diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/libc/src/unix/linux_like/linux/mod.rs | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/libc/src/unix/linux_like/linux/mod.rs')
-rw-r--r-- | vendor/libc/src/unix/linux_like/linux/mod.rs | 411 |
1 files changed, 350 insertions, 61 deletions
diff --git a/vendor/libc/src/unix/linux_like/linux/mod.rs b/vendor/libc/src/unix/linux_like/linux/mod.rs index 9658f0744..6ac0f7092 100644 --- a/vendor/libc/src/unix/linux_like/linux/mod.rs +++ b/vendor/libc/src/unix/linux_like/linux/mod.rs @@ -48,6 +48,9 @@ pub type name_t = u64; pub type iconv_t = *mut ::c_void; +// linux/sctp.h +pub type sctp_assoc_t = ::__s32; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} @@ -468,9 +471,9 @@ s! { __pgrp: ::pid_t, __sd: ::sigset_t, __ss: ::sigset_t, - #[cfg(target_env = "musl")] + #[cfg(any(target_env = "musl", target_env = "ohos"))] __prio: ::c_int, - #[cfg(not(target_env = "musl"))] + #[cfg(not(any(target_env = "musl", target_env = "ohos")))] __sp: ::sched_param, __policy: ::c_int, __pad: [::c_int; 16], @@ -625,6 +628,63 @@ s! { pub flag: *mut ::c_int, pub val: ::c_int, } + + // linux/sctp.h + + pub struct sctp_initmsg { + pub sinit_num_ostreams: ::__u16, + pub sinit_max_instreams: ::__u16, + pub sinit_max_attempts: ::__u16, + pub sinit_max_init_timeo: ::__u16, + } + + pub struct sctp_sndrcvinfo { + pub sinfo_stream: ::__u16, + pub sinfo_ssn: ::__u16, + pub sinfo_flags: ::__u16, + pub sinfo_ppid: ::__u32, + pub sinfo_context: ::__u32, + pub sinfo_timetolive: ::__u32, + pub sinfo_tsn: ::__u32, + pub sinfo_cumtsn: ::__u32, + pub sinfo_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_sndinfo { + pub snd_sid: ::__u16, + pub snd_flags: ::__u16, + pub snd_ppid: ::__u32, + pub snd_context: ::__u32, + pub snd_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_rcvinfo { + pub rcv_sid: ::__u16, + pub rcv_ssn: ::__u16, + pub rcv_flags: ::__u16, + pub rcv_ppid: ::__u32, + pub rcv_tsn: ::__u32, + pub rcv_cumtsn: ::__u32, + pub rcv_context: ::__u32, + pub rcv_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_nxtinfo { + pub nxt_sid: ::__u16, + pub nxt_flags: ::__u16, + pub nxt_ppid: ::__u32, + pub nxt_length: ::__u32, + pub nxt_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_prinfo { + pub pr_policy: ::__u16, + pub pr_value: ::__u32, + } + + pub struct sctp_authinfo { + pub auth_keynumber: ::__u16, + } } s_no_extra_traits! { @@ -938,6 +998,28 @@ cfg_if! { } } + impl PartialEq for pthread_barrier_t { + fn eq(&self, other: &pthread_barrier_t) -> bool { + self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) + } + } + + impl Eq for pthread_barrier_t {} + + impl ::fmt::Debug for pthread_barrier_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_barrier_t") + .field("size", &self.size) + .finish() + } + } + + impl ::hash::Hash for pthread_barrier_t { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + self.size.hash(state); + } + } + impl PartialEq for sockaddr_alg { fn eq(&self, other: &sockaddr_alg) -> bool { self.salg_family == other.salg_family @@ -1143,7 +1225,7 @@ cfg_if! { } cfg_if! { - if #[cfg(any(target_env = "gnu", target_env = "musl"))] { + if #[cfg(any(target_env = "gnu", target_env = "musl", target_env = "ohos"))] { pub const ABDAY_1: ::nl_item = 0x20000; pub const ABDAY_2: ::nl_item = 0x20001; pub const ABDAY_3: ::nl_item = 0x20002; @@ -1699,6 +1781,12 @@ pub const IFLA_PROP_LIST: ::c_ushort = 52; pub const IFLA_ALT_IFNAME: ::c_ushort = 53; pub const IFLA_PERM_ADDRESS: ::c_ushort = 54; pub const IFLA_PROTO_DOWN_REASON: ::c_ushort = 55; +pub const IFLA_PARENT_DEV_NAME: ::c_ushort = 56; +pub const IFLA_PARENT_DEV_BUS_NAME: ::c_ushort = 57; +pub const IFLA_GRO_MAX_SIZE: ::c_ushort = 58; +pub const IFLA_TSO_MAX_SIZE: ::c_ushort = 59; +pub const IFLA_TSO_MAX_SEGS: ::c_ushort = 60; +pub const IFLA_ALLMULTI: ::c_ushort = 61; pub const IFLA_INFO_UNSPEC: ::c_ushort = 0; pub const IFLA_INFO_KIND: ::c_ushort = 1; @@ -1761,6 +1849,18 @@ pub const MPOL_F_NUMA_BALANCING: ::c_int = 1 << 13; pub const MPOL_F_RELATIVE_NODES: ::c_int = 1 << 14; pub const MPOL_F_STATIC_NODES: ::c_int = 1 << 15; +// linux/membarrier.h +pub const MEMBARRIER_CMD_QUERY: ::c_int = 0; +pub const MEMBARRIER_CMD_GLOBAL: ::c_int = 1 << 0; +pub const MEMBARRIER_CMD_GLOBAL_EXPEDITED: ::c_int = 1 << 1; +pub const MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: ::c_int = 1 << 2; +pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED: ::c_int = 1 << 3; +pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: ::c_int = 1 << 4; +pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: ::c_int = 1 << 5; +pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: ::c_int = 1 << 6; +pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ: ::c_int = 1 << 7; +pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ: ::c_int = 1 << 8; + align_const! { pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { size: [0; __SIZEOF_PTHREAD_MUTEX_T], @@ -1825,6 +1925,7 @@ pub const IPC_STAT: ::c_int = 2; pub const IPC_INFO: ::c_int = 3; pub const MSG_STAT: ::c_int = 11; pub const MSG_INFO: ::c_int = 12; +pub const MSG_NOTIFICATION: ::c_int = 0x8000; pub const MSG_NOERROR: ::c_int = 0o10000; pub const MSG_EXCEPT: ::c_int = 0o20000; @@ -2013,6 +2114,7 @@ pub const PR_SET_MM_MAP: ::c_int = 14; pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; pub const PR_SET_PTRACER: ::c_int = 0x59616d61; +pub const PR_SET_PTRACER_ANY: ::c_ulong = 0xffffffffffffffff; pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; @@ -2042,6 +2144,16 @@ pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; pub const PR_SET_VMA: ::c_int = 0x53564d41; pub const PR_SET_VMA_ANON_NAME: ::c_int = 0; +pub const PR_SCHED_CORE: ::c_int = 62; +pub const PR_SCHED_CORE_GET: ::c_int = 0; +pub const PR_SCHED_CORE_CREATE: ::c_int = 1; +pub const PR_SCHED_CORE_SHARE_TO: ::c_int = 2; +pub const PR_SCHED_CORE_SHARE_FROM: ::c_int = 3; +pub const PR_SCHED_CORE_MAX: ::c_int = 4; +pub const PR_SCHED_CORE_SCOPE_THREAD: ::c_int = 0; +pub const PR_SCHED_CORE_SCOPE_THREAD_GROUP: ::c_int = 1; +pub const PR_SCHED_CORE_SCOPE_PROCESS_GROUP: ::c_int = 2; + pub const GRND_NONBLOCK: ::c_uint = 0x0001; pub const GRND_RANDOM: ::c_uint = 0x0002; pub const GRND_INSECURE: ::c_uint = 0x0004; @@ -3132,6 +3244,10 @@ pub const IN_ALL_EVENTS: u32 = IN_ACCESS pub const IN_CLOEXEC: ::c_int = O_CLOEXEC; pub const IN_NONBLOCK: ::c_int = O_NONBLOCK; +// uapi/linux/mount.h +pub const OPEN_TREE_CLONE: ::c_uint = 0x01; +pub const OPEN_TREE_CLOEXEC: ::c_uint = O_CLOEXEC as ::c_uint; + // uapi/linux/netfilter/nf_tables.h pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; @@ -3413,6 +3529,27 @@ pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +pub const FUTEX_BITSET_MATCH_ANY: ::c_int = 0xffffffff; + +pub const FUTEX_OP_SET: ::c_int = 0; +pub const FUTEX_OP_ADD: ::c_int = 1; +pub const FUTEX_OP_OR: ::c_int = 2; +pub const FUTEX_OP_ANDN: ::c_int = 3; +pub const FUTEX_OP_XOR: ::c_int = 4; + +pub const FUTEX_OP_OPARG_SHIFT: ::c_int = 8; + +pub const FUTEX_OP_CMP_EQ: ::c_int = 0; +pub const FUTEX_OP_CMP_NE: ::c_int = 1; +pub const FUTEX_OP_CMP_LT: ::c_int = 2; +pub const FUTEX_OP_CMP_LE: ::c_int = 3; +pub const FUTEX_OP_CMP_GT: ::c_int = 4; +pub const FUTEX_OP_CMP_GE: ::c_int = 5; + +pub fn FUTEX_OP(op: ::c_int, oparg: ::c_int, cmp: ::c_int, cmparg: ::c_int) -> ::c_int { + ((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff) +} + // linux/reboot.h pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; @@ -3587,6 +3724,82 @@ pub const J1939_EE_INFO_RX_ABORT: ::c_int = 4; pub const J1939_FILTER_MAX: ::c_int = 512; +// linux/sctp.h +pub const SCTP_FUTURE_ASSOC: ::c_int = 0; +pub const SCTP_CURRENT_ASSOC: ::c_int = 1; +pub const SCTP_ALL_ASSOC: ::c_int = 2; +pub const SCTP_RTOINFO: ::c_int = 0; +pub const SCTP_ASSOCINFO: ::c_int = 1; +pub const SCTP_INITMSG: ::c_int = 2; +pub const SCTP_NODELAY: ::c_int = 3; +pub const SCTP_AUTOCLOSE: ::c_int = 4; +pub const SCTP_SET_PEER_PRIMARY_ADDR: ::c_int = 5; +pub const SCTP_PRIMARY_ADDR: ::c_int = 6; +pub const SCTP_ADAPTATION_LAYER: ::c_int = 7; +pub const SCTP_DISABLE_FRAGMENTS: ::c_int = 8; +pub const SCTP_PEER_ADDR_PARAMS: ::c_int = 9; +pub const SCTP_DEFAULT_SEND_PARAM: ::c_int = 10; +pub const SCTP_EVENTS: ::c_int = 11; +pub const SCTP_I_WANT_MAPPED_V4_ADDR: ::c_int = 12; +pub const SCTP_MAXSEG: ::c_int = 13; +pub const SCTP_STATUS: ::c_int = 14; +pub const SCTP_GET_PEER_ADDR_INFO: ::c_int = 15; +pub const SCTP_DELAYED_ACK_TIME: ::c_int = 16; +pub const SCTP_DELAYED_ACK: ::c_int = SCTP_DELAYED_ACK_TIME; +pub const SCTP_DELAYED_SACK: ::c_int = SCTP_DELAYED_ACK_TIME; +pub const SCTP_CONTEXT: ::c_int = 17; +pub const SCTP_FRAGMENT_INTERLEAVE: ::c_int = 18; +pub const SCTP_PARTIAL_DELIVERY_POINT: ::c_int = 19; +pub const SCTP_MAX_BURST: ::c_int = 20; +pub const SCTP_AUTH_CHUNK: ::c_int = 21; +pub const SCTP_HMAC_IDENT: ::c_int = 22; +pub const SCTP_AUTH_KEY: ::c_int = 23; +pub const SCTP_AUTH_ACTIVE_KEY: ::c_int = 24; +pub const SCTP_AUTH_DELETE_KEY: ::c_int = 25; +pub const SCTP_PEER_AUTH_CHUNKS: ::c_int = 26; +pub const SCTP_LOCAL_AUTH_CHUNKS: ::c_int = 27; +pub const SCTP_GET_ASSOC_NUMBER: ::c_int = 28; +pub const SCTP_GET_ASSOC_ID_LIST: ::c_int = 29; +pub const SCTP_AUTO_ASCONF: ::c_int = 30; +pub const SCTP_PEER_ADDR_THLDS: ::c_int = 31; +pub const SCTP_RECVRCVINFO: ::c_int = 32; +pub const SCTP_RECVNXTINFO: ::c_int = 33; +pub const SCTP_DEFAULT_SNDINFO: ::c_int = 34; +pub const SCTP_AUTH_DEACTIVATE_KEY: ::c_int = 35; +pub const SCTP_REUSE_PORT: ::c_int = 36; +pub const SCTP_PEER_ADDR_THLDS_V2: ::c_int = 37; +pub const SCTP_PR_SCTP_NONE: ::c_int = 0x0000; +pub const SCTP_PR_SCTP_TTL: ::c_int = 0x0010; +pub const SCTP_PR_SCTP_RTX: ::c_int = 0x0020; +pub const SCTP_PR_SCTP_PRIO: ::c_int = 0x0030; +pub const SCTP_PR_SCTP_MAX: ::c_int = SCTP_PR_SCTP_PRIO; +pub const SCTP_PR_SCTP_MASK: ::c_int = 0x0030; +pub const SCTP_ENABLE_RESET_STREAM_REQ: ::c_int = 0x01; +pub const SCTP_ENABLE_RESET_ASSOC_REQ: ::c_int = 0x02; +pub const SCTP_ENABLE_CHANGE_ASSOC_REQ: ::c_int = 0x04; +pub const SCTP_ENABLE_STRRESET_MASK: ::c_int = 0x07; +pub const SCTP_STREAM_RESET_INCOMING: ::c_int = 0x01; +pub const SCTP_STREAM_RESET_OUTGOING: ::c_int = 0x02; + +pub const SCTP_INIT: ::c_int = 0; +pub const SCTP_SNDRCV: ::c_int = 1; +pub const SCTP_SNDINFO: ::c_int = 2; +pub const SCTP_RCVINFO: ::c_int = 3; +pub const SCTP_NXTINFO: ::c_int = 4; +pub const SCTP_PRINFO: ::c_int = 5; +pub const SCTP_AUTHINFO: ::c_int = 6; +pub const SCTP_DSTADDRV4: ::c_int = 7; +pub const SCTP_DSTADDRV6: ::c_int = 8; + +pub const SCTP_UNORDERED: ::c_int = 1 << 0; +pub const SCTP_ADDR_OVER: ::c_int = 1 << 1; +pub const SCTP_ABORT: ::c_int = 1 << 2; +pub const SCTP_SACK_IMMEDIATELY: ::c_int = 1 << 3; +pub const SCTP_SENDALL: ::c_int = 1 << 6; +pub const SCTP_PR_SCTP_ALL: ::c_int = 1 << 7; +pub const SCTP_NOTIFICATION: ::c_int = MSG_NOTIFICATION; +pub const SCTP_EOF: ::c_int = ::MSG_FIN; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) @@ -3662,6 +3875,20 @@ f! { set1.bits == set2.bits } + pub fn SCTP_PR_INDEX(policy: ::c_int) -> ::c_int { + policy >> 4 - 1 + } + + pub fn SCTP_PR_POLICY(policy: ::c_int) -> ::c_int { + policy & SCTP_PR_SCTP_MASK + } + + pub fn SCTP_PR_SET_POLICY(flags: &mut ::c_int, policy: ::c_int) -> () { + *flags &= !SCTP_PR_SCTP_MASK; + *flags |= policy; + () + } + pub fn major(dev: ::dev_t) -> ::c_uint { let mut major = 0; major |= (dev & 0x00000000000fff00) >> 8; @@ -3728,10 +3955,22 @@ safe_f! { dev |= (minor & 0xffffff00) << 12; dev } + + pub {const} fn SCTP_PR_TTL_ENABLED(policy: ::c_int) -> bool { + policy == SCTP_PR_SCTP_TTL + } + + pub {const} fn SCTP_PR_RTX_ENABLED(policy: ::c_int) -> bool { + policy == SCTP_PR_SCTP_RTX + } + + pub {const} fn SCTP_PR_PRIO_ENABLED(policy: ::c_int) -> bool { + policy == SCTP_PR_SCTP_PRIO + } } cfg_if! { - if #[cfg(not(target_env = "uclibc"))] { + if #[cfg(all(not(target_env = "uclibc"), not(target_env = "ohos")))] { extern "C" { pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; @@ -3750,6 +3989,13 @@ cfg_if! { nitems: ::c_int, sevp: *mut ::sigevent, ) -> ::c_int; + } + } +} + +cfg_if! { + if #[cfg(not(target_env = "uclibc"))] { + extern "C" { pub fn pwritev( fd: ::c_int, iov: *const ::iovec, @@ -3799,8 +4045,79 @@ cfg_if! { } } +// These functions are not available on OpenHarmony +cfg_if! { + if #[cfg(not(target_env = "ohos"))] { + extern "C" { + // Only `getspnam_r` is implemented for musl, out of all of the reenterant + // functions from `shadow.h`. + // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h + pub fn getspnam_r( + name: *const ::c_char, + spbuf: *mut spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut spwd, + ) -> ::c_int; + + pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn mq_close(mqd: ::mqd_t) -> ::c_int; + pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + pub fn mq_receive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + ) -> ::ssize_t; + pub fn mq_timedreceive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::ssize_t; + pub fn mq_send( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + ) -> ::c_int; + pub fn mq_timedsend( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::c_int; + pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; + pub fn mq_setattr( + mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr + ) -> ::c_int; + + pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int; + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; + pub fn pthread_mutexattr_getrobust( + attr: *const pthread_mutexattr_t, + robustness: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_mutexattr_setrobust( + attr: *mut pthread_mutexattr_t, + robustness: ::c_int, + ) -> ::c_int; + } + } +} + extern "C" { - #[cfg_attr(not(target_env = "musl"), link_name = "__xpg_strerror_r")] + #[cfg_attr( + not(any(target_env = "musl", target_env = "ohos")), + link_name = "__xpg_strerror_r" + )] pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; @@ -3831,18 +4148,6 @@ extern "C" { pub fn getspent() -> *mut spwd; pub fn getspnam(name: *const ::c_char) -> *mut spwd; - // Only `getspnam_r` is implemented for musl, out of all of the reenterant - // functions from `shadow.h`. - // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h - pub fn getspnam_r( - name: *const ::c_char, - spbuf: *mut spwd, - buf: *mut ::c_char, - buflen: ::size_t, - spbufp: *mut *mut spwd, - ) -> ::c_int; - - pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; // System V IPC pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; @@ -3948,37 +4253,6 @@ extern "C" { id: ::c_int, data: *mut ::c_char, ) -> ::c_int; - pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; - pub fn mq_close(mqd: ::mqd_t) -> ::c_int; - pub fn mq_unlink(name: *const ::c_char) -> ::c_int; - pub fn mq_receive( - mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msg_prio: *mut ::c_uint, - ) -> ::ssize_t; - pub fn mq_timedreceive( - mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msg_prio: *mut ::c_uint, - abs_timeout: *const ::timespec, - ) -> ::ssize_t; - pub fn mq_send( - mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msg_prio: ::c_uint, - ) -> ::c_int; - pub fn mq_timedsend( - mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msg_prio: ::c_uint, - abs_timeout: *const ::timespec, - ) -> ::c_int; - pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; - pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int; pub fn epoll_pwait( epfd: ::c_int, events: *mut ::epoll_event, @@ -4045,8 +4319,6 @@ extern "C" { pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; - pub fn shm_unlink(name: *const ::c_char) -> ::c_int; - pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); pub fn telldir(dirp: *mut ::DIR) -> ::c_long; @@ -4150,11 +4422,28 @@ extern "C" { attr: *mut pthread_mutexattr_t, protocol: ::c_int, ) -> ::c_int; - pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int; + pub fn pthread_mutex_timedlock( lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int; + pub fn pthread_barrierattr_init(attr: *mut ::pthread_barrierattr_t) -> ::c_int; + pub fn pthread_barrierattr_destroy(attr: *mut ::pthread_barrierattr_t) -> ::c_int; + pub fn pthread_barrierattr_getpshared( + attr: *const ::pthread_barrierattr_t, + shared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_barrierattr_setpshared( + attr: *mut ::pthread_barrierattr_t, + shared: ::c_int, + ) -> ::c_int; + pub fn pthread_barrier_init( + barrier: *mut pthread_barrier_t, + attr: *const ::pthread_barrierattr_t, + count: ::c_uint, + ) -> ::c_int; + pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> ::c_int; + pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int; pub fn pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int; pub fn pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int; pub fn pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int; @@ -4231,7 +4520,6 @@ extern "C" { pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; pub fn getgrnam(name: *const ::c_char) -> *mut ::group; - pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; @@ -4266,14 +4554,6 @@ extern "C" { attr: *const pthread_mutexattr_t, pshared: *mut ::c_int, ) -> ::c_int; - pub fn pthread_mutexattr_getrobust( - attr: *const pthread_mutexattr_t, - robustness: *mut ::c_int, - ) -> ::c_int; - pub fn pthread_mutexattr_setrobust( - attr: *mut pthread_mutexattr_t, - robustness: ::c_int, - ) -> ::c_int; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn faccessat( dirfd: ::c_int, @@ -4458,13 +4738,22 @@ extern "C" { longopts: *const option, longindex: *mut ::c_int, ) -> ::c_int; + + pub fn copy_file_range( + fd_in: ::c_int, + off_in: *mut ::off64_t, + fd_out: ::c_int, + off_out: *mut ::off64_t, + len: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; } cfg_if! { if #[cfg(target_env = "uclibc")] { mod uclibc; pub use self::uclibc::*; - } else if #[cfg(target_env = "musl")] { + } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] { mod musl; pub use self::musl::*; } else if #[cfg(target_env = "gnu")] { |