Auto merge of #2403 - skrap:master, r=Amanieu

uclibc: fix semver files, add misc symbols

This commit gets uclibc support working again, and fixes the semver lists to segregate gnu- and musl- specific symbols to those libc variants.

There is a [separate PR](https://github.com/rust-lang/rust/pull/88952) against rust itself to add armv7-unknown-linux-uclibceabihf as a tier 3 platform, and this commit is in support of that effort.  Until that's done, we should not use the CI for that platform, but I'm including the CI file here in anticipation of turning it on in the not-too-distant future.
This commit is contained in:
bors 2021-09-24 22:30:06 +00:00
commit 372a8c6fcb
15 changed files with 356 additions and 179 deletions

View file

@ -0,0 +1,17 @@
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-arm curl \
xz-utils patch
RUN mkdir /toolchain
RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2020.08-1.tar.bz2 | \
tar xjf - -C /toolchain --strip-components=1
RUN /toolchain/relocate-sdk.sh
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
STAGING_DIR=/toolchain/armv7-buildroot-linux-uclibceabihf/sysroot \
CC_armv7_unknown_linux_uclibc=armv7-buildroot-linux-uclibc-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=armv7-buildroot-linux-uclibc-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L /toolchain/arm-buildroot-linux-uclibcgnueabihf/sysroot/"

View file

@ -0,0 +1,22 @@
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mipsel curl \
xz-utils patch
RUN mkdir /toolchain
# binutils 2.33.1
# gcc 9.3.0
# gdb 8.3.1
# linux-headers 4.9.234
# uclibc 1.0.34
RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/mips32el/tarballs/mips32el--uclibc--stable-2020.08-1.tar.bz2 | \
tar xjf - -C /toolchain --strip-components=1
RUN /toolchain/relocate-sdk.sh
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
STAGING_DIR=/toolchain/mipsel-buildroot-linux-uclibc/sysroot \
CC_mipsel_unknown_linux_uclibc=mipsel-buildroot-linux-uclibc-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_UCLIBC_LINKER=mipsel-buildroot-linux-uclibc-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_UCLIBC_RUNNER="qemu-mipsel -L /toolchain/mipsel-buildroot-linux-uclibc/sysroot/"

View file

@ -2867,6 +2867,34 @@ fn test_linux(target: &str) {
| "SW_CNT"
if mips || ppc64 || riscv64 || sparc64 => true,
// kernel constants not available in uclibc 1.0.34
| "ADDR_COMPAT_LAYOUT"
| "ADDR_LIMIT_3GB"
| "ADDR_NO_RANDOMIZE"
| "CLONE_NEWCGROUP"
| "EXTPROC"
| "FAN_MARK_FILESYSTEM"
| "FAN_MARK_INODE"
| "IPPROTO_BEETPH"
| "IPPROTO_MPLS"
| "IPV6_HDRINCL"
| "IPV6_MULTICAST_ALL"
| "IPV6_PMTUDISC_INTERFACE"
| "IPV6_PMTUDISC_OMIT"
| "IPV6_ROUTER_ALERT_ISOLATE"
| "O_TMPFILE"
| "PACKET_MR_UNICAST"
| "PTRACE_EVENT_STOP"
| "PTRACE_O_EXITKILL"
| "PTRACE_O_SUSPEND_SECCOMP"
| "PTRACE_PEEKSIGINFO"
| "READ_IMPLIES_EXEC"
| "RUSAGE_THREAD"
| "SHM_EXEC"
| "UDP_GRO"
| "UDP_SEGMENT"
if uclibc => true,
_ => false,
}
});
@ -2944,6 +2972,9 @@ fn test_linux(target: &str) {
"reallocarray" if musl => true,
// Not defined in uclibc as of 1.0.34
"gettid" if uclibc => true,
_ => false,
}
});

View file

