summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonah Petri <jonah@petri.us>2020-11-09 13:25:43 -0500
committerJonah Petri <jonah@petri.us>2021-02-12 20:42:59 -0500
commit10c54181b41deb1f05c333a8c7ba1c9fd921ba3a (patch)
tree3e8c30c284a4cc0157b3979bfdaa027a75ec96cb
parentfe8470be639aa1bb7a6704e8c827628a13778f9a (diff)
downloadrust-libc-10c54181b41deb1f05c333a8c7ba1c9fd921ba3a.tar.gz
uclibc -> linux-like/linux: Manual consolitation of redundant structs and fns.
-rwxr-xr-xlibc-test/build.rs33
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs20
-rw-r--r--src/unix/linux_like/linux/mod.rs239
-rw-r--r--src/unix/linux_like/linux/musl/mod.rs20
-rw-r--r--src/unix/linux_like/linux/uclibc/align.rs38
-rw-r--r--src/unix/linux_like/linux/uclibc/arm/mod.rs118
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs47
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mod.rs78
-rw-r--r--src/unix/linux_like/linux/uclibc/mod.rs551
-rw-r--r--src/unix/linux_like/linux/uclibc/x86_64/align.rs77
-rw-r--r--src/unix/linux_like/linux/uclibc/x86_64/mod.rs7
-rw-r--r--src/unix/linux_like/linux/uclibc/x86_64/no_align.rs59
-rw-r--r--src/unix/linux_like/mod.rs36
-rw-r--r--src/unix/mod.rs10
14 files changed, 467 insertions, 866 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index c259f00ba8..a743e726cd 100755
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -2267,6 +2267,7 @@ fn test_linux(target: &str) {
let gnuabihf = target.contains("gnueabihf");
let x86_64_gnux32 = target.contains("gnux32") && x86_64;
let riscv64 = target.contains("riscv64");
+ let uclibc = target.contains("uclibc");
let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
@@ -2377,7 +2378,8 @@ fn test_linux(target: &str) {
[!(x32 || musl || gnu)]: "sys/sysctl.h",
// <execinfo.h> is not supported by musl:
// https://www.openwall.com/lists/musl/2015/04/09/3
- [!musl]: "execinfo.h",
+ // <execinfo.h> is not present on uclibc.
+ [!(musl || uclibc)]: "execinfo.h",
}
// Include linux headers at the end:
@@ -2419,8 +2421,9 @@ fn test_linux(target: &str) {
"linux/sockios.h",
"linux/vm_sockets.h",
"linux/wait.h",
- "sys/auxv.h",
"sys/fanotify.h",
+ // <sys/auxv.h> is not present on uclibc
+ [!uclibc]: "sys/auxv.h",
}
// note: aio.h must be included before sys/mount.h
@@ -2428,7 +2431,8 @@ fn test_linux(target: &str) {
cfg:
"sys/xattr.h",
"sys/sysinfo.h",
- "aio.h",
+ // AIO is not supported by uclibc:
+ [!uclibc]: "aio.h",
}
cfg.type_name(move |ty, is_struct, is_union| {
@@ -2650,6 +2654,8 @@ 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):
"STATX_MNT_ID" => true,
@@ -2698,6 +2704,27 @@ fn test_linux(target: &str) {
// FIXME: It now takes c_void instead of timezone since glibc 2.31.
"gettimeofday" if gnu => true,
+ // These are all implemented as static inline functions in uclibc, so
+ // they cannot be linked against.
+ // If implementations are required, they might need to be implemented
+ // in this crate.
+ "posix_spawnattr_init" if uclibc => true,
+ "posix_spawnattr_destroy" if uclibc => true,
+ "posix_spawnattr_getsigdefault" if uclibc => true,
+ "posix_spawnattr_setsigdefault" if uclibc => true,
+ "posix_spawnattr_getsigmask" if uclibc => true,
+ "posix_spawnattr_setsigmask" if uclibc => true,
+ "posix_spawnattr_getflags" if uclibc => true,
+ "posix_spawnattr_setflags" if uclibc => true,
+ "posix_spawnattr_getpgroup" if uclibc => true,
+ "posix_spawnattr_setpgroup" if uclibc => true,
+ "posix_spawnattr_getschedpolicy" if uclibc => true,
+ "posix_spawnattr_setschedpolicy" if uclibc => true,
+ "posix_spawnattr_getschedparam" if uclibc => true,
+ "posix_spawnattr_setschedparam" if uclibc => true,
+ "posix_spawn_file_actions_init" if uclibc => true,
+ "posix_spawn_file_actions_destroy" if uclibc => true,
+
_ => false,
}
});
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index 0f531c1784..b5a9402e76 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -620,6 +620,22 @@ pub const TCP_FASTOPEN: ::c_int = 23;
pub const TCP_TIMESTAMP: ::c_int = 24;
pub const TCP_FASTOPEN_CONNECT: ::c_int = 30;
+pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000;
+pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
+// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0
+pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
+
+pub const AF_IB: ::c_int = 27;
+pub const AF_MPLS: ::c_int = 28;
+pub const AF_NFC: ::c_int = 39;
+pub const AF_VSOCK: ::c_int = 40;
+pub const AF_XDP: ::c_int = 44;
+pub const PF_IB: ::c_int = AF_IB;
+pub const PF_MPLS: ::c_int = AF_MPLS;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+pub const PF_XDP: ::c_int = AF_XDP;
+
/* DCCP socket options */
pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1;
pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2;
@@ -646,6 +662,7 @@ pub const SIGEV_THREAD_ID: ::c_int = 4;
pub const BUFSIZ: ::c_uint = 8192;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
+pub const FILENAME_MAX: ::c_uint = 4096;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
@@ -859,9 +876,6 @@ pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-pub const SEEK_DATA: ::c_int = 3;
-pub const SEEK_HOLE: ::c_int = 4;
-
// linux/fs.h
// Flags for preadv2/pwritev2
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index ca16430b26..d7c7c2c187 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -417,19 +417,6 @@ s! {
pub sh_entsize: Elf64_Xword,
}
- pub struct Elf32_Chdr {
- pub ch_type: Elf32_Word,
- pub ch_size: Elf32_Word,
- pub ch_addralign: Elf32_Word,
- }
-
- 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 ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
@@ -538,6 +525,25 @@ 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,
@@ -908,78 +914,82 @@ cfg_if! {
}
}
-pub const ABDAY_1: ::nl_item = 0x20000;
-pub const ABDAY_2: ::nl_item = 0x20001;
-pub const ABDAY_3: ::nl_item = 0x20002;
-pub const ABDAY_4: ::nl_item = 0x20003;
-pub const ABDAY_5: ::nl_item = 0x20004;
-pub const ABDAY_6: ::nl_item = 0x20005;
-pub const ABDAY_7: ::nl_item = 0x20006;
-
-pub const DAY_1: ::nl_item = 0x20007;
-pub const DAY_2: ::nl_item = 0x20008;
-pub const DAY_3: ::nl_item = 0x20009;
-pub const DAY_4: ::nl_item = 0x2000A;
-pub const DAY_5: ::nl_item = 0x2000B;
-pub const DAY_6: ::nl_item = 0x2000C;
-pub const DAY_7: ::nl_item = 0x2000D;
-
-pub const ABMON_1: ::nl_item = 0x2000E;
-pub const ABMON_2: ::nl_item = 0x2000F;
-pub const ABMON_3: ::nl_item = 0x20010;
-pub const ABMON_4: ::nl_item = 0x20011;
-pub const ABMON_5: ::nl_item = 0x20012;
-pub const ABMON_6: ::nl_item = 0x20013;
-pub const ABMON_7: ::nl_item = 0x20014;
-pub const ABMON_8: ::nl_item = 0x20015;
-pub const ABMON_9: ::nl_item = 0x20016;
-pub const ABMON_10: ::nl_item = 0x20017;
-pub const ABMON_11: ::nl_item = 0x20018;
-pub const ABMON_12: ::nl_item = 0x20019;
-
-pub const MON_1: ::nl_item = 0x2001A;
-pub const MON_2: ::nl_item = 0x2001B;
-pub const MON_3: ::nl_item = 0x2001C;
-pub const MON_4: ::nl_item = 0x2001D;
-pub const MON_5: ::nl_item = 0x2001E;
-pub const MON_6: ::nl_item = 0x2001F;
-pub const MON_7: ::nl_item = 0x20020;
-pub const MON_8: ::nl_item = 0x20021;
-pub const MON_9: ::nl_item = 0x20022;
-pub const MON_10: ::nl_item = 0x20023;
-pub const MON_11: ::nl_item = 0x20024;
-pub const MON_12: ::nl_item = 0x20025;
-
-pub const AM_STR: ::nl_item = 0x20026;
-pub const PM_STR: ::nl_item = 0x20027;
-
-pub const D_T_FMT: ::nl_item = 0x20028;
-pub const D_FMT: ::nl_item = 0x20029;
-pub const T_FMT: ::nl_item = 0x2002A;
-pub const T_FMT_AMPM: ::nl_item = 0x2002B;
-
-pub const ERA: ::nl_item = 0x2002C;
-pub const ERA_D_FMT: ::nl_item = 0x2002E;
-pub const ALT_DIGITS: ::nl_item = 0x2002F;
-pub const ERA_D_T_FMT: ::nl_item = 0x20030;
-pub const ERA_T_FMT: ::nl_item = 0x20031;
-
-pub const CODESET: ::nl_item = 14;
-
-pub const CRNCYSTR: ::nl_item = 0x4000F;
-
-pub const RUSAGE_THREAD: ::c_int = 1;
-pub const RUSAGE_CHILDREN: ::c_int = -1;
-
-pub const RADIXCHAR: ::nl_item = 0x10000;
-pub const THOUSEP: ::nl_item = 0x10001;
+cfg_if! {
+ if #[cfg(any(target_env = "gnu", target_env = "musl"))] {
+ pub const ABDAY_1: ::nl_item = 0x20000;
+ pub const ABDAY_2: ::nl_item = 0x20001;
+ pub const ABDAY_3: ::nl_item = 0x20002;
+ pub const ABDAY_4: ::nl_item = 0x20003;
+ pub const ABDAY_5: ::nl_item = 0x20004;
+ pub const ABDAY_6: ::nl_item = 0x20005;
+ pub const ABDAY_7: ::nl_item = 0x20006;
+
+ pub const DAY_1: ::nl_item = 0x20007;
+ pub const DAY_2: ::nl_item = 0x20008;
+ pub const DAY_3: ::nl_item = 0x20009;
+ pub const DAY_4: ::nl_item = 0x2000A;
+ pub const DAY_5: ::nl_item = 0x2000B;
+ pub const DAY_6: ::nl_item = 0x2000C;
+ pub const DAY_7: ::nl_item = 0x2000D;
+
+ pub const ABMON_1: ::nl_item = 0x2000E;
+ pub const ABMON_2: ::nl_item = 0x2000F;
+ pub const ABMON_3: ::nl_item = 0x20010;
+ pub const ABMON_4: ::nl_item = 0x20011;
+ pub const ABMON_5: ::nl_item = 0x20012;
+ pub const ABMON_6: ::nl_item = 0x20013;
+ pub const ABMON_7: ::nl_item = 0x20014;
+ pub const ABMON_8: ::nl_item = 0x20015;
+ pub const ABMON_9: ::nl_item = 0x20016;
+ pub const ABMON_10: ::nl_item = 0x20017;
+ pub const ABMON_11: ::nl_item = 0x20018;
+ pub const ABMON_12: ::nl_item = 0x20019;
+
+ pub const MON_1: ::nl_item = 0x2001A;
+ pub const MON_2: ::nl_item = 0x2001B;
+ pub const MON_3: ::nl_item = 0x2001C;
+ pub const MON_4: ::nl_item = 0x2001D;
+ pub const MON_5: ::nl_item = 0x2001E;
+ pub const MON_6: ::nl_item = 0x2001F;
+ pub const MON_7: ::nl_item = 0x20020;
+ pub const MON_8: ::nl_item = 0x20021;
+ pub const MON_9: ::nl_item = 0x20022;
+ pub const MON_10: ::nl_item = 0x20023;
+ pub const MON_11: ::nl_item = 0x20024;
+ pub const MON_12: ::nl_item = 0x20025;
+
+ pub const AM_STR: ::nl_item = 0x20026;
+ pub const PM_STR: ::nl_item = 0x20027;
+
+ pub const D_T_FMT: ::nl_item = 0x20028;
+ pub const D_FMT: ::nl_item = 0x20029;
+ pub const T_FMT: ::nl_item = 0x2002A;
+ pub const T_FMT_AMPM: ::nl_item = 0x2002B;
+
+ pub const ERA: ::nl_item = 0x2002C;
+ pub const ERA_D_FMT: ::nl_item = 0x2002E;
+ pub const ALT_DIGITS: ::nl_item = 0x2002F;
+ pub const ERA_D_T_FMT: ::nl_item = 0x20030;
+ pub const ERA_T_FMT: ::nl_item = 0x20031;
+
+ pub const CODESET: ::nl_item = 14;
+ pub const CRNCYSTR: ::nl_item = 0x4000F;
+ pub const RADIXCHAR: ::nl_item = 0x10000;
+ pub const THOUSEP: ::nl_item = 0x10001;
+ pub const YESEXPR: ::nl_item = 0x50000;
+ pub const NOEXPR: ::nl_item = 0x50001;
+ pub const YESSTR: ::nl_item = 0x50002;
+ pub const NOSTR: ::nl_item = 0x50003;
+ }
+}
-pub const YESEXPR: ::nl_item = 0x50000;
-pub const NOEXPR: ::nl_item = 0x50001;
-pub const YESSTR: ::nl_item = 0x50002;
-pub const NOSTR: ::nl_item = 0x50003;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ pub const RUSAGE_THREAD: ::c_int = 1;
+ }
+}
+pub const RUSAGE_CHILDREN: ::c_int = -1;
-pub const FILENAME_MAX: ::c_uint = 4096;
pub const L_tmpnam: ::c_uint = 20;
pub const _PC_LINK_MAX: ::c_int = 0;
pub const _PC_MAX_CANON: ::c_int = 1;
@@ -1289,6 +1299,10 @@ pub const IFF_DETACH_QUEUE: ::c_int = 0x0400;
pub const IFF_PERSIST: ::c_int = 0x0800;
pub const IFF_NOFILTER: ::c_int = 0x1000;
+// Since Linux 3.1
+pub const SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
+
pub const ST_RDONLY: ::c_ulong = 1;
pub const ST_NOSUID: ::c_ulong = 2;
pub const ST_NODEV: ::c_ulong = 4;
@@ -1309,6 +1323,7 @@ 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! {
@@ -1355,17 +1370,6 @@ pub const IPPROTO_MPTCP: ::c_int = 262;
)]
pub const IPPROTO_MAX: ::c_int = 256;
-pub const AF_IB: ::c_int = 27;
-pub const AF_MPLS: ::c_int = 28;
-pub const AF_NFC: ::c_int = 39;
-pub const AF_VSOCK: ::c_int = 40;
-pub const AF_XDP: ::c_int = 44;
-pub const PF_IB: ::c_int = AF_IB;
-pub const PF_MPLS: ::c_int = AF_MPLS;
-pub const PF_NFC: ::c_int = AF_NFC;
-pub const PF_VSOCK: ::c_int = AF_VSOCK;
-pub const PF_XDP: ::c_int = AF_XDP;
-
// System V IPC
pub const IPC_PRIVATE: ::key_t = 0;
@@ -1382,6 +1386,7 @@ 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;
@@ -1390,15 +1395,18 @@ 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;
pub const SHM_HUGETLB: ::c_int = 0o4000;
+#[cfg(not(all(target_env = "uclibc", target_arch = "mips")))]
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;
@@ -1451,14 +1459,18 @@ pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
-pub const AIO_CANCELED: ::c_int = 0;
-pub const AIO_NOTCANCELED: ::c_int = 1;
-pub const AIO_ALLDONE: ::c_int = 2;
-pub const LIO_READ: ::c_int = 0;
-pub const LIO_WRITE: ::c_int = 1;
-pub const LIO_NOP: ::c_int = 2;
-pub const LIO_WAIT: ::c_int = 0;
-pub const LIO_NOWAIT: ::c_int = 1;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ pub const AIO_CANCELED: ::c_int = 0;
+ pub const AIO_NOTCANCELED: ::c_int = 1;
+ pub const AIO_ALLDONE: ::c_int = 2;
+ pub const LIO_READ: ::c_int = 0;
+ pub const LIO_WRITE: ::c_int = 1;
+ pub const LIO_NOP: ::c_int = 2;
+ pub const LIO_WAIT: ::c_int = 0;
+ pub const LIO_NOWAIT: ::c_int = 1;
+ }
+}
pub const MREMAP_MAYMOVE: ::c_int = 1;
pub const MREMAP_FIXED: ::c_int = 2;
@@ -1621,7 +1633,9 @@ 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;
@@ -1634,6 +1648,7 @@ pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
pub const IPV6_RTHDR_STRICT: ::c_int = 1;
pub const IUTF8: ::tcflag_t = 0x00004000;
+#[cfg(not(all(target_env = "uclibc", target_arch = "mips")))]
pub const CMSPAR: ::tcflag_t = 0o10000000000;
pub const MFD_CLOEXEC: ::c_uint = 0x0001;
@@ -1952,6 +1967,7 @@ 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
@@ -2073,6 +2089,7 @@ 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;
@@ -2377,7 +2394,9 @@ 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
@@ -2518,10 +2537,6 @@ pub const FAN_MARK_ADD: ::c_uint = 0x0000_0001;
pub const FAN_MARK_REMOVE: ::c_uint = 0x0000_0002;
pub const FAN_MARK_DONT_FOLLOW: ::c_uint = 0x0000_0004;
pub const FAN_MARK_ONLYDIR: ::c_uint = 0x0000_0008;
-pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000;
-pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
-// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0
-pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
pub const FAN_MARK_IGNORED_MASK: ::c_uint = 0x0000_0020;
pub const FAN_MARK_IGNORED_SURV_MODIFY: ::c_uint = 0x0000_0040;
pub const FAN_MARK_FLUSH: ::c_uint = 0x0000_0080;
@@ -2822,7 +2837,6 @@ extern "C" {
) -> ::c_int;
}
-
extern "C" {
#[cfg_attr(not(target_env = "musl"), link_name = "__xpg_strerror_r")]
pub fn strerror_r(
@@ -3035,12 +3049,14 @@ 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,
@@ -3116,6 +3132,7 @@ 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,
@@ -3129,7 +3146,10 @@ extern "C" {
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,
@@ -3138,6 +3158,8 @@ extern "C" {
riovcnt: ::c_ulong,
flags: ::c_ulong,
) -> isize;
+
+ #[cfg(not(target_env = "uclibc"))]
pub fn process_vm_writev(
pid: ::pid_t,
local_iov: *const ::iovec,
@@ -3146,6 +3168,7 @@ extern "C" {
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;
@@ -3220,6 +3243,8 @@ extern "C" {
addrlen: *mut ::socklen_t,
) -> ::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;
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
index ca2322d7cc..5bedb4f739 100644
--- a/src/unix/linux_like/linux/musl/mod.rs
+++ b/src/unix/linux_like/linux/musl/mod.rs
@@ -484,6 +484,7 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000;
pub const BUFSIZ: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 10000;
pub const FOPEN_MAX: ::c_uint = 1000;
+pub const FILENAME_MAX: ::c_uint = 4096;
pub const O_PATH: ::c_int = 0o10000000;
pub const O_EXEC: ::c_int = 0o10000000;
pub const O_SEARCH: ::c_int = 0o10000000;
@@ -555,10 +556,23 @@ pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
pub const PTRACE_LISTEN: ::c_int = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
-pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000;
+pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
+// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0
+pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
+
+pub const AF_IB: ::c_int = 27;
+pub const AF_MPLS: ::c_int = 28;
+pub const AF_NFC: ::c_int = 39;
+pub const AF_VSOCK: ::c_int = 40;
+pub const AF_XDP: ::c_int = 44;
+pub const PF_IB: ::c_int = AF_IB;
+pub const PF_MPLS: ::c_int = AF_MPLS;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+pub const PF_XDP: ::c_int = AF_XDP;
-pub const SEEK_DATA: ::c_int = 3;
-pub const SEEK_HOLE: ::c_int = 4;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
diff --git a/src/unix/linux_like/linux/uclibc/align.rs b/src/unix/linux_like/linux/uclibc/align.rs
index 76b524d0c0..e6610bb7b9 100644
--- a/src/unix/linux_like/linux/uclibc/align.rs
+++ b/src/unix/linux_like/linux/uclibc/align.rs
@@ -24,43 +24,5 @@ macro_rules! expand_align {
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}
-
- s_no_extra_traits! {
- #[repr(align(8))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_cond_t {
- size: [u8; ::__SIZEOF_PTHREAD_COND_T],
- }
-
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_mutex_t {
- size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
- }
-
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_rwlock_t {
- size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
- }
- }
};
}
diff --git a/src/unix/linux_like/linux/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs
index 8caea8a8d5..1cafdb61c4 100644
--- a/src/unix/linux_like/linux/uclibc/arm/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs
@@ -56,13 +56,13 @@ s! {
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
+ pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
+ pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
- pub __unused4: ::c_ulong,
- pub __unused5: ::c_ulong,
+ pub st_ctime_nsec: ::c_long,
+ pub __uclibc_unused4: ::c_ulong,
+ pub __uclibc_unused5: ::c_ulong,
}
pub struct stat64
@@ -80,11 +80,11 @@ s! {
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_t,
pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
+ pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
+ pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
+ pub st_ctime_nsec: ::c_long,
pub st_ino: ::ino64_t,
}
@@ -125,7 +125,8 @@ s! {
pub f_fsid: ::fsid_t,
pub f_namelen: ::c_int,
pub f_frsize: ::c_int,
- pub f_spare: [::c_int; 5],
+ pub f_flags: ::c_int,
+ pub f_spare: [::c_int; 4],
}
pub struct statfs64 {
@@ -139,23 +140,8 @@ s! {
pub f_fsid: ::fsid_t,
pub f_namelen: ::c_int,
pub f_frsize: ::c_int,
- pub f_spare: [::c_int; 5],
- }
-
- pub struct statvfs {
- pub f_bsize: ::c_ulong,
- pub f_frsize: ::c_ulong,
- pub f_blocks: ::fsblkcnt_t,
- pub f_bfree: ::fsblkcnt_t,
- pub f_bavail: ::fsblkcnt_t,
- pub f_files: ::fsfilcnt_t,
- pub f_ffree: ::fsfilcnt_t,
- pub f_favail: ::fsfilcnt_t,
- pub f_fsid: ::c_ulong,
- __f_unused: ::c_int,
- pub f_flag: ::c_ulong,
- pub f_namemax: ::c_ulong,
- __f_spare: [::c_int; 6],
+ pub f_flags: ::c_int,
+ pub f_spare: [::c_int; 4],
}
pub struct statvfs64 {
@@ -180,10 +166,8 @@ s! {
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
- // uClibc defines sa_flags as `unsigned long int`,
- // but nix crate expects `int`
- pub sa_flags: ::c_int,
- pub sa_restorer: *mut ::c_void,
+ pub sa_flags: ::c_ulong,
+ pub sa_restorer: ::Option<extern fn()>,
pub sa_mask: sigset_t,
}
@@ -221,58 +205,41 @@ s! {
pub __pad1: ::c_ushort,
pub __seq: ::c_ushort,
pub __pad2: ::c_ushort,
- pub __unused1: ::c_ulong,
- pub __unused2: ::c_ulong,
+ pub __uclibc_unused1: ::c_ulong,
+ pub __uclibc_unused2: ::c_ulong,
}
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
pub msg_stime: ::time_t,
- pub __unused1: ::c_ulong,
+ pub __uclibc_unused1: ::c_ulong,
pub msg_rtime: ::time_t,
- pub __unused2: ::c_ulong,
+ pub __uclibc_unused2: ::c_ulong,
pub msg_ctime: ::time_t,
- pub __unused3: ::c_ulong,
+ pub __uclibc_unused3: ::c_ulong,
pub __msg_cbytes: ::c_ulong,
pub msg_qnum: ::msgqnum_t,
pub msg_qbytes: ::msglen_t,
pub msg_lspid: ::pid_t,
pub msg_lrpid: ::pid_t,
- pub __unused4: ::c_ulong,
- pub __unused5: ::c_ulong,
+ pub __uclibc_unused4: ::c_ulong,
+ pub __uclibc_unused5: ::c_ulong,
}
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_atime: ::time_t,
- pub __unused1: ::c_ulong,
+ pub __uclibc_unused1: ::c_ulong,
pub shm_dtime: ::time_t,
- pub __unused2: ::c_ulong,
+ pub __uclibc_unused2: ::c_ulong,
pub shm_ctime: ::time_t,
- pub __unused3: ::c_ulong,
+ pub __uclibc_unused3: ::c_ulong,
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
- pub __unused4: ::c_ulong,
- pub __unused5: ::c_ulong,
- }
-
- pub struct ucred {
- pub pid: ::pid_t,
- pub uid: ::uid_t,
- pub gid: ::gid_t,
- }
-
- pub struct regex_t {
- __buffer: *mut ::c_void,
- __allocated: ::size_t,
- __used: ::size_t,
- __syntax: ::c_ulong,
- __fastmap: *mut ::c_char,
- __translate: *mut ::c_char,
- __re_nsub: ::size_t,
- __bitfield: u8,
+ pub __uclibc_unused4: ::c_ulong,
+ pub __uclibc_unused5: ::c_ulong,
}
}
@@ -291,10 +258,7 @@ pub const NCCS: usize = 32;
// I wasn't able to find those constants
// in uclibc build environment for armv7
-pub const EPOLLWAKEUP: ::c_int = 0x20000000; // from linux/other/mod.rs
-pub const EXTPROC: ::tcflag_t = 0o200000; // from asm-generic/termbits.h
pub const MAP_HUGETLB: ::c_int = 0x040000; // from linux/other/mod.rs
-pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
pub const SO_BUSY_POLL: ::c_int = 46; // from src/unix/linux_like/mod.rs
pub const SO_PEEK_OFF: ::c_int = 42; // from src/unix/linux_like/mod.rs
pub const SO_REUSEPORT: ::c_int = 15; // from src/unix/linux_like/mod.rs
@@ -485,15 +449,21 @@ pub const OLCUC: ::tcflag_t = 0x2;
pub const ONLCR: ::tcflag_t = 0x4;
pub const O_ACCMODE: ::c_int = 0x3;
pub const O_APPEND: ::c_int = 0x400;
+pub const O_ASYNC: ::c_int = 0o20000;
pub const O_CREAT: ::c_int = 0x40;
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
-pub const O_DSYNC: ::c_int = 0x1000;
+pub const O_DSYNC: ::c_int = O_SYNC;
pub const O_EXCL: ::c_int = 0x80;
-pub const O_NDELAY: ::c_int = 0x800;
+pub const O_FSYNC: ::c_int = O_SYNC;
+pub const O_LARGEFILE: ::c_int = 0o400000;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
+pub const O_NOATIME: ::c_int = 0o1000000;
pub const O_NOCTTY: ::c_int = 0x100;
pub const O_NOFOLLOW: ::c_int = 0x8000;
pub const O_NONBLOCK: ::c_int = 0x800;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_RSYNC: ::c_int = O_SYNC;
pub const O_SYNC: ::c_int = 0o10000;
pub const O_TRUNC: ::c_int = 0x200;
pub const PARENB: ::tcflag_t = 0x100;
@@ -502,13 +472,16 @@ pub const PENDIN: ::tcflag_t = 0x4000;
pub const POLLWRBAND: ::c_short = 0x200;
pub const POLLWRNORM: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
-pub const SA_NOCLDSTOP: ::c_int = 0x1;
-pub const SA_NOCLDWAIT: ::c_int = 0x2;
-pub const SA_NODEFER: ::c_int = 0x40000000;
-pub const SA_ONSTACK: ::c_int = 0x8000000;
-pub const SA_RESETHAND: ::c_int = 0x80000000;
-pub const SA_RESTART: ::c_int = 0x10000000;
-pub const SA_SIGINFO: ::c_int = 0x4;
+
+// These are typed unsigned to match sigaction
+pub const SA_NOCLDSTOP: ::c_ulong = 0x1;
+pub const SA_NOCLDWAIT: ::c_ulong = 0x2;
+pub const SA_SIGINFO: ::c_ulong = 0x4;
+pub const SA_NODEFER: ::c_ulong = 0x40000000;
+pub const SA_ONSTACK: ::c_ulong = 0x8000000;
+pub const SA_RESETHAND: ::c_ulong = 0x80000000;
+pub const SA_RESTART: ::c_ulong = 0x10000000;
+
pub const SFD_CLOEXEC: ::c_int = 0x80000;
pub const SFD_NONBLOCK: ::c_int = 0x800;
pub const SIGBUS: ::c_int = 0x7;
@@ -555,6 +528,7 @@ pub const SO_PEERCRED: ::c_int = 0x11;
pub const SO_PRIORITY: ::c_int = 0xc;
pub const SO_PROTOCOL: ::c_int = 0x26;
pub const SO_RCVBUF: ::c_int = 0x8;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
pub const SO_RCVLOWAT: ::c_int = 0x12;
pub const SO_RCVTIMEO: ::c_int = 0x14;
pub const SO_REUSEADDR: ::c_int = 0x2;
@@ -589,6 +563,8 @@ pub const VTIME: usize = 0x5;
pub const VWERASE: usize = 0xe;
pub const XTABS: ::tcflag_t = 0x1800;
+pub const MADV_SOFT_OFFLINE: ::c_int = 101;
+
// Syscall table is copied from src/unix/notbsd/linux/musl/b32/arm.rs
pub const SYS_restart_syscall: ::c_long = 0;
pub const SYS_exit: ::c_long = 1;
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 31bca589ef..fac53f7b23 100644
--- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
@@ -12,7 +12,11 @@ pub type blksize_t = i32;
pub type nlink_t = u32;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
-pub type rlim_t = c_ulong;
+pub type rlim_t = ::c_ulong;
+pub type __u64 = ::c_ulonglong;
+pub type fsblkcnt64_t = u64;
+pub type fsfilcnt64_t = u64;
+
s! {
pub struct stat {
@@ -61,6 +65,22 @@ s! {
st_pad5: [::c_long; 14],
}
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt64_t,
+ pub f_bfree: ::fsblkcnt64_t,
+ pub f_bavail: ::fsblkcnt64_t,
+ pub f_files: ::fsfilcnt64_t,
+ pub f_ffree: ::fsfilcnt64_t,
+ pub f_favail: ::fsfilcnt64_t,
+ pub f_fsid: ::c_ulong,
+ pub __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ pub __f_spare: [::c_int; 6],
+ }
+
pub struct pthread_attr_t {
__size: [u32; 9]
}
@@ -169,6 +189,21 @@ s! {
f_spare: [::c_long; 6],
}
+ pub struct statfs64 {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ pub f_frsize: ::c_long,
+ pub f_blocks: ::fsblkcnt64_t,
+ pub f_bfree: ::fsblkcnt64_t,
+ pub f_files: ::fsblkcnt64_t,
+ pub f_ffree: ::fsblkcnt64_t,
+ pub f_bavail: ::fsblkcnt64_t,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 5],
+ }
+
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
@@ -222,10 +257,14 @@ s! {
}
}
-pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_ATTR_T: usize = 36;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
-pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 20;
+pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
@@ -599,7 +638,6 @@ extern "C" {
newlen: ::size_t,
) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
- pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
pub fn glob64(
pattern: *const ::c_char,
flags: ::c_int,
@@ -609,7 +647,6 @@ extern "C" {
pglob: *mut glob64_t,
) -> ::c_int;
pub fn globfree64(pglob: *mut glob64_t);
- pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
pub fn pthread_attr_getaffinity_np(
attr: *const ::pthread_attr_t,
cpusetsize: ::size_t,
diff --git a/src/unix/linux_like/linux/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs
index de76971ae3..971a7a118c 100644
--- a/src/unix/linux_like/linux/uclibc/mips/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs
@@ -37,15 +37,12 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000;
pub const BUFSIZ: ::c_uint = 4096;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
-pub const POSIX_FADV_DONTNEED: ::c_int = 4;
-pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const O_ACCMODE: ::c_int = 3;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
-pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
pub const RLIMIT_NOFILE: ::c_int = 5;
@@ -115,7 +112,6 @@ pub const ENOPROTOOPT: ::c_int = 99;
pub const EPROTONOSUPPORT: ::c_int = 120;
pub const ESOCKTNOSUPPORT: ::c_int = 121;
pub const EOPNOTSUPP: ::c_int = 122;
-pub const ENOTSUP: ::c_int = EOPNOTSUPP;
pub const EPFNOSUPPORT: ::c_int = 123;
pub const EAFNOSUPPORT: ::c_int = 124;
pub const EADDRINUSE: ::c_int = 125;
@@ -204,7 +200,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
pub const SO_PEERNAME: ::c_int = 28;
pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SO_PEERSEC: ::c_int = 30;
pub const SO_SNDBUFFORCE: ::c_int = 31;
pub const SO_RCVBUFFORCE: ::c_int = 33;
@@ -212,8 +207,6 @@ pub const SO_PASSSEC: ::c_int = 34;
pub const SO_TIMESTAMPNS: ::c_int = 35;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SO_MARK: ::c_int = 36;
-pub const SO_TIMESTAMPING: ::c_int = 37;
-pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
pub const SO_RXQ_OVFL: ::c_int = 40;
pub const SO_WIFI_STATUS: ::c_int = 41;
pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
@@ -256,39 +249,11 @@ pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
-pub const POLLRDNORM: ::c_short = 0x040;
pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
pub const POLLWRBAND: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
-pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
-pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
-pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
-pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
-pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
-pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
-pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
-pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
-pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
-pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
-pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
-pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
-pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
-pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
-pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
-pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
-pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
-pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
-pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
-pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
-pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
-pub const TMPFS_MAGIC: ::c_long = 0x01021994;
-pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
pub const VEOF: usize = 16;
pub const VEOL: usize = 17;
@@ -297,36 +262,12 @@ pub const VMIN: usize = 4;
pub const IEXTEN: ::tcflag_t = 0x00000100;
pub const TOSTOP: ::tcflag_t = 0x00008000;
pub const FLUSHO: ::tcflag_t = 0x00002000;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const TCSANOW: ::c_int = 0x540e;
pub const TCSADRAIN: ::c_int = 0x540f;
pub const TCSAFLUSH: ::c_int = 0x5410;
pub const CPU_SETSIZE: ::c_int = 0x400;
-pub const PTRACE_TRACEME: ::c_uint = 0;
-pub const PTRACE_PEEKTEXT: ::c_uint = 1;
-pub const PTRACE_PEEKDATA: ::c_uint = 2;
-pub const PTRACE_PEEKUSER: ::c_uint = 3;
-pub const PTRACE_POKETEXT: ::c_uint = 4;
-pub const PTRACE_POKEDATA: ::c_uint = 5;
-pub const PTRACE_POKEUSER: ::c_uint = 6;
-pub const PTRACE_CONT: ::c_uint = 7;
-pub const PTRACE_KILL: ::c_uint = 8;
-pub const PTRACE_SINGLESTEP: ::c_uint = 9;
-pub const PTRACE_ATTACH: ::c_uint = 16;
-pub const PTRACE_DETACH: ::c_uint = 17;
-pub const PTRACE_SYSCALL: ::c_uint = 24;
-pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
-pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
-pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
-pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
-pub const PTRACE_GETFPREGS: ::c_uint = 14;
-pub const PTRACE_SETFPREGS: ::c_uint = 15;
-pub const PTRACE_GETFPXREGS: ::c_uint = 18;
-pub const PTRACE_SETFPXREGS: ::c_uint = 19;
-pub const PTRACE_GETREGS: ::c_uint = 12;
-pub const PTRACE_SETREGS: ::c_uint = 13;
pub const EFD_NONBLOCK: ::c_int = 0x80;
@@ -370,28 +311,9 @@ pub const TIOCMSET: ::c_ulong = 0x741a;
pub const FIONREAD: ::c_ulong = 0x467f;
pub const TIOCCONS: ::c_ulong = 0x80047478;
-pub const RTLD_DEEPBIND: ::c_int = 0x10;
pub const RTLD_GLOBAL: ::c_int = 0x4;
pub const RTLD_NOLOAD: ::c_int = 0x8;
-pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
-pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
-pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
-pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
-pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
-
-pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
-pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
-pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
-pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
-pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
-pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
-pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
-pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
-
-pub const MCL_CURRENT: ::c_int = 0x0001;
-pub const MCL_FUTURE: ::c_int = 0x0002;
-
pub const SIGSTKSZ: ::size_t = 8192;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::tcflag_t = 0x00000800;
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
index dfb126916c..704302b240 100644
--- a/src/unix/linux_like/linux/uclibc/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -1,110 +1,10 @@
-pub type sa_family_t = u16;
-pub type pthread_key_t = ::c_uint;
-pub type speed_t = ::c_uint;
-pub type tcflag_t = ::c_uint;
-pub type loff_t = ::c_longlong;
-pub type clockid_t = ::c_int;
-pub type key_t = ::c_int;
-pub type id_t = ::c_uint;
-pub type useconds_t = u32;
-pub type dev_t = u64;
-pub type socklen_t = u32;
-pub type mode_t = u32;
-pub type ino64_t = u64;
-pub type off64_t = i64;
-pub type blkcnt64_t = i64;
-pub type rlim64_t = u64;
pub type shmatt_t = ::c_ulong;
-pub type mqd_t = ::c_int;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
-pub type nfds_t = ::c_ulong;
-pub type nl_item = ::c_int;
-pub type idtype_t = ::c_uint;
-pub type Elf32_Half = u16;
-pub type Elf32_Word = u32;
-pub type Elf32_Off = u32;
-pub type Elf32_Addr = u32;
-pub type Elf64_Half = u16;
-pub type Elf64_Word = u32;
-pub type Elf64_Off = u64;
-pub type Elf64_Addr = u64;
-pub type Elf64_Xword = u64;
-pub type Elf64_Sxword = i64;
-
pub type regoff_t = ::c_int;
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos64_t {} // FIXME: fill this out with a struct
-impl ::Copy for fpos64_t {}
-impl ::Clone for fpos64_t {
- fn clone(&self) -> fpos64_t {
- *self
- }
-}
-
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum timezone {}
-impl ::Copy for timezone {}
-impl ::Clone for timezone {
- fn clone(&self) -> timezone {
- *self
- }
-}
-
s! {
-
-
-
-
-
-
-
-
-
-
- pub struct addrinfo {
- pub ai_flags: ::c_int,
- pub ai_family: ::c_int,
- pub ai_socktype: ::c_int,
- pub ai_protocol: ::c_int,
- pub ai_addrlen: socklen_t,
-
- pub ai_addr: *mut ::sockaddr,
-
- pub ai_canonname: *mut c_char,
-
- pub ai_next: *mut addrinfo,
- }
-
-
-
-
-
- pub struct sched_param {
- pub sched_priority: ::c_int,
- }
-
-
-
-
-
-
-
-
-
-
-
- pub struct pthread_rwlockattr_t {
- __lockkind: ::c_int,
- __pshared: ::c_int,
- }
-
-
-
-
-
- pub struct statvfs {
+ pub struct statvfs { // Different than GNU!
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
@@ -124,132 +24,106 @@ s! {
__f_spare: [::c_int; 6],
}
- pub struct dqblk {
- pub dqb_bhardlimit: u32,
- pub dqb_bsoftlimit: u32,
- pub dqb_curblocks: u32,
- pub dqb_ihardlimit: u32,
- pub dqb_isoftlimit: u32,
- pub dqb_curinodes: u32,
- pub dqb_btime: ::time_t,
- pub dqb_itime: ::time_t,
+ pub struct regex_t {
+ __buffer: *mut ::c_void,
+ __allocated: ::size_t,
+ __used: ::size_t,
+ __syntax: ::c_ulong,
+ __fastmap: *mut ::c_char,
+ __translate: *mut ::c_char,
+ __re_nsub: ::size_t,
+ __bitfield: u8,
}
-
- pub struct cpu_set_t {
- #[cfg(target_pointer_width = "32")]
- bits: [u32; 32],
- #[cfg(target_pointer_width = "64")]
- bits: [u64; 16],
- }
-}
-
-s_no_extra_traits! {
- pub struct mq_attr {
- pub mq_flags: ::c_long,
- pub mq_maxmsg: ::c_long,
- pub mq_msgsize: ::c_long,
- pub mq_curmsgs: ::c_long,
- pad: [::c_long; 4]
- }
}
-cfg_if! {
- if #[cfg(feature = "extra_traits")] {
- impl PartialEq for mq_attr {
- fn eq(&self, other: &mq_attr) -> bool {
- self.mq_flags == other.mq_flags &&
- self.mq_maxmsg == other.mq_maxmsg &&
- self.mq_msgsize == other.mq_msgsize &&
- self.mq_curmsgs == other.mq_curmsgs
- }
- }
- impl Eq for mq_attr {}
- impl ::fmt::Debug for mq_attr {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("mq_attr")
- .field("mq_flags", &self.mq_flags)
- .field("mq_maxmsg", &self.mq_maxmsg)
- .field("mq_msgsize", &self.mq_msgsize)
- .field("mq_curmsgs", &self.mq_curmsgs)
- .finish()
- }
- }
- impl ::hash::Hash for mq_attr {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.mq_flags.hash(state);
- self.mq_maxmsg.hash(state);
- self.mq_msgsize.hash(state);
- self.mq_curmsgs.hash(state);
- }
- }
-
- impl PartialEq for sockaddr_nl {
- fn eq(&self, other: &sockaddr_nl) -> bool {
- self.nl_family == other.nl_family &&
- self.nl_pid == other.nl_pid &&
- self.nl_groups == other.nl_groups
- }
- }
- impl Eq for sockaddr_nl {}
- impl ::fmt::Debug for sockaddr_nl {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sockaddr_nl")
- .field("nl_family", &self.nl_family)
- .field("nl_pid", &self.nl_pid)
- .field("nl_groups", &self.nl_groups)
- .finish()
- }
- }
- impl ::hash::Hash for sockaddr_nl {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.nl_family.hash(state);
- self.nl_pid.hash(state);
- self.nl_groups.hash(state);
- }
- }
-
- impl PartialEq for sigevent {
- fn eq(&self, other: &sigevent) -> bool {
- self.sigev_value == other.sigev_value
- && self.sigev_signo == other.sigev_signo
- && self.sigev_notify == other.sigev_notify
- && self.sigev_notify_thread_id
- == other.sigev_notify_thread_id
- }
- }
- impl Eq for sigevent {}
- impl ::fmt::Debug for sigevent {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sigevent")
- .field("sigev_value", &self.sigev_value)
- .field("sigev_signo", &self.sigev_signo)
- .field("sigev_notify", &self.sigev_notify)
- .field("sigev_notify_thread_id",
- &self.sigev_notify_thread_id)
- .finish()
- }
- }
- impl ::hash::Hash for sigevent {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.sigev_value.hash(state);
- self.sigev_signo.hash(state);
- self.sigev_notify.hash(state);
- self.sigev_notify_thread_id.hash(state);
- }
- }
- }
-}
-
-// intentionally not public, only used for fd_set
-cfg_if! {
- if #[cfg(target_pointer_width = "32")] {
- const ULONG_SIZE: usize = 32;
- } else if #[cfg(target_pointer_width = "64")] {
- const ULONG_SIZE: usize = 64;
- } else {
- // Unknown target_pointer_width
- }
-}
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+pub const SIGEV_THREAD_ID: ::c_int = 4;
+
+pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
+pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
+pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
+pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
+pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
+pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
+pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
+pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
+pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
+pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
+pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
+pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
+pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
+pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
+pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
+pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
+pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
+pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
+pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
+pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
+pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
+pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
+pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
+pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
+pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
+pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
+pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
+pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
+pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
+pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
+pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
+pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
+pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
+pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
+pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
+pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
+pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
+pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
+pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
+pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
+pub const SYSFS_MAGIC: ::c_long = 0x62656572;
+pub const TMPFS_MAGIC: ::c_long = 0x01021994;
+pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
+pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
+pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
+pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
+pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
+
+pub const PTRACE_TRACEME: ::c_int = 0;
+pub const PTRACE_PEEKTEXT: ::c_int = 1;
+pub const PTRACE_PEEKDATA: ::c_int = 2;
+pub const PTRACE_PEEKUSER: ::c_int = 3;
+pub const PTRACE_POKETEXT: ::c_int = 4;
+pub const PTRACE_POKEDATA: ::c_int = 5;
+pub const PTRACE_POKEUSER: ::c_int = 6;
+pub const PTRACE_CONT: ::c_int = 7;
+pub const PTRACE_KILL: ::c_int = 8;
+pub const PTRACE_SINGLESTEP: ::c_int = 9;
+pub const PTRACE_GETREGS: ::c_int = 12;
+pub const PTRACE_SETREGS: ::c_int = 13;
+pub const PTRACE_GETFPREGS: ::c_int = 14;
+pub const PTRACE_SETFPREGS: ::c_int = 15;
+pub const PTRACE_ATTACH: ::c_int = 16;
+pub const PTRACE_DETACH: ::c_int = 17;
+pub const PTRACE_GETFPXREGS: ::c_int = 18;
+pub const PTRACE_SETFPXREGS: ::c_int = 19;
+pub const PTRACE_SYSCALL: ::c_int = 24;
+pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
+pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
+pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
+pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
+pub const PTRACE_GETREGSET: ::c_int = 0x4204;
+pub const PTRACE_SETREGSET: ::c_int = 0x4205;
+pub const PTRACE_SEIZE: ::c_int = 0x4206;
+pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
+pub const PTRACE_LISTEN: ::c_int = 0x4208;
+pub const PTRACE_O_MASK: ::c_int = 0x000000ff;
+
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -263,24 +137,25 @@ pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
// These are different than GNU!
-pub const LC_MONETARY: ::c_int = 2;
+pub const LC_CTYPE: ::c_int = 0;
+pub const LC_NUMERIC: ::c_int = 1;
pub const LC_TIME: ::c_int = 3;
pub const LC_COLLATE: ::c_int = 4;
+pub const LC_MONETARY: ::c_int = 2;
+pub const LC_MESSAGES: ::c_int = 5;
+pub const LC_ALL: ::c_int = 6;
// end different section
-pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
-
// MS_ flags for mount(2)
-pub const MS_NOUSER: ::c_ulong = 0x80000000;
-pub const MS_RMT_MASK: ::c_ulong = 0x800051;
+pub const MS_RMT_MASK: ::c_ulong = ::MS_RDONLY|::MS_SYNCHRONOUS|
+ ::MS_MANDLOCK|::MS_I_VERSION;
pub const ENOTSUP: ::c_int = EOPNOTSUPP;
pub const IPV6_JOIN_GROUP: ::c_int = 20;
pub const IPV6_LEAVE_GROUP: ::c_int = 21;
-// These actually are different from GNU
-pub const EAI_NODATA: ::c_int = -5;
+// These are different from GNU
pub const ABDAY_1: ::nl_item = 0x300;
pub const ABDAY_2: ::nl_item = 0x301;
pub const ABDAY_3: ::nl_item = 0x302;
@@ -345,196 +220,72 @@ pub const PRIO_PROCESS: ::c_int = 0;
pub const PRIO_PGRP: ::c_int = 1;
pub const PRIO_USER: ::c_int = 2;
+pub const ST_RELATIME: ::c_ulong = 4096;
+
extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
pub fn pthread_rwlockattr_getkind_np(
- attr: *const pthread_rwlockattr_t,
+ attr: *const ::pthread_rwlockattr_t,
val: *mut ::c_int,
) -> ::c_int;
pub fn pthread_rwlockattr_setkind_np(
- attr: *mut pthread_rwlockattr_t,
+ attr: *mut ::pthread_rwlockattr_t,
val: ::c_int,
) -> ::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;
-<<<<<<< HEAD
- 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;
- pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
- pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
-
- // Not available now on Android
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
- pub fn if_nameindex() -> *mut if_nameindex;
- pub fn if_freenameindex(ptr: *mut if_nameindex);
- pub fn freeifaddrs(ifa: *mut ::ifaddrs);
+ pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
- pub fn mremap(
- addr: *mut ::c_void,
- len: ::size_t,
- new_len: ::size_t,
+ pub fn sendmmsg(
+ sockfd: ::c_int,
+ msgvec: *mut ::mmsghdr,
+ vlen: ::c_uint,
flags: ::c_int,
- ...
- ) -> *mut ::c_void;
-
- pub fn glob(
- pattern: *const c_char,
- flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
- >,
- pglob: *mut ::glob_t,
) -> ::c_int;
- pub fn globfree(pglob: *mut ::glob_t);
-
- pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
-
- pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
-
- pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
-
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
+ pub fn recvmmsg(
+ sockfd: ::c_int,
+ msgvec: *mut ::mmsghdr,
+ vlen: ::c_uint,
flags: ::c_int,
+ timeout: *mut ::timespec,
) -> ::c_int;
- pub fn recvfrom(
- socket: ::c_int,
- buf: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t,
- ) -> ::ssize_t;
- pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
+ pub fn openpty(
+ amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize,
+ ) -> ::c_int;
+ pub fn forkpty(
+ amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize,
+ ) -> ::pid_t;
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_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_uint,
) -> ::c_int;
- pub fn writev(
+ pub fn pwritev(
fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
+ offset: ::off64_t,
) -> ::ssize_t;
- pub fn readv(
+ pub fn preadv(
fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
+ offset: ::off64_t,
) -> ::ssize_t;
-
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recvmsg(
- fd: ::c_int,
- msg: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn getgrgid_r(
- gid: ::gid_t,
- grp: *mut ::group,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut ::group,
- ) -> ::c_int;
- pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
- pub fn sem_close(sem: *mut sem_t) -> ::c_int;
- pub fn getdtablesize() -> ::c_int;
- pub fn getgrnam_r(
- name: *const ::c_char,
- grp: *mut ::group,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut ::group,
- ) -> ::c_int;
- 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_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;
- pub fn getpwnam_r(
- name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd,
- ) -> ::c_int;
- pub fn getpwuid_r(
- uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd,
- ) -> ::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()>,
- parent: ::Option<unsafe extern "C" fn()>,
- child: ::Option<unsafe extern "C" fn()>,
- ) -> ::c_int;
- pub fn pthread_create(
- native: *mut ::pthread_t,
- attr: *const ::pthread_attr_t,
- f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
- value: *mut ::c_void,
- ) -> ::c_int;
- pub fn dl_iterate_phdr(
- callback: ::Option<
- unsafe extern "C" fn(
- info: *mut ::dl_phdr_info,
- size: ::size_t,
- data: *mut ::c_void,
- ) -> ::c_int,
- >,
- data: *mut ::c_void,
- ) -> ::c_int;
- pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
- pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
- pub fn uname(buf: *mut ::utsname) -> ::c_int;
- 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;
-=======
->>>>>>> 9735c92c7... mostly mechanical removal of redundant symbols.
}
cfg_if! {
@@ -551,15 +302,3 @@ cfg_if! {
pub use unsupported_target;
}
}
-
-cfg_if! {
- if #[cfg(libc_align)] {
- #[macro_use]
- mod align;
- } else {
- #[macro_use]
- mod no_align;
- }
-}
-
-expand_align!();
diff --git a/src/unix/linux_like/linux/uclibc/x86_64/align.rs b/src/unix/linux_like/linux/uclibc/x86_64/align.rs
deleted file mode 100644
index e2d829b507..0000000000
--- a/src/unix/linux_like/linux/uclibc/x86_64/align.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-macro_rules! expand_align {
- () => {
- s! {
- #[cfg_attr(target_pointer_width = "32",
- repr(align(4)))]
- #[cfg_attr(target_pointer_width = "64",
- repr(align(8)))]
- pub struct sem_t { // FIXME
- #[cfg(target_pointer_width = "32")]
- __size: [::c_char; 16],
- #[cfg(target_pointer_width = "64")]
- __size: [::c_char; 32],
- }
-
- #[cfg_attr(any(target_pointer_width = "32",
- target_arch = "x86_64",
- target_arch = "powerpc64",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64"),
- repr(align(4)))]
- #[cfg_attr(not(any(target_pointer_width = "32",
- target_arch = "x86_64",
- target_arch = "powerpc64",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64")),
- repr(align(8)))]
- pub struct pthread_mutexattr_t { // FIXME
- size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
- }
-
- #[repr(align(4))]
- pub struct pthread_condattr_t { // FIXME
- size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
- }
- }
-
- s_no_extra_traits! {
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(all(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_mutex_t { // FIXME
- size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
- }
-
- #[repr(align(8))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_cond_t { // FIXME
- size: [u8; ::__SIZEOF_PTHREAD_COND_T],
- }
-
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_rwlock_t { // FIXME
- size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
- }
- }
- };
-}
diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs
index 177cd062db..ed0bb0b1ce 100644
--- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs
@@ -143,7 +143,7 @@ s! {
pub struct sigaction {
pub sa_handler: ::sighandler_t,
pub sa_flags: ::c_ulong,
- pub sa_restorer: *mut ::c_void,
+ pub sa_restorer: ::Option<extern fn()>,
pub sa_mask: ::sigset_t,
}
@@ -219,11 +219,6 @@ s! {
__unused5: *mut ::c_void,
}
- pub struct rlimit64 { // FIXME
- pub rlim_cur: rlim64_t,
- pub rlim_max: rlim64_t,
- }
-
pub struct cpu_set_t { // FIXME
#[cfg(target_pointer_width = "32")]
bits: [u32; 32],
diff --git a/src/unix/linux_like/linux/uclibc/x86_64/no_align.rs b/src/unix/linux_like/linux/uclibc/x86_64/no_align.rs
deleted file mode 100644
index ffa4e523f2..0000000000
--- a/src/unix/linux_like/linux/uclibc/x86_64/no_align.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-macro_rules! expand_align {
- () => {
- s! {
- pub struct sem_t { // FIXME
- #[cfg(target_pointer_width = "32")]
- __size: [::c_char; 16],
- #[cfg(target_pointer_width = "64")]
- __size: [::c_char; 32],
- __align: [::c_long; 0],
- }
-
- pub struct pthread_mutex_t { // FIXME
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))]
- __align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")))]
- __align: [::c_longlong; 0],
- size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
- }
-
- pub struct pthread_mutexattr_t { // FIXME
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64")))]
- __align: [::c_long; 0],
- size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
- }
-
- pub struct pthread_cond_t { // FIXME
- __align: [::c_longlong; 0],
- size: [u8; ::__SIZEOF_PTHREAD_COND_T],
- }
-
- pub struct pthread_condattr_t { // FIXME
- __align: [::c_int; 0],
- size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
- }
-
- pub struct pthread_rwlock_t { // FIXME
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))]
- __align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")))]
- __align: [::c_longlong; 0],
- size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
- }
- }
- }
-}
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index d5299b2c38..4c2e5f2827 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -546,13 +546,18 @@ pub const PROT_READ: ::c_int = 1;
pub const PROT_WRITE: ::c_int = 2;
pub const PROT_EXEC: ::c_int = 4;
-pub const LC_CTYPE: ::c_int = 0;
-pub const LC_NUMERIC: ::c_int = 1;
-pub const LC_TIME: ::c_int = 2;
-pub const LC_COLLATE: ::c_int = 3;
-pub const LC_MONETARY: ::c_int = 4;
-pub const LC_MESSAGES: ::c_int = 5;
-pub const LC_ALL: ::c_int = 6;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ pub const LC_CTYPE: ::c_int = 0;
+ pub const LC_NUMERIC: ::c_int = 1;
+ pub const LC_TIME: ::c_int = 2;
+ pub const LC_COLLATE: ::c_int = 3;
+ pub const LC_MONETARY: ::c_int = 4;
+ pub const LC_MESSAGES: ::c_int = 5;
+ pub const LC_ALL: ::c_int = 6;
+ }
+}
+
pub const LC_CTYPE_MASK: ::c_int = 1 << LC_CTYPE;
pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC;
pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME;
@@ -855,6 +860,7 @@ 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;
@@ -866,6 +872,7 @@ 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;
@@ -905,6 +912,7 @@ 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;
@@ -941,7 +949,9 @@ 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;
@@ -1081,6 +1091,7 @@ 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;
@@ -1091,14 +1102,18 @@ 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.
@@ -1110,8 +1125,11 @@ 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.
@@ -1536,6 +1554,7 @@ extern "C" {
count: ::size_t,
offset: off64_t,
) -> ::ssize_t;
+ #[cfg(not(target_env = "uclibc"))]
pub fn preadv64(
fd: ::c_int,
iov: *const ::iovec,
@@ -1548,6 +1567,7 @@ extern "C" {
count: ::size_t,
offset: off64_t,
) -> ::ssize_t;
+ #[cfg(not(target_env = "uclibc"))]
pub fn pwritev64(
fd: ::c_int,
iov: *const ::iovec,
@@ -1633,6 +1653,7 @@ 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,
@@ -1640,6 +1661,7 @@ extern "C" {
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,
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 9d7b902405..184be046f5 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -458,6 +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,
@@ -626,15 +627,18 @@ extern "C" {
...
) -> ::c_int;
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
- #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")]
+ #[cfg_attr(all(target_os = "linux", not(target_env = "uclibc")),
+ link_name = "__isoc99_fscanf")]
pub fn fscanf(
stream: *mut ::FILE,
format: *const ::c_char,
...
) -> ::c_int;
- #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")]
+ #[cfg_attr(all(target_os = "linux", not(target_env = "uclibc")),
+ link_name = "__isoc99_scanf")]
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
- #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")]
+ #[cfg_attr(all(target_os = "linux", not(target_env = "uclibc")),
+ link_name = "__isoc99_sscanf")]
pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
-> ::c_int;
pub fn getchar_unlocked() -> ::c_int;