|
| 1 | +pub type blkcnt_t = i64; |
| 2 | +pub type blksize_t = i64; |
| 3 | +pub type c_char = u8; |
| 4 | +pub type c_long = i64; |
| 5 | +pub type c_ulong = u64; |
| 6 | +pub type fsblkcnt_t = u64; |
| 7 | +pub type fsfilcnt_t = u64; |
| 8 | +pub type ino_t = u64; |
| 9 | +pub type nlink_t = u64; |
| 10 | +pub type off_t = i64; |
| 11 | +pub type rlim_t = u64; |
| 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: ::dev_t, |
| 19 | + pub st_ino: ::ino_t, |
| 20 | + pub st_nlink: ::nlink_t, |
| 21 | + pub st_mode: ::mode_t, |
| 22 | + pub st_uid: ::uid_t, |
| 23 | + pub st_gid: ::gid_t, |
| 24 | + st_pad0: ::c_int, |
| 25 | + pub st_rdev: ::dev_t, |
| 26 | + pub st_size: ::off_t, |
| 27 | + pub st_atime: ::time_t, |
| 28 | + pub st_atime_nsec: ::c_long, |
| 29 | + pub st_mtime: ::time_t, |
| 30 | + pub st_mtime_nsec: ::c_long, |
| 31 | + pub st_ctime: ::time_t, |
| 32 | + pub st_ctime_nsec: ::c_long, |
| 33 | + pub st_blksize: ::blksize_t, |
| 34 | + pub st_blocks: ::blkcnt_t, |
| 35 | + __glibc_reserved: [::c_int; 5], |
| 36 | + } |
| 37 | + |
| 38 | + pub struct stat64 { |
| 39 | + pub st_dev: ::dev_t, |
| 40 | + pub st_ino: ::ino_t, |
| 41 | + pub st_nlink: ::nlink_t, |
| 42 | + pub st_mode: ::mode_t, |
| 43 | + pub st_uid: ::uid_t, |
| 44 | + pub st_gid: ::gid_t, |
| 45 | + st_pad0: ::c_int, |
| 46 | + pub st_rdev: ::dev_t, |
| 47 | + pub st_size: ::off_t, |
| 48 | + pub st_atime: ::time_t, |
| 49 | + pub st_atime_nsec: ::c_long, |
| 50 | + pub st_mtime: ::time_t, |
| 51 | + pub st_mtime_nsec: ::c_long, |
| 52 | + pub st_ctime: ::time_t, |
| 53 | + pub st_ctime_nsec: ::c_long, |
| 54 | + pub st_blksize: ::blksize_t, |
| 55 | + pub st_blocks: ::blkcnt_t, |
| 56 | + __glibc_reserved: [::c_int; 5], |
| 57 | + } |
| 58 | + |
| 59 | + pub struct pthread_attr_t { |
| 60 | + __size: [::c_ulong; 7] |
| 61 | + } |
| 62 | + |
| 63 | + pub struct sigaction { |
| 64 | + pub sa_sigaction: ::sighandler_t, |
| 65 | + pub sa_flags: ::c_ulong, |
| 66 | + _restorer: *mut ::c_void, |
| 67 | + pub sa_mask: sigset_t, |
| 68 | + } |
| 69 | + |
| 70 | + pub struct stack_t { |
| 71 | + pub ss_sp: *mut ::c_void, |
| 72 | + pub ss_flags: ::c_int, |
| 73 | + pub ss_size: ::size_t, |
| 74 | + } |
| 75 | + |
| 76 | + pub struct sigset_t { |
| 77 | + __size: [::c_ulong; 16], |
| 78 | + } |
| 79 | + |
| 80 | + pub struct siginfo_t { |
| 81 | + pub si_signo: ::c_int, |
| 82 | + pub si_errno: ::c_int, |
| 83 | + pub si_code: ::c_int, |
| 84 | + _pad: ::c_int, |
| 85 | + _pad2: [::c_long; 14], |
| 86 | + } |
| 87 | + |
| 88 | + pub struct ipc_perm { |
| 89 | + pub __key: ::key_t, |
| 90 | + pub uid: ::uid_t, |
| 91 | + pub gid: ::gid_t, |
| 92 | + pub cuid: ::uid_t, |
| 93 | + pub cgid: ::gid_t, |
| 94 | + pub mode: ::c_uint, |
| 95 | + pub __seq: ::c_ushort, |
| 96 | + __pad1: ::c_ushort, |
| 97 | + __unused1: ::c_ulong, |
| 98 | + __unused2: ::c_ulong |
| 99 | + } |
| 100 | + |
| 101 | + pub struct shmid_ds { |
| 102 | + pub shm_perm: ::ipc_perm, |
| 103 | + pub shm_segsz: ::size_t, |
| 104 | + pub shm_atime: ::time_t, |
| 105 | + pub shm_dtime: ::time_t, |
| 106 | + pub shm_ctime: ::time_t, |
| 107 | + pub shm_cpid: ::pid_t, |
| 108 | + pub shm_lpid: ::pid_t, |
| 109 | + pub shm_nattch: ::shmatt_t, |
| 110 | + __unused4: ::c_ulong, |
| 111 | + __unused5: ::c_ulong |
| 112 | + } |
| 113 | + |
| 114 | + pub struct statfs { |
| 115 | + pub f_type: ::c_uint, |
| 116 | + pub f_bsize: ::c_uint, |
| 117 | + pub f_blocks: ::fsblkcnt_t, |
| 118 | + pub f_bfree: ::fsblkcnt_t, |
| 119 | + pub f_bavail: ::fsblkcnt_t, |
| 120 | + pub f_files: ::fsblkcnt_t, |
| 121 | + pub f_ffree: ::fsblkcnt_t, |
| 122 | + pub f_fsid: ::fsid_t, |
| 123 | + pub f_namelen: ::c_uint, |
| 124 | + pub f_frsize: ::c_uint, |
| 125 | + pub f_flags: ::c_uint, |
| 126 | + f_spare: [::c_uint; 4], |
| 127 | + } |
| 128 | + |
| 129 | + pub struct msghdr { |
| 130 | + pub msg_name: *mut ::c_void, |
| 131 | + pub msg_namelen: ::socklen_t, |
| 132 | + pub msg_iov: *mut ::iovec, |
| 133 | + pub msg_iovlen: ::size_t, |
| 134 | + pub msg_control: *mut ::c_void, |
| 135 | + pub msg_controllen: ::size_t, |
| 136 | + pub msg_flags: ::c_int, |
| 137 | + } |
| 138 | + |
| 139 | + pub struct termios { |
| 140 | + pub c_iflag: ::tcflag_t, |
| 141 | + pub c_oflag: ::tcflag_t, |
| 142 | + pub c_cflag: ::tcflag_t, |
| 143 | + pub c_lflag: ::tcflag_t, |
| 144 | + pub c_line: ::cc_t, |
| 145 | + pub c_cc: [::cc_t; ::NCCS], |
| 146 | + pub c_ispeed: ::speed_t, |
| 147 | + pub c_ospeed: ::speed_t, |
| 148 | + } |
| 149 | + |
| 150 | + pub struct sysinfo { |
| 151 | + pub uptime: ::c_long, |
| 152 | + pub loads: [::c_ulong; 3], |
| 153 | + pub totalram: ::c_ulong, |
| 154 | + pub freeram: ::c_ulong, |
| 155 | + pub sharedram: ::c_ulong, |
| 156 | + pub bufferram: ::c_ulong, |
| 157 | + pub totalswap: ::c_ulong, |
| 158 | + pub freeswap: ::c_ulong, |
| 159 | + pub procs: ::c_ushort, |
| 160 | + pub pad: ::c_ushort, |
| 161 | + pub totalhigh: ::c_ulong, |
| 162 | + pub freehigh: ::c_ulong, |
| 163 | + pub mem_unit: ::c_uint, |
| 164 | + pub _f: [::c_char; 0], |
| 165 | + } |
| 166 | + |
| 167 | + // FIXME this is actually a union |
| 168 | + pub struct sem_t { |
| 169 | + __size: [::c_char; 32], |
| 170 | + __align: [::c_long; 0], |
| 171 | + } |
| 172 | +} |
| 173 | + |
| 174 | +pub const POSIX_FADV_DONTNEED: ::c_int = 6; |
| 175 | +pub const POSIX_FADV_NOREUSE: ::c_int = 7; |
| 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 = 98; |
| 183 | +pub const EADDRNOTAVAIL: ::c_int = 99; |
| 184 | +pub const ECONNABORTED: ::c_int = 103; |
| 185 | +pub const ECONNREFUSED: ::c_int = 111; |
| 186 | +pub const ECONNRESET: ::c_int = 104; |
| 187 | +pub const EDEADLK: ::c_int = 35; |
| 188 | +pub const ENOSYS: ::c_int = 38; |
| 189 | +pub const ENOTCONN: ::c_int = 107; |
| 190 | +pub const ETIMEDOUT: ::c_int = 110; |
| 191 | +pub const FIOCLEX: ::c_ulong = 0x5451; |
| 192 | +pub const FIONBIO: ::c_ulong = 0x5421; |
| 193 | +pub const MAP_ANON: ::c_int = 0x20; |
| 194 | +pub const O_ACCMODE: ::c_int = 3; |
| 195 | +pub const O_APPEND: ::c_int = 1024; |
| 196 | +pub const O_CREAT: ::c_int = 64; |
| 197 | +pub const O_EXCL: ::c_int = 128; |
| 198 | +pub const O_NONBLOCK: ::c_int = 2048; |
| 199 | +pub const PTHREAD_STACK_MIN: ::size_t = 16384; |
| 200 | +pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff; |
| 201 | +pub const SA_ONSTACK: ::c_ulong = 0x08000000; |
| 202 | +pub const SA_SIGINFO: ::c_ulong = 4; |
| 203 | +pub const SIGBUS: ::c_int = 7; |
| 204 | +pub const SIGSTKSZ: ::size_t = 0x2000; |
| 205 | +pub const SIG_SETMASK: ::c_int = 2; |
| 206 | +pub const SOCK_DGRAM: ::c_int = 2; |
| 207 | +pub const SOCK_STREAM: ::c_int = 1; |
| 208 | +pub const SOL_SOCKET: ::c_int = 1; |
| 209 | +pub const SO_BROADCAST: ::c_int = 6; |
| 210 | +pub const SO_ERROR: ::c_int = 4; |
| 211 | +pub const SO_RCVTIMEO: ::c_int = 20; |
| 212 | +pub const SO_REUSEADDR: ::c_int = 2; |
| 213 | +pub const SO_SNDTIMEO: ::c_int = 21; |
| 214 | + |
| 215 | +#[link(name = "util")] |
| 216 | +extern { |
| 217 | + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; |
| 218 | +} |
0 commit comments