| 1 |
use crate::off_t; |
| 2 |
use crate::prelude::*; |
| 3 |
|
| 4 |
// Define lock_data_instrumented as an empty enum |
| 5 |
extern_ty! { |
| 6 |
pub type lock_data_instrumented; |
| 7 |
} |
| 8 |
|
| 9 |
s! { |
| 10 |
pub struct sigset_t { |
| 11 |
pub ss_set: [c_ulong; 4], |
| 12 |
} |
| 13 |
|
| 14 |
pub struct fd_set { |
| 15 |
pub fds_bits: [c_long; 1024], |
| 16 |
} |
| 17 |
|
| 18 |
pub struct flock { |
| 19 |
pub l_type: c_short, |
| 20 |
pub l_whence: c_short, |
| 21 |
pub l_sysid: c_uint, |
| 22 |
pub l_pid: crate::pid_t, |
| 23 |
pub l_vfs: c_int, |
| 24 |
pub l_start: off_t, |
| 25 |
pub l_len: off_t, |
| 26 |
} |
| 27 |
|
| 28 |
pub struct statvfs { |
| 29 |
pub f_bsize: c_ulong, |
| 30 |
pub f_frsize: c_ulong, |
| 31 |
pub f_blocks: crate::fsblkcnt_t, |
| 32 |
pub f_bfree: crate::fsblkcnt_t, |
| 33 |
pub f_bavail: crate::fsblkcnt_t, |
| 34 |
pub f_files: crate::fsfilcnt_t, |
| 35 |
pub f_ffree: crate::fsfilcnt_t, |
| 36 |
pub f_favail: crate::fsfilcnt_t, |
| 37 |
pub f_fsid: c_ulong, |
| 38 |
pub f_basetype: [c_char; 16], |
| 39 |
pub f_flag: c_ulong, |
| 40 |
pub f_namemax: c_ulong, |
| 41 |
pub f_fstr: [c_char; 32], |
| 42 |
pub f_filler: [c_ulong; 16], |
| 43 |
} |
| 44 |
|
| 45 |
pub struct pthread_rwlock_t { |
| 46 |
__rw_word: [c_long; 10], |
| 47 |
} |
| 48 |
|
| 49 |
pub struct pthread_cond_t { |
| 50 |
__cv_word: [c_long; 6], |
| 51 |
} |
| 52 |
|
| 53 |
pub struct pthread_mutex_t { |
| 54 |
__mt_word: [c_long; 8], |
| 55 |
} |
| 56 |
|
| 57 |
pub struct pthread_once_t { |
| 58 |
__on_word: [c_long; 9], |
| 59 |
} |
| 60 |
|
| 61 |
pub struct stat { |
| 62 |
pub st_dev: crate::dev_t, |
| 63 |
pub st_ino: crate::ino_t, |
| 64 |
pub st_mode: crate::mode_t, |
| 65 |
pub st_nlink: crate::nlink_t, |
| 66 |
pub st_flag: c_ushort, |
| 67 |
pub st_uid: crate::uid_t, |
| 68 |
pub st_gid: crate::gid_t, |
| 69 |
pub st_rdev: crate::dev_t, |
| 70 |
pub st_ssize: c_int, |
| 71 |
pub st_atim: crate::st_timespec, |
| 72 |
pub st_mtim: crate::st_timespec, |
| 73 |
pub st_ctim: crate::st_timespec, |
| 74 |
pub st_blksize: crate::blksize_t, |
| 75 |
pub st_blocks: crate::blkcnt_t, |
| 76 |
pub st_vfstype: c_int, |
| 77 |
pub st_vfs: c_uint, |
| 78 |
pub st_type: c_uint, |
| 79 |
pub st_gen: c_uint, |
| 80 |
st_reserved: Padding<[c_uint; 9]>, |
| 81 |
pub st_padto_ll: c_uint, |
| 82 |
pub st_size: off_t, |
| 83 |
} |
| 84 |
|
| 85 |
pub struct statfs { |
| 86 |
pub f_version: c_int, |
| 87 |
pub f_type: c_int, |
| 88 |
pub f_bsize: c_ulong, |
| 89 |
pub f_blocks: crate::fsblkcnt_t, |
| 90 |
pub f_bfree: crate::fsblkcnt_t, |
| 91 |
pub f_bavail: crate::fsblkcnt_t, |
| 92 |
pub f_files: crate::fsblkcnt_t, |
| 93 |
pub f_ffree: crate::fsblkcnt_t, |
| 94 |
pub f_fsid: crate::fsid64_t, |
| 95 |
pub f_vfstype: c_int, |
| 96 |
pub f_fsize: c_ulong, |
| 97 |
pub f_vfsnumber: c_int, |
| 98 |
pub f_vfsoff: c_int, |
| 99 |
pub f_vfslen: c_int, |
| 100 |
pub f_vfsvers: c_int, |
| 101 |
pub f_fname: [c_char; 32], |
| 102 |
pub f_fpack: [c_char; 32], |
| 103 |
pub f_name_max: c_int, |
| 104 |
} |
| 105 |
|
| 106 |
pub struct aiocb { |
| 107 |
pub aio_lio_opcode: c_int, |
| 108 |
pub aio_fildes: c_int, |
| 109 |
pub aio_word1: c_int, |
| 110 |
pub aio_offset: off_t, |
| 111 |
pub aio_buf: *mut c_void, |
| 112 |
pub aio_return: ssize_t, |
| 113 |
pub aio_errno: c_int, |
| 114 |
pub aio_nbytes: size_t, |
| 115 |
pub aio_reqprio: c_int, |
| 116 |
pub aio_sigevent: crate::sigevent, |
| 117 |
pub aio_word2: c_int, |
| 118 |
pub aio_fp: c_int, |
| 119 |
pub aio_handle: *mut aiocb, |
| 120 |
aio_reserved: Padding<[c_uint; 2]>, |
| 121 |
pub aio_sigev_tid: c_long, |
| 122 |
} |
| 123 |
|
| 124 |
pub struct __vmxreg_t { |
| 125 |
__v: [c_uint; 4], |
| 126 |
} |
| 127 |
|
| 128 |
pub struct __vmx_context_t { |
| 129 |
pub __vr: [crate::__vmxreg_t; 32], |
| 130 |
pub __pad1: [c_uint; 3], |
| 131 |
pub __vscr: c_uint, |
| 132 |
pub __vrsave: c_uint, |
| 133 |
pub __pad2: [c_uint; 3], |
| 134 |
} |
| 135 |
|
| 136 |
pub struct __vsx_context_t { |
| 137 |
pub __vsr_dw1: [c_ulonglong; 32], |
| 138 |
} |
| 139 |
|
| 140 |
pub struct __tm_context_t { |
| 141 |
pub vmx: crate::__vmx_context_t, |
| 142 |
pub vsx: crate::__vsx_context_t, |
| 143 |
pub gpr: [c_ulonglong; 32], |
| 144 |
pub lr: c_ulonglong, |
| 145 |
pub ctr: c_ulonglong, |
| 146 |
pub cr: c_uint, |
| 147 |
pub xer: c_uint, |
| 148 |
pub amr: c_ulonglong, |
| 149 |
pub texasr: c_ulonglong, |
| 150 |
pub tfiar: c_ulonglong, |
| 151 |
pub tfhar: c_ulonglong, |
| 152 |
pub ppr: c_ulonglong, |
| 153 |
pub dscr: c_ulonglong, |
| 154 |
pub tar: c_ulonglong, |
| 155 |
pub fpscr: c_uint, |
| 156 |
pub fpscrx: c_uint, |
| 157 |
pub fpr: [fpreg_t; 32], |
| 158 |
pub tmcontext: c_char, |
| 159 |
pub tmstate: c_char, |
| 160 |
pub prevowner: c_char, |
| 161 |
pub pad: [c_char; 5], |
| 162 |
} |
| 163 |
|
| 164 |
pub struct __context64 { |
| 165 |
pub gpr: [c_ulonglong; 32], |
| 166 |
pub msr: c_ulonglong, |
| 167 |
pub iar: c_ulonglong, |
| 168 |
pub lr: c_ulonglong, |
| 169 |
pub ctr: c_ulonglong, |
| 170 |
pub cr: c_uint, |
| 171 |
pub xer: c_uint, |
| 172 |
pub fpscr: c_uint, |
| 173 |
pub fpscrx: c_uint, |
| 174 |
pub except: [c_ulonglong; 1], |
| 175 |
pub fpr: [fpreg_t; 32], |
| 176 |
pub fpeu: c_char, |
| 177 |
pub fpinfo: c_char, |
| 178 |
pub fpscr24_31: c_char, |
| 179 |
pub pad: [c_char; 1], |
| 180 |
pub excp_type: c_int, |
| 181 |
} |
| 182 |
|
| 183 |
pub struct mcontext_t { |
| 184 |
pub jmp_context: __context64, |
| 185 |
} |
| 186 |
|
| 187 |
pub struct __extctx_t { |
| 188 |
pub __flags: c_uint, |
| 189 |
pub __rsvd1: [c_uint; 3], |
| 190 |
pub __vmx: crate::__vmx_context_t, |
| 191 |
pub __ukeys: [c_uint; 2], |
| 192 |
pub __vsx: crate::__vsx_context_t, |
| 193 |
pub __tm: crate::__tm_context_t, |
| 194 |
__reserved: Padding<[c_char; 1860]>, |
| 195 |
pub __extctx_magic: c_int, |
| 196 |
} |
| 197 |
|
| 198 |
pub struct ucontext_t { |
| 199 |
pub __sc_onstack: c_int, |
| 200 |
pub uc_sigmask: crate::sigset_t, |
| 201 |
pub __sc_uerror: c_int, |
| 202 |
pub uc_mcontext: crate::mcontext_t, |
| 203 |
pub uc_link: *mut ucontext_t, |
| 204 |
pub uc_stack: crate::stack_t, |
| 205 |
pub __extctx: *mut crate::__extctx_t, |
| 206 |
pub __extctx_magic: c_int, |
| 207 |
pub __pad: [c_int; 1], |
| 208 |
} |
| 209 |
|
| 210 |
pub struct utmpx { |
| 211 |
pub ut_user: [c_char; 256], |
| 212 |
pub ut_id: [c_char; 14], |
| 213 |
pub ut_line: [c_char; 64], |
| 214 |
pub ut_pid: crate::pid_t, |
| 215 |
pub ut_type: c_short, |
| 216 |
pub ut_tv: crate::timeval, |
| 217 |
pub ut_host: [c_char; 256], |
| 218 |
pub __dbl_word_pad: c_int, |
| 219 |
pub __reservedA: [c_int; 2], |
| 220 |
pub __reservedV: [c_int; 6], |
| 221 |
} |
| 222 |
|
| 223 |
pub struct pthread_spinlock_t { |
| 224 |
pub __sp_word: [c_long; 3], |
| 225 |
} |
| 226 |
|
| 227 |
pub struct pthread_barrier_t { |
| 228 |
pub __br_word: [c_long; 5], |
| 229 |
} |
| 230 |
|
| 231 |
pub struct msqid_ds { |
| 232 |
pub msg_perm: crate::ipc_perm, |
| 233 |
pub msg_first: c_uint, |
| 234 |
pub msg_last: c_uint, |
| 235 |
pub msg_cbytes: c_uint, |
| 236 |
pub msg_qnum: c_uint, |
| 237 |
pub msg_qbytes: c_ulong, |
| 238 |
pub msg_lspid: crate::pid_t, |
| 239 |
pub msg_lrpid: crate::pid_t, |
| 240 |
pub msg_stime: crate::time_t, |
| 241 |
pub msg_rtime: crate::time_t, |
| 242 |
pub msg_ctime: crate::time_t, |
| 243 |
pub msg_rwait: c_int, |
| 244 |
pub msg_wwait: c_int, |
| 245 |
pub msg_reqevents: c_ushort, |
| 246 |
} |
| 247 |
|
| 248 |
pub struct siginfo_t { |
| 249 |
pub si_signo: c_int, |
| 250 |
pub si_errno: c_int, |
| 251 |
pub si_code: c_int, |
| 252 |
pub si_pid: crate::pid_t, |
| 253 |
pub si_uid: crate::uid_t, |
| 254 |
pub si_status: c_int, |
| 255 |
pub si_addr: *mut c_void, |
| 256 |
pub si_band: c_long, |
| 257 |
pub si_value: crate::sigval, |
| 258 |
pub __si_flags: c_int, |
| 259 |
pub __pad: [c_int; 3], |
| 260 |
} |
| 261 |
|
| 262 |
pub struct pollfd_ext { |
| 263 |
pub fd: c_int, |
| 264 |
pub events: c_short, |
| 265 |
pub revents: c_short, |
| 266 |
pub data: __pollfd_ext_u, |
| 267 |
} |
| 268 |
} |
| 269 |
|
| 270 |
s_no_extra_traits! { |
| 271 |
pub union _kernel_simple_lock { |
| 272 |
pub _slock: c_long, |
| 273 |
pub _slockp: *mut lock_data_instrumented, |
| 274 |
} |
| 275 |
|
| 276 |
pub struct fileops_t { |
| 277 |
pub fo_rw: Option< |
| 278 |
extern "C" fn( |
| 279 |
file: *mut file, |
| 280 |
rw: crate::uio_rw, |
| 281 |
io: *mut c_void, |
| 282 |
ext: c_long, |
| 283 |
secattr: *mut c_void, |
| 284 |
) -> c_int, |
| 285 |
>, |
| 286 |
pub fo_ioctl: Option< |
| 287 |
extern "C" fn( |
| 288 |
file: *mut file, |
| 289 |
a: c_long, |
| 290 |
b: crate::caddr_t, |
| 291 |
c: c_long, |
| 292 |
d: c_long, |
| 293 |
) -> c_int, |
| 294 |
>, |
| 295 |
pub fo_select: Option< |
| 296 |
extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int, |
| 297 |
>, |
| 298 |
pub fo_close: Option<extern "C" fn(file: *mut file) -> c_int>, |
| 299 |
pub fo_fstat: Option<extern "C" fn(file: *mut file, sstat: *mut crate::stat) -> c_int>, |
| 300 |
} |
| 301 |
|
| 302 |
pub struct file { |
| 303 |
pub f_flag: c_long, |
| 304 |
pub f_count: c_int, |
| 305 |
pub f_options: c_short, |
| 306 |
pub f_type: c_short, |
| 307 |
// Should be pointer to 'vnode' |
| 308 |
pub f_data: *mut c_void, |
| 309 |
pub f_offset: c_longlong, |
| 310 |
pub f_dir_off: c_long, |
| 311 |
// Should be pointer to 'cred' |
| 312 |
pub f_cred: *mut c_void, |
| 313 |
pub f_lock: _kernel_simple_lock, |
| 314 |
pub f_offset_lock: _kernel_simple_lock, |
| 315 |
pub f_vinfo: crate::caddr_t, |
| 316 |
pub f_ops: *mut fileops_t, |
| 317 |
pub f_parentp: crate::caddr_t, |
| 318 |
pub f_fnamep: crate::caddr_t, |
| 319 |
pub f_fdata: [c_char; 160], |
| 320 |
} |
| 321 |
|
| 322 |
pub union __ld_info_file { |
| 323 |
pub _ldinfo_fd: c_int, |
| 324 |
pub _ldinfo_fp: *mut file, |
| 325 |
pub _core_offset: c_long, |
| 326 |
} |
| 327 |
|
| 328 |
pub struct ld_info { |
| 329 |
pub ldinfo_next: c_uint, |
| 330 |
pub ldinfo_flags: c_uint, |
| 331 |
pub _file: __ld_info_file, |
| 332 |
pub ldinfo_textorg: *mut c_void, |
| 333 |
pub ldinfo_textsize: c_ulong, |
| 334 |
pub ldinfo_dataorg: *mut c_void, |
| 335 |
pub ldinfo_datasize: c_ulong, |
| 336 |
pub ldinfo_filename: [c_char; 2], |
| 337 |
} |
| 338 |
|
| 339 |
pub union __pollfd_ext_u { |
| 340 |
pub addr: *mut c_void, |
| 341 |
pub data32: u32, |
| 342 |
pub data: u64, |
| 343 |
} |
| 344 |
|
| 345 |
pub struct fpreg_t { |
| 346 |
pub d: c_double, |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
impl siginfo_t { |
| 351 |
pub unsafe fn si_addr(&self) -> *mut c_void { |
| 352 |
self.si_addr |
| 353 |
} |
| 354 |
|
| 355 |
pub unsafe fn si_value(&self) -> crate::sigval { |
| 356 |
self.si_value |
| 357 |
} |
| 358 |
|
| 359 |
pub unsafe fn si_pid(&self) -> crate::pid_t { |
| 360 |
self.si_pid |
| 361 |
} |
| 362 |
|
| 363 |
pub unsafe fn si_uid(&self) -> crate::uid_t { |
| 364 |
self.si_uid |
| 365 |
} |
| 366 |
|
| 367 |
pub unsafe fn si_status(&self) -> c_int { |
| 368 |
self.si_status |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
cfg_if! { |
| 373 |
if #[cfg(feature = "extra_traits")] { |
| 374 |
impl PartialEq for __pollfd_ext_u { |
| 375 |
fn eq(&self, other: &__pollfd_ext_u) -> bool { |
| 376 |
unsafe { |
| 377 |
self.addr == other.addr |
| 378 |
&& self.data32 == other.data32 |
| 379 |
&& self.data == other.data |
| 380 |
} |
| 381 |
} |
| 382 |
} |
| 383 |
impl Eq for __pollfd_ext_u {} |
| 384 |
impl hash::Hash for __pollfd_ext_u { |
| 385 |
fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 386 |
unsafe { |
| 387 |
self.addr.hash(state); |
| 388 |
self.data.hash(state); |
| 389 |
self.data32.hash(state); |
| 390 |
} |
| 391 |
} |
| 392 |
} |
| 393 |
|
| 394 |
impl PartialEq for fpreg_t { |
| 395 |
fn eq(&self, other: &fpreg_t) -> bool { |
| 396 |
self.d == other.d |
| 397 |
} |
| 398 |
} |
| 399 |
impl Eq for fpreg_t {} |
| 400 |
impl hash::Hash for fpreg_t { |
| 401 |
fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 402 |
let d: u64 = self.d.to_bits(); |
| 403 |
d.hash(state); |
| 404 |
} |
| 405 |
} |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
| 410 |
__mt_word: [0, 2, 0, 0, 0, 0, 0, 0], |
| 411 |
}; |
| 412 |
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { |
| 413 |
__cv_word: [0, 0, 0, 0, 2, 0], |
| 414 |
}; |
| 415 |
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { |
| 416 |
__rw_word: [2, 0, 0, 0, 0, 0, 0, 0, 0, 0], |
| 417 |
}; |
| 418 |
|
| 419 |
pub const PTHREAD_ONCE_INIT: pthread_once_t = pthread_once_t { |
| 420 |
__on_word: [0, 0, 0, 0, 0, 2, 0, 0, 0], |
| 421 |
}; |
| 422 |
|
| 423 |
pub const RLIM_INFINITY: c_ulong = 0x7fffffffffffffff; |
| 424 |
|
| 425 |
extern "C" { |
| 426 |
pub fn getsystemcfg(label: c_int) -> c_ulong; |
| 427 |
} |