Skip to content

Commit acb0c19

Browse files
authored
Merge pull request #4020 from tgross35/backport-collard-greens
[0.2] Backports
2 parents d435e9b + 33a772c commit acb0c19

File tree

12 files changed

+202
-1
lines changed

12 files changed

+202
-1
lines changed

libc-test/build.rs

+7
Original file line numberDiff line numberDiff line change
@@ -2764,6 +2764,13 @@ fn test_freebsd(target: &str) {
27642764
_ => false,
27652765
}
27662766
});
2767+
if target.contains("arm") {
2768+
cfg.skip_roundtrip(move |s| match s {
2769+
// Can't return an array from a C function.
2770+
"__gregset_t" => true,
2771+
_ => false,
2772+
});
2773+
}
27672774

27682775
cfg.generate("../src/lib.rs", "main.rs");
27692776
}

libc-test/semver/freebsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ CLOCK_UPTIME
264264
CLOCK_UPTIME_FAST
265265
CLOCK_UPTIME_PRECISE
266266
CLOCK_VIRTUAL
267+
CLOSE_RANGE_CLOEXEC
267268
CMGROUP_MAX
268269
CMSG_DATA
269270
CMSG_FIRSTHDR

libc-test/semver/linux-gnu.txt

+2
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ TIME_WAIT
472472
TMPFS_MAGIC
473473
TMP_MAX
474474
TRACEFS_MAGIC
475+
TUNGETDEVNETNS
476+
TUNSETCARRIER
475477
UDF_SUPER_MAGIC
476478
UNAME26
477479
USBDEVICE_SUPER_MAGIC

libc-test/semver/linux.txt

