diff options
author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-07-01 06:42:12 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-01 06:42:12 +0900 |
commit | 4d0e2b367ecc8dba4c4dfb6ab9e7dcc7f9cc439d (patch) | |
tree | ca473c7686acf2d3ea0a60a95d95111934db6f40 | |
parent | cd6001c4e6e04acd3630d36676567b02ae7984c1 (diff) | |
parent | 51acd7f488f63c6f4c60a38b44b8439bb9d04821 (diff) | |
download | rust-libc-4d0e2b367ecc8dba4c4dfb6ab9e7dcc7f9cc439d.tar.gz |
Merge pull request #1795 from qwandor-google/master
-rw-r--r-- | ci/android-install-ndk.sh | 2 | ||||
-rw-r--r-- | libc-test/build.rs | 5 | ||||
-rw-r--r-- | src/unix/linux_like/android/b64/aarch64/mod.rs | 2 | ||||
-rw-r--r-- | src/unix/linux_like/android/mod.rs | 145 |
4 files changed, 148 insertions, 6 deletions
diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index c5594e1839..07d3703959 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -2,7 +2,7 @@ set -ex -NDK=android-ndk-r19c +NDK=android-ndk-r21d curl --retry 20 -O https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip unzip -q ${NDK}-linux-x86_64.zip diff --git a/libc-test/build.rs b/libc-test/build.rs index 1e602618ae..e941baf056 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1427,6 +1427,7 @@ fn test_android(target: &str) { "sys/sysinfo.h", "sys/time.h", "sys/times.h", + "sys/timerfd.h", "sys/types.h", "sys/ucontext.h", "sys/uio.h", @@ -1454,6 +1455,7 @@ fn test_android(target: &str) { "asm/mman.h", "linux/dccp.h", "linux/errqueue.h", + "linux/falloc.h", "linux/futex.h", "linux/fs.h", "linux/genetlink.h", @@ -1475,6 +1477,7 @@ fn test_android(target: &str) { "linux/quota.h", "linux/reboot.h", "linux/seccomp.h", + "linux/sched.h", "linux/sockios.h", } @@ -1577,7 +1580,7 @@ fn test_android(target: &str) { // https://github.com/rust-lang/libc/issues/1765 "lockf" | "preadv64" | "pwritev64" | "openpty" | "forkpty" | "login_tty" | "getifaddrs" | "freeifaddrs" | "sethostname" - | "getgrgid_r" | "getgrnam_r" + | "getgrgid_r" | "getgrnam_r" | "sigtimedwait" if aarch64 => { true diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index b2b91889a2..b7a21e1539 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -322,7 +322,7 @@ pub const SYS_pwritev2: ::c_long = 287; pub const SYS_pkey_mprotect: ::c_long = 288; pub const SYS_pkey_alloc: ::c_long = 289; pub const SYS_pkey_free: ::c_long = 290; -pub const SYS_syscalls: ::c_long = 292; +pub const SYS_syscalls: ::c_long = 436; cfg_if! { if #[cfg(libc_align)] { diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 9cc1c77ad9..9f369e417c 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -19,6 +19,7 @@ pub type nfds_t = ::c_uint; pub type rlim_t = ::c_ulong; pub type dev_t = ::c_ulong; pub type ino_t = ::c_ulong; +pub type ino64_t = u64; pub type __CPU_BITTYPE = ::c_ulong; pub type idtype_t = ::c_int; pub type loff_t = ::c_longlong; @@ -147,6 +148,11 @@ s! { _pad: [u8; 28], } + pub struct itimerspec { + pub it_interval: ::timespec, + pub it_value: ::timespec, + } + pub struct ucred { pub pid: ::pid_t, pub uid: ::uid_t, @@ -629,11 +635,27 @@ pub const EPOLLONESHOT: ::c_int = 0x40000000; pub const EPOLLRDHUP: ::c_int = 0x00002000; pub const EPOLLWAKEUP: ::c_int = 0x20000000; -pub const EFD_CLOEXEC: ::c_int = 0x80000; +// sys/eventfd.h +pub const EFD_SEMAPHORE: ::c_int = 0x1; +pub const EFD_CLOEXEC: ::c_int = O_CLOEXEC; +pub const EFD_NONBLOCK: ::c_int = O_NONBLOCK; + +// sys/timerfd.h +pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; +pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK; +pub const TFD_TIMER_ABSTIME: ::c_int = 1; +pub const TFD_TIMER_CANCEL_ON_SET: ::c_int = 2; pub const USER_PROCESS: ::c_short = 7; +// linux/falloc.h +pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; +pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; +pub const FALLOC_FL_NO_HIDE_STALE: ::c_int = 0x04; pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; +pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10; +pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20; +pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40; pub const BUFSIZ: ::c_uint = 1024; pub const FILENAME_MAX: ::c_uint = 4096; @@ -804,6 +826,11 @@ pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; +// stdio.h +pub const RENAME_NOREPLACE: ::c_int = 1; +pub const RENAME_EXCHANGE: ::c_int = 2; +pub const RENAME_WHITEOUT: ::c_int = 4; + pub const FIOCLEX: ::c_int = 0x5451; pub const FIONCLEX: ::c_int = 0x5450; @@ -1097,8 +1124,6 @@ pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; -pub const EFD_NONBLOCK: ::c_int = 0x800; - pub const F_GETLK: ::c_int = 5; pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; @@ -2148,6 +2173,18 @@ pub const PRIO_PROCESS: ::c_int = 0; pub const PRIO_PGRP: ::c_int = 1; pub const PRIO_USER: ::c_int = 2; +// linux/sched.h +pub const SCHED_NORMAL: ::c_int = 0; +pub const SCHED_FIFO: ::c_int = 1; +pub const SCHED_RR: ::c_int = 2; +pub const SCHED_BATCH: ::c_int = 3; +pub const SCHED_IDLE: ::c_int = 5; +pub const SCHED_DEADLINE: ::c_int = 6; + +// bits/seek_constants.h +pub const SEEK_DATA: ::c_int = 3; +pub const SEEK_HOLE: ::c_int = 4; + f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { @@ -2218,6 +2255,18 @@ extern "C" { pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int; pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + pub fn prlimit( + pid: ::pid_t, + resource: ::c_int, + new_limit: *const ::rlimit, + old_limit: *mut ::rlimit, + ) -> ::c_int; + pub fn prlimit64( + pid: ::pid_t, + resource: ::c_int, + new_limit: *const ::rlimit64, + old_limit: *mut ::rlimit64, + ) -> ::c_int; pub fn strerror_r( errnum: ::c_int, buf: *mut c_char, @@ -2273,16 +2322,101 @@ extern "C" { pub fn setutent(); pub fn getutent() -> *mut utmp; + pub fn fallocate( + fd: ::c_int, + mode: ::c_int, + offset: ::off_t, + len: ::off_t, + ) -> ::c_int; + pub fn fallocate64( + fd: ::c_int, + mode: ::c_int, + offset: ::off64_t, + len: ::off64_t, + ) -> ::c_int; pub fn posix_fallocate( fd: ::c_int, offset: ::off_t, len: ::off_t, ) -> ::c_int; + pub fn posix_fallocate64( + fd: ::c_int, + offset: ::off64_t, + len: ::off64_t, + ) -> ::c_int; + pub fn getxattr( + path: *const c_char, + name: *const c_char, + value: *mut ::c_void, + size: ::size_t, + ) -> ::ssize_t; + pub fn lgetxattr( + path: *const c_char, + name: *const c_char, + value: *mut ::c_void, + size: ::size_t, + ) -> ::ssize_t; + pub fn fgetxattr( + filedes: ::c_int, + name: *const c_char, + value: *mut ::c_void, + size: ::size_t, + ) -> ::ssize_t; + pub fn setxattr( + path: *const c_char, + name: *const c_char, + value: *const ::c_void, + size: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn lsetxattr( + path: *const c_char, + name: *const c_char, + value: *const ::c_void, + size: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn fsetxattr( + filedes: ::c_int, + name: *const c_char, + value: *const ::c_void, + size: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn listxattr( + path: *const c_char, + list: *mut c_char, + size: ::size_t, + ) -> ::ssize_t; + pub fn llistxattr( + path: *const c_char, + list: *mut c_char, + size: ::size_t, + ) -> ::ssize_t; + pub fn flistxattr( + filedes: ::c_int, + list: *mut c_char, + size: ::size_t, + ) -> ::ssize_t; + pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; pub fn signalfd( fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int, ) -> ::c_int; + pub fn timerfd_create(clock: ::clockid_t, flags: ::c_int) -> ::c_int; + pub fn timerfd_gettime( + fd: ::c_int, + current_value: *mut itimerspec, + ) -> ::c_int; + pub fn timerfd_settime( + fd: ::c_int, + flags: ::c_int, + new_value: *const itimerspec, + old_value: *mut itimerspec, + ) -> ::c_int; pub fn syscall(num: ::c_long, ...) -> ::c_long; pub fn sched_getaffinity( pid: ::pid_t, @@ -2460,6 +2594,11 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; + pub fn sigtimedwait( + set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec, + ) -> ::c_int; pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option<unsafe extern "C" fn()>, |