@ -15,6 +15,11 @@ ADJ_TICK
ADJ_TIMECONST
AFFS_SUPER_MAGIC
AFS_SUPER_MAGIC
AF_MPLS
AF_XDP
AIO_ALLDONE
AIO_CANCELED
AIO_NOTCANCELED
AT_STATX_DONT_SYNC
AT_STATX_FORCE_SYNC
AT_STATX_SYNC_AS_STAT
@ -54,6 +59,8 @@ EMPTY
EXT2_SUPER_MAGIC
EXT3_SUPER_MAGIC
EXT4_SUPER_MAGIC
Elf32_Chdr
Elf64_Chdr
F2FS_SUPER_MAGIC
FDPIC_FUNCPTRS
FUTEXFS_SUPER_MAGIC
@ -111,6 +118,11 @@ LC_PAPER
LC_PAPER_MASK
LC_TELEPHONE
LC_TELEPHONE_MASK
LIO_NOP
LIO_NOWAIT
LIO_READ
LIO_WAIT
LIO_WRITE
LM_ID_BASE
LM_ID_NEWLM
LOGIN_PROCESS
@ -316,6 +328,9 @@ OLD_TIME
OPENPROM_SUPER_MAGIC
OVERLAYFS_SUPER_MAGIC
O_FSYNC
PF_IB
PF_MPLS
PF_XDP
PROC_SUPER_MAGIC
PTHREAD_MUTEX_ADAPTIVE_NP
QNX4_SUPER_MAGIC
@ -524,6 +539,14 @@ __priority_which_t
__rlimit_resource_t
__timeval
adjtimex
aio_cancel
aio_error
aio_fsync
aio_read
aio_return
aio_suspend
aio_write
aiocb
backtrace
clock_adjtime
copy_file_range
@ -532,7 +555,10 @@ dlmopen
endutxent
explicit_bzero
fgetspent_r
futimes
getauxval
getgrent_r
getloadavg
getpt
getpwent_r
getpwnam_r
@ -541,11 +567,12 @@ getutxent
getutxid
getutxline
glob
glob_t
glob64
glob64_t
glob_t
globfree
globfree64
lio_listio
mallinfo
mallinfo2
malloc_info
@ -557,7 +584,13 @@ nl_pktinfo
ntp_adjtime
ntp_gettime
ntptimeval
open_wmemstream
preadv2
preadv64
prlimit
prlimit64
process_vm_readv
process_vm_writev
pthread_attr_getaffinity_np
pthread_attr_setaffinity_np
pthread_getname_np
@ -567,6 +600,7 @@ pthread_rwlockattr_setkind_np
pthread_setname_np
pututxline
pwritev2
pwritev64
qsort_r
reallocarray
semid_ds

View file

@ -1,8 +1,42 @@
# TODO: musl.
AF_IB
AF_MPLS
AF_XDP
AIO_ALLDONE
AIO_CANCELED
AIO_NOTCANCELED
Elf32_Chdr
Elf64_Chdr
LIO_NOP
LIO_NOWAIT
LIO_READ
LIO_WAIT
LIO_WRITE
PF_IB
PF_MPLS
PF_XDP
adjtimex
aio_cancel
aio_error
aio_fsync
aio_read
aio_return
aio_suspend
aio_write
aiocb
clock_adjtime
explicit_bzero
futimes
getauxval
getloadavg
lio_listio
ntptimeval
open_wmemstream
preadv64
prlimit
prlimit64
process_vm_readv
process_vm_writev
pwritev64
reallocarray
timex

View file

