1 pub type c_char = i8;
2 pub type wchar_t = i32;
3 pub type nlink_t = u64;
4 pub type blksize_t = ::c_long;
5 pub type __u64 = ::c_ulonglong;
6 
7 s! {
8     pub struct stat {
9         pub st_dev: ::dev_t,
10         pub st_ino: ::ino_t,
11         pub st_nlink: ::nlink_t,
12         pub st_mode: ::mode_t,
13         pub st_uid: ::uid_t,
14         pub st_gid: ::gid_t,
15         __pad0: ::c_int,
16         pub st_rdev: ::dev_t,
17         pub st_size: ::off_t,
18         pub st_blksize: ::blksize_t,
19         pub st_blocks: ::blkcnt_t,
20         pub st_atime: ::time_t,
21         pub st_atime_nsec: ::c_long,
22         pub st_mtime: ::time_t,
23         pub st_mtime_nsec: ::c_long,
24         pub st_ctime: ::time_t,
25         pub st_ctime_nsec: ::c_long,
26         __unused: [::c_long; 3],
27     }
28 
29     pub struct stat64 {
30         pub st_dev: ::dev_t,
31         pub st_ino: ::ino64_t,
32         pub st_nlink: ::nlink_t,
33         pub st_mode: ::mode_t,
34         pub st_uid: ::uid_t,
35         pub st_gid: ::gid_t,
36         __pad0: ::c_int,
37         pub st_rdev: ::dev_t,
38         pub st_size: ::off_t,
39         pub st_blksize: ::blksize_t,
40         pub st_blocks: ::blkcnt64_t,
41         pub st_atime: ::time_t,
42         pub st_atime_nsec: ::c_long,
43         pub st_mtime: ::time_t,
44         pub st_mtime_nsec: ::c_long,
45         pub st_ctime: ::time_t,
46         pub st_ctime_nsec: ::c_long,
47         __reserved: [::c_long; 3],
48     }
49 
50     pub struct mcontext_t {
51         __private: [u64; 32],
52     }
53 
54     pub struct ipc_perm {
55         pub __ipc_perm_key: ::key_t,
56         pub uid: ::uid_t,
57         pub gid: ::gid_t,
58         pub cuid: ::uid_t,
59         pub cgid: ::gid_t,
60         pub mode: ::mode_t,
61         pub __seq: ::c_int,
62         __unused1: ::c_long,
63         __unused2: ::c_long
64     }
65 }
66 
67 s_no_extra_traits! {
68     pub struct ucontext_t {
69         pub uc_flags: ::c_ulong,
70         pub uc_link: *mut ucontext_t,
71         pub uc_stack: ::stack_t,
72         pub uc_mcontext: mcontext_t,
73         pub uc_sigmask: ::sigset_t,
74         __private: [u8; 512],
75     }
76 }
77 
78 cfg_if! {
79     if #[cfg(feature = "extra_traits")] {
80         impl PartialEq for ucontext_t {
81             fn eq(&self, other: &ucontext_t) -> bool {
82                 self.uc_flags == other.uc_flags
83                     && self.uc_link == other.uc_link
84                     && self.uc_stack == other.uc_stack
85                     && self.uc_mcontext == other.uc_mcontext
86                     && self.uc_sigmask == other.uc_sigmask
87                     && self
88                     .__private
89                     .iter()
90                     .zip(other.__private.iter())
91                     .all(|(a,b)| a == b)
92             }
93         }
94         impl Eq for ucontext_t {}
95         impl ::fmt::Debug for ucontext_t {
96             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
97                 f.debug_struct("ucontext_t")
98                     .field("uc_flags", &self.uc_flags)
99                     .field("uc_link", &self.uc_link)
100                     .field("uc_stack", &self.uc_stack)
101                     .field("uc_mcontext", &self.uc_mcontext)
102                     .field("uc_sigmask", &self.uc_sigmask)
103                     // FIXME: .field("__private", &self.__private)
104                     .finish()
105             }
106         }
107         impl ::hash::Hash for ucontext_t {
108             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
109                 self.uc_flags.hash(state);
110                 self.uc_link.hash(state);
111                 self.uc_stack.hash(state);
112                 self.uc_mcontext.hash(state);
113                 self.uc_sigmask.hash(state);
114                 self.__private.hash(state);
115             }
116         }
117     }
118 }
119 
120 // offsets in user_regs_structs, from sys/reg.h
121 pub const R15: ::c_int = 0;
122 pub const R14: ::c_int = 1;
123 pub const R13: ::c_int = 2;
124 pub const R12: ::c_int = 3;
125 pub const RBP: ::c_int = 4;
126 pub const RBX: ::c_int = 5;
127 pub const R11: ::c_int = 6;
128 pub const R10: ::c_int = 7;
129 pub const R9: ::c_int = 8;
130 pub const R8: ::c_int = 9;
131 pub const RAX: ::c_int = 10;
132 pub const RCX: ::c_int = 11;
133 pub const RDX: ::c_int = 12;
134 pub const RSI: ::c_int = 13;
135 pub const RDI: ::c_int = 14;
136 pub const ORIG_RAX: ::c_int = 15;
137 pub const RIP: ::c_int = 16;
138 pub const CS: ::c_int = 17;
139 pub const EFLAGS: ::c_int = 18;
140 pub const RSP: ::c_int = 19;
141 pub const SS: ::c_int = 20;
142 pub const FS_BASE: ::c_int = 21;
143 pub const GS_BASE: ::c_int = 22;
144 pub const DS: ::c_int = 23;
145 pub const ES: ::c_int = 24;
146 pub const FS: ::c_int = 25;
147 pub const GS: ::c_int = 26;
148 
149 pub const MAP_32BIT: ::c_int = 0x0040;
150 
151 pub const SIGSTKSZ: ::size_t = 8192;
152 pub const MINSIGSTKSZ: ::size_t = 2048;
153