uclibc -> linux-like/linux: mostly mechanical removal of redundant symbols

This commit is contained in:
Jonah Petri 2020-11-06 17:37:21 -05:00
parent c4803a6783
commit fe8470be63
21 changed files with 673 additions and 2562 deletions

View File

@ -302,9 +302,18 @@ s! {
#[cfg(target_pointer_width = "32")]
pub dlpi_phnum: Elf32_Half,
// As of uClibc 1.0.36, the following fields are
// gated behind a "#if 0" block which always evaluates
// to false. So I'm just removing these, and if uClibc changes
// the #if block in the future to include the following fields, these
// will probably need including here. tsidea, skrap
#[cfg(not(target_env = "uclibc"))]
pub dlpi_adds: ::c_ulonglong,
#[cfg(not(target_env = "uclibc"))]
pub dlpi_subs: ::c_ulonglong,
#[cfg(not(target_env = "uclibc"))]
pub dlpi_tls_modid: ::size_t,
#[cfg(not(target_env = "uclibc"))]
pub dlpi_tls_data: *mut ::c_void,
}
@ -2792,20 +2801,8 @@ f! {
}
}
#[cfg(not(target_env = "uclibc"))]
extern "C" {
#[cfg_attr(not(target_env = "musl"), 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;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
pub fn rand() -> ::c_int;
pub fn srand(seed: ::c_uint);
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;
@ -2823,6 +2820,22 @@ extern "C" {
nitems: ::c_int,
sevp: *mut ::sigevent,
) -> ::c_int;
}
extern "C" {
#[cfg_attr(not(target_env = "musl"), 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;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
pub fn rand() -> ::c_int;
pub fn srand(seed: ::c_uint);
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
@ -3594,7 +3607,10 @@ extern "C" {
}
cfg_if! {
if #[cfg(target_env = "musl")] {
if #[cfg(target_env = "uclibc")] {
mod uclibc;
pub use self::uclibc::*;
} else if #[cfg(target_env = "musl")] {
mod musl;
pub use self::musl::*;
} else if #[cfg(target_env = "gnu")] {

View File

