summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonah Petri <jonah@petri.us>2021-01-11 10:12:16 -0500
committerJonah Petri <jonah@petri.us>2021-02-12 20:43:02 -0500
commit0ac10285d93ce270e44e198d1fcbd238a0321c7b (patch)
tree107b5e95b5e4d2db3f3992249c984f96d090b753
parent7775ce20b9e49bcfb437210f93c91c31806a1214 (diff)
downloadrust-libc-0ac10285d93ce270e44e198d1fcbd238a0321c7b.tar.gz
uclibc: style fixes
-rwxr-xr-xlibc-test/build.rs2
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs13
-rw-r--r--src/unix/linux_like/linux/mod.rs191
-rw-r--r--src/unix/linux_like/linux/musl/mod.rs13
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs1
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mod.rs2
-rw-r--r--src/unix/linux_like/mod.rs119
-rw-r--r--src/unix/mod.rs17
8 files changed, 174 insertions, 184 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 18dc82b65c..872ef4cd66 100755
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -2654,7 +2654,7 @@ fn test_linux(target: &str) {
| "CAN_J1939"
| "CAN_RAW_FILTER_MAX"
| "CAN_NPROTO" => true,
-
+
"MS_RMT_MASK" if uclibc => true, // updated in glibc 2.22 and musl 1.1.13
// FIXME: Requires recent kernel headers (5.8):
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index b5a9402e76..de2d5a6e5c 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -287,6 +287,19 @@ s! {
__re_nsub: ::size_t,
__bitfield: u8,
}
+
+ pub struct Elf64_Chdr {
+ pub ch_type: ::Elf64_Word,
+ pub ch_reserved: ::Elf64_Word,
+ pub ch_size: ::Elf64_Xword,
+ pub ch_addralign: ::Elf64_Xword,
+ }
+
+ pub struct Elf32_Chdr {
+ pub ch_type: ::Elf32_Word,
+ pub ch_size: ::Elf32_Word,
+ pub ch_addralign: ::Elf32_Word,
+ }
}
impl siginfo_t {
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index d7c7c2c187..9e32eddafa 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -525,25 +525,6 @@ s! {
}
}
-cfg_if! {
- if #[cfg(not(target_env = "uclibc"))] {
- s! {
- pub struct Elf64_Chdr {
- pub ch_type: Elf64_Word,
- pub ch_reserved: Elf64_Word,
- pub ch_size: Elf64_Xword,
- pub ch_addralign: Elf64_Xword,
- }
-
- pub struct Elf32_Chdr {
- pub ch_type: Elf32_Word,
- pub ch_size: Elf32_Word,
- pub ch_addralign: Elf32_Word,
- }
- }
- }
-}
-
s_no_extra_traits! {
pub struct sockaddr_nl {
pub nl_family: ::sa_family_t,
@@ -983,13 +964,7 @@ cfg_if! {
}
}
-cfg_if! {
- if #[cfg(not(target_env = "uclibc"))] {
- pub const RUSAGE_THREAD: ::c_int = 1;
- }
-}
pub const RUSAGE_CHILDREN: ::c_int = -1;
-
pub const L_tmpnam: ::c_uint = 20;
pub const _PC_LINK_MAX: ::c_int = 0;
pub const _PC_MAX_CANON: ::c_int = 1;
@@ -1323,8 +1298,6 @@ pub const RTLD_NOW: ::c_int = 0x2;
pub const AT_EACCESS: ::c_int = 0x200;
pub const TCP_MD5SIG: ::c_int = 14;
-#[cfg(not(target_env = "uclibc"))]
-pub const TCP_ULP: ::c_int = 31;
align_const! {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@@ -1386,8 +1359,6 @@ pub const MSG_INFO: ::c_int = 12;
pub const MSG_NOERROR: ::c_int = 0o10000;
pub const MSG_EXCEPT: ::c_int = 0o20000;
-#[cfg(not(target_env = "uclibc"))]
-pub const MSG_COPY: ::c_int = 0o40000;
pub const SHM_R: ::c_int = 0o400;
pub const SHM_W: ::c_int = 0o200;
@@ -1395,8 +1366,6 @@ pub const SHM_W: ::c_int = 0o200;
pub const SHM_RDONLY: ::c_int = 0o10000;
pub const SHM_RND: ::c_int = 0o20000;
pub const SHM_REMAP: ::c_int = 0o40000;
-#[cfg(not(target_env = "uclibc"))]
-pub const SHM_EXEC: ::c_int = 0o100000;
pub const SHM_LOCK: ::c_int = 11;
pub const SHM_UNLOCK: ::c_int = 12;
@@ -1406,8 +1375,6 @@ pub const SHM_HUGETLB: ::c_int = 0o4000;
pub const SHM_NORESERVE: ::c_int = 0o10000;
pub const EPOLLRDHUP: ::c_int = 0x2000;
-#[cfg(not(target_env = "uclibc"))]
-pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
pub const QFMT_VFS_OLD: ::c_int = 1;
@@ -1469,6 +1436,16 @@ cfg_if! {
pub const LIO_NOP: ::c_int = 2;
pub const LIO_WAIT: ::c_int = 0;
pub const LIO_NOWAIT: ::c_int = 1;
+ pub const RUSAGE_THREAD: ::c_int = 1;
+ pub const TCP_ULP: ::c_int = 31;
+ pub const MSG_COPY: ::c_int = 0o40000;
+ pub const SHM_EXEC: ::c_int = 0o100000;
+ pub const IPV6_MULTICAST_ALL: ::c_int = 29;
+ pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
+ pub const PACKET_MR_UNICAST: ::c_int = 3;
+ pub const PTRACE_EVENT_STOP: ::c_int = 128;
+ pub const UDP_SEGMENT: ::c_int = 103;
+ pub const UDP_GRO: ::c_int = 104;
}
}
@@ -1633,10 +1610,6 @@ pub const SO_ORIGINAL_DST: ::c_int = 80;
pub const IP_RECVFRAGSIZE: ::c_int = 25;
pub const IPV6_FLOWINFO: ::c_int = 11;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPV6_MULTICAST_ALL: ::c_int = 29;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
pub const IPV6_FLOWLABEL_MGR: ::c_int = 32;
pub const IPV6_FLOWINFO_SEND: ::c_int = 33;
pub const IPV6_RECVFRAGSIZE: ::c_int = 77;
@@ -1967,8 +1940,6 @@ pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
pub const PACKET_MR_MULTICAST: ::c_int = 0;
pub const PACKET_MR_PROMISC: ::c_int = 1;
pub const PACKET_MR_ALLMULTI: ::c_int = 2;
-#[cfg(not(target_env = "uclibc"))]
-pub const PACKET_MR_UNICAST: ::c_int = 3;
// linux/netfilter.h
pub const NF_DROP: ::c_int = 0;
@@ -2089,9 +2060,6 @@ pub const SIOCSRARP: ::c_ulong = 0x00008962;
pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
-#[cfg(not(target_env = "uclibc"))]
-pub const PTRACE_EVENT_STOP: ::c_int = 128;
-
pub const IPTOS_TOS_MASK: u8 = 0x1E;
pub const IPTOS_PREC_MASK: u8 = 0xE0;
@@ -2394,10 +2362,6 @@ pub const UDP_CORK: ::c_int = 1;
pub const UDP_ENCAP: ::c_int = 100;
pub const UDP_NO_CHECK6_TX: ::c_int = 101;
pub const UDP_NO_CHECK6_RX: ::c_int = 102;
-#[cfg(not(target_env = "uclibc"))]
-pub const UDP_SEGMENT: ::c_int = 103;
-#[cfg(not(target_env = "uclibc"))]
-pub const UDP_GRO: ::c_int = 104;
// include/uapi/linux/mman.h
pub const MAP_SHARED_VALIDATE: ::c_int = 0x3;
@@ -2816,25 +2780,73 @@ f! {
}
}
-#[cfg(not(target_env = "uclibc"))]
-extern "C" {
- pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
- pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
- pub fn aio_suspend(
- aiocb_list: *const *const aiocb,
- nitems: ::c_int,
- timeout: *const ::timespec,
- ) -> ::c_int;
- pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn lio_listio(
- mode: ::c_int,
- aiocb_list: *const *mut aiocb,
- nitems: ::c_int,
- sevp: *mut ::sigevent,
- ) -> ::c_int;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ extern "C" {
+ pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
+ pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
+ pub fn aio_suspend(
+ aiocb_list: *const *const aiocb,
+ nitems: ::c_int,
+ timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn lio_listio(
+ mode: ::c_int,
+ aiocb_list: *const *mut aiocb,
+ nitems: ::c_int,
+ sevp: *mut ::sigevent,
+ ) -> ::c_int;
+ pub fn pwritev(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ ) -> ::ssize_t;
+ pub fn preadv(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ ) -> ::ssize_t;
+ pub fn getnameinfo(
+ sa: *const ::sockaddr,
+ salen: ::socklen_t,
+ host: *mut ::c_char,
+ hostlen: ::socklen_t,
+ serv: *mut ::c_char,
+ sevlen: ::socklen_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn getloadavg(
+ loadavg: *mut ::c_double,
+ nelem: ::c_int
+ ) -> ::c_int;
+ pub fn process_vm_readv(
+ pid: ::pid_t,
+ local_iov: *const ::iovec,
+ liovcnt: ::c_ulong,
+ remote_iov: *const ::iovec,
+ riovcnt: ::c_ulong,
+ flags: ::c_ulong,
+ ) -> isize;
+ pub fn process_vm_writev(
+ pid: ::pid_t,
+ local_iov: *const ::iovec,
+ liovcnt: ::c_ulong,
+ remote_iov: *const ::iovec,
+ riovcnt: ::c_ulong,
+ flags: ::c_ulong,
+ ) -> isize;
+ pub fn futimes(
+ fd: ::c_int,
+ times: *const ::timeval
+ ) -> ::c_int;
+ }
+ }
}
extern "C" {
@@ -3049,20 +3061,6 @@ extern "C" {
new_value: *const itimerspec,
old_value: *mut itimerspec,
) -> ::c_int;
- #[cfg(not(target_env = "uclibc"))]
- pub fn pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- #[cfg(not(target_env = "uclibc"))]
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
pub fn quotactl(
cmd: ::c_int,
special: *const ::c_char,
@@ -3132,43 +3130,10 @@ extern "C" {
len: *mut ::socklen_t,
flg: ::c_int,
) -> ::c_int;
- #[cfg(not(target_env = "uclibc"))]
- pub fn getnameinfo(
- sa: *const ::sockaddr,
- salen: ::socklen_t,
- host: *mut ::c_char,
- hostlen: ::socklen_t,
- serv: *mut ::c_char,
- sevlen: ::socklen_t,
- flags: ::c_int,
- ) -> ::c_int;
pub fn pthread_setschedprio(
native: ::pthread_t,
priority: ::c_int,
) -> ::c_int;
- #[cfg(not(target_env = "uclibc"))]
- pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
-
- #[cfg(not(target_env = "uclibc"))]
- pub fn process_vm_readv(
- pid: ::pid_t,
- local_iov: *const ::iovec,
- liovcnt: ::c_ulong,
- remote_iov: *const ::iovec,
- riovcnt: ::c_ulong,
- flags: ::c_ulong,
- ) -> isize;
-
- #[cfg(not(target_env = "uclibc"))]
- pub fn process_vm_writev(
- pid: ::pid_t,
- local_iov: *const ::iovec,
- liovcnt: ::c_ulong,
- remote_iov: *const ::iovec,
- riovcnt: ::c_ulong,
- flags: ::c_ulong,
- ) -> isize;
-
pub fn reboot(how_to: ::c_int) -> ::c_int;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
@@ -3244,8 +3209,6 @@ extern "C" {
) -> ::ssize_t;
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
- #[cfg(not(target_env = "uclibc"))]
- pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
index 5bedb4f739..8f81c7e5a4 100644
--- a/src/unix/linux_like/linux/musl/mod.rs
+++ b/src/unix/linux_like/linux/musl/mod.rs
@@ -236,6 +236,19 @@ s! {
pub e_termination: ::c_short,
pub e_exit: ::c_short,
}
+
+ pub struct Elf64_Chdr {
+ pub ch_type: ::Elf64_Word,
+ pub ch_reserved: ::Elf64_Word,
+ pub ch_size: ::Elf64_Xword,
+ pub ch_addralign: ::Elf64_Xword,
+ }
+
+ pub struct Elf32_Chdr {
+ pub ch_type: ::Elf32_Word,
+ pub ch_size: ::Elf32_Word,
+ pub ch_addralign: ::Elf32_Word,
+ }
}
s_no_extra_traits! {
diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
index fac53f7b23..6b34faeade 100644
--- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
@@ -17,7 +17,6 @@ pub type __u64 = ::c_ulonglong;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
-
s! {
pub struct stat {
pub st_dev: ::dev_t,
diff --git a/src/unix/linux_like/linux/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs
index 971a7a118c..29aaf17944 100644
--- a/src/unix/linux_like/linux/uclibc/mips/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs
@@ -254,7 +254,6 @@ pub const POLLWRBAND: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
-
pub const VEOF: usize = 16;
pub const VEOL: usize = 17;
pub const VEOL2: usize = 6;
@@ -268,7 +267,6 @@ pub const TCSAFLUSH: ::c_int = 0x5410;
pub const CPU_SETSIZE: ::c_int = 0x400;
-
pub const EFD_NONBLOCK: ::c_int = 0x80;
pub const F_GETLK: ::c_int = 14;
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index 4c2e5f2827..18d137ee53 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -860,8 +860,6 @@ pub const IPPROTO_NONE: ::c_int = 59;
/// IP6 destination option
pub const IPPROTO_DSTOPTS: ::c_int = 60;
pub const IPPROTO_MTP: ::c_int = 92;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPPROTO_BEETPH: ::c_int = 94;
/// encapsulation header
pub const IPPROTO_ENCAP: ::c_int = 98;
/// Protocol indep. multicast
@@ -872,8 +870,6 @@ pub const IPPROTO_COMP: ::c_int = 108;
pub const IPPROTO_SCTP: ::c_int = 132;
pub const IPPROTO_MH: ::c_int = 135;
pub const IPPROTO_UDPLITE: ::c_int = 136;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPPROTO_MPLS: ::c_int = 137;
/// raw IP packet
pub const IPPROTO_RAW: ::c_int = 255;
@@ -912,8 +908,6 @@ pub const IPV6_JOIN_ANYCAST: ::c_int = 27;
pub const IPV6_LEAVE_ANYCAST: ::c_int = 28;
pub const IPV6_IPSEC_POLICY: ::c_int = 34;
pub const IPV6_XFRM_POLICY: ::c_int = 35;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPV6_HDRINCL: ::c_int = 36;
pub const IPV6_RECVPKTINFO: ::c_int = 49;
pub const IPV6_PKTINFO: ::c_int = 50;
pub const IPV6_RECVHOPLIMIT: ::c_int = 51;
@@ -949,10 +943,6 @@ pub const IPV6_PMTUDISC_DONT: ::c_int = 0;
pub const IPV6_PMTUDISC_WANT: ::c_int = 1;
pub const IPV6_PMTUDISC_DO: ::c_int = 2;
pub const IPV6_PMTUDISC_PROBE: ::c_int = 3;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
-#[cfg(not(target_env = "uclibc"))]
-pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_MAXSEG: ::c_int = 2;
@@ -1091,8 +1081,6 @@ pub const CLONE_NEWUSER: ::c_int = 0x10000000;
pub const CLONE_NEWPID: ::c_int = 0x20000000;
pub const CLONE_NEWNET: ::c_int = 0x40000000;
pub const CLONE_IO: ::c_int = 0x80000000;
-#[cfg(not(target_env = "uclibc"))]
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -1102,19 +1090,11 @@ pub const WCONTINUED: ::c_int = 0x00000008;
pub const WNOWAIT: ::c_int = 0x01000000;
// Options for personality(2).
-#[cfg(not(target_env = "uclibc"))]
-pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
pub const MMAP_PAGE_ZERO: ::c_int = 0x0100000;
-#[cfg(not(target_env = "uclibc"))]
-pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
-#[cfg(not(target_env = "uclibc"))]
-pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000;
pub const ADDR_LIMIT_32BIT: ::c_int = 0x0800000;
pub const SHORT_INODE: ::c_int = 0x1000000;
pub const WHOLE_SECONDS: ::c_int = 0x2000000;
pub const STICKY_TIMEOUTS: ::c_int = 0x4000000;
-#[cfg(not(target_env = "uclibc"))]
-pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
// Options set using PTRACE_SETOPTIONS.
pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
@@ -1125,12 +1105,6 @@ pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
-#[cfg(not(target_env = "uclibc"))]
-pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
-#[cfg(not(target_env = "uclibc"))]
-pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
-#[cfg(not(target_env = "uclibc"))]
-pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
// Wait extended result codes for the above trace options.
pub const PTRACE_EVENT_FORK: ::c_int = 1;
@@ -1327,6 +1301,24 @@ pub const ARPHRD_IEEE802154: u16 = 804;
pub const ARPHRD_VOID: u16 = 0xFFFF;
pub const ARPHRD_NONE: u16 = 0xFFFE;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ pub const IPPROTO_BEETPH: ::c_int = 94;
+ pub const IPPROTO_MPLS: ::c_int = 137;
+ pub const IPV6_HDRINCL: ::c_int = 36;
+ pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
+ pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
+ pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
+ pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
+ pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
+ pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000;
+ pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
+ pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
+ pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
+ pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
+ }
+}
+
const_fn! {
{const} fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
@@ -1554,26 +1546,6 @@ extern "C" {
count: ::size_t,
offset: off64_t,
) -> ::ssize_t;
- #[cfg(not(target_env = "uclibc"))]
- pub fn preadv64(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off64_t,
- ) -> ::ssize_t;
- pub fn pwrite64(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- offset: off64_t,
- ) -> ::ssize_t;
- #[cfg(not(target_env = "uclibc"))]
- pub fn pwritev64(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off64_t,
- ) -> ::ssize_t;
pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
pub fn readdir64_r(
dirp: *mut ::DIR,
@@ -1653,21 +1625,6 @@ extern "C" {
options: ::c_int,
rusage: *mut ::rusage,
) -> ::pid_t;
- #[cfg(not(target_env = "uclibc"))] // has separate non-const version of this function
- pub fn openpty(
- amaster: *mut ::c_int,
- aslave: *mut ::c_int,
- name: *mut ::c_char,
- termp: *const termios,
- winp: *const ::winsize,
- ) -> ::c_int;
- #[cfg(not(target_env = "uclibc"))] // has separate non-const version of this function
- pub fn forkpty(
- amaster: *mut ::c_int,
- name: *mut ::c_char,
- termp: *const termios,
- winp: *const ::winsize,
- ) -> ::pid_t;
pub fn login_tty(fd: ::c_int) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
@@ -1712,6 +1669,46 @@ extern "C" {
}
cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ extern "C" {
+ pub fn preadv64(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+ ) -> ::ssize_t;
+ pub fn pwrite64(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::size_t,
+ offset: off64_t,
+ ) -> ::ssize_t;
+ pub fn pwritev64(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+ ) -> ::ssize_t;
+ // uclibc has separate non-const version of this function
+ pub fn forkpty(
+ amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize,
+ ) -> ::pid_t;
+ // uclibc has separate non-const version of this function
+ pub fn openpty(
+ amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize,
+ ) -> ::c_int;
+ }
+ }
+}
+
+cfg_if! {
if #[cfg(target_os = "emscripten")] {
mod emscripten;
pub use self::emscripten::*;
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 184be046f5..42f99ca715 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -458,11 +458,7 @@ extern "C" {
ptr: *mut *mut c_char,
sizeloc: *mut size_t,
) -> *mut FILE;
- #[cfg(not(target_env = "uclibc"))]
- pub fn open_wmemstream(
- ptr: *mut *mut wchar_t,
- sizeloc: *mut size_t,
- ) -> *mut FILE;
+
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
@@ -1581,6 +1577,17 @@ extern "C" {
}
cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ extern "C" {
+ pub fn open_wmemstream(
+ ptr: *mut *mut wchar_t,
+ sizeloc: *mut size_t,
+ ) -> *mut FILE;
+ }
+ }
+}
+
+cfg_if! {
if #[cfg(not(target_os = "redox"))] {
extern {
pub fn getsid(pid: pid_t) -> pid_t;