Debian Codegraph @

third_party/rust/libc/src/unix/aix/powerpc64.rs

raw
1 use crate::off_t;
2 use crate::prelude::*;
3
4 s! {
5 pub struct sigset_t {
6 pub ss_set: [c_ulong; 4],
7 }
8
9 pub struct fd_set {
10 pub fds_bits: [c_long; 1024],
11 }
12
13 pub struct flock {
14 pub l_type: c_short,
15 pub l_whence: c_short,
16 pub l_sysid: c_uint,
17 pub l_pid: crate::pid_t,
18 pub l_vfs: c_int,
19 pub l_start: off_t,
20 pub l_len: off_t,
21 }
22
23 pub struct statvfs {
24 pub f_bsize: c_ulong,
25 pub f_frsize: c_ulong,
26 pub f_blocks: crate::fsblkcnt_t,
27 pub f_bfree: crate::fsblkcnt_t,
28 pub f_bavail: crate::fsblkcnt_t,
29 pub f_files: crate::fsfilcnt_t,
30 pub f_ffree: crate::fsfilcnt_t,
31 pub f_favail: crate::fsfilcnt_t,
32 pub f_fsid: c_ulong,
33 pub f_basetype: [c_char; 16],
34 pub f_flag: c_ulong,
35 pub f_namemax: c_ulong,
36 pub f_fstr: [c_char; 32],
37 pub f_filler: [c_ulong; 16],
38 }
39
40 pub struct pthread_rwlock_t {
41 __rw_word: [c_long; 10],
42 }
43
44 pub struct pthread_cond_t {
45 __cv_word: [c_long; 6],
46 }
47
48 pub struct pthread_mutex_t {
49 __mt_word: [c_long; 8],
50 }
51
52 pub struct stat {
53 pub st_dev: crate::dev_t,
54 pub st_ino: crate::ino_t,
55 pub st_mode: crate::mode_t,
56 pub st_nlink: crate::nlink_t,
57 pub st_flag: c_ushort,
58 pub st_uid: crate::uid_t,
59 pub st_gid: crate::gid_t,
60 pub st_rdev: crate::dev_t,
61 pub st_ssize: c_int,
62 pub st_atime: crate::st_timespec,
63 pub st_mtime: crate::st_timespec,
64 pub st_ctime: crate::st_timespec,
65 pub st_blksize: crate::blksize_t,
66 pub st_blocks: crate::blkcnt_t,
67 pub st_vfstype: c_int,
68 pub st_vfs: c_uint,
69 pub st_type: c_uint,
70 pub st_gen: c_uint,
71 pub st_reserved: [c_uint; 9],
72 pub st_padto_ll: c_uint,
73 pub st_size: off_t,
74 }
75
76 pub struct statfs {
77 pub f_version: c_int,
78 pub f_type: c_int,
79 pub f_bsize: c_ulong,
80 pub f_blocks: crate::fsblkcnt_t,
81 pub f_bfree: crate::fsblkcnt_t,
82 pub f_bavail: crate::fsblkcnt_t,
83 pub f_files: crate::fsblkcnt_t,
84 pub f_ffree: crate::fsblkcnt_t,
85 pub f_fsid: crate::fsid64_t,
86 pub f_vfstype: c_int,
87 pub f_fsize: c_ulong,
88 pub f_vfsnumber: c_int,
89 pub f_vfsoff: c_int,
90 pub f_vfslen: c_int,
91 pub f_vfsvers: c_int,
92 pub f_fname: [c_char; 32],
93 pub f_fpack: [c_char; 32],
94 pub f_name_max: c_int,
95 }
96
97 pub struct aiocb {
98 pub aio_lio_opcode: c_int,
99 pub aio_fildes: c_int,
100 pub aio_word1: c_int,
101 pub aio_offset: off_t,
102 pub aio_buf: *mut c_void,
103 pub aio_return: ssize_t,
104 pub aio_errno: c_int,
105 pub aio_nbytes: size_t,
106 pub aio_reqprio: c_int,
107 pub aio_sigevent: crate::sigevent,
108 pub aio_word2: c_int,
109 pub aio_fp: c_int,
110 pub aio_handle: *mut aiocb,
111 pub aio_reserved: [c_uint; 2],
112 pub aio_sigev_tid: c_long,
113 }
114
115 pub struct ucontext_t {
116 pub __sc_onstack: c_int,
117 pub uc_sigmask: crate::sigset_t,
118 pub __sc_uerror: c_int,
119 pub uc_mcontext: crate::mcontext_t,
120 pub uc_link: *mut ucontext_t,
121 pub uc_stack: crate::stack_t,
122 // Should be pointer to __extctx_t
123 pub __extctx: *mut c_void,
124 pub __extctx_magic: c_int,
125 pub __pad: [c_int; 1],
126 }
127
128 pub struct mcontext_t {
129 pub gpr: [c_ulonglong; 32],
130 pub msr: c_ulonglong,
131 pub iar: c_ulonglong,
132 pub lr: c_ulonglong,
133 pub ctr: c_ulonglong,
134 pub cr: c_uint,
135 pub xer: c_uint,
136 pub fpscr: c_uint,
137 pub fpscrx: c_uint,
138 pub except: [c_ulonglong; 1],
139 // Should be array of double type
140 pub fpr: [crate::uint64_t; 32],
141 pub fpeu: c_char,
142 pub fpinfo: c_char,
143 pub fpscr24_31: c_char,
144 pub pad: [c_char; 1],
145 pub excp_type: c_int,
146 }
147
148 pub struct utmpx {
149 pub ut_user: [c_char; 256],
150 pub ut_id: [c_char; 14],
151 pub ut_line: [c_char; 64],
152 pub ut_pid: crate::pid_t,
153 pub ut_type: c_short,
154 pub ut_tv: crate::timeval,
155 pub ut_host: [c_char; 256],
156 pub __dbl_word_pad: c_int,
157 pub __reservedA: [c_int; 2],
158 pub __reservedV: [c_int; 6],
159 }
160
161 pub struct pthread_spinlock_t {
162 pub __sp_word: [c_long; 3],
163 }
164
165 pub struct pthread_barrier_t {
166 pub __br_word: [c_long; 5],
167 }
168
169 pub struct msqid_ds {
170 pub msg_perm: crate::ipc_perm,
171 pub msg_first: c_uint,
172 pub msg_last: c_uint,
173 pub msg_cbytes: c_uint,
174 pub msg_qnum: c_uint,
175 pub msg_qbytes: c_ulong,
176 pub msg_lspid: crate::pid_t,
177 pub msg_lrpid: crate::pid_t,
178 pub msg_stime: crate::time_t,
179 pub msg_rtime: crate::time_t,
180 pub msg_ctime: crate::time_t,
181 pub msg_rwait: c_int,
182 pub msg_wwait: c_int,
183 pub msg_reqevents: c_ushort,
184 }
185 }
186
187 s_no_extra_traits! {
188 pub struct siginfo_t {
189 pub si_signo: c_int,
190 pub si_errno: c_int,
191 pub si_code: c_int,
192 pub si_pid: crate::pid_t,
193 pub si_uid: crate::uid_t,
194 pub si_status: c_int,
195 pub si_addr: *mut c_void,
196 pub si_band: c_long,
197 pub si_value: crate::sigval,
198 pub __si_flags: c_int,
199 pub __pad: [c_int; 3],
200 }
201
202 pub union _kernel_simple_lock {
203 pub _slock: c_long,
204 // Should be pointer to 'lock_data_instrumented'
205 pub _slockp: *mut c_void,
206 }
207
208 pub struct fileops_t {
209 pub fo_rw: extern "C" fn(
210 file: *mut file,
211 rw: crate::uio_rw,
212 io: *mut c_void,
213 ext: c_long,
214 secattr: *mut c_void,
215 ) -> c_int,
216 pub fo_ioctl: extern "C" fn(
217 file: *mut file,
218 a: c_long,
219 b: crate::caddr_t,
220 c: c_long,
221 d: c_long,
222 ) -> c_int,
223 pub fo_select:
224 extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int,
225 pub fo_close: extern "C" fn(file: *mut file) -> c_int,
226 pub fo_fstat: extern "C" fn(file: *mut file, sstat: *mut crate::stat) -> c_int,
227 }
228
229 pub struct file {
230 pub f_flag: c_long,
231 pub f_count: c_int,
232 pub f_options: c_short,
233 pub f_type: c_short,
234 // Should be pointer to 'vnode'
235 pub f_data: *mut c_void,
236 pub f_offset: c_longlong,
237 pub f_dir_off: c_long,
238 // Should be pointer to 'cred'
239 pub f_cred: *mut c_void,
240 pub f_lock: _kernel_simple_lock,
241 pub f_offset_lock: _kernel_simple_lock,
242 pub f_vinfo: crate::caddr_t,
243 pub f_ops: *mut fileops_t,
244 pub f_parentp: crate::caddr_t,
245 pub f_fnamep: crate::caddr_t,
246 pub f_fdata: [c_char; 160],
247 }
248
249 pub union __ld_info_file {
250 pub _ldinfo_fd: c_int,
251 pub _ldinfo_fp: *mut file,
252 pub _core_offset: c_long,
253 }
254
255 pub struct ld_info {
256 pub ldinfo_next: c_uint,
257 pub ldinfo_flags: c_uint,
258 pub _file: __ld_info_file,
259 pub ldinfo_textorg: *mut c_void,
260 pub ldinfo_textsize: c_ulong,
261 pub ldinfo_dataorg: *mut c_void,
262 pub ldinfo_datasize: c_ulong,
263 pub ldinfo_filename: [c_char; 2],
264 }
265
266 pub union __pollfd_ext_u {
267 pub addr: *mut c_void,
268 pub data32: u32,
269 pub data: u64,
270 }
271
272 pub struct pollfd_ext {
273 pub fd: c_int,
274 pub events: c_ushort,
275 pub revents: c_ushort,
276 pub data: __pollfd_ext_u,
277 }
278 }
279
280 impl siginfo_t {
281 pub unsafe fn si_addr(&self) -> *mut c_void {
282 self.si_addr
283 }
284
285 pub unsafe fn si_value(&self) -> crate::sigval {
286 self.si_value
287 }
288
289 pub unsafe fn si_pid(&self) -> crate::pid_t {
290 self.si_pid
291 }
292
293 pub unsafe fn si_uid(&self) -> crate::uid_t {
294 self.si_uid
295 }
296
297 pub unsafe fn si_status(&self) -> c_int {
298 self.si_status
299 }
300 }
301
302 cfg_if! {
303 if #[cfg(feature = "extra_traits")] {
304 impl PartialEq for siginfo_t {
305 fn eq(&self, other: &siginfo_t) -> bool {
306 self.si_signo == other.si_signo
307 && self.si_errno == other.si_errno
308 && self.si_code == other.si_code
309 && self.si_pid == other.si_pid
310 && self.si_uid == other.si_uid
311 && self.si_status == other.si_status
312 && self.si_addr == other.si_addr
313 && self.si_band == other.si_band
314 && self.__si_flags == other.__si_flags
315 && self.si_value == other.si_value
316 }
317 }
318 impl Eq for siginfo_t {}
319 impl fmt::Debug for siginfo_t {
320 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
321 f.debug_struct("siginfo_t")
322 .field("si_signo", &self.si_signo)
323 .field("si_errno", &self.si_errno)
324 .field("si_code", &self.si_code)
325 .field("si_pid", &self.si_pid)
326 .field("si_uid", &self.si_uid)
327 .field("si_status", &self.si_status)
328 .field("si_addr", &self.si_addr)
329 .field("si_band", &self.si_band)
330 .field("si_value", &self.si_value)
331 .field("__si_flags", &self.__si_flags)
332 .finish()
333 }
334 }
335 impl hash::Hash for siginfo_t {
336 fn hash<H: hash::Hasher>(&self, state: &mut H) {
337 self.si_signo.hash(state);
338 self.si_errno.hash(state);
339 self.si_code.hash(state);
340 self.si_pid.hash(state);
341 self.si_uid.hash(state);
342 self.si_status.hash(state);
343 self.si_addr.hash(state);
344 self.si_band.hash(state);
345 self.si_value.hash(state);
346 self.__si_flags.hash(state);
347 }
348 }
349
350 impl PartialEq for _kernel_simple_lock {
351 fn eq(&self, other: &_kernel_simple_lock) -> bool {
352 unsafe { self._slock == other._slock && self._slockp == other._slockp }
353 }
354 }
355 impl Eq for _kernel_simple_lock {}
356 impl hash::Hash for _kernel_simple_lock {
357 fn hash<H: hash::Hasher>(&self, state: &mut H) {
358 unsafe {
359 self._slock.hash(state);
360 self._slockp.hash(state);
361 }
362 }
363 }
364
365 impl PartialEq for fileops_t {
366 fn eq(&self, other: &fileops_t) -> bool {
367 self.fo_rw == other.fo_rw
368 && self.fo_ioctl == other.fo_ioctl
369 && self.fo_select == other.fo_select
370 && self.fo_close == other.fo_close
371 && self.fo_fstat == other.fo_fstat
372 }
373 }
374 impl Eq for fileops_t {}
375 impl fmt::Debug for fileops_t {
376 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
377 f.debug_struct("fileops_t")
378 .field("fo_rw", &self.fo_rw)
379 .field("fo_ioctl", &self.fo_ioctl)
380 .field("fo_select", &self.fo_select)
381 .field("fo_close", &self.fo_close)
382 .field("fo_fstat", &self.fo_fstat)
383 .finish()
384 }
385 }
386 impl hash::Hash for fileops_t {
387 fn hash<H: hash::Hasher>(&self, state: &mut H) {
388 self.fo_rw.hash(state);
389 self.fo_ioctl.hash(state);
390 self.fo_select.hash(state);
391 self.fo_close.hash(state);
392 self.fo_fstat.hash(state);
393 }
394 }
395
396 impl PartialEq for file {
397 fn eq(&self, other: &file) -> bool {
398 self.f_flag == other.f_flag
399 && self.f_count == other.f_count
400 && self.f_options == other.f_options
401 && self.f_type == other.f_type
402 && self.f_data == other.f_data
403 && self.f_offset == other.f_offset
404 && self.f_dir_off == other.f_dir_off
405 && self.f_cred == other.f_cred
406 && self.f_vinfo == other.f_vinfo
407 && self.f_ops == other.f_ops
408 && self.f_parentp == other.f_parentp
409 && self.f_fnamep == other.f_fnamep
410 && self.f_fdata == other.f_fdata
411 && self.f_lock == other.f_lock
412 && self.f_offset_lock == other.f_offset_lock
413 }
414 }
415 impl Eq for file {}
416 impl fmt::Debug for file {
417 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
418 f.debug_struct("file")
419 .field("f_flag", &self.f_flag)
420 .field("f_count", &self.f_count)
421 .field("f_options", &self.f_options)
422 .field("f_type", &self.f_type)
423 .field("f_data", &self.f_data)
424 .field("f_offset", &self.f_offset)
425 .field("f_dir_off", &self.f_dir_off)
426 .field("f_cred", &self.f_cred)
427 .field("f_lock", &self.f_lock)
428 .field("f_offset_lock", &self.f_offset_lock)
429 .field("f_vinfo", &self.f_vinfo)
430 .field("f_ops", &self.f_ops)
431 .field("f_parentp", &self.f_parentp)
432 .field("f_fnamep", &self.f_fnamep)
433 .field("f_fdata", &self.f_fdata)
434 .finish()
435 }
436 }
437 impl hash::Hash for file {
438 fn hash<H: hash::Hasher>(&self, state: &mut H) {
439 self.f_flag.hash(state);
440 self.f_count.hash(state);
441 self.f_options.hash(state);
442 self.f_type.hash(state);
443 self.f_data.hash(state);
444 self.f_offset.hash(state);
445 self.f_dir_off.hash(state);
446 self.f_cred.hash(state);
447 self.f_lock.hash(state);
448 self.f_offset_lock.hash(state);
449 self.f_vinfo.hash(state);
450 self.f_ops.hash(state);
451 self.f_parentp.hash(state);
452 self.f_fnamep.hash(state);
453 self.f_fdata.hash(state);
454 }
455 }
456
457 impl PartialEq for __ld_info_file {
458 fn eq(&self, other: &__ld_info_file) -> bool {
459 unsafe {
460 self._ldinfo_fd == other._ldinfo_fd
461 && self._ldinfo_fp == other._ldinfo_fp
462 && self._core_offset == other._core_offset
463 }
464 }
465 }
466 impl Eq for __ld_info_file {}
467 impl hash::Hash for __ld_info_file {
468 fn hash<H: hash::Hasher>(&self, state: &mut H) {
469 unsafe {
470 self._ldinfo_fd.hash(state);
471 self._ldinfo_fp.hash(state);
472 self._core_offset.hash(state);
473 }
474 }
475 }
476
477 impl PartialEq for ld_info {
478 fn eq(&self, other: &ld_info) -> bool {
479 self.ldinfo_next == other.ldinfo_next
480 && self.ldinfo_flags == other.ldinfo_flags
481 && self.ldinfo_textorg == other.ldinfo_textorg
482 && self.ldinfo_textsize == other.ldinfo_textsize
483 && self.ldinfo_dataorg == other.ldinfo_dataorg
484 && self.ldinfo_datasize == other.ldinfo_datasize
485 && self.ldinfo_filename == other.ldinfo_filename
486 && self._file == other._file
487 }
488 }
489 impl Eq for ld_info {}
490 impl fmt::Debug for ld_info {
491 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
492 f.debug_struct("ld_info")
493 .field("ldinfo_next", &self.ldinfo_next)
494 .field("ldinfo_flags", &self.ldinfo_flags)
495 .field("ldinfo_textorg", &self.ldinfo_textorg)
496 .field("ldinfo_textsize", &self.ldinfo_textsize)
497 .field("ldinfo_dataorg", &self.ldinfo_dataorg)
498 .field("ldinfo_datasize", &self.ldinfo_datasize)
499 .field("ldinfo_filename", &self.ldinfo_filename)
500 .field("_file", &self._file)
501 .finish()
502 }
503 }
504 impl hash::Hash for ld_info {
505 fn hash<H: hash::Hasher>(&self, state: &mut H) {
506 self.ldinfo_next.hash(state);
507 self.ldinfo_flags.hash(state);
508 self.ldinfo_textorg.hash(state);
509 self.ldinfo_textsize.hash(state);
510 self.ldinfo_dataorg.hash(state);
511 self.ldinfo_datasize.hash(state);
512 self.ldinfo_filename.hash(state);
513 self._file.hash(state);
514 }
515 }
516
517 impl PartialEq for __pollfd_ext_u {
518 fn eq(&self, other: &__pollfd_ext_u) -> bool {
519 unsafe {
520 self.addr == other.addr
521 && self.data32 == other.data32
522 && self.data == other.data
523 }
524 }
525 }
526 impl Eq for __pollfd_ext_u {}
527 impl hash::Hash for __pollfd_ext_u {
528 fn hash<H: hash::Hasher>(&self, state: &mut H) {
529 unsafe {
530 self.addr.hash(state);
531 self.data.hash(state);
532 self.data32.hash(state);
533 }
534 }
535 }
536
537 impl PartialEq for pollfd_ext {
538 fn eq(&self, other: &pollfd_ext) -> bool {
539 self.fd == other.fd
540 && self.events == other.events
541 && self.revents == other.revents
542 && self.data == other.data
543 }
544 }
545 impl Eq for pollfd_ext {}
546 impl fmt::Debug for pollfd_ext {
547 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
548 f.debug_struct("pollfd_ext")
549 .field("fd", &self.fd)
550 .field("events", &self.events)
551 .field("revents", &self.revents)
552 .field("data", &self.data)
553 .finish()
554 }
555 }
556 impl hash::Hash for pollfd_ext {
557 fn hash<H: hash::Hasher>(&self, state: &mut H) {
558 self.fd.hash(state);
559 self.events.hash(state);
560 self.revents.hash(state);
561 self.data.hash(state);
562 }
563 }
564 }
565 }
566
567 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
568 __mt_word: [0, 2, 0, 0, 0, 0, 0, 0],
569 };
570 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
571 __cv_word: [0, 0, 0, 0, 2, 0],
572 };
573 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
574 __rw_word: [2, 0, 0, 0, 0, 0, 0, 0, 0, 0],
575 };
576 pub const RLIM_INFINITY: c_ulong = 0x7fffffffffffffff;
577
578 extern "C" {
579 pub fn getsystemcfg(label: c_int) -> c_ulong;
580 }