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