Skip to content

Commit

Permalink
Fix the definition of several BPF related ioctls on 32-bit FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed Oct 15, 2024
1 parent 60cf16d commit cfbc120
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ cfg_if! {
}
}

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ cfg_if! {
}

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
8 changes: 7 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3145,7 +3145,13 @@ pub const H4DISC: ::c_int = 0x7;

pub const VM_TOTAL: ::c_int = 1;

pub const BIOCSETFNR: ::c_ulong = 0x80104282;
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
} else {
pub const BIOCSETFNR: ::c_ulong = 0x80084282;
}
}

pub const FIODGNAME: ::c_ulong = 0x80106678;
pub const FIONWRITE: ::c_ulong = 0x40046677;
Expand Down
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ cfg_if! {
}

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ cfg_if! {
}

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/riscv64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ cfg_if! {
}
}

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,7 @@ cfg_if! {

pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e;
pub const KINFO_FILE_SIZE: ::c_int = 1392;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
3 changes: 3 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ cfg_if! {

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;

pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

Expand Down
13 changes: 9 additions & 4 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,10 +1278,15 @@ pub const BIOCSRSIG: ::c_ulong = 0x80044273;
pub const BIOCSDLT: ::c_ulong = 0x80044278;
pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
pub const BIOCSETF: ::c_ulong = 0x80104267;
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
pub const BIOCSETF: ::c_ulong = 0x80104267;
} else if #[cfg(target_pointer_width = "32")] {
pub const BIOCGDLTLIST: ::c_ulong = 0xc0084279;
pub const BIOCSETF: ::c_ulong = 0x80084267;
}
}

pub const FIODTYPE: ::c_ulong = 0x4004667a;
pub const FIOGETLBA: ::c_ulong = 0x40046679;
Expand Down

0 comments on commit cfbc120

Please sign in to comment.