Debian Codegraph @

debian/missing-sources/libc/src/unix/newlib/rtems/mod.rs

raw
1 // defined in architecture specific module
2
3 use crate::prelude::*;
4
5 s! {
6 pub struct sockaddr_un {
7 pub sun_family: crate::sa_family_t,
8 pub sun_path: [c_char; 108usize],
9 }
10 }
11
12 pub const AF_UNIX: c_int = 1;
13
14 pub const RTLD_DEFAULT: *mut c_void = -2isize as *mut c_void;
15
16 pub const UTIME_OMIT: c_long = -1;
17 pub const AT_FDCWD: c_int = -2;
18
19 pub const O_DIRECTORY: c_int = 0x200000;
20 pub const O_NOFOLLOW: c_int = 0x100000;
21
22 pub const AT_EACCESS: c_int = 1;
23 pub const AT_SYMLINK_NOFOLLOW: c_int = 2;
24 pub const AT_SYMLINK_FOLLOW: c_int = 4;
25 pub const AT_REMOVEDIR: c_int = 8;
26
27 // signal.h
28 pub const SIG_BLOCK: c_int = 1;
29 pub const SIG_UNBLOCK: c_int = 2;
30 pub const SIG_SETMASK: c_int = 0;
31 pub const SIGHUP: c_int = 1;
32 pub const SIGINT: c_int = 2;
33 pub const SIGQUIT: c_int = 3;
34 pub const SIGILL: c_int = 4;
35 pub const SIGTRAP: c_int = 5;
36 pub const SIGABRT: c_int = 6;
37 pub const SIGEMT: c_int = 7;
38 pub const SIGFPE: c_int = 8;
39 pub const SIGKILL: c_int = 9;
40 pub const SIGBUS: c_int = 10;
41 pub const SIGSEGV: c_int = 11;
42 pub const SIGSYS: c_int = 12;
43 pub const SIGPIPE: c_int = 13;
44 pub const SIGALRM: c_int = 14;
45 pub const SIGTERM: c_int = 15;
46 pub const SIGURG: c_int = 16;
47 pub const SIGSTOP: c_int = 17;
48 pub const SIGTSTP: c_int = 18;
49 pub const SIGCONT: c_int = 19;
50 pub const SIGCHLD: c_int = 20;
51 pub const SIGCLD: c_int = 20;
52 pub const SIGTTIN: c_int = 21;
53 pub const SIGTTOU: c_int = 22;
54 pub const SIGIO: c_int = 23;
55 pub const SIGWINCH: c_int = 24;
56 pub const SIGUSR1: c_int = 25;
57 pub const SIGUSR2: c_int = 26;
58 pub const SIGRTMIN: c_int = 27;
59 pub const SIGRTMAX: c_int = 31;
60 pub const SIGXCPU: c_int = 24;
61 pub const SIGXFSZ: c_int = 25;
62 pub const SIGVTALRM: c_int = 26;
63 pub const SIGPROF: c_int = 27;
64
65 pub const SA_NOCLDSTOP: c_ulong = 0x00000001;
66 pub const SA_SIGINFO: c_ulong = 0x00000002;
67 pub const SA_ONSTACK: c_ulong = 0x00000004;
68
69 pub const EAI_AGAIN: c_int = 2;
70 pub const EAI_BADFLAGS: c_int = 3;
71 pub const EAI_FAIL: c_int = 4;
72 pub const EAI_SERVICE: c_int = 9;
73 pub const EAI_SYSTEM: c_int = 11;
74 pub const EAI_OVERFLOW: c_int = 14;
75
76 pub const PTHREAD_STACK_MIN: size_t = 0;
77
78 // sys/wait.h
79 pub const WNOHANG: c_int = 1;
80 pub const WUNTRACED: c_int = 2;
81
82 // sys/socket.h
83 pub const SOMAXCONN: c_int = 128;
84
85 safe_f! {
86 pub const fn WIFSTOPPED(status: c_int) -> bool {
87 (status & 0xff) == 0x7f
88 }
89
90 pub const fn WSTOPSIG(status: c_int) -> c_int {
91 // (status >> 8) & 0xff
92 WEXITSTATUS(status)
93 }
94
95 pub const fn WIFSIGNALED(status: c_int) -> bool {
96 ((status & 0x7f) > 0) && ((status & 0x7f) < 0x7f)
97 }
98
99 pub const fn WTERMSIG(status: c_int) -> c_int {
100 status & 0x7f
101 }
102
103 pub const fn WIFEXITED(status: c_int) -> bool {
104 (status & 0xff) == 0
105 }
106
107 pub const fn WEXITSTATUS(status: c_int) -> c_int {
108 (status >> 8) & 0xff
109 }
110
111 // RTEMS doesn't have native WIFCONTINUED.
112 pub const fn WIFCONTINUED(_status: c_int) -> bool {
113 true
114 }
115
116 // RTEMS doesn't have native WCOREDUMP.
117 pub const fn WCOREDUMP(_status: c_int) -> bool {
118 false
119 }
120 }
121
122 extern "C" {
123 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
124 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
125 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
126
127 pub fn pthread_create(
128 native: *mut crate::pthread_t,
129 attr: *const crate::pthread_attr_t,
130 f: extern "C" fn(_: *mut c_void) -> *mut c_void,
131 value: *mut c_void,
132 ) -> c_int;
133
134 pub fn pthread_condattr_setclock(
135 attr: *mut crate::pthread_condattr_t,
136 clock_id: crate::clockid_t,
137 ) -> c_int;
138
139 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
140
141 pub fn arc4random_buf(buf: *mut core::ffi::c_void, nbytes: size_t);
142
143 pub fn setgroups(ngroups: c_int, grouplist: *const crate::gid_t) -> c_int;
144 }