diff --git a/libc-test/semver/illumos.txt b/libc-test/semver/illumos.txt index 64c25d4b4f969..df91859b46655 100644 --- a/libc-test/semver/illumos.txt +++ b/libc-test/semver/illumos.txt @@ -12,3 +12,4 @@ pthread_attr_get_np pthread_attr_getstackaddr pthread_attr_setstack ptsname_r +syncfs diff --git a/libc-test/semver/wasi-p2.txt b/libc-test/semver/wasi-p2.txt index bb79dfd0dc1e8..c2bb8ce791c58 100644 --- a/libc-test/semver/wasi-p2.txt +++ b/libc-test/semver/wasi-p2.txt @@ -11,30 +11,42 @@ sockaddr_storage addrinfo ip_mreq ipv6_mreq +linger SHUT_RD SHUT_WR SHUT_RDWR MSG_NOSIGNAL MSG_PEEK SO_REUSEADDR +SO_TYPE SO_ERROR SO_BROADCAST +SO_SNDBUF +SO_RCVBUF +SO_KEEPALIVE SO_LINGER +SO_ACCEPTCONN +SO_PROTOCOL +SO_DOMAIN SO_RCVTIMEO SO_SNDTIMEO SOCK_DGRAM SOCK_STREAM +SOCK_NONBLOCK SOL_SOCKET +AF_UNSPEC AF_INET AF_INET6 IPPROTO_IP IPPROTO_TCP +IPPROTO_UDP IPPROTO_IPV6 IP_TTL IP_MULTICAST_TTL IP_MULTICAST_LOOP IP_ADD_MEMBERSHIP IP_DROP_MEMBERSHIP +IPV6_UNICAST_HOPS IPV6_MULTICAST_LOOP IPV6_JOIN_GROUP IPV6_LEAVE_GROUP @@ -42,12 +54,16 @@ IPV6_V6ONLY IPV6_ADD_MEMBERSHIP IPV6_DROP_MEMBERSHIP TCP_NODELAY +TCP_KEEPIDLE +TCP_KEEPINTVL +TCP_KEEPCNT EAI_SYSTEM socket connect bind listen accept +accept4 getsockname getpeername sendto diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index ad422fe718349..ec22469a31693 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -482,7 +482,7 @@ s! { pub struct stat64 { pub st_fstype: ::c_int, - pub st_fsid: __fsid_t, + pub st_dev: __fsid_t, /* Actually st_fsid */ pub st_ino: __ino64_t, pub st_gen: ::c_uint, pub st_rdev: __dev_t, @@ -873,12 +873,11 @@ s! { } pub struct utsname { - pub sysname: [::c_char; 65], - pub nodename: [::c_char; 65], - pub release: [::c_char; 65], - pub version: [::c_char; 65], - pub machine: [::c_char; 65], - pub domainname: [::c_char; 65] + pub sysname: [::c_char; _UTSNAME_LENGTH], + pub nodename: [::c_char; _UTSNAME_LENGTH], + pub release: [::c_char; _UTSNAME_LENGTH], + pub version: [::c_char; _UTSNAME_LENGTH], + pub machine: [::c_char; _UTSNAME_LENGTH], } pub struct rlimit64 { @@ -3437,6 +3436,9 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { }; pub const PTHREAD_STACK_MIN: ::size_t = 0; +// Non-public helper constants +const _UTSNAME_LENGTH: usize = 1024; + const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) diff --git a/src/unix/newlib/rtems/mod.rs b/src/unix/newlib/rtems/mod.rs index 031754950e6c1..f2b7687fa491e 100644 --- a/src/unix/newlib/rtems/mod.rs +++ b/src/unix/newlib/rtems/mod.rs @@ -139,5 +139,7 @@ extern "C" { pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + pub fn arc4random_buf(buf: *mut core::ffi::c_void, nbytes: ::size_t); + pub fn setgroups(ngroups: ::c_int, grouplist: *const ::gid_t) -> ::c_int; } diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 614fd12eb07eb..9b0a692055e6a 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -112,4 +112,6 @@ extern "C" { pub fn getpagesizes2(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int; pub fn ptsname_r(fildes: ::c_int, name: *mut ::c_char, namelen: ::size_t) -> ::c_int; + + pub fn syncfs(fd: ::c_int) -> ::c_int; } diff --git a/src/wasi/p2.rs b/src/wasi/p2.rs index 3e8eb95fcd1a5..d6381be451389 100644 --- a/src/wasi/p2.rs +++ b/src/wasi/p2.rs @@ -62,6 +62,11 @@ s! { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: ::c_uint, } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const SHUT_RD: ::c_int = 1 << 0; @@ -72,22 +77,32 @@ pub const MSG_NOSIGNAL: ::c_int = 0x4000; pub const MSG_PEEK: ::c_int = 0x0002; pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; pub const SO_ERROR: ::c_int = 4; pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; pub const SO_LINGER: ::c_int = 13; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; pub const SO_RCVTIMEO: ::c_int = 66; pub const SO_SNDTIMEO: ::c_int = 67; pub const SOCK_DGRAM: ::c_int = 5; pub const SOCK_STREAM: ::c_int = 6; +pub const SOCK_NONBLOCK: ::c_int = 0x00004000; pub const SOL_SOCKET: ::c_int = 0x7fffffff; +pub const AF_UNSPEC: ::c_int = 0; pub const AF_INET: ::c_int = 1; pub const AF_INET6: ::c_int = 2; pub const IPPROTO_IP: ::c_int = 0; pub const IPPROTO_TCP: ::c_int = 6; +pub const IPPROTO_UDP: ::c_int = 17; pub const IPPROTO_IPV6: ::c_int = 41; pub const IP_TTL: ::c_int = 2; @@ -96,6 +111,7 @@ pub const IP_MULTICAST_LOOP: ::c_int = 34; pub const IP_ADD_MEMBERSHIP: ::c_int = 35; pub const IP_DROP_MEMBERSHIP: ::c_int = 36; +pub const IPV6_UNICAST_HOPS: ::c_int = 16; pub const IPV6_MULTICAST_LOOP: ::c_int = 19; pub const IPV6_JOIN_GROUP: ::c_int = 20; pub const IPV6_LEAVE_GROUP: ::c_int = 21; @@ -105,6 +121,9 @@ pub const IPV6_ADD_MEMBERSHIP: ::c_int = IPV6_JOIN_GROUP; pub const IPV6_DROP_MEMBERSHIP: ::c_int = IPV6_LEAVE_GROUP; pub const TCP_NODELAY: ::c_int = 1; +pub const TCP_KEEPIDLE: ::c_int = 4; +pub const TCP_KEEPINTVL: ::c_int = 5; +pub const TCP_KEEPCNT: ::c_int = 6; pub const EAI_SYSTEM: ::c_int = -11; @@ -114,6 +133,12 @@ extern "C" { pub fn bind(socket: ::c_int, addr: *const sockaddr, addrlen: socklen_t) -> ::c_int; pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; pub fn accept(socket: ::c_int, addr: *mut sockaddr, addrlen: *mut socklen_t) -> ::c_int; + pub fn accept4( + socket: ::c_int, + addr: *mut sockaddr, + addrlen: *mut socklen_t, + flags: ::c_int, + ) -> ::c_int; pub fn getsockname(socket: ::c_int, addr: *mut sockaddr, addrlen: *mut socklen_t) -> ::c_int; pub fn getpeername(socket: ::c_int, addr: *mut sockaddr, addrlen: *mut socklen_t) -> ::c_int;