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] Backport three pull requests #3851

Merged
merged 3 commits into from
Aug 17, 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
2 changes: 2 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,7 @@ fn test_android(target: &str) {
"sys/fsuid.h",
"sys/inotify.h",
"sys/ioctl.h",
"sys/klog.h",
"sys/mman.h",
"sys/mount.h",
"sys/personality.h",
Expand Down Expand Up @@ -3433,6 +3434,7 @@ fn test_linux(target: &str) {
"sys/eventfd.h",
"sys/file.h",
"sys/fsuid.h",
"sys/klog.h",
"sys/inotify.h",
"sys/ioctl.h",
"sys/ipc.h",
Expand Down
12 changes: 12 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,17 @@ KEXEC_ON_CRASH
KEXEC_PRESERVE_CONTEXT
KEY_CNT
KEY_MAX
KLOG_CLOSE
KLOG_OPEN
KLOG_READ
KLOG_READ_ALL
KLOG_READ_CLEAR
KLOG_CLEAR
KLOG_CONSOLE_OFF
KLOG_CONSOLE_ON
KLOG_CONSOLE_LEVEL
KLOG_SIZE_UNREAD
KLOG_SIZE_BUFFER
LC_ADDRESS
LC_ADDRESS_MASK
LC_ALL
Expand Down Expand Up @@ -3341,6 +3352,7 @@ itimerval
key_t
kill
killpg
klogctl
lastlog
lchown
lconv
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/fuchsia.txt
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ SOL_UDP
SOL_X25
SOMAXCONN
SO_BINDTODEVICE
SO_BINDTOIFINDEX
SO_BSDCOMPAT
SO_BUSY_POLL
SO_DOMAIN
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3562,6 +3562,7 @@ j1939_filter
jrand48
key_t
killpg
klogctl
labs
lcong48
lgetxattr
Expand Down
13 changes: 13 additions & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
IPV6_DONTFRAG
IPV6_PKTINFO
IPV6_RECVTCLASS
IPV6_TCLASS
IP_DONTFRAG
IP_PKTINFO
IP_TOS
IP_TTL
PIPE_BUF
bind
in6_pktinfo
in_pktinfo
recvmsg
sendmsg
1 change: 1 addition & 0 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2981,6 +2981,7 @@ pub const SO_MARK: ::c_int = 36;
pub const SO_RXQ_OVFL: ::c_int = 40;
pub const SO_PEEK_OFF: ::c_int = 42;
pub const SO_BUSY_POLL: ::c_int = 46;
pub const SO_BINDTOIFINDEX: ::c_int = 62;

pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
Expand Down
14 changes: 14 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3523,6 +3523,18 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;

pub const PF_SUSPEND_TASK: ::c_int = 0x80000000;

pub const KLOG_CLOSE: ::c_int = 0;
pub const KLOG_OPEN: ::c_int = 1;
pub const KLOG_READ: ::c_int = 2;
pub const KLOG_READ_ALL: ::c_int = 3;
pub const KLOG_READ_CLEAR: ::c_int = 4;
pub const KLOG_CLEAR: ::c_int = 5;
pub const KLOG_CONSOLE_OFF: ::c_int = 6;
pub const KLOG_CONSOLE_ON: ::c_int = 7;
pub const KLOG_CONSOLE_LEVEL: ::c_int = 8;
pub const KLOG_SIZE_UNREAD: ::c_int = 9;
pub const KLOG_SIZE_BUFFER: ::c_int = 10;

// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
// following are only available on newer Linux versions than the versions
// currently used in CI in some configurations, so we define them here.
Expand Down Expand Up @@ -4095,6 +4107,8 @@ extern "C" {
) -> ::size_t;
pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;

pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
}

cfg_if! {
Expand Down
2 changes: 2 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5626,6 +5626,8 @@ extern "C" {
len: ::size_t,
flags: ::c_uint,
) -> ::ssize_t;

pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
}

// LFS64 extensions
Expand Down
30 changes: 24 additions & 6 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,10 @@ extern "C" {
target_vendor = "nintendo"
)))]
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_socket"
)]
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
#[cfg(not(all(
Expand All @@ -607,7 +610,10 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "connect$UNIX2003"
)]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_connect"
)]
#[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int;
#[cfg_attr(
Expand Down Expand Up @@ -669,7 +675,10 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "socketpair$UNIX2003"
)]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_socketpair"
)]
pub fn socketpair(
domain: ::c_int,
type_: ::c_int,
Expand All @@ -685,7 +694,10 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "sendto$UNIX2003"
)]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_sendto"
)]
#[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
pub fn sendto(
socket: ::c_int,
Expand Down Expand Up @@ -1164,7 +1176,10 @@ extern "C" {
pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;

#[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_getsockopt"
)]
#[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
pub fn getsockopt(
sockfd: ::c_int,
Expand All @@ -1187,7 +1202,10 @@ extern "C" {
target_arch = "powerpc",
target_vendor = "nintendo"
)))]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_getaddrinfo"
)]
#[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
pub fn getaddrinfo(
node: *const c_char,
Expand Down
26 changes: 22 additions & 4 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ s! {
pub __sin6_src_id: u32
}

pub struct in_pktinfo {
pub ipi_ifindex: ::c_uint,
pub ipi_spec_dst: ::in_addr,
pub ipi_addr: ::in_addr,
}

pub struct in6_pktinfo {
pub ipi6_addr: ::in6_addr,
pub ipi6_ifindex: ::c_uint,
}

pub struct passwd {
pub pw_name: *mut ::c_char,
pub pw_passwd: *mut ::c_char,
Expand Down Expand Up @@ -1238,14 +1249,20 @@ pub const CLD_STOPPED: ::c_int = 5;
pub const CLD_CONTINUED: ::c_int = 6;

pub const IP_RECVDSTADDR: ::c_int = 0x7;
pub const IP_PKTINFO: ::c_int = 0x1a;
pub const IP_DONTFRAG: ::c_int = 0x1b;
pub const IP_SEC_OPT: ::c_int = 0x22;

pub const IPV6_UNICAST_HOPS: ::c_int = 0x5;
pub const IPV6_MULTICAST_IF: ::c_int = 0x6;
pub const IPV6_MULTICAST_HOPS: ::c_int = 0x7;
pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
pub const IPV6_PKTINFO: ::c_int = 0xb;
pub const IPV6_RECVPKTINFO: ::c_int = 0x12;
pub const IPV6_RECVTCLASS: ::c_int = 0x19;
pub const IPV6_DONTFRAG: ::c_int = 0x21;
pub const IPV6_SEC_OPT: ::c_int = 0x22;
pub const IPV6_TCLASS: ::c_int = 0x26;
pub const IPV6_V6ONLY: ::c_int = 0x27;

cfg_if! {
Expand Down Expand Up @@ -1775,8 +1792,9 @@ pub const SOCK_SEQPACKET: ::c_int = 6;
pub const IP_MULTICAST_IF: ::c_int = 16;
pub const IP_MULTICAST_TTL: ::c_int = 17;
pub const IP_MULTICAST_LOOP: ::c_int = 18;
pub const IP_TTL: ::c_int = 4;
pub const IP_HDRINCL: ::c_int = 2;
pub const IP_TOS: ::c_int = 3;
pub const IP_TTL: ::c_int = 4;
pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
pub const IPV6_JOIN_GROUP: ::c_int = 9;
Expand Down Expand Up @@ -2869,15 +2887,15 @@ extern "C" {
) -> ::c_int;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;

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

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

#[cfg_attr(target_os = "illumos", link_name = "__xnet_sendmsg")]
#[link_name = "__xnet_sendmsg"]
pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(target_os = "illumos", link_name = "__xnet_recvmsg")]
#[link_name = "__xnet_recvmsg"]
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn accept4(
fd: ::c_int,
Expand Down