interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / unix / newlib / rtems / mod.rs

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