@ -35,7 +35,6 @@ AF_CAIF
AF_CAN
AF_DECnet
AF_ECONET
AF_IB
AF_IEEE802154
AF_IPX
AF_IRDA
@ -44,7 +43,6 @@ AF_IUCV
AF_KEY
AF_LLC
AF_LOCAL
AF_MPLS
AF_NETBEUI
AF_NETLINK
AF_NETROM
@ -62,10 +60,6 @@ AF_TIPC
AF_VSOCK
AF_WANPIPE
AF_X25
AF_XDP
AIO_ALLDONE
AIO_CANCELED
AIO_NOTCANCELED
AI_ADDRCONFIG
AI_ALL
AI_CANONNAME
@ -513,7 +507,6 @@ EXTA
EXTB
EXTPROC
Elf32_Addr
Elf32_Chdr
Elf32_Ehdr
Elf32_Half
Elf32_Off
@ -523,7 +516,6 @@ Elf32_Shdr
Elf32_Sym
Elf32_Word
Elf64_Addr
Elf64_Chdr
Elf64_Ehdr
Elf64_Half
Elf64_Off
@ -1050,11 +1042,6 @@ LINUX_REBOOT_MAGIC2
LINUX_REBOOT_MAGIC2A
LINUX_REBOOT_MAGIC2B
LINUX_REBOOT_MAGIC2C
LIO_NOP
LIO_NOWAIT
LIO_READ
LIO_WAIT
LIO_WRITE
LOG_AUTHPRIV
LOG_CRON
LOG_FTP
@ -1483,7 +1470,6 @@ PF_CAIF
PF_CAN
PF_DECnet
PF_ECONET
PF_IB
PF_IEEE802154
PF_IPX
PF_IRDA
@ -1492,7 +1478,6 @@ PF_IUCV
PF_KEY
PF_LLC
PF_LOCAL
PF_MPLS
PF_NETBEUI
PF_NETLINK
PF_NETROM
@ -1510,7 +1495,6 @@ PF_TIPC
PF_VSOCK
PF_WANPIPE
PF_X25
PF_XDP
PIPE_BUF
PM_STR
POLLRDBAND
@ -2643,14 +2627,6 @@ accept4
acct
addmntent
af_alg_iv
aio_cancel
aio_error
aio_fsync
aio_read
aio_return
aio_suspend
aio_write
aiocb
arpd_request
arphdr
arpreq
@ -2741,9 +2717,7 @@ fstatvfs64
ftello64
ftok
ftruncate64
futimes
genlmsghdr
getauxval
getdomainname
getdtablesize
getgrent
@ -2755,7 +2729,6 @@ getgrouplist
gethostid
getifaddrs
getline
getloadavg
getmntent
getnameinfo
getpriority
@ -2805,7 +2778,6 @@ key_t
killpg
labs
lgetxattr
lio_listio
listxattr
llistxattr
lockf
@ -2866,7 +2838,6 @@ nlmsghdr
off64_t
open64
open_memstream
open_wmemstream
openat
openat64
openpty
@ -2907,11 +2878,6 @@ ppoll
prctl
pread64
preadv
preadv64
prlimit
prlimit64
process_vm_readv
process_vm_writev
pthread_attr_getguardsize
pthread_attr_getstack
pthread_cancel
@ -2941,7 +2907,6 @@ ptrace
ptsname_r
pwrite64
pwritev
pwritev64
qsort
quotactl
rand

View file

