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