| 1 |
use crate::off64_t; |
| 2 |
use crate::prelude::*; |
| 3 |
|
| 4 |
pub type blkcnt_t = i64; |
| 5 |
pub type blksize_t = i64; |
| 6 |
pub type fsblkcnt_t = c_ulong; |
| 7 |
pub type fsfilcnt_t = c_ulong; |
| 8 |
pub type ino_t = u64; |
| 9 |
pub type nlink_t = u64; |
| 10 |
pub type off_t = i64; |
| 11 |
pub type suseconds_t = i64; |
| 12 |
pub type time_t = i64; |
| 13 |
pub type wchar_t = i32; |
| 14 |
|
| 15 |
s! { |
| 16 |
pub struct stat { |
| 17 |
pub st_dev: c_ulong, |
| 18 |
st_pad1: Padding<[c_long; 2]>, |
| 19 |
pub st_ino: crate::ino_t, |
| 20 |
pub st_mode: crate::mode_t, |
| 21 |
pub st_nlink: crate::nlink_t, |
| 22 |
pub st_uid: crate::uid_t, |
| 23 |
pub st_gid: crate::gid_t, |
| 24 |
pub st_rdev: c_ulong, |
| 25 |
st_pad2: Padding<[c_ulong; 1]>, |
| 26 |
pub st_size: off_t, |
| 27 |
st_pad3: Padding<c_long>, |
| 28 |
pub st_atime: crate::time_t, |
| 29 |
pub st_atime_nsec: c_long, |
| 30 |
pub st_mtime: crate::time_t, |
| 31 |
pub st_mtime_nsec: c_long, |
| 32 |
pub st_ctime: crate::time_t, |
| 33 |
pub st_ctime_nsec: c_long, |
| 34 |
pub st_blksize: crate::blksize_t, |
| 35 |
st_pad4: Padding<c_long>, |
| 36 |
pub st_blocks: crate::blkcnt_t, |
| 37 |
st_pad5: Padding<[c_long; 7]>, |
| 38 |
} |
| 39 |
|
| 40 |
pub struct stat64 { |
| 41 |
pub st_dev: c_ulong, |
| 42 |
st_pad1: Padding<[c_long; 2]>, |
| 43 |
pub st_ino: crate::ino64_t, |
| 44 |
pub st_mode: crate::mode_t, |
| 45 |
pub st_nlink: crate::nlink_t, |
| 46 |
pub st_uid: crate::uid_t, |
| 47 |
pub st_gid: crate::gid_t, |
| 48 |
pub st_rdev: c_ulong, |
| 49 |
st_pad2: Padding<[c_long; 2]>, |
| 50 |
pub st_size: off64_t, |
| 51 |
pub st_atime: crate::time_t, |
| 52 |
pub st_atime_nsec: c_long, |
| 53 |
pub st_mtime: crate::time_t, |
| 54 |
pub st_mtime_nsec: c_long, |
| 55 |
pub st_ctime: crate::time_t, |
| 56 |
pub st_ctime_nsec: c_long, |
| 57 |
pub st_blksize: crate::blksize_t, |
| 58 |
st_pad3: Padding<c_long>, |
| 59 |
pub st_blocks: crate::blkcnt64_t, |
| 60 |
st_pad5: Padding<[c_long; 7]>, |
| 61 |
} |
| 62 |
|
| 63 |
pub struct pthread_attr_t { |
| 64 |
__size: [c_ulong; 7], |
| 65 |
} |
| 66 |
|
| 67 |
pub struct sigaction { |
| 68 |
pub sa_flags: c_int, |
| 69 |
pub sa_sigaction: crate::sighandler_t, |
| 70 |
pub sa_mask: sigset_t, |
| 71 |
_restorer: *mut c_void, |
| 72 |
} |
| 73 |
|
| 74 |
pub struct stack_t { |
| 75 |
pub ss_sp: *mut c_void, |
| 76 |
pub ss_size: size_t, |
| 77 |
pub ss_flags: c_int, |
| 78 |
} |
| 79 |
|
| 80 |
pub struct sigset_t { |
| 81 |
__size: [c_ulong; 16], |
| 82 |
} |
| 83 |
|
| 84 |
pub struct siginfo_t { |
| 85 |
pub si_signo: c_int, |
| 86 |
pub si_code: c_int, |
| 87 |
pub si_errno: c_int, |
| 88 |
_pad: Padding<c_int>, |
| 89 |
_pad2: Padding<[c_long; 14]>, |
| 90 |
} |
| 91 |
|
| 92 |
pub struct ipc_perm { |
| 93 |
pub __key: crate::key_t, |
| 94 |
pub uid: crate::uid_t, |
| 95 |
pub gid: crate::gid_t, |
| 96 |
pub cuid: crate::uid_t, |
| 97 |
pub cgid: crate::gid_t, |
| 98 |
pub mode: c_uint, |
| 99 |
pub __seq: c_ushort, |
| 100 |
__pad1: Padding<c_ushort>, |
| 101 |
__unused1: Padding<c_ulong>, |
| 102 |
__unused2: Padding<c_ulong>, |
| 103 |
} |
| 104 |
|
| 105 |
pub struct shmid_ds { |
| 106 |
pub shm_perm: crate::ipc_perm, |
| 107 |
pub shm_segsz: size_t, |
| 108 |
pub shm_atime: crate::time_t, |
| 109 |
pub shm_dtime: crate::time_t, |
| 110 |
pub shm_ctime: crate::time_t, |
| 111 |
pub shm_cpid: crate::pid_t, |
| 112 |
pub shm_lpid: crate::pid_t, |
| 113 |
pub shm_nattch: crate::shmatt_t, |
| 114 |
__unused4: Padding<c_ulong>, |
| 115 |
__unused5: Padding<c_ulong>, |
| 116 |
} |
| 117 |
|
| 118 |
pub struct msqid_ds { |
| 119 |
pub msg_perm: crate::ipc_perm, |
| 120 |
pub msg_stime: crate::time_t, |
| 121 |
pub msg_rtime: crate::time_t, |
| 122 |
pub msg_ctime: crate::time_t, |
| 123 |
pub __msg_cbytes: c_ulong, |
| 124 |
pub msg_qnum: crate::msgqnum_t, |
| 125 |
pub msg_qbytes: crate::msglen_t, |
| 126 |
pub msg_lspid: crate::pid_t, |
| 127 |
pub msg_lrpid: crate::pid_t, |
| 128 |
__glibc_reserved4: Padding<c_ulong>, |
| 129 |
__glibc_reserved5: Padding<c_ulong>, |
| 130 |
} |
| 131 |
|
| 132 |
pub struct statfs { |
| 133 |
pub f_type: c_long, |
| 134 |
pub f_bsize: c_long, |
| 135 |
pub f_frsize: c_long, |
| 136 |
pub f_blocks: crate::fsblkcnt_t, |
| 137 |
pub f_bfree: crate::fsblkcnt_t, |
| 138 |
pub f_files: crate::fsblkcnt_t, |
| 139 |
pub f_ffree: crate::fsblkcnt_t, |
| 140 |
pub f_bavail: crate::fsblkcnt_t, |
| 141 |
pub f_fsid: crate::fsid_t, |
| 142 |
|
| 143 |
pub f_namelen: c_long, |
| 144 |
f_spare: [c_long; 6], |
| 145 |
} |
| 146 |
|
| 147 |
pub struct msghdr { |
| 148 |
pub msg_name: *mut c_void, |
| 149 |
pub msg_namelen: crate::socklen_t, |
| 150 |
pub msg_iov: *mut crate::iovec, |
| 151 |
pub msg_iovlen: size_t, |
| 152 |
pub msg_control: *mut c_void, |
| 153 |
pub msg_controllen: size_t, |
| 154 |
pub msg_flags: c_int, |
| 155 |
} |
| 156 |
|
| 157 |
pub struct cmsghdr { |
| 158 |
pub cmsg_len: size_t, |
| 159 |
pub cmsg_level: c_int, |
| 160 |
pub cmsg_type: c_int, |
| 161 |
} |
| 162 |
|
| 163 |
pub struct termios { |
| 164 |
pub c_iflag: crate::tcflag_t, |
| 165 |
pub c_oflag: crate::tcflag_t, |
| 166 |
pub c_cflag: crate::tcflag_t, |
| 167 |
pub c_lflag: crate::tcflag_t, |
| 168 |
pub c_line: crate::cc_t, |
| 169 |
pub c_cc: [crate::cc_t; crate::NCCS], |
| 170 |
} |
| 171 |
|
| 172 |
pub struct sysinfo { |
| 173 |
pub uptime: c_long, |
| 174 |
pub loads: [c_ulong; 3], |
| 175 |
pub totalram: c_ulong, |
| 176 |
pub freeram: c_ulong, |
| 177 |
pub sharedram: c_ulong, |
| 178 |
pub bufferram: c_ulong, |
| 179 |
pub totalswap: c_ulong, |
| 180 |
pub freeswap: c_ulong, |
| 181 |
pub procs: c_ushort, |
| 182 |
pub pad: c_ushort, |
| 183 |
pub totalhigh: c_ulong, |
| 184 |
pub freehigh: c_ulong, |
| 185 |
pub mem_unit: c_uint, |
| 186 |
pub _f: [c_char; 0], |
| 187 |
} |
| 188 |
|
| 189 |
// FIXME(1.0): this is actually a union |
| 190 |
#[cfg_attr(target_pointer_width = "32", repr(align(4)))] |
| 191 |
#[cfg_attr(target_pointer_width = "64", repr(align(8)))] |
| 192 |
pub struct sem_t { |
| 193 |
__size: [c_char; 32], |
| 194 |
} |
| 195 |
} |
| 196 |
|
| 197 |
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; |
| 198 |
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; |
| 199 |
pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4; |
| 200 |
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; |
| 201 |
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; |
| 202 |
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32; |
| 203 |
|
| 204 |
pub const SYS_gettid: c_long = 5178; // Valid for n64 |