@ -141,19 +141,6 @@ s! {
pub keepcost: ::size_t,
}
pub struct nlmsghdr {
pub nlmsg_len: u32,
pub nlmsg_type: u16,
pub nlmsg_flags: u16,
pub nlmsg_seq: u32,
pub nlmsg_pid: u32,
}
pub struct nlmsgerr {
pub error: ::c_int,
pub msg: nlmsghdr,
}
pub struct nl_pktinfo {
pub group: u32,
}
@ -174,11 +161,6 @@ s! {
pub nm_gid: u32,
}
pub struct nlattr {
pub nla_len: u16,
pub nla_type: u16,
}
pub struct rtentry {
pub rt_pad1: ::c_ulong,
pub rt_dst: ::sockaddr,
@ -1210,13 +1192,6 @@ extern "C" {
statxbuf: *mut statx,
) -> ::c_int;
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
pub fn memmem(
haystack: *const ::c_void,
haystacklen: ::size_t,
needle: *const ::c_void,
needlelen: ::size_t,
) -> *mut ::c_void;
pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
pub fn adjtimex(buf: *mut timex) -> ::c_int;
@ -1305,16 +1280,6 @@ extern "C" {
) -> ::c_int;
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
pub fn pthread_getaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *mut ::cpu_set_t,
) -> ::c_int;
pub fn pthread_setaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t,
) -> ::c_int;
pub fn pthread_rwlockattr_getkind_np(
attr: *const ::pthread_rwlockattr_t,
val: *mut ::c_int,
@ -1323,7 +1288,6 @@ extern "C" {
attr: *mut ::pthread_rwlockattr_t,
val: ::c_int,
) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
pub fn mallinfo() -> ::mallinfo;
pub fn mallinfo2() -> ::mallinfo2;
pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;

View file

@ -563,6 +563,24 @@ s! {
pub instruction_pointer: ::__u64,
pub args: [::__u64; 6],
}
pub struct nlmsghdr {
pub nlmsg_len: u32,
pub nlmsg_type: u16,
pub nlmsg_flags: u16,
pub nlmsg_seq: u32,
pub nlmsg_pid: u32,
}
pub struct nlmsgerr {
pub error: ::c_int,
pub msg: nlmsghdr,
}
pub struct nlattr {
pub nla_len: u16,
pub nla_type: u16,
}
}
s_no_extra_traits! {
@ -3438,6 +3456,16 @@ extern "C" {
len: *mut ::socklen_t,
flg: ::c_int,
) -> ::c_int;
pub fn pthread_getaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *mut ::cpu_set_t,
) -> ::c_int;
pub fn pthread_setaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t,
) -> ::c_int;
pub fn pthread_setschedprio(native: ::pthread_t, priority: ::c_int) -> ::c_int;
pub fn reboot(how_to: ::c_int) -> ::c_int;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
@ -3850,6 +3878,13 @@ extern "C" {
pub fn gethostid() -> ::c_long;
pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int;
pub fn memmem(
haystack: *const ::c_void,
haystacklen: ::size_t,
needle: *const ::c_void,
needlelen: ::size_t,
) -> *mut ::c_void;
pub fn sched_getcpu() -> ::c_int;
}
cfg_if! {

View file

@ -133,24 +133,6 @@ s! {
__dummy4: [::c_char; 16],
}
pub struct nlmsghdr {
pub nlmsg_len: u32,
pub nlmsg_type: u16,
pub nlmsg_flags: u16,
pub nlmsg_seq: u32,
pub nlmsg_pid: u32,
}
pub struct nlmsgerr {
pub error: ::c_int,
pub msg: nlmsghdr,
}
pub struct nlattr {
pub nla_len: u16,
pub nla_type: u16,
}
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
@ -757,23 +739,6 @@ extern "C" {
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
pub fn pthread_getaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *mut ::cpu_set_t,
) -> ::c_int;
pub fn pthread_setaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t,
) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
pub fn memmem(
haystack: *const ::c_void,
haystacklen: ::size_t,
needle: *const ::c_void,
needlelen: ::size_t,
) -> *mut ::c_void;
// Musl targets need the `mask` argument of `fanotify_mark` be specified
// `::c_ulonglong` instead of `u64` or there will be a type mismatch between
// `long long unsigned int` and the expected `uint64_t`.

View file

