path
stringlengths
14
112
content
stringlengths
0
6.32M
size
int64
0
6.32M
max_lines
int64
1
100k
repo_name
stringclasses
2 values
autogenerated
bool
1 class
cosmopolitan/libc/isystem/sys/mount.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_MOUNT_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_MOUNT_H_ #include "libc/calls/mount.h" #include "libc/sysv/consts/mount.h" #include "libc/sysv/consts/unmount.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_MOUNT_H_ */
250
7
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/select.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_SELECT_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_SELECT_H_ #include "libc/calls/weirdtypes.h" #include "libc/sock/select.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SELECT_H_ */
214
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/ptrace.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PTRACE_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PTRACE_H_ #include "libc/calls/calls.h" #include "libc/sysv/consts/ptrace.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_PTRACE_H_ */
216
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/sendfile.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_SENDFILE_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_SENDFILE_H_ #include "libc/calls/weirdtypes.h" #include "libc/sock/sock.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SENDFILE_H_ */
218
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/auxv.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_AUXV_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_AUXV_H_ #include "libc/runtime/runtime.h" #include "libc/sysv/consts/auxv.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_AUXV_H_ */
212
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/uio.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_UIO_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_UIO_H_ #include "libc/calls/calls.h" #include "libc/calls/struct/iovec.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_UIO_H_ */
207
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/types.h
#ifndef LIBC_ISYSTEM_SYS_TYPES_H_ #define LIBC_ISYSTEM_SYS_TYPES_H_ #include "libc/calls/makedev.h" #include "libc/calls/weirdtypes.h" #include "libc/thread/thread.h" #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #include "libc/calls/typedef/u.h" #include "libc/calls/weirdtypes.h" #include "libc/intrin/newbie.h" #include "libc/sock/select.h" #include "libc/sysv/consts/endian.h" #endif #endif
400
16
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/times.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_TIMES_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_TIMES_H_ #include "libc/calls/calls.h" #include "libc/calls/struct/tms.h" #include "libc/calls/weirdtypes.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_TIMES_H_ */
246
7
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/signal.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ #include "libc/calls/calls.h" #include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/siginfo.h" #include "libc/sysv/consts/sicode.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */
296
8
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/wait.h
#ifndef LIBC_ISYSTEM_SYS_WAIT_H_ #define LIBC_ISYSTEM_SYS_WAIT_H_ #include "libc/calls/calls.h" #include "libc/calls/struct/siginfo.h" #include "libc/calls/weirdtypes.h" #include "libc/sysv/consts/w.h" #include "libc/sysv/consts/waitid.h" #endif
246
9
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/ttydefaults.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_TTYDEFAULTS_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_TTYDEFAULTS_H_ #include "libc/calls/ttydefaults.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_TTYDEFAULTS_H_ */
200
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/file.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_FILE_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_FILE_H_ #include "libc/calls/calls.h" #include "libc/calls/struct/flock.h" #include "libc/sysv/consts/l.h" #include "libc/sysv/consts/lock.h" #include "libc/sysv/consts/ok.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_FILE_H_ */
310
9
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/poll.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_POLL_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_POLL_H_ #include "libc/sock/sock.h" #include "libc/sysv/consts/poll.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_POLL_H_ */
206
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/stat.h
#ifndef LIBC_ISYSTEM_SYS_STAT_H_ #define LIBC_ISYSTEM_SYS_STAT_H_ #include "libc/calls/calls.h" #include "libc/calls/struct/stat.h" #include "libc/calls/struct/stat.macros.h" #include "libc/calls/struct/timespec.h" #include "libc/calls/weirdtypes.h" #include "libc/sysv/consts/s.h" #include "libc/sysv/consts/utime.h" #include "libc/time/time.h" #endif
353
12
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/reboot.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_REBOOT_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_REBOOT_H_ #include "libc/calls/calls.h" #include "libc/sysv/consts/reboot.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_REBOOT_H_ */
216
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/syscall.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYSCALL_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYSCALL_H_ #include "libc/calls/calls.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYSCALL_H_ */
170
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/statfs.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_STATFS_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_STATFS_H_ #include "libc/calls/struct/statfs.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_STATFS_H_ */
187
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/un.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_UN_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_UN_H_ #include "libc/calls/weirdtypes.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_UN_H_ */
239
7
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/termios.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_TERMIOS_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_TERMIOS_H_ #include "libc/calls/termios.h" #include "libc/sysv/consts/termios.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_TERMIOS_H_ */
222
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/param.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ #include "libc/intrin/newbie.h" #include "libc/calls/calls.h" #include "libc/calls/struct/rlimit.h" #include "libc/calls/struct/rusage.h" #include "libc/calls/sysparam.h" #include "libc/calls/weirdtypes.h" #include "libc/limits.h" #include "libc/sysv/consts/endian.h" #include "libc/sysv/consts/prio.h" #include "libc/sysv/consts/rlim.h" #include "libc/sysv/consts/rlimit.h" #include "libc/sysv/consts/rusage.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ */
558
16
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/vfs.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_VFS_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_VFS_H_ #include "libc/calls/struct/statfs.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_VFS_H_ */
178
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/errno.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_ERRNO_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_ERRNO_H_ #include "libc/errno.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_ERRNO_H_ */
170
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/utsname.h
#ifndef LIBC_ISYSTEM_SYS_UTSNAME_H_ #define LIBC_ISYSTEM_SYS_UTSNAME_H_ #include "libc/calls/struct/utsname.h" #endif
118
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/fcntl.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_FCNTL_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_FCNTL_H_ #include "libc/calls/calls.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/consts/dn.h" #include "libc/sysv/consts/f.h" #include "third_party/musl/lockf.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_FCNTL_H_ */
310
9
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/socket.h
#ifndef LIBC_ISYSTEM_SYS_SOCKET_H_ #define LIBC_ISYSTEM_SYS_SOCKET_H_ #include "libc/calls/weirdtypes.h" #include "libc/sock/sock.h" #include "libc/sock/struct/cmsghdr.h" #include "libc/sock/struct/linger.h" #include "libc/sock/struct/msghdr.h" #include "libc/sock/struct/sockaddr.h" #include "libc/sysv/consts/af.h" #include "libc/sysv/consts/limits.h" #include "libc/sysv/consts/msg.h" #include "libc/sysv/consts/pf.h" #include "libc/sysv/consts/scm.h" #include "libc/sysv/consts/shut.h" #include "libc/sysv/consts/so.h" #include "libc/sysv/consts/sock.h" #include "libc/sysv/consts/sol.h" #endif
599
19
jart/cosmopolitan
false
cosmopolitan/libc/isystem/sys/time.h
#ifndef LIBC_ISYSTEM_SYS_TIME_H_ #define LIBC_ISYSTEM_SYS_TIME_H_ #include "libc/calls/struct/itimerval.h" #include "libc/calls/struct/timeval.h" #include "libc/calls/weirdtypes.h" #include "libc/sock/select.h" #include "libc/sysv/consts/clock.h" #include "libc/sysv/consts/itimer.h" #include "libc/time/struct/timezone.h" #include "libc/time/time.h" #endif
358
12
jart/cosmopolitan
false
cosmopolitan/libc/isystem/linux/limits.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_LINUX_LIMITS_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_LINUX_LIMITS_H_ #include "libc/sysv/consts/limits.h" #define NR_OPEN 1024 #define XATTR_NAME_MAX 255 #define XATTR_SIZE_MAX 65536 #define XATTR_LIST_MAX 65536 #define RTSIG_MAX 32 #endif /* COSMOPOLITAN_LIBC_ISYSTEM_LINUX_LIMITS_H_ */
333
12
jart/cosmopolitan
false
cosmopolitan/libc/isystem/linux/xattr.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_XATTR_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_XATTR_H_ #include "libc/calls/xattr.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_XATTR_H_ */
176
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/linux/futex.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_LINUX_FUTEX_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_LINUX_FUTEX_H_ #include "libc/sysv/consts/futex.h" #include "libc/sysv/consts/nr.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_LINUX_FUTEX_H_ */
221
6
jart/cosmopolitan
false
cosmopolitan/libc/isystem/linux/types.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_LINUX_TYPES_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_LINUX_TYPES_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ typedef uint16_t __u16; typedef uint32_t __u32; typedef uint64_t __u64; typedef __u16 __le16; typedef __u16 __be16; typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __le64; typedef __u64 __be64; typedef __u16 __sum16; typedef __u32 __wsum; #define __aligned_u64 __u64 __attribute__((__aligned__(8))) #define __aligned_be64 __be64 __attribute__((__aligned__(8))) #define __aligned_le64 __le64 __attribute__((__aligned__(8))) COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* COSMOPOLITAN_LIBC_ISYSTEM_LINUX_TYPES_H_ */
717
26
jart/cosmopolitan
false
cosmopolitan/libc/isystem/net/if.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_NET_IF_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_NET_IF_H_ #include "libc/sock/struct/ifconf.h" #include "libc/sock/struct/ifreq.h" #include "libc/sysv/consts/iff.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_NET_IF_H_ */
244
7
jart/cosmopolitan
false
cosmopolitan/libc/isystem/netinet/udp.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_NETINET_UDP_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_NETINET_UDP_H_ #include "libc/sysv/consts/sol.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_NETINET_UDP_H_ */
186
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/netinet/tcp.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_NETINET_TCP_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_NETINET_TCP_H_ #include "libc/sysv/consts/sol.h" #include "libc/sysv/consts/tcp.h" #include "libc/sysv/consts/tcpopt.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_NETINET_TCP_H_ */
257
7
jart/cosmopolitan
false
cosmopolitan/libc/isystem/netinet/ip.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_NETINET_IP_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_NETINET_IP_H_ #endif /* COSMOPOLITAN_LIBC_ISYSTEM_NETINET_IP_H_ */
150
5
jart/cosmopolitan
false
cosmopolitan/libc/isystem/netinet/in.h
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_NETINET_IN_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_NETINET_IN_H_ #include "libc/calls/weirdtypes.h" #include "libc/sock/sock.h" #include "libc/sock/struct/ip_mreq.h" #include "libc/sock/struct/sockaddr.h" #include "libc/sock/struct/sockaddr6.h" #include "libc/sysv/consts/inaddr.h" #include "libc/sysv/consts/inet6.h" #include "libc/sysv/consts/ip.h" #include "libc/sysv/consts/ipport.h" #include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/ipv6.h" #include "libc/sysv/consts/mcast.h" #include "libc/sysv/consts/pf.h" #include "libc/sysv/consts/sock.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_NETINET_IN_H_ */
649
18
jart/cosmopolitan
false
cosmopolitan/libc/integral/lp64arg.inc
/* variadic arguments for chibicc */ /* <sync libc/runtime/valist.c> */ struct __va_list { uint32_t gp_offset; uint32_t fp_offset; void *overflow_arg_area; void *reg_save_area; }; /* </sync libc/runtime/valist.c> */ void *__va_arg(struct __va_list *, size_t, unsigned, unsigned); #define __GNUC_VA_LIST 1 #define __gnuc_va_list va_list #define va_end(AP) #define va_copy(DST, SRC) ((DST)[0] = (SRC)[0]) #define va_start(AP, LAST) \ do { \ *(AP) = *(struct __va_list *)__va_area__; \ } while (0) #define va_arg(AP, TYPE) \ (*(TYPE *)__va_arg(AP, sizeof(TYPE), _Alignof(TYPE), \ __builtin_reg_class(TYPE))) typedef struct __va_list va_list[1];
775
29
jart/cosmopolitan
false
cosmopolitan/libc/integral/c.inc
#if __GNUC__ + 0 < 2 #define __attribute__(x) #endif #ifndef __cplusplus #define COSMOPOLITAN_C_START_ #define COSMOPOLITAN_C_END_ #define COSMOPOLITAN_CXX_START_ #define COSMOPOLITAN_CXX_END_ #define COSMOPOLITAN_CXX_USING_ #endif #ifndef __ia16__ #define __far #endif #if !defined(__GNUC__) && __cplusplus + 0 >= 201103L #define typeof(x) decltype(x) #elif (defined(__STRICT_ANSI__) || !defined(__GNUC__)) && \ __STDC_VERSION__ + 0 < 201112 #define typeof(x) __typeof(x) #endif #ifdef __cplusplus #if __cplusplus >= 201103L #define _Alignof(x) alignof(x) #endif /* C++11 */ #else /* __cplusplus */ #if __STDC_VERSION__ + 0 < 201112 #if __GNUC__ + _MSC_VER + 0 && !defined(__STRICT_ANSI__) #define _Alignof(x) __alignof(x) #else #define _Alignof(x) /* basically all it ever did lool */ sizeof(x) #endif /* GNU/MSVC/!ANSI */ #endif /* C11 */ #endif /* __cplusplus */ #if !defined(__cplusplus) && !defined(inline) && __STDC_VERSION__ + 0 < 199901 #if !defined(__STRICT_ANSI__) && (defined(__GNUC__) || defined(_MSC_VER)) #define inline __inline #else #define inline #define __inline #endif #endif #if __STDC_VERSION__ + 0 < 201112 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) #define _Alignas(x) __attribute__((__aligned__(x))) #elif defined(_MSC_VER) #define _Alignas(x) __declspec(align(x)) #endif #endif #ifdef _MSC_VER #define __builtin_unreachable() __assume(false) #elif defined(__STRICT_ANSI__) || \ !((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 405 || \ defined(__clang__) || defined(__INTEL_COMPILER) || \ __has_builtin(__builtin_unreachable)) #define __builtin_unreachable() \ for (;;) { \ } #endif #if defined(__STRICT_ANSI__) || \ (!defined(__llvm__) && !__has_builtin(__builtin_assume)) #define __builtin_assume(x) \ do { \ if (!(x)) __builtin_unreachable(); \ } while (0) #endif #if __STDC_VERSION__ + 0 < 201112 #define _Atomic(TYPE) TYPE volatile #endif #ifdef __llvm__ #define __gnu_printf__ __printf__ #define __gnu_scanf__ __scanf__ #endif #if __cplusplus + 0 >= 201103L #define NULL nullptr #elif !defined(__cplusplus) #define NULL ((void *)0) #else #define NULL 0 #endif #ifndef __cplusplus #define HAVE_STDBOOL_H 1 #if __STDC_VERSION__ + 0 >= 201112 typedef _Bool bool; #define true ((bool)+1) #define false ((bool)+0) #else #define bool int #define true 1 #define false 0 #endif #endif #ifndef __cplusplus typedef __WCHAR_TYPE__ wchar_t; typedef __CHAR16_TYPE__ char16_t; typedef __CHAR32_TYPE__ char32_t; #endif #define _LIBCPP_STDINT_H typedef int errno_t; typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ssize_t; typedef __INTPTR_TYPE__ intptr_t; typedef __UINTPTR_TYPE__ uintptr_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __WINT_TYPE__ wint_t; /* uint32_t on linux but int32_t on xnu */ typedef __INT32_TYPE__ bool32; typedef __INT8_TYPE__ int8_t; typedef __UINT8_TYPE__ uint8_t; typedef __INT16_TYPE__ int16_t; typedef __UINT16_TYPE__ uint16_t; typedef __INT32_TYPE__ int32_t; typedef __UINT32_TYPE__ uint32_t; typedef __INT64_TYPE__ int64_t; typedef __UINT64_TYPE__ uint64_t; typedef __INTMAX_TYPE__ intmax_t; typedef __UINTMAX_TYPE__ uintmax_t; #if ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 406 || \ defined(__llvm__)) && \ !defined(__STRICT_ANSI__) typedef signed __int128 int128_t; typedef unsigned __int128 uint128_t; #endif typedef struct { intptr_t ax, dx; } axdx_t; #ifndef __chibicc__ #define va_list __builtin_va_list #define va_arg(ap, type) __builtin_va_arg(ap, type) #define va_copy(dest, src) __builtin_va_copy(dest, src) #define va_end(ap) __builtin_va_end(ap) #define va_start(ap, last) __builtin_va_start(ap, last) #else #include "libc/integral/lp64arg.inc" #endif #define libcesque dontthrow nocallback #define memcpyesque libcesque #define strlenesque libcesque nosideeffect paramsnonnull() #define vallocesque \ libcesque dontdiscard returnsaligned((GUARDSIZE)) returnspointerwithnoaliases #define reallocesque libcesque returnsaligned((16)) #define mallocesque reallocesque returnspointerwithnoaliases #define interruptfn nocallersavedregisters forcealignargpointer #ifndef pureconst #ifndef __STRICT_ANSI__ #define pureconst __attribute__((__const__)) #else #define pureconst #endif #endif #ifndef forcealign #ifndef __STRICT_ANSI__ #define forcealign(bytes) __attribute__((__aligned__(bytes))) #else #define forcealign(bytes) #endif #endif #ifndef __STRICT_ANSI__ #define thatispacked __attribute__((__packed__)) #else #define thatispacked #endif #ifndef __STRICT_ANSI__ #define printfesque(n) __attribute__((__format__(__gnu_printf__, n, n + 1))) #define scanfesque(n) __attribute__((__format__(__gnu_scanf__, n, n + 1))) #define strftimeesque(n) __attribute__((__format__(__strftime__, n, 0))) #else #define printfesque(n) #define scanfesque(n) #define strftimeesque(n) #endif #ifndef _Hide #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__visibility__) || defined(__GNUC__)) && !defined(_WIN32) #define _Hide __attribute__((__visibility__("hidden"))) #else #define _Hide #endif #endif #ifndef privileged #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__visibility__) || defined(__GNUC__)) #define privileged _Section(".privileged") #else #define privileged _Section(".privileged") #endif #endif #ifndef noinstrument #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__no_instrument_function__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 204) #define noinstrument __attribute__((__no_instrument_function__)) #else #define noinstrument #endif #endif #ifndef wontreturn #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__noreturn__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 208) #define wontreturn __attribute__((__noreturn__)) #else #define wontreturn #endif #endif #ifndef nosideeffect #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__pure__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 296) #define nosideeffect __attribute__((__pure__)) #else #define nosideeffect #endif #endif #ifndef dontinline #ifdef _MSC_VER #define dontinline __declspec(noinline) #elif !defined(__STRICT_ANSI__) && \ (__has_attribute(__noinline__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 301) #define dontinline __attribute__((__noinline__)) #else #define dontinline #endif #endif #ifndef dontclone #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__noclone__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 405) #define dontclone __attribute__((__noclone__)) #else #define dontclone #endif #endif #ifndef forceinline #ifdef __cplusplus #define forceinline inline #else #if !defined(__STRICT_ANSI__) && \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 302 #if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403 || \ !defined(__cplusplus) || \ (defined(__clang__) && \ (defined(__GNUC_STDC_INLINE__) || defined(__GNUC_GNU_INLINE__))) #if defined(__GNUC_STDC_INLINE__) || defined(__cplusplus) #define forceinline \ static __inline __attribute__((__always_inline__, __gnu_inline__, \ __no_instrument_function__, __unused__)) #else #define forceinline \ static __inline __attribute__((__always_inline__, \ __no_instrument_function__, __unused__)) #endif /* __GNUC_STDC_INLINE__ */ #endif /* GCC >= 4.3 */ #elif defined(_MSC_VER) #define forceinline __forceinline #else #define forceinline static inline #endif /* !ANSI && GCC >= 3.2 */ #endif /* __cplusplus */ #endif /* forceinline */ #ifndef mayalias #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__may_alias__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 303) #define mayalias __attribute__((__may_alias__)) #else #define mayalias #endif #endif #ifndef dontdiscard #if !defined(__STRICT_ANSI__) && \ ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 304 || \ __has_attribute(__warn_unused_result__)) #define dontdiscard __attribute__((__warn_unused_result__)) #else #define dontdiscard #endif #endif #ifndef nullterminated #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__sentinel__) || __GNUC__ + 0 >= 4) #define nullterminated(x) __attribute__((__sentinel__ x)) #else #define nullterminated(x) #endif #endif #ifndef flattenout #if __has_attribute(__flatten__) || \ ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 401 && !defined(__llvm__)) #define flattenout __attribute__((__flatten__)) #else #define flattenout #endif #endif #ifndef externinline #if !defined(__STRICT_ANSI__) && \ (!defined(__cplusplus) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403 || \ (defined(__clang__) && \ (defined(__GNUC_STDC_INLINE__) || defined(__GNUC_GNU_INLINE__)))) #if defined(__GNUC_STDC_INLINE__) || defined(__cplusplus) #define externinline extern __inline __attribute__((__gnu_inline__)) #else #define externinline extern __inline __attribute__((__always_inline__)) #endif #else #define externinline inline #endif #endif #ifndef relegated #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__cold__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403) #define relegated __attribute__((__cold__)) #else #define relegated #endif #endif #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__warning__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403) #define warnifused(s) __attribute__((__warning__(s))) #else #define warnifused(s) #endif #ifndef firstclass #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__hot__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403) #define firstclass __attribute__((__hot__)) #else #define firstclass #endif #endif #ifndef paramsnonnull #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__nonnull__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403) #define paramsnonnull(opt_1idxs) __attribute__((__nonnull__ opt_1idxs)) #else #define paramsnonnull(opt_1idxs) #endif #endif #if __STDC_VERSION__ + 0 >= 199901L #define hasatleast static #else #define hasatleast #endif #if __STDC_VERSION__ + 0 < 199901L && !defined(restrict) #if !defined(__STRICT_ANSI__) && !defined(__cplusplus) && \ ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 301 || defined(_MSC_VER)) #define restrict __restrict__ #else #define restrict #define __restrict #endif #endif #ifndef nocallback #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__leaf__) || \ (!defined(__llvm__) && \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 406)) #define nocallback __attribute__((__leaf__)) #else #define nocallback #endif #endif #ifndef dontthrow #if defined(__cplusplus) && !defined(__STRICT_ANSI__) && \ (__has_attribute(dontthrow) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 303) #define dontthrow __attribute__((__nothrow__)) #elif defined(_MSC_VER) #define dontthrow __declspec(nothrow) #else #define dontthrow #endif #endif #ifndef dontoptimize #ifndef __STRICT_ANSI__ #if defined(__llvm__) || __has_attribute(__optnone__) #define dontoptimize __attribute__((__optnone__)) #elif (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407 || \ __has_attribute(__optimize__) #define dontoptimize __attribute__((__optimize__(0))) #endif #else #define dontoptimize #endif #endif #ifndef optimizesize #ifndef __STRICT_ANSI__ #if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407 || \ __has_attribute(__optimize__) #define optimizesize __attribute__((__optimize__("s"))) #elif defined(__llvm__) || __has_attribute(__optnone__) #define optimizesize __attribute__((__optnone__)) #endif #else #define optimizesize #endif #endif #ifndef optimizespeed #if !defined(__STRICT_ANSI__) && \ ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407 || \ __has_attribute(__optimize__)) #define optimizespeed __attribute__((__optimize__(3))) #else #define optimizespeed #endif #endif #ifndef unrollloops #if !defined(__STRICT_ANSI__) && \ ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407 || \ __has_attribute(__optimize__)) #define unrollloops __attribute__((__optimize__("unroll-loops"))) #else #define unrollloops #endif #endif #ifndef returnstwice #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__returns_twice__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 402) #define returnstwice __attribute__((__returns_twice__)) #else #define returnstwice #endif #endif #ifndef nodebuginfo #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__nodebug__) || defined(__llvm__)) #define nodebuginfo __attribute__((__nodebug__)) #else #define nodebuginfo #endif #endif #ifndef artificial #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__artificial__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 403) #define artificial __attribute__((__artificial__)) #else #define artificial #endif #endif #ifndef microarchitecture #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__target__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 404) #define microarchitecture(march) __attribute__((__target__(march))) #else #define microarchitecture(march) #endif #endif #ifndef targetclones #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__target_clones__) || __GNUC__ >= 6) #define targetclones(archs) __attribute__((__target_clones__(archs))) #else #define targetclones(archs) #endif #endif #if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 408 || \ __has_attribute(__force_align_arg_pointer__) #define forcealignargpointer __attribute__((__force_align_arg_pointer__)) #else #define forcealignargpointer "need modern compiler" #endif #ifndef returnsnonnull #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__returns_nonnull__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 409) #define returnsnonnull __attribute__((__returns_nonnull__)) #else #define returnsnonnull #endif #endif #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__assume_aligned__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 409) #define returnsaligned(x) __attribute__((__assume_aligned__ x)) #else #define returnsaligned(x) #endif #ifndef returnspointerwithnoaliases #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__malloc__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 409) #define returnspointerwithnoaliases __attribute__((__malloc__)) #elif defined(_MSC_VER) #define returnspointerwithnoaliases __declspec(allocator) #else #define returnspointerwithnoaliases #endif #endif #ifndef attributeallocsize #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__alloc_size__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 409) #define attributeallocsize(x) __attribute__((__alloc_size__ x)) #else #define attributeallocsize(x) #endif #endif #ifndef attributeallocalign #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__alloc_align__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 409) #define attributeallocalign(x) __attribute__((__alloc_align__ x)) #else #define attributeallocalign(x) #endif #endif #if __cplusplus + 0 >= 201103L #define autotype(x) auto #elif ((__has_builtin(__auto_type) || defined(__llvm__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 409) && \ !defined(__chibicc__)) #define autotype(x) __auto_type #else #define autotype(x) typeof(x) #endif #ifdef __x86_64__ #if __GNUC__ >= 7 || __has_attribute(__no_caller_saved_registers__) #define nocallersavedregisters __attribute__((__no_caller_saved_registers__)) #else #define nocallersavedregisters "need modern compiler" #endif #else #define nocallersavedregisters #endif #if ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 408 || \ __has_attribute(__no_sanitize_address__)) && \ !defined(__STRICT_ANSI__) #define noasan __attribute__((__no_sanitize_address__)) #else #define noasan #endif #if ((__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 408 || \ __has_attribute(__no_sanitize_undefined__)) && \ !defined(__STRICT_ANSI__) #define noubsan __attribute__((__no_sanitize_undefined__)) #else #define noubsan #endif #ifndef unreachable #define unreachable __builtin_unreachable() #endif #ifdef __STRICT_ANSI__ void abort(void) wontreturn; #define notpossible abort() #else #ifdef __x86_64__ #define notpossible \ do { \ asm("nop\n\t" \ "ud2\n\t" \ "nop"); \ unreachable; \ } while (0) #else #define notpossible __builtin_trap() #endif #endif #define donothing \ do { \ } while (0) #ifndef __STRICT_ANSI__ #define textstartup _Section(".text.startup") noinstrument #define textexit _Section(".text.exit") noinstrument #define textreal _Section(".text.real") #define texthead _Section(".text.head") #define textwindows _Section(".text.windows") #define antiquity _Section(".text.antiquity") #else #define textstartup #define textexit #define textreal #define texthead #define textwindows #define antiquity #endif #ifndef compatfn #define compatfn #endif #ifndef frownedupon #define frownedupon(alternative) #endif #if defined(__GNUC__) && !defined(__STRICT_ANSI__) #define _Vector_size(k) __attribute__((__vector_size__(k))) #else #define _Vector_size(k) [k] #endif #if defined(__STRICT_ANSI__) || \ (!defined(__GNUC__) && !defined(__builtin_offsetof)) #define offsetof(type, member) ((unsigned long)&((type *)0)->member) #else #define offsetof(type, member) __builtin_offsetof(type, member) #endif #ifdef __llvm__ #define __builtin_ia32_movntdq(x, y) (*(x) = (y)) #endif #ifndef _Section #if !defined(__STRICT_ANSI__) && !defined(__APPLE__) #define _Section(s) __attribute__((__section__(s))) #else #define _Section(s) #endif #endif #if defined(__x86_64__) && !defined(__llvm__) #define initarray _Section(".init_array,\"a\",@init_array #") #else #define initarray _Section(".init_array") #endif #ifndef __STRICT_ANSI__ #if defined(__GNUC__) || defined(__llvm__) #pragma GCC diagnostic ignored \ "-Wundef" /* complaints about __ASSEMBLER__/__LINKER__ */ #pragma GCC diagnostic ignored "-Wsign-compare" /* lint needs to change */ #pragma GCC diagnostic ignored "-Wtype-limits" /* makes macros unsafe */ #pragma GCC diagnostic ignored "-Woverflow" /* also breaks macros */ #pragma GCC diagnostic ignored "-Wformat" /* forces only gnu pf */ #pragma GCC diagnostic ignored "-Wunused-parameter" /* extreme prejudice */ #pragma GCC diagnostic ignored "-Wunused-function" /* contradicts dce! */ #pragma GCC diagnostic ignored "-Wunused-const-variable" /* let me dce */ #pragma GCC diagnostic ignored "-Wunused-variable" /* belongs in tidy */ #pragma GCC diagnostic ignored "-Wformat-extra-args" /* is also broken */ #pragma GCC diagnostic ignored "-Wparentheses" /* annoying tidy */ #pragma GCC diagnostic ignored "-Wdangling-else" /* come on tidy */ #pragma GCC diagnostic ignored "-Wformat-security" /* come on tidy */ #pragma GCC diagnostic ignored "-Wunused-value" /* breaks macros */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" /* libcxx */ #ifndef __cplusplus #pragma GCC diagnostic ignored "-Wimplicit-int" #pragma GCC diagnostic ignored "-Wc++-compat" #endif /* C++ */ #endif /* GCC || LLVM */ #if defined(__GNUC__) && !defined(__llvm__) /* why we need authorization to name a variable `yn' */ #pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" #pragma GCC diagnostic ignored "-Wfree-nonheap-object" /* broken #54202 */ #ifndef __cplusplus #if __GNUC__ >= 6 #pragma GCC diagnostic ignored /* wut */ "-Wdiscarded-qualifiers" #pragma GCC diagnostic ignored /* tidy */ "-Wunused-but-set-variable" #pragma GCC diagnostic ignored /* tidy */ "-Wunused-but-set-parameter" #endif /* GCC6+ */ #if __GNUC__ >= 8 #pragma GCC diagnostic ignored "-Wstringop-truncation" #pragma GCC diagnostic ignored "-Wstringop-overflow" /* breaks strndup */ #endif /* GCC8+ */ #if __GNUC__ + 0 >= 9 #pragma GCC diagnostic ignored /* "always true" breaks dce */ "-Waddress" #endif /* GCC9+ */ #endif /* !C++ */ #endif /* GCC && !LLVM */ #ifdef __llvm__ #pragma clang diagnostic ignored \ "-Wincompatible-pointer-types-discards-qualifiers" #pragma clang diagnostic ignored "-Wbuiltin-requires-header" #pragma clang diagnostic ignored "-Wparentheses-equality" /*-save-temps*/ #pragma clang diagnostic ignored "-Wunused-value" /*({-save-temps})*/ #pragma clang diagnostic ignored "-Wstring-plus-int" /* special ed */ #pragma clang diagnostic ignored "-Wunused-value" /* extreme prejudice */ #pragma clang diagnostic ignored "-Wbuiltin-requires-header" #pragma clang diagnostic ignored \ "-Wincompatible-pointer-types-discards-qualifiers" #endif /* !GCC && LLVM */ #endif /* ANSI */ #ifndef __W__ #ifndef __STRICT_ANSI__ #if defined(__GNUC__) || defined(__llvm__) #pragma GCC diagnostic error "-Wpointer-arith" #pragma GCC diagnostic error "-Wnonnull" #pragma GCC diagnostic error "-Wunused-result" #pragma GCC diagnostic error "-Wstrict-aliasing" #pragma GCC diagnostic error "-Wshift-negative-value" #ifndef __cplusplus #pragma GCC diagnostic error "-Wimplicit-function-declaration" #if __GNUC__ >= 6 #pragma GCC diagnostic error "-Wincompatible-pointer-types" #if __GNUC__ >= 8 #pragma GCC diagnostic error "-Wmultistatement-macros" #pragma GCC diagnostic error "-Wpacked-not-aligned" #pragma GCC diagnostic error "-Wcast-align=strict" #pragma GCC diagnostic error "-Wif-not-aligned" #endif /* GCC 8+ */ #endif /* GCC 6+ */ #endif /* __cplusplus */ #endif /* GCC || LLVM */ #if defined(__GNUC__) && !defined(__llvm__) #pragma GCC diagnostic error "-Wwrite-strings" #pragma GCC diagnostic error "-Wtrampolines" #if __GNUC__ >= 6 #pragma GCC diagnostic error "-Wnonnull-compare" #if defined(COSMO) && !defined(MODE_DBG) && !defined(STACK_FRAME_UNLIMITED) #pragma GCC diagnostic error "-Wframe-larger-than=131072" #if __GNUC__ >= 9 // #pragma GCC diagnostic error "-Walloca-larger-than=1024" // #pragma GCC diagnostic error "-Wvla-larger-than=1024" #endif /* GCC 9+ */ #endif /* STACK_FRAME_UNLIMITED */ #elif __GNUC__ >= 9 #pragma GCC diagnostic error /* e.g. fabs not abs */ "-Wabsolute-value" #endif /* GCC 6+ */ #endif /* GCC && !LLVM */ #ifdef __llvm__ #pragma clang diagnostic error "-Wassume" #endif /* !GCC && LLVM */ #endif /* ANSI */ #endif /* -w */ #ifndef __STRICT_ANSI__ #ifdef __x86_64__ #define DebugBreak() asm("int3") #else #define DebugBreak() __builtin_trap() #endif #else #define DebugBreak() (void)0 #endif #ifndef __STRICT_ANSI__ #define VEIL(CONSTRAINT, EXPRESSION) \ ({ \ autotype(EXPRESSION) VeiledValue = (EXPRESSION); \ asm("" : "=" CONSTRAINT ""(VeiledValue) : "0"(VeiledValue)); \ VeiledValue; \ }) #else #define VEIL(CONSTRAINT, EXPRESSION) (EXPRESSION) #endif #ifndef __STRICT_ANSI__ #define CONCEAL(CONSTRAINT, EXPRESSION) \ ({ \ autotype(EXPRESSION) VeiledValue = (EXPRESSION); \ asm volatile("" : "=" CONSTRAINT ""(VeiledValue) : "0"(VeiledValue)); \ VeiledValue; \ }) #else #define CONCEAL(CONSTRAINT, EXPRESSION) (EXPRESSION) #endif #ifndef __STRICT_ANSI__ #define EXPROPRIATE(EXPRESSION) \ ({ \ asm volatile("" ::"g"(EXPRESSION) : "memory"); \ 0; \ }) #else #define EXPROPRIATE(EXPRESSION) (EXPRESSION) #endif #if !defined(__STRICT_ANSI__) && !defined(__APPLE__) && defined(__x86_64__) #define YOINK(SYMBOL) \ asm(".section .yoink\n\tnopl\t%a0\n\t.previous" : : "X"(SYMBOL)) #elif defined(__aarch64__) #define YOINK(SYMBOL) \ asm(".section .yoink\n\tb\t%a0\n\t.previous" : : "X"(SYMBOL)) #else #define YOINK(SYMBOL) (void)0 #endif #if !defined(__STRICT_ANSI__) && !defined(__APPLE__) && defined(__x86_64__) #define STATIC_YOINK(SYMBOLSTR) \ asm(".section .yoink\n\tnopl\t\"" SYMBOLSTR "\"\n\t.previous") #elif defined(__aarch64__) #define STATIC_YOINK(SYMBOLSTR) \ asm(".section .yoink\n\tb\t\"" SYMBOLSTR "\"\n\t.previous") #else #define STATIC_YOINK(SYMBOLSTR) #endif #if !defined(IM_FEELING_NAUGHTY) #define STATIC_YOINK_SOURCE(PATH) STATIC_YOINK(PATH) #else #define STATIC_YOINK_SOURCE(PATH) #endif #define __strong_reference(sym, aliassym) \ extern typeof(sym) aliassym __attribute__((__alias__(#sym))) #define __weak_reference(sym, alias) \ asm(".weak\t" #alias "\n\t" \ ".equ\t" #alias ", " #sym) #define __funline \ extern __inline \ __attribute__((__gnu_inline__, __always_inline__, __artificial__)) #define MACHINE_CODE_ANALYSIS_BEGIN_ #define MACHINE_CODE_ANALYSIS_END_
25,521
868
jart/cosmopolitan
false
cosmopolitan/libc/integral/llp64.inc
#define __INT8_MAX__ 0x7f #define __UINT8_MAX__ 0xff #define __INT16_MAX__ 0x7fff #define __UINT16_MAX__ 0xffff #define __SHRT_MAX__ 0x7fff #define __INT_MAX__ 0x7fffffff #define __INT32_MAX__ 0x7fffffff #define __UINT32_MAX__ 0xffffffffu #define __INT64_MAX__ 0x7fffffffffffffffl #define __UINT64_MAX__ 0xffffffffffffffffull #define __SIZE_MAX__ 0xffffffffffffffffull #define __INTPTR_MAX__ 0x7fffffffffffffffll #define __UINTPTR_MAX__ 0xffffffffffffffffull #define __WINT_MAX__ 0xffffffffu #define __SIZEOF_SHORT__ 2 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 4 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_POINTER__ 8 #define __SIZEOF_PTRDIFF_T__ 8 #define __SIZEOF_SIZE_T__ 4 #define __SIZEOF_WCHAR_T__ 4 #define __SIZEOF_WINT_T__ 4 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_FLOAT128__ 16 #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT80__ 16 #define __SIZEOF_LONG_DOUBLE__ 16 #define __INT8_C(c) c #define __UINT8_C(c) c #define __INT16_C(c) c #define __UINT16_C(c) c #define __INT32_C(c) c #define __UINT32_C(c) c##U #define __INT64_C(c) c##LL #define __UINT64_C(c) c##ULL #if !(__ASSEMBLER__ + __LINKER__ + 0) #define __INT8_TYPE__ signed char #define __UINT8_TYPE__ unsigned char #define __INT16_TYPE__ short int #define __UINT16_TYPE__ short unsigned int #define __INT32_TYPE__ int #define __UINT32_TYPE__ unsigned int #define __INT64_TYPE__ long long int #define __UINT64_TYPE__ long long unsigned int #define __INTPTR_TYPE__ long long int #define __UINTPTR_TYPE__ long long unsigned int #define __PTRDIFF_TYPE__ long long int #define __SIZE_TYPE__ unsigned int #define __WCHAR_TYPE__ int #define __CHAR16_TYPE__ short unsigned int #define __CHAR32_TYPE__ unsigned int #define __WINT_TYPE__ unsigned int #define __INT_LEAST8_TYPE__ __INT8_TYPE__ #define __UINT_LEAST8_TYPE__ __UINT8_TYPE__ #define __INT_LEAST16_TYPE__ __INT32_TYPE__ #define __UINT_LEAST16_TYPE__ __UINT16_TYPE__ #define __INT_LEAST32_TYPE__ __INT16_TYPE__ #define __UINT_LEAST32_TYPE__ __UINT32_TYPE__ #define __INT_LEAST64_TYPE__ __INT64_TYPE__ #define __UINT_LEAST64_TYPE__ __UINT64_TYPE__ #define __INT_FAST8_TYPE__ __INT8_TYPE__ #define __UINT_FAST8_TYPE__ __UINT8_TYPE__ #define __INT_FAST16_TYPE__ __INT32_TYPE__ #define __UINT_FAST16_TYPE__ __UINT32_TYPE__ #define __INT_FAST32_TYPE__ __INT32_TYPE__ #define __UINT_FAST32_TYPE__ __UINT32_TYPE__ #define __INT_FAST64_TYPE__ __INT64_TYPE__ #define __UINT_FAST64_TYPE__ __UINT64_TYPE__ #endif
2,586
77
jart/cosmopolitan
false
cosmopolitan/libc/integral/normalize.inc
#define __COSMOPOLITAN__ 1 #ifndef __COUNTER__ #define __COUNTER__ __LINE__ #endif #if __GNUC__ + 0 < 2 #undef __GNUC__ #elif defined(__GNUC__) && defined(SWIG) /* lool */ #undef __GNUC__ #elif defined(__GNUC__) && defined(__NVCC__) /* lool */ #undef __GNUC__ #elif !defined(__GNUC__) && defined(__APPLE__) /* modesty */ #define __GNUC__ 4 #define __GNUC_MINOR__ 2 #define __GNUC_PATCHLEVEL__ 1 #elif !defined(__GNUC__) && defined(__TINYC__) #define __GNUC__ 2 #define __GNUC_MINOR__ 0 #define __GNUC_PATCHLEVEL__ 0 #endif #if !defined(__x86_64__) && \ (defined(__amd64__) || (defined(_M_AMD64) && defined(_M_X64))) #define __x86_64__ 1 #elif !defined(__i386__) && ((defined(__i486__) || defined(__i586__) || \ defined(__i686__) || defined(__i786__)) || \ _M_IX86 + 0 >= 400) #define __i386__ 1 #elif !defined(__ia16__) && (defined(__MSDOS__) || defined(__BCC__)) #define __ia16__ 1 #endif #if __ia16__ + __i386__ + __x86_64__ + 0 #define __x86__ 1 #endif #ifdef _MSC_VER #define __STRICT_ANSI__ #ifndef __STDC__ #define __STDC__ #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_builtin #define __has_builtin(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef __has_extension #define __has_extension(x) 0 #endif #ifdef unix #undef unix #endif #ifdef linux #undef linux #endif #ifndef __BIGGEST_ALIGNMENT__ #define __BIGGEST_ALIGNMENT__ 16 #endif /* TODO(jart): Remove this in favor of GetStackSize() */ #ifdef COSMO #define STACKSIZE 262144 /* 256kb stack */ #else #define STACKSIZE 8388608 /* 8mb stack */ #endif #define BIGPAGESIZE 0x200000 #define FRAMESIZE 0x10000 /* 8086 */ #define GUARDSIZE 0x4000 /* b/c apple m1 */ #define PAGESIZE 0x1000 /* i386+ */ #define BUFSIZ 0x1000 /* best stdio default */ #define CACHELINE 0x40 /* nexgen32e */ #define CHAR_BIT 8 /* b/c von neumann */ #define ARG_MAX 0xfffe /* for argv and envp; see CreateProcess (32767*2) */ #define PATH_MAX 1024 /* b/c _XOPEN_PATH_MAX */ #define NAME_MAX 255 /* 511 on netbsd */ #define CHILD_MAX 16 /* only if malloc isn't linked */ #define OPEN_MAX 16 /* only if malloc isn't linked */ #define ATEXIT_MAX 32 /* only if malloc isn't linked */ #define NSIG 128 /* b/c freebsd */ #if defined(__LP64__) && !defined(__INT64_TYPE__) #include "libc/integral/lp64.inc" #elif defined(_MSC_VER) && !defined(__INT64_TYPE__) #include "libc/integral/llp64.inc" #endif #if !(__ASSEMBLER__ + __LINKER__ + 0) #ifdef __STDC__ #include "libc/integral/c.inc" #else #define const #define volatile #endif #ifdef __cplusplus #include "libc/integral/cxx.inc" #endif #endif
2,788
108
jart/cosmopolitan
false
cosmopolitan/libc/integral/lp64.inc
#define __INT8_MAX__ 0x7f #define __UINT8_MAX__ 0xff #define __INT16_MAX__ 0x7fff #define __UINT16_MAX__ 0xffff #define __SHRT_MAX__ 0x7fff #define __INT_MAX__ 0x7fffffff #define __INT32_MAX__ 0x7fffffff #define __UINT32_MAX__ 0xffffffffu #define __INT64_MAX__ 0x7fffffffffffffffl #define __UINT64_MAX__ 0xfffffffffffffffful #define __SIZE_MAX__ 0xfffffffffffffffful #define __INTPTR_MAX__ 0x7fffffffffffffffl #define __UINTPTR_MAX__ 0xfffffffffffffffful #define __WINT_MAX__ 0xffffffffu #define __UINTMAX_MAX__ 0xffffffffffffffffUL #define __INTMAX_MAX__ 0x7fffffffffffffffL #define __SIZEOF_SHORT__ 2 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 8 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_POINTER__ 8 #define __SIZEOF_PTRDIFF_T__ 8 #define __SIZEOF_SIZE_T__ 8 #define __SIZEOF_WCHAR_T__ 4 #define __SIZEOF_WINT_T__ 4 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_FLOAT128__ 16 #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT80__ 16 #define __SIZEOF_LONG_DOUBLE__ 16 #if !(__ASSEMBLER__ + __LINKER__ + 0) #define __CHAR16_TYPE__ short unsigned int #define __CHAR32_TYPE__ unsigned int #define __INT16_TYPE__ short int #define __INT32_TYPE__ int #define __INT64_TYPE__ long int #define __INT8_TYPE__ signed char #define __INTMAX_TYPE__ long int #define __INTPTR_TYPE__ long int #define __PTRDIFF_TYPE__ long int #define __SIZE_TYPE__ long unsigned int #define __UINT16_TYPE__ short unsigned int #define __UINT32_TYPE__ unsigned int #define __UINT64_TYPE__ long unsigned int #define __UINT8_TYPE__ unsigned char #define __UINTMAX_TYPE__ long unsigned int #define __UINTPTR_TYPE__ long unsigned int #define __WCHAR_TYPE__ int #define __WINT_TYPE__ unsigned int #define __INT_LEAST8_TYPE__ __INT8_TYPE__ #define __UINT_LEAST8_TYPE__ __UINT8_TYPE__ #define __INT_LEAST16_TYPE__ __INT32_TYPE__ #define __UINT_LEAST16_TYPE__ __UINT16_TYPE__ #define __INT_LEAST32_TYPE__ __INT16_TYPE__ #define __UINT_LEAST32_TYPE__ __UINT32_TYPE__ #define __INT_LEAST64_TYPE__ __INT64_TYPE__ #define __UINT_LEAST64_TYPE__ __UINT64_TYPE__ #define __INT_FAST8_TYPE__ __INT8_TYPE__ #define __UINT_FAST8_TYPE__ __UINT8_TYPE__ #define __INT_FAST16_TYPE__ __INT32_TYPE__ #define __UINT_FAST16_TYPE__ __UINT32_TYPE__ #define __INT_FAST32_TYPE__ __INT32_TYPE__ #define __UINT_FAST32_TYPE__ __UINT32_TYPE__ #define __INT_FAST64_TYPE__ __INT64_TYPE__ #define __UINT_FAST64_TYPE__ __UINT64_TYPE__ #endif
2,523
72
jart/cosmopolitan
false
cosmopolitan/libc/integral/cxx.inc
#define COSMOPOLITAN_CXX_START_ namespace cosmo { #define COSMOPOLITAN_CXX_END_ } #define COSMOPOLITAN_CXX_USING_ using namespace cosmo; #define COSMOPOLITAN_C_START_ extern "C" { #define COSMOPOLITAN_C_END_ } #if !defined(__builtin_types_compatible_p) && !__has_builtin(types_compatible_p) #if 0 /* todo jart whyyyy */ #include "libc/integral/cxxtypescompat.inc" #define __builtin_types_compatible_p(A, B) \ (__cxx_types_compatible<A, B>::_value) #else #define __builtin_types_compatible_p(A, B) 0 #endif #endif #if !defined(__builtin_choose_expr) && !__has_builtin(choose_expr) #if 1 template <bool _P, typename _T, typename _U> struct __cxx_choose_expr { __cxx_choose_expr(_T _a, _U _b) : _value(_a) {} const _T _value; }; template <typename _T, typename _U> struct __cxx_choose_expr<false, _T, _U> { __cxx_choose_expr(_T _a, _U _b) : _value(_b) {} const _U _value; }; #define __builtin_choose_expr(X, A, B) \ (__cxx_choose_expr<X, typeof(A), typeof(B)>(A, B)._value) #else #define __builtin_choose_expr(X, A, B) ((X) ? (A) : (B)) #endif #endif
1,070
35
jart/cosmopolitan
false
cosmopolitan/libc/integral/cxxtypescompat.inc
#define NAME __cxx_types_compatible #define QUALIFIED(Q1, Q2) \ template <class _T, class _U> \ struct NAME<_T Q1, _U Q2> : NAME<_T, _U> {} template <class, class> struct NAME { enum { _value = 0 }; }; template <class _T> struct NAME<_T, _T> { enum { _value = 1 }; }; template <class _T, size_t N> struct NAME<_T[], _T[N]> { enum { _value = 1 }; }; template <class _T, size_t N> struct NAME<_T[N], _T[]> { enum { _value = 1 }; }; QUALIFIED(const volatile, ); QUALIFIED(const volatile, const); QUALIFIED(const, const volatile); QUALIFIED(volatile, const volatile); QUALIFIED(const volatile, volatile); QUALIFIED(const, volatile); QUALIFIED(volatile, const); QUALIFIED(, const); QUALIFIED(const, ); QUALIFIED(, volatile); QUALIFIED(volatile, ); #undef QUALIFIED #undef NAME
796
40
jart/cosmopolitan
false
cosmopolitan/libc/sysv/restorert.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 sw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/sysv/consts/nrlinux.h" #include "libc/macros.internal.h" .privileged // Linux Signal Trampoline (HOLY CODE) __restore_bt: nop .endfn __restore_bt,globl,hidden nop // gap so that __get_symbol(st, addr - 1) fails .balign 16 __restore_rt: // @see gdb/amd64-linux-tdep.c #ifdef __x86_64__ mov $__NR_linux_sigreturn,%rax // [sic] syscall #elif defined(__aarch64__) mov x8,#139 // __NR_rt_sigreturn svc #0 #elif defined(__powerpc64__) li 0,172 // __NR_rt_sigreturn sc #endif /* __x86_64__ */ .balign 16 .endfn __restore_rt,globl,hidden
2,404
42
jart/cosmopolitan
false
cosmopolitan/libc/sysv/macros.internal.h
#ifndef COSMOPOLITAN_LIBC_SYSV_MACROS_H_ #define COSMOPOLITAN_LIBC_SYSV_MACROS_H_ #include "libc/macros.internal.h" #ifdef __ASSEMBLER__ /* clang-format off */ /** * @fileoverview System Five jump slot generator. * * We need to pass a magic number to the SYSCALL instruction in %rax. * That's only possible to do in C using asm() macro wrappers, like in * Chromium's "System Call Support" library. This technique is simpler * to implement, gains us object-level ABI compatibility, hookability, * and the ability to support significantly more functions, without the * risk of slowing down builds too much with complicated headers. */ .macro .scall name:req amd:req arm_linux:req arm_xnu:req kw1 kw2 .section .text.syscall,"ax",@progbits #ifdef __x86_64__ .ifnb \kw2 .balign 16 \name: movabs $\amd,%rax jmp *__systemfive(%rip) .else \name: push %rbp mov %rsp,%rbp movabs $\amd,%rax .hookable call *__systemfive(%rip) pop %rbp ret .endif .endfn \name,\kw1,\kw2 #elif defined(__aarch64__) .ifc \arm_linux,4095 .ifc \arm_xnu,4095 // return enosys(); \name: b enosys .endfn \name,\kw1,\kw2 .else // return IsXnu() ? syscall(x16, ...) : syscall(x8, ...); \name: adrp x9,__hostos ldr w9,[x9,#:lo12:__hostos] tbz x9,#3,1f // !IsXnu() mov x16,#\arm_xnu // apple ordinal svc #0 // issue system call bcs 1f b _sysret 1: neg x0,x0 b _sysret .hidden _sysret .endfn \name,\kw1,\kw2 .endif .else .ifc \arm_xnu,4095 // return IsLinux() ? syscall(x8, ...) : enosys(); \name: adrp x9,__hostos ldr w9,[x9,#:lo12:__hostos] tbz x9,#0,1f // !IsLinux() mov x8,#\arm_linux // systemd ordinal svc #0 // issue system call mov x1,#\arm_linux b _sysret .hidden _sysret 1: b enosys .endfn \name,\kw1,\kw2 .else \name: mov x16,#\arm_xnu // apple ordinal mov x8,#\arm_linux // systemd ordinal mov x9,#0 // clear carry flag adds x9,x9,#0 // clear carry flag svc #0 // issue system call bcs 1f b _sysret 1: neg x0,x0 b _sysret .hidden _sysret .endfn \name,\kw1,\kw2 .endif .endif #else #error "architecture unsupported" #endif .previous .endm /* clang-format on */ #endif /* __ASSEMBLER__ */ #endif /* COSMOPOLITAN_LIBC_SYSV_MACROS_H_ */
2,212
91
jart/cosmopolitan
false
cosmopolitan/libc/sysv/errno.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2021 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" /** * Global variable for last error. * * The system call wrappers update this with WIN32 error codes. * Unlike traditional libraries, Cosmopolitan error codes are * defined as variables. By convention, system calls and other * functions do not update this variable when nothing's broken. * * @see libc/sysv/consts.sh * @see libc/sysv/errfuns.h * @see __errno_location() stable abi */ errno_t __errno;
2,274
34
jart/cosmopolitan
false
cosmopolitan/libc/sysv/errno_location.greg.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2022 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/thread/tls2.h" /** * Returns address of errno variable. */ nocallersavedregisters errno_t *(__errno_location)(void) { if (!__tls_enabled) return &__errno; return &__get_tls_privileged()->tib_errno; }
2,082
29
jart/cosmopolitan
false
cosmopolitan/libc/sysv/sysv.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += LIBC_SYSV LIBC_SYSV_LIBS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_A)) LIBC_SYSV_ARCHIVES = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_A)) LIBC_SYSV_HDRS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_HDRS)) LIBC_SYSV_INCS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_INCS)) LIBC_SYSV_BINS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_BINS)) LIBC_SYSV_CHECKS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_CHECKS)) LIBC_SYSV_OBJS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_OBJS)) LIBC_SYSV_TESTS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_TESTS)) LIBC_SYSV_SRCS = $(foreach x,$(LIBC_SYSV_ARTIFACTS),$($(x)_SRCS)) #─────────────────────────────────────────────────────────────────────────────── LIBC_SYSV = \ $(LIBC_SYSV_A_DEPS) \ $(LIBC_SYSV_A) LIBC_SYSV_ARTIFACTS += LIBC_SYSV_A LIBC_SYSV_A = o/$(MODE)/libc/sysv/sysv.a LIBC_SYSV_A_HDRS = $(filter %.h,$(LIBC_SYSV_A_FILES)) LIBC_SYSV_A_INCS = $(filter %.inc,$(LIBC_SYSV_A_FILES)) LIBC_SYSV_A_SRCS_C = $(filter %.c,$(LIBC_SYSV_A_FILES)) LIBC_SYSV_A_SRCS_A = $(filter %.s,$(LIBC_SYSV_A_FILES)) LIBC_SYSV_A_SRCS_S = $(filter %.S,$(LIBC_SYSV_A_FILES)) LIBC_SYSV_A_CHECKS = $(LIBC_SYSV_A).pkg LIBC_SYSV_A_DIRECTDEPS = \ LIBC_NEXGEN32E LIBC_SYSV_A_FILES := \ libc/sysv/macros.internal.h \ libc/sysv/errfuns.h \ libc/sysv/hostos.S \ libc/sysv/syscon.S \ libc/sysv/syslib.S \ libc/sysv/syscount.S \ libc/sysv/restorert.S \ libc/sysv/syscall.S \ libc/sysv/systemfive.S \ libc/sysv/errno_location.greg.c \ libc/sysv/sysret.c \ libc/sysv/errno.c \ libc/sysv/errfun.S \ libc/sysv/errfun2.c \ libc/sysv/strace.greg.c \ libc/sysv/describeos.greg.c \ $(wildcard libc/sysv/consts/*) \ $(wildcard libc/sysv/errfuns/*) \ $(wildcard libc/sysv/dos2errno/*) LIBC_SYSV_A_SRCS = \ $(LIBC_SYSV_A_SRCS_A) \ $(LIBC_SYSV_A_SRCS_C) \ $(LIBC_SYSV_A_SRCS_S) LIBC_SYSV_A_OBJS = \ $(LIBC_SYSV_A_SRCS_A:%.s=o/$(MODE)/%.o) \ $(LIBC_SYSV_A_SRCS_C:%.c=o/$(MODE)/%.o) \ $(LIBC_SYSV_A_SRCS_S:%.S=o/$(MODE)/%.o) LIBC_SYSV_A_DEPS := \ $(call uniq,$(foreach x,$(LIBC_SYSV_A_DIRECTDEPS),$($(x)))) $(LIBC_SYSV_A): libc/sysv/ \ libc/sysv/consts/ \ libc/sysv/errfuns/ \ $(LIBC_SYSV_A).pkg \ $(LIBC_SYSV_A_OBJS) $(LIBC_SYSV_A).pkg: \ $(LIBC_SYSV_A_OBJS) \ $(foreach x,$(LIBC_SYSV_A_DIRECTDEPS),$($(x)_A).pkg) o/$(MODE)/libc/sysv/errno.o \ o/$(MODE)/libc/sysv/sysret.o \ o/$(MODE)/libc/sysv/errfun2.o \ o/$(MODE)/libc/sysv/sysret.o: private \ OVERRIDE_CFLAGS += \ $(NO_MAGIC) #─────────────────────────────────────────────────────────────────────────────── LIBC_SYSV_CALLS = \ $(LIBC_SYSV_CALLS_A_DEPS) \ $(LIBC_SYSV_CALLS_A) LIBC_SYSV_ARTIFACTS += LIBC_SYSV_CALLS_A LIBC_SYSV_CALLS_A = o/$(MODE)/libc/sysv/calls.a LIBC_SYSV_CALLS_A_SRCS := $(wildcard libc/sysv/calls/*.S) LIBC_SYSV_CALLS_A_OBJS = $(LIBC_SYSV_CALLS_A_SRCS:%.S=o/$(MODE)/%.o) LIBC_SYSV_CALLS_A_CHECKS = $(LIBC_SYSV_CALLS_A).pkg LIBC_SYSV_CALLS_A_DIRECTDEPS = \ LIBC_SYSV LIBC_SYSV_CALLS_A_DEPS := \ $(call uniq,$(foreach x,$(LIBC_SYSV_CALLS_A_DIRECTDEPS),$($(x)))) $(LIBC_SYSV_CALLS_A): \ libc/sysv/calls/ \ $(LIBC_SYSV_CALLS_A).pkg \ $(LIBC_SYSV_CALLS_A_OBJS) $(LIBC_SYSV_CALLS_A).pkg: \ $(LIBC_SYSV_CALLS_A_OBJS) \ $(foreach x,$(LIBC_SYSV_CALLS_A_DIRECTDEPS),$($(x)_A).pkg) #─────────────────────────────────────────────────────────────────────────────── LIBC_SYSV_MACHCALLS = \ $(LIBC_SYSV_MACHCALLS_A_DEPS) \ $(LIBC_SYSV_MACHCALLS_A) LIBC_SYSV_ARTIFACTS += LIBC_SYSV_MACHCALLS_A LIBC_SYSV_MACHCALLS_A = o/$(MODE)/libc/sysv/machcalls.a LIBC_SYSV_MACHCALLS_A_SRCS := $(wildcard libc/sysv/machcalls/*.s) LIBC_SYSV_MACHCALLS_A_OBJS = $(LIBC_SYSV_MACHCALLS_A_SRCS:%.s=o/$(MODE)/%.o) LIBC_SYSV_MACHCALLS_A_CHECKS = $(LIBC_SYSV_MACHCALLS_A).pkg LIBC_SYSV_MACHCALLS_A_DIRECTDEPS = \ LIBC_SYSV LIBC_SYSV_MACHCALLS_A_DEPS := \ $(call uniq,$(foreach x,$(LIBC_SYSV_MACHCALLS_A_DIRECTDEPS),$($(x)))) $(LIBC_SYSV_MACHCALLS_A): \ libc/sysv/machcalls/ \ $(LIBC_SYSV_MACHCALLS_A).pkg \ $(LIBC_SYSV_MACHCALLS_A_OBJS) $(LIBC_SYSV_MACHCALLS_A).pkg: \ $(LIBC_SYSV_MACHCALLS_A_OBJS) \ $(foreach x,$(LIBC_SYSV_MACHCALLS_A_DIRECTDEPS),$($(x)_A).pkg) #─────────────────────────────────────────────────────────────────────────────── # let aarch64 compile these o/$(MODE)/libc/sysv/syscon.o: libc/sysv/syscon.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/hostos.o: libc/sysv/hostos.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/syslib.o: libc/sysv/syslib.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/syscount.o: libc/sysv/syscount.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/restorert.o: libc/sysv/restorert.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/calls/%.o: libc/sysv/calls/%.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/consts/%.o: libc/sysv/consts/%.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/errfuns/%.o: libc/sysv/errfuns/%.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/$(MODE)/libc/sysv/dos2errno/%.o: libc/sysv/dos2errno/%.S @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< #─────────────────────────────────────────────────────────────────────────────── .PHONY: o/$(MODE)/libc/sysv o/$(MODE)/libc/sysv: $(LIBC_SYSV_CHECKS)
6,543
164
jart/cosmopolitan
false
cosmopolitan/libc/sysv/consts.sh
/*bin/echo ' -*- mode:sh; indent-tabs-mode:nil; tab-width:8; coding:utf-8 -*-│ │vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚────────────────────────────────────────────────────────────────'>/dev/null #*/ dir=libc/sysv/consts . libc/sysv/gen.sh # The Fifth Bell System, Community Edition # » catalogue of carnage # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon errno ENOSYS 38 38 78 78 78 78 78 1 # system call unavailable; bsd consensus; kNtErrorInvalidFunction syscon errno EPERM 1 1 1 1 1 1 1 12 # operation not permitted; unix consensus; kNtErrorInvalidAccess (should be kNtErrorNotOwner but is that mutex only??); raised by accept(2), acct(2), add_key(2), adjtimex(2), arch_prctl(2), bdflush(2), bpf(2), capget(2), chmod(2), chown(2), chroot(2), clock_getres(2), clone(2), copy_file_range(2), create_module(2), delete_module(2), epoll_ctl(2), execve(2), fallocate(2), fanotify_init(2), fcntl(2), futex(2), get_robust_list(2), getdomainname(2), getgroups(2), gethostname(2), getpriority(2), getrlimit(2), getsid(2), gettimeofday(2), idle(2), init_module(2), io_submit(2), ioctl_console(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), ioctl_ns(2), ioctl_tty(2), ioperm(2), iopl(2), ioprio_set(2), kcmp(2), kexec_load(2), keyctl(2), kill(2), link(2), lookup_dcookie(2), madvise(2), mbind(2), membarrier(2), migrate_pages(2), mkdir(2), mknod(2), mlock(2), mmap(2), mount(2), move_pages(2), msgctl(2), nice(2), open(2), open_by_handle_at(2), pciconfig_read(2), perf_event_open(2), pidfd_getfd(2), pidfd_send_signal(2), pivot_root(2), prctl(2), process_vm_readv(2), ptrace(2), quotactl(2), reboot(2), rename(2), request_key(2), rmdir(2), rt_sigqueueinfo(2), sched_setaffinity(2), sched_setattr(2), sched_setparam(2), sched_setscheduler(2), semctl(2), seteuid(2), setfsgid(2), setfsuid(2), setgid(2), setns(2), setpgid(2), setresuid(2), setreuid(2), setsid(2), setuid(2), setup(2), setxattr(2), shmctl(2), shmget(2), sigaltstack(2), spu_create(2), stime(2), swapon(2), symlink(2), syslog(2), timer_create(2), timerfd_create(2), tkill(2), truncate(2), umount(2), unlink(2), unshare(2), utime(2), utimensat(2), vhangup(2), vm86(2), write(2), unix(7), ip(7) syscon errno ENOENT 2 2 2 2 2 2 2 2 # no such file or directory; unix consensus; kNtErrorFileNotFound; raised by access(2), acct(2), alloc_hugepages(2), bind(2), bpf(2), chdir(2), chmod(2), chown(2), chroot(2), clock_getres(2), delete_module(2), epoll_ctl(2), execve(2), execveat(2), fanotify_mark(2), getdents(2), inotify_add_watch(2), ioctl_fat(2), kcmp(2), keyctl(2), link(2), mkdir(2), mknod(2), mount(2), msgget(2), open(2), open_by_handle_at(2), perf_event_open(2), query_module(2), quotactl(2), readdir(2), readlink(2), rename(2), rmdir(2), semget(2), shmget(2), spu_create(2), stat(2), statfs(2), statx(2), swapon(2), symlink(2), truncate(2), umount(2), unlink(2), utime(2), utimensat(2), unix(7), ip(7) syscon errno ESRCH 3 3 3 3 3 3 3 566 # no such process; kNtErrorThreadNotInProcess (cf. kNtErrorInvalidHandle); raised by capget(2), get_robust_list(2), getpriority(2), getrlimit(2), getsid(2), ioprio_set(2), kcmp(2), kill(2), migrate_pages(2), move_pages(2), perf_event_open(2), pidfd_getfd(2), pidfd_open(2), pidfd_send_signal(2), process_vm_readv(2), ptrace(2), quotactl(2), rt_sigqueueinfo(2), sched_rr_get_interval(2), sched_setaffinity(2), sched_setattr(2), sched_setparam(2), sched_setscheduler(2), set_thread_area(2), setpgid(2), tkill(2), utimensat(2), unix(7) syscon errno EINTR 4 4 4 4 4 4 4 10004 # the greatest of all errnos; crucial for building real time reliable software; unix consensus; WSAEINTR; raised by accept(2), clock_nanosleep(2), close(2), connect(2), dup(2), epoll_wait(2), fallocate(2), fcntl(2), flock(2), futex(2), getrandom(2), io_getevents(2), msgop(2), nanosleep(2), open(2), pause(2), perf_event_open(2), poll(2), ptrace(2), read(2), recv(2), request_key(2), select(2), semop(2), send(2), sigsuspend(2), sigwaitinfo(2), spu_run(2), statfs(2), truncate(2), wait(2), write(2) syscon errno EIO 5 5 5 5 5 5 5 1117 # unix consensus; kNtErrorIoDevice; raised by access(2) acct(2) chdir(2) chmod(2) chown(2) chroot(2) close(2) copy_file_range(2) execve(2) fallocate(2) fsync(2) ioperm(2) link(2) madvise(2) mbind(2) pciconfig_read(2) ptrace(2) read(2) readlink(2) sendfile(2) statfs(2) symlink(2) sync_file_range(2) truncate(2) unlink(2) write(2) syscon errno ENXIO 6 6 6 6 6 6 6 1112 # no such device or address; unix consensus; kNtErrorNoMediaInDrive; raised by lseek(2), mount(2), open(2), prctl(2) syscon errno E2BIG 7 7 7 7 7 7 7 1639 # argument list too long; unix consensus; kNtErrorInvalidCommandLine; raised by bpf(2), execve(2), getxattr(2), listxattr(2), move_pages(2), msgop(2), openat2(2), perf_event_open(2), sched_setattr(2), semop(2) syscon errno ENOEXEC 8 8 8 8 8 8 8 193 # exec format error; unix consensus; kNtErrorBadExeFormat; raised by execve(2), init_module(2), kexec_load(2), uselib(2) syscon errno EBADF 9 9 9 9 9 9 9 6 # bad file descriptor; cf. EBADFD; unix consensus; kNtErrorInvalidHandle; raised by accept(2), access(2), bind(2), bpf(2), chdir(2), chmod(2), chown(2), close(2), connect(2), copy_file_range(2), dup(2), epoll_ctl(2), epoll_wait(2), execveat(2), fallocate(2), fanotify_mark(2), fcntl(2), flock(2), fsync(2), futimesat(2), getdents(2), getpeername(2), getsockname(2), getsockopt(2), init_module(2), inotify_add_watch(2), inotify_rm_watch(2), io_submit(2), ioctl(2), ioctl_console(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), ioctl_getfsmap(2), kcmp(2), kexec_load(2), link(2), listen(2), llseek(2), lseek(2), madvise(2), mkdir(2), mknod(2), mmap(2), open(2), open_by_handle_at(2), perf_event_open(2), pidfd_getfd(2), pidfd_send_signal(2), posix_fadvise(2), prctl(2), read(2), readahead(2), readdir(2), readlink(2), recv(2), rename(2), select(2), send(2), sendfile(2), setns(2), shutdown(2), signalfd(2), splice(2), spu_run(2), stat(2), statfs(2), statx(2), symlink(2), sync(2), sync_file_range(2), timerfd_create(2), truncate(2), unlink(2), utimensat(2), vmsplice(2), write(2), unix(7) syscon errno ECHILD 10 10 10 10 10 10 10 128 # no child process; unix consensus; kNtErrorWaitNoChildren; raised by wait(2), waitpid(2), waitid(2), wait3(2), wait4(2) syscon errno EAGAIN 11 11 35 35 35 35 35 10035 # resource temporarily unavailable (e.g. SO_RCVTIMEO expired, too many processes, too much memory locked, read or write with O_NONBLOCK needs polling, etc.); bsd consensus; WSAEWOULDBLOCK; raised by accept(2), clone(2), connect(2), eventfd(2), fcntl(2), fork(2), futex(2), getrandom(2), io_cancel(2), io_setup(2), io_submit(2), ioctl_userfaultfd(2), keyctl(2), madvise(2), mincore(2), mlock(2), mmap(2), mremap(2), msgop(2), openat2(2), poll(2), read(2), rt_sigqueueinfo(2), select(2), semop(2), send(2), sendfile(2), setresuid(2), setreuid(2), setuid(2), signalfd(2), sigwaitinfo(2), splice(2), tee(2), timer_create(2), timerfd_create(2), tkill(2), umount(2), vmsplice(2), write(2), ip(7) syscon errno ENOMEM 12 12 12 12 12 12 12 14 # we require more vespene gas; unix consensus; kNtErrorOutofmemory; raised by access(2), acct(2), add_key(2), bind(2), bpf(2), chdir(2), chmod(2), chown(2), chroot(2), clone(2), copy_file_range(2), create_module(2), epoll_create(2), epoll_ctl(2), eventfd(2), execve(2), fanotify_init(2), fanotify_mark(2), fork(2), getgroups(2), getrlimit(2), init_module(2), inotify_add_watch(2), inotify_init(2), io_setup(2), ioctl_fideduperange(2), ioctl_getfsmap(2), ioperm(2), kexec_load(2), keyctl(2), link(2), lookup_dcookie(2), madvise(2), mbind(2), memfd_create(2), mincore(2), mkdir(2), mknod(2), mlock(2), mmap(2), mount(2), mprotect(2), mremap(2), msgget(2), msgop(2), msync(2), open(2), pidfd_open(2), poll(2), process_vm_readv(2), readlink(2), recv(2), rename(2), request_key(2), rmdir(2), s390_guarded_storage(2), s390_pci_mmio_write(2), s390_runtime_instr(2), s390_sthyi(2), select(2), semget(2), semop(2), send(2), sendfile(2), set_mempolicy(2), setns(2), shmctl(2), shmget(2), shmop(2), sigaltstack(2), signalfd(2), splice(2), spu_create(2), spu_run(2), stat(2), statfs(2), statx(2), subpage_prot(2), swapon(2), symlink(2), sync_file_range(2), tee(2), timer_create(2), timerfd_create(2), umount(2), unlink(2), unshare(2), userfaultfd(2), vmsplice(2), unix(7), ip(7) syscon errno EACCES 13 13 13 13 13 13 13 5 # permission denied; unix consensus; kNtErrorAccessDenied; raised by access(2), acct(2), add_key(2), bind(2), bpf(2), chdir(2), chmod(2), chown(2), chroot(2), clock_getres(2), connect(2), execve(2), fcntl(2), futex(2), getpriority(2), inotify_add_watch(2), keyctl(2), link(2), madvise(2), mkdir(2), mknod(2), mmap(2), mount(2), move_pages(2), mprotect(2), msgctl(2), msgget(2), msgop(2), open(2), perf_event_open(2), prctl(2), ptrace(2), quotactl(2), readlink(2), rename(2), request_key(2), rmdir(2), semctl(2), semget(2), semop(2), send(2), setpgid(2), shmctl(2), shmget(2), shmop(2), socket(2), spu_create(2), stat(2), statfs(2), statx(2), symlink(2), truncate(2), unlink(2), uselib(2), utime(2), utimensat(2), ip(7) syscon errno EFAULT 14 14 14 14 14 14 14 487 # pointer passed to system call that would otherwise segfault; unix consensus; kNtErrorInvalidAddress; raised by accept(2), access(2), acct(2), add_key(2), adjtimex(2), arch_prctl(2), bdflush(2), bind(2), bpf(2), cacheflush(2), capget(2), chdir(2), chmod(2), chown(2), chroot(2), clock_getres(2), clock_nanosleep(2), connect(2), create_module(2), delete_module(2), epoll_wait(2), execve(2), fcntl(2), futex(2), get_mempolicy(2), get_robust_list(2), getcpu(2), getdents(2), getdomainname(2), getgroups(2), gethostname(2), getitimer(2), getpeername(2), getrandom(2), getresuid(2), getrlimit(2), getrusage(2), getsockname(2), getsockopt(2), gettimeofday(2), getunwind(2), init_module(2), inotify_add_watch(2), io_cancel(2), io_destroy(2), io_getevents(2), io_setup(2), io_submit(2), ioctl(2), ioctl_getfsmap(2), ioctl_userfaultfd(2), kcmp(2), keyctl(2), link(2), llseek(2), lookup_dcookie(2), mbind(2), memfd_create(2), migrate_pages(2), mincore(2), mkdir(2), mknod(2), mmap2(2), modify_ldt(2), mount(2), move_pages(2), mremap(2), msgctl(2), msgop(2), msync(2), nanosleep(2), open(2), open_by_handle_at(2), perf_event_open(2), pipe(2), poll(2), prctl(2), process_vm_readv(2), ptrace(2), query_module(2), quotactl(2), read(2), readdir(2), readlink(2), reboot(2), recv(2), rename(2), request_key(2), rmdir(2), s390_guarded_storage(2), s390_pci_mmio_write(2), s390_sthyi(2), sched_rr_get_interval(2), sched_setaffinity(2), semctl(2), semop(2), send(2), sendfile(2), set_mempolicy(2), set_thread_area(2), shmctl(2), sigaction(2), sigaltstack(2), sigpending(2), sigprocmask(2), sigsuspend(2), socketpair(2), spu_create(2), spu_run(2), stat(2), statfs(2), statx(2), stime(2), subpage_prot(2), symlink(2), sysctl(2), sysfs(2), sysinfo(2), time(2), timer_settime(2), timerfd_create(2), times(2), truncate(2), umount(2), uname(2), unlink(2), ustat(2), utimensat(2), vm86(2), write(2), unix(7) syscon errno ENOTBLK 15 15 15 15 15 15 15 26 # block device required; unix consensus; kNtErrorNotDosDisk; raised by mount(2), quotactl(2), umount(2) syscon errno EBUSY 16 16 16 16 16 16 16 170 # device or resource busy; unix consensus; kNtErrorBusy; raised by bdflush(2), delete_module(2), dup(2), fcntl(2), init_module(2), ioctl_tty(2), ioctl_userfaultfd(2), kexec_load(2), mount(2), msync(2), pivot_root(2), prctl(2), ptrace(2), quotactl(2), rename(2), rmdir(2), sched_setattr(2), swapon(2), umount(2) syscon errno EEXIST 17 17 17 17 17 17 17 183 # file exists; unix consensus; kNtErrorAlreadyExists (should be kNtErrorFileExists too); raised by bpf(2), create_module(2), epoll_ctl(2), init_module(2), inotify_add_watch(2), keyctl(2), link(2), mkdir(2), mknod(2), mmap(2), msgget(2), open(2), rename(2), rmdir(2), semget(2), setxattr(2), shmget(2), spu_create(2), symlink(2) syscon errno EXDEV 18 18 18 18 18 18 18 17 # improper link; unix consensus; kNtErrorNotSameDevice; raised by copy_file_range(2), fanotify_mark(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), link(2), openat2(2), rename(2) syscon errno ENODEV 19 19 19 19 19 19 19 1200 # no such device; unix consensus; kNtErrorBadDevice; raised by arch_prctl(2), eventfd(2), fallocate(2), fanotify_mark(2), mmap(2), mount(2), move_pages(2), open(2), pciconfig_read(2), perf_event_open(2), pidfd_open(2), prctl(2), s390_pci_mmio_write(2), signalfd(2), spu_create(2), timerfd_create(2) syscon errno ENOTDIR 20 20 20 20 20 20 20 3 # not a directory; unix consensus; kNtErrorPathNotFound; raised by access(2), acct(2), bind(2), chdir(2), chmod(2), chown(2), chroot(2), execve(2), execveat(2), fanotify_mark(2), fcntl(2), futimesat(2), getdents(2), inotify_add_watch(2), ioctl_fat(2), keyctl(2), link(2), mkdir(2), mknod(2), mount(2), open(2), open_by_handle_at(2), pivot_root(2), readdir(2), readlink(2), rename(2), rmdir(2), spu_create(2), stat(2), statfs(2), statx(2), symlink(2), sysctl(2), truncate(2), unlink(2), utimensat(2) syscon errno EISDIR 21 21 21 21 21 21 21 267 # is a a directory; unix consensus; kNtErrorDirectory; raised by acct(2), copy_file_range(2), execve(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), open(2), read(2), rename(2), truncate(2), unlink(2) syscon errno EINVAL 22 22 22 22 22 22 22 87 # invalid argument; unix consensus; kNtErrorInvalidParameter; raised by accept(2), access(2), add_key(2), adjtimex(2), arch_prctl(2), bdflush(2), bind(2), bpf(2), cacheflush(2), capget(2), chmod(2), chown(2), clock_getres(2), clock_nanosleep(2), clone(2), copy_file_range(2), create_module(2), dup(2), epoll_create(2), epoll_ctl(2), epoll_wait(2), eventfd(2), execve(2), execveat(2), fallocate(2), fanotify_init(2), fanotify_mark(2), fcntl(2), flock(2), futex(2), get_mempolicy(2), get_robust_list(2), getdents(2), getdomainname(2), getgroups(2), gethostname(2), getitimer(2), getpeername(2), getpriority(2), getrandom(2), getrlimit(2), getrusage(2), getsockname(2), getsockopt(2), gettimeofday(2), init_module(2), inotify_add_watch(2), inotify_init(2), inotify_rm_watch(2), io_cancel(2), io_destroy(2), io_getevents(2), io_setup(2), io_submit(2), ioctl(2), ioctl_console(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), ioctl_getfsmap(2), ioctl_ns(2), ioctl_tty(2), ioctl_userfaultfd(2), ioperm(2), iopl(2), ioprio_set(2), kcmp(2), kexec_load(2), keyctl(2), kill(2), link(2), llseek(2), lookup_dcookie(2), lseek(2), madvise(2), mbind(2), membarrier(2), memfd_create(2), migrate_pages(2), mincore(2), mkdir(2), mknod(2), mlock(2), mmap(2), mmap2(2), modify_ldt(2), mount(2), move_pages(2), mprotect(2), mremap(2), msgctl(2), msgop(2), msync(2), nanosleep(2), open(2), open_by_handle_at(2), openat2(2), pciconfig_read(2), perf_event_open(2), personality(2), pidfd_getfd(2), pidfd_open(2), pidfd_send_signal(2), pipe(2), pivot_root(2), pkey_alloc(2), poll(2), posix_fadvise(2), prctl(2), process_vm_readv(2), ptrace(2), query_module(2), quotactl(2), read(2), readahead(2), readdir(2), readlink(2), readv(2), reboot(2), recv(2), recvmmsg(2), remap_file_pages(2), rename(2), request_key(2), rmdir(2), rt_sigqueueinfo(2), s390_guarded_storage(2), s390_pci_mmio_write(2), s390_runtime_instr(2), s390_sthyi(2), sched_get_priority_max(2), sched_rr_get_interval(2), sched_setaffinity(2), sched_setattr(2), sched_setparam(2), sched_setscheduler(2), seccomp(2), select(2), semctl(2), semget(2), semop(2), send(2), sendfile(2), set_mempolicy(2), set_thread_area(2), seteuid(2), setfsgid(2), setfsuid(2), setgid(2), setns(2), setpgid(2), setresuid(2), setreuid(2), setuid(2), shmctl(2), shmget(2), shmop(2), shutdown(2), sigaction(2), sigaltstack(2), signal(2), signalfd(2), sigprocmask(2), sigsuspend(2), sigwaitinfo(2), socket(2), splice(2), spu_create(2), spu_run(2), stat(2), statx(2), subpage_prot(2), swapon(2), sync_file_range(2), sysfs(2), syslog(2), tee(2), timer_create(2), timer_delete(2), timer_getoverrun(2), timer_settime(2), timerfd_create(2), tkill(2), truncate(2), umount(2), unlink(2), unshare(2), userfaultfd(2), ustat(2), utimensat(2), vmsplice(2), wait(2), write(2), unix(7), ip(7) syscon errno ENFILE 23 23 23 23 23 23 23 331 # too many open files in system; unix consensus; kNtErrorTooManyDescriptors; raised by accept(2), acct(2), epoll_create(2), eventfd(2), execve(2), futex(2), inotify_init(2), memfd_create(2), mmap(2), open(2), pidfd_getfd(2), pidfd_open(2), pipe(2), shmget(2), signalfd(2), socket(2), socketpair(2), spu_create(2), swapon(2), timerfd_create(2), uselib(2), userfaultfd(2) syscon errno EMFILE 24 24 24 24 24 24 24 4 # too many open files; unix consensus; kNtErrorTooManyOpenFiles; raised by accept(2), dup(2), epoll_create(2), eventfd(2), execve(2), fanotify_init(2), fcntl(2), inotify_init(2), memfd_create(2), mount(2), open(2), perf_event_open(2), pidfd_getfd(2), pidfd_open(2), pipe(2), signalfd(2), socket(2), socketpair(2), spu_create(2), timerfd_create(2) syscon errno ENOTTY 25 25 25 25 25 25 25 1118 # inappropriate i/o control operation; unix consensus; kNtErrorSerialNoDevice; raised by ioctl(2), ioctl_console(2), ioctl_fat(2), ioctl_ns(2), ioctl_tty(2) syscon errno ETXTBSY 26 26 26 26 26 26 26 148 # won't open executable that's executing in write mode; try UnlockExecutable(); unix consensus; kNtErrorPathBusy; raised by access(2), copy_file_range(2), execve(2), fallocate(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), mmap(2), open(2), truncate(2) syscon errno EFBIG 27 27 27 27 27 27 27 223 # file too large; unix consensus; kNtErrorFileTooLarge; raised by copy_file_range(2), fallocate(2), init_module(2), open(2), semop(2), truncate(2), write(2) syscon errno ENOSPC 28 28 28 28 28 28 28 39 # no space left on device; unix consensus; kNtErrorDiskFull; raised by copy_file_range(2), epoll_ctl(2), fallocate(2), fanotify_mark(2), fsync(2), inotify_add_watch(2), link(2), mkdir(2), mknod(2), msgget(2), open(2), perf_event_open(2), pkey_alloc(2), query_module(2), rename(2), semget(2), setxattr(2), shmget(2), spu_create(2), symlink(2), sync_file_range(2), write(2) syscon errno EDQUOT 122 122 69 69 69 69 69 1816 # disk quota exceeded; bsd consensus; kNtErrorNotEnoughQuota; raised by add_key(2), keyctl(2), link(2), mkdir(2), mknod(2), open(2), rename(2), request_key(2), setxattr(2), symlink(2), write(2) syscon errno ESPIPE 29 29 29 29 29 29 29 25 # invalid seek; unix consensus; kNtErrorSeek; raised by fallocate(2), lseek(2), posix_fadvise(2), sendfile(2), splice(2), sync_file_range(2) syscon errno EROFS 30 30 30 30 30 30 30 6009 # read-only filesystem; unix consensus; kNtErrorFileReadOnly; raised by access(2), acct(2), bind(2), chmod(2), chown(2), link(2), mkdir(2), mknod(2), mount(2), open(2), rename(2), rmdir(2), symlink(2), truncate(2), unlink(2), utime(2), utimensat(2) syscon errno EMLINK 31 31 31 31 31 31 31 1142 # too many links; unix consensus; kNtErrorTooManyLinks; raised by link(2), mkdir(2), rename(2) syscon errno EPIPE 32 32 32 32 32 32 32 109 # broken pipe; unix consensus; kNtErrorBrokenPipe; raised by send(2), write(2), tcp(7), unix(7), ip(7) syscon errno EDOM 33 33 33 33 33 33 33 20000 # mathematics argument out of domain of function; bsd consensus; made up on NT; returned by cos(3), fmod(3), log1p(3), sin(3), tan(3), tgamma(3) syscon errno ERANGE 34 34 34 34 34 34 34 6604 # result too large; bsd consensus; kNtErrorLogInvalidRange; raised by getxattr(2), listxattr(2), lookup_dcookie(2), prctl(2), quotactl(2), semctl(2), semop(2), setxattr(2) syscon errno EDEADLK 35 35 11 11 11 11 11 1131 # resource deadlock avoided; bsd consensus; kNtErrorPossibleDeadlock; raised by fcntl(2), keyctl(2) syscon errno ENAMETOOLONG 36 36 63 63 63 63 63 10063 # filename too long; bsd consensus; WSAENAMETOOLONG; raised by access(2), acct(2), bind(2), chdir(2), chmod(2), chown(2), chroot(2), execve(2), gethostname(2), inotify_add_watch(2), link(2), lookup_dcookie(2), mkdir(2), mknod(2), mount(2), open(2), readlink(2), rename(2), rmdir(2), spu_create(2), stat(2), statfs(2), statx(2), symlink(2), truncate(2), umount(2), unlink(2), utimensat(2) syscon errno ENOLCK 37 37 77 77 77 77 77 158 # no locks available; kNtErrorNotLocked; bsd consensus; raised by fcntl(2), flock(2) syscon errno ENOTEMPTY 39 39 66 66 66 66 66 145 # directory not empty; bsd consensus; kNtErrorDirNotEmpty (TODO: What is WSAENOTEMPTY? 10066); raised by rmdir(2) syscon errno ELOOP 40 40 62 62 62 62 62 1921 # too many levels of symbolic links; bsd consensus; kNtErrorCantResolveFilename; raised by access(2), acct(2), bind(2), chdir(2), chmod(2), chown(2), chroot(2), epoll_ctl(2), execve(2), execveat(2), keyctl(2), link(2), mkdir(2), mknod(2), mount(2), open(2), open_by_handle_at(2), openat2(2), readlink(2), rename(2), rmdir(2), spu_create(2), stat(2), statfs(2), statx(2), symlink(2), truncate(2), unlink(2), utimensat(2) syscon errno ENOMSG 42 42 91 91 83 90 83 4306 # kNtErrorEmpty; raised by msgop(2) syscon errno EIDRM 43 43 90 90 82 89 82 1287 # identifier removed; kNtErrorUnidentifiedError; raised by msgctl(2), msgget(2), msgop(2), semctl(2), semop(2), shmctl(2), shmget(2), shmop(2) syscon errno EPROTO 71 71 100 100 92 95 96 7065 # Protocol error; kNtErrorRdpProtocolError; raised by accept(2), connect(2), socket(2), socketpair(2) syscon errno EOVERFLOW 75 75 84 84 84 87 84 534 # kNtErrorArithmeticOverflow; raised by aio_read(2), copy_file_range(2), ctime(2), fanotify_init(2), lseek(2), mmap(2), open(2), open_by_handle_at(2), sem_post(2), sendfile(2), shmctl(2), stat(2), statfs(2), statvfs(2), time(2), timegm(2) syscon errno EILSEQ 84 84 92 92 86 84 85 582 # kNtErrorIllegalCharacter; returned by fgetwc(3), fputwc(3), getwchar(3), putwchar(3), scanf(3), ungetwc(3) syscon errno EUSERS 87 87 68 68 68 68 68 10068 # too many users; bsd consensus; WSAEUSERS; raised by acct(2) syscon errno ENOTSOCK 88 88 38 38 38 38 38 10038 # not a socket; bsd consensus; WSAENOTSOCK; raised by accept(2), bind(2), connect(2), getpeername(2), getsockname(2), getsockopt(2), listen(2), recv(2), send(2), shutdown(2) syscon errno EDESTADDRREQ 89 89 39 39 39 39 39 10039 # destination address required; bsd consensus; WSAEDESTADDRREQ; raised by send(2), write(2) syscon errno EMSGSIZE 90 90 40 40 40 40 40 10040 # message too long; bsd consensus; WSAEMSGSIZE; raised by keyctl(2), send(2), ip(7) syscon errno EPROTOTYPE 91 91 41 41 41 41 41 10041 # protocol wrong type for socket; bsd consensus; WSAEPROTOTYPE; raised by connect(2), unix(7) syscon errno ENOPROTOOPT 92 92 42 42 42 42 42 10042 # protocol not available; bsd consensus; WSAENOPROTOOPT; raised by getsockopt(2), accept(2), ip(7) syscon errno EPROTONOSUPPORT 93 93 43 43 43 43 43 10043 # protocol not supported; bsd consensus; WSAEPROTONOSUPPORT; raised by socket(2), socketpair(2), unix(7) syscon errno ESOCKTNOSUPPORT 94 94 44 44 44 44 44 10044 # socket type not supported; bsd consensus; WSAESOCKTNOSUPPORT; raised by unix(7), ip(7) syscon errno ENOTSUP 95 95 45 45 45 91 86 10045 # operation not supported; raised by chmod(2), clock_getres(2), clock_nanosleep(2), getxattr(2), listxattr(2), removexattr(2), setxattr(2), timer_create(2), mmap(2) syscon errno EOPNOTSUPP 95 95 102 102 45 45 45 10045 # socket operation not supported; raised by accept(2), fallocate(2), fanotify_mark(2), ioctl_ficlonerange(2), ioctl_fideduperange(2), ioctl_getfsmap(2), keyctl(2), listen(2), mmap(2), open_by_handle_at(2), pciconfig_read(2), perf_event_open(2), prctl(2), readv(2), s390_guarded_storage(2), s390_runtime_instr(2), s390_sthyi(2), send(2), socketpair(2), unix(7), ip(7) syscon errno EPFNOSUPPORT 96 96 46 46 46 46 46 10046 # protocol family not supported; bsd consensus; WSAEPFNOSUPPORT syscon errno EAFNOSUPPORT 97 97 47 47 47 47 47 10047 # address family not supported; bsd consensus; WSAEAFNOSUPPORT; raised by connect(2), socket(2), socketpair(2), tcp(7) syscon errno EADDRINUSE 98 98 48 48 48 48 48 10048 # address already in use; bsd consensus; WSAEADDRINUSE; raised by bind(2), connect(2), listen(2), unix(7), ip(7) syscon errno EADDRNOTAVAIL 99 99 49 49 49 49 49 10049 # address not available; bsd consensus; WSAEADDRNOTAVAIL; raised by bind(2), connect(2), kexec_load(2), ip(7) syscon errno ENETDOWN 100 100 50 50 50 50 50 10050 # network is down; bsd consensus; WSAENETDOWN; raised by accept(2) syscon errno ENETUNREACH 101 101 51 51 51 51 51 10051 # host is unreachable; bsd consensus; WSAENETUNREACH; raised by accept(2), connect(2) syscon errno ENETRESET 102 102 52 52 52 52 52 10052 # connection reset by network; bsd consensus; WSAENETRESET syscon errno ECONNABORTED 103 103 53 53 53 53 53 10053 # connection reset before accept; bsd consensus; WSAECONNABORTED; raised by accept(2) syscon errno ECONNRESET 104 104 54 54 54 54 54 10054 # connection reset by client; bsd consensus; WSAECONNRESET; raised by send(2), unix(7) syscon errno ENOBUFS 105 105 55 55 55 55 55 10055 # no buffer space available; bsd consensus; WSAENOBUFS; raised by getpeername(2), getsockname(2), send(2), ip(7) syscon errno EISCONN 106 106 56 56 56 56 56 10056 # socket is connected; bsd consensus; WSAEISCONN; raised by connect(2), send(2), unix(7), ip(7) syscon errno ENOTCONN 107 107 57 57 57 57 57 10057 # socket is not connected; bsd consensus; WSAENOTCONN; raised by getpeername(2), recv(2), send(2), shutdown(2), ip(7) syscon errno ESHUTDOWN 108 108 58 58 58 58 58 10058 # cannot send after transport endpoint shutdown; note that shutdown write is an EPIPE; bsd consensus; WSAESHUTDOWN syscon errno ETOOMANYREFS 109 109 59 59 59 59 59 10059 # too many references: cannot splice; bsd consensus; WSAETOOMANYREFS; raised by sendmsg(2), unix(7) syscon errno ETIMEDOUT 110 110 60 60 60 60 60 1460 # connection timed out; kNtErrorTimeout; bsd consensus; WSAETIMEDOUT; raised by connect(2), futex(2), keyctl(2), tcp(7) syscon errno ETIME 62 62 101 101 60 60 92 1460 # timer expired (POSIX.1 XSI STREAMS) syscon errno ECONNREFUSED 111 111 61 61 61 61 61 10061 # bsd consensus; WSAECONNREFUSED; raised by connect(2), listen(2), recv(2), unix(7), udp(7)system-imposed limit on the number of threads was encountered. syscon errno EHOSTDOWN 112 112 64 64 64 64 64 10064 # bsd consensus; WSAEHOSTDOWN; raised by accept(2) syscon errno EHOSTUNREACH 113 113 65 65 65 65 65 10065 # bsd consensus; WSAEHOSTUNREACH; raised by accept(2), ip(7) syscon errno EALREADY 114 114 37 37 37 37 37 10037 # connection already in progress; bsd consensus; WSAEALREADY; raised by connect(2), send(2), ip(7) syscon errno EINPROGRESS 115 115 36 36 36 36 36 10036 # bsd consensus; WSAEINPROGRESS; raised by connect(2) w/ O_NONBLOCK syscon errno ESTALE 116 116 70 70 70 70 70 10070 # bsd consensus; WSAESTALE; raised by open_by_handle_at(2) syscon errno EREMOTE 66 66 71 71 71 71 71 10071 # bsd consensus syscon errno EBADRPC 300 300 72 72 72 72 72 1626 # kNtErrorFunctionNotCalled; bsd consensus; made up on linux syscon errno ERPCMISMATCH 301 301 73 73 73 73 73 1627 # kNtErrorFunctionFailed; bsd consensus; made up on linux syscon errno EPROGUNAVAIL 302 302 74 74 74 74 74 329 # kNtErrorOperationInProgress; bsd consensus; made up on linux syscon errno EPROGMISMATCH 303 303 75 75 75 75 75 595 # kNtErrorReplyMessageMismatch; bsd consensus; made up on linux syscon errno EPROCUNAVAIL 304 304 76 76 76 76 76 15841 # kNtErrorApiUnavailable; bsd consensus; made up on linux syscon errno EFTYPE 305 305 79 79 79 79 79 222 # Inappropriate file type or format; kNtErrorBadFileType; bsd consensus; made up on linux syscon errno EAUTH 306 306 80 80 80 80 80 1244 # Authentication error; kNtErrorNotAuthenticated; bsd consensus; made up on linux syscon errno ENEEDAUTH 307 307 81 81 81 81 81 224 # Need authenticator; kNtErrorFormsAuthRequired; bsd consensus; made up on linux syscon errno EPROCLIM 308 308 67 67 67 67 67 10067 # bsd consensus; made up on linux syscon errno ENOATTR 309 309 93 93 87 83 93 117 # Attribute not found; kNtErrorInvalidCategory; made up on linux syscon errno EPWROFF 310 310 82 82 310 310 310 639 # Intelligent device errors. Device power is off; kNtErrorInsufficientPower; made up on non-xnu syscon errno EDEVERR 311 311 83 83 311 311 311 483 # kNtErrorDeviceHardwareError; made up on non-xnu syscon errno EBADEXEC 312 312 85 85 312 312 312 192 # kNtErrorExeMarkedInvalid; made up on non-xnu syscon errno EBADARCH 313 313 86 86 313 313 313 216 # kNtErrorExeMachineTypeMismatch; made up on non-xnu syscon errno ESHLIBVERS 314 314 87 87 314 314 314 0 # shiver me timbers; made up on non-xnu syscon errno EBADMACHO 315 315 88 88 315 315 315 0 # made up on non-xnu syscon errno ENOPOLICY 316 316 103 103 316 316 316 0 # made up on non-xnu syscon errno EBADMSG 74 74 94 94 89 92 88 0 # raised by ioctl_getfsmap(2) syscon errno ECANCELED 125 125 89 89 85 88 87 1223 # kNtErrorCancelled; raised by timerfd_create(2) syscon errno EOWNERDEAD 130 130 105 105 96 94 97 105 # kNtErrorSemOwnerDied; raised by pthread_cond_timedwait(3), pthread_mutex_consistent(3), pthread_mutex_getprioceiling(3), pthread_mutex_lock(3), pthread_mutex_timedlock(3), pthread_mutexattr_getrobust(3), pthread_mutexattr_setrobust(3) syscon errno ENOTRECOVERABLE 131 131 104 104 95 93 98 0 # raised by pthread_cond_timedwait(3), pthread_mutex_consistent(3), pthread_mutex_getprioceiling(3), pthread_mutex_lock(3), pthread_mutex_timedlock(3), pthread_mutexattr_getrobust(3), pthread_mutexattr_setrobust(3) syscon errno ENONET 64 64 317 317 317 317 317 0 # made up on BSDs; raised by accept(2) syscon errno ERESTART 85 85 -1 -1 -1 -1 -3 0 # should only be seen in ptrace() syscon errno ENODATA 61 61 96 96 0 0 89 232 # no message is available in xsi stream or named pipe is being closed; no data available; barely in posix; returned by ioctl; very close in spirit to EPIPE? syscon errno ENOSR 63 63 98 98 0 90 90 0 # out of streams resources; something like EAGAIN; it's in POSIX; maybe some commercial UNIX returns it with openat, putmsg, putpmsg, posix_openpt, ioctl, open syscon errno ENOSTR 60 60 99 99 0 0 91 0 # not a stream; returned by getmsg, putmsg, putpmsg, getpmsg syscon errno EMULTIHOP 72 72 95 95 90 0 94 0 # barely in posix syscon errno ENOLINK 67 67 97 97 91 0 95 0 # barely in posix syscon errno ENOMEDIUM 123 123 0 0 0 85 0 0 # not posix; not documented syscon errno EMEDIUMTYPE 124 124 0 0 0 86 0 0 # not posix; not documented syscon errno EBADFD 77 77 9 9 0 0 0 0 # file descriptor in bad state syscon compat EWOULDBLOCK 11 11 35 35 35 35 35 10035 # same as EAGAIN on every platform we've seen # signals # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sig SIGHUP 1 1 1 1 1 1 1 1 # terminal hangup or daemon reload; resumable; auto-broadcasted to process group; unix consensus & faked on nt syscon sig SIGINT 2 2 2 2 2 2 2 2 # terminal ctrl-c keystroke; resumable; auto-broadcasted to process group; unix consensus & faked on nt; X3.159-1988 syscon sig SIGQUIT 3 3 3 3 3 3 3 3 # terminal ctrl-\ keystroke; resumable; unix consensus & faked on nt syscon sig SIGILL 4 4 4 4 4 4 4 4 # illegal instruction; unresumable (unless you longjmp() or edit ucontex->rip+=ild(ucontex->rip)); unix consensus & faked on nt; X3.159-1988 syscon sig SIGTRAP 5 5 5 5 5 5 5 5 # int3 instruction; resumable; unix consensus & faked on nt syscon sig SIGABRT 6 6 6 6 6 6 6 6 # process aborted; resumable; unix consensus & faked on nt; X3.159-1988 syscon sig SIGBUS 7 7 10 10 10 10 10 7 # valid memory access that went beyond underlying end of file; bsd consensus syscon sig SIGFPE 8 8 8 8 8 8 8 8 # illegal math; unresumable (unless you longjmp() or edit ucontex->rip+=ild(ucontex->rip)); unix consensus & faked on nt; X3.159-1988 syscon sig SIGKILL 9 9 9 9 9 9 9 9 # terminate with extreme prejudice; unreceivable; unix consensus & faked on nt syscon sig SIGUSR1 10 10 30 30 30 30 30 10 # do whatever you want; bsd consensus syscon sig SIGSEGV 11 11 11 11 11 11 11 11 # invalid memory access; unresumable (unless you longjmp() or edit ucontex->rip+=ild(ucontex->rip)); unix consensus & faked on nt; X3.159-1988 syscon sig SIGUSR2 12 12 31 31 31 31 31 12 # do whatever you want; bsd consensus syscon sig SIGPIPE 13 13 13 13 13 13 13 13 # write to closed file descriptor; unix consensus & faked on nt syscon sig SIGALRM 14 14 14 14 14 14 14 14 # sent by setitimer(2) or timer_settime(2); unix consensus & faked on nt syscon sig SIGTERM 15 15 15 15 15 15 15 15 # terminate; resumable; unix consensus & faked on nt; X3.159-1988 syscon sig SIGSTKFLT 16 16 0 0 0 0 0 0 # wut syscon sig SIGCHLD 17 17 20 20 20 20 20 17 # child process exited or terminated and is now a zombie (unless this is SIG_IGN or SA_NOCLDWAIT) or child process stopped due to terminal i/o or profiling/debugging (unless you used SA_NOCLDSTOP); bsd consensus syscon sig SIGCONT 18 18 19 19 19 19 19 18 # child process resumed from profiling/debugging; bsd consensus syscon sig SIGSTOP 19 19 17 17 17 17 17 19 # child process stopped due to profiling/debugging; bsd consensus syscon sig SIGTSTP 20 20 18 18 18 18 18 20 # terminal ctrl-z keystroke; bsd consensus syscon sig SIGTTIN 21 21 21 21 21 21 21 21 # terminal input for background process; resumable; unix consensus & faked on nt syscon sig SIGTTOU 22 22 22 22 22 22 22 22 # terminal output for background process; resumable; unix consensus & faked on nt syscon sig SIGURG 23 23 16 16 16 16 16 23 # bsd consensus syscon sig SIGXCPU 24 24 24 24 24 24 24 24 # cpu time limit exceeded; unix consensus & faked on nt syscon sig SIGXFSZ 25 25 25 25 25 25 25 25 # file size limit exceeded; unix consensus & faked on nt syscon sig SIGVTALRM 26 26 26 26 26 26 26 26 # virtual alarm clock; wut; unix consensus & faked on nt syscon sig SIGPROF 27 27 27 27 27 27 27 27 # profiling timer expired; unix consensus & faked on nt syscon sig SIGWINCH 28 28 28 28 28 28 28 28 # terminal resized; unix consensus & faked on nt syscon sig SIGIO 29 29 23 23 23 23 23 29 # bsd consensus syscon sig SIGSYS 31 31 12 12 12 12 12 31 # wut; bsd consensus syscon sig SIGINFO 63 63 29 29 29 29 29 63 # bsd consensus syscon sig SIGEMT 64 64 7 7 7 7 7 64 # not implemented in most community editions of system five; consider doing this using SIGUSR1 or SIGUSR2 instead syscon sig SIGPWR 30 30 30 30 30 30 32 30 # not implemented in most community editions of system five; consider doing this using SIGUSR1 or SIGUSR2 instead syscon sig SIGTHR 32 32 7 7 32 32 33 32 # used by pthread_cancel(); SIGRTMIN+0 on Linux/NetBSD; faked as SIGEMT on XNU (what is SIG32 on XNU anyway?) syscon sig SIGRTMIN 32 32 0 0 65 0 33 32 syscon sig SIGRTMAX 64 64 0 0 126 0 63 64 syscon compat SIGPOLL 29 29 23 23 23 23 23 29 # same as SIGIO syscon compat SIGIOT 6 6 6 6 6 6 6 6 # PDP-11 feature; same as SIGABRT # open() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD Windoze Commentary syscon open O_RDONLY 0 0 0 0 0 0 0 0 # consensus syscon open O_WRONLY 1 1 1 1 1 1 1 1 # consensus syscon open O_RDWR 2 2 2 2 2 2 2 2 # consensus syscon open O_ACCMODE 3 3 3 3 3 3 3 3 # O_RDONLY|O_WRONLY|O_RDWR syscon open O_APPEND 0x00000400 0x00000400 8 8 8 8 8 0x00000400 # bsd consensus & kNtFileAppendData; won't pose issues w/ mknod(S_IFIFO) [SYNC libc/calls/open-nt.c] syscon open O_CREAT 0x00000040 0x00000040 0x00000200 0x00000200 0x00000200 0x00000200 0x00000200 0x00000040 # bsd consensus & NT faked as Linux [SYNC libc/calls/open-nt.c] syscon open O_EXCL 0x00000080 0x00000080 0x00000800 0x00000800 0x00000800 0x00000800 0x00000800 0x00000080 # bsd consensus & NT faked as Linux [SYNC libc/calls/open-nt.c] syscon open O_TRUNC 0x00000200 0x00000200 0x00000400 0x00000400 0x00000400 0x00000400 0x00000400 0x00000200 # bsd consensus & NT faked as Linux [SYNC libc/calls/open-nt.c] syscon open O_DIRECTORY 0x00010000 0x00004000 0x00100000 0x00100000 0x00020000 0x00020000 0x00200000 0x00010000 # useful hint on UNIX, but required on NT (see kNtFileFlagBackupSemantics) [SYNC libc/calls/open-nt.c] syscon open O_NOFOLLOW 0x00020000 0x00008000 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00020000 # bsd consensus; kNtFileFlagOpenReparsePoint syscon open O_DIRECT 0x00004000 0x00010000 0 0 0x00010000 0 0x00080000 0x00004000 # kNtFileFlagNoBuffering [SYNC libc/calls/open-nt.c] syscon open O_NDELAY 0x00000800 0x00000800 0x00000004 0x00000004 0x00000004 0x00000004 0x00000004 0x00000800 # kNtFileFlagWriteThrough [SYNC libc/calls/open-nt.c] syscon open O_RANDOM 0 0 0 0 0 0 0 0x80000000 # kNtFileFlagRandomAccess [SYNC libc/calls/open-nt.c] syscon open O_SEQUENTIAL 0 0 0 0 0 0 0 0x40000000 # kNtFileFlagSequentialScan [SYNC libc/calls/open-nt.c] syscon open O_COMPRESSED 0 0 0 0 0 0 0 0x20000000 # kNtFileAttributeCompressed [SYNC libc/calls/open-nt.c] syscon open O_INDEXED 0 0 0 0 0 0 0 0x10000000 # !kNtFileAttributeNotContentIndexed [SYNC libc/calls/open-nt.c] syscon open O_CLOEXEC 0x00080000 0x00080000 0x01000000 0x01000000 0x00100000 0x00010000 0x00400000 0x00080000 # NT faked as Linux [SYNC libc/calls/open-nt.c] syscon open O_TMPFILE 0x00410000 0x00404000 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # please use tmpfd(); Linux 3.11+ (c. 2013) __O_TMPFILE | O_DIRECTORY; kNtFileAttributeTemporary|kNtFileFlagDeleteOnClose [SYNC libc/calls/open-nt.c] syscon open O_SPARSE 0 0 0 0 0 0 0 0 # wut syscon open O_NONBLOCK 0x00000800 0x00000800 0x00000004 0x00000004 0x00000004 0x00000004 0x00000004 0x00000800 # bsd consensus syscon open O_ASYNC 0x00002000 0x00002000 0x00000040 0x00000040 0x00000040 0x00000040 0x00000040 0 # bsd consensus syscon open O_NOFOLLOW_ANY 0 0 0x20000000 0x20000000 0 0 0 0 # syscon open O_SYNC 0x00101000 0x00101000 0x00000080 0x00000080 0x00000080 0x00000080 0x00000080 0 # bsd consensus syscon open O_NOCTTY 0x00000100 0x00000100 0x00020000 0x00020000 0x00008000 0x00008000 0x00008000 0 # used for remote viewing (default behavior on freebsd) syscon open O_NOATIME 0x00040000 0x00040000 0 0 0 0 0 0 # optimize away access time update syscon open O_EXEC 0x00200000 0x00200000 0 0 0x00040000 0 0x04000000 0 # open only for executing (POSIX.1 hack for when file mode is 0111); see fexecve(); O_PATH on Linux syscon open O_SEARCH 0 0 0 0 0x00040000 0 0x00800000 0 # it's specified by posix what does it mean syscon open O_DSYNC 0x00001000 0x00001000 0x00400000 0x00400000 0 0x00000080 0x00010000 0 # syscon open O_RSYNC 0x00101000 0x00101000 0 0 0 0x00000080 0x00020000 0 # syscon open O_PATH 0x00200000 0x00200000 0 0 0 0 0 0 # Linux 2.6.39+ syscon open O_VERIFY 0 0 0 0 0x00200000 0 0 0 # syscon open O_SHLOCK 0 0 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 0 # syscon open O_EXLOCK 0 0 0x00000020 0x00000020 0x00000020 0x00000020 0x00000020 0 # syscon open O_TTY_INIT 0 0 0 0 0x00080000 0 0 0 # syscon compat O_LARGEFILE 0x00008000 0x00020000 0 0 0 0 0 0 # # mmap() flags # the revolutionary praxis of malloc() # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mmap MAP_FILE 0 0 0 0 0 0 0 0 # consensus syscon mmap MAP_SHARED 1 1 1 1 1 1 1 1 # forced consensus & faked nt syscon mmap MAP_SHARED_VALIDATE 3 3 1 1 1 1 1 1 # weird linux thing syscon mmap MAP_PRIVATE 2 2 2 2 2 2 2 2 # forced consensus & faked nt syscon mmap MAP_STACK 6 6 6 6 6 6 6 6 # our definition syscon mmap MAP_TYPE 15 15 15 15 15 15 15 15 # mask for type of mapping syscon mmap MAP_FIXED 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 # unix consensus; openbsd appears to forbid; faked nt syscon mmap MAP_FIXED_NOREPLACE 0x08000000 0x08000000 0x00004010 0x00004010 0x08000000 0x08000000 0x08000000 0x08000000 # handled and defined by cosmo runtime; 0x100000 on linux 4.7+; MAP_FIXED|MAP_EXCL on FreeBSD syscon mmap MAP_ANONYMOUS 0x00000020 0x00000020 0x00001000 0x00001000 0x00001000 0x00001000 0x00001000 0x00000020 # bsd consensus; faked nt syscon mmap MAP_GROWSDOWN 0x00000100 0x00000100 0 0 0 0 0 0 # use MAP_STACK; abstracted by MAP_STACK; may be passed to __sys_mmap() for low-level Linux fiddling syscon mmap MAP_LOCKED 0x00002000 0x00002000 0 0 0 0 0 0 syscon mmap MAP_NORESERVE 0x00004000 0x00004000 0x00000040 0x00000040 0 0 0x00000040 0 # Linux calls it "reserve"; NT calls it "commit"? which is default? syscon mmap MAP_POPULATE 0x00008000 0x00008000 0 0 0x00040000 0 0 0 # MAP_PREFAULT_READ on FreeBSD; can avoid madvise(MADV_WILLNEED) on private file mapping syscon mmap MAP_NONBLOCK 0x00010000 0x00010000 0 0 0 0 0 0 syscon mmap MAP_HUGETLB 0x00040000 0x00040000 0 0 0 0 0 0x80000000 # kNtSecLargePages syscon mmap MAP_SYNC 0x00080000 0x00080000 0 0 0 0 0 0 # perform synchronous page faults for mapping (Linux 4.15+) syscon mmap MAP_INHERIT -1 -1 -1 -1 -1 -1 0x00000080 -1 # make it inherit across execve() syscon mmap MAP_HASSEMAPHORE 0 0 0x00000200 0x00000200 0x00000200 0 0x00000200 0 # does it matter on x86? syscon mmap MAP_NOSYNC 0 0 0 0 0x00000800 0 0 0 # flush to physical media only when necessary rather than gratuitously; be sure to use write() rather than ftruncate() with this! syscon mmap MAP_CONCEAL 0 0 0 0 0x00020000 0x00008000 0x00008000 0 # omit from core dumps; MAP_NOCORE on FreeBSD syscon mmap MAP_HUGE_MASK 63 63 0 0 0 0 0 0 syscon mmap MAP_HUGE_SHIFT 26 26 0 0 0 0 0 0 syscon compat MAP_NOCORE 0 0 0 0 0x00020000 0x00008000 0x00008000 0 # use MAP_CONCEAL syscon compat MAP_ANON 0x00000020 0x00000020 0x00001000 0x00001000 0x00001000 0x00001000 0x00001000 0x00000020 # bsd consensus; faked nt syscon compat MAP_EXECUTABLE 0x00001000 0x00001000 0 0 0 0 0 0 # ignored syscon compat MAP_DENYWRITE 0x00000800 0x00000800 0 0 0 0 0 0 syscon compat MAP_32BIT 0x00000040 0x00000040 0 0 0x00080000 0 0 0 # iffy # madvise() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon madv MADV_NORMAL 0 0 0 0 0 0 0 0 # consensus syscon compat POSIX_FADV_NORMAL 0 0 0 0 0 0 0 0 # consensus syscon compat POSIX_MADV_NORMAL 0 0 0 0 0 0 0 0 # consensus syscon madv MADV_DONTNEED 4 4 4 4 4 4 4 127 # TODO(jart): weird nt decommit thing? syscon compat POSIX_MADV_DONTNEED 4 4 4 4 4 4 4 127 # unix consensus syscon compat POSIX_FADV_DONTNEED 4 4 127 127 4 4 4 127 # unix consensus syscon madv MADV_RANDOM 1 1 1 1 1 1 1 1 # unix consensus syscon compat POSIX_MADV_RANDOM 1 1 1 1 1 1 1 1 # unix consensus syscon compat POSIX_FADV_RANDOM 1 1 127 127 1 1 1 1 # unix consensus syscon madv MADV_SEQUENTIAL 2 2 2 2 2 2 2 2 # unix consensus syscon compat POSIX_MADV_SEQUENTIAL 2 2 2 2 2 2 2 2 # unix consensus syscon compat POSIX_FADV_SEQUENTIAL 2 2 127 127 2 2 2 2 # TODO(jart): double check xnu syscon madv MADV_WILLNEED 3 3 3 3 3 3 3 3 # unix consensus (faked on NT) syscon compat POSIX_MADV_WILLNEED 3 3 3 3 3 3 3 3 # unix consensus syscon compat POSIX_FADV_WILLNEED 3 3 127 127 3 3 3 3 # TODO(jart): double check xnu syscon madv MADV_MERGEABLE 12 12 127 127 127 127 127 127 # turns on (private anon range) page scanning and merging service (linux only) syscon madv MADV_UNMERGEABLE 13 13 127 127 127 127 127 127 # turns off mergeable (linux only) syscon madv MADV_FREE 8 8 5 5 5 6 6 8 # Linux 4.5+ (c. 2016) / NT Faked → VMOfferPriorityNormal (Win8+) syscon madv MADV_HUGEPAGE 14 14 127 127 127 127 127 127 # TODO(jart): why would we need it? syscon madv MADV_NOHUGEPAGE 15 15 127 127 127 127 127 127 # TODO(jart): why would we need it? syscon madv MADV_DODUMP 17 17 127 127 127 127 127 127 # TODO(jart): what is it? syscon madv MADV_DOFORK 11 11 127 127 127 127 127 127 # TODO(jart): what is it? syscon madv MADV_DONTDUMP 16 16 127 127 127 127 127 127 # see MAP_CONCEAL in OpenBSD; TODO(jart): what is it? syscon madv MADV_DONTFORK 10 10 127 127 127 127 127 127 # TODO(jart): what is it? syscon madv MADV_HWPOISON 100 100 127 127 127 127 127 127 # TODO(jart): what is it? syscon madv MADV_REMOVE 9 9 127 127 127 127 127 127 # TODO(jart): what is it? syscon fadv POSIX_FADV_NOREUSE 5 5 127 127 5 127 5 127 # wut # mmap(), mprotect(), etc. # digital restrictions management for the people # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mprot PROT_NONE 0 0 0 0 0 0 0 0 # mmap, mprotect, unix consensus (nt needs special business logic here) syscon mprot PROT_READ 1 1 1 1 1 1 1 1 # mmap, mprotect, unix consensus syscon mprot PROT_WRITE 2 2 2 2 2 2 2 2 # mmap, mprotect, unix consensus syscon mprot PROT_EXEC 4 4 4 4 4 4 4 4 # mmap, mprotect, unix consensus syscon mprot PROT_GROWSDOWN 0x01000000 0x01000000 0 0 0 0 0 0 # intended for mprotect; see MAP_GROWSDOWN for mmap() (todo: what was 0x01000000 on nt) syscon mprot PROT_GROWSUP 0x02000000 0x02000000 0 0 0 0 0 0 # intended for mprotect; see MAP_GROWSDOWN for mmap() # mremap() flags # the revolutionary praxis of realloc() # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mremap MREMAP_MAYMOVE 1 1 1 1 1 1 1 1 # faked non-linux (b/c linux only) syscon mremap MREMAP_FIXED 2 2 2 2 2 2 2 2 # faked non-linux (b/c linux only) # sigprocmask() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon misc SIG_BLOCK 0 0 1 1 1 1 1 0 # bsd consensus; faked nt syscon misc SIG_UNBLOCK 1 1 2 2 2 2 2 1 # bsd consensus; faked nt syscon misc SIG_SETMASK 2 2 3 3 3 3 3 2 # bsd consensus; faked nt # lseek() whence # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon splice SEEK_HOLE 4 4 3 3 4 -1 -1 -1 # syscon splice SEEK_DATA 3 3 4 4 3 -1 -1 -1 # # splice() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon splice SPLICE_F_MOVE 1 1 0 0 0 0 0 0 # can be safely ignored by polyfill; it's a hint syscon splice SPLICE_F_NONBLOCK 2 2 0 0 0 0 0 0 # can be safely ignored by polyfill, since linux says it doesn't apply to underlying FDs syscon splice SPLICE_F_MORE 4 4 0 0 0 0 0 0 # can be safely ignored by polyfill; it's a hint syscon splice SPLICE_F_GIFT 8 8 0 0 0 0 0 0 # can probably be ignored by polyfill # access() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon access F_OK 0 0 0 0 0 0 0 0 # consensus syscon access X_OK 1 1 1 1 1 1 1 0xa0000000 # unix consensus and kNtGenericExecute | kNtGenericRead syscon access W_OK 2 2 2 2 2 2 2 0x40000000 # unix consensus and kNtGenericWrite syscon access R_OK 4 4 4 4 4 4 4 0x80000000 # unix consensus and kNtGenericRead # flock() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon lock LOCK_SH 1 1 1 1 1 1 1 0 # shared [unix consensus]; hard-coded into flock-nt.c too syscon lock LOCK_EX 2 2 2 2 2 2 2 2 # exclusive [consensus!] a.k.a. kNtLockfileExclusiveLock syscon lock LOCK_NB 4 4 4 4 4 4 4 1 # non-blocking [unix consensus] a.k.a. kNtLockfileFailImmediately syscon lock LOCK_UN 8 8 8 8 8 8 8 8 # unlock [unix consensus & faked NT]; hard-coded into flock-nt.c too # waitpid() / wait4() options # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon waitpid WNOHANG 1 1 1 1 1 1 1 1 # helps you reap zombies; unix consensus; fake nt syscon waitpid WUNTRACED 2 2 2 2 2 2 2 0 # unix consensus syscon waitpid WCONTINUED 8 8 0x10 0x10 4 8 16 0 # # waitid() options # no dice on openbsd >:\ # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon waitid WEXITED 4 4 4 4 0x10 0 32 0 syscon waitid WSTOPPED 2 2 8 8 2 0 2 0 syscon waitid WNOWAIT 0x01000000 0x01000000 0x20 0x20 8 0 0x10000 0 # fcntl() # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon fcntl2 F_DUPFD 0 0 0 0 0 0 0 0 # consensus syscon fcntl2 F_GETFD 1 1 1 1 1 1 1 1 # unix consensus & faked nt syscon fcntl2 F_SETFD 2 2 2 2 2 2 2 2 # unix consensus & faked nt syscon fcntl2 F_GETFL 3 3 3 3 3 3 3 3 # unix consensus & faked nt syscon fcntl2 F_SETFL 4 4 4 4 4 4 4 4 # unix consensus & faked nt syscon fcntl2 F_SETOWN 8 8 6 6 6 6 6 -1 # bsd consensus syscon fcntl2 F_GETOWN 9 9 5 5 5 5 5 -1 # bsd consensus syscon fcntl2 F_SETOWN_EX 15 15 -1 -1 -1 -1 -1 -1 # TODO(jart): polyfill syscon fcntl2 F_GETOWN_EX 16 16 -1 -1 -1 -1 -1 -1 # TODO(jart): polyfill syscon fcntl2 F_FULLFSYNC -1 -1 51 51 -1 -1 -1 -1 # syscon fcntl2 F_BARRIERFSYNC -1 -1 85 85 -1 -1 -1 -1 # syscon fcntl2 F_NOCACHE -1 -1 48 48 -1 -1 -1 -1 # syscon fcntl3 F_SETNOSIGPIPE -1 -1 73 73 -1 -1 14 -1 # syscon fcntl3 F_GETNOSIGPIPE -1 -1 74 74 -1 -1 13 -1 # syscon fcntl3 F_GETPATH -1 -1 50 50 -1 -1 15 -1 # geth path associated with fd into buffer with PATH_MAX (1024) bytes syscon fcntl3 FD_CLOEXEC 1 1 1 1 1 1 1 1 # unix consensus & faked nt syscon fcntl F_DUPFD_CLOEXEC 0x0406 0x0406 67 67 17 10 12 0x0406 # Linux 2.6.24+; faked nt syscon fcntl F_MAXFD -1 -1 -1 -1 -1 -1 11 -1 # syscon fcntl F_NOTIFY 0x0402 0x0402 -1 -1 -1 -1 -1 -1 syscon fcntl F_SETPIPE_SZ 0x0407 0x0407 -1 -1 -1 -1 -1 -1 syscon fcntl F_GETPIPE_SZ 0x0408 0x0408 -1 -1 -1 -1 -1 -1 syscon fcntl FREAD 0 0 1 1 1 1 1 0 # wut is it syscon fcntl FWRITE 0 0 2 2 2 2 2 0 # wut is it # fcntl3 O_NONBLOCK # fcntl3 O_APPEND # fcntl3 O_ASYNC # fcntl3 O_DIRECT # fcntl3 O_NOATIME # fcntl() POSIX Advisory Locks # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon fcntl F_SETLK 6 6 8 8 12 8 8 6 # polyfilled nt syscon fcntl F_SETLKW 7 7 9 9 13 9 9 7 # polyfilled nt syscon fcntl F_GETLK 5 5 7 7 11 7 7 5 # polyfilled nt syscon fcntl F_OFD_SETLK 37 37 -1 -1 -1 -1 -1 -1 # listed in xnu source code but marked private syscon fcntl F_OFD_SETLKW 38 38 -1 -1 -1 -1 -1 -1 # listed in xnu source code but marked private syscon fcntl F_OFD_GETLK 36 36 -1 -1 -1 -1 -1 -1 # listed in xnu source code but marked private syscon fcntl F_RDLCK 0 0 1 1 1 1 1 0 # polyfilled nt; bsd consensus syscon fcntl F_WRLCK 1 1 3 3 3 3 3 1 # polyfilled nt; bsd consensus syscon fcntl F_UNLCK 2 2 2 2 2 2 2 2 # polyfilled nt; unix consensus syscon compat F_SETLK64 6 6 8 8 12 8 8 6 # polyfilled nt syscon compat F_SETLKW64 7 7 9 9 13 9 9 7 syscon compat F_GETLK64 5 5 7 7 11 7 7 5 # polyfilled nt syscon fcntl F_SETSIG 10 10 -1 -1 -1 -1 -1 -1 syscon fcntl F_GETSIG 11 11 -1 -1 -1 -1 -1 -1 syscon fcntl F_SETOWN_EX 15 15 -1 -1 -1 -1 -1 -1 syscon fcntl F_GETOWN_EX 0x10 0x10 -1 -1 -1 -1 -1 -1 syscon fcntl F_SETLEASE 0x0400 0x0400 -1 -1 -1 -1 -1 -1 syscon fcntl F_GETLEASE 0x0401 0x0401 -1 -1 -1 -1 -1 -1 syscon ioctl FIONBIO 0x5421 0x5421 0x8004667e 0x8004667e 0x8004667e 0x8004667e 0x8004667e 0x8004667e # BSD-The New Technology consensus; FIONBIO is traditional O_NONBLOCK; see F_SETFL for re-imagined api syscon ioctl FIOASYNC 0x5452 0x5452 0x8004667d 0x8004667d 0x8004667d 0x8004667d 0x8004667d 0x8004667d # BSD-The New Technology consensus syscon ioctl FIONREAD 0x541b 0x541b 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f # BSD-The New Technology consensus; bytes waiting in FD's input buffer syscon ioctl FIOCLEX 0x5451 0x5451 0x20006601 0x20006601 0x20006601 0x20006601 0x20006601 0x5451 # sets "close on exec" on file descriptor the fast way; faked nt syscon ioctl FIONCLEX 0x5450 0x5450 0x20006602 0x20006602 0x20006602 0x20006602 0x20006602 0x5450 # clears "close on exec" on file descriptor the fast way; faked nt #syscon ioctl FIONWRITE 0x0 0x0 0x0 0x0 0x40046677 0x0 0x0 -1 # [FreeBSD Generalization] bytes queued in FD's output buffer (same as TIOCOUTQ for TTY FDs; see also SO_SNDBUF) #syscon ioctl FIONSPACE 0x0 0x0 0x0 0x0 0x40046676 0x0 0x0 -1 # [FreeBSD Generalization] capacity of FD's output buffer, e.g. equivalent to TIOCGSERIAL w/ UART # openat(), fstatat(), linkat(), etc. magnums # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon at AT_FDCWD -100 -100 -2 -2 -100 -100 -100 -100 # faked nt syscon at AT_SYMLINK_NOFOLLOW 0x0100 0x0100 0x20 0x20 0x0200 2 0x200 0x0100 # faked nt syscon at AT_SYMLINK_FOLLOW 0x0400 0x0400 0x40 0x40 0x0400 4 0x400 0 # see linkat(2) syscon at AT_REMOVEDIR 0x0200 0x0200 0x80 0x80 0x0800 8 0x800 0x0200 # faked nt syscon at AT_EACCESS 0x0200 0x0200 0x10 0x10 0x0100 1 0x100 0 # performs check using effective uid/gid; unnecessary nt syscon at AT_EMPTY_PATH 0x1000 0x1000 0 0 0 0 0 0 # linux 2.6.39+; see unlink, O_TMPFILE, etc. # utimensat() special values # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon utime UTIME_NOW 0x3fffffff 0x3fffffff 0x3fffffff 0x3fffffff -1 -2 0x3fffffff -2 # timespec::tv_sec may be this; polyfilled xnu/nt syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe 0x3ffffffe 0x3ffffffe -2 -1 0x3ffffffe -1 # timespec::tv_nsec may be this; polyfilled xnu/nt # getauxval() keys # # Unsupported values are encoded as 0. # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon auxv AT_EXECFD 2 2 0 0 2 0 2 0 # file descriptor of program syscon auxv AT_PHDR 3 3 3 3 3 0 3 0 # address of program headers of executable syscon auxv AT_PHENT 4 4 4 4 4 0 4 0 syscon auxv AT_PHNUM 5 5 5 5 5 0 5 0 syscon auxv AT_PAGESZ 6 6 6 6 6 0 6 0 syscon auxv AT_BASE 7 7 7 7 7 0 7 0 # address of program interpreter syscon auxv AT_FLAGS 8 8 0 0 8 0 8 0 syscon auxv AT_ENTRY 9 9 9 9 9 0 9 0 # entry address of executable syscon auxv AT_NOTELF 10 10 0 0 10 0 0 0 syscon auxv AT_OSRELDATE 0 0 0 0 18 0 0 0 syscon auxv AT_UID 11 11 11 11 0 0 2001 0 syscon auxv AT_EUID 12 12 12 12 0 0 2000 0 syscon auxv AT_GID 13 13 13 13 0 0 2003 0 syscon auxv AT_EGID 14 14 14 14 0 0 2002 0 syscon auxv AT_PLATFORM 15 15 0 0 0 0 0 0 # address of string with hardware platform for rpath interpretation syscon auxv AT_HWCAP 16 16 16 16 0 0 0 0 syscon auxv AT_CLKTCK 17 17 0 0 0 0 0 0 syscon auxv AT_DCACHEBSIZE 19 19 0 0 0 0 0 0 syscon auxv AT_ICACHEBSIZE 20 20 0 0 0 0 0 0 syscon auxv AT_UCACHEBSIZE 21 21 0 0 0 0 0 0 syscon auxv AT_SECURE 23 23 23 23 0 0 0 0 syscon auxv AT_BASE_PLATFORM 24 24 0 0 0 0 0 0 syscon auxv AT_RANDOM 25 25 25 25 16 0 0 0 # address of sixteen bytes of random data; AT_CANARY on FreeBSD whose AT_CANARYLEN should be 64 syscon auxv AT_HWCAP2 26 26 26 26 0 0 0 0 syscon auxv AT_EXECFN 31 31 31 31 15 999 2014 31 # address of string containing first argument passed to execve() used when running program; AT_EXECPATH on FreeBSD syscon auxv AT_SYSINFO_EHDR 33 33 0 0 0 0 0 0 syscon auxv AT_STACKBASE 0 0 0 0 0 0 13 0 syscon auxv AT_EXECPATH 31 31 31 31 15 999 2014 31 # FreeBSD name for AT_EXECFN syscon auxv AT_MINSIGSTKSZ 51 51 0 0 0 0 0 0 # FreeBSD name for AT_EXECFN syscon auxv AT_CANARY 0 0 0 0 16 0 0 0 syscon auxv AT_CANARYLEN 0 0 0 0 17 0 0 0 syscon auxv AT_NCPUS 0 0 0 0 19 0 0 0 syscon auxv AT_PAGESIZES 0 0 0 0 20 0 0 0 syscon auxv AT_PAGESIZESLEN 0 0 0 0 21 0 0 0 syscon auxv AT_TIMEKEEP 0 0 0 0 22 0 0 0 syscon auxv AT_STACKPROT 0 0 0 0 23 0 0 0 syscon auxv AT_EHDRFLAGS 0 0 0 0 24 0 0 0 syscon auxv AT_NO_AUTOMOUNT 0x0800 0x0800 0 0 0 0 0 0 # getrlimit() / setrlimit() resource parameter # # Unsupported values are encoded as 127. # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon rlimit RLIMIT_CPU 0 0 0 0 0 0 0 127 # max cpu time in seconds; see SIGXCPU; unix consensus syscon rlimit RLIMIT_FSIZE 1 1 1 1 1 1 1 127 # max file size in bytes; unix consensus syscon rlimit RLIMIT_DATA 2 2 2 2 2 2 2 127 # max mmap() / brk() / sbrk() size in bytes; unix consensus syscon rlimit RLIMIT_STACK 3 3 3 3 3 3 3 127 # max stack size in bytes; see SIGXFSZ; unix consensus syscon rlimit RLIMIT_CORE 4 4 4 4 4 4 4 127 # max core file size in bytes; unix consensus syscon rlimit RLIMIT_RSS 5 5 5 5 5 5 5 127 # max physical memory size in bytes; see mmap()→ENOMEM; unix consensus syscon rlimit RLIMIT_NPROC 6 6 7 7 7 7 7 127 # max number of processes; see fork()→EAGAIN; bsd consensus syscon rlimit RLIMIT_NOFILE 7 7 8 8 8 8 8 127 # max number of open files; see accept()→EMFILE/ENFILE; bsd consensus syscon rlimit RLIMIT_MEMLOCK 8 8 6 6 6 6 6 127 # max locked-in-memory address space; bsd consensus syscon rlimit RLIMIT_AS 9 9 5 5 10 2 10 0 # max virtual memory size in bytes; this one actually works; fudged as RLIMIT_DATA on OpenBSD syscon rlimit RLIMIT_LOCKS 10 10 127 127 127 127 127 127 # max flock() / fcntl() locks; bsd consensus syscon rlimit RLIMIT_SIGPENDING 11 11 127 127 127 127 127 127 # max sigqueue() can enqueue; bsd consensus syscon rlimit RLIMIT_MSGQUEUE 12 12 127 127 127 127 127 127 # meh posix message queues; bsd consensus syscon rlimit RLIMIT_NICE 13 13 127 127 127 127 127 127 # max scheduling priority; 𝑥 ∈ [1,40]; niceness is traditionally displayed as as 𝟸𝟶-𝑥, therefore 𝑥=1 (lowest priority) prints as 19 and 𝑥=40 (highest priority) prints as -20; bsd consensus syscon rlimit RLIMIT_RTPRIO 14 14 127 127 127 127 127 127 # woop syscon rlimit RLIMIT_RTTIME 15 15 127 127 127 127 127 127 # woop syscon rlimit RLIMIT_SWAP 127 127 127 127 12 127 127 127 # swap used syscon rlimit RLIMIT_SBSIZE 127 127 127 127 9 127 127 127 # max size of all socket buffers syscon rlimit RLIMIT_NPTS 127 127 127 127 11 127 127 127 # pseudoteletypewriters syscon compat RLIMIT_VMEM 9 9 5 5 10 127 10 127 # same as RLIMIT_AS # resource limit special values # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon rlim RLIM_NLIMITS 16 16 9 9 15 9 12 1 syscon rlim RLIM_INFINITY 0xffffffffffffffff 0xffffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0xffffffffffffffff syscon rlim RLIM_SAVED_CUR 0xffffffffffffffff 0xffffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0xffffffffffffffff syscon rlim RLIM_SAVED_MAX 0xffffffffffffffff 0xffffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0xffffffffffffffff # sigaction() codes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sigact SA_NOCLDSTOP 1 1 8 8 8 8 8 1 # lets you set SIGCHLD handler that's only notified on exit/termination and not notified on SIGSTOP/SIGTSTP/SIGTTIN/SIGTTOU/SIGCONT lool; bsd consensus syscon sigact SA_NOCLDWAIT 2 2 32 32 32 32 32 2 # changes SIGCHLD so the zombie is gone and you can't call wait(2) anymore; similar to SIGCHLD+SIG_IGN but may still deliver the SIGCHLD; bsd consensus syscon sigact SA_SIGINFO 4 4 64 64 64 64 64 4 # asks kernel to provide ucontext_t argument, which has mutable cpu/fpu state of signalled process; and it is polyfilled by cosmopolitan; bsd consensus syscon sigact SA_ONSTACK 0x08000000 0x08000000 1 1 1 1 1 0x08000000 # causes signal handler to be called on stack provided by sigaltstack(2); bsd consensus syscon sigact SA_RESTART 0x10000000 0x10000000 2 2 2 2 2 0x10000000 # prevents signal delivery from triggering EINTR on i/o calls (e.g. read/write/open/wait/accept) but doesn't impact non-i/o blocking calls (e.g. poll, sigsuspend, nanosleep) which will still EINTR; bsd consensus syscon sigact SA_NODEFER 0x40000000 0x40000000 16 16 16 16 16 0x40000000 # lets signal handler be reentrant (e.g. so you can longjmp() out of signal handler); bsd consensus syscon sigact SA_RESETHAND 0x80000000 0x80000000 4 4 4 4 4 0x80000000 # causes signal handler to be called at most once and then set to SIG_DFL automatically; bsd consensus syscon compat SA_NOMASK 0x40000000 0x40000000 16 16 16 16 16 0x40000000 # same as SA_NODEFER syscon compat SA_ONESHOT 0x80000000 0x80000000 4 4 4 4 4 0x80000000 # same as SA_RESETHAND # siginfo::si_code values # # The New Technology NT is polyfilled as Linux. # Unsupported values are encoded as 0x80000000. # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sicode SI_USER 0 0 0x010001 0x010001 0x010001 0 0 0 # sent by kill(2); openbsd defines si_code<=0 as originating from user syscon sicode SI_QUEUE -1 -1 0x010002 0x010002 0x010002 -2 -1 -1 # sent by sigqueue(2) syscon sicode SI_TIMER -2 -2 0x010003 0x010003 0x010003 -3 -2 -2 # sent by setitimer(2) or clock_settime(2) syscon sicode SI_TKILL -6 -6 0x80000000 0x80000000 0x010007 -1 -5 -6 # sent by tkill(2) or tgkill(2) or thr_kill(2) or lwp_kill(2) or _lwp_kill(2); cries syscon sicode SI_MESGQ -3 -3 0x010005 0x010005 0x010005 0x80000000 -4 -3 # sent by mq_notify(2); lool syscon sicode SI_ASYNCIO -4 -4 0x010004 0x010004 0x010004 0x80000000 -3 -4 # aio completion; no thank you syscon sicode SI_ASYNCNL -60 -60 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 # aio completion for dns; the horror syscon sicode SI_KERNEL 128 128 0x80000000 0x80000000 0x010006 0x80000000 0x80000000 0x80 # wut; openbsd defines as si_code>0 syscon sicode SI_NOINFO 32767 32767 0x80000000 0x80000000 0 32767 32767 32767 # no signal specific info available syscon sicode CLD_EXITED 1 1 1 1 1 1 1 1 # SIGCHLD; child exited; unix consensus syscon sicode CLD_KILLED 2 2 2 2 2 2 2 2 # SIGCHLD; child terminated w/o core; unix consensus syscon sicode CLD_DUMPED 3 3 3 3 3 3 3 3 # SIGCHLD; child terminated w/ core; unix consensus syscon sicode CLD_TRAPPED 4 4 4 4 4 4 4 4 # SIGCHLD; traced child trapped; unix consensus syscon sicode CLD_STOPPED 5 5 5 5 5 5 5 5 # SIGCHLD; child stopped; unix consensus syscon sicode CLD_CONTINUED 6 6 6 6 6 6 6 6 # SIGCHLD; stopped child continued; unix consensus syscon sicode TRAP_BRKPT 1 1 1 1 1 1 1 1 # SIGTRAP; process breakpoint; unix consensus syscon sicode TRAP_TRACE 2 2 2 2 2 2 2 2 # SIGTRAP; process trace trap; unix consensus syscon sicode SEGV_MAPERR 1 1 1 1 1 1 1 1 # SIGSEGV; address not mapped to object; unix consensus syscon sicode SEGV_ACCERR 2 2 2 2 2 2 2 2 # SIGSEGV; invalid permissions for mapped object; unix consensus syscon sicode SEGV_PKUERR -1 -1 -1 -1 100 -1 -1 -1 # SIGSEGV: x86: PKU violation syscon sicode FPE_INTDIV 1 1 7 7 2 1 1 1 # SIGFPE; integer divide by zero syscon sicode FPE_INTOVF 2 2 8 8 1 2 2 2 # SIGFPE; integer overflow syscon sicode FPE_FLTDIV 3 3 1 1 3 3 3 3 # SIGFPE; floating point divide by zero syscon sicode FPE_FLTOVF 4 4 2 2 4 4 4 4 # SIGFPE; floating point overflow syscon sicode FPE_FLTUND 5 5 3 3 5 5 5 5 # SIGFPE; floating point underflow syscon sicode FPE_FLTRES 6 6 4 4 6 6 6 6 # SIGFPE; floating point inexact syscon sicode FPE_FLTINV 7 7 5 5 7 7 7 7 # SIGFPE; invalid floating point operation syscon sicode FPE_FLTSUB 8 8 6 6 8 8 8 8 # SIGFPE; subscript out of range syscon sicode ILL_ILLOPC 1 1 1 1 1 1 1 1 # SIGILL; illegal opcode; unix consensus syscon sicode ILL_ILLOPN 2 2 4 4 2 2 2 2 # SIGILL; illegal operand syscon sicode ILL_ILLADR 3 3 5 5 3 3 3 3 # SIGILL; illegal addressing mode syscon sicode ILL_ILLTRP 4 4 2 2 4 4 4 4 # SIGILL; illegal trap syscon sicode ILL_PRVOPC 5 5 3 3 5 5 5 5 # SIGILL; privileged opcode syscon sicode ILL_PRVREG 6 6 6 6 6 6 6 6 # SIGILL; privileged register; unix consensus syscon sicode ILL_COPROC 7 7 7 7 7 7 7 7 # SIGILL; coprocessor error; unix consensus syscon sicode ILL_BADSTK 8 8 8 8 8 8 8 8 # SIGILL; internal stack error; unix consensus syscon sicode BUS_ADRALN 1 1 1 1 1 1 1 1 # SIGBUS; invalid address alignment; unix consensus syscon sicode BUS_ADRERR 2 2 2 2 2 2 2 2 # SIGBUS; non-existent physical address; unix consensus syscon sicode BUS_OBJERR 3 3 3 3 3 3 3 3 # SIGBUS; object specific hardware error; unix consensus syscon sicode BUS_OOMERR -1 -1 -1 -1 100 -1 -1 -1 # SIGBUS; Non-standard: No memory. syscon sicode BUS_MCEERR_AR 4 4 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 # SIGBUS; Linux 2.6.32+ syscon sicode BUS_MCEERR_AO 5 5 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 # SIGBUS; Linux 2.6.32+ syscon sicode POLL_IN 1 1 1 1 1 1 1 1 # SIGIO; data input available; unix consensus syscon sicode POLL_OUT 2 2 2 2 2 2 2 2 # SIGIO; output buffer available; unix consensus syscon sicode POLL_MSG 3 3 3 3 3 3 3 3 # SIGIO; input message available; unix consensus syscon sicode POLL_ERR 4 4 4 4 4 4 4 4 # SIGIO; i/o error; unix consensus syscon sicode POLL_PRI 5 5 5 5 5 5 5 5 # SIGIO; high priority input available; unix consensus syscon sicode POLL_HUP 6 6 6 6 6 6 6 6 # SIGIO; device disconnected; unix consensus syscon sicode SYS_SECCOMP 1 1 -1 -1 -1 -1 -1 -1 # SIGSYS; seccomp triggered syscon sicode SYS_USER_DISPATCH 2 2 -1 -1 -1 -1 -1 -1 # SIGSYS; syscall user dispatch triggered # sigaltstack() values # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ss SS_ONSTACK 1 1 1 1 1 1 1 1 # unix consensus syscon ss SS_DISABLE 2 2 4 4 4 4 4 2 # bsd consensus # close_range() values # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon close CLOSE_RANGE_UNSHARE 2 2 -1 -1 -1 -1 -1 -1 # syscon close CLOSE_RANGE_CLOEXEC 4 4 -1 -1 -1 -1 -1 -1 # # clock_{gettime,settime} timers # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon clock CLOCK_REALTIME 0 0 0 0 0 0 0 0 # consensus syscon clock CLOCK_REALTIME_PRECISE 0 0 0 0 9 0 0 0 # syscon clock CLOCK_REALTIME_FAST 0 0 0 0 10 0 0 0 # syscon clock CLOCK_REALTIME_COARSE 5 5 0 0 10 0 0 0 # Linux 2.6.32+; bsd consensus; not available on RHEL5 syscon clock CLOCK_MONOTONIC 1 1 1 6 4 3 3 1 # XNU/NT faked; could move backwards if NTP introduces negative leap second syscon clock CLOCK_MONOTONIC_PRECISE 1 1 1 6 11 3 3 1 # syscon clock CLOCK_MONOTONIC_FAST 1 1 1 6 12 3 3 1 # syscon clock CLOCK_MONOTONIC_COARSE 6 6 1 6 12 3 3 1 # Linux 2.6.32+; bsd consensus; not available on RHEL5 syscon clock CLOCK_MONOTONIC_RAW 4 4 127 4 127 127 127 127 # actually monotonic; not subject to NTP adjustments; Linux 2.6.28+; XNU/NT/FreeBSD/OpenBSD faked; not available on RHEL5 syscon clock CLOCK_PROCESS_CPUTIME_ID 2 2 127 12 15 2 0x40000000 127 # syscon clock CLOCK_THREAD_CPUTIME_ID 3 3 127 16 14 4 0x20000000 127 # syscon clock CLOCK_PROF 127 127 127 127 2 127 2 127 # syscon clock CLOCK_BOOTTIME 7 7 127 127 127 6 127 127 # syscon clock CLOCK_REALTIME_ALARM 8 8 127 127 127 127 127 127 # syscon clock CLOCK_BOOTTIME_ALARM 9 9 127 127 127 127 127 127 # syscon clock CLOCK_TAI 11 11 127 127 127 127 127 127 # syscon clock CLOCK_UPTIME 127 127 127 127 5 5 127 127 # syscon clock CLOCK_UPTIME_PRECISE 127 127 127 127 7 127 127 127 # syscon clock CLOCK_UPTIME_FAST 127 127 127 127 8 127 127 127 # syscon clock CLOCK_SECOND 127 127 127 127 13 127 127 127 # # poll() # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon poll POLLIN 1 1 1 1 1 1 1 0x0300 # unix consensus; POLLRDNORM|POLLRDBAND on Windows syscon poll POLLPRI 2 2 2 2 2 2 2 0x0400 # unix consensus syscon poll POLLOUT 4 4 4 4 4 4 4 0x0010 # unix consensus; POLLWRNORM on Windows syscon poll POLLERR 8 8 8 8 8 8 8 0x0001 # unix consensus syscon poll POLLHUP 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x0002 # unix consensus syscon poll POLLNVAL 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x0004 # unix consensus syscon poll POLLRDBAND 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x0200 # unix consensus syscon poll POLLRDNORM 0x40 0x40 0x40 0x40 0x40 0x40 0x40 0x0100 # unix consensus syscon poll POLLWRBAND 0x0200 0x0200 0x0100 0x0100 0x0100 0x0100 0x0100 0x0020 # bsd consensus syscon poll POLLWRNORM 0x0100 0x0100 4 4 4 4 4 0x0010 # bsd consensus syscon poll POLLRDHUP 0x2000 0x2000 0x10 0x10 0x10 0x10 0x10 2 # bsd consensus (POLLHUP on non-Linux) # epoll # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon epoll EPOLL_CLOEXEC 0x080000 0x080000 0x01000000 0x01000000 0x100000 0x010000 0x010000 0x80000 # O_CLOEXEC syscon epoll EPOLL_CTL_ADD 1 1 1 1 1 1 1 1 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLL_CTL_DEL 2 2 2 2 2 2 2 2 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLL_CTL_MOD 3 3 3 3 3 3 3 3 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLIN 1 1 1 1 1 1 1 1 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLOUT 4 4 4 4 4 4 4 4 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLERR 8 8 8 8 8 8 8 8 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLPRI 2 2 2 2 2 2 2 2 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLHUP 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLRDNORM 0x40 0x40 0x40 0x40 0x40 0x40 0x40 0x40 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLRDBAND 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLWRNORM 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLWRBAND 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLMSG 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLRDHUP 0x2000 0x2000 0x2000 0x2000 0x2000 0x2000 0x2000 0x2000 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLEXCLUSIVE 0x10000000 0x10000000 0x10000000 0x10000000 0x10000000 0x10000000 0x10000000 0x10000000 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLWAKEUP 0x20000000 0x20000000 0x20000000 0x20000000 0x20000000 0x20000000 0x20000000 0x20000000 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLONESHOT 0x40000000 0x40000000 0x40000000 0x40000000 0x40000000 0x40000000 0x40000000 0x40000000 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLLET 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 # forced consensus, linux only natively, polyfilled elsewhere # {set,get}sockopt(fd, level=SOL_SOCKET, X, ...) # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon so SO_DEBUG 1 1 1 1 1 1 1 1 # debugging is enabled; consensus syscon so SO_TYPE 3 3 0x1008 0x1008 0x1008 0x1008 0x1008 0x1008 # bsd consensus syscon so SO_ERROR 4 4 0x1007 0x1007 0x1007 0x1007 0x1007 0x1007 # takes int pointer and stores/clears the pending error code; bsd consensus syscon so SO_ACCEPTCONN 30 30 2 2 2 2 2 2 # takes int pointer and stores boolean indicating if listen() was called on fd; bsd consensus syscon so SO_REUSEPORT 15 15 0x0200 0x0200 0x0200 0x0200 0x0200 4 # bsd consensus (NT calls it SO_REUSEADDR) syscon so SO_REUSEADDR 2 2 4 4 4 4 4 4 # bsd consensus (default behavior on NT) syscon so SO_EXCLUSIVEADDRUSE 0 0 0 0 0 0 0 ~4 # bsd consensus (default behavior on NT) syscon so SO_KEEPALIVE 9 9 8 8 8 8 8 8 # bsd consensus syscon so SO_DONTROUTE 5 5 0x10 0x10 0x10 0x10 0x10 0x10 # bsd consensus syscon so SO_BROADCAST 6 6 0x20 0x20 0x20 0x20 0x20 0x20 # socket is configured for broadcast messages; bsd consensus syscon so SO_USELOOPBACK 0 0 0x40 0x40 0x40 0x40 0x40 0x40 # bsd consensus syscon so SO_LINGER 13 13 0x1080 0x1080 0x80 0x80 0x80 0x80 # takes struct linger; causes close() return value to actually mean something; SO_LINGER_SEC on XNU; bsd consensus syscon so SO_DONTLINGER 0 0 0 0 0 0 0 ~0x80 # disables so_linger on windows syscon so SO_OOBINLINE 10 10 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 # bsd consensus syscon so SO_SNDBUF 7 7 0x1001 0x1001 0x1001 0x1001 0x1001 0x1001 # bsd consensus syscon so SO_RCVBUF 8 8 0x1002 0x1002 0x1002 0x1002 0x1002 0x1002 # bsd consensus syscon so SO_RCVTIMEO 20 20 0x1006 0x1006 0x1006 0x1006 0x100c 0x1006 # recv timeout; takes struct timeval (overrides SA_RESTART restoring EINTR behavior on recv/send/connect/accept/etc.; bsd consensus) syscon so SO_SNDTIMEO 21 21 0x1005 0x1005 0x1005 0x1005 0x100b 0x1005 # send timeout; takes struct timeval; bsd consensus syscon so SO_RCVLOWAT 18 18 0x1004 0x1004 0x1004 0x1004 0x1004 0x1004 # bsd consensus syscon so SO_SNDLOWAT 19 19 0x1003 0x1003 0x1003 0x1003 0x1003 0x1003 # bsd consensus syscon so SO_TIMESTAMP 29 29 0x0400 0x0400 0x0400 0x0800 0x2000 0 syscon so SO_SETFIB 0 0 0 0 0x1014 0 0 0 syscon so SO_DOMAIN 39 39 0 0 0x1019 0x1024 0 0 syscon so SO_MAX_PACING_RATE 47 47 0 0 0x1018 0 0 0 syscon so SO_PEERCRED 17 17 0 0 0 0x1022 0 0 syscon so SO_EXCLUSIVEADDRUSE 0 0 0 0 0 0 0 0xfffffffb # hoo boy syscon so LOCAL_PEERCRED 0 0 1 1 1 0 0 0 syscon so SO_PROTOCOL 38 38 0 0 0x1016 0x1025 0 0 syscon so SO_ATTACH_BPF 50 50 0 0 0 0 0 0 syscon so SO_ATTACH_FILTER 26 26 0 0 0 0 0 0 syscon so SO_ATTACH_REUSEPORT_CBPF 51 51 0 0 0 0 0 0 syscon so SO_ATTACH_REUSEPORT_EBPF 52 52 0 0 0 0 0 0 syscon so SO_BINDTODEVICE 25 25 0 0 0 0 0 0 syscon so SO_BPF_EXTENSIONS 48 48 0 0 0 0 0 0 syscon so SO_BSDCOMPAT 14 14 0 0 0 0 0 0 syscon so SO_BUSY_POLL 46 46 0 0 0 0 0 0 syscon so SO_CNX_ADVICE 53 53 0 0 0 0 0 0 syscon so SO_DETACH_BPF 27 27 0 0 0 0 0 0 syscon so SO_DETACH_FILTER 27 27 0 0 0 0 0 0 syscon so SO_GET_FILTER 26 26 0 0 0 0 0 0 syscon so SO_INCOMING_CPU 49 49 0 0 0 0 0 0 syscon so SO_LOCK_FILTER 44 44 0 0 0 0 0 0 syscon so SO_MARK 36 36 0 0 0 0 0 0 syscon so SO_NOFCS 43 43 0 0 0 0 0 0 syscon so SO_NO_CHECK 11 11 0 0 0 0 0 0 syscon so SO_PASSCRED 0x10 0x10 0 0 0 0 0 0 syscon so SO_PASSSEC 34 34 0 0 0 0 0 0 syscon so SO_PEEK_OFF 42 42 0 0 0 0 0 0 syscon so SO_PEERNAME 28 28 0 0 0 0 0 0 syscon so SO_PEERSEC 31 31 0 0 0 0 0 0 syscon so SO_PRIORITY 12 12 0 0 0 0 0 0 syscon so SO_RCVBUFFORCE 33 33 0 0 0 0 0 0 syscon so SO_RXQ_OVFL 40 40 0 0 0 0 0 0 syscon so SO_SECURITY_AUTHENTICATION 22 22 0 0 0 0 0 0 syscon so SO_SECURITY_ENCRYPTION_NETWORK 24 24 0 0 0 0 0 0 syscon so SO_SECURITY_ENCRYPTION_TRANSPORT 23 23 0 0 0 0 0 0 syscon so SO_SELECT_ERR_QUEUE 45 45 0 0 0 0 0 0 syscon so SO_SNDBUFFORCE 0x20 0x20 0 0 0 0 0 0 syscon so SO_TIMESTAMPING 37 37 0 0 0 0 0 0 syscon so SO_TIMESTAMPNS 35 35 0 0 0 0 0 0 syscon so SO_WIFI_STATUS 41 41 0 0 0 0 0 0 syscon sol SOL_IP 0 0 0 0 0 0 0 0 # consensus syscon sol SOL_SOCKET 1 1 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff # yes it's actually 0xffff; bsd+nt consensus (todo: what's up with ipproto_icmp overlap) syscon sol SOL_TCP 6 6 6 6 6 6 6 6 # consensus syscon sol SOL_UDP 17 17 17 17 17 17 17 17 # consensus syscon sol SOL_RAW 255 255 -1 -1 -1 -1 -1 -1 syscon sol SOL_IPV6 41 41 41 41 41 41 41 41 syscon sol SOL_ICMPV6 58 58 58 58 58 58 58 -1 syscon sol SOL_AAL 265 265 -1 -1 -1 -1 -1 -1 syscon sol SOL_ALG 279 279 -1 -1 -1 -1 -1 -1 syscon sol SOL_ATM 264 264 -1 -1 -1 -1 -1 -1 syscon sol SOL_BLUETOOTH 274 274 -1 -1 -1 -1 -1 -1 syscon sol SOL_CAIF 278 278 -1 -1 -1 -1 -1 -1 syscon sol SOL_DCCP 269 269 -1 -1 -1 -1 -1 -1 syscon sol SOL_DECNET 261 261 -1 -1 -1 -1 -1 -1 syscon sol SOL_IRDA 266 266 -1 -1 -1 -1 -1 -1 syscon sol SOL_IUCV 277 277 -1 -1 -1 -1 -1 -1 syscon sol SOL_KCM 281 281 -1 -1 -1 -1 -1 -1 syscon sol SOL_LLC 268 268 -1 -1 -1 -1 -1 -1 syscon sol SOL_NETBEUI 267 267 -1 -1 -1 -1 -1 -1 syscon sol SOL_NETLINK 270 270 -1 -1 -1 -1 -1 -1 syscon sol SOL_NFC 280 280 -1 -1 -1 -1 -1 -1 syscon sol SOL_PACKET 263 263 -1 -1 -1 -1 -1 -1 syscon sol SOL_PNPIPE 275 275 -1 -1 -1 -1 -1 -1 syscon sol SOL_PPPOL2TP 273 273 -1 -1 -1 -1 -1 -1 syscon sol SOL_RDS 276 276 -1 -1 -1 -1 -1 -1 syscon sol SOL_RXRPC 272 272 -1 -1 -1 -1 -1 -1 syscon sol SOL_TIPC 271 271 -1 -1 -1 -1 -1 -1 syscon sol SOL_X25 262 262 -1 -1 -1 -1 -1 -1 syscon alg ALG_SET_KEY 1 1 0 0 0 0 0 0 syscon alg ALG_SET_IV 2 2 0 0 0 0 0 0 syscon alg ALG_SET_OP 3 3 0 0 0 0 0 0 syscon alg ALG_SET_AEAD_ASSOCLEN 4 4 0 0 0 0 0 0 syscon alg ALG_SET_AEAD_AUTHSIZE 5 5 0 0 0 0 0 0 syscon alg ALG_SET_DRBG_ENTROPY 6 6 0 0 0 0 0 0 # {set,get}sockopt(fd, level=SOL_TCP, X, ...) # » most elite of all tuning groups # # @see https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt # @see https://www.iana.org/assignments/tcp-parameters/tcp-parameters.txt # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon tcp TCP_NODELAY 1 1 1 1 1 1 1 1 # strong consensus for disabling nagle's algorithm; so be sure to disable it by turning this on syscon tcp TCP_CORK 3 3 4 4 4 16 4 0 # nagle's algorithm strikes again; TCP_NOPUSH on BSD; be sure to turn it off; protip: mmap+writev vs. write+sendfile; see also /proc/sys/net/ipv4/tcp_autocorking; netbsd is 4 but not implemented syscon tcp TCP_MAXSEG 2 2 2 2 2 2 2 0 # reduces tcp segment size; see also tcp offloading syscon tcp TCP_FASTOPEN 23 23 0 0 0x0401 0 0 15 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true syscon tcp TCP_FASTOPEN_CONNECT 30 30 0 0 0 0 0 0 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true syscon tcp TCP_KEEPIDLE 4 4 0 0 0x100 0 3 0 # start keepalives after this period syscon tcp TCP_KEEPINTVL 5 5 0x101 0x101 0x200 0 5 0 # interval between keepalives syscon tcp TCP_KEEPCNT 6 6 0x102 0x102 0x400 0 6 0 # number of keepalives before death syscon tcp TCP_SYNCNT 7 7 0 0 0 0 0 0 # how hard to syn packet the enemy syscon tcp TCP_ULP 31 31 0 0 0 0 0 0 # setsockopt(sock, IPPROTO_TCP, TCP_ULP, "tls", 4) syscon tcp TCP_COOKIE_TRANSACTIONS 15 15 0 0 0 0 0 0 # defense against the syn packets syscon tcp TCP_LINGER2 8 8 0 0 0 0 0 0 # orphaned fin-wait-2 lifetime cf. net.ipv4.tcp_fin_timeout see cloudflare blog syscon tcp TCP_NOTSENT_LOWAT 25 25 513 513 0 0 0 0 # limit unset byte queue syscon tcp TCP_INFO 11 11 0 0 0x20 0 9 0 # get connection info syscon tcp TCP_CC_INFO 26 26 0 0 0 0 0 0 # get congestion control info syscon tcp TCP_CONGESTION 13 13 0 0 0x40 0 0 0 # set traffic control syscon tcp TCP_MD5SIG 14 14 0 0 0x10 4 16 0 # what is it (rfc2385) syscon tcp TCP_MD5SIG_MAXKEYLEN 80 80 0 0 0 0 0 0 # what is it syscon tcp TCP_TIMESTAMP 24 24 0 0 0 0 0 0 # what is it syscon tcp TCP_USER_TIMEOUT 18 18 0 0 0 0 0 0 # what is it syscon tcp TCP_QUICKACK 12 12 0 0 0 0 0 0 # disables optimization that lets kernel merge response data into ack packets syscon tcp TCP_SAVE_SYN 27 27 0 0 0 0 0 0 # record syn packets syscon tcp TCP_SAVED_SYN 28 28 0 0 0 0 0 0 # get recorded syn packets syscon tcp TCP_THIN_DUPACK 17 17 0 0 0 0 0 0 # what is it syscon tcp TCP_QUEUE_SEQ 21 21 0 0 0 0 0 0 # what is it syscon tcp TCP_WINDOW_CLAMP 10 10 0 0 0 0 0 0 # what is it syscon tcp TCP_DEFER_ACCEPT 9 9 0 0 0 0 0 0 # defer accept() until readable data has arrived syscon tcp TCP_REPAIR 19 19 0 0 0 0 0 0 # what is it syscon tcp TCP_REPAIR_OPTIONS 22 22 0 0 0 0 0 0 # what is it syscon tcp TCP_REPAIR_QUEUE 20 20 0 0 0 0 0 0 # what is it syscon tcp TCP_THIN_LINEAR_TIMEOUTS 16 16 0 0 0 0 0 0 # what is it # https://blog.cloudflare.com/know-your-scm_rights/ # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon scm SCM_RIGHTS 1 1 1 1 1 1 1 1 # unix consensus; faked nt syscon scm SCM_TIMESTAMP 29 29 2 2 2 4 8 0 syscon scm SCM_CREDENTIALS 2 2 0 0 0 0 0 0 syscon scm SCM_TIMESTAMPING 37 37 0 0 0 0 0 0 syscon scm SCM_TIMESTAMPNS 35 35 0 0 0 0 0 0 syscon scm SCM_WIFI_STATUS 41 41 0 0 0 0 0 0 # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ip IP_TOS 1 1 3 3 3 3 3 8 # bsd consensus syscon ip IP_TTL 2 2 4 4 4 4 4 7 # bsd consensus syscon ip IP_HDRINCL 3 3 2 2 2 2 2 2 # bsd consensus syscon ip IP_DEFAULT_MULTICAST_LOOP 1 1 1 1 1 1 1 1 # consensus syscon ip IP_DEFAULT_MULTICAST_TTL 1 1 1 1 1 1 1 1 # consensus syscon ip IP_PMTUDISC_DONT 0 0 0 0 0 0 0 0 # consensus syscon ip IP_MAX_MEMBERSHIPS 20 20 0x0fff 0x0fff 0x0fff 0x0fff 0x0fff 20 # bsd consensus syscon ip IP_OPTIONS 4 4 1 1 1 1 1 1 # bsd consensus syscon ip IP_RECVTTL 12 12 24 24 65 31 23 21 syscon ip IP_ADD_MEMBERSHIP 35 35 12 12 12 12 12 5 # bsd consensus syscon ip IP_DROP_MEMBERSHIP 36 36 13 13 13 13 13 6 # bsd consensus syscon ip IP_MULTICAST_IF 0x20 0x20 9 9 9 9 9 2 # bsd consensus syscon ip IP_MULTICAST_LOOP 34 34 11 11 11 11 11 4 # bsd consensus syscon ip IP_MULTICAST_TTL 33 33 10 10 10 10 10 3 # bsd consensus syscon ip IP_RECVOPTS 6 6 5 5 5 5 5 0 # bsd consensus syscon ip IP_RECVRETOPTS 7 7 6 6 6 6 6 0 # bsd consensus syscon ip IP_RECVDSTADDR 0 0 7 7 7 7 7 0 # bsd consensus syscon ip IP_RETOPTS 7 7 8 8 8 8 8 0 # bsd consensus syscon ip IP_ADD_SOURCE_MEMBERSHIP 39 39 70 70 70 0 0 15 syscon ip IP_BLOCK_SOURCE 38 38 72 72 72 0 0 17 syscon ip IP_DROP_SOURCE_MEMBERSHIP 40 40 71 71 71 0 0 0x10 syscon ip IP_UNBLOCK_SOURCE 37 37 73 73 73 0 0 18 syscon ip IP_IPSEC_POLICY 0x10 0x10 21 21 21 0 0 0 syscon ip IP_MINTTL 21 21 0 0 66 32 24 0 # minimum ttl for packet or drop syscon ip IP_MSFILTER 41 41 74 74 74 0 0 0 syscon ip IP_PKTINFO 8 8 26 26 0 0 25 19 syscon ip IP_RECVTOS 13 13 0 0 68 0 0 40 syscon ip IP_MTU 14 14 0 0 0 0 0 73 # bsd consensus syscon ip IP_MTU_DISCOVER 10 10 0 0 0 0 0 71 # bsd consensus syscon ip IP_RECVERR 11 11 0 0 0 0 0 75 # bsd consensus syscon ip IP_UNICAST_IF 50 50 0 0 0 0 0 31 # bsd consensus syscon ip IP_ORIGDSTADDR 20 20 0 0 27 0 0 0 syscon ip IP_RECVORIGDSTADDR 20 20 0 0 27 0 0 0 syscon ip IP_BIND_ADDRESS_NO_PORT 24 24 0 0 0 0 0 0 syscon ip IP_CHECKSUM 23 23 0 0 0 0 0 0 syscon ip IP_FREEBIND 15 15 0 0 0 0 0 0 syscon ip IP_MULTICAST_ALL 49 49 0 0 0 0 0 0 syscon ip IP_NODEFRAG 22 22 0 0 0 0 0 0 syscon ip IP_PASSSEC 18 18 0 0 0 0 0 0 syscon ip IP_PKTOPTIONS 9 9 0 0 0 0 0 0 syscon ip IP_PMTUDISC 10 10 0 0 0 0 0 0 syscon ip IP_PMTUDISC_DO 2 2 0 0 0 0 0 0 syscon ip IP_PMTUDISC_INTERFACE 4 4 0 0 0 0 0 0 syscon ip IP_PMTUDISC_OMIT 5 5 0 0 0 0 0 0 syscon ip IP_PMTUDISC_PROBE 3 3 0 0 0 0 0 0 syscon ip IP_PMTUDISC_WANT 1 1 0 0 0 0 0 0 syscon ip IP_ROUTER_ALERT 5 5 0 0 0 0 0 0 syscon ip IP_TRANSPARENT 19 19 0 0 0 0 0 0 syscon ip IP_XFRM_POLICY 17 17 0 0 0 0 0 0 syscon ip INET_ADDRSTRLEN 0x10 0x10 0x10 0x10 0x10 0x10 0x10 22 # unix consensus syscon ipport IPPORT_USERRESERVED 5000 5000 5000 5000 5000 49151 5000 5000 # ptrace() codes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ptrace PTRACE_TRACEME 0 0 0 0 0 0 -1 -1 # unix consensus a.k.a. PT_TRACE_ME syscon ptrace PTRACE_PEEKTEXT 1 1 1 1 1 1 -1 -1 # unix consensus a.k.a. PT_READ_I syscon ptrace PTRACE_PEEKDATA 2 2 2 2 2 2 -1 -1 # unix consensus a.k.a. PT_READ_D syscon ptrace PTRACE_PEEKUSER 3 3 3 3 -1 -1 -1 -1 # a.k.a. PT_READ_U syscon ptrace PTRACE_POKETEXT 4 4 4 4 4 4 -1 -1 # unix consensus a.k.a. PT_WRITE_I syscon ptrace PTRACE_POKEDATA 5 5 5 5 5 5 -1 -1 # unix consensus a.k.a. PT_WRITE_D syscon ptrace PTRACE_POKEUSER 6 6 6 6 -1 -1 -1 -1 # a.k.a. PT_WRITE_U syscon ptrace PTRACE_CONT 7 7 7 7 7 7 -1 -1 # unix consensus a.k.a. PT_CONTINUE syscon ptrace PTRACE_KILL 8 8 8 8 8 8 -1 -1 # unix consensus a.k.a. PT_KILL syscon ptrace PTRACE_SINGLESTEP 9 9 9 9 9 32 -1 -1 # a.k.a. PT_STEP syscon ptrace PTRACE_GETREGS 12 12 -1 -1 33 33 -1 -1 # a.k.a. PT_GETREGS syscon ptrace PTRACE_SETREGS 13 13 -1 -1 34 34 -1 -1 # a.k.a. PT_SETREGS syscon ptrace PTRACE_GETFPREGS 14 14 -1 -1 35 35 -1 -1 # a.k.a. PT_GETFPREGS syscon ptrace PTRACE_SETFPREGS 15 15 -1 -1 36 36 -1 -1 # a.k.a. PT_SETFPREGS syscon ptrace PTRACE_ATTACH 16 16 10 10 10 9 -1 -1 # a.k.a. PT_ATTACH syscon ptrace PTRACE_DETACH 17 17 11 11 11 10 -1 -1 # a.k.a. PT_DETACH syscon ptrace PTRACE_GETFPXREGS 18 18 -1 -1 -1 -1 -1 -1 # a.k.a. PT_GETFPXREGS syscon ptrace PTRACE_SETFPXREGS 19 19 -1 -1 -1 -1 -1 -1 # a.k.a. PT_SETFPXREGS syscon ptrace PTRACE_SYSCALL 24 24 -1 -1 22 -1 -1 -1 # a.k.a. PT_SYSCALL syscon ptrace PTRACE_GETEVENTMSG 0x4201 0x4201 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_GETSIGINFO 0x4202 0x4202 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_SETOPTIONS 0x4200 0x4200 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_SETSIGINFO 0x4203 0x4203 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_GETREGSET 0x4204 0x4204 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_GETSIGMASK 0x420a 0x420a -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_INTERRUPT 0x4207 0x4207 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_LISTEN 0x4208 0x4208 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_PEEKSIGINFO 0x4209 0x4209 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_SECCOMP_GET_FILTER 0x420c 0x420c -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_SEIZE 0x4206 0x4206 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_SETREGSET 0x4205 0x4205 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_SETSIGMASK 0x420b 0x420b -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACESYSGOOD 0x0001 0x0001 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACEFORK 0x0002 0x0002 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACEVFORK 0x0004 0x0004 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACECLONE 0x0008 0x0008 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACEEXEC 0x0010 0x0010 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACEVFORKDONE 0x0020 0x0020 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACEEXIT 0x0040 0x0040 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_TRACESECCOMP 0x0080 0x0080 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_O_MASK 0x007f 0x007f -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_FORK 1 1 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_VFORK 2 2 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_CLONE 3 3 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_EXEC 4 4 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_VFORK_DONE 5 5 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_EXIT 6 6 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_SECCOMP 7 7 -1 -1 -1 -1 -1 -1 syscon ptrace PTRACE_EVENT_STOP 128 128 -1 -1 -1 -1 -1 -1 # clone() codes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon clone CLONE_VM 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 # intentionally symbolic so we can tell if clone() is being used to create threads # IPPROTO_* # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon iproto IPPROTO_IP 0 0 0 0 0 0 0 0 # consensus syscon iproto IPPROTO_ICMP 1 1 1 1 1 1 1 1 # consensus syscon iproto IPPROTO_TCP 6 6 6 6 6 6 6 6 # consensus syscon iproto IPPROTO_UDP 17 17 17 17 17 17 17 17 # consensus syscon iproto IPPROTO_RAW 255 255 255 255 255 255 255 255 # consensus syscon iproto IPPROTO_HOPOPTS -1 -1 -1 -1 -1 -1 -1 -1 # consensus syscon iproto IPPROTO_IDP 22 22 22 22 22 22 22 22 # consensus syscon iproto IPPROTO_IGMP 2 2 2 2 2 2 2 2 # consensus syscon iproto IPPROTO_PUP 12 12 12 12 12 12 12 12 # consensus syscon iproto IPPROTO_AH 51 51 51 51 51 51 51 -1 # unix consensus syscon iproto IPPROTO_DSTOPTS 60 60 60 60 60 60 60 -1 # unix consensus syscon iproto IPPROTO_EGP 8 8 8 8 8 8 8 -1 # unix consensus syscon iproto IPPROTO_ENCAP 98 98 98 98 98 98 98 -1 # unix consensus syscon iproto IPPROTO_ESP 50 50 50 50 50 50 50 -1 # unix consensus syscon iproto IPPROTO_FRAGMENT 44 44 44 44 44 44 44 -1 # unix consensus syscon iproto IPPROTO_GRE 47 47 47 47 47 47 47 -1 # unix consensus syscon iproto IPPROTO_ICMPV6 58 58 58 58 58 58 58 -1 # unix consensus syscon iproto IPPROTO_IPIP 4 4 4 4 4 4 4 -1 # unix consensus syscon iproto IPPROTO_IPV6 41 41 41 41 41 41 41 -1 # unix consensus syscon iproto IPPROTO_NONE 59 59 59 59 59 59 59 -1 # unix consensus syscon iproto IPPROTO_PIM 103 103 103 103 103 103 103 -1 # unix consensus syscon iproto IPPROTO_ROUTING 43 43 43 43 43 43 43 -1 # unix consensus syscon iproto IPPROTO_RSVP 46 46 46 46 46 46 46 -1 # unix consensus syscon iproto IPPROTO_TP 29 29 29 29 29 29 29 -1 # unix consensus syscon iproto IPPROTO_MPLS 137 137 -1 -1 137 137 137 -1 syscon iproto IPPROTO_MTP 92 92 92 92 92 -1 -1 -1 syscon iproto IPPROTO_SCTP 132 132 132 132 132 -1 -1 -1 syscon iproto IPPROTO_MH 135 135 -1 -1 135 -1 -1 -1 syscon iproto IPPROTO_UDPLITE 136 136 -1 -1 136 -1 -1 -1 syscon iproto IPPROTO_BEETPH 94 94 -1 -1 -1 -1 -1 -1 syscon iproto IPPROTO_COMP 108 108 -1 -1 -1 -1 -1 -1 syscon iproto IPPROTO_DCCP 33 33 -1 -1 -1 -1 -1 -1 # socket ioctl() # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sio SIOCATMARK 0x8905 0x8905 0x40047307 0x40047307 0x40047307 0x40047307 0x40047307 0x40047307 # use sockatmark(); determines if oob is available; bsd consensus syscon sio SIOCADDMULTI 0x8931 0x8931 0x80206931 0x80206931 0x80206931 0x80206931 0x80206931 0 # bsd consensus syscon sio SIOCDELMULTI 0x8932 0x8932 0x80206932 0x80206932 0x80206932 0x80206932 0x80206932 0 # bsd consensus syscon sio SIOCDIFADDR 0x8936 0x8936 0x80206919 0x80206919 0x80206919 0x80206919 0x80206919 0 # bsd consensus syscon sio SIOCGIFADDR 0x8915 0x8915 0xc0206921 0xc0206921 0xc0206921 0xc0206921 0xc0206921 0 # bsd consensus syscon sio SIOCGIFBRDADDR 0x8919 0x8919 0xc0206923 0xc0206923 0xc0206923 0xc0206923 0xc0206923 0 # bsd consensus syscon sio SIOCGIFDSTADDR 0x8917 0x8917 0xc0206922 0xc0206922 0xc0206922 0xc0206922 0xc0206922 0 # bsd consensus syscon sio SIOCGIFFLAGS 0x8913 0x8913 0xc0206911 0xc0206911 0xc0206911 0xc0206911 0xc0206911 0 # bsd consensus syscon sio SIOCGIFMETRIC 0x891d 0x891d 0xc0206917 0xc0206917 0xc0206917 0xc0206917 0xc0206917 0 # bsd consensus syscon sio SIOCGIFNETMASK 0x891b 0x891b 0xc0206925 0xc0206925 0xc0206925 0xc0206925 0xc0206925 0 # bsd consensus syscon sio SIOCGPGRP 0x8904 0x8904 0x40047309 0x40047309 0x40047309 0x40047309 0x40047309 0 # bsd consensus syscon sio SIOCSIFADDR 0x8916 0x8916 0x8020690c 0x8020690c 0x8020690c 0x8020690c 0x8020690c 0 # bsd consensus syscon sio SIOCSIFBRDADDR 0x891a 0x891a 0x80206913 0x80206913 0x80206913 0x80206913 0x80206913 0 # bsd consensus syscon sio SIOCSIFDSTADDR 0x8918 0x8918 0x8020690e 0x8020690e 0x8020690e 0x8020690e 0x8020690e 0 # bsd consensus syscon sio SIOCSIFFLAGS 0x8914 0x8914 0x80206910 0x80206910 0x80206910 0x80206910 0x80206910 0 # bsd consensus syscon sio SIOCSIFMETRIC 0x891e 0x891e 0x80206918 0x80206918 0x80206918 0x80206918 0x80206918 0 # bsd consensus syscon sio SIOCSIFNETMASK 0x891c 0x891c 0x80206916 0x80206916 0x80206916 0x80206916 0x80206916 0 # bsd consensus syscon sio SIOCSPGRP 0x8902 0x8902 0x80047308 0x80047308 0x80047308 0x80047308 0x80047308 0 # bsd consensus syscon sio SIOCGIFCONF 0x8912 0x8912 0xc00c6924 0xc00c6924 0xc0106924 0xc0106924 0xc0106924 0 syscon sio SIOCGIFMTU 0x8921 0x8921 0xc0206933 0xc0206933 0xc0206933 0xc020697e 0xc020697e 0 syscon sio SIOCSIFMTU 0x8922 0x8922 0x80206934 0x80206934 0x80206934 0x8020697f 0x8020697f 0 syscon sio SIOCGIFINDEX 0x8933 0x8933 0 0 0xc0206920 0 0 0 syscon sio SIOCSIFNAME 0x8923 0x8923 0 0 0x80206928 0 0 0 syscon sio SIOCADDDLCI 0x8980 0x8980 0 0 0 0 0 0 syscon sio SIOCADDRT 0x890b 0x890b 0 0 0 0 0 0 syscon sio SIOCDARP 0x8953 0x8953 0 0 0 0 0 0 syscon sio SIOCDELDLCI 0x8981 0x8981 0 0 0 0 0 0 syscon sio SIOCDELRT 0x890c 0x890c 0 0 0 0 0 0 syscon sio SIOCDEVPRIVATE 0x89f0 0x89f0 0 0 0 0 0 0 syscon sio SIOCDRARP 0x8960 0x8960 0 0 0 0 0 0 syscon sio SIOCGARP 0x8954 0x8954 0 0 0 0 0 0 syscon sio SIOCGIFBR 0x8940 0x8940 0 0 0 0 0 0 syscon sio SIOCGIFCOUNT 0x8938 0x8938 0 0 0 0 0 0 syscon sio SIOCGIFENCAP 0x8925 0x8925 0 0 0 0 0 0 syscon sio SIOCGIFHWADDR 0x8927 0x8927 0 0 0 0 0 0 syscon sio SIOCGIFMAP 0x8970 0x8970 0 0 0 0 0 0 syscon sio SIOCGIFMEM 0x891f 0x891f 0 0 0 0 0 0 syscon sio SIOCGIFNAME 0x8910 0x8910 0 0 0 0 0 0 syscon sio SIOCGIFPFLAGS 0x8935 0x8935 0 0 0 0 0 0 syscon sio SIOCGIFSLAVE 0x8929 0x8929 0 0 0 0 0 0 syscon sio SIOCGIFTXQLEN 0x8942 0x8942 0 0 0 0 0 0 syscon sio SIOCGRARP 0x8961 0x8961 0 0 0 0 0 0 syscon sio SIOCGSTAMP 0x8906 0x8906 0 0 0 0 0 0 syscon sio SIOCGSTAMPNS 0x8907 0x8907 0 0 0 0 0 0 syscon sio SIOCPROTOPRIVATE 0x89e0 0x89e0 0 0 0 0 0 0 syscon sio SIOCRTMSG 0x890d 0x890d 0 0 0 0 0 0 syscon sio SIOCSARP 0x8955 0x8955 0 0 0 0 0 0 syscon sio SIOCSIFBR 0x8941 0x8941 0 0 0 0 0 0 syscon sio SIOCSIFENCAP 0x8926 0x8926 0 0 0 0 0 0 syscon sio SIOCSIFHWADDR 0x8924 0x8924 0 0 0 0 0 0 syscon sio SIOCSIFHWBROADCAST 0x8937 0x8937 0 0 0 0 0 0 syscon sio SIOCSIFLINK 0x8911 0x8911 0 0 0 0 0 0 syscon sio SIOCSIFMAP 0x8971 0x8971 0 0 0 0 0 0 syscon sio SIOCSIFMEM 0x8920 0x8920 0 0 0 0 0 0 syscon sio SIOCSIFPFLAGS 0x8934 0x8934 0 0 0 0 0 0 syscon sio SIOCSIFSLAVE 0x8930 0x8930 0 0 0 0 0 0 syscon sio SIOCSIFTXQLEN 0x8943 0x8943 0 0 0 0 0 0 syscon sio SIOCSRARP 0x8962 0x8962 0 0 0 0 0 0 syscon sio SIOGIFINDEX 0x8933 0x8933 0 0 0 0 0 0 # socket() address families # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon af AF_UNSPEC 0 0 0 0 0 0 0 0 # consensus syscon af AF_UNIX 1 1 1 1 1 1 1 1 # consensus syscon af AF_LOCAL 1 1 1 1 1 1 1 1 # consensus syscon af AF_FILE 1 1 0 0 0 0 0 0 syscon af AF_INET 2 2 2 2 2 2 2 2 # consensus syscon af AF_INET6 10 10 30 30 28 24 24 23 syscon af AF_AX25 3 3 0 0 0 0 0 0 syscon af AF_IPX 4 4 23 23 23 23 23 6 # bsd consensus syscon af AF_APPLETALK 5 5 0x10 0x10 0x10 0x10 0x10 0x10 # bsd consensus syscon af AF_NETROM 6 6 0 0 0 0 0 0 syscon af AF_BRIDGE 7 7 0 0 0 0 0 0 syscon af AF_ATMPVC 8 8 0 0 0 0 0 0 syscon af AF_X25 9 9 0 0 0 0 0 0 syscon af AF_ROSE 11 11 0 0 0 0 0 0 syscon af AF_NETBEUI 13 13 0 0 0 0 0 0 syscon af AF_SECURITY 14 14 0 0 0 0 0 0 syscon af AF_KEY 15 15 0 0 0 30 0 0 syscon af AF_ROUTE 16 16 17 17 17 17 34 0 # bsd consensus syscon af AF_NETLINK 16 16 0 0 0 0 0 0 syscon af AF_PACKET 17 17 0 0 0 0 0 0 syscon af AF_LINK 0 0 18 18 18 18 18 0 syscon af AF_ASH 18 18 0 0 0 0 0 0 syscon af AF_ECONET 19 19 0 0 0 0 0 0 syscon af AF_ATMSVC 20 20 0 0 0 0 0 0 syscon af AF_RDS 21 21 0 0 0 0 0 0 syscon af AF_SNA 22 22 11 11 11 11 11 11 # bsd consensus syscon af AF_IRDA 23 23 0 0 0 0 0 0 syscon af AF_PPPOX 24 24 0 0 0 0 0 0 syscon af AF_WANPIPE 25 25 0 0 0 0 0 0 syscon af AF_LLC 26 26 0 0 0 0 0 0 syscon af AF_IB 27 27 0 0 0 0 0 0 syscon af AF_MPLS 28 28 0 0 0 33 33 0 syscon af AF_CAN 29 29 0 0 0 0 35 0 syscon af AF_TIPC 30 30 0 0 0 0 0 0 syscon af AF_BLUETOOTH 31 31 0 0 36 0x20 31 0 syscon af AF_IUCV 0x20 0x20 0 0 0 0 0 0 syscon af AF_RXRPC 33 33 0 0 0 0 0 0 syscon af AF_ISDN 34 34 28 28 26 26 26 0 syscon af AF_PHONET 35 35 0 0 0 0 0 0 syscon af AF_IEEE802154 36 36 0 0 0 0 0 0 syscon af AF_CAIF 37 37 0 0 0 0 0 0 syscon af AF_ALG 38 38 0 0 0 0 0 0 syscon af AF_NFC 39 39 0 0 0 0 0 0 syscon af AF_VSOCK 40 40 0 0 0 0 0 0 syscon af AF_KCM 41 41 0 0 0 0 0 0 syscon af AF_MAX 42 42 40 40 42 36 37 35 syscon pf PF_UNIX 1 1 1 1 1 1 1 1 # consensus syscon pf PF_UNSPEC 0 0 0 0 0 0 0 0 # consensus syscon pf PF_APPLETALK 5 5 0x10 0x10 0x10 0x10 0x10 0x10 # bsd consensus syscon pf PF_SNA 22 22 11 11 11 11 11 11 # bsd consensus syscon pf PF_INET6 10 10 30 30 28 24 24 23 syscon pf PF_MAX 42 42 40 40 42 36 36 35 syscon pf PF_INET 2 2 2 2 2 2 2 0 # unix consensus syscon pf PF_LOCAL 1 1 1 1 1 1 1 0 # unix consensus syscon pf PF_IPX 4 4 23 23 23 23 23 0 # bsd consensus syscon pf PF_ROUTE 0x10 0x10 17 17 17 17 17 0 # bsd consensus syscon pf PF_ISDN 34 34 28 28 26 26 26 0 syscon pf PF_KEY 15 15 29 29 27 30 30 0 syscon pf PF_BLUETOOTH 31 31 0 0 36 0x20 0x20 0 syscon pf PF_MPLS 28 28 0 0 0 33 33 0 syscon pf PF_ALG 38 38 0 0 0 0 0 0 syscon pf PF_ASH 18 18 0 0 0 0 0 0 syscon pf PF_ATMPVC 8 8 0 0 0 0 0 0 syscon pf PF_ATMSVC 20 20 0 0 0 0 0 0 syscon pf PF_AX25 3 3 0 0 0 0 0 0 syscon pf PF_BRIDGE 7 7 0 0 0 0 0 0 syscon pf PF_CAIF 37 37 0 0 0 0 0 0 syscon af PF_CAN 29 29 0 0 0 0 35 0 syscon pf PF_ECONET 19 19 0 0 0 0 0 0 syscon pf PF_FILE 1 1 0 0 0 0 0 0 syscon pf PF_IB 27 27 0 0 0 0 0 0 syscon pf PF_IEEE802154 36 36 0 0 0 0 0 0 syscon pf PF_IRDA 23 23 0 0 0 0 0 0 syscon pf PF_IUCV 0x20 0x20 0 0 0 0 0 0 syscon pf PF_KCM 41 41 0 0 0 0 0 0 syscon pf PF_LLC 26 26 0 0 0 0 0 0 syscon pf PF_NETBEUI 13 13 0 0 0 0 0 0 syscon pf PF_NETLINK 0x10 0x10 0 0 0 0 0 0 syscon pf PF_NETROM 6 6 0 0 0 0 0 0 syscon pf PF_NFC 39 39 0 0 0 0 0 0 syscon pf PF_PACKET 17 17 0 0 0 0 0 0 syscon pf PF_PHONET 35 35 0 0 0 0 0 0 syscon pf PF_PPPOX 24 24 0 0 0 0 0 0 syscon pf PF_RDS 21 21 0 0 0 0 0 0 syscon pf PF_ROSE 11 11 0 0 0 0 0 0 syscon pf PF_RXRPC 33 33 0 0 0 0 0 0 syscon pf PF_SECURITY 14 14 0 0 0 0 0 0 syscon pf PF_TIPC 30 30 0 0 0 0 0 0 syscon pf PF_VSOCK 40 40 0 0 0 0 0 0 syscon pf PF_WANPIPE 25 25 0 0 0 0 0 0 syscon pf PF_X25 9 9 0 0 0 0 0 0 # getdents() constants # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon dt DT_UNKNOWN 0 0 0 0 0 0 0 0 # consensus syscon dt DT_FIFO 1 1 1 1 1 1 1 1 # unix consensus & faked nt syscon dt DT_CHR 2 2 2 2 2 2 2 2 # unix consensus & faked nt syscon dt DT_DIR 4 4 4 4 4 4 4 4 # unix consensus & faked nt syscon dt DT_BLK 6 6 6 6 6 6 6 6 # unix consensus & faked nt syscon dt DT_REG 8 8 8 8 8 8 8 8 # unix consensus & faked nt syscon dt DT_LNK 10 10 10 10 10 10 10 10 # unix consensus & faked nt syscon dt DT_SOCK 12 12 12 12 12 12 12 12 # unix consensus & faked nt # msync() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ms MS_SYNC 4 4 16 16 0 2 4 4 # faked nt syscon ms MS_ASYNC 1 1 1 1 1 1 1 1 # consensus (faked nt) syscon ms MS_INVALIDATE 2 2 2 2 2 4 2 0 # statfs() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon statfs ST_RDONLY 1 1 1 1 1 1 1 0x00080000 # MNT_RDONLY on BSD, kNtFileReadOnlyVolume on NT syscon statfs ST_NOSUID 2 2 8 8 8 8 8 0 # MNT_NOSUID on BSD syscon statfs ST_NODEV 4 4 16 16 0 16 16 0 # MNT_NODEV on BSD syscon statfs ST_NOEXEC 8 8 4 4 4 4 4 0 # MNT_NOEXEC on BSD syscon statfs ST_SYNCHRONOUS 16 16 2 2 2 2 2 0 # MNT_SYNCHRONOUS on BSD syscon statfs ST_NOATIME 0x0040 0x0040 0x10000000 0x10000000 0x10000000 0x00008000 0x04000000 0 # MNT_NOATIME on BSD syscon statfs ST_RELATIME 0x1000 0x1000 0 0 0 0 0x00020000 0 # MNT_RELATIME on NetBSD syscon statfs ST_APPEND 0x0100 0x0100 0 0 0 0 0 0 # syscon statfs ST_IMMUTABLE 0x0200 0x0200 0 0 0 0 0 0 # syscon statfs ST_MANDLOCK 0x0040 0x0040 0 0 0 0 0 0 # syscon statfs ST_NODIRATIME 0x0800 0x0800 0 0 0 0 0 0 # syscon statfs ST_WRITE 0x0080 0x0080 0 0 0 0 0 0 # # sendfile() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sf SF_NODISKIO 0 0 0 0 1 0 0 0 syscon sf SF_MNOWAIT 0 0 0 0 2 0 0 0 syscon sf SF_SYNC 0 0 0 0 4 0 0 0 # mount() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mount MS_RDONLY 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 # consensus; MNT_RDONLY on bsd; faked nt syscon mount MNT_RDONLY 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 # consensus; MS_RDONLY on linux; faked nt syscon mount MS_NOSUID 0x00000002 0x00000002 0x00000008 0x00000008 0x00000008 0x00000008 0x00000008 0x00000001 # don't honor S_ISUID bit; bsd consensus; MNT_NOSUID on bsd; faked nt syscon mount MNT_NOSUID 0 0 0x00000008 0x00000008 0x00000008 0x00000008 0x00000008 0x00000001 # don't honor S_ISUID bit; bsd consensus; appears incorrectly defined in linux headers; MS_NOSUID on linux; faked nt syscon mount MS_NODEV 0x00000004 0x00000004 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 0x00000004 # disallow special files; bsd consensus; MNT_NODEV on bsd; faked nt syscon mount MNT_NODEV 0x00000004 0x00000004 0x00000010 0x00000010 0x00000010 0x00000010 0x00000010 0x00000004 # disallow special files; bsd consensus; MS_NODEV on linux; faked nt syscon mount MS_NOEXEC 0x00000008 0x00000008 0x00000004 0x00000004 0x00000004 0x00000004 0x00000004 0x00000008 # disallow program execution; bsd consensus; MNT_NOEXEC on bsd; faked nt syscon mount MNT_NOEXEC 0x00000008 0x00000008 0x00000004 0x00000004 0x00000004 0x00000004 0x00000004 0x00000008 # disallow program execution; bsd consensus; MS_NOEXEC on linux; faked nt syscon mount MS_SYNCHRONOUS 0x00000010 0x00000010 0x00000002 0x00000002 0x00000002 0x00000002 0x00000002 0x00000010 # bsd consensus; MNT_SYNCHRONOUS on bsd; faked nt syscon mount MNT_SYNCHRONOUS 0x00000010 0x00000010 0x00000002 0x00000002 0x00000002 0x00000002 0x00000002 0x00000010 # bsd consensus; MS_SYNCHRONOUS on linux; faked nt syscon mount MS_REMOUNT 0x00000020 0x00000020 0x00010000 0x00010000 0x00010000 0x00010000 0x00010000 0x00000020 # tune existing mounting; bsd consensus; MNT_UPDATE on bsd; faked nt syscon mount MNT_UPDATE 0x00000020 0x00000020 0x00010000 0x00010000 0x00010000 0x00010000 0x00010000 0x00000020 # tune existing mounting; bsd consensus; MS_REMOUNT on linux; faked nt syscon mount MS_MANDLOCK 0x00000040 0x00000040 0 0 0 0 0 0 # syscon mount MS_DIRSYNC 0x00000080 0x00000080 0 0 0 0 0 0 # syscon mount MS_NOATIME 0x00000400 0x00000400 0x10000000 0x10000000 0x10000000 0x00008000 0x04000000 0x00000400 # do not update access times; MNT_NOATIME on bsd syscon mount MNT_NOATIME 0x00000400 0x00000400 0x10000000 0x10000000 0x10000000 0x00008000 0x04000000 0x00000400 # do not update access times; MS_NOATIME on linux syscon mount MS_NODIRATIME 0x00000800 0x00000800 0 0 0 0 0 0 # syscon mount MS_BIND 0x00001000 0x00001000 0 0 0 0 0 0 # syscon mount MS_MOVE 0x00002000 0x00002000 0 0 0 0 0 0 # syscon mount MS_REC 0x00004000 0x00004000 0 0 0 0 0 0 # syscon mount MS_SILENT 0x00008000 0x00008000 0 0 0 0 0 0 # syscon mount MS_POSIXACL 0x00010000 0x00010000 0 0 0 0 0 0 # syscon mount MS_UNBINDABLE 0x00020000 0x00020000 0 0 0 0 0 0 # syscon mount MS_PRIVATE 0x00040000 0x00040000 0 0 0 0 0 0 # syscon mount MS_SLAVE 0x00080000 0x00080000 0 0 0 0 0 0 # syscon mount MS_SHARED 0x00100000 0x00100000 0 0 0 0 0 0 # syscon mount MS_RELATIME 0x00200000 0x00200000 0 0 0 0 0x00020000 0 # MNT_RELATIME on bsd syscon mount MNT_RELATIME 0x00200000 0x00200000 0 0 0 0 0x00020000 0 # MS_RELATIME on linux syscon mount MS_KERNMOUNT 0x00400000 0x00400000 0 0 0 0 0 0 # syscon mount MS_I_VERSION 0x00800000 0x00800000 0 0 0 0 0 0 # syscon mount MS_STRICTATIME 0x01000000 0x01000000 0x80000000 0x80000000 0 0 0 0 # enable strict update of file access time; MNT_STRICTATIME on bsd syscon mount MNT_STRICTATIME 0x01000000 0x01000000 0x80000000 0x80000000 0 0 0 0 # enable strict update of file access time; MS_STRICTATIME on linux syscon mount MS_LAZYTIME 0x02000000 0x02000000 0 0 0 0 0 0 # syscon mount MS_ACTIVE 0x40000000 0x40000000 0 0 0 0 0 0 # syscon mount MS_NOUSER 0x80000000 0x80000000 0 0 0 0 0 0 # syscon mount MS_RMT_MASK 0x02800051 0x02800051 0 0 0 0 0 0 # syscon mount MS_MGC_VAL 0xc0ed0000 0xc0ed0000 0 0 0 0 0 0 # Linux 2.3 syscon mount MS_MGC_MSK 0xffff0000 0xffff0000 0 0 0 0 0 0 # Linux 2.3 syscon mount MNT_ASYNC 0 0 0x00000040 0x00000040 0x00000040 0x00000040 0x00000040 0 # file system written asynchronously; bsd consensus syscon mount MNT_RELOAD 0 0 0x00040000 0x00040000 0x00040000 0x00040000 0x00040000 0 # reload filesystem data; bsd consensus syscon mount MNT_SUIDDIR 0 0 0 0 0x00100000 0 0 0 # special suid dir handling syscon mount MNT_NOCLUSTERR 0 0 0 0 0x40000000 0 0 0 # disable cluster read syscon mount MNT_NOCLUSTERW 0 0 0 0 0x80000000 0 0 0 # disable cluster write syscon mount MNT_SNAPSHOT 0 0 0x40000000 0x40000000 0x01000000 0 0 0 # confusing # limits # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon limits PIPE_BUF 4096 4096 512 512 512 512 512 4096 # bsd consensus syscon limits NGROUPS_MAX 65536 65536 16 16 1023 16 16 0 # syscon limits LINK_MAX 127 127 32767 32767 32767 32767 32767 64 # freebsd/windows are educated guesses syscon limits MAX_CANON 255 255 1024 1024 255 255 255 255 # windows is guessed syscon limits MAX_INPUT 255 255 1024 1024 255 255 255 255 # windows is guessed syscon limits SOMAXCONN 4096 4096 128 128 128 128 128 2147483647 # maximum backlog for listen() syscon limits _ARG_MAX 128*1024 128*1024 1024*1024 1024*1024 512*1024 512*1024 256*1024 32767*2 # bsd consensus syscon limits _NAME_MAX 255 255 255 255 255 255 511 255 # probably higher on windows? syscon limits _PATH_MAX 4096 4096 1024 1024 1024 1024 1024 512 # cosmopolitan libc imposes a lower 512 limit; nt theoretically goes up to 32767 syscon limits _NSIG 64 64 32 32 128 32 64 64 # _SIG_MAXSIG on FreeBSD # unmount() flags # a.k.a. umount2() on linux # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon unmount MNT_FORCE 1 1 0x00080000 0x00080000 0x00080000 0x00080000 0x00080000 2 # force unmount or readonly syscon unmount MNT_DETACH 2 2 0 0 0 0 0 0 # just detach from the tree syscon unmount MNT_EXPIRE 4 4 0 0 0 0 0 0 # mark for expiry syscon unmount UMOUNT_NOFOLLOW 8 8 0 0 0 0 0 0 # don't follow symlinks on unmount syscon unmount MNT_BYFSID 0 0 0 0 0x08000000 0 0 0 # if used pass "FSID:val0:val1", where val0 and val1 are the contents of the fsid_t val[] array in decimal # reboot() magnums # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon reboot RB_AUTOBOOT 0x01234567 0x01234567 0 0 0 0 0 4 # reboots; SHUTDOWN_RESTART on NT syscon reboot RB_POWER_OFF 0x4321fedc 0x4321fedc 0xffffffff 0xffffffff 0x4000 0x1000 0x808 8 # SHUTDOWN_POWEROFF on NT syscon reboot RB_POWERDOWN 0x4321fedc 0x4321fedc 0xffffffff 0xffffffff 0x4000 0x1000 0x808 8 # openbsd/netbsd name syscon reboot RB_POWEROFF 0x4321fedc 0x4321fedc 0xffffffff 0xffffffff 0x4000 0x1000 0x808 8 # freebsd name syscon reboot RB_HALT_SYSTEM 0xcdef0123 0xcdef0123 8 8 8 8 8 16 # the processor is simply halted; SHUTDOWN_NOREBOOT on NT syscon reboot RB_HALT 0xcdef0123 0xcdef0123 8 8 8 8 8 16 # the processor is simply halted; bsd name syscon reboot RB_SW_SUSPEND 0xd000fce2 0xd000fce2 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xd000fce2 # syscon reboot RB_KEXEC 0x45584543 0x45584543 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # syscon reboot RB_ENABLE_CAD 0x89abcdef 0x89abcdef 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # enable control-alt-delete reboot syscon reboot RB_DISABLE_CAD 0 0 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # make control-alt-delete just eintr syscon reboot RB_NOSYNC 0x20000000 0x20000000 4 4 4 4 4 0x20000000 # prevents implicit sync() beforehand; polyfilled linux; polyfilled on nt just in case # send() / recv() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon msg MSG_OOB 1 1 1 1 1 1 1 1 # consensus syscon msg MSG_PEEK 2 2 2 2 2 2 2 2 # consensus syscon msg MSG_DONTROUTE 4 4 4 4 4 4 4 4 # consensus syscon msg MSG_FASTOPEN 0x20000000 0x20000000 0 0 0 0 0 0 # TODO syscon msg MSG_WAITALL 0x0100 0x0100 0x40 0x40 0x40 0x40 0x40 8 # bsd consensus syscon msg MSG_MORE 0x8000 0x8000 0 0 0 0 0 0 # send/sendto: manual TCP_CORK hbasically syscon msg MSG_NOSIGNAL 0x4000 0x4000 0x80000 0x80000 0x020000 0x0400 0x0400 0 # send/sendto: don't SIGPIPE on EOF syscon msg MSG_DONTWAIT 0x40 0x40 0x80 0x80 0x80 0x80 0x80 0 # send/sendto: manual non-blocking syscon msg MSG_TRUNC 0x20 0x20 0x10 0x10 0x10 0x10 0x10 0x0100 # bsd consensus syscon msg MSG_CTRUNC 8 8 0x20 0x20 0x20 0x20 0x20 0x0200 # bsd consensus syscon msg MSG_ERRQUEUE 0x2000 0x2000 0 0 0 0 0 0x1000 # bsd consensus syscon msg MSG_NOERROR 0x1000 0x1000 0x1000 0x1000 0x1000 0x1000 0x1000 0 # unix consensus syscon msg MSG_EOR 0x80 0x80 8 8 8 8 8 0 # bsd consensus syscon msg MSG_CMSG_CLOEXEC 0x40000000 0x40000000 0 0 0x040000 0x0800 0x0800 0 syscon msg MSG_WAITFORONE 0x010000 0x010000 0 0 0x080000 0 0x2000 0 syscon msg MSG_BATCH 0x040000 0x040000 0 0 0 0 0 0 syscon msg MSG_CONFIRM 0x0800 0x0800 0 0 0 0 0 0 syscon msg MSG_EXCEPT 0x2000 0x2000 0 0 0 0 0 0 syscon msg MSG_FIN 0x0200 0x0200 0x0100 0x0100 0x0100 0 0 0 syscon msg MSG_EOF 0x0200 0x0200 0x0100 0x0100 0x0100 0 0 0 syscon msg MSG_INFO 12 12 0 0 0 0 0 0 syscon msg MSG_PARITY_ERROR 9 9 0 0 0 0 0 0 syscon msg MSG_PROXY 0x10 0x10 0 0 0 0 0 0 syscon msg MSG_RST 0x1000 0x1000 0 0 0 0 0 0 syscon msg MSG_STAT 11 11 0 0 0 0 0 0 syscon msg MSG_SYN 0x0400 0x0400 0 0 0 0 0 0 syscon msg MSG_BCAST 0 0 0 0 0 0x100 0x100 0 syscon msg MSG_MCAST 0 0 0 0 0 0x200 0x200 0 syscon msg MSG_NOTIFICATION 0x8000 0x8000 0 0 0x2000 0 0x4000 0 # getpriority() / setpriority() magnums (a.k.a. nice) # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon prio PRIO_PROCESS 0 0 0 0 0 0 0 0 # consensus / poly nt syscon prio PRIO_PGRP 1 1 1 1 1 1 1 1 # unix consensus / poly nt syscon prio PRIO_USER 2 2 2 2 2 2 2 2 # unix consensus / poly nt syscon prio PRIO_MIN -20 -20 -20 -20 -20 -20 -20 -20 # unix consensus / poly nt syscon prio PRIO_MAX 20 20 20 20 20 20 20 20 # unix consensus / poly nt # getrusage() who # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon rusage RUSAGE_SELF 0 0 0 0 0 0 0 0 # unix consensus & faked nt syscon rusage RUSAGE_THREAD 1 1 99 99 1 1 1 1 # faked nt & unavailable on xnu syscon rusage RUSAGE_CHILDREN -1 -1 -1 -1 -1 -1 -1 99 # unix consensus & unavailable on nt syscon rusage RUSAGE_BOTH -2 -2 99 99 99 99 99 99 # woop # fast userspace mutexes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon futex FUTEX_WAIT 0 0 0 0 0 1 0 0 syscon futex FUTEX_WAKE 1 1 0 0 1 2 1 1 syscon futex FUTEX_REQUEUE 3 3 0 0 0 3 0 0 syscon futex FUTEX_PRIVATE_FLAG 128 128 0 0 128 128 0 0 # lio_listio() magnums # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon lio LIO_WRITE 127 127 2 2 1 127 1 127 syscon lio LIO_NOWAIT 127 127 1 1 0 127 0 127 syscon lio LIO_READ 127 127 1 1 2 127 2 127 syscon lio LIO_WAIT 127 127 2 2 1 127 1 127 syscon lio LIO_NOP 127 127 0 0 0 127 0 127 # posix scheduling # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sched SCHED_OTHER 0 0 127 127 2 127 0 127 # standard round-robin time-sharing policy syscon sched SCHED_FIFO 1 1 127 127 1 127 1 127 # [real-time] first-in, first-out policy syscon sched SCHED_RR 2 2 127 127 3 127 2 127 # [real-time] round-robin policy syscon sched SCHED_BATCH 3 3 127 127 2 127 0 127 # for "batch" style execution of processes; polyfilled as SCHED_OTHER on non-Linux syscon sched SCHED_IDLE 5 5 127 127 2 127 0 127 # for running very low priority background jobs; polyfilled as SCHED_OTHER on non-Linux syscon sched SCHED_DEADLINE 6 6 127 127 127 127 127 127 # can only be set by sched_setattr() syscon sched SCHED_RESET_ON_FORK 0x40000000 0x40000000 0 0 0 0 0 0 # Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork(); no-op on non-Linux # Teletypewriter Control, e.g. # # TCSETS → About 70,800 results (0.31 seconds) # = TCSETNOW → About 47,700 results (0.31 seconds) # ≈ TCSETA → About 12,600 results (0.32 seconds) # = TIOCSETA → About 3,110 results (0.41 seconds) # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon termios TCGETS 0x5401 0x5401 0x40487413 0x40487413 0x402c7413 0x402c7413 0x402c7413 0 # Gets console settings; tcgetattr(tty, argp) → ioctl(tty, TCGETS, struct termios *argp); polyfilled NT syscon compat TIOCGETA 0x5401 0x5401 0x40487413 0x40487413 0x402c7413 0x402c7413 0x402c7413 0 # Gets console settings; = tcgetattr(tty, struct termios *argp) #syscon compat TCGETA 0x5405 0x5405 0 0 0 0 0 0 # Gets console settings; ≈ ioctl(fd, TCGETA, struct termio *argp) syscon termios TCSANOW 0 0 0 0 0 0 0 0 # Sets console settings; tcsetattr(fd, TCSANOW, argp); polyfilled NT syscon termios TCSETS 0x5402 0x5402 0x80487414 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; = ioctl(tty, TCSETS, const struct termios *argp); polyfilled NT syscon compat TIOCSETA 0x5402 0x5402 0x80487414 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; = ioctl(tty, TIOCSETA, const struct termios *argp); polyfilled NT #syscon compat TCSETA 0x5402 0x5402 0x80487414 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; ≈ ioctl(tty, TCSETA, const struct termio *argp); polyfilled NT syscon termios TCSADRAIN 1 1 1 1 1 1 1 1 # Drains output & sets console settings; tcsetawttr(fd, TCSADRAIN, argp); polyfilled NT syscon termios TCSETSW 0x5403 0x5403 0x80487415 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; = ioctl(tty, TCSETSW, const struct termios *argp); polyfilled NT syscon compat TIOCSETAW 0x5403 0x5403 0x80487415 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; = ioctl(tty, TIOCSETAW, const struct termios *argp); polyfilled NT #syscon compat TCSETAW 0x5403 0x5403 0x80487415 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; ≈ ioctl(tty, TCSETAW, const struct termio *argp); polyfilled NT syscon termios TCSAFLUSH 2 2 2 2 2 2 2 2 # Drops input & drains output & sets console settings; tcsetafttr(fd, TCSAFLUSH, argp); polyfilled NT syscon termios TCSETSF 0x5404 0x5404 0x80487416 0x80487416 0x802c7416 0x802c7416 0x802c7416 0x5404 # Drops input & drains output & sets console settings; = ioctl(tty, TCSETSF, const struct termios *argp); polyfilled NT syscon compat TIOCSETAF 0x5404 0x5404 0x80487416 0x80487416 0x802c7416 0x802c7416 0x802c7416 0x5402 # Drops input & drains output & sets console settings; = ioctl(tty, TIOCSETAF, const struct termios *argp); polyfilled NT #syscon compat TCSETAF 0x5404 0x5404 0x80487416 0x80487416 0x802c7416 0x802c7416 0x802c7416 0x5402 # Drops input & drains output & sets console settings; ≈ ioctl(tty, TCSETAF, const struct termio *argp); polyfilled NT syscon termios TIOCGWINSZ 0x5413 0x5413 1074295912 1074295912 1074295912 1074295912 1074295912 0x5413 # ioctl(tty, TIOCGWINSZ, struct winsize *argp); polyfilled NT syscon termios TIOCSWINSZ 0x5414 0x5414 0x80087467 0x80087467 0x80087467 0x80087467 0x80087467 0x5414 # ioctl(tty, TIOCSWINSZ, const struct winsize *argp) (faked NT) syscon termios TIOCINQ 0x541b 0x541b 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f # [Linuxism] same as FIONREAD syscon termios TIOCOUTQ 0x5411 0x5411 0x40047473 0x40047473 0x40047473 0x40047473 0x40047473 0 # get # bytes queued in TTY's output buffer ioctl(tty, TIOCSWINSZ, const struct winsize *argp) syscon termios TIOCGPGRP 0x540f 0x540f 0x40047477 0x40047477 0x40047477 0x40047477 0x40047477 0 # tcgetpgrp(): get pgrp of tty syscon termios TIOCSPGRP 0x5410 0x5410 0x80047476 0x80047476 0x80047476 0x80047476 0x80047476 0 # tcsetpgrp(): set pgrp of tty syscon termios TIOCSBRK 0x5427 0x5427 0x2000747b 0x2000747b 0x2000747b 0x2000747b 0x2000747b 0 # set break bit syscon termios TIOCCBRK 0x5428 0x5428 0x2000747a 0x2000747a 0x2000747a 0x2000747a 0x2000747a 0 # boop syscon termios TIOCCONS 0x541d 0x541d 0x80047462 0x80047462 0x80047462 0x80047462 0x80047462 0 # boop syscon termios TIOCGETD 0x5424 0x5424 0x4004741a 0x4004741a 0x4004741a 0x4004741a 0x4004741a 0 # boop syscon termios TIOCNOTTY 0x5422 0x5422 0x20007471 0x20007471 0x20007471 0x20007471 0x20007471 0 # boop syscon termios TIOCNXCL 0x540d 0x540d 0x2000740e 0x2000740e 0x2000740e 0x2000740e 0x2000740e 0 # boop syscon termios TIOCSCTTY 0x540e 0x540e 0x20007461 0x20007461 0x20007461 0x20007461 0x20007461 0 # makes terminal controlling terminal of calling process (see login_tty) syscon termios TIOCSETD 0x5423 0x5423 0x8004741b 0x8004741b 0x8004741b 0x8004741b 0x8004741b 0 # boop syscon termios TIOCSIG 0x40045436 0x40045436 0x2000745f 0x2000745f 0x2004745f 0x8004745f 0x8004745f 0 # boop syscon termios TIOCSTI 0x5412 0x5412 0x80017472 0x80017472 0x80017472 0 0 0 # boop syscon termios TIOCGSID 0x5429 0x5429 0x40047463 0x40047463 0x40047463 0x40047463 0x40047463 0 # boop syscon termios TABLDISC 0 0 0x3 0x3 0 0x3 0x3 0 # boop syscon termios SLIPDISC 0 0 0x4 0x4 0x4 0x4 0x4 0 # boop syscon termios PPPDISC 0 0 0x5 0x5 0x5 0x5 0x5 0 # boop syscon termios TCSBRK 0x5409 0x5409 0x2000745e 0x2000745e 0x2000745e 0x2000745e 0x2000745e 0 # TIOCDRAIN on BSD; TIOCDRAIN on BSD syscon termios TIOCSTAT 0 0 0x20007465 0x20007465 0x20007465 0x20007465 0x20007465 0 # boop syscon termios TIOCSTART 0 0 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0 # boop syscon termios TIOCCDTR 0 0 0x20007478 0x20007478 0x20007478 0x20007478 0x20007478 0 # clear data terminal ready syscon termios TIOCSDTR 0 0 0x20007479 0x20007479 0x20007479 0x20007479 0x20007479 0 # boop syscon termios TIOCEXT 0 0 0x80047460 0x80047460 0x80047460 0x80047460 0x80047460 0 # boop syscon termios TIOCGDRAINWAIT 0 0 0x40047456 0x40047456 0x40047456 0 0 0 # boop syscon termios TIOCTIMESTAMP 0 0 0x40107459 0x40107459 0x40107459 0 0 0 # boop syscon termios TIOCSDRAINWAIT 0 0 0x80047457 0x80047457 0x80047457 0 0 0 # boop syscon termios TIOCREMOTE 0 0 0x80047469 0x80047469 0 0x80047469 0x80047469 0 # boop syscon termios TTYDISC 0 0 0 0 0 0 0 0 # boop syscon termios TIOCFLAG_SOFTCAR 0 0 0 0 0 0x1 0x1 0 # boop syscon termios TIOCFLAG_PPS 0 0 0 0 0 0x10 0x10 0 # boop syscon termios TIOCFLAG_CLOCAL 0 0 0 0 0 0x2 0x2 0 # boop syscon termios TIOCCHKVERAUTH 0 0 0 0 0 0x2000741e 0x2000741e 0 # boop syscon termios TIOCGFLAGS 0 0 0 0 0 0x4004745d 0x4004745d 0 # boop syscon termios TIOCGTSTAMP 0 0 0 0 0 0x4010745b 0x4010745b 0 # boop syscon termios STRIPDISC 0 0 0 0 0 0x6 0x6 0 # boop syscon termios NMEADISC 0 0 0 0 0 0x7 0x7 0 # boop syscon termios TIOCUCNTL_CBRK 0 0 0 0 0 0x7a 0x7a 0 # boop syscon termios TIOCFLAG_MDMBUF 0 0 0 0 0 0x8 0x8 0 # boop syscon termios TIOCSETVERAUTH 0 0 0 0 0 0x8004741c 0x8004741c 0 # boop syscon termios TIOCSFLAGS 0 0 0 0 0 0x8004745c 0x8004745c 0 # boop syscon termios TIOCSTSTAMP 0 0 0 0 0 0x8008745a 0x8008745a 0 # boop syscon termios ENDRUNDISC 0 0 0 0 0 0x9 0x9 0 # boop syscon termios TIOCPTMASTER 0 0 0 0 0x2000741c 0 0 0 # boop syscon termios TIOCPTYGRANT 0 0 0x20007454 0x20007454 0 0 0 0 # xnu grantpt() syscon termios TIOCPTYUNLK 0 0 0x20007452 0x20007452 0 0 0 0 # xnu unlockpt() syscon termios TIOCPTYGNAME 0 0 0x40807453 0x40807453 0 0 0 0 # xnu ptyname() syscon termios TIOCPTSNAME 0 0 0 0 0 0 0x48087448 0 # netbsd ptyname() syscon termios FIODGNAME 0 0 0 0 0x80106678 0 0 0 # freebsd ptsname_r() syscon termios NETGRAPHDISC 0 0 0 0 0x6 0 0 0 # boop syscon termios H4DISC 0 0 0 0 0x7 0 0 0 # boop # Teletypewriter Control Modes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon termios CS5 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0b0000000000000000 0b0000000000000000 0b0000000000000000 # termios.c_cflag; consensus syscon termios CS6 0b0000000000010000 0b0000000000010000 0b000000000100000000 0b000000000100000000 0b000000000100000000 0b0000000100000000 0b0000000100000000 0b0000000000010000 # termios.c_cflag; 6-bit characters syscon termios CS7 0b0000000000100000 0b0000000000100000 0b000000001000000000 0b000000001000000000 0b000000001000000000 0b0000001000000000 0b0000001000000000 0b0000000000100000 # termios.c_cflag; 7-bit characters syscon termios CS8 0b0000000000110000 0b0000000000110000 0b000000001100000000 0b000000001100000000 0b000000001100000000 0b0000001100000000 0b0000001100000000 0b0000000000110000 # termios.c_cflag; 8-bit characters syscon termios CSIZE 0b0000000000110000 0b0000000000110000 0b000000001100000000 0b000000001100000000 0b000000001100000000 0b0000001100000000 0b0000001100000000 0b0000000000110000 # termios.c_cflag; mask for CS𝑥 flags syscon termios CSTOPB 0b0000000001000000 0b0000000001000000 0b000000010000000000 0b000000010000000000 0b000000010000000000 0b0000010000000000 0b0000010000000000 0b0000000001000000 # termios.c_cflag; bsd consensus syscon termios CREAD 0b0000000010000000 0b0000000010000000 0b000000100000000000 0b000000100000000000 0b000000100000000000 0b0000100000000000 0b0000100000000000 0b0000000010000000 # termios.c_cflag; bsd consensus syscon termios PARENB 0b0000000100000000 0b0000000100000000 0b000001000000000000 0b000001000000000000 0b000001000000000000 0b0001000000000000 0b0001000000000000 0b0000000100000000 # termios.c_cflag syscon termios PARODD 0b0000001000000000 0b0000001000000000 0b000010000000000000 0b000010000000000000 0b000010000000000000 0b0010000000000000 0b0010000000000000 0b0000001000000000 # termios.c_cflag syscon termios HUPCL 0b0000010000000000 0b0000010000000000 0b000100000000000000 0b000100000000000000 0b000100000000000000 0b0100000000000000 0b0100000000000000 0b0000010000000000 # termios.c_cflag; bsd consensus syscon termios CLOCAL 0b0000100000000000 0b0000100000000000 0b1000000000000000 0b1000000000000000 0b1000000000000000 0b1000000000000000 0b1000000000000000 0b0000100000000000 # termios.c_cflag; consensus # Teletypewriter Local Modes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon termios ISIG 0b0000000000000001 0b0000000000000001 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000000000001 # termios.c_lflag|=ISIG makes Ctrl-C, Ctrl-\, etc. generate signals syscon termios ICANON 0b0000000000000010 0b0000000000000010 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000000000010 # termios.c_lflag&=~ICANON disables 1960's version of gnu readline (see also VMIN) syscon termios XCASE 0b0000000000000100 0b0000000000000100 0 0 0 16777216 0 0b0000000000000100 # termios.c_lflag syscon termios ECHO 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # termios.c_lflag&=~ECHO is for passwords and raw mode syscon termios ECHOE 0b0000000000010000 0b0000000000010000 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000010000 # termios.c_lflag syscon termios ECHOK 0b0000000000100000 0b0000000000100000 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000100000 # termios.c_lflag syscon termios ECHONL 0b0000000001000000 0b0000000001000000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000001000000 # termios.c_lflag syscon termios NOFLSH 0b0000000010000000 0b0000000010000000 2147483648 2147483648 2147483648 2147483648 2147483648 0b0000000010000000 # termios.c_lflag|=NOFLSH means don't flush on INT/QUIT/SUSP syscon termios TOSTOP 0b0000000100000000 0b0000000100000000 4194304 4194304 4194304 4194304 4194304 0b0000000100000000 # termios.c_lflag|=TOSTOP raises SIGTTOU to process group if background job tries to write to controlling terminal syscon termios ECHOCTL 0b0000001000000000 0b0000001000000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000001000000000 # termios.c_lflag|=ECHOCTL prints ^𝑥 codes for monotonic motion syscon termios ECHOPRT 0b0000010000000000 0b0000010000000000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000010000000000 # termios.c_lflag|=ECHOPRT includes the parity bit syscon termios ECHOKE 0b0000100000000000 0b0000100000000000 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000100000000000 # termios.c_lflag syscon termios FLUSHO 0b0001000000000000 0b0001000000000000 8388608 8388608 8388608 8388608 8388608 0b0001000000000000 # termios.c_lflag syscon termios PENDIN 0b0100000000000000 0b0100000000000000 536870912 536870912 536870912 536870912 536870912 0b0100000000000000 # termios.c_lflag syscon termios IEXTEN 0b1000000000000000 0b1000000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b1000000000000000 # termios.c_lflag&=~IEXTEN disables platform input processing magic syscon termios EXTPROC 65536 65536 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 65536 # termios.c_lflag # Teletypewriter Input Modes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon termios IGNBRK 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_iflag it's complicated, uart only? UNIXCONSENSUS syscon termios BRKINT 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 # termios.c_iflag it's complicated, uart only? UNIXCONSENSUS syscon termios IGNPAR 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 # termios.c_iflag|=IGNPAR ignores parity and framing errors; see PARMRK UNIXCONSENSUS syscon termios PARMRK 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # termios.c_iflag|=PARMRK passes-through parity bit UNIXCONSENSUS syscon termios INPCK 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 # termios.c_iflag|=INPCK enables parity checking UNIXCONSENSUS syscon termios ISTRIP 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 # termios.c_iflag|=ISTRIP automates read(1)&0x7f UNIXCONSENSUS syscon termios INLCR 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # termios.c_iflag|=INLCR maps \n → \r input UNIXCONSENSUS syscon termios IGNCR 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # termios.c_iflag|=IGNCR maps \r → ∅ input UNIXCONSENSUS syscon termios ICRNL 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # termios.c_iflag|=ICRNL maps \r → \n input UNIXCONSENSUS syscon termios IUCLC 0b0000001000000000 0b0000001000000000 0 0 0 0b0001000000000000 0 0b0000001000000000 # termios.c_iflag|=IUCLC maps A-Z → a-z input syscon termios IXON 0b0000010000000000 0b0000010000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000010000000000 # termios.c_iflag|=IXON enables flow rida syscon termios IXANY 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 # termios.c_iflag|=IXANY typing will un-stuck teletype UNIXCONSENSUS syscon termios IXOFF 0b0001000000000000 0b0001000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0001000000000000 # termios.c_iflag|=IXOFF disables annoying display freeze keys syscon termios IMAXBEL 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 # termios.c_iflag|=IMAXBEL rings when queue full UNIXCONSENSUS syscon termios IUTF8 0b0100000000000000 0b0100000000000000 0b0100000000000000 0b0100000000000000 0 0 0 0b0100000000000000 # termios.c_iflag|=IUTF8 helps w/ rubout on UTF-8 input # Teletypewriter Output Modes # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon termios OPOST 0b0000000000000001 0b0000000000000001 0b000000000000000001 0b000000000000000001 0b000000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_oflag&=~OPOST disables output processing magic, e.g. MULTICS newlines syscon termios OLCUC 0b0000000000000010 0b0000000000000010 0 0 0 0b0000000000100000 0 0b0000000000000010 # termios.c_oflag|=OLCUC maps a-z → A-Z output (SHOUTING) syscon termios ONLCR 0b0000000000000100 0b0000000000000100 0b000000000000000010 0b000000000000000010 0b000000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000100 # termios.c_oflag|=ONLCR map \n → \r\n output (MULTICS newline) and requires OPOST syscon termios OCRNL 0b0000000000001000 0b0000000000001000 0b000000000000010000 0b000000000000010000 0b000000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000001000 # termios.c_oflag|=OCRNL maps \r → \n output syscon termios ONOCR 0b0000000000010000 0b0000000000010000 0b000000000000100000 0b000000000000100000 0b000000000000100000 0b0000000001000000 0b0000000001000000 0b0000000000010000 # termios.c_oflag|=ONOCR maps \r → ∅ output iff column 0 syscon termios ONLRET 0b0000000000100000 0b0000000000100000 0b000000000001000000 0b000000000001000000 0b000000000001000000 0b0000000010000000 0b0000000010000000 0b0000000000100000 # termios.c_oflag|=ONLRET maps \r → ∅ output syscon termios OFILL 0b0000000001000000 0b0000000001000000 0b000000000010000000 0b000000000010000000 0 0 0 0b0000000001000000 # termios.c_oflag syscon termios OFDEL 0b0000000010000000 0b0000000010000000 0b100000000000000000 0b100000000000000000 0 0 0 0b0000000010000000 # termios.c_oflag syscon termios NLDLY 0b0000000100000000 0b0000000100000000 0b000000001100000000 0b000000001100000000 0b000000001100000000 0 0 0b0000000100000000 # (termios.c_oflag & NLDLY) ∈ {NL0,NL1,NL2,NL3} syscon termios NL0 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0 0b000000000000000000 0b0000000000000000 # (termios.c_oflag & NLDLY) == NL0 syscon termios NL1 0b0000000100000000 0b0000000100000000 0b000000000100000000 0b000000000100000000 0b000000000100000000 0 0b000000000100000000 0b0000000100000000 # (termios.c_oflag & NLDLY) == NL1 syscon termios NL2 0 0 0b000000001000000000 0b000000001000000000 0b000000001000000000 0 0b000000001000000000 0 # (termios.c_oflag & NLDLY) == NL2 syscon termios NL3 0 0 0b000000001100000000 0b000000001100000000 0b000000001100000000 0 0b000000001100000000 0 # (termios.c_oflag & NLDLY) == NL3 syscon termios CRDLY 0b0000011000000000 0b0000011000000000 0b000011000000000000 0b000011000000000000 0b000011000000000000 0 0 0b0000011000000000 # (termios.c_oflag & CRDLY) ∈ {CR0,CR1,CR2,CR3} syscon termios CR0 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0 0b000000000000000000 0b0000000000000000 # (termios.c_oflag & CRDLY) == CR0 syscon termios CR1 0b0000001000000000 0b0000001000000000 0b000001000000000000 0b000001000000000000 0b000001000000000000 0 0b000001000000000000 0b0000001000000000 # (termios.c_oflag & CRDLY) == CR1 syscon termios CR2 0b0000010000000000 0b0000010000000000 0b000010000000000000 0b000010000000000000 0b000010000000000000 0 0b000000010000000000 0b0000010000000000 # (termios.c_oflag & CRDLY) == CR2 syscon termios CR3 0b0000011000000000 0b0000011000000000 0b000011000000000000 0b000011000000000000 0b000011000000000000 0 0b000000011000000000 0b0000011000000000 # (termios.c_oflag & CRDLY) == CR3 syscon termios TABDLY 0b0001100000000000 0b0001100000000000 0b000000110000000100 0b000000110000000100 0b000000000000000100 0 0 0b0001100000000000 # (termios.c_oflag & TABDLY) ∈ {TAB0,TAB1,TAB2,TAB3,XTABS} syscon termios TAB0 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0 0b000000000000000000 0b0000000000000000 # (termios.c_oflag & TABDLY) == TAB0 syscon termios TAB1 0b0000100000000000 0b0000100000000000 0b000000010000000000 0b000000010000000000 0b000000010000000000 0 0b000000010000000000 0b0000100000000000 # (termios.c_oflag & TABDLY) == TAB1 syscon termios TAB2 0b0001000000000000 0b0001000000000000 0b000000100000000000 0b000000100000000000 0b000000100000000000 0 0b000000100000000000 0b0001000000000000 # (termios.c_oflag & TABDLY) == TAB2 syscon termios TAB3 0b0001100000000000 0b0001100000000000 0b000000000000000100 0b000000000000000100 0b000000000000000100 0 0b000000000000000100 0b0001100000000000 # (termios.c_oflag & TABDLY) == TAB3 syscon termios XTABS 0b0001100000000000 0b0001100000000000 0b000000110000000000 0b000000110000000000 0b000000110000000000 0 0b000000110000000000 0b0001100000000000 # (termios.c_oflag & TABDLY) == XTABS syscon termios BSDLY 0b0010000000000000 0b0010000000000000 0b001000000000000000 0b001000000000000000 0b001000000000000000 0 0 0b0010000000000000 # termios.c_oflag syscon termios BS0 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag syscon termios BS1 0b0010000000000000 0b0010000000000000 0b001000000000000000 0b001000000000000000 0b001000000000000000 0 0 0b0010000000000000 # termios.c_oflag syscon termios VTDLY 0b0100000000000000 0b0100000000000000 0b010000000000000000 0b010000000000000000 0b010000000000000000 0 0 0b0100000000000000 # termios.c_oflag syscon termios VT0 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag syscon termios VT1 0b0100000000000000 0b0100000000000000 0b010000000000000000 0b010000000000000000 0b010000000000000000 0 0 0b0100000000000000 # termios.c_oflag syscon termios FFDLY 0b1000000000000000 0b1000000000000000 0b000100000000000000 0b000100000000000000 0b000100000000000000 0 0 0b1000000000000000 # termios.c_oflag syscon termios FF0 0b0000000000000000 0b0000000000000000 0b000000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag syscon termios FF1 0b1000000000000000 0b1000000000000000 0b000100000000000000 0b000100000000000000 0b000100000000000000 0 0 0b1000000000000000 # termios.c_oflag # Teletypewriter Special Control Character Assignments # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon termios VMIN 6+1 6+1 16 16 16 16 16 6 # termios.c_cc[VMIN]=𝑥 in non-canonical mode can be set to 0 for non-blocking reads, 1 for single character raw mode reads, or higher to buffer syscon termios VTIME 5+1 5+1 17 17 17 17 17 5 # termios.c_cc[VTIME]=𝑥 sets non-canonical read timeout to 𝑥×𝟷𝟶𝟶ms which is needed when entering escape sequences manually with the escape key syscon termios NCCS 20 20 20 20 20 20 20 20 # ARRAYLEN(termios.c_cc); we schlep c_line into c_cc on linux syscon termios VINTR 0+1 0+1 8 8 8 8 8 0 # termios.c_cc[VINTR]=𝑥 syscon termios VQUIT 1+1 1+1 9 9 9 9 9 1 # termios.c_cc[VQUIT]=𝑥 syscon termios VERASE 2+1 2+1 3 3 3 3 3 2 # termios.c_cc[VERASE]=𝑥 syscon termios VKILL 3+1 3+1 5 5 5 5 5 3 # termios.c_cc[VKILL]=𝑥 syscon termios VEOF 4+1 4+1 0 0 0 0 0 4 # termios.c_cc[VEOF]=𝑥 syscon termios VSWTC 7+1 7+1 0 0 0 0 0 7 # termios.c_cc[VSWTC]=𝑥 syscon termios VSTART 8+1 8+1 12 12 12 12 12 8 # termios.c_cc[VSTART]=𝑥 syscon termios VSTOP 9+1 9+1 13 13 13 13 13 9 # termios.c_cc[VSTOP]=𝑥 syscon termios VSUSP 10+1 10+1 10 10 10 10 10 10 # termios.c_cc[VSUSP]=𝑥 defines suspend, i.e. Ctrl-Z (a.k.a. →, ^Z, SUB, 26, 032, 0x1A, ord('Z')^0b01000000); unix consensus syscon termios VEOL 11+1 11+1 1 1 1 1 1 11 # termios.c_cc[VEOL]=𝑥 syscon termios VREPRINT 12+1 12+1 6 6 6 6 6 12 # termios.c_cc[VREPRINT]=𝑥 syscon termios VDISCARD 13+1 13+1 15 15 15 15 15 13 # termios.c_cc[VDISCARD]=𝑥 syscon termios VWERASE 14+1 14+1 4 4 4 4 4 14 # termios.c_cc[VWERASE]=𝑥 syscon termios VLNEXT 15+1 15+1 14 14 14 14 14 15 # termios.c_cc[VLNEXT]=𝑥 syscon termios VEOL2 16+1 16+1 2 2 2 2 2 16 # termios.c_cc[VEOL2]=𝑥 syscon termios TIOCSERGETLSR 0x5459 0x5459 0 0 0 0 0 0 # syscon termios TIOCSERGETMULTI 0x545a 0x545a 0 0 0 0 0 0 # syscon termios TIOCSERSETMULTI 0x545b 0x545b 0 0 0 0 0 0 # syscon termios TIOCSER_TEMT 1 1 0 0 0 0 0 0 # syscon termios VERIFY 47 47 0 0 0 0 0 0 syscon termios CIBAUD 0x100f0000 0x100f0000 0 0 0 0 0 0 syscon termios CMSPAR 0x40000000 0x40000000 0 0 0 0 0 0 syscon termios BUSY 4 4 0 0 0 0 0 0 syscon termios CBAUD 0x100f 0x100f 0 0 0 0 0 0 syscon termios CBAUDEX 0x1000 0x1000 0 0 0 0 0 0 syscon termios EXTA 14 14 0x4b00 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus syscon termios EXTB 15 15 0x9600 0x9600 0x9600 0x9600 0x9600 0 # bsd consensus syscon termios ERA 0x02002c 0x02002c 45 45 45 0 0 0 syscon termios EMPTY 0 0 0 0 0 0 0 0 # consensus syscon termios TCFLSH 0x540b 0x540b 0x80047410 0x80047410 0x80047410 0x80047410 0x80047410 0 # see tcflush; TIOCFLUSH on BSD syscon termios TIOCFLUSH 0x540b 0x540b 0x80047410 0x80047410 0x80047410 0x80047410 0x80047410 0 # see tcflush; TCFLSH on Linux syscon termios TCIFLUSH 0 0 1 1 1 1 1 0 # see tcflush; bsd consensus; faked nt syscon termios TCOFLUSH 1 1 2 2 2 2 2 1 # see tcflush; bsd consensus; faked nt syscon termios TCIOFLUSH 2 2 3 3 3 3 3 2 # see tcflush; bsd consensus; faked nt syscon termios TCXONC 0x540A 0x540A 0 0 0 0 0 0 # see tcflow syscon termios TIOCSTOP 0x540A 0x540A 0x2000746f 0x2000746f 0x2000746f 0x2000746f 0x2000746f 0 # see tcflow syscon termios TIOCSTART 0x540A 0x540A 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0 # see tcflow syscon termios TCOOFF 0 0 1 1 1 1 1 0 # see tcflow; bsd consensus syscon termios TCOON 1 1 2 2 2 2 2 1 # see tcflow; bsd consensus syscon termios TCIOFF 2 2 3 3 3 3 3 2 # see tcflow; bsd consensus syscon termios TCION 3 3 4 4 4 4 4 3 # see tcflow; bsd consensus syscon termios CSTART 17 17 17 17 17 17 17 0 # unix consensus syscon termios CSTOP 19 19 19 19 19 19 19 0 # unix consensus # Pseudoteletypewriter Control # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon pty TIOCGPTN 0x80045430 0x80045430 0 0 0x4004740f 0 0 0 # boop syscon pty TIOCSPTLCK 0x40045431 0x40045431 0 0 0 0 0 0 # boop syscon pty TIOCPKT 0x5420 0x5420 0x80047470 0x80047470 0x80047470 0x80047470 0x80047470 -1 # boop syscon pty TIOCPKT_DATA 0 0 0 0 0 0 0 0 # consensus syscon pty TIOCPKT_FLUSHREAD 1 1 1 1 1 1 1 1 # unix consensus syscon pty TIOCPKT_FLUSHWRITE 2 2 2 2 2 2 2 2 # unix consensus syscon pty TIOCPKT_STOP 4 4 4 4 4 4 4 4 # unix consensus syscon pty TIOCPKT_START 8 8 8 8 8 8 8 8 # unix consensus syscon pty TIOCPKT_NOSTOP 16 16 16 16 16 16 16 16 # unix consensus syscon pty TIOCPKT_DOSTOP 32 32 32 32 32 32 32 32 # unix consensus syscon pty TIOCPKT_IOCTL 64 64 64 64 64 64 64 64 # unix consensus syscon pty PTMGET 0 0 0 0 0 0x40287401 0x40287401 -1 # for /dev/ptm # Modem Control # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon modem TIOCMGET 0x5415 0x5415 0x4004746a 0x4004746a 0x4004746a 0x4004746a 0x4004746a -1 # get status of modem bits; ioctl(fd, TIOCMGET, int *argp) syscon modem TIOCMSET 0x5418 0x5418 0x8004746d 0x8004746d 0x8004746d 0x8004746d 0x8004746d -1 # set status of modem bits; ioctl(fd, TIOCMSET, const int *argp) syscon modem TIOCMBIC 0x5417 0x5417 0x8004746b 0x8004746b 0x8004746b 0x8004746b 0x8004746b -1 # clear indicated modem bits; ioctl(fd, TIOCMBIC, int *argp) syscon modem TIOCMBIS 0x5416 0x5416 0x8004746c 0x8004746c 0x8004746c 0x8004746c 0x8004746c -1 # set indicated modem bits; ioctl(fd, TIOCMBIS, int *argp) syscon modem TIOCM_LE 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # consensus syscon modem TIOCM_DTR 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 # consensus syscon modem TIOCM_RTS 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 # consensus syscon modem TIOCM_ST 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # consensus syscon modem TIOCM_SR 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 # consensus syscon modem TIOCM_CTS 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 # consensus syscon modem TIOCM_CAR 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # consensus syscon modem TIOCM_CD 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # boop syscon modem TIOCM_RI 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # boop syscon modem TIOCM_RNG 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # boop syscon modem TIOCM_DSR 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # consensus syscon modem TIOCM_DCD 0 0 0 0 0x40 0 0 -1 # wut syscon modem TIOCMODG 0 0 0x40047403 0x40047403 0 0x4004746a 0x4004746a -1 # wut syscon modem TIOCMODS 0 0 0x80047404 0x80047404 0 0x8004746d 0x8004746d -1 # wut syscon modem TIOCMSDTRWAIT 0 0 0x8004745b 0x8004745b 0x8004745b 0 0 -1 # wut # ioctl(SIOCGIFFLAGS) Network Interface Flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon iff IFF_UP 1 1 1 1 1 1 1 1 # unix consensus syscon iff IFF_BROADCAST 2 2 2 2 2 2 2 2 # valid broadcast address set; consensus syscon iff IFF_DEBUG 4 4 4 4 4 4 4 4 # faked nt; consensus syscon iff IFF_LOOPBACK 8 8 8 8 8 8 8 4 # is loopback device; consensus syscon iff IFF_MULTICAST 0x1000 0x1000 0x8000 0x8000 0x8000 0x8000 0x8000 0x1000 # supports multicast; faked nt; bsd consensus syscon iff IFF_ALLMULTI 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 # receive all multicast packets; faked nt; unix consensus syscon iff IFF_NOARP 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 # faked nt as linux; unix consensus syscon iff IFF_POINTOPOINT 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 # point-to-point; faked nt as linux; unix consensus syscon iff IFF_PROMISC 0x100 0x100 0x100 0x100 0x100 0x100 0x100 0 # in packet capture mode; unix consensus syscon iff IFF_RUNNING 0x40 0x40 0x40 0x40 0x40 0x40 0x40 0 # unix consensus syscon iff IFF_NOTRAILERS 0x20 0x20 0x20 0x20 0 0 0 0 syscon iff IFF_AUTOMEDIA 0x4000 0x4000 0 0 0 0 0 0 syscon iff IFF_DYNAMIC 0x8000 0x8000 0 0 0 0 0 0 syscon iff IFF_MASTER 0x0400 0x0400 0 0 0 0 0 0 syscon iff IFF_PORTSEL 0x2000 0x2000 0 0 0 0 0 0 syscon iff IFF_SLAVE 0x0800 0x0800 0 0 0 0 0 0 syscon sock SOCK_STREAM 1 1 1 1 1 1 1 1 # consensus syscon sock SOCK_DGRAM 2 2 2 2 2 2 2 2 # consensus syscon sock SOCK_RAW 3 3 3 3 3 3 3 3 # consensus syscon sock SOCK_RDM 4 4 4 4 4 4 4 4 # consensus syscon sock SOCK_SEQPACKET 5 5 5 5 5 5 5 5 # consensus syscon sock SOCK_CLOEXEC 0x080000 0x080000 0x080000 0x080000 0x10000000 0x8000 0x10000000 0x00080000 # faked xnu & faked nt to be some as O_CLOEXEC syscon sock SOCK_NONBLOCK 0x0800 0x0800 0x0800 0x0800 0x20000000 0x4000 0x20000000 0x00000800 # faked xnu & faked nt to be same as O_NONBLOC and socket() will ioctl(FIONBIO=1) syscon sock SOCK_DCCP 6 6 0 0 0 0 0 0 # what is it? syscon sock SOCK_PACKET 10 10 0 0 0 0 0 0 # what is it? syscon shm SHM_R 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus syscon shm SHM_RDONLY 0x1000 0x1000 0x1000 0x1000 0x1000 0x1000 0x1000 0 # unix consensus syscon shm SHM_RND 0x2000 0x2000 0x2000 0x2000 0x2000 0x2000 0x2000 0 # unix consensus syscon shm SHM_W 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0 # unix consensus syscon shm SHM_LOCK 11 11 0 0 11 3 3 0 syscon shm SHM_UNLOCK 12 12 0 0 12 4 4 0 syscon shm SHM_INFO 14 14 0 0 14 0 0 0 syscon shm SHM_STAT 13 13 0 0 13 0 0 0 syscon shm SHM_DEST 0x0200 0x0200 0 0 0 0 0 0 syscon shm SHM_EXEC 0x8000 0x8000 0 0 0 0 0 0 syscon shm SHM_HUGETLB 0x0800 0x0800 0 0 0 0 0 0 syscon shm SHM_LOCKED 0x0400 0x0400 0 0 0 0 0 0 syscon shm SHM_NORESERVE 0x1000 0x1000 0 0 0 0 0 0 syscon shm SHM_REMAP 0x4000 0x4000 0 0 0 0 0 0 syscon shm SHM_ANON 0 0 0 0 1 0 0 0 syscon lock LOCK_UNLOCK_CACHE 54 54 0 0 0 0 0 0 # wut syscon misc IP6F_MORE_FRAG 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 # consensus syscon misc IP6F_OFF_MASK 0xf8ff 0xf8ff 0xf8ff 0xf8ff 0xf8ff 0xf8ff 0xf8ff 0xf8ff # consensus syscon misc IP6F_RESERVED_MASK 0x0600 0x0600 0x0600 0x0600 0x0600 0x0600 0x0600 0x0600 # consensus syscon misc NO_SENSE 0 0 0 0 0 0 0 0 # consensus syscon misc NO_ADDRESS 4 4 4 4 4 4 4 0x2afc # unix consensus syscon misc L_SET 0 0 0 0 0 0 0 0 # consensus syscon misc L_INCR 1 1 1 1 1 1 1 0 # unix consensus syscon misc L_XTND 2 2 2 2 2 2 2 0 # unix consensus syscon misc SHUT_RD 0 0 0 0 0 0 0 0 # consensus (SD_RECEIVE) syscon misc SHUT_WR 1 1 1 1 1 1 1 1 # consensus (SD_SEND) syscon misc SHUT_RDWR 2 2 2 2 2 2 2 2 # consensus (SD_BOTH) syscon misc Q_QUOTAOFF 0x800003 0x800003 0x0200 0x0200 0x0200 0x0200 0x0200 0 # bsd consensus syscon misc Q_QUOTAON 0x800002 0x800002 0x0100 0x0100 0x0100 0x0100 0x0100 0 # bsd consensus syscon misc Q_SYNC 0x800001 0x800001 0x0600 0x0600 0x0600 0x0600 0x0600 0 # bsd consensus syscon misc Q_GETQUOTA 0x800007 0x800007 768 768 0x0700 768 768 0 syscon misc Q_SETQUOTA 0x800008 0x800008 0x0400 0x0400 0x0800 0x0400 0x0400 0 syscon misc Q_GETFMT 0x800004 0x800004 0 0 0 0 0 0 syscon misc Q_GETINFO 0x800005 0x800005 0 0 0 0 0 0 syscon misc Q_SETINFO 0x800006 0x800006 0 0 0 0 0 0 syscon misc RPM_PCO_ADD 1 1 1 1 1 1 1 0 # unix consensus syscon misc RPM_PCO_CHANGE 2 2 2 2 2 2 2 0 # unix consensus syscon misc RPM_PCO_SETGLOBAL 3 3 3 3 3 3 3 0 # unix consensus syscon misc FSETLOCKING_QUERY 0 0 0 0 0 0 0 0 # consensus syscon misc FSETLOCKING_BYCALLER 2 2 0 0 0 0 0 0 syscon misc FSETLOCKING_INTERNAL 1 1 0 0 0 0 0 0 syscon misc MAX_DQ_TIME 0x093a80 0x093a80 0x093a80 0x093a80 0x093a80 0x093a80 0x093a80 0 # unix consensus syscon misc MAX_IQ_TIME 0x093a80 0x093a80 0x093a80 0x093a80 0x093a80 0x093a80 0x093a80 0 # unix consensus syscon misc MAX_HANDLE_SZ 0x80 0x80 0 0 0 0 0 0 syscon mlock MCL_CURRENT 1 1 1 1 1 1 1 0 # unix consensus syscon mlock MCL_FUTURE 2 2 2 2 2 2 2 0 # unix consensus syscon mlock MCL_ONFAULT 4 4 0 0 0 0 0 0 syscon misc MLD_LISTENER_QUERY 130 130 130 130 130 130 130 0 # unix consensus syscon misc MLD_LISTENER_REPORT 131 131 131 131 131 131 131 0 # unix consensus syscon misc MLD_LISTENER_REDUCTION 132 132 132 132 132 0 0 0 syscon misc TTYDEF_CFLAG 0x05a0 0x05a0 0x4b00 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus syscon misc TTYDEF_IFLAG 0x2d22 0x2d22 0x2b02 0x2b02 0x2b02 0x2b02 0x2b02 0 # bsd consensus syscon misc TTYDEF_LFLAG 0x8a1b 0x8a1b 0x05cb 0x05cb 0x05cb 0x05cb 0x05cb 0 # bsd consensus syscon misc TTYDEF_SPEED 13 13 0x2580 0x2580 0x2580 0x2580 0x2580 0 # bsd consensus syscon misc TTYDEF_OFLAG 0x1805 0x1805 3 3 3 7 7 0 syscon misc ACCT_BYTEORDER 0 0 0 0 0 0 0 0 # consensus syscon misc ACCT_COMM 0x10 0x10 0 0 0 0 0 0 syscon misc COMMAND_COMPLETE 0 0 0 0 0 0 0 0 # consensus syscon misc COMMAND_TERMINATED 17 17 0 0 0 0 0 0 syscon select FD_SETSIZE 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 # forced consensus (0x40 on NT) syscon misc MATH_ERREXCEPT 2 2 2 2 2 2 2 0 # unix consensus syscon misc MATH_ERRNO 1 1 1 1 1 1 1 0 # unix consensus syscon misc MCAST_BLOCK_SOURCE 43 43 84 84 84 0 0 43 syscon misc MCAST_JOIN_GROUP 42 42 80 80 80 0 0 41 syscon misc MCAST_JOIN_SOURCE_GROUP 46 46 82 82 82 0 0 45 syscon misc MCAST_LEAVE_GROUP 45 45 81 81 81 0 0 42 syscon misc MCAST_LEAVE_SOURCE_GROUP 47 47 83 83 83 0 0 46 syscon misc MCAST_UNBLOCK_SOURCE 44 44 85 85 85 0 0 44 syscon misc MCAST_INCLUDE 1 1 1 1 1 0 0 0 syscon misc MCAST_EXCLUDE 0 0 2 2 2 0 0 0 syscon misc MCAST_MSFILTER 48 48 0 0 0 0 0 0 syscon misc AREGTYPE 0 0 0 0 0 0 0 0 # consensus syscon misc CTIME 0 0 0 0 0 0 0 0 # consensus syscon misc EFD_CLOEXEC 0x080000 0x080000 0 0 0 0 0 0 syscon misc EFD_NONBLOCK 0x0800 0x0800 0 0 0 0 0 0 syscon misc EFD_SEMAPHORE 1 1 0 0 0 0 0 0 syscon misc SYNC_FILE_RANGE_WAIT_AFTER 4 4 0 0 0 0 0 0 syscon misc SYNC_FILE_RANGE_WAIT_BEFORE 1 1 0 0 0 0 0 0 syscon misc SYNC_FILE_RANGE_WRITE 2 2 0 0 0 0 0 0 syscon misc TEST_UNIT_READY 0 0 0 0 0 0 0 0 syscon misc TFD_CLOEXEC 0x080000 0x080000 0 0 0 0 0 0 syscon misc TFD_NONBLOCK 0x0800 0x0800 0 0 0 0 0 0 syscon misc TFD_TIMER_ABSTIME 1 1 0 0 0 0 0 0 syscon misc USRQUOTA 0 0 0 0 0 0 0 0 syscon misc HOST_NAME_MAX 0x40 0x40 0 0 0 255 255 0 syscon misc UDP_ENCAP_ESPINUDP_NON_IKE 1 1 0 0 1 0 0 0 syscon misc UDP_NO_CHECK6_RX 102 102 0 0 0 0 0 0 syscon misc UDP_NO_CHECK6_TX 101 101 0 0 0 0 0 0 syscon misc ACK 4 4 4 4 4 4 4 0 # unix consensus syscon misc CDISCARD 15 15 15 15 15 15 15 0 # unix consensus syscon misc CEOT 4 4 4 4 4 4 4 0 # unix consensus syscon misc CERASE 127 127 127 127 127 127 127 0 # unix consensus syscon misc CHRTYPE 51 51 51 51 51 51 51 0 # unix consensus syscon misc CKILL 21 21 21 21 21 21 21 0 # unix consensus syscon misc CLNEXT 22 22 22 22 22 22 22 0 # unix consensus syscon misc CMIN 1 1 1 1 1 1 1 0 # unix consensus syscon misc COMPLETE 2 2 2 2 2 2 2 0 # unix consensus syscon misc CONTINUE 3 3 3 3 3 3 3 0 # unix consensus syscon misc CONTTYPE 55 55 55 55 55 55 55 0 # unix consensus syscon misc COPY_ABORTED 10 10 0 0 0 0 0 0 syscon misc COPY_VERIFY 58 58 0 0 0 0 0 0 syscon misc CQUIT 28 28 28 28 28 28 28 0 # unix consensus syscon misc CREPRINT 18 18 18 18 18 18 18 0 # unix consensus syscon misc CRPRNT 18 18 18 18 18 18 18 0 # unix consensus syscon misc DATA 3 3 3 3 3 3 3 0 # unix consensus syscon misc DEV_BSIZE 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus syscon misc DIRTYPE 53 53 53 53 53 53 53 0 # unix consensus syscon misc ELF_NGREG 27 27 0 0 0 0 0 0 syscon misc ELF_PRARGSZ 80 80 0 0 0 0 0 0 syscon misc EM_ALTERA_NIOS2 113 113 0 0 0 0 0 0 syscon misc EM_LATTICEMICO32 138 138 0 0 0 0 0 0 syscon misc EXPR_NEST_MAX 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0 # unix consensus # linux fallocate() flags # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon misc FALLOC_FL_KEEP_SIZE 0x01 0x01 -1 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_PUNCH_HOLE 0x02 0x02 -1 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_NO_HIDE_STALE 0x04 0x04 -1 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_COLLAPSE_RANGE 0x08 0x08 -1 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_ZERO_RANGE 0x10 0x10 -1 -1 -1 -1 -1 0x000980C8 # bsd consensus & kNtFsctlSetZeroData syscon misc FALLOC_FL_INSERT_RANGE 0x20 0x20 -1 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_UNSHARE_RANGE 0x40 0x40 -1 -1 -1 -1 -1 -1 # bsd consensus # Video Output Control Ioctls (mostly platform-specific) # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon vid FBIOGET_VSCREENINFO 0x4600 0x4600 0 0 0 0 0 0 syscon vid FBIOPUT_VSCREENINFO 0x4601 0x4601 0 0 0 0 0 0 syscon vid FBIOGET_FSCREENINFO 0x4602 0x4602 0 0 0 0 0 0 syscon vid FBIOGETCMAP 0x4604 0x4604 0 0 0 0 0 0 syscon vid FBIOPUTCMAP 0x4605 0x4605 0 0 0 0 0 0 syscon vid FBIOPAN_DISPLAY 0x4606 0x4606 0 0 0 0 0 0 syscon vid FBIO_WAITFORVSYNC 0x40044620 0x40044620 0 0 0 0 0 0 #syscon vid FBIO_CACHE_SYNC 0x4630 0x4630 0 0 0 0 0 0 # does any Linux kernel driver actually implement this ioctl? only Chinese sources mention it syscon vid GIO_FONT 0x4b60 0x4b60 0 0 0 0 0 0 syscon vid PIO_FONT 0x4b61 0x4b61 0 0 0 0 0 0 syscon vid GIO_FONTX 0x4b6b 0x4b6b 0 0 0 0 0 0 syscon vid PIO_FONTX 0x4b6c 0x4b6c 0 0 0 0 0 0 syscon vid PIO_FONT8x8 0 0 0 0 0x88006340 0 0 0 syscon vid PIO_FONT8x14 0 0 0 0 0x8e006342 0 0 0 syscon vid PIO_FONT8x16 0 0 0 0 0x90006344 0 0 0 syscon vid PIO_VFONT 0 0 0 0 0x84086346 0 0 0 syscon vid PIO_FONTRESET 0x4b6d 0x4b6d 0 0 0x20006348 0 0 0 # PIO_VFONT_DEFAULT on FreeBSD, absent on OpenBSD syscon vid KDFONTOP 0x4b72 0x4b72 0 0 0 0 0 0 # System Call Numbers. # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology syscon nr __NR_exit 0x003c 0x005d 0x2000169 0x0169 0x01af 0x012e 0x136 0xfff # __bsdthread_terminate() on XNU, thr_exit() on FreeBSD, __threxit() on OpenBSD, __lwp_exit() on NetBSD syscon nr __NR_exit_group 0x00e7 0x005e 0x2000001 0x0001 0x0001 0x0001 0x001 0xfff syscon nr __NR_read 0x0000 0x003f 0x2000003 0x0003 0x0003 0x0003 0x003 0xfff syscon nr __NR_write 0x0001 0x0040 0x2000004 0x0004 0x0004 0x0004 0x004 0xfff syscon nr __NR_open 0x0002 0x00b4 0x2000005 0x0005 0x0005 0x0005 0x005 0xfff syscon nr __NR_close 0x0003 0x0039 0x2000006 0x0006 0x0006 0x0006 0x006 0xfff syscon nr __NR_stat 0x0004 0x004f 0x2000152 0x0152 0xfff 0x0026 0x1b7 0xfff syscon nr __NR_fstat 0x0005 0x0050 0x2000153 0x0153 0x0227 0x0035 0x1b8 0xfff syscon nr __NR_lstat 0x0006 0x0fff 0x2000154 0x0154 0x0028 0x0028 0x1b9 0xfff syscon nr __NR_poll 0x0007 0x0fff 0x20000e6 0x00e6 0x00d1 0x00fc 0x0d1 0xfff syscon nr __NR_ppoll 0x010f 0x0049 0xfff 0xfff 0x0221 0x006d 0xfff 0xfff syscon nr __NR_lseek 0x0008 0x003e 0x20000c7 0x00c7 0x01de 0x00c7 0x0c7 0xfff syscon nr __NR_mmap 0x0009 0x00de 0x20000c5 0x00c5 0x01dd 0x00c5 0x0c5 0xfff syscon nr __NR_msync 0x001a 0x00e3 0x2000041 0x0041 0x0041 0x0100 0x115 0xfff syscon nr __NR_mprotect 0x000a 0x00e2 0x200004a 0x004a 0x004a 0x004a 0x04a 0xfff syscon nr __NR_munmap 0x000b 0x00d7 0x2000049 0x0049 0x0049 0x0049 0x049 0xfff syscon nr __NR_sigaction 0x000d 0x0086 0x200002e 0x002e 0x01a0 0x002e 0x154 0xfff syscon nr __NR_sigprocmask 0x000e 0x0087 0x2000149 0x0149 0x0154 0x0030 0x125 0xfff syscon nr __NR_ioctl 0x0010 0x001d 0x2000036 0x0036 0x0036 0x0036 0x036 0xfff syscon nr __NR_pread 0x0011 0x0043 0x2000099 0x0099 0x01db 0x00ad 0x0ad 0xfff syscon nr __NR_pwrite 0x0012 0x0044 0x200009a 0x009a 0x01dc 0x00ae 0x0ae 0xfff syscon nr __NR_readv 0x0013 0x0041 0x2000078 0x0078 0x0078 0x0078 0x078 0xfff syscon nr __NR_writev 0x0014 0x0042 0x2000079 0x0079 0x0079 0x0079 0x079 0xfff syscon nr __NR_access 0x0015 0x0fff 0x2000021 0x0021 0x0021 0x0021 0x021 0xfff syscon nr __NR_pipe 0x0016 0x0fff 0x200002a 0x002a 0x021e 0x0107 0x02a 0xfff syscon nr __NR_select 0x0017 0x0fff 0x200005d 0x005d 0x005d 0x0047 0x1a1 0xfff syscon nr __NR_pselect 0xfff 0x0fff 0x200018a 0x018a 0x020a 0x006e 0x1b4 0xfff syscon nr __NR_pselect6 0x010e 0x0048 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sched_yield 0x0018 0x007c 0x200005d 0x005d 0x014b 0x012a 0x15e 0xfff # select() on XNU (previously swtch() but removed in 12.4) syscon nr __NR_mremap 0x0019 0x00d8 0xfff 0xfff 0xfff 0xfff 0x19b 0xfff syscon nr __NR_mincore 0x001b 0x00e8 0x200004e 0x004e 0x004e 0x004e 0x04e 0xfff syscon nr __NR_madvise 0x001c 0x00e9 0x200004b 0x004b 0x004b 0x004b 0x04b 0xfff syscon nr __NR_shmget 0x001d 0x00c2 0x2000109 0x0109 0x00e7 0x0121 0x0e7 0xfff syscon nr __NR_shmat 0x001e 0x00c4 0x2000106 0x0106 0x00e4 0x00e4 0x0e4 0xfff syscon nr __NR_shmctl 0x001f 0x00c3 0x2000107 0x0107 0x0200 0x0128 0x1bb 0xfff syscon nr __NR_dup 0x0020 0x0017 0x2000029 0x0029 0x0029 0x0029 0x029 0xfff syscon nr __NR_dup2 0x0021 0x0fff 0x200005a 0x005a 0x005a 0x005a 0x05a 0xfff syscon nr __NR_pause 0x0022 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_nanosleep 0x0023 0x0065 0xfff 0xfff 0x00f0 0x005b 0x1ae 0xfff syscon nr __NR_getitimer 0x0024 0x0066 0x2000056 0x0056 0x0056 0x0046 0x1aa 0xfff syscon nr __NR_setitimer 0x0026 0x0067 0x2000053 0x0053 0x0053 0x0045 0x1a9 0xfff syscon nr __NR_alarm 0x0025 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_getpid 0x0027 0x00ac 0x2000014 0x0014 0x0014 0x0014 0x014 0xfff syscon nr __NR_sendfile 0x0028 0x0047 0x2000151 0x0151 0x0189 0xfff 0xfff 0xfff syscon nr __NR_socket 0x0029 0x00c6 0x2000061 0x0061 0x0061 0x0061 0x18a 0xfff syscon nr __NR_connect 0x002a 0x00cb 0x2000062 0x0062 0x0062 0x0062 0x062 0xfff syscon nr __NR_accept 0x002b 0x00ca 0x200001e 0x001e 0x0063 0x001e 0x01e 0xfff syscon nr __NR_sendto 0x002c 0x00ce 0x2000085 0x0085 0x0085 0x0085 0x085 0xfff syscon nr __NR_recvfrom 0x002d 0x00cf 0x200001d 0x001d 0x001d 0x001d 0x01d 0xfff syscon nr __NR_sendmsg 0x002e 0x00d3 0x200001c 0x001c 0x001c 0x001c 0x01c 0xfff syscon nr __NR_recvmsg 0x002f 0x00d4 0x200001b 0x001b 0x001b 0x001b 0x01b 0xfff syscon nr __NR_shutdown 0x0030 0x00d2 0x2000086 0x0086 0x0086 0x0086 0x086 0xfff syscon nr __NR_bind 0x0031 0x00c8 0x2000068 0x0068 0x0068 0x0068 0x068 0xfff syscon nr __NR_listen 0x0032 0x00c9 0x200006a 0x006a 0x006a 0x006a 0x06a 0xfff syscon nr __NR_getsockname 0x0033 0x00cc 0x2000020 0x0020 0x0020 0x0020 0x020 0xfff syscon nr __NR_getpeername 0x0034 0x00cd 0x200001f 0x001f 0x008d 0x001f 0x01f 0xfff syscon nr __NR_socketpair 0x0035 0x00c7 0x2000087 0x0087 0x0087 0x0087 0x087 0xfff syscon nr __NR_setsockopt 0x0036 0x00d0 0x2000069 0x0069 0x0069 0x0069 0x069 0xfff syscon nr __NR_getsockopt 0x0037 0x00d1 0x2000076 0x0076 0x0076 0x0076 0x076 0xfff syscon nr __NR_fork 0x0039 0x0fff 0x2000002 0x0002 0x0002 0x0002 0x002 0xfff syscon nr __NR_vfork 0x003a 0x0fff 0x2000042 0x0042 0x0042 0x0042 0x042 0xfff syscon nr __NR_posix_spawn 0xfff 0x0fff 0x20000f4 0x00f4 0xfff 0xfff 0xfff 0xfff syscon nr __NR_execve 0x003b 0x00dd 0x200003b 0x003b 0x003b 0x003b 0x03b 0xfff # DING DING DING DING DING syscon nr __NR_wait4 0x003d 0x0104 0x2000007 0x0007 0x0007 0x000b 0x1c1 0xfff syscon nr __NR_kill 0x003e 0x0081 0x2000025 0x0025 0x0025 0x007a 0x025 0xfff syscon nr __NR_killpg 0xfff 0x0fff 0xfff 0xfff 0x0092 0xfff 0xfff 0xfff syscon nr __NR_clone 0x0038 0x00dc 0xfff 0xfff 0xfff 0xfff 0x11f 0xfff syscon nr __NR_tkill 0x00c8 0x0082 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_futex 0x00ca 0x0062 0xfff 0xfff 0x1c6 0x0053 0x0a6 0xfff syscon nr __NR_set_robust_list 0x0111 0x0063 0xfff 0xfff 0xfff 0xfff 0x0a7 0xfff syscon nr __NR_get_robust_list 0x0112 0x0064 0xfff 0xfff 0xfff 0xfff 0x0a8 0xfff syscon nr __NR_uname 0x003f 0x00a0 0xfff 0xfff 0x00a4 0xfff 0xfff 0xfff syscon nr __NR_semget 0x0040 0x00be 0x20000ff 0x00ff 0x00dd 0x00dd 0x0dd 0xfff syscon nr __NR_semop 0x0041 0x00c1 0x2000100 0x0100 0x00de 0x0122 0x0de 0xfff syscon nr __NR_semctl 0x0042 0x00bf 0x20000fe 0x00fe 0x01fe 0x0127 0xfff 0xfff syscon nr __NR_shmdt 0x0043 0x00c5 0x2000108 0x0108 0x00e6 0x00e6 0x0e6 0xfff syscon nr __NR_msgget 0x0044 0x00ba 0x2000103 0x0103 0x00e1 0x00e1 0x0e1 0xfff syscon nr __NR_msgsnd 0x0045 0x00bd 0x2000104 0x0104 0x00e2 0x00e2 0x0e2 0xfff syscon nr __NR_msgrcv 0x0046 0x00bc 0x2000105 0x0105 0x00e3 0x00e3 0x0e3 0xfff syscon nr __NR_msgctl 0x0047 0x00bb 0x2000102 0x0102 0x01ff 0x0129 0x1bc 0xfff syscon nr __NR_fcntl 0x0048 0x0019 0x200005c 0x005c 0x005c 0x005c 0x05c 0xfff syscon nr __NR_flock 0x0049 0x0020 0x2000083 0x0083 0x0083 0x0083 0x083 0xfff syscon nr __NR_fsync 0x004a 0x0052 0x200005f 0x005f 0x005f 0x005f 0x05f 0xfff syscon nr __NR_fdatasync 0x004b 0x0053 0x20000bb 0x00bb 0x0226 0x005f 0x0f1 0xfff syscon nr __NR_truncate 0x004c 0x002d 0x20000c8 0x00c8 0x01df 0x00c8 0x0c8 0xfff syscon nr __NR_ftruncate 0x004d 0x002e 0x20000c9 0x00c9 0x01e0 0x00c9 0x0c9 0xfff syscon nr __NR_getcwd 0x004f 0x0011 0xfff 0xfff 0x0146 0x0130 0x128 0xfff syscon nr __NR_chdir 0x0050 0x0031 0x200000c 0x000c 0x000c 0x000c 0x00c 0xfff syscon nr __NR_fchdir 0x0051 0x0032 0x200000d 0x000d 0x000d 0x000d 0x00d 0xfff syscon nr __NR_rename 0x0052 0x0fff 0x2000080 0x0080 0x0080 0x0080 0x080 0xfff syscon nr __NR_mkdir 0x0053 0x0fff 0x2000088 0x0088 0x0088 0x0088 0x088 0xfff syscon nr __NR_rmdir 0x0054 0x0fff 0x2000089 0x0089 0x0089 0x0089 0x089 0xfff syscon nr __NR_creat 0x0055 0x0fff 0xfff 0xfff 0x0008 0xfff 0x008 0xfff syscon nr __NR_link 0x0056 0x0fff 0x2000009 0x0009 0x0009 0x0009 0x009 0xfff syscon nr __NR_unlink 0x0057 0x00b5 0x200000a 0x000a 0x000a 0x000a 0x00a 0xfff syscon nr __NR_symlink 0x0058 0x0fff 0x2000039 0x0039 0x0039 0x0039 0x039 0xfff syscon nr __NR_readlink 0x0059 0x0fff 0x200003a 0x003a 0x003a 0x003a 0x03a 0xfff syscon nr __NR_chmod 0x005a 0x0fff 0x200000f 0x000f 0x000f 0x000f 0x00f 0xfff syscon nr __NR_fchmod 0x005b 0x0034 0x200007c 0x007c 0x007c 0x007c 0x07c 0xfff syscon nr __NR_chown 0x005c 0x0fff 0x2000010 0x0010 0x0010 0x0010 0x010 0xfff syscon nr __NR_fchown 0x005d 0x0037 0x200007b 0x007b 0x007b 0x007b 0x07b 0xfff syscon nr __NR_lchown 0x005e 0x0fff 0x200016c 0x016c 0x00fe 0x00fe 0x113 0xfff syscon nr __NR_umask 0x005f 0x00a6 0x200003c 0x003c 0x003c 0x003c 0x03c 0xfff syscon nr __NR_gettimeofday 0x0060 0x00a9 0x2000074 0x0074 0x0074 0x0043 0x1a2 0xfff syscon nr __NR_getrlimit 0x0061 0x00a3 0x20000c2 0x00c2 0x00c2 0x00c2 0x0c2 0xfff syscon nr __NR_getrusage 0x0062 0x00a5 0x2000075 0x0075 0x0075 0x0013 0x1bd 0xfff syscon nr __NR_sysinfo 0x0063 0x00b3 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_times 0x0064 0x0099 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_ptrace 0x0065 0x0075 0x200001a 0x001a 0x001a 0x001a 0x01a 0xfff syscon nr __NR_syslog 0x0067 0x0074 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_getuid 0x0066 0x00ae 0x2000018 0x0018 0x0018 0x0018 0x018 0xfff syscon nr __NR_getgid 0x0068 0x00b0 0x200002f 0x002f 0x002f 0x002f 0x02f 0xfff syscon nr __NR_getppid 0x006e 0x00ad 0x2000027 0x0027 0x0027 0x0027 0xfff 0xfff syscon nr __NR_getpgrp 0x006f 0x0fff 0x2000051 0x0051 0x0051 0x0051 0x051 0xfff syscon nr __NR_setsid 0x0070 0x009d 0x2000093 0x0093 0x0093 0x0093 0x093 0xfff syscon nr __NR_getsid 0x007c 0x009c 0x2000136 0x0136 0x0136 0x00ff 0x11e 0xfff syscon nr __NR_getpgid 0x0079 0x009b 0x2000097 0x0097 0x00cf 0x00cf 0x0cf 0xfff syscon nr __NR_setpgid 0x006d 0x009a 0x2000052 0x0052 0x0052 0x0052 0x052 0xfff syscon nr __NR_geteuid 0x006b 0x00af 0x2000019 0x0019 0x0019 0x0019 0xfff 0xfff syscon nr __NR_getegid 0x006c 0x00b1 0x200002b 0x002b 0x002b 0x002b 0xfff 0xfff syscon nr __NR_getgroups 0x0073 0x009e 0x200004f 0x004f 0x004f 0x004f 0x04f 0xfff syscon nr __NR_setgroups 0x0074 0x009f 0x2000050 0x0050 0x0050 0x0050 0x050 0xfff syscon nr __NR_setreuid 0x0071 0x0091 0x200007e 0x007e 0x007e 0x007e 0x07e 0xfff syscon nr __NR_setregid 0x0072 0x008f 0x200007f 0x007f 0x007f 0x007f 0x07f 0xfff syscon nr __NR_setuid 0x0069 0x0092 0x2000017 0x0017 0x0017 0x0017 0x017 0xfff syscon nr __NR_setgid 0x006a 0x0090 0x20000b5 0x00b5 0x00b5 0x00b5 0x0b5 0xfff syscon nr __NR_setresuid 0x0075 0x0093 0xfff 0xfff 0x0137 0x011a 0xfff 0xfff syscon nr __NR_setresgid 0x0077 0x0095 0xfff 0xfff 0x0138 0x011c 0xfff 0xfff syscon nr __NR_getresuid 0x0076 0x0094 0xfff 0xfff 0x0168 0x0119 0xfff 0xfff syscon nr __NR_getresgid 0x0078 0x0096 0xfff 0xfff 0x0169 0x011b 0xfff 0xfff syscon nr __NR_sigpending 0x007f 0x0088 0x2000034 0x0034 0x0034 0x0034 0x124 0xfff syscon nr __NR_sigsuspend 0x0082 0x0085 0x200006f 0x006f 0x0155 0x006f 0x126 0xfff syscon nr __NR_sigaltstack 0x0083 0x0084 0x2000035 0x0035 0x0035 0x0120 0x119 0xfff syscon nr __NR_mknod 0x0085 0x0fff 0x200000e 0x000e 0x000e 0x000e 0x1c2 0xfff syscon nr __NR_mknodat 0x0103 0x0021 0xfff 0xfff 0x22ff 0x0140 0x1cc 0xfff syscon nr __NR_mkfifo 0xfff 0x0fff 0x2000084 0x0084 0x0084 0x0084 0x084 0xfff syscon nr __NR_mkfifoat 0xfff 0x0fff 0xfff 0xfff 0x01f1 0x013f 0x1cb 0xfff syscon nr __NR_statfs 0x0089 0x002b 0x2000159 0x0159 0x022b 0x003f 0xfff 0xfff syscon nr __NR_fstatfs 0x008a 0x002c 0x200015a 0x015a 0x022c 0x0040 0xfff 0xfff syscon nr __NR_getpriority 0x008c 0x008d 0x2000064 0x0064 0x0064 0x0064 0x064 0xfff syscon nr __NR_setpriority 0x008d 0x008c 0x2000060 0x0060 0x0060 0x0060 0x060 0xfff syscon nr __NR_mlock 0x0095 0x00e4 0x20000cb 0x00cb 0x00cb 0x00cb 0x0cb 0xfff syscon nr __NR_munlock 0x0096 0x00e5 0x20000cc 0x00cc 0x00cc 0x00cc 0x0cc 0xfff syscon nr __NR_mlockall 0x0097 0x00e6 0x2000144 0x0144 0x0144 0x010f 0x0f2 0xfff syscon nr __NR_munlockall 0x0098 0x00e7 0x2000145 0x0145 0x0145 0x0110 0x0f3 0xfff syscon nr __NR_setrlimit 0x00a0 0x00a4 0x20000c3 0x00c3 0x00c3 0x00c3 0x0c3 0xfff syscon nr __NR_chroot 0x00a1 0x0033 0x200003d 0x003d 0x003d 0x003d 0x03d 0xfff syscon nr __NR_sync 0x00a2 0x0051 0x2000024 0x0024 0x0024 0x0024 0x024 0xfff syscon nr __NR_acct 0x00a3 0x0059 0x2000033 0x0033 0x0033 0x0033 0x033 0xfff syscon nr __NR_settimeofday 0x00a4 0x00aa 0x200007a 0x007a 0x007a 0x0044 0x1a3 0xfff syscon nr __NR_mount 0x00a5 0x0028 0x20000a7 0x00a7 0x0015 0x0015 0x19a 0xfff syscon nr __NR_reboot 0x00a9 0x008e 0x2000037 0x0037 0x0037 0x0037 0x0d0 0xfff syscon nr __NR_quotactl 0x00b3 0x003c 0x20000a5 0x00a5 0x0094 0x0094 0xfff 0xfff syscon nr __NR_setfsuid 0x007a 0x0097 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_setfsgid 0x007b 0x0098 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_capget 0x007d 0x005a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_capset 0x007e 0x005b 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sigtimedwait 0x0080 0x0089 0xfff 0xfff 0x0159 0xfff 0xfff 0xfff syscon nr __NR_sigqueueinfo 0x0081 0x008a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_personality 0x0087 0x005c 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_ustat 0x0088 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sysfs 0x008b 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sched_setparam 0x008e 0x0076 0xfff 0xfff 0x0147 0xfff 0xfff 0xfff syscon nr __NR_sched_getparam 0x008f 0x0079 0xfff 0xfff 0x0148 0xfff 0xfff 0xfff syscon nr __NR_sched_setscheduler 0x0090 0x0077 0xfff 0xfff 0x0149 0xfff 0xfff 0xfff syscon nr __NR_sched_getscheduler 0x0091 0x0078 0xfff 0xfff 0x014a 0xfff 0xfff 0xfff syscon nr __NR_sched_get_priority_max 0x0092 0x007d 0xfff 0xfff 0x014c 0xfff 0xfff 0xfff syscon nr __NR_sched_get_priority_min 0x0093 0x007e 0xfff 0xfff 0x014d 0xfff 0xfff 0xfff syscon nr __NR_sched_rr_get_interval 0x0094 0x007f 0xfff 0xfff 0x014e 0xfff 0xfff 0xfff syscon nr __NR_vhangup 0x0099 0x003a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_modify_ldt 0x009a 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pivot_root 0x009b 0x0029 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR__sysctl 0x009c 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_prctl 0x009d 0x00a7 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_arch_prctl 0x009e 0x0fff 0x3000003 0xfff 0x00a5 0x149 0x13d 0xfff # sysarch on freebsd, _lwp_setprivate on netbsd, __set_tcb on openbsd, thread_fast_set_cthread_self on xnu syscon nr __NR_adjtimex 0x009f 0x00ab 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_umount2 0x00a6 0x0027 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_swapon 0x00a7 0x00e0 0x2000055 0x0055 0x0055 0xfff 0xfff 0xfff syscon nr __NR_swapoff 0x00a8 0x00e1 0xfff 0xfff 0x01a8 0xfff 0xfff 0xfff syscon nr __NR_sethostname 0x00aa 0x00a1 0xfff 0xfff 0x0058 0xfff 0xfff 0xfff syscon nr __NR_setdomainname 0x00ab 0x00a2 0xfff 0xfff 0x00a3 0xfff 0xfff 0xfff syscon nr __NR_iopl 0x00ac 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_ioperm 0x00ad 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_init_module 0x00af 0x0069 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_delete_module 0x00b0 0x006a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_gettid 0x00ba 0x00b2 0x100001b 0xfff 432 299 311 0xfff # TODO(jart): thread_self_trap vs. gettid? syscon nr __NR_readahead 0x00bb 0x00d5 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_setxattr 0x00bc 0x0005 0x20000ec 0x00ec 0xfff 0xfff 0x177 0xfff syscon nr __NR_fsetxattr 0x00be 0x0007 0x20000ed 0x00ed 0xfff 0xfff 0x179 0xfff syscon nr __NR_getxattr 0x00bf 0x0008 0x20000ea 0x00ea 0xfff 0xfff 0x17a 0xfff syscon nr __NR_fgetxattr 0x00c1 0x000a 0x20000eb 0x00eb 0xfff 0xfff 0x17c 0xfff syscon nr __NR_listxattr 0x00c2 0x000b 0x20000f0 0x00f0 0xfff 0xfff 0x17d 0xfff syscon nr __NR_flistxattr 0x00c4 0x000d 0x20000f1 0x00f1 0xfff 0xfff 0x17f 0xfff syscon nr __NR_removexattr 0x00c5 0x000e 0x20000ee 0x00ee 0xfff 0xfff 0x180 0xfff syscon nr __NR_fremovexattr 0x00c7 0x0010 0x20000ef 0x00ef 0xfff 0xfff 0x182 0xfff syscon nr __NR_lsetxattr 0x00bd 0x0006 0xfff 0xfff 0xfff 0xfff 0x178 0xfff syscon nr __NR_lgetxattr 0x00c0 0x0009 0xfff 0xfff 0xfff 0xfff 0x17b 0xfff syscon nr __NR_llistxattr 0x00c3 0x000c 0xfff 0xfff 0xfff 0xfff 0x17e 0xfff syscon nr __NR_lremovexattr 0x00c6 0x000f 0xfff 0xfff 0xfff 0xfff 0x181 0xfff syscon nr __NR_sched_setaffinity 0x00cb 0x007a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sched_getaffinity 0x00cc 0x007b 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_cpuset_getaffinity 0xfff 0xfff 0xfff 0xfff 0x01e7 0xfff 0xfff 0xfff syscon nr __NR_cpuset_setaffinity 0xfff 0xfff 0xfff 0xfff 0x01e8 0xfff 0xfff 0xfff syscon nr __NR_io_setup 0x00ce 0x0000 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_destroy 0x00cf 0x0001 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_getevents 0x00d0 0x0004 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_submit 0x00d1 0x0002 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_cancel 0x00d2 0x0003 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_lookup_dcookie 0x00d4 0x0012 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_epoll_create 0x00d5 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_epoll_wait 0x00e8 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_epoll_ctl 0x00e9 0x0015 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_getdents 0x00d9 0x003d 0xfff 0xfff 0x0110 0x0063 0x186 0xfff syscon nr __NR_set_tid_address 0x00da 0x0060 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_restart_syscall 0x00db 0x0080 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_semtimedop 0x00dc 0x00c0 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_fadvise 0x00dd 0x00df 0xfff 0xfff 0x0213 0xfff 0xfff 0xfff syscon nr __NR_timer_create 0x00de 0x006b 0xfff 0xfff 0xfff 0xfff 0x0eb 0xfff syscon nr __NR_timer_settime 0x00df 0x006e 0xfff 0xfff 0xfff 0xfff 0x1be 0xfff syscon nr __NR_timer_gettime 0x00e0 0x006c 0xfff 0xfff 0xfff 0xfff 0x1bf 0xfff syscon nr __NR_timer_getoverrun 0x00e1 0x006d 0xfff 0xfff 0xfff 0xfff 0x0ef 0xfff syscon nr __NR_timer_delete 0x00e2 0x006f 0xfff 0xfff 0xfff 0xfff 0x0ec 0xfff syscon nr __NR_clock_settime 0x00e3 0x0070 0xfff 0xfff 0x00e9 0x0058 0x1ac 0xfff syscon nr __NR_clock_gettime 0x00e4 0x0071 0xfff 0xfff 0x00e8 0x0057 0x1ab 0xfff syscon nr __NR_clock_getres 0x00e5 0x0072 0xfff 0xfff 0x00ea 0x0059 0x1ad 0xfff syscon nr __NR_clock_nanosleep 0x00e6 0x0073 0xfff 0xfff 0x00f4 0xfff 0x1dd 0xfff syscon nr __NR_tgkill 0x00ea 0x0083 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_mbind 0x00ed 0x00eb 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_set_mempolicy 0x00ee 0x00ed 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_get_mempolicy 0x00ef 0x00ec 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_mq_open 0x00f0 0x00b4 0xfff 0xfff 0xfff 0xfff 0x101 0xfff syscon nr __NR_mq_unlink 0x00f1 0x00b5 0xfff 0xfff 0xfff 0xfff 0x103 0xfff syscon nr __NR_mq_timedsend 0x00f2 0x00b6 0xfff 0xfff 0xfff 0xfff 0x1b0 0xfff syscon nr __NR_mq_timedreceive 0x00f3 0x00b7 0xfff 0xfff 0xfff 0xfff 0x1b1 0xfff syscon nr __NR_mq_notify 0x00f4 0x00b8 0xfff 0xfff 0xfff 0xfff 0x106 0xfff syscon nr __NR_mq_getsetattr 0x00f5 0x00b9 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_kexec_load 0x00f6 0x0068 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_waitid 0x00f7 0x005f 0x20000ad 0x00ad 0xfff 0xfff 0xfff 0xfff syscon nr __NR_add_key 0x00f8 0x00d9 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_request_key 0x00f9 0x00da 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_keyctl 0x00fa 0x00db 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_ioprio_set 0x00fb 0x001e 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_ioprio_get 0x00fc 0x001f 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_inotify_init 0x00fd 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_inotify_add_watch 0x00fe 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_inotify_rm_watch 0x00ff 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_openat 0x0101 0x0038 0x20001cf 0x01cf 0x01f3 0x0141 0x1d4 0xfff syscon nr __NR_mkdirat 0x0102 0x0022 0x20001db 0x01db 0x01f0 0x013e 0x1cd 0xfff syscon nr __NR_fchownat 0x0104 0x0036 0x20001d4 0x01d4 0x01eb 0x013b 0x1d0 0xfff syscon nr __NR_utime 0x0084 0x0062 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_utimes 0x00eb 0x0058 0x200008a 0x008a 0x008a 0x004c 0x1a4 0xfff syscon nr __NR_futimesat 0x0105 0x0fff 0xfff 0xfff 0x01ee 0xfff 0xfff 0xfff syscon nr __NR_futimes 0xfff 0x0fff 0x200008b 0x008b 0x00ce 0x004d 0x1a7 0xfff syscon nr __NR_futimens 0xfff 0x0fff 0xfff 0xfff 0x0222 0x0055 0x1d8 0xfff syscon nr __NR_fstatat 0x0106 0x004f 0x20001d6 0x01d6 0x0228 0x002a 0x1d2 0xfff syscon nr __NR_unlinkat 0x0107 0x0023 0x20001d8 0x01d8 0x01f7 0x0145 0x1d7 0xfff syscon nr __NR_renameat 0x0108 0x0026 0x20001d1 0x01d1 0x01f5 0x0143 0x1ca 0xfff syscon nr __NR_linkat 0x0109 0x0025 0x20001d7 0x01d7 0x01ef 0x013d 0x1c9 0xfff syscon nr __NR_symlinkat 0x010a 0x0024 0x20001da 0x01da 0x01f6 0x0144 0x1d6 0xfff syscon nr __NR_readlinkat 0x010b 0x004e 0x20001d9 0x01d9 0x01f4 0x0142 0x1d5 0xfff syscon nr __NR_fchmodat 0x010c 0x0035 0x20001d3 0x01d3 0x01ea 0x013a 0x1cf 0xfff syscon nr __NR_faccessat 0x010d 0x0030 0x20001d2 0x01d2 0x01e9 0x0139 0x1ce 0xfff syscon nr __NR_unshare 0x0110 0x0061 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_splice 0x0113 0x004c 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_tee 0x0114 0x004d 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sync_file_range 0x0115 0x0054 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_vmsplice 0x0116 0x004b 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_migrate_pages 0x0100 0x00ee 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_move_pages 0x0117 0x00ef 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_preadv 0x0127 0x0045 0xfff 0xfff 0x0121 0x010b 0x121 0xfff syscon nr __NR_pwritev 0x0128 0x0046 0xfff 0xfff 0x0122 0x010c 0x122 0xfff syscon nr __NR_utimensat 0x0118 0x0058 0xfff 0xfff 0x0223 0x0054 0x1d3 0xfff syscon nr __NR_fallocate 0x011d 0x002f 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_posix_fallocate 0xfff 0xfff 0xfff 0xfff 0x0212 0xfff 0x1df 0xfff syscon nr __NR_accept4 0x0120 0x00f2 0xfff 0xfff 0x021d 0x005d 0xfff 0xfff syscon nr __NR_dup3 0x0124 0x0018 0xfff 0xfff 0xfff 0x0066 0x1c6 0xfff syscon nr __NR_pipe2 0x0125 0x003b 0xfff 0xfff 0x021e 0x0065 0x1c5 0xfff syscon nr __NR_epoll_pwait 0x0119 0x0016 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_epoll_create1 0x0123 0x0014 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_perf_event_open 0x012a 0x00f1 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_inotify_init1 0x0126 0x001a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_tgsigqueueinfo 0x0129 0x00f0 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_signalfd 0x011a 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_signalfd4 0x0121 0x004a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_eventfd 0x011c 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_eventfd2 0x0122 0x0013 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_timerfd_create 0x011b 0x0055 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_timerfd_settime 0x011e 0x0056 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_timerfd_gettime 0x011f 0x0057 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_recvmmsg 0x012b 0x00f3 0xfff 0xfff 0xfff 0xfff 0x1db 0xfff syscon nr __NR_fanotify_init 0x012c 0x0106 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_fanotify_mark 0x012d 0x0107 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_prlimit 0x012e 0x0105 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_name_to_handle_at 0x012f 0x0108 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_open_by_handle_at 0x0130 0x0109 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_clock_adjtime 0x0131 0x010a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_syncfs 0x0132 0x010b 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sendmmsg 0x0133 0x010d 0xfff 0xfff 0xfff 0xfff 0x1dc 0xfff syscon nr __NR_setns 0x0134 0x010c 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_getcpu 0x0135 0x00a8 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_process_vm_readv 0x0136 0x010e 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_process_vm_writev 0x0137 0x010f 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_kcmp 0x0138 0x0110 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_finit_module 0x0139 0x0111 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sched_setattr 0x013a 0x0112 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_sched_getattr 0x013b 0x0113 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_renameat2 0x013c 0x0114 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_seccomp 0x013d 0x0115 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_getrandom 0x013e 0x0116 0x20001f4 0x01f4 0x0233 0x0007 0x05b 0xfff syscon nr __NR_memfd_create 0x013f 0x0117 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_kexec_file_load 0x0140 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_bpf 0x0141 0x0118 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_execveat 0x0142 0x0119 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_userfaultfd 0x0143 0x011a 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_membarrier 0x0144 0x011b 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_mlock2 0x0145 0x011c 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_copy_file_range 0x0146 0x011d 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_preadv2 0x0147 0x011e 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pwritev2 0x0148 0x011f 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pkey_mprotect 0x0149 0x0120 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pkey_alloc 0x014a 0x0121 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pkey_free 0x014b 0x0122 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_statx 0x014c 0x0123 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_pgetevents 0x014d 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_rseq 0x014e 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pidfd_send_signal 0x01a8 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_uring_setup 0x01a9 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_uring_enter 0x01aa 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_io_uring_register 0x01ab 0x0fff 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff syscon nr __NR_pledge 0xfff 0xfff 0xfff 0xfff 0xfff 0x006c 0xfff 0xfff syscon nr __NR_msyscall 0xfff 0xfff 0xfff 0xfff 0xfff 0x0025 0xfff 0xfff syscon nr __NR_ktrace 0xfff 0xfff 0xfff 0xfff 0x002d 0x002d 0x02d 0xfff # unilateral undocumented errnos # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon junkerr ECHRNG 44 44 -1 -1 -1 -1 -1 -1 syscon junkerr EL2NSYNC 45 45 -1 -1 -1 -1 -1 -1 syscon junkerr EL3HLT 46 46 -1 -1 -1 -1 -1 -1 syscon junkerr EL3RST 47 47 -1 -1 -1 -1 -1 -1 syscon junkerr ELNRNG 48 48 -1 -1 -1 -1 -1 -1 syscon junkerr EUNATCH 49 49 -1 -1 -1 -1 -1 -1 syscon junkerr ENOCSI 50 50 -1 -1 -1 -1 -1 -1 syscon junkerr EL2HLT 51 51 -1 -1 -1 -1 -1 -1 syscon junkerr EBADE 52 52 -1 -1 -1 -1 -1 -1 syscon junkerr EBADR 53 53 -1 -1 -1 -1 -1 -1 syscon junkerr EXFULL 54 54 -1 -1 -1 -1 -1 -1 syscon junkerr ENOANO 55 55 -1 -1 -1 -1 -1 -1 syscon junkerr EBADRQC 56 56 -1 -1 -1 -1 -1 -1 syscon junkerr EBADSLT 57 57 -1 -1 -1 -1 -1 -1 syscon junkerr ENOPKG 65 65 -1 -1 -1 -1 -1 -1 syscon junkerr EADV 68 68 -1 -1 -1 -1 -1 -1 syscon junkerr ESRMNT 69 69 -1 -1 -1 -1 -1 -1 syscon junkerr ECOMM 70 70 -1 -1 -1 -1 -1 -1 syscon junkerr EDOTDOT 73 73 -1 -1 -1 -1 -1 -1 syscon junkerr ENOTUNIQ 76 76 -1 -1 -1 -1 -1 -1 syscon junkerr EREMCHG 78 78 -1 -1 -1 -1 -1 -1 syscon junkerr ELIBACC 79 79 -1 -1 -1 -1 -1 -1 syscon junkerr ELIBBAD 80 80 -1 -1 -1 -1 -1 -1 syscon junkerr ELIBSCN 81 81 -1 -1 -1 -1 -1 -1 syscon junkerr ELIBMAX 82 82 -1 -1 -1 -1 -1 -1 syscon junkerr ELIBEXEC 83 83 -1 -1 -1 -1 -1 -1 syscon junkerr ESTRPIPE 86 86 -1 -1 -1 -1 -1 -1 syscon junkerr EUCLEAN 117 117 -1 -1 -1 -1 -1 -1 syscon junkerr ENOTNAM 118 118 -1 -1 -1 -1 -1 -1 syscon junkerr ENAVAIL 119 119 -1 -1 -1 -1 -1 -1 syscon junkerr EISNAM 120 120 -1 -1 -1 -1 -1 -1 syscon junkerr EREMOTEIO 121 121 -1 -1 -1 -1 -1 -1 syscon junkerr ENOKEY 126 126 -1 -1 -1 -1 -1 -1 syscon junkerr EKEYEXPIRED 127 127 -1 -1 -1 -1 -1 -1 syscon junkerr EKEYREVOKED 128 128 -1 -1 -1 -1 -1 -1 syscon junkerr EKEYREJECTED 129 129 -1 -1 -1 -1 -1 -1 syscon junkerr ERFKILL 132 132 -1 -1 -1 -1 -1 -1 syscon junkerr EHWPOISON 133 133 -1 -1 -1 -1 -1 -1 # arpanet fork combating human-induced exhaustion of our ipv4 address space # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ipv6 IPV6_PMTUDISC_DONT 0 0 0 0 0 0 0 0 # consensus syscon ipv6 IPV6_RTHDR_LOOSE 0 0 0 0 0 0 0 0 # consensus syscon ipv6 IPV6_RTHDR_TYPE_0 0 0 0 0 0 0 0 0 # consensus syscon ipv6 IPV6_CHECKSUM 7 7 26 26 26 26 26 26 # bsd consensus syscon ipv6 IPV6_JOIN_GROUP 20 20 12 12 12 12 12 12 # bsd consensus syscon ipv6 IPV6_LEAVE_GROUP 21 21 13 13 13 13 13 13 # bsd consensus syscon ipv6 IPV6_MULTICAST_HOPS 18 18 10 10 10 10 10 10 # bsd consensus syscon ipv6 IPV6_MULTICAST_IF 17 17 9 9 9 9 9 9 # bsd consensus syscon ipv6 IPV6_MULTICAST_LOOP 19 19 11 11 11 11 11 11 # bsd consensus syscon ipv6 IPV6_UNICAST_HOPS 0x10 0x10 4 4 4 4 4 4 # bsd consensus syscon ipv6 IPV6_V6ONLY 26 26 27 27 27 27 27 27 # bsd consensus syscon ipv6 IPV6_RECVTCLASS 66 66 35 35 57 57 57 40 syscon ipv6 IPV6_TCLASS 67 67 36 36 61 61 61 39 syscon ipv6 IPV6_DONTFRAG 62 62 0 0 62 62 62 14 syscon ipv6 IPV6_HOPLIMIT 52 52 0 0 47 47 47 21 syscon ipv6 IPV6_HOPOPTS 54 54 0 0 49 49 49 1 syscon ipv6 IPV6_PKTINFO 50 50 0 0 46 46 46 19 syscon ipv6 IPV6_RECVRTHDR 56 56 0 0 38 38 38 38 syscon ipv6 IPV6_RTHDR 57 57 0 0 51 51 51 0x20 syscon ipv6 IPV6_DSTOPTS 59 59 0 0 50 50 50 0 syscon ipv6 IPV6_IPSEC_POLICY 34 34 28 28 28 0 0 0 syscon ipv6 IPV6_NEXTHOP 9 9 0 0 48 48 48 0 syscon ipv6 IPV6_PATHMTU 61 61 0 0 44 44 44 0 syscon ipv6 IPV6_RECVDSTOPTS 58 58 0 0 40 40 40 0 syscon ipv6 IPV6_RECVHOPLIMIT 51 51 0 0 37 37 37 0 syscon ipv6 IPV6_RECVHOPOPTS 53 53 0 0 39 39 39 0 syscon ipv6 IPV6_RECVPATHMTU 60 60 0 0 43 43 43 0 syscon ipv6 IPV6_RECVPKTINFO 49 49 0 0 36 36 36 0 syscon ipv6 IPV6_RTHDRDSTOPTS 55 55 0 0 35 35 35 0 syscon ipv6 IPV6_RTHDR_STRICT 1 1 1 1 1 0 0 0 syscon ipv6 IPV6_ADD_MEMBERSHIP 20 20 0 0 0 0 0 12 # bsd consensus syscon ipv6 IPV6_DROP_MEMBERSHIP 21 21 0 0 0 0 0 13 # bsd consensus syscon ipv6 IPV6_HDRINCL 36 36 0 0 0 0 0 2 # bsd consensus syscon ipv6 IPV6_MTU 24 24 0 0 0 0 0 72 # bsd consensus syscon ipv6 IPV6_MTU_DISCOVER 23 23 0 0 0 0 0 71 # bsd consensus syscon ipv6 IPV6_RECVERR 25 25 0 0 0 0 0 75 # bsd consensus syscon ipv6 IPV6_2292DSTOPTS 4 4 23 23 0 0 0 0 syscon ipv6 IPV6_2292HOPLIMIT 8 8 20 20 0 0 0 0 syscon ipv6 IPV6_2292HOPOPTS 3 3 22 22 0 0 0 0 syscon ipv6 IPV6_2292PKTINFO 2 2 19 19 0 0 0 0 syscon ipv6 IPV6_2292PKTOPTIONS 6 6 25 25 0 0 0 0 syscon ipv6 IPV6_2292RTHDR 5 5 24 24 0 0 0 0 syscon ipv6 IPV6_AUTOFLOWLABEL 0 0 0 0 59 59 59 0 syscon ipv6 IPV6_ADDRFORM 1 1 0 0 0 0 0 0 syscon ipv6 IPV6_AUTHHDR 10 10 0 0 0 0 0 0 syscon ipv6 IPV6_JOIN_ANYCAST 27 27 0 0 0 0 0 0 syscon ipv6 IPV6_LEAVE_ANYCAST 28 28 0 0 0 0 0 0 syscon ipv6 IPV6_PMTUDISC_DO 2 2 0 0 0 0 0 0 syscon ipv6 IPV6_PMTUDISC_INTERFACE 4 4 0 0 0 0 0 0 syscon ipv6 IPV6_PMTUDISC_OMIT 5 5 0 0 0 0 0 0 syscon ipv6 IPV6_PMTUDISC_PROBE 3 3 0 0 0 0 0 0 syscon ipv6 IPV6_PMTUDISC_WANT 1 1 0 0 0 0 0 0 syscon ipv6 IPV6_ROUTER_ALERT 22 22 0 0 0 0 0 0 syscon ipv6 IPV6_RXDSTOPTS 59 59 0 0 0 0 0 0 syscon ipv6 IPV6_RXHOPOPTS 54 54 0 0 0 0 0 0 syscon ipv6 IPV6_XFRM_POLICY 35 35 0 0 0 0 0 0 syscon ipv6 IPV6_MINHOPCOUNT 0 0 0 0 0 65 65 0 syscon ipv6 IPV6_ORIGDSTADDR 0 0 0 0 72 0 0 0 syscon ipv6 IPV6_RECVORIGDSTADDR 0 0 0 0 72 0 0 0 syscon ipv6 INET6_ADDRSTRLEN 46 46 46 46 46 46 46 65 # unix consensus syscon icmp6 ICMP6_DST_UNREACH_NOROUTE 0 0 0 0 0 0 0 0 # consensus syscon icmp6 ICMP6_PARAMPROB_HEADER 0 0 0 0 0 0 0 0 # consensus syscon icmp6 ICMP6_TIME_EXCEED_TRANSIT 0 0 0 0 0 0 0 0 # consensus syscon icmp6 ICMP6_DST_UNREACH_ADMIN 1 1 1 1 1 1 1 1 # consensus syscon icmp6 ICMP6_PARAMPROB_NEXTHEADER 1 1 1 1 1 1 1 1 # consensus syscon icmp6 ICMP6_TIME_EXCEED_REASSEMBLY 1 1 1 1 1 1 1 1 # consensus syscon icmp6 ICMP6_DST_UNREACH 1 1 1 1 1 1 1 0 # unix consensus syscon icmp6 ICMP6_FILTER 1 1 18 18 18 18 18 0 # bsd consensus syscon icmp6 ICMP6_DST_UNREACH_BEYONDSCOPE 2 2 2 2 2 2 2 2 # consensus syscon icmp6 ICMP6_PARAMPROB_OPTION 2 2 2 2 2 2 2 2 # consensus syscon icmp6 ICMP6_PACKET_TOO_BIG 2 2 2 2 2 2 2 0 # unix consensus syscon icmp6 ICMP6_DST_UNREACH_ADDR 3 3 3 3 3 3 3 3 # consensus syscon icmp6 ICMP6_TIME_EXCEEDED 3 3 3 3 3 3 3 0 # unix consensus syscon icmp6 ICMP6_DST_UNREACH_NOPORT 4 4 4 4 4 4 4 4 # consensus syscon icmp6 ICMP6_PARAM_PROB 4 4 4 4 4 4 4 0 # unix consensus syscon icmp6 ICMP6_RR_FLAGS_PREVDONE 8 8 8 8 8 8 8 0 # unix consensus syscon icmp6 ICMP6_RR_FLAGS_SPECSITE 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0 # unix consensus syscon icmp6 ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 0x10 0x40 0x40 0x40 0x40 0x40 0 # bsd consensus syscon icmp6 ICMP6_RR_FLAGS_FORCEAPPLY 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0 # unix consensus syscon icmp6 ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 0x20 0x80 0x80 0x80 0x80 0x80 0 # bsd consensus syscon icmp6 ICMP6_RR_FLAGS_REQRESULT 0x40 0x40 0x40 0x40 0x40 0x40 0x40 0 # unix consensus syscon icmp6 ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 0x40 0x40 0x40 0x40 0x40 0x40 0 # unix consensus syscon icmp6 ICMP6_INFOMSG_MASK 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 # consensus syscon icmp6 ICMP6_ECHO_REQUEST 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0 # unix consensus syscon icmp6 ICMP6_RR_FLAGS_TEST 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0 # unix consensus syscon icmp6 ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0 # unix consensus syscon icmp6 ICMP6_ECHO_REPLY 129 129 129 129 129 129 129 0 # unix consensus syscon icmp6 ICMP6_ROUTER_RENUMBERING 138 138 138 138 138 138 138 0 # unix consensus syscon icmp6 ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus syscon icmp6 ICMP6_RR_RESULT_FLAGS_OOB 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus syscon misc FIFOTYPE 54 54 54 54 54 54 54 0 # unix consensus syscon misc GRPQUOTA 1 1 1 1 1 1 1 0 # unix consensus syscon misc IF_NAMESIZE 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0 # unix consensus syscon misc INTERMEDIATE_C_GOOD 10 10 0 0 0 0 0 0 syscon misc INTERMEDIATE_GOOD 8 8 0 0 0 0 0 0 syscon misc IOV_MAX 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 16 # unix consensus & MSG_MAXIOVLEN syscon misc LINE_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus syscon misc LINKED_CMD_COMPLETE 10 10 0 0 0 0 0 0 syscon misc LINKED_FLG_CMD_COMPLETE 11 11 0 0 0 0 0 0 syscon misc LNKTYPE 49 49 49 49 49 49 49 0 # unix consensus syscon misc MAXNAMLEN 255 255 255 255 255 255 255 0 # unix consensus syscon misc MAXQUOTAS 2 2 2 2 2 2 2 0 # unix consensus syscon misc MEDIUM_ERROR 3 3 0 0 0 0 0 0 syscon misc MEDIUM_SCAN 56 56 0 0 0 0 0 0 syscon misc NBBY 8 8 8 8 8 8 8 0 # unix consensus syscon misc NR_DQHASH 43 43 0 0 0 0 0 0 syscon misc NR_DQUOTS 0x0100 0x0100 0 0 0 0 0 0 syscon misc PERSISTENT_RESERVE_IN 94 94 0 0 0 0 0 0 syscon misc PERSISTENT_RESERVE_OUT 95 95 0 0 0 0 0 0 syscon misc PRELIM 1 1 1 1 1 1 1 0 # unix consensus syscon misc REGTYPE 48 48 48 48 48 48 48 0 # unix consensus syscon misc RES_PRF_CLASS 4 4 4 4 4 4 4 0 # unix consensus syscon misc RHF_GUARANTEE_START_INIT 0x80 0x80 0 0 0 0 0 0 syscon misc RHF_NO_LIBRARY_REPLACEMENT 4 4 0 0 0 0 0 0 syscon misc RRQ 1 1 1 1 1 1 1 0 # unix consensus syscon misc RTF_NOFORWARD 0x1000 0x1000 0 0 0 0 0 0 syscon misc RTF_NOPMTUDISC 0x4000 0x4000 0 0 0 0 0 0 syscon misc SARMAG 8 8 8 8 8 8 8 0 # unix consensus syscon misc SEGSIZE 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus syscon misc SEND_DIAGNOSTIC 29 29 0 0 0 0 0 0 syscon misc SEND_VOLUME_TAG 182 182 0 0 0 0 0 0 syscon misc SET_LIMITS 51 51 0 0 0 0 0 0 syscon misc SET_WINDOW 36 36 0 0 0 0 0 0 syscon misc SFD_CLOEXEC 0x080000 0x080000 0 0 0 0 0 0 syscon misc SFD_NONBLOCK 0x0800 0x0800 0 0 0 0 0 0 syscon misc SUBCMDMASK 255 255 255 255 255 255 255 0 # unix consensus syscon misc SUBCMDSHIFT 8 8 8 8 8 8 8 0 # unix consensus syscon misc SYMTYPE 50 50 50 50 50 50 50 0 # unix consensus syscon misc TGEXEC 8 8 8 8 8 8 8 0 # unix consensus syscon misc TGREAD 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0 # unix consensus syscon misc TGWRITE 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0 # unix consensus syscon misc TMAGLEN 6 6 6 6 6 6 6 0 # unix consensus syscon misc TOEXEC 1 1 1 1 1 1 1 0 # unix consensus syscon misc TOREAD 4 4 4 4 4 4 4 0 # unix consensus syscon misc TOWRITE 2 2 2 2 2 2 2 0 # unix consensus syscon misc TRANSIENT 4 4 4 4 4 4 4 0 # unix consensus syscon misc TSGID 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 0 # unix consensus syscon misc TSUID 0x0800 0x0800 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus syscon misc TSVTX 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus syscon misc TUEXEC 0x40 0x40 0x40 0x40 0x40 0x40 0x40 0 # unix consensus syscon misc TUREAD 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus syscon misc TUWRITE 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0 # unix consensus syscon misc TVERSLEN 2 2 2 2 2 2 2 0 # unix consensus syscon misc WORD_BIT 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0 # unix consensus syscon misc WRQ 2 2 2 2 2 2 2 0 # unix consensus syscon misc SIGEV_THREAD 2 2 3 3 2 0 2 0 syscon misc SIGEV_SIGNAL 0 0 1 1 1 0 1 0 syscon misc SIGEV_NONE 1 1 0 0 0 0 0 0 syscon misc BC_BASE_MAX 99 99 99 99 99 0x7fffffff 0x7fffffff 0 syscon misc BC_DIM_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0xffff 0xffff 0 syscon misc BC_SCALE_MAX 99 99 99 99 99 0x7fffffff 0x7fffffff 0 syscon misc BC_STRING_MAX 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 0x7fffffff 0x7fffffff 0 syscon misc ABORTED_COMMAND 11 11 0 0 0 0 0 0 syscon misc ACORE 0 0 8 8 8 8 8 0 # bsd consensus syscon misc AFORK 0 0 1 1 1 1 1 0 # bsd consensus syscon misc AIO_ALLDONE 2 2 1 1 3 0 0 0 syscon misc AIO_NOTCANCELED 1 1 4 4 2 0 0 0 syscon misc AIO_CANCELED 0 0 2 2 1 0 0 0 # baud rates # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon baud B0 0 0 0 0 0 0 0 0 syscon baud B50 1 1 50 50 50 50 50 50 syscon baud B75 2 2 75 75 75 75 75 75 syscon baud B110 3 3 110 110 110 110 110 110 syscon baud B134 4 4 134 134 134 134 134 134 syscon baud B150 5 5 150 150 150 150 150 150 syscon baud B200 6 6 200 200 200 200 200 200 syscon baud B300 7 7 300 300 300 300 300 300 syscon baud B600 8 8 600 600 600 600 600 600 syscon baud B1200 9 9 1200 1200 1200 1200 1200 1200 syscon baud B1800 10 10 1800 1800 1800 1800 1800 1800 syscon baud B2400 11 11 2400 2400 2400 2400 2400 2400 syscon baud B4800 12 12 4800 4800 4800 4800 4800 4800 syscon baud B9600 13 13 9600 9600 9600 9600 9600 9600 syscon baud B19200 14 14 19200 19200 19200 19200 19200 19200 syscon baud B38400 15 15 38400 38400 38400 38400 38400 38400 syscon baud B57600 0x1001 0x1001 57600 57600 57600 57600 57600 57600 syscon baud B115200 0x1002 0x1002 115200 115200 115200 115200 115200 115200 syscon baud B230400 0x1003 0x1003 230400 230400 230400 230400 230400 230400 syscon baud B500000 0x1005 0x1005 500000 500000 500000 500000 500000 500000 syscon baud B576000 0x1006 0x1006 576000 576000 576000 576000 576000 576000 syscon baud B1000000 0x1008 0x1008 1000000 1000000 1000000 1000000 1000000 1000000 syscon baud B1152000 0x1009 0x1009 1152000 1152000 1152000 1152000 1152000 1152000 syscon baud B1500000 0x100a 0x100a 1500000 1500000 1500000 1500000 1500000 1500000 syscon baud B2000000 0x100b 0x100b 2000000 2000000 2000000 2000000 2000000 2000000 syscon baud B2500000 0x100c 0x100c 2500000 2500000 2500000 2500000 2500000 2500000 syscon baud B3000000 0x100d 0x100d 3000000 3000000 3000000 3000000 3000000 3000000 syscon baud B3500000 0x100e 0x100e 3500000 3500000 3500000 3500000 3500000 3500000 syscon baud B4000000 0x100f 0x100f 4000000 4000000 4000000 4000000 4000000 4000000 syscon misc WEOF 0xffffffff 0xffffffff -1 -1 -1 -1 -1 -1 # bsd consensus (win fake) syscon misc _LINUX_QUOTA_VERSION 2 2 0 0 0 0 0 0 syscon misc _SEM_SEMUN_UNDEFINED 1 1 0 0 0 0 0 0 syscon misc D_FMT 0x020029 0x020029 2 2 2 1 1 0 syscon misc D_T_FMT 0x020028 0x020028 1 1 1 0 0 0 syscon misc LOGIN_PROCESS 6 6 6 6 6 0 0 0 syscon misc LOGIN_NAME_MAX 0x0100 0x0100 0 0 0 0x20 0x20 0 syscon misc T_FMT 0x02002a 0x02002a 3 3 3 2 2 0 syscon misc T_FMT_AMPM 0x02002b 0x02002b 4 4 4 3 3 0 syscon misc UL_GETFSIZE 1 1 1 1 1 0 0 0 syscon misc UL_SETFSIZE 2 2 2 2 2 0 0 0 syscon misc XATTR_CREATE 1 1 2 2 0 0 0 0 syscon misc XATTR_REPLACE 2 2 4 4 0 0 0 0 # https://youtu.be/GUQUD3IMbb4?t=85
231,695
2,387
jart/cosmopolitan
false
cosmopolitan/libc/sysv/errfun2.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2023 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #ifndef __x86_64__ long __errfun(int e) { errno = e; return -1; } #endif /* __x86_64__ */
1,956
28
jart/cosmopolitan
false
cosmopolitan/libc/sysv/systemfive.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 sw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/strace.internal.h" #include "libc/dce.h" #include "libc/macros.internal.h" #include "libc/nexgen32e/macros.h" #include "libc/sysv/consts/sig.h" #include "libc/thread/posixthread.internal.h" #include "libc/sysv/consts/nr.h" #define SIG_IGN 1 /* ▄▄▄ ▄▄▄ ▀▓▓▒▄ ▄▓▒▒░ ▀▓▒▒▒▄ ▄▓▓▓▒▀ ▄▄▄▄ ▒▓▒▒░▒▄ ▄▓▓▓▒▓ ▄▄▓██▓▓▓▓▒▒▒▒▓▓▄▄▓▓▒▒▒░░▒ ▓▓▓▓▒▒▒▄▄ ░▒█▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▓▒░░▒░ ██▓▓▓▒▒░░▒▒▒▒▓▓▓▓▓▓▒▓▒░▒▒░▀▒▒▒▒░▀░▒▒▒░▒ ▓▓▓▓▓▓▓▒▒▒▒▒▒▓▓▒▓▓▒▒▒░▒▒░░ ░▒▒░ ░▒▒▒▒ ▀▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░▒░░ ░▒▒ ░ ▀▒▒ ▀▓▓█▓▓▓▓▓▓▓▓▓▓▒▒░░▒▒░░ ░░░▓░ ▓░░░▒ ▀▀█▓███▓▓▓▓▓▒▒░░░▒░░ ░█▓░█▓░█▓▓▄▒░ ░▓██▓▓▓▓▓▒▒░░░▒░░ ░████▓▒▓█▓▀░▀▄ ░▓██▓▓▓▓▓▒▒▒░░░▒░░ ▒██▓▒▒▒▒▒▒░░░▒ ████▓▓▓▓▓▒▒▒▒▒▒▒▒▒░░▒▓▓▒░░░░▒░░░▒░ ░░░░░ ░▓███▓▓▓▓▓▒▒░░░░░░░▒▒▒▒▒▒▒▒▒▒▒░░░ ░░░░░ ░ ▓███▓▓▓▓▓▒▓▒▒▒▒░░░░░░░░░▒▓▒▒░▀ ░░░ ░░░░░ ▀▒██▓▓▓▓▒▒▒▓▓▓▓▒▒▒▒▒▒▒▓▀▀░ ░░░░░░░░░ ░ ▓▓▓▓▓▓▓▒▓▒▒▒▒▓▓▓▒▀░ ░░░░░▄░░░ ░░░ ░░░░░░ ▓▓▓▒▒▒▒▒▒▒▒▒▒▒▓ █▓▒░░▒░░░░ ░░░░░░░░ ▄▓▓▓▒▒▒▒▒░░░░░░░▒▄▄▄░▒▓▓▒▒░▀░ ░▓█▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒░░░▒ besiyata ▓▓█▓▓▒▓▓▓▒▒▒░░░░░░▒▓▓▓▓▒▒▒▒▒░ dishmaya ▓▓█▓▓▓▓▓▓▒▒▒░░░░░░░▒▓▓▒▀▀▀ ▓▓██▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▀ █▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▀ ▒▓▓▓▓▀░░▒▓▓▓▓▓▓▓▓▒▒░░▒ ▄▓▓▀░░░▄▓▓▓▓▒▒▒▒▒░░░░▄░ ▄███▄▄▓▓▓▓▓▓▓▒▒▒▒▒░░▒▒░ ▄▓▓▓█▓█▓▓███▓▓▓▓▓▓▓▓▓▓▓░ ▄░▓▓▓▓▓▓▀▒▓▓▓▒▒▓▒░░░▒▓▒░░░▓ ▄▄▄░▒▓▓▓▓▓▓░▀▀ ▓▓▒░▓▒▒▒▒▒▒▒▒▒▒▄░░▀▀░░ ▄▄▄▄ ▄▄▄▒▒▓▓█▓▓▓▓▓▀▀▀▀▀ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▀░░▀░░▒▒▒░░░ ░░░░░ ▄▓▓▓▒▀▀ ▓▒▓▓▓▓▓▒▒▒▒▒▒▒▒▓░░░ ▒▒▒░░░░░░░░▒ █▓▓▒ ▄▄▄ ▀▓▒▓▒▒▒▓▓▓▓▓▓▒▒▒░░░░░░░░░▒▒░░░░░░░ ▀▓▓▓▓▒▄▄▒▒▒▒▒▒▄▄ ▀▀▀▀░░▒▒▒▒░░░░░░ ▀▀▀▓▓▓▓▒▒▒▒▒▓▓▄▄ ╔────────────────────────────────────────────────────────────────────────────│─╗ │ cosmopolitan § bell system five » system call support ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ .initbss 300,_init_systemfive // Performs System Five System Call. // // Cosmopolitan is designed to delegate all function calls into the // Linux, FreeBSD, OpenBSD, and XNU kernels via this function, with // few exceptions. This function should generally only be called by // generated thunks in the libc/sysv/syscalls/ directory. // // It's safe to call this function on Windows, where it will always // return -1 with errno == ENOSYS. Further note that -1 is the only // return value that means error, a common anti-pattern is to check // for values less than 0 (which is more problematic on 32-bit). // // It is important to consider that system calls are one order of a // magnitude more expensive than normal function calls. For example // getpid() on Linux usually takes 500ns, and cached i/o calls will // take 1µs or more. So we don't need to inline them like Chromium. // // Another thing to consider is that BSDs only loosely follow the // System Five ABI for the SYSCALL instruction. For example Linux // always follows the six argument limit but the FreeBSD sendfile // system call accepts a seventh argument that is passed on stack // and OpenBSD modifies functions like mmap so that the sixth arg // is passed on the stack. There's also the carry flag convention // that XNU, FreeBSD, and OpenBSD inherited from 386BSD aka Jolix // // @param %rax function ordinal supplied by jump slot // @param %rdi,%rsi,%rdx,%rcx,%r8,%r9 and rest on stack // @return %rax:%rdx is result, or -1 w/ errno on error // @clob %rcx,%r10,%r11 // @see syscalls.sh __systemfive: .quad 0 .endobj __systemfive,globl,hidden __pid: .quad 0 .endobj __pid,globl,hidden .previous systemfive_cp: push %rbp mov %rsp,%rbp // so backtraces work systemfive_cancellable: // our pthread_cancel() miracle code cmpb $0,__tls_enabled(%rip) // inspired by the musl libc design! je 1f // we handle linux and bsd together! mov %fs:0,%r10 // CosmoTib::tib_self mov 0x28(%r10),%r10 // CosmoTib::tib_pthread test %r10,%r10 // is it a posix thread? jz 1f // it's spawn() probably testb $PT_NOCANCEL,0x00(%r10) // PosixThread::flags jnz 1f // canceler no cancelling #if IsModeDbg() testb $PT_INCANCEL,0x00(%r10) jz 5f #endif cmp $0,0x04(%r10) // PosixThread::cancelled jne systemfive_cancel // we will tail call below 1: mov %rcx,%r10 // move the fourth argument clc // no cancellable system calls exist syscall // that have 7+ args on the bsd OSes systemfive_cancellable_end: // i/o calls park here for long time pop %rbp jnc 2f neg %rax // turns bsd errno to system v errno 2: cmp $-4095,%rax // but we still check again on eintr jae 3f // branch because system call failed ret // done if the system call succeeded 3: neg %eax // now examine the nature of failure cmp EINTR(%rip),%eax // did the SIGTHR cancel our IO call jne systemfive_errno // werent interrupted by OnSigCancel cmpb $0,__tls_enabled(%rip) // make sure it's safe to grab %fs:0 je systemfive_errno // tls is disabled we can't continue mov %fs:0,%rcx // CosmoTib::tib_self mov 0x28(%rcx),%rcx // CosmoTib::tib_pthread test %rcx,%rcx // is it a posix thread? jz systemfive_errno // it's spawn() probably testb $PT_NOCANCEL,0x00(%rcx) // PosixThread::flags jnz systemfive_errno // cancellation is disabled cmp $0,0x04(%rcx) // PosixThread::cancelled je systemfive_errno // we aren't actually cancelled jmp 4f // now we are in fact cancelled systemfive_cancel: // SIGTHR will jump here too pop %rbp 4: jmp _pthread_cancel_sys // tail call .weak _pthread_cancel_sys // must be linked if we're cancelled #if IsModeDbg() not_a_cancellation_point: // need BEGIN/END_CANCELLATION_POINT nop .weak report_cancellation_point 5: ezlea report_cancellation_point,cx test %rcx,%rcx jz 6f call *%rcx 6: ud2 nop #endif .globl systemfive_cancellable_end .globl systemfive_cancellable .globl systemfive_cancel .endfn systemfive_cp .Lanchorpoint: #if SupportsLinux() || SupportsMetal() systemfive_linux: and $0xfff,%eax // remove nonlinux bits from ordinal cmp $0xfff,%eax // checks if unsupported by platform je systemfive_enosys // never taken branches cost nothing btr $11,%eax // 0x800 means a call is cancellable jc systemfive_cp // it is handled by the holiest code mov %rcx,%r10 // syscall instruction clobbers %rcx push %rbp // linux never reads args from stack mov %rsp,%rbp // having frame will help backtraces syscall // this is known as a context switch pop %rbp // next we check to see if it failed cmp $-4095,%rax // system five nexgen32e abi § a.2.1 jae systemfive_error // encodes errno as neg return value ret .endfn systemfive_linux,globl,hidden systemfive_error: neg %eax // 𝑠𝑙𝑖𝑑𝑒 .endfn systemfive_error,globl,hidden #endif systemfive_errno: xchg %eax,%ecx .errno mov %ecx,(%rax) // normalize to c library convention push $-1 // negative one is only error result pop %rax // the push pop is to save code size ret .endfn systemfive_errno,globl,hidden systemfive_enosys: mov ENOSYS(%rip),%eax jmp systemfive_errno .endfn systemfive_enosys,globl,hidden #if SupportsNetbsd() systemfive_netbsd: shr $4*13,%rax jmp systemfive_bsdscrub .endfn systemfive_netbsd,globl,hidden #endif #if SupportsOpenbsd() systemfive_openbsd: shr $4*10,%rax jmp systemfive_bsdscrub .endfn systemfive_openbsd,globl,hidden #endif #if SupportsFreebsd() systemfive_freebsd: shr $4*7,%rax movzwl %ax,%eax // 𝑠𝑙𝑖𝑑𝑒 .endfn systemfive_freebsd,globl,hidden #endif #if SupportsBsd() systemfive_bsdscrub: and $0xfff,%eax // 𝑠𝑙𝑖𝑑𝑒 .endfn systemfive_bsdscrub,globl,hidden systemfive_bsd: cmp $0xfff,%ax je systemfive_enosys btr $11,%eax // checks/reset the 800 cancellable bit jc systemfive_cp mov %rcx,%r10 syscall // bsd will need arg on stack sometimes jc systemfive_errno // bsd sets carry flag if %rax is errno ret .endfn systemfive_bsd #endif #if SupportsXnu() systemfive_xnu: // 0x?????????2153??? // how syscalls.sh encodes xnu ordinals // │└┴┴┐ // │ ├┬┐ // 0x0000000002000153 // how xnu wants ordinals to be encoded mov %eax,%r11d and $0x0f000000,%r11d shl $8,%eax shr $20,%eax or %r11d,%eax jmp systemfive_bsd .endfn systemfive_xnu,globl,hidden #endif .previous // Initializes System Five system call support. // // (1) Extracts parameters passed by kernel // (2) Detects OS without issuing system calls // (3) Unpacks magnums from libc/sysv/consts.sh // (4) Replaces stack with one we control // // @param %r15 is auxv // @note OpenBSD devs: let us know if you start using auxv .init.start 300,_init_systemfive push %rbx push %rsi // Detect the operating system. mov __hostos(%rip),%eax #if SupportsWindows() || SupportsXnu() || SupportsFreebsd() // set by libc/ape.S for XNU // set by libc/crt/crt.S for XNU/FreeBSD // set by libc/nt/winmain.greg.c for New Technology test %eax,%eax jnz _init_systemfive_detected // os is already known #endif #if SupportsOpenbsd() cmpq $0,(%r15) // OpenBSD has no auxv jnz 0f mov $_HOSTOPENBSD,%al jmp _init_systemfive_detected 0: #endif #if SupportsNetbsd() xor %ecx,%ecx 0: cmpq $2014,(%r15,%rcx,8) // NetBSD's AT_EXECFN jne 1f mov $_HOSTNETBSD,%al jmp _init_systemfive_detected 1: cmpq $0,(%r15,%rcx,8) lea 2(%ecx),%ecx jnz 0b 2: #endif mov $_HOSTLINUX,%al _init_systemfive_detected: mov %eax,__hostos(%rip) bsr %eax,%eax mov $_init_systemfive_jmptab,%ebx movzbl (%rbx,%rax),%eax lea (%rbx,%rax),%eax jmp *%rax _init_systemfive_jmptab: .byte _init_systemfive_linux-_init_systemfive_jmptab .byte _init_systemfive_metal-_init_systemfive_jmptab .byte _init_systemfive_windows-_init_systemfive_jmptab .byte _init_systemfive_xnu-_init_systemfive_jmptab .byte _init_systemfive_openbsd-_init_systemfive_jmptab .byte _init_systemfive_freebsd-_init_systemfive_jmptab .byte _init_systemfive_netbsd-_init_systemfive_jmptab .endobj _init_systemfive_jmptab _init_systemfive_linux: #if SupportsLinux() pushb systemfive_linux-.Lanchorpoint mov $syscon_linux,%esi jmp _init_systemfive_os #endif .endfn _init_systemfive_linux _init_systemfive_metal: #if SupportsMetal() pushb systemfive_enosys-.Lanchorpoint mov $syscon_linux,%esi jmp _init_systemfive_os #endif .endfn _init_systemfive_metal _init_systemfive_windows: #if SupportsWindows() pushb systemfive_enosys-.Lanchorpoint mov $syscon_windows,%esi jmp _init_systemfive_os #endif .endfn _init_systemfive_windows _init_systemfive_xnu: #if SupportsXnu() pushb systemfive_xnu-.Lanchorpoint mov $syscon_xnu,%esi jmp _init_systemfive_os #endif .endfn _init_systemfive_xnu _init_systemfive_openbsd: #if SupportsOpenbsd() pushb systemfive_openbsd-.Lanchorpoint mov $syscon_openbsd,%esi jmp _init_systemfive_os #endif .endfn _init_systemfive_openbsd _init_systemfive_freebsd: #if SupportsFreebsd() pushb systemfive_freebsd-.Lanchorpoint mov $syscon_freebsd,%esi jmp _init_systemfive_os #endif .endfn _init_systemfive_freebsd _init_systemfive_netbsd: #if SupportsNetbsd() pushb systemfive_netbsd-.Lanchorpoint mov $syscon_netbsd,%esi // 𝑠𝑙𝑖𝑑𝑒 #endif .endfn _init_systemfive_netbsd _init_systemfive_os: pop %rax add $.Lanchorpoint,%eax stosq #→ __systemfive // 𝑠𝑙𝑖𝑑𝑒 .endfn _init_systemfive_os _init_systemfive_magnums: push %rdi mov $syscon_start,%edi 2: cmp $syscon_end,%edi jnb 5f xor %ebx,%ebx xor %ecx,%ecx xor %edx,%edx 3: lodsb // decodes uleb128 movzbl %al,%edx and $127,%dl shl %cl,%rdx or %rdx,%rbx add $7,%cl test $128,%al jnz 3b xchg %rbx,%rax stosq #ifdef SYSDEBUG inc %r8d #endif jmp 2b 5: nop #ifdef SYSDEBUG push %rdi push %rsi push %r8 call __describe_os mov %rax,%rdx pop %r8 .weak __stracef ezlea __stracef,ax test %rax,%rax jz 5f ezlea .Llog,di mov %r8d,%esi call *%rax 5: pop %rsi pop %rdi #endif /* DEBUGSYS */ pop %rdi pop %rsi pop %rbx // 𝑠𝑙𝑖𝑑𝑒 .endfn _init_systemfive_magnums #if SupportsSystemv() _init_systemfive_pid: ezlea __hostos,cx mov (%rcx),%al mov (%rdi),%eax testb $_HOSTWINDOWS|_HOSTMETAL,(%rcx) jnz 1f mov __NR_getpid,%eax syscall 1: stosq .endfn _init_systemfive_pid #endif #if SupportsBsd() && !defined(TINY) _init_systemfive_sigsys: testb IsBsd() // BSDs will trap SIGSYS! jz 1f // We want ENOSYS instead push %rdi // XNU removed some calls push %rsi // in past, so this makes xor %eax,%eax // troubleshooting easier push %rax // but it's non-essential push %rax push %rax push %rax push %rax push $SIG_IGN // sigaction_meta size 48 mov __NR_sigaction,%eax // mag mov SIGSYS,%edi // sig mov %rsp,%rsi // new xor %edx,%edx // old mov $8,%r10d // for linux xor %r8d,%r8d // for netbsd syscall add $6*8,%rsp pop %rsi pop %rdi 1: .endfn _init_systemfive_sigsys #endif _init_systemfive_done: nop .init.end 300,_init_systemfive,globl,hidden #ifdef SYSDEBUG .rodata.str1.1 .Llog: .ascii STRACE_PROLOGUE .ascii "bell system five system call support" .asciz " %'u magnums loaded on %s\n" .previous #endif /* DEBUGSYS */
18,077
459
jart/cosmopolitan
false
cosmopolitan/libc/sysv/syscall.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/macros.internal.h" .privileged // Performs raw System Five system call. // // This function provides a direct path into system call support // that's friendly to C code, since it doesn't need an intermediate // thunk. It only supports arities up to six, since there's no way // to do more safely; this isn't a problem with Linux, although // certain BSD calls may not be available. // // @param %rdi is system call ordinal, which isn't translated, // and must be correct for the underlying host system // @param %rsi,%rdx,%rcx,%r8,%r9 may supply parameters 1 through 5 // @param sixth is optionally pushed on the stack before call // @return %rax has result, or -1 w/ errno on failure syscall: push %rbp mov %rsp,%rbp .profilable // slide arguments into their right places mov %rdi,%rax // nr mov %rsi,%rdi // arg 1 mov %rdx,%rsi // arg 2 mov %rcx,%rdx // arg 3 mov %r8,%rcx // arg 4 mov %r9,%r8 // arg 5 mov 16(%rbp),%r9 // arg 6 push 32(%rbp) // arg 8 push 24(%rbp) // arg 7 // convert from consts.sh to syscalls.sh encoding push %rcx mov __hostos(%rip),%cl test $_HOSTLINUX,%cl jnz 2f 1: test $_HOSTFREEBSD,%cl jz 1f shl $4*7,%rax jmp 2f 1: test $_HOSTOPENBSD,%cl jz 1f shl $4*10,%rax jmp 2f 1: test $_HOSTNETBSD,%cl jz 1f shl $4*13,%rax jmp 2f 1: test $_HOSTXNU,%cl jz 2f mov %eax,%ecx and $0x0f000000,%ecx and $0x00000fff,%eax shl $4*3,%eax or %ecx,%eax 2: pop %rcx // trigger the system call call *__systemfive(%rip) // clean up stack and return leave ret .endfn syscall,globl
3,407
85
jart/cosmopolitan
false
cosmopolitan/libc/sysv/syslib.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2023 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/macros.internal.h" .bss .balign 8 __syslib: .quad 0 .endfn __syslib,globl
1,930
26
jart/cosmopolitan
false
cosmopolitan/libc/sysv/errfuns.h
#ifndef COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ #define COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) /** * @fileoverview Optimized error return paths. * * Saying this: * * return einval(); * * Instead of this: * * errno = EINVAL; * return -1; * * Allows the compiler to generate 11 fewer bytes of code each time. * * @return always -1 * @see libc/sysv/errfuns.inc (for implementation) */ intptr_t einval(void) relegated; intptr_t eperm(void) relegated; intptr_t enoent(void) relegated; intptr_t esrch(void) relegated; intptr_t eintr(void) relegated; intptr_t eio(void) relegated; intptr_t enxio(void) relegated; intptr_t e2big(void) relegated; intptr_t enoexec(void) relegated; intptr_t ebadf(void) relegated; intptr_t echild(void) relegated; intptr_t eagain(void) relegated; intptr_t enomem(void) relegated; intptr_t eacces(void) relegated; intptr_t efault(void) relegated; intptr_t enotblk(void) relegated; intptr_t ebusy(void) relegated; intptr_t eexist(void) relegated; intptr_t exdev(void) relegated; intptr_t enodev(void) relegated; intptr_t enotdir(void) relegated; intptr_t eisdir(void) relegated; intptr_t enfile(void) relegated; intptr_t emfile(void) relegated; intptr_t enotty(void) relegated; intptr_t enotsup(void) relegated; intptr_t etxtbsy(void) relegated; intptr_t efbig(void) relegated; intptr_t enospc(void) relegated; intptr_t espipe(void) relegated; intptr_t erofs(void) relegated; intptr_t emlink(void) relegated; intptr_t epipe(void) relegated; intptr_t edom(void) relegated; intptr_t erange(void) relegated; intptr_t edeadlk(void) relegated; intptr_t enametoolong(void) relegated; intptr_t enolck(void) relegated; intptr_t enosys(void) relegated; intptr_t enotempty(void) relegated; intptr_t eloop(void) relegated; intptr_t enomsg(void) relegated; intptr_t eidrm(void) relegated; intptr_t echrng(void) relegated; intptr_t el2nsync(void) relegated; intptr_t el3hlt(void) relegated; intptr_t el3rst(void) relegated; intptr_t elnrng(void) relegated; intptr_t eunatch(void) relegated; intptr_t enocsi(void) relegated; intptr_t el2hlt(void) relegated; intptr_t ebade(void) relegated; intptr_t ebadr(void) relegated; intptr_t exfull(void) relegated; intptr_t enoano(void) relegated; intptr_t ebadrqc(void) relegated; intptr_t ebadslt(void) relegated; intptr_t enostr(void) relegated; intptr_t enodata(void) relegated; intptr_t etime(void) relegated; intptr_t enosr(void) relegated; intptr_t enonet(void) relegated; intptr_t enopkg(void) relegated; intptr_t eremote(void) relegated; intptr_t enolink(void) relegated; intptr_t eadv(void) relegated; intptr_t esrmnt(void) relegated; intptr_t ecomm(void) relegated; intptr_t eproto(void) relegated; intptr_t emultihop(void) relegated; intptr_t edotdot(void) relegated; intptr_t ebadmsg(void) relegated; intptr_t eoverflow(void) relegated; intptr_t enotuniq(void) relegated; intptr_t ebadfd(void) relegated; intptr_t eremchg(void) relegated; intptr_t elibacc(void) relegated; intptr_t elibbad(void) relegated; intptr_t elibscn(void) relegated; intptr_t elibmax(void) relegated; intptr_t elibexec(void) relegated; intptr_t eilseq(void) relegated; intptr_t erestart(void) relegated; intptr_t estrpipe(void) relegated; intptr_t eusers(void) relegated; intptr_t enotsock(void) relegated; intptr_t edestaddrreq(void) relegated; intptr_t emsgsize(void) relegated; intptr_t eprototype(void) relegated; intptr_t enoprotoopt(void) relegated; intptr_t eprotonosupport(void) relegated; intptr_t esocktnosupport(void) relegated; intptr_t eopnotsupp(void) relegated; intptr_t epfnosupport(void) relegated; intptr_t eafnosupport(void) relegated; intptr_t eaddrinuse(void) relegated; intptr_t eaddrnotavail(void) relegated; intptr_t enetdown(void) relegated; intptr_t enetunreach(void) relegated; intptr_t enetreset(void) relegated; intptr_t econnaborted(void) relegated; intptr_t econnreset(void) relegated; intptr_t enobufs(void) relegated; intptr_t eisconn(void) relegated; intptr_t enotconn(void) relegated; intptr_t eshutdown(void) relegated; intptr_t etoomanyrefs(void) relegated; intptr_t etimedout(void) relegated; intptr_t econnrefused(void) relegated; intptr_t ehostdown(void) relegated; intptr_t ehostunreach(void) relegated; intptr_t ealready(void) relegated; intptr_t einprogress(void) relegated; intptr_t estale(void) relegated; intptr_t euclean(void) relegated; intptr_t enotnam(void) relegated; intptr_t enavail(void) relegated; intptr_t eisnam(void) relegated; intptr_t eremoteio(void) relegated; intptr_t edquot(void) relegated; intptr_t enomedium(void) relegated; intptr_t emediumtype(void) relegated; intptr_t ecanceled(void) relegated; intptr_t enokey(void) relegated; intptr_t ekeyexpired(void) relegated; intptr_t ekeyrevoked(void) relegated; intptr_t ekeyrejected(void) relegated; intptr_t eownerdead(void) relegated; intptr_t enotrecoverable(void) relegated; intptr_t erfkill(void) relegated; intptr_t ehwpoison(void) relegated; #if defined(__MNO_RED_ZONE__) && defined(__GNUC__) && !defined(__STRICT_ANSI__) #define __ERRFUN(FUNC) \ ({ \ intptr_t NegOne; \ asm volatile("call\t" FUNC \ : "=a"(NegOne) \ : /* no outputs */ \ : "rcx", "memory"); \ NegOne; \ }) #define einval() __ERRFUN("einval") #define eperm() __ERRFUN("eperm") #define enoent() __ERRFUN("enoent") #define esrch() __ERRFUN("esrch") #define eintr() __ERRFUN("eintr") #define eio() __ERRFUN("eio") #define enxio() __ERRFUN("enxio") #define e2big() __ERRFUN("e2big") #define enoexec() __ERRFUN("enoexec") #define ebadf() __ERRFUN("ebadf") #define echild() __ERRFUN("echild") #define eagain() __ERRFUN("eagain") #define enomem() __ERRFUN("enomem") #define eacces() __ERRFUN("eacces") #define efault() __ERRFUN("efault") #define enotblk() __ERRFUN("enotblk") #define ebusy() __ERRFUN("ebusy") #define eexist() __ERRFUN("eexist") #define exdev() __ERRFUN("exdev") #define enodev() __ERRFUN("enodev") #define enotdir() __ERRFUN("enotdir") #define eisdir() __ERRFUN("eisdir") #define enfile() __ERRFUN("enfile") #define emfile() __ERRFUN("emfile") #define enotty() __ERRFUN("enotty") #define enotsup() __ERRFUN("enotsup") #define etxtbsy() __ERRFUN("etxtbsy") #define efbig() __ERRFUN("efbig") #define enospc() __ERRFUN("enospc") #define espipe() __ERRFUN("espipe") #define erofs() __ERRFUN("erofs") #define emlink() __ERRFUN("emlink") #define epipe() __ERRFUN("epipe") #define edom() __ERRFUN("edom") #define erange() __ERRFUN("erange") #define edeadlk() __ERRFUN("edeadlk") #define enametoolong() __ERRFUN("enametoolong") #define enolck() __ERRFUN("enolck") #define enosys() __ERRFUN("enosys") #define enotempty() __ERRFUN("enotempty") #define eloop() __ERRFUN("eloop") #define enomsg() __ERRFUN("enomsg") #define eidrm() __ERRFUN("eidrm") #define echrng() __ERRFUN("echrng") #define el2nsync() __ERRFUN("el2nsync") #define el3hlt() __ERRFUN("el3hlt") #define el3rst() __ERRFUN("el3rst") #define elnrng() __ERRFUN("elnrng") #define eunatch() __ERRFUN("eunatch") #define enocsi() __ERRFUN("enocsi") #define el2hlt() __ERRFUN("el2hlt") #define ebade() __ERRFUN("ebade") #define ebadr() __ERRFUN("ebadr") #define exfull() __ERRFUN("exfull") #define enoano() __ERRFUN("enoano") #define ebadrqc() __ERRFUN("ebadrqc") #define ebadslt() __ERRFUN("ebadslt") #define enostr() __ERRFUN("enostr") #define enodata() __ERRFUN("enodata") #define etime() __ERRFUN("etime") #define enosr() __ERRFUN("enosr") #define enonet() __ERRFUN("enonet") #define enopkg() __ERRFUN("enopkg") #define eremote() __ERRFUN("eremote") #define enolink() __ERRFUN("enolink") #define eadv() __ERRFUN("eadv") #define esrmnt() __ERRFUN("esrmnt") #define ecomm() __ERRFUN("ecomm") #define eproto() __ERRFUN("eproto") #define emultihop() __ERRFUN("emultihop") #define edotdot() __ERRFUN("edotdot") #define ebadmsg() __ERRFUN("ebadmsg") #define eoverflow() __ERRFUN("eoverflow") #define enotuniq() __ERRFUN("enotuniq") #define ebadfd() __ERRFUN("ebadfd") #define eremchg() __ERRFUN("eremchg") #define elibacc() __ERRFUN("elibacc") #define elibbad() __ERRFUN("elibbad") #define elibscn() __ERRFUN("elibscn") #define elibmax() __ERRFUN("elibmax") #define elibexec() __ERRFUN("elibexec") #define eilseq() __ERRFUN("eilseq") #define erestart() __ERRFUN("erestart") #define estrpipe() __ERRFUN("estrpipe") #define eusers() __ERRFUN("eusers") #define enotsock() __ERRFUN("enotsock") #define edestaddrreq() __ERRFUN("edestaddrreq") #define emsgsize() __ERRFUN("emsgsize") #define eprototype() __ERRFUN("eprototype") #define enoprotoopt() __ERRFUN("enoprotoopt") #define eprotonosupport() __ERRFUN("eprotonosupport") #define esocktnosupport() __ERRFUN("esocktnosupport") #define eopnotsupp() __ERRFUN("eopnotsupp") #define epfnosupport() __ERRFUN("epfnosupport") #define eafnosupport() __ERRFUN("eafnosupport") #define eaddrinuse() __ERRFUN("eaddrinuse") #define eaddrnotavail() __ERRFUN("eaddrnotavail") #define enetdown() __ERRFUN("enetdown") #define enetunreach() __ERRFUN("enetunreach") #define enetreset() __ERRFUN("enetreset") #define econnaborted() __ERRFUN("econnaborted") #define econnreset() __ERRFUN("econnreset") #define enobufs() __ERRFUN("enobufs") #define eisconn() __ERRFUN("eisconn") #define enotconn() __ERRFUN("enotconn") #define eshutdown() __ERRFUN("eshutdown") #define etoomanyrefs() __ERRFUN("etoomanyrefs") #define etimedout() __ERRFUN("etimedout") #define econnrefused() __ERRFUN("econnrefused") #define ehostdown() __ERRFUN("ehostdown") #define ehostunreach() __ERRFUN("ehostunreach") #define ealready() __ERRFUN("ealready") #define einprogress() __ERRFUN("einprogress") #define estale() __ERRFUN("estale") #define euclean() __ERRFUN("euclean") #define enotnam() __ERRFUN("enotnam") #define enavail() __ERRFUN("enavail") #define eisnam() __ERRFUN("eisnam") #define eremoteio() __ERRFUN("eremoteio") #define edquot() __ERRFUN("edquot") #define enomedium() __ERRFUN("enomedium") #define emediumtype() __ERRFUN("emediumtype") #define ecanceled() __ERRFUN("ecanceled") #define enokey() __ERRFUN("enokey") #define ekeyexpired() __ERRFUN("ekeyexpired") #define ekeyrevoked() __ERRFUN("ekeyrevoked") #define ekeyrejected() __ERRFUN("ekeyrejected") #define eownerdead() __ERRFUN("eownerdead") #define enotrecoverable() __ERRFUN("enotrecoverable") #define erfkill() __ERRFUN("erfkill") #define ehwpoison() __ERRFUN("ehwpoison") #endif #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ */
11,539
300
jart/cosmopolitan
false
cosmopolitan/libc/sysv/hostos.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2023 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/macros.internal.h" .bss .balign 8 __hostos: .quad 0 .endfn __hostos,globl
1,930
26
jart/cosmopolitan
false
cosmopolitan/libc/sysv/sysret.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2023 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/syscall-sysv.internal.h" #include "libc/errno.h" /** * Handles return path of system call on Linux. */ unsigned long _sysret(unsigned long res) { if (res > -4096) { errno = -res; res = -1; } return res; }
2,079
32
jart/cosmopolitan
false
cosmopolitan/libc/sysv/errfuns.sh
/*bin/echo ' -*- mode:sh; indent-tabs-mode:nil; tab-width:8; coding:utf-8 -*-│ │vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚────────────────────────────────────────────────────────────────'>/dev/null #*/ dir=libc/sysv/errfuns . libc/sysv/gen.sh errfun eperm EPERM errfun enoent ENOENT errfun esrch ESRCH errfun eintr EINTR errfun eio EIO errfun enxio ENXIO errfun e2big E2BIG errfun enoexec ENOEXEC errfun ebadf EBADF errfun echild ECHILD errfun eagain EAGAIN errfun enomem ENOMEM errfun eacces EACCES errfun efault EFAULT errfun enotblk ENOTBLK errfun ebusy EBUSY errfun eexist EEXIST errfun exdev EXDEV errfun enodev ENODEV errfun enotdir ENOTDIR errfun eisdir EISDIR errfun einval EINVAL errfun enfile ENFILE errfun emfile EMFILE errfun enotty ENOTTY errfun enotsup ENOTSUP errfun etxtbsy ETXTBSY errfun efbig EFBIG errfun enospc ENOSPC errfun espipe ESPIPE errfun erofs EROFS errfun emlink EMLINK errfun epipe EPIPE errfun edom EDOM errfun erange ERANGE errfun edeadlk EDEADLK errfun enametoolong ENAMETOOLONG errfun enolck ENOLCK errfun enosys ENOSYS errfun enotempty ENOTEMPTY errfun eloop ELOOP errfun enomsg ENOMSG errfun eidrm EIDRM errfun echrng ECHRNG errfun el2nsync EL2NSYNC errfun el3hlt EL3HLT errfun el3rst EL3RST errfun elnrng ELNRNG errfun eunatch EUNATCH errfun enocsi ENOCSI errfun el2hlt EL2HLT errfun ebade EBADE errfun ebadr EBADR errfun exfull EXFULL errfun enoano ENOANO errfun ebadrqc EBADRQC errfun ebadslt EBADSLT errfun enostr ENOSTR errfun enodata ENODATA errfun etime ETIME errfun enosr ENOSR errfun enonet ENONET errfun enopkg ENOPKG errfun eremote EREMOTE errfun enolink ENOLINK errfun eadv EADV errfun esrmnt ESRMNT errfun ecomm ECOMM errfun eproto EPROTO errfun emultihop EMULTIHOP errfun edotdot EDOTDOT errfun ebadmsg EBADMSG errfun eoverflow EOVERFLOW errfun enotuniq ENOTUNIQ errfun ebadfd EBADFD errfun eremchg EREMCHG errfun elibacc ELIBACC errfun elibbad ELIBBAD errfun elibscn ELIBSCN errfun elibmax ELIBMAX errfun elibexec ELIBEXEC errfun eilseq EILSEQ errfun erestart ERESTART errfun estrpipe ESTRPIPE errfun eusers EUSERS errfun enotsock ENOTSOCK errfun edestaddrreq EDESTADDRREQ errfun emsgsize EMSGSIZE errfun eprototype EPROTOTYPE errfun enoprotoopt ENOPROTOOPT errfun eprotonosupport EPROTONOSUPPORT errfun esocktnosupport ESOCKTNOSUPPORT errfun eopnotsupp EOPNOTSUPP errfun epfnosupport EPFNOSUPPORT errfun eafnosupport EAFNOSUPPORT errfun eaddrinuse EADDRINUSE errfun eaddrnotavail EADDRNOTAVAIL errfun enetdown ENETDOWN errfun enetunreach ENETUNREACH errfun enetreset ENETRESET errfun econnaborted ECONNABORTED errfun econnreset ECONNRESET errfun enobufs ENOBUFS errfun eisconn EISCONN errfun enotconn ENOTCONN errfun eshutdown ESHUTDOWN errfun etoomanyrefs ETOOMANYREFS errfun etimedout ETIMEDOUT errfun econnrefused ECONNREFUSED errfun ehostdown EHOSTDOWN errfun ehostunreach EHOSTUNREACH errfun ealready EALREADY errfun einprogress EINPROGRESS errfun estale ESTALE errfun euclean EUCLEAN errfun enotnam ENOTNAM errfun enavail ENAVAIL errfun eisnam EISNAM errfun eremoteio EREMOTEIO errfun edquot EDQUOT errfun enomedium ENOMEDIUM errfun emediumtype EMEDIUMTYPE errfun ecanceled ECANCELED errfun enokey ENOKEY errfun ekeyexpired EKEYEXPIRED errfun ekeyrevoked EKEYREVOKED errfun ekeyrejected EKEYREJECTED errfun eownerdead EOWNERDEAD errfun enotrecoverable ENOTRECOVERABLE errfun erfkill ERFKILL errfun ehwpoison EHWPOISON
4,985
153
jart/cosmopolitan
false
cosmopolitan/libc/sysv/README.md
SYNOPSIS System Five Import Libraries OVERVIEW Bell System Five is the umbrella term we use to describe Linux, FreeBSD, OpenBSD, and Mac OS X which all have nearly-identical application binary interfaces that stood the test of time, having definitions nearly the same as those of AT&T back in the 1980's. Cosmopolitan aims to help you build apps that can endure over the course of decades, just like these systems have: without needing to lift a finger for maintenance churn, broken builds, broken hearts. The challenge to System V binary compatibility basically boils down to numbers. All these systems agree on what services are provided, but tend to grant them wildly different numbers. We address this by putting all the numbers in a couple big shell scripts, ask the GNU Assembler to encode them into binaries using an efficient LEB128 encoding, unpacked by _init(), and ref'd via extern const. It gives us good debuggability, and any costs are gained back by fewer branches in wrapper functions.z
1,041
25
jart/cosmopolitan
false
cosmopolitan/libc/sysv/describeos.greg.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/nexgen32e/vendor.internal.h" const char *__describe_os(void) { if (IsLinux()) { return "gnu/systemd"; } else if (IsXnu()) { return "xnu's not unix!"; } else if (IsFreebsd()) { return "free besiyata dishmaya"; } else if (IsNetbsd()) { return "net besiyata dishmaya"; } else if (IsOpenbsd()) { return "open besiyata dishmaya"; } else if (IsWindows()) { return "the new technology"; } else { return "wut"; } }
2,325
39
jart/cosmopolitan
false
cosmopolitan/libc/sysv/syscon.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2023 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/macros.internal.h" // Sections for varint encoded magic numbers. // // These sections are all ordered by (group_name, constant_name). // They're populated by modules simply referencing the symbols. // // @see libc/sysv/consts.sh // @see libc/sysv/consts/syscon_h .section .piro.bss.sort.syscon.1,"aw",@nobits .balign 8 syscon_start:/* ...decentralized quadwords... */.previous .section .piro.bss.sort.syscon.3,"aw",@nobits syscon_end: .previous .type syscon_start,@object .type syscon_end,@object .globl syscon_start .globl syscon_end #if SupportsLinux() || SupportsMetal() .section .sort.rodata.syscon.linux.1,"a",@progbits syscon_linux:/* ...decentralized leb128... */.previous .type syscon_linux,@object .globl syscon_linux #endif #if SupportsXnu() .section .sort.rodata.syscon.xnu.1,"a",@progbits syscon_xnu:/* ...decentralized leb128... */.previous .type syscon_xnu,@object .globl syscon_xnu #endif #if SupportsFreebsd() .section .sort.rodata.syscon.freebsd.1,"a",@progbits syscon_freebsd:/* ...decentralized leb128... */.previous .type syscon_freebsd,@object .globl syscon_freebsd #endif #if SupportsOpenbsd() .section .sort.rodata.syscon.openbsd.1,"a",@progbits syscon_openbsd:/* ...decentralized leb128... */.previous .type syscon_openbsd,@object .globl syscon_openbsd #endif #if SupportsNetbsd() .section .sort.rodata.syscon.netbsd.1,"a",@progbits syscon_netbsd:/* ...decentralized leb128... */.previous .type syscon_netbsd,@object .globl syscon_netbsd #endif #if SupportsWindows() .section .sort.rodata.syscon.windows.1,"a",@progbits syscon_windows:/* ...decentralized leb128... */.previous .type syscon_windows,@object .globl syscon_windows #endif
3,573
89
jart/cosmopolitan
false
cosmopolitan/libc/sysv/strace.greg.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2021 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/atomic.h" #include "libc/runtime/runtime.h" /** * System call logging enabled state. * * If Cosmopolitan was compiled with the `SYSDEBUG` macro (this is the * default behavior, except in tiny and release modes) then `__strace` * shall control whether or not system calls are logged to fd 2. If it's * greater than zero, syscalls are logged. Otherwise, they're aren't. * * By convention, functions wishing to disable syscall tracing for a * short time period should say: * * void foo() { * strace_enabled(-1); * bar(); * strace_enabled(+1); * } * * This way you still have some flexibility to force syscall tracing, by * setting `__strace` to a higher number like `2` or `200`. Even though * under normal circumstances, `__strace` should only be either zero or * one. */ int __strace;
2,683
45
jart/cosmopolitan
false
cosmopolitan/libc/sysv/errfun.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2022 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/macros.internal.h" .text.unlikely __errfun: call __errno_location mov %ecx,(%rax) push $-1 pop %rax .leafepilogue // .leafprologue is in errfuns/... .endfn __errfun,globl,hidden
2,038
29
jart/cosmopolitan
false
cosmopolitan/libc/sysv/syscalls.sh
/*bin/echo ' -*- mode:sh; indent-tabs-mode:nil; tab-width:8; coding:utf-8 -*-│ │vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚────────────────────────────────────────────────────────────────'>/dev/null #*/ dir=libc/sysv/calls . libc/sysv/gen.sh # The Fifth Bell System Interface, Community Edition ┌─────────────────────────┐ # » so many numbers │ legend │ # ├─────────────────────────┤ # GNU/Systemd┐ │ fff │ unavailable │ # 2.6.18+│ │ 800 │ cancellable │ # Mac OS X┐ │ │ sys_ │ wrapped │ # 15.6+│ │ │ __sys_ │ wrapped twice │ # FreeBSD┐ │ │ └─────────────────────────┘ # 12+│ │ │ # OpenBSD┐ │ ┌─│──│── XnuClass{1:Mach,2:Unix} # 6.4+│ │ │ │ │ # NetBSD┐ │ │ │ │ │ # 9.1+│ │ │ │ │ │ # Symbol ┌┴┐┌┴┐┌┴┐│┬┴┐┌┴┐ Arm64 Directives & Commentary scall sys_exit 0x00100100120010e7 0x05e globl hidden # a.k.a. exit_group scall sys_read 0x8038038032803800 0x03f globl hidden scall sys_write 0x8048048042804801 0x040 globl hidden scall sys_close 0x0060060062006003 0x039 globl hidden scall __sys_stat 0x1b7026fff2152004 0x04f globl hidden # FreeBSD 11→12 fumble; use sys_fstatat(); blocked on Android scall __sys_fstat 0x1b80352272153005 0x050 globl hidden # needs __stat2linux() scall __sys_lstat 0x1b90280282154006 0xfff globl hidden # needs __stat2linux(); blocked on Android scall __sys_poll 0x8d18fc8d128e6807 0xfff globl hidden scall sys_ppoll 0xfff86da21ffff90f 0x049 globl hidden # consider INTON/INTOFF tutorial in examples/unbourne.c scall sys_lseek 0x0c70c71de20c7008 0x03e globl hidden # netbsd+openbsd:evilpad scall __sys_mmap 0x0c50c51dd20c5009 0x0de globl hidden # netbsd+openbsd:pad scall sys_msync 0x915900841284181a 0x0e3 globl hidden scall sys_mprotect 0x04a04a04a204a00a 0x0e2 globl hidden scall __sys_munmap 0x049049049204900b 0x0d7 globl hidden scall sys_sigaction 0x15402e1a0202e00d 0x086 globl hidden # rt_sigaction on Lunix; __sigaction_sigtramp() on NetBSD scall __sys_sigprocmask 0x125030154214900e 0x087 globl hidden # a.k.a. rt_sigprocmask, openbsd:byvalue, a.k.a. pthread_sigmask scall sys_ioctl 0x0360360362036010 0x01d globl hidden scall sys_ioctl_cp 0x8368368362836810 0x01d globl hidden # intended for TCSBRK scall sys_pread 0x8ad8ad9db2899811 0x043 globl hidden # a.k.a. pread64; netbsd+openbsd:pad scall sys_pwrite 0x8ae8ae9dc289a812 0x044 globl hidden # a.k.a. pwrite64; netbsd+openbsd:pad scall sys_readv 0x8788788782878813 0x041 globl hidden scall sys_writev 0x8798798792879814 0x042 globl hidden scall __sys_pipe 0x02a10721e202a016 0x03b globl hidden # NOTE: pipe2() on FreeBSD and Linux Aarch64; XNU is pipe(void)→eax:edx scall sys_select 0x9a184785d285d817 0xfff globl hidden scall sys_pselect 0x9b486ea0a298a90e 0x048 globl hidden # pselect6() on gnu/systemd scall sys_sched_yield 0x15e12a14bf25d018 0x07c globl hidden # select() on XNU (previously swtch() but removed in 12.4) scall __sys_mremap 0x19bffffffffff019 0x0d8 globl hidden scall sys_mincore 0x04e04e04e204e01b 0x0e8 globl hidden scall sys_madvise 0x04b04b04b204b01c 0x0e9 globl hidden scall sys_shmget 0x0e71210e7210901d 0x0c2 globl # no wrapper scall sys_shmat 0x0e40e40e4210601e 0x0c4 globl # no wrapper scall sys_shmctl 0x1bb128200210701f 0x0c3 globl # no wrapper scall sys_dup 0x0290290292029020 0x017 globl hidden scall sys_dup2 0x05a05a05a205a021 0x018 globl hidden # dup3() on linux aarch64 (doesn't behave same if oldfd==newfd) scall sys_pause 0xfffffffffffff022 0xfff globl hidden scall sys_nanosleep 0x9ae85b8f0ffff823 0x065 globl hidden scall __sys_clock_nanosleep 0x9ddfff8f4ffff8e6 0x073 globl hidden scall sys_getitimer 0x1aa0460562056024 0x066 globl hidden scall sys_setitimer 0x1a90450532053026 0x067 globl hidden scall sys_alarm 0xfffffffffffff025 0xfff globl hidden scall sys_getpid 0x0140140142014027 0x0ac globl hidden # netbsd returns ppid in edx scall sys_sendfile 0xffffff1892151028 0x047 globl hidden # Linux vs. XNU/BSD ABIs very different scall __sys_socket 0x18a0610612061029 0x0c6 globl hidden scall __sys_connect 0x862862862286282a 0x0cb globl hidden scall __sys_accept 0x81e81ea1d281e82b 0x0ca globl hidden # accept4 on freebsd scall sys_sendto 0x885885885288582c 0x0ce globl hidden scall sys_recvfrom 0x81d81d81d281d82d 0x0cf globl hidden scall sys_sendmsg 0x81c81c81c281c82e 0x0d3 globl hidden scall sys_recvmsg 0x81b81b81b281b82f 0x0d4 globl hidden scall sys_shutdown 0x0860860862086030 0x0d2 globl hidden scall __sys_bind 0x0680680682068031 0x0c8 globl hidden scall sys_listen 0x06a06a06a206a032 0x0c9 globl hidden scall __sys_getsockname 0x0200200202020033 0x0cc globl hidden scall __sys_getpeername 0x01f01f08d201f034 0x0cd globl hidden scall __sys_socketpair 0x0870870872087035 0x0c7 globl hidden scall sys_setsockopt 0x0690690692069036 0x0d0 globl hidden scall sys_getsockopt 0x0760760762076037 0x0d1 globl hidden scall __sys_fork 0x0020020022002039 0xfff globl hidden # xnu needs eax&=~-edx bc eax always holds pid and edx is 0 for parent and 1 for child #scall vfork 0x042042042204203a 0xfff globl # this syscall is from the moon so we implement it by hand in libc/runtime/vfork.S; probably removed from XNU in 12.5 scall sys_posix_spawn 0x1daffffff20f4fff 0xfff globl hidden # good luck figuring out how xnu defines this scall __sys_execve 0x03b03b03b203b03b 0x0dd globl hidden scall __sys_wait4 0x9c180b807280783d 0x104 globl hidden scall sys_kill 0x02507a025202503e 0x081 globl hidden # kill(pid, sig, 1) b/c xnu scall sys_killpg 0x092fff092fffffff 0xfff globl hidden scall sys_clone 0x11fffffffffff038 0x0dc globl hidden scall sys_tkill 0x13e0771b121480c8 0x082 globl hidden # thr_kill() on FreeBSD; _lwp_kill() on NetBSD; thrkill() on OpenBSD where arg3 should be 0 or tcb; __pthread_kill() on XNU scall sys_tgkill 0xffffff1e1ffff0ea 0x083 globl hidden # thr_kill2() on FreeBSD scall sys_futex 0x0a60531c6ffff0ca 0x062 globl hidden # raises SIGSYS on NetBSD; _umtx_op() on FreeBSD scall sys_futex_cp 0x8a68539c6ffff8ca 0x062 globl hidden # intended for futex wait ops scall sys_set_robust_list 0x0a7ffffffffff111 0x063 globl # no wrapper scall sys_get_robust_list 0x0a8ffffffffff112 0x064 globl # no wrapper scall sys_uname 0x0a4fff0a4ffff03f 0x0a0 globl hidden scall sys_semget 0x0dd0dd0dd20ff040 0x0be globl # no wrapper scall sys_semop 0x0de1220de2100041 0x0c1 globl # no wrapper scall sys_semctl 0xfff1271fe20fe042 0x0bf globl # no wrapper scall sys_shmdt 0x0e60e60e62108043 0x0c5 globl # no wrapper scall sys_msgget 0x0e10e10e12103044 0x0ba globl # no wrapper scall sys_msgsnd 0x8e28e28e22904845 0x0bd globl # no wrapper scall sys_msgrcv 0x8e38e38e32905846 0x0bc globl # no wrapper scall sys_msgctl 0x1bc1291ff2102047 0x0bb globl # no wrapper scall __sys_fcntl 0x05c05c05c205c048 0x019 globl hidden scall __sys_fcntl_cp 0x85c85c85c285c848 0x019 globl hidden # intended for F_SETLKW and F_OFD_SETLKW scall sys_flock 0x8838838832883849 0x020 globl hidden scall sys_fsync 0x85f85f85f285f84a 0x052 globl hidden scall sys_fdatasync 0x8f185fa2628bb84b 0x053 globl hidden # fsync() on openbsd scall sys_truncate 0x8c88c89df28c884c 0x02d globl hidden # netbsd+openbsd:pad scall sys_ftruncate 0x8c98c99e028c984d 0x02e globl hidden # netbsd+openbsd:pad scall sys_getcwd 0x128130146ffff04f 0x011 globl hidden scall sys_chdir 0x00c00c00c200c050 0x031 globl hidden scall sys_fchdir 0x00d00d00d200d051 0x032 globl hidden scall sys_unlink 0x00a00a00a200a057 0x0b5 globl hidden scall sys_fchmod 0x07c07c07c207c05b 0x034 globl hidden scall sys_fchown 0x07b07b07b207b05d 0x037 globl hidden # @asyncsignalsafe scall sys_umask 0x03c03c03c203c05f 0x0a6 globl hidden scall sys_gettimeofday 0x1a20430742074060 0x0a9 globl hidden # xnu esi/edx=0 scall sys_getrlimit 0x0c20c20c220c2061 0x0a3 globl hidden scall __sys_getrusage 0x1bd0130752075062 0x0a5 globl hidden scall sys_sysinfo 0xfffffffffffff063 0x0b3 globl hidden scall sys_times 0xfffffffffffff064 0x099 globl hidden scall __sys_ptrace 0x01a01a01a201a065 0x075 globl hidden # ptrace() wrapper api is terrible scall sys_syslog 0xfffffffffffff067 0x074 globl hidden scall sys_getuid 0x0180180182018066 0x0ae globl hidden scall sys_getgid 0x02f02f02f202f068 0x0b0 globl hidden scall sys_getppid 0xfff027027202706e 0x0ad globl hidden # see sys_getpid()→edx for netbsd scall sys_setsid 0x0930930932093070 0x09d globl hidden scall sys_getsid 0x11e0ff136213607c 0x09c globl hidden scall sys_getpgid 0x0cf0cf0cf2097079 0x09b globl hidden scall sys_setpgid 0x052052052205206d 0x09a globl hidden scall sys_geteuid 0x019019019201906b 0x0af globl hidden scall sys_getegid 0x02b02b02b202b06c 0x0b1 globl hidden scall sys_getgroups 0x04f04f04f204f073 0x09e globl hidden scall sys_setgroups 0x0500500502050074 0x09f globl hidden scall sys_setreuid 0x07e07e07e207e071 0x091 globl hidden scall sys_setregid 0x07f07f07f207f072 0x08f globl hidden scall sys_setuid 0x0170170172017069 0x092 globl hidden scall sys_setgid 0x0b50b50b520b506a 0x090 globl hidden scall sys_setresuid 0xfff11a137ffff075 0x093 globl hidden # polyfilled for xnu scall sys_setresgid 0xfff11c138ffff077 0x095 globl hidden # polyfilled for xnu scall sys_getresuid 0xfff119168ffff076 0x094 globl hidden # semantics aren't well-defined scall sys_getresgid 0xfff11b169ffff078 0x096 globl hidden # semantics aren't well-defined scall sys_sigpending 0x124034157203407f 0x088 globl hidden # a.k.a. rt_sigpending on linux scall sys_sigsuspend 0x92686f955286f882 0x085 globl hidden # a.k.a. rt_sigsuspend on Linux; openbsd:byvalue, sigsuspend_nocancel on XNU scall sys_sigaltstack 0x1191200352035083 0x084 globl hidden scall sys_mknod 0x1c200e00e200e085 0xfff globl hidden scall sys_mknodat 0x1cc14022fffff103 0x021 globl # no wrapper; FreeBSD 12+ scall sys_mkfifo 0x0840840842084fff 0xfff globl hidden scall sys_mkfifoat 0x1cb13f1f1fffffff 0xfff globl # no wrapper scall sys_statfs 0x89d83fa2b2959889 0x02b globl hidden scall sys_fstatfs 0x89e840a2c295a88a 0x02c globl hidden scall sys_getpriority 0x064064064206408c 0x08d globl hidden scall sys_setpriority 0x060060060206008d 0x08c globl hidden # modern nice() scall sys_mlock 0x0cb0cb0cb20cb095 0x0e4 globl # no wrapper scall sys_munlock 0x0cc0cc0cc20cc096 0x0e5 globl # no wrapper scall sys_mlockall 0x0f210f1442144097 0x0e6 globl # no wrapper scall sys_munlockall 0x0f31101452145098 0x0e7 globl # no wrapper scall sys_setrlimit 0x0c30c30c320c30a0 0x0a4 globl hidden scall sys_chroot 0x03d03d03d203d0a1 0x033 globl hidden scall sys_sync 0x02402402420240a2 0x051 globl hidden scall sys_acct 0x03303303320330a3 0x059 globl # no wrapper scall sys_settimeofday 0x1a304407a207a0a4 0x0aa globl # no wrapper scall sys_mount 0x19a01501520a70a5 0x028 globl hidden scall sys_unmount 0x016016016209f0a6 0xfff globl # no wrapper; umount2() on linux scall sys_umount2 0x016016016209f0a6 0x027 globl # no wrapper; unmount() on bsd scall sys_reboot 0x0d003703720370a9 0x08e globl hidden # two arguments b/c netbsd/sparc lool scall sys_quotactl 0xfff09409420a50b3 0x03c globl # no wrapper scall sys_setfsuid 0xfffffffffffff07a 0x097 globl hidden scall sys_setfsgid 0xfffffffffffff07b 0x098 globl hidden scall sys_capget 0xfffffffffffff07d 0x05a globl # no wrapper scall sys_capset 0xfffffffffffff07e 0x05b globl # no wrapper scall sys_sigtimedwait 0x9affff959ffff880 0x089 globl hidden scall sys_sigqueue 0xffffff1c8fffffff 0xfff globl hidden scall sys_sigqueueinfo 0x0f5ffffffffff081 0x08a globl hidden # a.k.a. rt_sigqueueinfo on linux scall sys_personality 0xfffffffffffff087 0x05c globl # no wrapper scall sys_ustat 0xfffffffffffff088 0xfff globl # no wrapper scall sys_sysfs 0xfffffffffffff08b 0xfff globl # no wrapper scall sys_sched_setparam 0x15afff147ffff08e 0x076 globl hidden scall sys_sched_getparam 0x15bfff148ffff08f 0x079 globl hidden scall sys_sched_setscheduler 0xffffff149ffff090 0x077 globl hidden scall sys_sched_getscheduler 0xffffff14affff091 0x078 globl hidden scall sys_sched_setaffinity 0x15cfff1e8ffff0cb 0x07a globl hidden # hairy; cpuset_setaffinity on FreeBSD scall sys_sched_getaffinity 0x15dfff1e7ffff0cc 0x07b globl hidden # hairy; cpuset_getaffinity on FreeBSD scall sys_sched_get_priority_max 0xffffff14cffff092 0x07d globl hidden scall sys_sched_get_priority_min 0xffffff14dffff093 0x07e globl hidden scall sys_sched_rr_get_interval 0xffffff14effff094 0x07f globl hidden scall sys_vhangup 0xfffffffffffff099 0x03a globl # no wrapper scall sys_modify_ldt 0xfffffffffffff09a 0xfff globl # no wrapper scall sys_pivot_root 0xfffffffffffff09b 0x029 globl hidden #scall prctl 0xfffffffffffff09d 0x0a7 globl # wrapped manually scall sys_arch_prctl 0x0a50a50a5ffff09e 0xfff globl hidden # sysarch() on bsd scall sys_set_tls 0x13d1490a5300309e 0xfff globl hidden # arch_prctl on linux, sysarch on freebsd, _lwp_setprivate on netbsd, __set_tcb on openbsd, _lwp_setprivate on netbsd, thread_fast_set_cthread_self on xnu scall sys_adjtimex 0xfffffffffffff09f 0x0ab globl # no wrapper scall sys_swapon 0xffffff05520550a7 0x0e0 globl # no wrapper scall sys_swapoff 0xffffff1a8ffff0a8 0x0e1 globl # no wrapper scall sys_sethostname 0xffffff058ffff0aa 0x0a1 globl # no wrapper scall sys_setdomainname 0xffffff0a3ffff0ab 0x0a2 globl # no wrapper scall sys_iopl 0xfffffffffffff0ac 0xfff globl # no wrapper scall sys_ioperm 0xfffffffffffff0ad 0xfff globl # no wrapper scall sys_init_module 0xfffffffffffff0af 0x069 globl # no wrapper scall sys_delete_module 0xfffffffffffff0b0 0x06a globl # no wrapper scall __sys_gettid 0x13712b1b0101b0ba 0x0b2 globl hidden # thread_self_trap (or gettid? on xnu), _lwp_self on netbsd, thr_self on freebsd, getthrid on openbsd scall sys_readahead 0xfffffffffffff0bb 0x0d5 globl # no wrapper; consider fadvise() / madvise() scall sys_setxattr 0x177ffffff20ec0bc 0x005 globl # no wrapper scall sys_fsetxattr 0x179ffffff20ed0be 0x007 globl # no wrapper scall sys_getxattr 0x17affffff20ea0bf 0x008 globl # no wrapper scall sys_fgetxattr 0x17cffffff20eb0c1 0x00a globl # no wrapper scall sys_listxattr 0x17dffffff20f00c2 0x00b globl # no wrapper scall sys_flistxattr 0x17fffffff20f10c4 0x00d globl # no wrapper scall sys_removexattr 0x180ffffff20ee0c5 0x00e globl # no wrapper scall sys_fremovexattr 0x182ffffff20ef0c7 0x010 globl # no wrapper scall sys_lsetxattr 0x178ffffffffff0bd 0x006 globl # no wrapper scall sys_lgetxattr 0x17bffffffffff0c0 0x009 globl # no wrapper scall sys_llistxattr 0x17effffffffff0c3 0x00c globl # no wrapper scall sys_lremovexattr 0x181ffffffffff0c6 0x00f globl # no wrapper scall sys_io_setup 0xfffffffffffff0ce 0x000 globl # no wrapper scall sys_io_destroy 0xfffffffffffff0cf 0x001 globl # no wrapper scall sys_io_getevents 0xfffffffffffff0d0 0x004 globl # no wrapper scall sys_io_submit 0xfffffffffffff0d1 0x002 globl # no wrapper scall sys_io_cancel 0xfffffffffffff0d2 0x003 globl # no wrapper scall sys_lookup_dcookie 0xfffffffffffff0d4 0x012 globl # no wrapper scall sys_epoll_create 0xfffffffffffff0d5 0xfff globl hidden scall sys_epoll_wait 0xfffffffffffff8e8 0xfff globl hidden scall sys_epoll_ctl 0xfffffffffffff0e9 0x015 globl hidden scall sys_getdents 0x18606311020c40d9 0x03d globl hidden # use opendir/readdir; four args b/c xnu, getdirentries on xnu, 32-bit on xnu/freebsd, a.k.a. getdents64 on linux, 64-bit on openbsd scall sys_set_tid_address 0xfffffffffffff0da 0x060 globl # no wrapper scall sys_restart_syscall 0xfffffffffffff0db 0x080 globl # no wrapper scall sys_semtimedop 0xfffffffffffff0dc 0x0c0 globl # no wrapper scall sys_fadvise 0x1a0fff213ffff0dd 0x0df globl hidden scall sys_timer_create 0x0ebffffffffff0de 0x06b globl # no wrapper scall sys_timer_settime 0x1beffffffffff0df 0x06e globl # no wrapper scall sys_timer_gettime 0x1bfffffffffff0e0 0x06c globl # no wrapper scall sys_timer_getoverrun 0x0efffffffffff0e1 0x06d globl # no wrapper scall sys_timer_delete 0x0ecffffffffff0e2 0x06f globl # no wrapper scall sys_ktimer_create 0xffffff0ebfffffff 0xfff globl # no wrapper scall sys_ktimer_delete 0xffffff0ecfffffff 0xfff globl # no wrapper scall sys_ktimer_getoverrun 0xffffff0effffffff 0xfff globl # no wrapper scall sys_ktimer_gettime 0xffffff0eefffffff 0xfff globl # no wrapper scall sys_ktimer_settime 0xffffff0edfffffff 0xfff globl # no wrapper scall sys_clock_settime 0x1ac0580e9ffff0e3 0x070 globl # no wrapper scall sys_clock_gettime 0x1ab0570e8ffff0e4 0x071 globl hidden # Linux 2.6+ (c. 2003); XNU uses magic address scall sys_clock_getres 0x1ad0590eaffff0e5 0x072 globl hidden scall sys_mbind 0xfffffffffffff0ed 0x0eb globl # no wrapper; numa numa yeah scall set_mempolicy 0xfffffffffffff0ee 0x0ed globl scall get_mempolicy 0xfffffffffffff0ef 0x0ec globl scall sys_mq_open 0x101ffffffffff0f0 0x0b4 globl # won't polyfill scall sys_mq_unlink 0x103ffffffffff0f1 0x0b5 globl # won't polyfill scall sys_mq_timedsend 0x1b0ffffffffff0f2 0x0b6 globl # won't polyfill scall sys_mq_timedreceive 0x1b1ffffffffff0f3 0x0b7 globl # won't polyfill scall sys_mq_notify 0x106ffffffffff0f4 0x0b8 globl # won't polyfill scall sys_mq_getsetattr 0xfffffffffffff0f5 0x0b9 globl # won't polyfill scall sys_kexec_load 0xfffffffffffff0f6 0x068 globl # no wrapper scall sys_waitid 0xfffffffff28ad8f7 0x05f globl # Linux 2.6.9+; no wrapper scall sys_add_key 0xfffffffffffff0f8 0x0d9 globl # no wrapper scall sys_request_key 0xfffffffffffff0f9 0x0da globl # no wrapper scall sys_keyctl 0xfffffffffffff0fa 0x0db globl # no wrapper scall ioprio_set 0xfffffffffffff0fb 0x01e globl scall ioprio_get 0xfffffffffffff0fc 0x01f globl scall sys_inotify_init 0xfffffffffffff0fd 0xfff globl # no wrapper scall sys_inotify_add_watch 0xfffffffffffff0fe 0xfff globl # no wrapper scall sys_inotify_rm_watch 0xfffffffffffff0ff 0xfff globl # no wrapper scall __sys_openat 0x9d49419f329cf901 0x038 globl hidden # Linux 2.6.16+ (c. 2007) scall __sys_openat_nc 0x1d41411f321d0101 0x038 globl hidden # openat_nocancel() on xnu scall sys_mkdirat 0x1cd13e1f021db102 0x022 globl hidden scall sys_fchownat 0x1d013b1eb21d4104 0x036 globl hidden # @asyncsignalsafe scall sys_utime 0xfffffffffffff084 0x062 globl hidden scall sys_utimes 0x1a404c08a208a0eb 0x058 globl hidden scall sys_futimes 0x1a704d0ce208bfff 0xfff globl hidden scall sys_futimens 0x1d8055222fffffff 0xfff globl hidden scall __sys_fstatat 0x1d202a22821d6106 0x04f globl hidden # a.k.a. newfstatat(); FreeBSD 12+; needs __stat2linux() scall sys_unlinkat 0x1d71451f721d8107 0x023 globl hidden scall sys_renameat 0x1ca1431f521d1108 0x026 globl hidden scall sys_linkat 0x1c913d1ef21d7109 0x025 globl hidden scall sys_symlinkat 0x1d61441f621da10a 0x024 globl hidden scall sys_readlinkat 0x1d51421f421d910b 0x04e globl hidden scall sys_fchmodat 0x1cf13a1ea21d310c 0x035 globl hidden scall sys_faccessat 0x1ce1391e921d210d 0x030 globl hidden scall sys_unshare 0xfffffffffffff110 0x061 globl # no wrapper scall sys_splice 0xfffffffffffff113 0x04c globl hidden # Linux 2.6.17+ (c. 2007) scall sys_tee 0xfffffffffffff114 0x04d globl # Linux 2.6.17+; no wrapper scall sys_sync_file_range 0xfffffffffffff115 0x054 globl hidden # Linux 2.6.17+ scall sys_vmsplice 0xfffffffffffff116 0x04b globl hidden scall sys_migrate_pages 0xfffffffffffff100 0x0ee globl # no wrapper; numa numa yay scall sys_move_pages 0xfffffffffffff117 0x0ef globl # no wrapper; NOTE: We view Red Hat versions as "epochs" for all distros. #──────────────────────RHEL 5.0 LIMIT──────────────────────────────── # ←┬─ last distro with gplv2 licensed compiler c. 2007 scall sys_preadv 0x92190b9212a1c927 0x045 globl hidden # ├─ last distro with system v shell script init scall sys_pwritev 0x92290c9222a1d928 0x046 globl hidden # ├─ rob landley unleashes busybox gpl lawsuits scall __sys_utimensat 0x1d3054223ffff118 0x058 globl hidden # ├─ python modules need this due to pep513 scall sys_fallocate 0xfffffffffffff91d 0x02f globl # ├─ end of life 2020-11-30 (extended) scall posix_fallocate 0x9dffffa12fffffff 0xfff globl hidden # └─ cosmopolitan supports rhel5+ scall __sys_accept4 0xfff85da1dffff920 0x0f2 globl hidden # Linux 2.6.28+ scall __sys_dup3 0x1c6066fffffff124 0x018 globl hidden # Linux 2.6.27+ scall __sys_pipe2 0x1c506521effff125 0x03b globl hidden # Linux 2.6.27+ scall sys_epoll_pwait 0xfffffffffffff919 0x016 globl hidden scall sys_epoll_create1 0xfffffffffffff123 0x014 globl hidden scall sys_perf_event_open 0xfffffffffffff12a 0x0f1 globl # no wrapper scall sys_inotify_init1 0xfffffffffffff126 0x01a globl # no wrapper scall sys_tgsigqueueinfo 0xfffffffffffff129 0x0f0 globl # no wrapper; officially rt_tgsigqueueinfo on gnu/systemd scall sys_signalfd 0xfffffffffffff11a 0xfff globl # no wrapper scall sys_signalfd4 0xfffffffffffff121 0x04a globl # no wrapper scall sys_eventfd 0xfffffffffffff11c 0xfff globl # no wrapper scall sys_eventfd2 0xfffffffffffff122 0x013 globl # no wrapper scall sys_timerfd_create 0xfffffffffffff11b 0x055 globl # no wrapper scall sys_timerfd_settime 0xfffffffffffff11e 0x056 globl # no wrapper scall sys_timerfd_gettime 0xfffffffffffff11f 0x057 globl # no wrapper #──────────────────────RHEL 6.0 LIMIT──────────────────────────────── # ←┬─ modern glibc needs rhel6+ c. 2011 scall sys_recvmmsg 0x1dbffffffffff12b 0x0f3 globl # ├─ end of life 2024-06-30 (extended) scall sys_fanotify_init 0xfffffffffffff12c 0x106 globl # ├─ last distro with the original gnome desktop scall sys_fanotify_mark 0xfffffffffffff12d 0x107 globl # └─ apple and google condemn the gplv3/gccrtev3 scall sys_prlimit 0xfffffffffffff12e 0x105 globl # a.k.a. prlimit64() scall sys_name_to_handle_at 0xfffffffffffff12f 0x108 globl scall sys_open_by_handle_at 0xfffffffffffff130 0x109 globl scall sys_clock_adjtime 0xfffffffffffff131 0x10a globl # no wrapper scall sys_syncfs 0xfffffffffffff132 0x10b globl # no wrapper #scall sendmmsg 0x1dcffffffffff133 0x10d globl scall sys_setns 0xfffffffffffff134 0x10c globl # no wrapper scall sys_getcpu 0xfffffffffffff135 0x0a8 globl # no wrapper scall sys_process_vm_readv 0xfffffffffffff136 0x10e globl # no wrapper scall sys_process_vm_writev 0xfffffffffffff137 0x10f globl # no wrapper scall sys_kcmp 0xfffffffffffff138 0x110 globl # no wrapper scall sys_finit_module 0xfffffffffffff139 0x111 globl # no wrapper #──────────────────────RHEL 7.0 LIMIT──────────────────────────────── # ←┬─ anything that links or uses c++11 code needs rhel7+ c. 2014 scall sys_sched_setattr 0xfffffffffffff13a 0x112 globl # ├─ desktop replaced with tablet-first gui inspired by mac os x scall sys_sched_getattr 0xfffffffffffff13b 0x113 globl # ├─ karen sandler requires systemd init and boot for tablet gui scall sys_renameat2 0xfffffffffffff13c 0x114 globl # └─ debian founder ian murdock found strangled with vacuum cord #scall seccomp 0xfffffffffffff13d 0x115 globl # wrapped manually scall sys_getrandom 0xfff007a3321f493e 0x116 globl hidden # Linux 3.17+; FreeBSD 12+; NetBSD wut; getentropy() on XNU/OpenBSD scall sys_memfd_create 0xfffffffffffff13f 0x117 globl hidden scall sys_kexec_file_load 0xfffffffffffff140 0xfff globl # no wrapper scall sys_bpf 0xfffffffffffff141 0x118 globl # no wrapper scall sys_execveat 0xfffffffffffff142 0x119 globl # no wrapper scall sys_userfaultfd 0xfffffffffffff143 0x11a globl # no wrapper; Linux 4.3+ (c. 2015) scall sys_membarrier 0xfffffffffffff144 0x11b globl # no wrapper; Linux 4.3+ (c. 2015) scall sys_mlock2 0xfffffffffffff145 0x11c globl # no wrapper; Linux 4.5+ (c. 2016) scall sys_copy_file_range 0xffffffa39ffff946 0x11d globl hidden # Linux 4.5+ (c. 2016), FreeBSD 13+ scall sys_preadv2 0xfffffffffffff147 0x11e globl # no wrapper scall sys_pwritev2 0xfffffffffffff148 0x11f globl # no wrapper scall sys_pkey_mprotect 0xfffffffffffff149 0x120 globl # no wrapper scall sys_pkey_alloc 0xfffffffffffff14a 0x121 globl # no wrapper scall sys_pkey_free 0xfffffffffffff14b 0x122 globl # no wrapper scall sys_statx 0xfffffffffffff14c 0x123 globl # no wrapper; lool https://lkml.org/lkml/2010/7/22/249 scall sys_io_pgetevents 0xfffffffffffff14d 0x124 globl # no wrapper scall sys_rseq 0xfffffffffffff14e 0x125 globl # no wrapper; Linux 4.18+ (c. 2018) #──────────────────────LINUX 4.18 LIMIT────────────────────────────── # ←┬─ last version of linux kernel buildable with only gplv2 scall sys_pidfd_send_signal 0xfffffffffffff1a8 0x1a8 globl # ├─ linux conferences ban linux founder linus torvalds scall sys_io_uring_setup 0xfffffffffffff1a9 0x1a9 globl # └─ gnu founder richard stallman publicly disgraced scall sys_io_uring_enter 0xfffffffffffff1aa 0x1aa globl scall sys_io_uring_register 0xfffffffffffff1ab 0x1ab globl #────────────────────────RHEL CLOUD────────────────────────────────── # ←──────┬─ red hat terminates community release of enterprise linux circa 2020 scall sys_pledge 0xfff06cffffffffff 0xfff globl hidden # └─ online linux services ban the president of united states of america scall sys_msyscall 0xfff025ffffffffff 0xfff globl # no wrapper scall sys_bogus 0x00b5005002500500 0x500 globl scall sys_open_tree 0xfffffffffffff1ac 0x1ac globl # no wrapper scall sys_move_mount 0xfffffffffffff1ad 0x1ad globl # no wrapper scall sys_fsopen 0xfffffffffffff1ae 0x1ae globl # no wrapper scall sys_fsconfig 0xfffffffffffff1af 0x1af globl # no wrapper scall sys_fsmount 0xfffffffffffff1b0 0x1b0 globl # no wrapper scall sys_fspick 0xfffffffffffff1b1 0x1b1 globl # no wrapper scall sys_pidfd_open 0xfffffffffffff1b2 0x1b2 globl # no wrapper scall sys_clone3 0xfffffffffffff1b3 0x1b3 globl # no wrapper scall sys_close_range 0xffffff23fffff1b4 0x1b4 globl hidden # Linux 5.9 scall sys_openat2 0xfffffffffffff1b5 0x1b5 globl hidden # Linux 5.6 scall sys_pidfd_getfd 0xfffffffffffff1b6 0x1b6 globl # no wrapper scall sys_faccessat2 0xfffffffffffff1b7 0x1b7 globl hidden scall sys_process_madvise 0xfffffffffffff1b8 0x1b8 globl # no wrapper scall sys_epoll_pwait2 0xfffffffffffff1b9 0x1b9 globl # no wrapper scall sys_mount_setattr 0xfffffffffffff1ba 0x1ba globl # no wrapper scall sys_quotactl_fd 0xfffffffffffff1bb 0xfff globl # no wrapper scall sys_landlock_create_ruleset 0xfffffffffffff1bc 0x1bc globl hidden # Linux 5.13+ scall sys_landlock_add_rule 0xfffffffffffff1bd 0x1bd globl hidden scall sys_landlock_restrict_self 0xfffffffffffff1be 0x1be globl hidden scall sys_memfd_secret 0xfffffffffffff1bf 0xfff globl # no wrapper scall sys_process_mrelease 0xfffffffffffff1c0 0xfff globl # no wrapper scall sys_futex_waitv 0xfffffffffffff1c1 0xfff globl # no wrapper scall sys_set_mempolicy_home_node 0xfffffffffffff1c2 0xfff globl # no wrapper # The Fifth Bell System Interface, Community Edition # » besiyata dishmaya # GNU/Systemd┐ # Mac OS X┐ │ # FreeBSD┐ │ │ # OpenBSD┐ │ ┌─│──│── XnuClass{1:Mach,2:Unix} # NetBSD┐ │ │ │ │ │ # Symbol ┌┴┐┌┴┐┌┴┐│┬┴┐┌┴┐ Arm64 Type Directives & Commentary scall sys_ktrace 0x02d02d02dfffffff 0xfff globl # no wrapper scall sys_kqueue 0x15810d16a216afff 0xfff globl # no wrapper scall sys_kevent 0x1b30482302171fff 0xfff globl # no wrapper scall sys_revoke 0x0380380382038fff 0xfff globl # no wrapper scall sys_setlogin 0xfff0320322032fff 0xfff globl # no wrapper scall sys_getfh 0x18b0a10a120a1fff 0xfff globl # no wrapper scall sys_chflags 0x0220220222022fff 0xfff globl # no wrapper scall sys_getfsstat 0xfff03e22d215bfff 0xfff globl # no wrapper scall sys_nfssvc 0x09b09b09b209bfff 0xfff globl # no wrapper scall sys_adjtime 0x1a508c08c208cfff 0xfff globl # no wrapper scall sys_fchflags 0x0230230232023fff 0xfff globl # no wrapper scall __bsd_seteuid 0xfff0b70b720b7fff 0xfff globl hidden # wrapped via setreuid() scall __bsd_setegid 0xfff0b60b620b6fff 0xfff globl hidden # wrapped via setregid() scall sys_fpathconf 0x0c00c00c020c0fff 0xfff globl # no wrapper scall sys_fhopen 0x18c10812a20f8fff 0xfff globl # no wrapper scall sys_issetugid 0xfff0fd0fd2147fff 0xfff globl hidden scall sys_minherit 0x1110fa0fa20fafff 0xfff globl # no wrapper scall sys_pathconf 0x0bf0bf0bf20bffff 0xfff globl # no wrapper scall sys_sysctl 0x0ca0ca0ca20cafff 0xfff globl # no wrapper #──────────────────XNU & FREEBSD & NETBSD──────────────────────────────────── scall sys_sem_init 0x0f7fff194fffffff 0xfff globl scall sys_sem_destroy 0x0fffff198fffffff 0xfff globl scall sys_sem_open 0x0f8fff195210cfff 0xfff globl scall sys_sem_close 0x0fafff190210dfff 0xfff globl scall sys_sem_unlink 0x0f9fff196210efff 0xfff globl scall sys_sem_post 0x0fbfff1912111fff 0xfff globl scall sys_sem_wait 0x8fcfff992290ffff 0xfff globl scall sys_sem_trywait 0x0fdfff1932110fff 0xfff globl scall sys_sem_timedwait 0x900fff9b9fffffff 0xfff globl scall sys_sem_wait_nocancel 0xfffffffff21a4fff 0xfff globl # no wrapper scall sys_sem_getvalue 0x0fefff197fffffff 0xfff globl #───────────────────────XNU & FREEBSD──────────────────────────────────────── scall sys_ntp_adjtime 0x0b0fff0b0220ffff 0xfff globl # no wrapper scall sys_ntp_gettime 0x1c0fff0f82210fff 0xfff globl # no wrapper scall sys_shm_unlink 0xffffff1e3210bfff 0xfff globl # no wrapper scall sys_shm_open 0xffffff1e2210afff 0xfff globl # no wrapper scall sys_aio_read 0x192fff13e213efff 0xfff globl # no wrapper scall sys_aio_suspend 0x1b6fff13b213bfff 0xfff globl # no wrapper scall sys_aio_cancel 0x18ffff13c213cfff 0xfff globl # no wrapper scall sys_aio_fsync 0x191fff1d12139fff 0xfff globl # no wrapper scall sys_aio_error 0x190fff13d213dfff 0xfff globl # no wrapper scall sys_aio_return 0x193fff13a213afff 0xfff globl # no wrapper scall sys_aio_write 0x195fff13f213ffff 0xfff globl # no wrapper scall sys_aio_waitcomplete 0xffffff167fffffff 0xfff globl # no wrapper scall sys_aio_suspend_nocancel 0xfffffffff21a5fff 0xfff globl # no wrapper scall sys_aio_mlock 0xffffff21ffffffff 0xfff globl # no wrapper scall sys_sigwait 0xffffff1ad214afff 0xfff globl # no wrapper scall sys_undelete 0x0cdfff0cd20cdfff 0xfff globl # no wrapper scall sys_getlogin 0x03108d0312031fff 0xfff globl hidden scall sys_getdtablesize 0xffffff0592059fff 0xfff globl # no wrapper scall sys_setauid 0xffffff1c02162fff 0xfff globl # no wrapper scall sys_audit 0xffffff1bd215efff 0xfff globl # no wrapper scall sys_auditctl 0xffffff1c52167fff 0xfff globl # no wrapper scall sys_getaudit_addr 0xffffff1c32165fff 0xfff globl # no wrapper scall sys_getdirentries 0xffffff22a20c4fff 0xfff globl # xnu getdirentries64 is 0x158 scall sys_lio_listio 0x196fff1402140fff 0xfff globl # no wrapper scall sys_setaudit_addr 0xffffff1c42166fff 0xfff globl # no wrapper scall sys_getauid 0xffffff1bf2161fff 0xfff globl # no wrapper scall sys_semsys 0xffffff0a920fbfff 0xfff globl # no wrapper scall sys_auditon 0xffffff1be215ffff 0xfff globl # no wrapper scall sys_msgsys 0xffffff0aa20fcfff 0xfff globl # no wrapper scall sys_shmsys 0xffffff0ab20fdfff 0xfff globl # no wrapper #─────────────────────FREEBSD & OPENBSD────────────────────────────────────── scall sys_fhstat 0x1c3126229fffffff 0xfff globl # no wrapper scall sys_chflagsat 0xfff06b21cfffffff 0xfff globl # no wrapper scall sys_profil 0x02c02c02cfffffff 0xfff globl # no wrapper scall sys_fhstatfs 0xfff04122efffffff 0xfff globl # no wrapper scall sys_utrace 0x1320d114ffffffff 0xfff globl # no wrapper scall sys_closefrom 0xfff11f1fdfffffff 0xfff globl hidden #───────────────────────────XNU────────────────────────────────────────────── #scall __pthread_markcancel 0xfffffffff214cfff 0xfff globl #scall __pthread_kill 0xfffffffff2148fff 0xfff globl #scall __pthread_fchdir 0xfffffffff215dfff 0xfff globl #scall __pthread_sigmask 0xfffffffff2149fff 0xfff globl #scall __pthread_chdir 0xfffffffff215cfff 0xfff globl #scall __pthread_canceled 0xfffffffff214dfff 0xfff globl #scall __disable_threadsignal 0xfffffffff214bfff 0xfff globl #scall abort_with_payload 0xfffffffff2209fff 0xfff globl #scall accept_nocancel 0xfffffffff2194fff 0xfff globl #scall access_extended 0xfffffffff211cfff 0xfff globl #scall audit_session_join 0xfffffffff21adfff 0xfff globl #scall audit_session_port 0xfffffffff21b0fff 0xfff globl #scall audit_session_self 0xfffffffff21acfff 0xfff globl #scall sys_bsdthread_create 0xfffffffff2168fff 0xfff globl #scall bsdthread_ctl 0xfffffffff21defff 0xfff globl scall sys_bsdthread_register 0xfffffffff216efff 0xfff globl hidden #scall bsdthread_terminate 0xfffffffff2169fff 0xfff globl #scall change_fdguard_np 0xfffffffff21bcfff 0xfff globl #scall chmod_extended 0xfffffffff211afff 0xfff globl #scall clonefileat 0xfffffffff21cefff 0xfff globl #scall close_nocancel 0xfffffffff218ffff 0xfff globl #scall coalition 0xfffffffff21cafff 0xfff globl #scall coalition_info 0xfffffffff21cbfff 0xfff globl #scall connect_nocancel 0xfffffffff2199fff 0xfff globl #scall connectx 0xfffffffff21bffff 0xfff globl #scall copyfile 0xfffffffff20e3fff 0xfff globl #scall csops 0xfffffffff20a9fff 0xfff globl #scall csops_audittoken 0xfffffffff20aafff 0xfff globl #scall csrctl 0xfffffffff21e3fff 0xfff globl #scall delete 0xfffffffff20e2fff 0xfff globl #scall disconnectx 0xfffffffff21c0fff 0xfff globl #scall exchangedata 0xfffffffff20dffff 0xfff globl #scall fchmod_extended 0xfffffffff211bfff 0xfff globl #scall fclonefileat 0xfffffffff2205fff 0xfff globl #scall fcntl_nocancel 0xfffffffff2196fff 0xfff globl #scall ffsctl 0xfffffffff20f5fff 0xfff globl #scall fgetattrlist 0xfffffffff20e4fff 0xfff globl #scall fileport_makefd 0xfffffffff21affff 0xfff globl #scall fileport_makeport 0xfffffffff21aefff 0xfff globl #scall fmount 0xfffffffff220efff 0xfff globl #scall fs_snapshot 0xfffffffff2206fff 0xfff globl #scall fsctl 0xfffffffff20f2fff 0xfff globl #scall fsetattrlist 0xfffffffff20e5fff 0xfff globl #scall fstat_extended 0xfffffffff2119fff 0xfff globl #scall fsync_nocancel 0xfffffffff2198fff 0xfff globl #scall getattrlist 0xfffffffff20dcfff 0xfff globl #scall getattrlistat 0xfffffffff21dcfff 0xfff globl #scall getattrlistbulk 0xfffffffff21cdfff 0xfff globl #scall getdirentriesattr 0xfffffffff20defff 0xfff globl #scall gethostuuid 0xfffffffff208efff 0xfff globl #scall getsgroups 0xfffffffff2120fff 0xfff globl #scall getwgroups 0xfffffffff2122fff 0xfff globl #scall grab_pgo_data 0xfffffffff21edfff 0xfff globl #scall guarded_close_np 0xfffffffff21bafff 0xfff globl #scall guarded_kqueue_np 0xfffffffff21bbfff 0xfff globl #scall guarded_open_np 0xfffffffff21b9fff 0xfff globl #scall guarded_pwrite_np 0xfffffffff21e6fff 0xfff globl #scall guarded_write_np 0xfffffffff21e5fff 0xfff globl #scall guarded_writev_np 0xfffffffff21e7fff 0xfff globl #scall identitysvc 0xfffffffff2125fff 0xfff globl #scall initgroups 0xfffffffff20f3fff 0xfff globl #scall iopolicysys 0xfffffffff2142fff 0xfff globl #scall kas_info 0xfffffffff21b7fff 0xfff globl #scall kdebug_trace 0xfffffffff20b3fff 0xfff globl #scall kdebug_trace_string 0xfffffffff20b2fff 0xfff globl #scall kdebug_typefilter 0xfffffffff20b1fff 0xfff globl #scall kevent_id 0xfffffffff2177fff 0xfff globl #scall kevent_qos 0xfffffffff2176fff 0xfff globl #scall ledger 0xfffffffff2175fff 0xfff globl #scall lstat_extended 0xfffffffff2156fff 0xfff globl #scall memorystatus_control 0xfffffffff21b8fff 0xfff globl #scall memorystatus_get_level 0xfffffffff21c5fff 0xfff globl #scall microstackshot 0xfffffffff21ecfff 0xfff globl #scall mkdir_extended 0xfffffffff2124fff 0xfff globl #scall mkfifo_extended 0xfffffffff2123fff 0xfff globl #scall modwatch 0xfffffffff20e9fff 0xfff globl #scall mremap_encrypted 0xfffffffff21e9fff 0xfff globl #scall msgrcv_nocancel 0xfffffffff21a3fff 0xfff globl #scall msgsnd_nocancel 0xfffffffff21a2fff 0xfff globl #scall msync_nocancel 0xfffffffff2195fff 0xfff globl #scall necp_client_action 0xfffffffff21f6fff 0xfff globl #scall necp_match_policy 0xfffffffff21ccfff 0xfff globl #scall necp_open 0xfffffffff21f5fff 0xfff globl #scall necp_session_action 0xfffffffff220bfff 0xfff globl #scall necp_session_open 0xfffffffff220afff 0xfff globl #scall net_qos_guideline 0xfffffffff220dfff 0xfff globl #scall netagent_trigger 0xfffffffff21eafff 0xfff globl #scall nfsclnt 0xfffffffff20f7fff 0xfff globl #scall open_dprotected_np 0xfffffffff20d8fff 0xfff globl #scall open_extended 0xfffffffff2115fff 0xfff globl #scall open_nocancel 0xfffffffff218efff 0xfff globl #scall openat_nocancel 0xfffffffff21d0fff 0xfff globl #scall openbyid_np 0xfffffffff21dffff 0xfff globl #scall os_fault_with_payload 0xfffffffff2211fff 0xfff globl #scall peeloff 0xfffffffff21c1fff 0xfff globl #scall persona 0xfffffffff21eefff 0xfff globl #scall pid_hibernate 0xfffffffff21b3fff 0xfff globl #scall pid_resume 0xfffffffff21b2fff 0xfff globl #scall pid_shutdown_sockets 0xfffffffff21b4fff 0xfff globl #scall pid_suspend 0xfffffffff21b1fff 0xfff globl #scall poll_nocancel 0xfffffffff21a1fff 0xfff globl #scall pread_nocancel 0xfffffffff219efff 0xfff globl #scall proc_info 0xfffffffff2150fff 0xfff globl #scall proc_rlimit_control 0xfffffffff21befff 0xfff globl #scall proc_trace_log 0xfffffffff21ddfff 0xfff globl #scall proc_uuid_policy 0xfffffffff21c4fff 0xfff globl #scall process_policy 0xfffffffff2143fff 0xfff globl #scall pselect_nocancel 0xfffffffff218bfff 0xfff globl #scall psynch_cvbroad 0xfffffffff212ffff 0xfff globl #scall psynch_cvclrprepost 0xfffffffff2138fff 0xfff globl #scall psynch_cvsignal 0xfffffffff2130fff 0xfff globl #scall psynch_mutexdrop 0xfffffffff212efff 0xfff globl #scall psynch_mutexwait 0xfffffffff212dfff 0xfff globl #scall psynch_rw_downgrade 0xfffffffff212bfff 0xfff globl #scall psynch_rw_longrdlock 0xfffffffff2129fff 0xfff globl #scall psynch_rw_rdlock 0xfffffffff2132fff 0xfff globl #scall psynch_rw_unlock 0xfffffffff2134fff 0xfff globl #scall psynch_rw_unlock2 0xfffffffff2135fff 0xfff globl #scall psynch_rw_upgrade 0xfffffffff212cfff 0xfff globl #scall psynch_rw_wrlock 0xfffffffff2133fff 0xfff globl #scall psynch_rw_yieldwrlock 0xfffffffff212afff 0xfff globl #scall pwrite_nocancel 0xfffffffff219ffff 0xfff globl #scall read_nocancel 0xfffffffff218cfff 0xfff globl #scall readv_nocancel 0xfffffffff219bfff 0xfff globl #scall recvfrom_nocancel 0xfffffffff2193fff 0xfff globl #scall recvmsg_nocancel 0xfffffffff2191fff 0xfff globl #scall recvmsg_x 0xfffffffff21e0fff 0xfff globl #scall renameatx_np 0xfffffffff21e8fff 0xfff globl #scall searchfs 0xfffffffff20e1fff 0xfff globl #scall select_nocancel 0xfffffffff2197fff 0xfff globl #scall sendmsg_nocancel 0xfffffffff2192fff 0xfff globl #scall sendmsg_x 0xfffffffff21e1fff 0xfff globl #scall sendto_nocancel 0xfffffffff219dfff 0xfff globl #scall setattrlist 0xfffffffff20ddfff 0xfff globl #scall setattrlistat 0xfffffffff220cfff 0xfff globl #scall setprivexec 0xfffffffff2098fff 0xfff globl #scall setsgroups 0xfffffffff211ffff 0xfff globl #scall settid 0xfffffffff211dfff 0xfff globl #scall settid_with_pid 0xfffffffff2137fff 0xfff globl #scall setwgroups 0xfffffffff2121fff 0xfff globl #scall sfi_ctl 0xfffffffff21c8fff 0xfff globl #scall sfi_pidctl 0xfffffffff21c9fff 0xfff globl #scall shared_region_check_np 0xfffffffff2126fff 0xfff globl #scall sigsuspend_nocancel 0xfffffffff219afff 0xfff globl #scall socket_delegate 0xfffffffff21c2fff 0xfff globl #scall stat_extended 0xfffffffff2155fff 0xfff globl #scall sysctlbyname 0xfffffffff2112fff 0xfff globl #scall system_override 0xfffffffff21c6fff 0xfff globl #scall telemetry 0xfffffffff21c3fff 0xfff globl #scall terminate_with_payload 0xfffffffff2208fff 0xfff globl #scall thread_selfcounts 0xfffffffff20bafff 0xfff globl #scall thread_selfid 0xfffffffff2174fff 0xfff globl #scall thread_selfusage 0xfffffffff21e2fff 0xfff globl #scall ulock_wait 0xfffffffff2203fff 0xfff globl #scall ulock_wake 0xfffffffff2204fff 0xfff globl #scall umask_extended 0xfffffffff2116fff 0xfff globl #scall usrctl 0xfffffffff21bdfff 0xfff globl #scall vfs_purge 0xfffffffff21c7fff 0xfff globl #scall vm_pressure_monitor 0xfffffffff2128fff 0xfff globl #scall wait4_nocancel 0xfffffffff2190fff 0xfff globl #scall waitevent 0xfffffffff20e8fff 0xfff globl #scall waitid_nocancel 0xfffffffff21a0fff 0xfff globl #scall watchevent 0xfffffffff20e7fff 0xfff globl #scall work_interval_ctl 0xfffffffff21f3fff 0xfff globl #scall workq_kernreturn 0xfffffffff2170fff 0xfff globl #scall workq_open 0xfffffffff216ffff 0xfff globl #scall write_nocancel 0xfffffffff218dfff 0xfff globl #scall writev_nocancel 0xfffffffff219cfff 0xfff globl #──────────────────────────FREEBSD─────────────────────────────────────────── #scall sys_umtx_op 0xffffff1c6fffffff 0xfff globl #scall abort2 0xffffff1cffffffff 0xfff globl #scall afs3_syscall 0xffffff179fffffff 0xfff globl #scall bindat 0xffffff21afffffff 0xfff globl #scall cap_enter 0xffffff204fffffff 0xfff globl #scall cap_fcntls_get 0xffffff219fffffff 0xfff globl #scall cap_fcntls_limit 0xffffff218fffffff 0xfff globl #scall cap_getmode 0xffffff205fffffff 0xfff globl #scall cap_ioctls_get 0xffffff217fffffff 0xfff globl #scall cap_ioctls_limit 0xffffff216fffffff 0xfff globl #scall cap_rights_limit 0xffffff215fffffff 0xfff globl #scall clock_getcpuclockid2 0x1e2fff0f7fffffff 0xfff globl #scall connectat 0xffffff21bfffffff 0xfff globl #scall cpuset 0xffffff1e4fffffff 0xfff globl #scall cpuset_getdomain 0xffffff231fffffff 0xfff globl #scall cpuset_getid 0xffffff1e6fffffff 0xfff globl #scall cpuset_setdomain 0xffffff232fffffff 0xfff globl #scall cpuset_setid 0xffffff1e5fffffff 0xfff globl #scall eaccess 0xffffff178fffffff 0xfff globl #scall extattr_delete_fd 0x16efff175fffffff 0xfff globl #scall extattr_delete_file 0x16bfff166fffffff 0xfff globl #scall extattr_delete_link 0x171fff19efffffff 0xfff globl #scall extattr_get_fd 0x16dfff174fffffff 0xfff globl #scall extattr_get_file 0x16afff165fffffff 0xfff globl #scall extattr_get_link 0x170fff19dfffffff 0xfff globl #scall extattr_list_fd 0x172fff1b5fffffff 0xfff globl #scall extattr_list_file 0x173fff1b6fffffff 0xfff globl #scall extattr_list_link 0x174fff1b7fffffff 0xfff globl #scall extattr_set_fd 0x16cfff173fffffff 0xfff globl #scall extattr_set_file 0x169fff164fffffff 0xfff globl #scall extattr_set_link 0x16ffff19cfffffff 0xfff globl #scall extattrctl 0x168fff163fffffff 0xfff globl scall sys_fexecve 0xffffff1ecfffffff 0xfff globl hidden #scall ffclock_getcounter 0xffffff0f1fffffff 0xfff globl #scall ffclock_getestimate 0xffffff0f3fffffff 0xfff globl #scall ffclock_setestimate 0xffffff0f2fffffff 0xfff globl #scall fhlink 0xffffff235fffffff 0xfff globl #scall fhlinkat 0xffffff236fffffff 0xfff globl #scall fhreadlink 0xffffff237fffffff 0xfff globl #scall getaudit 0xffffff1c1fffffff 0xfff globl scall sys_getcontext 0x133fff1a5fffffff 0xfff globl hidden #scall getdomainname 0xffff00a2ffffffff 0xfff globl #scall getfhat 0xffffff234fffffff 0xfff globl #scall gethostid 0xffffff08efffffff 0xfff globl #scall gethostname 0xffff0057ffffffff 0xfff globl #scall getkerninfo 0xffffff03ffffffff 0xfff globl #scall getloginclass 0xffffff20bfffffff 0xfff globl scall getpagesize_freebsd 0xffffff040fffffff 0xfff globl hidden #scall gssd_syscall 0xffffff1f9fffffff 0xfff globl #scall jail 0xffffff152fffffff 0xfff globl #scall jail_attach 0xffffff1b4fffffff 0xfff globl #scall jail_get 0xffffff1fafffffff 0xfff globl #scall jail_remove 0xffffff1fcfffffff 0xfff globl #scall jail_set 0xffffff1fbfffffff 0xfff globl #scall kenv 0xffffff186fffffff 0xfff globl #scall kldfind 0xffffff132fffffff 0xfff globl #scall kldfirstmod 0xffffff135fffffff 0xfff globl #scall kldload 0xffffff130fffffff 0xfff globl #scall kldnext 0xffffff133fffffff 0xfff globl #scall kldstat 0xffffff134fffffff 0xfff globl #scall kldsym 0xffffff151fffffff 0xfff globl #scall kldunload 0xffffff131fffffff 0xfff globl #scall kldunloadf 0xffffff1bcfffffff 0xfff globl #scall kmq_notify 0xffffff1cdfffffff 0xfff globl #scall kmq_setattr 0xffffff1cafffffff 0xfff globl #scall kmq_timedreceive 0xffffff1cbfffffff 0xfff globl #scall kmq_timedsend 0xffffff1ccfffffff 0xfff globl #scall kmq_unlink 0xffffff1cefffffff 0xfff globl #scall lchflags 0x130fff187fffffff 0xfff globl #scall lchmod 0x112fff112fffffff 0xfff globl #scall lgetfh 0xffffff0a0fffffff 0xfff globl #scall lpathconf 0x1f3fff201fffffff 0xfff globl scall sys_lutimes 0x1a8fff114fffffff 0xfff globl hidden #scall mac_syscall 0xffffff18afffffff 0xfff globl #scall modfind 0xffffff12ffffffff 0xfff globl #scall modfnext 0xffffff12efffffff 0xfff globl #scall modnext 0xffffff12cfffffff 0xfff globl #scall modstat 0xffffff12dfffffff 0xfff globl #scall nfstat 0xffffff117fffffff 0xfff globl #scall nlm_syscall 0xffffff09afffffff 0xfff globl #scall nlstat 0xffffff118fffffff 0xfff globl #scall nmount 0xffffff17afffffff 0xfff globl #scall nnpfs_syscall 0xffffff153fffffff 0xfff globl #scall nstat 0xffffff116fffffff 0xfff globl #scall pdfork 0xffffff206fffffff 0xfff globl #scall pdgetpid 0xffffff208fffffff 0xfff globl #scall pdkill 0xffffff207fffffff 0xfff globl scall sys_posix_openpt 0xffffff1f8fffffff 0xfff globl hidden #scall procctl 0xffffff220fffffff 0xfff globl #scall psynch_cvwait 0xfffffffff2131fff 0xfff globl #scall quota 0xffffff095fffffff 0xfff globl #scall rctl_add_rule 0xffffff210fffffff 0xfff globl #scall rctl_get_limits 0xffffff20ffffffff 0xfff globl #scall rctl_get_racct 0xffffff20dfffffff 0xfff globl #scall rctl_get_rules 0xffffff20efffffff 0xfff globl #scall rctl_remove_rule 0xffffff211fffffff 0xfff globl #scall recv 0xffffff066fffffff 0xfff globl #scall rfork 0xffffff0fbfffffff 0xfff globl #scall rtprio 0xffffff0a6fffffff 0xfff globl scall sys_rtprio_thread 0xffffff1d2fffffff 0xfff globl # no wrapper #scall send 0xffffff065fffffff 0xfff globl #scall setaudit 0xffffff1c2fffffff 0xfff globl #scall setcontext 0x134fff1a6fffffff 0xfff globl #scall setfib 0xffffff0affffffff 0xfff globl #scall sethostid 0xffffff08ffffffff 0xfff globl #scall setloginclass 0xffffff20cfffffff 0xfff globl #scall sigblock 0xffffff06dfffffff 0xfff globl #scall sigsetmask 0xffffff06efffffff 0xfff globl #scall sigstack 0xffffff070fffffff 0xfff globl #scall sigvec 0xffffff06cfffffff 0xfff globl #scall sigwaitinfo 0xffffff15afffffff 0xfff globl #scall sstk 0xffffff046fffffff 0xfff globl #scall swapcontext 0xffffff1a7fffffff 0xfff globl #scall thr_create 0xffffff1aefffffff 0xfff globl #scall thr_exit 0xffffff1affffffff 0xfff globl #scall thr_kill 0xffffff1b1fffffff 0xfff globl #scall thr_kill2 0xffffff1e1fffffff 0xfff globl #scall thr_new 0xffffff1c7fffffff 0xfff globl #scall thr_self 0xffffff1b0fffffff 0xfff globl #scall thr_set_name 0xffffff1d0fffffff 0xfff globl #scall thr_suspend 0xffffff1bafffffff 0xfff globl #scall thr_wake 0xffffff1bbfffffff 0xfff globl #scall uuidgen 0x163fff188fffffff 0xfff globl #scall vadvise 0xffffff048fffffff 0xfff globl #scall wait 0xffffff054fffffff 0xfff globl #scall wait6 0x1e1fff214fffffff 0xfff globl #scall yield 0xffffff141fffffff 0xfff globl #──────────────────────────OPENBSD─────────────────────────────────────────── #scall __thrsleep 0xfff05effffffffff 0xfff globl #scall __thrwakeup 0xfff12dffffffffff 0xfff globl #scall __threxit 0xfff12effffffffff 0xfff globl #scall __thrsigdivert 0xfff12fffffffffff 0xfff globl #scall __set_tcb 0xfff149ffffffffff 0xfff globl #scall __get_tcb 0xfff14affffffffff 0xfff globl #scall adjfreq 0xfff131ffffffffff 0xfff globl #scall getdtablecount 0xfff012ffffffffff 0xfff globl #scall getlogin_r 0xfff08dffffffffff 0xfff globl #scall getrtable 0xfff137ffffffffff 0xfff globl #scall getthrid 0xfff12bffffffffff 0xfff globl #scall kbind 0xfff056ffffffffff 0xfff globl #scall mquery 0xfff11effffffffff 0xfff globl # openbsd:pad #scall obreak 0x011011ffffffffff 0xfff globl #scall sendsyslog 0xfff070ffffffffff 0xfff globl #scall setrtable 0xfff136ffffffffff 0xfff globl #scall swapctl 0x10f0c1ffffffffff 0xfff globl #scall thrkill 0xfff077ffffffffff 0xfff globl scall sys_unveil 0xfff072ffffffffff 0xfff globl hidden #──────────────────────────NETBSD──────────────────────────────────────────── #scall _lwp_create 0x135fffffffffffff 0xfff globl # int _lwp_create(const struct ucontext_netbsd *ucp, uint64_t flags, int *new_lwp) #scall _lwp_exit 0x136fffffffffffff 0xfff globl # int _lwp_exit(void) #scall _lwp_self 0x137fffffffffffff 0xfff globl # int _lwp_self(void) #scall _lwp_wait 0x138fffffffffffff 0xfff globl # int _lwp_wait(int wait_for, int *departed) #scall _lwp_suspend 0x139fffffffffffff 0xfff globl # int _lwp_suspend(int target) #scall _lwp_continue 0x13afffffffffffff 0xfff globl # int _lwp_continue(int target) #scall _lwp_wakeup 0x13bfffffffffffff 0xfff globl # int _lwp_wakeup(int target) #scall _lwp_getprivate 0x13cfffffffffffff 0xfff globl # void *_lwp_getprivate(void) #scall _lwp_setprivate 0x13dfffffffffffff 0xfff globl # int _lwp_setprivate(void *ptr) #scall _lwp_kill 0x13efffffffffffff 0xfff globl # int _lwp_kill(int target, int signo) #scall _lwp_detach 0x13ffffffffffffff 0xfff globl # int _lwp_park(int clock_id, int flags, struct timespec *ts, int unpark, const void *hint, const void *unparkhint) #scall _lwp_park 0x1defffffffffffff 0xfff globl # int _lwp_park(int clock_id, int flags, struct timespec *ts, int unpark, const void *hint, const void *unparkhint) #scall _lwp_unpark 0x141fffffffffffff 0xfff globl # int _lwp_unpark_all(int target, const void *hint) #scall _lwp_unpark_all 0x142fffffffffffff 0xfff globl # int _lwp_unpark_all(const int *targets, size_t ntargets, const void *hint) #scall _lwp_setname 0x143fffffffffffff 0xfff globl # int _lwp_setname(int target, const char *name) #scall _lwp_getname 0x144fffffffffffff 0xfff globl # int _lwp_getname(int target, char *name, size_t len) #scall _lwp_ctl 0x145fffffffffffff 0xfff globl # int _lwp_ctl(int features, struct lwpctl **address)
53,888
802
jart/cosmopolitan
false
cosmopolitan/libc/sysv/gen.sh
/*bin/echo ' -*- mode:sh; indent-tabs-mode:nil; tab-width:8; coding:utf-8 -*-│ │vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚────────────────────────────────────────────────────────────────'>/dev/null #*/ mkdir -p $dir rm -f $dir/*.s $dir/*.S IFS="," if [ x"$(((0x8d18fc8d128e6807 & 0x7ff000) >> 12))" != x230 ]; then echo "error: $SHELL does not support bitwise expressions" >&2 exit 1 fi scall() { { name=$1 amd=$2 arm_linux=$(($3 + 0)) arm_xnu=$((($amd & 0xfff000) >> 12)) if [ $arm_xnu != 4095 ]; then arm_xnu=$(($arm_xnu & 0x7ff)) fi shift 3 set -- "$name" "$amd" "$arm_linux" "$arm_xnu" "$*" echo "#include \"libc/sysv/macros.internal.h\"" echo ".scall" "$*" } >"$dir/${1/$/-}.S" } syscon() { { echo "#include \"libc/sysv/consts/syscon.internal.h\"" echo ".syscon" "$*" if [ -f "libc/sysv/dos2errno/${2/$/-}.S" ]; then echo "#ifdef __x86_64__" echo ".yoink kDos2Errno.${2/$/-}" echo "#endif" fi } >"$dir/${2/$/-}.S" } sysstr() { { echo "#include \"libc/sysv/macros.internal.h\"" echo ".sysstr $1 \"$2\"" } >"$dir/${1/$/-}.S" } errfun() { NAME="$1" ERRNO="$2" { printf '#include "libc/macros.internal.h"\n.text.unlikely\n\n' printf '%s:\n' "$NAME" printf '#ifdef __x86_64__ .leafprologue .profilable mov %s(%%rip),%%ecx jmp __errfun #elif defined(__aarch64__) adrp x1,%s ldrsw x0,[x1,#:lo12:%s] b __errfun #else #error "unsupported architecture" #endif .endfn %s,globl,hidden ' "$ERRNO" "$ERRNO" "$ERRNO" "$NAME" } >"$dir/${1/$/-}.S" } dos() { DOS="$1" UNIX="$2" if ! [ -f "$dir/${UNIX/$/-}.S" ]; then cat <<EOF >"$dir/${UNIX/$/-}.S" // generated by libc/sysv/dos2errno.sh #include "libc/nt/errors.h" #ifndef __x86_64__ .end #endif .macro .e doscode systemv .short \doscode .long \systemv .endm .section .sort.rodata.dos2errno.2,"a",@progbits .globl kDos2Errno.${UNIX} .type kDos2Errno.${UNIX},@object kDos2Errno.${UNIX}: EOF fi printf %s\\n " .e ${DOS},${UNIX}" >>"$dir/${UNIX/$/-}.S" }
3,666
109
jart/cosmopolitan
false
cosmopolitan/libc/sysv/dos2errno.sh
/*bin/echo ' -*- mode:sh; indent-tabs-mode:nil; tab-width:8; coding:utf-8 -*-│ │vi: set net ft=sh ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚────────────────────────────────────────────────────────────────'>/dev/null #*/ dir=libc/sysv/dos2errno . libc/sysv/gen.sh # DOS ERRNO MULTIMAPPINGS # # These mappings are defined in a decentralized section which are # grouped at linktime into kDos2Errno. (libc/intrin/kdos2errno.S) # dos kNtErrorInvalidTargetHandle EBADF dos kNtErrorDirectAccessHandle EBADF dos kNtErrorModNotFound ENOSYS dos kNtErrorBadCommand EACCES dos kNtErrorBadLength EACCES dos kNtErrorBadNetpath ENOENT dos kNtErrorBadNetName ENOENT dos kNtErrorBadPathname ENOENT dos kNtErrorBadNetResp ENETDOWN dos kNtErrorFileExists EEXIST dos kNtErrorCannotMake EACCES dos kNtErrorCommitmentLimit ENOMEM dos kNtErrorConnectionAborted ECONNABORTED dos kNtErrorConnectionActive EISCONN dos kNtErrorConnectionRefused ECONNREFUSED dos kNtErrorCrc EACCES dos kNtErrorDirNotEmpty ENOTEMPTY dos kNtErrorDupName EADDRINUSE dos kNtErrorFilenameExcedRange ENAMETOOLONG dos kNtErrorGenFailure EACCES dos kNtErrorGracefulDisconnect EPIPE dos kNtErrorHostDown EHOSTUNREACH dos kNtErrorHostUnreachable EHOSTUNREACH dos kNtErrorInsufficientBuffer EFAULT dos kNtErrorNoaccess EFAULT dos kNtErrorInvalidAddress EADDRNOTAVAIL dos kNtErrorNotAReparsePoint EINVAL dos kNtErrorInvalidFunction EINVAL dos kNtErrorNegativeSeek EINVAL dos kNtErrorInvalidNetname EADDRNOTAVAIL dos kNtErrorInvalidUserBuffer EMSGSIZE dos kNtErrorIoPending EINPROGRESS dos kNtErrorLockViolation EAGAIN dos kNtErrorMoreData EMSGSIZE dos kNtErrorNetnameDeleted ECONNABORTED dos kNtErrorNetworkAccessDenied EACCES dos kNtErrorNetworkBusy ENETDOWN dos kNtErrorNetworkUnreachable ENETUNREACH dos kNtErrorNonpagedSystemResources ENOMEM dos kNtErrorNotEnoughMemory ENOMEM dos kNtErrorNotEnoughQuota ENOMEM dos kNtErrorNotFound ENOENT dos kNtErrorNotReady EACCES dos kNtErrorNotSupported ENOTSUP dos kNtErrorNoMoreFiles ENOENT dos kNtErrorNoSystemResources ENOMEM dos kNtErrorOperationAborted EINTR dos kNtErrorOutOfPaper EACCES dos kNtErrorPagedSystemResources ENOMEM dos kNtErrorPagefileQuota ENOMEM dos kNtErrorPipeNotConnected EPIPE dos kNtErrorPortUnreachable ECONNRESET dos kNtErrorProtocolUnreachable ENETUNREACH dos kNtErrorRemNotList ECONNREFUSED dos kNtErrorRequestAborted EINTR dos kNtErrorReqNotAccep EWOULDBLOCK dos kNtErrorSectorNotFound EACCES dos kNtErrorSemTimeout ETIMEDOUT dos kNtErrorSharingViolation EACCES dos kNtErrorTooManyNames ENOMEM dos kNtErrorUnexpNetErr ECONNABORTED dos kNtErrorWorkingSetQuota ENOMEM dos kNtErrorWriteProtect EACCES dos kNtErrorWrongDisk EACCES dos WSAEACCES EACCES dos WSAEDISCON EPIPE dos WSAEFAULT EFAULT dos WSAEINVAL EINVAL dos WSAEDQUOT EDQUOT dos WSAEPROCLIM ENOMEM dos WSANOTINITIALISED ENETDOWN dos WSASYSNOTREADY ENETDOWN dos WSAVERNOTSUPPORTED ENOSYS dos WSAETIMEDOUT ETIMEDOUT
5,178
101
jart/cosmopolitan
false
cosmopolitan/libc/sysv/syscount.S
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ ╞══════════════════════════════════════════════════════════════════════════════╡ │ Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ │ │ │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ │ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ │ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ │ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ │ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ │ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/macros.internal.h" // RII System Five system call counter. // // Referencing this symbol will cause systemfive() to be hooked // for the purpose of counting non-Windows system calls. Please // note wrappers may still short circuit calls sometimes, which // wouldn't impact this counter. .bss .balign 8 __syscount: .quad 0 .endobj __syscount,globl .previous #ifdef __x86_64__ .initbss 701,_init___syscount __syscount_next: .quad 0 .endobj __syscount_next .previous syscount: incq __syscount(%rip) jmp *__syscount_next(%rip) .endfn syscount .previous .init.start 701,_init___syscount mov __systemfive(%rip),%rax stosq ezlea syscount,ax mov %rax,__systemfive(%rip) .init.end 701,_init___syscount #endif /* __x86_64__ */
2,594
57
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_fchflags.S
#include "libc/sysv/macros.internal.h" .scall sys_fchflags,0x0230230232023fff,4095,35,globl
92
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_aio_error.S
#include "libc/sysv/macros.internal.h" .scall sys_aio_error,0x190fff13d213dfff,4095,317,globl
94
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_getppid.S
#include "libc/sysv/macros.internal.h" .scall sys_getppid,0xfff027027202706e,173,39,globl,hidden
97
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_inotify_add_watch.S
#include "libc/sysv/macros.internal.h" .scall sys_inotify_add_watch,0xfffffffffffff0fe,4095,4095,globl
103
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_io_destroy.S
#include "libc/sysv/macros.internal.h" .scall sys_io_destroy,0xfffffffffffff0cf,1,4095,globl
93
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_ktimer_create.S
#include "libc/sysv/macros.internal.h" .scall sys_ktimer_create,0xffffff0ebfffffff,4095,4095,globl
99
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_signalfd.S
#include "libc/sysv/macros.internal.h" .scall sys_signalfd,0xfffffffffffff11a,4095,4095,globl
94
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_recvmmsg.S
#include "libc/sysv/macros.internal.h" .scall sys_recvmmsg,0x1dbffffffffff12b,243,4095,globl
93
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_tgkill.S
#include "libc/sysv/macros.internal.h" .scall sys_tgkill,0xffffff1e1ffff0ea,131,4095,globl,hidden
98
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/__sys_openat.S
#include "libc/sysv/macros.internal.h" .scall __sys_openat,0x9d49419f329cf901,56,463,globl,hidden
98
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_semctl.S
#include "libc/sysv/macros.internal.h" .scall sys_semctl,0xfff1271fe20fe042,191,254,globl
90
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_futex_waitv.S
#include "libc/sysv/macros.internal.h" .scall sys_futex_waitv,0xfffffffffffff1c1,4095,4095,globl
97
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_sysfs.S
#include "libc/sysv/macros.internal.h" .scall sys_sysfs,0xfffffffffffff08b,4095,4095,globl
91
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_clone.S
#include "libc/sysv/macros.internal.h" .scall sys_clone,0x11fffffffffff038,220,4095,globl,hidden
97
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_sendmsg.S
#include "libc/sysv/macros.internal.h" .scall sys_sendmsg,0x81c81c81c281c82e,211,28,globl,hidden
97
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/__sys_openat_nc.S
#include "libc/sysv/macros.internal.h" .scall __sys_openat_nc,0x1d41411f321d0101,56,464,globl,hidden
101
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_nfssvc.S
#include "libc/sysv/macros.internal.h" .scall sys_nfssvc,0x09b09b09b209bfff,4095,155,globl
91
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_chdir.S
#include "libc/sysv/macros.internal.h" .scall sys_chdir,0x00c00c00c200c050,49,12,globl,hidden
94
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_aio_waitcomplete.S
#include "libc/sysv/macros.internal.h" .scall sys_aio_waitcomplete,0xffffff167fffffff,4095,4095,globl
102
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_delete_module.S
#include "libc/sysv/macros.internal.h" .scall sys_delete_module,0xfffffffffffff0b0,106,4095,globl
98
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_kexec_file_load.S
#include "libc/sysv/macros.internal.h" .scall sys_kexec_file_load,0xfffffffffffff140,4095,4095,globl
101
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_msgctl.S
#include "libc/sysv/macros.internal.h" .scall sys_msgctl,0x1bc1291ff2102047,187,258,globl
90
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_mincore.S
#include "libc/sysv/macros.internal.h" .scall sys_mincore,0x04e04e04e204e01b,232,78,globl,hidden
97
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_sem_unlink.S
#include "libc/sysv/macros.internal.h" .scall sys_sem_unlink,0x0f9fff196210efff,4095,270,globl
95
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_quotactl_fd.S
#include "libc/sysv/macros.internal.h" .scall sys_quotactl_fd,0xfffffffffffff1bb,4095,4095,globl
97
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_tgsigqueueinfo.S
#include "libc/sysv/macros.internal.h" .scall sys_tgsigqueueinfo,0xfffffffffffff129,240,4095,globl
99
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_mlock.S
#include "libc/sysv/macros.internal.h" .scall sys_mlock,0x0cb0cb0cb20cb095,228,203,globl
89
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_mkfifo.S
#include "libc/sysv/macros.internal.h" .scall sys_mkfifo,0x0840840842084fff,4095,132,globl,hidden
98
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_mknodat.S
#include "libc/sysv/macros.internal.h" .scall sys_mknodat,0x1cc14022fffff103,33,4095,globl
91
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_aio_cancel.S
#include "libc/sysv/macros.internal.h" .scall sys_aio_cancel,0x18ffff13c213cfff,4095,316,globl
95
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_fpathconf.S
#include "libc/sysv/macros.internal.h" .scall sys_fpathconf,0x0c00c00c020c0fff,4095,192,globl
94
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_clock_settime.S
#include "libc/sysv/macros.internal.h" .scall sys_clock_settime,0x1ac0580e9ffff0e3,112,4095,globl
98
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/__sys_mremap.S
#include "libc/sysv/macros.internal.h" .scall __sys_mremap,0x19bffffffffff019,216,4095,globl,hidden
100
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_kexec_load.S
#include "libc/sysv/macros.internal.h" .scall sys_kexec_load,0xfffffffffffff0f6,104,4095,globl
95
3
jart/cosmopolitan
false
cosmopolitan/libc/sysv/calls/sys_capget.S
#include "libc/sysv/macros.internal.h" .scall sys_capget,0xfffffffffffff07d,90,4095,globl
90
3
jart/cosmopolitan
false