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 / vxworks / mod.rs
| 1 | //! Interface to VxWorks C library |
| 2 | |
| 3 | use crate::prelude::*; |
| 4 | |
| 5 | extern_ty! { |
| 6 | pub type DIR; |
| 7 | } |
| 8 | |
| 9 | // Deprecated impls: see #5296 |
| 10 | unsafe impl Send for DIR {} |
| 11 | unsafe impl Sync for DIR {} |
| 12 | |
| 13 | pub type intmax_t = i64; |
| 14 | pub type uintmax_t = u64; |
| 15 | |
| 16 | pub type uintptr_t = usize; |
| 17 | pub type intptr_t = isize; |
| 18 | pub type ptrdiff_t = isize; |
| 19 | pub type size_t = crate::uintptr_t; |
| 20 | pub type ssize_t = intptr_t; |
| 21 | pub type speed_t = c_uint; |
| 22 | pub type tcflag_t = c_uint; |
| 23 | pub type clock_t = c_long; |
| 24 | pub type cc_t = c_uchar; |
| 25 | |
| 26 | pub type pid_t = c_int; |
| 27 | pub type in_addr_t = u32; |
| 28 | pub type sighandler_t = size_t; |
| 29 | pub type cpuset_t = u32; |
| 30 | |
| 31 | pub type blkcnt_t = c_long; |
| 32 | pub type blksize_t = c_long; |
| 33 | pub type ino_t = c_ulong; |
| 34 | |
| 35 | pub type rlim_t = c_ulong; |
| 36 | pub type suseconds_t = c_long; |
| 37 | pub type time_t = c_longlong; |
| 38 | |
| 39 | pub type errno_t = c_int; |
| 40 | |
| 41 | pub type useconds_t = c_ulong; |
| 42 | |
| 43 | pub type socklen_t = c_uint; |
| 44 | |
| 45 | pub type pthread_t = c_ulong; |
| 46 | |
| 47 | pub type clockid_t = c_int; |
| 48 | |
| 49 | //defined for the structs |
| 50 | pub type dev_t = c_ulong; |
| 51 | pub type mode_t = c_int; |
| 52 | pub type nlink_t = c_ulong; |
| 53 | pub type uid_t = c_ushort; |
| 54 | pub type gid_t = c_ushort; |
| 55 | pub type sigset_t = c_ulonglong; |
| 56 | pub type key_t = c_long; |
| 57 | |
| 58 | pub type nfds_t = c_uint; |
| 59 | pub type stat64 = crate::stat; |
| 60 | |
| 61 | pub type pthread_key_t = c_ulong; |
| 62 | |
| 63 | // From b_off_t.h |
| 64 | pub type off_t = c_longlong; |
| 65 | |
| 66 | #[deprecated( |
| 67 | since = "0.2.187", |
| 68 | note = "Kernel mode definitions are unsupported. Use `off_t` instead." |
| 69 | )] |
| 70 | pub type off64_t = c_longlong; |
| 71 | |
| 72 | // From b_BOOL.h |
| 73 | pub type BOOL = c_int; |
| 74 | |
| 75 | // From vxWind.h .. |
| 76 | pub type _Vx_OBJ_HANDLE = c_int; |
| 77 | pub type _Vx_TASK_ID = crate::_Vx_OBJ_HANDLE; |
| 78 | pub type _Vx_MSG_Q_ID = crate::_Vx_OBJ_HANDLE; |
| 79 | pub type _Vx_SEM_ID_KERNEL = crate::_Vx_OBJ_HANDLE; |
| 80 | pub type _Vx_RTP_ID = crate::_Vx_OBJ_HANDLE; |
| 81 | pub type _Vx_SD_ID = crate::_Vx_OBJ_HANDLE; |
| 82 | pub type _Vx_CONDVAR_ID = crate::_Vx_OBJ_HANDLE; |
| 83 | pub type _Vx_SEM_ID = *mut crate::_Vx_semaphore; |
| 84 | pub type OBJ_HANDLE = crate::_Vx_OBJ_HANDLE; |
| 85 | pub type TASK_ID = crate::OBJ_HANDLE; |
| 86 | pub type MSG_Q_ID = crate::OBJ_HANDLE; |
| 87 | pub type SEM_ID_KERNEL = crate::OBJ_HANDLE; |
| 88 | pub type RTP_ID = crate::OBJ_HANDLE; |
| 89 | pub type SD_ID = crate::OBJ_HANDLE; |
| 90 | pub type CONDVAR_ID = crate::OBJ_HANDLE; |
| 91 | pub type STATUS = crate::OBJ_HANDLE; |
| 92 | |
| 93 | // From vxTypes.h |
| 94 | pub type _Vx_usr_arg_t = isize; |
| 95 | pub type _Vx_exit_code_t = isize; |
| 96 | pub type _Vx_ticks_t = c_uint; |
| 97 | pub type _Vx_ticks64_t = c_ulonglong; |
| 98 | |
| 99 | pub type sa_family_t = c_uchar; |
| 100 | |
| 101 | // mqueue.h |
| 102 | pub type mqd_t = c_int; |
| 103 | |
| 104 | extern_ty! { |
| 105 | pub type _Vx_semaphore; |
| 106 | } |
| 107 | |
| 108 | impl siginfo_t { |
| 109 | pub unsafe fn si_addr(&self) -> *mut c_void { |
| 110 | self.si_addr |
| 111 | } |
| 112 | |
| 113 | pub unsafe fn si_value(&self) -> crate::sigval { |
| 114 | self.si_value |
| 115 | } |
| 116 | |
| 117 | pub unsafe fn si_pid(&self) -> crate::pid_t { |
| 118 | self.si_pid |
| 119 | } |
| 120 | |
| 121 | pub unsafe fn si_uid(&self) -> crate::uid_t { |
| 122 | self.si_uid |
| 123 | } |
| 124 | |
| 125 | pub unsafe fn si_status(&self) -> c_int { |
| 126 | self.si_status |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | s! { |
| 131 | // b_pthread_condattr_t.h |
| 132 | pub struct pthread_condattr_t { |
| 133 | pub condAttrStatus: c_int, |
| 134 | pub condAttrPshared: c_int, |
| 135 | pub condAttrClockId: crate::clockid_t, |
| 136 | } |
| 137 | |
| 138 | // b_pthread_cond_t.h |
| 139 | pub struct pthread_cond_t { |
| 140 | pub condSemId: crate::_Vx_SEM_ID, |
| 141 | pub condValid: c_int, |
| 142 | pub condInitted: c_int, |
| 143 | pub condRefCount: c_int, |
| 144 | pub condMutex: *mut crate::pthread_mutex_t, |
| 145 | pub condAttr: crate::pthread_condattr_t, |
| 146 | pub condSemName: [c_char; _PTHREAD_SHARED_SEM_NAME_MAX], |
| 147 | } |
| 148 | |
| 149 | // b_pthread_rwlockattr_t.h |
| 150 | pub struct pthread_rwlockattr_t { |
| 151 | pub rwlockAttrStatus: c_int, |
| 152 | pub rwlockAttrPshared: c_int, |
| 153 | pub rwlockAttrMaxReaders: c_uint, |
| 154 | pub rwlockAttrConformOpt: c_uint, |
| 155 | } |
| 156 | |
| 157 | // b_pthread_rwlock_t.h |
| 158 | pub struct pthread_rwlock_t { |
| 159 | pub rwlockSemId: crate::_Vx_SEM_ID, |
| 160 | pub rwlockReadersRefCount: c_uint, |
| 161 | pub rwlockValid: c_int, |
| 162 | pub rwlockInitted: c_int, |
| 163 | pub rwlockAttr: crate::pthread_rwlockattr_t, |
| 164 | pub rwlockSemName: [c_char; _PTHREAD_SHARED_SEM_NAME_MAX], |
| 165 | } |
| 166 | |
| 167 | // b_struct_timeval.h |
| 168 | #[derive(Default)] |
| 169 | pub struct timeval { |
| 170 | pub tv_sec: crate::time_t, |
| 171 | pub tv_usec: crate::suseconds_t, |
| 172 | } |
| 173 | |
| 174 | // socket.h |
| 175 | pub struct linger { |
| 176 | pub l_onoff: c_int, |
| 177 | pub l_linger: c_int, |
| 178 | } |
| 179 | |
| 180 | pub struct sockaddr { |
| 181 | pub sa_len: c_uchar, |
| 182 | pub sa_family: sa_family_t, |
| 183 | pub sa_data: [c_char; 14], |
| 184 | } |
| 185 | |
| 186 | pub struct iovec { |
| 187 | pub iov_base: *mut c_void, |
| 188 | pub iov_len: size_t, |
| 189 | } |
| 190 | |
| 191 | pub struct msghdr { |
| 192 | pub msg_name: *mut c_void, |
| 193 | pub msg_namelen: socklen_t, |
| 194 | pub msg_iov: *mut iovec, |
| 195 | pub msg_iovlen: c_int, |
| 196 | pub msg_control: *mut c_void, |
| 197 | pub msg_controllen: socklen_t, |
| 198 | pub msg_flags: c_int, |
| 199 | } |
| 200 | |
| 201 | pub struct cmsghdr { |
| 202 | pub cmsg_len: socklen_t, |
| 203 | pub cmsg_level: c_int, |
| 204 | pub cmsg_type: c_int, |
| 205 | } |
| 206 | |
| 207 | // poll.h |
| 208 | pub struct pollfd { |
| 209 | pub fd: c_int, |
| 210 | pub events: c_short, |
| 211 | pub revents: c_short, |
| 212 | } |
| 213 | |
| 214 | // resource.h |
| 215 | pub struct rlimit { |
| 216 | pub rlim_cur: crate::rlim_t, |
| 217 | pub rlim_max: crate::rlim_t, |
| 218 | } |
| 219 | |
| 220 | // stat.h |
| 221 | pub struct stat { |
| 222 | pub st_dev: crate::dev_t, |
| 223 | pub st_ino: crate::ino_t, |
| 224 | pub st_mode: mode_t, |
| 225 | pub st_nlink: crate::nlink_t, |
| 226 | pub st_uid: crate::uid_t, |
| 227 | pub st_gid: crate::gid_t, |
| 228 | pub st_rdev: crate::dev_t, |
| 229 | pub st_size: off_t, |
| 230 | #[cfg(not(vxworks_lt_25_09))] |
| 231 | pub st_atim: timespec, |
| 232 | #[cfg(vxworks_lt_25_09)] |
| 233 | pub st_atime: crate::time_t, |
| 234 | #[cfg(not(vxworks_lt_25_09))] |
| 235 | pub st_mtim: timespec, |
| 236 | #[cfg(vxworks_lt_25_09)] |
| 237 | pub st_mtime: crate::time_t, |
| 238 | #[cfg(not(vxworks_lt_25_09))] |
| 239 | pub st_ctim: timespec, |
| 240 | #[cfg(vxworks_lt_25_09)] |
| 241 | pub st_ctime: crate::time_t, |
| 242 | pub st_blksize: crate::blksize_t, |
| 243 | pub st_blocks: crate::blkcnt_t, |
| 244 | pub st_attrib: c_uchar, |
| 245 | st_reserved1: Padding<c_int>, |
| 246 | st_reserved2: Padding<c_int>, |
| 247 | st_reserved3: Padding<c_int>, |
| 248 | st_reserved4: Padding<c_int>, |
| 249 | } |
| 250 | |
| 251 | pub struct fsid_t { |
| 252 | val: [c_long; 2], |
| 253 | } |
| 254 | |
| 255 | pub struct statfs { |
| 256 | pub f_type: c_long, |
| 257 | pub f_bsize: c_long, |
| 258 | pub f_blocks: c_long, |
| 259 | pub f_bfree: c_long, |
| 260 | pub f_bavail: c_long, |
| 261 | pub f_files: c_long, |
| 262 | pub f_ffree: c_long, |
| 263 | pub f_fsid: crate::fsid_t, |
| 264 | f_spare: Padding<[c_long; 7]>, |
| 265 | } |
| 266 | |
| 267 | //b_struct__Timespec.h |
| 268 | pub struct _Timespec { |
| 269 | pub tv_sec: crate::time_t, |
| 270 | pub tv_nsec: c_long, |
| 271 | } |
| 272 | |
| 273 | // b_struct__Sched_param.h |
| 274 | pub struct sched_param { |
| 275 | pub sched_priority: c_int, /* scheduling priority */ |
| 276 | pub sched_ss_low_priority: c_int, /* low scheduling priority */ |
| 277 | pub sched_ss_repl_period: crate::timespec, /* replenishment period */ |
| 278 | pub sched_ss_init_budget: crate::timespec, /* initial budget */ |
| 279 | pub sched_ss_max_repl: c_int, /* max pending replenishment */ |
| 280 | } |
| 281 | |
| 282 | // b_struct__Sched_param.h |
| 283 | pub struct _Sched_param { |
| 284 | pub sched_priority: c_int, /* scheduling priority */ |
| 285 | pub sched_ss_low_priority: c_int, /* low scheduling priority */ |
| 286 | pub sched_ss_repl_period: crate::_Timespec, /* replenishment period */ |
| 287 | pub sched_ss_init_budget: crate::_Timespec, /* initial budget */ |
| 288 | pub sched_ss_max_repl: c_int, /* max pending replenishment */ |
| 289 | } |
| 290 | |
| 291 | // b_pthread_attr_t.h |
| 292 | pub struct pthread_attr_t { |
| 293 | pub threadAttrStatus: c_int, |
| 294 | pub threadAttrStacksize: size_t, |
| 295 | pub threadAttrStackaddr: *mut c_void, |
| 296 | pub threadAttrGuardsize: size_t, |
| 297 | pub threadAttrDetachstate: c_int, |
| 298 | pub threadAttrContentionscope: c_int, |
| 299 | pub threadAttrInheritsched: c_int, |
| 300 | pub threadAttrSchedpolicy: c_int, |
| 301 | pub threadAttrName: *mut c_char, |
| 302 | pub threadAttrOptions: c_int, |
| 303 | pub threadAttrSchedparam: crate::_Sched_param, |
| 304 | } |
| 305 | |
| 306 | // signal.h |
| 307 | |
| 308 | pub struct sigaction { |
| 309 | #[cfg(vxworks_lt_25_09)] |
| 310 | pub sa_u: crate::sa_u_t, |
| 311 | #[cfg(not(vxworks_lt_25_09))] |
| 312 | pub sa_sigaction: crate::sighandler_t, |
| 313 | pub sa_mask: crate::sigset_t, |
| 314 | pub sa_flags: c_int, |
| 315 | } |
| 316 | |
| 317 | // b_stack_t.h |
| 318 | pub struct stack_t { |
| 319 | pub ss_sp: *mut c_void, |
| 320 | pub ss_size: size_t, |
| 321 | pub ss_flags: c_int, |
| 322 | } |
| 323 | |
| 324 | // signal.h |
| 325 | pub struct siginfo_t { |
| 326 | pub si_signo: c_int, |
| 327 | pub si_code: c_int, |
| 328 | pub si_value: crate::sigval, |
| 329 | pub si_errno: c_int, |
| 330 | pub si_status: c_int, |
| 331 | pub si_addr: *mut c_void, |
| 332 | pub si_uid: crate::uid_t, |
| 333 | pub si_pid: crate::pid_t, |
| 334 | } |
| 335 | |
| 336 | // pthread.h (krnl) |
| 337 | // b_pthread_mutexattr_t.h (usr) |
| 338 | pub struct pthread_mutexattr_t { |
| 339 | mutexAttrStatus: c_int, |
| 340 | mutexAttrPshared: c_int, |
| 341 | mutexAttrProtocol: c_int, |
| 342 | mutexAttrPrioceiling: c_int, |
| 343 | mutexAttrType: c_int, |
| 344 | } |
| 345 | |
| 346 | // pthread.h (krnl) |
| 347 | // b_pthread_mutex_t.h (usr) |
| 348 | pub struct pthread_mutex_t { |
| 349 | pub mutexSemId: crate::_Vx_SEM_ID, /*_Vx_SEM_ID ..*/ |
| 350 | pub mutexValid: c_int, |
| 351 | pub mutexInitted: c_int, |
| 352 | pub mutexCondRefCount: c_int, |
| 353 | pub mutexSavPriority: c_int, |
| 354 | pub mutexAttr: crate::pthread_mutexattr_t, |
| 355 | pub mutexSemName: [c_char; _PTHREAD_SHARED_SEM_NAME_MAX], |
| 356 | } |
| 357 | |
| 358 | // b_struct_timespec.h |
| 359 | #[derive(Default)] |
| 360 | pub struct timespec { |
| 361 | pub tv_sec: crate::time_t, |
| 362 | pub tv_nsec: c_long, |
| 363 | } |
| 364 | |
| 365 | // time.h |
| 366 | pub struct tm { |
| 367 | pub tm_sec: c_int, |
| 368 | pub tm_min: c_int, |
| 369 | pub tm_hour: c_int, |
| 370 | pub tm_mday: c_int, |
| 371 | pub tm_mon: c_int, |
| 372 | pub tm_year: c_int, |
| 373 | pub tm_wday: c_int, |
| 374 | pub tm_yday: c_int, |
| 375 | pub tm_isdst: c_int, |
| 376 | } |
| 377 | |
| 378 | // sys/times.h |
| 379 | pub struct tms { |
| 380 | pub tms_utime: crate::clock_t, |
| 381 | pub tms_stime: crate::clock_t, |
| 382 | pub tms_cutime: crate::clock_t, |
| 383 | pub tms_cstime: crate::clock_t, |
| 384 | } |
| 385 | |
| 386 | // utime.h |
| 387 | pub struct utimbuf { |
| 388 | pub actime: time_t, |
| 389 | pub modtime: time_t, |
| 390 | } |
| 391 | |
| 392 | // in.h |
| 393 | pub struct in_addr { |
| 394 | pub s_addr: in_addr_t, |
| 395 | } |
| 396 | |
| 397 | // in.h |
| 398 | pub struct ip_mreq { |
| 399 | pub imr_multiaddr: in_addr, |
| 400 | pub imr_interface: in_addr, |
| 401 | } |
| 402 | |
| 403 | // in6.h |
| 404 | #[repr(align(4))] |
| 405 | pub struct in6_addr { |
| 406 | pub s6_addr: [u8; 16], |
| 407 | } |
| 408 | |
| 409 | // in6.h |
| 410 | pub struct ipv6_mreq { |
| 411 | pub ipv6mr_multiaddr: in6_addr, |
| 412 | pub ipv6mr_interface: c_uint, |
| 413 | } |
| 414 | |
| 415 | // netdb.h |
| 416 | pub struct addrinfo { |
| 417 | pub ai_flags: c_int, |
| 418 | pub ai_family: c_int, |
| 419 | pub ai_socktype: c_int, |
| 420 | pub ai_protocol: c_int, |
| 421 | pub ai_addrlen: size_t, |
| 422 | pub ai_canonname: *mut c_char, |
| 423 | pub ai_addr: *mut crate::sockaddr, |
| 424 | pub ai_next: *mut crate::addrinfo, |
| 425 | } |
| 426 | |
| 427 | // netdb.h |
| 428 | pub struct servent { |
| 429 | pub s_name: *mut c_char, |
| 430 | pub s_aliases: *mut *mut c_char, |
| 431 | pub s_port: c_int, |
| 432 | pub s_proto: *mut c_char, |
| 433 | } |
| 434 | |
| 435 | // netdb.h |
| 436 | pub struct protoent { |
| 437 | pub p_name: *mut c_char, |
| 438 | pub p_aliases: *mut *mut c_char, |
| 439 | pub p_proto: c_int, |
| 440 | } |
| 441 | |
| 442 | // netdb.h |
| 443 | pub struct hostent { |
| 444 | pub h_name: *mut c_char, |
| 445 | pub h_aliases: *mut *mut c_char, |
| 446 | pub h_addrtype: c_int, |
| 447 | pub h_length: c_int, |
| 448 | pub h_addr_list: *mut *mut c_char, |
| 449 | } |
| 450 | |
| 451 | // in.h |
| 452 | pub struct sockaddr_in { |
| 453 | pub sin_len: u8, |
| 454 | pub sin_family: u8, |
| 455 | pub sin_port: u16, |
| 456 | pub sin_addr: crate::in_addr, |
| 457 | pub sin_zero: [c_char; 8], |
| 458 | } |
| 459 | |
| 460 | // in6.h |
| 461 | pub struct sockaddr_in6 { |
| 462 | pub sin6_len: u8, |
| 463 | pub sin6_family: u8, |
| 464 | pub sin6_port: u16, |
| 465 | pub sin6_flowinfo: u32, |
| 466 | pub sin6_addr: crate::in6_addr, |
| 467 | pub sin6_scope_id: u32, |
| 468 | } |
| 469 | |
| 470 | pub struct Dl_info { |
| 471 | pub dli_fname: *const c_char, |
| 472 | pub dli_fbase: *mut c_void, |
| 473 | pub dli_sname: *const c_char, |
| 474 | pub dli_saddr: *mut c_void, |
| 475 | } |
| 476 | |
| 477 | pub struct mq_attr { |
| 478 | pub mq_maxmsg: c_long, |
| 479 | pub mq_msgsize: c_long, |
| 480 | pub mq_flags: c_long, |
| 481 | pub mq_curmsgs: c_long, |
| 482 | } |
| 483 | |
| 484 | pub struct flock { |
| 485 | pub l_type: c_short, |
| 486 | pub l_whence: c_short, |
| 487 | pub l_start: c_longlong, |
| 488 | pub l_len: c_longlong, |
| 489 | pub l_pid: c_long, |
| 490 | } |
| 491 | |
| 492 | pub struct winsize { |
| 493 | pub ws_row: c_ushort, |
| 494 | pub ws_col: c_ushort, |
| 495 | pub ws_xpixel: c_ushort, |
| 496 | pub ws_ypixel: c_ushort, |
| 497 | } |
| 498 | |
| 499 | pub struct termios { |
| 500 | pub c_iflag: crate::tcflag_t, |
| 501 | pub c_oflag: crate::tcflag_t, |
| 502 | pub c_cflag: crate::tcflag_t, |
| 503 | pub c_lflag: crate::tcflag_t, |
| 504 | pub c_cc: [crate::cc_t; crate::NCCS], |
| 505 | pub c_ispeed: crate::speed_t, |
| 506 | pub c_ospeed: crate::speed_t, |
| 507 | } |
| 508 | |
| 509 | pub struct rusage { |
| 510 | pub ru_utime: timeval, |
| 511 | pub ru_stime: timeval, |
| 512 | pub ru_maxrss: c_long, |
| 513 | pub ru_ixrss: c_long, |
| 514 | pub ru_idrss: c_long, |
| 515 | pub ru_isrss: c_long, |
| 516 | pub ru_minflt: c_long, |
| 517 | pub ru_majflt: c_long, |
| 518 | pub ru_nswap: c_long, |
| 519 | pub ru_inblock: c_long, |
| 520 | pub ru_oublock: c_long, |
| 521 | pub ru_msgsnd: c_long, |
| 522 | pub ru_msgrcv: c_long, |
| 523 | pub ru_nsignals: c_long, |
| 524 | pub ru_nvcsw: c_long, |
| 525 | pub ru_nivcsw: c_long, |
| 526 | } |
| 527 | |
| 528 | pub struct lconv { |
| 529 | pub currency_symbol: *mut c_char, |
| 530 | pub int_curr_symbol: *mut c_char, |
| 531 | pub mon_decimal_point: *mut c_char, |
| 532 | pub mon_grouping: *mut c_char, |
| 533 | pub mon_thousands_sep: *mut c_char, |
| 534 | pub negative_sign: *mut c_char, |
| 535 | pub positive_sign: *mut c_char, |
| 536 | pub frac_digits: c_char, |
| 537 | pub n_cs_precedes: c_char, |
| 538 | pub n_sep_by_space: c_char, |
| 539 | pub n_sign_posn: c_char, |
| 540 | pub p_cs_precedes: c_char, |
| 541 | pub p_sep_by_space: c_char, |
| 542 | pub p_sign_posn: c_char, |
| 543 | pub int_frac_digits: c_char, |
| 544 | pub int_n_cs_precedes: c_char, |
| 545 | pub int_n_sep_by_space: c_char, |
| 546 | pub int_n_sign_posn: c_char, |
| 547 | pub int_p_cs_precedes: c_char, |
| 548 | pub int_p_sep_by_space: c_char, |
| 549 | pub int_p_sign_posn: c_char, |
| 550 | pub decimal_point: *mut c_char, |
| 551 | pub grouping: *mut c_char, |
| 552 | pub thousands_sep: *mut c_char, |
| 553 | pub _Frac_grouping: *mut c_char, |
| 554 | pub _Frac_sep: *mut c_char, |
| 555 | pub _False: *mut c_char, |
| 556 | pub _True: *mut c_char, |
| 557 | |
| 558 | pub _No: *mut c_char, |
| 559 | pub _Yes: *mut c_char, |
| 560 | } |
| 561 | |
| 562 | // grp.h |
| 563 | pub struct group { |
| 564 | pub gr_name: *mut c_char, |
| 565 | pub gr_passwd: *mut c_char, |
| 566 | pub gr_gid: c_int, |
| 567 | pub gr_mem: *mut *mut c_char, |
| 568 | } |
| 569 | |
| 570 | pub struct utsname { |
| 571 | pub sysname: [c_char; 80], |
| 572 | pub nodename: [c_char; 256], |
| 573 | pub release: [c_char; 80], |
| 574 | pub version: [c_char; 256], |
| 575 | pub machine: [c_char; 256], |
| 576 | pub endian: [c_char; 80], |
| 577 | pub kernelversion: [c_char; 80], |
| 578 | pub releaseversion: [c_char; 80], |
| 579 | pub processor: [c_char; 80], |
| 580 | pub bsprevision: [c_char; 80], |
| 581 | pub builddate: [c_char; 80], |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | s_no_extra_traits! { |
| 586 | // dirent.h |
| 587 | pub struct dirent { |
| 588 | pub d_ino: crate::ino_t, |
| 589 | pub d_name: [c_char; _PARM_NAME_MAX as usize + 1], |
| 590 | pub d_type: c_uchar, |
| 591 | } |
| 592 | |
| 593 | pub struct sockaddr_un { |
| 594 | pub sun_len: u8, |
| 595 | pub sun_family: sa_family_t, |
| 596 | pub sun_path: [c_char; 104], |
| 597 | } |
| 598 | |
| 599 | // rtpLibCommon.h |
| 600 | pub struct RTP_DESC { |
| 601 | pub status: c_int, |
| 602 | pub options: u32, |
| 603 | pub entrAddr: *mut c_void, |
| 604 | pub initTaskId: crate::TASK_ID, |
| 605 | pub parentId: crate::RTP_ID, |
| 606 | pub pathName: [c_char; VX_RTP_NAME_LENGTH as usize + 1], |
| 607 | pub taskCnt: c_int, |
| 608 | pub textStart: *mut c_void, |
| 609 | pub textEnd: *mut c_void, |
| 610 | } |
| 611 | // socket.h |
| 612 | pub struct sockaddr_storage { |
| 613 | pub ss_len: c_uchar, |
| 614 | pub ss_family: crate::sa_family_t, |
| 615 | __ss_pad1: Padding<[c_char; _SS_PAD1SIZE]>, |
| 616 | __ss_align: i32, |
| 617 | __ss_pad2: Padding<[c_char; _SS_PAD2SIZE]>, |
| 618 | } |
| 619 | |
| 620 | pub union sa_u_t { |
| 621 | pub sa_handler: Option<unsafe extern "C" fn(c_int) -> !>, |
| 622 | pub sa_sigaction: |
| 623 | Option<unsafe extern "C" fn(c_int, *mut crate::siginfo_t, *mut c_void) -> !>, |
| 624 | } |
| 625 | |
| 626 | pub union sigval { |
| 627 | pub sival_int: c_int, |
| 628 | pub sival_ptr: *mut c_void, |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | cfg_if! { |
| 633 | if #[cfg(feature = "extra_traits")] { |
| 634 | impl PartialEq for sa_u_t { |
| 635 | fn eq(&self, other: &sa_u_t) -> bool { |
| 636 | unsafe { |
| 637 | let h1 = match self.sa_handler { |
| 638 | Some(handler) => handler as usize, |
| 639 | None => 0 as usize, |
| 640 | }; |
| 641 | let h2 = match other.sa_handler { |
| 642 | Some(handler) => handler as usize, |
| 643 | None => 0 as usize, |
| 644 | }; |
| 645 | h1 == h2 |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | impl Eq for sa_u_t {} |
| 650 | impl hash::Hash for sa_u_t { |
| 651 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 652 | unsafe { |
| 653 | let h = match self.sa_handler { |
| 654 | Some(handler) => handler as usize, |
| 655 | None => 0 as usize, |
| 656 | }; |
| 657 | h.hash(state) |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | impl PartialEq for sigval { |
| 663 | fn eq(&self, other: &sigval) -> bool { |
| 664 | unsafe { self.sival_ptr as usize == other.sival_ptr as usize } |
| 665 | } |
| 666 | } |
| 667 | impl Eq for sigval {} |
| 668 | impl hash::Hash for sigval { |
| 669 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 670 | unsafe { (self.sival_ptr as usize).hash(state) }; |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | pub const EXIT_SUCCESS: c_int = 0; |
| 677 | pub const EXIT_FAILURE: c_int = 1; |
| 678 | |
| 679 | pub const EAI_SERVICE: c_int = 9; |
| 680 | pub const EAI_SOCKTYPE: c_int = 10; |
| 681 | pub const EAI_SYSTEM: c_int = 11; |
| 682 | |
| 683 | pub const INT_MAX: c_int = 0x7fffffff; |
| 684 | pub const INT_MIN: c_int = -INT_MAX - 1; |
| 685 | |
| 686 | // FIXME(vxworks): This is not defined in vxWorks, but we have to define it here |
| 687 | // to make the building pass for getrandom and std |
| 688 | pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut(); |
| 689 | |
| 690 | //Clock Lib Stuff |
| 691 | pub const CLOCK_REALTIME: c_int = 0x0; |
| 692 | pub const CLOCK_MONOTONIC: c_int = 0x1; |
| 693 | pub const CLOCK_PROCESS_CPUTIME_ID: c_int = 0x2; |
| 694 | pub const CLOCK_THREAD_CPUTIME_ID: c_int = 0x3; |
| 695 | pub const TIMER_ABSTIME: c_int = 0x1; |
| 696 | pub const TIMER_RELTIME: c_int = 0x0; |
| 697 | |
| 698 | // PTHREAD STUFF |
| 699 | pub const PTHREAD_INITIALIZED_OBJ: c_int = u32_cast_int(0xF70990EF); |
| 700 | pub const PTHREAD_DESTROYED_OBJ: c_int = -1; |
| 701 | pub const PTHREAD_VALID_OBJ: c_int = u32_cast_int(0xEC542A37); |
| 702 | pub const PTHREAD_INVALID_OBJ: c_int = -1; |
| 703 | pub const PTHREAD_UNUSED_YET_OBJ: c_int = -1; |
| 704 | |
| 705 | pub const PTHREAD_PRIO_NONE: c_int = 0; |
| 706 | pub const PTHREAD_PRIO_INHERIT: c_int = 1; |
| 707 | pub const PTHREAD_PRIO_PROTECT: c_int = 2; |
| 708 | |
| 709 | pub const PTHREAD_MUTEX_NORMAL: c_int = 0; |
| 710 | pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1; |
| 711 | pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2; |
| 712 | pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL; |
| 713 | pub const PTHREAD_STACK_MIN: usize = 4096; |
| 714 | |
| 715 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 716 | /// for details. |
| 717 | pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30; |
| 718 | |
| 719 | //sched.h |
| 720 | pub const SCHED_FIFO: c_int = 0x01; |
| 721 | pub const SCHED_RR: c_int = 0x02; |
| 722 | pub const SCHED_OTHER: c_int = 0x04; |
| 723 | pub const SCHED_SPORADIC: c_int = 0x08; |
| 724 | pub const PRIO_PROCESS: c_uint = 0; |
| 725 | pub const SCHED_FIFO_HIGH_PRI: c_int = 255; |
| 726 | pub const SCHED_FIFO_LOW_PRI: c_int = 0; |
| 727 | pub const SCHED_RR_HIGH_PRI: c_int = 255; |
| 728 | pub const SCHED_RR_LOW_PRI: c_int = 0; |
| 729 | pub const SCHED_SPORADIC_HIGH_PRI: c_int = 255; |
| 730 | pub const SCHED_SPORADIC_LOW_PRI: c_int = 0; |
| 731 | |
| 732 | // ERRNO STUFF |
| 733 | pub const ERROR: c_int = -1; |
| 734 | pub const OK: c_int = 0; |
| 735 | pub const EPERM: c_int = 1; /* Not owner */ |
| 736 | pub const ENOENT: c_int = 2; /* No such file or directory */ |
| 737 | pub const ESRCH: c_int = 3; /* No such process */ |
| 738 | pub const EINTR: c_int = 4; /* Interrupted system call */ |
| 739 | pub const EIO: c_int = 5; /* I/O error */ |
| 740 | pub const ENXIO: c_int = 6; /* No such device or address */ |
| 741 | pub const E2BIG: c_int = 7; /* Arg list too long */ |
| 742 | pub const ENOEXEC: c_int = 8; /* Exec format error */ |
| 743 | pub const EBADF: c_int = 9; /* Bad file number */ |
| 744 | pub const ECHILD: c_int = 10; /* No children */ |
| 745 | pub const EAGAIN: c_int = 11; /* No more processes */ |
| 746 | pub const ENOMEM: c_int = 12; /* Not enough core */ |
| 747 | pub const EACCES: c_int = 13; /* Permission denied */ |
| 748 | pub const EFAULT: c_int = 14; |
| 749 | pub const ENOTEMPTY: c_int = 15; |
| 750 | pub const EBUSY: c_int = 16; |
| 751 | pub const EEXIST: c_int = 17; |
| 752 | pub const EXDEV: c_int = 18; |
| 753 | pub const ENODEV: c_int = 19; |
| 754 | pub const ENOTDIR: c_int = 20; |
| 755 | pub const EISDIR: c_int = 21; |
| 756 | pub const EINVAL: c_int = 22; |
| 757 | pub const ENFILE: c_int = 23; |
| 758 | pub const EMFILE: c_int = 24; |
| 759 | pub const ENOTTY: c_int = 25; |
| 760 | pub const ENAMETOOLONG: c_int = 26; |
| 761 | pub const EFBIG: c_int = 27; |
| 762 | pub const ENOSPC: c_int = 28; |
| 763 | pub const ESPIPE: c_int = 29; |
| 764 | pub const EROFS: c_int = 30; |
| 765 | pub const EMLINK: c_int = 31; |
| 766 | pub const EPIPE: c_int = 32; |
| 767 | pub const EDEADLK: c_int = 33; |
| 768 | pub const ENOLCK: c_int = 34; |
| 769 | pub const ENOTSUP: c_int = 35; |
| 770 | pub const EMSGSIZE: c_int = 36; |
| 771 | pub const EDOM: c_int = 37; |
| 772 | pub const ERANGE: c_int = 38; |
| 773 | pub const EDOOM: c_int = 39; |
| 774 | pub const EDESTADDRREQ: c_int = 40; |
| 775 | pub const EPROTOTYPE: c_int = 41; |
| 776 | pub const ENOPROTOOPT: c_int = 42; |
| 777 | pub const EPROTONOSUPPORT: c_int = 43; |
| 778 | pub const ESOCKTNOSUPPORT: c_int = 44; |
| 779 | pub const EOPNOTSUPP: c_int = 45; |
| 780 | pub const EPFNOSUPPORT: c_int = 46; |
| 781 | pub const EAFNOSUPPORT: c_int = 47; |
| 782 | pub const EADDRINUSE: c_int = 48; |
| 783 | pub const EADDRNOTAVAIL: c_int = 49; |
| 784 | pub const ENOTSOCK: c_int = 50; |
| 785 | pub const ENETUNREACH: c_int = 51; |
| 786 | pub const ENETRESET: c_int = 52; |
| 787 | pub const ECONNABORTED: c_int = 53; |
| 788 | pub const ECONNRESET: c_int = 54; |
| 789 | pub const ENOBUFS: c_int = 55; |
| 790 | pub const EISCONN: c_int = 56; |
| 791 | pub const ENOTCONN: c_int = 57; |
| 792 | pub const ESHUTDOWN: c_int = 58; |
| 793 | pub const ETOOMANYREFS: c_int = 59; |
| 794 | pub const ETIMEDOUT: c_int = 60; |
| 795 | pub const ECONNREFUSED: c_int = 61; |
| 796 | pub const ENETDOWN: c_int = 62; |
| 797 | pub const ETXTBSY: c_int = 63; |
| 798 | pub const ELOOP: c_int = 64; |
| 799 | pub const EHOSTUNREACH: c_int = 65; |
| 800 | pub const ENOTBLK: c_int = 66; |
| 801 | pub const EHOSTDOWN: c_int = 67; |
| 802 | pub const EINPROGRESS: c_int = 68; |
| 803 | pub const EALREADY: c_int = 69; |
| 804 | pub const EWOULDBLOCK: c_int = 70; |
| 805 | pub const ENOSYS: c_int = 71; |
| 806 | pub const ECANCELED: c_int = 72; |
| 807 | pub const ENOSR: c_int = 74; |
| 808 | pub const ENOSTR: c_int = 75; |
| 809 | pub const EPROTO: c_int = 76; |
| 810 | pub const EBADMSG: c_int = 77; |
| 811 | pub const ENODATA: c_int = 78; |
| 812 | pub const ETIME: c_int = 79; |
| 813 | pub const ENOMSG: c_int = 80; |
| 814 | pub const EFPOS: c_int = 81; |
| 815 | pub const EILSEQ: c_int = 82; |
| 816 | pub const EDQUOT: c_int = 83; |
| 817 | pub const EIDRM: c_int = 84; |
| 818 | pub const EOVERFLOW: c_int = 85; |
| 819 | pub const EMULTIHOP: c_int = 86; |
| 820 | pub const ENOLINK: c_int = 87; |
| 821 | pub const ESTALE: c_int = 88; |
| 822 | pub const EOWNERDEAD: c_int = 89; |
| 823 | pub const ENOTRECOVERABLE: c_int = 90; |
| 824 | |
| 825 | // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h |
| 826 | const M_nfsStat: c_int = 48 << 16; |
| 827 | enum nfsstat { |
| 828 | NFSERR_REMOTE = 71, |
| 829 | NFSERR_WFLUSH = 99, |
| 830 | NFSERR_BADHANDLE = 10001, |
| 831 | NFSERR_NOT_SYNC = 10002, |
| 832 | NFSERR_BAD_COOKIE = 10003, |
| 833 | NFSERR_TOOSMALL = 10005, |
| 834 | NFSERR_BADTYPE = 10007, |
| 835 | NFSERR_JUKEBOX = 10008, |
| 836 | } |
| 837 | |
| 838 | pub const S_nfsLib_NFS_OK: c_int = OK; |
| 839 | pub const S_nfsLib_NFSERR_PERM: c_int = EPERM; |
| 840 | pub const S_nfsLib_NFSERR_NOENT: c_int = ENOENT; |
| 841 | pub const S_nfsLib_NFSERR_IO: c_int = EIO; |
| 842 | pub const S_nfsLib_NFSERR_NXIO: c_int = ENXIO; |
| 843 | pub const S_nfsLib_NFSERR_ACCESS: c_int = EACCES; |
| 844 | pub const S_nfsLib_NFSERR_EXIST: c_int = EEXIST; |
| 845 | pub const S_nfsLib_NFSERR_ENODEV: c_int = ENODEV; |
| 846 | pub const S_nfsLib_NFSERR_NOTDIR: c_int = ENOTDIR; |
| 847 | pub const S_nfsLib_NFSERR_ISDIR: c_int = EISDIR; |
| 848 | pub const S_nfsLib_NFSERR_INVAL: c_int = EINVAL; |
| 849 | pub const S_nfsLib_NFSERR_FBIG: c_int = EFBIG; |
| 850 | pub const S_nfsLib_NFSERR_NOSPC: c_int = ENOSPC; |
| 851 | pub const S_nfsLib_NFSERR_ROFS: c_int = EROFS; |
| 852 | pub const S_nfsLib_NFSERR_NAMETOOLONG: c_int = ENAMETOOLONG; |
| 853 | pub const S_nfsLib_NFSERR_NOTEMPTY: c_int = ENOTEMPTY; |
| 854 | pub const S_nfsLib_NFSERR_DQUOT: c_int = EDQUOT; |
| 855 | pub const S_nfsLib_NFSERR_STALE: c_int = ESTALE; |
| 856 | pub const S_nfsLib_NFSERR_WFLUSH: c_int = M_nfsStat | nfsstat::NFSERR_WFLUSH as c_int; |
| 857 | pub const S_nfsLib_NFSERR_REMOTE: c_int = M_nfsStat | nfsstat::NFSERR_REMOTE as c_int; |
| 858 | pub const S_nfsLib_NFSERR_BADHANDLE: c_int = M_nfsStat | nfsstat::NFSERR_BADHANDLE as c_int; |
| 859 | pub const S_nfsLib_NFSERR_NOT_SYNC: c_int = M_nfsStat | nfsstat::NFSERR_NOT_SYNC as c_int; |
| 860 | pub const S_nfsLib_NFSERR_BAD_COOKIE: c_int = M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as c_int; |
| 861 | pub const S_nfsLib_NFSERR_NOTSUPP: c_int = EOPNOTSUPP; |
| 862 | pub const S_nfsLib_NFSERR_TOOSMALL: c_int = M_nfsStat | nfsstat::NFSERR_TOOSMALL as c_int; |
| 863 | pub const S_nfsLib_NFSERR_SERVERFAULT: c_int = EIO; |
| 864 | pub const S_nfsLib_NFSERR_BADTYPE: c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as c_int; |
| 865 | pub const S_nfsLib_NFSERR_JUKEBOX: c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as c_int; |
| 866 | |
| 867 | // internal offset values for below constants |
| 868 | const taskErrorBase: c_int = 0x00030000; |
| 869 | const semErrorBase: c_int = 0x00160000; |
| 870 | const objErrorBase: c_int = 0x003d0000; |
| 871 | |
| 872 | // taskLibCommon.h |
| 873 | pub const S_taskLib_NAME_NOT_FOUND: c_int = taskErrorBase + 0x0065; |
| 874 | pub const S_taskLib_TASK_HOOK_TABLE_FULL: c_int = taskErrorBase + 0x0066; |
| 875 | pub const S_taskLib_TASK_HOOK_NOT_FOUND: c_int = taskErrorBase + 0x0067; |
| 876 | pub const S_taskLib_ILLEGAL_PRIORITY: c_int = taskErrorBase + 0x006D; |
| 877 | |
| 878 | // FIXME(vxworks): could also be useful for TASK_DESC type |
| 879 | pub const VX_TASK_NAME_LENGTH: c_int = 31; |
| 880 | pub const VX_TASK_RENAME_LENGTH: c_int = 16; |
| 881 | |
| 882 | pub const TCIFLUSH: c_int = 0; |
| 883 | |
| 884 | pub const VINTR: usize = 0; |
| 885 | pub const VQUIT: usize = 1; |
| 886 | pub const VERASE: usize = 2; |
| 887 | pub const VKILL: usize = 3; |
| 888 | pub const VEOF: usize = 4; |
| 889 | pub const VMIN: usize = 16; |
| 890 | pub const VTIME: usize = 17; |
| 891 | |
| 892 | // semLibCommon.h |
| 893 | pub const S_semLib_INVALID_STATE: c_int = semErrorBase + 0x0065; |
| 894 | pub const S_semLib_INVALID_OPTION: c_int = semErrorBase + 0x0066; |
| 895 | pub const S_semLib_INVALID_QUEUE_TYPE: c_int = semErrorBase + 0x0067; |
| 896 | pub const S_semLib_INVALID_OPERATION: c_int = semErrorBase + 0x0068; |
| 897 | |
| 898 | // objLibCommon.h |
| 899 | pub const S_objLib_OBJ_ID_ERROR: c_int = objErrorBase + 0x0001; |
| 900 | pub const S_objLib_OBJ_UNAVAILABLE: c_int = objErrorBase + 0x0002; |
| 901 | pub const S_objLib_OBJ_DELETED: c_int = objErrorBase + 0x0003; |
| 902 | pub const S_objLib_OBJ_TIMEOUT: c_int = objErrorBase + 0x0004; |
| 903 | pub const S_objLib_OBJ_NO_METHOD: c_int = objErrorBase + 0x0005; |
| 904 | |
| 905 | // netinet/in.h |
| 906 | pub const IPPROTO_IP: c_int = 0; |
| 907 | pub const IPPROTO_ICMP: c_int = 1; |
| 908 | pub const IPPROTO_TCP: c_int = 6; |
| 909 | pub const IPPROTO_IPV6: c_int = 41; |
| 910 | pub const IPPROTO_ICMPV6: c_int = 58; |
| 911 | |
| 912 | pub const INADDR_ANY: in_addr_t = 0; |
| 913 | pub const INADDR_LOOPBACK: in_addr_t = 2130706433; |
| 914 | pub const INADDR_BROADCAST: in_addr_t = 4294967295; |
| 915 | pub const INADDR_NONE: in_addr_t = 4294967295; |
| 916 | |
| 917 | // netinet6/in6.h |
| 918 | pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { |
| 919 | s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], |
| 920 | }; |
| 921 | pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { |
| 922 | s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], |
| 923 | }; |
| 924 | |
| 925 | // udp.h |
| 926 | pub const IPPROTO_UDP: c_int = 17; |
| 927 | |
| 928 | pub const IP_TTL: c_int = 4; |
| 929 | pub const IP_MULTICAST_IF: c_int = 9; |
| 930 | pub const IP_MULTICAST_TTL: c_int = 10; |
| 931 | pub const IP_MULTICAST_LOOP: c_int = 11; |
| 932 | pub const IP_ADD_MEMBERSHIP: c_int = 12; |
| 933 | pub const IP_DROP_MEMBERSHIP: c_int = 13; |
| 934 | |
| 935 | // netdb.h |
| 936 | pub const NI_MAXHOST: c_int = 1025; |
| 937 | |
| 938 | // in6.h |
| 939 | pub const IPV6_V6ONLY: c_int = 1; |
| 940 | pub const IPV6_UNICAST_HOPS: c_int = 4; |
| 941 | pub const IPV6_MULTICAST_IF: c_int = 9; |
| 942 | pub const IPV6_MULTICAST_HOPS: c_int = 10; |
| 943 | pub const IPV6_MULTICAST_LOOP: c_int = 11; |
| 944 | pub const IPV6_ADD_MEMBERSHIP: c_int = 12; |
| 945 | pub const IPV6_DROP_MEMBERSHIP: c_int = 13; |
| 946 | |
| 947 | // STAT Stuff |
| 948 | pub const S_IFMT: c_int = 0o17_0000; |
| 949 | pub const S_IFIFO: c_int = 0o1_0000; |
| 950 | pub const S_IFCHR: c_int = 0o2_0000; |
| 951 | pub const S_IFDIR: c_int = 0o4_0000; |
| 952 | pub const S_IFBLK: c_int = 0o6_0000; |
| 953 | pub const S_IFREG: c_int = 0o10_0000; |
| 954 | pub const S_IFLNK: c_int = 0o12_0000; |
| 955 | pub const S_IFSHM: c_int = 0o13_0000; |
| 956 | pub const S_IFSOCK: c_int = 0o14_0000; |
| 957 | pub const S_ISUID: c_int = 0o4000; |
| 958 | pub const S_ISGID: c_int = 0o2000; |
| 959 | pub const S_ISTXT: c_int = 0o1000; |
| 960 | pub const S_ISVTX: c_int = 0o1000; |
| 961 | pub const S_IRUSR: c_int = 0o0400; |
| 962 | pub const S_IWUSR: c_int = 0o0200; |
| 963 | pub const S_IXUSR: c_int = 0o0100; |
| 964 | pub const S_IRWXU: c_int = 0o0700; |
| 965 | pub const S_IRGRP: c_int = 0o0040; |
| 966 | pub const S_IWGRP: c_int = 0o0020; |
| 967 | pub const S_IXGRP: c_int = 0o0010; |
| 968 | pub const S_IRWXG: c_int = 0o0070; |
| 969 | pub const S_IROTH: c_int = 0o0004; |
| 970 | pub const S_IWOTH: c_int = 0o0002; |
| 971 | pub const S_IXOTH: c_int = 0o0001; |
| 972 | pub const S_IRWXO: c_int = 0o0007; |
| 973 | |
| 974 | pub const UTIME_OMIT: c_long = 0x3ffffffe; |
| 975 | pub const UTIME_NOW: c_long = 0x3fffffff; |
| 976 | |
| 977 | // socket.h |
| 978 | pub const SOL_SOCKET: c_int = 0xffff; |
| 979 | pub const SOMAXCONN: c_int = 128; |
| 980 | |
| 981 | pub const SO_DEBUG: c_int = 0x0001; |
| 982 | pub const SO_REUSEADDR: c_int = 0x0004; |
| 983 | pub const SO_KEEPALIVE: c_int = 0x0008; |
| 984 | pub const SO_DONTROUTE: c_int = 0x0010; |
| 985 | pub const SO_RCVLOWAT: c_int = 0x0012; |
| 986 | pub const SO_SNDLOWAT: c_int = 0x0013; |
| 987 | pub const SO_SNDTIMEO: c_int = 0x1005; |
| 988 | pub const SO_ACCEPTCONN: c_int = 0x001e; |
| 989 | pub const SO_BROADCAST: c_int = 0x0020; |
| 990 | pub const SO_USELOOPBACK: c_int = 0x0040; |
| 991 | pub const SO_LINGER: c_int = 0x0080; |
| 992 | pub const SO_REUSEPORT: c_int = 0x0200; |
| 993 | |
| 994 | pub const SO_VLAN: c_int = 0x8000; |
| 995 | |
| 996 | pub const SO_SNDBUF: c_int = 0x1001; |
| 997 | pub const SO_RCVBUF: c_int = 0x1002; |
| 998 | pub const SO_RCVTIMEO: c_int = 0x1006; |
| 999 | pub const SO_ERROR: c_int = 0x1007; |
| 1000 | pub const SO_TYPE: c_int = 0x1008; |
| 1001 | pub const SO_BINDTODEVICE: c_int = 0x1010; |
| 1002 | pub const SO_OOBINLINE: c_int = 0x1011; |
| 1003 | pub const SO_CONNTIMEO: c_int = 0x100a; |
| 1004 | |
| 1005 | pub const SOCK_STREAM: c_int = 1; |
| 1006 | pub const SOCK_DGRAM: c_int = 2; |
| 1007 | pub const SOCK_RAW: c_int = 3; |
| 1008 | pub const SOCK_RDM: c_int = 4; |
| 1009 | pub const SOCK_SEQPACKET: c_int = 5; |
| 1010 | pub const SOCK_PACKET: c_int = 10; |
| 1011 | |
| 1012 | pub const _SS_MAXSIZE: usize = 128; |
| 1013 | pub const _SS_ALIGNSIZE: usize = size_of::<u32>(); |
| 1014 | pub const _SS_PAD1SIZE: usize = |
| 1015 | _SS_ALIGNSIZE - size_of::<c_uchar>() - size_of::<crate::sa_family_t>(); |
| 1016 | pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE |
| 1017 | - size_of::<c_uchar>() |
| 1018 | - size_of::<crate::sa_family_t>() |
| 1019 | - _SS_PAD1SIZE |
| 1020 | - _SS_ALIGNSIZE; |
| 1021 | |
| 1022 | pub const MSG_OOB: c_int = 0x0001; |
| 1023 | pub const MSG_PEEK: c_int = 0x0002; |
| 1024 | pub const MSG_DONTROUTE: c_int = 0x0004; |
| 1025 | pub const MSG_EOR: c_int = 0x0008; |
| 1026 | pub const MSG_TRUNC: c_int = 0x0010; |
| 1027 | pub const MSG_CTRUNC: c_int = 0x0020; |
| 1028 | pub const MSG_WAITALL: c_int = 0x0040; |
| 1029 | pub const MSG_DONTWAIT: c_int = 0x0080; |
| 1030 | pub const MSG_EOF: c_int = 0x0100; |
| 1031 | pub const MSG_EXP: c_int = 0x0200; |
| 1032 | pub const MSG_MBUF: c_int = 0x0400; |
| 1033 | pub const MSG_NOTIFICATION: c_int = 0x0800; |
| 1034 | pub const MSG_COMPAT: c_int = 0x8000; |
| 1035 | |
| 1036 | pub const AF_UNSPEC: c_int = 0; |
| 1037 | pub const AF_LOCAL: c_int = 1; |
| 1038 | pub const PF_LOCAL: c_int = AF_LOCAL; |
| 1039 | pub const PF_UNIX: c_int = PF_LOCAL; |
| 1040 | pub const PF_UNSPEC: c_int = AF_UNSPEC; |
| 1041 | pub const AF_UNIX: c_int = AF_LOCAL; |
| 1042 | pub const AF_INET: c_int = 2; |
| 1043 | pub const PF_INET: c_int = AF_INET; |
| 1044 | pub const AF_NETLINK: c_int = 16; |
| 1045 | pub const AF_ROUTE: c_int = 17; |
| 1046 | pub const AF_LINK: c_int = 18; |
| 1047 | pub const AF_PACKET: c_int = 19; |
| 1048 | pub const pseudo_AF_KEY: c_int = 27; |
| 1049 | pub const AF_KEY: c_int = pseudo_AF_KEY; |
| 1050 | pub const AF_INET6: c_int = 28; |
| 1051 | pub const PF_INET6: c_int = AF_INET6; |
| 1052 | pub const AF_SOCKDEV: c_int = 31; |
| 1053 | pub const AF_TIPC: c_int = 33; |
| 1054 | pub const AF_MIPC: c_int = 34; |
| 1055 | pub const AF_MIPC_SAFE: c_int = 35; |
| 1056 | |
| 1057 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1058 | /// for details. |
| 1059 | pub const AF_MAX: c_int = 39; |
| 1060 | |
| 1061 | // termios.h |
| 1062 | pub const B0: crate::speed_t = 0; |
| 1063 | pub const B50: crate::speed_t = 50; |
| 1064 | pub const B75: crate::speed_t = 75; |
| 1065 | pub const B110: crate::speed_t = 110; |
| 1066 | pub const B134: crate::speed_t = 134; |
| 1067 | pub const B150: crate::speed_t = 150; |
| 1068 | pub const B200: crate::speed_t = 200; |
| 1069 | pub const B300: crate::speed_t = 300; |
| 1070 | pub const B600: crate::speed_t = 600; |
| 1071 | pub const B1200: crate::speed_t = 1200; |
| 1072 | pub const B1800: crate::speed_t = 1800; |
| 1073 | pub const B2400: crate::speed_t = 2400; |
| 1074 | pub const B4800: crate::speed_t = 4800; |
| 1075 | pub const B9600: crate::speed_t = 9600; |
| 1076 | pub const B19200: crate::speed_t = 19200; |
| 1077 | pub const B38400: crate::speed_t = 38400; |
| 1078 | pub const B57600: crate::speed_t = 57600; |
| 1079 | pub const B115200: crate::speed_t = 115200; |
| 1080 | pub const B230400: crate::speed_t = 230400; |
| 1081 | |
| 1082 | pub const IGNBRK: crate::tcflag_t = 0x00000001; |
| 1083 | pub const BRKINT: crate::tcflag_t = 0x00000002; |
| 1084 | pub const IGNCR: crate::tcflag_t = 0x00000200; |
| 1085 | pub const IGNPAR: crate::tcflag_t = 0x00000000; |
| 1086 | pub const INPCK: crate::tcflag_t = 0x00000020; |
| 1087 | pub const ISTRIP: crate::tcflag_t = 0x00000040; |
| 1088 | pub const INLCR: crate::tcflag_t = 0x00000100; |
| 1089 | pub const ISIG: crate::tcflag_t = 0x00000001; |
| 1090 | pub const IXOFF: crate::tcflag_t = 0x00010000; |
| 1091 | pub const IXON: crate::tcflag_t = 0x00002000; |
| 1092 | pub const PARMRK: crate::tcflag_t = 0x00000000; |
| 1093 | pub const NOFLSH: crate::tcflag_t = 0x00000000; |
| 1094 | pub const NCCS: usize = 20; |
| 1095 | |
| 1096 | pub const OPOST: crate::tcflag_t = 0x00000001; |
| 1097 | pub const ONLCR: crate::tcflag_t = 0x00000004; |
| 1098 | pub const ECHO: crate::tcflag_t = 0x00000010; |
| 1099 | pub const OCRNL: crate::tcflag_t = 0x00000010; |
| 1100 | pub const ECHOE: crate::tcflag_t = 0x00000020; |
| 1101 | pub const ECHOK: crate::tcflag_t = 0x00000040; |
| 1102 | pub const ECHONL: crate::tcflag_t = 0x00000100; |
| 1103 | |
| 1104 | // net/if.h |
| 1105 | pub const IFNAMSIZ: size_t = 16; |
| 1106 | pub const IF_NAMESIZE: size_t = IFNAMSIZ; |
| 1107 | |
| 1108 | // sioLibCommon.h |
| 1109 | pub const CLOCAL: crate::tcflag_t = 0x1; |
| 1110 | pub const CREAD: crate::tcflag_t = 0x2; |
| 1111 | pub const CS5: crate::tcflag_t = 0x0; |
| 1112 | pub const CS6: crate::tcflag_t = 0x4; |
| 1113 | pub const CS7: crate::tcflag_t = 0x8; |
| 1114 | pub const CS8: crate::tcflag_t = 0xc; |
| 1115 | pub const CSTOPB: crate::tcflag_t = 0x20; |
| 1116 | pub const CSIZE: crate::tcflag_t = 0xc; |
| 1117 | |
| 1118 | pub const PARODD: crate::tcflag_t = 0x80; |
| 1119 | pub const PARENB: crate::tcflag_t = 0x40; |
| 1120 | |
| 1121 | pub const DT_FIFO: c_uchar = 1; |
| 1122 | pub const DT_CHR: c_uchar = 2; |
| 1123 | pub const DT_DIR: c_uchar = 4; |
| 1124 | pub const DT_BLK: c_uchar = 6; |
| 1125 | pub const DT_REG: c_uchar = 8; |
| 1126 | pub const DT_LNK: c_uchar = 10; |
| 1127 | pub const DT_SOCK: c_uchar = 12; |
| 1128 | |
| 1129 | pub const FNM_NOMATCH: c_int = 1; |
| 1130 | pub const FNM_NOESCAPE: c_int = 1; |
| 1131 | pub const FNM_PATHNAME: c_int = 2; |
| 1132 | pub const FNM_PERIOD: c_int = 4; |
| 1133 | pub const FNM_CASEFOLD: c_int = 16; |
| 1134 | |
| 1135 | pub const F_OK: c_int = 0; |
| 1136 | pub const X_OK: c_int = 1; |
| 1137 | pub const W_OK: c_int = 2; |
| 1138 | |
| 1139 | pub const _PC_CHOWN_RESTRICTED: c_int = 4; |
| 1140 | pub const _PC_LINK_MAX: c_int = 6; |
| 1141 | pub const _PC_MAX_CANON: c_int = 7; |
| 1142 | pub const _PC_MAX_INPUT: c_int = 8; |
| 1143 | pub const _PC_NAME_MAX: c_int = 9; |
| 1144 | pub const _PC_NO_TRUNC: c_int = 10; |
| 1145 | pub const _PC_PATH_MAX: c_int = 11; |
| 1146 | pub const _PC_PIPE_BUF: c_int = 12; |
| 1147 | pub const _PC_VDISABLE: c_int = 20; |
| 1148 | |
| 1149 | pub const HUPCL: crate::tcflag_t = 0x10; |
| 1150 | |
| 1151 | pub const SHUT_RD: c_int = 0; |
| 1152 | pub const SHUT_WR: c_int = 1; |
| 1153 | pub const SHUT_RDWR: c_int = 2; |
| 1154 | |
| 1155 | pub const ICANON: crate::tcflag_t = 0x00000002; |
| 1156 | pub const ICRNL: crate::tcflag_t = 0x00000400; |
| 1157 | pub const IEXTEN: crate::tcflag_t = 0x00000000; |
| 1158 | |
| 1159 | pub const TCP_NODELAY: c_int = 1; |
| 1160 | pub const TCP_MAXSEG: c_int = 2; |
| 1161 | pub const TCP_NOPUSH: c_int = 3; |
| 1162 | pub const TCP_KEEPIDLE: c_int = 4; |
| 1163 | pub const TCP_KEEPINTVL: c_int = 5; |
| 1164 | pub const TCP_KEEPCNT: c_int = 6; |
| 1165 | |
| 1166 | pub const TCSANOW: c_int = 0; |
| 1167 | pub const TCSADRAIN: c_int = 1; |
| 1168 | pub const TCSAFLUSH: c_int = 2; |
| 1169 | |
| 1170 | // ioLib.h |
| 1171 | pub const FIONREAD: c_int = 0x40040001; |
| 1172 | pub const FIOFLUSH: c_int = 2; |
| 1173 | pub const FIOOPTIONS: c_int = 3; |
| 1174 | pub const FIOBAUDRATE: c_int = 4; |
| 1175 | pub const FIODISKFORMAT: c_int = 5; |
| 1176 | pub const FIODISKINIT: c_int = 6; |
| 1177 | pub const FIOSEEK: c_int = 7; |
| 1178 | pub const FIOWHERE: c_int = 8; |
| 1179 | pub const FIODIRENTRY: c_int = 9; |
| 1180 | pub const FIORENAME: c_int = 10; |
| 1181 | pub const FIOREADYCHANGE: c_int = 11; |
| 1182 | pub const FIODISKCHANGE: c_int = 13; |
| 1183 | pub const FIOCANCEL: c_int = 14; |
| 1184 | pub const FIOSQUEEZE: c_int = 15; |
| 1185 | pub const FIOGETNAME: c_int = 18; |
| 1186 | pub const FIONBIO: c_int = u32_cast_int(0x90040010); |
| 1187 | |
| 1188 | // limits.h |
| 1189 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1190 | /// for details. |
| 1191 | pub const PATH_MAX: c_int = _PARM_PATH_MAX; |
| 1192 | |
| 1193 | pub const _POSIX_PATH_MAX: c_int = 256; |
| 1194 | |
| 1195 | // Some poll stuff |
| 1196 | pub const POLLIN: c_short = 0x0001; |
| 1197 | pub const POLLPRI: c_short = 0x0002; |
| 1198 | pub const POLLOUT: c_short = 0x0004; |
| 1199 | pub const POLLRDNORM: c_short = 0x0040; |
| 1200 | pub const POLLWRNORM: c_short = POLLOUT; |
| 1201 | pub const POLLRDBAND: c_short = 0x0080; |
| 1202 | pub const POLLWRBAND: c_short = 0x0100; |
| 1203 | pub const POLLERR: c_short = 0x0008; |
| 1204 | pub const POLLHUP: c_short = 0x0010; |
| 1205 | pub const POLLNVAL: c_short = 0x0020; |
| 1206 | |
| 1207 | // fnctlcom.h |
| 1208 | pub const FD_CLOEXEC: c_int = 1; |
| 1209 | pub const F_DUPFD: c_int = 0; |
| 1210 | pub const F_GETFD: c_int = 1; |
| 1211 | pub const F_SETFD: c_int = 2; |
| 1212 | pub const F_GETFL: c_int = 3; |
| 1213 | pub const F_SETFL: c_int = 4; |
| 1214 | pub const F_GETOWN: c_int = 5; |
| 1215 | pub const F_SETOWN: c_int = 6; |
| 1216 | pub const F_GETLK: c_int = 7; |
| 1217 | pub const F_SETLK: c_int = 8; |
| 1218 | pub const F_SETLKW: c_int = 9; |
| 1219 | pub const F_DUPFD_CLOEXEC: c_int = 14; |
| 1220 | pub const F_RDLCK: c_int = 1; |
| 1221 | pub const F_WRLCK: c_int = 2; |
| 1222 | pub const F_UNLCK: c_int = 3; |
| 1223 | |
| 1224 | pub const LOG_EMERG: c_int = 0; |
| 1225 | pub const LOG_ALERT: c_int = 1; |
| 1226 | pub const LOG_CRIT: c_int = 2; |
| 1227 | pub const LOG_ERR: c_int = 3; |
| 1228 | pub const LOG_WARNING: c_int = 4; |
| 1229 | pub const LOG_NOTICE: c_int = 5; |
| 1230 | pub const LOG_INFO: c_int = 6; |
| 1231 | pub const LOG_DEBUG: c_int = 7; |
| 1232 | |
| 1233 | pub const LOG_KERN: c_int = 0 << 3; |
| 1234 | pub const LOG_USER: c_int = 1 << 3; |
| 1235 | pub const LOG_MAIL: c_int = 2 << 3; |
| 1236 | pub const LOG_DAEMON: c_int = 3 << 3; |
| 1237 | pub const LOG_AUTH: c_int = 4 << 3; |
| 1238 | pub const LOG_SYSLOG: c_int = 5 << 3; |
| 1239 | pub const LOG_LPR: c_int = 6 << 3; |
| 1240 | pub const LOG_NEWS: c_int = 7 << 3; |
| 1241 | pub const LOG_UUCP: c_int = 8 << 3; |
| 1242 | pub const LOG_LOCAL0: c_int = 16 << 3; |
| 1243 | pub const LOG_LOCAL1: c_int = 17 << 3; |
| 1244 | pub const LOG_LOCAL2: c_int = 18 << 3; |
| 1245 | pub const LOG_LOCAL3: c_int = 19 << 3; |
| 1246 | pub const LOG_LOCAL4: c_int = 20 << 3; |
| 1247 | pub const LOG_LOCAL5: c_int = 21 << 3; |
| 1248 | pub const LOG_LOCAL6: c_int = 22 << 3; |
| 1249 | pub const LOG_LOCAL7: c_int = 23 << 3; |
| 1250 | |
| 1251 | pub const LOG_PID: c_int = 0x01; |
| 1252 | pub const LOG_CONS: c_int = 0x02; |
| 1253 | pub const LOG_ODELAY: c_int = 0x04; |
| 1254 | pub const LOG_NDELAY: c_int = 0x08; |
| 1255 | pub const LOG_NOWAIT: c_int = 0x10; |
| 1256 | |
| 1257 | pub const LOG_PRIMASK: c_int = 0x7; |
| 1258 | pub const LOG_FACMASK: c_int = 0x3f8; |
| 1259 | |
| 1260 | // dlfcn.h |
| 1261 | pub const RTLD_LOCAL: c_int = 0; |
| 1262 | pub const RTLD_LAZY: c_int = 1; |
| 1263 | pub const RTLD_NOW: c_int = 2; |
| 1264 | pub const RTLD_GLOBAL: c_int = 256; |
| 1265 | |
| 1266 | // signal.h |
| 1267 | pub const SIG_DFL: sighandler_t = 0 as sighandler_t; |
| 1268 | pub const SIG_IGN: sighandler_t = 1 as sighandler_t; |
| 1269 | pub const SIG_ERR: sighandler_t = -1 as isize as sighandler_t; |
| 1270 | |
| 1271 | pub const SIGHUP: c_int = 1; |
| 1272 | pub const SIGINT: c_int = 2; |
| 1273 | pub const SIGQUIT: c_int = 3; |
| 1274 | pub const SIGILL: c_int = 4; |
| 1275 | pub const SIGTRAP: c_int = 5; |
| 1276 | pub const SIGABRT: c_int = 6; |
| 1277 | pub const SIGEMT: c_int = 7; |
| 1278 | pub const SIGFPE: c_int = 8; |
| 1279 | pub const SIGKILL: c_int = 9; |
| 1280 | pub const SIGBUS: c_int = 10; |
| 1281 | pub const SIGSEGV: c_int = 11; |
| 1282 | pub const SIGFMT: c_int = 12; |
| 1283 | pub const SIGPIPE: c_int = 13; |
| 1284 | pub const SIGALRM: c_int = 14; |
| 1285 | pub const SIGTERM: c_int = 15; |
| 1286 | pub const SIGCNCL: c_int = 16; |
| 1287 | pub const SIGSTOP: c_int = 17; |
| 1288 | pub const SIGTSTP: c_int = 18; |
| 1289 | pub const SIGCONT: c_int = 19; |
| 1290 | pub const SIGCHLD: c_int = 20; |
| 1291 | pub const SIGTTIN: c_int = 21; |
| 1292 | pub const SIGTTOU: c_int = 22; |
| 1293 | pub const SIGUSR1: c_int = 30; |
| 1294 | pub const SIGUSR2: c_int = 31; |
| 1295 | pub const SIGPOLL: c_int = 32; |
| 1296 | pub const SIGPROF: c_int = 33; |
| 1297 | pub const SIGSYS: c_int = 34; |
| 1298 | pub const SIGURG: c_int = 35; |
| 1299 | pub const SIGVTALRM: c_int = 36; |
| 1300 | pub const SIGXCPU: c_int = 37; |
| 1301 | pub const SIGXFSZ: c_int = 38; |
| 1302 | pub const SIGRTMIN: c_int = 48; |
| 1303 | |
| 1304 | pub const SIGIO: c_int = SIGRTMIN; |
| 1305 | pub const SIGWINCH: c_int = SIGRTMIN + 5; |
| 1306 | pub const SIGLOST: c_int = SIGRTMIN + 6; |
| 1307 | |
| 1308 | pub const SIG_BLOCK: c_int = 1; |
| 1309 | pub const SIG_UNBLOCK: c_int = 2; |
| 1310 | pub const SIG_SETMASK: c_int = 3; |
| 1311 | |
| 1312 | pub const SA_NOCLDSTOP: c_int = 0x0001; |
| 1313 | pub const SA_SIGINFO: c_int = 0x0002; |
| 1314 | pub const SA_ONSTACK: c_int = 0x0004; |
| 1315 | pub const SA_INTERRUPT: c_int = 0x0008; |
| 1316 | pub const SA_RESETHAND: c_int = 0x0010; |
| 1317 | pub const SA_RESTART: c_int = 0x0020; |
| 1318 | pub const SA_NODEFER: c_int = 0x0040; |
| 1319 | pub const SA_NOCLDWAIT: c_int = 0x0080; |
| 1320 | |
| 1321 | pub const SI_SYNC: c_int = 0; |
| 1322 | pub const SI_USER: c_int = -1; |
| 1323 | pub const SI_QUEUE: c_int = -2; |
| 1324 | pub const SI_TIMER: c_int = -3; |
| 1325 | pub const SI_ASYNCIO: c_int = -4; |
| 1326 | pub const SI_MESGQ: c_int = -5; |
| 1327 | pub const SI_CHILD: c_int = -6; |
| 1328 | pub const SI_KILL: c_int = SI_USER; |
| 1329 | |
| 1330 | pub const AT_FDCWD: c_int = -100; |
| 1331 | pub const AT_SYMLINK_NOFOLLOW: c_int = 0x100; |
| 1332 | pub const AT_REMOVEDIR: c_int = 0x200; |
| 1333 | pub const AT_SYMLINK_FOLLOW: c_int = 0x400; |
| 1334 | |
| 1335 | // vxParams.h definitions |
| 1336 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1337 | /// for details. |
| 1338 | pub const _PARM_NAME_MAX: c_int = 255; |
| 1339 | |
| 1340 | /// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines) |
| 1341 | /// for details. |
| 1342 | pub const _PARM_PATH_MAX: c_int = 1024; |
| 1343 | |
| 1344 | // WAIT STUFF |
| 1345 | pub const WNOHANG: c_int = 0x01; |
| 1346 | pub const WUNTRACED: c_int = 0x02; |
| 1347 | pub const WCONTINUED: c_int = 0x04; |
| 1348 | |
| 1349 | const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t = pthread_mutexattr_t { |
| 1350 | mutexAttrStatus: PTHREAD_INITIALIZED_OBJ, |
| 1351 | mutexAttrProtocol: PTHREAD_PRIO_NONE, |
| 1352 | mutexAttrPrioceiling: 0, |
| 1353 | mutexAttrType: PTHREAD_MUTEX_DEFAULT, |
| 1354 | mutexAttrPshared: 1, |
| 1355 | }; |
| 1356 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
| 1357 | mutexSemId: ptr::null_mut(), |
| 1358 | mutexValid: PTHREAD_VALID_OBJ, |
| 1359 | mutexInitted: PTHREAD_UNUSED_YET_OBJ, |
| 1360 | mutexCondRefCount: 0, |
| 1361 | mutexSavPriority: -1, |
| 1362 | mutexAttr: PTHREAD_MUTEXATTR_INITIALIZER, |
| 1363 | mutexSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX], |
| 1364 | }; |
| 1365 | |
| 1366 | const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t { |
| 1367 | condAttrStatus: u32_cast_int(0xf70990ef), |
| 1368 | condAttrPshared: 1, |
| 1369 | condAttrClockId: CLOCK_REALTIME, |
| 1370 | }; |
| 1371 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { |
| 1372 | condSemId: ptr::null_mut(), |
| 1373 | condValid: PTHREAD_VALID_OBJ, |
| 1374 | condInitted: PTHREAD_UNUSED_YET_OBJ, |
| 1375 | condRefCount: 0, |
| 1376 | condMutex: ptr::null_mut(), |
| 1377 | condAttr: PTHREAD_CONDATTR_INITIALIZER, |
| 1378 | condSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX], |
| 1379 | }; |
| 1380 | |
| 1381 | const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t = pthread_rwlockattr_t { |
| 1382 | rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ, |
| 1383 | rwlockAttrPshared: 1, |
| 1384 | rwlockAttrMaxReaders: 0, |
| 1385 | rwlockAttrConformOpt: 1, |
| 1386 | }; |
| 1387 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { |
| 1388 | rwlockSemId: ptr::null_mut(), |
| 1389 | rwlockReadersRefCount: 0, |
| 1390 | rwlockValid: PTHREAD_VALID_OBJ, |
| 1391 | rwlockInitted: PTHREAD_UNUSED_YET_OBJ, |
| 1392 | rwlockAttr: PTHREAD_RWLOCKATTR_INITIALIZER, |
| 1393 | rwlockSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX], |
| 1394 | }; |
| 1395 | |
| 1396 | pub const SEEK_SET: c_int = 0; |
| 1397 | pub const SEEK_CUR: c_int = 1; |
| 1398 | pub const SEEK_END: c_int = 2; |
| 1399 | |
| 1400 | // rtpLibCommon.h |
| 1401 | pub const VX_RTP_NAME_LENGTH: c_int = 255; |
| 1402 | pub const RTP_ID_ERROR: crate::RTP_ID = -1; |
| 1403 | |
| 1404 | // h/public/unistd.h |
| 1405 | // h/public/unistd.h |
| 1406 | pub const R_OK: c_int = 4; |
| 1407 | pub const _SC_ARG_MAX: c_int = 4; // Via unistd.h |
| 1408 | pub const _SC_CHILD_MAX: c_int = 12; |
| 1409 | pub const _SC_CLK_TCK: c_int = 13; |
| 1410 | pub const _SC_GETPW_R_SIZE_MAX: c_int = 21; |
| 1411 | pub const _SC_HOST_NAME_MAX: c_int = 22; |
| 1412 | pub const _SC_NGROUPS_MAX: c_int = 36; |
| 1413 | pub const _SC_OPEN_MAX: c_int = 37; |
| 1414 | pub const _SC_PAGE_SIZE: c_int = 38; |
| 1415 | pub const _SC_PAGESIZE: c_int = 39; |
| 1416 | pub const _SC_STREAM_MAX: c_int = 59; |
| 1417 | pub const _SC_SYMLOOP_MAX: c_int = 60; |
| 1418 | pub const _SC_TTY_NAME_MAX: c_int = 87; |
| 1419 | pub const _SC_TZNAME_MAX: c_int = 89; |
| 1420 | pub const _SC_VERSION: c_int = 94; |
| 1421 | pub const O_ACCMODE: c_int = 3; |
| 1422 | pub const O_CLOEXEC: c_int = 0x100000; // fcntlcom |
| 1423 | pub const O_EXCL: c_int = 0x0800; |
| 1424 | pub const O_CREAT: c_int = 0x0200; |
| 1425 | pub const O_SYNC: c_int = 0x2000; |
| 1426 | pub const O_ASYNC: c_int = 0x0040; |
| 1427 | pub const O_DSYNC: c_int = 0x10000; |
| 1428 | pub const O_TRUNC: c_int = 0x0400; |
| 1429 | pub const O_APPEND: c_int = 0x0008; |
| 1430 | pub const O_RDWR: c_int = 0x0002; |
| 1431 | pub const O_WRONLY: c_int = 0x0001; |
| 1432 | pub const O_RDONLY: c_int = 0; |
| 1433 | pub const O_NONBLOCK: c_int = 0x4000; |
| 1434 | |
| 1435 | // mman.h |
| 1436 | pub const PROT_NONE: c_int = 0x0000; |
| 1437 | pub const PROT_READ: c_int = 0x0001; |
| 1438 | pub const PROT_WRITE: c_int = 0x0002; |
| 1439 | pub const PROT_EXEC: c_int = 0x0004; |
| 1440 | |
| 1441 | pub const MAP_SHARED: c_int = 0x0001; |
| 1442 | pub const MAP_PRIVATE: c_int = 0x0002; |
| 1443 | pub const MAP_ANON: c_int = 0x0004; |
| 1444 | pub const MAP_ANONYMOUS: c_int = MAP_ANON; |
| 1445 | pub const MAP_FIXED: c_int = 0x0010; |
| 1446 | pub const MAP_CONTIG: c_int = 0x0020; |
| 1447 | |
| 1448 | pub const MS_SYNC: c_int = 0x0001; |
| 1449 | pub const MS_ASYNC: c_int = 0x0002; |
| 1450 | pub const MS_INVALIDATE: c_int = 0x0004; |
| 1451 | |
| 1452 | pub const MAP_FAILED: *mut c_void = !0 as *mut c_void; |
| 1453 | |
| 1454 | // sys/ttycom.h |
| 1455 | pub const TIOCGWINSZ: i64 = 0x1740087468; |
| 1456 | pub const TIOCSWINSZ: c_int = -0x7ff78b99; |
| 1457 | |
| 1458 | extern_ty! { |
| 1459 | pub type FILE; |
| 1460 | pub type fpos_t; // FIXME(vxworks): fill this out with a struct |
| 1461 | } |
| 1462 | |
| 1463 | f! { |
| 1464 | pub const unsafe fn CMSG_ALIGN(len: usize) -> usize { |
| 1465 | len + size_of::<usize>() - 1 & !(size_of::<usize>() - 1) |
| 1466 | } |
| 1467 | |
| 1468 | pub unsafe fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { |
| 1469 | let next = cmsg as usize |
| 1470 | + CMSG_ALIGN((*cmsg).cmsg_len as usize) |
| 1471 | + CMSG_ALIGN(size_of::<cmsghdr>()); |
| 1472 | let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; |
| 1473 | if next <= max { |
| 1474 | (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr |
| 1475 | } else { |
| 1476 | ptr::null_mut() |
| 1477 | } |
| 1478 | } |
| 1479 | |
| 1480 | pub unsafe fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { |
| 1481 | if (*mhdr).msg_controllen as usize > 0 { |
| 1482 | (*mhdr).msg_control.cast() |
| 1483 | } else { |
| 1484 | ptr::null_mut() |
| 1485 | } |
| 1486 | } |
| 1487 | |
| 1488 | pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { |
| 1489 | (cmsg as *mut c_uchar).offset(CMSG_ALIGN(size_of::<cmsghdr>()) as isize) |
| 1490 | } |
| 1491 | |
| 1492 | pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint { |
| 1493 | (CMSG_ALIGN(length as usize) + CMSG_ALIGN(size_of::<cmsghdr>())) as c_uint |
| 1494 | } |
| 1495 | |
| 1496 | pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint { |
| 1497 | CMSG_ALIGN(size_of::<cmsghdr>()) as c_uint + length |
| 1498 | } |
| 1499 | } |
| 1500 | |
| 1501 | extern "C" { |
| 1502 | pub fn isalnum(c: c_int) -> c_int; |
| 1503 | pub fn isalpha(c: c_int) -> c_int; |
| 1504 | pub fn iscntrl(c: c_int) -> c_int; |
| 1505 | pub fn isdigit(c: c_int) -> c_int; |
| 1506 | pub fn isgraph(c: c_int) -> c_int; |
| 1507 | pub fn islower(c: c_int) -> c_int; |
| 1508 | pub fn isprint(c: c_int) -> c_int; |
| 1509 | pub fn ispunct(c: c_int) -> c_int; |
| 1510 | pub fn isspace(c: c_int) -> c_int; |
| 1511 | pub fn isupper(c: c_int) -> c_int; |
| 1512 | pub fn isxdigit(c: c_int) -> c_int; |
| 1513 | pub fn isblank(c: c_int) -> c_int; |
| 1514 | pub fn tolower(c: c_int) -> c_int; |
| 1515 | pub fn toupper(c: c_int) -> c_int; |
| 1516 | pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; |
| 1517 | pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; |
| 1518 | pub fn fflush(file: *mut FILE) -> c_int; |
| 1519 | pub fn fclose(file: *mut FILE) -> c_int; |
| 1520 | pub fn remove(filename: *const c_char) -> c_int; |
| 1521 | pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; |
| 1522 | pub fn tmpfile() -> *mut FILE; |
| 1523 | pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; |
| 1524 | pub fn setbuf(stream: *mut FILE, buf: *mut c_char); |
| 1525 | pub fn getchar() -> c_int; |
| 1526 | pub fn putchar(c: c_int) -> c_int; |
| 1527 | pub fn fgetc(stream: *mut FILE) -> c_int; |
| 1528 | pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; |
| 1529 | pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; |
| 1530 | pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; |
| 1531 | pub fn puts(s: *const c_char) -> c_int; |
| 1532 | pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; |
| 1533 | pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; |
| 1534 | pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; |
| 1535 | pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; |
| 1536 | pub fn ftell(stream: *mut FILE) -> c_long; |
| 1537 | pub fn rewind(stream: *mut FILE); |
| 1538 | pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; |
| 1539 | pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; |
| 1540 | pub fn feof(stream: *mut FILE) -> c_int; |
| 1541 | pub fn ferror(stream: *mut FILE) -> c_int; |
| 1542 | pub fn perror(s: *const c_char); |
| 1543 | pub fn atof(s: *const c_char) -> c_double; |
| 1544 | pub fn atoi(s: *const c_char) -> c_int; |
| 1545 | pub fn atol(s: *const c_char) -> c_long; |
| 1546 | pub fn atoll(s: *const c_char) -> c_longlong; |
| 1547 | pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; |
| 1548 | pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; |
| 1549 | pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; |
| 1550 | pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; |
| 1551 | pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; |
| 1552 | pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; |
| 1553 | pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; |
| 1554 | pub fn malloc(size: size_t) -> *mut c_void; |
| 1555 | pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; |
| 1556 | pub fn free(p: *mut c_void); |
| 1557 | pub fn abort() -> !; |
| 1558 | pub fn exit(status: c_int) -> !; |
| 1559 | pub fn atexit(cb: extern "C" fn()) -> c_int; |
| 1560 | pub fn system(s: *const c_char) -> c_int; |
| 1561 | pub fn getenv(s: *const c_char) -> *mut c_char; |
| 1562 | |
| 1563 | pub fn cfgetospeed(termios: *const crate::termios) -> crate::speed_t; |
| 1564 | pub fn cfmakeraw(termios: *mut crate::termios) -> c_int; |
| 1565 | pub fn cfsetispeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int; |
| 1566 | pub fn cfsetospeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int; |
| 1567 | pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; |
| 1568 | pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; |
| 1569 | pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; |
| 1570 | pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; |
| 1571 | pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; |
| 1572 | pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; |
| 1573 | pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; |
| 1574 | pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; |
| 1575 | pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; |
| 1576 | pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; |
| 1577 | pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; |
| 1578 | pub fn strdup(cs: *const c_char) -> *mut c_char; |
| 1579 | pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
| 1580 | pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
| 1581 | pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; |
| 1582 | pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int; |
| 1583 | pub fn strlen(cs: *const c_char) -> size_t; |
| 1584 | pub fn strnlen(cs: *const c_char, n: size_t) -> size_t; |
| 1585 | pub fn strerror(n: c_int) -> *mut c_char; |
| 1586 | pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; |
| 1587 | pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; |
| 1588 | pub fn wcslen(buf: *const wchar_t) -> size_t; |
| 1589 | pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t; |
| 1590 | |
| 1591 | pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
| 1592 | pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; |
| 1593 | pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; |
| 1594 | pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
| 1595 | pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
| 1596 | pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
| 1597 | pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; |
| 1598 | |
| 1599 | pub fn aligned_alloc(alignment: size_t, size: size_t) -> *mut c_void; |
| 1600 | pub fn uname(buf: *mut crate::utsname) -> c_int; |
| 1601 | pub fn times(buf: *mut crate::tms) -> crate::clock_t; |
| 1602 | pub fn tcflush(fd: c_int, action: c_int) -> c_int; |
| 1603 | pub fn pclose(stream: *mut crate::FILE) -> c_int; |
| 1604 | pub fn mkdtemp(template: *mut c_char) -> *mut c_char; |
| 1605 | |
| 1606 | pub fn linkat( |
| 1607 | olddirfd: c_int, |
| 1608 | oldpath: *const c_char, |
| 1609 | newdirfd: c_int, |
| 1610 | newpath: *const c_char, |
| 1611 | flags: c_int, |
| 1612 | ) -> c_int; |
| 1613 | |
| 1614 | pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; |
| 1615 | |
| 1616 | pub fn readlinkat( |
| 1617 | dirfd: c_int, |
| 1618 | pathname: *const c_char, |
| 1619 | buf: *mut c_char, |
| 1620 | bufsiz: size_t, |
| 1621 | ) -> ssize_t; |
| 1622 | |
| 1623 | pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int; |
| 1624 | |
| 1625 | // netdb.h |
| 1626 | pub fn getprotobyname(name: *const c_char) -> *mut protoent; |
| 1627 | pub fn getprotobynumber(proto: c_int) -> *mut protoent; |
| 1628 | pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent; |
| 1629 | |
| 1630 | pub fn fchownat( |
| 1631 | dirfd: c_int, |
| 1632 | pathname: *const c_char, |
| 1633 | owner: crate::uid_t, |
| 1634 | group: crate::gid_t, |
| 1635 | flags: c_int, |
| 1636 | ) -> c_int; |
| 1637 | } |
| 1638 | |
| 1639 | extern "C" { |
| 1640 | pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int; |
| 1641 | pub fn printf(format: *const c_char, ...) -> c_int; |
| 1642 | pub fn snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int; |
| 1643 | pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int; |
| 1644 | pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int; |
| 1645 | pub fn scanf(format: *const c_char, ...) -> c_int; |
| 1646 | pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int; |
| 1647 | pub fn getchar_unlocked() -> c_int; |
| 1648 | pub fn putchar_unlocked(c: c_int) -> c_int; |
| 1649 | pub fn stat(path: *const c_char, buf: *mut stat) -> c_int; |
| 1650 | pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE; |
| 1651 | pub fn fileno(stream: *mut crate::FILE) -> c_int; |
| 1652 | pub fn creat(path: *const c_char, mode: mode_t) -> c_int; |
| 1653 | pub fn rewinddir(dirp: *mut crate::DIR); |
| 1654 | pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int; |
| 1655 | pub fn access(path: *const c_char, amode: c_int) -> c_int; |
| 1656 | pub fn alarm(seconds: c_uint) -> c_uint; |
| 1657 | pub fn fchdir(dirfd: c_int) -> c_int; |
| 1658 | pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int; |
| 1659 | pub fn fpathconf(filedes: c_int, name: c_int) -> c_long; |
| 1660 | pub fn getegid() -> gid_t; |
| 1661 | pub fn geteuid() -> uid_t; |
| 1662 | pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int; |
| 1663 | pub fn getlogin() -> *mut c_char; |
| 1664 | pub fn getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int; |
| 1665 | pub fn pathconf(path: *const c_char, name: c_int) -> c_long; |
| 1666 | pub fn pause() -> c_int; |
| 1667 | pub fn seteuid(uid: uid_t) -> c_int; |
| 1668 | pub fn setegid(gid: gid_t) -> c_int; |
| 1669 | pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; |
| 1670 | pub fn sleep(secs: c_uint) -> c_uint; |
| 1671 | pub fn ttyname(fd: c_int) -> *mut c_char; |
| 1672 | pub fn wait(status: *mut c_int) -> pid_t; |
| 1673 | pub fn umask(mask: mode_t) -> mode_t; |
| 1674 | pub fn mlock(addr: *const c_void, len: size_t) -> c_int; |
| 1675 | pub fn mlockall(flags: c_int) -> c_int; |
| 1676 | pub fn munlock(addr: *const c_void, len: size_t) -> c_int; |
| 1677 | pub fn munlockall() -> c_int; |
| 1678 | |
| 1679 | pub fn mmap( |
| 1680 | addr: *mut c_void, |
| 1681 | len: size_t, |
| 1682 | prot: c_int, |
| 1683 | flags: c_int, |
| 1684 | fd: c_int, |
| 1685 | offset: off_t, |
| 1686 | ) -> *mut c_void; |
| 1687 | pub fn munmap(addr: *mut c_void, len: size_t) -> c_int; |
| 1688 | |
| 1689 | pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; |
| 1690 | pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; |
| 1691 | |
| 1692 | pub fn truncate(path: *const c_char, length: off_t) -> c_int; |
| 1693 | pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int; |
| 1694 | pub fn shm_unlink(name: *const c_char) -> c_int; |
| 1695 | |
| 1696 | pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int; |
| 1697 | pub fn pthread_exit(value: *mut c_void) -> !; |
| 1698 | pub fn pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int; |
| 1699 | pub fn pthread_equal(t1: crate::pthread_t, t2: crate::pthread_t) -> c_int; |
| 1700 | |
| 1701 | pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; |
| 1702 | |
| 1703 | pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int; |
| 1704 | |
| 1705 | pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction) -> c_int; |
| 1706 | |
| 1707 | pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int; |
| 1708 | |
| 1709 | pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; |
| 1710 | |
| 1711 | pub fn utimensat( |
| 1712 | dirfd: c_int, |
| 1713 | path: *const c_char, |
| 1714 | times: *const crate::timespec, |
| 1715 | flag: c_int, |
| 1716 | ) -> c_int; |
| 1717 | |
| 1718 | #[link_name = "_rtld_dlopen"] |
| 1719 | pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void; |
| 1720 | |
| 1721 | #[link_name = "_rtld_dlerror"] |
| 1722 | pub fn dlerror() -> *mut c_char; |
| 1723 | |
| 1724 | #[link_name = "_rtld_dlsym"] |
| 1725 | pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void; |
| 1726 | |
| 1727 | #[link_name = "_rtld_dlclose"] |
| 1728 | pub fn dlclose(handle: *mut c_void) -> c_int; |
| 1729 | |
| 1730 | #[link_name = "_rtld_dladdr"] |
| 1731 | pub fn dladdr(addr: *mut c_void, info: *mut Dl_info) -> c_int; |
| 1732 | |
| 1733 | // time.h |
| 1734 | pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
| 1735 | pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
| 1736 | pub fn mktime(tm: *mut tm) -> time_t; |
| 1737 | pub fn time(time: *mut time_t) -> time_t; |
| 1738 | pub fn gmtime(time_p: *const time_t) -> *mut tm; |
| 1739 | pub fn localtime(time_p: *const time_t) -> *mut tm; |
| 1740 | pub fn timegm(tm: *mut tm) -> time_t; |
| 1741 | pub fn difftime(time1: time_t, time0: time_t) -> c_double; |
| 1742 | pub fn gethostname(name: *mut c_char, len: size_t) -> c_int; |
| 1743 | pub fn usleep(secs: crate::useconds_t) -> c_int; |
| 1744 | pub fn putenv(string: *mut c_char) -> c_int; |
| 1745 | pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char; |
| 1746 | pub fn localeconv() -> *mut lconv; |
| 1747 | |
| 1748 | pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int; |
| 1749 | pub fn sigpending(set: *mut sigset_t) -> c_int; |
| 1750 | |
| 1751 | pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int; |
| 1752 | |
| 1753 | pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int; |
| 1754 | pub fn ftello(stream: *mut crate::FILE) -> off_t; |
| 1755 | pub fn mkstemp(template: *mut c_char) -> c_int; |
| 1756 | |
| 1757 | pub fn tmpnam(ptr: *mut c_char) -> *mut c_char; |
| 1758 | |
| 1759 | pub fn openlog(ident: *const c_char, logopt: c_int, facility: c_int); |
| 1760 | pub fn closelog(); |
| 1761 | pub fn setlogmask(maskpri: c_int) -> c_int; |
| 1762 | pub fn syslog(priority: c_int, message: *const c_char, ...); |
| 1763 | pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; |
| 1764 | pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *const crate::termios) -> c_int; |
| 1765 | pub fn tcgetattr(fd: c_int, termios: *mut crate::termios) -> c_int; |
| 1766 | pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int; |
| 1767 | pub fn confstr(name: c_int, buf: *mut c_char, len: size_t) -> size_t; |
| 1768 | pub fn fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int; |
| 1769 | |
| 1770 | pub fn symlinkat(target: *const c_char, newdirfd: c_int, linkpath: *const c_char) -> c_int; |
| 1771 | |
| 1772 | // sys/stat.h |
| 1773 | pub fn fchmodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, flags: c_int) -> c_int; |
| 1774 | |
| 1775 | // utime.h |
| 1776 | pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int; |
| 1777 | } |
| 1778 | |
| 1779 | extern "C" { |
| 1780 | // stdlib.h |
| 1781 | pub fn memalign(block_size: size_t, size_arg: size_t) -> *mut c_void; |
| 1782 | |
| 1783 | // ioLib.h |
| 1784 | pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char; |
| 1785 | |
| 1786 | // ioLib.h |
| 1787 | pub fn chdir(attr: *const c_char) -> c_int; |
| 1788 | |
| 1789 | // pthread.h |
| 1790 | pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int; |
| 1791 | |
| 1792 | // pthread.h |
| 1793 | pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int; |
| 1794 | |
| 1795 | // pthread.h |
| 1796 | pub fn pthread_mutexattr_settype(pAttr: *mut crate::pthread_mutexattr_t, pType: c_int) |
| 1797 | -> c_int; |
| 1798 | |
| 1799 | // pthread.h |
| 1800 | pub fn pthread_mutex_init( |
| 1801 | mutex: *mut pthread_mutex_t, |
| 1802 | attr: *const pthread_mutexattr_t, |
| 1803 | ) -> c_int; |
| 1804 | |
| 1805 | // pthread.h |
| 1806 | pub fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> c_int; |
| 1807 | |
| 1808 | // pthread.h |
| 1809 | pub fn pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> c_int; |
| 1810 | |
| 1811 | // pthread.h |
| 1812 | pub fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> c_int; |
| 1813 | |
| 1814 | // pthread.h |
| 1815 | pub fn pthread_mutex_timedlock(attr: *mut pthread_mutex_t, spec: *const timespec) -> c_int; |
| 1816 | |
| 1817 | // pthread.h |
| 1818 | pub fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> c_int; |
| 1819 | |
| 1820 | // pthread.h |
| 1821 | pub fn pthread_attr_setname(pAttr: *mut crate::pthread_attr_t, name: *mut c_char) -> c_int; |
| 1822 | |
| 1823 | // pthread.h |
| 1824 | pub fn pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stacksize: size_t) -> c_int; |
| 1825 | |
| 1826 | // pthread.h |
| 1827 | pub fn pthread_attr_getstacksize( |
| 1828 | attr: *const crate::pthread_attr_t, |
| 1829 | size: *mut size_t, |
| 1830 | ) -> c_int; |
| 1831 | |
| 1832 | // pthread.h |
| 1833 | pub fn pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int; |
| 1834 | |
| 1835 | // pthread.h |
| 1836 | pub fn pthread_create( |
| 1837 | pThread: *mut crate::pthread_t, |
| 1838 | pAttr: *const crate::pthread_attr_t, |
| 1839 | start_routine: extern "C" fn(*mut c_void) -> *mut c_void, |
| 1840 | value: *mut c_void, |
| 1841 | ) -> c_int; |
| 1842 | |
| 1843 | //pthread.h |
| 1844 | pub fn pthread_setschedparam( |
| 1845 | native: crate::pthread_t, |
| 1846 | policy: c_int, |
| 1847 | param: *const crate::sched_param, |
| 1848 | ) -> c_int; |
| 1849 | |
| 1850 | //pthread.h |
| 1851 | pub fn pthread_getschedparam( |
| 1852 | native: crate::pthread_t, |
| 1853 | policy: *mut c_int, |
| 1854 | param: *mut crate::sched_param, |
| 1855 | ) -> c_int; |
| 1856 | |
| 1857 | //pthread.h |
| 1858 | pub fn pthread_attr_setinheritsched( |
| 1859 | attr: *mut crate::pthread_attr_t, |
| 1860 | inheritsched: c_int, |
| 1861 | ) -> c_int; |
| 1862 | |
| 1863 | //pthread.h |
| 1864 | pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int; |
| 1865 | |
| 1866 | // pthread.h |
| 1867 | pub fn pthread_attr_destroy(thread: *mut crate::pthread_attr_t) -> c_int; |
| 1868 | |
| 1869 | // pthread.h |
| 1870 | pub fn pthread_detach(thread: crate::pthread_t) -> c_int; |
| 1871 | |
| 1872 | // int pthread_atfork (void (*)(void), void (*)(void), void (*)(void)); |
| 1873 | pub fn pthread_atfork( |
| 1874 | prepare: Option<unsafe extern "C" fn()>, |
| 1875 | parent: Option<unsafe extern "C" fn()>, |
| 1876 | child: Option<unsafe extern "C" fn()>, |
| 1877 | ) -> c_int; |
| 1878 | |
| 1879 | // stat.h |
| 1880 | pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; |
| 1881 | |
| 1882 | // sys/statfs.h |
| 1883 | pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; |
| 1884 | |
| 1885 | // stat.h |
| 1886 | pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int; |
| 1887 | |
| 1888 | // unistd.h |
| 1889 | pub fn ftruncate(fd: c_int, length: off_t) -> c_int; |
| 1890 | |
| 1891 | // dirent.h |
| 1892 | pub fn readdir_r( |
| 1893 | pDir: *mut crate::DIR, |
| 1894 | entry: *mut crate::dirent, |
| 1895 | result: *mut *mut crate::dirent, |
| 1896 | ) -> c_int; |
| 1897 | |
| 1898 | // dirent.h |
| 1899 | pub fn readdir(pDir: *mut crate::DIR) -> *mut crate::dirent; |
| 1900 | |
| 1901 | // dirent.h |
| 1902 | pub fn fdopendir(fd: c_int) -> *mut crate::DIR; |
| 1903 | |
| 1904 | // dirent.h |
| 1905 | pub fn dirfd(dirp: *mut crate::DIR) -> c_int; |
| 1906 | |
| 1907 | // fcntl.h or |
| 1908 | // ioLib.h |
| 1909 | pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int; |
| 1910 | |
| 1911 | // fcntl.h |
| 1912 | pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int; |
| 1913 | |
| 1914 | // poll.h |
| 1915 | pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int; |
| 1916 | |
| 1917 | // pthread.h |
| 1918 | pub fn pthread_condattr_init(attr: *mut crate::pthread_condattr_t) -> c_int; |
| 1919 | |
| 1920 | // pthread.h |
| 1921 | pub fn pthread_condattr_destroy(attr: *mut crate::pthread_condattr_t) -> c_int; |
| 1922 | |
| 1923 | // pthread.h |
| 1924 | pub fn pthread_condattr_getclock( |
| 1925 | pAttr: *const crate::pthread_condattr_t, |
| 1926 | pClockId: *mut crate::clockid_t, |
| 1927 | ) -> c_int; |
| 1928 | |
| 1929 | // pthread.h |
| 1930 | pub fn pthread_condattr_setclock( |
| 1931 | pAttr: *mut crate::pthread_condattr_t, |
| 1932 | clockId: crate::clockid_t, |
| 1933 | ) -> c_int; |
| 1934 | |
| 1935 | // pthread.h |
| 1936 | pub fn pthread_cond_init( |
| 1937 | cond: *mut crate::pthread_cond_t, |
| 1938 | attr: *const crate::pthread_condattr_t, |
| 1939 | ) -> c_int; |
| 1940 | |
| 1941 | // pthread.h |
| 1942 | pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int; |
| 1943 | |
| 1944 | // pthread.h |
| 1945 | pub fn pthread_cond_signal(cond: *mut crate::pthread_cond_t) -> c_int; |
| 1946 | |
| 1947 | // pthread.h |
| 1948 | pub fn pthread_cond_broadcast(cond: *mut crate::pthread_cond_t) -> c_int; |
| 1949 | |
| 1950 | // pthread.h |
| 1951 | pub fn pthread_cond_wait( |
| 1952 | cond: *mut crate::pthread_cond_t, |
| 1953 | mutex: *mut crate::pthread_mutex_t, |
| 1954 | ) -> c_int; |
| 1955 | |
| 1956 | // pthread.h |
| 1957 | pub fn pthread_rwlockattr_init(attr: *mut crate::pthread_rwlockattr_t) -> c_int; |
| 1958 | |
| 1959 | // pthread.h |
| 1960 | pub fn pthread_rwlockattr_destroy(attr: *mut crate::pthread_rwlockattr_t) -> c_int; |
| 1961 | |
| 1962 | // pthread.h |
| 1963 | pub fn pthread_rwlockattr_setmaxreaders( |
| 1964 | attr: *mut crate::pthread_rwlockattr_t, |
| 1965 | attr2: c_uint, |
| 1966 | ) -> c_int; |
| 1967 | |
| 1968 | // pthread.h |
| 1969 | pub fn pthread_rwlock_init( |
| 1970 | attr: *mut crate::pthread_rwlock_t, |
| 1971 | host: *const crate::pthread_rwlockattr_t, |
| 1972 | ) -> c_int; |
| 1973 | |
| 1974 | // pthread.h |
| 1975 | pub fn pthread_rwlock_destroy(attr: *mut crate::pthread_rwlock_t) -> c_int; |
| 1976 | |
| 1977 | // pthread.h |
| 1978 | pub fn pthread_rwlock_rdlock(attr: *mut crate::pthread_rwlock_t) -> c_int; |
| 1979 | |
| 1980 | // pthread.h |
| 1981 | pub fn pthread_rwlock_tryrdlock(attr: *mut crate::pthread_rwlock_t) -> c_int; |
| 1982 | |
| 1983 | // pthread.h |
| 1984 | pub fn pthread_rwlock_timedrdlock( |
| 1985 | attr: *mut crate::pthread_rwlock_t, |
| 1986 | host: *const crate::timespec, |
| 1987 | ) -> c_int; |
| 1988 | |
| 1989 | // pthread.h |
| 1990 | pub fn pthread_rwlock_wrlock(attr: *mut crate::pthread_rwlock_t) -> c_int; |
| 1991 | |
| 1992 | // pthread.h |
| 1993 | pub fn pthread_rwlock_trywrlock(attr: *mut crate::pthread_rwlock_t) -> c_int; |
| 1994 | |
| 1995 | // pthread.h |
| 1996 | pub fn pthread_rwlock_timedwrlock( |
| 1997 | attr: *mut crate::pthread_rwlock_t, |
| 1998 | host: *const crate::timespec, |
| 1999 | ) -> c_int; |
| 2000 | |
| 2001 | // pthread.h |
| 2002 | pub fn pthread_rwlock_unlock(attr: *mut crate::pthread_rwlock_t) -> c_int; |
| 2003 | |
| 2004 | // pthread.h |
| 2005 | pub fn pthread_key_create( |
| 2006 | key: *mut crate::pthread_key_t, |
| 2007 | dtor: Option<unsafe extern "C" fn(*mut c_void)>, |
| 2008 | ) -> c_int; |
| 2009 | |
| 2010 | // pthread.h |
| 2011 | pub fn pthread_key_delete(key: crate::pthread_key_t) -> c_int; |
| 2012 | |
| 2013 | // pthread.h |
| 2014 | pub fn pthread_setspecific(key: crate::pthread_key_t, value: *const c_void) -> c_int; |
| 2015 | |
| 2016 | // pthread.h |
| 2017 | pub fn pthread_getspecific(key: crate::pthread_key_t) -> *mut c_void; |
| 2018 | |
| 2019 | // pthread.h |
| 2020 | pub fn pthread_cond_timedwait( |
| 2021 | cond: *mut crate::pthread_cond_t, |
| 2022 | mutex: *mut crate::pthread_mutex_t, |
| 2023 | abstime: *const crate::timespec, |
| 2024 | ) -> c_int; |
| 2025 | |
| 2026 | // pthread.h |
| 2027 | pub fn pthread_attr_getname(attr: *mut crate::pthread_attr_t, name: *mut *mut c_char) -> c_int; |
| 2028 | |
| 2029 | // pthread.h |
| 2030 | pub fn pthread_join(thread: crate::pthread_t, status: *mut *mut c_void) -> c_int; |
| 2031 | |
| 2032 | // pthread.h |
| 2033 | pub fn pthread_self() -> crate::pthread_t; |
| 2034 | |
| 2035 | // clockLib.h |
| 2036 | pub fn clock_gettime(clock_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int; |
| 2037 | |
| 2038 | // clockLib.h |
| 2039 | pub fn clock_settime(clock_id: crate::clockid_t, tp: *const crate::timespec) -> c_int; |
| 2040 | |
| 2041 | // clockLib.h |
| 2042 | pub fn clock_getres(clock_id: crate::clockid_t, res: *mut crate::timespec) -> c_int; |
| 2043 | |
| 2044 | // clockLib.h |
| 2045 | pub fn clock_nanosleep( |
| 2046 | clock_id: crate::clockid_t, |
| 2047 | flags: c_int, |
| 2048 | rqtp: *const crate::timespec, |
| 2049 | rmtp: *mut crate::timespec, |
| 2050 | ) -> c_int; |
| 2051 | |
| 2052 | // timerLib.h |
| 2053 | pub fn nanosleep(rqtp: *const crate::timespec, rmtp: *mut crate::timespec) -> c_int; |
| 2054 | |
| 2055 | // socket.h |
| 2056 | pub fn accept(s: c_int, addr: *mut crate::sockaddr, addrlen: *mut crate::socklen_t) -> c_int; |
| 2057 | |
| 2058 | // socket.h |
| 2059 | pub fn bind(fd: c_int, addr: *const sockaddr, len: socklen_t) -> c_int; |
| 2060 | |
| 2061 | // socket.h |
| 2062 | pub fn connect(s: c_int, name: *const crate::sockaddr, namelen: crate::socklen_t) -> c_int; |
| 2063 | |
| 2064 | // socket.h |
| 2065 | pub fn getpeername( |
| 2066 | s: c_int, |
| 2067 | name: *mut crate::sockaddr, |
| 2068 | namelen: *mut crate::socklen_t, |
| 2069 | ) -> c_int; |
| 2070 | |
| 2071 | // socket.h |
| 2072 | pub fn getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) |
| 2073 | -> c_int; |
| 2074 | |
| 2075 | // socket.h |
| 2076 | pub fn getsockopt( |
| 2077 | sockfd: c_int, |
| 2078 | level: c_int, |
| 2079 | optname: c_int, |
| 2080 | optval: *mut c_void, |
| 2081 | optlen: *mut crate::socklen_t, |
| 2082 | ) -> c_int; |
| 2083 | |
| 2084 | // socket.h |
| 2085 | pub fn listen(socket: c_int, backlog: c_int) -> c_int; |
| 2086 | |
| 2087 | // socket.h |
| 2088 | pub fn recv(s: c_int, buf: *mut c_void, bufLen: size_t, flags: c_int) -> ssize_t; |
| 2089 | |
| 2090 | // socket.h |
| 2091 | pub fn recvfrom( |
| 2092 | s: c_int, |
| 2093 | buf: *mut c_void, |
| 2094 | bufLen: size_t, |
| 2095 | flags: c_int, |
| 2096 | from: *mut crate::sockaddr, |
| 2097 | pFromLen: *mut crate::socklen_t, |
| 2098 | ) -> ssize_t; |
| 2099 | |
| 2100 | pub fn recvmsg(socket: c_int, mp: *mut crate::msghdr, flags: c_int) -> ssize_t; |
| 2101 | |
| 2102 | // socket.h |
| 2103 | pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t; |
| 2104 | |
| 2105 | pub fn sendmsg(socket: c_int, mp: *const crate::msghdr, flags: c_int) -> ssize_t; |
| 2106 | |
| 2107 | // socket.h |
| 2108 | pub fn sendto( |
| 2109 | socket: c_int, |
| 2110 | buf: *const c_void, |
| 2111 | len: size_t, |
| 2112 | flags: c_int, |
| 2113 | addr: *const sockaddr, |
| 2114 | addrlen: socklen_t, |
| 2115 | ) -> ssize_t; |
| 2116 | |
| 2117 | // socket.h |
| 2118 | pub fn setsockopt( |
| 2119 | socket: c_int, |
| 2120 | level: c_int, |
| 2121 | name: c_int, |
| 2122 | value: *const c_void, |
| 2123 | option_len: socklen_t, |
| 2124 | ) -> c_int; |
| 2125 | |
| 2126 | // socket.h |
| 2127 | pub fn shutdown(s: c_int, how: c_int) -> c_int; |
| 2128 | |
| 2129 | // socket.h |
| 2130 | pub fn socket(domain: c_int, _type: c_int, protocol: c_int) -> c_int; |
| 2131 | |
| 2132 | // icotl.h |
| 2133 | pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int; |
| 2134 | |
| 2135 | // fcntl.h |
| 2136 | pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int; |
| 2137 | |
| 2138 | // ntp_rfc2553.h for kernel |
| 2139 | // netdb.h for user |
| 2140 | pub fn gai_strerror(errcode: c_int) -> *mut c_char; |
| 2141 | |
| 2142 | // ioLib.h or |
| 2143 | // unistd.h |
| 2144 | pub fn close(fd: c_int) -> c_int; |
| 2145 | |
| 2146 | // ioLib.h or |
| 2147 | // unistd.h |
| 2148 | pub fn read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t; |
| 2149 | |
| 2150 | // ioLib.h or |
| 2151 | // unistd.h |
| 2152 | pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; |
| 2153 | |
| 2154 | // ioLib.h or |
| 2155 | // unistd.h |
| 2156 | pub fn isatty(fd: c_int) -> c_int; |
| 2157 | |
| 2158 | // ioLib.h or |
| 2159 | // unistd.h |
| 2160 | pub fn dup(src: c_int) -> c_int; |
| 2161 | |
| 2162 | // ioLib.h or |
| 2163 | // unistd.h |
| 2164 | pub fn dup2(src: c_int, dst: c_int) -> c_int; |
| 2165 | |
| 2166 | // ioLib.h or |
| 2167 | // unistd.h |
| 2168 | pub fn pipe(fds: *mut c_int) -> c_int; |
| 2169 | |
| 2170 | // ioLib.h or |
| 2171 | // unistd.h |
| 2172 | pub fn unlink(pathname: *const c_char) -> c_int; |
| 2173 | |
| 2174 | // unistd.h and |
| 2175 | // ioLib.h |
| 2176 | pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t; |
| 2177 | |
| 2178 | // netdb.h |
| 2179 | pub fn getaddrinfo( |
| 2180 | node: *const c_char, |
| 2181 | service: *const c_char, |
| 2182 | hints: *const addrinfo, |
| 2183 | res: *mut *mut addrinfo, |
| 2184 | ) -> c_int; |
| 2185 | |
| 2186 | // netdb.h |
| 2187 | pub fn freeaddrinfo(res: *mut addrinfo); |
| 2188 | |
| 2189 | // signal.h |
| 2190 | pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t; |
| 2191 | |
| 2192 | // unistd.h |
| 2193 | pub fn getpid() -> pid_t; |
| 2194 | |
| 2195 | // unistd.h |
| 2196 | pub fn getppid() -> pid_t; |
| 2197 | |
| 2198 | // unistd.h |
| 2199 | pub fn setpgid(pid: pid_t, pgid: pid_t) -> pid_t; |
| 2200 | |
| 2201 | // wait.h |
| 2202 | pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t; |
| 2203 | |
| 2204 | // unistd.h |
| 2205 | pub fn sysconf(attr: c_int) -> c_long; |
| 2206 | |
| 2207 | // stdlib.h |
| 2208 | pub fn setenv( |
| 2209 | // setenv.c |
| 2210 | envVarName: *const c_char, |
| 2211 | envVarValue: *const c_char, |
| 2212 | overwrite: c_int, |
| 2213 | ) -> c_int; |
| 2214 | |
| 2215 | // stdlib.h |
| 2216 | pub fn unsetenv( |
| 2217 | // setenv.c |
| 2218 | envVarName: *const c_char, |
| 2219 | ) -> c_int; |
| 2220 | |
| 2221 | // stdlib.h |
| 2222 | pub fn realpath(fileName: *const c_char, resolvedName: *mut c_char) -> *mut c_char; |
| 2223 | |
| 2224 | // unistd.h |
| 2225 | pub fn link(src: *const c_char, dst: *const c_char) -> c_int; |
| 2226 | |
| 2227 | // unistd.h |
| 2228 | pub fn readlink(path: *const c_char, buf: *mut c_char, bufsize: size_t) -> ssize_t; |
| 2229 | |
| 2230 | // unistd.h |
| 2231 | pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int; |
| 2232 | |
| 2233 | // dirent.h |
| 2234 | pub fn opendir(name: *const c_char) -> *mut crate::DIR; |
| 2235 | |
| 2236 | // unistd.h |
| 2237 | pub fn rmdir(path: *const c_char) -> c_int; |
| 2238 | |
| 2239 | // stat.h |
| 2240 | pub fn mkdir(dirName: *const c_char, mode: mode_t) -> c_int; |
| 2241 | |
| 2242 | // stat.h |
| 2243 | pub fn chmod(path: *const c_char, mode: mode_t) -> c_int; |
| 2244 | |
| 2245 | // stat.h |
| 2246 | pub fn fchmod(attr1: c_int, attr2: mode_t) -> c_int; |
| 2247 | |
| 2248 | // unistd.h |
| 2249 | pub fn fsync(fd: c_int) -> c_int; |
| 2250 | |
| 2251 | // unistd.h |
| 2252 | pub fn fdatasync(fd: c_int) -> c_int; |
| 2253 | |
| 2254 | // dirent.h |
| 2255 | pub fn closedir(ptr: *mut crate::DIR) -> c_int; |
| 2256 | |
| 2257 | //sched.h |
| 2258 | pub fn sched_get_priority_max(policy: c_int) -> c_int; |
| 2259 | |
| 2260 | //sched.h |
| 2261 | pub fn sched_get_priority_min(policy: c_int) -> c_int; |
| 2262 | |
| 2263 | //sched.h |
| 2264 | pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int; |
| 2265 | |
| 2266 | //sched.h |
| 2267 | pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int; |
| 2268 | |
| 2269 | //sched.h |
| 2270 | pub fn sched_setscheduler( |
| 2271 | pid: crate::pid_t, |
| 2272 | policy: c_int, |
| 2273 | param: *const crate::sched_param, |
| 2274 | ) -> c_int; |
| 2275 | |
| 2276 | //sched.h |
| 2277 | pub fn sched_getscheduler(pid: crate::pid_t) -> c_int; |
| 2278 | |
| 2279 | //sched.h |
| 2280 | pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int; |
| 2281 | |
| 2282 | // sched.h |
| 2283 | pub fn sched_yield() -> c_int; |
| 2284 | |
| 2285 | // errnoLib.h |
| 2286 | pub fn errnoSet(err: c_int) -> c_int; |
| 2287 | |
| 2288 | // errnoLib.h |
| 2289 | pub fn errnoGet() -> c_int; |
| 2290 | |
| 2291 | // unistd.h |
| 2292 | pub fn _exit(status: c_int) -> !; |
| 2293 | |
| 2294 | // unistd.h |
| 2295 | pub fn setgid(gid: crate::gid_t) -> c_int; |
| 2296 | |
| 2297 | // unistd.h |
| 2298 | pub fn getgid() -> crate::gid_t; |
| 2299 | |
| 2300 | // unistd.h |
| 2301 | pub fn setuid(uid: crate::uid_t) -> c_int; |
| 2302 | |
| 2303 | // unistd.h |
| 2304 | pub fn getuid() -> crate::uid_t; |
| 2305 | |
| 2306 | // signal.h |
| 2307 | pub fn sigemptyset(__set: *mut sigset_t) -> c_int; |
| 2308 | pub fn sigfillset(set: *mut sigset_t) -> c_int; |
| 2309 | pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int; |
| 2310 | pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int; |
| 2311 | |
| 2312 | // pthread.h for kernel |
| 2313 | // signal.h for user |
| 2314 | pub fn pthread_sigmask(__how: c_int, __set: *const sigset_t, __oset: *mut sigset_t) -> c_int; |
| 2315 | |
| 2316 | // signal.h for user |
| 2317 | pub fn kill(__pid: pid_t, __signo: c_int) -> c_int; |
| 2318 | |
| 2319 | // signal.h for user |
| 2320 | pub fn sigqueue(__pid: pid_t, __signo: c_int, __value: crate::sigval) -> c_int; |
| 2321 | |
| 2322 | // signal.h for user |
| 2323 | pub fn _sigqueue( |
| 2324 | rtpId: crate::RTP_ID, |
| 2325 | signo: c_int, |
| 2326 | pValue: *const crate::sigval, |
| 2327 | sigCode: c_int, |
| 2328 | ) -> c_int; |
| 2329 | |
| 2330 | // signal.h |
| 2331 | pub fn taskKill(taskId: crate::TASK_ID, signo: c_int) -> c_int; |
| 2332 | |
| 2333 | // signal.h |
| 2334 | pub fn raise(__signo: c_int) -> c_int; |
| 2335 | |
| 2336 | // taskLibCommon.h |
| 2337 | pub fn taskIdSelf() -> crate::TASK_ID; |
| 2338 | pub fn taskDelay(ticks: crate::_Vx_ticks_t) -> c_int; |
| 2339 | |
| 2340 | // taskLib.h |
| 2341 | pub fn taskNameSet(task_id: crate::TASK_ID, task_name: *mut c_char) -> c_int; |
| 2342 | pub fn taskNameGet(task_id: crate::TASK_ID, buf_name: *mut c_char, bufsize: size_t) -> c_int; |
| 2343 | |
| 2344 | // rtpLibCommon.h |
| 2345 | pub fn rtpInfoGet(rtpId: crate::RTP_ID, rtpStruct: *mut crate::RTP_DESC) -> c_int; |
| 2346 | pub fn rtpSpawn( |
| 2347 | pubrtpFileName: *const c_char, |
| 2348 | argv: *mut *const c_char, |
| 2349 | envp: *mut *const c_char, |
| 2350 | priority: c_int, |
| 2351 | uStackSize: size_t, |
| 2352 | options: c_int, |
| 2353 | taskOptions: c_int, |
| 2354 | ) -> RTP_ID; |
| 2355 | |
| 2356 | // ioLib.h |
| 2357 | pub fn _realpath(fileName: *const c_char, resolvedName: *mut c_char) -> *mut c_char; |
| 2358 | |
| 2359 | // pathLib.h |
| 2360 | pub fn _pathIsAbsolute(filepath: *const c_char, pNameTail: *mut *const c_char) -> BOOL; |
| 2361 | |
| 2362 | pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; |
| 2363 | pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t; |
| 2364 | |
| 2365 | // randomNumGen.h |
| 2366 | pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int; |
| 2367 | pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int; |
| 2368 | pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int; |
| 2369 | pub fn randSecure() -> c_int; |
| 2370 | |
| 2371 | // mqueue.h |
| 2372 | pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t; |
| 2373 | pub fn mq_close(mqd: crate::mqd_t) -> c_int; |
| 2374 | pub fn mq_unlink(name: *const c_char) -> c_int; |
| 2375 | pub fn mq_receive( |
| 2376 | mqd: crate::mqd_t, |
| 2377 | msg_ptr: *mut c_char, |
| 2378 | msg_len: size_t, |
| 2379 | msg_prio: *mut c_uint, |
| 2380 | ) -> ssize_t; |
| 2381 | pub fn mq_timedreceive( |
| 2382 | mqd: crate::mqd_t, |
| 2383 | msg_ptr: *mut c_char, |
| 2384 | msg_len: size_t, |
| 2385 | msg_prio: *mut c_uint, |
| 2386 | abs_timeout: *const crate::timespec, |
| 2387 | ) -> ssize_t; |
| 2388 | pub fn mq_send( |
| 2389 | mqd: crate::mqd_t, |
| 2390 | msg_ptr: *const c_char, |
| 2391 | msg_len: size_t, |
| 2392 | msg_prio: c_uint, |
| 2393 | ) -> c_int; |
| 2394 | pub fn mq_timedsend( |
| 2395 | mqd: crate::mqd_t, |
| 2396 | msg_ptr: *const c_char, |
| 2397 | msg_len: size_t, |
| 2398 | msg_prio: c_uint, |
| 2399 | abs_timeout: *const crate::timespec, |
| 2400 | ) -> c_int; |
| 2401 | pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int; |
| 2402 | pub fn mq_setattr( |
| 2403 | mqd: crate::mqd_t, |
| 2404 | newattr: *const crate::mq_attr, |
| 2405 | oldattr: *mut crate::mq_attr, |
| 2406 | ) -> c_int; |
| 2407 | |
| 2408 | // vxCpuLib.h |
| 2409 | pub fn vxCpuEnabledGet() -> crate::cpuset_t; // Get set of running CPU's in the system |
| 2410 | pub fn vxCpuConfiguredGet() -> crate::cpuset_t; // Get set of Configured CPU's in the system |
| 2411 | } |
| 2412 | |
| 2413 | //Dummy functions, these don't really exist in VxWorks. |
| 2414 | |
| 2415 | // wait.h macros |
| 2416 | safe_f! { |
| 2417 | pub const safe fn WIFEXITED(status: c_int) -> bool { |
| 2418 | (status & 0xFF00) == 0 |
| 2419 | } |
| 2420 | pub const safe fn WIFSIGNALED(status: c_int) -> bool { |
| 2421 | (status & 0xFF00) != 0 |
| 2422 | } |
| 2423 | pub const safe fn WIFSTOPPED(status: c_int) -> bool { |
| 2424 | (status & 0xFF0000) != 0 |
| 2425 | } |
| 2426 | pub const safe fn WEXITSTATUS(status: c_int) -> c_int { |
| 2427 | status & 0xFF |
| 2428 | } |
| 2429 | pub const safe fn WIFCONTINUED(status: c_int) -> c_int { |
| 2430 | (status >> 24) & 0xFF |
| 2431 | } |
| 2432 | pub const safe fn WTERMSIG(status: c_int) -> c_int { |
| 2433 | (status >> 8) & 0xFF |
| 2434 | } |
| 2435 | pub const safe fn WSTOPSIG(status: c_int) -> c_int { |
| 2436 | (status >> 16) & 0xFF |
| 2437 | } |
| 2438 | } |
| 2439 | |
| 2440 | pub unsafe fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int { |
| 2441 | // check to see if align is a power of 2 and if align is a multiple |
| 2442 | // of sizeof(void *) |
| 2443 | if (align & align - 1 != 0) || (align as usize % size_of::<size_t>() != 0) { |
| 2444 | return crate::EINVAL; |
| 2445 | } |
| 2446 | |
| 2447 | unsafe { |
| 2448 | // posix_memalign should not set errno |
| 2449 | let e = crate::errnoGet(); |
| 2450 | |
| 2451 | let temp = memalign(align, size); |
| 2452 | crate::errnoSet(e as c_int); |
| 2453 | |
| 2454 | if temp.is_null() { |
| 2455 | crate::ENOMEM |
| 2456 | } else { |
| 2457 | *memptr = temp; |
| 2458 | 0 |
| 2459 | } |
| 2460 | } |
| 2461 | } |
| 2462 | |
| 2463 | cfg_if! { |
| 2464 | if #[cfg(target_arch = "aarch64")] { |
| 2465 | mod aarch64; |
| 2466 | pub use self::aarch64::*; |
| 2467 | } else if #[cfg(target_arch = "arm")] { |
| 2468 | mod arm; |
| 2469 | pub use self::arm::*; |
| 2470 | } else if #[cfg(target_arch = "x86")] { |
| 2471 | mod x86; |
| 2472 | pub use self::x86::*; |
| 2473 | } else if #[cfg(target_arch = "x86_64")] { |
| 2474 | mod x86_64; |
| 2475 | pub use self::x86_64::*; |
| 2476 | } else if #[cfg(target_arch = "powerpc")] { |
| 2477 | mod powerpc; |
| 2478 | pub use self::powerpc::*; |
| 2479 | } else if #[cfg(target_arch = "powerpc64")] { |
| 2480 | mod powerpc64; |
| 2481 | pub use self::powerpc64::*; |
| 2482 | } else if #[cfg(target_arch = "riscv32")] { |
| 2483 | mod riscv32; |
| 2484 | pub use self::riscv32::*; |
| 2485 | } else if #[cfg(target_arch = "riscv64")] { |
| 2486 | mod riscv64; |
| 2487 | pub use self::riscv64::*; |
| 2488 | } else { |
| 2489 | // Unknown target_arch |
| 2490 | } |
| 2491 | } |