Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Backports #4005

Merged
merged 5 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/semver/illumos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pthread_attr_get_np
pthread_attr_getstackaddr
pthread_attr_setstack
ptsname_r
syncfs
16 changes: 16 additions & 0 deletions libc-test/semver/wasi-p2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,59 @@ 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
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
Expand Down
16 changes: 9 additions & 7 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
Expand Down
2 changes: 2 additions & 0 deletions src/unix/newlib/rtems/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/unix/solarish/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
25 changes: 25 additions & 0 deletions src/wasi/p2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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;
Expand Down