Skip to content

Commit

Permalink
Add forgotten SO_*_NEW values to powerpc, mips and arm
Browse files Browse the repository at this point in the history
The _NEW defines are not available in musl and ohos.
  • Loading branch information
snogge committed Jan 27, 2025
1 parent e3e1daa commit 57ffa6c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
14 changes: 13 additions & 1 deletion src/unix/linux_like/linux/arch/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,24 @@ const SO_TIMESTAMPING_OLD: c_int = 37;
cfg_if! {
if #[cfg(all(
linux_time_bits64,
any(target_arch = "arm", target_arch = "x86")
any(target_arch = "arm", target_arch = "x86"),
not(any(target_env = "musl", target_env = "ohos"))
))] {
pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW;
pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW;
pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW;
pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW;
pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW;
} else if #[cfg(all(
linux_time_bits64,
any(target_arch = "arm", target_arch = "x86"),
any(target_env = "musl", target_env = "ohos")
))] {
pub const SO_TIMESTAMP: c_int = 63;
pub const SO_TIMESTAMPNS: c_int = 64;
pub const SO_TIMESTAMPING: c_int = 65;
pub const SO_RCVTIMEO: c_int = 66;
pub const SO_SNDTIMEO: c_int = 67;
} else {
pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD;
pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD;
Expand Down Expand Up @@ -114,6 +125,7 @@ cfg_if! {
any(
target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm",
target_arch = "aarch64",
target_arch = "csky",
target_arch = "loongarch64"
Expand Down
5 changes: 5 additions & 0 deletions src/unix/linux_like/linux/arch/mips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ pub const SO_BINDTOIFINDEX: c_int = 62;
// but CI haven't support them yet.
// Some related consts could be found in b32.rs and b64.rs
const SO_TIMESTAMP_OLD: c_int = 29;
const SO_RCVTIMEO_NEW: c_int = 66;
const SO_SNDTIMEO_NEW: c_int = 67;
const SO_TIMESTAMPNS_OLD: c_int = 35;
const SO_TIMESTAMPING_OLD: c_int = 37;
const SO_TIMESTAMP_NEW: c_int = 63;
const SO_TIMESTAMPNS_NEW: c_int = 64;
const SO_TIMESTAMPING_NEW: c_int = 65;
cfg_if! {
if #[cfg(linux_time_bits64)] {
pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW;
Expand Down
10 changes: 5 additions & 5 deletions src/unix/linux_like/linux/arch/powerpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ pub const SO_ZEROCOPY: c_int = 60;
pub const SO_TXTIME: c_int = 61;
pub const SCM_TXTIME: c_int = SO_TXTIME;
pub const SO_BINDTOIFINDEX: c_int = 62;
// pub const SO_TIMESTAMP_NEW: c_int = 63;
// pub const SO_TIMESTAMPNS_NEW: c_int = 64;
// pub const SO_TIMESTAMPING_NEW: c_int = 65;
// pub const SO_RCVTIMEO_NEW: c_int = 66;
// pub const SO_SNDTIMEO_NEW: c_int = 67;
const SO_TIMESTAMP_NEW: c_int = 63;
const SO_TIMESTAMPNS_NEW: c_int = 64;
const SO_TIMESTAMPING_NEW: c_int = 65;
const SO_RCVTIMEO_NEW: c_int = 66;
const SO_SNDTIMEO_NEW: c_int = 67;
// pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
// pub const SO_PREFER_BUSY_POLL: c_int = 69;
// pub const SO_BUSY_POLL_BUDGET: c_int = 70;
Expand Down

0 comments on commit 57ffa6c

Please sign in to comment.