aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / unix / solarish / solaris.rs
| 1 | use crate::prelude::*; |
| 2 | use crate::{ |
| 3 | exit_status, |
| 4 | off_t, |
| 5 | termios, |
| 6 | NET_MAC_AWARE, |
| 7 | NET_MAC_AWARE_INHERIT, |
| 8 | PRIV_AWARE_RESET, |
| 9 | PRIV_DEBUG, |
| 10 | PRIV_PFEXEC, |
| 11 | PRIV_XPOLICY, |
| 12 | }; |
| 13 | |
| 14 | pub type door_attr_t = c_uint; |
| 15 | pub type door_id_t = c_ulonglong; |
| 16 | pub type lgrp_affinity_t = c_uint; |
| 17 | |
| 18 | e! { |
| 19 | #[repr(u32)] |
| 20 | pub enum lgrp_rsrc_t { |
| 21 | LGRP_RSRC_CPU = 0, |
| 22 | LGRP_RSRC_MEM = 1, |
| 23 | LGRP_RSRC_TYPES = 2, |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | s! { |
| 28 | pub struct aiocb { |
| 29 | pub aio_fildes: c_int, |
| 30 | pub aio_buf: *mut c_void, |
| 31 | pub aio_nbytes: size_t, |
| 32 | pub aio_offset: off_t, |
| 33 | pub aio_reqprio: c_int, |
| 34 | pub aio_sigevent: crate::sigevent, |
| 35 | pub aio_lio_opcode: c_int, |
| 36 | pub aio_resultp: crate::aio_result_t, |
| 37 | pub aio_state: c_char, |
| 38 | pub aio_returned: c_char, |
| 39 | pub aio__pad1: [c_char; 2], |
| 40 | pub aio_flags: c_int, |
| 41 | } |
| 42 | |
| 43 | pub struct shmid_ds { |
| 44 | pub shm_perm: crate::ipc_perm, |
| 45 | pub shm_segsz: size_t, |
| 46 | pub shm_flags: crate::uintptr_t, |
| 47 | pub shm_lkcnt: c_ushort, |
| 48 | pub shm_lpid: crate::pid_t, |
| 49 | pub shm_cpid: crate::pid_t, |
| 50 | pub shm_nattch: crate::shmatt_t, |
| 51 | pub shm_cnattch: c_ulong, |
| 52 | pub shm_atime: crate::time_t, |
| 53 | pub shm_dtime: crate::time_t, |
| 54 | pub shm_ctime: crate::time_t, |
| 55 | pub shm_amp: *mut c_void, |
| 56 | pub shm_gransize: u64, |
| 57 | pub shm_allocated: u64, |
| 58 | pub shm_pad4: [i64; 1], |
| 59 | } |
| 60 | |
| 61 | pub struct xrs_t { |
| 62 | pub xrs_id: c_ulong, |
| 63 | pub xrs_ptr: *mut c_char, |
| 64 | } |
| 65 | |
| 66 | pub struct utmpx { |
| 67 | pub ut_user: [c_char; _UTMP_USER_LEN], |
| 68 | pub ut_id: [c_char; _UTMP_ID_LEN], |
| 69 | pub ut_line: [c_char; _UTMP_LINE_LEN], |
| 70 | pub ut_pid: crate::pid_t, |
| 71 | pub ut_type: c_short, |
| 72 | pub ut_exit: exit_status, |
| 73 | pub ut_tv: crate::timeval, |
| 74 | pub ut_session: c_int, |
| 75 | pub pad: [c_int; 5], |
| 76 | pub ut_syslen: c_short, |
| 77 | pub ut_host: [c_char; 257], |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | s_no_extra_traits! { |
| 82 | #[repr(packed)] |
| 83 | pub struct door_desc_t__d_data__d_desc { |
| 84 | pub d_descriptor: c_int, |
| 85 | pub d_id: crate::door_id_t, |
| 86 | } |
| 87 | |
| 88 | pub union door_desc_t__d_data { |
| 89 | pub d_desc: door_desc_t__d_data__d_desc, |
| 90 | d_resv: [c_int; 5], /* Check out /usr/include/sys/door.h */ |
| 91 | } |
| 92 | |
| 93 | pub struct door_desc_t { |
| 94 | pub d_attributes: door_attr_t, |
| 95 | pub d_data: door_desc_t__d_data, |
| 96 | } |
| 97 | |
| 98 | pub struct door_arg_t { |
| 99 | pub data_ptr: *const c_char, |
| 100 | pub data_size: size_t, |
| 101 | pub desc_ptr: *const door_desc_t, |
| 102 | pub dec_num: c_uint, |
| 103 | pub rbuf: *const c_char, |
| 104 | pub rsize: size_t, |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | // FIXME(solaris): O_DIRECT and SIGINFO are NOT available on Solaris. |
| 109 | // But in past they were defined here and thus other crates expected them. |
| 110 | // Latest version v0.29.0 of Nix crate still expects this. Since last |
| 111 | // version of Nix crate is almost one year ago let's define these two |
| 112 | // temporarily before new Nix version is released. |
| 113 | pub const O_DIRECT: c_int = 0x2000000; |
| 114 | pub const SIGINFO: c_int = 41; |
| 115 | |
| 116 | pub const _UTMP_USER_LEN: usize = 32; |
| 117 | pub const _UTMP_LINE_LEN: usize = 32; |
| 118 | pub const _UTMP_ID_LEN: usize = 4; |
| 119 | |
| 120 | pub const PORT_SOURCE_POSTWAIT: c_int = 8; |
| 121 | pub const PORT_SOURCE_SIGNAL: c_int = 9; |
| 122 | |
| 123 | pub const AF_LOCAL: c_int = 1; // AF_UNIX |
| 124 | pub const AF_FILE: c_int = 1; // AF_UNIX |
| 125 | |
| 126 | pub const TCP_KEEPIDLE: c_int = 0x1d; |
| 127 | pub const TCP_KEEPINTVL: c_int = 0x1e; |
| 128 | pub const TCP_KEEPCNT: c_int = 0x1f; |
| 129 | |
| 130 | pub const F_DUPFD_CLOEXEC: c_int = 47; |
| 131 | pub const F_DUPFD_CLOFORK: c_int = 49; |
| 132 | pub const F_DUP2FD_CLOEXEC: c_int = 48; |
| 133 | pub const F_DUP2FD_CLOFORK: c_int = 50; |
| 134 | |
| 135 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 136 | /// for details. |
| 137 | pub const _PC_LAST: c_int = 102; |
| 138 | |
| 139 | pub const PRIV_PROC_SENSITIVE: c_uint = 0x0008; |
| 140 | pub const PRIV_PFEXEC_AUTH: c_uint = 0x0200; |
| 141 | pub const PRIV_PROC_TPD: c_uint = 0x0400; |
| 142 | pub const PRIV_TPD_UNSAFE: c_uint = 0x0800; |
| 143 | pub const PRIV_PROC_TPD_RESET: c_uint = 0x1000; |
| 144 | pub const PRIV_TPD_KILLABLE: c_uint = 0x2000; |
| 145 | |
| 146 | pub const POSIX_SPAWN_SETSID: c_short = 0x400; |
| 147 | |
| 148 | pub const PRIV_USER: c_uint = PRIV_DEBUG |
| 149 | | PRIV_PROC_SENSITIVE |
| 150 | | NET_MAC_AWARE |
| 151 | | NET_MAC_AWARE_INHERIT |
| 152 | | PRIV_XPOLICY |
| 153 | | PRIV_AWARE_RESET |
| 154 | | PRIV_PFEXEC |
| 155 | | PRIV_PFEXEC_AUTH |
| 156 | | PRIV_PROC_TPD |
| 157 | | PRIV_TPD_UNSAFE |
| 158 | | PRIV_TPD_KILLABLE |
| 159 | | PRIV_PROC_TPD_RESET; |
| 160 | |
| 161 | extern "C" { |
| 162 | // DIFF(main): changed to `*const *mut` in e77f551de9 |
| 163 | pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int; |
| 164 | |
| 165 | pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_char) -> c_int; |
| 166 | |
| 167 | pub fn door_call(d: c_int, params: *mut door_arg_t) -> c_int; |
| 168 | pub fn door_return( |
| 169 | data_ptr: *mut c_char, |
| 170 | data_size: size_t, |
| 171 | desc_ptr: *mut door_desc_t, |
| 172 | num_desc: c_uint, |
| 173 | ) -> c_int; |
| 174 | pub fn door_create( |
| 175 | server_procedure: extern "C" fn( |
| 176 | cookie: *mut c_void, |
| 177 | argp: *mut c_char, |
| 178 | arg_size: size_t, |
| 179 | dp: *mut door_desc_t, |
| 180 | n_desc: c_uint, |
| 181 | ), |
| 182 | cookie: *mut c_void, |
| 183 | attributes: door_attr_t, |
| 184 | ) -> c_int; |
| 185 | |
| 186 | pub fn fattach(fildes: c_int, path: *const c_char) -> c_int; |
| 187 | |
| 188 | pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int; |
| 189 | |
| 190 | pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int; |
| 191 | |
| 192 | pub fn openpty( |
| 193 | amain: *mut c_int, |
| 194 | asubord: *mut c_int, |
| 195 | name: *mut c_char, |
| 196 | termp: *mut termios, |
| 197 | winp: *mut crate::winsize, |
| 198 | ) -> c_int; |
| 199 | |
| 200 | pub fn forkpty( |
| 201 | amain: *mut c_int, |
| 202 | name: *mut c_char, |
| 203 | termp: *mut termios, |
| 204 | winp: *mut crate::winsize, |
| 205 | ) -> crate::pid_t; |
| 206 | } |