]> git.proxmox.com Git - rustc.git/blame - src/liblibc/src/unix/solaris/mod.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / liblibc / src / unix / solaris / mod.rs
CommitLineData
7453a54e
SL
1pub type c_char = i8;
2pub type c_long = i64;
3pub type c_ulong = u64;
54a0048b 4pub type clockid_t = ::c_int;
7453a54e
SL
5
6pub type blkcnt_t = i64;
7pub type clock_t = i64;
8pub type daddr_t = i64;
9pub type dev_t = u64;
10pub type fsblkcnt_t = u64;
11pub type fsfilcnt_t = u64;
12pub type ino_t = i64;
13pub type key_t = i32;
14pub type major_t = u32;
15pub type minor_t = u32;
16pub type mode_t = u32;
17pub type nlink_t = u32;
18pub type rlim_t = u64;
19pub type speed_t = u32;
20pub type tcflag_t = u32;
21pub type time_t = i64;
22pub type wchar_t = i32;
23pub type nfds_t = ::c_ulong;
24
25pub type suseconds_t = ::c_long;
26pub type off_t = i64;
27pub type useconds_t = ::c_uint;
28pub type socklen_t = u32;
29pub type sa_family_t = u8;
30pub type pthread_t = ::uintptr_t;
31pub type pthread_key_t = ::c_uint;
32pub type blksize_t = u32;
33pub type fflags_t = u32;
34
35pub enum timezone {}
36
37s! {
38 pub struct sockaddr {
39 pub sa_family: sa_family_t,
40 pub sa_data: [::c_char; 14],
41 }
42
43 pub struct sockaddr_in {
44 pub sin_family: sa_family_t,
45 pub sin_port: ::in_port_t,
46 pub sin_addr: ::in_addr,
47 pub sin_zero: [::c_char; 8]
48 }
49
50 pub struct sockaddr_in6 {
51 pub sin6_family: sa_family_t,
52 pub sin6_port: ::in_port_t,
53 pub sin6_flowinfo: u32,
54 pub sin6_addr: ::in6_addr,
55 pub sin6_scope_id: u32,
56 pub __sin6_src_id: u32
57 }
58
59 pub struct sockaddr_un {
60 pub sun_family: sa_family_t,
61 pub sun_path: [c_char; 108]
62 }
63
64 pub struct passwd {
65 pub pw_name: *mut ::c_char,
66 pub pw_passwd: *mut ::c_char,
67 pub pw_uid: ::uid_t,
68 pub pw_gid: ::gid_t,
69 pub pw_age: *mut ::c_char,
70 pub pw_comment: *mut ::c_char,
71 pub pw_gecos: *mut ::c_char,
72 pub pw_dir: *mut ::c_char,
73 pub pw_shell: *mut ::c_char
74 }
75
76 pub struct ifaddrs {
77 pub ifa_next: *mut ifaddrs,
78 pub ifa_name: *mut ::c_char,
79 pub ifa_flags: ::c_ulong,
80 pub ifa_addr: *mut ::sockaddr,
81 pub ifa_netmask: *mut ::sockaddr,
82 pub ifa_dstaddr: *mut ::sockaddr,
83 pub ifa_data: *mut ::c_void
84 }
85
86 pub struct tm {
87 pub tm_sec: ::c_int,
88 pub tm_min: ::c_int,
89 pub tm_hour: ::c_int,
90 pub tm_mday: ::c_int,
91 pub tm_mon: ::c_int,
92 pub tm_year: ::c_int,
93 pub tm_wday: ::c_int,
94 pub tm_yday: ::c_int,
95 pub tm_isdst: ::c_int
96 }
97
98 pub struct utsname {
99 pub sysname: [::c_char; 257],
100 pub nodename: [::c_char; 257],
101 pub release: [::c_char; 257],
102 pub version: [::c_char; 257],
103 pub machine: [::c_char; 257],
104 }
105
106 pub struct msghdr {
107 pub msg_name: *mut ::c_void,
108 pub msg_namelen: ::socklen_t,
109 pub msg_iov: *mut ::iovec,
110 pub msg_iovlen: ::c_int,
111 pub msg_control: *mut ::c_void,
112 pub msg_controllen: ::socklen_t,
113 pub msg_flags: ::c_int,
114 }
115
116 pub struct fd_set {
117 fds_bits: [i32; FD_SETSIZE / 32],
118 }
119
120 pub struct pthread_attr_t {
121 __pthread_attrp: *mut ::c_void
122 }
123
124 pub struct pthread_mutex_t {
125 __pthread_mutex_flag1: u16,
126 __pthread_mutex_flag2: u8,
127 __pthread_mutex_ceiling: u8,
128 __pthread_mutex_type: u16,
129 __pthread_mutex_magic: u16,
130 __pthread_mutex_lock: u64,
131 __pthread_mutex_data: u64
132 }
133
134 pub struct pthread_mutexattr_t {
135 __pthread_mutexattrp: *mut ::c_void
136 }
137
138 pub struct pthread_cond_t {
139 __pthread_cond_flag: [u8; 4],
140 __pthread_cond_type: u16,
141 __pthread_cond_magic: u16,
142 __pthread_cond_data: u64
143 }
144
145 pub struct pthread_rwlock_t {
146 __pthread_rwlock_readers: i32,
147 __pthread_rwlock_type: u16,
148 __pthread_rwlock_magic: u16,
149 __pthread_rwlock_mutex: ::pthread_mutex_t,
150 __pthread_rwlock_readercv: ::pthread_cond_t,
151 __pthread_rwlock_writercv: ::pthread_cond_t
152 }
153
154 pub struct dirent {
155 pub d_ino: ::ino_t,
156 pub d_off: ::off_t,
157 pub d_reclen: u16,
158 pub d_name: [::c_char; 1]
159 }
160
161 pub struct glob_t {
162 pub gl_pathc: ::size_t,
163 pub gl_pathv: *mut *mut ::c_char,
164 pub gl_offs: ::size_t,
165 __unused1: *mut ::c_void,
166 __unused2: ::c_int,
167 __unused3: ::c_int,
168 __unused4: ::c_int,
169 __unused5: *mut ::c_void,
170 __unused6: *mut ::c_void,
171 __unused7: *mut ::c_void,
172 __unused8: *mut ::c_void,
173 __unused9: *mut ::c_void,
174 __unused10: *mut ::c_void,
175 }
176
177 pub struct sockaddr_storage {
178 pub ss_family: ::sa_family_t,
179 __ss_pad1: [u8; 6],
180 __ss_align: i64,
181 __ss_pad2: [u8; 240],
182 }
183
184 pub struct addrinfo {
185 pub ai_flags: ::c_int,
186 pub ai_family: ::c_int,
187 pub ai_socktype: ::c_int,
188 pub ai_protocol: ::c_int,
189 pub ai_addrlen: ::socklen_t,
190 pub ai_canonname: *mut ::c_char,
191 pub ai_addr: *mut ::sockaddr,
192 pub ai_next: *mut addrinfo,
193 }
194
195 pub struct sigset_t {
196 bits: [u32; 4],
197 }
198
199 pub struct siginfo_t {
200 pub si_signo: ::c_int,
201 pub si_code: ::c_int,
202 pub si_errno: ::c_int,
203 pub si_pad: ::c_int,
204 pub si_addr: *mut ::c_void,
205 __pad: [u8; 232],
206 }
207
208 pub struct sigaction {
209 pub sa_flags: ::c_int,
210 pub sa_sigaction: ::sighandler_t,
211 pub sa_mask: sigset_t,
212 }
213
214 pub struct stack_t {
215 pub ss_sp: *mut ::c_void,
216 pub ss_size: ::size_t,
217 pub ss_flags: ::c_int,
218 }
219
220 pub struct statvfs {
221 pub f_bsize: ::c_ulong,
222 pub f_frsize: ::c_ulong,
223 pub f_blocks: ::fsblkcnt_t,
224 pub f_bfree: ::fsblkcnt_t,
225 pub f_bavail: ::fsblkcnt_t,
226 pub f_files: ::fsfilcnt_t,
227 pub f_ffree: ::fsfilcnt_t,
228 pub f_favail: ::fsfilcnt_t,
229 pub f_fsid: ::c_ulong,
230 pub f_basetype: [::c_char; 16],
231 pub f_flag: ::c_ulong,
232 pub f_namemax: ::c_ulong,
233 pub f_fstr: [::c_char; 32]
234 }
235
236 pub struct sched_param {
237 pub sched_priority: ::c_int,
238 sched_pad: [::c_int; 8]
239 }
240
241 pub struct Dl_info {
242 pub dli_fname: *const ::c_char,
243 pub dli_fbase: *mut ::c_void,
244 pub dli_sname: *const ::c_char,
245 pub dli_saddr: *mut ::c_void,
246 }
247
248 pub struct stat {
249 pub st_dev: ::dev_t,
250 pub st_ino: ::ino_t,
251 pub st_mode: ::mode_t,
252 pub st_nlink: ::nlink_t,
253 pub st_uid: ::uid_t,
254 pub st_gid: ::gid_t,
255 pub st_rdev: ::dev_t,
256 pub st_size: ::off_t,
257 pub st_atime: ::time_t,
258 pub st_atime_nsec: ::c_long,
259 pub st_mtime: ::time_t,
260 pub st_mtime_nsec: ::c_long,
261 pub st_ctime: ::time_t,
262 pub st_ctime_nsec: ::c_long,
263 pub st_blksize: ::blksize_t,
264 pub st_blocks: ::blkcnt_t,
265 __unused: [::c_char; 16]
266 }
267
268 pub struct termios {
269 pub c_iflag: ::tcflag_t,
270 pub c_oflag: ::tcflag_t,
271 pub c_cflag: ::tcflag_t,
272 pub c_lflag: ::tcflag_t,
273 pub c_cc: [::cc_t; ::NCCS]
274 }
275}
276
277pub const SA_ONSTACK: ::c_int = 0x00000001;
278pub const SA_RESETHAND: ::c_int = 0x00000002;
279pub const SA_RESTART: ::c_int = 0x00000004;
280pub const SA_SIGINFO: ::c_int = 0x00000008;
281pub const SA_NODEFER: ::c_int = 0x00000010;
282pub const SA_NOCLDWAIT: ::c_int = 0x00010000;
283pub const SA_NOCLDSTOP: ::c_int = 0x00020000;
284
285pub const SS_ONSTACK: ::c_int = 1;
286pub const SS_DISABLE: ::c_int = 2;
287
288pub const FIONBIO: ::c_int = 0x8004667e;
289
290pub const SIGCHLD: ::c_int = 18;
291pub const SIGBUS: ::c_int = 10;
292pub const SIG_SETMASK: ::c_int = 3;
293
294pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
295pub const IPV6_V6ONLY: ::c_int = 0x27;
296
297pub const FD_SETSIZE: usize = 1024;
298
299pub const ST_RDONLY: ::c_ulong = 1;
300pub const ST_NOSUID: ::c_ulong = 2;
301
302pub const NI_MAXHOST: ::socklen_t = 1025;
303
304pub const EXIT_FAILURE: ::c_int = 1;
305pub const EXIT_SUCCESS: ::c_int = 0;
306pub const RAND_MAX: ::c_int = 32767;
307pub const EOF: ::c_int = -1;
308pub const SEEK_SET: ::c_int = 0;
309pub const SEEK_CUR: ::c_int = 1;
310pub const SEEK_END: ::c_int = 2;
311pub const _IOFBF: ::c_int = 0;
312pub const _IONBF: ::c_int = 4;
313pub const _IOLBF: ::c_int = 64;
314pub const BUFSIZ: ::c_uint = 1024;
315pub const FOPEN_MAX: ::c_uint = 20;
316pub const FILENAME_MAX: ::c_uint = 1024;
317pub const L_tmpnam: ::c_uint = 25;
318pub const TMP_MAX: ::c_uint = 17576;
319
320pub const O_RDONLY: ::c_int = 0;
321pub const O_WRONLY: ::c_int = 1;
322pub const O_RDWR: ::c_int = 2;
323pub const O_APPEND: ::c_int = 8;
324pub const O_CREAT: ::c_int = 256;
325pub const O_EXCL: ::c_int = 1024;
326pub const O_NOCTTY: ::c_int = 2048;
327pub const O_TRUNC: ::c_int = 512;
328pub const O_CLOEXEC: ::c_int = 0x800000;
329pub const O_ACCMODE: ::c_int = 0x600003;
330pub const S_IFIFO: mode_t = 4096;
331pub const S_IFCHR: mode_t = 8192;
332pub const S_IFBLK: mode_t = 24576;
333pub const S_IFDIR: mode_t = 16384;
334pub const S_IFREG: mode_t = 32768;
335pub const S_IFLNK: mode_t = 40960;
336pub const S_IFSOCK: mode_t = 49152;
337pub const S_IFMT: mode_t = 61440;
338pub const S_IEXEC: mode_t = 64;
339pub const S_IWRITE: mode_t = 128;
340pub const S_IREAD: mode_t = 256;
341pub const S_IRWXU: mode_t = 448;
342pub const S_IXUSR: mode_t = 64;
343pub const S_IWUSR: mode_t = 128;
344pub const S_IRUSR: mode_t = 256;
345pub const S_IRWXG: mode_t = 56;
346pub const S_IXGRP: mode_t = 8;
347pub const S_IWGRP: mode_t = 16;
348pub const S_IRGRP: mode_t = 32;
349pub const S_IRWXO: mode_t = 7;
350pub const S_IXOTH: mode_t = 1;
351pub const S_IWOTH: mode_t = 2;
352pub const S_IROTH: mode_t = 4;
353pub const F_OK: ::c_int = 0;
354pub const R_OK: ::c_int = 4;
355pub const W_OK: ::c_int = 2;
356pub const X_OK: ::c_int = 1;
357pub const STDIN_FILENO: ::c_int = 0;
358pub const STDOUT_FILENO: ::c_int = 1;
359pub const STDERR_FILENO: ::c_int = 2;
360pub const F_LOCK: ::c_int = 1;
361pub const F_TEST: ::c_int = 3;
362pub const F_TLOCK: ::c_int = 2;
363pub const F_ULOCK: ::c_int = 0;
364pub const F_DUPFD_CLOEXEC: ::c_int = 37;
365pub const SIGHUP: ::c_int = 1;
366pub const SIGINT: ::c_int = 2;
367pub const SIGQUIT: ::c_int = 3;
368pub const SIGILL: ::c_int = 4;
369pub const SIGABRT: ::c_int = 6;
370pub const SIGFPE: ::c_int = 8;
371pub const SIGKILL: ::c_int = 9;
372pub const SIGSEGV: ::c_int = 11;
373pub const SIGPIPE: ::c_int = 13;
374pub const SIGALRM: ::c_int = 14;
375pub const SIGTERM: ::c_int = 15;
376
377pub const WNOHANG: ::c_int = 0x40;
378
379pub const PROT_NONE: ::c_int = 0;
380pub const PROT_READ: ::c_int = 1;
381pub const PROT_WRITE: ::c_int = 2;
382pub const PROT_EXEC: ::c_int = 4;
383
384pub const MAP_SHARED: ::c_int = 0x0001;
385pub const MAP_PRIVATE: ::c_int = 0x0002;
386pub const MAP_FIXED: ::c_int = 0x0010;
387pub const MAP_ANON: ::c_int = 0x0100;
388
389pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
390
391pub const MCL_CURRENT: ::c_int = 0x0001;
392pub const MCL_FUTURE: ::c_int = 0x0002;
393
394pub const MS_SYNC: ::c_int = 0x0004;
395pub const MS_ASYNC: ::c_int = 0x0001;
396pub const MS_INVALIDATE: ::c_int = 0x0002;
397
398pub const EPERM: ::c_int = 1;
399pub const ENOENT: ::c_int = 2;
400pub const ESRCH: ::c_int = 3;
401pub const EINTR: ::c_int = 4;
402pub const EIO: ::c_int = 5;
403pub const ENXIO: ::c_int = 6;
404pub const E2BIG: ::c_int = 7;
405pub const ENOEXEC: ::c_int = 8;
406pub const EBADF: ::c_int = 9;
407pub const ECHILD: ::c_int = 10;
408pub const EDEADLK: ::c_int = 45;
409pub const ENOMEM: ::c_int = 12;
410pub const EACCES: ::c_int = 13;
411pub const EFAULT: ::c_int = 14;
412pub const ENOTBLK: ::c_int = 15;
413pub const EBUSY: ::c_int = 16;
414pub const EEXIST: ::c_int = 17;
415pub const EXDEV: ::c_int = 18;
416pub const ENODEV: ::c_int = 19;
417pub const ENOTDIR: ::c_int = 20;
418pub const EISDIR: ::c_int = 21;
419pub const EINVAL: ::c_int = 22;
420pub const ENFILE: ::c_int = 23;
421pub const EMFILE: ::c_int = 24;
422pub const ENOTTY: ::c_int = 25;
423pub const ETXTBSY: ::c_int = 26;
424pub const EFBIG: ::c_int = 27;
425pub const ENOSPC: ::c_int = 28;
426pub const ESPIPE: ::c_int = 29;
427pub const EROFS: ::c_int = 30;
428pub const EMLINK: ::c_int = 31;
429pub const EPIPE: ::c_int = 32;
430pub const EDOM: ::c_int = 33;
431pub const ERANGE: ::c_int = 34;
432pub const EAGAIN: ::c_int = 11;
433pub const EWOULDBLOCK: ::c_int = 11;
434pub const EINPROGRESS: ::c_int = 150;
435pub const EALREADY: ::c_int = 149;
436pub const ENOTSOCK: ::c_int = 95;
437pub const EDESTADDRREQ: ::c_int = 96;
438pub const EMSGSIZE: ::c_int = 97;
439pub const EPROTOTYPE: ::c_int = 98;
440pub const ENOPROTOOPT: ::c_int = 99;
441pub const EPROTONOSUPPORT: ::c_int = 120;
442pub const ESOCKTNOSUPPORT: ::c_int = 121;
443pub const EOPNOTSUPP: ::c_int = 122;
444pub const EPFNOSUPPORT: ::c_int = 123;
445pub const EAFNOSUPPORT: ::c_int = 124;
446pub const EADDRINUSE: ::c_int = 125;
447pub const EADDRNOTAVAIL: ::c_int = 126;
448pub const ENETDOWN: ::c_int = 127;
449pub const ENETUNREACH: ::c_int = 128;
450pub const ENETRESET: ::c_int = 129;
451pub const ECONNABORTED: ::c_int = 130;
452pub const ECONNRESET: ::c_int = 131;
453pub const ENOBUFS: ::c_int = 132;
454pub const EISCONN: ::c_int = 133;
455pub const ENOTCONN: ::c_int = 134;
456pub const ESHUTDOWN: ::c_int = 143;
457pub const ETOOMANYREFS: ::c_int = 144;
458pub const ETIMEDOUT: ::c_int = 145;
459pub const ECONNREFUSED: ::c_int = 146;
460pub const ELOOP: ::c_int = 90;
461pub const ENAMETOOLONG: ::c_int = 78;
462pub const EHOSTDOWN: ::c_int = 147;
463pub const EHOSTUNREACH: ::c_int = 148;
464pub const ENOTEMPTY: ::c_int = 93;
465pub const EUSERS: ::c_int = 94;
466pub const EDQUOT: ::c_int = 49;
467pub const ESTALE: ::c_int = 151;
468pub const EREMOTE: ::c_int = 66;
469pub const ENOLCK: ::c_int = 46;
470pub const ENOSYS: ::c_int = 89;
471pub const EIDRM: ::c_int = 36;
472pub const ENOMSG: ::c_int = 35;
473pub const EOVERFLOW: ::c_int = 79;
474pub const ECANCELED: ::c_int = 47;
475pub const EILSEQ: ::c_int = 88;
476pub const EBADMSG: ::c_int = 77;
477pub const EMULTIHOP: ::c_int = 74;
478pub const ENOLINK: ::c_int = 67;
479pub const EPROTO: ::c_int = 71;
480
481pub const F_DUPFD: ::c_int = 0;
482pub const F_GETFD: ::c_int = 1;
483pub const F_SETFD: ::c_int = 2;
484pub const F_GETFL: ::c_int = 3;
485pub const F_SETFL: ::c_int = 4;
486
487pub const SIGTRAP: ::c_int = 5;
488
489pub const GLOB_APPEND : ::c_int = 32;
490pub const GLOB_DOOFFS : ::c_int = 16;
491pub const GLOB_ERR : ::c_int = 1;
492pub const GLOB_MARK : ::c_int = 2;
493pub const GLOB_NOCHECK : ::c_int = 8;
494pub const GLOB_NOSORT : ::c_int = 4;
495pub const GLOB_NOESCAPE: ::c_int = 64;
496
497pub const GLOB_NOSPACE : ::c_int = -2;
498pub const GLOB_ABORTED : ::c_int = -1;
499pub const GLOB_NOMATCH : ::c_int = -3;
500
501pub const POSIX_MADV_NORMAL: ::c_int = 0;
502pub const POSIX_MADV_RANDOM: ::c_int = 1;
503pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
504pub const POSIX_MADV_WILLNEED: ::c_int = 3;
505pub const POSIX_MADV_DONTNEED: ::c_int = 4;
506
507pub const _SC_IOV_MAX: ::c_int = 77;
508pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
509pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
510pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
511pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
512pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
513pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
514pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
515pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
516pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
517pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
518pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
519pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
520pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
521pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
522pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
523pub const _SC_THREADS: ::c_int = 576;
524pub const _SC_TTY_NAME_MAX: ::c_int = 575;
525pub const _SC_ATEXIT_MAX: ::c_int = 76;
526pub const _SC_XOPEN_CRYPT: ::c_int = 62;
527pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
528pub const _SC_XOPEN_LEGACY: ::c_int = 717;
529pub const _SC_XOPEN_REALTIME: ::c_int = 718;
530pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
531pub const _SC_XOPEN_SHM: ::c_int = 64;
532pub const _SC_XOPEN_UNIX: ::c_int = 78;
533pub const _SC_XOPEN_VERSION: ::c_int = 12;
534pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
535
536pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
537pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40;
538pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
539pub const PTHREAD_PROCESS_PRIVATE: u16 = 0;
540pub const PTHREAD_STACK_MIN: ::size_t = 4096;
541
542pub const SIGSTKSZ: ::size_t = 8192;
543
54a0048b
SL
544// https://illumos.org/man/3c/clock_gettime
545// https://github.com/illumos/illumos-gate/
546// blob/HEAD/usr/src/lib/libc/amd64/sys/__clock_gettime.s
547// clock_gettime(3c) doesn't seem to accept anything other than CLOCK_REALTIME
548// or __CLOCK_REALTIME0
549//
550// https://github.com/illumos/illumos-gate/
551// blob/HEAD/usr/src/uts/common/sys/time_impl.h
552// Confusing! CLOCK_HIGHRES==CLOCK_MONOTONIC==4
553// __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3
554pub const CLOCK_REALTIME: clockid_t = 3;
555pub const CLOCK_MONOTONIC: clockid_t = 4;
7453a54e
SL
556
557pub const RLIMIT_CPU: ::c_int = 0;
558pub const RLIMIT_FSIZE: ::c_int = 1;
559pub const RLIMIT_DATA: ::c_int = 2;
560pub const RLIMIT_STACK: ::c_int = 3;
561pub const RLIMIT_CORE: ::c_int = 4;
562pub const RLIMIT_NOFILE: ::c_int = 5;
563pub const RLIMIT_VMEM: ::c_int = 6;
564pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
565
566pub const RLIM_NLIMITS: rlim_t = 7;
567pub const RLIM_INFINITY: rlim_t = 0x7fffffff;
568
569pub const RUSAGE_SELF: ::c_int = 0;
570pub const RUSAGE_CHILDREN: ::c_int = -1;
571
572pub const MADV_NORMAL: ::c_int = 0;
573pub const MADV_RANDOM: ::c_int = 1;
574pub const MADV_SEQUENTIAL: ::c_int = 2;
575pub const MADV_WILLNEED: ::c_int = 3;
576pub const MADV_DONTNEED: ::c_int = 4;
577pub const MADV_FREE: ::c_int = 5;
578
579pub const AF_INET: ::c_int = 2;
580pub const AF_INET6: ::c_int = 26;
581pub const AF_UNIX: ::c_int = 1;
582pub const SOCK_DGRAM: ::c_int = 1;
583pub const SOCK_STREAM: ::c_int = 2;
584pub const SOCK_RAW: ::c_int = 4;
585pub const IPPROTO_TCP: ::c_int = 6;
586pub const IPPROTO_IP: ::c_int = 0;
587pub const IPPROTO_IPV6: ::c_int = 41;
588pub const IP_MULTICAST_TTL: ::c_int = 17;
589pub const IP_MULTICAST_LOOP: ::c_int = 18;
590pub const IP_TTL: ::c_int = 4;
591pub const IP_HDRINCL: ::c_int = 2;
592pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
593pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
594pub const IPV6_JOIN_GROUP: ::c_int = 9;
595pub const IPV6_LEAVE_GROUP: ::c_int = 10;
596
597pub const TCP_NODELAY: ::c_int = 1;
598pub const TCP_KEEPIDLE: ::c_int = 34;
599pub const SOL_SOCKET: ::c_int = 0xffff;
600pub const SO_DEBUG: ::c_int = 0x01;
601pub const SO_ACCEPTCONN: ::c_int = 0x0002;
602pub const SO_REUSEADDR: ::c_int = 0x0004;
603pub const SO_KEEPALIVE: ::c_int = 0x0008;
604pub const SO_DONTROUTE: ::c_int = 0x0010;
605pub const SO_BROADCAST: ::c_int = 0x0020;
606pub const SO_USELOOPBACK: ::c_int = 0x0040;
607pub const SO_LINGER: ::c_int = 0x0080;
608pub const SO_OOBINLINE: ::c_int = 0x0100;
609pub const SO_SNDBUF: ::c_int = 0x1001;
610pub const SO_RCVBUF: ::c_int = 0x1002;
611pub const SO_SNDLOWAT: ::c_int = 0x1003;
612pub const SO_RCVLOWAT: ::c_int = 0x1004;
613pub const SO_SNDTIMEO: ::c_int = 0x1005;
614pub const SO_RCVTIMEO: ::c_int = 0x1006;
615pub const SO_ERROR: ::c_int = 0x1007;
616pub const SO_TYPE: ::c_int = 0x1008;
617
618pub const IFF_LOOPBACK: ::c_int = 0x8;
619
620pub const SHUT_RD: ::c_int = 0;
621pub const SHUT_WR: ::c_int = 1;
622pub const SHUT_RDWR: ::c_int = 2;
623
624pub const LOCK_SH: ::c_int = 1;
625pub const LOCK_EX: ::c_int = 2;
626pub const LOCK_NB: ::c_int = 4;
627pub const LOCK_UN: ::c_int = 8;
628
629pub const O_SYNC: ::c_int = 16;
630pub const O_NONBLOCK: ::c_int = 128;
631
632pub const IPPROTO_RAW: ::c_int = 255;
633
634pub const _SC_ARG_MAX: ::c_int = 1;
635pub const _SC_CHILD_MAX: ::c_int = 2;
636pub const _SC_CLK_TCK: ::c_int = 3;
637pub const _SC_NGROUPS_MAX: ::c_int = 4;
638pub const _SC_OPEN_MAX: ::c_int = 5;
639pub const _SC_JOB_CONTROL: ::c_int = 6;
640pub const _SC_SAVED_IDS: ::c_int = 7;
641pub const _SC_VERSION: ::c_int = 8;
642pub const _SC_PAGESIZE: ::c_int = 11;
643pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
644pub const _SC_NPROCESSORS_ONLN: ::c_int = 15;
645pub const _SC_STREAM_MAX: ::c_int = 16;
646pub const _SC_TZNAME_MAX: ::c_int = 17;
647pub const _SC_AIO_LISTIO_MAX: ::c_int = 18;
648pub const _SC_AIO_MAX: ::c_int = 19;
649pub const _SC_BC_BASE_MAX: ::c_int = 54;
650pub const _SC_BC_DIM_MAX: ::c_int = 55;
651pub const _SC_BC_SCALE_MAX: ::c_int = 56;
652pub const _SC_BC_STRING_MAX: ::c_int = 57;
653pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58;
654pub const _SC_EXPR_NEST_MAX: ::c_int = 59;
655pub const _SC_LINE_MAX: ::c_int = 60;
656pub const _SC_RE_DUP_MAX: ::c_int = 61;
657pub const _SC_2_VERSION: ::c_int = 53;
658pub const _SC_2_C_BIND: ::c_int = 45;
659pub const _SC_2_C_DEV: ::c_int = 46;
660pub const _SC_2_CHAR_TERM: ::c_int = 66;
661pub const _SC_2_FORT_DEV: ::c_int = 48;
662pub const _SC_2_FORT_RUN: ::c_int = 49;
663pub const _SC_2_LOCALEDEF: ::c_int = 50;
664pub const _SC_2_SW_DEV: ::c_int = 51;
665pub const _SC_2_UPE: ::c_int = 52;
666pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
667pub const _SC_MAPPED_FILES: ::c_int = 24;
668pub const _SC_MEMLOCK: ::c_int = 25;
669pub const _SC_MEMLOCK_RANGE: ::c_int = 26;
670pub const _SC_MEMORY_PROTECTION: ::c_int = 27;
671pub const _SC_MESSAGE_PASSING: ::c_int = 28;
672pub const _SC_PRIORITIZED_IO: ::c_int = 31;
673pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32;
674pub const _SC_REALTIME_SIGNALS: ::c_int = 33;
675pub const _SC_SEMAPHORES: ::c_int = 35;
676pub const _SC_FSYNC: ::c_int = 23;
677pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
678pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
679pub const _SC_TIMERS: ::c_int = 43;
680pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
681pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
682pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
683pub const _SC_RTSIG_MAX: ::c_int = 34;
684pub const _SC_SEM_NSEMS_MAX: ::c_int = 36;
685pub const _SC_SEM_VALUE_MAX: ::c_int = 37;
686pub const _SC_SIGQUEUE_MAX: ::c_int = 39;
687pub const _SC_TIMER_MAX: ::c_int = 44;
688
689pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX
690pub const _COND_MAGIC: u16 = 0x4356; // CV
691pub const _RWL_MAGIC: u16 = 0x5257; // RW
692
693pub const NCCS: usize = 19;
694
695pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
696 __pthread_mutex_flag1: 0,
697 __pthread_mutex_flag2: 0,
698 __pthread_mutex_ceiling: 0,
699 __pthread_mutex_type: PTHREAD_PROCESS_PRIVATE,
700 __pthread_mutex_magic: _MUTEX_MAGIC,
701 __pthread_mutex_lock: 0,
702 __pthread_mutex_data: 0
703};
704pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
705 __pthread_cond_flag: [0; 4],
706 __pthread_cond_type: PTHREAD_PROCESS_PRIVATE,
707 __pthread_cond_magic: _COND_MAGIC,
708 __pthread_cond_data: 0
709};
710pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
711 __pthread_rwlock_readers: 0,
712 __pthread_rwlock_type: PTHREAD_PROCESS_PRIVATE,
713 __pthread_rwlock_magic: _RWL_MAGIC,
714 __pthread_rwlock_mutex: PTHREAD_MUTEX_INITIALIZER,
715 __pthread_rwlock_readercv: PTHREAD_COND_INITIALIZER,
716 __pthread_rwlock_writercv: PTHREAD_COND_INITIALIZER
717};
718pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 4;
719
720f! {
721 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
722 let fd = fd as usize;
723 (*set).fds_bits[fd / 32] &= !(1 << (fd % 32));
724 return
725 }
726
727 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
728 let fd = fd as usize;
729 return ((*set).fds_bits[fd / 32] & (1 << (fd % 32))) != 0
730 }
731
732 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
733 let fd = fd as usize;
734 (*set).fds_bits[fd / 32] |= 1 << (fd % 32);
735 return
736 }
737
738 pub fn FD_ZERO(set: *mut fd_set) -> () {
739 for slot in (*set).fds_bits.iter_mut() {
740 *slot = 0;
741 }
742 }
743
744 pub fn WIFEXITED(status: ::c_int) -> bool {
745 (status & 0xFF) == 0
746 }
747
748 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
749 (status >> 8) & 0xFF
750 }
751
752 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
753 status & 0x7F
754 }
755}
756
757extern {
758 pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int;
759 pub fn mincore(addr: *const ::c_void, len: ::size_t,
760 vec: *mut c_char) -> ::c_int;
761 pub fn setgroups(ngroups: ::c_int,
762 ptr: *const ::gid_t) -> ::c_int;
763 pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int;
764 pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
765 -> ::c_int;
54a0048b
SL
766 pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
767 pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
7453a54e
SL
768 pub fn getnameinfo(sa: *const ::sockaddr,
769 salen: ::socklen_t,
770 host: *mut ::c_char,
771 hostlen: ::socklen_t,
772 serv: *mut ::c_char,
773 sevlen: ::socklen_t,
774 flags: ::c_int) -> ::c_int;
775 pub fn getpwuid_r(uid: ::uid_t,
776 pwd: *mut passwd,
777 buf: *mut ::c_char,
778 buflen: ::size_t) -> *const passwd;
779 pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;
54a0048b 780 pub fn fdatasync(fd: ::c_int) -> ::c_int;
7453a54e
SL
781}
782