Skip to content

Commit 6bddf09

Browse files
authored
Merge pull request #4005 from tgross35/backport-kale
[0.2] Backports
2 parents ae7b38d + 016dea7 commit 6bddf09

File tree

6 files changed

+55
-7
lines changed

6 files changed

+55
-7
lines changed

libc-test/semver/illumos.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ pthread_attr_get_np
1212
pthread_attr_getstackaddr
1313
pthread_attr_setstack
1414
ptsname_r
15+
syncfs

libc-test/semver/wasi-p2.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,59 @@ sockaddr_storage
1111
addrinfo
1212
ip_mreq
1313
ipv6_mreq
14+
linger
1415
SHUT_RD
1516
SHUT_WR
1617
SHUT_RDWR
1718
MSG_NOSIGNAL
1819
MSG_PEEK
1920
SO_REUSEADDR
21+
SO_TYPE
2022
SO_ERROR
2123
SO_BROADCAST
24+
SO_SNDBUF
25+
SO_RCVBUF
26+
SO_KEEPALIVE
2227
SO_LINGER
28+
SO_ACCEPTCONN
29+
SO_PROTOCOL
30+
SO_DOMAIN
2331
SO_RCVTIMEO
2432
SO_SNDTIMEO
2533
SOCK_DGRAM
2634
SOCK_STREAM
35+
SOCK_NONBLOCK
2736
SOL_SOCKET
37+
AF_UNSPEC
2838
AF_INET
2939
AF_INET6
3040
IPPROTO_IP
3141
IPPROTO_TCP
42+
IPPROTO_UDP
3243
IPPROTO_IPV6
3344
IP_TTL
3445
IP_MULTICAST_TTL
3546
IP_MULTICAST_LOOP
3647
IP_ADD_MEMBERSHIP
3748
IP_DROP_MEMBERSHIP
49+
IPV6_UNICAST_HOPS
3850
IPV6_MULTICAST_LOOP
3951
IPV6_JOIN_GROUP
4052
IPV6_LEAVE_GROUP
4153
IPV6_V6ONLY
4254
IPV6_ADD_MEMBERSHIP
4355
IPV6_DROP_MEMBERSHIP
4456
TCP_NODELAY
57+
TCP_KEEPIDLE
58+
TCP_KEEPINTVL
59+
TCP_KEEPCNT
4560
EAI_SYSTEM
4661
socket
4762
connect
4863
bind
4964
listen
5065
accept
66+
accept4
5167
getsockname
5268
getpeername
5369
sendto

