@@ -1538,12 +1538,16 @@ fn test_freebsd(target: &str) {
1538
1538
// Just pass all these through, no need for a "struct" prefix
1539
1539
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty. to_string ( ) ,
1540
1540
1541
+ // FIXME: https://github.com/rust-lang/libc/issues/1273
1541
1542
"sighandler_t" => "sig_t" . to_string ( ) ,
1542
1543
1543
1544
t if is_union => format ! ( "union {}" , t) ,
1544
1545
1545
1546
t if t. ends_with ( "_t" ) => t. to_string ( ) ,
1546
1547
1548
+ // sigval is a struct in Rust, but a union in C:
1549
+ "sigval" => format ! ( "union sigval" ) ,
1550
+
1547
1551
// put `struct` in front of all structs:.
1548
1552
t if is_struct => format ! ( "struct {}" , t) ,
1549
1553
@@ -1565,52 +1569,27 @@ fn test_freebsd(target: &str) {
1565
1569
}
1566
1570
} ) ;
1567
1571
1568
- cfg. skip_struct ( move |ty| {
1569
- match ty {
1570
- // This is actually a union, not a struct
1571
- // FIXME: still required?
1572
- "sigval" => true ,
1573
-
1574
- _ => false ,
1575
- }
1576
- } ) ;
1577
-
1578
- cfg. skip_signededness ( move |c| {
1579
- match c {
1580
- // FIXME: still required?
1581
- "LARGE_INTEGER" | "float" | "double" => true ,
1582
- // FIXME: still required?
1583
- n if n. starts_with ( "pthread" ) => true ,
1584
- // sem_t is a struct or pointer
1585
- // FIXME: still required?
1586
- "sem_t" => true ,
1587
- // mqd_t is a pointer on FreeBSD
1588
- // FIXME: still required?
1589
- "mqd_t" => true ,
1590
-
1591
- _ => false ,
1592
- }
1593
- } ) ;
1594
-
1595
1572
cfg. skip_const ( move |name| {
1596
1573
match name {
1597
- // FIXME: still required?
1598
- "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true , // sighandler_t weirdness
1599
-
1600
1574
// These constants were introduced in FreeBSD 12:
1601
- "SF_USER_READAHEAD" |
1602
- "EVFILT_EMPTY" |
1603
- "SO_REUSEPORT_LB" |
1604
- "IP_ORIGDSTADDR" |
1605
- "IP_RECVORIGDSTADDR" |
1606
- "IPV6_ORIGDSTADDR" |
1607
- "IPV6_RECVORIGDSTADDR"
1608
- if Some ( 12 ) != freebsd_ver => true ,
1575
+ "SF_USER_READAHEAD"
1576
+ | "EVFILT_EMPTY"
1577
+ | "SO_REUSEPORT_LB"
1578
+ | "IP_ORIGDSTADDR"
1579
+ | "IP_RECVORIGDSTADDR"
1580
+ | "IPV6_ORIGDSTADDR"
1581
+ | "IPV6_RECVORIGDSTADDR"
1582
+ if Some ( 12 ) != freebsd_ver =>
1583
+ {
1584
+ true
1585
+ }
1609
1586
1587
+ // FIXME: There are deprecated - remove in a couple of releases.
1610
1588
// These constants were removed in FreeBSD 11 (svn r273250) but will
1611
1589
// still be accepted and ignored at runtime.
1612
- "MAP_RENAME" | "MAP_NORESERVE" => true ,
1590
+ "MAP_RENAME" | "MAP_NORESERVE" if Some ( 10 ) != freebsd_ver => true ,
1613
1591
1592
+ // FIXME: There are deprecated - remove in a couple of releases.
1614
1593
// These constants were removed in FreeBSD 11 (svn r262489),
1615
1594
// and they've never had any legitimate use outside of the
1616
1595
// base system anyway.
@@ -1624,64 +1603,40 @@ fn test_freebsd(target: &str) {
1624
1603
cfg. skip_fn ( move |name| {
1625
1604
// skip those that are manually verified
1626
1605
match name {
1627
- // FIXME: still required?
1628
- "execv" | // crazy stuff with const/mut
1629
- "execve" |
1630
- "execvp" |
1631
- "execvpe" |
1632
- "fexecve" => true ,
1606
+ // FIXME: https://github.com/rust-lang/libc/issues/1272
1607
+ "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true ,
1633
1608
1634
1609
// The `uname` function in freebsd is now an inline wrapper that
1635
1610
// delegates to another, but the symbol still exists, so don't check
1636
1611
// the symbol.
1637
1612
"uname" => true ,
1638
1613
1639
- // aio_waitcomplete's return type changed between FreeBSD 10 and 11.
1640
- // FIXME: still required?
1641
- "aio_waitcomplete" => true ,
1642
-
1643
- // lio_listio confuses the checker, probably because one of its
1644
- // arguments is an array
1645
- // FIXME: still required?
1614
+ // FIXME: Our API is unsound. The Rust API allows aliasing
1615
+ // pointers, but the C API requires pointers not to alias.
1616
+ // We should probably be at least using `&`/`&mut` here, see:
1617
+ // https://github.com/gnzlbg/ctest/issues/68
1646
1618
"lio_listio" => true ,
1647
1619
1648
1620
_ => false ,
1649
1621
}
1650
1622
} ) ;
1651
1623
1652
- cfg. skip_field_type ( move |struct_, field| {
1653
- // This is a weird union, don't check the type.
1654
- // FIXME: still required?
1655
- ( struct_ == "ifaddrs" && field == "ifa_ifu" ) ||
1656
- // FIXME: still required?
1657
- // sighandler_t type is super weird
1658
- ( struct_ == "sigaction" && field == "sa_sigaction" ) ||
1659
- // FIXME: still required?
1660
- // sigval is actually a union, but we pretend it's a struct
1661
- ( struct_ == "sigevent" && field == "sigev_value" ) ||
1662
- // aio_buf is "volatile void*" and Rust doesn't understand volatile
1663
- // FIXME: still required?
1664
- ( struct_ == "aiocb" && field == "aio_buf" ) ||
1665
- // stack_t.ss_sp's type changed from FreeBSD 10 to 11 in svn r294930
1666
- // FIXME: still required?
1667
- ( struct_ == "stack_t" && field == "ss_sp" )
1624
+ cfg. volatile_item ( |i| {
1625
+ use ctest:: VolatileItemKind :: * ;
1626
+ match i {
1627
+ // aio_buf is a volatile void** but since we cannot express that in
1628
+ // Rust types, we have to explicitly tell the checker about it here:
1629
+ StructField ( ref n, ref f) if n == "aiocb" && f == "aio_buf" => {
1630
+ true
1631
+ }
1632
+ _ => false ,
1633
+ }
1668
1634
} ) ;
1669
1635
1670
1636
cfg. skip_field ( move |struct_, field| {
1671
- // this is actually a union on linux, so we can't represent it well and
1672
- // just insert some padding.
1673
- // FIXME: still required?
1674
- ( struct_ == "siginfo_t" && field == "_pad" ) ||
1675
- // sigev_notify_thread_id is actually part of a sigev_un union
1676
- // FIXME: still required?
1677
- ( struct_ == "sigevent" && field == "sigev_notify_thread_id" ) ||
1678
- // signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet.
1679
- // FIXME: still required?
1680
- ( struct_ == "signalfd_siginfo" && ( field == "ssi_addr_lsb" ||
1681
- field == "_pad2" ||
1682
- field == "ssi_syscall" ||
1683
- field == "ssi_call_addr" ||
1684
- field == "ssi_arch" ) )
1637
+ // FIXME: `sa_sigaction` has type `sighandler_t` but that type is
1638
+ // incorrect, see: https://github.com/rust-lang/libc/issues/1359
1639
+ ( struct_ == "sigaction" && field == "sa_sigaction" )
1685
1640
} ) ;
1686
1641
1687
1642
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
0 commit comments