Skip to content

Commit 6db91d8

Browse files
committed
Skip items not available in FreeBSD10 in the libc-tests
1 parent efaabd8 commit 6db91d8

File tree

2 files changed

+60
-41
lines changed

2 files changed

+60
-41
lines changed

libc-test/build.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,15 @@ fn test_freebsd(target: &str) {
15831583
}
15841584
});
15851585

1586+
cfg.skip_type(move |ty| {
1587+
match ty {
1588+
// `mmsghdr` is not available in FreeBSD 10
1589+
"mmsghdr" if Some(10) == freebsd_ver => true,
1590+
1591+
_ => false,
1592+
}
1593+
});
1594+
15861595
cfg.skip_const(move |name| {
15871596
match name {
15881597
// These constants were introduced in FreeBSD 12:
@@ -1598,6 +1607,31 @@ fn test_freebsd(target: &str) {
15981607
true
15991608
}
16001609

1610+
// These constants were introduced in FreeBSD 11:
1611+
"SF_USER_READAHEAD"
1612+
| "SF_NOCACHE"
1613+
| "RLIMIT_KQUEUES"
1614+
| "RLIMIT_UMTXP"
1615+
| "EVFILT_PROCDESC"
1616+
| "EVFILT_SENDFILE"
1617+
| "EVFILT_EMPTY"
1618+
| "SO_REUSEPORT_LB"
1619+
| "TCP_CCALGOOPT"
1620+
| "TCP_PCAP_OUT"
1621+
| "TCP_PCAP_IN"
1622+
| "IP_BINDMULTI"
1623+
| "IP_ORIGDSTADDR "
1624+
| "IP_RECVORIGDSTADDR "
1625+
| "IPV6_ORIGDSTADDR"
1626+
| "IPV6_RECVORIGDSTADDR"
1627+
| "PD_CLOEXEC"
1628+
| "PD_ALLOWED_AT_FORK"
1629+
| "IP_RSS_LISTEN_BUCKET"
1630+
if Some(10) == freebsd_ver =>
1631+
{
1632+
true
1633+
}
1634+
16011635
// FIXME: This constant has a different value in FreeBSD 10:
16021636
"RLIM_NLIMITS" if Some(10) == freebsd_ver => true,
16031637

@@ -1622,6 +1656,13 @@ fn test_freebsd(target: &str) {
16221656
// FIXME: https://github.com/rust-lang/libc/issues/1272
16231657
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
16241658

1659+
// These functions were added in FreeBSD 11:
1660+
"fdatasync" | "aio_waitcomplete" | "mq_getfd_np"
1661+
if Some(10) == freebsd_ver =>
1662+
{
1663+
true
1664+
}
1665+
16251666
// The `uname` function in the `utsname.h` FreeBSD header is a C
16261667
// inline function (has no symbol) that calls the `__xuname` symbol.
16271668
// Therefore the function pointer comparison does not make sense for it.

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

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,7 @@ s! {
102102
pub ss_size: ::size_t,
103103
pub ss_flags: ::c_int,
104104
}
105-
}
106105

107-
// FIXME: FreeBSD10 is only defined when building libstd
108-
// These types are not available in FreeBSD10 and
109-
// cfg'ing them out prevents them from being used from
110-
// libstd by accident.
111-
#[cfg(not(freebsd10))]
112-
s! {
113106
pub struct mmsghdr {
114107
pub msg_hdr: ::msghdr,
115108
pub msg_len: ::ssize_t,
@@ -314,33 +307,25 @@ cfg_if! {
314307
}
315308
}
316309

317-
// FIXME: FreeBSD10 is only defined when building libstd
318-
// These constants are not available in FreeBSD10 and
319-
// cfg'ing them out prevents them from being used from
320-
// libstd by accident.
321-
cfg_if! {
322-
if #[cfg(not(freebsd10))] {
323-
pub const SF_USER_READAHEAD: ::c_int = 0x00000008;
324-
pub const SF_NOCACHE: ::c_int = 0x00000010;
325-
pub const RLIMIT_KQUEUES: ::c_int = 13;
326-
pub const RLIMIT_UMTXP: ::c_int = 14;
327-
pub const EVFILT_PROCDESC: i16 = -8;
328-
pub const EVFILT_SENDFILE: i16 = -12;
329-
pub const EVFILT_EMPTY: i16 = -13;
330-
pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
331-
pub const TCP_CCALGOOPT: ::c_int = 65;
332-
pub const TCP_PCAP_OUT: ::c_int = 2048;
333-
pub const TCP_PCAP_IN: ::c_int = 4096;
334-
pub const IP_BINDMULTI: ::c_int = 25;
335-
pub const IP_ORIGDSTADDR : ::c_int = 27;
336-
pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR;
337-
pub const IPV6_ORIGDSTADDR: ::c_int = 72;
338-
pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
339-
pub const PD_CLOEXEC: ::c_int = 0x00000002;
340-
pub const PD_ALLOWED_AT_FORK: ::c_int = PD_DAEMON | PD_CLOEXEC;
341-
pub const IP_RSS_LISTEN_BUCKET: ::c_int = 26;
342-
}
343-
}
310+
pub const SF_USER_READAHEAD: ::c_int = 0x00000008;
311+
pub const SF_NOCACHE: ::c_int = 0x00000010;
312+
pub const RLIMIT_KQUEUES: ::c_int = 13;
313+
pub const RLIMIT_UMTXP: ::c_int = 14;
314+
pub const EVFILT_PROCDESC: i16 = -8;
315+
pub const EVFILT_SENDFILE: i16 = -12;
316+
pub const EVFILT_EMPTY: i16 = -13;
317+
pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
318+
pub const TCP_CCALGOOPT: ::c_int = 65;
319+
pub const TCP_PCAP_OUT: ::c_int = 2048;
320+
pub const TCP_PCAP_IN: ::c_int = 4096;
321+
pub const IP_BINDMULTI: ::c_int = 25;
322+
pub const IP_ORIGDSTADDR : ::c_int = 27;
323+
pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR;
324+
pub const IPV6_ORIGDSTADDR: ::c_int = 72;
325+
pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
326+
pub const PD_CLOEXEC: ::c_int = 0x00000002;
327+
pub const PD_ALLOWED_AT_FORK: ::c_int = PD_DAEMON | PD_CLOEXEC;
328+
pub const IP_RSS_LISTEN_BUCKET: ::c_int = 26;
344329

345330
pub const SIGEV_THREAD_ID: ::c_int = 4;
346331

@@ -1149,19 +1134,12 @@ f! {
11491134
}
11501135
}
11511136

1152-
// FIXME: FreeBSD10 is only defined when building libstd
1153-
// These functions are not available in FreeBSD10 and
1154-
// cfg'ing them out prevents them from being used from
1155-
// libstd by accident.
1156-
#[cfg(not(freebsd10))]
11571137
extern {
11581138
pub fn fdatasync(fd: ::c_int) -> ::c_int;
11591139
pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
11601140
timeout: *mut ::timespec) -> ::ssize_t;
11611141
pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int;
1162-
}
11631142

1164-
extern {
11651143
pub fn __error() -> *mut ::c_int;
11661144

11671145
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;

0 commit comments

Comments
 (0)