summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml14
-rw-r--r--build.rs2
-rw-r--r--ci/build.sh1
-rw-r--r--libc-test/build.rs47
-rw-r--r--libc-test/semver/netbsd.txt2
-rw-r--r--libc-test/semver/openbsd.txt8
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs2
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs181
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs184
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs189
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs34
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs511
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs5
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs347
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs1
-rw-r--r--src/unix/bsd/netbsdlike/mod.rs1
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs7
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs15
-rw-r--r--src/unix/linux_like/linux/arch/generic/mod.rs16
-rw-r--r--src/unix/linux_like/linux/arch/mips/mod.rs16
-rw-r--r--src/unix/linux_like/linux/arch/powerpc/mod.rs8
-rw-r--r--src/unix/linux_like/linux/arch/sparc/mod.rs16
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs10
-rw-r--r--src/unix/linux_like/linux/musl/b64/mod.rs3
-rw-r--r--src/unix/linux_like/linux/musl/b64/riscv64/mod.rs736
-rw-r--r--src/unix/linux_like/linux/musl/mod.rs13
-rw-r--r--src/unix/linux_like/linux/uclibc/mod.rs10
27 files changed, 2232 insertions, 147 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 655f42bb48..5d70e818c6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -40,3 +40,17 @@ task:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
- sh ci/run.sh x86_64-unknown-freebsd
+
+task:
+ name: nightly x86_64-unknown-freebsd-14
+ freebsd_instance:
+ image: freebsd-14-0-current-amd64-v20211111
+ setup_script:
+ - pkg install -y curl
+ - curl https://sh.rustup.rs -sSf --output rustup.sh
+ - sh rustup.sh -y --default-toolchain nightly --profile=minimal
+ - . $HOME/.cargo/env
+ test_script:
+ - . $HOME/.cargo/env
+ - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
+ - sh ci/run.sh x86_64-unknown-freebsd
diff --git a/build.rs b/build.rs
index 2ca7c97e18..61acba646d 100644
--- a/build.rs
+++ b/build.rs
@@ -31,6 +31,7 @@ fn main() {
Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
+ Some(14) if libc_ci => println!("cargo:rustc-cfg=freebsd14"),
Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
}
@@ -150,6 +151,7 @@ fn which_freebsd() -> Option<i32> {
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
+ s if s.starts_with("14") => Some(14),
_ => None,
}
}
diff --git a/ci/build.sh b/ci/build.sh
index 21c08fbeb3..7914a71c21 100644
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -251,6 +251,7 @@ riscv32i-unknown-none-elf \
riscv32imac-unknown-none-elf \
riscv32imc-unknown-none-elf \
riscv32gc-unknown-linux-gnu \
+riscv64gc-unknown-linux-musl \
riscv64gc-unknown-none-elf \
riscv64imac-unknown-none-elf \
s390x-unknown-linux-musl \
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 34a7261104..e0ccb90f5b 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -300,6 +300,9 @@ fn test_apple(target: &str) {
"KERN_KDENABLE_BG_TRACE" | "KERN_KDDISABLE_BG_TRACE" => true,
// FIXME: the value has been changed since Catalina (0xffff0000 -> 0x3fff0000).
"SF_SETTABLE" => true,
+
+ // FIXME: XCode 13.1 doesn't have it.
+ "TIOCREMOTE" => true,
_ => false,
}
});
@@ -427,6 +430,7 @@ fn test_openbsd(target: &str) {
"string.h",
"sys/file.h",
"sys/ioctl.h",
+ "sys/ipc.h",
"sys/mman.h",
"sys/param.h",
"sys/resource.h",
@@ -990,6 +994,7 @@ fn test_netbsd(target: &str) {
"sys/file.h",
"sys/ioctl.h",
"sys/ioctl_compat.h",
+ "sys/ipc.h",
"sys/ktrace.h",
"sys/mman.h",
"sys/mount.h",
@@ -1756,6 +1761,7 @@ fn test_freebsd(target: &str) {
Some(11) => cfg.cfg("freebsd11", None),
Some(12) => cfg.cfg("freebsd12", None),
Some(13) => cfg.cfg("freebsd13", None),
+ Some(14) => cfg.cfg("freebsd14", None),
_ => &mut cfg,
};
@@ -1857,6 +1863,7 @@ fn test_freebsd(target: &str) {
"sys/times.h",
"sys/timex.h",
"sys/types.h",
+ "sys/proc.h",
"kvm.h", // must be after "sys/types.h"
"sys/ucontext.h",
"sys/uio.h",
@@ -2056,6 +2063,36 @@ fn test_freebsd(target: &str) {
"VM_TOTAL" if Some(11) == freebsd_ver => true,
+ // Added in FreeBSD 14.
+ "KERN_STACKTOP" if Some(14) > freebsd_ver => true,
+ // Added in FreeBSD 13.
+ "KERN_PROC_SIGFASTBLK"
+ | "USER_LOCALBASE"
+ | "TDP_SIGFASTBLOCK"
+ | "TDP_UIOHELD"
+ | "TDP_SIGFASTPENDING"
+ | "TDP2_COMPAT32RB"
+ | "P2_PROTMAX_ENABLE"
+ | "P2_PROTMAX_DISABLE"
+ | "CTLFLAG_NEEDGIANT"
+ | "CTL_SYSCTL_NEXTNOSKIP"
+ if Some(13) > freebsd_ver =>
+ {
+ true
+ }
+ // Added in FreeBSD 12.
+ "KERN_MAXPHYS"
+ | "KVME_FLAG_USER_WIRED"
+ | "TDP2_SBPAGES"
+ | "P2_ASLR_ENABLE"
+ | "P2_ASLR_DISABLE"
+ | "P2_ASLR_IGNSTART"
+ | "P_TREE_GRPEXITED"
+ if Some(12) > freebsd_ver =>
+ {
+ true
+ }
+
_ => false,
}
});
@@ -2735,6 +2772,9 @@ fn test_linux(target: &str) {
| "Elf64_Shdr" | "Elf32_Sym" | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr"
| "Elf32_Chdr" | "Elf64_Chdr" => ty.to_string(),
+ "Ioctl" if gnu => "unsigned long".to_string(),
+ "Ioctl" => "int".to_string(),
+
t if is_union => format!("union {}", t),
t if t.ends_with("_t") => t.to_string(),
@@ -2792,6 +2832,9 @@ fn test_linux(target: &str) {
// on Linux, this is a volatile int
"pthread_spinlock_t" => true,
+ // For internal use only, to define architecture specific ioctl constants with a libc specific type.
+ "Ioctl" => true,
+
_ => false,
}
});
@@ -3222,6 +3265,7 @@ fn test_linux(target: &str) {
// This function tests APIs that are incompatible to test when other APIs
// are included (e.g. because including both sets of headers clashes)
fn test_linux_like_apis(target: &str) {
+ let gnu = target.contains("gnu");
let musl = target.contains("musl");
let linux = target.contains("linux");
let emscripten = target.contains("emscripten");
@@ -3288,6 +3332,8 @@ fn test_linux_like_apis(target: &str) {
})
.skip_struct(|s| s != "termios2")
.type_name(move |ty, is_struct, is_union| match ty {
+ "Ioctl" if gnu => "unsigned long".to_string(),
+ "Ioctl" => "int".to_string(),
t if is_struct => format!("struct {}", t),
t if is_union => format!("union {}", t),
t => t.to_string(),
@@ -3376,6 +3422,7 @@ fn which_freebsd() -> Option<i32> {
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
+ s if s.starts_with("14") => Some(14),
_ => None,
}
}
diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt
index cd06ccf813..d89f1f79ba 100644
--- a/libc-test/semver/netbsd.txt
+++ b/libc-test/semver/netbsd.txt
@@ -1183,6 +1183,7 @@ forkpty
freeifaddrs
freelocale
fsid_t
+ftok
futimes
getbootfile
getbyteorder
@@ -1445,6 +1446,7 @@ sync
syscall
sysctl
sysctlbyname
+sysctldesc
telldir
timer_create
timer_delete
diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt
index c2053ccc96..5287d18ffb 100644
--- a/libc-test/semver/openbsd.txt
+++ b/libc-test/semver/openbsd.txt
@@ -615,10 +615,15 @@ PT_ATTACH
PT_CONTINUE
PT_DETACH
PT_FIRSTMACH
+PT_GET_EVENT_MASK
+PT_GET_PROCESS_STATE
+PT_GET_THREAD_FIRST
+PT_GET_THREAD_NEXT
PT_IO
PT_KILL
PT_READ_D
PT_READ_I
+PT_SET_EVENT_MASK
PT_TRACE_ME
PT_WRITE_D
PT_WRITE_I
@@ -952,6 +957,7 @@ freelocale
freezero
fsid_t
fstatfs
+ftok
fusefs_args
futimes
getdomainname
@@ -1059,6 +1065,8 @@ pthread_spinlock_t
pthread_stackseg_np
ptrace
ptrace_io_desc
+ptrace_state
+ptrace_thread_state
pwritev
qsort
rand
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index e9dfc8a68f..21b99f8a22 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1299,6 +1299,8 @@ pub const SF_XLINK: ::c_ulong = 0x01000000;
pub const UTIME_OMIT: c_long = -2;
pub const UTIME_NOW: c_long = -1;
+pub const MINCORE_SUPER: ::c_int = 0x20;
+
const_fn! {
{const} fn _CMSG_ALIGN(n: usize) -> usize {
(n + 3) & !3
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
index 863de940f4..75819352e8 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
@@ -29,6 +29,186 @@ s! {
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
}
+
+ pub struct kinfo_proc {
+ /// Size of this structure.
+ pub ki_structsize: ::c_int,
+ /// Reserved: layout identifier.
+ pub ki_layout: ::c_int,
+ /// Address of command arguments.
+ pub ki_args: *mut ::pargs,
+ // This is normally "struct proc".
+ /// Address of proc.
+ pub ki_paddr: *mut ::c_void,
+ // This is normally "struct user".
+ /// Kernel virtual address of u-area.
+ pub ki_addr: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to trace file.
+ pub ki_tracep: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to executable file.
+ pub ki_textvp: *mut ::c_void,
+ // This is normally "struct filedesc".
+ /// Pointer to open file info.
+ pub ki_fd: *mut ::c_void,
+ // This is normally "struct vmspace".
+ /// Pointer to kernel vmspace struct.
+ pub ki_vmspace: *mut ::c_void,
+ /// Sleep address.
+ pub ki_wchan: *mut ::c_void,
+ /// Process identifier.
+ pub ki_pid: ::pid_t,
+ /// Parent process ID.
+ pub ki_ppid: ::pid_t,
+ /// Process group ID.
+ pub ki_pgid: ::pid_t,
+ /// tty process group ID.
+ pub ki_tpgid: ::pid_t,
+ /// Process session ID.
+ pub ki_sid: ::pid_t,
+ /// Terminal session ID.
+ pub ki_tsid: ::pid_t,
+ /// Job control counter.
+ pub ki_jobc: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short1: ::c_short,
+ /// Controlling tty dev.
+ pub ki_tdev: ::dev_t,
+ /// Signals arrived but not delivered.
+ pub ki_siglist: ::sigset_t,
+ /// Current signal mask.
+ pub ki_sigmask: ::sigset_t,
+ /// Signals being ignored.
+ pub ki_sigignore: ::sigset_t,
+ /// Signals being caught by user.
+ pub ki_sigcatch: ::sigset_t,
+ /// Effective user ID.
+ pub ki_uid: ::uid_t,
+ /// Real user ID.
+ pub ki_ruid: ::uid_t,
+ /// Saved effective user ID.
+ pub ki_svuid: ::uid_t,
+ /// Real group ID.
+ pub ki_rgid: ::gid_t,
+ /// Saved effective group ID.
+ pub ki_svgid: ::gid_t,
+ /// Number of groups.
+ pub ki_ngroups: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short2: ::c_short,
+ /// Groups.
+ pub ki_groups: [::gid_t; ::KI_NGROUPS],
+ /// Virtual size.
+ pub ki_size: ::vm_size_t,
+ /// Current resident set size in pages.
+ pub ki_rssize: ::segsz_t,
+ /// Resident set size before last swap.
+ pub ki_swrss: ::segsz_t,
+ /// Text size (pages) XXX.
+ pub ki_tsize: ::segsz_t,
+ /// Data size (pages) XXX.
+ pub ki_dsize: ::segsz_t,
+ /// Stack size (pages).
+ pub ki_ssize: ::segsz_t,
+ /// Exit status for wait & stop signal.
+ pub ki_xstat: ::u_short,
+ /// Accounting flags.
+ pub ki_acflag: ::u_short,
+ /// %cpu for process during `ki_swtime`.
+ pub ki_pctcpu: ::fixpt_t,
+ /// Time averaged value of `ki_cpticks`.
+ pub ki_estcpu: ::u_int,
+ /// Time since last blocked.
+ pub ki_slptime: ::u_int,
+ /// Time swapped in or out.
+ pub ki_swtime: ::u_int,
+ /// Number of copy-on-write faults.
+ pub ki_cow: ::u_int,
+ /// Real time in microsec.
+ pub ki_runtime: u64,
+ /// Starting time.
+ pub ki_start: ::timeval,
+ /// Time used by process children.
+ pub ki_childtime: ::timeval,
+ /// P_* flags.
+ pub ki_flag: ::c_long,
+ /// KI_* flags (below).
+ pub ki_kiflag: ::c_long,
+ /// Kernel trace points.
+ pub ki_traceflag: ::c_int,
+ /// S* process status.
+ pub ki_stat: ::c_char,
+ /// Process "nice" value.
+ pub ki_nice: i8, // signed char
+ /// Process lock (prevent swap) count.
+ pub ki_lock: ::c_char,
+ /// Run queue index.
+ pub ki_rqindex: ::c_char,
+ /// Which cpu we are on.
+ pub ki_oncpu_old: ::c_uchar,
+ /// Last cpu we were on.
+ pub ki_lastcpu_old: ::c_uchar,
+ /// Thread name.
+ pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
+ /// Wchan message.
+ pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
+ /// Setlogin name.
+ pub ki_login: [::c_char; ::LOGNAMELEN + 1],
+ /// Lock name.
+ pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
+ /// Command name.
+ pub ki_comm: [::c_char; ::COMMLEN + 1],
+ /// Emulation name.
+ pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
+ /// Login class.
+ pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
+ /// More thread name.
+ pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
+ /// Spare string space.
+ pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
+ /// Spare room for growth.
+ pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
+ /// Which cpu we are on.
+ pub ki_oncpu: ::c_int,
+ /// Last cpu we were on.
+ pub ki_lastcpu: ::c_int,
+ /// PID of tracing process.
+ pub ki_tracer: ::c_int,
+ /// P2_* flags.
+ pub ki_flag2: ::c_int,
+ /// Default FIB number.
+ pub ki_fibnum: ::c_int,
+ /// Credential flags.
+ pub ki_cr_flags: ::u_int,
+ /// Process jail ID.
+ pub ki_jid: ::c_int,
+ /// Number of threads in total.
+ pub ki_numthreads: ::c_int,
+ // Thread ID.
+ pub ki_tid: ::lwpid_t,
+ /// Process priority.
+ pub ki_pri: ::priority,
+ /// Process rusage statistics.
+ pub ki_rusage: ::rusage,
+ /// rusage of children processes.
+ pub ki_rusage_ch: ::rusage,
+ // This is normally "struct pcb".
+ /// Kernel virtual addr of pcb.
+ pub ki_pcb: *mut ::c_void,
+ /// Kernel virtual addr of stack.
+ pub ki_kstack: *mut ::c_void,
+ /// User convenience pointer.
+ pub ki_udata: *mut ::c_void,
+ // This is normally "struct thread".
+ pub ki_tdaddr: *mut ::c_void,
+ pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
+ pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
+ /// PS_* flags.
+ pub ki_sflag: ::c_long,
+ /// kthread flag.
+ pub ki_tdflags: ::c_long,
+ }
}
s_no_extra_traits! {
@@ -192,6 +372,7 @@ cfg_if! {
pub const ELAST: ::c_int = 96;
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
pub const KI_NSPARE_PTR: usize = 6;
+pub const MINCORE_SUPER: ::c_int = 0x20;
extern "C" {
// Return type ::c_int was removed in FreeBSD 12
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
index e7b44b3eb0..59d70977a9 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
@@ -36,6 +36,188 @@ s! {
pub offset: ::u_long,
pub len: ::size_t,
}
+
+ pub struct kinfo_proc {
+ /// Size of this structure.
+ pub ki_structsize: ::c_int,
+ /// Reserved: layout identifier.
+ pub ki_layout: ::c_int,
+ /// Address of command arguments.
+ pub ki_args: *mut ::pargs,
+ // This is normally "struct proc".
+ /// Address of proc.
+ pub ki_paddr: *mut ::c_void,
+ // This is normally "struct user".
+ /// Kernel virtual address of u-area.
+ pub ki_addr: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to trace file.
+ pub ki_tracep: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to executable file.
+ pub ki_textvp: *mut ::c_void,
+ // This is normally "struct filedesc".
+ /// Pointer to open file info.
+ pub ki_fd: *mut ::c_void,
+ // This is normally "struct vmspace".
+ /// Pointer to kernel vmspace struct.
+ pub ki_vmspace: *mut ::c_void,
+ /// Sleep address.
+ pub ki_wchan: *mut ::c_void,
+ /// Process identifier.
+ pub ki_pid: ::pid_t,
+ /// Parent process ID.
+ pub ki_ppid: ::pid_t,
+ /// Process group ID.
+ pub ki_pgid: ::pid_t,
+ /// tty process group ID.
+ pub ki_tpgid: ::pid_t,
+ /// Process session ID.
+ pub ki_sid: ::pid_t,
+ /// Terminal session ID.
+ pub ki_tsid: ::pid_t,
+ /// Job control counter.
+ pub ki_jobc: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short1: ::c_short,
+ /// Controlling tty dev.
+ pub ki_tdev_freebsd11: u32,
+ /// Signals arrived but not delivered.
+ pub ki_siglist: ::sigset_t,
+ /// Current signal mask.
+ pub ki_sigmask: ::sigset_t,
+ /// Signals being ignored.
+ pub ki_sigignore: ::sigset_t,
+ /// Signals being caught by user.
+ pub ki_sigcatch: ::sigset_t,
+ /// Effective user ID.
+ pub ki_uid: ::uid_t,
+ /// Real user ID.
+ pub ki_ruid: ::uid_t,
+ /// Saved effective user ID.
+ pub ki_svuid: ::uid_t,
+ /// Real group ID.
+ pub ki_rgid: ::gid_t,
+ /// Saved effective group ID.
+ pub ki_svgid: ::gid_t,
+ /// Number of groups.
+ pub ki_ngroups: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short2: ::c_short,
+ /// Groups.
+ pub ki_groups: [::gid_t; ::KI_NGROUPS],
+ /// Virtual size.
+ pub ki_size: ::vm_size_t,
+ /// Current resident set size in pages.
+ pub ki_rssize: ::segsz_t,
+ /// Resident set size before last swap.
+ pub ki_swrss: ::segsz_t,
+ /// Text size (pages) XXX.
+ pub ki_tsize: ::segsz_t,
+ /// Data size (pages) XXX.
+ pub ki_dsize: ::segsz_t,
+ /// Stack size (pages).
+ pub ki_ssize: ::segsz_t,
+ /// Exit status for wait & stop signal.
+ pub ki_xstat: ::u_short,
+ /// Accounting flags.
+ pub ki_acflag: ::u_short,
+ /// %cpu for process during `ki_swtime`.
+ pub ki_pctcpu: ::fixpt_t,
+ /// Time averaged value of `ki_cpticks`.
+ pub ki_estcpu: ::u_int,
+ /// Time since last blocked.
+ pub ki_slptime: ::u_int,
+ /// Time swapped in or out.
+ pub ki_swtime: ::u_int,
+ /// Number of copy-on-write faults.
+ pub ki_cow: ::u_int,
+ /// Real time in microsec.
+ pub ki_runtime: u64,
+ /// Starting time.
+ pub ki_start: ::timeval,
+ /// Time used by process children.
+ pub ki_childtime: ::timeval,
+ /// P_* flags.
+ pub ki_flag: ::c_long,
+ /// KI_* flags (below).
+ pub ki_kiflag: ::c_long,
+ /// Kernel trace points.
+ pub ki_traceflag: ::c_int,
+ /// S* process status.
+ pub ki_stat: ::c_char,
+ /// Process "nice" value.
+ pub ki_nice: i8, // signed char
+ /// Process lock (prevent swap) count.
+ pub ki_lock: ::c_char,
+ /// Run queue index.
+ pub ki_rqindex: ::c_char,
+ /// Which cpu we are on.
+ pub ki_oncpu_old: ::c_uchar,
+ /// Last cpu we were on.
+ pub ki_lastcpu_old: ::c_uchar,
+ /// Thread name.
+ pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
+ /// Wchan message.
+ pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
+ /// Setlogin name.
+ pub ki_login: [::c_char; ::LOGNAMELEN + 1],
+ /// Lock name.
+ pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
+ /// Command name.
+ pub ki_comm: [::c_char; ::COMMLEN + 1],
+ /// Emulation name.
+ pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
+ /// Login class.
+ pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
+ /// More thread name.
+ pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
+ /// Spare string space.
+ pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
+ /// Spare room for growth.
+ pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
+ /// Controlling tty dev.
+ pub ki_tdev: ::dev_t,
+ /// Which cpu we are on.
+ pub ki_oncpu: ::c_int,
+ /// Last cpu we were on.
+ pub ki_lastcpu: ::c_int,
+ /// PID of tracing process.
+ pub ki_tracer: ::c_int,
+ /// P2_* flags.
+ pub ki_flag2: ::c_int,
+ /// Default FIB number.
+ pub ki_fibnum: ::c_int,
+ /// Credential flags.
+ pub ki_cr_flags: ::u_int,
+ /// Process jail ID.
+ pub ki_jid: ::c_int,
+ /// Number of threads in total.
+ pub ki_numthreads: ::c_int,
+ // Thread ID.
+ pub ki_tid: ::lwpid_t,
+ /// Process priority.
+ pub ki_pri: ::priority,
+ /// Process rusage statistics.
+ pub ki_rusage: ::rusage,
+ /// rusage of children processes.
+ pub ki_rusage_ch: ::rusage,
+ // This is normally "struct pcb".
+ /// Kernel virtual addr of pcb.
+ pub ki_pcb: *mut ::c_void,
+ /// Kernel virtual addr of stack.
+ pub ki_kstack: *mut ::c_void,
+ /// User convenience pointer.
+ pub ki_udata: *mut ::c_void,
+ // This is normally "struct thread".
+ pub ki_tdaddr: *mut ::c_void,
+ pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
+ pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
+ /// PS_* flags.
+ pub ki_sflag: ::c_long,
+ /// kthread flag.
+ pub ki_tdflags: ::c_long,
+ }
}
s_no_extra_traits! {
@@ -207,6 +389,8 @@ pub const ELAST: ::c_int = 97;
pub const SPECNAMELEN: ::c_int = 63;
pub const KI_NSPARE_PTR: usize = 6;
+pub const MINCORE_SUPER: ::c_int = 0x20;
+
extern "C" {
pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
index e8c4a4af2c..1c224bba6d 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
@@ -1,4 +1,4 @@
-// APIs in FreeBSD 13 that have changed since 11.
+// APIs in FreeBSD 14 that have changed since 11.
pub type nlink_t = u64;
pub type dev_t = u64;
@@ -54,6 +54,191 @@ s! {
pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
}
+
+ pub struct kinfo_proc {
+ /// Size of this structure.
+ pub ki_structsize: ::c_int,
+ /// Reserved: layout identifier.
+ pub ki_layout: ::c_int,
+ /// Address of command arguments.
+ pub ki_args: *mut ::pargs,
+ // This is normally "struct proc".
+ /// Address of proc.
+ pub ki_paddr: *mut ::c_void,
+ // This is normally "struct user".
+ /// Kernel virtual address of u-area.
+ pub ki_addr: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to trace file.
+ pub ki_tracep: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to executable file.
+ pub ki_textvp: *mut ::c_void,
+ // This is normally "struct filedesc".
+ /// Pointer to open file info.
+ pub ki_fd: *mut ::c_void,
+ // This is normally "struct vmspace".
+ /// Pointer to kernel vmspace struct.
+ pub ki_vmspace: *mut ::c_void,
+ /// Sleep address.
+ pub ki_wchan: *const ::c_void,
+ /// Process identifier.
+ pub ki_pid: ::pid_t,
+ /// Parent process ID.
+ pub ki_ppid: ::pid_t,
+ /// Process group ID.
+ pub ki_pgid: ::pid_t,
+ /// tty process group ID.
+ pub ki_tpgid: ::pid_t,
+ /// Process session ID.
+ pub ki_sid: ::pid_t,
+ /// Terminal session ID.
+ pub ki_tsid: ::pid_t,
+ /// Job control counter.
+ pub ki_jobc: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short1: ::c_short,
+ /// Controlling tty dev.
+ pub ki_tdev_freebsd11: u32,
+ /// Signals arrived but not delivered.
+ pub ki_siglist: ::sigset_t,
+ /// Current signal mask.
+ pub ki_sigmask: ::sigset_t,
+ /// Signals being ignored.
+ pub ki_sigignore: ::sigset_t,
+ /// Signals being caught by user.
+ pub ki_sigcatch: ::sigset_t,
+ /// Effective user ID.
+ pub ki_uid: ::uid_t,
+ /// Real user ID.
+ pub ki_ruid: ::uid_t,
+ /// Saved effective user ID.
+ pub ki_svuid: ::uid_t,
+ /// Real group ID.
+ pub ki_rgid: ::gid_t,
+ /// Saved effective group ID.
+ pub ki_svgid: ::gid_t,
+ /// Number of groups.
+ pub ki_ngroups: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short2: ::c_short,
+ /// Groups.
+ pub ki_groups: [::gid_t; ::KI_NGROUPS],
+ /// Virtual size.
+ pub ki_size: ::vm_size_t,
+ /// Current resident set size in pages.
+ pub ki_rssize: ::segsz_t,
+ /// Resident set size before last swap.
+ pub ki_swrss: ::segsz_t,
+ /// Text size (pages) XXX.
+ pub ki_tsize: ::segsz_t,
+ /// Data size (pages) XXX.
+ pub ki_dsize: ::segsz_t,
+ /// Stack size (pages).
+ pub ki_ssize: ::segsz_t,
+ /// Exit status for wait & stop signal.
+ pub ki_xstat: ::u_short,
+ /// Accounting flags.
+ pub ki_acflag: ::u_short,
+ /// %cpu for process during `ki_swtime`.
+ pub ki_pctcpu: ::fixpt_t,
+ /// Time averaged value of `ki_cpticks`.
+ pub ki_estcpu: ::u_int,
+ /// Time since last blocked.
+ pub ki_slptime: ::u_int,
+ /// Time swapped in or out.
+ pub ki_swtime: ::u_int,
+ /// Number of copy-on-write faults.
+ pub ki_cow: ::u_int,
+ /// Real time in microsec.
+ pub ki_runtime: u64,
+ /// Starting time.
+ pub ki_start: ::timeval,
+ /// Time used by process children.
+ pub ki_childtime: ::timeval,
+ /// P_* flags.
+ pub ki_flag: ::c_long,
+ /// KI_* flags (below).
+ pub ki_kiflag: ::c_long,
+ /// Kernel trace points.
+ pub ki_traceflag: ::c_int,
+ /// S* process status.
+ pub ki_stat: ::c_char,
+ /// Process "nice" value.
+ pub ki_nice: i8, // signed char
+ /// Process lock (prevent swap) count.
+ pub ki_lock: ::c_char,
+ /// Run queue index.
+ pub ki_rqindex: ::c_char,
+ /// Which cpu we are on.
+ pub ki_oncpu_old: ::c_uchar,
+ /// Last cpu we were on.
+ pub ki_lastcpu_old: ::c_uchar,
+ /// Thread name.
+ pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
+ /// Wchan message.
+ pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
+ /// Setlogin name.
+ pub ki_login: [::c_char; ::LOGNAMELEN + 1],
+ /// Lock name.
+ pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
+ /// Command name.
+ pub ki_comm: [::c_char; ::COMMLEN + 1],
+ /// Emulation name.
+ pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
+ /// Login class.
+ pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
+ /// More thread name.
+ pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
+ /// Spare string space.
+ pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
+ /// Spare room for growth.
+ pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
+ /// Controlling tty dev.
+ pub ki_tdev: u64,
+ /// Which cpu we are on.
+ pub ki_oncpu: ::c_int,
+ /// Last cpu we were on.
+ pub ki_lastcpu: ::c_int,
+ /// PID of tracing process.
+ pub ki_tracer: ::c_int,
+ /// P2_* flags.
+ pub ki_flag2: ::c_int,
+ /// Default FIB number.
+ pub ki_fibnum: ::c_int,
+ /// Credential flags.
+ pub ki_cr_flags: ::u_int,
+ /// Process jail ID.
+ pub ki_jid: ::c_int,
+ /// Number of threads in total.
+ pub ki_numthreads: ::c_int,
+ // Thread ID.
+ pub ki_tid: ::lwpid_t,
+ /// Process priority.
+ pub ki_pri: ::priority,
+ /// Process rusage statistics.
+ pub ki_rusage: ::rusage,
+ /// rusage of children processes.
+ pub ki_rusage_ch: ::rusage,
+ // This is normally "struct pcb".
+ /// Kernel virtual addr of pcb.
+ pub ki_pcb: *mut ::c_void,
+ /// Kernel virtual addr of stack.
+ pub ki_kstack: *mut ::c_void,
+ /// User convenience pointer.
+ pub ki_udata: *mut ::c_void,
+ // This is normally "struct thread".
+ pub ki_tdaddr: *mut ::c_void,
+ // This is normally "struct pwddesc".
+ /// Pointer to process paths info.
+ pub ki_pd: *mut ::c_void,
+ pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
+ pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
+ /// PS_* flags.
+ pub ki_sflag: ::c_long,
+ /// kthread flag.
+ pub ki_tdflags: ::c_long,
+ }
}
s_no_extra_traits! {
@@ -234,6 +419,8 @@ pub const DOMAINSET_POLICY_FIRSTTOUCH: ::c_int = 2;
pub const DOMAINSET_POLICY_PREFER: ::c_int = 3;
pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
+pub const MINCORE_SUPER: ::c_int = 0x20;
+
f! {
pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
let ngrps = if ngrps > 0 {
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs
new file mode 100644
index 0000000000..80c6fa1684
--- /dev/null
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs
@@ -0,0 +1,34 @@
+#[repr(C)]
+#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
+pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ st_padding0: i16,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ st_padding1: i32,
+ pub st_rdev: ::dev_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
+ pub st_birthtime: ::time_t,
+ pub st_birthtime_nsec: ::c_long,
+ pub st_size: ::off_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_blksize: ::blksize_t,
+ pub st_flags: ::fflags_t,
+ pub st_gen: u64,
+ pub st_spare: [u64; 10],
+}
+
+impl ::Copy for ::stat {}
+impl ::Clone for ::stat {
+ fn clone(&self) -> ::stat {
+ *self
+ }
+}
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
new file mode 100644
index 0000000000..25b012443a
--- /dev/null
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
@@ -0,0 +1,511 @@
+// APIs in FreeBSD 13 that have changed since 11.
+
+pub type nlink_t = u64;
+pub type dev_t = u64;
+pub type ino_t = ::c_ulong;
+pub type shmatt_t = ::c_uint;
+pub type kpaddr_t = u64;
+pub type kssize_t = i64;
+pub type domainset_t = __c_anonymous_domainset;
+
+s! {
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ }
+
+ pub struct kevent {
+ pub ident: ::uintptr_t,
+ pub filter: ::c_short,
+ pub flags: ::c_ushort,
+ pub fflags: ::c_uint,
+ pub data: ::intptr_t,
+ pub udata: *mut ::c_void,
+ pub ext: [u64; 4],
+ }
+
+ pub struct sockcred2 {
+ pub sc_version: ::c_int,
+ pub sc_pid: ::pid_t,
+ pub sc_uid: ::uid_t,
+ pub sc_euid: ::uid_t,
+ pub sc_gid: ::gid_t,
+ pub sc_egid: ::gid_t,
+ pub sc_ngroups: ::c_int,
+ pub sc_groups: [::gid_t; 1],
+ }
+
+ pub struct kvm_page {
+ pub kp_version: ::u_int,
+ pub kp_paddr: ::kpaddr_t,
+ pub kp_kmap_vaddr: ::kvaddr_t,
+ pub kp_dmap_vaddr: ::kvaddr_t,
+ pub kp_prot: ::vm_prot_t,
+ pub kp_offset: ::off_t,
+ pub kp_len: ::size_t,
+ }
+
+ pub struct __c_anonymous_domainset {
+ _priv: [::uintptr_t; 4],
+ }
+
+ pub struct kinfo_proc {
+ /// Size of this structure.
+ pub ki_structsize: ::c_int,
+ /// Reserved: layout identifier.
+ pub ki_layout: ::c_int,
+ /// Address of command arguments.
+ pub ki_args: *mut ::pargs,
+ // This is normally "struct proc".
+ /// Address of proc.
+ pub ki_paddr: *mut ::c_void,
+ // This is normally "struct user".
+ /// Kernel virtual address of u-area.
+ pub ki_addr: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to trace file.
+ pub ki_tracep: *mut ::c_void,
+ // This is normally "struct vnode".
+ /// Pointer to executable file.
+ pub ki_textvp: *mut ::c_void,
+ // This is normally "struct filedesc".
+ /// Pointer to open file info.
+ pub ki_fd: *mut ::c_void,
+ // This is normally "struct vmspace".
+ /// Pointer to kernel vmspace struct.
+ pub ki_vmspace: *mut ::c_void,
+ /// Sleep address.
+ pub ki_wchan: *const ::c_void,
+ /// Process identifier.
+ pub ki_pid: ::pid_t,
+ /// Parent process ID.
+ pub ki_ppid: ::pid_t,
+ /// Process group ID.
+ pub ki_pgid: ::pid_t,
+ /// tty process group ID.
+ pub ki_tpgid: ::pid_t,
+ /// Process session ID.
+ pub ki_sid: ::pid_t,
+ /// Terminal session ID.
+ pub ki_tsid: ::pid_t,
+ /// Job control counter.
+ pub ki_jobc: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short1: ::c_short,
+ /// Controlling tty dev.
+ pub ki_tdev_freebsd11: u32,
+ /// Signals arrived but not delivered.
+ pub ki_siglist: ::sigset_t,
+ /// Current signal mask.
+ pub ki_sigmask: ::sigset_t,
+ /// Signals being ignored.
+ pub ki_sigignore: ::sigset_t,
+ /// Signals being caught by user.
+ pub ki_sigcatch: ::sigset_t,
+ /// Effective user ID.
+ pub ki_uid: ::uid_t,
+ /// Real user ID.
+ pub ki_ruid: ::uid_t,
+ /// Saved effective user ID.
+ pub ki_svuid: ::uid_t,
+ /// Real group ID.
+ pub ki_rgid: ::gid_t,
+ /// Saved effective group ID.
+ pub ki_svgid: ::gid_t,
+ /// Number of groups.
+ pub ki_ngroups: ::c_short,
+ /// Unused (just here for alignment).
+ pub ki_spare_short2: ::c_short,
+ /// Groups.
+ pub ki_groups: [::gid_t; ::KI_NGROUPS],
+ /// Virtual size.
+ pub ki_size: ::vm_size_t,
+ /// Current resident set size in pages.
+ pub ki_rssize: ::segsz_t,
+ /// Resident set size before last swap.
+ pub ki_swrss: ::segsz_t,
+ /// Text size (pages) XXX.
+ pub ki_tsize: ::segsz_t,
+ /// Data size (pages) XXX.
+ pub ki_dsize: ::segsz_t,
+ /// Stack size (pages).
+ pub ki_ssize: ::segsz_t,
+ /// Exit status for wait & stop signal.
+ pub ki_xstat: ::u_short,
+ /// Accounting flags.
+ pub ki_acflag: ::u_short,
+ /// %cpu for process during `ki_swtime`.
+ pub ki_pctcpu: ::fixpt_t,
+ /// Time averaged value of `ki_cpticks`.
+ pub ki_estcpu: ::u_int,
+ /// Time since last blocked.
+ pub ki_slptime: ::u_int,
+ /// Time swapped in or out.
+ pub ki_swtime: ::u_int,
+ /// Number of copy-on-write faults.
+ pub ki_cow: ::u_int,
+ /// Real time in microsec.
+ pub ki_runtime: u64,
+ /// Starting time.
+ pub ki_start: ::timeval,
+ /// Time used by process children.
+ pub ki_childtime: ::timeval,
+ /// P_* flags.
+ pub ki_flag: ::c_long,
+ /// KI_* flags (below).
+ pub ki_kiflag: ::c_long,
+ /// Kernel trace points.
+ pub ki_traceflag: ::c_int,
+ /// S* process status.
+ pub ki_stat: ::c_char,
+ /// Process "nice" value.
+ pub ki_nice: i8, // signed char
+ /// Process lock (prevent swap) count.
+ pub ki_lock: ::c_char,
+ /// Run queue index.
+ pub ki_rqindex: ::c_char,
+ /// Which cpu we are on.
+ pub ki_oncpu_old: ::c_uchar,
+ /// Last cpu we were on.
+ pub ki_lastcpu_old: ::c_uchar,
+ /// Thread name.
+ pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
+ /// Wchan message.
+ pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
+ /// Setlogin name.
+ pub ki_login: [::c_char; ::LOGNAMELEN + 1],
+ /// Lock name.
+ pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
+ /// Command name.
+ pub ki_comm: [::c_char; ::COMMLEN + 1],
+ /// Emulation name.
+ pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
+ /// Login class.
+ pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
+ /// More thread name.
+ pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
+ /// Spare string space.
+ pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
+ /// Spare room for growth.
+ pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
+ /// Controlling tty dev.
+ pub ki_tdev: u64,
+ /// Which cpu we are on.
+ pub ki_oncpu: ::c_int,
+ /// Last cpu we were on.
+ pub ki_lastcpu: ::c_int,
+ /// PID of tracing process.
+ pub ki_tracer: ::c_int,
+ /// P2_* flags.
+ pub ki_flag2: ::c_int,
+ /// Default FIB number.
+ pub ki_fibnum: ::c_int,
+ /// Credential flags.
+ pub ki_cr_flags: ::u_int,
+ /// Process jail ID.
+ pub ki_jid: ::c_int,
+ /// Number of threads in total.
+ pub ki_numthreads: ::c_int,
+ // Thread ID.
+ pub ki_tid: ::lwpid_t,
+ /// Process priority.
+ pub ki_pri: ::priority,
+ /// Process rusage statistics.
+ pub ki_rusage: ::rusage,
+ /// rusage of children processes.
+ pub ki_rusage_ch: ::rusage,
+ // This is normally "struct pcb".
+ /// Kernel virtual addr of pcb.
+ pub ki_pcb: *mut ::c_void,
+ /// Kernel virtual addr of stack.
+ pub ki_kstack: *mut ::c_void,
+ /// User convenience pointer.
+ pub ki_udata: *mut ::c_void,
+ // This is normally "struct thread".
+ pub ki_tdaddr: *mut ::c_void,
+ // This is normally "struct pwddesc".
+ /// Pointer to process paths info.
+ pub ki_pd: *mut ::c_void,
+ pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
+ pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
+ /// PS_* flags.
+ pub ki_sflag: ::c_long,
+ /// kthread flag.
+ pub ki_tdflags: ::c_long,
+ }
+}
+
+s_no_extra_traits! {
+ pub struct dirent {
+ pub d_fileno: ::ino_t,
+ pub d_off: ::off_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ d_pad0: u8,
+ pub d_namlen: u16,
+ d_pad1: u16,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct statfs {
+ pub f_version: u32,
+ pub f_type: u32,
+ pub f_flags: u64,
+ pub f_bsize: u64,
+ pub f_iosize: u64,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: i64,
+ pub f_files: u64,
+ pub f_ffree: i64,
+ pub f_syncwrites: u64,
+ pub f_asyncwrites: u64,
+ pub f_syncreads: u64,
+ pub f_asyncreads: u64,
+ f_spare: [u64; 10],
+ pub f_namemax: u32,
+ pub f_owner: ::uid_t,
+ pub f_fsid: ::fsid_t,
+ f_charspare: [::c_char; 80],
+ pub f_fstypename: [::c_char; 16],
+ pub f_mntfromname: [::c_char; 1024],
+ pub f_mntonname: [::c_char; 1024],
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for statfs {
+ fn eq(&self, other: &statfs) -> bool {
+ self.f_version == other.f_version
+ && self.f_type == other.f_type
+ && self.f_flags == other.f_flags
+ && self.f_bsize == other.f_bsize
+ && self.f_iosize == other.f_iosize
+ && self.f_blocks == other.f_blocks
+ && self.f_bfree == other.f_bfree
+ && self.f_bavail == other.f_bavail
+ && self.f_files == other.f_files
+ && self.f_ffree == other.f_ffree
+ && self.f_syncwrites == other.f_syncwrites
+ && self.f_asyncwrites == other.f_asyncwrites
+ && self.f_syncreads == other.f_syncreads
+ && self.f_asyncreads == other.f_asyncreads
+ && self.f_namemax == other.f_namemax
+ && self.f_owner == other.f_owner
+ && self.f_fsid == other.f_fsid
+ && self.f_fstypename == other.f_fstypename
+ && self
+ .f_mntfromname
+ .iter()
+ .zip(other.f_mntfromname.iter())
+ .all(|(a,b)| a == b)
+ && self
+ .f_mntonname
+ .iter()
+ .zip(other.f_mntonname.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for statfs {}
+ impl ::fmt::Debug for statfs {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("statfs")
+ .field("f_bsize", &self.f_bsize)
+ .field("f_iosize", &self.f_iosize)
+ .field("f_blocks", &self.f_blocks)
+ .field("f_bfree", &self.f_bfree)
+ .field("f_bavail", &self.f_bavail)
+ .field("f_files", &self.f_files)
+ .field("f_ffree", &self.f_ffree)
+ .field("f_syncwrites", &self.f_syncwrites)
+ .field("f_asyncwrites", &self.f_asyncwrites)
+ .field("f_syncreads", &self.f_syncreads)
+ .field("f_asyncreads", &self.f_asyncreads)
+ .field("f_namemax", &self.f_namemax)
+ .field("f_owner", &self.f_owner)
+ .field("f_fsid", &self.f_fsid)
+ .field("f_fstypename", &self.f_fstypename)
+ .field("f_mntfromname", &&self.f_mntfromname[..])
+ .field("f_mntonname", &&self.f_mntonname[..])
+ .finish()
+ }
+ }
+ impl ::hash::Hash for statfs {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.f_version.hash(state);
+ self.f_type.hash(state);
+ self.f_flags.hash(state);
+ self.f_bsize.hash(state);
+ self.f_iosize.hash(state);
+ self.f_blocks.hash(state);
+ self.f_bfree.hash(state);
+ self.f_bavail.hash(state);
+ self.f_files.hash(state);
+ self.f_ffree.hash(state);
+ self.f_syncwrites.hash(state);
+ self.f_asyncwrites.hash(state);
+ self.f_syncreads.hash(state);
+ self.f_asyncreads.hash(state);
+ self.f_namemax.hash(state);
+ self.f_owner.hash(state);
+ self.f_fsid.hash(state);
+ self.f_charspare.hash(state);
+ self.f_fstypename.hash(state);
+ self.f_mntfromname.hash(state);
+ self.f_mntonname.hash(state);
+ }
+ }
+
+ impl PartialEq for dirent {
+ fn eq(&self, other: &dirent) -> bool {
+ self.d_fileno == other.d_fileno
+ && self.d_off == other.d_off
+ && self.d_reclen == other.d_reclen
+ && self.d_type == other.d_type
+ && self.d_namlen == other.d_namlen
+ && self
+ .d_name[..self.d_namlen as _]
+ .iter()
+ .zip(other.d_name.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for dirent {}
+ impl ::fmt::Debug for dirent {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("dirent")
+ .field("d_fileno", &self.d_fileno)
+ .field("d_off", &self.d_off)
+ .field("d_reclen", &self.d_reclen)
+ .field("d_type", &self.d_type)
+ .field("d_namlen", &self.d_namlen)
+ .field("d_name", &&self.d_name[..self.d_namlen as _])
+ .finish()
+ }
+ }
+ impl ::hash::Hash for dirent {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.d_fileno.hash(state);
+ self.d_off.hash(state);
+ self.d_reclen.hash(state);
+ self.d_type.hash(state);
+ self.d_namlen.hash(state);
+ self.d_name[..self.d_namlen as _].hash(state);
+ }
+ }
+ }
+}
+
+pub const RAND_MAX: ::c_int = 0x7fff_ffff;
+pub const ELAST: ::c_int = 97;
+
+pub const KF_TYPE_EVENTFD: ::c_int = 13;
+
+/// max length of devicename
+pub const SPECNAMELEN: ::c_int = 255;
+pub const KI_NSPARE_PTR: usize = 5;
+
+/// domainset policies
+pub const DOMAINSET_POLICY_INVALID: ::c_int = 0;
+pub const DOMAINSET_POLICY_ROUNDROBIN: ::c_int = 1;
+pub const DOMAINSET_POLICY_FIRSTTOUCH: ::c_int = 2;
+pub const DOMAINSET_POLICY_PREFER: ::c_int = 3;
+pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
+
+pub const MINCORE_SUPER: ::c_int = 0x60;
+
+f! {
+ pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
+ let ngrps = if ngrps > 0 {
+ ngrps - 1
+ } else {
+ 0
+ };
+ ::mem::size_of::<sockcred2>() + ::mem::size_of::<::gid_t>() * ngrps
+ }
+}
+
+extern "C" {
+ pub fn aio_readv(aiocbp: *mut ::aiocb) -> ::c_int;
+ pub fn aio_writev(aiocbp: *mut ::aiocb) -> ::c_int;
+ pub fn setgrent();
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
+ pub fn freelocale(loc: ::locale_t);
+ pub fn msgrcv(
+ msqid: ::c_int,
+ msgp: *mut ::c_void,
+ msgsz: ::size_t,
+ msgtyp: ::c_long,
+ msgflg: ::c_int,
+ ) -> ::ssize_t;
+ pub fn clock_nanosleep(
+ clk_id: ::clockid_t,
+ flags: ::c_int,
+ rqtp: *const ::timespec,
+ rmtp: *mut ::timespec,
+ ) -> ::c_int;
+
+ pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
+
+ pub fn fdatasync(fd: ::c_int) -> ::c_int;
+
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
+ pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
+ pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
+ pub fn setproctitle_fast(fmt: *const ::c_char, ...);
+ pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
+ pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
+
+ pub fn cpuset_getdomain(
+ level: ::cpulevel_t,
+ which: ::cpuwhich_t,
+ id: ::id_t,
+ setsize: ::size_t,
+ mask: *mut ::domainset_t,
+ policy: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn cpuset_setdomain(
+ level: ::cpulevel_t,
+ which: ::cpuwhich_t,
+ id: ::id_t,
+ setsize: ::size_t,
+ mask: *const ::domainset_t,
+ policy: ::c_int,
+ ) -> ::c_int;
+
+ pub fn copy_file_range(
+ infd: ::c_int,
+ inoffp: *mut ::off_t,
+ outfd: ::c_int,
+ outoffp: *mut ::off_t,
+ len: ::size_t,
+ flags: ::c_uint,
+ ) -> ::ssize_t;
+}
+
+#[link(name = "kvm")]
+extern "C" {
+ pub fn kvm_kerndisp(kd: *mut ::kvm_t) -> ::kssize_t;
+}
+
+cfg_if! {
+ if #[cfg(any(target_arch = "x86_64",
+ target_arch = "aarch64"))] {
+ mod b64;
+ pub use self::b64::*;
+ }
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ }
+}
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs
new file mode 100644
index 0000000000..7bf2534455
--- /dev/null
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs
@@ -0,0 +1,5 @@
+pub const PROC_KPTI_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN;
+pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: ::c_int = 1;
+pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: ::c_int = 2;
+pub const PROC_KPTI_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 1;
+pub const PROC_KPTI_STATUS_ACTIVE: ::c_int = 0x80000000;
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index ab5508e33c..0e66304f63 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -314,116 +314,6 @@ s! {
pub pri_user: u_char,
}
- pub struct kinfo_proc {
- pub ki_structsize: ::c_int,
- pub ki_layout: ::c_int,
- pub ki_args: *mut pargs,
- // This is normally "struct proc".
- pub ki_paddr: *mut ::c_void,
- // This is normally "struct user".
- pub ki_addr: *mut ::c_void,
- // This is normally "struct vnode".
- pub ki_tracep: *mut ::c_void,
- // This is normally "struct vnode".
- pub ki_textvp: *mut ::c_void,
- // This is normally "struct filedesc".
- pub ki_fd: *mut ::c_void,
- // This is normally "struct vmspace".
- pub ki_vmspace: *mut ::c_void,
- #[cfg(freebsd13)]
- pub ki_wchan: *const ::c_void,
- #[cfg(not(freebsd13))]
- pub ki_wchan: *mut ::c_void,
- pub ki_pid: ::pid_t,
- pub ki_ppid: ::pid_t,
- pub ki_pgid: ::pid_t,
- pub ki_tpgid: ::pid_t,
- pub ki_sid: ::pid_t,
- pub ki_tsid: ::pid_t,
- pub ki_jobc: ::c_short,
- pub ki_spare_short1: ::c_short,
- #[cfg(any(freebsd12, freebsd13))]
- pub ki_tdev_freebsd11: u32,
- #[cfg(freebsd11)]
- pub ki_tdev: ::dev_t,
- pub ki_siglist: ::sigset_t,
- pub ki_sigmask: ::sigset_t,
- pub ki_sigignore: ::sigset_t,
- pub ki_sigcatch: ::sigset_t,
- pub ki_uid: ::uid_t,
- pub ki_ruid: ::uid_t,
- pub ki_svuid: ::uid_t,
- pub ki_rgid: ::gid_t,
- pub ki_svgid: ::gid_t,
- pub ki_ngroups: ::c_short,
- pub ki_spare_short2: ::c_short,
- pub ki_groups: [::gid_t; ::KI_NGROUPS],
- pub ki_size: ::vm_size_t,
- pub ki_rssize: segsz_t,
- pub ki_swrss: segsz_t,
- pub ki_tsize: segsz_t,
- pub ki_dsize: segsz_t,
- pub ki_ssize: segsz_t,
- pub ki_xstat: ::u_short,
- pub ki_acflag: ::u_short,
- pub ki_pctcpu: fixpt_t,
- pub ki_estcpu: u_int,
- pub ki_slptime: u_int,
- pub ki_swtime: u_int,
- pub ki_cow: u_int,
- pub ki_runtime: u64,
- pub ki_start: ::timeval,
- pub ki_childtime: ::timeval,
- pub ki_flag: ::c_long,
- pub ki_kiflag: ::c_long,
- pub ki_traceflag: ::c_int,
- pub ki_stat: ::c_char,
- pub ki_nice: i8, // signed char
- pub ki_lock: ::c_char,
- pub ki_rqindex: ::c_char,
- pub ki_oncpu_old: ::c_uchar,
- pub ki_lastcpu_old: ::c_uchar,
- pub ki_tdname: [::c_char; TDNAMLEN + 1],
- pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
- pub ki_login: [::c_char; ::LOGNAMELEN + 1],
- pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
- pub ki_comm: [::c_char; ::COMMLEN + 1],
- pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
- pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
- pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
- pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
- pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
- #[cfg(freebsd13)]
- pub ki_tdev: u64,
- #[cfg(freebsd12)]
- pub ki_tdev: ::dev_t,
- pub ki_oncpu: ::c_int,
- pub ki_lastcpu: ::c_int,
- pub ki_tracer: ::c_int,
- pub ki_flag2: ::c_int,
- pub ki_fibnum: ::c_int,
- pub ki_cr_flags: u_int,
- pub ki_jid: ::c_int,
- pub ki_numthreads: ::c_int,
- pub ki_tid: lwpid_t,
- pub ki_pri: priority,
- pub ki_rusage: ::rusage,
- pub ki_rusage_ch: ::rusage,
- // This is normally "struct pcb".
- pub ki_pcb: *mut ::c_void,
- pub ki_kstack: *mut ::c_void,
- pub ki_udata: *mut ::c_void,
- // This is normally "struct thread".
- pub ki_tdaddr: *mut ::c_void,
- // This is normally "struct pwddesc".
- #[cfg(freebsd13)]
- pub ki_pd: *mut ::c_void,
- pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
- pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
- pub ki_sflag: ::c_long,
- pub ki_tdflags: ::c_long,
- }
-
pub struct kvm_swap {
pub ksw_devname: [::c_char; 32],
pub ksw_used: u_int,
@@ -480,6 +370,16 @@ s! {
pub t_sw: i16,
pub t_pad: [u16; 3],
}
+
+ pub struct rusage_ext {
+ pub rux_runtime: u64,
+ pub rux_uticks: u64,
+ pub rux_sticks: u64,
+ pub rux_iticks: u64,
+ pub rux_uu: u64,
+ pub rux_su: u64,
+ pub rux_tu: u64,
+ }
}
s_no_extra_traits! {
@@ -966,6 +866,58 @@ pub const CTL_HW: ::c_int = 6;
pub const CTL_MACHDEP: ::c_int = 7;
pub const CTL_USER: ::c_int = 8;
pub const CTL_P1003_1B: ::c_int = 9;
+
+// sys/sysctl.h
+pub const CTL_MAXNAME: ::c_int = 24;
+
+pub const CTLTYPE: ::c_int = 0xf;
+pub const CTLTYPE_NODE: ::c_int = 1;
+pub const CTLTYPE_INT: ::c_int = 2;
+pub const CTLTYPE_STRING: ::c_int = 3;
+pub const CTLTYPE_S64: ::c_int = 4;
+pub const CTLTYPE_OPAQUE: ::c_int = 5;
+pub const CTLTYPE_STRUCT: ::c_int = CTLTYPE_OPAQUE;
+pub const CTLTYPE_UINT: ::c_int = 6;
+pub const CTLTYPE_LONG: ::c_int = 7;
+pub const CTLTYPE_ULONG: ::c_int = 8;
+pub const CTLTYPE_U64: ::c_int = 9;
+pub const CTLTYPE_U8: ::c_int = 0xa;
+pub const CTLTYPE_U16: ::c_int = 0xb;
+pub const CTLTYPE_S8: ::c_int = 0xc;
+pub const CTLTYPE_S16: ::c_int = 0xd;
+pub const CTLTYPE_S32: ::c_int = 0xe;
+pub const CTLTYPE_U32: ::c_int = 0xf;
+
+pub const CTLFLAG_RD: ::c_int = 0x80000000;
+pub const CTLFLAG_WR: ::c_int = 0x40000000;
+pub const CTLFLAG_RW: ::c_int = CTLFLAG_RD | CTLFLAG_WR;
+pub const CTLFLAG_DORMANT: ::c_int = 0x20000000;
+pub const CTLFLAG_ANYBODY: ::c_int = 0x10000000;
+pub const CTLFLAG_SECURE: ::c_int = 0x08000000;
+pub const CTLFLAG_PRISON: ::c_int = 0x04000000;
+pub const CTLFLAG_DYN: ::c_int = 0x02000000;
+pub const CTLFLAG_SKIP: ::c_int = 0x01000000;
+pub const CTLMASK_SECURE: ::c_int = 0x00F00000;
+pub const CTLFLAG_TUN: ::c_int = 0x00080000;
+pub const CTLFLAG_RDTUN: ::c_int = CTLFLAG_RD | CTLFLAG_TUN;
+pub const CTLFLAG_RWTUN: ::c_int = CTLFLAG_RW | CTLFLAG_TUN;
+pub const CTLFLAG_MPSAFE: ::c_int = 0x00040000;
+pub const CTLFLAG_VNET: ::c_int = 0x00020000;
+pub const CTLFLAG_DYING: ::c_int = 0x00010000;
+pub const CTLFLAG_CAPRD: ::c_int = 0x00008000;
+pub const CTLFLAG_CAPWR: ::c_int = 0x00004000;
+pub const CTLFLAG_STATS: ::c_int = 0x00002000;
+pub const CTLFLAG_NOFETCH: ::c_int = 0x00001000;
+pub const CTLFLAG_CAPRW: ::c_int = CTLFLAG_CAPRD | CTLFLAG_CAPWR;
+pub const CTLFLAG_NEEDGIANT: ::c_int = 0x00000800;
+
+pub const CTLSHIFT_SECURE: ::c_int = 20;
+pub const CTLFLAG_SECURE1: ::c_int = CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE);
+pub const CTLFLAG_SECURE2: ::c_int = CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE);
+pub const CTLFLAG_SECURE3: ::c_int = CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE);
+
+pub const OID_AUTO: ::c_int = -1;
+
pub const CTL_SYSCTL_DEBUG: ::c_int = 0;
pub const CTL_SYSCTL_NAME: ::c_int = 1;
pub const CTL_SYSCTL_NEXT: ::c_int = 2;
@@ -973,6 +925,8 @@ pub const CTL_SYSCTL_NAME2OID: ::c_int = 3;
pub const CTL_SYSCTL_OIDFMT: ::c_int = 4;
pub const CTL_SYSCTL_OIDDESCR: ::c_int = 5;
pub const CTL_SYSCTL_OIDLABEL: ::c_int = 6;
+pub const CTL_SYSCTL_NEXTNOSKIP: ::c_int = 7;
+
pub const KERN_OSTYPE: ::c_int = 1;
pub const KERN_OSRELEASE: ::c_int = 2;
pub const KERN_OSREV: ::c_int = 3;
@@ -1010,6 +964,9 @@ pub const KERN_LOGSIGEXIT: ::c_int = 34;
pub const KERN_IOV_MAX: ::c_int = 35;
pub const KERN_HOSTUUID: ::c_int = 36;
pub const KERN_ARND: ::c_int = 37;
+pub const KERN_MAXPHYS: ::c_int = 38;
+pub const KERN_STACKTOP: ::c_int = 39;
+
pub const KERN_PROC_ALL: ::c_int = 0;
pub const KERN_PROC_PID: ::c_int = 1;
pub const KERN_PROC_PGRP: ::c_int = 2;
@@ -1037,6 +994,10 @@ pub const KERN_PROC_PS_STRINGS: ::c_int = 38;
pub const KERN_PROC_UMASK: ::c_int = 39;
pub const KERN_PROC_OSREL: ::c_int = 40;
pub const KERN_PROC_SIGTRAMP: ::c_int = 41;
+pub const KERN_PROC_CWD: ::c_int = 42;
+pub const KERN_PROC_NFDS: ::c_int = 43;
+pub const KERN_PROC_SIGFASTBLK: ::c_int = 44;
+
pub const KIPC_MAXSOCKBUF: ::c_int = 1;
pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
pub const KIPC_SOMAXCONN: ::c_int = 3;
@@ -1044,6 +1005,7 @@ pub const KIPC_MAX_LINKHDR: ::c_int = 4;
pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
pub const KIPC_MAX_HDR: ::c_int = 6;
pub const KIPC_MAX_DATALEN: ::c_int = 7;
+
pub const HW_MACHINE: ::c_int = 1;
pub const HW_MODEL: ::c_int = 2;
pub const HW_NCPU: ::c_int = 3;
@@ -1056,6 +1018,7 @@ pub const HW_DISKSTATS: ::c_int = 9;
pub const HW_FLOATINGPT: ::c_int = 10;
pub const HW_MACHINE_ARCH: ::c_int = 11;
pub const HW_REALMEM: ::c_int = 12;
+
pub const USER_CS_PATH: ::c_int = 1;
pub const USER_BC_BASE_MAX: ::c_int = 2;
pub const USER_BC_DIM_MAX: ::c_int = 3;
@@ -1076,6 +1039,8 @@ pub const USER_POSIX2_SW_DEV: ::c_int = 17;
pub const USER_POSIX2_UPE: ::c_int = 18;
pub const USER_STREAM_MAX: ::c_int = 19;
pub const USER_TZNAME_MAX: ::c_int = 20;
+pub const USER_LOCALBASE: ::c_int = 21;
+
pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
@@ -1101,6 +1066,7 @@ pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
+
pub const TIOCGPTN: ::c_uint = 0x4004740f;
pub const TIOCPTMASTER: ::c_uint = 0x2000741c;
pub const TIOCSIG: ::c_uint = 0x2004745f;
@@ -1880,11 +1846,7 @@ pub const KVME_FLAG_NOCOREDUMP: ::c_int = 0x00000004;
pub const KVME_FLAG_SUPER: ::c_int = 0x00000008;
pub const KVME_FLAG_GROWS_UP: ::c_int = 0x00000010;
pub const KVME_FLAG_GROWS_DOWN: ::c_int = 0x00000020;
-cfg_if! {
- if #[cfg(any(freebsd12, freebsd13))] {
- pub const KVME_FLAG_USER_WIRED: ::c_int = 0x00000040;
- }
-}
+pub const KVME_FLAG_USER_WIRED: ::c_int = 0x00000040;
pub const KKST_MAXLEN: ::c_int = 1024;
/// Stack is valid.
@@ -2007,6 +1969,156 @@ pub const _POSIX2_EXPR_NEST_MAX: ::c_int = 32;
pub const _POSIX2_LINE_MAX: ::c_int = 2048;
pub const _POSIX2_RE_DUP_MAX: ::c_int = 255;
+// sys/proc.h
+pub const TDF_BORROWING: ::c_int = 0x00000001;
+pub const TDF_INPANIC: ::c_int = 0x00000002;
+pub const TDF_INMEM: ::c_int = 0x00000004;
+pub const TDF_SINTR: ::c_int = 0x00000008;
+pub const TDF_TIMEOUT: ::c_int = 0x00000010;
+pub const TDF_IDLETD: ::c_int = 0x00000020;
+pub const TDF_CANSWAP: ::c_int = 0x00000040;
+pub const TDF_KTH_SUSP: ::c_int = 0x00000100;
+pub const TDF_ALLPROCSUSP: ::c_int = 0x00000200;
+pub const TDF_BOUNDARY: ::c_int = 0x00000400;
+pub const TDF_ASTPENDING: ::c_int = 0x00000800;
+pub const TDF_SBDRY: ::c_int = 0x00002000;
+pub const TDF_UPIBLOCKED: ::c_int = 0x00004000;
+pub const TDF_NEEDSUSPCHK: ::c_int = 0x00008000;
+pub const TDF_NEEDRESCHED: ::c_int = 0x00010000;
+pub const TDF_NEEDSIGCHK: ::c_int = 0x00020000;
+pub const TDF_NOLOAD: ::c_int = 0x00040000;
+pub const TDF_SERESTART: ::c_int = 0x00080000;
+pub const TDF_THRWAKEUP: ::c_int = 0x00100000;
+pub const TDF_SEINTR: ::c_int = 0x00200000;
+pub const TDF_SWAPINREQ: ::c_int = 0x00400000;
+pub const TDF_UNUSED23: ::c_int = 0x00800000;
+pub const TDF_SCHED0: ::c_int = 0x01000000;
+pub const TDF_SCHED1: ::c_int = 0x02000000;
+pub const TDF_SCHED2: ::c_int = 0x04000000;
+pub const TDF_SCHED3: ::c_int = 0x08000000;
+pub const TDF_ALRMPEND: ::c_int = 0x10000000;
+pub const TDF_PROFPEND: ::c_int = 0x20000000;
+pub const TDF_MACPEND: ::c_int = 0x40000000;
+
+pub const TDB_SUSPEND: ::c_int = 0x00000001;
+pub const TDB_XSIG: ::c_int = 0x00000002;
+pub const TDB_USERWR: ::c_int = 0x00000004;
+pub const TDB_SCE: ::c_int = 0x00000008;
+pub const TDB_SCX: ::c_int = 0x00000010;
+pub const TDB_EXEC: ::c_int = 0x00000020;
+pub const TDB_FORK: ::c_int = 0x00000040;
+pub const TDB_STOPATFORK: ::c_int = 0x00000080;
+pub const TDB_CHILD: ::c_int = 0x00000100;
+pub const TDB_BORN: ::c_int = 0x00000200;
+pub const TDB_EXIT: ::c_int = 0x00000400;
+pub const TDB_VFORK: ::c_int = 0x00000800;
+pub const TDB_FSTP: ::c_int = 0x00001000;
+pub const TDB_STEP: ::c_int = 0x00002000;
+
+pub const TDP_OLDMASK: ::c_int = 0x00000001;
+pub const TDP_INKTR: ::c_int = 0x00000002;
+pub const TDP_INKTRACE: ::c_int = 0x00000004;
+pub const TDP_BUFNEED: ::c_int = 0x00000008;
+pub const TDP_COWINPROGRESS: ::c_int = 0x00000010;
+pub const TDP_ALTSTACK: ::c_int = 0x00000020;
+pub const TDP_DEADLKTREAT: ::c_int = 0x00000040;
+pub const TDP_NOFAULTING: ::c_int = 0x00000080;
+pub const TDP_OWEUPC: ::c_int = 0x00000200;
+pub const TDP_ITHREAD: ::c_int = 0x00000400;
+pub const TDP_SYNCIO: ::c_int = 0x00000800;
+pub const TDP_SCHED1: ::c_int = 0x00001000;
+pub const TDP_SCHED2: ::c_int = 0x00002000;
+pub const TDP_SCHED3: ::c_int = 0x00004000;
+pub const TDP_SCHED4: ::c_int = 0x00008000;
+pub const TDP_GEOM: ::c_int = 0x00010000;
+pub const TDP_SOFTDEP: ::c_int = 0x00020000;
+pub const TDP_NORUNNINGBUF: ::c_int = 0x00040000;
+pub const TDP_WAKEUP: ::c_int = 0x00080000;
+pub const TDP_INBDFLUSH: ::c_int = 0x00100000;
+pub const TDP_KTHREAD: ::c_int = 0x00200000;
+pub const TDP_CALLCHAIN: ::c_int = 0x00400000;
+pub const TDP_IGNSUSP: ::c_int = 0x00800000;
+pub const TDP_AUDITREC: ::c_int = 0x01000000;
+pub const TDP_RFPPWAIT: ::c_int = 0x02000000;
+pub const TDP_RESETSPUR: ::c_int = 0x04000000;
+pub const TDP_NERRNO: ::c_int = 0x08000000;
+pub const TDP_EXECVMSPC: ::c_int = 0x40000000;
+
+pub const TDI_SUSPENDED: ::c_int = 0x0001;
+pub const TDI_SLEEPING: ::c_int = 0x0002;
+pub const TDI_SWAPPED: ::c_int = 0x0004;
+pub const TDI_LOCK: ::c_int = 0x0008;
+pub const TDI_IWAIT: ::c_int = 0x0010;
+
+pub const P_ADVLOCK: ::c_int = 0x00000001;
+pub const P_CONTROLT: ::c_int = 0x00000002;
+pub const P_KPROC: ::c_int = 0x00000004;
+pub const P_UNUSED3: ::c_int = 0x00000008;
+pub const P_PPWAIT: ::c_int = 0x00000010;
+pub const P_PROFIL: ::c_int = 0x00000020;
+pub const P_STOPPROF: ::c_int = 0x00000040;
+pub const P_HADTHREADS: ::c_int = 0x00000080;
+pub const P_SUGID: ::c_int = 0x00000100;
+pub const P_SYSTEM: ::c_int = 0x00000200;
+pub const P_SINGLE_EXIT: ::c_int = 0x00000400;
+pub const P_TRACED: ::c_int = 0x00000800;
+pub const P_WAITED: ::c_int = 0x00001000;
+pub const P_WEXIT: ::c_int = 0x00002000;
+pub const P_EXEC: ::c_int = 0x00004000;
+pub const P_WKILLED: ::c_int = 0x00008000;
+pub const P_CONTINUED: ::c_int = 0x00010000;
+pub const P_STOPPED_SIG: ::c_int = 0x00020000;
+pub const P_STOPPED_TRACE: ::c_int = 0x00040000;
+pub const P_STOPPED_SINGLE: ::c_int = 0x00080000;
+pub const P_PROTECTED: ::c_int = 0x00100000;
+pub const P_SIGEVENT: ::c_int = 0x00200000;
+pub const P_SINGLE_BOUNDARY: ::c_int = 0x00400000;
+pub const P_HWPMC: ::c_int = 0x00800000;
+pub const P_JAILED: ::c_int = 0x01000000;
+pub const P_TOTAL_STOP: ::c_int = 0x02000000;
+pub const P_INEXEC: ::c_int = 0x04000000;
+pub const P_STATCHILD: ::c_int = 0x08000000;
+pub const P_INMEM: ::c_int = 0x10000000;
+pub const P_SWAPPINGOUT: ::c_int = 0x20000000;
+pub const P_SWAPPINGIN: ::c_int = 0x40000000;
+pub const P_PPTRACE: ::c_int = 0x80000000;
+pub const P_STOPPED: ::c_int = P_STOPPED_SIG | P_STOPPED_SINGLE | P_STOPPED_TRACE;
+
+pub const P2_INHERIT_PROTECTED: ::c_int = 0x00000001;
+pub const P2_NOTRACE: ::c_int = 0x00000002;
+pub const P2_NOTRACE_EXEC: ::c_int = 0x00000004;
+pub const P2_AST_SU: ::c_int = 0x00000008;
+pub const P2_PTRACE_FSTP: ::c_int = 0x00000010;
+pub const P2_TRAPCAP: ::c_int = 0x00000020;
+pub const P2_STKGAP_DISABLE: ::c_int = 0x00000800;
+pub const P2_STKGAP_DISABLE_EXEC: ::c_int = 0x00001000;
+
+pub const P_TREE_ORPHANED: ::c_int = 0x00000001;
+pub const P_TREE_FIRST_ORPHAN: ::c_int = 0x00000002;
+pub const P_TREE_REAPER: ::c_int = 0x00000004;
+
+pub const SIDL: ::c_char = 1;
+pub const SRUN: ::c_char = 2;
+pub const SSLEEP: ::c_char = 3;
+pub const SSTOP: ::c_char = 4;
+pub const SZOMB: ::c_char = 5;
+pub const SWAIT: ::c_char = 6;
+pub const SLOCK: ::c_char = 7;
+
+pub const P_MAGIC: ::c_int = 0xbeefface;
+
+pub const TDP_SIGFASTBLOCK: ::c_int = 0x00000100;
+pub const TDP_UIOHELD: ::c_int = 0x10000000;
+pub const TDP_SIGFASTPENDING: ::c_int = 0x80000000;
+pub const TDP2_COMPAT32RB: ::c_int = 0x00000002;
+pub const P2_PROTMAX_ENABLE: ::c_int = 0x00000200;
+pub const P2_PROTMAX_DISABLE: ::c_int = 0x00000400;
+pub const TDP2_SBPAGES: ::c_int = 0x00000001;
+pub const P2_ASLR_ENABLE: ::c_int = 0x00000040;
+pub const P2_ASLR_DISABLE: ::c_int = 0x00000080;
+pub const P2_ASLR_IGNSTART: ::c_int = 0x00000100;
+pub const P_TREE_GRPEXITED: ::c_int = 0x00000008;
+
const_fn! {
{const} fn _ALIGN(p: usize) -> usize {
(p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -2624,7 +2736,10 @@ extern "C" {
}
cfg_if! {
- if #[cfg(freebsd13)] {
+ if #[cfg(freebsd14)] {
+ mod freebsd14;
+ pub use self::freebsd14::*;
+ } else if #[cfg(freebsd13)] {
mod freebsd13;
pub use self::freebsd13::*;
} else if #[cfg(freebsd12)] {
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 66035f3fcd..a1e78e4157 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -822,7 +822,6 @@ pub const MINCORE_REFERENCED: ::c_int = 0x2;
pub const MINCORE_MODIFIED: ::c_int = 0x4;
pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
-pub const MINCORE_SUPER: ::c_int = 0x20;
pub const AF_UNSPEC: ::c_int = 0;
pub const AF_LOCAL: ::c_int = 1;
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index 4e9cd1bc8c..7356e7ae23 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -747,6 +747,7 @@ extern "C" {
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn gethostid() -> ::c_long;
pub fn sethostid(hostid: ::c_long) -> ::c_int;
+ pub fn ftok(path: *const ::c_char, id: ::c_int) -> ::key_t;
}
cfg_if! {
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 183bd3c890..9422a73920 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -556,6 +556,13 @@ s! {
pub psi_siginfo: siginfo_t,
pub psi_lwpid: lwpid_t,
}
+
+ pub struct sysctldesc {
+ pub descr_num: i32,
+ pub descr_ver: u32,
+ pub descr_len: u32,
+ pub descr_str: [::c_char; 1],
+ }
}
s_no_extra_traits! {
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 1228683f63..1bd7ac720f 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -401,6 +401,16 @@ s! {
pub kve_inheritance: ::c_int,
pub kve_flags: u8,
}
+
+ pub struct ptrace_state {
+ pub pe_report_event: ::c_int,
+ pub pe_other_pid: ::pid_t,
+ pub pe_tid: ::pid_t,
+ }
+
+ pub struct ptrace_thread_state {
+ pub pts_tid: ::pid_t,
+ }
}
impl siginfo_t {
@@ -1428,6 +1438,11 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1_usize << _MAX_PAGE_SHIFT;
pub const MINSIGSTKSZ: ::size_t = 3_usize << _MAX_PAGE_SHIFT;
pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + (1_usize << _MAX_PAGE_SHIFT) * 4;
+pub const PT_SET_EVENT_MASK: ::c_int = 12;
+pub const PT_GET_EVENT_MASK: ::c_int = 13;
+pub const PT_GET_PROCESS_STATE: ::c_int = 14;
+pub const PT_GET_THREAD_FIRST: ::c_int = 15;
+pub const PT_GET_THREAD_NEXT: ::c_int = 16;
pub const PT_FIRSTMACH: ::c_int = 32;
pub const SOCK_CLOEXEC: ::c_int = 0x8000;
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
index 8d5852f18c..f3bed42b51 100644
--- a/src/unix/linux_like/linux/arch/generic/mod.rs
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -112,14 +112,14 @@ cfg_if! {
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
-pub const TIOCMGET: ::c_ulong = 0x5415;
-pub const TIOCMBIS: ::c_ulong = 0x5416;
-pub const TIOCMBIC: ::c_ulong = 0x5417;
-pub const TIOCMSET: ::c_ulong = 0x5418;
-pub const TCGETS2: ::c_ulong = 0x802c542a;
-pub const TCSETS2: ::c_ulong = 0x402c542b;
-pub const TCSETSW2: ::c_ulong = 0x402c542c;
-pub const TCSETSF2: ::c_ulong = 0x402c542d;
+pub const TIOCMGET: ::Ioctl = 0x5415;
+pub const TIOCMBIS: ::Ioctl = 0x5416;
+pub const TIOCMBIC: ::Ioctl = 0x5417;
+pub const TIOCMSET: ::Ioctl = 0x5418;
+pub const TCGETS2: ::Ioctl = 0x802c542a;
+pub const TCSETS2: ::Ioctl = 0x402c542b;
+pub const TCSETSW2: ::Ioctl = 0x402c542c;
+pub const TCSETSF2: ::Ioctl = 0x402c542d;
pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs
index 126618ab16..1b327687bc 100644
--- a/src/unix/linux_like/linux/arch/mips/mod.rs
+++ b/src/unix/linux_like/linux/arch/mips/mod.rs
@@ -108,14 +108,14 @@ pub const SO_TIMESTAMPING: ::c_int = 37;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
-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 TCGETS2: ::c_ulong = 0x4030542a;
-pub const TCSETS2: ::c_ulong = 0x8030542b;
-pub const TCSETSW2: ::c_ulong = 0x8030542c;
-pub const TCSETSF2: ::c_ulong = 0x8030542d;
+pub const TIOCMGET: ::Ioctl = 0x741d;
+pub const TIOCMBIS: ::Ioctl = 0x741b;
+pub const TIOCMBIC: ::Ioctl = 0x741c;
+pub const TIOCMSET: ::Ioctl = 0x741a;
+pub const TCGETS2: ::Ioctl = 0x4030542a;
+pub const TCSETS2: ::Ioctl = 0x8030542b;
+pub const TCSETSW2: ::Ioctl = 0x8030542c;
+pub const TCSETSF2: ::Ioctl = 0x8030542d;
pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs
index 1b492c362d..b56121cd1b 100644
--- a/src/unix/linux_like/linux/arch/powerpc/mod.rs
+++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs
@@ -90,10 +90,10 @@ pub const SO_BINDTOIFINDEX: ::c_int = 62;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
-pub const TIOCMGET: ::c_int = 0x5415;
-pub const TIOCMBIS: ::c_int = 0x5416;
-pub const TIOCMBIC: ::c_int = 0x5417;
-pub const TIOCMSET: ::c_int = 0x5418;
+pub const TIOCMGET: ::Ioctl = 0x5415;
+pub const TIOCMBIS: ::Ioctl = 0x5416;
+pub const TIOCMBIC: ::Ioctl = 0x5417;
+pub const TIOCMSET: ::Ioctl = 0x5418;
pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs
index 36db21b061..1d384c83cb 100644
--- a/src/unix/linux_like/linux/arch/sparc/mod.rs
+++ b/src/unix/linux_like/linux/arch/sparc/mod.rs
@@ -100,14 +100,14 @@ pub const SO_TIMESTAMPING: ::c_int = 0x0023;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
-pub const TIOCMGET: ::c_ulong = 0x4004746a;
-pub const TIOCMBIS: ::c_ulong = 0x8004746c;
-pub const TIOCMBIC: ::c_ulong = 0x8004746b;
-pub const TIOCMSET: ::c_ulong = 0x8004746d;
-pub const TCGETS2: ::c_ulong = 0x402c540c;
-pub const TCSETS2: ::c_ulong = 0x802c540d;
-pub const TCSETSW2: ::c_ulong = 0x802c540e;
-pub const TCSETSF2: ::c_ulong = 0x802c540f;
+pub const TIOCMGET: ::Ioctl = 0x4004746a;
+pub const TIOCMBIS: ::Ioctl = 0x8004746c;
+pub const TIOCMBIC: ::Ioctl = 0x8004746b;
+pub const TIOCMSET: ::Ioctl = 0x8004746d;
+pub const TCGETS2: ::Ioctl = 0x402c540c;
+pub const TCSETS2: ::Ioctl = 0x802c540d;
+pub const TCSETSW2: ::Ioctl = 0x802c540e;
+pub const TCSETSF2: ::Ioctl = 0x802c540f;
pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index c459c6eb82..69f1e01440 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -4,6 +4,16 @@ pub type __rlimit_resource_t = ::c_uint;
pub type Lmid_t = ::c_long;
pub type regoff_t = ::c_int;
+cfg_if! {
+ if #[cfg(doc)] {
+ // Used in `linux::arch` to define ioctl constants.
+ pub(crate) type Ioctl = ::c_ulong;
+ } else {
+ #[doc(hidden)]
+ pub type Ioctl = ::c_ulong;
+ }
+}
+
s! {
pub struct statx {
pub stx_mask: u32,
diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs
index cfcdaaecf4..7261b95d2d 100644
--- a/src/unix/linux_like/linux/musl/b64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/mod.rs
@@ -163,6 +163,9 @@ cfg_if! {
} else if #[cfg(any(target_arch = "x86_64"))] {
mod x86_64;
pub use self::x86_64::*;
+ } else if #[cfg(any(target_arch = "riscv64"))] {
+ mod riscv64;
+ pub use self::riscv64::*;
} else {
// Unknown target_arch
}
diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
new file mode 100644
index 0000000000..48fee4e638
--- /dev/null
+++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
@@ -0,0 +1,736 @@
+//! RISC-V-specific definitions for 64-bit linux-like values
+
+pub type c_char = u8;
+pub type wchar_t = ::c_int;
+
+pub type nlink_t = ::c_uint;
+pub type blksize_t = ::c_int;
+pub type fsblkcnt64_t = ::c_ulong;
+pub type fsfilcnt64_t = ::c_ulong;
+pub type __u64 = ::c_ulonglong;
+
+s! {
+ pub struct pthread_attr_t {
+ __size: [::c_ulong; 7],
+ }
+
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub __pad1: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
+ pub __pad2: ::c_int,
+ pub st_blocks: ::blkcnt_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
+ __unused: [::c_int; 2usize],
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino64_t,
+ pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub __pad1: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::blksize_t,
+ pub __pad2: ::c_int,
+ pub st_blocks: ::blkcnt_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
+ __unused: [::c_int; 2],
+ }
+
+ pub struct statfs {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ 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_fsid: ::fsid_t,
+ pub f_namelen: ::c_long,
+ pub f_frsize: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 4],
+ }
+
+ pub struct statfs64 {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ 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_long,
+ pub f_frsize: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 4],
+ }
+
+ 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,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ pub __f_spare: [::c_int; 6],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt64_t,
+ pub f_bfree: ::fsblkcnt64_t,
+ pub f_bavail: ::fsblkcnt64_t,
+ pub f_files: ::fsfilcnt64_t,
+ pub f_ffree: ::fsfilcnt64_t,
+ pub f_favail: ::fsfilcnt64_t,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ pub __f_spare: [::c_int; 6],
+ }
+
+ pub struct siginfo_t {
+ pub si_signo: ::c_int,
+ pub si_errno: ::c_int,
+ pub si_code: ::c_int,
+ #[doc(hidden)]
+ #[deprecated(
+ since="0.2.54",
+ note="Please leave a comment on \
+ https://github.com/rust-lang/libc/pull/1316 if you're using \
+ this field"
+ )]
+ pub _pad: [::c_int; 29],
+ _align: [u64; 0],
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t,
+ }
+
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: ::sigset_t,
+ pub sa_flags: ::c_int,
+ pub sa_restorer: ::Option<unsafe extern "C" fn()>,
+ }
+
+ pub struct ipc_perm {
+ pub __key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::c_ushort,
+ __pad1: ::c_ushort,
+ pub __seq: ::c_ushort,
+ __pad2: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong,
+ }
+
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ __unused5: ::c_ulong,
+ __unused6: ::c_ulong,
+ }
+
+ pub struct flock {
+ pub l_type: ::c_short,
+ pub l_whence: ::c_short,
+ pub l_start: ::off_t,
+ pub l_len: ::off_t,
+ pub l_pid: ::pid_t,
+ }
+
+ pub struct flock64 {
+ pub l_type: ::c_short,
+ pub l_whence: ::c_short,
+ pub l_start: ::off64_t,
+ pub l_len: ::off64_t,
+ pub l_pid: ::pid_t,
+ }
+}
+
+pub const SYS_read: ::c_long = 63;
+pub const SYS_write: ::c_long = 64;
+pub const SYS_close: ::c_long = 57;
+pub const SYS_fstat: ::c_long = 80;
+pub const SYS_lseek: ::c_long = 62;
+pub const SYS_mmap: ::c_long = 222;
+pub const SYS_mprotect: ::c_long = 226;
+pub const SYS_munmap: ::c_long = 215;
+pub const SYS_brk: ::c_long = 214;
+pub const SYS_rt_sigaction: ::c_long = 134;
+pub const SYS_rt_sigprocmask: ::c_long = 135;
+pub const SYS_rt_sigreturn: ::c_long = 139;
+pub const SYS_ioctl: ::c_long = 29;
+pub const SYS_pread64: ::c_long = 67;
+pub const SYS_pwrite64: ::c_long = 68;
+pub const SYS_readv: ::c_long = 65;
+pub const SYS_writev: ::c_long = 66;
+pub const SYS_sched_yield: ::c_long = 124;
+pub const SYS_mremap: ::c_long = 216;
+pub const SYS_msync: ::c_long = 227;
+pub const SYS_mincore: ::c_long = 232;
+pub const SYS_madvise: ::c_long = 233;
+pub const SYS_shmget: ::c_long = 194;
+pub const SYS_shmat: ::c_long = 196;
+pub const SYS_shmctl: ::c_long = 195;
+pub const SYS_dup: ::c_long = 23;
+pub const SYS_nanosleep: ::c_long = 101;
+pub const SYS_getitimer: ::c_long = 102;
+pub const SYS_setitimer: ::c_long = 103;
+pub const SYS_getpid: ::c_long = 172;
+pub const SYS_sendfile: ::c_long = 71;
+pub const SYS_socket: ::c_long = 198;
+pub const SYS_connect: ::c_long = 203;
+pub const SYS_accept: ::c_long = 202;
+pub const SYS_sendto: ::c_long = 206;
+pub const SYS_recvfrom: ::c_long = 207;
+pub const SYS_sendmsg: ::c_long = 211;
+pub const SYS_recvmsg: ::c_long = 212;
+pub const SYS_shutdown: ::c_long = 210;
+pub const SYS_bind: ::c_long = 200;
+pub const SYS_listen: ::c_long = 201;
+pub const SYS_getsockname: ::c_long = 204;
+pub const SYS_getpeername: ::c_long = 205;
+pub const SYS_socketpair: ::c_long = 199;
+pub const SYS_setsockopt: ::c_long = 208;
+pub const SYS_getsockopt: ::c_long = 209;
+pub const SYS_clone: ::c_long = 220;
+pub const SYS_execve: ::c_long = 221;
+pub const SYS_exit: ::c_long = 93;
+pub const SYS_wait4: ::c_long = 260;
+pub const SYS_kill: ::c_long = 129;
+pub const SYS_uname: ::c_long = 160;
+pub const SYS_semget: ::c_long = 190;
+pub const SYS_semop: ::c_long = 193;
+pub const SYS_semctl: ::c_long = 191;
+pub const SYS_shmdt: ::c_long = 197;
+pub const SYS_msgget: ::c_long = 186;
+pub const SYS_msgsnd: ::c_long = 189;
+pub const SYS_msgrcv: ::c_long = 188;
+pub const SYS_msgctl: ::c_long = 187;
+pub const SYS_fcntl: ::c_long = 25;
+pub const SYS_flock: ::c_long = 32;
+pub const SYS_fsync: ::c_long = 82;
+pub const SYS_fdatasync: ::c_long = 83;
+pub const SYS_truncate: ::c_long = 45;
+pub const SYS_ftruncate: ::c_long = 46;
+pub const SYS_getcwd: ::c_long = 17;
+pub const SYS_chdir: ::c_long = 49;
+pub const SYS_fchdir: ::c_long = 50;
+pub const SYS_fchmod: ::c_long = 52;
+pub const SYS_fchown: ::c_long = 55;
+pub const SYS_umask: ::c_long = 166;
+pub const SYS_gettimeofday: ::c_long = 169;
+pub const SYS_getrlimit: ::c_long = 163;
+pub const SYS_getrusage: ::c_long = 165;
+pub const SYS_sysinfo: ::c_long = 179;
+pub const SYS_times: ::c_long = 153;
+pub const SYS_ptrace: ::c_long = 117;
+pub const SYS_getuid: ::c_long = 174;
+pub const SYS_syslog: ::c_long = 116;
+pub const SYS_getgid: ::c_long = 176;
+pub const SYS_setuid: ::c_long = 146;
+pub const SYS_setgid: ::c_long = 144;
+pub const SYS_geteuid: ::c_long = 175;
+pub const SYS_getegid: ::c_long = 177;
+pub const SYS_setpgid: ::c_long = 154;
+pub const SYS_getppid: ::c_long = 173;
+pub const SYS_setsid: ::c_long = 157;
+pub const SYS_setreuid: ::c_long = 145;
+pub const SYS_setregid: ::c_long = 143;
+pub const SYS_getgroups: ::c_long = 158;
+pub const SYS_setgroups: ::c_long = 159;
+pub const SYS_setresuid: ::c_long = 147;
+pub const SYS_getresuid: ::c_long = 148;
+pub const SYS_setresgid: ::c_long = 149;
+pub const SYS_getresgid: ::c_long = 150;
+pub const SYS_getpgid: ::c_long = 155;
+pub const SYS_setfsuid: ::c_long = 151;
+pub const SYS_setfsgid: ::c_long = 152;
+pub const SYS_getsid: ::c_long = 156;
+pub const SYS_capget: ::c_long = 90;
+pub const SYS_capset: ::c_long = 91;
+pub const SYS_rt_sigpending: ::c_long = 136;
+pub const SYS_rt_sigtimedwait: ::c_long = 137;
+pub const SYS_rt_sigqueueinfo: ::c_long = 138;
+pub const SYS_rt_sigsuspend: ::c_long = 133;
+pub const SYS_sigaltstack: ::c_long = 132;
+pub const SYS_personality: ::c_long = 92;
+pub const SYS_statfs: ::c_long = 43;
+pub const SYS_fstatfs: ::c_long = 44;
+pub const SYS_getpriority: ::c_long = 141;
+pub const SYS_setpriority: ::c_long = 140;
+pub const SYS_sched_setparam: ::c_long = 118;
+pub const SYS_sched_getparam: ::c_long = 121;
+pub const SYS_sched_setscheduler: ::c_long = 119;
+pub const SYS_sched_getscheduler: ::c_long = 120;
+pub const SYS_sched_get_priority_max: ::c_long = 125;
+pub const SYS_sched_get_priority_min: ::c_long = 126;
+pub const SYS_sched_rr_get_interval: ::c_long = 127;
+pub const SYS_mlock: ::c_long = 228;
+pub const SYS_munlock: ::c_long = 229;
+pub const SYS_mlockall: ::c_long = 230;
+pub const SYS_munlockall: ::c_long = 231;
+pub const SYS_vhangup: ::c_long = 58;
+pub const SYS_pivot_root: ::c_long = 41;
+pub const SYS_prctl: ::c_long = 167;
+pub const SYS_adjtimex: ::c_long = 171;
+pub const SYS_setrlimit: ::c_long = 164;
+pub const SYS_chroot: ::c_long = 51;
+pub const SYS_sync: ::c_long = 81;
+pub const SYS_acct: ::c_long = 89;
+pub const SYS_settimeofday: ::c_long = 170;
+pub const SYS_mount: ::c_long = 40;
+pub const SYS_umount2: ::c_long = 39;
+pub const SYS_swapon: ::c_long = 224;
+pub const SYS_swapoff: ::c_long = 225;
+pub const SYS_reboot: ::c_long = 142;
+pub const SYS_sethostname: ::c_long = 161;
+pub const SYS_setdomainname: ::c_long = 162;
+pub const SYS_init_module: ::c_long = 105;
+pub const SYS_delete_module: ::c_long = 106;
+pub const SYS_quotactl: ::c_long = 60;
+pub const SYS_nfsservctl: ::c_long = 42;
+pub const SYS_gettid: ::c_long = 178;
+pub const SYS_readahead: ::c_long = 213;
+pub const SYS_setxattr: ::c_long = 5;
+pub const SYS_lsetxattr: ::c_long = 6;
+pub const SYS_fsetxattr: ::c_long = 7;
+pub const SYS_getxattr: ::c_long = 8;
+pub const SYS_lgetxattr: ::c_long = 9;
+pub const SYS_fgetxattr: ::c_long = 10;
+pub const SYS_listxattr: ::c_long = 11;
+pub const SYS_llistxattr: ::c_long = 12;
+pub const SYS_flistxattr: ::c_long = 13;
+pub const SYS_removexattr: ::c_long = 14;
+pub const SYS_lremovexattr: ::c_long = 15;
+pub const SYS_fremovexattr: ::c_long = 16;
+pub const SYS_tkill: ::c_long = 130;
+pub const SYS_futex: ::c_long = 98;
+pub const SYS_sched_setaffinity: ::c_long = 122;
+pub const SYS_sched_getaffinity: ::c_long = 123;
+pub const SYS_io_setup: ::c_long = 0;
+pub const SYS_io_destroy: ::c_long = 1;
+pub const SYS_io_getevents: ::c_long = 4;
+pub const SYS_io_submit: ::c_long = 2;
+pub const SYS_io_cancel: ::c_long = 3;
+pub const SYS_lookup_dcookie: ::c_long = 18;
+pub const SYS_remap_file_pages: ::c_long = 234;
+pub const SYS_getdents64: ::c_long = 61;
+pub const SYS_set_tid_address: ::c_long = 96;
+pub const SYS_restart_syscall: ::c_long = 128;
+pub const SYS_semtimedop: ::c_long = 192;
+pub const SYS_fadvise64: ::c_long = 223;
+pub const SYS_timer_create: ::c_long = 107;
+pub const SYS_timer_settime: ::c_long = 110;
+pub const SYS_timer_gettime: ::c_long = 108;
+pub const SYS_timer_getoverrun: ::c_long = 109;
+pub const SYS_timer_delete: ::c_long = 111;
+pub const SYS_clock_settime: ::c_long = 112;
+pub const SYS_clock_gettime: ::c_long = 113;
+pub const SYS_clock_getres: ::c_long = 114;
+pub const SYS_clock_nanosleep: ::c_long = 115;
+pub const SYS_exit_group: ::c_long = 94;
+pub const SYS_epoll_ctl: ::c_long = 21;
+pub const SYS_tgkill: ::c_long = 131;
+pub const SYS_mbind: ::c_long = 235;
+pub const SYS_set_mempolicy: ::c_long = 237;
+pub const SYS_get_mempolicy: ::c_long = 236;
+pub const SYS_mq_open: ::c_long = 180;
+pub const SYS_mq_unlink: ::c_long = 181;
+pub const SYS_mq_timedsend: ::c_long = 182;
+pub const SYS_mq_timedreceive: ::c_long = 183;
+pub const SYS_mq_notify: ::c_long = 184;
+pub const SYS_mq_getsetattr: ::c_long = 185;
+pub const SYS_kexec_load: ::c_long = 104;
+pub const SYS_waitid: ::c_long = 95;
+pub const SYS_add_key: ::c_long = 217;
+pub const SYS_request_key: ::c_long = 218;
+pub const SYS_keyctl: ::c_long = 219;
+pub const SYS_ioprio_set: ::c_long = 30;
+pub const SYS_ioprio_get: ::c_long = 31;
+pub const SYS_inotify_add_watch: ::c_long = 27;
+pub const SYS_inotify_rm_watch: ::c_long = 28;
+pub const SYS_migrate_pages: ::c_long = 238;
+pub const SYS_openat: ::c_long = 56;
+pub const SYS_mkdirat: ::c_long = 34;
+pub const SYS_mknodat: ::c_long = 33;
+pub const SYS_fchownat: ::c_long = 54;
+pub const SYS_newfstatat: ::c_long = 79;
+pub const SYS_unlinkat: ::c_long = 35;
+pub const SYS_linkat: ::c_long = 37;
+pub const SYS_symlinkat: ::c_long = 36;
+pub const SYS_readlinkat: ::c_long = 78;
+pub const SYS_fchmodat: ::c_long = 53;
+pub const SYS_faccessat: ::c_long = 48;
+pub const SYS_pselect6: ::c_long = 72;
+pub const SYS_ppoll: ::c_long = 73;
+pub const SYS_unshare: ::c_long = 97;
+pub const SYS_set_robust_list: ::c_long = 99;
+pub const SYS_get_robust_list: ::c_long = 100;
+pub const SYS_splice: ::c_long = 76;
+pub const SYS_tee: ::c_long = 77;
+pub const SYS_sync_file_range: ::c_long = 84;
+pub const SYS_vmsplice: ::c_long = 75;
+pub const SYS_move_pages: ::c_long = 239;
+pub const SYS_utimensat: ::c_long = 88;
+pub const SYS_epoll_pwait: ::c_long = 22;
+pub const SYS_timerfd_create: ::c_long = 85;
+pub const SYS_fallocate: ::c_long = 47;
+pub const SYS_timerfd_settime: ::c_long = 86;
+pub const SYS_timerfd_gettime: ::c_long = 87;
+pub const SYS_accept4: ::c_long = 242;
+pub const SYS_signalfd4: ::c_long = 74;
+pub const SYS_eventfd2: ::c_long = 19;
+pub const SYS_epoll_create1: ::c_long = 20;
+pub const SYS_dup3: ::c_long = 24;
+pub const SYS_pipe2: ::c_long = 59;
+pub const SYS_inotify_init1: ::c_long = 26;
+pub const SYS_preadv: ::c_long = 69;
+pub const SYS_pwritev: ::c_long = 70;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 240;
+pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_recvmmsg: ::c_long = 243;
+pub const SYS_fanotify_init: ::c_long = 262;
+pub const SYS_fanotify_mark: ::c_long = 263;
+pub const SYS_prlimit64: ::c_long = 261;
+pub const SYS_name_to_handle_at: ::c_long = 264;
+pub const SYS_open_by_handle_at: ::c_long = 265;
+pub const SYS_clock_adjtime: ::c_long = 266;
+pub const SYS_syncfs: ::c_long = 267;
+pub const SYS_sendmmsg: ::c_long = 269;
+pub const SYS_setns: ::c_long = 268;
+pub const SYS_getcpu: ::c_long = 168;
+pub const SYS_process_vm_readv: ::c_long = 270;
+pub const SYS_process_vm_writev: ::c_long = 271;
+pub const SYS_kcmp: ::c_long = 272;
+pub const SYS_finit_module: ::c_long = 273;
+pub const SYS_sched_setattr: ::c_long = 274;
+pub const SYS_sched_getattr: ::c_long = 275;
+pub const SYS_renameat2: ::c_long = 276;
+pub const SYS_seccomp: ::c_long = 277;
+pub const SYS_getrandom: ::c_long = 278;
+pub const SYS_memfd_create: ::c_long = 279;
+pub const SYS_bpf: ::c_long = 280;
+pub const SYS_execveat: ::c_long = 281;
+pub const SYS_userfaultfd: ::c_long = 282;
+pub const SYS_membarrier: ::c_long = 283;
+pub const SYS_mlock2: ::c_long = 284;
+pub const SYS_copy_file_range: ::c_long = 285;
+pub const SYS_preadv2: ::c_long = 286;
+pub const SYS_pwritev2: ::c_long = 287;
+pub const SYS_pkey_mprotect: ::c_long = 288;
+pub const SYS_pkey_alloc: ::c_long = 289;
+pub const SYS_pkey_free: ::c_long = 290;
+pub const SYS_statx: ::c_long = 291;
+
+pub const O_APPEND: ::c_int = 1024;
+pub const O_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_LARGEFILE: ::c_int = 0;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_CREAT: ::c_int = 64;
+pub const O_EXCL: ::c_int = 128;
+pub const O_NOCTTY: ::c_int = 256;
+pub const O_NONBLOCK: ::c_int = 2048;
+pub const O_SYNC: ::c_int = 1052672;
+pub const O_RSYNC: ::c_int = 1052672;
+pub const O_DSYNC: ::c_int = 4096;
+pub const O_ASYNC: ::c_int = 0x2000;
+
+pub const TIOCGRS485: ::c_int = 0x542E;
+pub const TIOCSRS485: ::c_int = 0x542F;
+
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+
+pub const ENAMETOOLONG: ::c_int = 36;
+pub const ENOLCK: ::c_int = 37;
+pub const ENOSYS: ::c_int = 38;
+pub const ENOTEMPTY: ::c_int = 39;
+pub const ELOOP: ::c_int = 40;
+pub const ENOMSG: ::c_int = 42;
+pub const EIDRM: ::c_int = 43;
+pub const ECHRNG: ::c_int = 44;
+pub const EL2NSYNC: ::c_int = 45;
+pub const EL3HLT: ::c_int = 46;
+pub const EL3RST: ::c_int = 47;
+pub const ELNRNG: ::c_int = 48;
+pub const EUNATCH: ::c_int = 49;
+pub const ENOCSI: ::c_int = 50;
+pub const EL2HLT: ::c_int = 51;
+pub const EBADE: ::c_int = 52;
+pub const EBADR: ::c_int = 53;
+pub const EXFULL: ::c_int = 54;
+pub const ENOANO: ::c_int = 55;
+pub const EBADRQC: ::c_int = 56;
+pub const EBADSLT: ::c_int = 57;
+pub const EMULTIHOP: ::c_int = 72;
+pub const EOVERFLOW: ::c_int = 75;
+pub const ENOTUNIQ: ::c_int = 76;
+pub const EBADFD: ::c_int = 77;
+pub const EBADMSG: ::c_int = 74;
+pub const EREMCHG: ::c_int = 78;
+pub const ELIBACC: ::c_int = 79;
+pub const ELIBBAD: ::c_int = 80;
+pub const ELIBSCN: ::c_int = 81;
+pub const ELIBMAX: ::c_int = 82;
+pub const ELIBEXEC: ::c_int = 83;
+pub const EILSEQ: ::c_int = 84;
+pub const ERESTART: ::c_int = 85;
+pub const ESTRPIPE: ::c_int = 86;
+pub const EUSERS: ::c_int = 87;
+pub const ENOTSOCK: ::c_int = 88;
+pub const EDESTADDRREQ: ::c_int = 89;
+pub const EMSGSIZE: ::c_int = 90;
+pub const EPROTOTYPE: ::c_int = 91;
+pub const ENOPROTOOPT: ::c_int = 92;
+pub const EPROTONOSUPPORT: ::c_int = 93;
+pub const ESOCKTNOSUPPORT: ::c_int = 94;
+pub const EOPNOTSUPP: ::c_int = 95;
+pub const EPFNOSUPPORT: ::c_int = 96;
+pub const EAFNOSUPPORT: ::c_int = 97;
+pub const EADDRINUSE: ::c_int = 98;
+pub const EADDRNOTAVAIL: ::c_int = 99;
+pub const ENETDOWN: ::c_int = 100;
+pub const ENETUNREACH: ::c_int = 101;
+pub const ENETRESET: ::c_int = 102;
+pub const ECONNABORTED: ::c_int = 103;
+pub const ECONNRESET: ::c_int = 104;
+pub const ENOBUFS: ::c_int = 105;
+pub const EISCONN: ::c_int = 106;
+pub const ENOTCONN: ::c_int = 107;
+pub const ESHUTDOWN: ::c_int = 108;
+pub const ETOOMANYREFS: ::c_int = 109;
+pub const ETIMEDOUT: ::c_int = 110;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const EHOSTDOWN: ::c_int = 112;
+pub const EHOSTUNREACH: ::c_int = 113;
+pub const EALREADY: ::c_int = 114;
+pub const EINPROGRESS: ::c_int = 115;
+pub const ESTALE: ::c_int = 116;
+pub const EDQUOT: ::c_int = 122;
+pub const ENOMEDIUM: ::c_int = 123;
+pub const EMEDIUMTYPE: ::c_int = 124;
+pub const ECANCELED: ::c_int = 125;
+pub const ENOKEY: ::c_int = 126;
+pub const EKEYEXPIRED: ::c_int = 127;
+pub const EKEYREVOKED: ::c_int = 128;
+pub const EKEYREJECTED: ::c_int = 129;
+pub const EOWNERDEAD: ::c_int = 130;
+pub const ENOTRECOVERABLE: ::c_int = 131;
+pub const EHWPOISON: ::c_int = 133;
+pub const ERFKILL: ::c_int = 132;
+
+pub const SA_ONSTACK: ::c_int = 0x08000000;
+pub const SA_SIGINFO: ::c_int = 0x00000004;
+pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
+
+pub const SIGCHLD: ::c_int = 17;
+pub const SIGBUS: ::c_int = 7;
+pub const SIGTTIN: ::c_int = 21;
+pub const SIGTTOU: ::c_int = 22;
+pub const SIGXCPU: ::c_int = 24;
+pub const SIGXFSZ: ::c_int = 25;
+pub const SIGVTALRM: ::c_int = 26;
+pub const SIGPROF: ::c_int = 27;
+pub const SIGWINCH: ::c_int = 28;
+pub const SIGUSR1: ::c_int = 10;
+pub const SIGUSR2: ::c_int = 12;
+pub const SIGCONT: ::c_int = 18;
+pub const SIGSTOP: ::c_int = 19;
+pub const SIGTSTP: ::c_int = 20;
+pub const SIGURG: ::c_int = 23;
+pub const SIGIO: ::c_int = 29;
+pub const SIGSYS: ::c_int = 31;
+pub const SIGSTKFLT: ::c_int = 16;
+pub const SIGPOLL: ::c_int = 29;
+pub const SIGPWR: ::c_int = 30;
+pub const SIG_SETMASK: ::c_int = 2;
+pub const SIG_BLOCK: ::c_int = 0x000000;
+pub const SIG_UNBLOCK: ::c_int = 0x01;
+
+pub const F_GETLK: ::c_int = 5;
+pub const F_GETOWN: ::c_int = 9;
+pub const F_SETLK: ::c_int = 6;
+pub const F_SETLKW: ::c_int = 7;
+pub const F_SETOWN: ::c_int = 8;
+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 VEOF: usize = 4;
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+
+pub const MAP_ANON: ::c_int = 0x0020;
+pub const MAP_GROWSDOWN: ::c_int = 0x0100;
+pub const MAP_DENYWRITE: ::c_int = 0x0800;
+pub const MAP_EXECUTABLE: ::c_int = 0x01000;
+pub const MAP_LOCKED: ::c_int = 0x02000;
+pub const MAP_NORESERVE: ::c_int = 0x04000;
+pub const MAP_POPULATE: ::c_int = 0x08000;
+pub const MAP_NONBLOCK: ::c_int = 0x010000;
+pub const MAP_STACK: ::c_int = 0x020000;
+pub const MAP_HUGETLB: ::c_int = 0x040000;
+pub const MAP_SYNC: ::c_int = 0x080000;
+
+pub const RLIMIT_NLIMITS: ::c_int = 15;
+pub const TIOCINQ: ::c_int = ::FIONREAD;
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const CBAUD: ::tcflag_t = 0o0010017;
+pub const TAB1: ::c_int = 0x00000800;
+pub const TAB2: ::c_int = 0x00001000;
+pub const TAB3: ::c_int = 0x00001800;
+pub const CR1: ::c_int = 0x00000200;
+pub const CR2: ::c_int = 0x00000400;
+pub const CR3: ::c_int = 0x00000600;
+pub const FF1: ::c_int = 0x00008000;
+pub const BS1: ::c_int = 0x00002000;
+pub const VT1: ::c_int = 0x00004000;
+pub const VWERASE: usize = 14;
+pub const VREPRINT: usize = 12;
+pub const VSUSP: usize = 10;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VDISCARD: usize = 13;
+pub const VTIME: usize = 5;
+pub const IXON: ::tcflag_t = 0x00000400;
+pub const IXOFF: ::tcflag_t = 0x00001000;
+pub const ONLCR: ::tcflag_t = 0x4;
+pub const CSIZE: ::tcflag_t = 0x00000030;
+pub const CS6: ::tcflag_t = 0x00000010;
+pub const CS7: ::tcflag_t = 0x00000020;
+pub const CS8: ::tcflag_t = 0x00000030;
+pub const CSTOPB: ::tcflag_t = 0x00000040;
+pub const CREAD: ::tcflag_t = 0x00000080;
+pub const PARENB: ::tcflag_t = 0x00000100;
+pub const PARODD: ::tcflag_t = 0x00000200;
+pub const HUPCL: ::tcflag_t = 0x00000400;
+pub const CLOCAL: ::tcflag_t = 0x00000800;
+pub const ECHOKE: ::tcflag_t = 0x00000800;
+pub const ECHOE: ::tcflag_t = 0x00000010;
+pub const ECHOK: ::tcflag_t = 0x00000020;
+pub const ECHONL: ::tcflag_t = 0x00000040;
+pub const ECHOPRT: ::tcflag_t = 0x00000400;
+pub const ECHOCTL: ::tcflag_t = 0x00000200;
+pub const ISIG: ::tcflag_t = 0x00000001;
+pub const ICANON: ::tcflag_t = 0x00000002;
+pub const PENDIN: ::tcflag_t = 0x00004000;
+pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+
+pub const FIOCLEX: ::c_int = 0x5451;
+pub const FIONCLEX: ::c_int = 0x5450;
+pub const FIONBIO: ::c_int = 0x5421;
+pub const EDEADLK: ::c_int = 35;
+pub const EDEADLOCK: ::c_int = EDEADLK;
+pub const EXTPROC: ::tcflag_t = 0x00010000;
+pub const VEOL: usize = 11;
+pub const VEOL2: usize = 16;
+pub const VMIN: usize = 6;
+pub const IEXTEN: ::tcflag_t = 0x00008000;
+pub const TOSTOP: ::tcflag_t = 0x00000100;
+pub const FLUSHO: ::tcflag_t = 0x00001000;
+pub const TCGETS: ::c_int = 0x5401;
+pub const TCSETS: ::c_int = 0x5402;
+pub const TCSETSW: ::c_int = 0x5403;
+pub const TCSETSF: ::c_int = 0x5404;
+pub const TCGETA: ::c_int = 0x5405;
+pub const TCSETA: ::c_int = 0x5406;
+pub const TCSETAW: ::c_int = 0x5407;
+pub const TCSETAF: ::c_int = 0x5408;
+pub const TCSBRK: ::c_int = 0x5409;
+pub const TCXONC: ::c_int = 0x540A;
+pub const TCFLSH: ::c_int = 0x540B;
+pub const TIOCGSOFTCAR: ::c_int = 0x5419;
+pub const TIOCSSOFTCAR: ::c_int = 0x541A;
+pub const TIOCLINUX: ::c_int = 0x541C;
+pub const TIOCGSERIAL: ::c_int = 0x541E;
+pub const TIOCEXCL: ::c_int = 0x540C;
+pub const TIOCNXCL: ::c_int = 0x540D;
+pub const TIOCSCTTY: ::c_int = 0x540E;
+pub const TIOCGPGRP: ::c_int = 0x540F;
+pub const TIOCSPGRP: ::c_int = 0x5410;
+pub const TIOCOUTQ: ::c_int = 0x5411;
+pub const TIOCSTI: ::c_int = 0x5412;
+pub const TIOCGWINSZ: ::c_int = 0x5413;
+pub const TIOCSWINSZ: ::c_int = 0x5414;
+pub const FIONREAD: ::c_int = 0x541B;
+pub const TIOCCONS: ::c_int = 0x541D;
+
+extern "C" {
+ pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
+}
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
index 5446477461..78b0c3e150 100644
--- a/src/unix/linux_like/linux/musl/mod.rs
+++ b/src/unix/linux_like/linux/musl/mod.rs
@@ -24,6 +24,16 @@ pub type rlim_t = ::c_ulonglong;
pub type flock64 = flock;
+cfg_if! {
+ if #[cfg(doc)] {
+ // Used in `linux::arch` to define ioctl constants.
+ pub(crate) type Ioctl = ::c_int;
+ } else {
+ #[doc(hidden)]
+ pub type Ioctl = ::c_int;
+ }
+}
+
impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut ::c_void {
#[repr(C)]
@@ -767,7 +777,8 @@ cfg_if! {
target_arch = "aarch64",
target_arch = "mips64",
target_arch = "powerpc64",
- target_arch = "s390x"))] {
+ target_arch = "s390x",
+ target_arch = "riscv64"))] {
mod b64;
pub use self::b64::*;
} else if #[cfg(any(target_arch = "x86",
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
index b71422bc18..8191c8babd 100644
--- a/src/unix/linux_like/linux/uclibc/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -5,6 +5,16 @@ pub type regoff_t = ::c_int;
pub type __rlimit_resource_t = ::c_uint;
pub type __priority_which_t = ::c_uint;
+cfg_if! {
+ if #[cfg(doc)] {
+ // Used in `linux::arch` to define ioctl constants.
+ pub(crate) type Ioctl = ::c_int;
+ } else {
+ #[doc(hidden)]
+ pub type Ioctl = ::c_int;
+ }
+}
+
s! {
pub struct statvfs { // Different than GNU!
pub f_bsize: ::c_ulong,