diff --git a/Cargo.toml b/Cargo.toml index 3ca0827a37aed..825e296618942 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,12 +85,14 @@ targets = [ "riscv32i-unknown-none-elf", "riscv32imac-unknown-none-elf", "riscv32imc-unknown-none-elf", + "riscv32-wrs-vxworks", "riscv64gc-unknown-freebsd", "riscv64gc-unknown-hermit", "riscv64gc-unknown-linux-gnu", "riscv64gc-unknown-linux-musl", "riscv64gc-unknown-none-elf", "riscv64imac-unknown-none-elf", + "riscv64-wrs-vxworks", "s390x-unknown-linux-gnu", "s390x-unknown-linux-musl", "sparc-unknown-linux-gnu", diff --git a/ci/build.sh b/ci/build.sh index d90872f4e8c84..d4b85ccbf0bd9 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -252,11 +252,13 @@ riscv32i-unknown-none-elf \ riscv32imac-unknown-none-elf \ riscv32imc-unknown-none-elf \ riscv32gc-unknown-linux-gnu \ +riscv32-wrs-vxworks \ riscv64gc-unknown-freebsd \ riscv64gc-unknown-hermit \ riscv64gc-unknown-linux-musl \ riscv64gc-unknown-none-elf \ riscv64imac-unknown-none-elf \ +riscv64-wrs-vxworks \ s390x-unknown-linux-musl \ sparc-unknown-linux-gnu \ sparc64-unknown-netbsd \ diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index d2d26b0fe0688..8c9a7854f9eba 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -874,6 +874,31 @@ RLIMIT_STACK RLIMIT_VMEM RLIM_INFINITY RLIM_NLIMITS +RTF_XRESOLVE +RTF_LLINFO +RTF_PROTO3 +RTF_PINNED +RTF_LOCAL +RTF_BROADCAST +RTF_MULTICAST +RTM_LOCK +RTM_RESOLVE +RTM_NEWADDR +RTM_DELADDR +RTM_IFINFO +RTM_NEWMADDR +RTM_DELMADDR +RTM_IFANNOUNCE +RTM_IEEE80211 +RTF_CLONING +RTF_PRCLONING +RTF_WASCLONED +RTF_MPLSOPS +RTM_VERSION +RTAX_MPLS1 +RTAX_MPLS2 +RTAX_MPLS3 +RTAX_MAX RTLD_NEXT RTLD_NODELETE RTLD_NOLOAD diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 85cb2d6fd823e..d4b53860b5a53 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1023,6 +1023,7 @@ PL_FLAG_SI PM_STR POLLINIGNEOF POLLRDBAND +POLLRDHUP POLLRDNORM POLLSTANDARD POLLWRBAND @@ -1218,6 +1219,26 @@ RLIMIT_UMTXP RLIMIT_VMEM RLIM_INFINITY RLIM_NLIMITS +RTF_XRESOLVE +RTF_LLINFO +RTF_PROTO3 +RTF_PINNED +RTF_LOCAL +RTF_BROADCAST +RTF_MULTICAST +RTM_LOCK +RTM_RESOLVE +RTM_NEWADDR +RTM_DELADDR +RTM_IFINFO +RTM_NEWMADDR +RTM_DELMADDR +RTM_IFANNOUNCE +RTM_IEEE80211 +RTF_LLDATA +RTF_FIXEDMTU +RTM_VERSION +RTAX_MAX RTLD_NEXT RTLD_NODELETE RTLD_NOLOAD diff --git a/libc-test/semver/illumos.txt b/libc-test/semver/illumos.txt index d0ef608456d54..64c25d4b4f969 100644 --- a/libc-test/semver/illumos.txt +++ b/libc-test/semver/illumos.txt @@ -1,3 +1,14 @@ +O_RSYNC +POLLRDHUP +POSIX_FADV_DONTNEED +POSIX_FADV_NOREUSE +POSIX_FADV_NORMAL +POSIX_FADV_RANDOM +POSIX_FADV_SEQUENTIAL +POSIX_FADV_WILLNEED +posix_fadvise +posix_fallocate pthread_attr_get_np pthread_attr_getstackaddr pthread_attr_setstack +ptsname_r diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index b775cec7182d9..531bb8567dd0c 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -1,4 +1,3 @@ -# TODO: musl. AF_IB AF_MPLS AF_XDP diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 838f28f71b5d1..cfde7caca0c55 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -136,6 +136,8 @@ CLD_EXITED CLD_KILLED CLD_STOPPED CLD_TRAPPED +CLOCK_PROCESS_CPUTIME_ID +CLOCK_THREAD_CPUTIME_ID CMSG_DATA CMSG_FIRSTHDR CMSG_LEN @@ -927,6 +929,28 @@ RLIM_INFINITY RLIM_NLIMITS RLIM_SAVED_CUR RLIM_SAVED_MAX +RTF_MASK +RTF_CONNECTED +RTF_ANNOUNCE +RTF_SRC +RTF_LOCAL +RTF_BROADCAST +RTF_UPDATING +RTF_DONTCHANGEIFA +RTM_VERSION +RTM_LOCK +RTM_IFANNOUNCE +RTM_IEEE80211 +RTM_SETGATE +RTM_LLINFO_UPD +RTM_IFINFO +RTM_OCHGADDR +RTM_NEWADDR +RTM_DELADDR +RTM_CHGADDR +RTA_TAG +RTAX_TAG +RTAX_MAX RTLD_NEXT RTLD_NOLOAD RTLD_SELF @@ -1567,6 +1591,7 @@ sync syscall sysctl sysctlbyname +sysctlnametomib sysctldesc tcp_info telldir diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index 197df09e1c2c6..ecdf40076fa72 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -765,8 +765,50 @@ RLIM_INFINITY RLIM_NLIMITS RLIM_SAVED_CUR RLIM_SAVED_MAX +RTA_BFD +RTA_DNS +RTA_LABEL +RTA_SEARCH +RTA_SRC +RTA_SRCMASK +RTA_STATIC +RTAX_BFD +RTAX_DNS +RTAX_LABEL +RTAX_MAX +RTAX_SEARCH +RTAX_SRC +RTAX_SRCMASK +RTAX_STATIC +RTF_ANNOUNCE +RTF_BFD +RTF_BROADCAST +RTF_CACHED +RTF_CLONED +RTF_CLONING +RTF_CONNECTED +RTF_FMASK +RTF_LLINFO +RTF_LOCAL +RTF_MPATH +RTF_MPLS +RTF_MULTICAST +RTF_PROTO3 RTLD_NEXT RTLD_SELF +RTM_80211INFO +RTM_BFD +RTM_CHGADDRATTR +RTM_DELADDR +RTM_DESYNC +RTM_IFANNOUNCE +RTM_IFINFO +RTM_INVALIDATE +RTM_NEWADDR +RTM_PROPOSAL +RTM_RESOLVE +RTM_SOURCE +RTM_VERSION RUSAGE_CHILDREN RUSAGE_SELF RUSAGE_THREAD diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 804bd89b5c4e8..0017403410f4c 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4940,22 +4940,11 @@ pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020; pub const NET_RT_IFLIST2: ::c_int = 0x0006; // net/route.h -pub const RTF_UP: ::c_int = 0x1; -pub const RTF_GATEWAY: ::c_int = 0x2; -pub const RTF_HOST: ::c_int = 0x4; -pub const RTF_REJECT: ::c_int = 0x8; -pub const RTF_DYNAMIC: ::c_int = 0x10; -pub const RTF_MODIFIED: ::c_int = 0x20; -pub const RTF_DONE: ::c_int = 0x40; pub const RTF_DELCLONE: ::c_int = 0x80; pub const RTF_CLONING: ::c_int = 0x100; pub const RTF_XRESOLVE: ::c_int = 0x200; pub const RTF_LLINFO: ::c_int = 0x400; -pub const RTF_STATIC: ::c_int = 0x800; -pub const RTF_BLACKHOLE: ::c_int = 0x1000; pub const RTF_NOIFREF: ::c_int = 0x2000; -pub const RTF_PROTO2: ::c_int = 0x4000; -pub const RTF_PROTO1: ::c_int = 0x8000; pub const RTF_PRCLONING: ::c_int = 0x10000; pub const RTF_WASCLONED: ::c_int = 0x20000; pub const RTF_PROTO3: ::c_int = 0x40000; @@ -4974,13 +4963,6 @@ pub const RTF_GLOBAL: ::c_int = 0x40000000; pub const RTM_VERSION: ::c_int = 5; // Message types -pub const RTM_ADD: ::c_int = 0x1; -pub const RTM_DELETE: ::c_int = 0x2; -pub const RTM_CHANGE: ::c_int = 0x3; -pub const RTM_GET: ::c_int = 0x4; -pub const RTM_LOSING: ::c_int = 0x5; -pub const RTM_REDIRECT: ::c_int = 0x6; -pub const RTM_MISS: ::c_int = 0x7; pub const RTM_LOCK: ::c_int = 0x8; pub const RTM_OLDADD: ::c_int = 0x9; pub const RTM_OLDDEL: ::c_int = 0xa; @@ -5004,25 +4986,6 @@ pub const RTV_SSTHRESH: ::c_int = 0x20; pub const RTV_RTT: ::c_int = 0x40; pub const RTV_RTTVAR: ::c_int = 0x80; -// Bitmask values for rtm_addrs. -pub const RTA_DST: ::c_int = 0x1; -pub const RTA_GATEWAY: ::c_int = 0x2; -pub const RTA_NETMASK: ::c_int = 0x4; -pub const RTA_GENMASK: ::c_int = 0x8; -pub const RTA_IFP: ::c_int = 0x10; -pub const RTA_IFA: ::c_int = 0x20; -pub const RTA_AUTHOR: ::c_int = 0x40; -pub const RTA_BRD: ::c_int = 0x80; - -// Index offsets for sockaddr array for alternate internal encoding. -pub const RTAX_DST: ::c_int = 0; -pub const RTAX_GATEWAY: ::c_int = 1; -pub const RTAX_NETMASK: ::c_int = 2; -pub const RTAX_GENMASK: ::c_int = 3; -pub const RTAX_IFP: ::c_int = 4; -pub const RTAX_IFA: ::c_int = 5; -pub const RTAX_AUTHOR: ::c_int = 6; -pub const RTAX_BRD: ::c_int = 7; pub const RTAX_MAX: ::c_int = 8; pub const KERN_PROCARGS2: ::c_int = 49; diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 6ade7949afb0f..9b3b872d03948 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1522,6 +1522,19 @@ pub const NGROUPS: usize = 16; pub const RB_PAUSE: ::c_int = 0x40000; pub const RB_VIDEO: ::c_int = 0x20000000; +// net/route.h +pub const RTF_CLONING: ::c_int = 0x100; +pub const RTF_PRCLONING: ::c_int = 0x10000; +pub const RTF_WASCLONED: ::c_int = 0x20000; +pub const RTF_MPLSOPS: ::c_int = 0x1000000; + +pub const RTM_VERSION: ::c_int = 7; + +pub const RTAX_MPLS1: ::c_int = 8; +pub const RTAX_MPLS2: ::c_int = 9; +pub const RTAX_MPLS3: ::c_int = 10; +pub const RTAX_MAX: ::c_int = 11; + const_fn! { {const} fn _CMSG_ALIGN(n: usize) -> usize { (n + (::mem::size_of::<::c_long>() - 1)) & !(::mem::size_of::<::c_long>() - 1) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 3224ac8fef6e9..a15987df10775 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2894,6 +2894,7 @@ pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; pub const POLLINIGNEOF: ::c_short = 0x2000; +pub const POLLRDHUP: ::c_short = 0x4000; pub const EVFILT_READ: i16 = -1; pub const EVFILT_WRITE: i16 = -2; @@ -4742,6 +4743,14 @@ pub const CPU_WHICH_CPUSET: ::c_int = 3; pub const CPU_WHICH_IRQ: ::c_int = 4; pub const CPU_WHICH_JAIL: ::c_int = 5; +// net/route.h +pub const RTF_LLDATA: ::c_int = 0x400; +pub const RTF_FIXEDMTU: ::c_int = 0x80000; + +pub const RTM_VERSION: ::c_int = 5; + +pub const RTAX_MAX: ::c_int = 8; + // sys/signal.h pub const SIGTHR: ::c_int = 32; pub const SIGLWP: ::c_int = SIGTHR; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index e0a0fbd01443f..86ade55353560 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1017,6 +1017,25 @@ pub const SO_TYPE: ::c_int = 0x1008; pub const LOCAL_PEERCRED: ::c_int = 1; +// net/route.h +pub const RTF_XRESOLVE: ::c_int = 0x200; +pub const RTF_LLINFO: ::c_int = 0x400; +pub const RTF_PROTO3: ::c_int = 0x40000; +pub const RTF_PINNED: ::c_int = 0x100000; +pub const RTF_LOCAL: ::c_int = 0x200000; +pub const RTF_BROADCAST: ::c_int = 0x400000; +pub const RTF_MULTICAST: ::c_int = 0x800000; + +pub const RTM_LOCK: ::c_int = 0x8; +pub const RTM_RESOLVE: ::c_int = 0xb; +pub const RTM_NEWADDR: ::c_int = 0xc; +pub const RTM_DELADDR: ::c_int = 0xd; +pub const RTM_IFINFO: ::c_int = 0xe; +pub const RTM_NEWMADDR: ::c_int = 0xf; +pub const RTM_DELMADDR: ::c_int = 0x10; +pub const RTM_IFANNOUNCE: ::c_int = 0x11; +pub const RTM_IEEE80211: ::c_int = 0x12; + pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 7acda9076d1f0..b49a83862f292 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -543,6 +543,49 @@ pub const ITIMER_REAL: ::c_int = 0; pub const ITIMER_VIRTUAL: ::c_int = 1; pub const ITIMER_PROF: ::c_int = 2; +// net/route.h + +pub const RTF_UP: ::c_int = 0x1; +pub const RTF_GATEWAY: ::c_int = 0x2; +pub const RTF_HOST: ::c_int = 0x4; +pub const RTF_REJECT: ::c_int = 0x8; +pub const RTF_DYNAMIC: ::c_int = 0x10; +pub const RTF_MODIFIED: ::c_int = 0x20; +pub const RTF_DONE: ::c_int = 0x40; +pub const RTF_STATIC: ::c_int = 0x800; +pub const RTF_BLACKHOLE: ::c_int = 0x1000; +pub const RTF_PROTO2: ::c_int = 0x4000; +pub const RTF_PROTO1: ::c_int = 0x8000; + +// Message types +pub const RTM_ADD: ::c_int = 0x1; +pub const RTM_DELETE: ::c_int = 0x2; +pub const RTM_CHANGE: ::c_int = 0x3; +pub const RTM_GET: ::c_int = 0x4; +pub const RTM_LOSING: ::c_int = 0x5; +pub const RTM_REDIRECT: ::c_int = 0x6; +pub const RTM_MISS: ::c_int = 0x7; + +// Bitmask values for rtm_addrs. +pub const RTA_DST: ::c_int = 0x1; +pub const RTA_GATEWAY: ::c_int = 0x2; +pub const RTA_NETMASK: ::c_int = 0x4; +pub const RTA_GENMASK: ::c_int = 0x8; +pub const RTA_IFP: ::c_int = 0x10; +pub const RTA_IFA: ::c_int = 0x20; +pub const RTA_AUTHOR: ::c_int = 0x40; +pub const RTA_BRD: ::c_int = 0x80; + +// Index offsets for sockaddr array for alternate internal encoding. +pub const RTAX_DST: ::c_int = 0; +pub const RTAX_GATEWAY: ::c_int = 1; +pub const RTAX_NETMASK: ::c_int = 2; +pub const RTAX_GENMASK: ::c_int = 3; +pub const RTAX_IFP: ::c_int = 4; +pub const RTAX_IFA: ::c_int = 5; +pub const RTAX_AUTHOR: ::c_int = 6; +pub const RTAX_BRD: ::c_int = 7; + f! { pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr { if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 0517a47b69c30..da96d092b4062 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1886,6 +1886,8 @@ pub const MNT_NOWAIT: ::c_int = 2; pub const MNT_LAZY: ::c_int = 3; // +pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; +pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 4; pub const NTP_API: ::c_int = 4; pub const MAXPHASE: ::c_long = 500000000; pub const MAXFREQ: ::c_long = 500000; @@ -2422,6 +2424,33 @@ cfg_if! { } } +// net/route.h +pub const RTF_MASK: ::c_int = 0x80; +pub const RTF_CONNECTED: ::c_int = 0x100; +pub const RTF_ANNOUNCE: ::c_int = 0x20000; +pub const RTF_SRC: ::c_int = 0x10000; +pub const RTF_LOCAL: ::c_int = 0x40000; +pub const RTF_BROADCAST: ::c_int = 0x80000; +pub const RTF_UPDATING: ::c_int = 0x100000; +pub const RTF_DONTCHANGEIFA: ::c_int = 0x200000; + +pub const RTM_VERSION: ::c_int = 4; +pub const RTM_LOCK: ::c_int = 0x8; +pub const RTM_IFANNOUNCE: ::c_int = 0x10; +pub const RTM_IEEE80211: ::c_int = 0x11; +pub const RTM_SETGATE: ::c_int = 0x12; +pub const RTM_LLINFO_UPD: ::c_int = 0x13; +pub const RTM_IFINFO: ::c_int = 0x14; +pub const RTM_OCHGADDR: ::c_int = 0x15; +pub const RTM_NEWADDR: ::c_int = 0x16; +pub const RTM_DELADDR: ::c_int = 0x17; +pub const RTM_CHGADDR: ::c_int = 0x18; + +pub const RTA_TAG: ::c_int = 0x100; + +pub const RTAX_TAG: ::c_int = 8; +pub const RTAX_MAX: ::c_int = 9; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -2668,6 +2697,11 @@ extern "C" { newp: *const ::c_void, newlen: ::size_t, ) -> ::c_int; + pub fn sysctlnametomib( + sname: *const ::c_char, + name: *mut ::c_int, + namelenp: *mut ::size_t, + ) -> ::c_int; #[link_name = "__kevent50"] pub fn kevent( kq: ::c_int, diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 8f470aff9a357..259f9e06024d1 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1916,6 +1916,62 @@ pub const RB_RESET: ::c_int = 0x08000; pub const RB_GOODRANDOM: ::c_int = 0x10000; pub const RB_UNHIBERNATE: ::c_int = 0x20000; +// net/route.h +pub const RTF_CLONING: ::c_int = 0x100; +pub const RTF_MULTICAST: ::c_int = 0x200; +pub const RTF_LLINFO: ::c_int = 0x400; +pub const RTF_PROTO3: ::c_int = 0x2000; +pub const RTF_ANNOUNCE: ::c_int = ::RTF_PROTO2; + +pub const RTF_CLONED: ::c_int = 0x10000; +pub const RTF_CACHED: ::c_int = 0x20000; +pub const RTF_MPATH: ::c_int = 0x40000; +pub const RTF_MPLS: ::c_int = 0x100000; +pub const RTF_LOCAL: ::c_int = 0x200000; +pub const RTF_BROADCAST: ::c_int = 0x400000; +pub const RTF_CONNECTED: ::c_int = 0x800000; +pub const RTF_BFD: ::c_int = 0x1000000; +pub const RTF_FMASK: ::c_int = ::RTF_LLINFO + | ::RTF_PROTO1 + | ::RTF_PROTO2 + | ::RTF_PROTO3 + | ::RTF_BLACKHOLE + | ::RTF_REJECT + | ::RTF_STATIC + | ::RTF_MPLS + | ::RTF_BFD; + +pub const RTM_VERSION: ::c_int = 5; +pub const RTM_RESOLVE: ::c_int = 0xb; +pub const RTM_NEWADDR: ::c_int = 0xc; +pub const RTM_DELADDR: ::c_int = 0xd; +pub const RTM_IFINFO: ::c_int = 0xe; +pub const RTM_IFANNOUNCE: ::c_int = 0xf; +pub const RTM_DESYNC: ::c_int = 0x10; +pub const RTM_INVALIDATE: ::c_int = 0x11; +pub const RTM_BFD: ::c_int = 0x12; +pub const RTM_PROPOSAL: ::c_int = 0x13; +pub const RTM_CHGADDRATTR: ::c_int = 0x14; +pub const RTM_80211INFO: ::c_int = 0x15; +pub const RTM_SOURCE: ::c_int = 0x16; + +pub const RTA_SRC: ::c_int = 0x100; +pub const RTA_SRCMASK: ::c_int = 0x200; +pub const RTA_LABEL: ::c_int = 0x400; +pub const RTA_BFD: ::c_int = 0x800; +pub const RTA_DNS: ::c_int = 0x1000; +pub const RTA_STATIC: ::c_int = 0x2000; +pub const RTA_SEARCH: ::c_int = 0x4000; + +pub const RTAX_SRC: ::c_int = 8; +pub const RTAX_SRCMASK: ::c_int = 9; +pub const RTAX_LABEL: ::c_int = 10; +pub const RTAX_BFD: ::c_int = 11; +pub const RTAX_DNS: ::c_int = 12; +pub const RTAX_STATIC: ::c_int = 13; +pub const RTAX_SEARCH: ::c_int = 14; +pub const RTAX_MAX: ::c_int = 15; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index ef3862ee41b34..614fd12eb07eb 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -28,6 +28,8 @@ pub const EFD_SEMAPHORE: ::c_int = 0x1; pub const EFD_NONBLOCK: ::c_int = 0x800; pub const EFD_CLOEXEC: ::c_int = 0x80000; +pub const POLLRDHUP: ::c_short = 0x4000; + pub const TCP_KEEPIDLE: ::c_int = 34; pub const TCP_KEEPCNT: ::c_int = 35; pub const TCP_KEEPINTVL: ::c_int = 36; @@ -56,6 +58,13 @@ pub const SOL_FILTER: ::c_int = 0xfffc; pub const MADV_PURGE: ::c_int = 9; +pub const POSIX_FADV_NORMAL: ::c_int = 0; +pub const POSIX_FADV_RANDOM: ::c_int = 1; +pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_FADV_WILLNEED: ::c_int = 3; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + pub const B1000000: ::speed_t = 24; pub const B1152000: ::speed_t = 25; pub const B1500000: ::speed_t = 26; @@ -96,8 +105,11 @@ extern "C" { stackaddr: *mut ::c_void, ) -> ::c_int; + pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advice: ::c_int) -> ::c_int; pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; pub fn getpagesizes2(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int; + + pub fn ptsname_r(fildes: ::c_int, name: *mut ::c_char, namelen: ::size_t) -> ::c_int; } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 63056bfbd7c7c..1cc6c429bc2d1 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1307,6 +1307,7 @@ pub const O_RDWR: ::c_int = 2; pub const O_NDELAY: ::c_int = 0x04; pub const O_APPEND: ::c_int = 8; pub const O_DSYNC: ::c_int = 0x40; +pub const O_RSYNC: ::c_int = 0x8000; pub const O_CREAT: ::c_int = 256; pub const O_EXCL: ::c_int = 1024; pub const O_NOCTTY: ::c_int = 2048; @@ -2168,7 +2169,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 4; -pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; +pub const PTHREAD_MUTEX_DEFAULT: ::c_int = ::PTHREAD_MUTEX_NORMAL; pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void; pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void; @@ -2846,6 +2847,7 @@ extern "C" { #[cfg_attr(target_os = "illumos", link_name = "_globfree_ext")] pub fn globfree(pglob: *mut ::glob_t); + pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int; pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 314283410aed6..f7adb5d682e5e 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -253,7 +253,7 @@ s! { } // b_struct__Sched_param.h - pub struct _Sched_param { + pub struct sched_param { pub sched_priority: ::c_int, /* scheduling priority */ pub sched_ss_low_priority: ::c_int, /* low scheduling priority */ pub sched_ss_repl_period: ::_Timespec, /* replenishment period */ @@ -274,7 +274,7 @@ s! { pub threadAttrSchedpolicy : ::c_int, pub threadAttrName : *mut ::c_char, pub threadAttrOptions : ::c_int, - pub threadAttrSchedparam : ::_Sched_param, + pub threadAttrSchedparam : ::sched_param, } // signal.h @@ -613,6 +613,19 @@ pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; pub const PTHREAD_STACK_MIN: usize = 4096; pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30; +//sched.h +pub const SCHED_FIFO: ::c_int = 0x01; +pub const SCHED_RR: ::c_int = 0x02; +pub const SCHED_OTHER: ::c_int = 0x04; +pub const SCHED_SPORADIC: ::c_int = 0x08; +pub const PRIO_PROCESS: ::c_uint = 0; +pub const SCHED_FIFO_HIGH_PRI: ::c_int = 255; +pub const SCHED_FIFO_LOW_PRI: ::c_int = 0; +pub const SCHED_RR_HIGH_PRI: ::c_int = 255; +pub const SCHED_RR_LOW_PRI: ::c_int = 0; +pub const SCHED_SPORADIC_HIGH_PRI: ::c_int = 255; +pub const SCHED_SPORADIC_LOW_PRI: ::c_int = 0; + // ERRNO STUFF pub const ERROR: ::c_int = -1; pub const OK: ::c_int = 0; @@ -1388,6 +1401,29 @@ extern "C" { value: *mut ::c_void, ) -> ::c_int; + //pthread.h + pub fn pthread_setschedparam( + native: ::pthread_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + + //pthread.h + pub fn pthread_getschedparam( + native: ::pthread_t, + policy: *mut ::c_int, + param: *mut ::sched_param, + ) -> ::c_int; + + //pthread.h + pub fn pthread_attr_setinheritsched( + attr: *mut ::pthread_attr_t, + inheritsched: ::c_int, + ) -> ::c_int; + + //pthread.h + pub fn pthread_attr_setschedpolicy(attr: *mut ::pthread_attr_t, policy: ::c_int) -> ::c_int; + // pthread.h pub fn pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int; @@ -1400,6 +1436,7 @@ extern "C" { parent: ::Option, child: ::Option, ) -> ::c_int; + // stat.h pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; @@ -1754,6 +1791,31 @@ extern "C" { // dirent.h pub fn closedir(ptr: *mut ::DIR) -> ::c_int; + //sched.h + pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; + + //sched.h + pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; + + //sched.h + pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; + + //sched.h + pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; + + //sched.h + pub fn sched_setscheduler( + pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + + //sched.h + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + + //sched.h + pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; + // sched.h pub fn sched_yield() -> ::c_int; @@ -1878,8 +1940,8 @@ extern "C" { pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int; // vxCpuLib.h - fn vxCpuEnabledGet() -> ::cpuset_t; // Get set of running CPU's in the system - fn vxCpuConfiguredGet() -> ::cpuset_t; // Get set of Configured CPU's in the system + pub fn vxCpuEnabledGet() -> ::cpuset_t; // Get set of running CPU's in the system + pub fn vxCpuConfiguredGet() -> ::cpuset_t; // Get set of Configured CPU's in the system } //Dummy functions, these don't really exist in VxWorks. @@ -1980,6 +2042,12 @@ cfg_if! { } else if #[cfg(target_arch = "powerpc64")] { mod powerpc64; pub use self::powerpc64::*; + } else if #[cfg(target_arch = "riscv32")] { + mod riscv32; + pub use self::riscv32::*; + } else if #[cfg(target_arch = "riscv64")] { + mod riscv64; + pub use self::riscv64::*; } else { // Unknown target_arch } diff --git a/src/vxworks/riscv32.rs b/src/vxworks/riscv32.rs new file mode 100644 index 0000000000000..e617bb83c6ce3 --- /dev/null +++ b/src/vxworks/riscv32.rs @@ -0,0 +1,4 @@ +pub type c_char = i8; +pub type wchar_t = i32; +pub type c_long = i32; +pub type c_ulong = u32; diff --git a/src/vxworks/riscv64.rs b/src/vxworks/riscv64.rs new file mode 100644 index 0000000000000..5e95ea2567ddf --- /dev/null +++ b/src/vxworks/riscv64.rs @@ -0,0 +1,4 @@ +pub type c_char = i8; +pub type wchar_t = i32; +pub type c_long = i64; +pub type c_ulong = u64;