diff options
Diffstat (limited to 'libc/src/unix/bsd/netbsdlike')
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/mod.rs | 57 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 11 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/arm.rs | 11 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/mod.rs | 160 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs | 2 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs | 2 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs | 14 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 10 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs | 4 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/x86.rs | 4 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 12 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs | 24 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs | 8 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs | 57 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs | 233 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs | 8 |
16 files changed, 564 insertions, 53 deletions
diff --git a/libc/src/unix/bsd/netbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/mod.rs index 9179e6a..bfd541d 100644 --- a/libc/src/unix/bsd/netbsdlike/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/mod.rs @@ -35,6 +35,11 @@ s! { pub sin_zero: [::int8_t; 8], } + pub struct in6_pktinfo { + pub ipi6_addr: ::in6_addr, + pub ipi6_ifindex: ::c_uint, + } + pub struct termios { pub c_iflag: ::tcflag_t, pub c_oflag: ::tcflag_t, @@ -177,7 +182,6 @@ pub const SIGSEGV : ::c_int = 11; pub const SIGPIPE : ::c_int = 13; pub const SIGALRM : ::c_int = 14; pub const SIGTERM : ::c_int = 15; -pub const SIGSTKSZ : ::size_t = 40960; pub const PROT_NONE : ::c_int = 0; pub const PROT_READ : ::c_int = 1; @@ -310,6 +314,17 @@ pub const POSIX_MADV_DONTNEED : ::c_int = 4; pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0; pub const PTHREAD_CREATE_DETACHED : ::c_int = 1; +pub const PT_TRACE_ME: ::c_int = 0; +pub const PT_READ_I: ::c_int = 1; +pub const PT_READ_D: ::c_int = 2; +pub const PT_WRITE_I: ::c_int = 4; +pub const PT_WRITE_D: ::c_int = 5; +pub const PT_CONTINUE: ::c_int = 7; +pub const PT_KILL: ::c_int = 8; +pub const PT_ATTACH: ::c_int = 9; +pub const PT_DETACH: ::c_int = 10; +pub const PT_IO: ::c_int = 11; + // http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2 // The man page says clock_gettime(3) can accept various values as clockid_t but // http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161 @@ -413,8 +428,9 @@ pub const IP_TTL: ::c_int = 4; pub const IP_HDRINCL: ::c_int = 2; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; +pub const IPV6_RECVPKTINFO: ::c_int = 36; +pub const IPV6_PKTINFO: ::c_int = 46; -pub const TCP_NODELAY: ::c_int = 0x01; pub const SOL_SOCKET: ::c_int = 0xffff; pub const SO_DEBUG: ::c_int = 0x01; pub const SO_ACCEPTCONN: ::c_int = 0x0002; @@ -532,6 +548,24 @@ pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS; pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS; pub const OCRNL: ::tcflag_t = 0x10; +pub const TIOCEXCL: ::c_ulong = 0x2000740d; +pub const TIOCNXCL: ::c_ulong = 0x2000740e; +pub const TIOCFLUSH: ::c_ulong = 0x80047410; +pub const TIOCGETA: ::c_ulong = 0x402c7413; +pub const TIOCSETA: ::c_ulong = 0x802c7414; +pub const TIOCSETAW: ::c_ulong = 0x802c7415; +pub const TIOCSETAF: ::c_ulong = 0x802c7416; +pub const TIOCGETD: ::c_ulong = 0x4004741a; +pub const TIOCSETD: ::c_ulong = 0x8004741b; +pub const TIOCMGET: ::c_ulong = 0x4004746a; +pub const TIOCMBIC: ::c_ulong = 0x8004746b; +pub const TIOCMBIS: ::c_ulong = 0x8004746c; +pub const TIOCMSET: ::c_ulong = 0x8004746d; +pub const TIOCSTART: ::c_ulong = 0x2000746e; +pub const TIOCSTOP: ::c_ulong = 0x2000746f; +pub const TIOCSCTTY: ::c_ulong = 0x20007461; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; pub const TIOCM_LE: ::c_int = 0o0001; pub const TIOCM_DTR: ::c_int = 0o0002; pub const TIOCM_RTS: ::c_int = 0o0004; @@ -544,6 +578,19 @@ pub const TIOCM_DSR: ::c_int = 0o0400; pub const TIOCM_CD: ::c_int = TIOCM_CAR; pub const TIOCM_RI: ::c_int = TIOCM_RNG; +// Flags for chflags(2) +pub const UF_SETTABLE: ::c_ulong = 0x0000ffff; +pub const UF_NODUMP: ::c_ulong = 0x00000001; +pub const UF_IMMUTABLE: ::c_ulong = 0x00000002; +pub const UF_APPEND: ::c_ulong = 0x00000004; +pub const UF_OPAQUE: ::c_ulong = 0x00000008; +pub const SF_SETTABLE: ::c_ulong = 0xffff0000; +pub const SF_ARCHIVED: ::c_ulong = 0x00010000; +pub const SF_IMMUTABLE: ::c_ulong = 0x00020000; +pub const SF_APPEND: ::c_ulong = 0x00040000; + +pub const TIMER_ABSTIME: ::c_int = 1; + f! { pub fn WSTOPSIG(status: ::c_int) -> ::c_int { status >> 8 @@ -602,14 +649,14 @@ extern { pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, + sval: *mut ::c_int) -> ::c_int; pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: ::clockid_t) -> ::c_int; pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; @@ -625,6 +672,8 @@ extern { pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int; + pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; } cfg_if! { diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs new file mode 100644 index 0000000..66f3301 --- /dev/null +++ b/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -0,0 +1,11 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; + +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs b/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs new file mode 100644 index 0000000..9e67316 --- /dev/null +++ b/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -0,0 +1,11 @@ +use PT_FIRSTMACH; + +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; + +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs index 4c528b5..55b8f4c 100644 --- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1,6 +1,5 @@ use dox::mem; -pub type c_char = i8; pub type clock_t = ::c_uint; pub type suseconds_t = ::c_int; pub type dev_t = u64; @@ -9,6 +8,7 @@ pub type fsblkcnt_t = ::uint64_t; pub type fsfilcnt_t = ::uint64_t; pub type idtype_t = ::c_int; pub type mqd_t = ::c_int; +type __pthread_spin_t = __cpu_simple_lock_nv_t; s! { pub struct aiocb { @@ -161,9 +161,14 @@ s! { pub struct pthread_mutex_t { ptm_magic: ::c_uint, - ptm_errorcheck: ::c_uchar, + ptm_errorcheck: __pthread_spin_t, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad1: [u8; 3], - ptm_interlock: ::c_uchar, + // actually a union with a non-unused, 0-initialized field + ptm_unused: __pthread_spin_t, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad2: [u8; 3], ptm_owner: ::pthread_t, ptm_waiters: *mut u8, @@ -183,7 +188,7 @@ s! { pub struct pthread_cond_t { ptc_magic: ::c_uint, - ptc_lock: ::c_uchar, + ptc_lock: __pthread_spin_t, ptc_waiters_first: *mut u8, ptc_waiters_last: *mut u8, ptc_mutex: *mut ::pthread_mutex_t, @@ -197,7 +202,7 @@ s! { pub struct pthread_rwlock_t { ptr_magic: ::c_uint, - ptr_interlock: ::c_uchar, + ptr_interlock: __pthread_spin_t, ptr_rblocked_first: *mut u8, ptr_rblocked_last: *mut u8, ptr_wblocked_first: *mut u8, @@ -313,6 +318,20 @@ s! { pub sdl_slen: ::uint8_t, pub sdl_data: [::c_char; 12], } + + pub struct in_pktinfo { + pub ipi_addr: ::in_addr, + pub ipi_ifindex: ::c_uint, + } + + #[repr(packed)] + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } } pub const AT_FDCWD: ::c_int = -100; @@ -321,6 +340,9 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; pub const AT_REMOVEDIR: ::c_int = 0x800; +pub const EXTATTR_NAMESPACE_USER: ::c_int = 1; +pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2; + pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE); pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE); pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY); @@ -371,9 +393,19 @@ pub const F_GETNOSIGPIPE: ::c_int = 13; pub const F_SETNOSIGPIPE: ::c_int = 14; pub const F_MAXFD: ::c_int = 11; +pub const IP_PKTINFO: ::c_int = 25; +pub const IP_RECVPKTINFO: ::c_int = 26; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; +pub const TCP_KEEPIDLE: ::c_int = 3; +pub const TCP_KEEPINTVL: ::c_int = 5; +pub const TCP_KEEPCNT: ::c_int = 6; +pub const TCP_KEEPINIT: ::c_int = 7; +pub const TCP_INFO: ::c_int = 9; +pub const TCP_MD5SIG: ::c_int = 0x10; +pub const TCP_CONGCTL: ::c_int = 0x20; + pub const SOCK_CONN_DGRAM: ::c_int = 6; pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM; pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000; @@ -675,14 +707,19 @@ pub const ST_NOSUID: ::c_ulong = 8; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { ptm_magic: 0x33330003, ptm_errorcheck: 0, - ptm_interlock: 0, - ptm_waiters: 0 as *mut _, - ptm_owner: 0, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad1: [0; 3], + ptm_unused: 0, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad2: [0; 3], + ptm_waiters: 0 as *mut _, + ptm_owner: 0, ptm_recursed: 0, ptm_spare2: 0 as *mut _, }; + pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { ptc_magic: 0x55550005, ptc_lock: 0, @@ -947,6 +984,22 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS; pub const SOCK_CLOEXEC: ::c_int = 0x10000000; pub const SOCK_NONBLOCK: ::c_int = 0x20000000; +pub const SIGSTKSZ : ::size_t = 40960; + +pub const PT_DUMPCORE: ::c_int = 12; +pub const PT_LWPINFO: ::c_int = 13; +pub const PT_SYSCALL: ::c_int = 14; +pub const PT_SYSCALLEMU: ::c_int = 15; +pub const PT_SET_EVENT_MASK: ::c_int = 16; +pub const PT_GET_EVENT_MASK: ::c_int = 17; +pub const PT_GET_PROCESS_STATE: ::c_int = 18; +pub const PT_FIRSTMACH: ::c_int = 32; + +// Flags for chflags(2) +pub const SF_SNAPSHOT: ::c_ulong = 0x00200000; +pub const SF_LOG: ::c_ulong = 0x00400000; +pub const SF_SNAPINVAL: ::c_ulong = 0x00800000; + // dirfd() is a macro on netbsd to access // the first field of the struct where dirp points to: // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36 @@ -982,6 +1035,55 @@ extern { pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent) -> ::c_int; + pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; + pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int; + pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; + + pub fn extattr_delete_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_get_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_namespace_to_string(attrnamespace: ::c_int, + string: *mut *mut ::c_char) -> ::c_int; + pub fn extattr_set_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::c_int; + pub fn extattr_set_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::c_int; + pub fn extattr_set_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::c_int; + pub fn extattr_string_to_namespace(string: *const ::c_char, + attrnamespace: *mut ::c_int) -> ::c_int; + + #[link_name = "__lutimes50"] pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, @@ -1033,11 +1135,13 @@ extern { pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int; + #[link_name = "__mq_timedreceive50"] pub fn mq_timedreceive(mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msq_prio: *mut ::c_uint, abs_timeout: *const ::timespec) -> ::ssize_t; + #[link_name = "__mq_timedsend50"] pub fn mq_timedsend(mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, @@ -1072,7 +1176,43 @@ extern { base: ::locale_t) -> ::locale_t; #[link_name = "__settimeofday50"] pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int; + + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; } -mod other; -pub use self::other::*; +#[link(name = "util")] +extern { + #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] + pub fn getpwent_r(pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd) -> ::c_int; + pub fn getgrent_r(grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } else if #[cfg(target_arch = "arm")] { + mod arm; + pub use self::arm::*; + } else if #[cfg(target_arch = "powerpc")] { + mod powerpc; + pub use self::powerpc::*; + } else if #[cfg(target_arch = "sparc64")] { + mod sparc64; + pub use self::sparc64::*; + } else if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } else if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; + } else { + // Unknown target_arch + } +} diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs deleted file mode 100644 index 9b0b338..0000000 --- a/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_long = i32; -pub type c_ulong = u32; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs deleted file mode 100644 index b07c476..0000000 --- a/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_long = i64; -pub type c_ulong = u64; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs deleted file mode 100644 index 3a9bf08..0000000 --- a/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -cfg_if! { - if #[cfg(any(target_arch = "sparc64", - target_arch = "x86_64"))] { - mod b64; - pub use self::b64::*; - } else if #[cfg(any(target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86"))] { - mod b32; - pub use self::b32::*; - } else { - // Unknown target_arch - } -} diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs new file mode 100644 index 0000000..54d069e --- /dev/null +++ b/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs @@ -0,0 +1,10 @@ +use PT_FIRSTMACH; + +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; + +pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs b/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs new file mode 100644 index 0000000..db8f2a9 --- /dev/null +++ b/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs @@ -0,0 +1,4 @@ +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs b/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs new file mode 100644 index 0000000..8bd1058 --- /dev/null +++ b/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs @@ -0,0 +1,4 @@ +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs new file mode 100644 index 0000000..8d3de84 --- /dev/null +++ b/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -0,0 +1,12 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; + +pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs index ac4acad..e5f0219 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs @@ -65,6 +65,28 @@ pub const ALTMON_12: ::nl_item = 69; pub const KERN_RND: ::c_int = 31; +// https://github.com/bitrig/bitrig/blob/master/sys/net/if.h#L187 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast + +pub const SIGSTKSZ : ::size_t = 40960; + +pub const PT_FIRSTMACH: ::c_int = 32; + extern { pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; pub fn duplocale(base: ::locale_t) -> ::locale_t; @@ -73,6 +95,8 @@ extern { locale: *const ::c_char, base: ::locale_t) -> ::locale_t; pub fn uselocale(loc: ::locale_t) -> ::locale_t; + pub fn pledge(promises: *const ::c_char, + paths: *mut *const ::c_char) -> ::c_int; pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; } diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs index b07c476..d3971aa 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs @@ -1,2 +1,10 @@ +use PT_FIRSTMACH; + pub type c_long = i64; pub type c_ulong = u64; + +pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index 1f40e34..85f0a02 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -14,6 +14,7 @@ pub type pthread_cond_t = *mut ::c_void; pub type pthread_condattr_t = *mut ::c_void; pub type pthread_rwlock_t = *mut ::c_void; pub type pthread_rwlockattr_t = *mut ::c_void; +pub type caddr_t = *mut ::c_char; s! { pub struct dirent { @@ -187,6 +188,20 @@ s! { pub sdl_slen: ::c_uchar, pub sdl_data: [::c_char; 24], } + + pub struct sockpeercred { + pub uid: ::uid_t, + pub gid: ::gid_t, + pub pid: ::pid_t, + } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } } pub const UT_NAMESIZE: usize = 32; @@ -236,24 +251,6 @@ pub const SO_RTABLE: ::c_int = 0x1021; pub const SO_PEERCRED: ::c_int = 0x1022; pub const SO_SPLICE: ::c_int = 0x1023; -// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187 -pub const IFF_UP: ::c_int = 0x1; // interface is up -pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid -pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging -pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net -pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link -pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers -pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated -pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol -pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets -pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets -pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress -pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions -pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit -pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit -pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit -pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast - // sys/netinet/in.h // Protocols (RFC 1700) // NOTE: These are in addition to the constants defined in src/unix/mod.rs @@ -320,6 +317,13 @@ pub const IPPROTO_MAX: ::c_int = 256; /// Divert sockets pub const IPPROTO_DIVERT: ::c_int = 258; +pub const IP_RECVDSTADDR: ::c_int = 7; +pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; + +// sys/netinet/in.h +pub const TCP_MD5SIG: ::c_int = 0x04; +pub const TCP_NOPUSH: ::c_int = 0x10; + pub const AF_ECMA: ::c_int = 8; pub const AF_ROUTE: ::c_int = 17; pub const AF_ENCAP: ::c_int = 28; @@ -588,6 +592,7 @@ pub const CTL_MACHDEP: ::c_int = 7; pub const CTL_DDB: ::c_int = 9; pub const CTL_VFS: ::c_int = 10; pub const CTL_MAXID: ::c_int = 11; +pub const HW_NCPUONLINE: ::c_int = 25; pub const KERN_OSTYPE: ::c_int = 1; pub const KERN_OSRELEASE: ::c_int = 2; pub const KERN_OSREV: ::c_int = 3; @@ -662,7 +667,9 @@ pub const KERN_PROC_VMMAP: ::c_int = 80; pub const KERN_GLOBAL_PTRACE: ::c_int = 81; pub const KERN_CONSBUFSIZE: ::c_int = 82; pub const KERN_CONSBUF: ::c_int = 83; -pub const KERN_MAXID: ::c_int = 84; +pub const KERN_AUDIO: ::c_int = 84; +pub const KERN_CPUSTATS: ::c_int = 85; +pub const KERN_MAXID: ::c_int = 86; pub const KERN_PROC_ALL: ::c_int = 0; pub const KERN_PROC_PID: ::c_int = 1; pub const KERN_PROC_PGRP: ::c_int = 2; @@ -694,6 +701,8 @@ pub const SOCK_CLOEXEC: ::c_int = 0x8000; pub const SOCK_NONBLOCK: ::c_int = 0x4000; pub const SOCK_DNS: ::c_int = 0x1000; +pub const PTRACE_FORK: ::c_int = 0x0002; + pub const WCONTINUED: ::c_int = 8; f! { @@ -703,6 +712,10 @@ f! { } extern { + pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int; + pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int; + pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_uint, + atflag: ::c_int) -> ::c_int; pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, @@ -731,10 +744,12 @@ extern { newlen: ::size_t) -> ::c_int; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn pledge(promises: *const ::c_char, - paths: *mut *const ::c_char) -> ::c_int; pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; + pub fn ptrace(request: ::c_int, + pid: ::pid_t, + addr: caddr_t, + data: ::c_int) -> ::c_int; } cfg_if! { diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs index e7e5876..a2a7a30 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs @@ -25,13 +25,246 @@ s! { pub int_p_sign_posn: ::c_char, pub int_n_sign_posn: ::c_char, } + + pub struct statfs { + pub f_flags: ::uint32_t, + pub f_bsize: ::uint32_t, + pub f_iosize: ::uint32_t, + pub f_blocks: ::uint64_t, + pub f_bfree: ::uint64_t, + pub f_bavail: ::int64_t, + pub f_files: ::uint64_t, + pub f_ffree: ::uint64_t, + pub f_favail: ::int64_t, + pub f_syncwrites: ::uint64_t, + pub f_syncreads: ::uint64_t, + pub f_asyncwrites: ::uint64_t, + pub f_asyncreads: ::uint64_t, + pub f_fsid: ::fsid_t, + pub f_namemax: ::uint32_t, + pub f_owner: ::uid_t, + pub f_ctime: ::uint64_t, + pub f_fstypename: [::c_char; 16], + pub f_mntonname: [::c_char; 90], + pub f_mntfromname: [::c_char; 90], + pub f_mntfromspec: [::c_char; 90], + pub mount_info: mount_info, + } + + pub union mount_info { + pub ufs_args: ufs_args, + pub mfs_args: mfs_args, + pub nfs_args: nfs_args, + pub iso_args: iso_args, + pub msdosfs_args: msdosfs_args, + pub ntfs_args: ntfs_args, + pub tmpfs_args: tmpfs_args, + align: [::c_char; 160], + } + + pub struct ufs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + } + + pub struct mfs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134 + pub base: *mut ::c_char, + pub size: ::c_ulong, + } + + pub struct iso_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + pub flags: ::c_int, + pub sess: ::c_int, + } + + pub struct nfs_args { + pub version: ::c_int, + pub addr: *mut ::sockaddr, + pub addrlen: ::c_int, + pub sotype: ::c_int, + pub proto: ::c_int, + pub fh: *mut ::c_uchar, + pub fhsize: ::c_int, + pub flags: ::c_int, + pub wsize: ::c_int, + pub rsize: ::c_int, + pub readdirsize: ::c_int, + pub timeo: ::c_int, + pub retrans: ::c_int, + pub maxgrouplist: ::c_int, + pub readahead: ::c_int, + pub leaseterm: ::c_int, + pub deadthresh: ::c_int, + pub hostname: *mut ::c_char, + pub acregmin: ::c_int, + pub acregmax: ::c_int, + pub acdirmin: ::c_int, + pub acdirmax: ::c_int, + } + + pub struct msdosfs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub mask: ::mode_t, + pub flags: ::c_int, + } + + pub struct ntfs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub mode: ::mode_t, + pub flag: ::c_ulong, + } + + pub struct udf_args { + pub fspec: *mut ::c_char, + pub lastblock: ::uint32_t, + } + + pub struct tmpfs_args { + pub ta_version: ::c_int, + pub ta_nodes_max: ::ino_t, + pub ta_size_max: ::off_t, + pub ta_root_uid: ::uid_t, + pub ta_root_gid: ::gid_t, + pub ta_root_mode: ::mode_t, + } + + pub struct fusefs_args { + pub name: *mut ::c_char, + pub fd: ::c_int, + pub max_read: ::c_int, + pub allow_other: ::c_int, + } + + pub struct xucred { + pub cr_uid: ::uid_t, + pub cr_gid: ::gid_t, + pub cr_ngroups: ::c_short, + //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44 + pub cr_groups: [::gid_t; 16], + } + + pub struct export_args { + pub ex_flags: ::c_int, + pub ex_root: ::uid_t, + pub ex_anon: xucred, + pub ex_addr: *mut ::sockaddr, + pub ex_addrlen: ::c_int, + pub ex_mask: *mut ::sockaddr, + pub ex_masklen: ::c_int, + } } +//https://github.com/openbsd/src/blob/master/sys/sys/mount.h +pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext +pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers +pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr +pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext +pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess + +pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes + +pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports +pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default) +pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size +pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size +pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout +pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries +pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size +pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount +pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket +pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol +pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol +pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication +pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically +pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs) +pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead +pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh +pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache +pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3 +pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size + +/* Flags valid only in mount syscall arguments */ +pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid +pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid +pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid +pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid + +/* Flags valid only in kernel */ +pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally +pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3 +pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info +pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo +pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point +pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress +pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted +pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock +pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above +pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock +pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above +pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication +pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator +pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator +pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error + +pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only +pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names +pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries + +pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1; +pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2; + +pub const TMPFS_ARGS_VERSION: ::c_int = 1; + +pub const MAP_STACK : ::c_int = 0x4000; + +// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_STATICARP: ::c_int = 0x20; // only static ARP +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast + +pub const SIGSTKSZ : ::size_t = 28672; + +pub const PT_FIRSTMACH: ::c_int = 32; + extern { pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int; + pub fn pledge(promises: *const ::c_char, + execpromises: *const ::c_char) -> ::c_int; + pub fn strtonum(nptr: *const ::c_char, minval: ::c_longlong, + maxval: ::c_longlong, + errstr: *mut *const ::c_char) -> ::c_longlong; + + pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; + pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; } cfg_if! { diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs index 27b9412..3bc7f52 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs @@ -1,3 +1,11 @@ +use PT_FIRSTMACH; + pub type c_long = i64; pub type c_ulong = u64; pub type c_char = i8; + +pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; |