]>
Commit | Line | Data |
---|---|---|
cc61c64b XL |
1 | // The following definitions are correct for arm and i686, |
2 | // but may be wrong for mips | |
3 | ||
a7813a04 XL |
4 | pub type c_long = i32; |
5 | pub type c_ulong = u32; | |
7453a54e | 6 | pub type mode_t = u16; |
a7813a04 | 7 | pub type off64_t = ::c_longlong; |
cc61c64b XL |
8 | pub type sigset_t = ::c_ulong; |
9 | pub type socklen_t = i32; | |
10 | pub type time64_t = i64; | |
7453a54e | 11 | |
92a42be0 SL |
12 | s! { |
13 | pub struct sigaction { | |
14 | pub sa_sigaction: ::sighandler_t, | |
15 | pub sa_mask: ::sigset_t, | |
16 | pub sa_flags: ::c_ulong, | |
17 | pub sa_restorer: ::dox::Option<extern fn()>, | |
18 | } | |
a7813a04 | 19 | |
cc61c64b XL |
20 | pub struct rlimit64 { |
21 | pub rlim_cur: u64, | |
22 | pub rlim_max: u64, | |
23 | } | |
24 | ||
a7813a04 XL |
25 | pub struct stat { |
26 | pub st_dev: ::c_ulonglong, | |
27 | __pad0: [::c_uchar; 4], | |
28 | __st_ino: ::ino_t, | |
29 | pub st_mode: ::c_uint, | |
30 | pub st_nlink: ::c_uint, | |
31 | pub st_uid: ::uid_t, | |
32 | pub st_gid: ::gid_t, | |
33 | pub st_rdev: ::c_ulonglong, | |
34 | __pad3: [::c_uchar; 4], | |
35 | pub st_size: ::c_longlong, | |
36 | pub st_blksize: ::blksize_t, | |
37 | pub st_blocks: ::c_ulonglong, | |
38 | pub st_atime: ::c_ulong, | |
39 | pub st_atime_nsec: ::c_ulong, | |
40 | pub st_mtime: ::c_ulong, | |
41 | pub st_mtime_nsec: ::c_ulong, | |
42 | pub st_ctime: ::c_ulong, | |
43 | pub st_ctime_nsec: ::c_ulong, | |
44 | pub st_ino: ::c_ulonglong, | |
45 | } | |
46 | ||
47 | pub struct stat64 { | |
48 | pub st_dev: ::c_ulonglong, | |
49 | __pad0: [::c_uchar; 4], | |
50 | __st_ino: ::ino_t, | |
51 | pub st_mode: ::c_uint, | |
52 | pub st_nlink: ::c_uint, | |
53 | pub st_uid: ::uid_t, | |
54 | pub st_gid: ::gid_t, | |
55 | pub st_rdev: ::c_ulonglong, | |
56 | __pad3: [::c_uchar; 4], | |
57 | pub st_size: ::c_longlong, | |
58 | pub st_blksize: ::blksize_t, | |
59 | pub st_blocks: ::c_ulonglong, | |
60 | pub st_atime: ::c_ulong, | |
61 | pub st_atime_nsec: ::c_ulong, | |
62 | pub st_mtime: ::c_ulong, | |
63 | pub st_mtime_nsec: ::c_ulong, | |
64 | pub st_ctime: ::c_ulong, | |
65 | pub st_ctime_nsec: ::c_ulong, | |
66 | pub st_ino: ::c_ulonglong, | |
67 | } | |
68 | ||
3b2f2976 XL |
69 | pub struct statfs64 { |
70 | pub f_type: u32, | |
71 | pub f_bsize: u32, | |
72 | pub f_blocks: u64, | |
73 | pub f_bfree: u64, | |
74 | pub f_bavail: u64, | |
75 | pub f_files: u64, | |
76 | pub f_ffree: u64, | |
77 | f_fsid: [u32; 2], | |
78 | pub f_namelen: u32, | |
79 | pub f_frsize: u32, | |
80 | pub f_flags: u32, | |
81 | pub f_spare: [u32; 4], | |
82 | } | |
83 | ||
84 | pub struct statvfs64 { | |
85 | pub f_bsize: ::c_ulong, | |
86 | pub f_frsize: ::c_ulong, | |
87 | pub f_blocks: ::c_ulong, | |
88 | pub f_bfree: ::c_ulong, | |
89 | pub f_bavail: ::c_ulong, | |
90 | pub f_files: ::c_ulong, | |
91 | pub f_ffree: ::c_ulong, | |
92 | pub f_favail: ::c_ulong, | |
93 | pub f_fsid: ::c_ulong, | |
94 | pub f_flag: ::c_ulong, | |
95 | pub f_namemax: ::c_ulong, | |
96 | } | |
97 | ||
a7813a04 XL |
98 | pub struct pthread_attr_t { |
99 | pub flags: ::uint32_t, | |
100 | pub stack_base: *mut ::c_void, | |
101 | pub stack_size: ::size_t, | |
102 | pub guard_size: ::size_t, | |
103 | pub sched_policy: ::int32_t, | |
104 | pub sched_priority: ::int32_t, | |
105 | } | |
106 | ||
107 | pub struct pthread_mutex_t { value: ::c_int } | |
108 | ||
109 | pub struct pthread_cond_t { value: ::c_int } | |
110 | ||
111 | pub struct pthread_rwlock_t { | |
112 | lock: pthread_mutex_t, | |
113 | cond: pthread_cond_t, | |
114 | numLocks: ::c_int, | |
115 | writerThreadId: ::c_int, | |
116 | pendingReaders: ::c_int, | |
117 | pendingWriters: ::c_int, | |
118 | attr: i32, | |
119 | __reserved: [::c_char; 12], | |
120 | } | |
121 | ||
122 | pub struct passwd { | |
123 | pub pw_name: *mut ::c_char, | |
124 | pub pw_passwd: *mut ::c_char, | |
125 | pub pw_uid: ::uid_t, | |
126 | pub pw_gid: ::gid_t, | |
127 | pub pw_dir: *mut ::c_char, | |
128 | pub pw_shell: *mut ::c_char, | |
129 | } | |
130 | ||
131 | pub struct statfs { | |
132 | pub f_type: ::uint32_t, | |
133 | pub f_bsize: ::uint32_t, | |
134 | pub f_blocks: ::uint64_t, | |
135 | pub f_bfree: ::uint64_t, | |
136 | pub f_bavail: ::uint64_t, | |
137 | pub f_files: ::uint64_t, | |
138 | pub f_ffree: ::uint64_t, | |
139 | pub f_fsid: ::__fsid_t, | |
140 | pub f_namelen: ::uint32_t, | |
141 | pub f_frsize: ::uint32_t, | |
142 | pub f_flags: ::uint32_t, | |
143 | pub f_spare: [::uint32_t; 4], | |
144 | } | |
3157f602 XL |
145 | |
146 | pub struct sysinfo { | |
147 | pub uptime: ::c_long, | |
148 | pub loads: [::c_ulong; 3], | |
149 | pub totalram: ::c_ulong, | |
150 | pub freeram: ::c_ulong, | |
151 | pub sharedram: ::c_ulong, | |
152 | pub bufferram: ::c_ulong, | |
153 | pub totalswap: ::c_ulong, | |
154 | pub freeswap: ::c_ulong, | |
155 | pub procs: ::c_ushort, | |
156 | pub pad: ::c_ushort, | |
157 | pub totalhigh: ::c_ulong, | |
158 | pub freehigh: ::c_ulong, | |
159 | pub mem_unit: ::c_uint, | |
160 | pub _f: [::c_char; 8], | |
161 | } | |
92a42be0 | 162 | } |
54a0048b | 163 | |
cc61c64b XL |
164 | pub const RTLD_GLOBAL: ::c_int = 2; |
165 | pub const RTLD_NOW: ::c_int = 0; | |
166 | pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void; | |
167 | ||
168 | pub const PTRACE_GETFPREGS: ::c_int = 14; | |
169 | pub const PTRACE_SETFPREGS: ::c_int = 15; | |
170 | pub const PTRACE_GETREGS: ::c_int = 12; | |
171 | pub const PTRACE_SETREGS: ::c_int = 13; | |
172 | ||
a7813a04 XL |
173 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
174 | value: 0, | |
175 | }; | |
176 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | |
177 | value: 0, | |
178 | }; | |
179 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | |
180 | lock: PTHREAD_MUTEX_INITIALIZER, | |
181 | cond: PTHREAD_COND_INITIALIZER, | |
182 | numLocks: 0, | |
183 | writerThreadId: 0, | |
184 | pendingReaders: 0, | |
185 | pendingWriters: 0, | |
186 | attr: 0, | |
187 | __reserved: [0; 12], | |
188 | }; | |
189 | pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2; | |
3157f602 XL |
190 | pub const CPU_SETSIZE: ::size_t = 32; |
191 | pub const __CPU_BITS: ::size_t = 32; | |
a7813a04 | 192 | |
9e0c209e SL |
193 | pub const UT_LINESIZE: usize = 8; |
194 | pub const UT_NAMESIZE: usize = 8; | |
195 | pub const UT_HOSTSIZE: usize = 16; | |
196 | ||
3b2f2976 XL |
197 | pub const SIGSTKSZ: ::size_t = 8192; |
198 | pub const MINSIGSTKSZ: ::size_t = 2048; | |
199 | ||
a7813a04 XL |
200 | extern { |
201 | pub fn timegm64(tm: *const ::tm) -> ::time64_t; | |
202 | } | |
cc61c64b XL |
203 | |
204 | cfg_if! { | |
205 | if #[cfg(target_arch = "x86")] { | |
206 | mod x86; | |
207 | pub use self::x86::*; | |
208 | } else if #[cfg(target_arch = "arm")] { | |
209 | mod arm; | |
210 | pub use self::arm::*; | |
211 | } else { | |
212 | // Unknown target_arch | |
213 | } | |
214 | } |