src/unix/hurd/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ s! {
482482

483483
pub struct stat64 {
484484
pub st_fstype: ::c_int,
485-
pub st_fsid: __fsid_t,
485+
pub st_dev: __fsid_t, /* Actually st_fsid */
486486
pub st_ino: __ino64_t,
487487
pub st_gen: ::c_uint,
488488
pub st_rdev: __dev_t,
@@ -873,12 +873,11 @@ s! {
873873
}
874874

875875
pub struct utsname {
876-
pub sysname: [::c_char; 65],
877-
pub nodename: [::c_char; 65],
878-
pub release: [::c_char; 65],
879-
pub version: [::c_char; 65],
880-
pub machine: [::c_char; 65],
881-
pub domainname: [::c_char; 65]
876+
pub sysname: [::c_char; _UTSNAME_LENGTH],
877+
pub nodename: [::c_char; _UTSNAME_LENGTH],
878+
pub release: [::c_char; _UTSNAME_LENGTH],
879+
pub version: [::c_char; _UTSNAME_LENGTH],
880+
pub machine: [::c_char; _UTSNAME_LENGTH],
882881
}
883882

884883
pub struct rlimit64 {
@@ -3437,6 +3436,9 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
34373436
};
34383437
pub const PTHREAD_STACK_MIN: ::size_t = 0;
34393438

3439+
// Non-public helper constants
3440+
const _UTSNAME_LENGTH: usize = 1024;
3441+
34403442
const_fn! {
34413443
{const} fn CMSG_ALIGN(len: usize) -> usize {
34423444
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)

src/unix/newlib/rtems/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,7 @@ extern "C" {
139139

140140
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
141141

142+
pub fn arc4random_buf(buf: *mut core::ffi::c_void, nbytes: ::size_t);
143+
142144
pub fn setgroups(ngroups: ::c_int, grouplist: *const ::gid_t) -> ::c_int;
143145
}

src/unix/solarish/illumos.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,6 @@ extern "C" {
112112
pub fn getpagesizes2(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int;
113113

114114
pub fn ptsname_r(fildes: ::c_int, name: *mut ::c_char, namelen: ::size_t) -> ::c_int;
115+
116+
pub fn syncfs(fd: ::c_int) -> ::c_int;
115117
}

src/wasi/p2.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ s! {
6262
pub ipv6mr_multiaddr: in6_addr,
6363
pub ipv6mr_interface: ::c_uint,
6464
}
65+
66+
pub struct linger {
67+
pub l_onoff: ::c_int,
68+
pub l_linger: ::c_int,
69+
}
6570
}
6671

6772
pub const SHUT_RD: ::c_int = 1 << 0;
@@ -72,22 +77,32 @@ pub const MSG_NOSIGNAL: ::c_int = 0x4000;
7277
pub const MSG_PEEK: ::c_int = 0x0002;
7378

7479
pub const SO_REUSEADDR: ::c_int = 2;
80+
pub const SO_TYPE: ::c_int = 3;
7581
pub const SO_ERROR: ::c_int = 4;
7682
pub const SO_BROADCAST: ::c_int = 6;
83+
pub const SO_SNDBUF: ::c_int = 7;
84+
pub const SO_RCVBUF: ::c_int = 8;
85+
pub const SO_KEEPALIVE: ::c_int = 9;
7786
pub const SO_LINGER: ::c_int = 13;
87+
pub const SO_ACCEPTCONN: ::c_int = 30;
88+
pub const SO_PROTOCOL: ::c_int = 38;
89+
pub const SO_DOMAIN: ::c_int = 39;
7890
pub const SO_RCVTIMEO: ::c_int = 66;
7991
pub const SO_SNDTIMEO: ::c_int = 67;
8092

8193
pub const SOCK_DGRAM: ::c_int = 5;
8294
pub const SOCK_STREAM: ::c_int = 6;
95+
pub const SOCK_NONBLOCK: ::c_int = 0x00004000;
8396

8497
pub const SOL_SOCKET: ::c_int = 0x7fffffff;
8598

99+
pub const AF_UNSPEC: ::c_int = 0;
86100
pub const AF_INET: ::c_int = 1;
87101
pub const AF_INET6: ::c_int = 2;
88102

89103
pub const IPPROTO_IP: ::c_int = 0;
90104
pub const IPPROTO_TCP: ::c_int = 6;
105+
pub const IPPROTO_UDP: ::c_int = 17;
91106
pub const IPPROTO_IPV6: ::c_int = 41;
92107

93108
pub const IP_TTL: ::c_int = 2;
@@ -96,6 +111,7 @@ pub const IP_MULTICAST_LOOP: ::c_int = 34;
96111
pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
97112
pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
98113

114+
pub const IPV6_UNICAST_HOPS: ::c_int = 16;
99115
pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
100116
pub const IPV6_JOIN_GROUP: ::c_int = 20;
101117
pub const IPV6_LEAVE_GROUP: ::c_int = 21;
@@ -105,6 +121,9 @@ pub const IPV6_ADD_MEMBERSHIP: ::c_int = IPV6_JOIN_GROUP;
105121
pub const IPV6_DROP_MEMBERSHIP: ::c_int = IPV6_LEAVE_GROUP;
106122

107123
pub const TCP_NODELAY: ::c_int = 1;
124+
pub const TCP_KEEPIDLE: ::c_int = 4;
125+
pub const TCP_KEEPINTVL: ::c_int = 5;
126+
pub const TCP_KEEPCNT: ::c_int = 6;
108127

109128
pub const EAI_SYSTEM: ::c_int = -11;
110129

@@ -114,6 +133,12 @@ extern "C" {
114133
pub fn bind(socket: ::c_int, addr: *const sockaddr, addrlen: socklen_t) -> ::c_int;
115134
pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
116135
pub fn accept(socket: ::c_int, addr: *mut sockaddr, addrlen: *mut socklen_t) -> ::c_int;
136+
pub fn accept4(
137+
socket: ::c_int,
138+
addr: *mut sockaddr,
139+
addrlen: *mut socklen_t,
140+
flags: ::c_int,
141+
) -> ::c_int;
117142

118143
pub fn getsockname(socket: ::c_int, addr: *mut sockaddr, addrlen: *mut socklen_t) -> ::c_int;
119144
pub fn getpeername(socket: ::c_int, addr: *mut sockaddr, addrlen: *mut socklen_t) -> ::c_int;

0 commit comments

Comments
 (0)