|
| 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 statfs { |
| 120 | + pub f_type: ::c_long, |
| 121 | + pub f_bsize: ::c_long, |
| 122 | + pub f_frsize: ::c_long, |
| 123 | + pub f_blocks: ::fsblkcnt_t, |
| 124 | + pub f_bfree: ::fsblkcnt_t, |
| 125 | + pub f_files: ::fsblkcnt_t, |
| 126 | + pub f_ffree: ::fsblkcnt_t, |
| 127 | + pub f_bavail: ::fsblkcnt_t, |
| 128 | + pub f_fsid: ::fsid_t, |
| 129 | + |
| 130 | + pub f_namelen: ::c_long, |
| 131 | + f_spare: [::c_long; 6], |
| 132 | + } |
| 133 | + |
| 134 | + pub struct msghdr { |
| 135 | + pub msg_name: *mut ::c_void, |
| 136 | + pub msg_namelen: ::socklen_t, |
| 137 | + pub msg_iov: *mut ::iovec, |
| 138 | + pub msg_iovlen: ::size_t, |
| 139 | + pub msg_control: *mut ::c_void, |
| 140 | + pub msg_controllen: ::size_t, |
| 141 | + pub msg_flags: ::c_int, |
| 142 | + } |
| 143 | + |
| 144 | + pub struct termios { |
| 145 | + pub c_iflag: ::tcflag_t, |
| 146 | + pub c_oflag: ::tcflag_t, |
| 147 | + pub c_cflag: ::tcflag_t, |
| 148 | + pub c_lflag: ::tcflag_t, |
| 149 | + pub c_line: ::cc_t, |
| 150 | + pub c_cc: [::cc_t; ::NCCS], |
| 151 | + } |
| 152 | + |
| 153 | + pub struct sysinfo { |
| 154 | + pub uptime: ::c_long, |
| 155 | + pub loads: [::c_ulong; 3], |
| 156 | + pub totalram: ::c_ulong, |
| 157 | + pub freeram: ::c_ulong, |
| 158 | + pub sharedram: ::c_ulong, |
| 159 | + pub bufferram: ::c_ulong, |
| 160 | + pub totalswap: ::c_ulong, |
| 161 | + pub freeswap: ::c_ulong, |
| 162 | + pub procs: ::c_ushort, |
| 163 | + pub pad: ::c_ushort, |
| 164 | + pub totalhigh: ::c_ulong, |
| 165 | + pub freehigh: ::c_ulong, |
| 166 | + pub mem_unit: ::c_uint, |
| 167 | + pub _f: [::c_char; 0], |
| 168 | + } |
| 169 | + |
| 170 | + // FIXME this is actually a union |
| 171 | + pub struct sem_t { |
| 172 | + __size: [::c_char; 32], |
| 173 | + __align: [::c_long; 0], |
| 174 | + } |
| 175 | +} |
| 176 | + |
| 177 | +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; |
| 178 | +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; |
| 179 | +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; |
| 180 | +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; |
| 181 | + |
| 182 | +pub const EADDRINUSE: ::c_int = 125; |
| 183 | +pub const EADDRNOTAVAIL: ::c_int = 126; |
| 184 | +pub const ECONNABORTED: ::c_int = 130; |
| 185 | +pub const ECONNREFUSED: ::c_int = 146; |
| 186 | +pub const ECONNRESET: ::c_int = 131; |
| 187 | +pub const EDEADLK: ::c_int = 45; |
| 188 | +pub const ENOSYS: ::c_int = 89; |
| 189 | +pub const ENOTCONN: ::c_int = 134; |
| 190 | +pub const ETIMEDOUT: ::c_int = 145; |
| 191 | +pub const FIOCLEX: ::c_ulong = 0x6601; |
| 192 | +pub const FIONBIO: ::c_ulong = 0x667e; |
| 193 | +pub const MAP_ANON: ::c_int = 0x800; |
| 194 | +pub const O_ACCMODE: ::c_int = 3; |
| 195 | +pub const O_APPEND: ::c_int = 8; |
| 196 | +pub const O_CREAT: ::c_int = 256; |
| 197 | +pub const O_EXCL: ::c_int = 1024; |
| 198 | +pub const O_NONBLOCK: ::c_int = 128; |
| 199 | +pub const PTHREAD_STACK_MIN: ::size_t = 131072; |
| 200 | +pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff; |
| 201 | +pub const SA_ONSTACK: ::c_int = 0x08000000; |
| 202 | +pub const SA_SIGINFO: ::c_int = 0x00000008; |
| 203 | +pub const SIGBUS: ::c_int = 10; |
| 204 | +pub const SIG_SETMASK: ::c_int = 3; |
| 205 | +pub const SOCK_DGRAM: ::c_int = 1; |
| 206 | +pub const SOCK_STREAM: ::c_int = 2; |
| 207 | +pub const SOL_SOCKET: ::c_int = 0xffff; |
| 208 | +pub const SO_BROADCAST: ::c_int = 32; |
| 209 | +pub const SO_ERROR: ::c_int = 4103; |
| 210 | +pub const SO_RCVTIMEO: ::c_int = 4102; |
| 211 | +pub const SO_REUSEADDR: ::c_int = 4; |
| 212 | +pub const SO_SNDTIMEO: ::c_int = 4101; |
| 213 | + |
| 214 | +#[link(name = "util")] |
| 215 | +extern { |
| 216 | + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; |
| 217 | +} |
0 commit comments