Skip to content

Commit cfbc120

Browse files
committed
Fix the definition of several BPF related ioctls on 32-bit FreeBSD
https://github.com/freebsd/freebsd-src/blob/main/sys/net/bpf.h
1 parent 60cf16d commit cfbc120

File tree

9 files changed

+31
-5
lines changed

9 files changed

+31
-5
lines changed

src/unix/bsd/freebsdlike/freebsd/aarch64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ cfg_if! {
133133
}
134134
}
135135

136+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
137+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
136138
pub const MAP_32BIT: ::c_int = 0x00080000;
137139
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
138140
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

src/unix/bsd/freebsdlike/freebsd/arm.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ cfg_if! {
5050
}
5151

5252
pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
53+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
54+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
5355
pub const MAP_32BIT: ::c_int = 0x00080000;
5456
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
5557
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3145,7 +3145,13 @@ pub const H4DISC: ::c_int = 0x7;
31453145

31463146
pub const VM_TOTAL: ::c_int = 1;
31473147

3148-
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
3148+
cfg_if! {
3149+
if #[cfg(target_pointer_width = "64")] {
3150+
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
3151+
} else {
3152+
pub const BIOCSETFNR: ::c_ulong = 0x80084282;
3153+
}
3154+
}
31493155

31503156
pub const FIODGNAME: ::c_ulong = 0x80106678;
31513157
pub const FIONWRITE: ::c_ulong = 0x40046677;

src/unix/bsd/freebsdlike/freebsd/powerpc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ cfg_if! {
6969
}
7070

7171
pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
72+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
73+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
7274
pub const MAP_32BIT: ::c_int = 0x00080000;
7375
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
7476
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

src/unix/bsd/freebsdlike/freebsd/powerpc64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ cfg_if! {
6969
}
7070

7171
pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
72+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
73+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
7274
pub const MAP_32BIT: ::c_int = 0x00080000;
7375
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
7476
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

src/unix/bsd/freebsdlike/freebsd/riscv64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ cfg_if! {
141141
}
142142
}
143143

144+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
145+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
144146
pub const MAP_32BIT: ::c_int = 0x00080000;
145147
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
146148
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

src/unix/bsd/freebsdlike/freebsd/x86.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,7 @@ cfg_if! {
156156

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

159+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d;
160+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e;
159161
pub const KINFO_FILE_SIZE: ::c_int = 1392;
160162
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;

src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ cfg_if! {
220220

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

223+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
224+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
225+
223226
pub const MAP_32BIT: ::c_int = 0x00080000;
224227
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
225228

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,10 +1278,15 @@ pub const BIOCSRSIG: ::c_ulong = 0x80044273;
12781278
pub const BIOCSDLT: ::c_ulong = 0x80044278;
12791279
pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
12801280
pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
1281-
pub const BIOCSETF: ::c_ulong = 0x80104267;
1282-
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
1283-
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
1284-
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
1281+
cfg_if! {
1282+
if #[cfg(target_pointer_width = "64")] {
1283+
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
1284+
pub const BIOCSETF: ::c_ulong = 0x80104267;
1285+
} else if #[cfg(target_pointer_width = "32")] {
1286+
pub const BIOCGDLTLIST: ::c_ulong = 0xc0084279;
1287+
pub const BIOCSETF: ::c_ulong = 0x80084267;
1288+
}
1289+
}
12851290

12861291
pub const FIODTYPE: ::c_ulong = 0x4004667a;
12871292
pub const FIOGETLBA: ::c_ulong = 0x40046679;

0 commit comments

Comments
 (0)