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