diff --git a/build.rs b/build.rs index 08ac338802af..42d76dc60709 100644 --- a/build.rs +++ b/build.rs @@ -37,6 +37,7 @@ const ALLOWED_CFGS: &[&str] = &[ "musl_redir_time64", "vxworks_lt_25_09", "libc_pauthtest", + "aix_large_file_api", ]; // Extra values to allow for check-cfg. @@ -157,6 +158,11 @@ fn main() { set_cfg("linux_time_bits64"); } + let aix_large_file_api = env_flag("CARGO_CFG_LIBC_UNSTABLE_LARGE_FILE_API"); + if aix_large_file_api { + set_cfg("aix_large_file_api"); + } + if target_env == "gnu" && matches!(target_os.as_str(), "linux" | "windows") && target_ptr_width == "32" diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 24c661f7361e..ab0469338d9e 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -1,40 +1,105 @@ use crate::prelude::*; -use crate::{ - in_addr_t, - in_port_t, -}; +pub type eye_catch_t = c_ulong; +pub type eye_catch1b_t = u8; +pub type eye_catch2b_t = u16; +pub type eye_catch4b_t = u32; +pub type eye_catch8b_t = u64; + +pub type wctype_t = c_uint; + +pub type UniChar = c_ushort; +pub type UTF32Char = c_uint; + +pub type __ptr32 = c_uint; +pub type __cptr32 = c_uint; +pub type __ptr64 = *mut c_void; +pub type __cptr64 = *mut c_char; +pub type ptr64_t = *mut c_void; + +pub type unit_addr_t = c_ulonglong; +pub type liobn_t = c_uint; +pub type class_id_t = c_uint; +pub type fhandle_t = fhandle; +pub type fid_t = fid; +pub type swblk_t = c_int; +pub type physaddr = physaddr_t; +pub type physaddr_t = *mut __c_anonymous_physaddr_t; +pub type va_list = *mut c_char; +pub type trace_event_set_t = u64; +pub type trace_id_t = c_uint; +pub type trace_event_id_t = c_uint; +pub type trace_attr_t = *mut c_void; +pub type wint_t = c_int; +pub type crid_t = c_int; +pub type boolean_t = c_int; +pub type mtyp_t = c_long; +pub type slab_t = [c_char; 12]; +pub type paddr_t = c_long; +pub type level_t = c_int; pub type caddr_t = *mut c_char; pub type clockid_t = c_longlong; -pub type blkcnt_t = c_long; pub type clock_t = c_int; pub type daddr_t = c_long; +pub type daddr32_t = c_int; pub type dev_t = c_ulong; +pub type dev32_t = c_uint; +pub type chan_t = c_int; +pub type pid_t = c_int; +pub type pid64_t = u64; +pub type tid_t = c_long; +pub type tid32_t = c_int; +pub type tid64_t = u64; +#[deprecated( + since = "0.2.187", + note = "Use `fpos_t` instead. Their definitions are equivalent." +)] pub type fpos64_t = c_longlong; pub type fsblkcnt_t = c_ulong; pub type fsfilcnt_t = c_ulong; pub type ino_t = c_ulong; +pub type ino32_t = c_uint; +pub type cnt_t = c_short; pub type key_t = c_int; pub type mode_t = c_uint; pub type nlink_t = c_short; +pub type rid_t = c_uint; +pub type authnum_t = c_ushort; +pub type mid_t = __ptr32; pub type rlim_t = c_ulong; +pub type rlim32_t = c_uint; pub type speed_t = c_uint; pub type tcflag_t = c_uint; +pub type fpos_t = c_long; pub type time_t = c_long; +#[deprecated( + since = "0.2.187", + note = "Use `time_t` intead. Their definitions are equivalent." +)] pub type time64_t = i64; pub type timer_t = c_long; +pub type time32_t = c_int; pub type wchar_t = c_uint; pub type nfds_t = c_uint; pub type projid_t = c_int; pub type id_t = c_uint; -pub type blksize64_t = c_ulonglong; -pub type blkcnt64_t = c_ulonglong; +pub type blkcnt_t = c_long; +pub type blkcnt32_t = c_int; +pub type blkcnt64_t = u64; +pub type blksize_t = c_long; +pub type blksize32_t = c_int; +pub type blksize64_t = u64; pub type suseconds_t = c_int; pub type useconds_t = c_uint; pub type off_t = c_long; pub type offset_t = c_longlong; +#[deprecated( + since = "0.2.187", + note = "Use `off_t` instead. Their definitions are equivalent." +)] pub type off64_t = c_longlong; pub type idtype_t = c_uint; +pub type unique_id_t = unique_id; pub type socklen_t = c_uint; pub type sa_family_t = c_uchar; @@ -43,12 +108,16 @@ pub type signal_t = c_int; pub type pthread_t = c_uint; pub type pthread_key_t = c_uint; pub type thread_t = pthread_t; -pub type blksize_t = c_long; pub type nl_item = c_int; pub type mqd_t = c_int; pub type shmatt_t = c_ulong; pub type regoff_t = c_long; +#[deprecated( + since = "0.2.187", + note = "Use `rlim_t` instead. Their definitions are equivalent." +)] pub type rlim64_t = c_ulonglong; +pub type soff_t = c_int; pub type sem_t = c_int; pub type pollset_t = c_int; @@ -61,6 +130,13 @@ pub type pthread_attr_t = *mut c_void; pub type pthread_barrierattr_t = *mut c_void; pub type posix_spawn_file_actions_t = *mut c_char; pub type iconv_t = *mut c_void; +pub type simple_lock_data = c_int; +pub type complex_lock_status = c_int; + +pub type __long32_t = c_int; +pub type __ulong32_t = c_uint; +pub type long32int64_t = c_long; +pub type ulong32int64_t = c_ulong; c_enum! { #[repr(u32)] @@ -80,12 +156,304 @@ c_enum! { } s! { + pub struct _simple_lock { + pub _slock: simple_lock_data, + pub _slockp: *mut lock_data_instrumented, + } + + pub struct _complex_lock { + pub _clock: complex_lock_data, + pub clockp: *mut lock_data_instrumented, + } + + pub struct _drw_lock { + pub _drwlock: complex_lock_status, + pub _drwlockp: *mut lock_data_instrumented, + } + + pub struct lock_data_instrumented { + pub lock_control_word: __c_anonymous_lock_data_instrumented_lock_control_word, + pub li_flags: c_uint, + reserved: Padding<[c_int; 1]>, + _lockname: __c_anonymous_lock_data_instrumented__lockname, + + #[cfg(debug_assertions)] + pub lock_lr: c_int, + #[cfg(debug_assertions)] + pub unlock_lr: c_int, + #[cfg(debug_assertions)] + pub lock_caller: tid_t, + #[cfg(debug_assertions)] + pub unlock_caller: tid_t, + #[cfg(debug_assertions)] + pub lock_cpuid: c_int, + #[cfg(debug_assertions)] + pub dbg_zero: c_int, + #[cfg(debug_assertions)] + pub unlock_cpuid: c_int, + #[cfg(debug_assertions)] + pub dbg_flags: c_int, + } + + pub struct __c_anonymous__lockname__lock_id { + _id: c_uint, + pub ocurrence: c_uint, + } + + pub struct complex_lock_data { + pub status: complex_lock_status, + pub flags: c_short, + pub recursion_depth: c_short, + pub reserved: c_uint, + } + + pub struct drw_lock_data { + pub status: complex_lock_status, + } + + pub struct sigset_t { + pub ss_set: [c_ulong; 4], + } + + pub struct fd_set { + pub fds_bits: [c_long; 1024], + } + + pub struct pthread_rwlock_t { + __rw_word: [c_long; 10], + } + + pub struct pthread_cond_t { + __cv_word: [c_long; 6], + } + + pub struct pthread_mutex_t { + __mt_word: [c_long; 8], + } + + pub struct pthread_once_t { + __on_word: [c_long; 9], + } + + pub struct aiocb { + pub aio_lio_opcode: c_int, + pub aio_fildes: c_int, + pub aio_word1: c_int, + pub aio_offset: off_t, + pub aio_buf: *mut c_void, + pub aio_return: ssize_t, + pub aio_errno: c_int, + pub aio_nbytes: size_t, + pub aio_reqprio: c_int, + pub aio_sigevent: sigevent, + pub aio_word2: c_int, + pub aio_fp: c_int, + pub aio_handle: *mut aiocb, + aio_reserved: Padding<[c_uint; 2]>, + pub aio_sigev_tid: c_long, + } + + pub struct __vmxreg_t { + __v: [c_uint; 4], + } + + pub struct __vmx_context_t { + pub __vr: [crate::__vmxreg_t; 32], + pub __pad1: [c_uint; 3], + pub __vscr: c_uint, + pub __vrsave: c_uint, + pub __pad2: [c_uint; 3], + } + + pub struct __vsx_context_t { + pub __vsr_dw1: [c_ulonglong; 32], + } + + pub struct __tm_context_t { + pub vmx: __vmx_context_t, + pub vsx: __vsx_context_t, + pub gpr: [c_ulonglong; 32], + pub lr: c_ulonglong, + pub ctr: c_ulonglong, + pub cr: c_uint, + pub xer: c_uint, + pub amr: c_ulonglong, + pub texasr: c_ulonglong, + pub tfiar: c_ulonglong, + pub tfhar: c_ulonglong, + pub ppr: c_ulonglong, + pub dscr: c_ulonglong, + pub tar: c_ulonglong, + pub fpscr: c_uint, + pub fpscrx: c_uint, + pub fpr: [fpreg_t; 32], + pub tmcontext: c_char, + pub tmstate: c_char, + pub prevowner: c_char, + pub pad: [c_char; 5], + } + + pub struct __context64 { + pub gpr: [c_ulonglong; 32], + pub msr: c_ulonglong, + pub iar: c_ulonglong, + pub lr: c_ulonglong, + pub ctr: c_ulonglong, + pub cr: c_uint, + pub xer: c_uint, + pub fpscr: c_uint, + pub fpscrx: c_uint, + pub except: [c_ulonglong; 1], + pub fpr: [fpreg_t; 32], + pub fpeu: c_char, + pub fpinfo: c_char, + pub fpscr24_31: c_char, + pub pad: [c_char; 1], + pub excp_type: c_int, + } + + pub struct mcontext_t { + pub jmp_context: __context64, + } + + pub struct __extctx_t { + pub __flags: c_uint, + pub __rsvd1: [c_uint; 3], + pub __vmx: __vmx_context_t, + pub __ukeys: [c_uint; 2], + pub __vsx: __vsx_context_t, + pub __tm: __tm_context_t, + __reserved: Padding<[c_char; 1860]>, + pub __extctx_magic: c_int, + } + + pub struct ucontext_t { + __sc_onstack: c_int, + pub uc_sigmask: sigset_t, + __sc_uerror: c_int, + pub uc_mcontext: mcontext_t, + pub uc_link: *mut ucontext_t, + pub uc_stack: stack_t, + __extctx: *mut __extctx_t, + __extctx_magic: c_int, + __pad: Padding<[c_int; 1]>, + } + + pub struct utmpx { + pub ut_user: [c_char; 256], + pub ut_id: [c_char; 14], + pub ut_line: [c_char; 64], + pub ut_pid: pid_t, + pub ut_type: c_short, + pub ut_tv: crate::timeval, + pub ut_host: [c_char; 256], + __dbl_word_pad: Padding, + __reservedA: Padding<[c_int; 2]>, + __reservedV: Padding<[c_int; 6]>, + } + + pub struct pthread_spinlock_t { + __sp_word: [c_long; 3], + } + + pub struct pthread_barrier_t { + __br_word: [c_long; 5], + } + + pub struct msqid_ds { + pub msg_perm: ipc_perm, + pub msg_first: c_uint, + pub msg_last: c_uint, + pub msg_cbytes: c_uint, + pub msg_qnum: c_uint, + pub msg_qbytes: c_ulong, + pub msg_lspid: pid_t, + pub msg_lrpid: pid_t, + pub msg_stime: time_t, + pub msg_rtime: time_t, + pub msg_ctime: time_t, + pub msg_rwait: c_int, + pub msg_wwait: c_int, + pub msg_reqevents: c_ushort, + } + + pub struct siginfo_t { + pub si_signo: c_int, + pub si_errno: c_int, + pub si_code: c_int, + pub si_pid: pid_t, + pub si_uid: crate::uid_t, + pub si_status: c_int, + pub si_addr: *mut c_void, + pub si_band: c_long, + pub si_value: crate::sigval, + __si_flags: c_int, + __pad: Padding<[c_int; 3]>, + } + + pub struct pollfd_ext_t { + pub fd: c_int, + pub events: c_short, + pub revents: c_short, + pub u: __c_anonymous_pollfd_ext_t_u, + } + + pub struct __c_anonymous_physaddr_t { + pub r: [c_int; 1], + } + + pub struct unique_id { + pub word1: __ulong32_t, + pub word2: __ulong32_t, + pub word3: __ulong32_t, + pub word4: __ulong32_t, + } + + pub struct imaxdiv_t { + pub quot: crate::intmax_t, + pub rem: crate::intmax_t, + } + + pub struct filehandle { + pub fh_fsid: fsid_t, + pub fh_fid: fileid, + } + + pub struct fileid { + pub fid_len: c_uint, + pub fid_ino: ino32_t, + pub fid_gen: c_uint, + pub fid_x: [c_char; MAXFIDSZ as usize - size_of::() - size_of::()], + } + + pub struct fid { + pub fid_len: c_uint, + pub fid_data: [c_char; MAXFIDSZ as usize], + } + + pub struct fhandle { + pub x: [c_char; FHSIZE as usize], + } + + pub struct sigset { + pub ss_set: [c_ulong; 4], + } + + pub struct fsid { + pub val: [c_uint; 2], + } + + pub struct sigset32_t { + pub losigs: c_uint, + pub hisigs: c_uint, + } + pub struct fsid_t { pub val: [c_uint; 2], } pub struct fsid64_t { - pub val: [crate::uint64_t; 2], + pub val: [u64; 2], } pub struct timezone { @@ -100,33 +468,47 @@ s! { pub struct dirent { pub d_offset: c_ulong, - pub d_ino: crate::ino_t, + pub d_ino: ino_t, pub d_reclen: c_ushort, pub d_namlen: c_ushort, pub d_name: [c_char; 256], } pub struct termios { - pub c_iflag: crate::tcflag_t, - pub c_oflag: crate::tcflag_t, - pub c_cflag: crate::tcflag_t, - pub c_lflag: crate::tcflag_t, - pub c_cc: [crate::cc_t; crate::NCCS], + pub c_iflag: tcflag_t, + pub c_oflag: tcflag_t, + pub c_cflag: tcflag_t, + pub c_lflag: tcflag_t, + pub c_cc: [crate::cc_t; NCCS], + } + + pub struct flock { + pub l_type: c_short, + pub l_whence: c_short, + pub l_sysid: c_uint, + pub l_pid: pid_t, + pub l_vfs: c_int, + pub l_start: off_t, + pub l_len: off_t, } + #[deprecated( + since = "0.2.187", + note = "Use `flock` instead. Their definitions are equivalent." + )] pub struct flock64 { pub l_type: c_short, pub l_whence: c_short, pub l_sysid: c_uint, - pub l_pid: crate::pid_t, + pub l_pid: pid_t, pub l_vfs: c_int, - pub l_start: off64_t, - pub l_len: off64_t, + pub l_start: off_t, + pub l_len: off_t, } pub struct msghdr { pub msg_name: *mut c_void, - pub msg_namelen: crate::socklen_t, + pub msg_namelen: socklen_t, pub msg_iov: *mut crate::iovec, pub msg_iovlen: c_int, pub msg_control: *mut c_void, @@ -134,15 +516,33 @@ s! { pub msg_flags: c_int, } + pub struct statvfs { + pub f_bsize: c_ulong, + pub f_frsize: c_ulong, + pub f_blocks: fsblkcnt_t, + pub f_bfree: fsblkcnt_t, + pub f_bavail: fsblkcnt_t, + pub f_files: fsfilcnt_t, + pub f_ffree: fsfilcnt_t, + pub f_favail: fsfilcnt_t, + pub f_fsid: fsid_t, + pub f_basetype: [c_char; 16], + pub f_flag: c_ulong, + pub f_namemax: c_ulong, + pub f_fstr: [c_char; 32], + pub f_filler: [c_ulong; 16], + } + + #[cfg(aix_large_file_api)] pub struct statvfs64 { - pub f_bsize: crate::blksize64_t, - pub f_frsize: crate::blksize64_t, - pub f_blocks: crate::blkcnt64_t, - pub f_bfree: crate::blkcnt64_t, - pub f_bavail: crate::blkcnt64_t, - pub f_files: crate::blkcnt64_t, - pub f_ffree: crate::blkcnt64_t, - pub f_favail: crate::blkcnt64_t, + pub f_bsize: blksize64_t, + pub f_frsize: blksize64_t, + pub f_blocks: blkcnt64_t, + pub f_bfree: blkcnt64_t, + pub f_bavail: blkcnt64_t, + pub f_files: blkcnt64_t, + pub f_ffree: blkcnt64_t, + pub f_favail: blkcnt64_t, pub f_fsid: fsid64_t, pub f_basetype: [c_char; 16], pub f_flag: c_ulong, @@ -199,13 +599,13 @@ s! { pub ai_protocol: c_int, pub ai_addrlen: c_ulong, pub ai_canonname: *mut c_char, - pub ai_addr: *mut crate::sockaddr, + pub ai_addr: *mut sockaddr, pub ai_next: *mut addrinfo, pub ai_eflags: c_int, } pub struct in_addr { - pub s_addr: in_addr_t, + pub s_addr: crate::in_addr_t, } pub struct ip_mreq_source { @@ -234,7 +634,7 @@ s! { pub struct sockaddr_in { pub sin_len: c_uchar, pub sin_family: sa_family_t, - pub sin_port: in_port_t, + pub sin_port: crate::in_port_t, pub sin_addr: in_addr, pub sin_zero: [c_uchar; 8], } @@ -242,17 +642,17 @@ s! { pub struct sockaddr_in6 { pub sin6_len: c_uchar, pub sin6_family: c_uchar, - pub sin6_port: crate::uint16_t, - pub sin6_flowinfo: crate::uint32_t, + pub sin6_port: u16, + pub sin6_flowinfo: u32, pub sin6_addr: crate::in6_addr, - pub sin6_scope_id: crate::uint32_t, + pub sin6_scope_id: u32, } pub struct sockaddr_storage { pub __ss_len: c_uchar, pub ss_family: sa_family_t, __ss_pad1: Padding<[c_char; 6]>, - __ss_align: crate::int64_t, + __ss_align: i64, __ss_pad2: Padding<[c_char; 1265]>, } @@ -263,10 +663,32 @@ s! { } pub struct st_timespec { - pub tv_sec: crate::time_t, + pub tv_sec: time_t, pub tv_nsec: c_int, } + pub struct statfs { + pub f_version: c_int, + pub f_type: c_int, + pub f_bsize: fsblkcnt_t, + pub f_blocks: fsblkcnt_t, + pub f_bfree: fsblkcnt_t, + pub f_bavail: fsblkcnt_t, + pub f_files: fsblkcnt_t, + pub f_ffree: fsblkcnt_t, + pub f_fsid: fsid_t, + pub f_vfstype: c_int, + pub f_fsize: c_ulong, + pub f_vfsnumber: c_int, + pub f_vfsoff: c_int, + pub f_vfslen: c_int, + pub f_vfsvers: c_int, + pub f_fname: [c_char; 32], + pub f_fpack: [c_char; 32], + pub f_name_max: c_int, + } + + #[cfg(aix_large_file_api)] pub struct statfs64 { pub f_version: c_int, pub f_type: c_int, @@ -274,8 +696,8 @@ s! { pub f_blocks: blkcnt64_t, pub f_bfree: blkcnt64_t, pub f_bavail: blkcnt64_t, - pub f_files: crate::uint64_t, - pub f_ffree: crate::uint64_t, + pub f_files: u64, + pub f_ffree: u64, pub f_fsid: fsid64_t, pub f_vfstype: c_int, pub f_fsize: blksize64_t, @@ -313,7 +735,7 @@ s! { } pub struct cmsghdr { - pub cmsg_len: crate::socklen_t, + pub cmsg_len: socklen_t, pub cmsg_level: c_int, pub cmsg_type: c_int, } @@ -343,16 +765,16 @@ s! { pub header_data: *mut c_void, pub header_length: c_uint, pub file_descriptor: c_int, - pub file_size: crate::uint64_t, - pub file_offset: crate::uint64_t, - pub file_bytes: crate::int64_t, + pub file_size: u64, + pub file_offset: u64, + pub file_bytes: i64, pub trailer_data: *mut c_void, pub trailer_length: c_uint, - pub bytes_sent: crate::uint64_t, + pub bytes_sent: u64, } pub struct mmsghdr { - pub msg_hdr: crate::msghdr, + pub msg_hdr: msghdr, pub msg_len: c_uint, } @@ -366,14 +788,14 @@ s! { pub ss_sp: *mut c_void, pub ss_size: size_t, pub ss_flags: c_int, - pub __pad: [c_int; 4], + __pad: Padding<[c_int; 4]>, } pub struct posix_spawnattr_t { pub posix_attr_flags: c_short, - pub posix_attr_pgroup: crate::pid_t, - pub posix_attr_sigmask: crate::sigset_t, - pub posix_attr_sigdefault: crate::sigset_t, + pub posix_attr_pgroup: pid_t, + pub posix_attr_sigmask: sigset_t, + pub posix_attr_sigdefault: sigset_t, pub posix_attr_schedpolicy: c_int, pub posix_attr_schedparam: sched_param, } @@ -408,14 +830,14 @@ s! { pub ut_user: [c_char; 256], pub ut_id: [c_char; 14], pub ut_line: [c_char; 64], - pub ut_pid: crate::pid_t, + pub ut_pid: pid_t, pub ut_type: c_short, pub ut_time: time64_t, pub ut_exit: exit_status, pub ut_host: [c_char; 256], - pub __dbl_word_pad: c_int, - pub __reservedA: [c_int; 2], - pub __reservedV: [c_int; 6], + __dbl_word_pad: Padding, + __reservedA: Padding<[c_int; 2]>, + __reservedV: Padding<[c_int; 6]>, } pub struct regmatch_t { @@ -429,7 +851,7 @@ s! { pub re_cflags: c_int, pub re_erroff: size_t, pub re_len: size_t, - pub re_ucoll: [crate::wchar_t; 2], + pub re_ucoll: [wchar_t; 2], pub re_lsub: [*mut c_void; 24], pub re_esub: [*mut c_void; 24], pub re_map: *mut c_uchar, @@ -437,6 +859,10 @@ s! { __unused: Padding<[*mut c_void; 34]>, } + #[deprecated( + since = "0.2.187", + note = "Use `rlimit` instead. Their definitions are equivalent." + )] pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -445,21 +871,49 @@ s! { pub struct shmid_ds { pub shm_perm: ipc_perm, pub shm_segsz: size_t, - pub shm_lpid: crate::pid_t, - pub shm_cpid: crate::pid_t, + pub shm_lpid: pid_t, + pub shm_cpid: pid_t, pub shm_nattch: shmatt_t, pub shm_cnattch: shmatt_t, pub shm_atime: time_t, pub shm_dtime: time_t, pub shm_ctime: time_t, - pub shm_handle: crate::uint32_t, + pub shm_handle: u32, pub shm_extshm: c_int, - pub shm_pagesize: crate::int64_t, - pub shm_lba: crate::uint64_t, - shm_reserved0: Padding, - shm_reserved1: Padding, + pub shm_pagesize: i64, + pub shm_lba: u64, + shm_reserved0: Padding, + shm_reserved1: Padding, } + 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_flag: c_ushort, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: dev_t, + pub st_ssize: c_int, + pub st_atim: st_timespec, + pub st_mtim: st_timespec, + pub st_ctim: st_timespec, + pub st_blksize: blksize_t, + pub st_blocks: blkcnt_t, + pub st_vfstype: c_int, + pub st_vfs: c_uint, + pub st_type: c_uint, + pub st_gen: c_uint, + st_reserved: Padding<[c_uint; 9]>, + st_padto_ll: Padding, + pub st_size: off_t, + } + + #[deprecated( + since = "0.2.187", + note = "Use `stat` instead. Their definitions are equivalent." + )] pub struct stat64 { pub st_dev: dev_t, pub st_ino: ino_t, @@ -480,7 +934,7 @@ s! { pub st_type: c_uint, pub st_gen: c_uint, st_reserved: Padding<[c_uint; 10]>, - pub st_size: off64_t, + pub st_size: off_t, } pub struct mntent { @@ -537,28 +991,209 @@ s! { pub sa_flags: c_int, } - pub struct poll_ctl_ext { + pub struct poll_ctl_ext_t { pub version: u8, pub command: u8, pub events: c_short, pub fd: c_int, - pub u: __poll_ctl_ext_u, + pub u: __c_anonymous_poll_ctl_ext_t_u, reserved64: Padding<[u64; 6]>, } } +impl fsid { + pub fn fsid_dev(&self) -> c_uint { + self.val[0] + } + + pub fn fsid_type(&self) -> c_uint { + self.val[1] + } +} + +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut c_void { + self.si_addr + } + + pub unsafe fn si_value(&self) -> crate::sigval { + self.si_value + } + + pub unsafe fn si_pid(&self) -> crate::pid_t { + self.si_pid + } + + pub unsafe fn si_uid(&self) -> crate::uid_t { + self.si_uid + } + + pub unsafe fn si_status(&self) -> c_int { + self.si_status + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for __c_anonymous_pollfd_ext_t_u { + fn eq(&self, other: &__c_anonymous_pollfd_ext_t_u) -> bool { + unsafe { + self.addr == other.addr + && self.data32 == other.data32 + && self.data == other.data + } + } + } + impl Eq for __c_anonymous_pollfd_ext_t_u {} + impl hash::Hash for __c_anonymous_pollfd_ext_t_u { + fn hash(&self, state: &mut H) { + unsafe { + self.addr.hash(state); + self.data.hash(state); + self.data32.hash(state); + } + } + } + + impl PartialEq for fpreg_t { + fn eq(&self, other: &fpreg_t) -> bool { + self.d == other.d + } + } + impl Eq for fpreg_t {} + impl hash::Hash for fpreg_t { + fn hash(&self, state: &mut H) { + let d: u64 = self.d.to_bits(); + d.hash(state); + } + } + } +} + +extern_ty! { + /// This is meant to be the `file` type upstream under `sys/ldr.h`. We + /// currently expose the kernel definition but that is slated for removal. + /// This opaque type will then be renamed to `file`. + pub type _file; +} + s_no_extra_traits! { - pub union __poll_ctl_ext_u { + pub union __c_anonymous_poll_ctl_ext_t_u { pub addr: *mut c_void, pub data32: u32, pub data: u64, } + + pub union __c_anonymous_lock_data_instrumented_lock_control_word { + pub s_lock: simple_lock_data, + pub c_lock: complex_lock_data, + pub drw_lock: drw_lock_data, + pub lock_next: *mut lock_data_instrumented, + } + + pub union __c_anonymous_lock_data_instrumented__lockname { + pub name: c_long, + _lock_id: __c_anonymous__lockname__lock_id, + } + + #[deprecated( + since = "0.2.187", + note = "Use `_simple_lock` instead. This type doesn't exist upstream." + )] + pub union _kernel_simple_lock { + pub _slock: c_long, + pub _slockp: *mut lock_data_instrumented, + } + + #[deprecated( + since = "0.2.187", + note = "This type is only available when programming against the kernel." + )] + #[allow(deprecated)] + pub struct fileops_t { + pub fo_rw: Option< + extern "C" fn( + file: *mut file, + rw: uio_rw, + io: *mut c_void, + ext: c_long, + secattr: *mut c_void, + ) -> c_int, + >, + pub fo_ioctl: Option< + extern "C" fn(file: *mut file, a: c_long, b: caddr_t, c: c_long, d: c_long) -> c_int, + >, + pub fo_select: Option< + extern "C" fn( + file: *mut file, + a: c_int, + b: c_ushort, + c: *mut c_ushort, + c: extern "C" fn(), + ) -> c_int, + >, + pub fo_close: Option c_int>, + pub fo_fstat: Option c_int>, + } + + #[deprecated( + since = "0.2.187", + note = "This type is only available when programming against the kernel." + )] + #[allow(deprecated)] + #[repr(align(256))] + pub struct file { + pub f_flag: c_long, + pub f_count: c_int, + pub f_options: c_short, + pub f_type: c_short, + // Should be pointer to 'vnode' + pub f_data: *mut c_void, + pub f_offset: offset_t, + pub f_dir_off: off_t, + // Should be pointer to 'cred' + pub f_cred: *mut c_void, + pub f_lock: _simple_lock, + pub f_offset_lock: _simple_lock, + pub f_vinfo: caddr_t, + pub f_ops: *mut fileops_t, + pub f_parentp: caddr_t, + pub f_fnamep: caddr_t, + pub f_fdata: [c_char; 160], + } + + pub union __c_anonymous_ld_info__file { + pub _ldinfo_fd: c_int, + pub _ldinfo_fp: *mut _file, + pub _core_offset: c_long, + } + + pub struct ld_info { + pub ldinfo_next: c_uint, + pub ldinfo_flags: c_uint, + pub _file: __c_anonymous_ld_info__file, + pub ldinfo_textorg: *mut c_void, + pub ldinfo_textsize: c_ulong, + pub ldinfo_dataorg: *mut c_void, + pub ldinfo_datasize: c_ulong, + pub ldinfo_filename: [c_char; 2], + } + + pub union __c_anonymous_pollfd_ext_t_u { + pub addr: *mut c_void, + pub data32: u32, + pub data: u64, + } + + pub struct fpreg_t { + pub d: c_double, + } } cfg_if! { if #[cfg(feature = "extra_traits")] { - impl PartialEq for __poll_ctl_ext_u { - fn eq(&self, other: &__poll_ctl_ext_u) -> bool { + impl PartialEq for __c_anonymous_poll_ctl_ext_t_u { + fn eq(&self, other: &__c_anonymous_poll_ctl_ext_t_u) -> bool { unsafe { self.addr == other.addr && self.data32 == other.data32 @@ -566,8 +1201,8 @@ cfg_if! { } } } - impl Eq for __poll_ctl_ext_u {} - impl hash::Hash for __poll_ctl_ext_u { + impl Eq for __c_anonymous_poll_ctl_ext_t_u {} + impl hash::Hash for __c_anonymous_poll_ctl_ext_t_u { fn hash(&self, state: &mut H) { unsafe { self.addr.hash(state); @@ -657,63 +1292,63 @@ pub const GLOB_NOMATCH: c_int = 0x4000; pub const GLOB_NOSYS: c_int = 0x8000; // langinfo.h -pub const DAY_1: crate::nl_item = 13; -pub const DAY_2: crate::nl_item = 14; -pub const DAY_3: crate::nl_item = 15; -pub const DAY_4: crate::nl_item = 16; -pub const DAY_5: crate::nl_item = 17; -pub const DAY_6: crate::nl_item = 18; -pub const DAY_7: crate::nl_item = 19; -pub const ABDAY_1: crate::nl_item = 6; -pub const ABDAY_2: crate::nl_item = 7; -pub const ABDAY_3: crate::nl_item = 8; -pub const ABDAY_4: crate::nl_item = 9; -pub const ABDAY_5: crate::nl_item = 10; -pub const ABDAY_6: crate::nl_item = 11; -pub const ABDAY_7: crate::nl_item = 12; -pub const MON_1: crate::nl_item = 32; -pub const MON_2: crate::nl_item = 33; -pub const MON_3: crate::nl_item = 34; -pub const MON_4: crate::nl_item = 35; -pub const MON_5: crate::nl_item = 36; -pub const MON_6: crate::nl_item = 37; -pub const MON_7: crate::nl_item = 38; -pub const MON_8: crate::nl_item = 39; -pub const MON_9: crate::nl_item = 40; -pub const MON_10: crate::nl_item = 41; -pub const MON_11: crate::nl_item = 42; -pub const MON_12: crate::nl_item = 43; -pub const ABMON_1: crate::nl_item = 20; -pub const ABMON_2: crate::nl_item = 21; -pub const ABMON_3: crate::nl_item = 22; -pub const ABMON_4: crate::nl_item = 23; -pub const ABMON_5: crate::nl_item = 24; -pub const ABMON_6: crate::nl_item = 25; -pub const ABMON_7: crate::nl_item = 26; -pub const ABMON_8: crate::nl_item = 27; -pub const ABMON_9: crate::nl_item = 28; -pub const ABMON_10: crate::nl_item = 29; -pub const ABMON_11: crate::nl_item = 30; -pub const ABMON_12: crate::nl_item = 31; -pub const RADIXCHAR: crate::nl_item = 44; -pub const THOUSEP: crate::nl_item = 45; -pub const YESSTR: crate::nl_item = 46; -pub const NOSTR: crate::nl_item = 47; -pub const CRNCYSTR: crate::nl_item = 48; -pub const D_T_FMT: crate::nl_item = 1; -pub const D_FMT: crate::nl_item = 2; -pub const T_FMT: crate::nl_item = 3; -pub const AM_STR: crate::nl_item = 4; -pub const PM_STR: crate::nl_item = 5; -pub const CODESET: crate::nl_item = 49; -pub const T_FMT_AMPM: crate::nl_item = 55; -pub const ERA: crate::nl_item = 56; -pub const ERA_D_FMT: crate::nl_item = 57; -pub const ERA_D_T_FMT: crate::nl_item = 58; -pub const ERA_T_FMT: crate::nl_item = 59; -pub const ALT_DIGITS: crate::nl_item = 60; -pub const YESEXPR: crate::nl_item = 61; -pub const NOEXPR: crate::nl_item = 62; +pub const DAY_1: nl_item = 13; +pub const DAY_2: nl_item = 14; +pub const DAY_3: nl_item = 15; +pub const DAY_4: nl_item = 16; +pub const DAY_5: nl_item = 17; +pub const DAY_6: nl_item = 18; +pub const DAY_7: nl_item = 19; +pub const ABDAY_1: nl_item = 6; +pub const ABDAY_2: nl_item = 7; +pub const ABDAY_3: nl_item = 8; +pub const ABDAY_4: nl_item = 9; +pub const ABDAY_5: nl_item = 10; +pub const ABDAY_6: nl_item = 11; +pub const ABDAY_7: nl_item = 12; +pub const MON_1: nl_item = 32; +pub const MON_2: nl_item = 33; +pub const MON_3: nl_item = 34; +pub const MON_4: nl_item = 35; +pub const MON_5: nl_item = 36; +pub const MON_6: nl_item = 37; +pub const MON_7: nl_item = 38; +pub const MON_8: nl_item = 39; +pub const MON_9: nl_item = 40; +pub const MON_10: nl_item = 41; +pub const MON_11: nl_item = 42; +pub const MON_12: nl_item = 43; +pub const ABMON_1: nl_item = 20; +pub const ABMON_2: nl_item = 21; +pub const ABMON_3: nl_item = 22; +pub const ABMON_4: nl_item = 23; +pub const ABMON_5: nl_item = 24; +pub const ABMON_6: nl_item = 25; +pub const ABMON_7: nl_item = 26; +pub const ABMON_8: nl_item = 27; +pub const ABMON_9: nl_item = 28; +pub const ABMON_10: nl_item = 29; +pub const ABMON_11: nl_item = 30; +pub const ABMON_12: nl_item = 31; +pub const RADIXCHAR: nl_item = 44; +pub const THOUSEP: nl_item = 45; +pub const YESSTR: nl_item = 46; +pub const NOSTR: nl_item = 47; +pub const CRNCYSTR: nl_item = 48; +pub const D_T_FMT: nl_item = 1; +pub const D_FMT: nl_item = 2; +pub const T_FMT: nl_item = 3; +pub const AM_STR: nl_item = 4; +pub const PM_STR: nl_item = 5; +pub const CODESET: nl_item = 49; +pub const T_FMT_AMPM: nl_item = 55; +pub const ERA: nl_item = 56; +pub const ERA_D_FMT: nl_item = 57; +pub const ERA_D_T_FMT: nl_item = 58; +pub const ERA_T_FMT: nl_item = 59; +pub const ALT_DIGITS: nl_item = 60; +pub const YESEXPR: nl_item = 61; +pub const NOEXPR: nl_item = 62; // locale.h pub const LC_GLOBAL_LOCALE: crate::locale_t = -1isize as crate::locale_t; @@ -738,14 +1373,14 @@ pub const LC_ALL_MASK: c_int = LC_COLLATE_MASK | LC_TIME_MASK; // netdb.h -pub const NI_MAXHOST: crate::socklen_t = 1025; -pub const NI_MAXSERV: crate::socklen_t = 32; -pub const NI_NOFQDN: crate::socklen_t = 0x1; -pub const NI_NUMERICHOST: crate::socklen_t = 0x2; -pub const NI_NAMEREQD: crate::socklen_t = 0x4; -pub const NI_NUMERICSERV: crate::socklen_t = 0x8; -pub const NI_DGRAM: crate::socklen_t = 0x10; -pub const NI_NUMERICSCOPE: crate::socklen_t = 0x40; +pub const NI_MAXHOST: socklen_t = 1025; +pub const NI_MAXSERV: socklen_t = 32; +pub const NI_NOFQDN: socklen_t = 0x1; +pub const NI_NUMERICHOST: socklen_t = 0x2; +pub const NI_NAMEREQD: socklen_t = 0x4; +pub const NI_NUMERICSERV: socklen_t = 0x8; +pub const NI_DGRAM: socklen_t = 0x10; +pub const NI_NUMERICSCOPE: socklen_t = 0x40; pub const EAI_AGAIN: c_int = 2; pub const EAI_BADFLAGS: c_int = 3; pub const EAI_FAIL: c_int = 4; @@ -1105,6 +1740,18 @@ pub const PTHREAD_MUTEX_STALLED: c_int = 0; pub const PTHREAD_PRIO_INHERIT: c_int = 3; pub const PTHREAD_PRIO_NONE: c_int = 1; pub const PTHREAD_PRIO_PROTECT: c_int = 2; +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + __mt_word: [0, 2, 0, 0, 0, 0, 0, 0], +}; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + __cv_word: [0, 0, 0, 0, 2, 0], +}; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + __rw_word: [2, 0, 0, 0, 0, 0, 0, 0, 0, 0], +}; +pub const PTHREAD_ONCE_INIT: pthread_once_t = pthread_once_t { + __on_word: [0, 0, 0, 0, 0, 2, 0, 0, 0], +}; // regex.h pub const REG_EXTENDED: c_int = 1; @@ -1149,7 +1796,7 @@ pub const NFSMNT_ACDIRMAX: c_int = 0x0800; pub const CPUSTATES: c_int = 4; // semaphore.h -pub const SEM_FAILED: *mut sem_t = -1isize as *mut crate::sem_t; +pub const SEM_FAILED: *mut sem_t = -1isize as *mut sem_t; // spawn.h pub const POSIX_SPAWN_SETPGROUP: c_short = 0x1; @@ -1434,7 +2081,7 @@ pub const IPC_W: c_int = 0o0200; pub const IPC_O: c_int = 0o1000; pub const IPC_NOERROR: c_int = 0o10000; pub const IPC_STAT: c_int = 102; -pub const IPC_PRIVATE: crate::key_t = -1; +pub const IPC_PRIVATE: key_t = -1; pub const SHM_LOCK: c_int = 201; pub const SHM_UNLOCK: c_int = 202; @@ -1687,6 +2334,7 @@ pub const RLIM_SAVED_MAX: c_ulong = RLIM_INFINITY - 1; pub const RLIM_SAVED_CUR: c_ulong = RLIM_INFINITY - 2; #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: c_int = 10; +pub const RLIM_INFINITY: c_ulong = 0x7fffffffffffffff; // sys/sched.h pub const SCHED_OTHER: c_int = 0; @@ -2078,8 +2726,8 @@ pub const POWER_9: c_int = 0x20000; // sys/time.h pub const FD_SETSIZE: c_int = 65534; pub const TIMEOFDAY: c_int = 9; -pub const CLOCK_REALTIME: crate::clockid_t = TIMEOFDAY as clockid_t; -pub const CLOCK_MONOTONIC: crate::clockid_t = 10; +pub const CLOCK_REALTIME: clockid_t = TIMEOFDAY as clockid_t; +pub const CLOCK_MONOTONIC: clockid_t = 10; pub const TIMER_ABSTIME: c_int = 999; pub const ITIMER_REAL: c_int = 0; pub const ITIMER_VIRTUAL: c_int = 1; @@ -2096,8 +2744,8 @@ pub const DST_USA: c_int = 1; pub const DST_WET: c_int = 3; // sys/termio.h -pub const CSTART: crate::tcflag_t = 0o21; -pub const CSTOP: crate::tcflag_t = 0o23; +pub const CSTART: tcflag_t = 0o21; +pub const CSTOP: tcflag_t = 0o23; pub const TCGETA: c_int = TIOC | 5; pub const TCSETA: c_int = TIOC | 6; pub const TCSETAW: c_int = TIOC | 7; @@ -2146,6 +2794,14 @@ pub const TIOCMBIC: c_int = u32_cast_int(0x8004746b); pub const TIOCMGET: c_int = 0x4004746a; pub const TIOCREMOTE: c_int = u32_cast_int(0x80047469); +// sys/types.h +pub const NULL: c_int = 0; +pub const TRUE: c_int = 1; +pub const FALSE: c_int = 0; +pub const NBBY: c_int = 8; +pub const FHSIZE: c_int = 32; +pub const MAXFIDSZ: c_int = 64; + // sys/user.h pub const MAXCOMLEN: c_int = 32; pub const UF_SYSTEM: c_int = 0x1000; @@ -2173,44 +2829,44 @@ pub const _W_STRC: c_int = 0x0000007f; // termios.h pub const NCCS: usize = 16; -pub const OLCUC: crate::tcflag_t = 2; -pub const CSIZE: crate::tcflag_t = 0x00000030; -pub const CS5: crate::tcflag_t = 0x00000000; -pub const CS6: crate::tcflag_t = 0x00000010; -pub const CS7: crate::tcflag_t = 0x00000020; -pub const CS8: crate::tcflag_t = 0x00000030; -pub const CSTOPB: crate::tcflag_t = 0x00000040; -pub const ECHO: crate::tcflag_t = 0x00000008; -pub const ECHOE: crate::tcflag_t = 0x00000010; -pub const ECHOK: crate::tcflag_t = 0x00000020; -pub const ECHONL: crate::tcflag_t = 0x00000040; -pub const ECHOCTL: crate::tcflag_t = 0x00020000; -pub const ECHOPRT: crate::tcflag_t = 0x00040000; -pub const ECHOKE: crate::tcflag_t = 0x00080000; -pub const IGNBRK: crate::tcflag_t = 0x00000001; -pub const BRKINT: crate::tcflag_t = 0x00000002; -pub const IGNPAR: crate::tcflag_t = 0x00000004; -pub const PARMRK: crate::tcflag_t = 0x00000008; -pub const INPCK: crate::tcflag_t = 0x00000010; -pub const ISTRIP: crate::tcflag_t = 0x00000020; -pub const INLCR: crate::tcflag_t = 0x00000040; -pub const IGNCR: crate::tcflag_t = 0x00000080; -pub const ICRNL: crate::tcflag_t = 0x00000100; -pub const IXON: crate::tcflag_t = 0x00000200; -pub const IXOFF: crate::tcflag_t = 0x00000400; -pub const IXANY: crate::tcflag_t = 0x00001000; -pub const IMAXBEL: crate::tcflag_t = 0x00010000; -pub const OPOST: crate::tcflag_t = 0x00000001; -pub const ONLCR: crate::tcflag_t = 0x00000004; -pub const OCRNL: crate::tcflag_t = 0x00000008; -pub const ONOCR: crate::tcflag_t = 0x00000010; -pub const ONLRET: crate::tcflag_t = 0x00000020; -pub const CREAD: crate::tcflag_t = 0x00000080; -pub const IEXTEN: crate::tcflag_t = 0x00200000; -pub const TOSTOP: crate::tcflag_t = 0x00010000; -pub const FLUSHO: crate::tcflag_t = 0x00100000; -pub const PENDIN: crate::tcflag_t = 0x20000000; -pub const NOFLSH: crate::tcflag_t = 0x00000080; +pub const OLCUC: tcflag_t = 2; +pub const CSIZE: tcflag_t = 0x00000030; +pub const CS5: tcflag_t = 0x00000000; +pub const CS6: tcflag_t = 0x00000010; +pub const CS7: tcflag_t = 0x00000020; +pub const CS8: tcflag_t = 0x00000030; +pub const CSTOPB: tcflag_t = 0x00000040; +pub const ECHO: tcflag_t = 0x00000008; +pub const ECHOE: tcflag_t = 0x00000010; +pub const ECHOK: tcflag_t = 0x00000020; +pub const ECHONL: tcflag_t = 0x00000040; +pub const ECHOCTL: tcflag_t = 0x00020000; +pub const ECHOPRT: tcflag_t = 0x00040000; +pub const ECHOKE: tcflag_t = 0x00080000; +pub const IGNBRK: tcflag_t = 0x00000001; +pub const BRKINT: tcflag_t = 0x00000002; +pub const IGNPAR: tcflag_t = 0x00000004; +pub const PARMRK: tcflag_t = 0x00000008; +pub const INPCK: tcflag_t = 0x00000010; +pub const ISTRIP: tcflag_t = 0x00000020; +pub const INLCR: tcflag_t = 0x00000040; +pub const IGNCR: tcflag_t = 0x00000080; +pub const ICRNL: tcflag_t = 0x00000100; +pub const IXON: tcflag_t = 0x00000200; +pub const IXOFF: tcflag_t = 0x00000400; +pub const IXANY: tcflag_t = 0x00001000; +pub const IMAXBEL: tcflag_t = 0x00010000; +pub const OPOST: tcflag_t = 0x00000001; +pub const ONLCR: tcflag_t = 0x00000004; +pub const OCRNL: tcflag_t = 0x00000008; +pub const ONOCR: tcflag_t = 0x00000010; +pub const ONLRET: tcflag_t = 0x00000020; +pub const CREAD: tcflag_t = 0x00000080; +pub const IEXTEN: tcflag_t = 0x00200000; +pub const TOSTOP: tcflag_t = 0x00010000; +pub const FLUSHO: tcflag_t = 0x00100000; +pub const PENDIN: tcflag_t = 0x20000000; +pub const NOFLSH: tcflag_t = 0x00000080; pub const VINTR: usize = 0; pub const VQUIT: usize = 1; pub const VERASE: usize = 2; @@ -2228,67 +2884,67 @@ pub const VREPRINT: usize = 11; pub const VDISCRD: usize = 12; pub const VWERSE: usize = 13; pub const VLNEXT: usize = 14; -pub const B0: crate::speed_t = 0x0; -pub const B50: crate::speed_t = 0x1; -pub const B75: crate::speed_t = 0x2; -pub const B110: crate::speed_t = 0x3; -pub const B134: crate::speed_t = 0x4; -pub const B150: crate::speed_t = 0x5; -pub const B200: crate::speed_t = 0x6; -pub const B300: crate::speed_t = 0x7; -pub const B600: crate::speed_t = 0x8; -pub const B1200: crate::speed_t = 0x9; -pub const B1800: crate::speed_t = 0xa; -pub const B2400: crate::speed_t = 0xb; -pub const B4800: crate::speed_t = 0xc; -pub const B9600: crate::speed_t = 0xd; -pub const B19200: crate::speed_t = 0xe; -pub const B38400: crate::speed_t = 0xf; -pub const EXTA: crate::speed_t = B19200; -pub const EXTB: crate::speed_t = B38400; -pub const IUCLC: crate::tcflag_t = 0x00000800; -pub const OFILL: crate::tcflag_t = 0x00000040; -pub const OFDEL: crate::tcflag_t = 0x00000080; -pub const CRDLY: crate::tcflag_t = 0x00000300; -pub const CR0: crate::tcflag_t = 0x00000000; -pub const CR1: crate::tcflag_t = 0x00000100; -pub const CR2: crate::tcflag_t = 0x00000200; -pub const CR3: crate::tcflag_t = 0x00000300; -pub const TABDLY: crate::tcflag_t = 0x00000c00; -pub const TAB0: crate::tcflag_t = 0x00000000; -pub const TAB1: crate::tcflag_t = 0x00000400; -pub const TAB2: crate::tcflag_t = 0x00000800; -pub const TAB3: crate::tcflag_t = 0x00000c00; -pub const BSDLY: crate::tcflag_t = 0x00001000; -pub const BS0: crate::tcflag_t = 0x00000000; -pub const BS1: crate::tcflag_t = 0x00001000; -pub const FFDLY: crate::tcflag_t = 0x00002000; -pub const FF0: crate::tcflag_t = 0x00000000; -pub const FF1: crate::tcflag_t = 0x00002000; -pub const NLDLY: crate::tcflag_t = 0x00004000; -pub const NL0: crate::tcflag_t = 0x00000000; -pub const NL1: crate::tcflag_t = 0x00004000; -pub const VTDLY: crate::tcflag_t = 0x00008000; -pub const VT0: crate::tcflag_t = 0x00000000; -pub const VT1: crate::tcflag_t = 0x00008000; -pub const OXTABS: crate::tcflag_t = 0x00040000; -pub const ONOEOT: crate::tcflag_t = 0x00080000; -pub const CBAUD: crate::tcflag_t = 0x0000000f; -pub const PARENB: crate::tcflag_t = 0x00000100; -pub const PARODD: crate::tcflag_t = 0x00000200; -pub const HUPCL: crate::tcflag_t = 0x00000400; -pub const CLOCAL: crate::tcflag_t = 0x00000800; -pub const CIBAUD: crate::tcflag_t = 0x000f0000; -pub const IBSHIFT: crate::tcflag_t = 16; -pub const PAREXT: crate::tcflag_t = 0x00100000; -pub const ISIG: crate::tcflag_t = 0x00000001; -pub const ICANON: crate::tcflag_t = 0x00000002; -pub const XCASE: crate::tcflag_t = 0x00000004; -pub const ALTWERASE: crate::tcflag_t = 0x00400000; +pub const B0: speed_t = 0x0; +pub const B50: speed_t = 0x1; +pub const B75: speed_t = 0x2; +pub const B110: speed_t = 0x3; +pub const B134: speed_t = 0x4; +pub const B150: speed_t = 0x5; +pub const B200: speed_t = 0x6; +pub const B300: speed_t = 0x7; +pub const B600: speed_t = 0x8; +pub const B1200: speed_t = 0x9; +pub const B1800: speed_t = 0xa; +pub const B2400: speed_t = 0xb; +pub const B4800: speed_t = 0xc; +pub const B9600: speed_t = 0xd; +pub const B19200: speed_t = 0xe; +pub const B38400: speed_t = 0xf; +pub const EXTA: speed_t = B19200; +pub const EXTB: speed_t = B38400; +pub const IUCLC: tcflag_t = 0x00000800; +pub const OFILL: tcflag_t = 0x00000040; +pub const OFDEL: tcflag_t = 0x00000080; +pub const CRDLY: tcflag_t = 0x00000300; +pub const CR0: tcflag_t = 0x00000000; +pub const CR1: tcflag_t = 0x00000100; +pub const CR2: tcflag_t = 0x00000200; +pub const CR3: tcflag_t = 0x00000300; +pub const TABDLY: tcflag_t = 0x00000c00; +pub const TAB0: tcflag_t = 0x00000000; +pub const TAB1: tcflag_t = 0x00000400; +pub const TAB2: tcflag_t = 0x00000800; +pub const TAB3: tcflag_t = 0x00000c00; +pub const BSDLY: tcflag_t = 0x00001000; +pub const BS0: tcflag_t = 0x00000000; +pub const BS1: tcflag_t = 0x00001000; +pub const FFDLY: tcflag_t = 0x00002000; +pub const FF0: tcflag_t = 0x00000000; +pub const FF1: tcflag_t = 0x00002000; +pub const NLDLY: tcflag_t = 0x00004000; +pub const NL0: tcflag_t = 0x00000000; +pub const NL1: tcflag_t = 0x00004000; +pub const VTDLY: tcflag_t = 0x00008000; +pub const VT0: tcflag_t = 0x00000000; +pub const VT1: tcflag_t = 0x00008000; +pub const OXTABS: tcflag_t = 0x00040000; +pub const ONOEOT: tcflag_t = 0x00080000; +pub const CBAUD: tcflag_t = 0x0000000f; +pub const PARENB: tcflag_t = 0x00000100; +pub const PARODD: tcflag_t = 0x00000200; +pub const HUPCL: tcflag_t = 0x00000400; +pub const CLOCAL: tcflag_t = 0x00000800; +pub const CIBAUD: tcflag_t = 0x000f0000; +pub const IBSHIFT: tcflag_t = 16; +pub const PAREXT: tcflag_t = 0x00100000; +pub const ISIG: tcflag_t = 0x00000001; +pub const ICANON: tcflag_t = 0x00000002; +pub const XCASE: tcflag_t = 0x00000004; +pub const ALTWERASE: tcflag_t = 0x00400000; // time.h -pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 11; -pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 12; +pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 11; +pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 12; // unistd.h pub const _POSIX_VDISABLE: c_int = 0xff; @@ -2475,7 +3131,8 @@ f! { { ptr::null_mut() } else { - // AIX does not have any alignment/padding for ancillary data, so we don't need _CMSG_ALIGN here. + // AIX does not have any alignment/padding for ancillary data, + // so we don't need _CMSG_ALIGN here. (cmsg as usize + (*cmsg).cmsg_len as usize) as *mut cmsghdr } } @@ -2564,19 +3221,19 @@ safe_f! { false } - pub const fn major(dev: crate::dev_t) -> c_uint { + pub const fn major(dev: dev_t) -> c_uint { let x = dev >> 16; x as c_uint } - pub const fn minor(dev: crate::dev_t) -> c_uint { + pub const fn minor(dev: dev_t) -> c_uint { let y = dev & 0xFFFF; y as c_uint } - pub const fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t { - let major = major as crate::dev_t; - let minor = minor as crate::dev_t; + pub const fn makedev(major: c_uint, minor: c_uint) -> dev_t { + let major = major as dev_t; + let minor = minor as dev_t; let mut dev = 0; dev |= major << 16; dev |= minor; @@ -2599,85 +3256,70 @@ extern "C" { ) -> c_int; pub fn pthread_attr_getdetachstate( - attr: *const crate::pthread_attr_t, + attr: *const pthread_attr_t, detachstate: *mut c_int, ) -> c_int; - pub fn pthread_attr_getguardsize( - attr: *const crate::pthread_attr_t, - guardsize: *mut size_t, - ) -> c_int; + pub fn pthread_attr_getguardsize(attr: *const pthread_attr_t, guardsize: *mut size_t) -> c_int; pub fn pthread_attr_getinheritsched( - attr: *const crate::pthread_attr_t, + attr: *const pthread_attr_t, inheritsched: *mut c_int, ) -> c_int; pub fn pthread_attr_getschedparam( - attr: *const crate::pthread_attr_t, + attr: *const pthread_attr_t, param: *mut sched_param, ) -> c_int; pub fn pthread_attr_getstackaddr( - attr: *const crate::pthread_attr_t, + attr: *const pthread_attr_t, stackaddr: *mut *mut c_void, ) -> c_int; - pub fn pthread_attr_getschedpolicy( - attr: *const crate::pthread_attr_t, - policy: *mut c_int, - ) -> c_int; + pub fn pthread_attr_getschedpolicy(attr: *const pthread_attr_t, policy: *mut c_int) -> c_int; - pub fn pthread_attr_getscope( - attr: *const crate::pthread_attr_t, - contentionscope: *mut c_int, - ) -> c_int; + pub fn pthread_attr_getscope(attr: *const pthread_attr_t, contentionscope: *mut c_int) + -> c_int; pub fn pthread_attr_getstack( - attr: *const crate::pthread_attr_t, + attr: *const pthread_attr_t, stackaddr: *mut *mut c_void, stacksize: *mut size_t, ) -> c_int; - pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int; + pub fn pthread_attr_setguardsize(attr: *mut pthread_attr_t, guardsize: size_t) -> c_int; - pub fn pthread_attr_setinheritsched( - attr: *mut crate::pthread_attr_t, - inheritsched: c_int, - ) -> c_int; + pub fn pthread_attr_setinheritsched(attr: *mut pthread_attr_t, inheritsched: c_int) -> c_int; pub fn pthread_attr_setschedparam( - attr: *mut crate::pthread_attr_t, + attr: *mut pthread_attr_t, param: *const sched_param, ) -> c_int; - pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int; + pub fn pthread_attr_setschedpolicy(attr: *mut pthread_attr_t, policy: c_int) -> c_int; - pub fn pthread_attr_setscope(attr: *mut crate::pthread_attr_t, contentionscope: c_int) - -> c_int; + pub fn pthread_attr_setscope(attr: *mut pthread_attr_t, contentionscope: c_int) -> c_int; pub fn pthread_attr_setstack( - attr: *mut crate::pthread_attr_t, + attr: *mut pthread_attr_t, stackaddr: *mut c_void, stacksize: size_t, ) -> c_int; - pub fn pthread_attr_setstackaddr( - attr: *mut crate::pthread_attr_t, - stackaddr: *mut c_void, - ) -> c_int; + pub fn pthread_attr_setstackaddr(attr: *mut pthread_attr_t, stackaddr: *mut c_void) -> c_int; - pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int; + pub fn pthread_barrierattr_destroy(attr: *mut pthread_barrierattr_t) -> c_int; pub fn pthread_barrierattr_getpshared( - attr: *const crate::pthread_barrierattr_t, + attr: *const pthread_barrierattr_t, pshared: *mut c_int, ) -> c_int; - pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int; + pub fn pthread_barrierattr_init(attr: *mut pthread_barrierattr_t) -> c_int; pub fn pthread_barrierattr_setpshared( - attr: *mut crate::pthread_barrierattr_t, + attr: *mut pthread_barrierattr_t, pshared: c_int, ) -> c_int; @@ -2685,13 +3327,13 @@ extern "C" { pub fn pthread_barrier_init( barrier: *mut pthread_barrier_t, - attr: *const crate::pthread_barrierattr_t, + attr: *const pthread_barrierattr_t, count: c_uint, ) -> c_int; pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int; - pub fn pthread_cancel(thread: crate::pthread_t) -> c_int; + pub fn pthread_cancel(thread: pthread_t) -> c_int; pub fn pthread_cleanup_pop(execute: c_int); @@ -2710,37 +3352,31 @@ extern "C" { pshared: *mut c_int, ) -> c_int; - pub fn pthread_condattr_setclock( - attr: *mut pthread_condattr_t, - clock_id: crate::clockid_t, - ) -> c_int; + pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: clockid_t) -> c_int; pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int; pub fn pthread_create( - thread: *mut crate::pthread_t, - attr: *const crate::pthread_attr_t, + thread: *mut pthread_t, + attr: *const pthread_attr_t, start_routine: extern "C" fn(*mut c_void) -> *mut c_void, arg: *mut c_void, ) -> c_int; pub fn pthread_getconcurrency() -> c_int; - pub fn pthread_getcpuclockid( - thread_id: crate::pthread_t, - clock_id: *mut crate::clockid_t, - ) -> c_int; + pub fn pthread_getcpuclockid(thread_id: pthread_t, clock_id: *mut clockid_t) -> c_int; pub fn pthread_getschedparam( - thread: crate::pthread_t, + thread: pthread_t, policy: *mut c_int, param: *mut sched_param, ) -> c_int; - pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int; + pub fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int; pub fn pthread_mutexattr_getprioceiling( - attr: *const crate::pthread_mutexattr_t, + attr: *const pthread_mutexattr_t, prioceiling: *mut c_int, ) -> c_int; @@ -2755,17 +3391,14 @@ extern "C" { ) -> c_int; pub fn pthread_mutexattr_getrobust( - attr: *const crate::pthread_mutexattr_t, + attr: *const pthread_mutexattr_t, robust: *mut c_int, ) -> c_int; - pub fn pthread_mutexattr_gettype( - attr: *const crate::pthread_mutexattr_t, - _type: *mut c_int, - ) -> c_int; + pub fn pthread_mutexattr_gettype(attr: *const pthread_mutexattr_t, _type: *mut c_int) -> c_int; pub fn pthread_mutexattr_setprioceiling( - attr: *mut crate::pthread_mutexattr_t, + attr: *mut pthread_mutexattr_t, prioceiling: c_int, ) -> c_int; @@ -2773,20 +3406,17 @@ extern "C" { pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int; - pub fn pthread_mutexattr_setrobust( - attr: *mut crate::pthread_mutexattr_t, - robust: c_int, - ) -> c_int; + pub fn pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robust: c_int) -> c_int; - pub fn pthread_mutex_consistent(mutex: *mut crate::pthread_mutex_t) -> c_int; + pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> c_int; pub fn pthread_mutex_getprioceiling( - mutex: *const crate::pthread_mutex_t, + mutex: *const pthread_mutex_t, prioceiling: *mut c_int, ) -> c_int; pub fn pthread_mutex_setprioceiling( - mutex: *mut crate::pthread_mutex_t, + mutex: *mut pthread_mutex_t, prioceiling: c_int, old_ceiling: *mut c_int, ) -> c_int; @@ -2797,7 +3427,7 @@ extern "C" { ) -> c_int; pub fn pthread_once( - once_control: *mut crate::pthread_once_t, + once_control: *mut pthread_once_t, init_routine: Option, ) -> c_int; @@ -2809,12 +3439,12 @@ extern "C" { pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, pshared: c_int) -> c_int; pub fn pthread_rwlock_timedrdlock( - rwlock: *mut crate::pthread_rwlock_t, + rwlock: *mut pthread_rwlock_t, abstime: *const crate::timespec, ) -> c_int; pub fn pthread_rwlock_timedwrlock( - rwlock: *mut crate::pthread_rwlock_t, + rwlock: *mut pthread_rwlock_t, abstime: *const crate::timespec, ) -> c_int; @@ -2824,12 +3454,12 @@ extern "C" { pub fn pthread_setconcurrency(new_level: c_int) -> c_int; pub fn pthread_setschedparam( - thread: crate::pthread_t, + thread: pthread_t, policy: c_int, param: *const sched_param, ) -> c_int; - pub fn pthread_setschedprio(thread: crate::pthread_t, prio: c_int) -> c_int; + pub fn pthread_setschedprio(thread: pthread_t, prio: c_int) -> c_int; pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oset: *mut sigset_t) -> c_int; @@ -2856,43 +3486,40 @@ extern "C" { } extern "C" { + pub fn getsystemcfg(label: c_int) -> c_ulong; pub fn acct(filename: *mut c_char) -> c_int; #[link_name = "_posix_aio_cancel"] - pub fn aio_cancel(fildes: c_int, aiocbp: *mut crate::aiocb) -> c_int; + pub fn aio_cancel(fildes: c_int, aiocbp: *mut aiocb) -> c_int; #[link_name = "_posix_aio_error"] - pub fn aio_error(aiocbp: *const crate::aiocb) -> c_int; + pub fn aio_error(aiocbp: *const aiocb) -> c_int; #[link_name = "_posix_aio_fsync"] - pub fn aio_fsync(op: c_int, aiocbp: *mut crate::aiocb) -> c_int; + pub fn aio_fsync(op: c_int, aiocbp: *mut aiocb) -> c_int; #[link_name = "_posix_aio_read"] - pub fn aio_read(aiocbp: *mut crate::aiocb) -> c_int; + pub fn aio_read(aiocbp: *mut aiocb) -> c_int; #[link_name = "_posix_aio_return"] - pub fn aio_return(aiocbp: *mut crate::aiocb) -> ssize_t; + pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t; #[link_name = "_posix_aio_suspend"] pub fn aio_suspend( - list: *const *const crate::aiocb, + list: *const *const aiocb, nent: c_int, timeout: *const crate::timespec, ) -> c_int; #[link_name = "_posix_aio_write"] - pub fn aio_write(aiocbp: *mut crate::aiocb) -> c_int; + pub fn aio_write(aiocbp: *mut aiocb) -> c_int; pub fn basename(path: *mut c_char) -> *mut c_char; - pub fn bind( - socket: c_int, - address: *const crate::sockaddr, - address_len: crate::socklen_t, - ) -> c_int; + pub fn bind(socket: c_int, address: *const sockaddr, address_len: socklen_t) -> c_int; pub fn brk(addr: *mut c_void) -> c_int; pub fn clearenv() -> c_int; - pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int; - pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; - pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; + pub fn clock_getcpuclockid(pid: pid_t, clk_id: *mut clockid_t) -> c_int; + pub fn clock_getres(clk_id: clockid_t, tp: *mut crate::timespec) -> c_int; + pub fn clock_gettime(clk_id: clockid_t, tp: *mut crate::timespec) -> c_int; pub fn clock_nanosleep( - clk_id: crate::clockid_t, + clk_id: clockid_t, flags: c_int, rqtp: *const crate::timespec, rmtp: *mut crate::timespec, ) -> c_int; - pub fn clock_settime(clock_id: crate::clockid_t, tp: *const crate::timespec) -> c_int; + pub fn clock_settime(clock_id: clockid_t, tp: *const crate::timespec) -> c_int; pub fn creat64(path: *const c_char, mode: mode_t) -> c_int; pub fn ctermid(s: *mut c_char) -> *mut c_char; pub fn dirfd(dirp: *mut crate::DIR) -> c_int; @@ -2913,24 +3540,59 @@ extern "C" { pub fn ffsl(value: c_long) -> c_int; pub fn ffsll(value: c_longlong) -> c_int; pub fn fgetgrent(file: *mut crate::FILE) -> *mut crate::group; - pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut fpos64_t) -> c_int; - pub fn fgetpwent(file: *mut crate::FILE) -> *mut crate::passwd; + #[deprecated( + since = "0.2.187", + note = "Use `fgetpos` instead. Their definitions are equivalent." + )] + pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut fpos_t) -> c_int; + pub fn fgetpwent(file: *mut crate::FILE) -> *mut passwd; + #[deprecated( + since = "0.2.187", + note = "Use `fopen` instead. Their definitions are equivalent." + )] pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut crate::FILE; pub fn freelocale(loc: crate::locale_t); + #[deprecated( + since = "0.2.187", + note = "Use `freopen` instead. Their definitions are equivalent." + )] pub fn freopen64( filename: *const c_char, mode: *const c_char, file: *mut crate::FILE, ) -> *mut crate::FILE; - pub fn fseeko64(stream: *mut crate::FILE, offset: off64_t, whence: c_int) -> c_int; - pub fn fsetpos64(stream: *mut crate::FILE, ptr: *const fpos64_t) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `fseeko` instead. Their definitions are equivalent." + )] + pub fn fseeko64(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `fsetpos` instead. Their definitions are equivalent." + )] + pub fn fsetpos64(stream: *mut crate::FILE, ptr: *const fpos_t) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `fstat` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn fstat64(fildes: c_int, buf: *mut stat64) -> c_int; pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; + #[cfg(aix_large_file_api)] pub fn fstatfs64(fd: c_int, buf: *mut statfs64) -> c_int; + #[cfg(aix_large_file_api)] pub fn fstatvfs64(fd: c_int, buf: *mut statvfs64) -> c_int; - pub fn ftello64(stream: *mut crate::FILE) -> off64_t; - pub fn ftok(path: *const c_char, id: c_int) -> crate::key_t; - pub fn ftruncate64(fd: c_int, length: off64_t) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `ftello` instead. Their definitions are equivalent." + )] + pub fn ftello64(stream: *mut crate::FILE) -> off_t; + pub fn ftok(path: *const c_char, id: c_int) -> key_t; + #[deprecated( + since = "0.2.187", + note = "Use `ftruncate` instead. Their definitions are equivalent." + )] + pub fn ftruncate64(fd: c_int, length: off_t) -> c_int; pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; pub fn getcontext(ucp: *mut ucontext_t) -> c_int; pub fn getdomainname(name: *mut c_char, len: c_int) -> c_int; @@ -2956,9 +3618,9 @@ extern "C" { ) -> c_int; pub fn getgrset(user: *const c_char) -> *mut c_char; pub fn gethostid() -> c_long; - pub fn getmntent(stream: *mut crate::FILE) -> *mut crate::mntent; + pub fn getmntent(stream: *mut crate::FILE) -> *mut mntent; pub fn getnameinfo( - sa: *const crate::sockaddr, + sa: *const sockaddr, salen: size_t, host: *mut c_char, hostlen: size_t, @@ -2968,8 +3630,8 @@ extern "C" { ) -> c_int; pub fn getpagesize() -> c_int; pub fn getpeereid(socket: c_int, euid: *mut crate::uid_t, egid: *mut crate::gid_t) -> c_int; - pub fn getpriority(which: c_int, who: crate::id_t) -> c_int; - pub fn getpwent() -> *mut crate::passwd; + pub fn getpriority(which: c_int, who: id_t) -> c_int; + pub fn getpwent() -> *mut passwd; #[link_name = "_posix_getpwnam_r"] pub fn getpwnam_r( name: *const c_char, @@ -2987,7 +3649,11 @@ extern "C" { result: *mut *mut passwd, ) -> c_int; pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int; - pub fn getrlimit64(resource: c_int, rlim: *mut rlimit64) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `getrlimit` instead. Their definitions are equivalent." + )] + pub fn getrlimit64(resource: c_int, rlim: *mut crate::rlimit) -> c_int; pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int; pub fn getitimer(which: c_int, curr_value: *mut crate::itimerval) -> c_int; pub fn getutent() -> *mut utmp; @@ -3000,10 +3666,10 @@ extern "C" { pattern: *const c_char, flags: c_int, errfunc: Option c_int>, - pglob: *mut crate::glob_t, + pglob: *mut glob_t, ) -> c_int; - pub fn globfree(pglob: *mut crate::glob_t); - pub fn hasmntopt(mnt: *const crate::mntent, opt: *const c_char) -> *mut c_char; + pub fn globfree(pglob: *mut glob_t); + pub fn hasmntopt(mnt: *const mntent, opt: *const c_char) -> *mut c_char; pub fn hcreate(nelt: size_t) -> c_int; pub fn hdestroy(); pub fn hsearch(entry: entry, action: ACTION) -> *mut entry; @@ -3038,11 +3704,20 @@ extern "C" { width: size_t, compar: Option c_int>, ) -> *mut c_void; - pub fn lseek64(fd: c_int, offset: off64_t, whence: c_int) -> off64_t; + #[deprecated( + since = "0.2.187", + note = "Use `lseek` instead. Their definitions are equivalent." + )] + pub fn lseek64(fd: c_int, offset: off_t, whence: c_int) -> off_t; + #[deprecated( + since = "0.2.187", + note = "Use `lstat` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn lstat64(path: *const c_char, buf: *mut stat64) -> c_int; pub fn madvise(addr: caddr_t, len: size_t, advice: c_int) -> c_int; - pub fn makecontext(ucp: *mut crate::ucontext_t, func: extern "C" fn(), argc: c_int, ...); - pub fn mallinfo() -> crate::mallinfo; + pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: c_int, ...); + pub fn mallinfo() -> mallinfo; pub fn mallopt(param: c_int, value: c_int) -> c_int; pub fn memmem( haystack: *const c_void, @@ -3056,36 +3731,27 @@ extern "C" { pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int; pub fn mount(device: *const c_char, path: *const c_char, flags: c_int) -> c_int; pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; - pub fn mq_close(mqd: crate::mqd_t) -> c_int; - pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int; - pub fn mq_notify(mqd: crate::mqd_t, notification: *const crate::sigevent) -> c_int; - pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t; + pub fn mq_close(mqd: mqd_t) -> c_int; + pub fn mq_getattr(mqd: mqd_t, attr: *mut mq_attr) -> c_int; + pub fn mq_notify(mqd: mqd_t, notification: *const sigevent) -> c_int; + pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> mqd_t; pub fn mq_receive( - mqd: crate::mqd_t, + mqd: mqd_t, msg_ptr: *mut c_char, msg_len: size_t, msg_prio: *mut c_uint, ) -> ssize_t; - pub fn mq_send( - mqd: crate::mqd_t, - msg_ptr: *const c_char, - msg_len: size_t, - msg_prio: c_uint, - ) -> c_int; - pub fn mq_setattr( - mqd: crate::mqd_t, - newattr: *const crate::mq_attr, - oldattr: *mut crate::mq_attr, - ) -> c_int; + pub fn mq_send(mqd: mqd_t, msg_ptr: *const c_char, msg_len: size_t, msg_prio: c_uint) -> c_int; + pub fn mq_setattr(mqd: mqd_t, newattr: *const mq_attr, oldattr: *mut mq_attr) -> c_int; pub fn mq_timedreceive( - mqd: crate::mqd_t, + mqd: mqd_t, msg_ptr: *mut c_char, msg_len: size_t, msg_prio: *mut c_uint, abs_timeout: *const crate::timespec, ) -> ssize_t; pub fn mq_timedsend( - mqd: crate::mqd_t, + mqd: mqd_t, msg_ptr: *const c_char, msg_len: size_t, msg_prio: c_uint, @@ -3094,7 +3760,7 @@ extern "C" { pub fn mq_unlink(name: *const c_char) -> c_int; pub fn mrand48() -> c_long; pub fn msgctl(msqid: c_int, cmd: c_int, buf: *mut msqid_ds) -> c_int; - pub fn msgget(key: crate::key_t, msgflg: c_int) -> c_int; + pub fn msgget(key: key_t, msgflg: c_int) -> c_int; pub fn msgrcv( msqid: c_int, msgp: *mut c_void, @@ -3105,9 +3771,13 @@ extern "C" { pub fn msgsnd(msqid: c_int, msgp: *const c_void, msgsz: size_t, msgflg: c_int) -> c_int; pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t; - pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char; - pub fn nl_langinfo_l(item: crate::nl_item, loc: crate::locale_t) -> *mut c_char; + pub fn nl_langinfo(item: nl_item) -> *mut c_char; + pub fn nl_langinfo_l(item: nl_item, loc: crate::locale_t) -> *mut c_char; pub fn nrand48(xseed: *mut c_ushort) -> c_long; + #[deprecated( + since = "0.2.187", + note = "Use `open` instead. Their definitions are equivalent." + )] pub fn open64(path: *const c_char, oflag: c_int, ...) -> c_int; pub fn pollset_create(maxfd: c_int) -> pollset_t; pub fn pollset_ctl(ps: pollset_t, pollctl_array: *mut poll_ctl, array_length: c_int) -> c_int; @@ -3121,15 +3791,23 @@ extern "C" { pub fn pollset_query(ps: pollset_t, pollfd_query: *mut crate::pollfd) -> c_int; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE; pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; - pub fn posix_fadvise64(fd: c_int, offset: off64_t, len: off64_t, advise: c_int) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `posix_fadvise` instead. Their definitions are equivalent." + )] + pub fn posix_fadvise64(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; - pub fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `posix_fallocate` instead. Their definitions are equivalent." + )] + pub fn posix_fallocate64(fd: c_int, offset: off_t, len: off_t) -> c_int; pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; pub fn posix_spawn( - pid: *mut crate::pid_t, + pid: *mut pid_t, path: *const c_char, - file_actions: *const crate::posix_spawn_file_actions_t, - attrp: *const crate::posix_spawnattr_t, + file_actions: *const posix_spawn_file_actions_t, + attrp: *const posix_spawnattr_t, argv: *const *mut c_char, envp: *const *mut c_char, ) -> c_int; @@ -3153,13 +3831,10 @@ extern "C" { pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int; pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int; pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int; - pub fn posix_spawnattr_getpgroup( - attr: *const posix_spawnattr_t, - flags: *mut crate::pid_t, - ) -> c_int; + pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, flags: *mut pid_t) -> c_int; pub fn posix_spawnattr_getschedparam( attr: *const posix_spawnattr_t, - param: *mut crate::sched_param, + param: *mut sched_param, ) -> c_int; pub fn posix_spawnattr_getschedpolicy( attr: *const posix_spawnattr_t, @@ -3175,30 +3850,36 @@ extern "C" { ) -> c_int; pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int; pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int; - pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int; + pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: pid_t) -> c_int; pub fn posix_spawnattr_setschedparam( attr: *mut posix_spawnattr_t, - param: *const crate::sched_param, + param: *const sched_param, ) -> c_int; pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int; pub fn posix_spawnattr_setsigdefault( attr: *mut posix_spawnattr_t, - default: *const crate::sigset_t, + default: *const sigset_t, ) -> c_int; pub fn posix_spawnattr_setsigmask( attr: *mut posix_spawnattr_t, - default: *const crate::sigset_t, + default: *const sigset_t, ) -> c_int; pub fn posix_spawnp( - pid: *mut crate::pid_t, + pid: *mut pid_t, file: *const c_char, - file_actions: *const crate::posix_spawn_file_actions_t, - attrp: *const crate::posix_spawnattr_t, + file_actions: *const posix_spawn_file_actions_t, + attrp: *const posix_spawnattr_t, argv: *const *mut c_char, envp: *const *mut c_char, ) -> c_int; - pub fn pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: off64_t) -> ssize_t; + #[deprecated( + since = "0.2.187", + note = "Use `pread` instead. Their definitions are equivalent." + )] + pub fn pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: off_t) -> ssize_t; pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: offset_t) -> ssize_t; + pub fn ptrace(request: c_int, id: c_int, address: *mut c_int, data: c_int, buffer: *mut c_int); + pub fn ptracex(request: c_int, id: c_int, address: c_longlong, data: c_int, buffer: *mut c_int); pub fn ptrace64( request: c_int, id: c_longlong, @@ -3208,7 +3889,11 @@ extern "C" { ) -> c_int; pub fn pututline(u: *const utmp) -> *mut utmp; pub fn pututxline(ut: *const utmpx) -> *mut utmpx; - pub fn pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset: off64_t) -> ssize_t; + #[deprecated( + since = "0.2.187", + note = "Use `pwrite` instead. Their definitions are equivalent." + )] + pub fn pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset: off_t) -> ssize_t; pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: offset_t) -> ssize_t; pub fn quotactl(cmd: *mut c_char, special: c_int, id: c_int, data: caddr_t) -> c_int; @@ -3221,12 +3906,12 @@ extern "C" { buf: *mut c_void, len: size_t, flags: c_int, - addr: *mut crate::sockaddr, - addrlen: *mut crate::socklen_t, + addr: *mut sockaddr, + addrlen: *mut socklen_t, ) -> ssize_t; pub fn recvmmsg( sockfd: c_int, - msgvec: *mut crate::mmsghdr, + msgvec: *mut mmsghdr, vlen: c_uint, flags: c_int, timeout: *mut crate::timespec, @@ -3237,7 +3922,7 @@ extern "C" { pub fn regcomp(preg: *mut regex_t, pattern: *const c_char, cflags: c_int) -> c_int; pub fn regerror( errcode: c_int, - preg: *const crate::regex_t, + preg: *const regex_t, errbuf: *mut c_char, errbuf_size: size_t, ) -> size_t; @@ -3250,20 +3935,16 @@ extern "C" { ) -> c_int; pub fn regfree(preg: *mut regex_t); pub fn sbrk(increment: intptr_t) -> *mut c_void; - pub fn sched_getparam(pid: crate::pid_t, param: *mut sched_param) -> c_int; - pub fn sched_getscheduler(pid: crate::pid_t) -> c_int; + pub fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int; + pub fn sched_getscheduler(pid: pid_t) -> c_int; pub fn sched_get_priority_max(policy: c_int) -> c_int; pub fn sched_get_priority_min(policy: c_int) -> c_int; - pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int; - pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int; - pub fn sched_setscheduler( - pid: crate::pid_t, - policy: c_int, - param: *const crate::sched_param, - ) -> c_int; + pub fn sched_rr_get_interval(pid: pid_t, tp: *mut crate::timespec) -> c_int; + pub fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int; + pub fn sched_setscheduler(pid: pid_t, policy: c_int, param: *const sched_param) -> c_int; pub fn sctp_opt_info( sd: c_int, - id: crate::sctp_assoc_t, + id: sctp_assoc_t, opt: c_int, arg_size: *mut c_void, size: *mut size_t, @@ -3279,7 +3960,7 @@ extern "C" { pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int; pub fn sem_unlink(name: *const c_char) -> c_int; pub fn semctl(semid: c_int, semnum: c_int, cmd: c_int, ...) -> c_int; - pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int; + pub fn semget(key: key_t, nsems: c_int, semflag: c_int) -> c_int; pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int; pub fn send_file(socket: *mut c_int, iobuf: *mut sf_parms, flags: c_uint) -> ssize_t; pub fn sendmmsg(sockfd: c_int, msgvec: *mut mmsghdr, vlen: c_uint, flags: c_int) -> c_int; @@ -3296,8 +3977,12 @@ extern "C" { pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int; pub fn setpwent(); pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; - pub fn setrlimit64(resource: c_int, rlim: *const rlimit64) -> c_int; - pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `setrlimit` instead. Their definitions are equivalent." + )] + pub fn setrlimit64(resource: c_int, rlim: *const crate::rlimit) -> c_int; + pub fn settimeofday(tv: *const crate::timeval, tz: *const timezone) -> c_int; pub fn setitimer( which: c_int, new_value: *const crate::itimerval, @@ -3306,7 +3991,7 @@ extern "C" { pub fn setutent(); pub fn setutxent(); pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int; - pub fn sigsuspend(mask: *const crate::sigset_t) -> c_int; + pub fn sigsuspend(mask: *const sigset_t) -> c_int; pub fn sigtimedwait( set: *const sigset_t, info: *mut siginfo_t, @@ -3316,17 +4001,29 @@ extern "C" { pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int; pub fn shmat(shmid: c_int, shmaddr: *const c_void, shmflg: c_int) -> *mut c_void; pub fn shmdt(shmaddr: *const c_void) -> c_int; - pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int; + pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut shmid_ds) -> c_int; pub fn shmget(key: key_t, size: size_t, shmflg: c_int) -> c_int; pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int; pub fn shm_unlink(name: *const c_char) -> c_int; pub fn splice(socket1: c_int, socket2: c_int, flags: c_int) -> c_int; pub fn srand(seed: c_uint); pub fn srand48(seed: c_long); + #[deprecated( + since = "0.2.187", + note = "Use `stat` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `fstatat` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn stat64at(dirfd: c_int, path: *const c_char, buf: *mut stat64, flags: c_int) -> c_int; pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; + #[cfg(aix_large_file_api)] pub fn statfs64(path: *const c_char, buf: *mut statfs64) -> c_int; + #[cfg(aix_large_file_api)] pub fn statvfs64(path: *const c_char, buf: *mut statvfs64) -> c_int; pub fn statx(path: *const c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int; pub fn strcasecmp_l( @@ -3347,29 +4044,29 @@ extern "C" { length: size_t, locale: crate::locale_t, ) -> c_int; - pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut crate::tm) -> *mut c_char; + pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut tm) -> *mut c_char; pub fn strsep(string: *mut *mut c_char, delim: *const c_char) -> *mut c_char; pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int; pub fn swapoff(path: *const c_char) -> c_int; pub fn swapon(path: *const c_char) -> c_int; pub fn sync(); pub fn telldir(dirp: *mut crate::DIR) -> c_long; - pub fn timer_create( - clockid: crate::clockid_t, - sevp: *mut crate::sigevent, - timerid: *mut crate::timer_t, - ) -> c_int; + pub fn timer_create(clockid: clockid_t, sevp: *mut sigevent, timerid: *mut timer_t) -> c_int; pub fn timer_delete(timerid: timer_t) -> c_int; pub fn timer_getoverrun(timerid: timer_t) -> c_int; pub fn timer_gettime(timerid: timer_t, value: *mut itimerspec) -> c_int; pub fn timer_settime( - timerid: crate::timer_t, + timerid: timer_t, flags: c_int, - new_value: *const crate::itimerspec, - old_value: *mut crate::itimerspec, - ) -> c_int; - pub fn truncate64(path: *const c_char, length: off64_t) -> c_int; - pub fn uname(buf: *mut crate::utsname) -> c_int; + new_value: *const itimerspec, + old_value: *mut itimerspec, + ) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `truncate` instead. Their definitions are equivalent." + )] + pub fn truncate64(path: *const c_char, length: off_t) -> c_int; + pub fn uname(buf: *mut utsname) -> c_int; pub fn updwtmp(file: *const c_char, u: *const utmp); pub fn uselocale(loc: crate::locale_t) -> crate::locale_t; pub fn utmpname(file: *const c_char) -> c_int; @@ -3380,26 +4077,14 @@ extern "C" { flag: c_int, ) -> c_int; pub fn wait4( - pid: crate::pid_t, + pid: pid_t, status: *mut c_int, options: c_int, rusage: *mut crate::rusage, - ) -> crate::pid_t; - pub fn waitid( - idtype: idtype_t, - id: id_t, - infop: *mut crate::siginfo_t, - options: c_int, - ) -> c_int; + ) -> pid_t; + pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut siginfo_t, options: c_int) -> c_int; pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; // Use AIX thread-safe version errno. pub fn _Errno() -> *mut c_int; } - -cfg_if! { - if #[cfg(target_arch = "powerpc64")] { - mod powerpc64; - pub use self::powerpc64::*; - } -} diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs deleted file mode 100644 index cd439044d196..000000000000 --- a/src/unix/aix/powerpc64.rs +++ /dev/null @@ -1,427 +0,0 @@ -use crate::off_t; -use crate::prelude::*; - -// Define lock_data_instrumented as an empty enum -extern_ty! { - pub type lock_data_instrumented; -} - -s! { - pub struct sigset_t { - pub ss_set: [c_ulong; 4], - } - - pub struct fd_set { - pub fds_bits: [c_long; 1024], - } - - pub struct flock { - pub l_type: c_short, - pub l_whence: c_short, - pub l_sysid: c_uint, - pub l_pid: crate::pid_t, - pub l_vfs: c_int, - pub l_start: off_t, - pub l_len: off_t, - } - - pub struct statvfs { - pub f_bsize: c_ulong, - pub f_frsize: c_ulong, - pub f_blocks: crate::fsblkcnt_t, - pub f_bfree: crate::fsblkcnt_t, - pub f_bavail: crate::fsblkcnt_t, - pub f_files: crate::fsfilcnt_t, - pub f_ffree: crate::fsfilcnt_t, - pub f_favail: crate::fsfilcnt_t, - pub f_fsid: c_ulong, - pub f_basetype: [c_char; 16], - pub f_flag: c_ulong, - pub f_namemax: c_ulong, - pub f_fstr: [c_char; 32], - pub f_filler: [c_ulong; 16], - } - - pub struct pthread_rwlock_t { - __rw_word: [c_long; 10], - } - - pub struct pthread_cond_t { - __cv_word: [c_long; 6], - } - - pub struct pthread_mutex_t { - __mt_word: [c_long; 8], - } - - pub struct pthread_once_t { - __on_word: [c_long; 9], - } - - pub struct stat { - pub st_dev: crate::dev_t, - pub st_ino: crate::ino_t, - pub st_mode: crate::mode_t, - pub st_nlink: crate::nlink_t, - pub st_flag: c_ushort, - pub st_uid: crate::uid_t, - pub st_gid: crate::gid_t, - pub st_rdev: crate::dev_t, - pub st_ssize: c_int, - pub st_atim: crate::st_timespec, - pub st_mtim: crate::st_timespec, - pub st_ctim: crate::st_timespec, - pub st_blksize: crate::blksize_t, - pub st_blocks: crate::blkcnt_t, - pub st_vfstype: c_int, - pub st_vfs: c_uint, - pub st_type: c_uint, - pub st_gen: c_uint, - st_reserved: Padding<[c_uint; 9]>, - pub st_padto_ll: c_uint, - pub st_size: off_t, - } - - pub struct statfs { - pub f_version: c_int, - pub f_type: c_int, - pub f_bsize: c_ulong, - pub f_blocks: crate::fsblkcnt_t, - pub f_bfree: crate::fsblkcnt_t, - pub f_bavail: crate::fsblkcnt_t, - pub f_files: crate::fsblkcnt_t, - pub f_ffree: crate::fsblkcnt_t, - pub f_fsid: crate::fsid64_t, - pub f_vfstype: c_int, - pub f_fsize: c_ulong, - pub f_vfsnumber: c_int, - pub f_vfsoff: c_int, - pub f_vfslen: c_int, - pub f_vfsvers: c_int, - pub f_fname: [c_char; 32], - pub f_fpack: [c_char; 32], - pub f_name_max: c_int, - } - - pub struct aiocb { - pub aio_lio_opcode: c_int, - pub aio_fildes: c_int, - pub aio_word1: c_int, - pub aio_offset: off_t, - pub aio_buf: *mut c_void, - pub aio_return: ssize_t, - pub aio_errno: c_int, - pub aio_nbytes: size_t, - pub aio_reqprio: c_int, - pub aio_sigevent: crate::sigevent, - pub aio_word2: c_int, - pub aio_fp: c_int, - pub aio_handle: *mut aiocb, - aio_reserved: Padding<[c_uint; 2]>, - pub aio_sigev_tid: c_long, - } - - pub struct __vmxreg_t { - __v: [c_uint; 4], - } - - pub struct __vmx_context_t { - pub __vr: [crate::__vmxreg_t; 32], - pub __pad1: [c_uint; 3], - pub __vscr: c_uint, - pub __vrsave: c_uint, - pub __pad2: [c_uint; 3], - } - - pub struct __vsx_context_t { - pub __vsr_dw1: [c_ulonglong; 32], - } - - pub struct __tm_context_t { - pub vmx: crate::__vmx_context_t, - pub vsx: crate::__vsx_context_t, - pub gpr: [c_ulonglong; 32], - pub lr: c_ulonglong, - pub ctr: c_ulonglong, - pub cr: c_uint, - pub xer: c_uint, - pub amr: c_ulonglong, - pub texasr: c_ulonglong, - pub tfiar: c_ulonglong, - pub tfhar: c_ulonglong, - pub ppr: c_ulonglong, - pub dscr: c_ulonglong, - pub tar: c_ulonglong, - pub fpscr: c_uint, - pub fpscrx: c_uint, - pub fpr: [fpreg_t; 32], - pub tmcontext: c_char, - pub tmstate: c_char, - pub prevowner: c_char, - pub pad: [c_char; 5], - } - - pub struct __context64 { - pub gpr: [c_ulonglong; 32], - pub msr: c_ulonglong, - pub iar: c_ulonglong, - pub lr: c_ulonglong, - pub ctr: c_ulonglong, - pub cr: c_uint, - pub xer: c_uint, - pub fpscr: c_uint, - pub fpscrx: c_uint, - pub except: [c_ulonglong; 1], - pub fpr: [fpreg_t; 32], - pub fpeu: c_char, - pub fpinfo: c_char, - pub fpscr24_31: c_char, - pub pad: [c_char; 1], - pub excp_type: c_int, - } - - pub struct mcontext_t { - pub jmp_context: __context64, - } - - pub struct __extctx_t { - pub __flags: c_uint, - pub __rsvd1: [c_uint; 3], - pub __vmx: crate::__vmx_context_t, - pub __ukeys: [c_uint; 2], - pub __vsx: crate::__vsx_context_t, - pub __tm: crate::__tm_context_t, - __reserved: Padding<[c_char; 1860]>, - pub __extctx_magic: c_int, - } - - pub struct ucontext_t { - pub __sc_onstack: c_int, - pub uc_sigmask: crate::sigset_t, - pub __sc_uerror: c_int, - pub uc_mcontext: crate::mcontext_t, - pub uc_link: *mut ucontext_t, - pub uc_stack: crate::stack_t, - pub __extctx: *mut crate::__extctx_t, - pub __extctx_magic: c_int, - pub __pad: [c_int; 1], - } - - pub struct utmpx { - pub ut_user: [c_char; 256], - pub ut_id: [c_char; 14], - pub ut_line: [c_char; 64], - pub ut_pid: crate::pid_t, - pub ut_type: c_short, - pub ut_tv: crate::timeval, - pub ut_host: [c_char; 256], - pub __dbl_word_pad: c_int, - pub __reservedA: [c_int; 2], - pub __reservedV: [c_int; 6], - } - - pub struct pthread_spinlock_t { - pub __sp_word: [c_long; 3], - } - - pub struct pthread_barrier_t { - pub __br_word: [c_long; 5], - } - - pub struct msqid_ds { - pub msg_perm: crate::ipc_perm, - pub msg_first: c_uint, - pub msg_last: c_uint, - pub msg_cbytes: c_uint, - pub msg_qnum: c_uint, - pub msg_qbytes: c_ulong, - pub msg_lspid: crate::pid_t, - pub msg_lrpid: crate::pid_t, - pub msg_stime: crate::time_t, - pub msg_rtime: crate::time_t, - pub msg_ctime: crate::time_t, - pub msg_rwait: c_int, - pub msg_wwait: c_int, - pub msg_reqevents: c_ushort, - } - - pub struct siginfo_t { - pub si_signo: c_int, - pub si_errno: c_int, - pub si_code: c_int, - pub si_pid: crate::pid_t, - pub si_uid: crate::uid_t, - pub si_status: c_int, - pub si_addr: *mut c_void, - pub si_band: c_long, - pub si_value: crate::sigval, - pub __si_flags: c_int, - pub __pad: [c_int; 3], - } - - pub struct pollfd_ext { - pub fd: c_int, - pub events: c_short, - pub revents: c_short, - pub data: __pollfd_ext_u, - } -} - -s_no_extra_traits! { - pub union _kernel_simple_lock { - pub _slock: c_long, - pub _slockp: *mut lock_data_instrumented, - } - - pub struct fileops_t { - pub fo_rw: Option< - extern "C" fn( - file: *mut file, - rw: crate::uio_rw, - io: *mut c_void, - ext: c_long, - secattr: *mut c_void, - ) -> c_int, - >, - pub fo_ioctl: Option< - extern "C" fn( - file: *mut file, - a: c_long, - b: crate::caddr_t, - c: c_long, - d: c_long, - ) -> c_int, - >, - pub fo_select: Option< - extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int, - >, - pub fo_close: Option c_int>, - pub fo_fstat: Option c_int>, - } - - pub struct file { - pub f_flag: c_long, - pub f_count: c_int, - pub f_options: c_short, - pub f_type: c_short, - // Should be pointer to 'vnode' - pub f_data: *mut c_void, - pub f_offset: c_longlong, - pub f_dir_off: c_long, - // Should be pointer to 'cred' - pub f_cred: *mut c_void, - pub f_lock: _kernel_simple_lock, - pub f_offset_lock: _kernel_simple_lock, - pub f_vinfo: crate::caddr_t, - pub f_ops: *mut fileops_t, - pub f_parentp: crate::caddr_t, - pub f_fnamep: crate::caddr_t, - pub f_fdata: [c_char; 160], - } - - pub union __ld_info_file { - pub _ldinfo_fd: c_int, - pub _ldinfo_fp: *mut file, - pub _core_offset: c_long, - } - - pub struct ld_info { - pub ldinfo_next: c_uint, - pub ldinfo_flags: c_uint, - pub _file: __ld_info_file, - pub ldinfo_textorg: *mut c_void, - pub ldinfo_textsize: c_ulong, - pub ldinfo_dataorg: *mut c_void, - pub ldinfo_datasize: c_ulong, - pub ldinfo_filename: [c_char; 2], - } - - pub union __pollfd_ext_u { - pub addr: *mut c_void, - pub data32: u32, - pub data: u64, - } - - pub struct fpreg_t { - pub d: c_double, - } -} - -impl siginfo_t { - pub unsafe fn si_addr(&self) -> *mut c_void { - self.si_addr - } - - pub unsafe fn si_value(&self) -> crate::sigval { - self.si_value - } - - pub unsafe fn si_pid(&self) -> crate::pid_t { - self.si_pid - } - - pub unsafe fn si_uid(&self) -> crate::uid_t { - self.si_uid - } - - pub unsafe fn si_status(&self) -> c_int { - self.si_status - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __pollfd_ext_u { - fn eq(&self, other: &__pollfd_ext_u) -> bool { - unsafe { - self.addr == other.addr - && self.data32 == other.data32 - && self.data == other.data - } - } - } - impl Eq for __pollfd_ext_u {} - impl hash::Hash for __pollfd_ext_u { - fn hash(&self, state: &mut H) { - unsafe { - self.addr.hash(state); - self.data.hash(state); - self.data32.hash(state); - } - } - } - - impl PartialEq for fpreg_t { - fn eq(&self, other: &fpreg_t) -> bool { - self.d == other.d - } - } - impl Eq for fpreg_t {} - impl hash::Hash for fpreg_t { - fn hash(&self, state: &mut H) { - let d: u64 = self.d.to_bits(); - d.hash(state); - } - } - } -} - -pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - __mt_word: [0, 2, 0, 0, 0, 0, 0, 0], -}; -pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - __cv_word: [0, 0, 0, 0, 2, 0], -}; -pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - __rw_word: [2, 0, 0, 0, 0, 0, 0, 0, 0, 0], -}; - -pub const PTHREAD_ONCE_INIT: pthread_once_t = pthread_once_t { - __on_word: [0, 0, 0, 0, 0, 2, 0, 0, 0], -}; - -pub const RLIM_INFINITY: c_ulong = 0x7fffffffffffffff; - -extern "C" { - pub fn getsystemcfg(label: c_int) -> c_ulong; -} diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 59fd7254441f..4bdf7313c9f5 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -14,6 +14,7 @@ pub type intptr_t = isize; pub type uintptr_t = usize; pub type ssize_t = isize; +#[cfg(not(target_os = "aix"))] pub type pid_t = i32; pub type in_addr_t = u32; pub type in_port_t = u16; @@ -624,7 +625,10 @@ cfg_if! { } cfg_if! { - if #[cfg(not(all(target_os = "linux", target_env = "gnu")))] { + if #[cfg(not(any( + target_os = "aix", + all(target_os = "linux", target_env = "gnu") + )))] { extern_ty! { pub type fpos_t; // FIXME(unix): fill this out with a struct }