+26
Original file line numberDiff line numberDiff line change
@@ -3247,6 +3247,32 @@ TP_STATUS_USER
32473247
TP_STATUS_VLAN_TPID_VALID
32483248
TP_STATUS_VLAN_VALID
32493249
TP_STATUS_WRONG_FORMAT
3250+
TUNATTACHFILTER
3251+
TUNDETACHFILTER
3252+
TUNGETFEATURES
3253+
TUNGETFILTER
3254+
TUNGETIFF
3255+
TUNGETSNDBUF
3256+
TUNGETVNETBE
3257+
TUNGETVNETHDRSZ
3258+
TUNGETVNETLE
3259+
TUNSETDEBUG
3260+
TUNSETFILTEREBPF
3261+
TUNSETGROUP
3262+
TUNSETIFF
3263+
TUNSETIFINDEX
3264+
TUNSETLINK
3265+
TUNSETNOCSUM
3266+
TUNSETOFFLOAD
3267+
TUNSETOWNER
3268+
TUNSETPERSIST
3269+
TUNSETQUEUE
3270+
TUNSETSNDBUF
3271+
TUNSETSTEERINGEBPF
3272+
TUNSETTXFILTER
3273+
TUNSETVNETBE
3274+
TUNSETVNETHDRSZ
3275+
TUNSETVNETLE
32503276
TUN_FLT_ALLMULTI
32513277
TUN_F_CSUM
32523278
TUN_F_TSO4

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub type __gregset_t = [::__greg_t; 17];
1212
s_no_extra_traits! {
1313
pub struct mcontext_t {
1414
pub __gregs: ::__gregset_t,
15-
pub mc_vfp_size: ::__size_t,
15+
pub mc_vfp_size: usize,
1616
pub mc_vfp_ptr: *mut ::c_void,
1717
pub mc_spare: [::c_uint; 33],
1818
}

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

+4
Original file line numberDiff line numberDiff line change
@@ -4968,6 +4968,10 @@ pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
49684968
pub const TFD_TIMER_ABSTIME: ::c_int = 0x01;
49694969
pub const TFD_TIMER_CANCEL_ON_SET: ::c_int = 0x02;
49704970

4971+
// sys/unistd.h
4972+
4973+
pub const CLOSE_RANGE_CLOEXEC: ::c_uint = 1 << 2;
4974+
49714975
cfg_if! {
49724976
if #[cfg(libc_const_extern_fn)] {
49734977
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {

src/unix/linux_like/linux/arch/generic/mod.rs

+34
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,34 @@ pub const BLKIOMIN: ::Ioctl = 0x1278;
210210
pub const BLKIOOPT: ::Ioctl = 0x1279;
211211
pub const BLKSSZGET: ::Ioctl = 0x1268;
212212
pub const BLKPBSZGET: ::Ioctl = 0x127B;
213+
// linux/if_tun.h
214+
pub const TUNSETNOCSUM: ::Ioctl = 0x400454c8;
215+
pub const TUNSETDEBUG: ::Ioctl = 0x400454c9;
216+
pub const TUNSETIFF: ::Ioctl = 0x400454ca;
217+
pub const TUNSETPERSIST: ::Ioctl = 0x400454cb;
218+
pub const TUNSETOWNER: ::Ioctl = 0x400454cc;
219+
pub const TUNSETLINK: ::Ioctl = 0x400454cd;
220+
pub const TUNSETGROUP: ::Ioctl = 0x400454ce;
221+
pub const TUNGETFEATURES: ::Ioctl = 0x800454cf;
222+
pub const TUNSETOFFLOAD: ::Ioctl = 0x400454d0;
223+
pub const TUNSETTXFILTER: ::Ioctl = 0x400454d1;
224+
pub const TUNGETIFF: ::Ioctl = 0x800454d2;
225+
pub const TUNGETSNDBUF: ::Ioctl = 0x800454d3;
226+
pub const TUNSETSNDBUF: ::Ioctl = 0x400454d4;
227+
pub const TUNGETVNETHDRSZ: ::Ioctl = 0x800454d7;
228+
pub const TUNSETVNETHDRSZ: ::Ioctl = 0x400454d8;
229+
pub const TUNSETQUEUE: ::Ioctl = 0x400454d9;
230+
pub const TUNSETIFINDEX: ::Ioctl = 0x400454da;
231+
pub const TUNSETVNETLE: ::Ioctl = 0x400454dc;
232+
pub const TUNGETVNETLE: ::Ioctl = 0x800454dd;
233+
/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on
234+
* little-endian hosts. Not all kernel configurations support them, but all
235+
* configurations that support SET also support GET.
236+
*/
237+
pub const TUNSETVNETBE: ::Ioctl = 0x400454de;
238+
pub const TUNGETVNETBE: ::Ioctl = 0x800454df;
239+
pub const TUNSETSTEERINGEBPF: ::Ioctl = 0x800454e0;
240+
pub const TUNSETFILTEREBPF: ::Ioctl = 0x800454e1;
213241

214242
cfg_if! {
215243
// Those type are constructed using the _IOC macro
@@ -227,6 +255,9 @@ cfg_if! {
227255
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x40046602;
228256
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x80047601;
229257
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x40047602;
258+
pub const TUNATTACHFILTER: ::Ioctl = 0x400854d5;
259+
pub const TUNDETACHFILTER: ::Ioctl = 0x400854d6;
260+
pub const TUNGETFILTER: ::Ioctl = 0x800854db;
230261
} else if #[cfg(any(target_arch = "x86_64",
231262
target_arch = "riscv64",
232263
target_arch = "aarch64",
@@ -240,6 +271,9 @@ cfg_if! {
240271
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x40046602;
241272
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x80047601;
242273
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x40047602;
274+
pub const TUNATTACHFILTER: ::Ioctl = 0x401054d5;
275+
pub const TUNDETACHFILTER: ::Ioctl = 0x401054d6;
276+
pub const TUNGETFILTER: ::Ioctl = 0x801054db;
243277
}
244278
}
245279

src/unix/linux_like/linux/arch/mips/mod.rs

+34
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,34 @@ pub const BLKIOMIN: ::Ioctl = 0x20001278;
192192
pub const BLKIOOPT: ::Ioctl = 0x20001279;
193193
pub const BLKSSZGET: ::Ioctl = 0x20001268;
194194
pub const BLKPBSZGET: ::Ioctl = 0x2000127B;
195+
// linux/if_tun.h
196+
pub const TUNSETNOCSUM: ::Ioctl = 0x800454c8;
197+
pub const TUNSETDEBUG: ::Ioctl = 0x800454c9;
198+
pub const TUNSETIFF: ::Ioctl = 0x800454ca;
199+
pub const TUNSETPERSIST: ::Ioctl = 0x800454cb;
200+
pub const TUNSETOWNER: ::Ioctl = 0x800454cc;
201+
pub const TUNSETLINK: ::Ioctl = 0x800454cd;
202+
pub const TUNSETGROUP: ::Ioctl = 0x800454ce;
203+
pub const TUNGETFEATURES: ::Ioctl = 0x400454cf;
204+
pub const TUNSETOFFLOAD: ::Ioctl = 0x800454d0;
205+
pub const TUNSETTXFILTER: ::Ioctl = 0x800454d1;
206+
pub const TUNGETIFF: ::Ioctl = 0x400454d2;
207+
pub const TUNGETSNDBUF: ::Ioctl = 0x400454d3;
208+
pub const TUNSETSNDBUF: ::Ioctl = 0x800454d4;
209+
pub const TUNGETVNETHDRSZ: ::Ioctl = 0x400454d7;
210+
pub const TUNSETVNETHDRSZ: ::Ioctl = 0x800454d8;
211+
pub const TUNSETQUEUE: ::Ioctl = 0x800454d9;
212+
pub const TUNSETIFINDEX: ::Ioctl = 0x800454da;
213+
pub const TUNSETVNETLE: ::Ioctl = 0x800454dc;
214+
pub const TUNGETVNETLE: ::Ioctl = 0x400454dd;
215+
/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on
216+
* little-endian hosts. Not all kernel configurations support them, but all
217+
* configurations that support SET also support GET.
218+
*/
219+
pub const TUNSETVNETBE: ::Ioctl = 0x800454de;
220+
pub const TUNGETVNETBE: ::Ioctl = 0x400454df;
221+
pub const TUNSETSTEERINGEBPF: ::Ioctl = 0x400454e0;
222+
pub const TUNSETFILTEREBPF: ::Ioctl = 0x400454e1;
195223

196224
cfg_if! {
197225
// Those type are constructed using the _IOC macro
@@ -209,6 +237,9 @@ cfg_if! {
209237
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602;
210238
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601;
211239
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602;
240+
pub const TUNATTACHFILTER: ::Ioctl = 0x800854d5;
241+
pub const TUNDETACHFILTER: ::Ioctl = 0x800854d6;
242+
pub const TUNGETFILTER: ::Ioctl = 0x400854db;
212243
} else if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] {
213244
pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601;
214245
pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602;
@@ -218,6 +249,9 @@ cfg_if! {
218249
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602;
219250
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601;
220251
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602;
252+
pub const TUNATTACHFILTER: ::Ioctl = 0x801054d5;
253+
pub const TUNDETACHFILTER: ::Ioctl = 0x801054d6;
254+
pub const TUNGETFILTER: ::Ioctl = 0x401054db;
221255
}
222256
}
223257

src/unix/linux_like/linux/arch/powerpc/mod.rs

+34
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,34 @@ pub const BLKIOOPT: ::Ioctl = 0x20001279;
178178
pub const BLKSSZGET: ::Ioctl = 0x20001268;
179179
pub const BLKPBSZGET: ::Ioctl = 0x2000127B;
180180
//pub const FIOQSIZE: ::Ioctl = 0x40086680;
181+
// linux/if_tun.h
182+
pub const TUNSETNOCSUM: ::Ioctl = 0x800454c8;
183+
pub const TUNSETDEBUG: ::Ioctl = 0x800454c9;
184+
pub const TUNSETIFF: ::Ioctl = 0x800454ca;
185+
pub const TUNSETPERSIST: ::Ioctl = 0x800454cb;
186+
pub const TUNSETOWNER: ::Ioctl = 0x800454cc;
187+
pub const TUNSETLINK: ::Ioctl = 0x800454cd;
188+
pub const TUNSETGROUP: ::Ioctl = 0x800454ce;
189+
pub const TUNGETFEATURES: ::Ioctl = 0x400454cf;
190+
pub const TUNSETOFFLOAD: ::Ioctl = 0x800454d0;
191+
pub const TUNSETTXFILTER: ::Ioctl = 0x800454d1;
192+
pub const TUNGETIFF: ::Ioctl = 0x400454d2;
193+
pub const TUNGETSNDBUF: ::Ioctl = 0x400454d3;
194+
pub const TUNSETSNDBUF: ::Ioctl = 0x800454d4;
195+
pub const TUNGETVNETHDRSZ: ::Ioctl = 0x400454d7;
196+
pub const TUNSETVNETHDRSZ: ::Ioctl = 0x800454d8;
197+
pub const TUNSETQUEUE: ::Ioctl = 0x800454d9;
198+
pub const TUNSETIFINDEX: ::Ioctl = 0x800454da;
199+
pub const TUNSETVNETLE: ::Ioctl = 0x800454dc;
200+
pub const TUNGETVNETLE: ::Ioctl = 0x400454dd;
201+
/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on
202+
* little-endian hosts. Not all kernel configurations support them, but all
203+
* configurations that support SET also support GET.
204+
*/
205+
pub const TUNSETVNETBE: ::Ioctl = 0x800454de;
206+
pub const TUNGETVNETBE: ::Ioctl = 0x400454df;
207+
pub const TUNSETSTEERINGEBPF: ::Ioctl = 0x400454e0;
208+
pub const TUNSETFILTEREBPF: ::Ioctl = 0x400454e1;
181209

182210
cfg_if! {
183211
// Those type are constructed using the _IOC macro
@@ -195,6 +223,9 @@ cfg_if! {
195223
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602;
196224
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601;
197225
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602;
226+
pub const TUNATTACHFILTER: ::Ioctl = 0x800854d5;
227+
pub const TUNDETACHFILTER: ::Ioctl = 0x800854d6;
228+
pub const TUNGETFILTER: ::Ioctl = 0x400854db;
198229
} else if #[cfg(target_arch = "powerpc64")] {
199230
pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601;
200231
pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602;
@@ -204,6 +235,9 @@ cfg_if! {
204235
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602;
205236
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601;
206237
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602;
238+
pub const TUNATTACHFILTER: ::Ioctl = 0x801054d5;
239+
pub const TUNDETACHFILTER: ::Ioctl = 0x801054d6;
240+
pub const TUNGETFILTER: ::Ioctl = 0x401054db;
207241
}
208242
}
209243

src/unix/linux_like/linux/arch/sparc/mod.rs

+35
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,35 @@ pub const BLKPBSZGET: ::Ioctl = 0x2000127B;
183183
//pub const TIOCGRS485: ::Ioctl = 0x40205441;
184184
//pub const TIOCSRS485: ::Ioctl = 0xc0205442;
185185

186+
// linux/if_tun.h
187+
pub const TUNSETNOCSUM: ::Ioctl = 0x800454c8;
188+
pub const TUNSETDEBUG: ::Ioctl = 0x800454c9;
189+
pub const TUNSETIFF: ::Ioctl = 0x800454ca;
190+
pub const TUNSETPERSIST: ::Ioctl = 0x800454cb;
191+
pub const TUNSETOWNER: ::Ioctl = 0x800454cc;
192+
pub const TUNSETLINK: ::Ioctl = 0x800454cd;
193+
pub const TUNSETGROUP: ::Ioctl = 0x800454ce;
194+
pub const TUNGETFEATURES: ::Ioctl = 0x400454cf;
195+
pub const TUNSETOFFLOAD: ::Ioctl = 0x800454d0;
196+
pub const TUNSETTXFILTER: ::Ioctl = 0x800454d1;
197+
pub const TUNGETIFF: ::Ioctl = 0x400454d2;
198+
pub const TUNGETSNDBUF: ::Ioctl = 0x400454d3;
199+
pub const TUNSETSNDBUF: ::Ioctl = 0x800454d4;
200+
pub const TUNGETVNETHDRSZ: ::Ioctl = 0x400454d7;
201+
pub const TUNSETVNETHDRSZ: ::Ioctl = 0x800454d8;
202+
pub const TUNSETQUEUE: ::Ioctl = 0x800454d9;
203+
pub const TUNSETIFINDEX: ::Ioctl = 0x800454da;
204+
pub const TUNSETVNETLE: ::Ioctl = 0x800454dc;
205+
pub const TUNGETVNETLE: ::Ioctl = 0x400454dd;
206+
/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on
207+
* little-endian hosts. Not all kernel configurations support them, but all
208+
* configurations that support SET also support GET.
209+
*/
210+
pub const TUNSETVNETBE: ::Ioctl = 0x800454de;
211+
pub const TUNGETVNETBE: ::Ioctl = 0x400454df;
212+
pub const TUNSETSTEERINGEBPF: ::Ioctl = 0x400454e0;
213+
pub const TUNSETFILTEREBPF: ::Ioctl = 0x400454e1;
214+
186215
pub const TIOCM_LE: ::c_int = 0x001;
187216
pub const TIOCM_DTR: ::c_int = 0x002;
188217
pub const TIOCM_RTS: ::c_int = 0x004;
@@ -246,6 +275,9 @@ cfg_if! {
246275
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602;
247276
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601;
248277
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602;
278+
pub const TUNATTACHFILTER: ::Ioctl = 0x800854d5;
279+
pub const TUNDETACHFILTER: ::Ioctl = 0x800854d6;
280+
pub const TUNGETFILTER: ::Ioctl = 0x400854db;
249281
} else if #[cfg(target_arch = "sparc64")] {
250282
pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601;
251283
pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602;
@@ -255,5 +287,8 @@ cfg_if! {
255287
pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602;
256288
pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601;
257289
pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602;
290+
pub const TUNATTACHFILTER: ::Ioctl = 0x801054d5;
291+
pub const TUNDETACHFILTER: ::Ioctl = 0x801054d6;
292+
pub const TUNGETFILTER: ::Ioctl = 0x401054db;
258293
}
259294
}

src/unix/linux_like/linux/gnu/mod.rs

+23
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,29 @@ pub const REG_EEND: ::c_int = 14;
12981298
pub const REG_ESIZE: ::c_int = 15;
12991299
pub const REG_ERPAREN: ::c_int = 16;
13001300

1301+
cfg_if! {
1302+
if #[cfg(any(target_arch = "x86",
1303+
target_arch = "x86_64",
1304+
target_arch = "arm",
1305+
target_arch = "aarch64",
1306+
target_arch = "loongarch64",
1307+
target_arch = "riscv64",
1308+
target_arch = "s390x"))] {
1309+
pub const TUNSETCARRIER: ::Ioctl = 0x400454e2;
1310+
pub const TUNGETDEVNETNS: ::Ioctl = 0x54e3;
1311+
} else if #[cfg(any(target_arch = "mips",
1312+
target_arch = "mips64",
1313+
target_arch = "powerpc",
1314+
target_arch = "powerpc64",
1315+
target_arch = "sparc",
1316+
target_arch = "sparc64"))] {
1317+
pub const TUNSETCARRIER: ::Ioctl = 0x800454e2;
1318+
pub const TUNGETDEVNETNS: ::Ioctl = 0x200054e3;
1319+
} else {
1320+
// Unknown target_arch
1321+
}
1322+
}
1323+
13011324
extern "C" {
13021325
pub fn fgetspent_r(
13031326
fp: *mut ::FILE,

src/unix/linux_like/linux/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,7 @@ pub const IFLA_INFO_SLAVE_KIND: ::c_ushort = 4;
21482148
pub const IFLA_INFO_SLAVE_DATA: ::c_ushort = 5;
21492149

21502150
// linux/if_tun.h
2151+
/* TUNSETIFF ifr flags */
21512152
pub const IFF_TUN: ::c_int = 0x0001;
21522153
pub const IFF_TAP: ::c_int = 0x0002;
21532154
pub const IFF_NAPI: ::c_int = 0x0010;

0 commit comments

Comments
 (0)