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 authored and tgross35 committed Nov 7, 2024
1 parent 3ad3729 commit d992140
Show file tree
Hide file tree
Showing 9 changed files with 32 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 @@ -142,6 +142,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 @@ -60,6 +60,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;
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 @@ -3212,7 +3212,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 @@ -83,6 +83,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 = 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 @@ -83,6 +83,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 = 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 @@ -150,6 +150,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 @@ -169,5 +169,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;
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ cfg_if! {
pub const _ALIGNBYTES: usize = 8 - 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 @@ -1305,10 +1305,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 d992140

Please sign in to comment.