aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/bsd')
-rw-r--r--libc/src/unix/bsd/apple/b32.rs4
-rw-r--r--libc/src/unix/bsd/apple/b64.rs4
-rw-r--r--libc/src/unix/bsd/apple/mod.rs545
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs148
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs4
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/arm.rs4
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs214
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs30
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs207
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs32
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/mod.rs374
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs4
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/x86.rs4
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs26
-rw-r--r--libc/src/unix/bsd/freebsdlike/mod.rs27
-rw-r--r--libc/src/unix/bsd/mod.rs22
-rw-r--r--libc/src/unix/bsd/netbsdlike/mod.rs11
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/mod.rs154
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs)0
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsd/mod.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs)608
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsd/x86.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs)0
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs (renamed from libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs)0
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs497
23 files changed, 1697 insertions, 1222 deletions
diff --git a/libc/src/unix/bsd/apple/b32.rs b/libc/src/unix/bsd/apple/b32.rs
index 13b1a0b..859809d 100644
--- a/libc/src/unix/bsd/apple/b32.rs
+++ b/libc/src/unix/bsd/apple/b32.rs
@@ -39,8 +39,8 @@ s! {
pub struct bpf_hdr {
pub bh_tstamp: ::timeval,
- pub bh_caplen: ::uint32_t,
- pub bh_datalen: ::uint32_t,
+ pub bh_caplen: u32,
+ pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
}
diff --git a/libc/src/unix/bsd/apple/b64.rs b/libc/src/unix/bsd/apple/b64.rs
index 50b48fa..7b89fc6 100644
--- a/libc/src/unix/bsd/apple/b64.rs
+++ b/libc/src/unix/bsd/apple/b64.rs
@@ -44,8 +44,8 @@ s! {
pub struct bpf_hdr {
pub bh_tstamp: ::timeval32,
- pub bh_caplen: ::uint32_t,
- pub bh_datalen: ::uint32_t,
+ pub bh_caplen: u32,
+ pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
}
diff --git a/libc/src/unix/bsd/apple/mod.rs b/libc/src/unix/bsd/apple/mod.rs
index 9483e90..af28dba 100644
--- a/libc/src/unix/bsd/apple/mod.rs
+++ b/libc/src/unix/bsd/apple/mod.rs
@@ -11,7 +11,6 @@ pub type mode_t = u16;
pub type nlink_t = u16;
pub type blksize_t = i32;
pub type rlim_t = u64;
-pub type mach_timebase_info_data_t = mach_timebase_info;
pub type pthread_key_t = c_ulong;
pub type sigset_t = u32;
pub type clockid_t = ::c_uint;
@@ -26,12 +25,17 @@ pub type idtype_t = ::c_uint;
pub type integer_t = ::c_int;
pub type cpu_type_t = integer_t;
pub type cpu_subtype_t = integer_t;
-pub type vm_prot_t = ::c_int;
+
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
pub type key_t = ::c_int;
pub type shmatt_t = ::c_ushort;
-pub type vm_size_t = ::uintptr_t;
+
+deprecated_mach! {
+ pub type vm_prot_t = ::c_int;
+ pub type vm_size_t = ::uintptr_t;
+ pub type mach_timebase_info_data_t = mach_timebase_info;
+}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
@@ -83,6 +87,10 @@ s! {
pub ai_next: *mut addrinfo,
}
+ #[deprecated(
+ since = "0.2.55",
+ note = "Use the `mach` crate instead",
+ )]
pub struct mach_timebase_info {
pub numer: u32,
pub denom: u32,
@@ -107,10 +115,10 @@ s! {
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: blksize_t,
- pub st_flags: ::uint32_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
- pub st_qspare: [::int64_t; 2],
+ pub st_flags: u32,
+ pub st_gen: u32,
+ pub st_lspare: i32,
+ pub st_qspare: [i64; 2],
}
pub struct pthread_mutexattr_t {
@@ -195,26 +203,26 @@ s! {
}
pub struct kevent64_s {
- pub ident: ::uint64_t,
- pub filter: ::int16_t,
- pub flags: ::uint16_t,
- pub fflags: ::uint32_t,
- pub data: ::int64_t,
- pub udata: ::uint64_t,
- pub ext: [::uint64_t; 2],
+ pub ident: u64,
+ pub filter: i16,
+ pub flags: u16,
+ pub fflags: u32,
+ pub data: i64,
+ pub udata: u64,
+ pub ext: [u64; 2],
}
pub struct dqblk {
- pub dqb_bhardlimit: ::uint64_t,
- pub dqb_bsoftlimit: ::uint64_t,
- pub dqb_curbytes: ::uint64_t,
- pub dqb_ihardlimit: ::uint32_t,
- pub dqb_isoftlimit: ::uint32_t,
- pub dqb_curinodes: ::uint32_t,
- pub dqb_btime: ::uint32_t,
- pub dqb_itime: ::uint32_t,
- pub dqb_id: ::uint32_t,
- pub dqb_spare: [::uint32_t; 4],
+ pub dqb_bhardlimit: u64,
+ pub dqb_bsoftlimit: u64,
+ pub dqb_curbytes: u64,
+ pub dqb_ihardlimit: u32,
+ pub dqb_isoftlimit: u32,
+ pub dqb_curinodes: u32,
+ pub dqb_btime: u32,
+ pub dqb_itime: u32,
+ pub dqb_id: u32,
+ pub dqb_spare: [u32; 4],
}
pub struct if_msghdr {
@@ -353,6 +361,10 @@ s! {
pub cr_groups: [::gid_t;16]
}
+ #[deprecated(
+ since = "0.2.55",
+ note = "Use the `mach` crate instead",
+ )]
pub struct mach_header {
pub magic: u32,
pub cputype: cpu_type_t,
@@ -363,6 +375,10 @@ s! {
pub flags: u32,
}
+ #[deprecated(
+ since = "0.2.55",
+ note = "Use the `mach` crate instead",
+ )]
pub struct mach_header_64 {
pub magic: u32,
pub cputype: cpu_type_t,
@@ -431,10 +447,10 @@ s! {
pub struct sockaddr_ctl {
pub sc_len: ::c_uchar,
pub sc_family: ::c_uchar,
- pub ss_sysaddr: ::uint16_t,
- pub sc_id: ::uint32_t,
- pub sc_unit: ::uint32_t,
- pub sc_reserved: [::uint32_t; 5],
+ pub ss_sysaddr: u16,
+ pub sc_id: u32,
+ pub sc_unit: u32,
+ pub sc_reserved: [u32; 5],
}
pub struct in_pktinfo {
@@ -487,9 +503,9 @@ s_no_extra_traits!{
#[cfg_attr(libc_packedN, repr(packed(4)))]
pub struct kevent {
pub ident: ::uintptr_t,
- pub filter: ::int16_t,
- pub flags: ::uint16_t,
- pub fflags: ::uint32_t,
+ pub filter: i16,
+ pub flags: u16,
+ pub fflags: u32,
pub data: ::intptr_t,
pub udata: *mut ::c_void,
}
@@ -498,13 +514,13 @@ s_no_extra_traits!{
pub struct semid_ds {
// Note the manpage shows different types than the system header.
pub sem_perm: ipc_perm,
- pub sem_base: ::int32_t,
+ pub sem_base: i32,
pub sem_nsems: ::c_ushort,
pub sem_otime: ::time_t,
- pub sem_pad1: ::int32_t,
+ pub sem_pad1: i32,
pub sem_ctime: ::time_t,
- pub sem_pad2: ::int32_t,
- pub sem_pad3: [::int32_t; 4],
+ pub sem_pad2: i32,
+ pub sem_pad3: [i32; 4],
}
#[cfg_attr(libc_packedN, repr(packed(4)))]
@@ -536,22 +552,22 @@ s_no_extra_traits!{
}
pub struct statfs {
- pub f_bsize: ::uint32_t,
- pub f_iosize: ::int32_t,
- pub f_blocks: ::uint64_t,
- pub f_bfree: ::uint64_t,
- pub f_bavail: ::uint64_t,
- pub f_files: ::uint64_t,
- pub f_ffree: ::uint64_t,
+ pub f_bsize: u32,
+ pub f_iosize: i32,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
pub f_fsid: ::fsid_t,
pub f_owner: ::uid_t,
- pub f_type: ::uint32_t,
- pub f_flags: ::uint32_t,
- pub f_fssubtype: ::uint32_t,
+ pub f_type: u32,
+ pub f_flags: u32,
+ pub f_fssubtype: u32,
pub f_fstypename: [::c_char; 16],
pub f_mntonname: [::c_char; 1024],
pub f_mntfromname: [::c_char; 1024],
- pub f_reserved: [::uint32_t; 8],
+ pub f_reserved: [u32; 8],
}
pub struct dirent {
@@ -594,7 +610,7 @@ s_no_extra_traits!{
pub ut_type: ::c_short,
pub ut_tv: ::timeval,
pub ut_host: [::c_char; _UTX_HOSTSIZE],
- ut_pad: [::uint32_t; 16],
+ ut_pad: [u32; 16],
}
}
@@ -1361,103 +1377,106 @@ pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_ANON: ::c_int = 0x1000;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
-pub const VM_FLAGS_FIXED: ::c_int = 0x0000;
-pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001;
-pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002;
-pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008;
-pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010;
-pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020;
-pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040;
-pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000;
-pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000;
-pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000;
-pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000;
-pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000;
-pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f;
-pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f;
-pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE |
- VM_FLAGS_RANDOM_ADDR |
- VM_FLAGS_OVERWRITE |
- VM_FLAGS_RETURN_DATA_ADDR |
- VM_FLAGS_RESILIENT_CODESIGN;
-
-pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16;
-pub const SUPERPAGE_NONE: ::c_int = 0;
-pub const SUPERPAGE_SIZE_ANY: ::c_int = 1;
-pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE <<
- VM_FLAGS_SUPERPAGE_SHIFT;
-pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY <<
+deprecated_mach! {
+ pub const VM_FLAGS_FIXED: ::c_int = 0x0000;
+ pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001;
+ pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002;
+ pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008;
+ pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010;
+ pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020;
+ pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040;
+ pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000;
+ pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000;
+ pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000;
+ pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000;
+ pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000;
+ pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f;
+ pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f;
+ pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED |
+ VM_FLAGS_ANYWHERE |
+ VM_FLAGS_RANDOM_ADDR |
+ VM_FLAGS_OVERWRITE |
+ VM_FLAGS_RETURN_DATA_ADDR |
+ VM_FLAGS_RESILIENT_CODESIGN;
+
+ pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16;
+ pub const SUPERPAGE_NONE: ::c_int = 0;
+ pub const SUPERPAGE_SIZE_ANY: ::c_int = 1;
+ pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE <<
VM_FLAGS_SUPERPAGE_SHIFT;
-pub const SUPERPAGE_SIZE_2MB: ::c_int = 2;
-pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB <<
- VM_FLAGS_SUPERPAGE_SHIFT;
-
-pub const VM_MEMORY_MALLOC: ::c_int = 1;
-pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2;
-pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3;
-pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4;
-pub const VM_MEMORY_SBRK: ::c_int = 5;
-pub const VM_MEMORY_REALLOC: ::c_int = 6;
-pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7;
-pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8;
-pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9;
-pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10;
-pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11;
-pub const VM_MEMORY_MACH_MSG: ::c_int = 20;
-pub const VM_MEMORY_IOKIT: ::c_int = 21;
-pub const VM_MEMORY_STACK: ::c_int = 30;
-pub const VM_MEMORY_GUARD: ::c_int = 31;
-pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32;
-pub const VM_MEMORY_DYLIB: ::c_int = 33;
-pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34;
-pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35;
-pub const VM_MEMORY_APPKIT: ::c_int = 40;
-pub const VM_MEMORY_FOUNDATION: ::c_int = 41;
-pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42;
-pub const VM_MEMORY_CORESERVICES: ::c_int = 43;
-pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES;
-pub const VM_MEMORY_JAVA: ::c_int = 44;
-pub const VM_MEMORY_COREDATA: ::c_int = 45;
-pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46;
-pub const VM_MEMORY_ATS: ::c_int = 50;
-pub const VM_MEMORY_LAYERKIT: ::c_int = 51;
-pub const VM_MEMORY_CGIMAGE: ::c_int = 52;
-pub const VM_MEMORY_TCMALLOC: ::c_int = 53;
-pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54;
-pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55;
-pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56;
-pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57;
-pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58;
-pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS;
-pub const VM_MEMORY_DYLD: ::c_int = 60;
-pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61;
-pub const VM_MEMORY_SQLITE: ::c_int = 62;
-pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63;
-pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64;
-pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65;
-pub const VM_MEMORY_GLSL: ::c_int = 66;
-pub const VM_MEMORY_OPENCL: ::c_int = 67;
-pub const VM_MEMORY_COREIMAGE: ::c_int = 68;
-pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69;
-pub const VM_MEMORY_IMAGEIO: ::c_int = 70;
-pub const VM_MEMORY_COREPROFILE: ::c_int = 71;
-pub const VM_MEMORY_ASSETSD: ::c_int = 72;
-pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73;
-pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74;
-pub const VM_MEMORY_ACCELERATE: ::c_int = 75;
-pub const VM_MEMORY_COREUI: ::c_int = 76;
-pub const VM_MEMORY_COREUIFILE: ::c_int = 77;
-pub const VM_MEMORY_GENEALOGY: ::c_int = 78;
-pub const VM_MEMORY_RAWCAMERA: ::c_int = 79;
-pub const VM_MEMORY_CORPSEINFO: ::c_int = 80;
-pub const VM_MEMORY_ASL: ::c_int = 81;
-pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82;
-pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83;
-pub const VM_MEMORY_DHMM: ::c_int = 84;
-pub const VM_MEMORY_SCENEKIT: ::c_int = 86;
-pub const VM_MEMORY_SKYWALK: ::c_int = 87;
-pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240;
-pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255;
+ pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY <<
+ VM_FLAGS_SUPERPAGE_SHIFT;
+ pub const SUPERPAGE_SIZE_2MB: ::c_int = 2;
+ pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB <<
+ VM_FLAGS_SUPERPAGE_SHIFT;
+
+ pub const VM_MEMORY_MALLOC: ::c_int = 1;
+ pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2;
+ pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3;
+ pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4;
+ pub const VM_MEMORY_SBRK: ::c_int = 5;
+ pub const VM_MEMORY_REALLOC: ::c_int = 6;
+ pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7;
+ pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8;
+ pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9;
+ pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10;
+ pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11;
+ pub const VM_MEMORY_MACH_MSG: ::c_int = 20;
+ pub const VM_MEMORY_IOKIT: ::c_int = 21;
+ pub const VM_MEMORY_STACK: ::c_int = 30;
+ pub const VM_MEMORY_GUARD: ::c_int = 31;
+ pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32;
+ pub const VM_MEMORY_DYLIB: ::c_int = 33;
+ pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34;
+ pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35;
+ pub const VM_MEMORY_APPKIT: ::c_int = 40;
+ pub const VM_MEMORY_FOUNDATION: ::c_int = 41;
+ pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42;
+ pub const VM_MEMORY_CORESERVICES: ::c_int = 43;
+ pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES;
+ pub const VM_MEMORY_JAVA: ::c_int = 44;
+ pub const VM_MEMORY_COREDATA: ::c_int = 45;
+ pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46;
+ pub const VM_MEMORY_ATS: ::c_int = 50;
+ pub const VM_MEMORY_LAYERKIT: ::c_int = 51;
+ pub const VM_MEMORY_CGIMAGE: ::c_int = 52;
+ pub const VM_MEMORY_TCMALLOC: ::c_int = 53;
+ pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54;
+ pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55;
+ pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56;
+ pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57;
+ pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58;
+ pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS;
+ pub const VM_MEMORY_DYLD: ::c_int = 60;
+ pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61;
+ pub const VM_MEMORY_SQLITE: ::c_int = 62;
+ pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63;
+ pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64;
+ pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65;
+ pub const VM_MEMORY_GLSL: ::c_int = 66;
+ pub const VM_MEMORY_OPENCL: ::c_int = 67;
+ pub const VM_MEMORY_COREIMAGE: ::c_int = 68;
+ pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69;
+ pub const VM_MEMORY_IMAGEIO: ::c_int = 70;
+ pub const VM_MEMORY_COREPROFILE: ::c_int = 71;
+ pub const VM_MEMORY_ASSETSD: ::c_int = 72;
+ pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73;
+ pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74;
+ pub const VM_MEMORY_ACCELERATE: ::c_int = 75;
+ pub const VM_MEMORY_COREUI: ::c_int = 76;
+ pub const VM_MEMORY_COREUIFILE: ::c_int = 77;
+ pub const VM_MEMORY_GENEALOGY: ::c_int = 78;
+ pub const VM_MEMORY_RAWCAMERA: ::c_int = 79;
+ pub const VM_MEMORY_CORPSEINFO: ::c_int = 80;
+ pub const VM_MEMORY_ASL: ::c_int = 81;
+ pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82;
+ pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83;
+ pub const VM_MEMORY_DHMM: ::c_int = 84;
+ pub const VM_MEMORY_SCENEKIT: ::c_int = 86;
+ pub const VM_MEMORY_SKYWALK: ::c_int = 87;
+ pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240;
+ pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255;
+}
pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
@@ -2064,6 +2083,11 @@ pub const AF_NETBIOS: ::c_int = 33;
pub const AF_PPP: ::c_int = 34;
pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const AF_MAX: ::c_int = 40;
pub const AF_SYS_CONTROL: ::c_int = 2;
@@ -2106,15 +2130,28 @@ pub const PF_SYSTEM: ::c_int = AF_SYSTEM;
pub const PF_NETBIOS: ::c_int = AF_NETBIOS;
pub const PF_PPP: ::c_int = AF_PPP;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const PF_MAX: ::c_int = AF_MAX;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const NET_MAXID: ::c_int = AF_MAX;
pub const NET_RT_DUMP: ::c_int = 1;
pub const NET_RT_FLAGS: ::c_int = 2;
pub const NET_RT_IFLIST: ::c_int = 3;
#[doc(hidden)]
+#[deprecated(since = "0.2.55")]
pub const NET_RT_MAXID: ::c_int = 10;
pub const SOMAXCONN: ::c_int = 128;
@@ -2372,109 +2409,111 @@ pub const FD_SETSIZE: usize = 1024;
pub const ST_NOSUID: ::c_ulong = 2;
-pub const EVFILT_READ: ::int16_t = -1;
-pub const EVFILT_WRITE: ::int16_t = -2;
-pub const EVFILT_AIO: ::int16_t = -3;
-pub const EVFILT_VNODE: ::int16_t = -4;
-pub const EVFILT_PROC: ::int16_t = -5;
-pub const EVFILT_SIGNAL: ::int16_t = -6;
-pub const EVFILT_TIMER: ::int16_t = -7;
-pub const EVFILT_MACHPORT: ::int16_t = -8;
-pub const EVFILT_FS: ::int16_t = -9;
-pub const EVFILT_USER: ::int16_t = -10;
-pub const EVFILT_VM: ::int16_t = -12;
-
-pub const EV_ADD: ::uint16_t = 0x1;
-pub const EV_DELETE: ::uint16_t = 0x2;
-pub const EV_ENABLE: ::uint16_t = 0x4;
-pub const EV_DISABLE: ::uint16_t = 0x8;
-pub const EV_ONESHOT: ::uint16_t = 0x10;
-pub const EV_CLEAR: ::uint16_t = 0x20;
-pub const EV_RECEIPT: ::uint16_t = 0x40;
-pub const EV_DISPATCH: ::uint16_t = 0x80;
-pub const EV_FLAG0: ::uint16_t = 0x1000;
-pub const EV_POLL: ::uint16_t = 0x1000;
-pub const EV_FLAG1: ::uint16_t = 0x2000;
-pub const EV_OOBAND: ::uint16_t = 0x2000;
-pub const EV_ERROR: ::uint16_t = 0x4000;
-pub const EV_EOF: ::uint16_t = 0x8000;
-pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
-
-pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
-pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
-pub const NOTE_FFAND: ::uint32_t = 0x40000000;
-pub const NOTE_FFOR: ::uint32_t = 0x80000000;
-pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
-pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
-pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
-pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
-pub const NOTE_DELETE: ::uint32_t = 0x00000001;
-pub const NOTE_WRITE: ::uint32_t = 0x00000002;
-pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
-pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
-pub const NOTE_LINK: ::uint32_t = 0x00000010;
-pub const NOTE_RENAME: ::uint32_t = 0x00000020;
-pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
-pub const NOTE_NONE: ::uint32_t = 0x00000080;
-pub const NOTE_EXIT: ::uint32_t = 0x80000000;
-pub const NOTE_FORK: ::uint32_t = 0x40000000;
-pub const NOTE_EXEC: ::uint32_t = 0x20000000;
+pub const EVFILT_READ: i16 = -1;
+pub const EVFILT_WRITE: i16 = -2;
+pub const EVFILT_AIO: i16 = -3;
+pub const EVFILT_VNODE: i16 = -4;
+pub const EVFILT_PROC: i16 = -5;
+pub const EVFILT_SIGNAL: i16 = -6;
+pub const EVFILT_TIMER: i16 = -7;
+pub const EVFILT_MACHPORT: i16 = -8;
+pub const EVFILT_FS: i16 = -9;
+pub const EVFILT_USER: i16 = -10;
+pub const EVFILT_VM: i16 = -12;
+
+pub const EV_ADD: u16 = 0x1;
+pub const EV_DELETE: u16 = 0x2;
+pub const EV_ENABLE: u16 = 0x4;
+pub const EV_DISABLE: u16 = 0x8;
+pub const EV_ONESHOT: u16 = 0x10;
+pub const EV_CLEAR: u16 = 0x20;
+pub const EV_RECEIPT: u16 = 0x40;
+pub const EV_DISPATCH: u16 = 0x80;
+pub const EV_FLAG0: u16 = 0x1000;
+pub const EV_POLL: u16 = 0x1000;
+pub const EV_FLAG1: u16 = 0x2000;
+pub const EV_OOBAND: u16 = 0x2000;
+pub const EV_ERROR: u16 = 0x4000;
+pub const EV_EOF: u16 = 0x8000;
+pub const EV_SYSFLAGS: u16 = 0xf000;
+
+pub const NOTE_TRIGGER: u32 = 0x01000000;
+pub const NOTE_FFNOP: u32 = 0x00000000;
+pub const NOTE_FFAND: u32 = 0x40000000;
+pub const NOTE_FFOR: u32 = 0x80000000;
+pub const NOTE_FFCOPY: u32 = 0xc0000000;
+pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
+pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
+pub const NOTE_LOWAT: u32 = 0x00000001;
+pub const NOTE_DELETE: u32 = 0x00000001;
+pub const NOTE_WRITE: u32 = 0x00000002;
+pub const NOTE_EXTEND: u32 = 0x00000004;
+pub const NOTE_ATTRIB: u32 = 0x00000008;
+pub const NOTE_LINK: u32 = 0x00000010;
+pub const NOTE_RENAME: u32 = 0x00000020;
+pub const NOTE_REVOKE: u32 = 0x00000040;
+pub const NOTE_NONE: u32 = 0x00000080;
+pub const NOTE_EXIT: u32 = 0x80000000;
+pub const NOTE_FORK: u32 = 0x40000000;
+pub const NOTE_EXEC: u32 = 0x20000000;
+#[doc(hidden)]
#[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")]
-pub const NOTE_REAP: ::uint32_t = 0x10000000;
-pub const NOTE_SIGNAL: ::uint32_t = 0x08000000;
-pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000;
-pub const NOTE_EXIT_DETAIL: ::uint32_t = 0x02000000;
-pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
-pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000;
+pub const NOTE_REAP: u32 = 0x10000000;
+pub const NOTE_SIGNAL: u32 = 0x08000000;
+pub const NOTE_EXITSTATUS: u32 = 0x04000000;
+pub const NOTE_EXIT_DETAIL: u32 = 0x02000000;
+pub const NOTE_PDATAMASK: u32 = 0x000fffff;
+pub const NOTE_PCTRLMASK: u32 = 0xfff00000;
+#[doc(hidden)]
#[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")]
-pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000;
-pub const NOTE_EXIT_DETAIL_MASK: ::uint32_t = 0x00070000;
-pub const NOTE_EXIT_DECRYPTFAIL: ::uint32_t = 0x00010000;
-pub const NOTE_EXIT_MEMORY: ::uint32_t = 0x00020000;
-pub const NOTE_EXIT_CSERROR: ::uint32_t = 0x00040000;
-pub const NOTE_VM_PRESSURE: ::uint32_t = 0x80000000;
-pub const NOTE_VM_PRESSURE_TERMINATE: ::uint32_t = 0x40000000;
-pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: ::uint32_t = 0x20000000;
-pub const NOTE_VM_ERROR: ::uint32_t = 0x10000000;
-pub const NOTE_SECONDS: ::uint32_t = 0x00000001;
-pub const NOTE_USECONDS: ::uint32_t = 0x00000002;
-pub const NOTE_NSECONDS: ::uint32_t = 0x00000004;
-pub const NOTE_ABSOLUTE: ::uint32_t = 0x00000008;
-pub const NOTE_LEEWAY: ::uint32_t = 0x00000010;
-pub const NOTE_CRITICAL: ::uint32_t = 0x00000020;
-pub const NOTE_BACKGROUND: ::uint32_t = 0x00000040;
-pub const NOTE_TRACK: ::uint32_t = 0x00000001;
-pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
-pub const NOTE_CHILD: ::uint32_t = 0x00000004;
-
-pub const OCRNL: ::c_int = 0x00000010;
-pub const ONOCR: ::c_int = 0x00000020;
-pub const ONLRET: ::c_int = 0x00000040;
-pub const OFILL: ::c_int = 0x00000080;
-pub const NLDLY: ::c_int = 0x00000300;
-pub const TABDLY: ::c_int = 0x00000c04;
-pub const CRDLY: ::c_int = 0x00003000;
-pub const FFDLY: ::c_int = 0x00004000;
-pub const BSDLY: ::c_int = 0x00008000;
-pub const VTDLY: ::c_int = 0x00010000;
-pub const OFDEL: ::c_int = 0x00020000;
-
-pub const NL0: ::c_int = 0x00000000;
-pub const NL1: ::c_int = 0x00000100;
-pub const TAB0: ::c_int = 0x00000000;
-pub const TAB1: ::c_int = 0x00000400;
-pub const TAB2: ::c_int = 0x00000800;
-pub const CR0: ::c_int = 0x00000000;
-pub const CR1: ::c_int = 0x00001000;
-pub const CR2: ::c_int = 0x00002000;
-pub const CR3: ::c_int = 0x00003000;
-pub const FF0: ::c_int = 0x00000000;
-pub const FF1: ::c_int = 0x00004000;
-pub const BS0: ::c_int = 0x00000000;
-pub const BS1: ::c_int = 0x00008000;
-pub const TAB3: ::c_int = 0x00000004;
-pub const VT0: ::c_int = 0x00000000;
-pub const VT1: ::c_int = 0x00010000;
+pub const NOTE_EXIT_REPARENTED: u32 = 0x00080000;
+pub const NOTE_EXIT_DETAIL_MASK: u32 = 0x00070000;
+pub const NOTE_EXIT_DECRYPTFAIL: u32 = 0x00010000;
+pub const NOTE_EXIT_MEMORY: u32 = 0x00020000;
+pub const NOTE_EXIT_CSERROR: u32 = 0x00040000;
+pub const NOTE_VM_PRESSURE: u32 = 0x80000000;
+pub const NOTE_VM_PRESSURE_TERMINATE: u32 = 0x40000000;
+pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: u32 = 0x20000000;
+pub const NOTE_VM_ERROR: u32 = 0x10000000;
+pub const NOTE_SECONDS: u32 = 0x00000001;
+pub const NOTE_USECONDS: u32 = 0x00000002;
+pub const NOTE_NSECONDS: u32 = 0x00000004;
+pub const NOTE_ABSOLUTE: u32 = 0x00000008;
+pub const NOTE_LEEWAY: u32 = 0x00000010;
+pub const NOTE_CRITICAL: u32 = 0x00000020;
+pub const NOTE_BACKGROUND: u32 = 0x00000040;
+pub const NOTE_TRACK: u32 = 0x00000001;
+pub const NOTE_TRACKERR: u32 = 0x00000002;
+pub const NOTE_CHILD: u32 = 0x00000004;
+
+pub const OCRNL: ::tcflag_t = 0x00000010;
+pub const ONOCR: ::tcflag_t = 0x00000020;
+pub const ONLRET: ::tcflag_t = 0x00000040;
+pub const OFILL: ::tcflag_t = 0x00000080;
+pub const NLDLY: ::tcflag_t = 0x00000300;
+pub const TABDLY: ::tcflag_t = 0x00000c04;
+pub const CRDLY: ::tcflag_t = 0x00003000;
+pub const FFDLY: ::tcflag_t = 0x00004000;
+pub const BSDLY: ::tcflag_t = 0x00008000;
+pub const VTDLY: ::tcflag_t = 0x00010000;
+pub const OFDEL: ::tcflag_t = 0x00020000;
+
+pub const NL0: ::tcflag_t = 0x00000000;
+pub const NL1: ::tcflag_t = 0x00000100;
+pub const TAB0: ::tcflag_t = 0x00000000;
+pub const TAB1: ::tcflag_t = 0x00000400;
+pub const TAB2: ::tcflag_t = 0x00000800;
+pub const CR0: ::tcflag_t = 0x00000000;
+pub const CR1: ::tcflag_t = 0x00001000;
+pub const CR2: ::tcflag_t = 0x00002000;
+pub const CR3: ::tcflag_t = 0x00003000;
+pub const FF0: ::tcflag_t = 0x00000000;
+pub const FF1: ::tcflag_t = 0x00004000;
+pub const BS0: ::tcflag_t = 0x00000000;
+pub const BS1: ::tcflag_t = 0x00008000;
+pub const TAB3: ::tcflag_t = 0x00000004;
+pub const VT0: ::tcflag_t = 0x00000000;
+pub const VT1: ::tcflag_t = 0x00010000;
pub const IUTF8: ::tcflag_t = 0x00004000;
pub const CRTSCTS: ::tcflag_t = 0x00030000;
@@ -2632,8 +2671,10 @@ pub const KERN_KDSETRTCDEC: ::c_int = 15;
pub const KERN_KDGETENTROPY: ::c_int = 16;
pub const KERN_KDWRITETR: ::c_int = 17;
pub const KERN_KDWRITEMAP: ::c_int = 18;
+#[doc(hidden)]
#[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")]
pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19;
+#[doc(hidden)]
#[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")]
pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20;
pub const KERN_KDREADCURTHRMAP: ::c_int = 21;
@@ -2887,7 +2928,7 @@ pub const DLT_RAW: ::c_uint = 12; // raw IP
pub const DLT_LOOP: ::c_uint = 108;
// https://github.com/apple/darwin-xnu/blob/master/bsd/net/bpf.h#L100
-// sizeof(int32_t)
+// sizeof(i32)
pub const BPF_ALIGNMENT: ::c_int = 4;
// sys/spawn.h:
@@ -3014,11 +3055,15 @@ f! {
}
extern {
+ pub fn setgrent();
+ #[doc(hidden)]
#[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.5")]
#[link_name = "daemon$1050"]
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[doc(hidden)]
#[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")]
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
+ #[doc(hidden)]
#[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")]
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
@@ -3045,6 +3090,8 @@ extern {
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
+ pub fn gettimeofday(tp: *mut ::timeval,
+ tz: *mut ::c_void) -> ::c_int;
pub fn getutxent() -> *mut utmpx;
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
@@ -3100,7 +3147,10 @@ extern {
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
+ #[deprecated(since = "0.2.55", note = "Use the mach crate")]
pub fn mach_absolute_time() -> u64;
+ #[deprecated(since = "0.2.55", note = "Use the mach crate")]
+ #[allow(deprecated)]
pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int;
pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void;
@@ -3220,9 +3270,14 @@ extern {
pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+ #[deprecated(since = "0.2.55", note = "Use the mach crate")]
pub fn _dyld_image_count() -> u32;
+ #[deprecated(since = "0.2.55", note = "Use the mach crate")]
+ #[allow(deprecated)]
pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header;
+ #[deprecated(since = "0.2.55", note = "Use the mach crate")]
pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t;
+ #[deprecated(since = "0.2.55", note = "Use the mach crate")]
pub fn _dyld_get_image_name(image_index: u32) -> *const ::c_char;
pub fn posix_spawn(pid: *mut ::pid_t,
diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index e91b351..26faffe 100644
--- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1,3 +1,4 @@
+pub type dev_t = u32;
pub type c_char = i8;
pub type clock_t = u64;
pub type ino_t = u64;
@@ -27,6 +28,15 @@ impl ::Clone for sem {
}
s! {
+ 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 struct exit_status {
pub e_termination: u16,
pub e_exit: u16
@@ -100,7 +110,7 @@ s! {
pub st_nlink: ::nlink_t,
pub st_dev: ::dev_t,
pub st_mode: ::mode_t,
- pub st_padding1: ::uint16_t,
+ pub st_padding1: u16,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
@@ -111,13 +121,13 @@ s! {
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_size: ::off_t,
- pub st_blocks: ::int64_t,
- pub st_blksize: ::uint32_t,
- pub st_flags: ::uint32_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
- pub st_qspare1: ::int64_t,
- pub st_qspare2: ::int64_t,
+ pub st_blocks: i64,
+ pub st_blksize: u32,
+ pub st_flags: u32,
+ pub st_gen: u32,
+ pub st_lspare: i32,
+ pub st_qspare1: i64,
+ pub st_qspare2: i64,
}
pub struct if_data {
@@ -214,8 +224,8 @@ s_no_extra_traits! {
pub f_ffree: ::c_long,
pub f_fsid: ::fsid_t,
pub f_owner: ::uid_t,
- pub f_type: ::int32_t,
- pub f_flags: ::int32_t,
+ pub f_type: i32,
+ pub f_flags: i32,
pub f_syncwrites: ::c_long,
pub f_asyncwrites: ::c_long,
pub f_fstypename: [::c_char; 16],
@@ -567,55 +577,55 @@ pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
-pub const EVFILT_READ: ::int16_t = -1;
-pub const EVFILT_WRITE: ::int16_t = -2;
-pub const EVFILT_AIO: ::int16_t = -3;
-pub const EVFILT_VNODE: ::int16_t = -4;
-pub const EVFILT_PROC: ::int16_t = -5;
-pub const EVFILT_SIGNAL: ::int16_t = -6;
-pub const EVFILT_TIMER: ::int16_t = -7;
-pub const EVFILT_EXCEPT: ::int16_t = -8;
-pub const EVFILT_USER: ::int16_t = -9;
-pub const EVFILT_FS: ::int16_t = -10;
-
-pub const EV_ADD: ::uint16_t = 0x1;
-pub const EV_DELETE: ::uint16_t = 0x2;
-pub const EV_ENABLE: ::uint16_t = 0x4;
-pub const EV_DISABLE: ::uint16_t = 0x8;
-pub const EV_ONESHOT: ::uint16_t = 0x10;
-pub const EV_CLEAR: ::uint16_t = 0x20;
-pub const EV_RECEIPT: ::uint16_t = 0x40;
-pub const EV_DISPATCH: ::uint16_t = 0x80;
-pub const EV_NODATA: ::uint16_t = 0x1000;
-pub const EV_FLAG1: ::uint16_t = 0x2000;
-pub const EV_ERROR: ::uint16_t = 0x4000;
-pub const EV_EOF: ::uint16_t = 0x8000;
-pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
-
-pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
-pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
-pub const NOTE_FFAND: ::uint32_t = 0x40000000;
-pub const NOTE_FFOR: ::uint32_t = 0x80000000;
-pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
-pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
-pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
-pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
-pub const NOTE_OOB: ::uint32_t = 0x00000002;
-pub const NOTE_DELETE: ::uint32_t = 0x00000001;
-pub const NOTE_WRITE: ::uint32_t = 0x00000002;
-pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
-pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
-pub const NOTE_LINK: ::uint32_t = 0x00000010;
-pub const NOTE_RENAME: ::uint32_t = 0x00000020;
-pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
-pub const NOTE_EXIT: ::uint32_t = 0x80000000;
-pub const NOTE_FORK: ::uint32_t = 0x40000000;
-pub const NOTE_EXEC: ::uint32_t = 0x20000000;
-pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
-pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
-pub const NOTE_TRACK: ::uint32_t = 0x00000001;
-pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
-pub const NOTE_CHILD: ::uint32_t = 0x00000004;
+pub const EVFILT_READ: i16 = -1;
+pub const EVFILT_WRITE: i16 = -2;
+pub const EVFILT_AIO: i16 = -3;
+pub const EVFILT_VNODE: i16 = -4;
+pub const EVFILT_PROC: i16 = -5;
+pub const EVFILT_SIGNAL: i16 = -6;
+pub const EVFILT_TIMER: i16 = -7;
+pub const EVFILT_EXCEPT: i16 = -8;
+pub const EVFILT_USER: i16 = -9;
+pub const EVFILT_FS: i16 = -10;
+
+pub const EV_ADD: u16 = 0x1;
+pub const EV_DELETE: u16 = 0x2;
+pub const EV_ENABLE: u16 = 0x4;
+pub const EV_DISABLE: u16 = 0x8;
+pub const EV_ONESHOT: u16 = 0x10;
+pub const EV_CLEAR: u16 = 0x20;
+pub const EV_RECEIPT: u16 = 0x40;
+pub const EV_DISPATCH: u16 = 0x80;
+pub const EV_NODATA: u16 = 0x1000;
+pub const EV_FLAG1: u16 = 0x2000;
+pub const EV_ERROR: u16 = 0x4000;
+pub const EV_EOF: u16 = 0x8000;
+pub const EV_SYSFLAGS: u16 = 0xf000;
+
+pub const NOTE_TRIGGER: u32 = 0x01000000;
+pub const NOTE_FFNOP: u32 = 0x00000000;
+pub const NOTE_FFAND: u32 = 0x40000000;
+pub const NOTE_FFOR: u32 = 0x80000000;
+pub const NOTE_FFCOPY: u32 = 0xc0000000;
+pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
+pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
+pub const NOTE_LOWAT: u32 = 0x00000001;
+pub const NOTE_OOB: u32 = 0x00000002;
+pub const NOTE_DELETE: u32 = 0x00000001;
+pub const NOTE_WRITE: u32 = 0x00000002;
+pub const NOTE_EXTEND: u32 = 0x00000004;
+pub const NOTE_ATTRIB: u32 = 0x00000008;
+pub const NOTE_LINK: u32 = 0x00000010;
+pub const NOTE_RENAME: u32 = 0x00000020;
+pub const NOTE_REVOKE: u32 = 0x00000040;
+pub const NOTE_EXIT: u32 = 0x80000000;
+pub const NOTE_FORK: u32 = 0x40000000;
+pub const NOTE_EXEC: u32 = 0x20000000;
+pub const NOTE_PDATAMASK: u32 = 0x000fffff;
+pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
+pub const NOTE_TRACK: u32 = 0x00000001;
+pub const NOTE_TRACKERR: u32 = 0x00000002;
+pub const NOTE_CHILD: u32 = 0x00000004;
pub const SO_SNDSPACE: ::c_int = 0x100a;
pub const SO_CPUHINT: ::c_int = 0x1030;
@@ -881,9 +891,22 @@ pub const TCP_FASTKEEP: ::c_int = 128;
pub const AF_BLUETOOTH: ::c_int = 33;
pub const AF_MPLS: ::c_int = 34;
pub const AF_IEEE80211: ::c_int = 35;
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const AF_MAX: ::c_int = 36;
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const PF_MAX: ::c_int = AF_MAX;
pub const NET_RT_DUMP: ::c_int = 1;
@@ -894,6 +917,12 @@ pub const NET_RT_MAXID: ::c_int = 4;
pub const SOMAXOPT_SIZE: ::c_int = 65536;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const NET_MAXID: ::c_int = AF_MAX;
pub const MSG_UNUSED09: ::c_int = 0x00000200;
@@ -1008,6 +1037,7 @@ f! {
}
extern {
+ pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
index 996abc5..22fd2b8 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
@@ -23,8 +23,8 @@ s! {
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
+ pub st_gen: u32,
+ pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs b/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs
index 945aca9..b7480aa 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs
@@ -26,8 +26,8 @@ s! {
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
+ pub st_gen: u32,
+ pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_birthtime_pad: ::c_long,
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
new file mode 100644
index 0000000..7d7dc2c
--- /dev/null
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
@@ -0,0 +1,214 @@
+// APIs that had breaking changes after FreeBSD 11
+
+// The type of `nlink_t` changed from `u16` to `u64` in FreeBSD 12:
+pub type nlink_t = u16;
+// Type of `dev_t` changed from `u32` to `u64` in FreeBSD 12:
+pub type dev_t = u32;
+// Type of `ino_t` changed from `unsigned int` to `unsigned long` in FreeBSD 12:
+pub type ino_t = u32;
+
+s! {
+ 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 struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ // Type of shm_nattc changed from `int` to `shmatt_t` (aka `unsigned
+ // int`) in FreeBSD 12:
+ pub shm_nattch: ::c_int,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ }
+}
+
+s_no_extra_traits! {
+ pub struct dirent {
+ pub d_fileno: ::ino_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ // Type of `d_namlen` changed from `char` to `u16` in FreeBSD 12:
+ pub d_namlen: u8,
+ 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],
+ // Array length changed from 88 to 1024 in FreeBSD 12:
+ pub f_mntfromname: [::c_char; 88],
+ // Array length changed from 88 to 1024 in FreeBSD 12:
+ pub f_mntonname: [::c_char; 88],
+ }
+}
+
+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_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_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_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_reclen.hash(state);
+ self.d_type.hash(state);
+ self.d_namlen.hash(state);
+ self.d_name[..self.d_namlen as _].hash(state);
+ }
+ }
+ }
+}
+
+extern {
+ // Return type ::c_int was removed in FreeBSD 12
+ pub fn setgrent() -> ::c_int;
+
+ // Type of `addr` argument changed from `const void*` to `void*`
+ // in FreeBSD 12
+ pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
+ -> ::c_int;
+
+ // Return type ::c_int was removed in FreeBSD 12
+ pub fn freelocale(loc: ::locale_t) -> ::c_int;
+
+ // Return type ::c_int changed to ::ssize_t in FreeBSD 12:
+ pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
+ msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ }
+}
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs
new file mode 100644
index 0000000..bba277e
--- /dev/null
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs
@@ -0,0 +1,30 @@
+#[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_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ 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_size: ::off_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_blksize: ::blksize_t,
+ pub st_flags: ::fflags_t,
+ pub st_gen: u32,
+ pub st_lspare: i32,
+ pub st_birthtime: ::time_t,
+ pub st_birthtime_nsec: ::c_long,
+}
+
+impl ::Copy for ::stat {}
+impl ::Clone for ::stat {
+ fn clone(&self) -> ::stat { *self }
+}
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
new file mode 100644
index 0000000..ab1b8d9
--- /dev/null
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
@@ -0,0 +1,207 @@
+// APIs that changed in FreeBSD12
+
+pub type nlink_t = u64;
+pub type dev_t = u64;
+pub type ino_t = ::c_ulong;
+pub type shmatt_t = ::c_uint;
+
+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],
+ }
+}
+
+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);
+ }
+ }
+ }
+}
+
+extern {
+ 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;
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ }
+}
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs
new file mode 100644
index 0000000..dbaa4ae
--- /dev/null
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs
@@ -0,0 +1,32 @@
+#[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/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 3ce96e8..e594551 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -1,14 +1,13 @@
pub type fflags_t = u32;
pub type clock_t = i32;
-pub type ino_t = u32;
+
pub type lwpid_t = i32;
-pub type nlink_t = u16;
pub type blksize_t = i32;
pub type clockid_t = ::c_int;
pub type sem_t = _sem;
-pub type fsblkcnt_t = ::uint64_t;
-pub type fsfilcnt_t = ::uint64_t;
+pub type fsblkcnt_t = u64;
+pub type fsfilcnt_t = u64;
pub type idtype_t = ::c_uint;
pub type key_t = ::c_long;
@@ -47,14 +46,6 @@ s! {
pub ip6: *mut ::in6_addr,
}
- pub struct mq_attr {
- pub mq_flags: ::c_long,
- pub mq_maxmsg: ::c_long,
- pub mq_msgsize: ::c_long,
- pub mq_curmsgs: ::c_long,
- __reserved: [::c_long; 4]
- }
-
pub struct sigevent {
pub sigev_notify: ::c_int,
pub sigev_signo: ::c_int,
@@ -110,17 +101,6 @@ s! {
pub msg_ctime: ::time_t,
}
- 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: ::c_int,
- pub shm_atime: ::time_t,
- pub shm_dtime: ::time_t,
- pub shm_ctime: ::time_t,
- }
-
pub struct xucred {
pub cr_version: ::c_uint,
pub cr_uid: ::uid_t,
@@ -153,39 +133,6 @@ s_no_extra_traits! {
pub __ut_spare: [::c_char; 64],
}
- pub struct dirent {
- pub d_fileno: u32,
- pub d_reclen: u16,
- pub d_type: u8,
- pub d_namlen: u8,
- pub d_name: [::c_char; 256],
- }
-
- pub struct statfs {
- pub f_version: ::uint32_t,
- pub f_type: ::uint32_t,
- pub f_flags: ::uint64_t,
- pub f_bsize: ::uint64_t,
- pub f_iosize: ::uint64_t,
- pub f_blocks: ::uint64_t,
- pub f_bfree: ::uint64_t,
- pub f_bavail: ::int64_t,
- pub f_files: ::uint64_t,
- pub f_ffree: ::int64_t,
- pub f_syncwrites: ::uint64_t,
- pub f_asyncwrites: ::uint64_t,
- pub f_syncreads: ::uint64_t,
- pub f_asyncreads: ::uint64_t,
- f_spare: [::uint64_t; 10],
- pub f_namemax: ::uint32_t,
- 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; 88],
- pub f_mntonname: [::c_char; 88],
- }
-
pub struct sockaddr_dl {
pub sdl_len: ::c_uchar,
pub sdl_family: ::c_uchar,
@@ -196,6 +143,14 @@ s_no_extra_traits! {
pub sdl_slen: ::c_uchar,
pub sdl_data: [::c_char; 46],
}
+
+ pub struct mq_attr {
+ pub mq_flags: ::c_long,
+ pub mq_maxmsg: ::c_long,
+ pub mq_msgsize: ::c_long,
+ pub mq_curmsgs: ::c_long,
+ __reserved: [::c_long; 4]
+ }
}
cfg_if! {
@@ -248,132 +203,6 @@ cfg_if! {
}
}
- impl PartialEq for dirent {
- fn eq(&self, other: &dirent) -> bool {
- self.d_fileno == other.d_fileno
- && self.d_reclen == other.d_reclen
- && self.d_type == other.d_type
- && self.d_namlen == other.d_namlen
- && self
- .d_name
- .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_reclen", &self.d_reclen)
- .field("d_type", &self.d_type)
- .field("d_namlen", &self.d_namlen)
- // FIXME: .field("d_name", &self.d_name)
- .finish()
- }
- }
- impl ::hash::Hash for dirent {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.d_fileno.hash(state);
- self.d_reclen.hash(state);
- self.d_type.hash(state);
- self.d_namlen.hash(state);
- self.d_name.hash(state);
- }
- }
-
- 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_spare == other.f_spare
- && self.f_namemax == other.f_namemax
- && self.f_owner == other.f_owner
- && self.f_fsid == other.f_fsid
- && self
- .f_charspare
- .iter()
- .zip(other.f_charspare.iter())
- .all(|(a,b)| a == b)
- && 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_spare", &self.f_spare)
- .field("f_namemax", &self.f_namemax)
- .field("f_owner", &self.f_owner)
- .field("f_fsid", &self.f_fsid)
- // FIXME: .field("f_charspare", &self.f_charspare)
- .field("f_fstypename", &self.f_fstypename)
- // FIXME: .field("f_mntfromname", &self.f_mntfromname)
- // FIXME: .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_spare.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 sockaddr_dl {
fn eq(&self, other: &sockaddr_dl) -> bool {
self.sdl_len == other.sdl_len
@@ -417,6 +246,34 @@ cfg_if! {
self.sdl_data.hash(state);
}
}
+
+ impl PartialEq for mq_attr {
+ fn eq(&self, other: &mq_attr) -> bool {
+ self.mq_flags == other.mq_flags &&
+ self.mq_maxmsg == other.mq_maxmsg &&
+ self.mq_msgsize == other.mq_msgsize &&
+ self.mq_curmsgs == other.mq_curmsgs
+ }
+ }
+ impl Eq for mq_attr {}
+ impl ::fmt::Debug for mq_attr {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("mq_attr")
+ .field("mq_flags", &self.mq_flags)
+ .field("mq_maxmsg", &self.mq_maxmsg)
+ .field("mq_msgsize", &self.mq_msgsize)
+ .field("mq_curmsgs", &self.mq_curmsgs)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for mq_attr {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.mq_flags.hash(state);
+ self.mq_maxmsg.hash(state);
+ self.mq_msgsize.hash(state);
+ self.mq_curmsgs.hash(state);
+ }
+ }
}
}
@@ -465,61 +322,61 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POLLINIGNEOF: ::c_short = 0x2000;
-pub const EVFILT_READ: ::int16_t = -1;
-pub const EVFILT_WRITE: ::int16_t = -2;
-pub const EVFILT_AIO: ::int16_t = -3;
-pub const EVFILT_VNODE: ::int16_t = -4;
-pub const EVFILT_PROC: ::int16_t = -5;
-pub const EVFILT_SIGNAL: ::int16_t = -6;
-pub const EVFILT_TIMER: ::int16_t = -7;
-pub const EVFILT_PROCDESC: ::int16_t = -8;
-pub const EVFILT_FS: ::int16_t = -9;
-pub const EVFILT_LIO: ::int16_t = -10;
-pub const EVFILT_USER: ::int16_t = -11;
-pub const EVFILT_SENDFILE: ::int16_t = -12;
-pub const EVFILT_EMPTY: ::int16_t = -13;
-
-pub const EV_ADD: ::uint16_t = 0x1;
-pub const EV_DELETE: ::uint16_t = 0x2;
-pub const EV_ENABLE: ::uint16_t = 0x4;
-pub const EV_DISABLE: ::uint16_t = 0x8;
-pub const EV_ONESHOT: ::uint16_t = 0x10;
-pub const EV_CLEAR: ::uint16_t = 0x20;
-pub const EV_RECEIPT: ::uint16_t = 0x40;
-pub const EV_DISPATCH: ::uint16_t = 0x80;
-pub const EV_DROP: ::uint16_t = 0x1000;
-pub const EV_FLAG1: ::uint16_t = 0x2000;
-pub const EV_ERROR: ::uint16_t = 0x4000;
-pub const EV_EOF: ::uint16_t = 0x8000;
-pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
-
-pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
-pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
-pub const NOTE_FFAND: ::uint32_t = 0x40000000;
-pub const NOTE_FFOR: ::uint32_t = 0x80000000;
-pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
-pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
-pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
-pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
-pub const NOTE_DELETE: ::uint32_t = 0x00000001;
-pub const NOTE_WRITE: ::uint32_t = 0x00000002;
-pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
-pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
-pub const NOTE_LINK: ::uint32_t = 0x00000010;
-pub const NOTE_RENAME: ::uint32_t = 0x00000020;
-pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
-pub const NOTE_EXIT: ::uint32_t = 0x80000000;
-pub const NOTE_FORK: ::uint32_t = 0x40000000;
-pub const NOTE_EXEC: ::uint32_t = 0x20000000;
-pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
-pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
-pub const NOTE_TRACK: ::uint32_t = 0x00000001;
-pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
-pub const NOTE_CHILD: ::uint32_t = 0x00000004;
-pub const NOTE_SECONDS: ::uint32_t = 0x00000001;
-pub const NOTE_MSECONDS: ::uint32_t = 0x00000002;
-pub const NOTE_USECONDS: ::uint32_t = 0x00000004;
-pub const NOTE_NSECONDS: ::uint32_t = 0x00000008;
+pub const EVFILT_READ: i16 = -1;
+pub const EVFILT_WRITE: i16 = -2;
+pub const EVFILT_AIO: i16 = -3;
+pub const EVFILT_VNODE: i16 = -4;
+pub const EVFILT_PROC: i16 = -5;
+pub const EVFILT_SIGNAL: i16 = -6;
+pub const EVFILT_TIMER: i16 = -7;
+pub const EVFILT_PROCDESC: i16 = -8;
+pub const EVFILT_FS: i16 = -9;
+pub const EVFILT_LIO: i16 = -10;
+pub const EVFILT_USER: i16 = -11;
+pub const EVFILT_SENDFILE: i16 = -12;
+pub const EVFILT_EMPTY: i16 = -13;
+
+pub const EV_ADD: u16 = 0x1;
+pub const EV_DELETE: u16 = 0x2;
+pub const EV_ENABLE: u16 = 0x4;
+pub const EV_DISABLE: u16 = 0x8;
+pub const EV_ONESHOT: u16 = 0x10;
+pub const EV_CLEAR: u16 = 0x20;
+pub const EV_RECEIPT: u16 = 0x40;
+pub const EV_DISPATCH: u16 = 0x80;
+pub const EV_DROP: u16 = 0x1000;
+pub const EV_FLAG1: u16 = 0x2000;
+pub const EV_ERROR: u16 = 0x4000;
+pub const EV_EOF: u16 = 0x8000;
+pub const EV_SYSFLAGS: u16 = 0xf000;
+
+pub const NOTE_TRIGGER: u32 = 0x01000000;
+pub const NOTE_FFNOP: u32 = 0x00000000;
+pub const NOTE_FFAND: u32 = 0x40000000;
+pub const NOTE_FFOR: u32 = 0x80000000;
+pub const NOTE_FFCOPY: u32 = 0xc0000000;
+pub const NOTE_FFCTRLMASK: u32 = 0xc0000000;
+pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff;
+pub const NOTE_LOWAT: u32 = 0x00000001;
+pub const NOTE_DELETE: u32 = 0x00000001;
+pub const NOTE_WRITE: u32 = 0x00000002;
+pub const NOTE_EXTEND: u32 = 0x00000004;
+pub const NOTE_ATTRIB: u32 = 0x00000008;
+pub const NOTE_LINK: u32 = 0x00000010;
+pub const NOTE_RENAME: u32 = 0x00000020;
+pub const NOTE_REVOKE: u32 = 0x00000040;
+pub const NOTE_EXIT: u32 = 0x80000000;
+pub const NOTE_FORK: u32 = 0x40000000;
+pub const NOTE_EXEC: u32 = 0x20000000;
+pub const NOTE_PDATAMASK: u32 = 0x000fffff;
+pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
+pub const NOTE_TRACK: u32 = 0x00000001;
+pub const NOTE_TRACKERR: u32 = 0x00000002;
+pub const NOTE_CHILD: u32 = 0x00000004;
+pub const NOTE_SECONDS: u32 = 0x00000001;
+pub const NOTE_MSECONDS: u32 = 0x00000002;
+pub const NOTE_USECONDS: u32 = 0x00000004;
+pub const NOTE_NSECONDS: u32 = 0x00000008;
pub const MADV_PROTECT: ::c_int = 10;
pub const RUSAGE_THREAD: ::c_int = 1;
@@ -768,6 +625,11 @@ pub const AF_IEEE80211: ::c_int = 37;
pub const AF_INET_SDP: ::c_int = 40;
pub const AF_INET6_SDP: ::c_int = 42;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const AF_MAX: ::c_int = 42;
// https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140
@@ -779,14 +641,20 @@ pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link
// 0x20 was IFF_SMART
pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated
#[doc(hidden)]
-// IFF_DRV_RUNNING is deprecated. Use the portable `IFF_RUNNING` instead
+#[deprecated(
+ since="0.2.54",
+ note="IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead"
+)]
pub const IFF_DRV_RUNNING: ::c_int = 0x40;
pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets
pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full
#[doc(hidden)]
-// IFF_DRV_OACTIVE is deprecated. Use the portable `IFF_OACTIVE` instead
+#[deprecated(
+ since = "0.2.54",
+ note = "Use the portable `IFF_OACTIVE` instead",
+)]
pub const IFF_DRV_OACTIVE: ::c_int = 0x400;
pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
@@ -1070,6 +938,12 @@ pub const PF_IEEE80211: ::c_int = AF_IEEE80211;
pub const PF_INET_SDP: ::c_int = AF_INET_SDP;
pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const PF_MAX: ::c_int = AF_MAX;
pub const NET_RT_DUMP: ::c_int = 1;
@@ -1106,14 +980,20 @@ pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char;
// they were all removed in svn r262489. They remain here for backwards
// compatibility only, and are scheduled to be removed in libc 1.0.0.
#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
+#[allow(deprecated)]
pub const NET_MAXID: ::c_int = AF_MAX;
#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
pub const CTL_MAXID: ::c_int = 10;
#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
pub const KERN_MAXID: ::c_int = 38;
#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
pub const HW_MAXID: ::c_int = 13;
#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
pub const USER_MAXID: ::c_int = 21;
#[doc(hidden)]
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
@@ -1251,9 +1131,6 @@ f! {
extern {
pub fn __error() -> *mut ::c_int;
- pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
- -> ::c_int;
-
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
@@ -1335,7 +1212,6 @@ extern {
timeout: *mut ::timespec) -> ::ssize_t;
pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int;
- pub fn freelocale(loc: ::locale_t) -> ::c_int;
pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t,
options: ::c_int) -> ::c_int;
@@ -1349,8 +1225,6 @@ extern {
pub fn msgctl(msqid: ::c_int, cmd: ::c_int,
buf: *mut ::msqid_ds) -> ::c_int;
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
- pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
- msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
msgflg: ::c_int) -> ::c_int;
pub fn cfmakesane(termios: *mut ::termios);
@@ -1452,6 +1326,16 @@ extern {
}
cfg_if! {
+ if #[cfg(freebsd12)] {
+ mod freebsd12;
+ pub use self::freebsd12::*;
+ } else {
+ mod freebsd11;
+ pub use self::freebsd11::*;
+ }
+}
+
+cfg_if! {
if #[cfg(target_arch = "x86")] {
mod x86;
pub use self::x86::*;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
index 9d893b6..5c0c6e7 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
@@ -23,8 +23,8 @@ s! {
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
+ pub st_gen: u32,
+ pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs
index 845124d..adec88c 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs
@@ -23,8 +23,8 @@ s! {
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
+ pub st_gen: u32,
+ pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
__unused: [u8; 8],
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
index 323d1ab..5220cde 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
@@ -4,32 +4,6 @@ pub type c_ulong = u64;
pub type time_t = i64;
pub type suseconds_t = i64;
-s! {
- 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 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_size: ::off_t,
- pub st_blocks: ::blkcnt_t,
- pub st_blksize: ::blksize_t,
- pub st_flags: ::fflags_t,
- pub st_gen: ::uint32_t,
- pub st_lspare: ::int32_t,
- pub st_birthtime: ::time_t,
- pub st_birthtime_nsec: ::c_long,
- }
-}
-
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs
index 7a82a45..64168eb 100644
--- a/libc/src/unix/bsd/freebsdlike/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/mod.rs
@@ -1,4 +1,3 @@
-pub type dev_t = u32;
pub type mode_t = u16;
pub type pthread_attr_t = *mut ::c_void;
pub type rlim_t = i64;
@@ -46,15 +45,6 @@ s! {
__unused8: *mut ::c_void,
}
- 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 struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
@@ -758,7 +748,11 @@ pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
pub const MAP_COPY: ::c_int = 0x0002;
+#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
pub const MAP_RENAME: ::c_int = 0x0020;
+#[doc(hidden)]
+#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")]
pub const MAP_NORESERVE: ::c_int = 0x0040;
pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
pub const MAP_STACK: ::c_int = 0x0400;
@@ -1095,7 +1089,8 @@ extern {
-> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
-
+ pub fn gettimeofday(tp: *mut ::timeval,
+ tz: *mut ::timezone) -> ::c_int;
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
@@ -1140,7 +1135,10 @@ extern {
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
- #[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")]
+ #[cfg_attr(
+ all(target_os = "freebsd", not(freebsd12)),
+ link_name = "kevent@FBSD_1.0"
+ )]
pub fn kevent(kq: ::c_int,
changelist: *const ::kevent,
nchanges: ::c_int,
@@ -1156,7 +1154,10 @@ extern {
n: ::size_t) -> *mut ::c_void;
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t) -> ::c_int;
- #[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")]
+ #[cfg_attr(
+ all(target_os = "freebsd", not(freebsd12)),
+ link_name = "mknodat@FBSD_1.1"
+ )]
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, dev: dev_t) -> ::c_int;
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
diff --git a/libc/src/unix/bsd/mod.rs b/libc/src/unix/bsd/mod.rs
index 03c987d..8bc6c7c 100644
--- a/libc/src/unix/bsd/mod.rs
+++ b/libc/src/unix/bsd/mod.rs
@@ -94,7 +94,7 @@ s! {
}
pub struct fsid_t {
- __fsid_val: [::int32_t; 2],
+ __fsid_val: [i32; 2],
}
pub struct if_nameindex {
@@ -488,6 +488,15 @@ f! {
}
extern {
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "getrlimit$UNIX2003")]
+ pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "setrlimit$UNIX2003")]
+ pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
+
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
+ buflen: ::size_t) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
@@ -506,7 +515,6 @@ extern {
pub fn getpwent() -> *mut passwd;
pub fn setpwent();
pub fn endpwent();
- pub fn setgrent();
pub fn endgrent();
pub fn getgrent() -> *mut ::group;
@@ -522,14 +530,20 @@ extern {
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
- #[cfg_attr(target_os = "freebsd", link_name = "glob@FBSD_1.0")]
+ #[cfg_attr(
+ all(target_os = "freebsd", not(freebsd12)),
+ link_name = "glob@FBSD_1.0"
+ )]
pub fn glob(pattern: *const ::c_char,
flags: ::c_int,
errfunc: ::Option<extern fn(epath: *const ::c_char,
errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
- #[cfg_attr(target_os = "freebsd", link_name = "globfree@FBSD_1.0")]
+ #[cfg_attr(
+ all(target_os = "freebsd", not(freebsd12)),
+ link_name = "globfree@FBSD_1.0"
+ )]
pub fn globfree(pglob: *mut ::glob_t);
pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
diff --git a/libc/src/unix/bsd/netbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/mod.rs
index 29b4dd7..2630a2f 100644
--- a/libc/src/unix/bsd/netbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/mod.rs
@@ -1,14 +1,14 @@
pub type time_t = i64;
pub type mode_t = u32;
-pub type nlink_t = ::uint32_t;
-pub type ino_t = ::uint64_t;
+pub type nlink_t = u32;
+pub type ino_t = u64;
pub type pthread_key_t = ::c_int;
pub type rlim_t = u64;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type nl_item = c_long;
pub type clockid_t = ::c_int;
-pub type id_t = ::uint32_t;
+pub type id_t = u32;
pub type sem_t = *mut sem;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
@@ -597,6 +597,7 @@ pub const TIMER_ABSTIME: ::c_int = 1;
#[link(name = "util")]
extern {
+ pub fn setgrent();
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t,
pshared: ::c_int,
@@ -677,8 +678,8 @@ cfg_if! {
mod netbsd;
pub use self::netbsd::*;
} else if #[cfg(target_os = "openbsd")] {
- mod openbsdlike;
- pub use self::openbsdlike::*;
+ mod openbsd;
+ pub use self::openbsd::*;
} else {
// Unknown target_os
}
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
index ad53c19..9d710eb 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -1,9 +1,9 @@
pub type clock_t = ::c_uint;
pub type suseconds_t = ::c_int;
pub type dev_t = u64;
-pub type blksize_t = ::int32_t;
-pub type fsblkcnt_t = ::uint64_t;
-pub type fsfilcnt_t = ::uint64_t;
+pub type blksize_t = i32;
+pub type fsblkcnt_t = u64;
+pub type fsfilcnt_t = u64;
pub type idtype_t = ::c_int;
pub type mqd_t = ::c_int;
type __pthread_spin_t = __cpu_simple_lock_nv_t;
@@ -77,9 +77,9 @@ s! {
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
- pub st_flags: ::uint32_t,
- pub st_gen: ::uint32_t,
- pub st_spare: [::uint32_t; 2],
+ pub st_flags: u32,
+ pub st_gen: u32,
+ pub st_spare: [u32; 2],
}
pub struct addrinfo {
@@ -163,22 +163,22 @@ s! {
pub struct kevent {
pub ident: ::uintptr_t,
- pub filter: ::uint32_t,
- pub flags: ::uint32_t,
- pub fflags: ::uint32_t,
- pub data: ::int64_t,
+ pub filter: u32,
+ pub flags: u32,
+ pub fflags: u32,
+ pub data: i64,
pub udata: ::intptr_t,
}
pub struct dqblk {
- pub dqb_bhardlimit: ::uint32_t,
- pub dqb_bsoftlimit: ::uint32_t,
- pub dqb_curblocks: ::uint32_t,
- pub dqb_ihardlimit: ::uint32_t,
- pub dqb_isoftlimit: ::uint32_t,
- pub dqb_curinodes: ::uint32_t,
- pub dqb_btime: ::int32_t,
- pub dqb_itime: ::int32_t,
+ pub dqb_bhardlimit: u32,
+ pub dqb_bsoftlimit: u32,
+ pub dqb_curblocks: u32,
+ pub dqb_ihardlimit: u32,
+ pub dqb_isoftlimit: u32,
+ pub dqb_curinodes: u32,
+ pub dqb_btime: i32,
+ pub dqb_itime: i32,
}
pub struct Dl_info {
@@ -261,10 +261,10 @@ s! {
pub sdl_len: ::c_uchar,
pub sdl_family: ::c_uchar,
pub sdl_index: ::c_ushort,
- pub sdl_type: ::uint8_t,
- pub sdl_nlen: ::uint8_t,
- pub sdl_alen: ::uint8_t,
- pub sdl_slen: ::uint8_t,
+ pub sdl_type: u8,
+ pub sdl_nlen: u8,
+ pub sdl_alen: u8,
+ pub sdl_slen: u8,
pub sdl_data: [::c_char; 12],
}
@@ -304,7 +304,7 @@ s_no_extra_traits! {
pub sin_family: ::sa_family_t,
pub sin_port: ::in_port_t,
pub sin_addr: ::in_addr,
- pub sin_zero: [::int8_t; 8],
+ pub sin_zero: [i8; 8],
}
pub struct dirent {
@@ -331,18 +331,18 @@ s_no_extra_traits! {
pub f_favail: ::fsfilcnt_t,
pub f_fresvd: ::fsfilcnt_t,
- pub f_syncreads: ::uint64_t,
- pub f_syncwrites: ::uint64_t,
+ pub f_syncreads: u64,
+ pub f_syncwrites: u64,
- pub f_asyncreads: ::uint64_t,
- pub f_asyncwrites: ::uint64_t,
+ pub f_asyncreads: u64,
+ pub f_asyncwrites: u64,
pub f_fsidx: ::fsid_t,
pub f_fsid: ::c_ulong,
pub f_namemax: ::c_ulong,
pub f_owner: ::uid_t,
- pub f_spare: [::uint32_t; 4],
+ pub f_spare: [u32; 4],
pub f_fstypename: [::c_char; 32],
pub f_mntonname: [::c_char; 1024],
@@ -853,8 +853,21 @@ pub const AF_BLUETOOTH: ::c_int = 31;
pub const AF_IEEE80211: ::c_int = 32;
pub const AF_MPLS: ::c_int = 33;
pub const AF_ROUTE: ::c_int = 34;
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const AF_MAX: ::c_int = 36;
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const NET_MAXID: ::c_int = AF_MAX;
pub const NET_RT_DUMP: ::c_int = 1;
pub const NET_RT_FLAGS: ::c_int = 2;
@@ -870,6 +883,14 @@ pub const PF_KEY: ::c_int = pseudo_AF_KEY;
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
pub const PF_MPLS: ::c_int = AF_MPLS;
pub const PF_ROUTE: ::c_int = AF_ROUTE;
+
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
+#[allow(deprecated)]
pub const PF_MAX: ::c_int = AF_MAX;
pub const MSG_NBIO: ::c_int = 0x1000;
@@ -1086,43 +1107,43 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
-pub const EVFILT_AIO: ::uint32_t = 2;
-pub const EVFILT_PROC: ::uint32_t = 4;
-pub const EVFILT_READ: ::uint32_t = 0;
-pub const EVFILT_SIGNAL: ::uint32_t = 5;
-pub const EVFILT_TIMER: ::uint32_t = 6;
-pub const EVFILT_VNODE: ::uint32_t = 3;
-pub const EVFILT_WRITE: ::uint32_t = 1;
-
-pub const EV_ADD: ::uint32_t = 0x1;
-pub const EV_DELETE: ::uint32_t = 0x2;
-pub const EV_ENABLE: ::uint32_t = 0x4;
-pub const EV_DISABLE: ::uint32_t = 0x8;
-pub const EV_ONESHOT: ::uint32_t = 0x10;
-pub const EV_CLEAR: ::uint32_t = 0x20;
-pub const EV_RECEIPT: ::uint32_t = 0x40;
-pub const EV_DISPATCH: ::uint32_t = 0x80;
-pub const EV_FLAG1: ::uint32_t = 0x2000;
-pub const EV_ERROR: ::uint32_t = 0x4000;
-pub const EV_EOF: ::uint32_t = 0x8000;
-pub const EV_SYSFLAGS: ::uint32_t = 0xf000;
-
-pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
-pub const NOTE_DELETE: ::uint32_t = 0x00000001;
-pub const NOTE_WRITE: ::uint32_t = 0x00000002;
-pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
-pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
-pub const NOTE_LINK: ::uint32_t = 0x00000010;
-pub const NOTE_RENAME: ::uint32_t = 0x00000020;
-pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
-pub const NOTE_EXIT: ::uint32_t = 0x80000000;
-pub const NOTE_FORK: ::uint32_t = 0x40000000;
-pub const NOTE_EXEC: ::uint32_t = 0x20000000;
-pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
-pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
-pub const NOTE_TRACK: ::uint32_t = 0x00000001;
-pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
-pub const NOTE_CHILD: ::uint32_t = 0x00000004;
+pub const EVFILT_AIO: u32 = 2;
+pub const EVFILT_PROC: u32 = 4;
+pub const EVFILT_READ: u32 = 0;
+pub const EVFILT_SIGNAL: u32 = 5;
+pub const EVFILT_TIMER: u32 = 6;
+pub const EVFILT_VNODE: u32 = 3;
+pub const EVFILT_WRITE: u32 = 1;
+
+pub const EV_ADD: u32 = 0x1;
+pub const EV_DELETE: u32 = 0x2;
+pub const EV_ENABLE: u32 = 0x4;
+pub const EV_DISABLE: u32 = 0x8;
+pub const EV_ONESHOT: u32 = 0x10;
+pub const EV_CLEAR: u32 = 0x20;
+pub const EV_RECEIPT: u32 = 0x40;
+pub const EV_DISPATCH: u32 = 0x80;
+pub const EV_FLAG1: u32 = 0x2000;
+pub const EV_ERROR: u32 = 0x4000;
+pub const EV_EOF: u32 = 0x8000;
+pub const EV_SYSFLAGS: u32 = 0xf000;
+
+pub const NOTE_LOWAT: u32 = 0x00000001;
+pub const NOTE_DELETE: u32 = 0x00000001;
+pub const NOTE_WRITE: u32 = 0x00000002;
+pub const NOTE_EXTEND: u32 = 0x00000004;
+pub const NOTE_ATTRIB: u32 = 0x00000008;
+pub const NOTE_LINK: u32 = 0x00000010;
+pub const NOTE_RENAME: u32 = 0x00000020;
+pub const NOTE_REVOKE: u32 = 0x00000040;
+pub const NOTE_EXIT: u32 = 0x80000000;
+pub const NOTE_FORK: u32 = 0x40000000;
+pub const NOTE_EXEC: u32 = 0x20000000;
+pub const NOTE_PDATAMASK: u32 = 0x000fffff;
+pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
+pub const NOTE_TRACK: u32 = 0x00000001;
+pub const NOTE_TRACKERR: u32 = 0x00000002;
+pub const NOTE_CHILD: u32 = 0x00000004;
pub const TMP_MAX : ::c_uint = 308915776;
@@ -1492,6 +1513,9 @@ extern {
#[link_name = "__lutimes50"]
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
+ #[link_name = "__gettimeofday50"]
+ pub fn gettimeofday(tp: *mut ::timeval,
+ tz: *mut ::c_void) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs b/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs
index 6a8cbb5..6a8cbb5 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 223064b..09739cb 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -4,9 +4,9 @@ pub type clock_t = i64;
pub type suseconds_t = ::c_long;
pub type dev_t = i32;
pub type sigset_t = ::c_uint;
-pub type blksize_t = ::int32_t;
-pub type fsblkcnt_t = ::uint64_t;
-pub type fsfilcnt_t = ::uint64_t;
+pub type blksize_t = i32;
+pub type fsblkcnt_t = u64;
+pub type fsfilcnt_t = u64;
pub type pthread_attr_t = *mut ::c_void;
pub type pthread_mutex_t = *mut ::c_void;
pub type pthread_mutexattr_t = *mut ::c_void;
@@ -17,6 +17,150 @@ pub type pthread_rwlockattr_t = *mut ::c_void;
pub type caddr_t = *mut ::c_char;
s! {
+ pub struct glob_t {
+ pub gl_pathc: ::size_t,
+ pub gl_matchc: ::size_t,
+ pub gl_offs: ::size_t,
+ pub gl_flags: ::c_int,
+ pub gl_pathv: *mut *mut ::c_char,
+ __unused1: *mut ::c_void,
+ __unused2: *mut ::c_void,
+ __unused3: *mut ::c_void,
+ __unused4: *mut ::c_void,
+ __unused5: *mut ::c_void,
+ __unused6: *mut ::c_void,
+ __unused7: *mut ::c_void,
+ }
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
+
+ pub struct ufs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ }
+
+ pub struct mfs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134
+ pub base: *mut ::c_char,
+ pub size: ::c_ulong,
+ }
+
+ pub struct iso_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ pub flags: ::c_int,
+ pub sess: ::c_int,
+ }
+
+ pub struct nfs_args {
+ pub version: ::c_int,
+ pub addr: *mut ::sockaddr,
+ pub addrlen: ::c_int,
+ pub sotype: ::c_int,
+ pub proto: ::c_int,
+ pub fh: *mut ::c_uchar,
+ pub fhsize: ::c_int,
+ pub flags: ::c_int,
+ pub wsize: ::c_int,
+ pub rsize: ::c_int,
+ pub readdirsize: ::c_int,
+ pub timeo: ::c_int,
+ pub retrans: ::c_int,
+ pub maxgrouplist: ::c_int,
+ pub readahead: ::c_int,
+ pub leaseterm: ::c_int,
+ pub deadthresh: ::c_int,
+ pub hostname: *mut ::c_char,
+ pub acregmin: ::c_int,
+ pub acregmax: ::c_int,
+ pub acdirmin: ::c_int,
+ pub acdirmax: ::c_int,
+ }
+
+ pub struct msdosfs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub mask: ::mode_t,
+ pub flags: ::c_int,
+ }
+
+ pub struct ntfs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub mode: ::mode_t,
+ pub flag: ::c_ulong,
+ }
+
+ pub struct udf_args {
+ pub fspec: *mut ::c_char,
+ pub lastblock: u32,
+ }
+
+ pub struct tmpfs_args {
+ pub ta_version: ::c_int,
+ pub ta_nodes_max: ::ino_t,
+ pub ta_size_max: ::off_t,
+ pub ta_root_uid: ::uid_t,
+ pub ta_root_gid: ::gid_t,
+ pub ta_root_mode: ::mode_t,
+ }
+
+ pub struct fusefs_args {
+ pub name: *mut ::c_char,
+ pub fd: ::c_int,
+ pub max_read: ::c_int,
+ pub allow_other: ::c_int,
+ }
+
+ pub struct xucred {
+ pub cr_uid: ::uid_t,
+ pub cr_gid: ::gid_t,
+ pub cr_ngroups: ::c_short,
+ //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44
+ pub cr_groups: [::gid_t; 16],
+ }
+
+ pub struct export_args {
+ pub ex_flags: ::c_int,
+ pub ex_root: ::uid_t,
+ pub ex_anon: xucred,
+ pub ex_addr: *mut ::sockaddr,
+ pub ex_addrlen: ::c_int,
+ pub ex_mask: *mut ::sockaddr,
+ pub ex_masklen: ::c_int,
+ }
+
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
@@ -31,7 +175,7 @@ s! {
pub sin_family: ::sa_family_t,
pub sin_port: ::in_port_t,
pub sin_addr: ::in_addr,
- pub sin_zero: [::int8_t; 8],
+ pub sin_zero: [i8; 8],
}
pub struct kevent {
@@ -39,7 +183,7 @@ s! {
pub filter: ::c_short,
pub flags: ::c_ushort,
pub fflags: ::c_uint,
- pub data: ::int64_t,
+ pub data: i64,
pub udata: *mut ::c_void,
}
@@ -60,8 +204,8 @@ s! {
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
- pub st_flags: ::uint32_t,
- pub st_gen: ::uint32_t,
+ pub st_flags: u32,
+ pub st_gen: u32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
@@ -206,6 +350,18 @@ s_no_extra_traits! {
pub ut_host: [::c_char; UT_HOSTSIZE],
pub ut_time: ::time_t,
}
+
+ pub union mount_info {
+ pub ufs_args: ufs_args,
+ pub mfs_args: mfs_args,
+ pub nfs_args: nfs_args,
+ pub iso_args: iso_args,
+ pub msdosfs_args: msdosfs_args,
+ pub ntfs_args: ntfs_args,
+ pub tmpfs_args: tmpfs_args,
+ align: [::c_char; 160],
+ }
+
}
cfg_if! {
@@ -385,6 +541,167 @@ cfg_if! {
self.ut_time.hash(state);
}
}
+
+ impl PartialEq for mount_info {
+ fn eq(&self, other: &mount_info) -> bool {
+ unsafe {
+ self.align
+ .iter()
+ .zip(other.align.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ }
+
+ impl Eq for mount_info { }
+
+ impl ::fmt::Debug for mount_info {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("mount_info")
+ // FIXME: .field("align", &self.align)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for mount_info {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe { self.align.hash(state) };
+ }
+ }
+ }
+}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ s_no_extra_traits! {
+ // This type uses the union mount_info:
+ pub struct statfs {
+ pub f_flags: u32,
+ pub f_bsize: u32,
+ pub f_iosize: u32,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: i64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: i64,
+ pub f_syncwrites: u64,
+ pub f_syncreads: u64,
+ pub f_asyncwrites: u64,
+ pub f_asyncreads: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namemax: u32,
+ pub f_owner: ::uid_t,
+ pub f_ctime: u64,
+ pub f_fstypename: [::c_char; 16],
+ pub f_mntonname: [::c_char; 90],
+ pub f_mntfromname: [::c_char; 90],
+ pub f_mntfromspec: [::c_char; 90],
+ pub mount_info: mount_info,
+ }
+ }
+
+ cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for statfs {
+ fn eq(&self, other: &statfs) -> bool {
+ 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_favail == other.f_favail
+ && self.f_syncwrites == other.f_syncwrites
+ && self.f_syncreads == other.f_syncreads
+ && self.f_asyncwrites == other.f_asyncwrites
+ && self.f_asyncreads == other.f_asyncreads
+ && self.f_fsid == other.f_fsid
+ && self.f_namemax == other.f_namemax
+ && self.f_owner == other.f_owner
+ && self.f_ctime == other.f_ctime
+ && self.f_fstypename
+ .iter()
+ .zip(other.f_fstypename.iter())
+ .all(|(a,b)| a == b)
+ && self.f_mntonname
+ .iter()
+ .zip(other.f_mntonname.iter())
+ .all(|(a,b)| a == b)
+ && self.f_mntfromname
+ .iter()
+ .zip(other.f_mntfromname.iter())
+ .all(|(a,b)| a == b)
+ && self.f_mntfromspec
+ .iter()
+ .zip(other.f_mntfromspec.iter())
+ .all(|(a,b)| a == b)
+ && self.mount_info == other.mount_info
+ }
+ }
+
+ impl Eq for statfs { }
+
+ impl ::fmt::Debug for statfs {
+ fn fmt(&self, f: &mut ::fmt::Formatter)
+ -> ::fmt::Result {
+ f.debug_struct("statfs")
+ .field("f_flags", &self.f_flags)
+ .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_favail", &self.f_favail)
+ .field("f_syncwrites", &self.f_syncwrites)
+ .field("f_syncreads", &self.f_syncreads)
+ .field("f_asyncwrites", &self.f_asyncwrites)
+ .field("f_asyncreads", &self.f_asyncreads)
+ .field("f_fsid", &self.f_fsid)
+ .field("f_namemax", &self.f_namemax)
+ .field("f_owner", &self.f_owner)
+ .field("f_ctime", &self.f_ctime)
+ // FIXME: .field("f_fstypename", &self.f_fstypename)
+ // FIXME: .field("f_mntonname", &self.f_mntonname)
+ // FIXME: .field("f_mntfromname", &self.f_mntfromname)
+ // FIXME: .field("f_mntfromspec", &self.f_mntfromspec)
+ .field("mount_info", &self.mount_info)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for statfs {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ 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_favail.hash(state);
+ self.f_syncwrites.hash(state);
+ self.f_syncreads.hash(state);
+ self.f_asyncwrites.hash(state);
+ self.f_asyncreads.hash(state);
+ self.f_fsid.hash(state);
+ self.f_namemax.hash(state);
+ self.f_owner.hash(state);
+ self.f_ctime.hash(state);
+ self.f_fstypename.hash(state);
+ self.f_mntonname.hash(state);
+ self.f_mntfromname.hash(state);
+ self.f_mntfromspec.hash(state);
+ self.mount_info.hash(state);
+ }
+ }
+ }
+ }
}
}
@@ -518,9 +835,20 @@ pub const AF_MPLS: ::c_int = 33;
pub const pseudo_AF_PFLOW: ::c_int = 34;
pub const pseudo_AF_PIPEX: ::c_int = 35;
#[doc(hidden)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const AF_MAX: ::c_int = 36;
#[doc(hidden)]
+#[allow(deprecated)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const NET_MAXID: ::c_int = AF_MAX;
pub const NET_RT_DUMP: ::c_int = 1;
pub const NET_RT_FLAGS: ::c_int = 2;
@@ -545,6 +873,12 @@ pub const PF_MPLS: ::c_int = AF_MPLS;
pub const PF_PFLOW: ::c_int = pseudo_AF_PFLOW;
pub const PF_PIPEX: ::c_int = pseudo_AF_PIPEX;
#[doc(hidden)]
+#[allow(deprecated)]
+#[deprecated(
+ since = "0.2.55",
+ note = "If you are using this report to: \
+ https://github.com/rust-lang/libc/issues/665"
+)]
pub const PF_MAX: ::c_int = AF_MAX;
pub const SCM_TIMESTAMP: ::c_int = 0x04;
@@ -713,57 +1047,60 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4;
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP;
-pub const EVFILT_AIO: ::int16_t = -3;
-pub const EVFILT_PROC: ::int16_t = -5;
-pub const EVFILT_READ: ::int16_t = -1;
-pub const EVFILT_SIGNAL: ::int16_t = -6;
-pub const EVFILT_TIMER: ::int16_t = -7;
-pub const EVFILT_VNODE: ::int16_t = -4;
-pub const EVFILT_WRITE: ::int16_t = -2;
-
-pub const EV_ADD: ::uint16_t = 0x1;
-pub const EV_DELETE: ::uint16_t = 0x2;
-pub const EV_ENABLE: ::uint16_t = 0x4;
-pub const EV_DISABLE: ::uint16_t = 0x8;
-pub const EV_ONESHOT: ::uint16_t = 0x10;
-pub const EV_CLEAR: ::uint16_t = 0x20;
-pub const EV_RECEIPT: ::uint16_t = 0x40;
-pub const EV_DISPATCH: ::uint16_t = 0x80;
-pub const EV_FLAG1: ::uint16_t = 0x2000;
-pub const EV_ERROR: ::uint16_t = 0x4000;
-pub const EV_EOF: ::uint16_t = 0x8000;
-pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
-
-pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
-pub const NOTE_EOF: ::uint32_t = 0x00000002;
-pub const NOTE_DELETE: ::uint32_t = 0x00000001;
-pub const NOTE_WRITE: ::uint32_t = 0x00000002;
-pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
-pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
-pub const NOTE_LINK: ::uint32_t = 0x00000010;
-pub const NOTE_RENAME: ::uint32_t = 0x00000020;
-pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
-pub const NOTE_TRUNCATE: ::uint32_t = 0x00000080;
-pub const NOTE_EXIT: ::uint32_t = 0x80000000;
-pub const NOTE_FORK: ::uint32_t = 0x40000000;
-pub const NOTE_EXEC: ::uint32_t = 0x20000000;
-pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
-pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
-pub const NOTE_TRACK: ::uint32_t = 0x00000001;
-pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
-pub const NOTE_CHILD: ::uint32_t = 0x00000004;
+pub const EVFILT_AIO: i16 = -3;
+pub const EVFILT_PROC: i16 = -5;
+pub const EVFILT_READ: i16 = -1;
+pub const EVFILT_SIGNAL: i16 = -6;
+pub const EVFILT_TIMER: i16 = -7;
+pub const EVFILT_VNODE: i16 = -4;
+pub const EVFILT_WRITE: i16 = -2;
+
+pub const EV_ADD: u16 = 0x1;
+pub const EV_DELETE: u16 = 0x2;
+pub const EV_ENABLE: u16 = 0x4;
+pub const EV_DISABLE: u16 = 0x8;
+pub const EV_ONESHOT: u16 = 0x10;
+pub const EV_CLEAR: u16 = 0x20;
+pub const EV_RECEIPT: u16 = 0x40;
+pub const EV_DISPATCH: u16 = 0x80;
+pub const EV_FLAG1: u16 = 0x2000;
+pub const EV_ERROR: u16 = 0x4000;
+pub const EV_EOF: u16 = 0x8000;
+pub const EV_SYSFLAGS: u16 = 0xf000;
+
+pub const NOTE_LOWAT: u32 = 0x00000001;
+pub const NOTE_EOF: u32 = 0x00000002;
+pub const NOTE_DELETE: u32 = 0x00000001;
+pub const NOTE_WRITE: u32 = 0x00000002;
+pub const NOTE_EXTEND: u32 = 0x00000004;
+pub const NOTE_ATTRIB: u32 = 0x00000008;
+pub const NOTE_LINK: u32 = 0x00000010;
+pub const NOTE_RENAME: u32 = 0x00000020;
+pub const NOTE_REVOKE: u32 = 0x00000040;
+pub const NOTE_TRUNCATE: u32 = 0x00000080;
+pub const NOTE_EXIT: u32 = 0x80000000;
+pub const NOTE_FORK: u32 = 0x40000000;
+pub const NOTE_EXEC: u32 = 0x20000000;
+pub const NOTE_PDATAMASK: u32 = 0x000fffff;
+pub const NOTE_PCTRLMASK: u32 = 0xf0000000;
+pub const NOTE_TRACK: u32 = 0x00000001;
+pub const NOTE_TRACKERR: u32 = 0x00000002;
+pub const NOTE_CHILD: u32 = 0x00000004;
pub const TMP_MAX : ::c_uint = 0x7fffffff;
pub const NI_MAXHOST: ::size_t = 256;
pub const RTLD_LOCAL: ::c_int = 0;
+
pub const CTL_MAXNAME: ::c_int = 12;
+
pub const CTLTYPE_NODE: ::c_int = 1;
pub const CTLTYPE_INT: ::c_int = 2;
pub const CTLTYPE_STRING: ::c_int = 3;
pub const CTLTYPE_QUAD: ::c_int = 4;
pub const CTLTYPE_STRUCT: ::c_int = 5;
+
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
pub const CTL_VM: ::c_int = 2;
@@ -775,7 +1112,9 @@ pub const CTL_MACHDEP: ::c_int = 7;
pub const CTL_DDB: ::c_int = 9;
pub const CTL_VFS: ::c_int = 10;
pub const CTL_MAXID: ::c_int = 11;
+
pub const HW_NCPUONLINE: ::c_int = 25;
+
pub const KERN_OSTYPE: ::c_int = 1;
pub const KERN_OSRELEASE: ::c_int = 2;
pub const KERN_OSREV: ::c_int = 3;
@@ -852,7 +1191,9 @@ pub const KERN_CONSBUFSIZE: ::c_int = 82;
pub const KERN_CONSBUF: ::c_int = 83;
pub const KERN_AUDIO: ::c_int = 84;
pub const KERN_CPUSTATS: ::c_int = 85;
-pub const KERN_MAXID: ::c_int = 86;
+pub const KERN_PFSTATUS: ::c_int = 86;
+pub const KERN_MAXID: ::c_int = 87;
+
pub const KERN_PROC_ALL: ::c_int = 0;
pub const KERN_PROC_PID: ::c_int = 1;
pub const KERN_PROC_PGRP: ::c_int = 2;
@@ -862,13 +1203,16 @@ pub const KERN_PROC_UID: ::c_int = 5;
pub const KERN_PROC_RUID: ::c_int = 6;
pub const KERN_PROC_KTHREAD: ::c_int = 7;
pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000;
+
pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1;
pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2;
pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3;
+
pub const KERN_PROC_ARGV: ::c_int = 1;
pub const KERN_PROC_NARGV: ::c_int = 2;
pub const KERN_PROC_ENV: ::c_int = 3;
pub const KERN_PROC_NENV: ::c_int = 4;
+
pub const KI_NGROUPS: ::c_int = 16;
pub const KI_MAXCOMLEN: ::c_int = 24;
pub const KI_WMESGLEN: ::c_int = 8;
@@ -880,6 +1224,92 @@ pub const OLCUC: ::tcflag_t = 0x20;
pub const ONOCR: ::tcflag_t = 0x40;
pub const ONLRET: ::tcflag_t = 0x80;
+//https://github.com/openbsd/src/blob/master/sys/sys/mount.h
+pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext
+pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers
+pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr
+pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext
+pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess
+
+pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes
+
+pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports
+pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default)
+pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size
+pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size
+pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout
+pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries
+pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size
+pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount
+pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket
+pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol
+pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol
+pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication
+pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically
+pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs)
+pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead
+pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh
+pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache
+pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3
+pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size
+
+/* Flags valid only in mount syscall arguments */
+pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid
+pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid
+pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid
+pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid
+
+/* Flags valid only in kernel */
+pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally
+pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3
+pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info
+pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo
+pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point
+pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress
+pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted
+pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock
+pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above
+pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock
+pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above
+pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication
+pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator
+pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator
+pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error
+
+pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only
+pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names
+pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries
+
+pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1;
+pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;
+
+pub const TMPFS_ARGS_VERSION: ::c_int = 1;
+
+pub const MAP_STACK : ::c_int = 0x4000;
+
+// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187
+pub const IFF_UP: ::c_int = 0x1; // interface is up
+pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
+pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
+pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
+pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
+pub const IFF_STATICARP: ::c_int = 0x20; // only static ARP
+pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
+pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
+pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
+pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
+pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
+pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
+pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
+pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
+pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
+pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
+
+pub const PTHREAD_STACK_MIN : ::size_t = 4096;
+pub const SIGSTKSZ : ::size_t = 28672;
+
+pub const PT_FIRSTMACH: ::c_int = 32;
+
pub const SOCK_CLOEXEC: ::c_int = 0x8000;
pub const SOCK_NONBLOCK: ::c_int = 0x4000;
pub const SOCK_DNS: ::c_int = 0x1000;
@@ -888,13 +1318,73 @@ pub const PTRACE_FORK: ::c_int = 0x0002;
pub const WCONTINUED: ::c_int = 8;
+fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+}
+
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
status & 0o177777 == 0o177777
}
+
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ (cmsg as *mut ::c_uchar)
+ .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
+ -> *mut ::cmsghdr
+ {
+ if cmsg.is_null() {
+ return ::CMSG_FIRSTHDR(mhdr);
+ };
+ let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
+ + _ALIGN(::mem::size_of::<::cmsghdr>());
+ let max = (*mhdr).msg_control as usize
+ + (*mhdr).msg_controllen as usize;
+ if next > max {
+ 0 as *mut ::cmsghdr
+ } else {
+ (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
+ as *mut ::cmsghdr
+ }
+ }
+
+ pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
+ as ::c_uint
+ }
+
+ pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ status >> 8
+ }
+
+ pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ (status & 0o177) != 0o177 && (status & 0o177) != 0
+ }
+
+ pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ (status & 0o177) == 0o177
+ }
}
extern {
+ pub fn gettimeofday(tp: *mut ::timeval,
+ tz: *mut ::timezone) -> ::c_int;
+ pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
+ addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
+ pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+ envp: *const *const ::c_char) -> ::c_int;
+ pub fn pledge(promises: *const ::c_char,
+ execpromises: *const ::c_char) -> ::c_int;
+ pub fn strtonum(nptr: *const ::c_char, minval: ::c_longlong,
+ maxval: ::c_longlong,
+ errstr: *mut *const ::c_char) -> ::c_longlong;
+ pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int;
pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_uint,
@@ -936,10 +1426,26 @@ extern {
}
cfg_if! {
- if #[cfg(target_os = "openbsd")] {
- mod openbsd;
- pub use self::openbsd::*;
+ if #[cfg(libc_union)] {
+ extern {
+ // these functions use statfs which uses the union mount_info:
+ pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+ pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
+ }
+ }
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86")] {
+ mod x86;
+ pub use self::x86::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "aarch64")] {
+ mod aarch64;
+ pub use self::aarch64::*;
} else {
- // Unknown target_os
+ // Unknown target_arch
}
}
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs b/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs
index 05538cd..05538cd 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs b/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs
index 7daa9d8..7daa9d8 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
deleted file mode 100644
index c168711..0000000
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
+++ /dev/null
@@ -1,497 +0,0 @@
-s! {
- pub struct glob_t {
- pub gl_pathc: ::size_t,
- pub gl_matchc: ::size_t,
- pub gl_offs: ::size_t,
- pub gl_flags: ::c_int,
- pub gl_pathv: *mut *mut ::c_char,
- __unused1: *mut ::c_void,
- __unused2: *mut ::c_void,
- __unused3: *mut ::c_void,
- __unused4: *mut ::c_void,
- __unused5: *mut ::c_void,
- __unused6: *mut ::c_void,
- __unused7: *mut ::c_void,
- }
-
- pub struct lconv {
- pub decimal_point: *mut ::c_char,
- pub thousands_sep: *mut ::c_char,
- pub grouping: *mut ::c_char,
- pub int_curr_symbol: *mut ::c_char,
- pub currency_symbol: *mut ::c_char,
- pub mon_decimal_point: *mut ::c_char,
- pub mon_thousands_sep: *mut ::c_char,
- pub mon_grouping: *mut ::c_char,
- pub positive_sign: *mut ::c_char,
- pub negative_sign: *mut ::c_char,
- pub int_frac_digits: ::c_char,
- pub frac_digits: ::c_char,
- pub p_cs_precedes: ::c_char,
- pub p_sep_by_space: ::c_char,
- pub n_cs_precedes: ::c_char,
- pub n_sep_by_space: ::c_char,
- pub p_sign_posn: ::c_char,
- pub n_sign_posn: ::c_char,
- pub int_p_cs_precedes: ::c_char,
- pub int_p_sep_by_space: ::c_char,
- pub int_n_cs_precedes: ::c_char,
- pub int_n_sep_by_space: ::c_char,
- pub int_p_sign_posn: ::c_char,
- pub int_n_sign_posn: ::c_char,
- }
-
- pub struct ufs_args {
- pub fspec: *mut ::c_char,
- pub export_info: export_args,
- }
-
- pub struct mfs_args {
- pub fspec: *mut ::c_char,
- pub export_info: export_args,
- // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134
- pub base: *mut ::c_char,
- pub size: ::c_ulong,
- }
-
- pub struct iso_args {
- pub fspec: *mut ::c_char,
- pub export_info: export_args,
- pub flags: ::c_int,
- pub sess: ::c_int,
- }
-
- pub struct nfs_args {
- pub version: ::c_int,
- pub addr: *mut ::sockaddr,
- pub addrlen: ::c_int,
- pub sotype: ::c_int,
- pub proto: ::c_int,
- pub fh: *mut ::c_uchar,
- pub fhsize: ::c_int,
- pub flags: ::c_int,
- pub wsize: ::c_int,
- pub rsize: ::c_int,
- pub readdirsize: ::c_int,
- pub timeo: ::c_int,
- pub retrans: ::c_int,
- pub maxgrouplist: ::c_int,
- pub readahead: ::c_int,
- pub leaseterm: ::c_int,
- pub deadthresh: ::c_int,
- pub hostname: *mut ::c_char,
- pub acregmin: ::c_int,
- pub acregmax: ::c_int,
- pub acdirmin: ::c_int,
- pub acdirmax: ::c_int,
- }
-
- pub struct msdosfs_args {
- pub fspec: *mut ::c_char,
- pub export_info: export_args,
- pub uid: ::uid_t,
- pub gid: ::gid_t,
- pub mask: ::mode_t,
- pub flags: ::c_int,
- }
-
- pub struct ntfs_args {
- pub fspec: *mut ::c_char,
- pub export_info: export_args,
- pub uid: ::uid_t,
- pub gid: ::gid_t,
- pub mode: ::mode_t,
- pub flag: ::c_ulong,
- }
-
- pub struct udf_args {
- pub fspec: *mut ::c_char,
- pub lastblock: ::uint32_t,
- }
-
- pub struct tmpfs_args {
- pub ta_version: ::c_int,
- pub ta_nodes_max: ::ino_t,
- pub ta_size_max: ::off_t,
- pub ta_root_uid: ::uid_t,
- pub ta_root_gid: ::gid_t,
- pub ta_root_mode: ::mode_t,
- }
-
- pub struct fusefs_args {
- pub name: *mut ::c_char,
- pub fd: ::c_int,
- pub max_read: ::c_int,
- pub allow_other: ::c_int,
- }
-
- pub struct xucred {
- pub cr_uid: ::uid_t,
- pub cr_gid: ::gid_t,
- pub cr_ngroups: ::c_short,
- //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44
- pub cr_groups: [::gid_t; 16],
- }
-
- pub struct export_args {
- pub ex_flags: ::c_int,
- pub ex_root: ::uid_t,
- pub ex_anon: xucred,
- pub ex_addr: *mut ::sockaddr,
- pub ex_addrlen: ::c_int,
- pub ex_mask: *mut ::sockaddr,
- pub ex_masklen: ::c_int,
- }
-}
-
-s_no_extra_traits! {
- pub union mount_info {
- pub ufs_args: ufs_args,
- pub mfs_args: mfs_args,
- pub nfs_args: nfs_args,
- pub iso_args: iso_args,
- pub msdosfs_args: msdosfs_args,
- pub ntfs_args: ntfs_args,
- pub tmpfs_args: tmpfs_args,
- align: [::c_char; 160],
- }
-}
-
-cfg_if! {
- if #[cfg(feature = "extra_traits")] {
- impl PartialEq for mount_info {
- fn eq(&self, other: &mount_info) -> bool {
- unsafe {
- self.align
- .iter()
- .zip(other.align.iter())
- .all(|(a,b)| a == b)
- }
- }
- }
-
- impl Eq for mount_info { }
-
- impl ::fmt::Debug for mount_info {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("mount_info")
- // FIXME: .field("align", &self.align)
- .finish()
- }
- }
-
- impl ::hash::Hash for mount_info {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- unsafe { self.align.hash(state) };
- }
- }
- }
-}
-
-cfg_if! {
- if #[cfg(libc_union)] {
- s_no_extra_traits! {
- // This type uses the union mount_info:
- pub struct statfs {
- pub f_flags: ::uint32_t,
- pub f_bsize: ::uint32_t,
- pub f_iosize: ::uint32_t,
- pub f_blocks: ::uint64_t,
- pub f_bfree: ::uint64_t,
- pub f_bavail: ::int64_t,
- pub f_files: ::uint64_t,
- pub f_ffree: ::uint64_t,
- pub f_favail: ::int64_t,
- pub f_syncwrites: ::uint64_t,
- pub f_syncreads: ::uint64_t,
- pub f_asyncwrites: ::uint64_t,
- pub f_asyncreads: ::uint64_t,
- pub f_fsid: ::fsid_t,
- pub f_namemax: ::uint32_t,
- pub f_owner: ::uid_t,
- pub f_ctime: ::uint64_t,
- pub f_fstypename: [::c_char; 16],
- pub f_mntonname: [::c_char; 90],
- pub f_mntfromname: [::c_char; 90],
- pub f_mntfromspec: [::c_char; 90],
- pub mount_info: mount_info,
- }
- }
-
- cfg_if! {
- if #[cfg(feature = "extra_traits")] {
- impl PartialEq for statfs {
- fn eq(&self, other: &statfs) -> bool {
- 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_favail == other.f_favail
- && self.f_syncwrites == other.f_syncwrites
- && self.f_syncreads == other.f_syncreads
- && self.f_asyncwrites == other.f_asyncwrites
- && self.f_asyncreads == other.f_asyncreads
- && self.f_fsid == other.f_fsid
- && self.f_namemax == other.f_namemax
- && self.f_owner == other.f_owner
- && self.f_ctime == other.f_ctime
- && self.f_fstypename
- .iter()
- .zip(other.f_fstypename.iter())
- .all(|(a,b)| a == b)
- && self.f_mntonname
- .iter()
- .zip(other.f_mntonname.iter())
- .all(|(a,b)| a == b)
- && self.f_mntfromname
- .iter()
- .zip(other.f_mntfromname.iter())
- .all(|(a,b)| a == b)
- && self.f_mntfromspec
- .iter()
- .zip(other.f_mntfromspec.iter())
- .all(|(a,b)| a == b)
- && self.mount_info == other.mount_info
- }
- }
-
- impl Eq for statfs { }
-
- impl ::fmt::Debug for statfs {
- fn fmt(&self, f: &mut ::fmt::Formatter)
- -> ::fmt::Result {
- f.debug_struct("statfs")
- .field("f_flags", &self.f_flags)
- .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_favail", &self.f_favail)
- .field("f_syncwrites", &self.f_syncwrites)
- .field("f_syncreads", &self.f_syncreads)
- .field("f_asyncwrites", &self.f_asyncwrites)
- .field("f_asyncreads", &self.f_asyncreads)
- .field("f_fsid", &self.f_fsid)
- .field("f_namemax", &self.f_namemax)
- .field("f_owner", &self.f_owner)
- .field("f_ctime", &self.f_ctime)
- // FIXME: .field("f_fstypename", &self.f_fstypename)
- // FIXME: .field("f_mntonname", &self.f_mntonname)
- // FIXME: .field("f_mntfromname", &self.f_mntfromname)
- // FIXME: .field("f_mntfromspec", &self.f_mntfromspec)
- .field("mount_info", &self.mount_info)
- .finish()
- }
- }
-
- impl ::hash::Hash for statfs {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- 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_favail.hash(state);
- self.f_syncwrites.hash(state);
- self.f_syncreads.hash(state);
- self.f_asyncwrites.hash(state);
- self.f_asyncreads.hash(state);
- self.f_fsid.hash(state);
- self.f_namemax.hash(state);
- self.f_owner.hash(state);
- self.f_ctime.hash(state);
- self.f_fstypename.hash(state);
- self.f_mntonname.hash(state);
- self.f_mntfromname.hash(state);
- self.f_mntfromspec.hash(state);
- self.mount_info.hash(state);
- }
- }
- }
- }
- }
-}
-
-//https://github.com/openbsd/src/blob/master/sys/sys/mount.h
-pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext
-pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers
-pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr
-pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext
-pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess
-
-pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes
-
-pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports
-pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default)
-pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size
-pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size
-pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout
-pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries
-pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size
-pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount
-pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket
-pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol
-pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol
-pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication
-pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically
-pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs)
-pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead
-pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh
-pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache
-pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3
-pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size
-
-/* Flags valid only in mount syscall arguments */
-pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid
-pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid
-pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid
-pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid
-
-/* Flags valid only in kernel */
-pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally
-pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3
-pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info
-pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo
-pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point
-pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress
-pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted
-pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock
-pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above
-pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock
-pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above
-pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication
-pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator
-pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator
-pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error
-
-pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only
-pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names
-pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries
-
-pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1;
-pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;
-
-pub const TMPFS_ARGS_VERSION: ::c_int = 1;
-
-pub const MAP_STACK : ::c_int = 0x4000;
-
-// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187
-pub const IFF_UP: ::c_int = 0x1; // interface is up
-pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
-pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
-pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
-pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
-pub const IFF_STATICARP: ::c_int = 0x20; // only static ARP
-pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
-pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
-pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
-pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
-pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
-pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
-pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
-pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
-pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
-pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
-
-pub const PTHREAD_STACK_MIN : ::size_t = 4096;
-pub const SIGSTKSZ : ::size_t = 28672;
-
-pub const PT_FIRSTMACH: ::c_int = 32;
-
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
-}
-
-f! {
- pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
- (cmsg as *mut ::c_uchar)
- .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
- }
-
- pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
- _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
- }
-
- pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
- -> *mut ::cmsghdr
- {
- if cmsg.is_null() {
- return ::CMSG_FIRSTHDR(mhdr);
- };
- let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
- + _ALIGN(::mem::size_of::<::cmsghdr>());
- let max = (*mhdr).msg_control as usize
- + (*mhdr).msg_controllen as usize;
- if next > max {
- 0 as *mut ::cmsghdr
- } else {
- (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
- as *mut ::cmsghdr
- }
- }
-
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
- (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
- as ::c_uint
- }
-
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
- status >> 8
- }
-
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
- (status & 0o177) != 0o177 && (status & 0o177) != 0
- }
-
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0o177) == 0o177
- }
-}
-
-extern {
- pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
- pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
- envp: *const *const ::c_char) -> ::c_int;
- pub fn pledge(promises: *const ::c_char,
- execpromises: *const ::c_char) -> ::c_int;
- pub fn strtonum(nptr: *const ::c_char, minval: ::c_longlong,
- maxval: ::c_longlong,
- errstr: *mut *const ::c_char) -> ::c_longlong;
- pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
-}
-
-cfg_if! {
- if #[cfg(libc_union)] {
- extern {
- // these functions use statfs which uses the union mount_info:
- pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
- pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
- }
- }
-}
-
-cfg_if! {
- if #[cfg(target_arch = "x86")] {
- mod x86;
- pub use self::x86::*;
- } else if #[cfg(target_arch = "x86_64")] {
- mod x86_64;
- pub use self::x86_64::*;
- } else if #[cfg(target_arch = "aarch64")] {
- mod aarch64;
- pub use self::aarch64::*;
- } else {
- // Unknown target_arch
- }
-}