Skip to content

Commit 64ee9df

Browse files
authored
Merge pull request #3851 from tgross35/backport-romaine
[0.2] Backport three pull requests
2 parents 3f102f3 + 3242730 commit 64ee9df

File tree

10 files changed

+92
-10
lines changed

10 files changed

+92
-10
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,7 @@ fn test_android(target: &str) {
16561656
"sys/fsuid.h",
16571657
"sys/inotify.h",
16581658
"sys/ioctl.h",
1659+
"sys/klog.h",
16591660
"sys/mman.h",
16601661
"sys/mount.h",
16611662
"sys/personality.h",
@@ -3433,6 +3434,7 @@ fn test_linux(target: &str) {
34333434
"sys/eventfd.h",
34343435
"sys/file.h",
34353436
"sys/fsuid.h",
3437+
"sys/klog.h",
34363438
"sys/inotify.h",
34373439
"sys/ioctl.h",
34383440
"sys/ipc.h",

libc-test/semver/android.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,17 @@ KEXEC_ON_CRASH
10731073
KEXEC_PRESERVE_CONTEXT
10741074
KEY_CNT
10751075
KEY_MAX
1076+
KLOG_CLOSE
1077+
KLOG_OPEN
1078+
KLOG_READ
1079+
KLOG_READ_ALL
1080+
KLOG_READ_CLEAR
1081+
KLOG_CLEAR
1082+
KLOG_CONSOLE_OFF
1083+
KLOG_CONSOLE_ON
1084+
KLOG_CONSOLE_LEVEL
1085+
KLOG_SIZE_UNREAD
1086+
KLOG_SIZE_BUFFER
10761087
LC_ADDRESS
10771088
LC_ADDRESS_MASK
10781089
LC_ALL
@@ -3341,6 +3352,7 @@ itimerval
33413352
key_t
33423353
kill
33433354
killpg
3355+
klogctl
33443356
lastlog
33453357
lchown
33463358
lconv

libc-test/semver/fuchsia.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ SOL_UDP
951951
SOL_X25
952952
SOMAXCONN
953953
SO_BINDTODEVICE
954+
SO_BINDTOIFINDEX
954955
SO_BSDCOMPAT
955956
SO_BUSY_POLL
956957
SO_DOMAIN

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,6 +3562,7 @@ j1939_filter
35623562
jrand48
35633563
key_t
35643564
killpg
3565+
klogctl
35653566
labs
35663567
lcong48
35673568
lgetxattr

libc-test/semver/solarish.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1+
IPV6_DONTFRAG
2+
IPV6_PKTINFO
3+
IPV6_RECVTCLASS
4+
IPV6_TCLASS
5+
IP_DONTFRAG
6+
IP_PKTINFO
7+
IP_TOS
8+
IP_TTL
19
PIPE_BUF
10+
bind
11+
in6_pktinfo
12+
in_pktinfo
13+
recvmsg
14+
sendmsg

src/fuchsia/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2981,6 +2981,7 @@ pub const SO_MARK: ::c_int = 36;
29812981
pub const SO_RXQ_OVFL: ::c_int = 40;
29822982
pub const SO_PEEK_OFF: ::c_int = 42;
29832983
pub const SO_BUSY_POLL: ::c_int = 46;
2984+
pub const SO_BINDTOIFINDEX: ::c_int = 62;
29842985

29852986
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
29862987
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;

src/unix/linux_like/android/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,6 +3523,18 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;
35233523

35243524
pub const PF_SUSPEND_TASK: ::c_int = 0x80000000;
35253525

3526+
pub const KLOG_CLOSE: ::c_int = 0;
3527+
pub const KLOG_OPEN: ::c_int = 1;
3528+
pub const KLOG_READ: ::c_int = 2;
3529+
pub const KLOG_READ_ALL: ::c_int = 3;
3530+
pub const KLOG_READ_CLEAR: ::c_int = 4;
3531+
pub const KLOG_CLEAR: ::c_int = 5;
3532+
pub const KLOG_CONSOLE_OFF: ::c_int = 6;
3533+
pub const KLOG_CONSOLE_ON: ::c_int = 7;
3534+
pub const KLOG_CONSOLE_LEVEL: ::c_int = 8;
3535+
pub const KLOG_SIZE_UNREAD: ::c_int = 9;
3536+
pub const KLOG_SIZE_BUFFER: ::c_int = 10;
3537+
35263538
// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
35273539
// following are only available on newer Linux versions than the versions
35283540
// currently used in CI in some configurations, so we define them here.
@@ -4095,6 +4107,8 @@ extern "C" {
40954107
) -> ::size_t;
40964108
pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
40974109
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;
4110+
4111+
pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
40984112
}
40994113

41004114
cfg_if! {

src/unix/linux_like/linux/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5626,6 +5626,8 @@ extern "C" {
56265626
len: ::size_t,
56275627
flags: ::c_uint,
56285628
) -> ::ssize_t;
5629+
5630+
pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
56295631
}
56305632

56315633
// LFS64 extensions

src/unix/mod.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,10 @@ extern "C" {
595595
target_vendor = "nintendo"
596596
)))]
597597
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
598-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
598+
#[cfg_attr(
599+
any(target_os = "illumos", target_os = "solaris"),
600+
link_name = "__xnet_socket"
601+
)]
599602
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
600603
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
601604
#[cfg(not(all(
@@ -607,7 +610,10 @@ extern "C" {
607610
all(target_os = "macos", target_arch = "x86"),
608611
link_name = "connect$UNIX2003"
609612
)]
610-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
613+
#[cfg_attr(
614+
any(target_os = "illumos", target_os = "solaris"),
615+
link_name = "__xnet_connect"
616+
)]
611617
#[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
612618
pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int;
613619
#[cfg_attr(
@@ -669,7 +675,10 @@ extern "C" {
669675
all(target_os = "macos", target_arch = "x86"),
670676
link_name = "socketpair$UNIX2003"
671677
)]
672-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
678+
#[cfg_attr(
679+
any(target_os = "illumos", target_os = "solaris"),
680+
link_name = "__xnet_socketpair"
681+
)]
673682
pub fn socketpair(
674683
domain: ::c_int,
675684
type_: ::c_int,
@@ -685,7 +694,10 @@ extern "C" {
685694
all(target_os = "macos", target_arch = "x86"),
686695
link_name = "sendto$UNIX2003"
687696
)]
688-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
697+
#[cfg_attr(
698+
any(target_os = "illumos", target_os = "solaris"),
699+
link_name = "__xnet_sendto"
700+
)]
689701
#[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
690702
pub fn sendto(
691703
socket: ::c_int,
@@ -1164,7 +1176,10 @@ extern "C" {
11641176
pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
11651177
pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
11661178

1167-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
1179+
#[cfg_attr(
1180+
any(target_os = "illumos", target_os = "solaris"),
1181+
link_name = "__xnet_getsockopt"
1182+
)]
11681183
#[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
11691184
pub fn getsockopt(
11701185
sockfd: ::c_int,
@@ -1187,7 +1202,10 @@ extern "C" {
11871202
target_arch = "powerpc",
11881203
target_vendor = "nintendo"
11891204
)))]
1190-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")]
1205+
#[cfg_attr(
1206+
any(target_os = "illumos", target_os = "solaris"),
1207+
link_name = "__xnet_getaddrinfo"
1208+
)]
11911209
#[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
11921210
pub fn getaddrinfo(
11931211
node: *const c_char,

src/unix/solarish/mod.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ s! {
120120
pub __sin6_src_id: u32
121121
}
122122

123+
pub struct in_pktinfo {
124+
pub ipi_ifindex: ::c_uint,
125+
pub ipi_spec_dst: ::in_addr,
126+
pub ipi_addr: ::in_addr,
127+
}
128+
129+
pub struct in6_pktinfo {
130+
pub ipi6_addr: ::in6_addr,
131+
pub ipi6_ifindex: ::c_uint,
132+
}
133+
123134
pub struct passwd {
124135
pub pw_name: *mut ::c_char,
125136
pub pw_passwd: *mut ::c_char,
@@ -1238,14 +1249,20 @@ pub const CLD_STOPPED: ::c_int = 5;
12381249
pub const CLD_CONTINUED: ::c_int = 6;
12391250

12401251
pub const IP_RECVDSTADDR: ::c_int = 0x7;
1252+
pub const IP_PKTINFO: ::c_int = 0x1a;
1253+
pub const IP_DONTFRAG: ::c_int = 0x1b;
12411254
pub const IP_SEC_OPT: ::c_int = 0x22;
12421255

12431256
pub const IPV6_UNICAST_HOPS: ::c_int = 0x5;
12441257
pub const IPV6_MULTICAST_IF: ::c_int = 0x6;
12451258
pub const IPV6_MULTICAST_HOPS: ::c_int = 0x7;
12461259
pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
1260+
pub const IPV6_PKTINFO: ::c_int = 0xb;
12471261
pub const IPV6_RECVPKTINFO: ::c_int = 0x12;
1262+
pub const IPV6_RECVTCLASS: ::c_int = 0x19;
1263+
pub const IPV6_DONTFRAG: ::c_int = 0x21;
12481264
pub const IPV6_SEC_OPT: ::c_int = 0x22;
1265+
pub const IPV6_TCLASS: ::c_int = 0x26;
12491266
pub const IPV6_V6ONLY: ::c_int = 0x27;
12501267

12511268
cfg_if! {
@@ -1775,8 +1792,9 @@ pub const SOCK_SEQPACKET: ::c_int = 6;
17751792
pub const IP_MULTICAST_IF: ::c_int = 16;
17761793
pub const IP_MULTICAST_TTL: ::c_int = 17;
17771794
pub const IP_MULTICAST_LOOP: ::c_int = 18;
1778-
pub const IP_TTL: ::c_int = 4;
17791795
pub const IP_HDRINCL: ::c_int = 2;
1796+
pub const IP_TOS: ::c_int = 3;
1797+
pub const IP_TTL: ::c_int = 4;
17801798
pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
17811799
pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
17821800
pub const IPV6_JOIN_GROUP: ::c_int = 9;
@@ -2869,15 +2887,15 @@ extern "C" {
28692887
) -> ::c_int;
28702888
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
28712889

2872-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_bind")]
2890+
#[link_name = "__xnet_bind"]
28732891
pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
28742892

28752893
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
28762894
pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
28772895

2878-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_sendmsg")]
2896+
#[link_name = "__xnet_sendmsg"]
28792897
pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
2880-
#[cfg_attr(target_os = "illumos", link_name = "__xnet_recvmsg")]
2898+
#[link_name = "__xnet_recvmsg"]
28812899
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
28822900
pub fn accept4(
28832901
fd: ::c_int,

0 commit comments

Comments
 (0)