@@ -1457,6 +1457,7 @@ fn test_freebsd(target: &str) {
14571457 let freebsd_ver = which_freebsd ( ) ;
14581458
14591459 match freebsd_ver {
1460+ Some ( 10 ) => cfg. cfg ( "freebsd10" , None ) ,
14601461 Some ( 11 ) => cfg. cfg ( "freebsd11" , None ) ,
14611462 Some ( 12 ) => cfg. cfg ( "freebsd12" , None ) ,
14621463 Some ( 13 ) => cfg. cfg ( "freebsd13" , None ) ,
@@ -1466,7 +1467,10 @@ fn test_freebsd(target: &str) {
14661467 // Required for `getline`:
14671468 cfg. define ( "_WITH_GETLINE" , None ) ;
14681469 // Required for making freebsd11_stat available in the headers
1469- cfg. define ( "_WANT_FREEBSD11_STAT" , None ) ;
1470+ match freebsd_ver {
1471+ Some ( 10 ) => & mut cfg,
1472+ _ => cfg. define ( "_WANT_FREEBSD11_STAT" , None ) ,
1473+ } ;
14701474
14711475 headers ! { cfg:
14721476 "aio.h" ,
@@ -1594,6 +1598,34 @@ fn test_freebsd(target: &str) {
15941598 true
15951599 }
15961600
1601+ // These constants were introduced in FreeBSD 11:
1602+ "SF_USER_READAHEAD"
1603+ | "SF_NOCACHE"
1604+ | "RLIMIT_KQUEUES"
1605+ | "RLIMIT_UMTXP"
1606+ | "EVFILT_PROCDESC"
1607+ | "EVFILT_SENDFILE"
1608+ | "EVFILT_EMPTY"
1609+ | "SO_REUSEPORT_LB"
1610+ | "TCP_CCALGOOPT"
1611+ | "TCP_PCAP_OUT"
1612+ | "TCP_PCAP_IN"
1613+ | "IP_BINDMULTI"
1614+ | "IP_ORIGDSTADDR"
1615+ | "IP_RECVORIGDSTADDR"
1616+ | "IPV6_ORIGDSTADDR"
1617+ | "IPV6_RECVORIGDSTADDR"
1618+ | "PD_CLOEXEC"
1619+ | "PD_ALLOWED_AT_FORK"
1620+ | "IP_RSS_LISTEN_BUCKET"
1621+ if Some ( 10 ) == freebsd_ver =>
1622+ {
1623+ true
1624+ }
1625+
1626+ // FIXME: This constant has a different value in FreeBSD 10:
1627+ "RLIM_NLIMITS" if Some ( 10 ) == freebsd_ver => true ,
1628+
15971629 // FIXME: There are deprecated - remove in a couple of releases.
15981630 // These constants were removed in FreeBSD 11 (svn r273250) but will
15991631 // still be accepted and ignored at runtime.
@@ -1609,12 +1641,32 @@ fn test_freebsd(target: &str) {
16091641 }
16101642 } ) ;
16111643
1644+ cfg. skip_struct ( move |ty| {
1645+ match ty {
1646+ // `mmsghdr` is not available in FreeBSD 10
1647+ "mmsghdr" if Some ( 10 ) == freebsd_ver => true ,
1648+
1649+ _ => false ,
1650+ }
1651+ } ) ;
1652+
16121653 cfg. skip_fn ( move |name| {
16131654 // skip those that are manually verified
16141655 match name {
16151656 // FIXME: https://github.com/rust-lang/libc/issues/1272
16161657 "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true ,
16171658
1659+ // These functions were added in FreeBSD 11:
1660+ "fdatasync" | "mq_getfd_np" | "sendmmsg" | "recvmmsg"
1661+ if Some ( 10 ) == freebsd_ver =>
1662+ {
1663+ true
1664+ }
1665+
1666+ // This function changed its return type from `int` in FreeBSD10 to
1667+ // `ssize_t` in FreeBSD11:
1668+ "aio_waitcomplete" if Some ( 10 ) == freebsd_ver => true ,
1669+
16181670 // The `uname` function in the `utsname.h` FreeBSD header is a C
16191671 // inline function (has no symbol) that calls the `__xuname` symbol.
16201672 // Therefore the function pointer comparison does not make sense for it.
@@ -1630,6 +1682,14 @@ fn test_freebsd(target: &str) {
16301682 }
16311683 } ) ;
16321684
1685+ cfg. skip_signededness ( move |c| {
1686+ match c {
1687+ // FIXME: has a different sign in FreeBSD10
1688+ "blksize_t" if Some ( 10 ) == freebsd_ver => true ,
1689+ _ => false ,
1690+ }
1691+ } ) ;
1692+
16331693 cfg. volatile_item ( |i| {
16341694 use ctest:: VolatileItemKind :: * ;
16351695 match i {
@@ -1643,9 +1703,17 @@ fn test_freebsd(target: &str) {
16431703 } ) ;
16441704
16451705 cfg. skip_field ( move |struct_, field| {
1646- // FIXME: `sa_sigaction` has type `sighandler_t` but that type is
1647- // incorrect, see: https://github.com/rust-lang/libc/issues/1359
1648- ( struct_ == "sigaction" && field == "sa_sigaction" )
1706+ match ( struct_, field) {
1707+ // FIXME: `sa_sigaction` has type `sighandler_t` but that type is
1708+ // incorrect, see: https://github.com/rust-lang/libc/issues/1359
1709+ ( "sigaction" , "sa_sigaction" ) => true ,
1710+
1711+ // FIXME: in FreeBSD10 this field has type `char*` instead of
1712+ // `void*`:
1713+ ( "stack_t" , "ss_sp" ) if Some ( 10 ) == freebsd_ver => true ,
1714+
1715+ _ => false ,
1716+ }
16491717 } ) ;
16501718
16511719 cfg. skip_roundtrip ( move |s| match s {
@@ -2473,6 +2541,7 @@ fn which_freebsd() -> Option<i32> {
24732541 let stdout = String :: from_utf8 ( output. stdout ) . ok ( ) ?;
24742542
24752543 match & stdout {
2544+ s if s. starts_with ( "10" ) => Some ( 10 ) ,
24762545 s if s. starts_with ( "11" ) => Some ( 11 ) ,
24772546 s if s. starts_with ( "12" ) => Some ( 12 ) ,
24782547 s if s. starts_with ( "13" ) => Some ( 13 ) ,
0 commit comments