Skip to content

Commit edb6412

Browse files
asomerstgross35
authored andcommitted
Fix the definition of several BPF related ioctls on 32-bit FreeBSD
https://github.com/freebsd/freebsd-src/blob/main/sys/net/bpf.h (backport <#3948>) (cherry picked from commit cfbc120)
1 parent d56110e commit edb6412

File tree

9 files changed

+32
-5
lines changed

9 files changed

+32
-5
lines changed

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

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

145+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
146+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
145147
pub const MAP_32BIT: ::c_int = 0x00080000;
146148
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
147149
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
@@ -60,6 +60,8 @@ cfg_if! {
6060
}
6161
}
6262

63+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
64+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
6365
pub const MAP_32BIT: ::c_int = 0x00080000;
6466
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
6567
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
@@ -3212,7 +3212,13 @@ pub const H4DISC: ::c_int = 0x7;
32123212

32133213
pub const VM_TOTAL: ::c_int = 1;
32143214

3215-
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
3215+
cfg_if! {
3216+
if #[cfg(target_pointer_width = "64")] {
3217+
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
3218+
} else {
3219+
pub const BIOCSETFNR: ::c_ulong = 0x80084282;
3220+
}
3221+
}
32163222

32173223
pub const FIODGNAME: ::c_ulong = 0x80106678;
32183224
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
@@ -83,6 +83,8 @@ cfg_if! {
8383
}
8484
}
8585

86+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
87+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
8688
pub const MAP_32BIT: ::c_int = 0x00080000;
8789
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
8890
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
@@ -83,6 +83,8 @@ cfg_if! {
8383
}
8484
}
8585

86+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
87+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
8688
pub const MAP_32BIT: ::c_int = 0x00080000;
8789
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
8890
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
@@ -150,6 +150,8 @@ cfg_if! {
150150
}
151151
}
152152

153+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
154+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
153155
pub const MAP_32BIT: ::c_int = 0x00080000;
154156
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
155157
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
@@ -170,5 +170,7 @@ cfg_if! {
170170

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

173+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d;
174+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e;
173175
pub const KINFO_FILE_SIZE: ::c_int = 1392;
174176
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ cfg_if! {
249249
pub const _ALIGNBYTES: usize = 8 - 1;
250250
}
251251
}
252+
253+
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
254+
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
255+
252256
pub const MAP_32BIT: ::c_int = 0x00080000;
253257
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
254258

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,15 @@ pub const BIOCSRSIG: ::c_ulong = 0x80044273;
13051305
pub const BIOCSDLT: ::c_ulong = 0x80044278;
13061306
pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
13071307
pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
1308-
pub const BIOCSETF: ::c_ulong = 0x80104267;
1309-
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
1310-
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
1311-
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
1308+
cfg_if! {
1309+
if #[cfg(target_pointer_width = "64")] {
1310+
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
1311+
pub const BIOCSETF: ::c_ulong = 0x80104267;
1312+
} else if #[cfg(target_pointer_width = "32")] {
1313+
pub const BIOCGDLTLIST: ::c_ulong = 0xc0084279;
1314+
pub const BIOCSETF: ::c_ulong = 0x80084267;
1315+
}
1316+
}
13121317

13131318
pub const FIODTYPE: ::c_ulong = 0x4004667a;
13141319
pub const FIOGETLBA: ::c_ulong = 0x40046679;

0 commit comments

Comments
 (0)