@ -61,8 +61,8 @@ s! {
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub __uclibc_unused4: ::c_ulong,
pub __uclibc_unused5: ::c_ulong,
pub __unused4: ::c_ulong,
pub __unused5: ::c_ulong,
}
pub struct stat64
@ -205,41 +205,41 @@ s! {
pub __pad1: ::c_ushort,
pub __seq: ::c_ushort,
pub __pad2: ::c_ushort,
pub __uclibc_unused1: ::c_ulong,
pub __uclibc_unused2: ::c_ulong,
pub __unused1: ::c_ulong,
pub __unused2: ::c_ulong,
}
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
pub msg_stime: ::time_t,
pub __uclibc_unused1: ::c_ulong,
pub __unused1: ::c_ulong,
pub msg_rtime: ::time_t,
pub __uclibc_unused2: ::c_ulong,
pub __unused2: ::c_ulong,
pub msg_ctime: ::time_t,
pub __uclibc_unused3: ::c_ulong,
pub __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 __uclibc_unused4: ::c_ulong,
pub __uclibc_unused5: ::c_ulong,
pub __unused4: ::c_ulong,
pub __unused5: ::c_ulong,
}
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_atime: ::time_t,
pub __uclibc_unused1: ::c_ulong,
pub __unused1: ::c_ulong,
pub shm_dtime: ::time_t,
pub __uclibc_unused2: ::c_ulong,
pub __unused2: ::c_ulong,
pub shm_ctime: ::time_t,
pub __uclibc_unused3: ::c_ulong,
pub __unused3: ::c_ulong,
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub __uclibc_unused4: ::c_ulong,
pub __uclibc_unused5: ::c_ulong,
pub __unused4: ::c_ulong,
pub __unused5: ::c_ulong,
}
}
@ -469,6 +469,7 @@ 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 RTLD_GLOBAL: ::c_int = 0x00100;
// These are typed unsigned to match sigaction
pub const SA_NOCLDSTOP: ::c_ulong = 0x1;
@ -516,6 +517,8 @@ pub const TABDLY: ::c_int = 0x1800;
pub const TCSADRAIN: ::c_int = 0x1;
pub const TCSAFLUSH: ::c_int = 0x2;
pub const TCSANOW: ::c_int = 0;
pub const TIOCGWINSZ: ::c_int = 0x5413;
pub const TIOCSWINSZ: ::c_int = 0x5414;
pub const TOSTOP: ::tcflag_t = 0x100;
pub const VDISCARD: usize = 0xd;
pub const VEOF: usize = 0x4;
@ -886,6 +889,9 @@ pub const SYS_pwritev2: ::c_long = 393;
pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
pub const SYS_statx: ::c_int = 397;
pub const SYS_pidfd_open: ::c_long = 434;
pub const SYS_clone3: ::c_long = 435;
extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;

View file