@ -17,6 +17,10 @@ pub type nlink_t = ::c_uint;
pub type blksize_t = ::c_long;
pub type blkcnt_t = ::c_long;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
pub type __u64 = ::c_ulonglong;
s! {
pub struct cmsghdr {
pub cmsg_len: ::size_t,
@ -92,6 +96,23 @@ s! {
pub l_pid: ::pid_t,
}
pub struct sysinfo {
pub uptime: ::c_long,
pub loads: [::c_ulong; 3],
pub totalram: ::c_ulong,
pub freeram: ::c_ulong,
pub sharedram: ::c_ulong,
pub bufferram: ::c_ulong,
pub totalswap: ::c_ulong,
pub freeswap: ::c_ulong,
pub procs: ::c_ushort,
pub pad: ::c_ushort,
pub totalhigh: ::c_ulong,
pub freehigh: ::c_ulong,
pub mem_unit: ::c_uint,
pub _f: [::c_char; 8],
}
pub struct statfs {
pub f_type: ::c_int,
pub f_bsize: ::c_int,
@ -107,6 +128,52 @@ s! {
pub f_spare: [::c_int; 5],
}
pub struct statfs64 {
pub f_type: ::c_int,
pub f_bsize: ::c_int,
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_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 struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
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 struct sigset_t {
__val: [::c_ulong; 2],
}
@ -197,6 +264,16 @@ s! {
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 const O_CLOEXEC: ::c_int = 0o2000000;
@ -214,33 +291,15 @@ pub const NCCS: usize = 32;
// I wasn't able to find those constants
// in uclibc build environment for armv7
pub const AIO_ALLDONE: ::c_int = 2; // from linux/mod.rs
pub const AIO_CANCELED: ::c_int = 0; // from linux/mod.rs
pub const AIO_NOTCANCELED: ::c_int = 1; // from linux/mod.rs
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; // from linux/mod.rs
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; // from linux/mod.rs
pub const EPOLLWAKEUP: ::c_int = 0x20000000; // from linux/other/mod.rs
pub const EXTPROC: ::tcflag_t = 0o200000; // from asm-generic/termbits.h
pub const F_GETPIPE_SZ: ::c_int = 1032; // from linux_like/mod.rs
pub const F_SETPIPE_SZ: ::c_int = 1031; // from linux_like/mod.rs
pub const LIO_NOP: ::c_int = 2; // from linux/mod.rs
pub const LIO_NOWAIT: ::c_int = 1; // from linux/mod.rs
pub const LIO_READ: ::c_int = 0; // from linux/mod.rs
pub const LIO_WAIT: ::c_int = 0; // from linux/mod.rs
pub const LIO_WRITE: ::c_int = 1; // from linux/mod.rs
pub const MAP_HUGETLB: ::c_int = 0x040000; // from linux/other/mod.rs
pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; // from linux/mod.rs
pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; // from linux/mod.rs
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
pub const SOL_NETLINK: ::c_int = 270; // from src/unix/linux_like/mod.rs
pub const _POSIX_VDISABLE: ::cc_t = 0; // from linux/mod.rs
pub const AT_EMPTY_PATH: ::c_int = 0x1000; // from linux_like/mod.rs
// autogenerated constants with hand tuned types
pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
pub const B0: ::speed_t = 0;
pub const B1000000: ::speed_t = 0x1008;
pub const B110: ::speed_t = 0x3;
@ -278,7 +337,6 @@ pub const CBAUD: ::tcflag_t = 0x100f;
pub const CBAUDEX: ::tcflag_t = 0x1000;
pub const CIBAUD: ::tcflag_t = 0x100f0000;
pub const CLOCAL: ::tcflag_t = 0x800;
pub const CMSPAR: ::tcflag_t = 0x40000000;
pub const CPU_SETSIZE: ::c_int = 0x400;
pub const CR1: ::c_int = 0x200;
pub const CR2: ::c_int = 0x400;
@ -409,7 +467,6 @@ pub const HUPCL: ::tcflag_t = 0x400;
pub const ICANON: ::tcflag_t = 0x2;
pub const IEXTEN: ::tcflag_t = 0x8000;
pub const ISIG: ::tcflag_t = 0x1;
pub const IUTF8: ::tcflag_t = 0x4000;
pub const IXOFF: ::tcflag_t = 0x1000;
pub const IXON: ::tcflag_t = 0x400;
pub const MAP_ANON: ::c_int = 0x20;
@ -422,29 +479,10 @@ pub const MAP_NONBLOCK: ::c_int = 0x10000;
pub const MAP_NORESERVE: ::c_int = 0x4000;
pub const MAP_POPULATE: ::c_int = 0x8000;
pub const MAP_STACK: ::c_int = 0x20000;
pub const MS_ACTIVE: u32 = 0x40000000;
pub const MS_DIRSYNC: u32 = 0x80;
pub const MS_I_VERSION: u32 = 0x800000;
pub const MS_KERNMOUNT: u32 = 0x400000;
pub const MS_MOVE: u32 = 0x2000;
pub const MS_POSIXACL: u32 = 0x10000;
pub const MS_PRIVATE: u32 = 0x40000;
pub const MS_REC: u32 = 0x4000;
pub const MS_RELATIME: u32 = 0x200000;
pub const MS_SHARED: u32 = 0x100000;
pub const MS_SILENT: u32 = 0x8000;
pub const MS_SLAVE: u32 = 0x80000;
pub const MS_STRICTATIME: u32 = 0x1000000;
pub const MS_UNBINDABLE: u32 = 0x20000;
pub const NLDLY: ::tcflag_t = 0x100;
pub const NOFLSH: ::tcflag_t = 0x80;
pub const OCRNL: ::c_int = 0x8;
pub const OFDEL: ::c_int = 0x80;
pub const OFILL: ::c_int = 0x40;
pub const OLCUC: ::tcflag_t = 0x2;
pub const ONLCR: ::tcflag_t = 0x4;
pub const ONLRET: ::tcflag_t = 0x20;
pub const ONOCR: ::tcflag_t = 0x10;
pub const O_ACCMODE: ::c_int = 0x3;
pub const O_APPEND: ::c_int = 0x400;
pub const O_CREAT: ::c_int = 0x40;
@ -461,21 +499,9 @@ pub const O_TRUNC: ::c_int = 0x200;
pub const PARENB: ::tcflag_t = 0x100;
pub const PARODD: ::tcflag_t = 0x200;
pub const PENDIN: ::tcflag_t = 0x4000;
pub const POLLRDBAND: ::c_short = 0x80;
pub const POLLRDNORM: ::c_short = 0x40;
pub const POLLWRBAND: ::c_short = 0x200;
pub const POLLWRNORM: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
pub const QIF_ALL: u32 = 0x3f;
pub const QIF_BLIMITS: u32 = 0x1;
pub const QIF_BTIME: u32 = 0x10;
pub const QIF_ILIMITS: u32 = 0x4;
pub const QIF_INODES: u32 = 0x8;
pub const QIF_ITIME: u32 = 0x20;
pub const QIF_LIMITS: u32 = 0x5;
pub const QIF_SPACE: u32 = 0x2;
pub const QIF_TIMES: u32 = 0x30;
pub const QIF_USAGE: u32 = 0xa;
pub const SA_NOCLDSTOP: ::c_int = 0x1;
pub const SA_NOCLDWAIT: ::c_int = 0x2;
pub const SA_NODEFER: ::c_int = 0x40000000;
@ -562,58 +588,6 @@ pub const VTDLY: ::c_int = 0x4000;
pub const VTIME: usize = 0x5;
pub const VWERASE: usize = 0xe;
pub const XTABS: ::tcflag_t = 0x1800;
pub const _PC_2_SYMLINKS: ::c_int = 0x14;
pub const _PC_ALLOC_SIZE_MIN: ::c_int = 0x12;
pub const _PC_ASYNC_IO: ::c_int = 0xa;
pub const _PC_FILESIZEBITS: ::c_int = 0xd;
pub const _PC_PRIO_IO: ::c_int = 0xb;
pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 0xe;
pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 0xf;
pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 0x10;
pub const _PC_REC_XFER_ALIGN: ::c_int = 0x11;
pub const _PC_SYMLINK_MAX: ::c_int = 0x13;
pub const _PC_SYNC_IO: ::c_int = 0x9;
pub const _SC_2_PBS: ::c_int = 0xa8;
pub const _SC_2_PBS_ACCOUNTING: ::c_int = 0xa9;
pub const _SC_2_PBS_CHECKPOINT: ::c_int = 0xaf;
pub const _SC_2_PBS_LOCATE: ::c_int = 0xaa;
pub const _SC_2_PBS_MESSAGE: ::c_int = 0xab;
pub const _SC_2_PBS_TRACK: ::c_int = 0xac;
pub const _SC_ADVISORY_INFO: ::c_int = 0x84;
pub const _SC_BARRIERS: ::c_int = 0x85;
pub const _SC_CLOCK_SELECTION: ::c_int = 0x89;
pub const _SC_CPUTIME: ::c_int = 0x8a;
pub const _SC_IPV6: ::c_int = 0xeb;
pub const _SC_MONOTONIC_CLOCK: ::c_int = 0x95;
pub const _SC_RAW_SOCKETS: ::c_int = 0xec;
pub const _SC_READER_WRITER_LOCKS: ::c_int = 0x99;
pub const _SC_REGEXP: ::c_int = 0x9b;
pub const _SC_SHELL: ::c_int = 0x9d;
pub const _SC_SPAWN: ::c_int = 0x9f;
pub const _SC_SPIN_LOCKS: ::c_int = 0x9a;
pub const _SC_SPORADIC_SERVER: ::c_int = 0xa0;
pub const _SC_SS_REPL_MAX: ::c_int = 0xf1;
pub const _SC_SYMLOOP_MAX: ::c_int = 0xad;
pub const _SC_THREAD_CPUTIME: ::c_int = 0x8b;
pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 0x52;
pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 0xf7;
pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 0xf8;
pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 0xa1;
pub const _SC_TIMEOUTS: ::c_int = 0xa4;
pub const _SC_TRACE: ::c_int = 0xb5;
pub const _SC_TRACE_EVENT_FILTER: ::c_int = 0xb6;
pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 0xf2;
pub const _SC_TRACE_INHERIT: ::c_int = 0xb7;
pub const _SC_TRACE_LOG: ::c_int = 0xb8;
pub const _SC_TRACE_NAME_MAX: ::c_int = 0xf3;
pub const _SC_TRACE_SYS_MAX: ::c_int = 0xf4;
pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 0xf5;
pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 0xa5;
pub const _SC_V6_ILP32_OFF32: ::c_int = 0xb0;
pub const _SC_V6_ILP32_OFFBIG: ::c_int = 0xb1;
pub const _SC_V6_LP64_OFF64: ::c_int = 0xb2;
pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 0xb3;
pub const _SC_XOPEN_STREAMS: ::c_int = 0xf6;
// Syscall table is copied from src/unix/notbsd/linux/musl/b32/arm.rs
pub const SYS_restart_syscall: ::c_long = 0;
@ -967,75 +941,8 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
}
f! {
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
(*mhdr).msg_control as *mut cmsghdr
} else {
0 as *mut cmsghdr
}
}
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
cmsg.offset(1) as *mut ::c_uchar
}
pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
as ::c_uint
}
pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
}
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
cmsg: *const cmsghdr) -> *mut cmsghdr {
if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
return 0 as *mut cmsghdr;
};
let next = (cmsg as usize +
CMSG_ALIGN((*cmsg).cmsg_len as usize))
as *mut cmsghdr;
let max = (*mhdr).msg_control as usize
+ (*mhdr).msg_controllen as usize;
if (next.offset(1)) as usize > max ||
next as usize + CMSG_ALIGN((*next).cmsg_len as usize) > max
{
0 as *mut cmsghdr
} else {
next as *mut cmsghdr
}
}
}
extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
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 setns(fd: ::c_int, nstype: ::c_int) -> ::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;
}
cfg_if! {

View File

@ -0,0 +1,565 @@
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 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,
#[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
#[cfg(target_pointer_width = "32")]
__f_unused: ::c_int,
#[cfg(target_endian = "big")]
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__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 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 RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
pub const RLIMIT_DATA: ::c_int = 2;
pub const RLIMIT_STACK: ::c_int = 3;
pub const RLIMIT_CORE: ::c_int = 4;
pub const RLIMIT_LOCKS: ::c_int = 10;
pub const RLIMIT_SIGPENDING: ::c_int = 11;
pub const RLIMIT_MSGQUEUE: ::c_int = 12;
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_TIME: ::c_int = 3;
pub const LC_COLLATE: ::c_int = 4;
// 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 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;
pub const ABDAY_1: ::nl_item = 0x300;
pub const ABDAY_2: ::nl_item = 0x301;
pub const ABDAY_3: ::nl_item = 0x302;
pub const ABDAY_4: ::nl_item = 0x303;
pub const ABDAY_5: ::nl_item = 0x304;
pub const ABDAY_6: ::nl_item = 0x305;
pub const ABDAY_7: ::nl_item = 0x306;
pub const DAY_1: ::nl_item = 0x307;
pub const DAY_2: ::nl_item = 0x308;
pub const DAY_3: ::nl_item = 0x309;
pub const DAY_4: ::nl_item = 0x30A;
pub const DAY_5: ::nl_item = 0x30B;
pub const DAY_6: ::nl_item = 0x30C;
pub const DAY_7: ::nl_item = 0x30D;
pub const ABMON_1: ::nl_item = 0x30E;
pub const ABMON_2: ::nl_item = 0x30F;
pub const ABMON_3: ::nl_item = 0x310;
pub const ABMON_4: ::nl_item = 0x311;
pub const ABMON_5: ::nl_item = 0x312;
pub const ABMON_6: ::nl_item = 0x313;
pub const ABMON_7: ::nl_item = 0x314;
pub const ABMON_8: ::nl_item = 0x315;
pub const ABMON_9: ::nl_item = 0x316;
pub const ABMON_10: ::nl_item = 0x317;
pub const ABMON_11: ::nl_item = 0x318;
pub const ABMON_12: ::nl_item = 0x319;
pub const MON_1: ::nl_item = 0x31A;
pub const MON_2: ::nl_item = 0x31B;
pub const MON_3: ::nl_item = 0x31C;
pub const MON_4: ::nl_item = 0x31D;
pub const MON_5: ::nl_item = 0x31E;
pub const MON_6: ::nl_item = 0x31F;
pub const MON_7: ::nl_item = 0x320;
pub const MON_8: ::nl_item = 0x321;
pub const MON_9: ::nl_item = 0x322;
pub const MON_10: ::nl_item = 0x323;
pub const MON_11: ::nl_item = 0x324;
pub const MON_12: ::nl_item = 0x325;
pub const AM_STR: ::nl_item = 0x326;
pub const PM_STR: ::nl_item = 0x327;
pub const D_T_FMT: ::nl_item = 0x328;
pub const D_FMT: ::nl_item = 0x329;
pub const T_FMT: ::nl_item = 0x32A;
pub const T_FMT_AMPM: ::nl_item = 0x32B;
pub const ERA: ::nl_item = 0x32C;
pub const ERA_D_FMT: ::nl_item = 0x32E;
pub const ALT_DIGITS: ::nl_item = 0x32F;
pub const ERA_D_T_FMT: ::nl_item = 0x330;
pub const ERA_T_FMT: ::nl_item = 0x331;
pub const CODESET: ::nl_item = 10;
pub const CRNCYSTR: ::nl_item = 0x215;
pub const RADIXCHAR: ::nl_item = 0x100;
pub const THOUSEP: ::nl_item = 0x101;
pub const NOEXPR: ::nl_item = 0x501;
pub const YESSTR: ::nl_item = 0x502;
pub const NOSTR: ::nl_item = 0x503;
// Different than Gnu.
pub const FILENAME_MAX: ::c_uint = 4095;
pub const PRIO_PROCESS: ::c_int = 0;
pub const PRIO_PGRP: ::c_int = 1;
pub const PRIO_USER: ::c_int = 2;
extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
pub fn pthread_rwlockattr_getkind_np(
attr: *const pthread_rwlockattr_t,
val: *mut ::c_int,
) -> ::c_int;
pub fn pthread_rwlockattr_setkind_np(
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 mremap(
addr: *mut ::c_void,
len: ::size_t,
new_len: ::size_t,
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,
flags: ::c_int,
) -> ::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 bind(
socket: ::c_int,
address: *const ::sockaddr,
address_len: ::socklen_t,
) -> ::c_int;
pub fn writev(
fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
) -> ::ssize_t;
pub fn readv(
fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
) -> ::ssize_t;
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! {
if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
mod mips;
pub use self::mips::*;
} else if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
} else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
} else {
pub use unsupported_target;
}
}
cfg_if! {
if #[cfg(libc_align)] {
#[macro_use]
mod align;
} else {
#[macro_use]
mod no_align;
}
}
expand_align!();

View File

@ -245,14 +245,6 @@ s_no_extra_traits! {
pub d_type: u8,
pub d_name: [::c_char; 256],
}
#[allow(missing_debug_implementations)]
pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}
}
// constants

View File

@ -1631,10 +1631,7 @@ cfg_if! {
}
cfg_if! {
if #[cfg(target_env = "uclibc")] {
mod uclibc;
pub use self::uclibc::*;
} else if #[cfg(target_env = "newlib")] {
if #[cfg(target_env = "newlib")] {
mod newlib;
pub use self::newlib::*;
} else if #[cfg(any(target_os = "linux",

File diff suppressed because it is too large Load Diff