From e790e95d2c05654cb07c10232566b623b96b8013 Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Thu, 22 Aug 2024 13:57:54 +0200 Subject: [PATCH] Fixes tests on Solaris (backport ) (cherry picked from commit ec3c338269a499778796072088a1d5a0d9eb186b) --- libc-test/build.rs | 19 ++- libc-test/semver/TODO-unix.txt | 5 + libc-test/semver/unix.txt | 4 - src/unix/mod.rs | 30 +++-- src/unix/solarish/illumos.rs | 225 ++++++++++++++++++++++++++++++-- src/unix/solarish/mod.rs | 213 ++---------------------------- src/unix/solarish/solaris.rs | 152 +++++++++++++++++++-- src/unix/solarish/x86_64.rs | 23 +++- src/unix/solarish/x86_common.rs | 78 +++++------ 9 files changed, 474 insertions(+), 275 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 750b3869205e9..a04816093c29d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -886,8 +886,6 @@ fn test_solarish(target: &str) { "stdlib.h", "string.h", "sys/auxv.h", - "sys/epoll.h", - "sys/eventfd.h", "sys/file.h", "sys/filio.h", "sys/ioctl.h", @@ -927,6 +925,19 @@ fn test_solarish(target: &str) { "wchar.h", } + if is_illumos { + headers! { cfg: + "sys/epoll.h", + "sys/eventfd.h", + } + } + + if is_solaris { + headers! { cfg: + "sys/lgrp_user_impl.h", + } + } + cfg.skip_type(move |ty| match ty { "sighandler_t" => true, _ => false, @@ -976,7 +987,7 @@ fn test_solarish(target: &str) { // EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be // defined on older systems. It is, however, safe to use on systems which do not // explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.) - "EPOLLEXCLUSIVE" => true, + "EPOLLEXCLUSIVE" if is_illumos => true, _ => false, }); @@ -1068,7 +1079,7 @@ fn test_solarish(target: &str) { // These functions may return int or void depending on the exact // configuration of the compilation environment, but the return // value is not useful (always 0) so we can ignore it: - "setservent" | "endservent" if is_illumos => true, + "setservent" | "endservent" => true, // Following illumos#3729, getifaddrs was changed to a // redefine_extname symbol in order to preserve compatibility. diff --git a/libc-test/semver/TODO-unix.txt b/libc-test/semver/TODO-unix.txt index 3a6d318f23994..e9eba8e83a225 100644 --- a/libc-test/semver/TODO-unix.txt +++ b/libc-test/semver/TODO-unix.txt @@ -3,3 +3,8 @@ getpwuid_r pthread_atfork pthread_sigmask +# * Solaris is missing flock(2) +LOCK_EX +LOCK_NB +LOCK_SH +LOCK_UN diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 1d5c3ce9c648e..3470f1f2de160 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -189,10 +189,6 @@ ISTRIP IXANY IXOFF IXON -LOCK_EX -LOCK_NB -LOCK_SH -LOCK_UN LOG_ALERT LOG_AUTH LOG_CONS diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 318db742bb951..90d6f23b6a9a2 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -622,10 +622,8 @@ extern "C" { target_vendor = "nintendo" )))] #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] - #[cfg_attr( - any(target_os = "illumos", target_os = "solaris"), - link_name = "__xnet_socket" - )] + #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] + #[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")] #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")] pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; #[cfg(not(all( @@ -931,6 +929,7 @@ extern "C" { pub fn getppid() -> pid_t; pub fn getuid() -> uid_t; pub fn isatty(fd: ::c_int) -> ::c_int; + #[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")] pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; @@ -968,7 +967,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "ttyname_r$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__posix_ttyname_r" + )] pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; pub fn unlink(c: *const c_char) -> ::c_int; #[cfg_attr( @@ -1089,8 +1091,6 @@ extern "C" { )] pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; - pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__times13")] pub fn times(buf: *mut ::tms) -> ::clock_t; @@ -1399,6 +1399,7 @@ extern "C" { #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] pub fn sigpending(set: *mut sigset_t) -> ::c_int; + #[cfg_attr(target_os = "solaris", link_name = "__sysconf_xpg7")] pub fn sysconf(name: ::c_int) -> ::c_long; pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; @@ -1452,10 +1453,15 @@ cfg_if! { if #[cfg(not(any(target_os = "emscripten", target_os = "android", target_os = "haiku", - target_os = "nto")))] { + target_os = "nto", + target_os = "solaris")))] { extern "C" { pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int; } + } else if #[cfg(target_os = "solaris")] { + extern "C" { + pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> ::c_int; + } } } @@ -1477,6 +1483,14 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(target_os = "solaris"))] { + extern "C" { + pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; + } + } +} + cfg_if! { if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] { extern "C" { diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 9b0a692055e6a..a3a6c54c97756 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -1,3 +1,14 @@ +use exit_status; +use NET_MAC_AWARE; +use NET_MAC_AWARE_INHERIT; +use PRIV_AWARE_RESET; +use PRIV_DEBUG; +use PRIV_PFEXEC; +use PRIV_XPOLICY; + +pub type lgrp_rsrc_t = ::c_int; +pub type lgrp_affinity_t = ::c_int; + s! { pub struct shmid_ds { pub shm_perm: ::ipc_perm, @@ -21,6 +32,123 @@ s! { } } +s_no_extra_traits! { + #[cfg_attr(any( + target_arch = "x86", target_arch = "x86_64"), + repr(packed(4)) + )] + pub struct epoll_event { + pub events: u32, + pub u64: u64, + } + + pub struct utmpx { + pub ut_user: [::c_char; _UTX_USERSIZE], + pub ut_id: [::c_char; _UTX_IDSIZE], + pub ut_line: [::c_char; _UTX_LINESIZE], + pub ut_pid: ::pid_t, + pub ut_type: ::c_short, + pub ut_exit: exit_status, + pub ut_tv: ::timeval, + pub ut_session: ::c_int, + pub ut_pad: [::c_int; _UTX_PADSIZE], + pub ut_syslen: ::c_short, + pub ut_host: [::c_char; _UTX_HOSTSIZE], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for utmpx { + fn eq(&self, other: &utmpx) -> bool { + self.ut_type == other.ut_type + && self.ut_pid == other.ut_pid + && self.ut_user == other.ut_user + && self.ut_line == other.ut_line + && self.ut_id == other.ut_id + && self.ut_exit == other.ut_exit + && self.ut_session == other.ut_session + && self.ut_tv == other.ut_tv + && self.ut_syslen == other.ut_syslen + && self.ut_pad == other.ut_pad + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for utmpx {} + + impl ::fmt::Debug for utmpx { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmpx") + .field("ut_user", &self.ut_user) + .field("ut_id", &self.ut_id) + .field("ut_line", &self.ut_line) + .field("ut_pid", &self.ut_pid) + .field("ut_type", &self.ut_type) + .field("ut_exit", &self.ut_exit) + .field("ut_tv", &self.ut_tv) + .field("ut_session", &self.ut_session) + .field("ut_pad", &self.ut_pad) + .field("ut_syslen", &self.ut_syslen) + .field("ut_host", &&self.ut_host[..]) + .finish() + } + } + + impl ::hash::Hash for utmpx { + fn hash(&self, state: &mut H) { + self.ut_user.hash(state); + self.ut_type.hash(state); + self.ut_pid.hash(state); + self.ut_line.hash(state); + self.ut_id.hash(state); + self.ut_host.hash(state); + self.ut_exit.hash(state); + self.ut_session.hash(state); + self.ut_tv.hash(state); + self.ut_syslen.hash(state); + self.ut_pad.hash(state); + } + } + + impl PartialEq for epoll_event { + fn eq(&self, other: &epoll_event) -> bool { + self.events == other.events + && self.u64 == other.u64 + } + } + impl Eq for epoll_event {} + impl ::fmt::Debug for epoll_event { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + let events = self.events; + let u64 = self.u64; + f.debug_struct("epoll_event") + .field("events", &events) + .field("u64", &u64) + .finish() + } + } + impl ::hash::Hash for epoll_event { + fn hash(&self, state: &mut H) { + let events = self.events; + let u64 = self.u64; + events.hash(state); + u64.hash(state); + } + } + } +} + +pub const _UTX_USERSIZE: usize = 32; +pub const _UTX_LINESIZE: usize = 32; +pub const _UTX_PADSIZE: usize = 5; +pub const _UTX_IDSIZE: usize = 4; +pub const _UTX_HOSTSIZE: usize = 257; + pub const AF_LOCAL: ::c_int = 1; // AF_UNIX pub const AF_FILE: ::c_int = 1; // AF_UNIX @@ -28,8 +156,6 @@ 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; @@ -58,12 +184,68 @@ 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 SIGINFO: ::c_int = 41; + +pub const O_DIRECT: ::c_int = 0x2000000; + +pub const PBIND_HARD: ::processorid_t = -3; +pub const PBIND_SOFT: ::processorid_t = -4; + +pub const PS_SYSTEM: ::c_int = 1; + +pub const MAP_FILE: ::c_int = 0; + +pub const MAP_32BIT: ::c_int = 0x80; + +pub const AF_NCA: ::c_int = 28; + +pub const PF_NCA: ::c_int = AF_NCA; + +pub const LOCK_SH: ::c_int = 1; +pub const LOCK_EX: ::c_int = 2; +pub const LOCK_NB: ::c_int = 4; +pub const LOCK_UN: ::c_int = 8; + +pub const _PC_LAST: ::c_int = 101; + +pub const VSTATUS: usize = 16; +pub const VERASE2: usize = 17; + +pub const EPOLLIN: ::c_int = 0x1; +pub const EPOLLPRI: ::c_int = 0x2; +pub const EPOLLOUT: ::c_int = 0x4; +pub const EPOLLRDNORM: ::c_int = 0x40; +pub const EPOLLRDBAND: ::c_int = 0x80; +pub const EPOLLWRNORM: ::c_int = 0x100; +pub const EPOLLWRBAND: ::c_int = 0x200; +pub const EPOLLMSG: ::c_int = 0x400; +pub const EPOLLERR: ::c_int = 0x8; +pub const EPOLLHUP: ::c_int = 0x10; +pub const EPOLLET: ::c_int = 0x80000000; +pub const EPOLLRDHUP: ::c_int = 0x2000; +pub const EPOLLONESHOT: ::c_int = 0x40000000; +pub const EPOLLWAKEUP: ::c_int = 0x20000000; +pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; +pub const EPOLL_CTL_ADD: ::c_int = 1; +pub const EPOLL_CTL_MOD: ::c_int = 3; +pub const EPOLL_CTL_DEL: ::c_int = 2; + +pub const PRIV_USER: ::c_uint = PRIV_DEBUG + | NET_MAC_AWARE + | NET_MAC_AWARE_INHERIT + | PRIV_XPOLICY + | PRIV_AWARE_RESET + | PRIV_PFEXEC; + +pub const LGRP_RSRC_COUNT: ::lgrp_rsrc_t = 2; +pub const LGRP_RSRC_CPU: ::lgrp_rsrc_t = 0; +pub const LGRP_RSRC_MEM: ::lgrp_rsrc_t = 1; + +pub const P_DISABLED: ::c_int = 0x008; + +pub const AT_SUN_HWCAP2: ::c_uint = 2023; +pub const AT_SUN_FPTYPE: ::c_uint = 2027; pub const B1000000: ::speed_t = 24; pub const B1152000: ::speed_t = 25; @@ -80,6 +262,24 @@ pub const SI_ADDRESS_WIDTH: ::c_int = 520; extern "C" { pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn epoll_pwait( + epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + sigmask: *const ::sigset_t, + ) -> ::c_int; + pub fn epoll_create(size: ::c_int) -> ::c_int; + pub fn epoll_create1(flags: ::c_int) -> ::c_int; + pub fn epoll_wait( + epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + ) -> ::c_int; + pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event) + -> ::c_int; + pub fn mincore(addr: ::caddr_t, len: ::size_t, vec: *mut ::c_char) -> ::c_int; pub fn pset_bind_lwp( @@ -105,7 +305,6 @@ 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; @@ -114,4 +313,12 @@ extern "C" { pub fn ptsname_r(fildes: ::c_int, name: *mut ::c_char, namelen: ::size_t) -> ::c_int; pub fn syncfs(fd: ::c_int) -> ::c_int; + + pub fn strcasecmp_l(s1: *const ::c_char, s2: *const ::c_char, loc: ::locale_t) -> ::c_int; + pub fn strncasecmp_l( + s1: *const ::c_char, + s2: *const ::c_char, + n: ::size_t, + loc: ::locale_t, + ) -> ::c_int; } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 7aa6d5fda953a..2e3bc3ed0013d 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -45,8 +45,6 @@ pub type id_t = ::c_int; pub type idtype_t = ::c_uint; pub type shmatt_t = ::c_ulong; -pub type lgrp_rsrc_t = ::c_int; -pub type lgrp_affinity_t = ::c_int; pub type lgrp_id_t = ::id_t; pub type lgrp_mem_size_t = ::c_longlong; pub type lgrp_cookie_t = ::uintptr_t; @@ -241,13 +239,21 @@ s! { pub gl_offs: ::size_t, __unused1: *mut ::c_void, __unused2: ::c_int, + #[cfg(target_os = "illumos")] __unused3: ::c_int, + #[cfg(target_os = "illumos")] __unused4: ::c_int, + #[cfg(target_os = "illumos")] __unused5: *mut ::c_void, + #[cfg(target_os = "illumos")] __unused6: *mut ::c_void, + #[cfg(target_os = "illumos")] __unused7: *mut ::c_void, + #[cfg(target_os = "illumos")] __unused8: *mut ::c_void, + #[cfg(target_os = "illumos")] __unused9: *mut ::c_void, + #[cfg(target_os = "illumos")] __unused10: *mut ::c_void, } @@ -464,7 +470,7 @@ s! { pub mr_flags: ::c_uint, } - pub struct lgrp_affinity_args { + pub struct lgrp_affinity_args_t { pub idtype: ::idtype_t, pub id: ::id_t, pub lgrp: ::lgrp_id_t, @@ -487,33 +493,6 @@ s! { } s_no_extra_traits! { - #[cfg_attr(all( - any(target_arch = "x86", target_arch = "x86_64"), - libc_packedN - ), repr(packed(4)))] - #[cfg_attr(all( - any(target_arch = "x86", target_arch = "x86_64"), - not(libc_packedN) - ), repr(packed))] - pub struct epoll_event { - pub events: u32, - pub u64: u64, - } - - pub struct utmpx { - pub ut_user: [::c_char; _UTX_USERSIZE], - pub ut_id: [::c_char; _UTX_IDSIZE], - pub ut_line: [::c_char; _UTX_LINESIZE], - pub ut_pid: ::pid_t, - pub ut_type: ::c_short, - pub ut_exit: exit_status, - pub ut_tv: ::timeval, - pub ut_session: ::c_int, - pub ut_pad: [::c_int; _UTX_PADSIZE], - pub ut_syslen: ::c_short, - pub ut_host: [::c_char; _UTX_HOSTSIZE], - } - pub struct sockaddr_un { pub sun_family: sa_family_t, pub sun_path: [c_char; 108] @@ -588,88 +567,6 @@ s_no_extra_traits! { cfg_if! { if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_user == other.ut_user - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_syslen == other.ut_syslen - && self.ut_pad == other.ut_pad - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_user", &self.ut_user) - .field("ut_id", &self.ut_id) - .field("ut_line", &self.ut_line) - .field("ut_pid", &self.ut_pid) - .field("ut_type", &self.ut_type) - .field("ut_exit", &self.ut_exit) - .field("ut_tv", &self.ut_tv) - .field("ut_session", &self.ut_session) - .field("ut_pad", &self.ut_pad) - .field("ut_syslen", &self.ut_syslen) - .field("ut_host", &&self.ut_host[..]) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_user.hash(state); - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_syslen.hash(state); - self.ut_pad.hash(state); - } - } - - impl PartialEq for epoll_event { - fn eq(&self, other: &epoll_event) -> bool { - self.events == other.events - && self.u64 == other.u64 - } - } - impl Eq for epoll_event {} - impl ::fmt::Debug for epoll_event { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let events = self.events; - let u64 = self.u64; - f.debug_struct("epoll_event") - .field("events", &events) - .field("u64", &u64) - .finish() - } - } - impl ::hash::Hash for epoll_event { - fn hash(&self, state: &mut H) { - let events = self.events; - let u64 = self.u64; - events.hash(state); - u64.hash(state); - } - } - impl PartialEq for sockaddr_un { fn eq(&self, other: &sockaddr_un) -> bool { self.sun_family == other.sun_family @@ -1232,7 +1129,6 @@ pub const FIOGETOWN: ::c_int = 0x4004667b; pub const SIGCHLD: ::c_int = 18; pub const SIGCLD: ::c_int = ::SIGCHLD; pub const SIGBUS: ::c_int = 10; -pub const SIGINFO: ::c_int = 41; pub const SIG_BLOCK: ::c_int = 1; pub const SIG_UNBLOCK: ::c_int = 2; pub const SIG_SETMASK: ::c_int = 3; @@ -1319,7 +1215,6 @@ pub const O_CLOEXEC: ::c_int = 0x800000; pub const O_ACCMODE: ::c_int = 0x600003; pub const O_XATTR: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x1000000; -pub const O_DIRECT: ::c_int = 0x2000000; pub const S_IFIFO: mode_t = 0o1_0000; pub const S_IFCHR: mode_t = 0o2_0000; pub const S_IFBLK: mode_t = 0o6_0000; @@ -1436,8 +1331,6 @@ pub const P_PSETID: idtype_t = 15; pub const PBIND_NONE: ::processorid_t = -1; pub const PBIND_QUERY: ::processorid_t = -2; -pub const PBIND_HARD: ::processorid_t = -3; -pub const PBIND_SOFT: ::processorid_t = -4; pub const PS_NONE: ::c_int = -1; pub const PS_QUERY: ::c_int = -2; @@ -1445,7 +1338,6 @@ pub const PS_MYID: ::c_int = -3; pub const PS_SOFT: ::c_int = -4; pub const PS_HARD: ::c_int = -5; pub const PS_QUERY_TYPE: ::c_int = -6; -pub const PS_SYSTEM: ::c_int = 1; pub const PS_PRIVATE: ::c_int = 2; pub const UTIME_OMIT: c_long = -2; @@ -1456,7 +1348,6 @@ pub const PROT_READ: ::c_int = 1; pub const PROT_WRITE: ::c_int = 2; pub const PROT_EXEC: ::c_int = 4; -pub const MAP_FILE: ::c_int = 0; pub const MAP_SHARED: ::c_int = 0x0001; pub const MAP_PRIVATE: ::c_int = 0x0002; pub const MAP_FIXED: ::c_int = 0x0010; @@ -1467,7 +1358,6 @@ pub const MAP_RENAME: ::c_int = 0x20; pub const MAP_ALIGN: ::c_int = 0x200; pub const MAP_TEXT: ::c_int = 0x400; pub const MAP_INITDATA: ::c_int = 0x800; -pub const MAP_32BIT: ::c_int = 0x80; pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; pub const MCL_CURRENT: ::c_int = 0x0001; @@ -1743,7 +1633,6 @@ pub const AF_ROUTE: ::c_int = 24; pub const AF_LINK: ::c_int = 25; pub const AF_INET6: ::c_int = 26; pub const AF_KEY: ::c_int = 27; -pub const AF_NCA: ::c_int = 28; pub const AF_POLICY: ::c_int = 29; pub const AF_INET_OFFLOAD: ::c_int = 30; pub const AF_TRILL: ::c_int = 31; @@ -1779,7 +1668,6 @@ pub const PF_ROUTE: ::c_int = AF_ROUTE; pub const PF_LINK: ::c_int = AF_LINK; pub const PF_INET6: ::c_int = AF_INET6; pub const PF_KEY: ::c_int = AF_KEY; -pub const PF_NCA: ::c_int = AF_NCA; pub const PF_POLICY: ::c_int = AF_POLICY; pub const PF_INET_OFFLOAD: ::c_int = AF_INET_OFFLOAD; pub const PF_TRILL: ::c_int = AF_TRILL; @@ -1939,11 +1827,6 @@ pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; -pub const LOCK_SH: ::c_int = 1; -pub const LOCK_EX: ::c_int = 2; -pub const LOCK_NB: ::c_int = 4; -pub const LOCK_UN: ::c_int = 8; - pub const F_RDLCK: ::c_short = 1; pub const F_WRLCK: ::c_short = 2; pub const F_UNLCK: ::c_short = 3; @@ -1981,7 +1864,6 @@ pub const _PC_ACCESS_FILTERING: ::c_int = 25; pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 26; pub const _PC_FILESIZEBITS: ::c_int = 67; pub const _PC_XATTR_ENABLED: ::c_int = 100; -pub const _PC_LAST: ::c_int = 101; pub const _PC_XATTR_EXISTS: ::c_int = 101; pub const _SC_ARG_MAX: ::c_int = 1; @@ -2197,11 +2079,7 @@ pub const PORT_SOURCE_MQ: ::c_int = 6; pub const PORT_SOURCE_FILE: ::c_int = 7; pub const NONROOT_USR: ::c_short = 2; -pub const _UTX_USERSIZE: usize = 32; -pub const _UTX_LINESIZE: usize = 32; -pub const _UTX_PADSIZE: usize = 5; -pub const _UTX_IDSIZE: usize = 4; -pub const _UTX_HOSTSIZE: usize = 257; + pub const EMPTY: ::c_short = 0; pub const RUN_LVL: ::c_short = 1; pub const BOOT_TIME: ::c_short = 2; @@ -2299,26 +2177,6 @@ pub const TIOCM_RNG: ::c_int = 0o0200; pub const TIOCM_RI: ::c_int = TIOCM_RNG; pub const TIOCM_DSR: ::c_int = 0o0400; -pub const EPOLLIN: ::c_int = 0x1; -pub const EPOLLPRI: ::c_int = 0x2; -pub const EPOLLOUT: ::c_int = 0x4; -pub const EPOLLRDNORM: ::c_int = 0x40; -pub const EPOLLRDBAND: ::c_int = 0x80; -pub const EPOLLWRNORM: ::c_int = 0x100; -pub const EPOLLWRBAND: ::c_int = 0x200; -pub const EPOLLMSG: ::c_int = 0x400; -pub const EPOLLERR: ::c_int = 0x8; -pub const EPOLLHUP: ::c_int = 0x10; -pub const EPOLLET: ::c_int = 0x80000000; -pub const EPOLLRDHUP: ::c_int = 0x2000; -pub const EPOLLONESHOT: ::c_int = 0x40000000; -pub const EPOLLWAKEUP: ::c_int = 0x20000000; -pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; -pub const EPOLL_CTL_ADD: ::c_int = 1; -pub const EPOLL_CTL_MOD: ::c_int = 3; -pub const EPOLL_CTL_DEL: ::c_int = 2; - /* termios */ pub const B0: speed_t = 0; pub const B50: speed_t = 1; @@ -2420,8 +2278,6 @@ pub const VREPRINT: usize = 12; pub const VDISCARD: usize = 13; pub const VWERASE: usize = 14; pub const VLNEXT: usize = 15; -pub const VSTATUS: usize = 16; -pub const VERASE2: usize = 17; // const STR: ::c_int = (b'S' as ::c_int) << 8; @@ -2537,12 +2393,6 @@ pub const NET_MAC_AWARE_INHERIT: ::c_uint = 0x0020; pub const PRIV_AWARE_RESET: ::c_uint = 0x0040; pub const PRIV_XPOLICY: ::c_uint = 0x0080; pub const PRIV_PFEXEC: ::c_uint = 0x0100; -pub const PRIV_USER: ::c_uint = PRIV_DEBUG - | NET_MAC_AWARE - | NET_MAC_AWARE_INHERIT - | PRIV_XPOLICY - | PRIV_AWARE_RESET - | PRIV_PFEXEC; // sys/systeminfo.h pub const SI_SYSNAME: ::c_int = 1; @@ -2568,9 +2418,6 @@ pub const LGRP_COOKIE_NONE: ::lgrp_cookie_t = 0; pub const LGRP_AFF_NONE: ::lgrp_affinity_t = 0x0; pub const LGRP_AFF_WEAK: ::lgrp_affinity_t = 0x10; pub const LGRP_AFF_STRONG: ::lgrp_affinity_t = 0x100; -pub const LGRP_RSRC_COUNT: ::lgrp_rsrc_t = 2; -pub const LGRP_RSRC_CPU: ::lgrp_rsrc_t = 0; -pub const LGRP_RSRC_MEM: ::lgrp_rsrc_t = 1; pub const LGRP_CONTENT_ALL: ::lgrp_content_t = 0; pub const LGRP_CONTENT_HIERARCHY: ::lgrp_content_t = LGRP_CONTENT_ALL; pub const LGRP_CONTENT_DIRECT: ::lgrp_content_t = 1; @@ -2589,15 +2436,12 @@ pub const P_FAULTED: ::c_int = 0x004; pub const P_POWEROFF: ::c_int = 0x005; pub const P_NOINTR: ::c_int = 0x006; pub const P_SPARE: ::c_int = 0x007; -pub const P_DISABLED: ::c_int = 0x008; pub const P_FORCED: ::c_int = 0x10000000; pub const PI_TYPELEN: ::c_int = 16; pub const PI_FPUTYPE: ::c_int = 32; // sys/auxv.h pub const AT_SUN_HWCAP: ::c_uint = 2009; -pub const AT_SUN_HWCAP2: ::c_uint = 2023; -pub const AT_SUN_FPTYPE: ::c_uint = 2027; // As per sys/socket.h, header alignment must be 8 bytes on SPARC // and 4 bytes everywhere else: @@ -2761,7 +2605,7 @@ extern "C" { pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int; pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int; - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; pub fn ___errno() -> *mut ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; @@ -2978,29 +2822,6 @@ extern "C" { pub fn sem_close(sem: *mut sem_t) -> ::c_int; pub fn getdtablesize() -> ::c_int; - // The epoll functions are actually only present on illumos. However, - // there are things using epoll on illumos (built using the - // x86_64-pc-solaris target) which would break until the illumos target is - // present in rustc. - pub fn epoll_pwait( - epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int, - sigmask: *const ::sigset_t, - ) -> ::c_int; - - pub fn epoll_create(size: ::c_int) -> ::c_int; - pub fn epoll_create1(flags: ::c_int) -> ::c_int; - pub fn epoll_wait( - epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int, - ) -> ::c_int; - pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event) - -> ::c_int; - #[cfg_attr( any(target_os = "solaris", target_os = "illumos"), link_name = "__posix_getgrnam_r" @@ -3016,6 +2837,7 @@ extern "C" { 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; + #[cfg_attr(target_os = "solaris", link_name = "__pthread_kill_xpg7")] pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; @@ -3083,7 +2905,7 @@ extern "C" { pub fn makeutx(ux: *const utmpx) -> *mut utmpx; pub fn modutx(ux: *const utmpx) -> *mut utmpx; - pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int; + pub fn updwtmpx(file: *const ::c_char, ut: *mut utmpx); pub fn utmpxname(file: *const ::c_char) -> ::c_int; pub fn getutxent() -> *mut utmpx; pub fn getutxid(ut: *const utmpx) -> *mut utmpx; @@ -3205,13 +3027,6 @@ extern "C" { validity: *mut ::c_uint, ) -> ::c_int; - pub fn strcasecmp_l(s1: *const ::c_char, s2: *const ::c_char, loc: ::locale_t) -> ::c_int; - pub fn strncasecmp_l( - s1: *const ::c_char, - s2: *const ::c_char, - n: ::size_t, - loc: ::locale_t, - ) -> ::c_int; pub fn strsep(string: *mut *mut ::c_char, delim: *const ::c_char) -> *mut ::c_char; pub fn getisax(array: *mut u32, n: ::c_uint) -> ::c_uint; @@ -3261,7 +3076,7 @@ extern "C" { id: ::id_t, lgrp: ::lgrp_id_t, aff: lgrp_affinity_t, - ) -> ::lgrp_affinity_t; + ) -> ::c_int; pub fn lgrp_cpus( cookie: ::lgrp_cookie_t, lgrp: ::lgrp_id_t, diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index 80bad281ea705..62653489af721 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -1,5 +1,23 @@ +use exit_status; +use NET_MAC_AWARE; +use NET_MAC_AWARE_INHERIT; +use PRIV_AWARE_RESET; +use PRIV_DEBUG; +use PRIV_PFEXEC; +use PRIV_XPOLICY; + pub type door_attr_t = ::c_uint; pub type door_id_t = ::c_ulonglong; +pub type lgrp_affinity_t = ::c_uint; + +e! { + #[repr(u32)] + pub enum lgrp_rsrc_t { + LGRP_RSRC_CPU = 0, + LGRP_RSRC_MEM = 1, + LGRP_RSRC_TYPES = 2, + } +} s! { pub struct shmid_ds { @@ -20,13 +38,20 @@ s! { pub shm_pad4: [i64; 1], } + pub struct xrs_t { + pub xrs_id: ::c_ulong, + pub xrs_ptr: *mut ::c_char, + } +} + +s_no_extra_traits! { + #[repr(packed)] + #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub struct door_desc_t__d_data__d_desc { pub d_descriptor: ::c_int, pub d_id: ::door_id_t } -} -s_no_extra_traits! { #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub union door_desc_t__d_data { pub d_desc: door_desc_t__d_data__d_desc, @@ -48,13 +73,92 @@ s_no_extra_traits! { pub rbuf: *const ::c_char, pub rsize: ::size_t, } + + pub struct utmpx { + pub ut_user: [::c_char; _UTMP_USER_LEN], + pub ut_id: [::c_char; _UTMP_ID_LEN], + pub ut_line: [::c_char; _UTMP_LINE_LEN], + pub ut_pid: ::pid_t, + pub ut_type: ::c_short, + pub ut_exit: exit_status, + pub ut_tv: ::timeval, + pub ut_session: ::c_int, + pub pad: [::c_int; 5], + pub ut_syslen: ::c_short, + pub ut_host: [::c_char; 257], + } + +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for utmpx { + fn eq(&self, other: &utmpx) -> bool { + self.ut_type == other.ut_type + && self.ut_pid == other.ut_pid + && self.ut_user == other.ut_user + && self.ut_line == other.ut_line + && self.ut_id == other.ut_id + && self.ut_exit == other.ut_exit + && self.ut_session == other.ut_session + && self.ut_tv == other.ut_tv + && self.ut_syslen == other.ut_syslen + && self.pad == other.pad + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for utmpx {} + + impl ::fmt::Debug for utmpx { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmpx") + .field("ut_user", &self.ut_user) + .field("ut_id", &self.ut_id) + .field("ut_line", &self.ut_line) + .field("ut_pid", &self.ut_pid) + .field("ut_type", &self.ut_type) + .field("ut_exit", &self.ut_exit) + .field("ut_tv", &self.ut_tv) + .field("ut_session", &self.ut_session) + .field("pad", &self.pad) + .field("ut_syslen", &self.ut_syslen) + .field("ut_host", &&self.ut_host[..]) + .finish() + } + } + + impl ::hash::Hash for utmpx { + fn hash(&self, state: &mut H) { + self.ut_user.hash(state); + self.ut_type.hash(state); + self.ut_pid.hash(state); + self.ut_line.hash(state); + self.ut_id.hash(state); + self.ut_host.hash(state); + self.ut_exit.hash(state); + self.ut_session.hash(state); + self.ut_tv.hash(state); + self.ut_syslen.hash(state); + self.pad.hash(state); + } + } + } } +pub const _UTMP_USER_LEN: usize = 32; +pub const _UTMP_LINE_LEN: usize = 32; +pub const _UTMP_ID_LEN: usize = 4; + pub const PORT_SOURCE_POSTWAIT: ::c_int = 8; pub const PORT_SOURCE_SIGNAL: ::c_int = 9; -pub const AF_LOCAL: ::c_int = 0; -pub const AF_FILE: ::c_int = 0; +pub const AF_LOCAL: ::c_int = 1; // AF_UNIX +pub const AF_FILE: ::c_int = 1; // AF_UNIX pub const TCP_KEEPIDLE: ::c_int = 0x1d; pub const TCP_KEEPINTVL: ::c_int = 0x1e; @@ -65,6 +169,28 @@ pub const F_DUPFD_CLOFORK: ::c_int = 49; pub const F_DUP2FD_CLOEXEC: ::c_int = 48; pub const F_DUP2FD_CLOFORK: ::c_int = 50; +pub const _PC_LAST: ::c_int = 102; + +pub const PRIV_PROC_SENSITIVE: ::c_uint = 0x0008; +pub const PRIV_PFEXEC_AUTH: ::c_uint = 0x0200; +pub const PRIV_PROC_TPD: ::c_uint = 0x0400; +pub const PRIV_TPD_UNSAFE: ::c_uint = 0x0800; +pub const PRIV_PROC_TPD_RESET: ::c_uint = 0x1000; +pub const PRIV_TPD_KILLABLE: ::c_uint = 0x2000; + +pub const PRIV_USER: ::c_uint = PRIV_DEBUG + | PRIV_PROC_SENSITIVE + | NET_MAC_AWARE + | NET_MAC_AWARE_INHERIT + | PRIV_XPOLICY + | PRIV_AWARE_RESET + | PRIV_PFEXEC + | PRIV_PFEXEC_AUTH + | PRIV_PROC_TPD + | PRIV_TPD_UNSAFE + | PRIV_TPD_KILLABLE + | PRIV_PROC_TPD_RESET; + extern "C" { pub fn fexecve( fd: ::c_int, @@ -72,24 +198,24 @@ extern "C" { envp: *const *const ::c_char, ) -> ::c_int; - pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; + pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; - pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int; + pub fn door_call(d: ::c_int, params: *mut door_arg_t) -> ::c_int; pub fn door_return( - data_ptr: *const ::c_char, + data_ptr: *mut ::c_char, data_size: ::size_t, - desc_ptr: *const door_desc_t, + desc_ptr: *mut door_desc_t, num_desc: ::c_uint, - ); + ) -> ::c_int; pub fn door_create( server_procedure: extern "C" fn( - cookie: *const ::c_void, - argp: *const ::c_char, + cookie: *mut ::c_void, + argp: *mut ::c_char, arg_size: ::size_t, - dp: *const door_desc_t, + dp: *mut door_desc_t, n_desc: ::c_uint, ), - cookie: *const ::c_void, + cookie: *mut ::c_void, attributes: door_attr_t, ) -> ::c_int; diff --git a/src/unix/solarish/x86_64.rs b/src/unix/solarish/x86_64.rs index bca552f378202..c7cb52c47749e 100644 --- a/src/unix/solarish/x86_64.rs +++ b/src/unix/solarish/x86_64.rs @@ -1,3 +1,9 @@ +cfg_if! { + if #[cfg(target_os = "solaris")] { + use unix::solarish::solaris; + } +} + pub type greg_t = ::c_long; pub type Elf64_Addr = ::c_ulong; @@ -46,6 +52,10 @@ s! { pub dlpi_phnum: ::Elf64_Half, pub dlpi_adds: ::c_ulonglong, pub dlpi_subs: ::c_ulonglong, + #[cfg(target_os = "solaris")] + pub dlpi_tls_modid: ::c_ulong, + #[cfg(target_os = "solaris")] + pub dlpi_tls_data: *mut ::c_void, } } @@ -71,7 +81,18 @@ s_no_extra_traits! { pub uc_sigmask: ::sigset_t, pub uc_stack: ::stack_t, pub uc_mcontext: mcontext_t, - pub uc_filler: [::c_long; 5], + #[cfg(target_os = "illumos")] + pub uc_brand_data: [*mut ::c_void; 3], + #[cfg(target_os = "illumos")] + pub uc_xsave: ::c_long, + #[cfg(target_os = "illumos")] + pub uc_filler: ::c_long, + #[cfg(target_os = "solaris")] + pub uc_xrs: solaris::xrs_t, + #[cfg(target_os = "solaris")] + pub uc_lwpid: ::c_uint, + #[cfg(target_os = "solaris")] + pub uc_filler: [::c_long; 2], } } diff --git a/src/unix/solarish/x86_common.rs b/src/unix/solarish/x86_common.rs index 515f23490db55..e72a22a83b417 100644 --- a/src/unix/solarish/x86_common.rs +++ b/src/unix/solarish/x86_common.rs @@ -26,40 +26,44 @@ pub const AV_386_AES: u32 = 0x4000000; pub const AV_386_PCLMULQDQ: u32 = 0x8000000; pub const AV_386_XSAVE: u32 = 0x10000000; pub const AV_386_AVX: u32 = 0x20000000; -pub const AV_386_VMX: u32 = 0x40000000; -pub const AV_386_AMD_SVM: u32 = 0x80000000; -// AT_SUN_HWCAP2 -pub const AV_386_2_F16C: u32 = 0x00000001; -pub const AV_386_2_RDRAND: u32 = 0x00000002; -pub const AV_386_2_BMI1: u32 = 0x00000004; -pub const AV_386_2_BMI2: u32 = 0x00000008; -pub const AV_386_2_FMA: u32 = 0x00000010; -pub const AV_386_2_AVX2: u32 = 0x00000020; -pub const AV_386_2_ADX: u32 = 0x00000040; -pub const AV_386_2_RDSEED: u32 = 0x00000080; -pub const AV_386_2_AVX512F: u32 = 0x00000100; -pub const AV_386_2_AVX512DQ: u32 = 0x00000200; -pub const AV_386_2_AVX512IFMA: u32 = 0x00000400; -pub const AV_386_2_AVX512PF: u32 = 0x00000800; -pub const AV_386_2_AVX512ER: u32 = 0x00001000; -pub const AV_386_2_AVX512CD: u32 = 0x00002000; -pub const AV_386_2_AVX512BW: u32 = 0x00004000; -pub const AV_386_2_AVX512VL: u32 = 0x00008000; -pub const AV_386_2_AVX512VBMI: u32 = 0x00010000; -pub const AV_386_2_AVX512VPOPCDQ: u32 = 0x00020000; -pub const AV_386_2_AVX512_4NNIW: u32 = 0x00040000; -pub const AV_386_2_AVX512_4FMAPS: u32 = 0x00080000; -pub const AV_386_2_SHA: u32 = 0x00100000; -pub const AV_386_2_FSGSBASE: u32 = 0x00200000; -pub const AV_386_2_CLFLUSHOPT: u32 = 0x00400000; -pub const AV_386_2_CLWB: u32 = 0x00800000; -pub const AV_386_2_MONITORX: u32 = 0x01000000; -pub const AV_386_2_CLZERO: u32 = 0x02000000; -pub const AV_386_2_AVX512_VNNI: u32 = 0x04000000; -pub const AV_386_2_VPCLMULQDQ: u32 = 0x08000000; -pub const AV_386_2_VAES: u32 = 0x10000000; -// AT_SUN_FPTYPE -pub const AT_386_FPINFO_NONE: u32 = 0; -pub const AT_386_FPINFO_FXSAVE: u32 = 1; -pub const AT_386_FPINFO_XSAVE: u32 = 2; -pub const AT_386_FPINFO_XSAVE_AMD: u32 = 3; +cfg_if! { + if #[cfg(target_os = "illumos")] { + pub const AV_386_VMX: u32 = 0x40000000; + pub const AV_386_AMD_SVM: u32 = 0x80000000; + // AT_SUN_HWCAP2 + pub const AV_386_2_F16C: u32 = 0x00000001; + pub const AV_386_2_RDRAND: u32 = 0x00000002; + pub const AV_386_2_BMI1: u32 = 0x00000004; + pub const AV_386_2_BMI2: u32 = 0x00000008; + pub const AV_386_2_FMA: u32 = 0x00000010; + pub const AV_386_2_AVX2: u32 = 0x00000020; + pub const AV_386_2_ADX: u32 = 0x00000040; + pub const AV_386_2_RDSEED: u32 = 0x00000080; + pub const AV_386_2_AVX512F: u32 = 0x00000100; + pub const AV_386_2_AVX512DQ: u32 = 0x00000200; + pub const AV_386_2_AVX512IFMA: u32 = 0x00000400; + pub const AV_386_2_AVX512PF: u32 = 0x00000800; + pub const AV_386_2_AVX512ER: u32 = 0x00001000; + pub const AV_386_2_AVX512CD: u32 = 0x00002000; + pub const AV_386_2_AVX512BW: u32 = 0x00004000; + pub const AV_386_2_AVX512VL: u32 = 0x00008000; + pub const AV_386_2_AVX512VBMI: u32 = 0x00010000; + pub const AV_386_2_AVX512VPOPCDQ: u32 = 0x00020000; + pub const AV_386_2_AVX512_4NNIW: u32 = 0x00040000; + pub const AV_386_2_AVX512_4FMAPS: u32 = 0x00080000; + pub const AV_386_2_SHA: u32 = 0x00100000; + pub const AV_386_2_FSGSBASE: u32 = 0x00200000; + pub const AV_386_2_CLFLUSHOPT: u32 = 0x00400000; + pub const AV_386_2_CLWB: u32 = 0x00800000; + pub const AV_386_2_MONITORX: u32 = 0x01000000; + pub const AV_386_2_CLZERO: u32 = 0x02000000; + pub const AV_386_2_AVX512_VNNI: u32 = 0x04000000; + pub const AV_386_2_VPCLMULQDQ: u32 = 0x08000000; + pub const AV_386_2_VAES: u32 = 0x10000000; + // AT_SUN_FPTYPE + pub const AT_386_FPINFO_NONE: u32 = 0; + pub const AT_386_FPINFO_FXSAVE: u32 = 1; + pub const AT_386_FPINFO_XSAVE: u32 = 2; + pub const AT_386_FPINFO_XSAVE_AMD: u32 = 3; + } +}