@ -625,6 +625,7 @@ pub const SYS_pwritev2: ::c_long = 4000 + 362;
pub const SYS_pkey_mprotect: ::c_long = 4000 + 363;
pub const SYS_pkey_alloc: ::c_long = 4000 + 364;
pub const SYS_pkey_free: ::c_long = 4000 + 365;
pub const SYS_clone3: ::c_long = 4000 + 435;
#[link(name = "util")]
extern "C" {

View file

@ -32,22 +32,13 @@ pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
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_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 NI_MAXHOST: ::socklen_t = 1025;
pub const RLIMIT_NOFILE: ::c_int = 5;
pub const RLIMIT_AS: ::c_int = 6;
pub const RLIMIT_RSS: ::c_int = 7;
pub const RLIMIT_NPROC: ::c_int = 8;
pub const RLIMIT_MEMLOCK: ::c_int = 9;
pub const RLIMIT_NLIMITS: ::c_int = 15;
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
@ -87,7 +78,6 @@ pub const EXFULL: ::c_int = 52;
pub const ENOANO: ::c_int = 53;
pub const EBADRQC: ::c_int = 54;
pub const EBADSLT: ::c_int = 55;
pub const EDEADLOCK: ::c_int = 56;
pub const EMULTIHOP: ::c_int = 74;
pub const EOVERFLOW: ::c_int = 79;
pub const ENOTUNIQ: ::c_int = 80;
@ -189,7 +179,6 @@ pub const SIGTSTP: ::c_int = 24;
pub const SIGURG: ::c_int = 21;
pub const SIGIO: ::c_int = 22;
pub const SIGSYS: ::c_int = 12;
pub const SIGPOLL: ::c_int = 22;
pub const SIGPWR: ::c_int = 19;
pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
@ -216,47 +205,15 @@ pub const CPU_SETSIZE: ::c_int = 0x400;
pub const EFD_NONBLOCK: ::c_int = 0x80;
pub const F_GETLK: ::c_int = 14;
pub const F_GETOWN: ::c_int = 23;
pub const F_SETOWN: ::c_int = 24;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const SFD_NONBLOCK: ::c_int = 0x80;
pub const TCGETS: ::c_ulong = 0x540d;
pub const TCSETS: ::c_ulong = 0x540e;
pub const TCSETSW: ::c_ulong = 0x540f;
pub const TCSETSF: ::c_ulong = 0x5410;
pub const TCGETA: ::c_ulong = 0x5401;
pub const TCSETA: ::c_ulong = 0x5402;
pub const TCSETAW: ::c_ulong = 0x5403;
pub const TCSETAF: ::c_ulong = 0x5404;
pub const TCSBRK: ::c_ulong = 0x5405;
pub const TCXONC: ::c_ulong = 0x5406;
pub const TCFLSH: ::c_ulong = 0x5407;
pub const TIOCGSOFTCAR: ::c_ulong = 0x5481;
pub const TIOCSSOFTCAR: ::c_ulong = 0x5482;
pub const TIOCINQ: ::c_ulong = 0x467f;
pub const TIOCLINUX: ::c_ulong = 0x5483;
pub const TIOCGSERIAL: ::c_ulong = 0x5484;
pub const TIOCEXCL: ::c_ulong = 0x740d;
pub const TIOCNXCL: ::c_ulong = 0x740e;
pub const TIOCSCTTY: ::c_ulong = 0x5480;
pub const TIOCGPGRP: ::c_ulong = 0x40047477;
pub const TIOCSPGRP: ::c_ulong = 0x80047476;
pub const TIOCOUTQ: ::c_ulong = 0x7472;
pub const TIOCSTI: ::c_ulong = 0x5472;
pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
pub const TIOCMGET: ::c_ulong = 0x741d;
pub const TIOCMBIS: ::c_ulong = 0x741b;
pub const TIOCMBIC: ::c_ulong = 0x741c;
pub const TIOCMSET: ::c_ulong = 0x741a;
pub const FIONREAD: ::c_ulong = 0x467f;
pub const TIOCCONS: ::c_ulong = 0x80047478;
pub const RTLD_GLOBAL: ::c_int = 0x4;
pub const RTLD_NOLOAD: ::c_int = 0x8;
pub const SIGSTKSZ: ::size_t = 8192;
pub const CBAUD: ::tcflag_t = 0o0010017;
@ -316,8 +273,6 @@ pub const B4800: ::speed_t = 0o000014;
pub const B9600: ::speed_t = 0o000015;
pub const B19200: ::speed_t = 0o000016;
pub const B38400: ::speed_t = 0o000017;
pub const EXTA: ::speed_t = B19200;
pub const EXTB: ::speed_t = B38400;
pub const B57600: ::speed_t = 0o010001;
pub const B115200: ::speed_t = 0o010002;
pub const B230400: ::speed_t = 0o010003;

View file

@ -2,6 +2,8 @@ pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type regoff_t = ::c_int;
pub type __rlimit_resource_t = ::c_uint;
pub type __priority_which_t = ::c_uint;
s! {
pub struct statvfs { // Different than GNU!
@ -34,6 +36,32 @@ s! {
__re_nsub: ::size_t,
__bitfield: u8,
}
pub struct rtentry {
pub rt_pad1: ::c_ulong,
pub rt_dst: ::sockaddr,
pub rt_gateway: ::sockaddr,
pub rt_genmask: ::sockaddr,
pub rt_flags: ::c_ushort,
pub rt_pad2: ::c_short,
pub rt_pad3: ::c_ulong,
pub rt_tos: ::c_uchar,
pub rt_class: ::c_uchar,
#[cfg(target_pointer_width = "64")]
pub rt_pad4: [::c_short; 3usize],
#[cfg(not(target_pointer_width = "64"))]
pub rt_pad4: ::c_short,
pub rt_metric: ::c_short,
pub rt_dev: *mut ::c_char,
pub rt_mtu: ::c_ulong,
pub rt_window: ::c_ulong,
pub rt_irtt: ::c_ushort,
}
pub struct __exit_status {
pub e_termination: ::c_short,
pub e_exit: ::c_short,
}
}
pub const MCL_CURRENT: ::c_int = 0x0001;
@ -223,6 +251,108 @@ pub const PRIO_USER: ::c_int = 2;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const AF_NFC: ::c_int = PF_NFC;
pub const BUFSIZ: ::c_int = 4096;
pub const EDEADLOCK: ::c_int = EDEADLK;
pub const EXTA: ::c_uint = B19200;
pub const EXTB: ::c_uint = B38400;
pub const EXTPROC: ::c_int = 0200000;
pub const FAN_MARK_FILESYSTEM: ::c_int = 0x00000100;
pub const FAN_MARK_INODE: ::c_int = 0x00000000;
pub const FAN_MARK_MOUNT: ::c_int = 0x10;
pub const FIONREAD: ::c_int = 0x541B;
pub const FOPEN_MAX: ::c_int = 16;
pub const F_GETOWN: ::c_int = 9;
pub const F_OFD_GETLK: ::c_int = 36;
pub const F_OFD_SETLK: ::c_int = 37;
pub const F_OFD_SETLKW: ::c_int = 38;
pub const F_RDLCK: ::c_int = 0;
pub const F_SETOWN: ::c_int = 8;
pub const F_UNLCK: ::c_int = 2;
pub const F_WRLCK: ::c_int = 1;
pub const IPV6_MULTICAST_ALL: ::c_int = 29;
pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
pub const MAP_HUGE_SHIFT: ::c_int = 26;
pub const MAP_HUGE_MASK: ::c_int = 0x3f;
pub const MAP_HUGE_64KB: ::c_int = 16 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_512KB: ::c_int = 19 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_1MB: ::c_int = 20 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_2MB: ::c_int = 21 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_8MB: ::c_int = 23 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_16MB: ::c_int = 24 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_32MB: ::c_int = 25 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_256MB: ::c_int = 28 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_512MB: ::c_int = 29 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_1GB: ::c_int = 30 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_2GB: ::c_int = 31 << MAP_HUGE_SHIFT;
pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT;
pub const MINSIGSTKSZ: ::c_int = 2048;
pub const MSG_COPY: ::c_int = 040000;
pub const NI_MAXHOST: ::socklen_t = 1025;
pub const O_TMPFILE: ::c_int = 020000000 | O_DIRECTORY;
pub const PACKET_MR_UNICAST: ::c_int = 3;
pub const PF_NFC: ::c_int = 39;
pub const PF_VSOCK: ::c_int = 40;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const PTRACE_EVENT_STOP: ::c_int = 128;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
pub const RLIMIT_AS: ::c_int = 9;
pub const RLIMIT_MEMLOCK: ::c_int = 8;
pub const RLIMIT_NLIMITS: ::c_int = 15;
pub const RLIMIT_NOFILE: ::c_int = 7;
pub const RLIMIT_NPROC: ::c_int = 6;
pub const RLIMIT_RSS: ::c_int = 5;
pub const RLIMIT_RTTIME: ::c_int = 15;
pub const RTLD_NOLOAD: ::c_int = 0x00004;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const SHM_EXEC: ::c_int = 0100000;
pub const SIGPOLL: ::c_int = SIGIO;
pub const SOCK_DCCP: ::c_int = 6;
pub const SOCK_PACKET: ::c_int = 10;
pub const TCFLSH: ::c_int = 0x540B;
pub const TCGETA: ::c_int = 0x5405;
pub const TCGETS: ::c_int = 0x5401;
pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
pub const TCSBRK: ::c_int = 0x5409;
pub const TCSETA: ::c_int = 0x5406;
pub const TCSETAF: ::c_int = 0x5408;
pub const TCSETAW: ::c_int = 0x5407;
pub const TCSETS: ::c_int = 0x5402;
pub const TCSETSF: ::c_int = 0x5404;
pub const TCSETSW: ::c_int = 0x5403;
pub const TCXONC: ::c_int = 0x540A;
pub const TIOCCONS: ::c_int = 0x541D;
pub const TIOCEXCL: ::c_int = 0x540C;
pub const TIOCGPGRP: ::c_int = 0x540F;
pub const TIOCGSERIAL: ::c_int = 0x541E;
pub const TIOCGSOFTCAR: ::c_int = 0x5419;
pub const TIOCINQ: ::c_int = FIONREAD;
pub const TIOCLINUX: ::c_int = 0x541C;
pub const TIOCMBIC: ::c_int = 0x5417;
pub const TIOCMGET: ::c_int = 0x5415;
pub const TIOCMBIS: ::c_int = 0x5416;
pub const TIOCMSET: ::c_int = 0x5418;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_DSR: ::c_int = 0x100;
pub const TIOCM_DTR: ::c_int = 0x002;
pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_RTS: ::c_int = 0x004;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCNXCL: ::c_int = 0x540D;
pub const TIOCOUTQ: ::c_int = 0x5411;
pub const TIOCSCTTY: ::c_int = 0x540E;
pub const TIOCSPGRP: ::c_int = 0x5410;
pub const TIOCSSOFTCAR: ::c_int = 0x541A;
pub const TIOCSTI: ::c_int = 0x5412;
pub const UDP_GRO: ::c_int = 104;
pub const UDP_SEGMENT: ::c_int = 103;
pub const YESEXPR: ::c_int = ((5) << 8) | (0);
extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
@ -289,6 +419,19 @@ extern "C" {
) -> ::ssize_t;
pub fn sethostid(hostid: ::c_long) -> ::c_int;
pub fn fanotify_mark(
fd: ::c_int,
flags: ::c_uint,
mask: u64,
dirfd: ::c_int,
path: *const ::c_char,
) -> ::c_int;
pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
}
cfg_if! {

View file

@ -46,3 +46,8 @@ pub struct pthread_attr_t {
// L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
// somewhere in the core libraries. uClibc wants 16k, but that's not enough.
pub const PTHREAD_STACK_MIN: usize = 65536;
// Misc other constants required for building.
pub const SIGIO: ::c_int = 29;
pub const B19200: ::speed_t = 0o000016;
pub const B38400: ::speed_t = 0o000017;

View file

@ -877,6 +877,8 @@ pub const IPPROTO_MH: ::c_int = 135;
pub const IPPROTO_UDPLITE: ::c_int = 136;
/// raw IP packet
pub const IPPROTO_RAW: ::c_int = 255;
pub const IPPROTO_BEETPH: ::c_int = 94;
pub const IPPROTO_MPLS: ::c_int = 137;
pub const MCAST_EXCLUDE: ::c_int = 0;
pub const MCAST_INCLUDE: ::c_int = 1;
@ -913,6 +915,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;
pub const IPV6_HDRINCL: ::c_int = 36;
pub const IPV6_RECVPKTINFO: ::c_int = 49;
pub const IPV6_PKTINFO: ::c_int = 50;
pub const IPV6_RECVHOPLIMIT: ::c_int = 51;
@ -948,6 +951,8 @@ 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;
pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_MAXSEG: ::c_int = 2;
@ -1117,6 +1122,7 @@ pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
pub const CLONE_DETACHED: ::c_int = 0x400000;
pub const CLONE_UNTRACED: ::c_int = 0x800000;
pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
pub const CLONE_NEWUTS: ::c_int = 0x04000000;
pub const CLONE_NEWIPC: ::c_int = 0x08000000;
pub const CLONE_NEWUSER: ::c_int = 0x10000000;
@ -1132,11 +1138,15 @@ pub const WCONTINUED: ::c_int = 0x00000008;
pub const WNOWAIT: ::c_int = 0x01000000;
// Options for personality(2).
pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
pub const MMAP_PAGE_ZERO: ::c_int = 0x0100000;
pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
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;
pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
// Options set using PTRACE_SETOPTIONS.
pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
@ -1147,6 +1157,8 @@ 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;
pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
// Wait extended result codes for the above trace options.
pub const PTRACE_EVENT_FORK: ::c_int = 1;
@ -1346,18 +1358,6 @@ pub const ARPHRD_NONE: u16 = 0xFFFE;
cfg_if! {
if #[cfg(not(target_env = "uclibc"))] {
pub const IPPROTO_BEETPH: ::c_int = 94;
pub const IPPROTO_MPLS: ::c_int = 137;
pub const IPV6_HDRINCL: ::c_int = 36;
pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000;
pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
}
}