From 690be544da77eb3323858df6562543db2978243d Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 14 May 2021 05:36:58 -0700 Subject: [PATCH] Make redbean StoreAsset() work better - Better UBSAN error messages - POSIX Advisory Locks polyfills - Move redbean manual to /.help.txt - System call memory safety in ASAN mode - Character classification now does UNICODE --- build/bootstrap/compile.com | Bin 77824 -> 77824 bytes examples/curl.c | 1 - libc/calls/calls.h | 6 +- libc/calls/fcntl-nt.c | 109 +- libc/calls/fcntl-sysv.c | 31 + libc/calls/fcntl.c | 10 +- libc/calls/fixupnewfd.c | 2 +- libc/calls/flock.c | 2 + libc/calls/fstat.c | 2 + libc/calls/fstatat.c | 3 + libc/calls/getcwd-xnu.c | 2 +- libc/calls/getppid.c | 2 +- libc/calls/internal.h | 7 +- libc/calls/metaflock.c | 164 ++ libc/calls/openat-sysv.c | 2 +- libc/calls/preadv.c | 2 + libc/calls/pwritev.c | 2 + libc/calls/readv.c | 28 +- libc/calls/struct/flock.h | 13 +- libc/calls/sysinfo.c | 7 + libc/calls/utimes.c | 7 + libc/calls/wait4.c | 12 + libc/calls/writev.c | 28 +- libc/dce.h | 6 + libc/dns/dns.h | 9 + libc/dns/getaddrinfo.c | 1 - libc/fmt/kerrornames.S | 48 +- libc/intrin/asan.c | 219 +- libc/intrin/asan.internal.h | 5 +- libc/intrin/somanyasan.S | 423 ++- libc/log/log.h | 1 + libc/log/oncrash.c | 2 +- libc/log/somanyubsan.S | 517 +++- libc/log/ubsan.c | 168 +- libc/log/ubsan.internal.h | 14 +- libc/macros.internal.h | 2 - libc/nt/enum/lockfile.h | 7 + libc/runtime/msync.c | 1 + libc/str/getzipcdir.c | 42 +- libc/str/getzipcdircomment.c | 2 +- libc/str/getzipcdircommentsize.c | 2 +- libc/str/iswlower.c | 6 +- libc/str/iszipcdir64.c | 13 +- libc/str/memchr.c | 15 +- libc/str/strchr.c | 12 +- libc/str/strxfrm.c | 1 - libc/sysv/calls/__sys_fcntl.s | 2 + libc/sysv/calls/sys_fcntl.s | 2 - libc/sysv/consts.sh | 2342 ++++++++--------- libc/sysv/consts/AI_ADDRCONFIG.S | 2 - libc/sysv/consts/AI_ALL.S | 2 - libc/sysv/consts/AI_CANONNAME.S | 2 - libc/sysv/consts/AI_NUMERICHOST.S | 2 - libc/sysv/consts/AI_NUMERICSERV.S | 2 - libc/sysv/consts/AI_PASSIVE.S | 2 - libc/sysv/consts/AI_V4MAPPED.S | 2 - libc/sysv/consts/BIG_ENDIAN.S | 2 - libc/sysv/consts/BLK_BYTECOUNT.S | 2 - libc/sysv/consts/BLK_EOF.S | 2 - libc/sysv/consts/BLK_EOR.S | 2 - libc/sysv/consts/BLK_ERRORS.S | 2 - libc/sysv/consts/BLK_RESTART.S | 2 - libc/sysv/consts/BUS_DEVICE_RESET.S | 2 +- libc/sysv/consts/CR0.S | 2 +- libc/sysv/consts/CR1.S | 2 +- libc/sysv/consts/CR2.S | 2 +- libc/sysv/consts/CR3.S | 2 +- libc/sysv/consts/EBADFD.S | 2 +- libc/sysv/consts/EMEDIUMTYPE.S | 2 +- libc/sysv/consts/EMPTY.S | 2 +- libc/sysv/consts/EMULTIHOP.S | 2 +- libc/sysv/consts/ENODATA.S | 2 +- libc/sysv/consts/ENOLINK.S | 2 +- libc/sysv/consts/ENOMEDIUM.S | 2 +- libc/sysv/consts/ENOSR.S | 2 +- libc/sysv/consts/ENOSTR.S | 2 +- libc/sysv/consts/ERA.S | 2 +- libc/sysv/consts/ERESTART.S | 2 +- libc/sysv/consts/EXTA.S | 2 +- libc/sysv/consts/EXTB.S | 2 +- libc/sysv/consts/F_GETLK.S | 2 +- libc/sysv/consts/F_GETLK64.S | 2 +- libc/sysv/consts/F_SETLK.S | 2 +- libc/sysv/consts/F_SETLK64.S | 2 +- libc/sysv/consts/F_SETLKW.S | 2 +- libc/sysv/consts/F_SETLKW64.S | 2 +- libc/sysv/consts/F_UNLCK.S | 2 +- libc/sysv/consts/F_WRLCK.S | 2 +- libc/sysv/consts/INADDR_ALLHOSTS_GROUP.S | 2 - libc/sysv/consts/INADDR_ALLRTRS_GROUP.S | 2 - libc/sysv/consts/INADDR_ANY.S | 2 - libc/sysv/consts/INADDR_BROADCAST.S | 2 - libc/sysv/consts/INADDR_LOOPBACK.S | 2 - libc/sysv/consts/INADDR_MAX_LOCAL_GROUP.S | 2 - libc/sysv/consts/INADDR_NONE.S | 2 - libc/sysv/consts/INADDR_UNSPEC_GROUP.S | 2 - libc/sysv/consts/IUCLC.S | 2 +- libc/sysv/consts/LITTLE_ENDIAN.S | 2 - libc/sysv/consts/MAP_CONCEAL.S | 2 +- libc/sysv/consts/MAP_TYPE.S | 2 +- libc/sysv/consts/MODE_B.S | 2 - libc/sysv/consts/MODE_C.S | 2 - libc/sysv/consts/MODE_S.S | 2 - libc/sysv/consts/MODE_SELECT.S | 2 - libc/sysv/consts/MODE_SELECT_10.S | 2 - libc/sysv/consts/MODE_SENSE.S | 2 - libc/sysv/consts/MODE_SENSE_10.S | 2 - libc/sysv/consts/NL0.S | 2 +- libc/sysv/consts/NL1.S | 2 +- libc/sysv/consts/NL2.S | 2 +- libc/sysv/consts/NL3.S | 2 +- libc/sysv/consts/OLCUC.S | 2 +- libc/sysv/consts/O_APPEND.S | 2 +- libc/sysv/consts/O_ASYNC.S | 2 +- libc/sysv/consts/O_CLOEXEC.S | 2 +- libc/sysv/consts/O_CREAT.S | 2 +- libc/sysv/consts/O_DIRECT.S | 2 +- libc/sysv/consts/O_DIRECTORY.S | 2 +- libc/sysv/consts/O_DSYNC.S | 2 +- libc/sysv/consts/O_EXCL.S | 2 +- libc/sysv/consts/O_EXEC.S | 2 +- libc/sysv/consts/O_NDELAY.S | 2 +- libc/sysv/consts/O_NOATIME.S | 2 +- libc/sysv/consts/O_NOCTTY.S | 2 +- libc/sysv/consts/O_NOFOLLOW.S | 2 +- libc/sysv/consts/O_NONBLOCK.S | 2 +- libc/sysv/consts/O_PATH.S | 2 +- libc/sysv/consts/O_RSYNC.S | 2 +- libc/sysv/consts/O_SYNC.S | 2 +- libc/sysv/consts/O_TMPFILE.S | 2 +- libc/sysv/consts/O_TRUNC.S | 2 +- libc/sysv/consts/O_TTY_INIT.S | 2 +- libc/sysv/consts/READ_10.S | 2 +- libc/sysv/consts/READ_12.S | 2 +- libc/sysv/consts/READ_6.S | 2 +- libc/sysv/consts/READ_BLOCK_LIMITS.S | 2 +- libc/sysv/consts/READ_BUFFER.S | 2 +- libc/sysv/consts/READ_CAPACITY.S | 2 +- libc/sysv/consts/READ_DEFECT_DATA.S | 2 +- libc/sysv/consts/READ_ELEMENT_STATUS.S | 2 +- libc/sysv/consts/READ_LONG.S | 2 +- libc/sysv/consts/READ_POSITION.S | 2 +- libc/sysv/consts/READ_REVERSE.S | 2 +- libc/sysv/consts/READ_TOC.S | 2 +- .../consts/SCSI_IOCTL_BENCHMARK_COMMAND.S | 2 +- libc/sysv/consts/SCSI_IOCTL_DOORLOCK.S | 2 +- libc/sysv/consts/SCSI_IOCTL_DOORUNLOCK.S | 2 +- libc/sysv/consts/SCSI_IOCTL_GET_BUS_NUMBER.S | 2 +- libc/sysv/consts/SCSI_IOCTL_GET_IDLUN.S | 2 +- libc/sysv/consts/SCSI_IOCTL_PROBE_HOST.S | 2 +- libc/sysv/consts/SCSI_IOCTL_SEND_COMMAND.S | 2 +- libc/sysv/consts/SCSI_IOCTL_START_UNIT.S | 2 +- libc/sysv/consts/SCSI_IOCTL_STOP_UNIT.S | 2 +- libc/sysv/consts/SCSI_IOCTL_SYNC.S | 2 +- libc/sysv/consts/SCSI_IOCTL_TAGGED_DISABLE.S | 2 +- libc/sysv/consts/SCSI_IOCTL_TAGGED_ENABLE.S | 2 +- libc/sysv/consts/SCSI_IOCTL_TEST_UNIT_READY.S | 2 +- libc/sysv/consts/ST_APPEND.S | 2 +- libc/sysv/consts/ST_IMMUTABLE.S | 2 +- libc/sysv/consts/ST_MANDLOCK.S | 2 +- libc/sysv/consts/ST_NOATIME.S | 2 +- libc/sysv/consts/ST_NODEV.S | 2 +- libc/sysv/consts/ST_NODIRATIME.S | 2 +- libc/sysv/consts/ST_NOEXEC.S | 2 +- libc/sysv/consts/ST_NOSUID.S | 2 +- libc/sysv/consts/ST_RDONLY.S | 2 +- libc/sysv/consts/ST_RELATIME.S | 2 +- libc/sysv/consts/ST_SYNCHRONOUS.S | 2 +- libc/sysv/consts/ST_WRITE.S | 2 +- libc/sysv/consts/TAB0.S | 2 +- libc/sysv/consts/TAB1.S | 2 +- libc/sysv/consts/TAB2.S | 2 +- libc/sysv/consts/TAB3.S | 2 +- libc/sysv/consts/TCFLSH.S | 2 +- libc/sysv/consts/TCIFLUSH.S | 2 +- libc/sysv/consts/TCIOFF.S | 2 +- libc/sysv/consts/TCIOFLUSH.S | 2 +- libc/sysv/consts/TCION.S | 2 +- libc/sysv/consts/TCOFLUSH.S | 2 +- libc/sysv/consts/TCOOFF.S | 2 +- libc/sysv/consts/TCOON.S | 2 +- libc/sysv/consts/WRITE_10.S | 2 +- libc/sysv/consts/WRITE_12.S | 2 +- libc/sysv/consts/WRITE_6.S | 2 +- libc/sysv/consts/WRITE_BUFFER.S | 2 +- libc/sysv/consts/WRITE_FILEMARKS.S | 2 +- libc/sysv/consts/WRITE_LONG.S | 2 +- libc/sysv/consts/WRITE_LONG_2.S | 2 +- libc/sysv/consts/WRITE_SAME.S | 2 +- libc/sysv/consts/WRITE_VERIFY.S | 2 +- libc/sysv/consts/WRITE_VERIFY_12.S | 2 +- libc/sysv/consts/XCASE.S | 2 +- libc/sysv/consts/XTABS.S | 2 +- libc/sysv/consts/ai.h | 26 - libc/sysv/consts/blk.h | 56 - libc/sysv/consts/inaddr.h | 40 +- libc/sysv/consts/map.h | 5 +- libc/sysv/syscalls.sh | 2 +- libc/sysv/systemfive.S | 8 +- libc/testlib/testlib.mk | 1 + libc/testlib/testmain.c | 5 + libc/testlib/testrunner.c | 1 + libc/time/strftime.c | 11 +- libc/zip.h | 14 +- net/http/escapejsstringliteral.c | 126 +- net/http/geturischeme.gperf | 24 - net/http/geturischeme.inc | 213 -- net/http/parseurl.c | 48 +- test/libc/calls/writev_test.c | 26 + test/libc/fmt/fmt_test.c | 5 + test/libc/intrin/asan_test.c | 42 + test/libc/intrin/test.mk | 1 + test/libc/str/regex_test.c | 13 + third_party/zlib/internal.h | 2 +- third_party/zlib/zalloc.c | 2 +- third_party/zlib/zconf.h | 4 +- tool/build/compile.c | 18 + tool/build/lib/errnos.S | 50 +- tool/build/lib/xlaterrno.c | 33 +- tool/build/runit.c | 1 - tool/decode/lib/socknames.c | 1 - tool/decode/zip.c | 29 +- tool/emacs/cosmo-stuff.el | 5 +- tool/net/.help.txt | 158 ++ tool/net/demo/redbean.lua | 2 +- tool/net/dig.c | 4 +- tool/net/net.mk | 6 +- tool/net/redbean.c | 1094 ++++---- 228 files changed, 3653 insertions(+), 3015 deletions(-) create mode 100644 libc/calls/fcntl-sysv.c create mode 100644 libc/calls/metaflock.c create mode 100644 libc/nt/enum/lockfile.h create mode 100644 libc/sysv/calls/__sys_fcntl.s delete mode 100644 libc/sysv/calls/sys_fcntl.s delete mode 100644 libc/sysv/consts/AI_ADDRCONFIG.S delete mode 100644 libc/sysv/consts/AI_ALL.S delete mode 100644 libc/sysv/consts/AI_CANONNAME.S delete mode 100644 libc/sysv/consts/AI_NUMERICHOST.S delete mode 100644 libc/sysv/consts/AI_NUMERICSERV.S delete mode 100644 libc/sysv/consts/AI_PASSIVE.S delete mode 100644 libc/sysv/consts/AI_V4MAPPED.S delete mode 100644 libc/sysv/consts/BIG_ENDIAN.S delete mode 100644 libc/sysv/consts/BLK_BYTECOUNT.S delete mode 100644 libc/sysv/consts/BLK_EOF.S delete mode 100644 libc/sysv/consts/BLK_EOR.S delete mode 100644 libc/sysv/consts/BLK_ERRORS.S delete mode 100644 libc/sysv/consts/BLK_RESTART.S delete mode 100644 libc/sysv/consts/INADDR_ALLHOSTS_GROUP.S delete mode 100644 libc/sysv/consts/INADDR_ALLRTRS_GROUP.S delete mode 100644 libc/sysv/consts/INADDR_ANY.S delete mode 100644 libc/sysv/consts/INADDR_BROADCAST.S delete mode 100644 libc/sysv/consts/INADDR_LOOPBACK.S delete mode 100644 libc/sysv/consts/INADDR_MAX_LOCAL_GROUP.S delete mode 100644 libc/sysv/consts/INADDR_NONE.S delete mode 100644 libc/sysv/consts/INADDR_UNSPEC_GROUP.S delete mode 100644 libc/sysv/consts/LITTLE_ENDIAN.S delete mode 100644 libc/sysv/consts/MODE_B.S delete mode 100644 libc/sysv/consts/MODE_C.S delete mode 100644 libc/sysv/consts/MODE_S.S delete mode 100644 libc/sysv/consts/MODE_SELECT.S delete mode 100644 libc/sysv/consts/MODE_SELECT_10.S delete mode 100644 libc/sysv/consts/MODE_SENSE.S delete mode 100644 libc/sysv/consts/MODE_SENSE_10.S delete mode 100644 libc/sysv/consts/ai.h delete mode 100644 libc/sysv/consts/blk.h delete mode 100644 net/http/geturischeme.gperf delete mode 100644 net/http/geturischeme.inc create mode 100644 test/libc/intrin/asan_test.c create mode 100644 tool/net/.help.txt diff --git a/build/bootstrap/compile.com b/build/bootstrap/compile.com index 0073592d8e727a6fbc51b8837b3640316e662a4b..c460b3c6001959d875565e2ea0600edfbe28186c 100755 GIT binary patch delta 34057 zcmb5X3tW`N_Xqs!!U`z(tO|-31Oybkf{KYqva+ks>SEsSnueNb7t>v(6nAlqkK`@LRBRMZ8OR}v@lE;;( z#(JO6T=>@s)=U4OrUQFH-$RqdcIn@5|EDMjVza%v$C5NcsP{D@S1P0$1h*8!3R~Da zw0k~VkUlKQT+Say*V4lxtI~%%w%4%^EhpS>Z6OHrvL{0_?={y5>TJr!P1-T$X0}kL zdp<@Z=+!?1u;1$m#sG^`Rlv3%=*>QBIdgbuM}y$)J5O-)M7Md}+~)|=Y2GCF1F=Z7 zotNQ$ks$hcgWTI=kO-OA$2}a7iMnfl5=RqC>-!mmLf=R>tyOpJq~=U%mEOY;AqdkS ztf};i$S~e8&LICqf{}lRY@&B;(Hfx1Ge-HUI^ceGrB%OHKIpMj1F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HEl?VK!#%tZl2ZL#4o_UWH03O8OEELt?J+Ag8#OKz_ zpC@^HN>jY1cFg@vgKbK$DdHH>e=PFW2=-3GOxXpRWQ&=rD7+m1R#Urj{ENY!{t7qK} zPF`(&*0snzVleFO_KGz>MX@DV#Z)nyDJXB7-mnvMg!rMSa3sDwD`!rQ z<2{9MCqvl-N&?$kI8?xJw|PW|mWhb3urle;%xmYUuK9zo6~Mgf74#V{H3SW2SJ8>e zn@kNh1K;FZW9fnSV;&w0Pkmn!zqn*jh9WBHD>m@u``16(!y77#1F27Tt*W(Q{Y9)@ zF%{F^*^*71+nRX;uJJ*?|Wqx5P{6)bpuZ z^jtPiA{WJKWgkmj8@;I1CVD}WkScFH8 zm|he53NfC~03n56*o`zrLCf&syHV#52N~OWkecTqHUxNVr{KpTKQTufsSU)0pCM7B zoX(~wkyBp>52GrSVsY3p9J7RDk?Hw?Lj%iF{)QPsV)v+zO9RVL>ynVuIWn(!vt^A$uP22iiZrWTfzk;jSxO(cEsx^(j zO5ry(TSoDF4UO$0Kcm@X<_kx@e3@B8((!vntYN|a&SRhXZ5YXO1s1l&bULbzjoUmr zaqUNhI|+Y77$h7@vz^>`2?q#GjGz(6M8cVbWrT|fR}*eY+WXCzeYlJbvBqtS>g>VMp9Kr>J%L%s;zE7y9j?l_len; + off = l->l_start; + if (!len || l->l_whence == SEEK_END) { + if (!GetFileInformationByHandle(f->handle, &info)) return __winerr(); + size = (uint64_t)info.nFileSizeHigh << 32 | info.nFileSizeLow; + } else { + size = 0; + } + if (l->l_whence != SEEK_SET) { + if (l->l_whence == SEEK_CUR) { + if (!SetFilePointerEx(f->handle, 0, &pos, SEEK_CUR)) return __winerr(); + off = pos + off; + } else if (l->l_whence == SEEK_END) { + off = size - off; + } else { + return einval(); + } + } + if (!len) len = size - off; + if (off < 0 || len < 0) return einval(); + offset2overlap(off, &ov); + if (l->l_type == F_RDLCK || l->l_type == F_WRLCK) { + flags = 0; + if (cmd == F_SETLK) flags |= kNtLockfileFailImmediately; + if (l->l_type == F_WRLCK) flags |= kNtLockfileExclusiveLock; + if (LockFileEx(f->handle, flags, 0, len, len >> 32, &ov)) { + return 0; + } else { + return __winerr(); + } + } else if (l->l_type == F_UNLCK) { + if (UnlockFileEx(f->handle, 0, len, len >> 32, &ov)) { + return 0; + } else { + return __winerr(); + } + } else { + return einval(); + } +} + +textwindows int sys_fcntl_nt(int fd, int cmd, uintptr_t arg) { uint32_t flags; if (__isfdkind(fd, kFdFile) || __isfdkind(fd, kFdSocket)) { - switch (cmd) { - case F_GETFL: - return g_fds.p[fd].flags & (O_ACCMODE | O_APPEND | O_ASYNC | O_DIRECT | - O_NOATIME | O_NONBLOCK); - case F_SETFL: - /* - * - O_APPEND doesn't appear to be tunable at cursory glance - * - O_NONBLOCK might require we start doing all i/o in threads - * - O_DSYNC / O_RSYNC / O_SYNC maybe if we fsync() everything - */ - return einval(); - case F_GETFD: - if (g_fds.p[fd].flags & O_CLOEXEC) { - return FD_CLOEXEC; - } else { - return 0; - } - case F_SETFD: - if (arg & FD_CLOEXEC) { - g_fds.p[fd].flags |= O_CLOEXEC; - return FD_CLOEXEC; - } else { - g_fds.p[fd].flags &= ~O_CLOEXEC; - return 0; - } - default: - return einval(); + if (cmd == F_GETFL) { + return g_fds.p[fd].flags & (O_ACCMODE | O_APPEND | O_ASYNC | O_DIRECT | + O_NOATIME | O_NONBLOCK); + } else if (cmd == F_SETFL) { + /* + * - O_APPEND doesn't appear to be tunable at cursory glance + * - O_NONBLOCK might require we start doing all i/o in threads + * - O_DSYNC / O_RSYNC / O_SYNC maybe if we fsync() everything + */ + return einval(); + } else if (cmd == F_GETFD) { + if (g_fds.p[fd].flags & O_CLOEXEC) { + return FD_CLOEXEC; + } else { + return 0; + } + } else if (cmd == F_SETFD) { + if (arg & FD_CLOEXEC) { + g_fds.p[fd].flags |= O_CLOEXEC; + return FD_CLOEXEC; + } else { + g_fds.p[fd].flags &= ~O_CLOEXEC; + return 0; + } + } else if (cmd == F_SETLK || cmd == F_SETLKW) { + return sys_fcntl_nt_lock(g_fds.p + fd, cmd, arg); + } else { + return einval(); } } else { return ebadf(); diff --git a/libc/calls/fcntl-sysv.c b/libc/calls/fcntl-sysv.c new file mode 100644 index 000000000..0e9a04ff2 --- /dev/null +++ b/libc/calls/fcntl-sysv.c @@ -0,0 +1,31 @@ +/*-*- 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/calls/internal.h" +#include "libc/calls/struct/flock.h" +#include "libc/sysv/consts/f.h" + +int sys_fcntl(int fd, int cmd, uintptr_t arg) { + int rc; + bool islock; + islock = cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK; + if (islock) cosmo2flock(arg); + rc = __sys_fcntl(fd, cmd, arg); + if (islock) flock2cosmo(arg); + return rc; +} diff --git a/libc/calls/fcntl.c b/libc/calls/fcntl.c index 665a2acd1..eff0dd9b9 100644 --- a/libc/calls/fcntl.c +++ b/libc/calls/fcntl.c @@ -25,6 +25,12 @@ * * CHECK_NE(-1, fcntl(fd, F_SETFD, FD_CLOEXEC)); * + * This function implements POSIX Advisory Locks, e.g. + * + * CHECK_NE(-1, fcntl(zfd, F_SETLKW, &(struct flock){F_WRLCK})); + * // ... + * CHECK_NE(-1, fcntl(zfd, F_SETLK, &(struct flock){F_UNLCK})); + * * @param cmd can be F_{GET,SET}{FD,FL}, etc. * @param arg can be FD_CLOEXEC, etc. depending * @return 0 on success, or -1 w/ errno @@ -32,9 +38,9 @@ */ int fcntl(int fd, int cmd, ...) { va_list va; - unsigned arg; + uintptr_t arg; va_start(va, cmd); - arg = va_arg(va, unsigned); + arg = va_arg(va, uintptr_t); va_end(va); if (!IsWindows()) { return sys_fcntl(fd, cmd, arg); diff --git a/libc/calls/fixupnewfd.c b/libc/calls/fixupnewfd.c index 893601ba2..c7a65c920 100644 --- a/libc/calls/fixupnewfd.c +++ b/libc/calls/fixupnewfd.c @@ -28,7 +28,7 @@ int __fixupnewfd(int fd, int flags) { if (fd != -1) { if (flags & O_CLOEXEC) { - sys_fcntl(fd, F_SETFD, FD_CLOEXEC); + __sys_fcntl(fd, F_SETFD, FD_CLOEXEC); } } return fd; diff --git a/libc/calls/flock.c b/libc/calls/flock.c index 1fbdae7ba..c8f7af7f9 100644 --- a/libc/calls/flock.c +++ b/libc/calls/flock.c @@ -23,6 +23,8 @@ /** * Acquires lock on file. * + * Please note multiple file descriptors means multiple locks. + * * @param op can have LOCK_{SH,EX,NB,UN} for shared, exclusive, * non-blocking, and unlocking * @return 0 on success, or -1 w/ errno diff --git a/libc/calls/fstat.c b/libc/calls/fstat.c index 0d5a0290e..553f6b08d 100644 --- a/libc/calls/fstat.c +++ b/libc/calls/fstat.c @@ -20,6 +20,7 @@ #include "libc/calls/calls.h" #include "libc/calls/internal.h" #include "libc/dce.h" +#include "libc/intrin/asan.internal.h" #include "libc/sysv/errfuns.h" #include "libc/zipos/zipos.internal.h" @@ -28,6 +29,7 @@ * @asyncsignalsafe */ int fstat(int fd, struct stat *st) { + if (IsAsan() && (!st || !__asan_is_valid(st, sizeof(*st)))) return efault(); if (__isfdkind(fd, kFdZip)) { return weaken(__zipos_fstat)( (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, st); diff --git a/libc/calls/fstatat.c b/libc/calls/fstatat.c index cb6c4a55e..e9187388c 100644 --- a/libc/calls/fstatat.c +++ b/libc/calls/fstatat.c @@ -20,7 +20,9 @@ #include "libc/calls/calls.h" #include "libc/calls/internal.h" #include "libc/errno.h" +#include "libc/intrin/asan.internal.h" #include "libc/sysv/consts/at.h" +#include "libc/sysv/errfuns.h" #include "libc/zipos/zipos.internal.h" /** @@ -36,6 +38,7 @@ */ int fstatat(int dirfd, const char *path, struct stat *st, uint32_t flags) { struct ZiposUri zipname; + if (IsAsan() && (!st || !__asan_is_valid(st, sizeof(*st)))) return efault(); if (weaken(__zipos_stat) && weaken(__zipos_parseuri)(path, &zipname) != -1) { return weaken(__zipos_stat)(&zipname, st); } else if (!IsWindows()) { diff --git a/libc/calls/getcwd-xnu.c b/libc/calls/getcwd-xnu.c index c1ea1ec17..960d56918 100644 --- a/libc/calls/getcwd-xnu.c +++ b/libc/calls/getcwd-xnu.c @@ -34,7 +34,7 @@ char *sys_getcwd_xnu(char *res, size_t size) { if ((fd = sys_openat(AT_FDCWD, ".", O_RDONLY | O_DIRECTORY, 0)) != -1) { if (sys_fstat(fd, &st[0]) != -1) { if (st[0].st_dev && st[0].st_ino) { - if (sys_fcntl(fd, XNU_F_GETPATH, buf) != -1) { + if (__sys_fcntl(fd, XNU_F_GETPATH, (uintptr_t)buf) != -1) { if (sys_fstatat(AT_FDCWD, buf, &st[1], 0) != -1) { if (st[0].st_dev == st[1].st_dev && st[0].st_ino == st[1].st_ino) { if (memccpy(res, buf, '\0', size)) { diff --git a/libc/calls/getppid.c b/libc/calls/getppid.c index e4dbd5663..7ab0b7c45 100644 --- a/libc/calls/getppid.c +++ b/libc/calls/getppid.c @@ -22,7 +22,7 @@ * Returns parent process id. * @asyncsignalsafe */ -int32_t getppid(void) { +int getppid(void) { if (!IsWindows()) { if (!IsNetbsd()) { return sys_getppid(); diff --git a/libc/calls/internal.h b/libc/calls/internal.h index 4c5571864..c1fe14ccf 100644 --- a/libc/calls/internal.h +++ b/libc/calls/internal.h @@ -109,6 +109,7 @@ char *sys_getcwd(char *, u64) hidden; char *sys_getcwd_xnu(char *, u64) hidden; i32 __sys_dup3(i32, i32, i32) hidden; i32 __sys_execve(const char *, char *const[], char *const[]) hidden; +i32 __sys_fcntl(i32, i32, u64) hidden; i32 __sys_fstat(i32, struct stat *) hidden; i32 __sys_fstatat(i32, const char *, struct stat *, i32) hidden; i32 __sys_getrusage(i32, struct rusage *) hidden; @@ -131,7 +132,7 @@ i32 sys_fchmod(i32, u32) hidden; i32 sys_fchmodat(i32, const char *, u32, u32) hidden; i32 sys_fchown(i64, u32, u32) hidden; i32 sys_fchownat(i32, const char *, u32, u32, u32) hidden; -i32 sys_fcntl(i32, i32, ...) hidden; +i32 sys_fcntl(i32, i32, u64) hidden; i32 sys_fdatasync(i32) hidden; i32 sys_flock(i32, i32) hidden; i32 sys_fstat(i32, struct stat *) hidden; @@ -229,6 +230,8 @@ int gethostname_nt(char *, size_t) hidden; size_t __iovec_size(const struct iovec *, size_t) hidden; void __rusage2linux(struct rusage *) hidden; ssize_t WritevUninterruptible(int, struct iovec *, int); +void flock2cosmo(uintptr_t); +void cosmo2flock(uintptr_t); /*───────────────────────────────────────────────────────────────────────────│─╗ │ cosmopolitan § syscalls » windows nt » veneers ─╬─│┼ @@ -245,7 +248,7 @@ int sys_execve_nt(const char *, char *const[], char *const[]) hidden; int sys_faccessat_nt(int, const char *, int, uint32_t) hidden; int sys_fadvise_nt(int, u64, u64, int) hidden; int sys_fchdir_nt(int) hidden; -int sys_fcntl_nt(int, int, unsigned) hidden; +int sys_fcntl_nt(int, int, uintptr_t) hidden; int sys_fdatasync_nt(int) hidden; int sys_flock_nt(int, int) hidden; int sys_fork_nt(void) hidden; diff --git a/libc/calls/metaflock.c b/libc/calls/metaflock.c new file mode 100644 index 000000000..a13b891cc --- /dev/null +++ b/libc/calls/metaflock.c @@ -0,0 +1,164 @@ +/*-*- 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/calls/internal.h" +#include "libc/calls/struct/flock.h" + +union metaflock { + struct flock cosmo; + struct flock_linux { + int16_t l_type; + int16_t l_whence; + int64_t l_start; + int64_t l_len; + int32_t l_pid; + } linux; + struct flock_xnu { + int64_t l_start; + int64_t l_len; + int32_t l_pid; + int16_t l_type; + int16_t l_whence; + } xnu; + struct flock_freebsd { + int64_t l_start; + int64_t l_len; + int32_t l_pid; + int16_t l_type; + int16_t l_whence; + int32_t l_sysid; + } freebsd; + struct flock_openbsd { + int64_t l_start; + int64_t l_len; + int32_t l_pid; + int16_t l_type; + int16_t l_whence; + } openbsd; + struct flock_netbsd { + int64_t l_start; + int64_t l_len; + int32_t l_pid; + int16_t l_type; + int16_t l_whence; + } netbsd; +}; + +void flock2cosmo(uintptr_t memory) { + int64_t l_start; + int64_t l_len; + int32_t l_pid; + int16_t l_type; + int16_t l_whence; + int32_t l_sysid; + union metaflock *u; + u = (union metaflock *)memory; + if (IsLinux()) { + l_start = u->linux.l_start; + l_len = u->linux.l_len; + l_pid = u->linux.l_pid; + l_type = u->linux.l_type; + l_whence = u->linux.l_whence; + l_sysid = 0; + } else if (IsXnu()) { + l_start = u->xnu.l_start; + l_len = u->xnu.l_len; + l_pid = u->xnu.l_pid; + l_type = u->xnu.l_type; + l_whence = u->xnu.l_whence; + l_sysid = 0; + } else if (IsFreebsd()) { + l_start = u->freebsd.l_start; + l_len = u->freebsd.l_len; + l_pid = u->freebsd.l_pid; + l_type = u->freebsd.l_type; + l_whence = u->freebsd.l_whence; + l_sysid = u->freebsd.l_sysid; + } else if (IsOpenbsd()) { + l_start = u->openbsd.l_start; + l_len = u->openbsd.l_len; + l_pid = u->openbsd.l_pid; + l_type = u->openbsd.l_type; + l_whence = u->openbsd.l_whence; + l_sysid = 0; + } else if (IsNetbsd()) { + l_start = u->netbsd.l_start; + l_len = u->netbsd.l_len; + l_pid = u->netbsd.l_pid; + l_type = u->netbsd.l_type; + l_whence = u->netbsd.l_whence; + l_sysid = 0; + } else { + return; + } + u->cosmo.l_start = l_start; + u->cosmo.l_len = l_len; + u->cosmo.l_pid = l_pid; + u->cosmo.l_type = l_type; + u->cosmo.l_whence = l_whence; + u->cosmo.l_sysid = l_sysid; +} + +void cosmo2flock(uintptr_t memory) { + int64_t l_start; + int64_t l_len; + int32_t l_pid; + int16_t l_type; + int16_t l_whence; + int32_t l_sysid; + union metaflock *u; + u = (union metaflock *)memory; + l_start = u->cosmo.l_start; + l_len = u->cosmo.l_len; + l_pid = u->cosmo.l_pid; + l_type = u->cosmo.l_type; + l_whence = u->cosmo.l_whence; + l_sysid = u->cosmo.l_sysid; + if (IsLinux()) { + u->linux.l_start = l_start; + u->linux.l_len = l_len; + u->linux.l_pid = l_pid; + u->linux.l_type = l_type; + u->linux.l_whence = l_whence; + } else if (IsXnu()) { + u->xnu.l_start = l_start; + u->xnu.l_len = l_len; + u->xnu.l_pid = l_pid; + u->xnu.l_type = l_type; + u->xnu.l_whence = l_whence; + } else if (IsFreebsd()) { + u->freebsd.l_start = l_start; + u->freebsd.l_len = l_len; + u->freebsd.l_pid = l_pid; + u->freebsd.l_type = l_type; + u->freebsd.l_whence = l_whence; + u->freebsd.l_sysid = l_sysid; + } else if (IsOpenbsd()) { + u->openbsd.l_start = l_start; + u->openbsd.l_len = l_len; + u->openbsd.l_pid = l_pid; + u->openbsd.l_type = l_type; + u->openbsd.l_whence = l_whence; + } else if (IsNetbsd()) { + u->netbsd.l_start = l_start; + u->netbsd.l_len = l_len; + u->netbsd.l_pid = l_pid; + u->netbsd.l_type = l_type; + u->netbsd.l_whence = l_whence; + } +} diff --git a/libc/calls/openat-sysv.c b/libc/calls/openat-sysv.c index 2bfbfdeab..09dfc678a 100644 --- a/libc/calls/openat-sysv.c +++ b/libc/calls/openat-sysv.c @@ -36,7 +36,7 @@ int sys_openat(int dirfd, const char *file, int flags, unsigned mode) { errno = err; fd = __sys_openat(dirfd, file, flags & ~O_CLOEXEC, mode); if (fd != -1 && (flags & O_CLOEXEC)) { - sys_fcntl(fd, F_SETFD, FD_CLOEXEC); + __sys_fcntl(fd, F_SETFD, FD_CLOEXEC); } } diff --git a/libc/calls/preadv.c b/libc/calls/preadv.c index 2467b9370..3ad2b28f2 100644 --- a/libc/calls/preadv.c +++ b/libc/calls/preadv.c @@ -23,6 +23,7 @@ #include "libc/calls/struct/iovec.h" #include "libc/dce.h" #include "libc/errno.h" +#include "libc/intrin/asan.internal.h" #include "libc/macros.internal.h" #include "libc/sysv/consts/iov.h" #include "libc/sysv/errfuns.h" @@ -45,6 +46,7 @@ ssize_t preadv(int fd, struct iovec *iov, int iovlen, int64_t off) { if (fd < 0) return einval(); if (iovlen < 0) return einval(); + if (IsAsan() && !__asan_is_valid_iov(iov, iovlen)) return efault(); if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { return weaken(__zipos_read)( (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, off); diff --git a/libc/calls/pwritev.c b/libc/calls/pwritev.c index 54231e6ec..036ddfdb0 100644 --- a/libc/calls/pwritev.c +++ b/libc/calls/pwritev.c @@ -22,6 +22,7 @@ #include "libc/calls/struct/iovec.h" #include "libc/dce.h" #include "libc/errno.h" +#include "libc/intrin/asan.internal.h" #include "libc/macros.internal.h" #include "libc/sysv/consts/iov.h" #include "libc/sysv/errfuns.h" @@ -49,6 +50,7 @@ ssize_t pwritev(int fd, const struct iovec *iov, int iovlen, int64_t off) { if (fd < 0) return einval(); if (iovlen < 0) return einval(); + if (IsAsan() && !__asan_is_valid_iov(iov, iovlen)) return efault(); if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { return weaken(__zipos_write)( (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, off); diff --git a/libc/calls/readv.c b/libc/calls/readv.c index 24212c202..0d2087aa5 100644 --- a/libc/calls/readv.c +++ b/libc/calls/readv.c @@ -20,6 +20,7 @@ #include "libc/calls/calls.h" #include "libc/calls/internal.h" #include "libc/calls/struct/iovec.h" +#include "libc/intrin/asan.internal.h" #include "libc/sock/internal.h" #include "libc/sysv/errfuns.h" #include "libc/zipos/zipos.internal.h" @@ -31,18 +32,21 @@ * @asyncsignalsafe */ ssize_t readv(int fd, const struct iovec *iov, int iovlen) { - if (fd < 0) return einval(); - if (iovlen < 0) return einval(); - if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { - return weaken(__zipos_read)( - (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1); - } else if (!IsWindows() && !IsMetal()) { - return sys_readv(fd, iov, iovlen); - } else if (fd >= g_fds.n) { - return ebadf(); - } else if (IsMetal()) { - return sys_readv_metal(g_fds.p + fd, iov, iovlen); + if (fd >= 0 && iovlen >= 0) { + if (IsAsan() && !__asan_is_valid_iov(iov, iovlen)) return efault(); + if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { + return weaken(__zipos_read)( + (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1); + } else if (!IsWindows() && !IsMetal()) { + return sys_readv(fd, iov, iovlen); + } else if (fd >= g_fds.n) { + return ebadf(); + } else if (IsMetal()) { + return sys_readv_metal(g_fds.p + fd, iov, iovlen); + } else { + return sys_readv_nt(g_fds.p + fd, iov, iovlen); + } } else { - return sys_readv_nt(g_fds.p + fd, iov, iovlen); + return einval(); } } diff --git a/libc/calls/struct/flock.h b/libc/calls/struct/flock.h index 52319ee31..2a9650579 100644 --- a/libc/calls/struct/flock.h +++ b/libc/calls/struct/flock.h @@ -2,12 +2,13 @@ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_FLOCK_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) -struct flock { - short l_type; - short l_whence; - int64_t l_start; - int64_t l_len; - int l_pid; +struct flock { /* cosmopolitan abi */ + int16_t l_type; /* F_RDLCK, F_WRLCK, F_UNLCK */ + int16_t l_whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ + int64_t l_start; /* starting offset */ + int64_t l_len; /* 0 means until end of file */ + int32_t l_pid; /* lock owner */ + int32_t l_sysid; /* remote system id or zero for local */ }; #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ diff --git a/libc/calls/sysinfo.c b/libc/calls/sysinfo.c index 108b84912..f061cf1cc 100644 --- a/libc/calls/sysinfo.c +++ b/libc/calls/sysinfo.c @@ -21,11 +21,13 @@ #include "libc/calls/internal.h" #include "libc/calls/struct/sysinfo.h" #include "libc/dce.h" +#include "libc/intrin/asan.internal.h" #include "libc/nt/accounting.h" #include "libc/nt/runtime.h" #include "libc/nt/struct/memorystatusex.h" #include "libc/nt/systeminfo.h" #include "libc/str/str.h" +#include "libc/sysv/errfuns.h" /** * Returns amount of system ram, cores, etc. @@ -34,6 +36,11 @@ */ int sysinfo(struct sysinfo *info) { int rc; + if (IsAsan()) { + if (info && !__asan_is_valid(info, sizeof(*info))) { + return efault(); + } + } memset(info, 0, sizeof(*info)); if (!IsWindows()) { rc = sys_sysinfo(info); diff --git a/libc/calls/utimes.c b/libc/calls/utimes.c index 7fe812540..1f4f8edcb 100644 --- a/libc/calls/utimes.c +++ b/libc/calls/utimes.c @@ -18,7 +18,9 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" #include "libc/dce.h" +#include "libc/intrin/asan.internal.h" #include "libc/sysv/consts/at.h" +#include "libc/sysv/errfuns.h" #include "libc/time/time.h" /** @@ -30,6 +32,11 @@ * @see stat() */ int utimes(const char *path, const struct timeval tv[2]) { + if (IsAsan()) { + if (tv && !__asan_is_valid(tv, sizeof(*tv) * 2)) { + return efault(); + } + } if (!IsWindows()) { /* * we don't modernize utimes() into utimensat() because the diff --git a/libc/calls/wait4.c b/libc/calls/wait4.c index 564a64848..420ef53eb 100644 --- a/libc/calls/wait4.c +++ b/libc/calls/wait4.c @@ -20,6 +20,8 @@ #include "libc/calls/internal.h" #include "libc/calls/wait4.h" #include "libc/dce.h" +#include "libc/intrin/asan.internal.h" +#include "libc/sysv/errfuns.h" /** * Waits for status to change on process. @@ -35,6 +37,16 @@ */ int wait4(int pid, int *opt_out_wstatus, int options, struct rusage *opt_out_rusage) { + if (IsAsan()) { + if (opt_out_wstatus && + !__asan_is_valid(opt_out_wstatus, sizeof(*opt_out_wstatus))) { + return efault(); + } + if (opt_out_rusage && + !__asan_is_valid(opt_out_rusage, sizeof(*opt_out_rusage))) { + return efault(); + } + } if (!IsWindows()) { return sys_wait4(pid, opt_out_wstatus, options, opt_out_rusage); } else { diff --git a/libc/calls/writev.c b/libc/calls/writev.c index 53821450b..e6d31258c 100644 --- a/libc/calls/writev.c +++ b/libc/calls/writev.c @@ -19,6 +19,7 @@ #include "libc/bits/weaken.h" #include "libc/calls/calls.h" #include "libc/calls/internal.h" +#include "libc/intrin/asan.internal.h" #include "libc/sock/internal.h" #include "libc/sysv/errfuns.h" #include "libc/zipos/zipos.internal.h" @@ -34,18 +35,21 @@ * @return number of bytes actually handed off, or -1 w/ errno */ ssize_t writev(int fd, const struct iovec *iov, int iovlen) { - if (fd < 0) return einval(); - if (iovlen < 0) return einval(); - if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { - return weaken(__zipos_write)( - (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1); - } else if (!IsWindows() && !IsMetal()) { - return sys_writev(fd, iov, iovlen); - } else if (fd >= g_fds.n) { - return ebadf(); - } else if (IsMetal()) { - return sys_writev_metal(g_fds.p + fd, iov, iovlen); + if (fd >= 0 && iovlen >= 0) { + if (IsAsan() && !__asan_is_valid_iov(iov, iovlen)) return efault(); + if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { + return weaken(__zipos_write)( + (struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1); + } else if (!IsWindows() && !IsMetal()) { + return sys_writev(fd, iov, iovlen); + } else if (fd >= g_fds.n) { + return ebadf(); + } else if (IsMetal()) { + return sys_writev_metal(g_fds.p + fd, iov, iovlen); + } else { + return sys_writev_nt(g_fds.p + fd, iov, iovlen); + } } else { - return sys_writev_nt(g_fds.p + fd, iov, iovlen); + return einval(); } } diff --git a/libc/dce.h b/libc/dce.h index 73cde783f..6b02b308b 100644 --- a/libc/dce.h +++ b/libc/dce.h @@ -57,6 +57,12 @@ #define IsOptimized() 0 #endif +#ifdef __FSANITIZE_ADDRESS__ +#define IsAsan() 1 +#else +#define IsAsan() 0 +#endif + #if defined(__PIE__) || defined(__PIC__) #define IsPositionIndependent() 1 #else diff --git a/libc/dns/dns.h b/libc/dns/dns.h index 5205a42a9..48bc50b7c 100644 --- a/libc/dns/dns.h +++ b/libc/dns/dns.h @@ -27,6 +27,15 @@ #define EAI_INTR -104 #define EAI_NOTCANCELED -102 +/* AI_* conforms to NT ABI */ +#define AI_PASSIVE 1 +#define AI_CANONNAME 2 +#define AI_NUMERICHOST 4 +#define AI_NUMERICSERV 8 +#define AI_ALL 0x0100 +#define AI_ADDRCONFIG 0x0400 +#define AI_V4MAPPED 0x0800 + #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ diff --git a/libc/dns/getaddrinfo.c b/libc/dns/getaddrinfo.c index 3443877ed..76cb26a36 100644 --- a/libc/dns/getaddrinfo.c +++ b/libc/dns/getaddrinfo.c @@ -26,7 +26,6 @@ #include "libc/sock/sock.h" #include "libc/str/str.h" #include "libc/sysv/consts/af.h" -#include "libc/sysv/consts/ai.h" #include "libc/sysv/consts/inaddr.h" #include "libc/sysv/errfuns.h" diff --git a/libc/fmt/kerrornames.S b/libc/fmt/kerrornames.S index 7574a5b9a..fa3072923 100644 --- a/libc/fmt/kerrornames.S +++ b/libc/fmt/kerrornames.S @@ -21,7 +21,7 @@ .macro .e e .long \e - kErrorNames .long 1f - kErrorNames - .section .rodata.str1.1 + .rodata.str1.1 1: .string "\e" .previous .endm @@ -114,51 +114,5 @@ kErrorNames: .e ENOTRECOVERABLE .e ENONET .e ERESTART - .e ECHRNG - .e EL2NSYNC - .e EL3HLT - .e EL3RST - .e ELNRNG - .e EUNATCH - .e ENOCSI - .e EL2HLT - .e EBADE - .e EBADR - .e EXFULL - .e ENOANO - .e EBADRQC - .e EBADSLT - .e ENOSTR - .e ENODATA - .e ENOSR - .e ENOPKG - .e ENOLINK - .e EADV - .e ESRMNT - .e ECOMM - .e EMULTIHOP - .e EDOTDOT - .e ENOTUNIQ - .e EBADFD - .e EREMCHG - .e ELIBACC - .e ELIBBAD - .e ELIBSCN - .e ELIBMAX - .e ELIBEXEC - .e ESTRPIPE - .e EUCLEAN - .e ENOTNAM - .e ENAVAIL - .e EISNAM - .e EREMOTEIO - .e ENOMEDIUM - .e EMEDIUMTYPE - .e ENOKEY - .e EKEYEXPIRED - .e EKEYREVOKED - .e EKEYREJECTED - .e ERFKILL - .e EHWPOISON .long 0 .endobj kErrorNames,globl,hidden diff --git a/libc/intrin/asan.c b/libc/intrin/asan.c index 8c3fd939e..7573af0c2 100644 --- a/libc/intrin/asan.c +++ b/libc/intrin/asan.c @@ -21,6 +21,7 @@ #include "libc/bits/likely.h" #include "libc/bits/weaken.h" #include "libc/calls/calls.h" +#include "libc/calls/struct/iovec.h" #include "libc/dce.h" #include "libc/intrin/asan.internal.h" #include "libc/log/log.h" @@ -116,7 +117,7 @@ struct AsanMorgue { static struct AsanMorgue __asan_morgue; -static uint64_t __asan_bsrl(uint64_t x) { +static inline int __asan_bsrl(uint64_t x) { return __builtin_clzll(x) ^ 63; } @@ -137,7 +138,7 @@ static size_t __asan_strlen(const char *s) { static int __asan_strcmp(const char *l, const char *r) { size_t i = 0; while (l[i] == r[i] && r[i]) ++i; - return (l[i] & 0xff) - (r[i] & 0xff); + return (l[i] & 255) - (r[i] & 255); } static char *__asan_stpcpy(char *d, const char *s) { @@ -168,7 +169,7 @@ static void *__asan_memset(void *p, int c, size_t n) { size_t i; uint64_t x; b = p; - x = 0x0101010101010101 * (c & 0xff); + x = 0x0101010101010101 * (c & 255); switch (n) { case 0: return p; @@ -293,73 +294,105 @@ static void *__asan_memcpy(void *dst, const void *src, size_t n) { return dst; } -static size_t __asan_int2hex(uint64_t x, char b[17], uint8_t k) { - int i; - char *p; - for (p = b; k > 0;) { - *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15]; - } - *p = '\0'; - return p - b; +static char *__asan_hexcpy(char *p, uint64_t x, uint8_t k) { + while (k) *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15]; + return p; } -static size_t __asan_uint2str(uint64_t i, char *a) { - size_t j; - j = 0; +static char *__asan_uint2str(char *p, uint64_t i) { + int j = 0; do { - a[j++] = i % 10 + '0'; + p[j++] = i % 10 + '0'; i /= 10; } while (i > 0); - a[j] = '\0'; - reverse(a, j); - return j; + reverse(p, j); + return p + j; } -static size_t __asan_int2str(int64_t i, char *a) { - if (i >= 0) return __asan_uint2str(i, a); - *a++ = '-'; - return 1 + __asan_uint2str(-i, a); +static char *__asan_intcpy(char *p, int64_t i) { + if (i >= 0) return __asan_uint2str(p, i); + *p++ = '-'; + return __asan_uint2str(p, -i); } -void __asan_poison(uintptr_t p, size_t n, int kind) { - int k; - char *s; - if (!n) return; - if (UNLIKELY(p & 7)) { - k = MIN(8 - (p & 7), n); - s = SHADOW(p); - if (*s == 0 || *s > (p & 7)) { - *s = p & 7; - } - n -= k; - p += k; +void __asan_poison(uintptr_t p, size_t n, int t) { + signed char k, *s; + k = p & 7; + s = (signed char *)((p >> 3) + 0x7fff8000); + if (UNLIKELY(k)) { + if (n && (!*s || *s > k) && 8 - k >= n) *s = k; + ++s, n -= MIN(8 - k, n); } - __asan_memset(SHADOW(p), kind, n >> 3); + __asan_memset(s, t, n >> 3); if ((k = n & 7)) { - s = SHADOW(p + n); - if (*s < 0 || (*s > 0 && *s >= k)) { - *s = kind; - } + s += n >> 3; + if (*s < 0 || 0 < *s && *s <= k) *s = t; } } void __asan_unpoison(uintptr_t p, size_t n) { - int k; - char *s; - if (!n) return; - if (UNLIKELY(p & 7)) { - k = MIN(8 - (p & 7), n); - s = SHADOW(p); - *s = 0; - n -= k; - p += k; + signed char k, *s; + k = p & 7; + s = (signed char *)((p >> 3) + 0x7fff8000); + if (UNLIKELY(k)) { + if (n) *s = 0; + ++s, n -= MIN(8 - k, n); } - __asan_memset(SHADOW(p), 0, n >> 3); + __asan_memset(s, 0, n >> 3); if ((k = n & 7)) { - s = SHADOW(p + n); - if (*s && *s < k) { - *s = k; + s += n >> 3; + if (*s && *s < k) *s = k; + } +} + +bool __asan_is_valid(const void *p, size_t n) { + signed char k, *s, *e; + if (n) { + k = (uintptr_t)p & 7; + s = (signed char *)(((uintptr_t)p >> 3) + 0x7fff8000); + if (UNLIKELY(k)) { + if (n && !(!*s || *s >= k + n)) return false; + ++s, n -= MIN(8 - k, n); } + e = s; + k = n & 7; + e += n >> 3; + for (; s + 8 <= e; s += 8) { + if ((uint64_t)(255 & s[0]) << 000 | (uint64_t)(255 & s[1]) << 010 | + (uint64_t)(255 & s[2]) << 020 | (uint64_t)(255 & s[3]) << 030 | + (uint64_t)(255 & s[4]) << 040 | (uint64_t)(255 & s[5]) << 050 | + (uint64_t)(255 & s[6]) << 060 | (uint64_t)(255 & s[7]) << 070) { + return false; + } + } + while (s < e) { + if (*s++) { + return false; + } + } + if (k) { + if (!(!*s || *s >= k)) { + return false; + } + } + } + return true; +} + +bool __asan_is_valid_iov(const struct iovec *iov, int iovlen) { + int i; + size_t size; + if (iovlen >= 0 && + !__builtin_mul_overflow(iovlen, sizeof(struct iovec), &size) && + __asan_is_valid(iov, size)) { + for (i = 0; i < iovlen; ++i) { + if (!__asan_is_valid(iov[i].iov_base, iov[i].iov_len)) { + return false; + } + } + return true; + } else { + return false; } } @@ -376,7 +409,7 @@ static const char *__asan_dscribe_heap_poison(long c) { } } -static const char *__asan_describe_access_poison(char *p) { +static const char *__asan_describe_access_poison(signed char *p) { int c = p[0]; if (1 <= c && c <= 7) c = p[1]; switch (c) { @@ -445,15 +478,10 @@ static ssize_t __asan_write_string(const char *s) { return __asan_write(s, __asan_strlen(s)); } -static wontreturn void __asan_abort(void) { - if (weaken(__die)) weaken(__die)(); - __asan_exit(134); -} - static wontreturn void __asan_die(const char *msg) { __asan_write_string(msg); if (weaken(__die)) weaken(__die)(); - __asan_abort(); + __asan_exit(134); } static char *__asan_report_start(char *p) { @@ -472,9 +500,9 @@ static wontreturn void __asan_report_heap_fault(void *addr, long c) { p = __asan_report_start(buf); p = __asan_stpcpy(p, __asan_dscribe_heap_poison(c)); p = __asan_stpcpy(p, " at 0x"); - p = __asan_mempcpy(p, ibuf, __asan_int2hex((intptr_t)addr, ibuf, 48)); + p = __asan_hexcpy(p, (intptr_t)addr, 48); p = __asan_stpcpy(p, " shadow 0x"); - p = __asan_mempcpy(p, ibuf, __asan_int2hex((intptr_t)SHADOW(addr), ibuf, 48)); + p = __asan_hexcpy(p, (intptr_t)SHADOW(addr), 48); p = __asan_stpcpy(p, "\r\n"); __asan_die(buf); } @@ -485,20 +513,20 @@ static wontreturn void __asan_report_memory_fault(uint8_t *addr, int size, p = __asan_report_start(buf); p = __asan_stpcpy(p, __asan_describe_access_poison(SHADOW(addr))); p = __asan_stpcpy(p, " "); - p = __asan_mempcpy(p, ibuf, __asan_int2str(size, ibuf)); + p = __asan_intcpy(p, size); p = __asan_stpcpy(p, "-byte "); p = __asan_stpcpy(p, kind); p = __asan_stpcpy(p, " at 0x"); - p = __asan_mempcpy(p, ibuf, __asan_int2hex((intptr_t)addr, ibuf, 48)); + p = __asan_hexcpy(p, (uintptr_t)addr, 48); p = __asan_stpcpy(p, " shadow 0x"); - p = __asan_mempcpy(p, ibuf, __asan_int2hex((intptr_t)SHADOW(addr), ibuf, 48)); + p = __asan_hexcpy(p, (uintptr_t)SHADOW(addr), 48); p = __asan_stpcpy(p, "\r\n"); __asan_die(buf); } const void *__asan_morgue_add(void *p) { void *r; - unsigned i, j; + int i, j; for (;;) { i = __asan_morgue.i; j = (i + 1) & (ARRAYLEN(__asan_morgue.p) - 1); @@ -511,8 +539,8 @@ const void *__asan_morgue_add(void *p) { } static void __asan_morgue_flush(void) { + int i; void *p; - unsigned i; for (i = 0; i < ARRAYLEN(__asan_morgue.p); ++i) { p = __asan_morgue.p[i]; if (cmpxchg(__asan_morgue.p + i, p, NULL)) { @@ -532,15 +560,16 @@ static size_t __asan_heap_size(size_t n) { } static void *__asan_allocate(size_t a, size_t n, int underrun, int overrun) { - char *p; size_t c; + char *p, *f; if ((p = weaken(dlmemalign)(a, __asan_heap_size(n)))) { c = weaken(dlmalloc_usable_size)(p); __asan_unpoison((uintptr_t)p, n); __asan_poison((uintptr_t)p - 16, 16, underrun); /* see dlmalloc design */ __asan_poison((uintptr_t)p + n, c - n, overrun); __asan_memset(p, 0xF9, n); - WRITE64BE(p + c - sizeof(n), n); + f = p + c - 8; + WRITE64BE(f, n); } return p; } @@ -548,7 +577,7 @@ static void *__asan_allocate(size_t a, size_t n, int underrun, int overrun) { static size_t __asan_malloc_usable_size(const void *p) { size_t c, n; if ((c = weaken(dlmalloc_usable_size)(p)) >= 8) { - if ((n = READ64BE((char *)p + c - sizeof(n))) <= c) { + if ((n = READ64BE((char *)p + c - 8)) <= c) { return n; } else { __asan_report_heap_fault(p, n); @@ -561,9 +590,9 @@ static size_t __asan_malloc_usable_size(const void *p) { static void __asan_deallocate(char *p, long kind) { size_t c, n; if ((c = weaken(dlmalloc_usable_size)(p)) >= 8) { - if ((n = READ64BE((char *)p + c - sizeof(n))) <= c) { - WRITE64BE((char *)p + c - sizeof(n), kind); - __asan_poison((uintptr_t)p, n, kind); + if ((n = READ64BE(p + c - 8)) <= c) { + WRITE64BE(p + c - 8, kind); + __asan_poison((uintptr_t)p, c - 8, kind); if (weaken(dlfree)) { weaken(dlfree)(__asan_morgue_add(p)); } @@ -588,43 +617,47 @@ static void *__asan_malloc(size_t size) { return __asan_memalign(16, size); } -static void *__asan_calloc(size_t nelem, size_t elsize) { +static void *__asan_calloc(size_t n, size_t m) { char *p; - size_t n; - if (__builtin_mul_overflow(nelem, elsize, &n)) n = -1; + if (__builtin_mul_overflow(n, m, &n)) n = -1; if ((p = __asan_malloc(n))) __asan_memset(p, 0, n); return p; } static void *__asan_realloc(void *p, size_t n) { - char *p2; + char *q, *f; size_t c, m; if (p) { if (n) { - if ((c = weaken(dlmalloc_usable_size)(p)) < 8) + if ((c = weaken(dlmalloc_usable_size)(p)) >= 8) { + f = (char *)p + c - 8; + if ((m = READ64BE(f)) <= c) { + if (n <= m) { /* shrink */ + __asan_poison((uintptr_t)p + n, m - n, kAsanHeapOverrun); + WRITE64BE(f, n); + q = p; + } else if (n <= c - 8) { /* small growth */ + __asan_unpoison((uintptr_t)p + m, n - m); + WRITE64BE(f, n); + q = p; + } else if ((q = __asan_malloc(n))) { /* exponential growth */ + __asan_memcpy(q, p, m); + __asan_deallocate(p, kAsanRelocated); + } + } else { + __asan_report_heap_fault(p, m); + } + } else { __asan_report_heap_fault(p, 0); - if ((m = READ64BE((char *)p + c - sizeof(n))) > c) - __asan_report_heap_fault(p, m); - if (n <= m) { /* shrink */ - __asan_poison((uintptr_t)p + n, m - n, kAsanHeapOverrun); - WRITE64BE((char *)p + c - sizeof(n), n); - p2 = p; - } else if (n <= c - 8) { /* small growth */ - __asan_unpoison((uintptr_t)p + m, n - m); - WRITE64BE((char *)p + c - sizeof(n), n); - p2 = p; - } else if ((p2 = __asan_malloc(n))) { /* exponential growth */ - __asan_memcpy(p2, p, m); - __asan_deallocate(p, kAsanRelocated); } } else { __asan_free(p); - p2 = NULL; + q = NULL; } } else { - p2 = __asan_malloc(n); + q = __asan_malloc(n); } - return p2; + return q; } static void *__asan_valloc(size_t n) { diff --git a/libc/intrin/asan.internal.h b/libc/intrin/asan.internal.h index 6e6bd3f6d..8f301e39b 100644 --- a/libc/intrin/asan.internal.h +++ b/libc/intrin/asan.internal.h @@ -1,5 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_INTRIN_ASAN_H_ #define COSMOPOLITAN_LIBC_INTRIN_ASAN_H_ +#include "libc/calls/struct/iovec.h" #define kAsanScale 3 #define kAsanMagic 0x7fff8000 @@ -17,10 +18,12 @@ #define kAsanUnscoped -12 #define kAsanUnmapped -13 -#define SHADOW(x) ((char *)(((uintptr_t)(x) >> kAsanScale) + kAsanMagic)) +#define SHADOW(x) ((signed char *)(((uintptr_t)(x) >> kAsanScale) + kAsanMagic)) void __asan_map_shadow(uintptr_t, size_t); void __asan_poison(uintptr_t, size_t, int); void __asan_unpoison(uintptr_t, size_t); +bool __asan_is_valid(const void *, size_t); +bool __asan_is_valid_iov(const struct iovec *, int); #endif /* COSMOPOLITAN_LIBC_INTRIN_ASAN_H_ */ diff --git a/libc/intrin/somanyasan.S b/libc/intrin/somanyasan.S index 5bd1076be..818314184 100644 --- a/libc/intrin/somanyasan.S +++ b/libc/intrin/somanyasan.S @@ -19,6 +19,16 @@ #include "libc/macros.internal.h" .source __FILE__ + .macro .acall fn:req + xor %eax,%eax + mov $1,%r10b + cmpxchg %r10b,__asan_noreentry(%rip) + jnz 2f + call \fn + decb __asan_noreentry(%rip) +2: nop + .endm + .rodata.cst4 __asan_option_detect_stack_use_after_return: .long 0 @@ -32,181 +42,362 @@ __asan_noreentry: .previous __asan_report_load1: - push $1 - jmp OnReportLoad + push %rbp + mov %rsp,%rbp + .profilable + mov $1,%esi + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load1,globl + __asan_report_load2: - push $2 - jmp OnReportLoad + push %rbp + mov %rsp,%rbp + .profilable + mov $2,%esi + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load2,globl + __asan_report_load4: - push $4 - jmp OnReportLoad + push %rbp + mov %rsp,%rbp + .profilable + mov $4,%esi + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load4,globl + __asan_report_load8: - push $8 - jmp OnReportLoad + push %rbp + mov %rsp,%rbp + .profilable + mov $8,%esi + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load8,globl + __asan_report_load16: - push $16 - jmp OnReportLoad + push %rbp + mov %rsp,%rbp + .profilable + mov $16,%esi + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load16,globl + __asan_report_load32: - push $32 -// 𝑠𝑙𝑖𝑑𝑒 + push %rbp + mov %rsp,%rbp + .profilable + mov $32,%esi + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load32,globl -OnReportLoad: - pop %rsi -// 𝑠𝑙𝑖𝑑𝑒 - .endfn OnReportLoad + __asan_report_load_n: - lea __asan_report_load(%rip),%r11 - jmp __asan_report_noreentry + push %rbp + mov %rsp,%rbp + .profilable + .acall __asan_report_load + pop %rbp + ret .endfn __asan_report_load_n,globl __asan_report_store1: - push $1 - jmp ReportStore - .endfn __asan_report_store1,globl -__asan_report_store2: - push $2 - jmp ReportStore - .endfn __asan_report_store2,globl -__asan_report_store4: - push $4 - jmp ReportStore - .endfn __asan_report_store4,globl -__asan_report_store8: - push $8 - jmp ReportStore - .endfn __asan_report_store8,globl -__asan_report_store16: - push $16 - jmp ReportStore - .endfn __asan_report_store16,globl -__asan_report_store32: - push $32 -// 𝑠𝑙𝑖𝑑𝑒 - .endfn __asan_report_store32,globl -ReportStore: - pop %rsi -// 𝑠𝑙𝑖𝑑𝑒 - .endfn ReportStore -__asan_report_store_n: - lea __asan_report_store(%rip),%r11 -// 𝑠𝑙𝑖𝑑𝑒 - .endfn __asan_report_store_n,globl - -__asan_report_noreentry: push %rbp mov %rsp,%rbp - xor %eax,%eax - mov $1,%r10b - cmpxchg %r10b,__asan_noreentry(%rip) - jnz 2f - call *%r11 - decb __asan_noreentry(%rip) -2: pop %rbp + .profilable + mov $1,%esi + .acall __asan_report_store + pop %rbp ret - .endfn __asan_report_noreentry + .endfn __asan_report_store1,globl + +__asan_report_store2: + push %rbp + mov %rsp,%rbp + .profilable + mov $2,%esi + .acall __asan_report_store + pop %rbp + ret + .endfn __asan_report_store2,globl + +__asan_report_store4: + push %rbp + mov %rsp,%rbp + .profilable + mov $4,%esi + .acall __asan_report_store + pop %rbp + ret + .endfn __asan_report_store4,globl + +__asan_report_store8: + push %rbp + mov %rsp,%rbp + .profilable + mov $8,%esi + .acall __asan_report_store + pop %rbp + ret + .endfn __asan_report_store8,globl + +__asan_report_store16: + push %rbp + mov %rsp,%rbp + .profilable + mov $16,%esi + .acall __asan_report_store + pop %rbp + ret + .endfn __asan_report_store16,globl + +__asan_report_store32: + push %rbp + mov %rsp,%rbp + .profilable + mov $32,%esi + .acall __asan_report_store + pop %rbp + ret + .endfn __asan_report_store32,globl + +__asan_report_store_n: + push %rbp + mov %rsp,%rbp + .profilable + .acall __asan_report_store + pop %rbp + ret + .endfn __asan_report_store_n,globl __asan_stack_free_0: - push $0 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $0,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_0,globl + __asan_stack_free_1: - push $1 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $1,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_1,globl + __asan_stack_free_2: - push $2 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $2,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_2,globl + __asan_stack_free_3: - push $3 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $3,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_3,globl + __asan_stack_free_4: - push $4 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $4,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_4,globl + __asan_stack_free_5: - push $5 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $5,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_5,globl + __asan_stack_free_6: - push $6 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $6,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_6,globl + __asan_stack_free_7: - push $7 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $7,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_7,globl + __asan_stack_free_8: - push $8 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $8,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_8,globl + __asan_stack_free_9: - push $9 - jmp OnStackFree + push %rbp + mov %rsp,%rbp + .profilable + mov $9,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_9,globl + __asan_stack_free_10: - push $10 -// 𝑠𝑙𝑖𝑑𝑒 + push %rbp + mov %rsp,%rbp + .profilable + mov $10,%edx + call __asan_stack_free + pop %rbp + ret .endfn __asan_stack_free_10,globl -OnStackFree: - pop %rdx - jmp __asan_stack_free - .endfn OnStackFree __asan_stack_malloc_0: - push $0 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $0,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_0,globl + __asan_stack_malloc_1: - push $1 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $1,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_1,globl + __asan_stack_malloc_2: - push $2 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $2,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_2,globl + __asan_stack_malloc_3: - push $3 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $3,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_3,globl + __asan_stack_malloc_4: - push $4 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $4,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_4,globl + __asan_stack_malloc_5: - push $5 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $5,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_5,globl + __asan_stack_malloc_6: - push $6 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $6,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_6,globl + __asan_stack_malloc_7: - push $7 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $7,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_7,globl + __asan_stack_malloc_8: - push $8 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $8,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_8,globl + __asan_stack_malloc_9: - push $9 - jmp OnStackMalloc + push %rbp + mov %rsp,%rbp + .profilable + mov $9,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_9,globl + __asan_stack_malloc_10: - push $10 -// 𝑠𝑙𝑖𝑑𝑒 + push %rbp + mov %rsp,%rbp + .profilable + mov $10,%esi + call __asan_stack_malloc + pop %rbp + ret .endfn __asan_stack_malloc_10,globl -OnStackMalloc: - pop %rsi - jmp __asan_stack_malloc - .endfn OnStackMalloc __asan_version_mismatch_check_v8: ret @@ -242,26 +433,31 @@ __asan_load1: mov %rsp,%rbp ud2 .endfn __asan_load1,globl + __asan_load2: push %rbp mov %rsp,%rbp ud2 .endfn __asan_load2,globl + __asan_load4: push %rbp mov %rsp,%rbp ud2 .endfn __asan_load4,globl + __asan_load8: push %rbp mov %rsp,%rbp ud2 .endfn __asan_load8,globl + __asan_load16: push %rbp mov %rsp,%rbp ud2 .endfn __asan_load16,globl + __asan_load32: push %rbp mov %rsp,%rbp @@ -273,26 +469,31 @@ __asan_store1: mov %rsp,%rbp ud2 .endfn __asan_store1,globl + __asan_store2: push %rbp mov %rsp,%rbp ud2 .endfn __asan_store2,globl + __asan_store4: push %rbp mov %rsp,%rbp ud2 .endfn __asan_store4,globl + __asan_store8: push %rbp mov %rsp,%rbp ud2 .endfn __asan_store8,globl + __asan_store16: push %rbp mov %rsp,%rbp ud2 .endfn __asan_store16,globl + __asan_store32: push %rbp mov %rsp,%rbp diff --git a/libc/log/log.h b/libc/log/log.h index 170153b4c..ba54a42eb 100644 --- a/libc/log/log.h +++ b/libc/log/log.h @@ -1,5 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_ #define COSMOPOLITAN_LIBC_LOG_LOG_H_ +#include "libc/bits/likely.h" #include "libc/calls/struct/sigset.h" #include "libc/calls/struct/winsize.h" #include "libc/stdio/stdio.h" diff --git a/libc/log/oncrash.c b/libc/log/oncrash.c index 3c4bbbcd2..803c918ba 100644 --- a/libc/log/oncrash.c +++ b/libc/log/oncrash.c @@ -133,7 +133,7 @@ relegated static void ShowGeneralRegisters(int fd, ucontext_t *ctx) { } else { memset(&st, 0, sizeof(st)); } - dprintf(fd, " %s(%zu) %Lf", "ST", k, st); + dprintf(fd, " %s(%zu) %Lg", "ST", k, st); ++k; write(fd, "\r\n", 2); } diff --git a/libc/log/somanyubsan.S b/libc/log/somanyubsan.S index 9e481ef09..98dbb7601 100644 --- a/libc/log/somanyubsan.S +++ b/libc/log/somanyubsan.S @@ -34,232 +34,495 @@ __ubsan_get_current_report_data: .endfn __ubsan_get_current_report_data,globl __ubsan_handle_type_mismatch_abort: - jmp __ubsan_handle_type_mismatch + push %rbp + mov %rsp,%rbp + .profilable + call __ubsan_handle_type_mismatch + pop %rbp + ret .endfn __ubsan_handle_type_mismatch_abort,globl __ubsan_handle_float_cast_overflow_abort: - jmp __ubsan_handle_float_cast_overflow + push %rbp + mov %rsp,%rbp + .profilable + call __ubsan_handle_float_cast_overflow + pop %rbp + ret .endfn __ubsan_handle_float_cast_overflow_abort,globl -__ubsan_handle_type_mismatch_v1: __ubsan_handle_type_mismatch_v1_abort: - jmp ___ubsan_handle_type_mismatch_v1 - .endfn __ubsan_handle_type_mismatch_v1,globl + push %rbp + mov %rsp,%rbp + .profilable + call ___ubsan_handle_type_mismatch_v1 + pop %rbp + ret .endfn __ubsan_handle_type_mismatch_v1_abort,globl +__ubsan_handle_type_mismatch_v1: + push %rbp + mov %rsp,%rbp + .profilable + call ___ubsan_handle_type_mismatch_v1 + pop %rbp + ret + .endfn __ubsan_handle_type_mismatch_v1,globl + __ubsan_handle_add_overflow_abort: - nop -// fallthrough - .endfn __ubsan_handle_add_overflow_abort,globl -__ubsan_handle_add_overflow: + push %rbp + mov %rsp,%rbp + .profilable loadstr "add_overflow",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_add_overflow_abort,globl + +__ubsan_handle_add_overflow: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "add_overflow",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_add_overflow,globl __ubsan_handle_alignment_assumption_abort: - nop -// fallthrough - .endfn __ubsan_handle_alignment_assumption_abort,globl -__ubsan_handle_alignment_assumption: + push %rbp + mov %rsp,%rbp + .profilable loadstr "alignment_assumption",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_alignment_assumption_abort,globl + +__ubsan_handle_alignment_assumption: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "alignment_assumption",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_alignment_assumption,globl __ubsan_handle_builtin_unreachable_abort: - nop -// fallthrough - .endfn __ubsan_handle_builtin_unreachable_abort,globl -__ubsan_handle_builtin_unreachable: + push %rbp + mov %rsp,%rbp + .profilable loadstr "builtin_unreachable",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_builtin_unreachable_abort,globl + +__ubsan_handle_builtin_unreachable: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "builtin_unreachable",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_builtin_unreachable,globl __ubsan_handle_cfi_bad_type_abort: - nop -// fallthrough - .endfn __ubsan_handle_cfi_bad_type_abort,globl -__ubsan_handle_cfi_bad_type: + push %rbp + mov %rsp,%rbp + .profilable loadstr "cfi_bad_type",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_cfi_bad_type_abort,globl + +__ubsan_handle_cfi_bad_type: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "cfi_bad_type",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_cfi_bad_type,globl __ubsan_handle_cfi_check_fail_abort: - nop -// fallthrough - .endfn __ubsan_handle_cfi_check_fail_abort,globl -__ubsan_handle_cfi_check_fail: + push %rbp + mov %rsp,%rbp + .profilable loadstr "cfi_check_fail",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_cfi_check_fail_abort,globl + +__ubsan_handle_cfi_check_fail: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "cfi_check_fail",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_cfi_check_fail,globl __ubsan_handle_divrem_overflow_abort: - nop -// fallthrough - .endfn __ubsan_handle_divrem_overflow_abort,globl -__ubsan_handle_divrem_overflow: + push %rbp + mov %rsp,%rbp + .profilable loadstr "divrem_overflow",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_divrem_overflow_abort,globl + +__ubsan_handle_divrem_overflow: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "divrem_overflow",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_divrem_overflow,globl __ubsan_handle_dynamic_type_cache_miss_abort: - nop -// fallthrough - .endfn __ubsan_handle_dynamic_type_cache_miss_abort,globl -__ubsan_handle_dynamic_type_cache_miss: + push %rbp + mov %rsp,%rbp + .profilable loadstr "dynamic_type_cache_miss",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_dynamic_type_cache_miss_abort,globl + +__ubsan_handle_dynamic_type_cache_miss: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "dynamic_type_cache_miss",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_dynamic_type_cache_miss,globl __ubsan_handle_function_type_mismatch_abort: - nop -// fallthrough - .endfn __ubsan_handle_function_type_mismatch_abort,globl -__ubsan_handle_function_type_mismatch: + push %rbp + mov %rsp,%rbp + .profilable loadstr "function_type_mismatch",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_function_type_mismatch_abort,globl + +__ubsan_handle_function_type_mismatch: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "function_type_mismatch",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_function_type_mismatch,globl __ubsan_handle_implicit_conversion_abort: - nop -// fallthrough - .endfn __ubsan_handle_implicit_conversion_abort,globl -__ubsan_handle_implicit_conversion: + push %rbp + mov %rsp,%rbp + .profilable loadstr "implicit_conversion",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_implicit_conversion_abort,globl + +__ubsan_handle_implicit_conversion: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "implicit_conversion",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_implicit_conversion,globl __ubsan_handle_invalid_builtin_abort: - nop -// fallthrough - .endfn __ubsan_handle_invalid_builtin_abort,globl -__ubsan_handle_invalid_builtin: + push %rbp + mov %rsp,%rbp + .profilable loadstr "invalid_builtin",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_invalid_builtin_abort,globl + +__ubsan_handle_invalid_builtin: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "invalid_builtin",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_invalid_builtin,globl __ubsan_handle_load_invalid_value_abort: - nop -// fallthrough + push %rbp + mov %rsp,%rbp + .profilable + loadstr "load_invalid_value (uninitialized? bool∌[01]?)",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_load_invalid_value_abort,globl + __ubsan_handle_load_invalid_value: - loadstr "load_invalid_value (try checking for uninitialized variables)",si - jmp __ubsan_hop + push %rbp + mov %rsp,%rbp + .profilable + loadstr "load_invalid_value (uninitialized? bool∌[01]?)",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_load_invalid_value,globl __ubsan_handle_missing_return_abort: - nop -// fallthrough - .endfn __ubsan_handle_missing_return_abort,globl -__ubsan_handle_missing_return: + push %rbp + mov %rsp,%rbp + .profilable loadstr "missing_return",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_missing_return_abort,globl + +__ubsan_handle_missing_return: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "missing_return",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_missing_return,globl __ubsan_handle_mul_overflow_abort: - nop -// fallthrough - .endfn __ubsan_handle_mul_overflow_abort,globl -__ubsan_handle_mul_overflow: + push %rbp + mov %rsp,%rbp + .profilable loadstr "mul_overflow",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_mul_overflow_abort,globl + +__ubsan_handle_mul_overflow: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "mul_overflow",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_mul_overflow,globl __ubsan_handle_negate_overflow_abort: - nop -// fallthrough - .endfn __ubsan_handle_negate_overflow_abort,globl -__ubsan_handle_negate_overflow: + push %rbp + mov %rsp,%rbp + .profilable loadstr "negate_overflow",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_negate_overflow_abort,globl + +__ubsan_handle_negate_overflow: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "negate_overflow",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_negate_overflow,globl __ubsan_handle_nonnull_arg_abort: - nop -// fallthrough - .endfn __ubsan_handle_nonnull_arg_abort,globl -__ubsan_handle_nonnull_arg: + push %rbp + mov %rsp,%rbp + .profilable loadstr "nonnull_arg",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_nonnull_arg_abort,globl + +__ubsan_handle_nonnull_arg: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "nonnull_arg",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_nonnull_arg,globl __ubsan_handle_nonnull_return_v1_abort: - nop -// fallthrough - .endfn __ubsan_handle_nonnull_return_v1_abort,globl -__ubsan_handle_nonnull_return_v1: + push %rbp + mov %rsp,%rbp + .profilable loadstr "nonnull_return_v1",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_nonnull_return_v1_abort,globl + +__ubsan_handle_nonnull_return_v1: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "nonnull_return_v1",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_nonnull_return_v1,globl -__ubsan_hop: - jmp __ubsan_abort - .endfn __ubsan_hop - __ubsan_handle_nullability_arg_abort: - nop -// fallthrough - .endfn __ubsan_handle_nullability_arg_abort,globl -__ubsan_handle_nullability_arg: + push %rbp + mov %rsp,%rbp + .profilable loadstr "nullability_arg",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_nullability_arg_abort,globl + +__ubsan_handle_nullability_arg: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "nullability_arg",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_nullability_arg,globl __ubsan_handle_nullability_return_v1_abort: - nop -// fallthrough - .endfn __ubsan_handle_nullability_return_v1_abort,globl -__ubsan_handle_nullability_return_v1: + push %rbp + mov %rsp,%rbp + .profilable loadstr "nullability_return_v1",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_nullability_return_v1_abort,globl + +__ubsan_handle_nullability_return_v1: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "nullability_return_v1",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_nullability_return_v1,globl __ubsan_handle_pointer_overflow_abort: - nop -// fallthrough - .endfn __ubsan_handle_pointer_overflow_abort,globl -__ubsan_handle_pointer_overflow: + push %rbp + mov %rsp,%rbp + .profilable loadstr "pointer_overflow",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_pointer_overflow_abort,globl + +__ubsan_handle_pointer_overflow: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "pointer_overflow",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_pointer_overflow,globl __ubsan_handle_shift_out_of_bounds_abort: - nop -// fallthrough + push %rbp + mov %rsp,%rbp + .profilable + call __ubsan_handle_shift_out_of_bounds + pop %rbp + ret .endfn __ubsan_handle_shift_out_of_bounds_abort,globl -__ubsan_handle_shift_out_of_bounds: - loadstr "shift_out_of_bounds",si - jmp __ubsan_hop - .endfn __ubsan_handle_shift_out_of_bounds,globl __ubsan_handle_sub_overflow_abort: - nop -// fallthrough - .endfn __ubsan_handle_sub_overflow_abort,globl -__ubsan_handle_sub_overflow: + push %rbp + mov %rsp,%rbp + .profilable loadstr "sub_overflow",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_sub_overflow_abort,globl + +__ubsan_handle_sub_overflow: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "sub_overflow",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_sub_overflow,globl __ubsan_handle_vla_bound_not_positive_abort: - nop -// fallthrough - .endfn __ubsan_handle_vla_bound_not_positive_abort,globl -__ubsan_handle_vla_bound_not_positive: + push %rbp + mov %rsp,%rbp + .profilable loadstr "vla_bound_not_positive",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_vla_bound_not_positive_abort,globl + +__ubsan_handle_vla_bound_not_positive: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "vla_bound_not_positive",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_vla_bound_not_positive,globl __ubsan_handle_nonnull_return_abort: - nop -// fallthrough - .endfn __ubsan_handle_nonnull_return_abort,globl -__ubsan_handle_nonnull_return: + push %rbp + mov %rsp,%rbp + .profilable loadstr "nonnull_return",si - jmp __ubsan_hop + call __ubsan_abort + pop %rbp + ret + .endfn __ubsan_handle_nonnull_return_abort,globl + +__ubsan_handle_nonnull_return: + push %rbp + mov %rsp,%rbp + .profilable + loadstr "nonnull_return",si + call __ubsan_abort + pop %rbp + ret .endfn __ubsan_handle_nonnull_return,globl __ubsan_handle_out_of_bounds_abort: - jmp __ubsan_handle_out_of_bounds + push %rbp + mov %rsp,%rbp + .profilable + call __ubsan_handle_out_of_bounds + pop %rbp + ret .endfn __ubsan_handle_out_of_bounds_abort,globl - -.previous diff --git a/libc/log/ubsan.c b/libc/log/ubsan.c index b47e7ea90..ee64cd9ef 100644 --- a/libc/log/ubsan.c +++ b/libc/log/ubsan.c @@ -16,6 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/alg/reverse.internal.h" #include "libc/bits/pushpop.h" #include "libc/calls/calls.h" #include "libc/fmt/fmt.h" @@ -43,6 +44,89 @@ upcast of\0\ cast to virtual base of\0\ \0"; +static int __ubsan_bits(struct UbsanTypeDescriptor *t) { + return 1 << (t->info >> 1); +} + +static bool __ubsan_signed(struct UbsanTypeDescriptor *t) { + return t->info & 1; +} + +static bool __ubsan_negative(struct UbsanTypeDescriptor *t, uintptr_t x) { + return __ubsan_signed(t) && (intptr_t)x < 0; +} + +static size_t __ubsan_strlen(const char *s) { + size_t n = 0; + while (*s++) ++n; + return n; +} + +static char *__ubsan_stpcpy(char *d, const char *s) { + size_t i; + for (i = 0;; ++i) { + if (!(d[i] = s[i])) { + return d + i; + } + } +} + +static char *__ubsan_poscpy(char *p, uintptr_t i) { + int j = 0; + do { + p[j++] = i % 10 + '0'; + i /= 10; + } while (i > 0); + reverse(p, j); + return p + j; +} + +static char *__ubsan_intcpy(char *p, intptr_t i) { + if (i >= 0) return __ubsan_poscpy(p, i); + *p++ = '-'; + return __ubsan_poscpy(p, -i); +} + +static char *__ubsan_hexcpy(char *p, uintptr_t x, int k) { + while (k) *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15]; + return p; +} + +static char *__ubsan_itpcpy(char *p, struct UbsanTypeDescriptor *t, + uintptr_t x) { + if (__ubsan_signed(t)) { + return __ubsan_intcpy(p, x); + } else { + return __ubsan_poscpy(p, x); + } +} + +static const char *__ubsan_dubnul(const char *s, unsigned i) { + size_t n; + while (i--) { + if ((n = __ubsan_strlen(s))) { + s += n + 1; + } else { + return NULL; + } + } + return s; +} + +static uintptr_t __ubsan_extend(struct UbsanTypeDescriptor *t, uintptr_t x) { + int w; + w = __ubsan_bits(t); + if (w < sizeof(x) * CHAR_BIT) { + x <<= sizeof(x) * CHAR_BIT - w; + if (__ubsan_signed(t)) { + x = (intptr_t)x >> w; + } else { + x >>= w; + } + } + return x; +} + void __ubsan_abort(const struct UbsanSourceLocation *loc, const char *description) { static bool once; @@ -53,43 +137,73 @@ void __ubsan_abort(const struct UbsanSourceLocation *loc, } if (IsDebuggerPresent(false)) DebugBreak(); __start_fatal(loc->file, loc->line); - fprintf(stderr, "%s\r\n", description); + write(2, description, strlen(description)); + write(2, "\r\n", 2); __die(); - unreachable; +} + +void __ubsan_handle_shift_out_of_bounds(struct UbsanShiftOutOfBoundsInfo *info, + uintptr_t lhs, uintptr_t rhs) { + char *p; + const char *s; + lhs = __ubsan_extend(info->lhs_type, lhs); + rhs = __ubsan_extend(info->rhs_type, rhs); + if (__ubsan_negative(info->rhs_type, rhs)) { + s = "shift exponent is negative"; + } else if (rhs >= __ubsan_bits(info->lhs_type)) { + s = "shift exponent too large for type"; + } else if (__ubsan_negative(info->lhs_type, lhs)) { + s = "left shift of negative value"; + } else if (__ubsan_signed(info->lhs_type)) { + s = "signed left shift changed sign bit or overflowed"; + } else { + s = "wut shift out of bounds"; + } + p = __ubsan_buf; + p = __ubsan_stpcpy(p, s), *p++ = ' '; + p = __ubsan_itpcpy(p, info->lhs_type, lhs), *p++ = ' '; + p = __ubsan_stpcpy(p, info->lhs_type->name), *p++ = ' '; + p = __ubsan_itpcpy(p, info->rhs_type, rhs), *p++ = ' '; + p = __ubsan_stpcpy(p, info->rhs_type->name); + __ubsan_abort(&info->location, __ubsan_buf); } void __ubsan_handle_out_of_bounds(struct UbsanOutOfBoundsInfo *info, uintptr_t index) { - snprintf(__ubsan_buf, sizeof(__ubsan_buf), - "%s index %,lu into %s out of bounds", info->index_type->name, index, - info->array_type->name); + char *p; + p = __ubsan_buf; + p = __ubsan_stpcpy(p, info->index_type->name); + p = __ubsan_stpcpy(p, " index "); + p = __ubsan_itpcpy(p, info->index_type, index); + p = __ubsan_stpcpy(p, " into "); + p = __ubsan_stpcpy(p, info->array_type->name); + p = __ubsan_stpcpy(p, " out of bounds"); __ubsan_abort(&info->location, __ubsan_buf); - unreachable; } -void __ubsan_handle_type_mismatch(struct UbsanTypeMismatchInfo *type_mismatch, +void __ubsan_handle_type_mismatch(struct UbsanTypeMismatchInfo *info, uintptr_t pointer) { - struct UbsanSourceLocation *loc = &type_mismatch->location; - const char *description; - const char *kind = IndexDoubleNulString(kUbsanTypeCheckKinds, - type_mismatch->type_check_kind); - if (pointer == 0) { - description = "null pointer access"; - } else if (type_mismatch->alignment != 0 && - (pointer & (type_mismatch->alignment - 1))) { - description = __ubsan_buf; - snprintf(__ubsan_buf, sizeof(__ubsan_buf), "%s %s %s @%p %s %d", - "unaligned", kind, type_mismatch->type->name, pointer, "align", - type_mismatch->alignment); + char *p; + const char *kind; + if (!pointer) __ubsan_abort(&info->location, "null pointer access"); + p = __ubsan_buf; + kind = __ubsan_dubnul(kUbsanTypeCheckKinds, info->type_check_kind); + if (info->alignment && (pointer & (info->alignment - 1))) { + p = __ubsan_stpcpy(p, "unaligned "); + p = __ubsan_stpcpy(p, kind), *p++ = ' '; + p = __ubsan_stpcpy(p, info->type->name), *p++ = ' ', *p++ = '@'; + p = __ubsan_itpcpy(p, info->type, pointer); + p = __ubsan_stpcpy(p, " align "); + p = __ubsan_intcpy(p, info->alignment); } else { - description = __ubsan_buf; - snprintf(__ubsan_buf, sizeof(__ubsan_buf), "%s\r\n\t%s %s %p %s %s", - "insufficient size", kind, "address", pointer, - "with insufficient space for object of type", - type_mismatch->type->name); + p = __ubsan_stpcpy(p, "insufficient size\r\n\t"); + p = __ubsan_stpcpy(p, kind); + p = __ubsan_stpcpy(p, " address 0x"); + p = __ubsan_hexcpy(p, pointer, sizeof(pointer) * CHAR_BIT); + p = __ubsan_stpcpy(p, " with insufficient space for object of type "); + p = __ubsan_stpcpy(p, info->type->name); } - __ubsan_abort(loc, description); - unreachable; + __ubsan_abort(&info->location, __ubsan_buf); } void ___ubsan_handle_type_mismatch_v1( @@ -100,7 +214,6 @@ void ___ubsan_handle_type_mismatch_v1( mm.alignment = 1u << type_mismatch->log_alignment; mm.type_check_kind = type_mismatch->type_check_kind; __ubsan_handle_type_mismatch(&mm, pointer); - unreachable; } void __ubsan_handle_float_cast_overflow(void *data_raw, void *from_raw) { @@ -116,5 +229,4 @@ void __ubsan_handle_float_cast_overflow(void *data_raw, void *from_raw) { }; __ubsan_abort(((void)data, &kUnknownLocation), "float cast overflow"); #endif - unreachable; } diff --git a/libc/log/ubsan.internal.h b/libc/log/ubsan.internal.h index f3cc34990..f9dc4fd4e 100644 --- a/libc/log/ubsan.internal.h +++ b/libc/log/ubsan.internal.h @@ -1,11 +1,15 @@ #ifndef COSMOPOLITAN_LIBC_UBSAN_H_ #define COSMOPOLITAN_LIBC_UBSAN_H_ -#if !(__ASSEMBLER__ + __LINKER__ + 0) - /*───────────────────────────────────────────────────────────────────────────│─╗ │ cosmopolitan § runtime » behavior enforcement ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ +#define kUbsanKindInt 0 +#define kUbsanKindFloat 1 +#define kUbsanKindUnknown 0xffff + +#if !(__ASSEMBLER__ + __LINKER__ + 0) + struct UbsanSourceLocation { const char *file; uint32_t line; @@ -13,8 +17,8 @@ struct UbsanSourceLocation { }; struct UbsanTypeDescriptor { - uint16_t kind; - uint16_t info; + uint16_t kind; /* int,float,... */ + uint16_t info; /* if int bit 0 if signed, remaining bits are log2(sizeof*8) */ char name[]; }; @@ -91,7 +95,7 @@ struct UbsanOutOfBoundsData { struct UbsanTypeDescriptor *index_type; }; -struct UbsanShiftOutOfBoundsData { +struct UbsanShiftOutOfBoundsInfo { struct UbsanSourceLocation location; struct UbsanTypeDescriptor *lhs_type; struct UbsanTypeDescriptor *rhs_type; diff --git a/libc/macros.internal.h b/libc/macros.internal.h index 5c1939f08..5bbff6e92 100644 --- a/libc/macros.internal.h +++ b/libc/macros.internal.h @@ -26,8 +26,6 @@ #define TYPE_BIT(type) (sizeof(type) * CHAR_BIT) #define TYPE_SIGNED(type) (((type)-1) < 0) #define TYPE_INTEGRAL(type) (((type)0.5) != 0.5) -#define INT_STRLEN_MAXIMUM(type) \ - ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type)) #define ARRAYLEN(A) \ ((sizeof(A) / sizeof(*(A))) / ((unsigned)!(sizeof(A) % sizeof(*(A))))) diff --git a/libc/nt/enum/lockfile.h b/libc/nt/enum/lockfile.h new file mode 100644 index 000000000..dae4f2149 --- /dev/null +++ b/libc/nt/enum/lockfile.h @@ -0,0 +1,7 @@ +#ifndef COSMOPOLITAN_LIBC_NT_ENUM_LOCKFILE_H_ +#define COSMOPOLITAN_LIBC_NT_ENUM_LOCKFILE_H_ + +#define kNtLockfileFailImmediately 1 +#define kNtLockfileExclusiveLock 2 + +#endif /* COSMOPOLITAN_LIBC_NT_ENUM_LOCKFILE_H_ */ diff --git a/libc/runtime/msync.c b/libc/runtime/msync.c index fde0b2b9f..adcd9a0e9 100644 --- a/libc/runtime/msync.c +++ b/libc/runtime/msync.c @@ -29,6 +29,7 @@ * Without this, there's no guarantee memory is written back to disk. In * practice, what that means is just Windows NT. * + * @param addr needs to be 4096-byte page aligned * @param flags needs MS_ASYNC or MS_SYNC and can have MS_INVALIDATE * @return 0 on success or -1 w/ errno */ diff --git a/libc/str/getzipcdir.c b/libc/str/getzipcdir.c index 18d1d956e..1ba8d7815 100644 --- a/libc/str/getzipcdir.c +++ b/libc/str/getzipcdir.c @@ -21,9 +21,9 @@ /** * Locates End Of Central Directory record in ZIP file. * - * The ZIP spec says this header can be anywhere in the last 64kb. - * We search it backwards for the ZIP-64 "PK♠♠" magic number. If that's - * not found, then we search again for the original "PK♣♠" magnum. The + * The ZIP spec says this header can be anywhere in the last 64kb. We + * search it backwards for the ZIP-64 "PK♠•" magic number. If that's not + * found, then we search again for the original "PK♣♠" magnum. The * caller needs to check the first four bytes of the returned value to * determine whether to use ZIP_CDIR_xxx() or ZIP_CDIR64_xxx() macros. * @@ -31,23 +31,25 @@ * @param n is byte size of file * @return pointer to EOCD64 or EOCD, or NULL if not found */ -uint8_t *GetZipCdir(const uint8_t *p, size_t n) { +void *GetZipCdir(const uint8_t *p, size_t n) { size_t i, j; - if (n >= kZipCdirHdrMinSize) { - i = n - kZipCdirHdrMinSize; - do { - if (READ32LE(p + i) == kZipCdir64HdrMagic && IsZipCdir64(p, n, i)) { - return (/*unconst*/ uint8_t *)(p + i); - } else if (READ32LE(p + i) == kZipCdirHdrMagic && IsZipCdir32(p, n, i)) { - j = i; - do { - if (READ32LE(p + j) == kZipCdir64HdrMagic && IsZipCdir64(p, n, j)) { - return (/*unconst*/ uint8_t *)(p + j); - } - } while (j-- && i - j < 64 * 1024); - return (/*unconst*/ uint8_t *)(p + i); - } - } while (i--); - } + i = n - 4; + do { + if (READ32LE(p + i) == kZipCdir64LocatorMagic && + i + kZipCdir64LocatorSize <= n && + IsZipCdir64(p, n, ZIP_LOCATE64_OFFSET(p + i))) { + return (void *)(p + ZIP_LOCATE64_OFFSET(p + i)); + } else if (READ32LE(p + i) == kZipCdirHdrMagic && IsZipCdir32(p, n, i)) { + j = i; + do { + if (READ32LE(p + j) == kZipCdir64LocatorMagic && + j + kZipCdir64LocatorSize <= n && + IsZipCdir64(p, n, ZIP_LOCATE64_OFFSET(p + j))) { + return (void *)(p + ZIP_LOCATE64_OFFSET(p + j)); + } + } while (j-- && i - j < 64 * 1024); + return (void *)(p + i); + } + } while (i--); return NULL; } diff --git a/libc/str/getzipcdircomment.c b/libc/str/getzipcdircomment.c index cefd8ab82..b738b4e05 100644 --- a/libc/str/getzipcdircomment.c +++ b/libc/str/getzipcdircomment.c @@ -22,7 +22,7 @@ * Returns comment of zip central directory. */ void *GetZipCdirComment(const uint8_t *eocd) { - if (READ32LE(eocd) == kZipCdir64HdrMagic) { + if (READ32LE(eocd) == kZipCdir64HdrMagic && ZIP_CDIR64_COMMENTSIZE(eocd)) { return ZIP_CDIR64_COMMENT(eocd); } else { return ZIP_CDIR_COMMENT(eocd); diff --git a/libc/str/getzipcdircommentsize.c b/libc/str/getzipcdircommentsize.c index 6741fadac..78165b245 100644 --- a/libc/str/getzipcdircommentsize.c +++ b/libc/str/getzipcdircommentsize.c @@ -22,7 +22,7 @@ * Returns comment of zip central directory. */ uint64_t GetZipCdirCommentSize(const uint8_t *eocd) { - if (READ32LE(eocd) == kZipCdir64HdrMagic) { + if (READ32LE(eocd) == kZipCdir64HdrMagic && ZIP_CDIR64_COMMENTSIZE(eocd)) { return ZIP_CDIR64_COMMENTSIZE(eocd); } else { return ZIP_CDIR_COMMENTSIZE(eocd); diff --git a/libc/str/iswlower.c b/libc/str/iswlower.c index 79adef127..4e7769aa9 100644 --- a/libc/str/iswlower.c +++ b/libc/str/iswlower.c @@ -714,8 +714,7 @@ int iswlower(wint_t c) { case u'ᶑ': // LATIN SMALL D W/ HOOK AND TAIL (0x1d91) case u'ᶒ': // LATIN SMALL E W/ RETROFLEX HOOK (0x1d92) case u'ᶓ': // LATIN SMALL OPEN E W/ RETROFLEX HOOK (0x1d93) - case u'ᶔ': // LATIN SMALL REVERSED OPEN E W/ RETROFLEX HOOK - // (0x1d94) + case u'ᶔ': // LATIN SMALL REVERSED OPEN E W/ RETROFLEX HOOK (0x1d94) case u'ᶕ': // LATIN SMALL SCHWA W/ RETROFLEX HOOK (0x1d95) case u'ᶖ': // LATIN SMALL I W/ RETROFLEX HOOK (0x1d96) case u'ᶗ': // LATIN SMALL OPEN O W/ RETROFLEX HOOK (0x1d97) @@ -1219,8 +1218,7 @@ int iswlower(wint_t c) { case u'ꝡ': // LATIN SMALL VY (0xa761) case u'ꝣ': // LATIN SMALL VISIGOTHIC Z (0xa763) case u'ꝥ': // LATIN SMALL THORN W/ STROKE (0xa765) - case u'ꝧ': // LATIN SMALL THORN W/ STROKE THROUGH DESCENDER - // (0xa767) + case u'ꝧ': // LATIN SMALL THORN W/ STROKE THROUGH DESCENDER (0xa767) case u'ꝩ': // LATIN SMALL VEND (0xa769) case u'ꝫ': // LATIN SMALL ET (0xa76b) case u'ꝭ': // LATIN SMALL IS (0xa76d) diff --git a/libc/str/iszipcdir64.c b/libc/str/iszipcdir64.c index ca18dcee2..044442336 100644 --- a/libc/str/iszipcdir64.c +++ b/libc/str/iszipcdir64.c @@ -23,11 +23,16 @@ * Returns true if zip64 end of central directory header seems legit. */ bool IsZipCdir64(const uint8_t *p, size_t n, size_t i) { - if (i > n || n - i < kZipCdir64HdrMinSize) return false; + if (i + kZipCdir64HdrMinSize > n) return false; if (READ32LE(p + i) != kZipCdir64HdrMagic) return false; - if (i + ZIP_CDIR64_HDRSIZE(p + i) > n) return false; - if (ZIP_CDIR64_DISK(p + i) != ZIP_CDIR64_STARTINGDISK(p + i)) return false; - if (ZIP_CDIR64_RECORDSONDISK(p + i) != ZIP_CDIR64_RECORDS(p + i)) { + if (i + ZIP_CDIR64_HDRSIZE(p + i) + kZipCdir64LocatorSize > n) { + return false; + } + if (ZIP_LOCATE64_MAGIC(p + i + ZIP_CDIR64_HDRSIZE(p + i)) != + kZipCdir64LocatorMagic) { + return false; + } + if (ZIP_LOCATE64_OFFSET(p + i + ZIP_CDIR64_HDRSIZE(p + i)) != i) { return false; } if (ZIP_CDIR64_RECORDS(p + i) * kZipCfileHdrMinSize > diff --git a/libc/str/memchr.c b/libc/str/memchr.c index 1c917fb70..c764a9d08 100644 --- a/libc/str/memchr.c +++ b/libc/str/memchr.c @@ -29,19 +29,22 @@ */ void *memchr(const void *m, int c, size_t n) { uint64_t v, w; - const unsigned char *p, *pe; + const char *p, *pe; c &= 255; v = 0x0101010101010101 * c; - for (p = (const unsigned char *)m, pe = p + n; p + 8 <= pe; p += 8) { - w = (uint64_t)p[7] << 070 | (uint64_t)p[6] << 060 | (uint64_t)p[5] << 050 | - (uint64_t)p[4] << 040 | (uint64_t)p[3] << 030 | (uint64_t)p[2] << 020 | - (uint64_t)p[1] << 010 | (uint64_t)p[0] << 000; + for (p = m, pe = p + n; p + 8 <= pe; p += 8) { + w = (uint64_t)(255 & p[7]) << 070 | (uint64_t)(255 & p[6]) << 060 | + (uint64_t)(255 & p[5]) << 050 | (uint64_t)(255 & p[4]) << 040 | + (uint64_t)(255 & p[3]) << 030 | (uint64_t)(255 & p[2]) << 020 | + (uint64_t)(255 & p[1]) << 010 | (uint64_t)(255 & p[0]) << 000; if ((w = ~(w ^ v) & ((w ^ v) - 0x0101010101010101) & 0x8080808080808080)) { return p + ((unsigned)__builtin_ctzll(w) >> 3); } } for (; p < pe; ++p) { - if (*p == c) return p; + if ((*p & 255) == c) { + return p; + } } return NULL; } diff --git a/libc/str/strchr.c b/libc/str/strchr.c index ff4187062..77ee980ab 100644 --- a/libc/str/strchr.c +++ b/libc/str/strchr.c @@ -17,14 +17,16 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" -#include "libc/bits/bits.h" #include "libc/str/str.h" -noasan static inline const char *strchr_x64(const char *p, uint64_t c) { +static noasan inline const char *strchr_x64(const char *p, uint64_t c) { unsigned a, b; uint64_t w, x, y; for (c *= 0x0101010101010101;; p += 8) { - w = READ64LE(p); + w = (uint64_t)(255 & p[7]) << 070 | (uint64_t)(255 & p[6]) << 060 | + (uint64_t)(255 & p[5]) << 050 | (uint64_t)(255 & p[4]) << 040 | + (uint64_t)(255 & p[3]) << 030 | (uint64_t)(255 & p[2]) << 020 | + (uint64_t)(255 & p[1]) << 010 | (uint64_t)(255 & p[0]) << 000; if ((x = ~(w ^ c) & ((w ^ c) - 0x0101010101010101) & 0x8080808080808080) | (y = ~w & (w - 0x0101010101010101) & 0x8080808080808080)) { if (x) { @@ -57,8 +59,8 @@ noasan static inline const char *strchr_x64(const char *p, uint64_t c) { */ char *strchr(const char *s, int c) { char *r; - for (c &= 0xff; (uintptr_t)s & 7; ++s) { - if ((*s & 0xff) == c) return s; + for (c &= 255; (uintptr_t)s & 7; ++s) { + if ((*s & 255) == c) return s; if (!*s) return NULL; } r = strchr_x64(s, c); diff --git a/libc/str/strxfrm.c b/libc/str/strxfrm.c index 57cda307e..1f71ac3ff 100644 --- a/libc/str/strxfrm.c +++ b/libc/str/strxfrm.c @@ -25,7 +25,6 @@ │ OTHER DEALINGS IN THE SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ - #include "libc/assert.h" #include "libc/str/str.h" diff --git a/libc/sysv/calls/__sys_fcntl.s b/libc/sysv/calls/__sys_fcntl.s new file mode 100644 index 000000000..672d1118a --- /dev/null +++ b/libc/sysv/calls/__sys_fcntl.s @@ -0,0 +1,2 @@ +.include "o/libc/sysv/macros.internal.inc" +.scall __sys_fcntl,0x05c05c05c205c048,globl,hidden diff --git a/libc/sysv/calls/sys_fcntl.s b/libc/sysv/calls/sys_fcntl.s deleted file mode 100644 index a33374cd1..000000000 --- a/libc/sysv/calls/sys_fcntl.s +++ /dev/null @@ -1,2 +0,0 @@ -.include "o/libc/sysv/macros.internal.inc" -.scall sys_fcntl,0x05c05c05c205c048,globl,hidden diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index a9e0675b9..140445c56 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -22,7 +22,7 @@ dir=libc/sysv/consts # The Fifth Bell System, Community Edition # » catalogue of carnage # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD Windows Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon errno ENOSYS 38 78 78 78 78 1 # system call unavailable; bsd consensus; kNtErrorInvalidFunction syscon errno EPERM 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 # 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) @@ -106,59 +106,20 @@ syscon errno EBADMSG 74 94 89 92 88 0 # raised by ioctl_getfsmap syscon errno ECANCELED 125 89 85 88 87 0 # raised by timerfd_create(2) syscon errno EOWNERDEAD 130 105 96 94 97 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 ENOTRECOVERABLE 131 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 0 0 0 0 0 # bsd consensus; raised by accept(2) -syscon errno ERESTART 85 0 0 0 -3 0 # bsd consensus; should only be seen in ptrace() -syscon junkerr ECHRNG 44 0 0 0 0 0 # bsd consensus -syscon junkerr EL2NSYNC 45 0 0 0 0 0 # bsd consensus -syscon junkerr EL3HLT 46 0 0 0 0 0 # bsd consensus -syscon junkerr EL3RST 47 0 0 0 0 0 # bsd consensus -syscon junkerr ELNRNG 48 0 0 0 0 0 # bsd consensus -syscon junkerr EUNATCH 49 0 0 0 0 0 # bsd consensus -syscon junkerr ENOCSI 50 0 0 0 0 0 # bsd consensus -syscon junkerr EL2HLT 51 0 0 0 0 0 # bsd consensus -syscon junkerr EBADE 52 0 0 0 0 0 # bsd consensus -syscon junkerr EBADR 53 0 0 0 0 0 # bsd consensus -syscon junkerr EXFULL 54 0 0 0 0 0 # bsd consensus -syscon junkerr ENOANO 55 0 0 0 0 0 # bsd consensus -syscon junkerr EBADRQC 56 0 0 0 0 0 # bsd consensus -syscon junkerr EBADSLT 57 0 0 0 0 0 # bsd consensus -syscon junkerr ENOSTR 60 99 0 0 91 0 # -syscon junkerr ENODATA 61 96 0 0 89 0 # raised by getxattr(2), removexattr(2), setxattr(2) -syscon junkerr ENOSR 63 98 0 0 90 0 # -syscon junkerr ENOPKG 65 0 0 0 0 0 # bsd consensus, ip(7) -syscon junkerr ENOLINK 67 97 91 0 95 0 # -syscon junkerr EADV 68 0 0 0 0 0 # bsd consensus -syscon junkerr ESRMNT 69 0 0 0 0 0 # bsd consensus -syscon junkerr ECOMM 70 0 0 0 0 0 # bsd consensus -syscon junkerr EMULTIHOP 72 95 90 0 94 0 # -syscon junkerr EDOTDOT 73 0 0 0 0 0 # bsd consensus -syscon junkerr ENOTUNIQ 76 0 0 0 0 0 # bsd consensus -syscon junkerr EREMCHG 78 0 0 0 0 0 # bsd consensus -syscon junkerr ELIBACC 79 0 0 0 0 0 # bsd consensus -syscon junkerr ELIBBAD 80 0 0 0 0 0 # bsd consensus -syscon junkerr ELIBSCN 81 0 0 0 0 0 # bsd consensus -syscon junkerr ELIBMAX 82 0 0 0 0 0 # bsd consensus -syscon junkerr ELIBEXEC 83 0 0 0 0 0 # bsd consensus -syscon junkerr ESTRPIPE 86 0 0 0 0 0 # bsd consensus -syscon junkerr EUCLEAN 117 0 0 0 0 0 # bsd consensus -syscon junkerr ENOTNAM 118 0 0 0 0 0 # bsd consensus -syscon junkerr ENAVAIL 119 0 0 0 0 0 # bsd consensus -syscon junkerr EISNAM 120 0 0 0 0 0 # bsd consensus -syscon junkerr EREMOTEIO 121 0 0 0 0 0 # bsd consensus -syscon junkerr ENOMEDIUM 123 0 0 85 85 0 # -syscon junkerr EMEDIUMTYPE 124 0 0 86 86 0 # -syscon junkerr ENOKEY 126 0 0 0 0 0 # bsd consensus -syscon junkerr EKEYEXPIRED 127 0 0 0 0 0 # bsd consensus -syscon junkerr EKEYREVOKED 128 0 0 0 0 0 # bsd consensus -syscon junkerr EKEYREJECTED 129 0 0 0 0 0 # bsd consensus -syscon junkerr ERFKILL 132 0 0 0 0 0 # bsd consensus -syscon junkerr EHWPOISON 133 0 0 0 0 0 # bsd consensus -syscon junkerr EBADFD 77 9 9 9 9 6 # file descriptor in bad state; cf. EBADF; fudged on non-Linux -syscon compat EWOULDBLOCK 11 35 35 35 35 10035 # same as EWOULDBLOCK +syscon errno ENONET 64 0 0 0 0 0 # unilateral; raised by accept(2) +syscon errno ERESTART 85 -1 -1 -1 -3 0 # should only be seen in ptrace() +syscon errno ENOSR 63 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 99 0 0 91 0 # not a stream; returned by getmsg, putmsg, putpmsg, getpmsg +syscon errno ENODATA 61 96 0 0 89 0 # no data available; barely in posix; returned by ioctl +syscon errno EMULTIHOP 72 95 90 0 94 0 # barely in posix +syscon errno ENOLINK 67 97 91 0 95 0 # barely in posix +syscon errno ENOMEDIUM 123 0 0 85 0 0 # not posix; not documented +syscon errno EMEDIUMTYPE 124 0 0 86 0 0 # not posix; not documented +syscon compat EWOULDBLOCK 11 35 35 35 35 10035 # same as EAGAIN on every platform we've seen # signals # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sig SIGHUP 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 # 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 # terminal ctrl-\ keystroke; resumable; unix consensus & faked on nt @@ -205,36 +166,37 @@ syscon open O_RDONLY 0 0 0 0 0 0xA0000000 # unix consensus & kNtGe syscon open O_WRONLY 1 1 1 1 1 0x40000000 # unix consensus & kNtGenericWrite syscon open O_RDWR 2 2 2 2 2 0xE0000000 # unix consensus & kNtGenericRead|kNtGenericWrite|kNtGenericExecute syscon open O_ACCMODE 3 3 3 3 3 0xE0000000 # O_RDONLY|O_WRONLY|O_RDWR -syscon open O_APPEND 0x0400 8 8 8 8 0x00000004 # bsd consensus & kNtFileAppendData; won't pose issues w/ mknod(S_IFIFO) -syscon open O_CREAT 0x40 0x0200 0x0200 0x0200 0x0200 0x00000040 # bsd consensus & NT faked as Linux -syscon open O_EXCL 0x80 0x0800 0x0800 0x0800 0x0800 0x00000080 # bsd consensus & NT faked as Linux -syscon open O_TRUNC 0x0200 0x0400 0x0400 0x0400 0x0400 0x00000200 # bsd consensus & NT faked as Linux -syscon open O_DIRECTORY 0x010000 0x100000 0x020000 0x020000 0x200000 0x02000000 # kNtFileFlagBackupSemantics -syscon open O_DIRECT 0x4000 0 0x010000 0 0x80000 0x00200000 # kNtFileFlagNoBuffering>>8 -syscon open O_CLOEXEC 0x080000 0x01000000 0x100000 0x010000 0x400000 0x00080000 # NT faked as Linux -syscon open O_TMPFILE 0x410000 0 0 0 0 0x04000100 # Linux 3.11+ (c. 2013) & kNtFileAttributeTemporary|kNtFileFlagDeleteOnClose +syscon open O_APPEND 0x00000400 8 8 8 8 0x00000004 # bsd consensus & kNtFileAppendData; won't pose issues w/ mknod(S_IFIFO) +syscon open O_CREAT 0x00000040 0x00000200 0x00000200 0x00000200 0x00000200 0x00000040 # bsd consensus & NT faked as Linux +syscon open O_EXCL 0x00000080 0x00000800 0x00000800 0x00000800 0x00000800 0x00000080 # bsd consensus & NT faked as Linux +syscon open O_TRUNC 0x00000200 0x00000400 0x00000400 0x00000400 0x00000400 0x00000200 # bsd consensus & NT faked as Linux +syscon open O_DIRECTORY 0x00010000 0x00100000 0x00020000 0x00020000 0x00200000 0x02000000 # kNtFileFlagBackupSemantics +syscon open O_DIRECT 0x00004000 0 0x00010000 0 0x00080000 0x00200000 # kNtFileFlagNoBuffering>>8 +syscon open O_CLOEXEC 0x00080000 0x01000000 0x00100000 0x00010000 0x00400000 0x00080000 # NT faked as Linux +syscon open O_TMPFILE 0x00410000 0 0 0 0 0x04000100 # Linux 3.11+ (c. 2013) & kNtFileAttributeTemporary|kNtFileFlagDeleteOnClose syscon open O_SPARSE 0 0 0 0 0 0x00040000 # we invented it -syscon open O_NDELAY 0x0800 4 4 4 4 0 # bsd consensus & kNtFileFlagWriteThrough>>8 → 0x00800000 (???) -syscon open O_NONBLOCK 0x0800 4 4 4 4 0x00000800 # bsd consensus & faked on nt to be same as linux -syscon open O_ASYNC 0x2000 0x40 0x40 0x40 0x40 0 # bsd consensus -syscon open O_NOFOLLOW 0x020000 0x0100 0x0100 0x0100 0x0100 0 # bsd consensus -syscon open O_SYNC 0x101000 0x80 0x80 0x80 0x80 0 # bsd consensus -syscon open O_NOCTTY 0x0100 0x020000 0x8000 0x8000 0x8000 0 # used for remote viewing (default behavior on freebsd) -syscon open O_DSYNC 0x1000 0x400000 0 0x80 0x10000 0 -syscon open O_RSYNC 0x101000 0 0 0x80 0x20000 0 -syscon open O_NOATIME 0x040000 0 0 0 0 0 -syscon open O_PATH 0x200000 0 0 0 0 0 -syscon open O_EXEC 0 0 0x040000 0 0x4000000 0 -syscon open O_TTY_INIT 0 0 0x080000 0 0 0 +syscon open O_NDELAY 0x00000800 0x00000004 0x00000004 0x00000004 0x00000004 0x00000800 # bsd consensus & kNtFileFlagWriteThrough>>8 → 0x00800000 (???) +syscon open O_NONBLOCK 0x00000800 0x00000004 0x00000004 0x00000004 0x00000004 0x00000800 # bsd consensus & faked on nt to be same as linux +syscon open O_ASYNC 0x00002000 0x00000040 0x00000040 0x00000040 0x00000040 0 # bsd consensus +syscon open O_NOFOLLOW 0x00020000 0x00000100 0x00000100 0x00000100 0x00000100 0 # bsd consensus +syscon open O_SYNC 0x00101000 0x00000080 0x00000080 0x00000080 0x00000080 0 # bsd consensus +syscon open O_NOCTTY 0x00000100 0x00020000 0x00008000 0x00008000 0x00008000 0 # used for remote viewing (default behavior on freebsd) +syscon open O_NOATIME 0x00040000 0 0 0 0 0 # optimize away access time update +syscon open O_EXEC 0 0 0x00040000 0 0x04000000 0 # it's specified by posix what does it mean +syscon open O_DSYNC 0x00001000 0x00400000 0 0x00000080 0x00010000 0 +syscon open O_RSYNC 0x00101000 0 0 0x00000080 0x00020000 0 +syscon open O_PATH 0x00200000 0 0 0 0 0 +syscon open O_TTY_INIT 0 0 0x00080000 0 0 0 syscon compat O_LARGEFILE 0 0 0 0 0 0 # mmap() flags # the revolutionary praxis of malloc() # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon compat MAP_FILE 0 0 0 0 0 0 # consensus syscon mmap MAP_SHARED 1 1 1 1 1 1 # forced consensus & faked nt syscon mmap MAP_PRIVATE 2 2 2 2 2 2 # forced consensus & faked nt +syscon mmap MAP_TYPE 15 15 15 15 15 15 # mask for type of mapping syscon mmap MAP_FIXED 0x10 0x10 0x10 0x10 0x10 0x10 # unix consensus; openbsd appears to forbid; faked nt syscon mmap MAP_ANONYMOUS 0x20 0x1000 0x1000 0x1000 0x1000 0x20 # bsd consensus; faked nt syscon mmap MAP_GROWSDOWN 0x0100 0 0x0400 0x4000 0x4000 0x100000 # mandatory for OpenBSD stacks; MAP_STACK on Free/OpenBSD; MEM_TOP_DOWN on NT @@ -246,7 +208,7 @@ syscon mmap MAP_HUGE_SHIFT 26 0 0 0 0 0 syscon mmap MAP_LOCKED 0x2000 0 0 0 0 0 syscon mmap MAP_NONBLOCK 0x10000 0 0 0 0 0 syscon mmap MAP_POPULATE 0x8000 0 0 0 0 0 # can avoid madvise(MADV_WILLNEED) on private file mapping -syscon mmap MAP_TYPE 15 0 0 0 0 0 # what is it +syscon mmap MAP_CONCEAL 0 0 0 0x8000 0 0 # omit from dumps syscon compat MAP_STACK 0x0100 0 0x0400 0x4000 0x2000 0x100000 # use MAP_GROWSDOWN syscon compat MAP_NOCORE 0 0 0x20000 0x8000 0x8000 0 # use MAP_CONCEAL syscon compat MAP_ANON 0x20 0x1000 0x1000 0x1000 0x1000 0x20 # bsd consensus; faked nt @@ -257,7 +219,7 @@ syscon compat MAP_32BIT 0x40 0 0x080000 0 0 0 # iffy # madvise() flags # beneath the iceberg memory management # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon madv MADV_NORMAL 0 0 0 0 0 0x00000080 # consensus & kNtFileAttributeNormal syscon compat POSIX_FADV_NORMAL 0 0 0 0 0 0x00000080 # consensus & kNtFileAttributeNormal syscon compat POSIX_MADV_NORMAL 0 0 0 0 0 0x00000080 # consensus & kNtFileAttributeNormal @@ -280,7 +242,7 @@ syscon madv MADV_HUGEPAGE 14 0 0 0 0 0 # TODO(jart): why would we syscon madv MADV_NOHUGEPAGE 15 0 0 0 0 0 # TODO(jart): why would we need it? syscon madv MADV_DODUMP 17 0 0 0 0 0 # TODO(jart): what is it? syscon madv MADV_DOFORK 11 0 0 0 0 0 # TODO(jart): what is it? -syscon madv MADV_DONTDUMP 16 0 0 0 0 0 # TODO(jart): what is it? +syscon madv MADV_DONTDUMP 16 0 0 0 0 0 # see MAP_CONCEAL in OpenBSD; TODO(jart): what is it? syscon madv MADV_DONTFORK 10 0 0 0 0 0 # TODO(jart): what is it? syscon madv MADV_HWPOISON 100 0 0 0 0 0 # TODO(jart): what is it? syscon madv MADV_REMOVE 9 0 0 0 0 0 # TODO(jart): what is it? @@ -289,7 +251,7 @@ syscon fadv POSIX_FADV_NOREUSE 5 0 5 0 5 0 # wut # mmap(), mprotect(), etc. # digital restrictions management for the people # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mprot PROT_NONE 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 # mmap, mprotect, unix consensus syscon mprot PROT_WRITE 2 2 2 2 2 2 # mmap, mprotect, unix consensus @@ -300,13 +262,21 @@ syscon mprot PROT_GROWSUP 0x02000000 0 0 0 0 0 # intended for mpro # mremap() flags # the revolutionary praxis of realloc() # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mremap MREMAP_MAYMOVE 1 1 1 1 1 1 # faked non-linux (b/c linux only) syscon mremap MREMAP_FIXED 2 2 2 2 2 2 # faked non-linux (b/c linux only) +# sigprocmask() flags +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon misc SIG_BLOCK 0 1 1 1 1 0 # bsd consensus; faked nt +syscon misc SIG_UNBLOCK 1 2 2 2 2 1 # bsd consensus; faked nt +syscon misc SIG_SETMASK 2 3 3 3 3 2 # bsd consensus; faked nt +syscon misc SIG_ATOMIC_MIN -2147483648 -2147483648 -9223372036854775808 -2147483648 -2147483648 0 + # splice() flags # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon splice SPLICE_F_MOVE 1 0 0 0 0 0 # can be safely ignored by polyfill; it's a hint syscon splice SPLICE_F_NONBLOCK 2 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 0 0 0 0 0 # can be safely ignored by polyfill; it's a hint @@ -314,7 +284,7 @@ syscon splice SPLICE_F_GIFT 8 0 0 0 0 0 # can probably be ignored # access() flags # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon access F_OK 0 0 0 0 0 0 # consensus syscon access X_OK 1 1 1 1 1 0xa0000000 # unix consensus and kNtGenericExecute | kNtGenericRead syscon access W_OK 2 2 2 2 2 0x40000000 # unix consensus and kNtGenericWrite @@ -322,29 +292,30 @@ syscon access R_OK 4 4 4 4 4 0x80000000 # unix consensus and kNtG # flock() flags # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon lock LOCK_SH 1 1 1 1 1 0 # shared [unix consensus] -syscon lock LOCK_EX 2 2 2 2 2 2 # exclusive [consensus!] -syscon lock LOCK_NB 4 4 4 4 4 1 # non-blocking [unix consensus] +syscon lock LOCK_EX 2 2 2 2 2 2 # exclusive [consensus!] a.k.a. kNtLockfileExclusiveLock +syscon lock LOCK_NB 4 4 4 4 4 1 # non-blocking [unix consensus] a.k.a. kNtLockfileFailImmediately syscon lock LOCK_UN 8 8 8 8 8 8 # unlock [unix consensus & faked NT] # waitpid() / wait4() options # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon waitpid WNOHANG 1 1 1 1 1 0 # helps you reap zombies; unix consensus syscon waitpid WUNTRACED 2 2 2 2 2 0 # unix consensus syscon waitpid WCONTINUED 8 0x10 4 8 16 0 # waitid() options +# no dice on openbsd >:\ # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon waitid WEXITED 4 4 0x10 0 32 0 syscon waitid WSTOPPED 2 8 2 0 2 0 syscon waitid WNOWAIT 0x01000000 0x20 8 0 0x10000 0 # stat::st_mode constants # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon stat S_IFREG 0100000 0100000 0100000 0100000 0100000 0100000 # regular file (unix consensus; faked nt) syscon stat S_IFBLK 0060000 0060000 0060000 0060000 0060000 0060000 # block device (unix consensus; faked nt) syscon stat S_IFCHR 0020000 0020000 0020000 0020000 0020000 0020000 # character device (unix consensus; faked nt) @@ -374,7 +345,7 @@ syscon stat S_IRWXO 0000007 0000007 0000007 0000007 0000007 000000 # fcntl() # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon fcntl2 F_DUPFD 0 0 0 0 0 0 # consensus syscon fcntl2 F_GETFD 1 1 1 1 1 1 # unix consensus & faked nt @@ -393,19 +364,22 @@ syscon fcntl2 F_SETFL 4 4 4 4 4 4 # unix consensus & faked nt syscon fcntl2 F_SETOWN 8 6 6 6 6 0 # bsd consensus syscon fcntl2 F_GETOWN 9 5 5 5 5 0 # bsd consensus -syscon fcntl F_ULOCK 0 0 0 0 0 0 # consensus -syscon fcntl F_RDLCK 0 1 1 1 1 0 # bsd consensus +# fcntl() POSIX Advisory Locks +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon fcntl F_SETLK 6 8 12 8 8 6 # polyfilled nt +syscon compat F_SETLK64 6 8 12 8 8 6 # polyfilled nt +syscon fcntl F_SETLKW 7 9 13 9 9 7 +syscon compat F_SETLKW64 7 9 13 9 9 7 +syscon fcntl F_GETLK 5 7 11 7 7 5 # polyfilled nt +syscon compat F_GETLK64 5 7 11 7 7 5 # polyfilled nt +syscon fcntl F_RDLCK 0 1 1 1 1 0 # polyfilled nt; bsd consensus +syscon fcntl F_WRLCK 1 3 3 3 3 1 # polyfilled nt; bsd consensus +syscon fcntl F_UNLCK 2 2 2 2 2 2 # polyfilled nt; unix consensus + syscon fcntl F_LOCK 1 1 1 1 1 0 # unix consensus -syscon fcntl F_WRLCK 1 3 3 3 3 0 # bsd consensus syscon fcntl F_TLOCK 2 2 2 2 2 0 # unix consensus -syscon fcntl F_UNLCK 2 2 2 2 2 0 # unix consensus syscon fcntl F_TEST 3 3 3 3 3 0 # unix consensus -syscon fcntl F_GETLK 5 7 11 7 7 0 -syscon fcntl F_SETLK 6 8 12 8 8 0 -syscon fcntl F_SETLKW 7 9 13 9 9 0 -syscon fcntl F_GETLK64 5 0 0 0 0 0 -syscon fcntl F_SETLK64 6 0 0 0 0 0 -syscon fcntl F_SETLKW64 7 0 0 0 0 0 syscon fcntl F_SETSIG 10 0 0 0 0 0 syscon fcntl F_GETSIG 11 0 0 0 0 0 syscon fcntl F_SETOWN_EX 15 0 0 0 0 0 @@ -418,10 +392,19 @@ syscon fcntl F_GETLEASE 0x0401 0 0 0 0 0 syscon fcntl F_NOTIFY 0x0402 0 0 0 0 0 syscon fcntl F_SETPIPE_SZ 0x0407 0 0 0 0 0 syscon fcntl F_GETPIPE_SZ 0x0408 0 0 0 0 0 +syscon fcntl F_ULOCK 0 0 0 0 0 0 # TODO: specified by posix but not kernels? + +syscon ioctl FIONBIO 0x5421 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 0x8004667d 0x8004667d 0x8004667d 0x8004667d 0x8004667d # BSD-The New Technology consensus +syscon ioctl FIONREAD 0x541b 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f # BSD-The New Technology consensus; bytes waiting in FD's input buffer +#syscon ioctl FIONWRITE 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 0x40046676 0x0 0x0 -1 # [FreeBSD Generalization] capacity of FD's output buffer, e.g. equivalent to TIOCGSERIAL w/ UART +syscon ioctl TIOCINQ 0x541b 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f # [Linuxism] same as FIONREAD +#syscon ioctl TIOCOUTQ 0x5411 0x40047473 0x40047473 0x40047473 0x40047473 -1 # bytes queued in TTY's output buffer # openat(), fstatat(), linkat(), etc. magnums # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon at AT_FDCWD -100 -2 -100 -100 -100 -100 # faked nt syscon at AT_SYMLINK_FOLLOW 0x0400 0x40 0x0400 4 0x400 0 syscon at AT_SYMLINK_NOFOLLOW 0x0100 0x20 0x0200 2 0x200 0 # TODO(jart): What should NT do? @@ -434,13 +417,13 @@ syscon at AT_EMPTY_PATH 0x1000 0 0 0 0 0 # linux 2.6.39+; see unl # # Unsupported flags are encoded as 0. # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon memfd MFD_CLOEXEC 1 0 0 0 0 0 syscon memfd MFD_ALLOW_SEALING 2 0 0 0 0 0 # utimensat() special values # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon utime UTIME_NOW 0x3fffffff 0x3fffffff -1 -2 0x3fffffff -2 # timespec::tv_sec may be this; polyfilled xnu/nt syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe -2 -1 0x3ffffffe -1 # timespec::tv_nsec may be this; polyfilled xnu/nt @@ -448,7 +431,7 @@ syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe -2 -1 0x3ffffffe -1 # # # Unsupported values are encoded as 0. # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon auxv AT_EXECFD 2 0 2 0 2 0 # file descriptor of program syscon auxv AT_PHDR 3 0 3 0 3 0 # address of program headers of executable syscon auxv AT_PHENT 4 0 4 0 4 0 @@ -481,7 +464,7 @@ syscon auxv AT_NO_AUTOMOUNT 0x0800 0 0 0 0 0 # # Unsupported values are encoded as 127. # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon rlimit RLIMIT_CPU 0 0 0 0 0 127 # max cpu time in seconds; see SIGXCPU; unix consensus syscon rlimit RLIMIT_FSIZE 1 1 1 1 1 127 # max file size in bytes; unix consensus syscon rlimit RLIMIT_DATA 2 2 2 2 2 127 # max mmap() / brk() / sbrk() size in bytes; unix consensus @@ -501,7 +484,7 @@ syscon compat RLIMIT_VMEM 9 5 10 127 10 127 # same as RLIMIT_AS # resource limit special values # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon rlim RLIM_NLIMITS 16 9 15 9 12 0 # no clue why we need it syscon rlim RLIM_INFINITY 0xffffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0 syscon rlim RLIM_SAVED_CUR 0xffffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0x7fffffffffffffff 0 @@ -509,7 +492,7 @@ syscon rlim RLIM_SAVED_MAX 0xffffffffffffffff 0x7fffffffffffffff 0x7fffffffff # sigaction() codes # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sigact SA_NOCLDSTOP 1 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 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 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 @@ -522,10 +505,10 @@ syscon compat SA_ONESHOT 0x80000000 4 4 4 4 0x80000000 # same as SA # siginfo::si_code values # -# Windows NT is polyfilled as Linux. +# The New Technology NT is polyfilled as Linux. # Unsupported values are encoded as 0x80000000. # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon sicode SI_USER 0 0x010001 0x010001 0 0 0 # sent by kill(2); openbsd defines si_code<=0 as originating from user syscon sicode SI_QUEUE -1 0x010002 0x010002 -2 -1 -1 # sent by sigqueue(2) syscon sicode SI_TIMER -2 0x010003 0x010003 -3 -2 -2 # sent by setitimer(2) or clock_settime(2) @@ -575,12 +558,12 @@ syscon sicode POLL_HUP 6 6 6 6 6 6 # SIGIO; device disconnected; # sigalstack() values # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ss SIGSTKSZ 0x2000 0x020000 0x8800 0x7000 0x7000 0x2000 # clock_{gettime,settime} timers # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon clock CLOCK_REALTIME 0 0 0 0 0 0 # consensus syscon clock CLOCK_MONOTONIC 1 1 4 3 3 1 # XNU/NT faked; could move backwards if NTP introduces negative leap second syscon clock CLOCK_PROCESS_CPUTIME_ID 2 -1 15 2 0x40000000 -1 @@ -595,7 +578,7 @@ syscon clock CLOCK_TAI 11 -1 -1 -1 -1 -1 # bsd consensus # poll() # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon poll POLLIN 1 1 1 1 1 0x300 # unix consensus syscon poll POLLPRI 2 2 2 2 2 0x0400 # unix consensus syscon poll POLLOUT 4 4 4 4 4 0x10 # unix consensus @@ -610,7 +593,7 @@ syscon poll POLLRDHUP 0x2000 0x10 0x10 0x10 0x10 2 # bsd consensu # epoll # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon epoll EPOLL_CLOEXEC 0x080000 0x01000000 0x100000 0x010000 0x010000 0x80000 # O_CLOEXEC syscon epoll EPOLL_CTL_ADD 1 1 1 1 1 1 # forced consensus, linux only natively, polyfilled elsewhere syscon epoll EPOLL_CTL_DEL 2 2 2 2 2 2 # forced consensus, linux only natively, polyfilled elsewhere @@ -636,7 +619,7 @@ syscon epoll EPOLLET 0x80000000 0x80000000 0x80000000 0x80000000 0x80000 # * 0 we define as EINVAL # * -1 we define as no-op # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon so SO_REUSEPORT 15 0x0200 0x0200 0x0200 0x0200 4 # bsd consensus (NT calls it SO_REUSEADDR) syscon so SO_REUSEADDR 2 4 4 4 4 0 # bsd consensus (default behavior on NT) syscon so SO_KEEPALIVE 9 8 8 8 8 8 # bsd consensus @@ -732,7 +715,7 @@ syscon sol SOL_X25 262 0 0 0 0 0 # @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 XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon tcp TCP_NODELAY 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 4 4 16 0 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 0 # reduces tcp segment size; see also tcp offloading @@ -763,7 +746,7 @@ syscon tcp TCP_REPAIR_OPTIONS 22 0 0 0 0 0 # what is it syscon tcp TCP_REPAIR_QUEUE 20 0 0 0 0 0 # what is it syscon tcp TCP_THIN_LINEAR_TIMEOUTS 16 0 0 0 0 0 # what is it -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ip IP_DEFAULT_MULTICAST_LOOP 1 1 1 1 1 1 # consensus syscon ip IP_DEFAULT_MULTICAST_TTL 1 1 1 1 1 1 # consensus syscon ip IP_PMTUDISC_DONT 0 0 0 0 0 0 # consensus @@ -816,7 +799,7 @@ syscon ip INET_ADDRSTRLEN 0x10 0x10 0x10 0x10 0x10 22 # unix cons # ptrace() codes # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ptrace PTRACE_TRACEME 0 0 0 0 -1 -1 # unix consensus a.k.a. PT_TRACE_ME syscon ptrace PTRACE_PEEKTEXT 1 1 1 1 -1 -1 # unix consensus a.k.a. PT_READ_I syscon ptrace PTRACE_PEEKDATA 2 2 2 2 -1 -1 # unix consensus a.k.a. PT_READ_D @@ -897,11 +880,6 @@ syscon iproto IPPROTO_BEETPH 94 0 0 0 0 0 syscon iproto IPPROTO_COMP 108 0 0 0 0 0 syscon iproto IPPROTO_DCCP 33 0 0 0 0 0 -syscon misc EXTA 14 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus -syscon misc EXTB 15 0x9600 0x9600 0x9600 0x9600 0 # bsd consensus -syscon misc ERA 0x02002c 45 45 0 0 0 -syscon misc EMPTY 0 0 0 0 0 0 # consensus - syscon pr PR_SET_PTRACER_ANY -1 0 0 0 0 0 syscon pr PR_ENDIAN_BIG 0 0 0 0 0 0 # consensus syscon pr PR_FP_EXC_DISABLED 0 0 0 0 0 0 # consensus @@ -1005,209 +983,6 @@ syscon pr PR_FP_EXC_RES 0x080000 0 0 0 0 0 syscon pr PR_FP_EXC_INV 0x100000 0 0 0 0 0 syscon pr PR_SET_PTRACER 0x59616d61 0 0 0 0 0 -syscon log LOG_EMERG 0 0 0 0 0 0 # consensus -syscon log LOG_KERN 0 0 0 0 0 0 # consensus -syscon log LOG_ALERT 1 1 1 1 1 1 # unix consensus -syscon log LOG_PID 1 1 1 1 1 1 # unix consensus -syscon log LOG_CONS 2 2 2 2 2 2 # unix consensus -syscon log LOG_CRIT 2 2 2 2 2 2 # unix consensus -syscon log LOG_ERR 3 3 3 3 3 3 # unix consensus -syscon log LOG_ODELAY 4 4 4 4 4 4 # unix consensus -syscon log LOG_WARNING 4 4 4 4 4 4 # unix consensus -syscon log LOG_NOTICE 5 5 5 5 5 5 # unix consensus -syscon log LOG_INFO 6 6 6 6 6 6 # unix consensus -syscon log LOG_DEBUG 7 7 7 7 7 7 # unix consensus -syscon log LOG_PRIMASK 7 7 7 7 7 7 # unix consensus -syscon log LOG_NDELAY 8 8 8 8 8 8 # unix consensus -syscon log LOG_USER 8 8 8 8 8 8 # unix consensus -syscon log LOG_MAIL 0x10 0x10 0x10 0x10 0x10 0x10 # unix consensus -syscon log LOG_NOWAIT 0x10 0x10 0x10 0x10 0x10 0x10 # unix consensus -syscon log LOG_DAEMON 24 24 24 24 24 24 # unix consensus -syscon log LOG_NFACILITIES 24 25 24 24 24 24 -syscon log LOG_AUTH 0x20 0x20 0x20 0x20 0x20 0x20 # unix consensus -syscon log LOG_PERROR 0x20 0x20 0x20 0x20 0x20 0x20 # unix consensus -syscon log LOG_SYSLOG 40 40 40 40 40 40 # unix consensus -syscon log LOG_LPR 48 48 48 48 48 48 # unix consensus -syscon log LOG_NEWS 56 56 56 56 56 56 # unix consensus -syscon log LOG_UUCP 0x40 0x40 0x40 0x40 0x40 40 # unix consensus -syscon log LOG_CRON 72 72 72 72 72 72 # unix consensus -syscon log LOG_SELECT 76 0 0 0 0 0 -syscon log LOG_SENSE 77 0 0 0 0 0 -syscon log LOG_LOCAL0 0x80 0x80 0x80 0x80 0x80 0x80 # unix consensus -syscon log LOG_LOCAL1 136 136 136 136 136 136 # unix consensus -syscon log LOG_LOCAL2 144 144 144 144 144 144 # unix consensus -syscon log LOG_LOCAL3 152 152 152 152 152 152 # unix consensus -syscon log LOG_LOCAL4 160 160 160 160 160 160 # unix consensus -syscon log LOG_LOCAL5 168 168 168 168 168 168 # unix consensus -syscon log LOG_LOCAL6 176 176 176 176 176 176 # unix consensus -syscon log LOG_LOCAL7 184 184 184 184 184 184 # unix consensus -syscon log LOG_FACMASK 0x03f8 0x03f8 0x03f8 0x03f8 0x03f8 0x03f8 # unix consensus - -syscon sg SG_DXFER_TO_FROM_DEV -4 0 0 0 0 0 -syscon sg SG_DXFER_FROM_DEV -3 0 0 0 0 0 -syscon sg SG_DXFER_TO_DEV -2 0 0 0 0 0 -syscon sg SG_DXFER_NONE -1 0 0 0 0 0 -syscon sg SG_DEF_COMMAND_Q 0 0 0 0 0 0 # consensus -syscon sg SG_DEF_FORCE_LOW_DMA 0 0 0 0 0 0 # consensus -syscon sg SG_DEF_FORCE_PACK_ID 0 0 0 0 0 0 # consensus -syscon sg SG_DEF_KEEP_ORPHAN 0 0 0 0 0 0 # consensus -syscon sg SG_DEF_UNDERRUN_FLAG 0 0 0 0 0 0 # consensus -syscon sg SG_INFO_INDIRECT_IO 0 0 0 0 0 0 # consensus -syscon sg SG_INFO_OK 0 0 0 0 0 0 # consensus -syscon sg SG_SCSI_RESET_NOTHING 0 0 0 0 0 0 # consensus -syscon sg SG_DEFAULT_RETRIES 1 0 0 0 0 0 -syscon sg SG_FLAG_DIRECT_IO 1 0 0 0 0 0 -syscon sg SG_INFO_CHECK 1 0 0 0 0 0 -syscon sg SG_INFO_OK_MASK 1 0 0 0 0 0 -syscon sg SG_SCSI_RESET_DEVICE 1 0 0 0 0 0 -syscon sg SG_FLAG_LUN_INHIBIT 2 0 0 0 0 0 -syscon sg SG_INFO_DIRECT_IO 2 0 0 0 0 0 -syscon sg SG_SCSI_RESET_BUS 2 0 0 0 0 0 -syscon sg SG_SCSI_RESET_HOST 3 0 0 0 0 0 -syscon sg SG_INFO_MIXED_IO 4 0 0 0 0 0 -syscon sg SG_INFO_DIRECT_IO_MASK 6 0 0 0 0 0 -syscon misc VOLUME_OVERFLOW 13 0 0 0 0 0 -syscon sg SG_MAX_QUEUE 0x10 0 0 0 0 0 -syscon sg SG_MAX_SENSE 0x10 0 0 0 0 0 -syscon sg SG_DEFAULT_TIMEOUT 0x1770 0 0 0 0 0 -syscon sg SG_SET_TIMEOUT 0x2201 0 0 0 0 0 -syscon sg SG_GET_TIMEOUT 0x2202 0 0 0 0 0 -syscon sg SG_EMULATED_HOST 0x2203 0 0 0 0 0 -syscon sg SG_SET_TRANSFORM 0x2204 0 0 0 0 0 -syscon sg SG_GET_TRANSFORM 0x2205 0 0 0 0 0 -syscon sg SG_GET_COMMAND_Q 0x2270 0 0 0 0 0 -syscon sg SG_SET_COMMAND_Q 0x2271 0 0 0 0 0 -syscon sg SG_GET_RESERVED_SIZE 0x2272 0 0 0 0 0 -syscon sg SG_SET_RESERVED_SIZE 0x2275 0 0 0 0 0 -syscon sg SG_GET_SCSI_ID 0x2276 0 0 0 0 0 -syscon sg SG_SET_FORCE_LOW_DMA 0x2279 0 0 0 0 0 -syscon sg SG_GET_LOW_DMA 0x227a 0 0 0 0 0 -syscon sg SG_SET_FORCE_PACK_ID 0x227b 0 0 0 0 0 -syscon sg SG_GET_PACK_ID 0x227c 0 0 0 0 0 -syscon sg SG_GET_NUM_WAITING 0x227d 0 0 0 0 0 -syscon sg SG_SET_DEBUG 0x227e 0 0 0 0 0 -syscon sg SG_GET_SG_TABLESIZE 0x227f 0 0 0 0 0 -syscon sg SG_GET_VERSION_NUM 0x2282 0 0 0 0 0 -syscon sg SG_NEXT_CMD_LEN 0x2283 0 0 0 0 0 -syscon sg SG_SCSI_RESET 0x2284 0 0 0 0 0 -syscon sg SG_IO 0x2285 0 0 0 0 0 -syscon sg SG_GET_REQUEST_TABLE 0x2286 0 0 0 0 0 -syscon sg SG_SET_KEEP_ORPHAN 0x2287 0 0 0 0 0 -syscon sg SG_GET_KEEP_ORPHAN 0x2288 0 0 0 0 0 -syscon sg SG_BIG_BUFF 0x8000 0 0 0 0 0 -syscon sg SG_DEF_RESERVED_SIZE 0x8000 0 0 0 0 0 -syscon sg SG_SCATTER_SZ 0x8000 0 0 0 0 0 -syscon sg SG_FLAG_NO_DXFER 0x010000 0 0 0 0 0 - -syscon posix _POSIX_ARG_MAX 0x1000 0x1000 0x1000 0x1000 0x1000 0 # unix consensus -syscon posix _POSIX_CHILD_MAX 25 25 25 25 25 0 # unix consensus -syscon posix _POSIX_HOST_NAME_MAX 255 255 255 255 255 0 # unix consensus -syscon posix _POSIX_LINK_MAX 8 8 8 8 8 0 # unix consensus -syscon posix _POSIX_LOGIN_NAME_MAX 9 9 9 9 9 0 # unix consensus -syscon posix _POSIX_MAX_CANON 255 255 255 255 255 0 # unix consensus -syscon posix _POSIX_MAX_INPUT 255 255 255 255 255 0 # unix consensus -syscon posix _POSIX_NAME_MAX 14 14 14 14 14 14 # forced consensus -syscon posix _POSIX_NGROUPS_MAX 8 8 8 8 8 0 # unix consensus -syscon posix _POSIX_OPEN_MAX 20 20 20 20 20 20 # forced consensus -syscon posix _POSIX_PATH_MAX 255 255 255 255 255 255 # forced consensus -syscon posix _POSIX_PIPE_BUF 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus -syscon posix _POSIX_RE_DUP_MAX 255 255 255 255 255 0 # unix consensus -syscon posix _POSIX_SEM_NSEMS_MAX 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus -syscon posix _POSIX_SEM_VALUE_MAX 0x7fff 0x7fff 0x7fff 0x7fff 0x7fff 0 # unix consensus -syscon posix _POSIX_SSIZE_MAX 0x7fff 0x7fff 0x7fff 0x7fff 0x7fff 0 # unix consensus -syscon posix _POSIX_STREAM_MAX 8 8 8 8 8 0 # unix consensus -syscon posix _POSIX_SYMLINK_MAX 255 255 255 255 255 0 # unix consensus -syscon posix _POSIX_SYMLOOP_MAX 8 8 8 8 8 0 # unix consensus -syscon posix _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 4 4 4 4 0 # unix consensus -syscon posix _POSIX_THREAD_KEYS_MAX 0x80 0x80 0x80 0x80 0x80 0 # unix consensus -syscon posix _POSIX_TTY_NAME_MAX 9 9 9 9 9 0 # unix consensus -syscon posix _POSIX_TZNAME_MAX 6 6 6 6 6 0 # unix consensus -syscon posix _POSIX_CLOCK_SELECTION 0x031069 -1 -1 -1 -1 0 # bsd consensus -syscon posix _POSIX_FSYNC 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_MAPPED_FILES 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_MEMORY_PROTECTION 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_READER_WRITER_LOCKS 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_THREADS 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_THREAD_ATTR_STACKADDR 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_THREAD_ATTR_STACKSIZE 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon posix _POSIX_ADVISORY_INFO 0x031069 -1 0x030db0 -1 -1 0 -syscon posix _POSIX_ASYNCHRONOUS_IO 0x031069 -1 0x030db0 -1 -1 0 -syscon posix _POSIX_BARRIERS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_JOB_CONTROL 1 0x030db0 1 1 1 0 -syscon posix _POSIX_MEMLOCK 0x031069 -1 -1 0x030db0 0x030db0 0 -syscon posix _POSIX_MEMLOCK_RANGE 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_MESSAGE_PASSING 0x031069 -1 0x030db0 -1 -1 0 -syscon posix _POSIX_NO_TRUNC 1 0x030db0 1 1 1 0 -syscon posix _POSIX_RAW_SOCKETS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_REALTIME_SIGNALS 0x031069 -1 0x030db0 -1 -1 0 -syscon posix _POSIX_REGEXP 1 0x030db0 1 1 1 0 -syscon posix _POSIX_SEMAPHORES 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_SHARED_MEMORY_OBJECTS 0x031069 -1 0x030db0 0x031069 0x031069 0 -syscon posix _POSIX_SHELL 1 0x030db0 1 1 1 0 -syscon posix _POSIX_SPAWN 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_SPIN_LOCKS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_THREAD_PRIORITY_SCHEDULING 0x031069 -1 0x030db0 -1 -1 0 -syscon posix _POSIX_THREAD_PROCESS_SHARED 0x031069 0x030db0 0x030db0 -1 -1 0 -syscon posix _POSIX_THREAD_SAFE_FUNCTIONS 0x031069 0x030db0 -1 0x030db0 0x030db0 0 -syscon posix _POSIX_THREAD_THREADS_MAX 0x40 0x40 0x40 4 4 0 -syscon posix _POSIX_TIMEOUTS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_TIMERS 0x031069 -1 0x030db0 -1 -1 0 -syscon posix _POSIX_VERSION 0x031069 0x030db0 0x030db0 0x031069 0x031069 0 -syscon posix _POSIX_VDISABLE 0 255 255 255 255 0 # bsd consensus -syscon posix _POSIX_AIO_LISTIO_MAX 2 2 2 0 0 0 -syscon posix _POSIX_AIO_MAX 1 1 1 0 0 0 -syscon posix _POSIX_CHOWN_RESTRICTED 0 0x030db0 1 1 1 0 -syscon posix _POSIX_CLOCKRES_MIN 0x01312d00 0 0x01312d00 0x01312d00 0x01312d00 0 -syscon posix _POSIX_CPUTIME 0 -1 0x030db0 0x031069 0x031069 0 -syscon posix _POSIX_DELAYTIMER_MAX 0x20 0x20 0x20 0 0 0 -syscon posix _POSIX_MONOTONIC_CLOCK 0 -1 0x030db0 0x030db0 0x030db0 0 -syscon posix _POSIX_MQ_OPEN_MAX 8 8 8 0 0 0 -syscon posix _POSIX_MQ_PRIO_MAX 0x20 0x20 0x20 0 0 0 -syscon posix _POSIX_RTSIG_MAX 8 8 8 0 0 0 -syscon posix _POSIX_SAVED_IDS 1 0x030db0 0 1 1 0 -syscon posix _POSIX_SIGQUEUE_MAX 0x20 0x20 0x20 0 0 0 -syscon posix _POSIX_THREAD_CPUTIME 0 -1 0x030db0 0x031069 0x031069 0 -syscon posix _POSIX_TIMER_MAX 0x20 0x20 0x20 0 0 0 -syscon posix _POSIX_IPV6 0x031069 0x030db0 0 0 0 0 -syscon posix _POSIX_SS_REPL_MAX 0 4 4 0 0 0 -syscon posix _POSIX_TRACE_EVENT_NAME_MAX 0 30 30 0 0 0 -syscon posix _POSIX_TRACE_NAME_MAX 0 8 8 0 0 0 -syscon posix _POSIX_TRACE_SYS_MAX 0 8 8 0 0 0 -syscon posix _POSIX_TRACE_USER_EVENT_MAX 0 0x20 0x20 0 0 0 -syscon posix _POSIX_V6_LP64_OFF64 1 1 0 0 0 0 -syscon posix _POSIX_V7_LP64_OFF64 1 1 0 0 0 0 - -syscon icmp6 ICMP6_DST_UNREACH_NOROUTE 0 0 0 0 0 0 # consensus -syscon icmp6 ICMP6_PARAMPROB_HEADER 0 0 0 0 0 0 # consensus -syscon icmp6 ICMP6_TIME_EXCEED_TRANSIT 0 0 0 0 0 0 # consensus -syscon icmp6 ICMP6_DST_UNREACH_ADMIN 1 1 1 1 1 1 # consensus -syscon icmp6 ICMP6_PARAMPROB_NEXTHEADER 1 1 1 1 1 1 # consensus -syscon icmp6 ICMP6_TIME_EXCEED_REASSEMBLY 1 1 1 1 1 1 # consensus -syscon icmp6 ICMP6_DST_UNREACH 1 1 1 1 1 0 # unix consensus -syscon icmp6 ICMP6_FILTER 1 18 18 18 18 0 # bsd consensus -syscon icmp6 ICMP6_DST_UNREACH_BEYONDSCOPE 2 2 2 2 2 2 # consensus -syscon icmp6 ICMP6_PARAMPROB_OPTION 2 2 2 2 2 2 # consensus -syscon icmp6 ICMP6_PACKET_TOO_BIG 2 2 2 2 2 0 # unix consensus -syscon icmp6 ICMP6_DST_UNREACH_ADDR 3 3 3 3 3 3 # consensus -syscon icmp6 ICMP6_TIME_EXCEEDED 3 3 3 3 3 0 # unix consensus -syscon icmp6 ICMP6_DST_UNREACH_NOPORT 4 4 4 4 4 4 # consensus -syscon icmp6 ICMP6_PARAM_PROB 4 4 4 4 4 0 # unix consensus -syscon icmp6 ICMP6_RR_FLAGS_PREVDONE 8 8 8 8 8 0 # unix consensus -syscon icmp6 ICMP6_RR_FLAGS_SPECSITE 0x10 0x10 0x10 0x10 0x10 0 # unix consensus -syscon icmp6 ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 0x40 0x40 0x40 0x40 0 # bsd consensus -syscon icmp6 ICMP6_RR_FLAGS_FORCEAPPLY 0x20 0x20 0x20 0x20 0x20 0 # unix consensus -syscon icmp6 ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 0x80 0x80 0x80 0x80 0 # bsd consensus -syscon icmp6 ICMP6_RR_FLAGS_REQRESULT 0x40 0x40 0x40 0x40 0x40 0 # unix consensus -syscon icmp6 ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 0x40 0x40 0x40 0x40 0 # unix consensus -syscon icmp6 ICMP6_INFOMSG_MASK 0x80 0x80 0x80 0x80 0x80 0x80 # consensus -syscon icmp6 ICMP6_ECHO_REQUEST 0x80 0x80 0x80 0x80 0x80 0 # unix consensus -syscon icmp6 ICMP6_RR_FLAGS_TEST 0x80 0x80 0x80 0x80 0x80 0 # unix consensus -syscon icmp6 ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 0x80 0x80 0x80 0x80 0 # unix consensus -syscon icmp6 ICMP6_ECHO_REPLY 129 129 129 129 129 0 # unix consensus -syscon icmp6 ICMP6_ROUTER_RENUMBERING 138 138 138 138 138 0 # unix consensus -syscon icmp6 ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus -syscon icmp6 ICMP6_RR_RESULT_FLAGS_OOB 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus - syscon sio SIOCADDMULTI 0x8931 0x80206931 0x80206931 0x80206931 0x80206931 0 # bsd consensus syscon sio SIOCATMARK 0x8905 0x40047307 0x40047307 0x40047307 0x40047307 0 # bsd consensus syscon sio SIOCDELMULTI 0x8932 0x80206932 0x80206932 0x80206932 0x80206932 0 # bsd consensus @@ -1360,104 +1135,6 @@ syscon pf PF_VSOCK 40 0 0 0 0 0 syscon pf PF_WANPIPE 25 0 0 0 0 0 syscon pf PF_X25 9 0 0 0 0 0 -syscon ipv6 IPV6_PMTUDISC_DONT 0 0 0 0 0 0 # consensus -syscon ipv6 IPV6_RTHDR_LOOSE 0 0 0 0 0 0 # consensus -syscon ipv6 IPV6_RTHDR_TYPE_0 0 0 0 0 0 0 # consensus -syscon ipv6 IPV6_CHECKSUM 7 26 26 26 26 26 # bsd consensus -syscon ipv6 IPV6_JOIN_GROUP 20 12 12 12 12 12 # bsd consensus -syscon ipv6 IPV6_LEAVE_GROUP 21 13 13 13 13 13 # bsd consensus -syscon ipv6 IPV6_MULTICAST_HOPS 18 10 10 10 10 10 # bsd consensus -syscon ipv6 IPV6_MULTICAST_IF 17 9 9 9 9 9 # bsd consensus -syscon ipv6 IPV6_MULTICAST_LOOP 19 11 11 11 11 11 # bsd consensus -syscon ipv6 IPV6_UNICAST_HOPS 0x10 4 4 4 4 4 # bsd consensus -syscon ipv6 IPV6_V6ONLY 26 27 27 27 27 27 # bsd consensus -syscon ipv6 IPV6_RECVTCLASS 66 35 57 57 57 40 -syscon ipv6 IPV6_TCLASS 67 36 61 61 61 39 -syscon ipv6 IPV6_DONTFRAG 62 0 62 62 62 14 -syscon ipv6 IPV6_HOPLIMIT 52 0 47 47 47 21 -syscon ipv6 IPV6_HOPOPTS 54 0 49 49 49 1 -syscon ipv6 IPV6_PKTINFO 50 0 46 46 46 19 -syscon ipv6 IPV6_RECVRTHDR 56 0 38 38 38 38 -syscon ipv6 IPV6_RTHDR 57 0 51 51 51 0x20 -syscon ipv6 IPV6_DSTOPTS 59 0 50 50 50 0 -syscon ipv6 IPV6_IPSEC_POLICY 34 28 28 0 0 0 -syscon ipv6 IPV6_NEXTHOP 9 0 48 48 48 0 -syscon ipv6 IPV6_PATHMTU 61 0 44 44 44 0 -syscon ipv6 IPV6_RECVDSTOPTS 58 0 40 40 40 0 -syscon ipv6 IPV6_RECVHOPLIMIT 51 0 37 37 37 0 -syscon ipv6 IPV6_RECVHOPOPTS 53 0 39 39 39 0 -syscon ipv6 IPV6_RECVPATHMTU 60 0 43 43 43 0 -syscon ipv6 IPV6_RECVPKTINFO 49 0 36 36 36 0 -syscon ipv6 IPV6_RTHDRDSTOPTS 55 0 35 35 35 0 -syscon ipv6 IPV6_RTHDR_STRICT 1 1 1 0 0 0 -syscon ipv6 IPV6_ADD_MEMBERSHIP 20 0 0 0 0 12 # bsd consensus -syscon ipv6 IPV6_DROP_MEMBERSHIP 21 0 0 0 0 13 # bsd consensus -syscon ipv6 IPV6_HDRINCL 36 0 0 0 0 2 # bsd consensus -syscon ipv6 IPV6_MTU 24 0 0 0 0 72 # bsd consensus -syscon ipv6 IPV6_MTU_DISCOVER 23 0 0 0 0 71 # bsd consensus -syscon ipv6 IPV6_RECVERR 25 0 0 0 0 75 # bsd consensus -syscon ipv6 IPV6_2292DSTOPTS 4 23 0 0 0 0 -syscon ipv6 IPV6_2292HOPLIMIT 8 20 0 0 0 0 -syscon ipv6 IPV6_2292HOPOPTS 3 22 0 0 0 0 -syscon ipv6 IPV6_2292PKTINFO 2 19 0 0 0 0 -syscon ipv6 IPV6_2292PKTOPTIONS 6 25 0 0 0 0 -syscon ipv6 IPV6_2292RTHDR 5 24 0 0 0 0 -syscon ipv6 IPV6_AUTOFLOWLABEL 0 0 59 59 59 0 -syscon ipv6 IPV6_ADDRFORM 1 0 0 0 0 0 -syscon ipv6 IPV6_AUTHHDR 10 0 0 0 0 0 -syscon ipv6 IPV6_JOIN_ANYCAST 27 0 0 0 0 0 -syscon ipv6 IPV6_LEAVE_ANYCAST 28 0 0 0 0 0 -syscon ipv6 IPV6_PMTUDISC_DO 2 0 0 0 0 0 -syscon ipv6 IPV6_PMTUDISC_INTERFACE 4 0 0 0 0 0 -syscon ipv6 IPV6_PMTUDISC_OMIT 5 0 0 0 0 0 -syscon ipv6 IPV6_PMTUDISC_PROBE 3 0 0 0 0 0 -syscon ipv6 IPV6_PMTUDISC_WANT 1 0 0 0 0 0 -syscon ipv6 IPV6_ROUTER_ALERT 22 0 0 0 0 0 -syscon ipv6 IPV6_RXDSTOPTS 59 0 0 0 0 0 -syscon ipv6 IPV6_RXHOPOPTS 54 0 0 0 0 0 -syscon ipv6 IPV6_XFRM_POLICY 35 0 0 0 0 0 -syscon ipv6 IPV6_MINHOPCOUNT 0 0 0 65 65 0 -syscon ipv6 IPV6_ORIGDSTADDR 0 0 72 0 0 0 -syscon ipv6 IPV6_RECVORIGDSTADDR 0 0 72 0 0 0 -syscon ipv6 INET6_ADDRSTRLEN 46 46 46 46 46 65 # unix consensus - -syscon fan FAN_CLASS_NOTIF 0 0 0 0 0 0 # consensus -syscon fan FAN_ACCESS 1 0 0 0 0 0 -syscon fan FAN_ACCESS_PERM 0x020000 0 0 0 0 0 -syscon fan FAN_ALLOW 1 0 0 0 0 0 -syscon fan FAN_ALL_CLASS_BITS 12 0 0 0 0 0 -syscon fan FAN_ALL_EVENTS 59 0 0 0 0 0 -syscon fan FAN_ALL_INIT_FLAGS 63 0 0 0 0 0 -syscon fan FAN_ALL_MARK_FLAGS 255 0 0 0 0 0 -syscon fan FAN_ALL_OUTGOING_EVENTS 0x03403b 0 0 0 0 0 -syscon fan FAN_ALL_PERM_EVENTS 0x030000 0 0 0 0 0 -syscon fan FAN_CLASS_CONTENT 4 0 0 0 0 0 -syscon fan FAN_CLASS_PRE_CONTENT 8 0 0 0 0 0 -syscon fan FAN_CLOEXEC 1 0 0 0 0 0 -syscon fan FAN_CLOSE 24 0 0 0 0 0 -syscon fan FAN_CLOSE_NOWRITE 0x10 0 0 0 0 0 -syscon fan FAN_CLOSE_WRITE 8 0 0 0 0 0 -syscon fan FAN_DENY 2 0 0 0 0 0 -syscon fan FAN_EVENT_METADATA_LEN 24 0 0 0 0 0 -syscon fan FAN_EVENT_ON_CHILD 0x08000000 0 0 0 0 0 -syscon fan FAN_MARK_ADD 1 0 0 0 0 0 -syscon fan FAN_MARK_DONT_FOLLOW 4 0 0 0 0 0 -syscon fan FAN_MARK_FLUSH 0x80 0 0 0 0 0 -syscon fan FAN_MARK_IGNORED_MASK 0x20 0 0 0 0 0 -syscon fan FAN_MARK_IGNORED_SURV_MODIFY 0x40 0 0 0 0 0 -syscon fan FAN_MARK_MOUNT 0x10 0 0 0 0 0 -syscon fan FAN_MARK_ONLYDIR 8 0 0 0 0 0 -syscon fan FAN_MARK_REMOVE 2 0 0 0 0 0 -syscon fan FAN_MODIFY 2 0 0 0 0 0 -syscon fan FAN_NOFD -1 0 0 0 0 0 -syscon fan FAN_NONBLOCK 2 0 0 0 0 0 -syscon fan FAN_ONDIR 0x40000000 0 0 0 0 0 -syscon fan FAN_OPEN 0x20 0 0 0 0 0 -syscon fan FAN_OPEN_PERM 0x010000 0 0 0 0 0 -syscon fan FAN_Q_OVERFLOW 0x4000 0 0 0 0 0 -syscon fan FAN_UNLIMITED_MARKS 0x20 0 0 0 0 0 -syscon fan FAN_UNLIMITED_QUEUE 0x10 0 0 0 0 0 - syscon exit EXIT_SUCCESS 0 0 0 0 0 0 # consensus syscon exit EXIT_FAILURE 1 1 1 1 1 1 # consensus @@ -1467,7 +1144,7 @@ syscon exit EXIT_FAILURE 1 1 1 1 1 1 # consensus # - Dating back to 1980 in 4.0BSD; # - That won't be standardized. # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ex EX_OK 0 0 0 0 0 0 # consensus syscon ex EX_USAGE 64 64 64 64 64 64 # unix consensus & force NT syscon ex EX_DATAERR 65 65 65 65 65 65 # unix consensus & force NT @@ -1489,7 +1166,7 @@ syscon ex EX__MAX 78 78 78 78 78 78 # unix consensus & force NT # getdents() constants # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon dt DT_UNKNOWN 0 0 0 0 0 0 # consensus syscon dt DT_FIFO 1 1 1 1 1 1 # unix consensus & faked nt syscon dt DT_CHR 2 2 2 2 2 2 # unix consensus & faked nt @@ -1501,14 +1178,30 @@ syscon dt DT_SOCK 12 12 12 12 12 12 # unix consensus & faked nt # msync() flags # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon ms MS_SYNC 4 16 0 2 4 4 # faked nt syscon ms MS_ASYNC 1 1 1 1 1 1 # consensus (faked nt) syscon ms MS_INVALIDATE 2 2 2 4 2 0 +# statvfs() flags +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon statvfs ST_NOSUID 2 2 2 2 2 0 # unix consensus +syscon statvfs ST_RDONLY 1 1 1 1 1 0 # unix consensus +syscon statvfs ST_APPEND 0x0100 0 0 0 0 0 +syscon statvfs ST_IMMUTABLE 0x0200 0 0 0 0 0 +syscon statvfs ST_MANDLOCK 0x40 0 0 0 0 0 +syscon statvfs ST_NOATIME 0x0400 0 0 0 0 0 +syscon statvfs ST_NODEV 4 0 0 0 0 0 +syscon statvfs ST_NODIRATIME 0x0800 0 0 0 0 0 +syscon statvfs ST_NOEXEC 8 0 0 0 0 0 +syscon statvfs ST_RELATIME 0x1000 0 0 0 0 0 +syscon statvfs ST_SYNCHRONOUS 0x10 0 0 0 0 0 +syscon statvfs ST_WRITE 0x80 0 0 0 0 0 + # mount flags # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon mount MS_ACTIVE 0x40000000 0 0 0 0 0 syscon mount MS_BIND 0x1000 0 0 0 0 0 syscon mount MS_DIRSYNC 0x80 0 0 0 0 0 @@ -1539,7 +1232,9 @@ syscon mount MS_SYNCHRONOUS 0x10 0 0 0 0 0 syscon mount MS_UNBINDABLE 0x020000 0 0 0 0 0 syscon mount MS_MGC_MSK 0xffff0000 0 0 0 0 0 -# TODO(jart): MSG_ZEROCOPY +# send() / recv() flags +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon msg MSG_OOB 1 1 1 1 1 1 # consensus syscon msg MSG_PEEK 2 2 2 2 2 2 # consensus syscon msg MSG_DONTROUTE 4 4 4 4 4 4 # consensus @@ -1566,33 +1261,240 @@ syscon msg MSG_RST 0x1000 0 0 0 0 0 syscon msg MSG_STAT 11 0 0 0 0 0 syscon msg MSG_SYN 0x0400 0 0 0 0 0 -syscon in IN_LOOPBACKNET 127 127 127 127 127 0 # unix consensus -syscon in IN_ACCESS 1 0 0 0 0 0 -syscon in IN_ALL_EVENTS 0x0fff 0 0 0 0 0 -syscon in IN_ATTRIB 4 0 0 0 0 0 -syscon in IN_CLOEXEC 0x080000 0 0 0 0 0 -syscon in IN_CLOSE 24 0 0 0 0 0 -syscon in IN_CLOSE_NOWRITE 0x10 0 0 0 0 0 -syscon in IN_CLOSE_WRITE 8 0 0 0 0 0 -syscon in IN_CREATE 0x0100 0 0 0 0 0 -syscon in IN_DELETE 0x0200 0 0 0 0 0 -syscon in IN_DELETE_SELF 0x0400 0 0 0 0 0 -syscon in IN_DONT_FOLLOW 0x02000000 0 0 0 0 0 -syscon in IN_EXCL_UNLINK 0x04000000 0 0 0 0 0 -syscon in IN_IGNORED 0x8000 0 0 0 0 0 -syscon in IN_ISDIR 0x40000000 0 0 0 0 0 -syscon in IN_MASK_ADD 0x20000000 0 0 0 0 0 -syscon in IN_MODIFY 2 0 0 0 0 0 -syscon in IN_MOVE 192 0 0 0 0 0 -syscon in IN_MOVED_FROM 0x40 0 0 0 0 0 -syscon in IN_MOVED_TO 0x80 0 0 0 0 0 -syscon in IN_MOVE_SELF 0x0800 0 0 0 0 0 -syscon in IN_NONBLOCK 0x0800 0 0 0 0 0 -syscon in IN_ONESHOT 0x80000000 0 0 0 0 0 -syscon in IN_ONLYDIR 0x01000000 0 0 0 0 0 -syscon in IN_OPEN 0x20 0 0 0 0 0 -syscon in IN_Q_OVERFLOW 0x4000 0 0 0 0 0 -syscon in IN_UNMOUNT 0x2000 0 0 0 0 0 +# getpriority() / setpriority() magnums (a.k.a. nice) +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon prio PRIO_PROCESS 0 0 0 0 0 0 # consensus / poly nt +syscon prio PRIO_PGRP 1 1 1 1 1 1 # unix consensus / poly nt +syscon prio PRIO_USER 2 2 2 2 2 2 # unix consensus / poly nt +syscon prio PRIO_MIN -20 -20 -20 -20 -20 -20 # unix consensus / poly nt +syscon prio PRIO_MAX 20 20 20 20 20 20 # unix consensus / poly nt +syscon prio NZERO 20 20 20 20 20 20 # unix consensus / polyfilled nt + +# 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 XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon termios TCGETS 0x5401 0x40487413 0x402c7413 0x402c7413 0x402c7413 0 # Gets console settings; tcgetattr(tty, argp) → ioctl(tty, TCGETS, struct termios *argp); polyfilled NT +syscon compat TIOCGETA 0x5401 0x40487413 0x402c7413 0x402c7413 0x402c7413 0 # Gets console settings; = tcgetattr(tty, struct termios *argp) +#syscon compat TCGETA 0x5405 0 0 0 0 0 # Gets console settings; ≈ ioctl(fd, TCGETA, struct termio *argp) +syscon termios TCSANOW 0 0 0 0 0 0 # Sets console settings; tcsetattr(fd, TCSANOW, argp); polyfilled NT +syscon termios TCSETS 0x5402 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; = ioctl(tty, TCSETS, const struct termios *argp); polyfilled NT +syscon compat TIOCSETA 0x5402 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; = ioctl(tty, TIOCSETA, const struct termios *argp); polyfilled NT +#syscon compat TCSETA 0x5402 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 # Drains output & sets console settings; tcsetawttr(fd, TCSADRAIN, argp); polyfilled NT +syscon termios TCSETSW 0x5403 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; = ioctl(tty, TCSETSW, const struct termios *argp); polyfilled NT +syscon compat TIOCSETAW 0x5403 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; = ioctl(tty, TIOCSETAW, const struct termios *argp); polyfilled NT +#syscon compat TCSETAW 0x5403 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 # Drops input & drains output & sets console settings; tcsetafttr(fd, TCSAFLUSH, argp); polyfilled NT +syscon termios TCSETSF 0x5404 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 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 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 1074295912 1074295912 1074295912 1074295912 0x5413 # ioctl(tty, TIOCGWINSZ, struct winsize *argp); polyfilled NT +syscon termios TIOCSWINSZ 0x5414 0x80087467 0x80087467 0x80087467 0x80087467 0x5414 # ioctl(tty, TIOCSWINSZ, const struct winsize *argp) (faked NT) +syscon termios TIOCOUTQ 0x5411 0x40047473 0x40047473 0x40047473 0x40047473 0 # get # bytes queued in TTY's output buffer ioctl(tty, TIOCSWINSZ, const struct winsize *argp) +syscon termios TIOCCBRK 0x5428 0x2000747a 0x2000747a 0x2000747a 0x2000747a 0 # boop +syscon termios TIOCCONS 0x541d 0x80047462 0x80047462 0x80047462 0x80047462 0 # boop +syscon termios TIOCGETD 0x5424 0x4004741a 0x4004741a 0x4004741a 0x4004741a 0 # boop +syscon termios TIOCGPGRP 0x540f 0x40047477 0x40047477 0x40047477 0x40047477 0 # boop +syscon termios TIOCNOTTY 0x5422 0x20007471 0x20007471 0x20007471 0x20007471 0 # boop +syscon termios TIOCNXCL 0x540d 0x2000740e 0x2000740e 0x2000740e 0x2000740e 0 # boop +syscon termios TIOCSBRK 0x5427 0x2000747b 0x2000747b 0x2000747b 0x2000747b 0 # boop +syscon termios TIOCSCTTY 0x540e 0x20007461 0x20007461 0x20007461 0x20007461 0 # boop +syscon termios TIOCSETD 0x5423 0x8004741b 0x8004741b 0x8004741b 0x8004741b 0 # boop +syscon termios TIOCSIG 0x40045436 0x2000745f 0x2004745f 0x8004745f 0x8004745f 0 # boop +syscon termios TIOCSPGRP 0x5410 0x80047476 0x80047476 0x80047476 0x80047476 0 # boop +syscon termios TIOCSTI 0x5412 0x80017472 0x80017472 0 0 0 # boop +syscon termios TIOCGPTN 0x80045430 0 0x4004740f 0 0 0 # boop +syscon termios TIOCGSID 0x5429 0 0x40047463 0x40047463 0x40047463 0 # boop +syscon termios TABLDISC 0 0x3 0 0x3 0x3 0 # boop +syscon termios SLIPDISC 0 0x4 0x4 0x4 0x4 0 # boop +syscon termios PPPDISC 0 0x5 0x5 0x5 0x5 0 # boop +syscon termios TIOCDRAIN 0 0x2000745e 0x2000745e 0x2000745e 0x2000745e 0 # boop +syscon termios TIOCSTAT 0 0x20007465 0x20007465 0x20007465 0x20007465 0 # boop +syscon termios TIOCSTART 0 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0 # boop +syscon termios TIOCCDTR 0 0x20007478 0x20007478 0x20007478 0x20007478 0 # boop +syscon termios TIOCSDTR 0 0x20007479 0x20007479 0x20007479 0x20007479 0 # boop +syscon termios TIOCFLUSH 0 0x80047410 0x80047410 0x80047410 0x80047410 0 # boop +syscon termios TIOCEXT 0 0x80047460 0x80047460 0x80047460 0x80047460 0 # boop +syscon termios TIOCGDRAINWAIT 0 0x40047456 0x40047456 0 0 0 # boop +syscon termios TIOCTIMESTAMP 0 0x40107459 0x40107459 0 0 0 # boop +syscon termios TIOCSDRAINWAIT 0 0x80047457 0x80047457 0 0 0 # boop +syscon termios TIOCREMOTE 0 0x80047469 0 0x80047469 0x80047469 0 # boop +syscon termios TTYDISC 0 0 0 0 0 0 # boop +syscon termios TIOCFLAG_SOFTCAR 0 0 0 0x1 0x1 0 # boop +syscon termios TIOCFLAG_PPS 0 0 0 0x10 0x10 0 # boop +syscon termios TIOCFLAG_CLOCAL 0 0 0 0x2 0x2 0 # boop +syscon termios TIOCCHKVERAUTH 0 0 0 0x2000741e 0x2000741e 0 # boop +syscon termios TIOCGFLAGS 0 0 0 0x4004745d 0x4004745d 0 # boop +syscon termios TIOCGTSTAMP 0 0 0 0x4010745b 0x4010745b 0 # boop +syscon termios STRIPDISC 0 0 0 0x6 0x6 0 # boop +syscon termios NMEADISC 0 0 0 0x7 0x7 0 # boop +syscon termios TIOCUCNTL_CBRK 0 0 0 0x7a 0x7a 0 # boop +syscon termios TIOCFLAG_MDMBUF 0 0 0 0x8 0x8 0 # boop +syscon termios TIOCSETVERAUTH 0 0 0 0x8004741c 0x8004741c 0 # boop +syscon termios TIOCSFLAGS 0 0 0 0x8004745c 0x8004745c 0 # boop +syscon termios TIOCSTSTAMP 0 0 0 0x8008745a 0x8008745a 0 # boop +syscon termios ENDRUNDISC 0 0 0 0x9 0x9 0 # boop +syscon termios TIOCPTMASTER 0 0 0x2000741c 0 0 0 # boop +syscon termios NETGRAPHDISC 0 0 0x6 0 0 0 # boop +syscon termios H4DISC 0 0 0x7 0 0 0 # boop +syscon termios ISIG 0b0000000000000001 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000000000001 # termios.c_lflag|=ISIG makes Ctrl-C, Ctrl-\, etc. generate signals +syscon termios ICANON 0b0000000000000010 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000000000010 # termios.c_lflag&=~ICANON disables 1960's version of gnu readline (see also VMIN) +syscon termios XCASE 0b0000000000000100 0 0 16777216 0 0b0000000000000100 # termios.c_lflag +syscon termios ECHO 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # termios.c_lflag&=~ECHO is for passwords and raw mode +syscon termios ECHOE 0b0000000000010000 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000010000 # termios.c_lflag +syscon termios ECHOK 0b0000000000100000 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000100000 # termios.c_lflag +syscon termios ECHONL 0b0000000001000000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000001000000 # termios.c_lflag +syscon termios NOFLSH 0b0000000010000000 2147483648 2147483648 2147483648 2147483648 0b0000000010000000 # termios.c_lflag|=NOFLSH means don't flush on INT/QUIT/SUSP +syscon termios TOSTOP 0b0000000100000000 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 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000001000000000 # termios.c_lflag|=ECHOCTL prints ^𝑥 codes for monotonic motion +syscon termios ECHOPRT 0b0000010000000000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000010000000000 # termios.c_lflag|=ECHOPRT includes the parity bit +syscon termios ECHOKE 0b0000100000000000 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000100000000000 # termios.c_lflag +syscon termios FLUSHO 0b0001000000000000 8388608 8388608 8388608 8388608 0b0001000000000000 # termios.c_lflag +syscon termios PENDIN 0b0100000000000000 536870912 536870912 536870912 536870912 0b0100000000000000 # termios.c_lflag +syscon termios IEXTEN 0b1000000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b1000000000000000 # termios.c_lflag&=~IEXTEN disables platform input processing magic +syscon termios EXTPROC 65536 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 65536 # termios.c_lflag +syscon termios IGNBRK 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_iflag it's complicated, uart only? UNIXCONSENSUS +syscon termios BRKINT 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 # termios.c_iflag it's complicated, uart only? UNIXCONSENSUS +syscon termios IGNPAR 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 # termios.c_iflag|=PARMRK passes-through parity bit UNIXCONSENSUS +syscon termios INPCK 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 # termios.c_iflag|=INPCK enables parity checking UNIXCONSENSUS +syscon termios ISTRIP 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 # termios.c_iflag|=ISTRIP automates read(1)&0x7f UNIXCONSENSUS +syscon termios INLCR 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # termios.c_iflag|=INLCR maps \n → \r input UNIXCONSENSUS +syscon termios IGNCR 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # termios.c_iflag|=IGNCR maps \r → ∅ input UNIXCONSENSUS +syscon termios ICRNL 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # termios.c_iflag|=ICRNL maps \r → \n input UNIXCONSENSUS +syscon termios IUCLC 0b0000001000000000 0 0 0b0001000000000000 0 0b0000001000000000 # termios.c_iflag|=IUCLC maps A-Z → a-z input +syscon termios IXON 0b0000010000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000010000000000 # termios.c_iflag|=IXON enables flow rida +syscon termios IXANY 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 # termios.c_iflag|=IXANY tying will un-stuck teletype UNIXCONSENSUS +syscon termios IXOFF 0b0001000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0001000000000000 # termios.c_iflag|=IXOFF disables annoying display freeze keys +syscon termios IMAXBEL 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 # termios.c_iflag|=IMAXBEL rings when queue full UNIXCONSENSUS +syscon termios IUTF8 0b0100000000000000 0b0100000000000000 0 0 0 0b0100000000000000 # termios.c_iflag|=IUTF8 helps w/ rubout on UTF-8 input +syscon termios OPOST 0b0000000000000001 0b000000000000000001 0b000000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_oflag&=~OPOST disables output processing magic +syscon termios OLCUC 0b0000000000000010 0 0 0b0000000000100000 0 0b0000000000000010 # termios.c_oflag|=OLCUC maps a-z → A-Z output +syscon termios ONLCR 0b0000000000000100 0b000000000000000010 0b000000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000100 # termios.c_oflag|=ONLCR maps \n → \r\n output +syscon termios OCRNL 0b0000000000001000 0b000000000000010000 0b000000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000001000 # termios.c_oflag|=OCRNL maps \r → \n output +syscon termios ONOCR 0b0000000000010000 0b000000000000100000 0b000000000000100000 0b0000000001000000 0b0000000001000000 0b0000000000010000 # termios.c_oflag|=ONOCR maps \r → ∅ output iff column 0 +syscon termios ONLRET 0b0000000000100000 0b000000000001000000 0b000000000001000000 0b0000000010000000 0b0000000010000000 0b0000000000100000 # termios.c_oflag|=ONLRET maps \r → ∅ output +syscon termios OFILL 0b0000000001000000 0b000000000010000000 0 0 0 0b0000000001000000 # termios.c_oflag +syscon termios OFDEL 0b0000000010000000 0b100000000000000000 0 0 0 0b0000000010000000 # termios.c_oflag +syscon termios NLDLY 0b0000000100000000 0b000000001100000000 0b000000001100000000 0 0 0b0000000100000000 # (termios.c_oflag & NLDLY) ∈ {NL0,NL1,NL2,NL3} +syscon termios NL0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0b000000000000000000 0b0000000000000000 # (termios.c_oflag & NLDLY) == NL0 +syscon termios NL1 0b0000000100000000 0b000000000100000000 0b000000000100000000 0 0b000000000100000000 0b0000000100000000 # (termios.c_oflag & NLDLY) == NL1 +syscon termios NL2 0 0b000000001000000000 0b000000001000000000 0 0b000000001000000000 0 # (termios.c_oflag & NLDLY) == NL2 +syscon termios NL3 0 0b000000001100000000 0b000000001100000000 0 0b000000001100000000 0 # (termios.c_oflag & NLDLY) == NL3 +syscon termios CRDLY 0b0000011000000000 0b000011000000000000 0b000011000000000000 0 0 0b0000011000000000 # (termios.c_oflag & CRDLY) ∈ {CR0,CR1,CR2,CR3} +syscon termios CR0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0b000000000000000000 0b0000000000000000 # (termios.c_oflag & CRDLY) == CR0 +syscon termios CR1 0b0000001000000000 0b000001000000000000 0b000001000000000000 0 0b000001000000000000 0b0000001000000000 # (termios.c_oflag & CRDLY) == CR1 +syscon termios CR2 0b0000010000000000 0b000010000000000000 0b000010000000000000 0 0b000000010000000000 0b0000010000000000 # (termios.c_oflag & CRDLY) == CR2 +syscon termios CR3 0b0000011000000000 0b000011000000000000 0b000011000000000000 0 0b000000011000000000 0b0000011000000000 # (termios.c_oflag & CRDLY) == CR3 +syscon termios TABDLY 0b0001100000000000 0b000000110000000100 0b000000000000000100 0 0 0b0001100000000000 # (termios.c_oflag & TABDLY) ∈ {TAB0,TAB1,TAB2,TAB3,XTABS} +syscon termios TAB0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0b000000000000000000 0b0000000000000000 # (termios.c_oflag & TABDLY) == TAB0 +syscon termios TAB1 0b0000100000000000 0b000000010000000000 0b000000010000000000 0 0b000000010000000000 0b0000100000000000 # (termios.c_oflag & TABDLY) == TAB1 +syscon termios TAB2 0b0001000000000000 0b000000100000000000 0b000000100000000000 0 0b000000100000000000 0b0001000000000000 # (termios.c_oflag & TABDLY) == TAB2 +syscon termios TAB3 0b0001100000000000 0b000000000000000100 0b000000000000000100 0 0b000000000000000100 0b0001100000000000 # (termios.c_oflag & TABDLY) == TAB3 +syscon termios XTABS 0b0001100000000000 0b000000110000000000 0b000000110000000000 0 0b000000110000000000 0b0001100000000000 # (termios.c_oflag & TABDLY) == XTABS +syscon termios BSDLY 0b0010000000000000 0b001000000000000000 0b001000000000000000 0 0 0b0010000000000000 # termios.c_oflag +syscon termios BS0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag +syscon termios BS1 0b0010000000000000 0b001000000000000000 0b001000000000000000 0 0 0b0010000000000000 # termios.c_oflag +syscon termios VTDLY 0b0100000000000000 0b010000000000000000 0b010000000000000000 0 0 0b0100000000000000 # termios.c_oflag +syscon termios VT0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag +syscon termios VT1 0b0100000000000000 0b010000000000000000 0b010000000000000000 0 0 0b0100000000000000 # termios.c_oflag +syscon termios FFDLY 0b1000000000000000 0b000100000000000000 0b000100000000000000 0 0 0b1000000000000000 # termios.c_oflag +syscon termios FF0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag +syscon termios FF1 0b1000000000000000 0b000100000000000000 0b000100000000000000 0 0 0b1000000000000000 # termios.c_oflag +syscon termios CS6 0b0000000000010000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000000010000 # termios.c_cflag flag for 6-bit characters +syscon termios CS7 0b0000000000100000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000000000100000 # termios.c_cflag flag for 7-bit characters +syscon termios CS8 0b0000000000110000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000000000110000 # termios.c_cflag flag for 8-bit characters +syscon termios CSIZE 0b0000000000110000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000000000110000 # mask for CS𝑥 flags +syscon termios NCCS 32 32 32 32 20 32 # ARRAYLEN(termios.c_cc); faked xnu/freebsd/openbsd (originally 20) and faked nt +syscon termios VINTR 0 8 8 8 8 0 # termios.c_cc[VINTR]=𝑥 +syscon termios VQUIT 1 9 9 9 9 0 # termios.c_cc[VQUIT]=𝑥 +syscon termios VERASE 2 3 3 3 3 0 # termios.c_cc[VERASE]=𝑥 +syscon termios VKILL 3 5 5 5 5 0 # termios.c_cc[VKILL]=𝑥 +syscon termios VEOF 4 0 0 0 0 0 # termios.c_cc[VEOF]=𝑥 +syscon termios VTIME 5 17 17 17 17 0 # 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 VMIN 6 16 16 16 16 0 # 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 VSWTC 7 0 0 0 0 0 # termios.c_cc[VSWTC]=𝑥 +syscon termios VSTART 8 12 12 12 12 0 # termios.c_cc[VSTART]=𝑥 +syscon termios VSTOP 9 13 13 13 13 0 # termios.c_cc[VSTOP]=𝑥 +syscon termios VSUSP 10 10 10 10 10 0 # 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 1 1 1 0 # termios.c_cc[VEOL]=𝑥 +syscon termios VEOL2 16 2 2 2 2 0 # termios.c_cc[VEOL2]=𝑥 +syscon termios VREPRINT 12 6 6 6 6 0 # termios.c_cc[VREPRINT]=𝑥 +syscon termios VDISCARD 13 15 15 15 15 0 # termios.c_cc[VDISCARD]=𝑥 +syscon termios VWERASE 14 4 4 4 4 0 # termios.c_cc[VWERASE]=𝑥 +syscon termios VLNEXT 15 14 14 14 14 0 # termios.c_cc[VLNEXT]=𝑥 +syscon termios TIOCSERGETLSR 0x5459 0 0 0 0 0 # +syscon termios TIOCSERGETMULTI 0x545a 0 0 0 0 0 # +syscon termios TIOCSERSETMULTI 0x545b 0 0 0 0 0 # +syscon termios TIOCSER_TEMT 1 0 0 0 0 0 # +syscon termios VERIFY 47 0 0 0 0 0 +syscon termios PARENB 0x0100 0x1000 0x1000 0x1000 0x1000 0 # +syscon termios PARODD 0x0200 0x2000 0x2000 0x2000 0x2000 0 # +syscon termios CIBAUD 0x100f0000 0 0 0 0 0 +syscon termios CLOCAL 0x0800 0x8000 0x8000 0x8000 0x8000 0 # +syscon termios CMSPAR 0x40000000 0 0 0 0 0 +syscon termios BUSY 4 0 0 0 0 0 +syscon termios CANBSIZ 255 0 0 0 0 0 +syscon termios CBAUD 0x100f 0 0 0 0 0 +syscon termios CBAUDEX 0x1000 0 0 0 0 0 +syscon termios CBRK 0 255 255 255 255 0 # +syscon termios CEOL 0 255 255 255 255 0 # +syscon termios EXTA 14 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus +syscon termios EXTB 15 0x9600 0x9600 0x9600 0x9600 0 # bsd consensus +syscon termios ERA 0x02002c 45 45 0 0 0 +syscon termios EMPTY 0 0 0 0 0 0 # consensus +syscon termios TCFLSH 0x540b 0 0 0 0 0 +syscon termios TCIFLUSH 0 1 1 1 1 0 # bsd consensus +syscon termios TCIOFF 2 3 3 3 3 0 # bsd consensus +syscon termios TCIOFLUSH 2 3 3 3 3 0 # bsd consensus +syscon termios TCION 3 4 4 4 4 0 # bsd consensus +syscon termios TCOFLUSH 1 2 2 2 2 0 # bsd consensus +syscon termios TCOOFF 0 1 1 1 1 0 # bsd consensus +syscon termios TCOON 1 2 2 2 2 0 # bsd consensus + +# Pseudoteletypewriter Control +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon pty TIOCPKT 0x5420 0x80047470 0x80047470 0x80047470 0x80047470 -1 # boop +syscon pty TIOCPKT_DATA 0 0 0 0 0 0 # consensus +syscon pty TIOCPKT_FLUSHREAD 1 1 1 1 1 1 # unix consensus +syscon pty TIOCPKT_FLUSHWRITE 2 2 2 2 2 2 # unix consensus +syscon pty TIOCPKT_STOP 4 4 4 4 4 4 # unix consensus +syscon pty TIOCPKT_START 8 8 8 8 8 8 # unix consensus +syscon pty TIOCPKT_NOSTOP 16 16 16 16 16 16 # unix consensus +syscon pty TIOCPKT_DOSTOP 32 32 32 32 32 32 # unix consensus +syscon pty TIOCPKT_IOCTL 64 64 64 64 64 64 # unix consensus +syscon pty TIOCSPTLCK 0x40045431 0 0 0 0 -1 # boop +syscon pty PTMGET 0 0 0 0x40287401 0x40287401 -1 # for /dev/ptm + +# Modem Control +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon modem TIOCMGET 0x5415 0x4004746a 0x4004746a 0x4004746a 0x4004746a -1 # get status of modem bits; ioctl(fd, TIOCMGET, int *argp) +syscon modem TIOCMSET 0x5418 0x8004746d 0x8004746d 0x8004746d 0x8004746d -1 # set status of modem bits; ioctl(fd, TIOCMSET, const int *argp) +syscon modem TIOCMBIC 0x5417 0x8004746b 0x8004746b 0x8004746b 0x8004746b -1 # clear indicated modem bits; ioctl(fd, TIOCMBIC, int *argp) +syscon modem TIOCMBIS 0x5416 0x8004746c 0x8004746c 0x8004746c 0x8004746c -1 # set indicated modem bits; ioctl(fd, TIOCMBIS, int *argp) +syscon modem TIOCM_LE 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # consensus +syscon modem TIOCM_DTR 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 # consensus +syscon modem TIOCM_RTS 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 # consensus +syscon modem TIOCM_ST 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # consensus +syscon modem TIOCM_SR 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 # consensus +syscon modem TIOCM_CTS 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 # consensus +syscon modem TIOCM_CAR 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # consensus +syscon modem TIOCM_CD 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # boop +syscon modem TIOCM_RI 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # boop +syscon modem TIOCM_RNG 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # boop +syscon modem TIOCM_DSR 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # consensus +syscon modem TIOCM_DCD 0 0 0x40 0 0 -1 # wut +syscon modem TIOCMODG 0 0x40047403 0 0x4004746a 0x4004746a -1 # wut +syscon modem TIOCMODS 0 0x80047404 0 0x8004746d 0x8004746d -1 # wut +syscon modem TIOCMSDTRWAIT 0 0x8004745b 0x8004745b 0 0 -1 # wut syscon iff IFF_BROADCAST 2 2 2 2 2 2 # consensus syscon iff IFF_LOOPBACK 8 8 8 8 8 4 # unix consensus @@ -1610,97 +1512,6 @@ syscon iff IFF_MASTER 0x0400 0 0 0 0 0 syscon iff IFF_PORTSEL 0x2000 0 0 0 0 0 syscon iff IFF_SLAVE 0x0800 0 0 0 0 0 -syscon nd ND_RA_FLAG_MANAGED 0x80 0x80 0x80 0x80 0x80 0x80 # consensus -syscon nd ND_RA_FLAG_OTHER 0x40 0x40 0x40 0x40 0x40 0x40 # consensus -syscon nd ND_NA_FLAG_OVERRIDE 0x20 0x20 0x20 0x20 0x20 0x20000000 # unix consensus -syscon nd ND_NA_FLAG_ROUTER 0x80 0x80 0x80 0x80 0x80 0x80000000 # unix consensus -syscon nd ND_NA_FLAG_SOLICITED 0x40 0x40 0x40 0x40 0x40 0x40000000 # unix consensus -syscon nd ND_NEIGHBOR_ADVERT 136 136 136 136 136 0 # unix consensus -syscon nd ND_NEIGHBOR_SOLICIT 135 135 135 135 135 0 # unix consensus -syscon nd ND_REDIRECT 137 137 137 137 137 0 # unix consensus -syscon nd ND_ROUTER_ADVERT 134 134 134 134 134 0 # unix consensus -syscon nd ND_ROUTER_SOLICIT 133 133 133 133 133 0 # unix consensus -syscon nd ND_RA_FLAG_HOME_AGENT 0x20 0 0 0 0 0x20 # bsd consensus - -syscon misc TCFLSH 0x540b 0 0 0 0 0 -syscon misc TCIFLUSH 0 1 1 1 1 0 # bsd consensus -syscon misc TCIOFF 2 3 3 3 3 0 # bsd consensus -syscon misc TCIOFLUSH 2 3 3 3 3 0 # bsd consensus -syscon misc TCION 3 4 4 4 4 0 # bsd consensus -syscon misc TCOFLUSH 1 2 2 2 2 0 # bsd consensus -syscon misc TCOOFF 0 1 1 1 1 0 # bsd consensus -syscon misc TCOON 1 2 2 2 2 0 # bsd consensus - -syscon misc TYPE_DISK 0 0 0 0 0 0 # consensus -syscon misc TYPE_A 1 1 1 1 1 0 # unix consensus -syscon misc TYPE_E 2 2 2 2 2 0 # unix consensus -syscon misc TYPE_I 3 3 3 3 3 0 # unix consensus -syscon misc TYPE_L 4 4 4 4 4 0 # unix consensus -syscon misc TYPE_ENCLOSURE 13 0 0 0 0 0 -syscon misc TYPE_MEDIUM_CHANGER 8 0 0 0 0 0 -syscon misc TYPE_MOD 7 0 0 0 0 0 -syscon misc TYPE_NO_LUN 127 0 0 0 0 0 -syscon misc TYPE_PROCESSOR 3 0 0 0 0 0 -syscon misc TYPE_ROM 5 0 0 0 0 0 -syscon misc TYPE_SCANNER 6 0 0 0 0 0 -syscon misc TYPE_TAPE 1 0 0 0 0 0 -syscon misc TYPE_WORM 4 0 0 0 0 0 - -syscon misc _POSIX2_BC_BASE_MAX 99 99 99 99 99 0 # unix consensus -syscon misc _POSIX2_BC_DIM_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus -syscon misc _POSIX2_BC_SCALE_MAX 99 99 99 99 99 0 # unix consensus -syscon misc _POSIX2_BC_STRING_MAX 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 0 # unix consensus -syscon misc _POSIX2_CHARCLASS_NAME_MAX 14 14 14 14 14 0 # unix consensus -syscon misc _POSIX2_COLL_WEIGHTS_MAX 2 2 2 2 2 0 # unix consensus -syscon misc _POSIX2_EXPR_NEST_MAX 0x20 0x20 0x20 0x20 0x20 0 # unix consensus -syscon misc _POSIX2_LINE_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus -syscon misc _POSIX2_RE_DUP_MAX 255 255 255 255 255 0 # unix consensus -syscon misc _POSIX2_C_BIND 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus -syscon misc _POSIX2_VERSION 0x031069 0x030db0 0x030a2c 0x031069 0x031069 0 - -syscon misc PTHREAD_MUTEX_STALLED 0 0 0 0 0 0 # consensus -syscon misc PTHREAD_PRIO_NONE 0 0 0 0 0 0 # consensus -syscon misc PTHREAD_PRIO_INHERIT 0 1 1 1 1 0 # bsd consensus -syscon misc PTHREAD_PRIO_PROTECT 0 2 2 2 2 0 # bsd consensus -syscon misc PTHREAD_DESTRUCTOR_ITERATIONS 4 4 4 4 4 0 # unix consensus -syscon misc PTHREAD_PROCESS_SHARED 1 1 1 1 1 0 # unix consensus -syscon misc PTHREAD_CREATE_DETACHED 1 2 1 1 1 0 -syscon misc PTHREAD_KEYS_MAX 0x0400 0x0200 0x0100 0x0100 0x0100 0 -syscon misc PTHREAD_STACK_MIN 0x4000 0x2000 0x0800 0x1000 0x1000 0 -syscon misc PTHREAD_BARRIER_SERIAL_THREAD -1 0 -1 -1 -1 0 -syscon misc PTHREAD_CANCEL_ASYNCHRONOUS 1 0 2 2 2 0 -syscon misc PTHREAD_CANCEL_DISABLE 1 0 1 1 1 0 -syscon misc PTHREAD_INHERIT_SCHED 0 1 4 4 4 0 -syscon misc PTHREAD_SCOPE_SYSTEM 0 1 2 2 2 0 -syscon misc PTHREAD_EXPLICIT_SCHED 1 2 0 0 0 0 -syscon misc PTHREAD_MUTEX_DEFAULT 0 0 1 4 4 0 -syscon misc PTHREAD_MUTEX_ERRORCHECK 0 1 0 1 1 0 -syscon misc PTHREAD_MUTEX_RECURSIVE 0 2 0 2 2 0 -syscon misc PTHREAD_SCOPE_PROCESS 1 2 0 0 0 0 -syscon misc PTHREAD_CANCEL_DEFERRED 0 2 0 0 0 0 -syscon misc PTHREAD_CANCEL_ENABLE 0 1 0 0 0 0 -syscon misc PTHREAD_CREATE_JOINABLE 0 1 0 0 0 0 -syscon misc PTHREAD_MUTEX_NORMAL 0 0 0 3 3 0 -syscon misc PTHREAD_MUTEX_ROBUST 0 0 1 0 0 0 -syscon misc PTHREAD_PROCESS_PRIVATE 0 2 0 0 0 0 - -syscon misc N_TTY 0 0 0 0 0 0 # consensus -syscon misc N_6PACK 7 0 0 0 0 0 -syscon misc N_AX25 5 0 0 0 0 0 -syscon misc N_HCI 15 0 0 0 0 0 -syscon misc N_HDLC 13 0 0 0 0 0 -syscon misc N_IRDA 11 0 0 0 0 0 -syscon misc N_MASC 8 0 0 0 0 0 -syscon misc N_MOUSE 2 0 0 0 0 0 -syscon misc N_PPP 3 0 0 0 0 0 -syscon misc N_PROFIBUS_FDL 10 0 0 0 0 0 -syscon misc N_R3964 9 0 0 0 0 0 -syscon misc N_SLIP 1 0 0 0 0 0 -syscon misc N_SMSBLOCK 12 0 0 0 0 0 -syscon misc N_STRIP 4 0 0 0 0 0 -syscon misc N_SYNC_PPP 14 0 0 0 0 0 -syscon misc N_X25 6 0 0 0 0 0 - syscon sock SOCK_STREAM 1 1 1 1 1 1 # consensus syscon sock SOCK_DGRAM 2 2 2 2 2 2 # consensus syscon sock SOCK_RAW 3 3 3 3 3 3 # consensus @@ -1723,32 +1534,6 @@ syscon prsnlty ADDR_NO_RANDOMIZE 0x0040000 0 0 0 0 0 # linux only syscon prsnlty SHORT_INODE 0x1000000 0 0 0 0 0 # linux only syscon prsnlty UNAME26 0x0020000 0 0 0 0 0 # linux only -syscon misc INADDR_ANY 0 0 0 0 0 0 # consensus -syscon misc INADDR_BROADCAST 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # consensus -syscon misc INADDR_NONE 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # consensus -syscon misc INADDR_ALLHOSTS_GROUP 0xe0000001 0xe0000001 0xe0000001 0xe0000001 0xe0000001 0 # unix consensus -syscon misc INADDR_LOOPBACK 0x7f000001 0x7f000001 0x7f000001 0x7f000001 0x7f000001 0x7f000001 # consensus -syscon misc INADDR_MAX_LOCAL_GROUP 0xe00000ff 0xe00000ff 0xe00000ff 0xe00000ff 0xe00000ff 0 # unix consensus -syscon misc INADDR_UNSPEC_GROUP 0xe0000000 0xe0000000 0xe0000000 0xe0000000 0xe0000000 0 # unix consensus -syscon misc INADDR_ALLRTRS_GROUP 0xe0000002 0xe0000002 0xe0000002 0 0 0 - -syscon misc BLKTYPE 52 52 52 52 52 0 # unix consensus -syscon misc BLKBSZGET 0x80081270 0 0 0 0 0 -syscon misc BLKBSZSET 0x40081271 0 0 0 0 0 -syscon misc BLKFLSBUF 0x1261 0 0 0 0 0 -syscon misc BLKFRAGET 0x1265 0 0 0 0 0 -syscon misc BLKFRASET 0x1264 0 0 0 0 0 -syscon misc BLKGETSIZE 0x1260 0 0 0 0 0 -syscon misc BLKGETSIZE64 0x80081272 0 0 0 0 0 -syscon misc BLKRAGET 0x1263 0 0 0 0 0 -syscon misc BLKRASET 0x1262 0 0 0 0 0 -syscon misc BLKROGET 0x125e 0 0 0 0 0 -syscon misc BLKROSET 0x125d 0 0 0 0 0 -syscon misc BLKRRPART 0x125f 0 0 0 0 0 -syscon misc BLKSECTGET 0x1267 0 0 0 0 0 -syscon misc BLKSECTSET 0x1266 0 0 0 0 0 -syscon misc BLKSSZGET 0x1268 0 0 0 0 0 - syscon misc TH_FIN 1 1 1 1 1 1 # consensus syscon misc TH_SYN 2 2 2 2 2 2 # consensus syscon misc TH_RST 4 4 4 4 4 4 # consensus @@ -1788,108 +1573,6 @@ syscon misc TCPOPT_SACK_PERMITTED 4 4 4 4 4 0 # unix consensus syscon misc TCPOPT_TIMESTAMP 8 8 8 8 8 0 # unix consensus syscon misc TCPOPT_WINDOW 3 3 3 3 3 0 # unix consensus -syscon misc ETH_P_CUST 0x6006 0 0 0 0 0 -syscon misc ETH_P_DDCMP 6 0 0 0 0 0 -syscon misc ETH_P_DEC 0x6000 0 0 0 0 0 -syscon misc ETH_P_DIAG 0x6005 0 0 0 0 0 -syscon misc ETH_P_DNA_DL 0x6001 0 0 0 0 0 -syscon misc ETH_P_DNA_RC 0x6002 0 0 0 0 0 -syscon misc ETH_P_DNA_RT 0x6003 0 0 0 0 0 -syscon misc ETH_P_IEEE802154 246 0 0 0 0 0 -syscon misc ETH_P_LAT 0x6004 0 0 0 0 0 -syscon misc ETH_P_LOCALTALK 9 0 0 0 0 0 -syscon misc ETH_P_PPP_MP 8 0 0 0 0 0 -syscon misc ETH_P_RARP 0x8035 0 0 0 0 0 -syscon misc ETH_P_SCA 0x6007 0 0 0 0 0 -syscon misc ETH_P_WAN_PPP 7 0 0 0 0 0 - -syscon misc ST_NOSUID 2 2 2 2 2 0 # unix consensus -syscon misc ST_RDONLY 1 1 1 1 1 0 # unix consensus -syscon misc ST_APPEND 0x0100 0 0 0 0 0 -syscon misc ST_IMMUTABLE 0x0200 0 0 0 0 0 -syscon misc ST_MANDLOCK 0x40 0 0 0 0 0 -syscon misc ST_NOATIME 0x0400 0 0 0 0 0 -syscon misc ST_NODEV 4 0 0 0 0 0 -syscon misc ST_NODIRATIME 0x0800 0 0 0 0 0 -syscon misc ST_NOEXEC 8 0 0 0 0 0 -syscon misc ST_RELATIME 0x1000 0 0 0 0 0 -syscon misc ST_SYNCHRONOUS 0x10 0 0 0 0 0 -syscon misc ST_WRITE 0x80 0 0 0 0 0 - -syscon misc SCSI_IOCTL_BENCHMARK_COMMAND 3 0 0 0 0 0 -syscon misc SCSI_IOCTL_DOORLOCK 0x5380 0 0 0 0 0 -syscon misc SCSI_IOCTL_DOORUNLOCK 0x5381 0 0 0 0 0 -syscon misc SCSI_IOCTL_GET_BUS_NUMBER 0x5386 0 0 0 0 0 -syscon misc SCSI_IOCTL_GET_IDLUN 0x5382 0 0 0 0 0 -syscon misc SCSI_IOCTL_PROBE_HOST 0x5385 0 0 0 0 0 -syscon misc SCSI_IOCTL_SEND_COMMAND 1 0 0 0 0 0 -syscon misc SCSI_IOCTL_START_UNIT 5 0 0 0 0 0 -syscon misc SCSI_IOCTL_STOP_UNIT 6 0 0 0 0 0 -syscon misc SCSI_IOCTL_SYNC 4 0 0 0 0 0 -syscon misc SCSI_IOCTL_TAGGED_DISABLE 0x5384 0 0 0 0 0 -syscon misc SCSI_IOCTL_TAGGED_ENABLE 0x5383 0 0 0 0 0 -syscon misc SCSI_IOCTL_TEST_UNIT_READY 2 0 0 0 0 0 -syscon misc BUS_DEVICE_RESET 12 0 0 0 0 0 # SIGBUS; - -syscon misc READ_10 40 0 0 0 0 0 -syscon misc READ_12 168 0 0 0 0 0 -syscon misc READ_6 8 0 0 0 0 0 -syscon misc READ_BLOCK_LIMITS 5 0 0 0 0 0 -syscon misc READ_BUFFER 60 0 0 0 0 0 -syscon misc READ_CAPACITY 37 0 0 0 0 0 -syscon misc READ_DEFECT_DATA 55 0 0 0 0 0 -syscon misc READ_ELEMENT_STATUS 184 0 0 0 0 0 -syscon misc READ_LONG 62 0 0 0 0 0 -syscon misc READ_POSITION 52 0 0 0 0 0 -syscon misc READ_REVERSE 15 0 0 0 0 0 -syscon misc READ_TOC 67 0 0 0 0 0 - -# getpriority() / setpriority() magnums (a.k.a. nice) -# -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary -syscon prio PRIO_PROCESS 0 0 0 0 0 0 # consensus / poly nt -syscon prio PRIO_PGRP 1 1 1 1 1 1 # unix consensus / poly nt -syscon prio PRIO_USER 2 2 2 2 2 2 # unix consensus / poly nt -syscon prio PRIO_MIN -20 -20 -20 -20 -20 -20 # unix consensus / poly nt -syscon prio PRIO_MAX 20 20 20 20 20 20 # unix consensus / poly nt -syscon prio NZERO 20 20 20 20 20 20 # unix consensus / polyfilled nt - -# getaddrinfo() flags -# -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary -syscon gai AI_PASSIVE 1 1 1 1 1 1 # consensus -syscon gai AI_CANONNAME 2 2 2 2 2 2 # consensus -syscon gai AI_NUMERICHOST 4 4 4 4 4 4 # consensus -syscon gai AI_ADDRCONFIG 0x20 0x0400 0x0400 0x40 0x40 0x0400 -syscon gai AI_NUMERICSERV 0x0400 0x1000 8 0x10 0x10 8 -syscon gai AI_ALL 0x10 0x0100 0x0100 0 0 0x0100 -syscon gai AI_V4MAPPED 8 0x0800 0x0800 0 0 0x0800 - -syscon misc BLK_BYTECOUNT 2 2 2 2 2 0 # unix consensus -syscon misc BLK_EOF 0x40 0x40 0x40 0x40 0x40 0 # unix consensus -syscon misc BLK_EOR 0x80 0x80 0x80 0x80 0x80 0 # unix consensus -syscon misc BLK_ERRORS 0x20 0x20 0x20 0x20 0x20 0 # unix consensus -syscon misc BLK_RESTART 0x10 0x10 0x10 0x10 0x10 0 # unix consensus - -syscon misc MODE_B 2 2 2 2 2 0 # unix consensus -syscon misc MODE_C 3 3 3 3 3 0 # unix consensus -syscon misc MODE_S 1 1 1 1 1 0 # unix consensus -syscon misc MODE_SELECT 21 0 0 0 0 0 -syscon misc MODE_SELECT_10 85 0 0 0 0 0 -syscon misc MODE_SENSE 26 0 0 0 0 0 -syscon misc MODE_SENSE_10 90 0 0 0 0 0 - -syscon misc WRITE_10 42 0 0 0 0 0 -syscon misc WRITE_12 170 0 0 0 0 0 -syscon misc WRITE_6 10 0 0 0 0 0 -syscon misc WRITE_BUFFER 59 0 0 0 0 0 -syscon misc WRITE_FILEMARKS 0x10 0 0 0 0 0 -syscon misc WRITE_LONG 63 0 0 0 0 0 -syscon misc WRITE_LONG_2 234 0 0 0 0 0 -syscon misc WRITE_SAME 65 0 0 0 0 0 -syscon misc WRITE_VERIFY 46 0 0 0 0 0 -syscon misc WRITE_VERIFY_12 174 0 0 0 0 0 - syscon lock LOCK_UNLOCK_CACHE 54 0 0 0 0 0 # wut syscon misc ARPHRD_ETHER 1 1 1 1 1 0 # unix consensus @@ -2098,11 +1781,6 @@ syscon misc MCAST_INCLUDE 1 1 1 0 0 0 syscon misc MCAST_EXCLUDE 0 2 2 0 0 0 syscon misc MCAST_MSFILTER 48 0 0 0 0 0 -syscon misc SIG_BLOCK 0 1 1 1 1 0 # bsd consensus; faked nt -syscon misc SIG_UNBLOCK 1 2 2 2 2 1 # bsd consensus; faked nt -syscon misc SIG_SETMASK 2 3 3 3 3 2 # bsd consensus; faked nt -syscon misc SIG_ATOMIC_MIN -2147483648 -2147483648 -9223372036854775808 -2147483648 -2147483648 0 - syscon misc AREGTYPE 0 0 0 0 0 0 # consensus syscon misc B0 0 0 0 0 0 0 # consensus syscon misc CS5 0 0 0 0 0 0 # consensus @@ -2174,7 +1852,6 @@ syscon misc UDP_NO_CHECK6_RX 102 0 0 0 0 0 syscon misc UDP_NO_CHECK6_TX 101 0 0 0 0 0 syscon misc ACK 4 4 4 4 4 0 # unix consensus -syscon misc BIG_ENDIAN 0x10e1 0x10e1 0x10e1 0x10e1 0x10e1 0 # unix consensus syscon misc CDISCARD 15 15 15 15 15 0 # unix consensus syscon misc CDSUSP 25 25 25 25 25 0 # unix consensus syscon misc CEOF 4 4 4 4 4 0 # unix consensus @@ -2212,7 +1889,7 @@ syscon misc EXPR_NEST_MAX 0x20 0x20 0x20 0x20 0x20 0 # unix conse # linux fallocate() flags # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary syscon misc FALLOC_FL_KEEP_SIZE 0x01 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_PUNCH_HOLE 0x02 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_NO_HIDE_STALE 0x04 -1 -1 -1 -1 -1 # bsd consensus @@ -2221,513 +1898,9 @@ syscon misc FALLOC_FL_ZERO_RANGE 0x10 -1 -1 -1 -1 0x000980C8 # bsd syscon misc FALLOC_FL_INSERT_RANGE 0x20 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_UNSHARE_RANGE 0x40 -1 -1 -1 -1 -1 # bsd consensus -syscon misc FIFOTYPE 54 54 54 54 54 0 # unix consensus -syscon misc GRPQUOTA 1 1 1 1 1 0 # unix consensus -syscon misc IF_NAMESIZE 0x10 0x10 0x10 0x10 0x10 0 # unix consensus -syscon misc INTERMEDIATE_C_GOOD 10 0 0 0 0 0 -syscon misc INTERMEDIATE_GOOD 8 0 0 0 0 0 - -syscon misc IOV_MAX 0x0400 0x0400 0x0400 0x0400 0x0400 16 # unix consensus & MSG_MAXIOVLEN -syscon misc LINE_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus -syscon misc LINKED_CMD_COMPLETE 10 0 0 0 0 0 -syscon misc LINKED_FLG_CMD_COMPLETE 11 0 0 0 0 0 - -syscon misc LITTLE_ENDIAN 0x04d2 0x04d2 0x04d2 0x04d2 0x04d2 0 # unix consensus -syscon misc LNKTYPE 49 49 49 49 49 0 # unix consensus -syscon misc MAXNAMLEN 255 255 255 255 255 0 # unix consensus -syscon misc MAXQUOTAS 2 2 2 2 2 0 # unix consensus -syscon misc MEDIUM_ERROR 3 0 0 0 0 0 -syscon misc MEDIUM_SCAN 56 0 0 0 0 0 - -syscon misc NBBY 8 8 8 8 8 0 # unix consensus -syscon misc NR_DQHASH 43 0 0 0 0 0 -syscon misc NR_DQUOTS 0x0100 0 0 0 0 0 - -syscon misc PERSISTENT_RESERVE_IN 94 0 0 0 0 0 -syscon misc PERSISTENT_RESERVE_OUT 95 0 0 0 0 0 - -syscon misc PRELIM 1 1 1 1 1 0 # unix consensus -syscon misc REGTYPE 48 48 48 48 48 0 # unix consensus -syscon misc RES_PRF_CLASS 4 4 4 4 4 0 # unix consensus -syscon misc RHF_GUARANTEE_START_INIT 0x80 0 0 0 0 0 -syscon misc RHF_NO_LIBRARY_REPLACEMENT 4 0 0 0 0 0 - -syscon misc RRQ 1 1 1 1 1 0 # unix consensus -syscon misc RTF_NOFORWARD 0x1000 0 0 0 0 0 -syscon misc RTF_NOPMTUDISC 0x4000 0 0 0 0 0 - -syscon misc SARMAG 8 8 8 8 8 0 # unix consensus -syscon misc SEGSIZE 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus -syscon misc SEND_DIAGNOSTIC 29 0 0 0 0 0 -syscon misc SEND_VOLUME_TAG 182 0 0 0 0 0 - -syscon misc SET_LIMITS 51 0 0 0 0 0 -syscon misc SET_WINDOW 36 0 0 0 0 0 - -syscon misc SFD_CLOEXEC 0x080000 0 0 0 0 0 -syscon misc SFD_NONBLOCK 0x0800 0 0 0 0 0 - -syscon misc SOMAXCONN 0x80 0x80 0x80 0x80 0x80 0x7fffffff # unix consensus -syscon misc SUBCMDMASK 255 255 255 255 255 0 # unix consensus -syscon misc SUBCMDSHIFT 8 8 8 8 8 0 # unix consensus -syscon misc SYMTYPE 50 50 50 50 50 0 # unix consensus -syscon misc TGEXEC 8 8 8 8 8 0 # unix consensus -syscon misc TGREAD 0x20 0x20 0x20 0x20 0x20 0 # unix consensus -syscon misc TGWRITE 0x10 0x10 0x10 0x10 0x10 0 # unix consensus -syscon misc TMAGLEN 6 6 6 6 6 0 # unix consensus -syscon misc TOEXEC 1 1 1 1 1 0 # unix consensus -syscon misc TOREAD 4 4 4 4 4 0 # unix consensus -syscon misc TOWRITE 2 2 2 2 2 0 # unix consensus -syscon misc TRANSIENT 4 4 4 4 4 0 # unix consensus -syscon misc TRY_AGAIN 2 2 2 2 2 0x2afa # unix consensus -syscon misc TSGID 0x0400 0x0400 0x0400 0x0400 0x0400 0 # unix consensus -syscon misc TSUID 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus -syscon misc TSVTX 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus -syscon misc TUEXEC 0x40 0x40 0x40 0x40 0x40 0 # unix consensus -syscon misc TUREAD 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus -syscon misc TUWRITE 0x80 0x80 0x80 0x80 0x80 0 # unix consensus -syscon misc TVERSLEN 2 2 2 2 2 0 # unix consensus -syscon misc WORD_BIT 0x20 0x20 0x20 0x20 0x20 0 # unix consensus -syscon misc WRQ 2 2 2 2 2 0 # unix consensus -syscon misc SIGEV_THREAD 2 3 2 0 2 0 -syscon misc SIGEV_SIGNAL 0 1 1 0 1 0 -syscon misc SIGEV_NONE 1 0 0 0 0 0 - -syscon misc BC_BASE_MAX 99 99 99 0x7fffffff 0x7fffffff 0 -syscon misc BC_DIM_MAX 0x0800 0x0800 0x0800 0xffff 0xffff 0 -syscon misc BC_SCALE_MAX 99 99 99 0x7fffffff 0x7fffffff 0 -syscon misc BC_STRING_MAX 0x03e8 0x03e8 0x03e8 0x7fffffff 0x7fffffff 0 - -syscon misc ABORTED_COMMAND 11 0 0 0 0 0 -syscon misc ACORE 0 8 8 8 8 0 # bsd consensus -syscon misc AFORK 0 1 1 1 1 0 # bsd consensus -syscon misc AIO_ALLDONE 2 1 3 0 0 0 -syscon misc AIO_NOTCANCELED 1 4 2 0 0 0 -syscon misc AIO_CANCELED 0 2 1 0 0 0 - -syscon misc ALLOW_MEDIUM_REMOVAL 30 0 0 0 0 0 -syscon misc ASU 0 2 2 2 2 0 # bsd consensus -syscon misc ATF_NETMASK 0x20 0 0 0 0 0 -syscon misc AXSIG 0 0x10 0x10 0x10 0x10 0 # bsd consensus -syscon misc B1000000 0x1008 0 0 0 0 0 -syscon misc B110 3 110 110 110 110 0 # bsd consensus -syscon misc B115200 0x1002 0x01c200 0x01c200 0x01c200 0x01c200 0 # bsd consensus -syscon misc B1152000 0x1009 0 0 0 0 0 -syscon misc B1200 9 0x04b0 0x04b0 0x04b0 0x04b0 0 # bsd consensus -syscon misc B134 4 134 134 134 134 0 # bsd consensus -syscon misc B150 5 150 150 150 150 0 # bsd consensus -syscon misc B1500000 0x100a 0 0 0 0 0 -syscon misc B1800 10 0x0708 0x0708 0x0708 0x0708 0 # bsd consensus -syscon misc B19200 14 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus -syscon misc B200 6 200 200 200 200 0 # bsd consensus -syscon misc B2000000 0x100b 0 0 0 0 0 -syscon misc B230400 0x1003 0x038400 0x038400 0x038400 0x038400 0 # bsd consensus -syscon misc B2400 11 0x0960 0x0960 0x0960 0x0960 0 # bsd consensus -syscon misc B2500000 0x100c 0 0 0 0 0 -syscon misc B300 7 300 300 300 300 0 # bsd consensus -syscon misc B3000000 0x100d 0 0 0 0 0 -syscon misc B3500000 0x100e 0 0 0 0 0 -syscon misc B38400 15 0x9600 0x9600 0x9600 0x9600 0 # bsd consensus -syscon misc B4000000 0x100f 0 0 0 0 0 -syscon misc B4800 12 0x12c0 0x12c0 0x12c0 0x12c0 0 # bsd consensus -syscon misc B50 1 50 50 50 50 0 # bsd consensus -syscon misc B500000 0x1005 0 0 0 0 0 -syscon misc B57600 0x1001 0xe100 0xe100 0xe100 0xe100 0 # bsd consensus -syscon misc B576000 0x1006 0 0 0 0 0 -syscon misc B600 8 600 600 600 600 0 # bsd consensus -syscon misc B75 2 75 75 75 75 0 # bsd consensus -syscon misc B9600 13 0x2580 0x2580 0x2580 0x2580 0 # bsd consensus -syscon misc BITSPERBYTE 8 0 0 0 0 0 -syscon misc BLANK_CHECK 8 0 0 0 0 0 -syscon misc CHANGE_DEFINITION 0x40 0 0 0 0 0 -syscon misc CHARBITS 8 0 0 0 0 0 -syscon misc CHECK_CONDITION 1 0 0 0 0 0 -syscon misc CONDITION_GOOD 2 0 0 0 0 0 -syscon misc CREAD 0x80 0x0800 0x0800 0x0800 0x0800 0 # bsd consensus -syscon misc CSTOPB 0x40 0x0400 0x0400 0x0400 0x0400 0 # bsd consensus -syscon misc DATA_PROTECT 7 0 0 0 0 0 -syscon misc DELAYTIMER_MAX 0x7fffffff 0 0 0 0 0 -syscon misc DMAXEXP 0x0400 0 0 0 0 0 -syscon misc DMINEXP -1021 0 0 0 0 0 -syscon misc DOUBLEBITS 0x40 0 0 0 0 0 -syscon misc ERA_D_FMT 0x02002e 46 46 0 0 0 -syscon misc ERA_D_T_FMT 0x020030 47 47 0 0 0 -syscon misc ERA_T_FMT 0x020031 48 48 0 0 0 - -# 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 XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary -syscon termios TCGETS 0x5401 0x40487413 0x402c7413 0x402c7413 0x402c7413 0 # Gets console settings; tcgetattr(tty, argp) → ioctl(tty, TCGETS, struct termios *argp); polyfilled NT -syscon compat TIOCGETA 0x5401 0x40487413 0x402c7413 0x402c7413 0x402c7413 0 # Gets console settings; = tcgetattr(tty, struct termios *argp) -#syscon compat TCGETA 0x5405 0 0 0 0 0 # Gets console settings; ≈ ioctl(fd, TCGETA, struct termio *argp) -syscon termios TCSANOW 0 0 0 0 0 0 # Sets console settings; tcsetattr(fd, TCSANOW, argp); polyfilled NT -syscon termios TCSETS 0x5402 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; = ioctl(tty, TCSETS, const struct termios *argp); polyfilled NT -syscon compat TIOCSETA 0x5402 0x80487414 0x802c7414 0x802c7414 0x802c7414 0x5402 # Sets console settings; = ioctl(tty, TIOCSETA, const struct termios *argp); polyfilled NT -#syscon compat TCSETA 0x5402 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 # Drains output & sets console settings; tcsetawttr(fd, TCSADRAIN, argp); polyfilled NT -syscon termios TCSETSW 0x5403 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; = ioctl(tty, TCSETSW, const struct termios *argp); polyfilled NT -syscon compat TIOCSETAW 0x5403 0x80487415 0x802c7415 0x802c7415 0x802c7415 0x5403 # Drains output & sets console settings; = ioctl(tty, TIOCSETAW, const struct termios *argp); polyfilled NT -#syscon compat TCSETAW 0x5403 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 # Drops input & drains output & sets console settings; tcsetafttr(fd, TCSAFLUSH, argp); polyfilled NT -syscon termios TCSETSF 0x5404 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 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 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 1074295912 1074295912 1074295912 1074295912 0x5413 # ioctl(tty, TIOCGWINSZ, struct winsize *argp); polyfilled NT -syscon termios TIOCSWINSZ 0x5414 0x80087467 0x80087467 0x80087467 0x80087467 0x5414 # ioctl(tty, TIOCSWINSZ, const struct winsize *argp) (faked NT) -syscon termios TIOCOUTQ 0x5411 0x40047473 0x40047473 0x40047473 0x40047473 0 # get # bytes queued in TTY's output buffer ioctl(tty, TIOCSWINSZ, const struct winsize *argp) -syscon termios TIOCCBRK 0x5428 0x2000747a 0x2000747a 0x2000747a 0x2000747a 0 # boop -syscon termios TIOCCONS 0x541d 0x80047462 0x80047462 0x80047462 0x80047462 0 # boop -syscon termios TIOCGETD 0x5424 0x4004741a 0x4004741a 0x4004741a 0x4004741a 0 # boop -syscon termios TIOCGPGRP 0x540f 0x40047477 0x40047477 0x40047477 0x40047477 0 # boop -syscon termios TIOCNOTTY 0x5422 0x20007471 0x20007471 0x20007471 0x20007471 0 # boop -syscon termios TIOCNXCL 0x540d 0x2000740e 0x2000740e 0x2000740e 0x2000740e 0 # boop -syscon termios TIOCSBRK 0x5427 0x2000747b 0x2000747b 0x2000747b 0x2000747b 0 # boop -syscon termios TIOCSCTTY 0x540e 0x20007461 0x20007461 0x20007461 0x20007461 0 # boop -syscon termios TIOCSETD 0x5423 0x8004741b 0x8004741b 0x8004741b 0x8004741b 0 # boop -syscon termios TIOCSIG 0x40045436 0x2000745f 0x2004745f 0x8004745f 0x8004745f 0 # boop -syscon termios TIOCSPGRP 0x5410 0x80047476 0x80047476 0x80047476 0x80047476 0 # boop -syscon termios TIOCSTI 0x5412 0x80017472 0x80017472 0 0 0 # boop -syscon termios TIOCGPTN 0x80045430 0 0x4004740f 0 0 0 # boop -syscon termios TIOCGSID 0x5429 0 0x40047463 0x40047463 0x40047463 0 # boop -syscon termios TABLDISC 0 0x3 0 0x3 0x3 0 # boop -syscon termios SLIPDISC 0 0x4 0x4 0x4 0x4 0 # boop -syscon termios PPPDISC 0 0x5 0x5 0x5 0x5 0 # boop -syscon termios TIOCDRAIN 0 0x2000745e 0x2000745e 0x2000745e 0x2000745e 0 # boop -syscon termios TIOCSTAT 0 0x20007465 0x20007465 0x20007465 0x20007465 0 # boop -syscon termios TIOCSTART 0 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0 # boop -syscon termios TIOCCDTR 0 0x20007478 0x20007478 0x20007478 0x20007478 0 # boop -syscon termios TIOCSDTR 0 0x20007479 0x20007479 0x20007479 0x20007479 0 # boop -syscon termios TIOCFLUSH 0 0x80047410 0x80047410 0x80047410 0x80047410 0 # boop -syscon termios TIOCEXT 0 0x80047460 0x80047460 0x80047460 0x80047460 0 # boop -syscon termios TIOCGDRAINWAIT 0 0x40047456 0x40047456 0 0 0 # boop -syscon termios TIOCTIMESTAMP 0 0x40107459 0x40107459 0 0 0 # boop -syscon termios TIOCSDRAINWAIT 0 0x80047457 0x80047457 0 0 0 # boop -syscon termios TIOCREMOTE 0 0x80047469 0 0x80047469 0x80047469 0 # boop -syscon termios TTYDISC 0 0 0 0 0 0 # boop -syscon termios TIOCFLAG_SOFTCAR 0 0 0 0x1 0x1 0 # boop -syscon termios TIOCFLAG_PPS 0 0 0 0x10 0x10 0 # boop -syscon termios TIOCFLAG_CLOCAL 0 0 0 0x2 0x2 0 # boop -syscon termios TIOCCHKVERAUTH 0 0 0 0x2000741e 0x2000741e 0 # boop -syscon termios TIOCGFLAGS 0 0 0 0x4004745d 0x4004745d 0 # boop -syscon termios TIOCGTSTAMP 0 0 0 0x4010745b 0x4010745b 0 # boop -syscon termios STRIPDISC 0 0 0 0x6 0x6 0 # boop -syscon termios NMEADISC 0 0 0 0x7 0x7 0 # boop -syscon termios TIOCUCNTL_CBRK 0 0 0 0x7a 0x7a 0 # boop -syscon termios TIOCFLAG_MDMBUF 0 0 0 0x8 0x8 0 # boop -syscon termios TIOCSETVERAUTH 0 0 0 0x8004741c 0x8004741c 0 # boop -syscon termios TIOCSFLAGS 0 0 0 0x8004745c 0x8004745c 0 # boop -syscon termios TIOCSTSTAMP 0 0 0 0x8008745a 0x8008745a 0 # boop -syscon termios ENDRUNDISC 0 0 0 0x9 0x9 0 # boop -syscon termios TIOCPTMASTER 0 0 0x2000741c 0 0 0 # boop -syscon termios NETGRAPHDISC 0 0 0x6 0 0 0 # boop -syscon termios H4DISC 0 0 0x7 0 0 0 # boop - -syscon termios ISIG 0b0000000000000001 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000000000001 # termios.c_lflag|=ISIG makes Ctrl-C, Ctrl-\, etc. generate signals -syscon termios ICANON 0b0000000000000010 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000000000010 # termios.c_lflag&=~ICANON disables 1960's version of gnu readline (see also VMIN) -syscon termios XCASE 0b0000000000000100 0 0 16777216 16777216 0b0000000000000100 # termios.c_lflag -syscon termios ECHO 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # termios.c_lflag&=~ECHO is for passwords and raw mode -syscon termios ECHOE 0b0000000000010000 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000010000 # termios.c_lflag -syscon termios ECHOK 0b0000000000100000 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000100000 # termios.c_lflag -syscon termios ECHONL 0b0000000001000000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000001000000 # termios.c_lflag -syscon termios NOFLSH 0b0000000010000000 2147483648 2147483648 2147483648 2147483648 0b0000000010000000 # termios.c_lflag|=NOFLSH means don't flush on INT/QUIT/SUSP -syscon termios TOSTOP 0b0000000100000000 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 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000001000000000 # termios.c_lflag|=ECHOCTL prints ^𝑥 codes for monotonic motion -syscon termios ECHOPRT 0b0000010000000000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000010000000000 # termios.c_lflag|=ECHOPRT includes the parity bit -syscon termios ECHOKE 0b0000100000000000 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000100000000000 # termios.c_lflag -syscon termios FLUSHO 0b0001000000000000 8388608 8388608 8388608 8388608 0b0001000000000000 # termios.c_lflag -syscon termios PENDIN 0b0100000000000000 536870912 536870912 536870912 536870912 0b0100000000000000 # termios.c_lflag -syscon termios IEXTEN 0b1000000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b1000000000000000 # termios.c_lflag&=~IEXTEN disables platform input processing magic -syscon termios EXTPROC 65536 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 65536 # termios.c_lflag - -syscon termios IGNBRK 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_iflag it's complicated, uart only? UNIXCONSENSUS -syscon termios BRKINT 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 # termios.c_iflag it's complicated, uart only? UNIXCONSENSUS -syscon termios IGNPAR 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 # termios.c_iflag|=PARMRK passes-through parity bit UNIXCONSENSUS -syscon termios INPCK 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 # termios.c_iflag|=INPCK enables parity checking UNIXCONSENSUS -syscon termios ISTRIP 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 # termios.c_iflag|=ISTRIP automates read(1)&0x7f UNIXCONSENSUS -syscon termios INLCR 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # termios.c_iflag|=INLCR maps \n → \r input UNIXCONSENSUS -syscon termios IGNCR 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # termios.c_iflag|=IGNCR maps \r → ∅ input UNIXCONSENSUS -syscon termios ICRNL 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # termios.c_iflag|=ICRNL maps \r → \n input UNIXCONSENSUS -syscon termios IUCLC 0b0000001000000000 0 0 0b0001000000000000 0b0001000000000000 0b0000001000000000 # termios.c_iflag|=IUCLC maps A-Z → a-z input -syscon termios IXON 0b0000010000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000010000000000 # termios.c_iflag|=IXON enables flow rida -syscon termios IXANY 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 # termios.c_iflag|=IXANY tying will un-stuck teletype UNIXCONSENSUS -syscon termios IXOFF 0b0001000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0001000000000000 # termios.c_iflag|=IXOFF disables annoying display freeze keys -syscon termios IMAXBEL 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 # termios.c_iflag|=IMAXBEL rings when queue full UNIXCONSENSUS -syscon termios IUTF8 0b0100000000000000 0b0100000000000000 0 0 0 0b0100000000000000 # termios.c_iflag|=IUTF8 helps w/ rubout on UTF-8 input - -syscon termios OPOST 0b0000000000000001 0b000000000000000001 0b000000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_oflag&=~OPOST disables output processing magic -syscon termios OLCUC 0b0000000000000010 0b000000000000000000 0 0b0000000000100000 0b0000000000100000 0b0000000000000010 # termios.c_oflag|=OLCUC maps a-z → A-Z output -syscon termios ONLCR 0b0000000000000100 0b000000000000000010 0b000000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000100 # termios.c_oflag|=ONLCR maps \n → \r\n output -syscon termios OCRNL 0b0000000000001000 0b000000000000010000 0b000000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000001000 # termios.c_oflag|=OCRNL maps \r → \n output -syscon termios ONOCR 0b0000000000010000 0b000000000000100000 0b000000000000100000 0b0000000001000000 0b0000000001000000 0b0000000000010000 # termios.c_oflag|=ONOCR maps \r → ∅ output iff column 0 -syscon termios ONLRET 0b0000000000100000 0b000000000001000000 0b000000000001000000 0b0000000010000000 0b0000000010000000 0b0000000000100000 # termios.c_oflag|=ONLRET maps \r → ∅ output -syscon termios OFILL 0b0000000001000000 0b000000000010000000 0 0 0 0b0000000001000000 # termios.c_oflag -syscon termios OFDEL 0b0000000010000000 0b100000000000000000 0 0 0 0b0000000010000000 # termios.c_oflag -syscon termios NLDLY 0b0000000100000000 0b000000001100000000 0b000000001100000000 0 0 0b0000000100000000 # (termios.c_oflag & NLDLY) ∈ {NL0,NL1,NL2,NL3} -syscon termios NL0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # (termios.c_oflag & NLDLY) == NL0 -syscon termios NL1 0b0000000100000000 0b000000000100000000 0b000000000100000000 0 0 0b0000000100000000 # (termios.c_oflag & NLDLY) == NL1 -syscon termios NL2 0 0b000000001000000000 0b000000001000000000 0 0 0 # (termios.c_oflag & NLDLY) == NL2 -syscon termios NL3 0 0b000000001100000000 0b000000001100000000 0 0 0 # (termios.c_oflag & NLDLY) == NL3 -syscon termios CRDLY 0b0000011000000000 0b000011000000000000 0b000011000000000000 0 0 0b0000011000000000 # (termios.c_oflag & CRDLY) ∈ {CR0,CR1,CR2,CR3} -syscon termios CR0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0x0 0x0 0b0000000000000000 # (termios.c_oflag & CRDLY) == CR0 -syscon termios CR1 0b0000001000000000 0b000001000000000000 0b000001000000000000 0x0 0x0 0b0000001000000000 # (termios.c_oflag & CRDLY) == CR1 -syscon termios CR2 0b0000010000000000 0b000010000000000000 0b000010000000000000 0x0 0x0 0b0000010000000000 # (termios.c_oflag & CRDLY) == CR2 -syscon termios CR3 0b0000011000000000 0b000011000000000000 0b000011000000000000 0x0 0x0 0b0000011000000000 # (termios.c_oflag & CRDLY) == CR3 -syscon termios TABDLY 0b0001100000000000 0b000000110000000100 0b000000000000000100 0 0 0b0001100000000000 # (termios.c_oflag & TABDLY) ∈ {TAB0,TAB1,TAB2,TAB3,XTABS} -syscon termios TAB0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # (termios.c_oflag & TABDLY) == TAB0 -syscon termios TAB1 0b0000100000000000 0b000000010000000000 0b000000010000000000 0 0 0b0000100000000000 # (termios.c_oflag & TABDLY) == TAB1 -syscon termios TAB2 0b0001000000000000 0b000000100000000000 0b000000100000000000 0 0 0b0001000000000000 # (termios.c_oflag & TABDLY) == TAB2 -syscon termios TAB3 0b0001100000000000 0b000000000000000100 0b000000000000000100 0 0 0b0001100000000000 # (termios.c_oflag & TABDLY) == TAB3 -syscon termios XTABS 0b0001100000000000 0b000000000000000000 0b000000110000000000 0 0 0b0001100000000000 # (termios.c_oflag & TABDLY) == XTABS -syscon termios BSDLY 0b0010000000000000 0b001000000000000000 0b001000000000000000 0 0 0b0010000000000000 # termios.c_oflag -syscon termios BS0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag -syscon termios BS1 0b0010000000000000 0b001000000000000000 0b001000000000000000 0 0 0b0010000000000000 # termios.c_oflag -syscon termios VTDLY 0b0100000000000000 0b010000000000000000 0b010000000000000000 0 0 0b0100000000000000 # termios.c_oflag -syscon termios VT0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag -syscon termios VT1 0b0100000000000000 0b010000000000000000 0b010000000000000000 0 0 0b0100000000000000 # termios.c_oflag -syscon termios FFDLY 0b1000000000000000 0b000100000000000000 0b000100000000000000 0 0 0b1000000000000000 # termios.c_oflag -syscon termios FF0 0b0000000000000000 0b000000000000000000 0b000000000000000000 0 0 0b0000000000000000 # termios.c_oflag -syscon termios FF1 0b1000000000000000 0b000100000000000000 0b000100000000000000 0 0 0b1000000000000000 # termios.c_oflag - -syscon termios CS6 0b0000000000010000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000000010000 # termios.c_cflag flag for 6-bit characters -syscon termios CS7 0b0000000000100000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000000000100000 # termios.c_cflag flag for 7-bit characters -syscon termios CS8 0b0000000000110000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000000000110000 # termios.c_cflag flag for 8-bit characters -syscon termios CSIZE 0b0000000000110000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000001100000000 0b0000000000110000 # mask for CS𝑥 flags - -syscon termios NCCS 32 32 32 32 20 32 # ARRAYLEN(termios.c_cc); faked xnu/freebsd/openbsd (originally 20) and faked nt -syscon termios VINTR 0 8 8 8 8 0 # termios.c_cc[VINTR]=𝑥 -syscon termios VQUIT 1 9 9 9 9 0 # termios.c_cc[VQUIT]=𝑥 -syscon termios VERASE 2 3 3 3 3 0 # termios.c_cc[VERASE]=𝑥 -syscon termios VKILL 3 5 5 5 5 0 # termios.c_cc[VKILL]=𝑥 -syscon termios VEOF 4 0 0 0 0 0 # termios.c_cc[VEOF]=𝑥 -syscon termios VTIME 5 17 17 17 17 0 # 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 VMIN 6 16 16 16 16 0 # 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 VSWTC 7 0 0 0 0 0 # termios.c_cc[VSWTC]=𝑥 -syscon termios VSTART 8 12 12 12 12 0 # termios.c_cc[VSTART]=𝑥 -syscon termios VSTOP 9 13 13 13 13 0 # termios.c_cc[VSTOP]=𝑥 -syscon termios VSUSP 10 10 10 10 10 0 # 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 1 1 1 0 # termios.c_cc[VEOL]=𝑥 -syscon termios VEOL2 16 2 2 2 2 0 # termios.c_cc[VEOL2]=𝑥 -syscon termios VREPRINT 12 6 6 6 6 0 # termios.c_cc[VREPRINT]=𝑥 -syscon termios VDISCARD 13 15 15 15 15 0 # termios.c_cc[VDISCARD]=𝑥 -syscon termios VWERASE 14 4 4 4 4 0 # termios.c_cc[VWERASE]=𝑥 -syscon termios VLNEXT 15 14 14 14 14 0 # termios.c_cc[VLNEXT]=𝑥 - -syscon termios TIOCSERGETLSR 0x5459 0 0 0 0 0 # -syscon termios TIOCSERGETMULTI 0x545a 0 0 0 0 0 # -syscon termios TIOCSERSETMULTI 0x545b 0 0 0 0 0 # -syscon termios TIOCSER_TEMT 1 0 0 0 0 0 # -syscon termios VERIFY 47 0 0 0 0 0 -syscon termios PARENB 0x0100 0x1000 0x1000 0x1000 0x1000 0 # -syscon termios PARODD 0x0200 0x2000 0x2000 0x2000 0x2000 0 # -syscon termios CIBAUD 0x100f0000 0 0 0 0 0 -syscon termios CLOCAL 0x0800 0x8000 0x8000 0x8000 0x8000 0 # -syscon termios CMSPAR 0x40000000 0 0 0 0 0 -syscon termios BUSY 4 0 0 0 0 0 -syscon termios CANBSIZ 255 0 0 0 0 0 -syscon termios CBAUD 0x100f 0 0 0 0 0 -syscon termios CBAUDEX 0x1000 0 0 0 0 0 -syscon termios CBRK 0 255 255 255 255 0 # -syscon termios CEOL 0 255 255 255 255 0 # - -# Pseudoteletypewriter Control -# -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary -syscon pty TIOCPKT 0x5420 0x80047470 0x80047470 0x80047470 0x80047470 -1 # boop -syscon pty TIOCPKT_DATA 0 0 0 0 0 0 # consensus -syscon pty TIOCPKT_FLUSHREAD 1 1 1 1 1 1 # unix consensus -syscon pty TIOCPKT_FLUSHWRITE 2 2 2 2 2 2 # unix consensus -syscon pty TIOCPKT_STOP 4 4 4 4 4 4 # unix consensus -syscon pty TIOCPKT_START 8 8 8 8 8 8 # unix consensus -syscon pty TIOCPKT_NOSTOP 16 16 16 16 16 16 # unix consensus -syscon pty TIOCPKT_DOSTOP 32 32 32 32 32 32 # unix consensus -syscon pty TIOCPKT_IOCTL 64 64 64 64 64 64 # unix consensus -syscon pty TIOCSPTLCK 0x40045431 0 0 0 0 -1 # boop -syscon pty PTMGET 0 0 0 0x40287401 0x40287401 -1 # for /dev/ptm - -# Modem Control -# -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX Commentary -syscon modem TIOCMGET 0x5415 0x4004746a 0x4004746a 0x4004746a 0x4004746a -1 # get status of modem bits; ioctl(fd, TIOCMGET, int *argp) -syscon modem TIOCMSET 0x5418 0x8004746d 0x8004746d 0x8004746d 0x8004746d -1 # set status of modem bits; ioctl(fd, TIOCMSET, const int *argp) -syscon modem TIOCMBIC 0x5417 0x8004746b 0x8004746b 0x8004746b 0x8004746b -1 # clear indicated modem bits; ioctl(fd, TIOCMBIC, int *argp) -syscon modem TIOCMBIS 0x5416 0x8004746c 0x8004746c 0x8004746c 0x8004746c -1 # set indicated modem bits; ioctl(fd, TIOCMBIS, int *argp) -syscon modem TIOCM_LE 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # consensus -syscon modem TIOCM_DTR 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000010 # consensus -syscon modem TIOCM_RTS 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 0b0000000000000100 # consensus -syscon modem TIOCM_ST 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 0b0000000000001000 # consensus -syscon modem TIOCM_SR 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000010000 # consensus -syscon modem TIOCM_CTS 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 0b0000000000100000 # consensus -syscon modem TIOCM_CAR 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # consensus -syscon modem TIOCM_CD 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 0b0000000001000000 # boop -syscon modem TIOCM_RI 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # boop -syscon modem TIOCM_RNG 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 0b0000000010000000 # boop -syscon modem TIOCM_DSR 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # consensus -syscon modem TIOCM_DCD 0 0 0x40 0 0 -1 # wut -syscon modem TIOCMODG 0 0x40047403 0 0x4004746a 0x4004746a -1 # wut -syscon modem TIOCMODS 0 0x80047404 0 0x8004746d 0x8004746d -1 # wut -syscon modem TIOCMSDTRWAIT 0 0x8004745b 0x8004745b 0 0 -1 # wut - -syscon ioctl FIONBIO 0x5421 0x8004667e 0x8004667e 0x8004667e 0x8004667e 0x8004667e # BSD-Windows consensus; FIONBIO is traditional O_NONBLOCK; see F_SETFL for re-imagined api -syscon ioctl FIOASYNC 0x5452 0x8004667d 0x8004667d 0x8004667d 0x8004667d 0x8004667d # BSD-Windows consensus -syscon ioctl FIONREAD 0x541b 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f # BSD-Windows consensus; bytes waiting in FD's input buffer -#syscon ioctl FIONWRITE 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 0x40046676 0x0 0x0 -1 # [FreeBSD Generalization] capacity of FD's output buffer, e.g. equivalent to TIOCGSERIAL w/ UART -syscon ioctl TIOCINQ 0x541b 0x4004667f 0x4004667f 0x4004667f 0x4004667f 0x4004667f # [Linuxism] same as FIONREAD -#syscon ioctl TIOCOUTQ 0x5411 0x40047473 0x40047473 0x40047473 0x40047473 -1 # bytes queued in TTY's output buffer - -syscon misc FANOTIFY_METADATA_VERSION 3 0 0 0 0 0 -syscon misc FAPPEND 0x0400 8 8 8 8 0 # bsd consensus -syscon misc FASYNC 0x2000 0x40 0x40 0x40 0x40 0 # bsd consensus -syscon misc FFSYNC 0x101000 0x80 0x80 0x80 0x80 0 # bsd consensus -syscon misc FILENAME_MAX 0x1000 0x0400 0x0400 0x0400 0x0400 0 # bsd consensus -syscon misc FIOGETOWN 0x8903 0x4004667b 0x4004667b 0x4004667b 0x4004667b 0 # bsd consensus -syscon misc FIOSETOWN 0x8901 0x8004667c 0x8004667c 0x8004667c 0x8004667c 0 # bsd consensus -syscon misc FMAXEXP 0x80 0 0 0 0 0 -syscon misc FMINEXP -125 0 0 0 0 0 -syscon misc FNDELAY 0x0800 4 4 4 4 0 # bsd consensus -syscon misc FNONBLOCK 0x0800 4 4 4 4 0 # bsd consensus -syscon misc FOPEN_MAX 0x10 20 20 20 20 0 # bsd consensus -syscon misc FORMAT_UNIT 4 0 0 0 0 0 -syscon misc HARDWARE_ERROR 4 0 0 0 0 0 -syscon misc HEAD_OF_QUEUE_TAG 33 0 0 0 0 0 -syscon misc HUPCL 0x0400 0x4000 0x4000 0x4000 0x4000 0 # bsd consensus -syscon misc IGMP_MEMBERSHIP_QUERY 17 0 0 0 0 0 -syscon misc ILLEGAL_REQUEST 5 0 0 0 0 0 -syscon misc INITIATE_RECOVERY 15 0 0 0 0 0 -syscon misc INITIATOR_ERROR 5 0 0 0 0 0 -syscon misc INQUIRY 18 0 0 0 0 0 -syscon misc MAXHOSTNAMELEN 0x40 0x0100 0x0100 0x0100 0x0100 0 # bsd consensus -syscon misc MAXPATHLEN 255 255 255 255 255 255 # forced consensus -syscon misc MAXSYMLINKS 20 0x20 0x20 0x20 0x20 0 # bsd consensus -syscon misc MESSAGE_REJECT 7 0 0 0 0 0 -syscon misc MISCOMPARE 14 0 0 0 0 0 -syscon misc MOVE_MEDIUM 165 0 0 0 0 0 -syscon misc MTCOMPRESSION 0x20 0 0 0 0 0 -syscon misc MTFSFM 11 0 0 0 0 0 -syscon misc MTLOCK 28 0 0 0 0 0 -syscon misc MTMKPART 34 0 0 0 0 0 -syscon misc MTRAS1 14 0 0 0 0 0 -syscon misc MTRAS3 0x10 0 0 0 0 0 -syscon misc MTSETBLK 20 0 0 0 0 0 -syscon misc MTSETDENSITY 21 0 0 0 0 0 -syscon misc MTSETDRVBUFFER 24 0 0 0 0 0 -syscon misc MTSETPART 33 0 0 0 0 0 -syscon misc MTUNLOAD 31 0 0 0 0 0 -syscon misc MTUNLOCK 29 0 0 0 0 0 -syscon misc NCARGS 0x020000 0x040000 0x040000 0x040000 0x040000 0 # bsd consensus -syscon misc NGREG 23 0 0 0 0 0 -syscon misc NOGROUP -1 0xffff 0xffff 0xffff 0xffff 0 # bsd consensus -syscon misc ORDERED_QUEUE_TAG 34 0 0 0 0 0 -syscon misc ORIG_RAX 15 0 0 0 0 0 -syscon misc PIPE_BUF 0x1000 0x0200 0x0200 0x0200 0x0200 0 # bsd consensus -syscon misc PRE_FETCH 52 0 0 0 0 0 -syscon misc QUEUE_FULL 20 0 0 0 0 0 -syscon misc REASSIGN_BLOCKS 7 0 0 0 0 0 -syscon misc RECEIVE_DIAGNOSTIC 28 0 0 0 0 0 -syscon misc RECOVERED_ERROR 1 0 0 0 0 0 -syscon misc RECOVER_BUFFERED_DATA 20 0 0 0 0 0 -syscon misc RELEASE_RECOVERY 0x10 0 0 0 0 0 -syscon misc REQUEST_SENSE 3 0 0 0 0 0 -syscon misc RESERVATION_CONFLICT 12 0 0 0 0 0 -syscon misc RESERVE 22 0 0 0 0 0 -syscon misc RESERVE_10 86 0 0 0 0 0 -syscon misc RESTORE_POINTERS 3 0 0 0 0 0 -syscon misc REZERO_UNIT 1 0 0 0 0 0 -syscon misc RE_DUP_MAX 0x7fff 255 255 255 255 0 # bsd consensus -syscon misc RTCF_DOREDIRECT 0x01000000 0 0 0 0 0 -syscon misc SAVE_POINTERS 2 0 0 0 0 0 -syscon misc SEM_VALUE_MAX 0x7fffffff 0x7fff 0x7fffffff 0xffffffff 0xffffffff 0 -syscon misc SEM_INFO 19 0 11 0 0 0 -syscon misc SEM_STAT 18 0 10 0 0 0 - -syscon misc SHMLBA 0 0x1000 0x1000 0x1000 0x1000 0 # bsd consensus -syscon misc SIMPLE_QUEUE_TAG 0x20 0 0 0 0 0 -syscon misc SPACE 17 0 0 0 0 0 -syscon misc START_STOP 27 0 0 0 0 0 -syscon misc STATUS_MASK 62 0 0 0 0 0 -syscon misc SWAP_FLAG_DISCARD 0x010000 0 0 0 0 0 -syscon misc SYNCHRONIZE_CACHE 53 0 0 0 0 0 -syscon misc UMOUNT_NOFOLLOW 8 0 0 0 0 0 -syscon misc UNIT_ATTENTION 6 0 0 0 0 0 -syscon misc UPDATE_BLOCK 61 0 0 0 0 0 -syscon misc UT_HOSTSIZE 0x0100 0x10 0 0x0100 0x0100 0 -syscon misc UT_LINESIZE 0x20 8 0 8 8 0 -syscon misc UT_NAMESIZE 0x20 8 0 0x20 0x20 0 - -syscon misc WEOF 0xffffffff -1 -1 -1 -1 -1 # bsd consensus (win fake) -syscon misc _LINUX_QUOTA_VERSION 2 0 0 0 0 0 -syscon misc _SEM_SEMUN_UNDEFINED 1 0 0 0 0 0 -syscon misc D_FMT 0x020029 2 2 1 1 0 -syscon misc D_T_FMT 0x020028 1 1 0 0 0 - -syscon misc LOGIN_PROCESS 6 6 6 0 0 0 -syscon misc LOGIN_NAME_MAX 0x0100 0 0 0x20 0x20 0 - -syscon misc T_FMT 0x02002a 3 3 2 2 0 -syscon misc T_FMT_AMPM 0x02002b 4 4 3 3 0 - -syscon misc UL_GETFSIZE 1 1 1 0 0 0 -syscon misc UL_SETFSIZE 2 2 2 0 0 0 - -syscon misc XATTR_CREATE 1 2 0 0 0 0 -syscon misc XATTR_REPLACE 2 4 0 0 0 0 - -syscon misc ACCOUNTING 9 9 0 0 0 0 -syscon misc AHZ 100 0x40 0 0x40 0x40 0 -syscon misc ALT_DIGITS 0x02002f 49 49 0 0 0 -syscon misc AM_STR 0x020026 5 5 4 4 0 -syscon misc B460800 0x1004 0 0x070800 0 0 0 -syscon misc B921600 0x1007 0 0x0e1000 0 0 0 -syscon misc BOOT_TIME 2 2 1 0 0 0 -syscon misc CHARCLASS_NAME_MAX 0x0800 14 14 0 0 0 -syscon misc CLOCKS_PER_SEC 1000000 1000000 0x80 100 100 10000000 -syscon misc CODESET 14 0 0 51 51 0 -syscon misc COLL_WEIGHTS_MAX 255 2 10 2 2 0 -syscon misc CPU_SETSIZE 0x0400 0 0x0100 0 0 0 -syscon misc CRNCYSTR 0x04000f 56 56 50 50 0 -syscon misc CRTSCTS 0x80000000 0x030000 0x030000 0x010000 0x010000 0 -syscon misc CSTATUS 0 20 20 255 255 0 -syscon misc DEAD_PROCESS 8 8 7 0 0 0 -syscon misc FNM_NOSYS -1 -1 -1 2 2 0 -syscon misc INIT_PROCESS 5 5 5 0 0 0 -syscon misc MINSIGSTKSZ 0x0800 0x8000 0x0800 0x3000 0x2000 0 -syscon misc MQ_PRIO_MAX 0x8000 0 0x40 0 0 0 -syscon misc MTERASE 13 0 12 9 9 0 -syscon misc MTLOAD 30 0 19 0 0 0 -syscon misc MTRETEN 9 0 0 8 8 0 -syscon misc NEW_TIME 3 4 3 0 0 0 -syscon misc NFDBITS 0x40 0x20 0x40 0x20 0x20 0 -syscon misc NGROUPS 0x010000 0x10 0x0400 0x10 0x10 0 -syscon misc NGROUPS_MAX 0x010000 0x10 0x03ff 0x10 0x10 0 -syscon misc NOEXPR 0x050001 53 53 49 49 0 -syscon misc NOFILE 0x0100 0x0100 0x40 0x40 0x40 0 -syscon misc NOSTR 0x050003 55 55 48 48 0 -syscon misc OLD_TIME 4 3 2 0 0 0 -syscon misc PM_STR 0x020027 6 6 5 5 0 -syscon misc RADIXCHAR 0x010000 50 50 44 44 0 -syscon misc RUN_LVL 1 1 0 0 0 0 -syscon misc STA_RONLY 0xff00 0 0xff00 0 0 0 -syscon misc SYMLOOP_MAX 0 0 0 0x20 0x20 0 -syscon misc THOUSEP 0x010001 51 51 45 45 0 -syscon misc TIMER_ABSTIME 1 0 1 1 1 0 -syscon misc TIME_UTC 1 0 1 0 0 0 -syscon misc TMP_MAX 0x03a2f8 0x1269ae40 0x1269ae40 0x7fffffff 0x7fffffff 0 -syscon misc TSS_DTOR_ITERATIONS 0 0 4 0 0 0 -syscon misc TTY_NAME_MAX 0x20 0 0 260 260 0 -syscon misc UIO_MAXIOV 0x0400 0 0 0x0400 0x0400 0 -syscon misc USER_PROCESS 7 7 4 0 0 0 -syscon misc YESEXPR 0x050000 52 52 47 47 0 -syscon misc YESSTR 0x050002 54 54 46 46 0 - # System Call Numbers. # -# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD XENIX +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology syscon nr __NR_exit 0x003c 0x2000001 0x0001 0x0001 0x001 0xfff syscon nr __NR_exit_group 0x00e7 0x2000001 0x0001 0x0001 0x001 0xfff syscon nr __NR_read 0x0000 0x2000003 0x0003 0x0003 0x003 0xfff @@ -3495,4 +2668,809 @@ syscon nr __NR_shared_region_map_and_slide_np 0xfff 0x20001b6 0xfff 0xfff syscon nr __NR_guarded_open_dprotected_np 0xfff 0x20001e4 0xfff 0xfff 0xfff 0xfff syscon nr __NR_stack_snapshot_with_config 0xfff 0x20001eb 0xfff 0xfff 0xfff 0xfff +# unilateral undocumented errnos +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon junkerr ECHRNG 44 0 0 0 0 0 +syscon junkerr EL2NSYNC 45 0 0 0 0 0 +syscon junkerr EL3HLT 46 0 0 0 0 0 +syscon junkerr EL3RST 47 0 0 0 0 0 +syscon junkerr ELNRNG 48 0 0 0 0 0 +syscon junkerr EUNATCH 49 0 0 0 0 0 +syscon junkerr ENOCSI 50 0 0 0 0 0 +syscon junkerr EL2HLT 51 0 0 0 0 0 +syscon junkerr EBADE 52 0 0 0 0 0 +syscon junkerr EBADR 53 0 0 0 0 0 +syscon junkerr EXFULL 54 0 0 0 0 0 +syscon junkerr ENOANO 55 0 0 0 0 0 +syscon junkerr EBADRQC 56 0 0 0 0 0 +syscon junkerr EBADSLT 57 0 0 0 0 0 +syscon junkerr ENOPKG 65 0 0 0 0 0 +syscon junkerr EADV 68 0 0 0 0 0 +syscon junkerr ESRMNT 69 0 0 0 0 0 +syscon junkerr ECOMM 70 0 0 0 0 0 +syscon junkerr EDOTDOT 73 0 0 0 0 0 +syscon junkerr ENOTUNIQ 76 0 0 0 0 0 +syscon junkerr EBADFD 77 9 0 0 0 0 +syscon junkerr EREMCHG 78 0 0 0 0 0 +syscon junkerr ELIBACC 79 0 0 0 0 0 +syscon junkerr ELIBBAD 80 0 0 0 0 0 +syscon junkerr ELIBSCN 81 0 0 0 0 0 +syscon junkerr ELIBMAX 82 0 0 0 0 0 +syscon junkerr ELIBEXEC 83 0 0 0 0 0 +syscon junkerr ESTRPIPE 86 0 0 0 0 0 +syscon junkerr EUCLEAN 117 0 0 0 0 0 +syscon junkerr ENOTNAM 118 0 0 0 0 0 +syscon junkerr ENAVAIL 119 0 0 0 0 0 +syscon junkerr EISNAM 120 0 0 0 0 0 +syscon junkerr EREMOTEIO 121 0 0 0 0 0 +syscon junkerr ENOKEY 126 0 0 0 0 0 +syscon junkerr EKEYEXPIRED 127 0 0 0 0 0 +syscon junkerr EKEYREVOKED 128 0 0 0 0 0 +syscon junkerr EKEYREJECTED 129 0 0 0 0 0 +syscon junkerr ERFKILL 132 0 0 0 0 0 +syscon junkerr EHWPOISON 133 0 0 0 0 0 + +# arpanet fork combating human-induced exhaustion of our ipv4 address space +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon ipv6 IPV6_PMTUDISC_DONT 0 0 0 0 0 0 # consensus +syscon ipv6 IPV6_RTHDR_LOOSE 0 0 0 0 0 0 # consensus +syscon ipv6 IPV6_RTHDR_TYPE_0 0 0 0 0 0 0 # consensus +syscon ipv6 IPV6_CHECKSUM 7 26 26 26 26 26 # bsd consensus +syscon ipv6 IPV6_JOIN_GROUP 20 12 12 12 12 12 # bsd consensus +syscon ipv6 IPV6_LEAVE_GROUP 21 13 13 13 13 13 # bsd consensus +syscon ipv6 IPV6_MULTICAST_HOPS 18 10 10 10 10 10 # bsd consensus +syscon ipv6 IPV6_MULTICAST_IF 17 9 9 9 9 9 # bsd consensus +syscon ipv6 IPV6_MULTICAST_LOOP 19 11 11 11 11 11 # bsd consensus +syscon ipv6 IPV6_UNICAST_HOPS 0x10 4 4 4 4 4 # bsd consensus +syscon ipv6 IPV6_V6ONLY 26 27 27 27 27 27 # bsd consensus +syscon ipv6 IPV6_RECVTCLASS 66 35 57 57 57 40 +syscon ipv6 IPV6_TCLASS 67 36 61 61 61 39 +syscon ipv6 IPV6_DONTFRAG 62 0 62 62 62 14 +syscon ipv6 IPV6_HOPLIMIT 52 0 47 47 47 21 +syscon ipv6 IPV6_HOPOPTS 54 0 49 49 49 1 +syscon ipv6 IPV6_PKTINFO 50 0 46 46 46 19 +syscon ipv6 IPV6_RECVRTHDR 56 0 38 38 38 38 +syscon ipv6 IPV6_RTHDR 57 0 51 51 51 0x20 +syscon ipv6 IPV6_DSTOPTS 59 0 50 50 50 0 +syscon ipv6 IPV6_IPSEC_POLICY 34 28 28 0 0 0 +syscon ipv6 IPV6_NEXTHOP 9 0 48 48 48 0 +syscon ipv6 IPV6_PATHMTU 61 0 44 44 44 0 +syscon ipv6 IPV6_RECVDSTOPTS 58 0 40 40 40 0 +syscon ipv6 IPV6_RECVHOPLIMIT 51 0 37 37 37 0 +syscon ipv6 IPV6_RECVHOPOPTS 53 0 39 39 39 0 +syscon ipv6 IPV6_RECVPATHMTU 60 0 43 43 43 0 +syscon ipv6 IPV6_RECVPKTINFO 49 0 36 36 36 0 +syscon ipv6 IPV6_RTHDRDSTOPTS 55 0 35 35 35 0 +syscon ipv6 IPV6_RTHDR_STRICT 1 1 1 0 0 0 +syscon ipv6 IPV6_ADD_MEMBERSHIP 20 0 0 0 0 12 # bsd consensus +syscon ipv6 IPV6_DROP_MEMBERSHIP 21 0 0 0 0 13 # bsd consensus +syscon ipv6 IPV6_HDRINCL 36 0 0 0 0 2 # bsd consensus +syscon ipv6 IPV6_MTU 24 0 0 0 0 72 # bsd consensus +syscon ipv6 IPV6_MTU_DISCOVER 23 0 0 0 0 71 # bsd consensus +syscon ipv6 IPV6_RECVERR 25 0 0 0 0 75 # bsd consensus +syscon ipv6 IPV6_2292DSTOPTS 4 23 0 0 0 0 +syscon ipv6 IPV6_2292HOPLIMIT 8 20 0 0 0 0 +syscon ipv6 IPV6_2292HOPOPTS 3 22 0 0 0 0 +syscon ipv6 IPV6_2292PKTINFO 2 19 0 0 0 0 +syscon ipv6 IPV6_2292PKTOPTIONS 6 25 0 0 0 0 +syscon ipv6 IPV6_2292RTHDR 5 24 0 0 0 0 +syscon ipv6 IPV6_AUTOFLOWLABEL 0 0 59 59 59 0 +syscon ipv6 IPV6_ADDRFORM 1 0 0 0 0 0 +syscon ipv6 IPV6_AUTHHDR 10 0 0 0 0 0 +syscon ipv6 IPV6_JOIN_ANYCAST 27 0 0 0 0 0 +syscon ipv6 IPV6_LEAVE_ANYCAST 28 0 0 0 0 0 +syscon ipv6 IPV6_PMTUDISC_DO 2 0 0 0 0 0 +syscon ipv6 IPV6_PMTUDISC_INTERFACE 4 0 0 0 0 0 +syscon ipv6 IPV6_PMTUDISC_OMIT 5 0 0 0 0 0 +syscon ipv6 IPV6_PMTUDISC_PROBE 3 0 0 0 0 0 +syscon ipv6 IPV6_PMTUDISC_WANT 1 0 0 0 0 0 +syscon ipv6 IPV6_ROUTER_ALERT 22 0 0 0 0 0 +syscon ipv6 IPV6_RXDSTOPTS 59 0 0 0 0 0 +syscon ipv6 IPV6_RXHOPOPTS 54 0 0 0 0 0 +syscon ipv6 IPV6_XFRM_POLICY 35 0 0 0 0 0 +syscon ipv6 IPV6_MINHOPCOUNT 0 0 0 65 65 0 +syscon ipv6 IPV6_ORIGDSTADDR 0 0 72 0 0 0 +syscon ipv6 IPV6_RECVORIGDSTADDR 0 0 72 0 0 0 +syscon ipv6 INET6_ADDRSTRLEN 46 46 46 46 46 65 # unix consensus +syscon icmp6 ICMP6_DST_UNREACH_NOROUTE 0 0 0 0 0 0 # consensus +syscon icmp6 ICMP6_PARAMPROB_HEADER 0 0 0 0 0 0 # consensus +syscon icmp6 ICMP6_TIME_EXCEED_TRANSIT 0 0 0 0 0 0 # consensus +syscon icmp6 ICMP6_DST_UNREACH_ADMIN 1 1 1 1 1 1 # consensus +syscon icmp6 ICMP6_PARAMPROB_NEXTHEADER 1 1 1 1 1 1 # consensus +syscon icmp6 ICMP6_TIME_EXCEED_REASSEMBLY 1 1 1 1 1 1 # consensus +syscon icmp6 ICMP6_DST_UNREACH 1 1 1 1 1 0 # unix consensus +syscon icmp6 ICMP6_FILTER 1 18 18 18 18 0 # bsd consensus +syscon icmp6 ICMP6_DST_UNREACH_BEYONDSCOPE 2 2 2 2 2 2 # consensus +syscon icmp6 ICMP6_PARAMPROB_OPTION 2 2 2 2 2 2 # consensus +syscon icmp6 ICMP6_PACKET_TOO_BIG 2 2 2 2 2 0 # unix consensus +syscon icmp6 ICMP6_DST_UNREACH_ADDR 3 3 3 3 3 3 # consensus +syscon icmp6 ICMP6_TIME_EXCEEDED 3 3 3 3 3 0 # unix consensus +syscon icmp6 ICMP6_DST_UNREACH_NOPORT 4 4 4 4 4 4 # consensus +syscon icmp6 ICMP6_PARAM_PROB 4 4 4 4 4 0 # unix consensus +syscon icmp6 ICMP6_RR_FLAGS_PREVDONE 8 8 8 8 8 0 # unix consensus +syscon icmp6 ICMP6_RR_FLAGS_SPECSITE 0x10 0x10 0x10 0x10 0x10 0 # unix consensus +syscon icmp6 ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 0x40 0x40 0x40 0x40 0 # bsd consensus +syscon icmp6 ICMP6_RR_FLAGS_FORCEAPPLY 0x20 0x20 0x20 0x20 0x20 0 # unix consensus +syscon icmp6 ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 0x80 0x80 0x80 0x80 0 # bsd consensus +syscon icmp6 ICMP6_RR_FLAGS_REQRESULT 0x40 0x40 0x40 0x40 0x40 0 # unix consensus +syscon icmp6 ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 0x40 0x40 0x40 0x40 0 # unix consensus +syscon icmp6 ICMP6_INFOMSG_MASK 0x80 0x80 0x80 0x80 0x80 0x80 # consensus +syscon icmp6 ICMP6_ECHO_REQUEST 0x80 0x80 0x80 0x80 0x80 0 # unix consensus +syscon icmp6 ICMP6_RR_FLAGS_TEST 0x80 0x80 0x80 0x80 0x80 0 # unix consensus +syscon icmp6 ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 0x80 0x80 0x80 0x80 0 # unix consensus +syscon icmp6 ICMP6_ECHO_REPLY 129 129 129 129 129 0 # unix consensus +syscon icmp6 ICMP6_ROUTER_RENUMBERING 138 138 138 138 138 0 # unix consensus +syscon icmp6 ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus +syscon icmp6 ICMP6_RR_RESULT_FLAGS_OOB 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus + +# java's computational model +# solves the sharing problem by defining everything as shared +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon misc PTHREAD_MUTEX_STALLED 0 0 0 0 0 0 # consensus +syscon misc PTHREAD_PRIO_NONE 0 0 0 0 0 0 # consensus +syscon misc PTHREAD_PRIO_INHERIT 0 1 1 1 1 0 # bsd consensus +syscon misc PTHREAD_PRIO_PROTECT 0 2 2 2 2 0 # bsd consensus +syscon misc PTHREAD_DESTRUCTOR_ITERATIONS 4 4 4 4 4 0 # unix consensus +syscon misc PTHREAD_PROCESS_SHARED 1 1 1 1 1 0 # unix consensus +syscon misc PTHREAD_CREATE_DETACHED 1 2 1 1 1 0 +syscon misc PTHREAD_KEYS_MAX 0x0400 0x0200 0x0100 0x0100 0x0100 0 +syscon misc PTHREAD_STACK_MIN 0x4000 0x2000 0x0800 0x1000 0x1000 0 +syscon misc PTHREAD_BARRIER_SERIAL_THREAD -1 0 -1 -1 -1 0 +syscon misc PTHREAD_CANCEL_ASYNCHRONOUS 1 0 2 2 2 0 +syscon misc PTHREAD_CANCEL_DISABLE 1 0 1 1 1 0 +syscon misc PTHREAD_INHERIT_SCHED 0 1 4 4 4 0 +syscon misc PTHREAD_SCOPE_SYSTEM 0 1 2 2 2 0 +syscon misc PTHREAD_EXPLICIT_SCHED 1 2 0 0 0 0 +syscon misc PTHREAD_MUTEX_DEFAULT 0 0 1 4 4 0 +syscon misc PTHREAD_MUTEX_ERRORCHECK 0 1 0 1 1 0 +syscon misc PTHREAD_MUTEX_RECURSIVE 0 2 0 2 2 0 +syscon misc PTHREAD_SCOPE_PROCESS 1 2 0 0 0 0 +syscon misc PTHREAD_CANCEL_DEFERRED 0 2 0 0 0 0 +syscon misc PTHREAD_CANCEL_ENABLE 0 1 0 0 0 0 +syscon misc PTHREAD_CREATE_JOINABLE 0 1 0 0 0 0 +syscon misc PTHREAD_MUTEX_NORMAL 0 0 0 3 3 0 +syscon misc PTHREAD_MUTEX_ROBUST 0 0 1 0 0 0 +syscon misc PTHREAD_PROCESS_PRIVATE 0 2 0 0 0 0 + +syscon fan FAN_CLASS_NOTIF 0 0 0 0 0 0 # consensus +syscon fan FAN_ACCESS 1 0 0 0 0 0 +syscon fan FAN_ACCESS_PERM 0x020000 0 0 0 0 0 +syscon fan FAN_ALLOW 1 0 0 0 0 0 +syscon fan FAN_ALL_CLASS_BITS 12 0 0 0 0 0 +syscon fan FAN_ALL_EVENTS 59 0 0 0 0 0 +syscon fan FAN_ALL_INIT_FLAGS 63 0 0 0 0 0 +syscon fan FAN_ALL_MARK_FLAGS 255 0 0 0 0 0 +syscon fan FAN_ALL_OUTGOING_EVENTS 0x03403b 0 0 0 0 0 +syscon fan FAN_ALL_PERM_EVENTS 0x030000 0 0 0 0 0 +syscon fan FAN_CLASS_CONTENT 4 0 0 0 0 0 +syscon fan FAN_CLASS_PRE_CONTENT 8 0 0 0 0 0 +syscon fan FAN_CLOEXEC 1 0 0 0 0 0 +syscon fan FAN_CLOSE 24 0 0 0 0 0 +syscon fan FAN_CLOSE_NOWRITE 0x10 0 0 0 0 0 +syscon fan FAN_CLOSE_WRITE 8 0 0 0 0 0 +syscon fan FAN_DENY 2 0 0 0 0 0 +syscon fan FAN_EVENT_METADATA_LEN 24 0 0 0 0 0 +syscon fan FAN_EVENT_ON_CHILD 0x08000000 0 0 0 0 0 +syscon fan FAN_MARK_ADD 1 0 0 0 0 0 +syscon fan FAN_MARK_DONT_FOLLOW 4 0 0 0 0 0 +syscon fan FAN_MARK_FLUSH 0x80 0 0 0 0 0 +syscon fan FAN_MARK_IGNORED_MASK 0x20 0 0 0 0 0 +syscon fan FAN_MARK_IGNORED_SURV_MODIFY 0x40 0 0 0 0 0 +syscon fan FAN_MARK_MOUNT 0x10 0 0 0 0 0 +syscon fan FAN_MARK_ONLYDIR 8 0 0 0 0 0 +syscon fan FAN_MARK_REMOVE 2 0 0 0 0 0 +syscon fan FAN_MODIFY 2 0 0 0 0 0 +syscon fan FAN_NOFD -1 0 0 0 0 0 +syscon fan FAN_NONBLOCK 2 0 0 0 0 0 +syscon fan FAN_ONDIR 0x40000000 0 0 0 0 0 +syscon fan FAN_OPEN 0x20 0 0 0 0 0 +syscon fan FAN_OPEN_PERM 0x010000 0 0 0 0 0 +syscon fan FAN_Q_OVERFLOW 0x4000 0 0 0 0 0 +syscon fan FAN_UNLIMITED_MARKS 0x20 0 0 0 0 0 +syscon fan FAN_UNLIMITED_QUEUE 0x10 0 0 0 0 0 + +syscon misc FIFOTYPE 54 54 54 54 54 0 # unix consensus +syscon misc GRPQUOTA 1 1 1 1 1 0 # unix consensus +syscon misc IF_NAMESIZE 0x10 0x10 0x10 0x10 0x10 0 # unix consensus +syscon misc INTERMEDIATE_C_GOOD 10 0 0 0 0 0 +syscon misc INTERMEDIATE_GOOD 8 0 0 0 0 0 + +syscon misc IOV_MAX 0x0400 0x0400 0x0400 0x0400 0x0400 16 # unix consensus & MSG_MAXIOVLEN +syscon misc LINE_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus +syscon misc LINKED_CMD_COMPLETE 10 0 0 0 0 0 +syscon misc LINKED_FLG_CMD_COMPLETE 11 0 0 0 0 0 + +syscon misc LNKTYPE 49 49 49 49 49 0 # unix consensus +syscon misc MAXNAMLEN 255 255 255 255 255 0 # unix consensus +syscon misc MAXQUOTAS 2 2 2 2 2 0 # unix consensus +syscon misc MEDIUM_ERROR 3 0 0 0 0 0 +syscon misc MEDIUM_SCAN 56 0 0 0 0 0 + +syscon misc NBBY 8 8 8 8 8 0 # unix consensus +syscon misc NR_DQHASH 43 0 0 0 0 0 +syscon misc NR_DQUOTS 0x0100 0 0 0 0 0 + +syscon misc PERSISTENT_RESERVE_IN 94 0 0 0 0 0 +syscon misc PERSISTENT_RESERVE_OUT 95 0 0 0 0 0 + +syscon misc PRELIM 1 1 1 1 1 0 # unix consensus +syscon misc REGTYPE 48 48 48 48 48 0 # unix consensus +syscon misc RES_PRF_CLASS 4 4 4 4 4 0 # unix consensus +syscon misc RHF_GUARANTEE_START_INIT 0x80 0 0 0 0 0 +syscon misc RHF_NO_LIBRARY_REPLACEMENT 4 0 0 0 0 0 + +syscon misc RRQ 1 1 1 1 1 0 # unix consensus +syscon misc RTF_NOFORWARD 0x1000 0 0 0 0 0 +syscon misc RTF_NOPMTUDISC 0x4000 0 0 0 0 0 + +syscon misc SARMAG 8 8 8 8 8 0 # unix consensus +syscon misc SEGSIZE 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus +syscon misc SEND_DIAGNOSTIC 29 0 0 0 0 0 +syscon misc SEND_VOLUME_TAG 182 0 0 0 0 0 + +syscon misc SET_LIMITS 51 0 0 0 0 0 +syscon misc SET_WINDOW 36 0 0 0 0 0 + +syscon misc SFD_CLOEXEC 0x080000 0 0 0 0 0 +syscon misc SFD_NONBLOCK 0x0800 0 0 0 0 0 + +syscon misc SOMAXCONN 0x80 0x80 0x80 0x80 0x80 0x7fffffff # unix consensus +syscon misc SUBCMDMASK 255 255 255 255 255 0 # unix consensus +syscon misc SUBCMDSHIFT 8 8 8 8 8 0 # unix consensus +syscon misc SYMTYPE 50 50 50 50 50 0 # unix consensus +syscon misc TGEXEC 8 8 8 8 8 0 # unix consensus +syscon misc TGREAD 0x20 0x20 0x20 0x20 0x20 0 # unix consensus +syscon misc TGWRITE 0x10 0x10 0x10 0x10 0x10 0 # unix consensus +syscon misc TMAGLEN 6 6 6 6 6 0 # unix consensus +syscon misc TOEXEC 1 1 1 1 1 0 # unix consensus +syscon misc TOREAD 4 4 4 4 4 0 # unix consensus +syscon misc TOWRITE 2 2 2 2 2 0 # unix consensus +syscon misc TRANSIENT 4 4 4 4 4 0 # unix consensus +syscon misc TRY_AGAIN 2 2 2 2 2 0x2afa # unix consensus +syscon misc TSGID 0x0400 0x0400 0x0400 0x0400 0x0400 0 # unix consensus +syscon misc TSUID 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus +syscon misc TSVTX 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus +syscon misc TUEXEC 0x40 0x40 0x40 0x40 0x40 0 # unix consensus +syscon misc TUREAD 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus +syscon misc TUWRITE 0x80 0x80 0x80 0x80 0x80 0 # unix consensus +syscon misc TVERSLEN 2 2 2 2 2 0 # unix consensus +syscon misc WORD_BIT 0x20 0x20 0x20 0x20 0x20 0 # unix consensus +syscon misc WRQ 2 2 2 2 2 0 # unix consensus +syscon misc SIGEV_THREAD 2 3 2 0 2 0 +syscon misc SIGEV_SIGNAL 0 1 1 0 1 0 +syscon misc SIGEV_NONE 1 0 0 0 0 0 + +syscon misc BC_BASE_MAX 99 99 99 0x7fffffff 0x7fffffff 0 +syscon misc BC_DIM_MAX 0x0800 0x0800 0x0800 0xffff 0xffff 0 +syscon misc BC_SCALE_MAX 99 99 99 0x7fffffff 0x7fffffff 0 +syscon misc BC_STRING_MAX 0x03e8 0x03e8 0x03e8 0x7fffffff 0x7fffffff 0 + +syscon misc ABORTED_COMMAND 11 0 0 0 0 0 +syscon misc ACORE 0 8 8 8 8 0 # bsd consensus +syscon misc AFORK 0 1 1 1 1 0 # bsd consensus +syscon misc AIO_ALLDONE 2 1 3 0 0 0 +syscon misc AIO_NOTCANCELED 1 4 2 0 0 0 +syscon misc AIO_CANCELED 0 2 1 0 0 0 + +syscon misc ALLOW_MEDIUM_REMOVAL 30 0 0 0 0 0 +syscon misc ASU 0 2 2 2 2 0 # bsd consensus +syscon misc ATF_NETMASK 0x20 0 0 0 0 0 +syscon misc AXSIG 0 0x10 0x10 0x10 0x10 0 # bsd consensus +syscon misc B1000000 0x1008 0 0 0 0 0 +syscon misc B110 3 110 110 110 110 0 # bsd consensus +syscon misc B115200 0x1002 0x01c200 0x01c200 0x01c200 0x01c200 0 # bsd consensus +syscon misc B1152000 0x1009 0 0 0 0 0 +syscon misc B1200 9 0x04b0 0x04b0 0x04b0 0x04b0 0 # bsd consensus +syscon misc B134 4 134 134 134 134 0 # bsd consensus +syscon misc B150 5 150 150 150 150 0 # bsd consensus +syscon misc B1500000 0x100a 0 0 0 0 0 +syscon misc B1800 10 0x0708 0x0708 0x0708 0x0708 0 # bsd consensus +syscon misc B19200 14 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus +syscon misc B200 6 200 200 200 200 0 # bsd consensus +syscon misc B2000000 0x100b 0 0 0 0 0 +syscon misc B230400 0x1003 0x038400 0x038400 0x038400 0x038400 0 # bsd consensus +syscon misc B2400 11 0x0960 0x0960 0x0960 0x0960 0 # bsd consensus +syscon misc B2500000 0x100c 0 0 0 0 0 +syscon misc B300 7 300 300 300 300 0 # bsd consensus +syscon misc B3000000 0x100d 0 0 0 0 0 +syscon misc B3500000 0x100e 0 0 0 0 0 +syscon misc B38400 15 0x9600 0x9600 0x9600 0x9600 0 # bsd consensus +syscon misc B4000000 0x100f 0 0 0 0 0 +syscon misc B4800 12 0x12c0 0x12c0 0x12c0 0x12c0 0 # bsd consensus +syscon misc B50 1 50 50 50 50 0 # bsd consensus +syscon misc B500000 0x1005 0 0 0 0 0 +syscon misc B57600 0x1001 0xe100 0xe100 0xe100 0xe100 0 # bsd consensus +syscon misc B576000 0x1006 0 0 0 0 0 +syscon misc B600 8 600 600 600 600 0 # bsd consensus +syscon misc B75 2 75 75 75 75 0 # bsd consensus +syscon misc B9600 13 0x2580 0x2580 0x2580 0x2580 0 # bsd consensus +syscon misc BITSPERBYTE 8 0 0 0 0 0 +syscon misc BLANK_CHECK 8 0 0 0 0 0 +syscon misc CHANGE_DEFINITION 0x40 0 0 0 0 0 +syscon misc CHARBITS 8 0 0 0 0 0 +syscon misc CHECK_CONDITION 1 0 0 0 0 0 +syscon misc CONDITION_GOOD 2 0 0 0 0 0 +syscon misc CREAD 0x80 0x0800 0x0800 0x0800 0x0800 0 # bsd consensus +syscon misc CSTOPB 0x40 0x0400 0x0400 0x0400 0x0400 0 # bsd consensus +syscon misc DATA_PROTECT 7 0 0 0 0 0 +syscon misc DELAYTIMER_MAX 0x7fffffff 0 0 0 0 0 +syscon misc DMAXEXP 0x0400 0 0 0 0 0 +syscon misc DMINEXP -1021 0 0 0 0 0 +syscon misc DOUBLEBITS 0x40 0 0 0 0 0 +syscon misc ERA_D_FMT 0x02002e 46 46 0 0 0 +syscon misc ERA_D_T_FMT 0x020030 47 47 0 0 0 +syscon misc ERA_T_FMT 0x020031 48 48 0 0 0 + +syscon misc FANOTIFY_METADATA_VERSION 3 0 0 0 0 0 +syscon misc FAPPEND 0x0400 8 8 8 8 0 # bsd consensus +syscon misc FASYNC 0x2000 0x40 0x40 0x40 0x40 0 # bsd consensus +syscon misc FFSYNC 0x101000 0x80 0x80 0x80 0x80 0 # bsd consensus +syscon misc FILENAME_MAX 0x1000 0x0400 0x0400 0x0400 0x0400 0 # bsd consensus +syscon misc FIOGETOWN 0x8903 0x4004667b 0x4004667b 0x4004667b 0x4004667b 0 # bsd consensus +syscon misc FIOSETOWN 0x8901 0x8004667c 0x8004667c 0x8004667c 0x8004667c 0 # bsd consensus +syscon misc FMAXEXP 0x80 0 0 0 0 0 +syscon misc FMINEXP -125 0 0 0 0 0 +syscon misc FNDELAY 0x0800 4 4 4 4 0 # bsd consensus +syscon misc FNONBLOCK 0x0800 4 4 4 4 0 # bsd consensus +syscon misc FOPEN_MAX 0x10 20 20 20 20 0 # bsd consensus +syscon misc FORMAT_UNIT 4 0 0 0 0 0 +syscon misc HARDWARE_ERROR 4 0 0 0 0 0 +syscon misc HEAD_OF_QUEUE_TAG 33 0 0 0 0 0 +syscon misc HUPCL 0x0400 0x4000 0x4000 0x4000 0x4000 0 # bsd consensus +syscon misc IGMP_MEMBERSHIP_QUERY 17 0 0 0 0 0 +syscon misc ILLEGAL_REQUEST 5 0 0 0 0 0 +syscon misc INITIATE_RECOVERY 15 0 0 0 0 0 +syscon misc INITIATOR_ERROR 5 0 0 0 0 0 +syscon misc INQUIRY 18 0 0 0 0 0 +syscon misc MAXHOSTNAMELEN 0x40 0x0100 0x0100 0x0100 0x0100 0 # bsd consensus +syscon misc MAXPATHLEN 255 255 255 255 255 255 # forced consensus +syscon misc MAXSYMLINKS 20 0x20 0x20 0x20 0x20 0 # bsd consensus +syscon misc MESSAGE_REJECT 7 0 0 0 0 0 +syscon misc MISCOMPARE 14 0 0 0 0 0 +syscon misc MOVE_MEDIUM 165 0 0 0 0 0 +syscon misc MTCOMPRESSION 0x20 0 0 0 0 0 +syscon misc MTFSFM 11 0 0 0 0 0 +syscon misc MTLOCK 28 0 0 0 0 0 +syscon misc MTMKPART 34 0 0 0 0 0 +syscon misc MTRAS1 14 0 0 0 0 0 +syscon misc MTRAS3 0x10 0 0 0 0 0 +syscon misc MTSETBLK 20 0 0 0 0 0 +syscon misc MTSETDENSITY 21 0 0 0 0 0 +syscon misc MTSETDRVBUFFER 24 0 0 0 0 0 +syscon misc MTSETPART 33 0 0 0 0 0 +syscon misc MTUNLOAD 31 0 0 0 0 0 +syscon misc MTUNLOCK 29 0 0 0 0 0 +syscon misc NCARGS 0x020000 0x040000 0x040000 0x040000 0x040000 0 # bsd consensus +syscon misc NGREG 23 0 0 0 0 0 +syscon misc NOGROUP -1 0xffff 0xffff 0xffff 0xffff 0 # bsd consensus +syscon misc ORDERED_QUEUE_TAG 34 0 0 0 0 0 +syscon misc ORIG_RAX 15 0 0 0 0 0 +syscon misc PIPE_BUF 0x1000 0x0200 0x0200 0x0200 0x0200 0 # bsd consensus +syscon misc PRE_FETCH 52 0 0 0 0 0 +syscon misc QUEUE_FULL 20 0 0 0 0 0 +syscon misc REASSIGN_BLOCKS 7 0 0 0 0 0 +syscon misc RECEIVE_DIAGNOSTIC 28 0 0 0 0 0 +syscon misc RECOVERED_ERROR 1 0 0 0 0 0 +syscon misc RECOVER_BUFFERED_DATA 20 0 0 0 0 0 +syscon misc RELEASE_RECOVERY 0x10 0 0 0 0 0 +syscon misc REQUEST_SENSE 3 0 0 0 0 0 +syscon misc RESERVATION_CONFLICT 12 0 0 0 0 0 +syscon misc RESERVE 22 0 0 0 0 0 +syscon misc RESERVE_10 86 0 0 0 0 0 +syscon misc RESTORE_POINTERS 3 0 0 0 0 0 +syscon misc REZERO_UNIT 1 0 0 0 0 0 +syscon misc RE_DUP_MAX 0x7fff 255 255 255 255 0 # bsd consensus +syscon misc RTCF_DOREDIRECT 0x01000000 0 0 0 0 0 +syscon misc SAVE_POINTERS 2 0 0 0 0 0 +syscon misc SEM_VALUE_MAX 0x7fffffff 0x7fff 0x7fffffff 0xffffffff 0xffffffff 0 +syscon misc SEM_INFO 19 0 11 0 0 0 +syscon misc SEM_STAT 18 0 10 0 0 0 + +syscon misc SHMLBA 0 0x1000 0x1000 0x1000 0x1000 0 # bsd consensus +syscon misc SIMPLE_QUEUE_TAG 0x20 0 0 0 0 0 +syscon misc SPACE 17 0 0 0 0 0 +syscon misc START_STOP 27 0 0 0 0 0 +syscon misc STATUS_MASK 62 0 0 0 0 0 +syscon misc SWAP_FLAG_DISCARD 0x010000 0 0 0 0 0 +syscon misc SYNCHRONIZE_CACHE 53 0 0 0 0 0 +syscon misc UMOUNT_NOFOLLOW 8 0 0 0 0 0 +syscon misc UNIT_ATTENTION 6 0 0 0 0 0 +syscon misc UPDATE_BLOCK 61 0 0 0 0 0 +syscon misc UT_HOSTSIZE 0x0100 0x10 0 0x0100 0x0100 0 +syscon misc UT_LINESIZE 0x20 8 0 8 8 0 +syscon misc UT_NAMESIZE 0x20 8 0 0x20 0x20 0 + +syscon misc WEOF 0xffffffff -1 -1 -1 -1 -1 # bsd consensus (win fake) +syscon misc _LINUX_QUOTA_VERSION 2 0 0 0 0 0 +syscon misc _SEM_SEMUN_UNDEFINED 1 0 0 0 0 0 +syscon misc D_FMT 0x020029 2 2 1 1 0 +syscon misc D_T_FMT 0x020028 1 1 0 0 0 + +syscon misc LOGIN_PROCESS 6 6 6 0 0 0 +syscon misc LOGIN_NAME_MAX 0x0100 0 0 0x20 0x20 0 + +syscon misc T_FMT 0x02002a 3 3 2 2 0 +syscon misc T_FMT_AMPM 0x02002b 4 4 3 3 0 + +syscon misc UL_GETFSIZE 1 1 1 0 0 0 +syscon misc UL_SETFSIZE 2 2 2 0 0 0 + +syscon misc XATTR_CREATE 1 2 0 0 0 0 +syscon misc XATTR_REPLACE 2 4 0 0 0 0 + +syscon misc ACCOUNTING 9 9 0 0 0 0 +syscon misc AHZ 100 0x40 0 0x40 0x40 0 +syscon misc ALT_DIGITS 0x02002f 49 49 0 0 0 +syscon misc AM_STR 0x020026 5 5 4 4 0 +syscon misc B460800 0x1004 0 0x070800 0 0 0 +syscon misc B921600 0x1007 0 0x0e1000 0 0 0 +syscon misc BOOT_TIME 2 2 1 0 0 0 +syscon misc CHARCLASS_NAME_MAX 0x0800 14 14 0 0 0 +syscon misc CLOCKS_PER_SEC 1000000 1000000 0x80 100 100 10000000 +syscon misc CODESET 14 0 0 51 51 0 +syscon misc COLL_WEIGHTS_MAX 255 2 10 2 2 0 +syscon misc CPU_SETSIZE 0x0400 0 0x0100 0 0 0 +syscon misc CRNCYSTR 0x04000f 56 56 50 50 0 +syscon misc CRTSCTS 0x80000000 0x030000 0x030000 0x010000 0x010000 0 +syscon misc CSTATUS 0 20 20 255 255 0 +syscon misc DEAD_PROCESS 8 8 7 0 0 0 +syscon misc FNM_NOSYS -1 -1 -1 2 2 0 +syscon misc INIT_PROCESS 5 5 5 0 0 0 +syscon misc MINSIGSTKSZ 0x0800 0x8000 0x0800 0x3000 0x2000 0 +syscon misc MQ_PRIO_MAX 0x8000 0 0x40 0 0 0 +syscon misc MTERASE 13 0 12 9 9 0 +syscon misc MTLOAD 30 0 19 0 0 0 +syscon misc MTRETEN 9 0 0 8 8 0 +syscon misc NEW_TIME 3 4 3 0 0 0 +syscon misc NFDBITS 0x40 0x20 0x40 0x20 0x20 0 +syscon misc NGROUPS 0x010000 0x10 0x0400 0x10 0x10 0 +syscon misc NGROUPS_MAX 0x010000 0x10 0x03ff 0x10 0x10 0 +syscon misc NOEXPR 0x050001 53 53 49 49 0 +syscon misc NOFILE 0x0100 0x0100 0x40 0x40 0x40 0 +syscon misc NOSTR 0x050003 55 55 48 48 0 +syscon misc OLD_TIME 4 3 2 0 0 0 +syscon misc PM_STR 0x020027 6 6 5 5 0 +syscon misc RADIXCHAR 0x010000 50 50 44 44 0 +syscon misc RUN_LVL 1 1 0 0 0 0 +syscon misc STA_RONLY 0xff00 0 0xff00 0 0 0 +syscon misc SYMLOOP_MAX 0 0 0 0x20 0x20 0 +syscon misc THOUSEP 0x010001 51 51 45 45 0 +syscon misc TIMER_ABSTIME 1 0 1 1 1 0 +syscon misc TIME_UTC 1 0 1 0 0 0 +syscon misc TMP_MAX 0x03a2f8 0x1269ae40 0x1269ae40 0x7fffffff 0x7fffffff 0 +syscon misc TSS_DTOR_ITERATIONS 0 0 4 0 0 0 +syscon misc TTY_NAME_MAX 0x20 0 0 260 260 0 +syscon misc UIO_MAXIOV 0x0400 0 0 0x0400 0x0400 0 +syscon misc USER_PROCESS 7 7 4 0 0 0 +syscon misc YESEXPR 0x050000 52 52 47 47 0 +syscon misc YESSTR 0x050002 54 54 46 46 0 + +syscon in IN_LOOPBACKNET 127 127 127 127 127 0 # unix consensus +syscon in IN_ACCESS 1 0 0 0 0 0 +syscon in IN_ALL_EVENTS 0x0fff 0 0 0 0 0 +syscon in IN_ATTRIB 4 0 0 0 0 0 +syscon in IN_CLOEXEC 0x080000 0 0 0 0 0 +syscon in IN_CLOSE 24 0 0 0 0 0 +syscon in IN_CLOSE_NOWRITE 0x10 0 0 0 0 0 +syscon in IN_CLOSE_WRITE 8 0 0 0 0 0 +syscon in IN_CREATE 0x0100 0 0 0 0 0 +syscon in IN_DELETE 0x0200 0 0 0 0 0 +syscon in IN_DELETE_SELF 0x0400 0 0 0 0 0 +syscon in IN_DONT_FOLLOW 0x02000000 0 0 0 0 0 +syscon in IN_EXCL_UNLINK 0x04000000 0 0 0 0 0 +syscon in IN_IGNORED 0x8000 0 0 0 0 0 +syscon in IN_ISDIR 0x40000000 0 0 0 0 0 +syscon in IN_MASK_ADD 0x20000000 0 0 0 0 0 +syscon in IN_MODIFY 2 0 0 0 0 0 +syscon in IN_MOVE 192 0 0 0 0 0 +syscon in IN_MOVED_FROM 0x40 0 0 0 0 0 +syscon in IN_MOVED_TO 0x80 0 0 0 0 0 +syscon in IN_MOVE_SELF 0x0800 0 0 0 0 0 +syscon in IN_NONBLOCK 0x0800 0 0 0 0 0 +syscon in IN_ONESHOT 0x80000000 0 0 0 0 0 +syscon in IN_ONLYDIR 0x01000000 0 0 0 0 0 +syscon in IN_OPEN 0x20 0 0 0 0 0 +syscon in IN_Q_OVERFLOW 0x4000 0 0 0 0 0 +syscon in IN_UNMOUNT 0x2000 0 0 0 0 0 + +syscon posix _POSIX_ARG_MAX 0x1000 0x1000 0x1000 0x1000 0x1000 0 # unix consensus +syscon posix _POSIX_CHILD_MAX 25 25 25 25 25 0 # unix consensus +syscon posix _POSIX_HOST_NAME_MAX 255 255 255 255 255 0 # unix consensus +syscon posix _POSIX_LINK_MAX 8 8 8 8 8 0 # unix consensus +syscon posix _POSIX_LOGIN_NAME_MAX 9 9 9 9 9 0 # unix consensus +syscon posix _POSIX_MAX_CANON 255 255 255 255 255 0 # unix consensus +syscon posix _POSIX_MAX_INPUT 255 255 255 255 255 0 # unix consensus +syscon posix _POSIX_NAME_MAX 14 14 14 14 14 14 # forced consensus +syscon posix _POSIX_NGROUPS_MAX 8 8 8 8 8 0 # unix consensus +syscon posix _POSIX_OPEN_MAX 20 20 20 20 20 20 # forced consensus +syscon posix _POSIX_PATH_MAX 255 255 255 255 255 255 # forced consensus +syscon posix _POSIX_PIPE_BUF 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus +syscon posix _POSIX_RE_DUP_MAX 255 255 255 255 255 0 # unix consensus +syscon posix _POSIX_SEM_NSEMS_MAX 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus +syscon posix _POSIX_SEM_VALUE_MAX 0x7fff 0x7fff 0x7fff 0x7fff 0x7fff 0 # unix consensus +syscon posix _POSIX_SSIZE_MAX 0x7fff 0x7fff 0x7fff 0x7fff 0x7fff 0 # unix consensus +syscon posix _POSIX_STREAM_MAX 8 8 8 8 8 0 # unix consensus +syscon posix _POSIX_SYMLINK_MAX 255 255 255 255 255 0 # unix consensus +syscon posix _POSIX_SYMLOOP_MAX 8 8 8 8 8 0 # unix consensus +syscon posix _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 4 4 4 4 0 # unix consensus +syscon posix _POSIX_THREAD_KEYS_MAX 0x80 0x80 0x80 0x80 0x80 0 # unix consensus +syscon posix _POSIX_TTY_NAME_MAX 9 9 9 9 9 0 # unix consensus +syscon posix _POSIX_TZNAME_MAX 6 6 6 6 6 0 # unix consensus +syscon posix _POSIX_CLOCK_SELECTION 0x031069 -1 -1 -1 -1 0 # bsd consensus +syscon posix _POSIX_FSYNC 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_MAPPED_FILES 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_MEMORY_PROTECTION 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_READER_WRITER_LOCKS 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_THREADS 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_THREAD_ATTR_STACKADDR 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_THREAD_ATTR_STACKSIZE 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon posix _POSIX_ADVISORY_INFO 0x031069 -1 0x030db0 -1 -1 0 +syscon posix _POSIX_ASYNCHRONOUS_IO 0x031069 -1 0x030db0 -1 -1 0 +syscon posix _POSIX_BARRIERS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_JOB_CONTROL 1 0x030db0 1 1 1 0 +syscon posix _POSIX_MEMLOCK 0x031069 -1 -1 0x030db0 0x030db0 0 +syscon posix _POSIX_MEMLOCK_RANGE 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_MESSAGE_PASSING 0x031069 -1 0x030db0 -1 -1 0 +syscon posix _POSIX_NO_TRUNC 1 0x030db0 1 1 1 0 +syscon posix _POSIX_RAW_SOCKETS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_REALTIME_SIGNALS 0x031069 -1 0x030db0 -1 -1 0 +syscon posix _POSIX_REGEXP 1 0x030db0 1 1 1 0 +syscon posix _POSIX_SEMAPHORES 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_SHARED_MEMORY_OBJECTS 0x031069 -1 0x030db0 0x031069 0x031069 0 +syscon posix _POSIX_SHELL 1 0x030db0 1 1 1 0 +syscon posix _POSIX_SPAWN 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_SPIN_LOCKS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_THREAD_PRIORITY_SCHEDULING 0x031069 -1 0x030db0 -1 -1 0 +syscon posix _POSIX_THREAD_PROCESS_SHARED 0x031069 0x030db0 0x030db0 -1 -1 0 +syscon posix _POSIX_THREAD_SAFE_FUNCTIONS 0x031069 0x030db0 -1 0x030db0 0x030db0 0 +syscon posix _POSIX_THREAD_THREADS_MAX 0x40 0x40 0x40 4 4 0 +syscon posix _POSIX_TIMEOUTS 0x031069 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_TIMERS 0x031069 -1 0x030db0 -1 -1 0 +syscon posix _POSIX_VERSION 0x031069 0x030db0 0x030db0 0x031069 0x031069 0 +syscon posix _POSIX_VDISABLE 0 255 255 255 255 0 # bsd consensus +syscon posix _POSIX_AIO_LISTIO_MAX 2 2 2 0 0 0 +syscon posix _POSIX_AIO_MAX 1 1 1 0 0 0 +syscon posix _POSIX_CHOWN_RESTRICTED 0 0x030db0 1 1 1 0 +syscon posix _POSIX_CLOCKRES_MIN 0x01312d00 0 0x01312d00 0x01312d00 0x01312d00 0 +syscon posix _POSIX_CPUTIME 0 -1 0x030db0 0x031069 0x031069 0 +syscon posix _POSIX_DELAYTIMER_MAX 0x20 0x20 0x20 0 0 0 +syscon posix _POSIX_MONOTONIC_CLOCK 0 -1 0x030db0 0x030db0 0x030db0 0 +syscon posix _POSIX_MQ_OPEN_MAX 8 8 8 0 0 0 +syscon posix _POSIX_MQ_PRIO_MAX 0x20 0x20 0x20 0 0 0 +syscon posix _POSIX_RTSIG_MAX 8 8 8 0 0 0 +syscon posix _POSIX_SAVED_IDS 1 0x030db0 0 1 1 0 +syscon posix _POSIX_SIGQUEUE_MAX 0x20 0x20 0x20 0 0 0 +syscon posix _POSIX_THREAD_CPUTIME 0 -1 0x030db0 0x031069 0x031069 0 +syscon posix _POSIX_TIMER_MAX 0x20 0x20 0x20 0 0 0 +syscon posix _POSIX_IPV6 0x031069 0x030db0 0 0 0 0 +syscon posix _POSIX_SS_REPL_MAX 0 4 4 0 0 0 +syscon posix _POSIX_TRACE_EVENT_NAME_MAX 0 30 30 0 0 0 +syscon posix _POSIX_TRACE_NAME_MAX 0 8 8 0 0 0 +syscon posix _POSIX_TRACE_SYS_MAX 0 8 8 0 0 0 +syscon posix _POSIX_TRACE_USER_EVENT_MAX 0 0x20 0x20 0 0 0 +syscon posix _POSIX_V6_LP64_OFF64 1 1 0 0 0 0 +syscon posix _POSIX_V7_LP64_OFF64 1 1 0 0 0 0 + +syscon misc TYPE_DISK 0 0 0 0 0 0 # consensus +syscon misc TYPE_A 1 1 1 1 1 0 # unix consensus +syscon misc TYPE_E 2 2 2 2 2 0 # unix consensus +syscon misc TYPE_I 3 3 3 3 3 0 # unix consensus +syscon misc TYPE_L 4 4 4 4 4 0 # unix consensus +syscon misc TYPE_ENCLOSURE 13 0 0 0 0 0 +syscon misc TYPE_MEDIUM_CHANGER 8 0 0 0 0 0 +syscon misc TYPE_MOD 7 0 0 0 0 0 +syscon misc TYPE_NO_LUN 127 0 0 0 0 0 +syscon misc TYPE_PROCESSOR 3 0 0 0 0 0 +syscon misc TYPE_ROM 5 0 0 0 0 0 +syscon misc TYPE_SCANNER 6 0 0 0 0 0 +syscon misc TYPE_TAPE 1 0 0 0 0 0 +syscon misc TYPE_WORM 4 0 0 0 0 0 + +syscon misc _POSIX2_BC_BASE_MAX 99 99 99 99 99 0 # unix consensus +syscon misc _POSIX2_BC_DIM_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus +syscon misc _POSIX2_BC_SCALE_MAX 99 99 99 99 99 0 # unix consensus +syscon misc _POSIX2_BC_STRING_MAX 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 0 # unix consensus +syscon misc _POSIX2_CHARCLASS_NAME_MAX 14 14 14 14 14 0 # unix consensus +syscon misc _POSIX2_COLL_WEIGHTS_MAX 2 2 2 2 2 0 # unix consensus +syscon misc _POSIX2_EXPR_NEST_MAX 0x20 0x20 0x20 0x20 0x20 0 # unix consensus +syscon misc _POSIX2_LINE_MAX 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus +syscon misc _POSIX2_RE_DUP_MAX 255 255 255 255 255 0 # unix consensus +syscon misc _POSIX2_C_BIND 0x031069 0x030db0 0x030db0 0x030db0 0x030db0 0 # bsd consensus +syscon misc _POSIX2_VERSION 0x031069 0x030db0 0x030a2c 0x031069 0x031069 0 + +syscon nd ND_RA_FLAG_MANAGED 0x80 0x80 0x80 0x80 0x80 0x80 # consensus +syscon nd ND_RA_FLAG_OTHER 0x40 0x40 0x40 0x40 0x40 0x40 # consensus +syscon nd ND_NA_FLAG_OVERRIDE 0x20 0x20 0x20 0x20 0x20 0x20000000 # unix consensus +syscon nd ND_NA_FLAG_ROUTER 0x80 0x80 0x80 0x80 0x80 0x80000000 # unix consensus +syscon nd ND_NA_FLAG_SOLICITED 0x40 0x40 0x40 0x40 0x40 0x40000000 # unix consensus +syscon nd ND_NEIGHBOR_ADVERT 136 136 136 136 136 0 # unix consensus +syscon nd ND_NEIGHBOR_SOLICIT 135 135 135 135 135 0 # unix consensus +syscon nd ND_REDIRECT 137 137 137 137 137 0 # unix consensus +syscon nd ND_ROUTER_ADVERT 134 134 134 134 134 0 # unix consensus +syscon nd ND_ROUTER_SOLICIT 133 133 133 133 133 0 # unix consensus +syscon nd ND_RA_FLAG_HOME_AGENT 0x20 0 0 0 0 0x20 # bsd consensus + +syscon misc N_TTY 0 0 0 0 0 0 # consensus +syscon misc N_6PACK 7 0 0 0 0 0 +syscon misc N_AX25 5 0 0 0 0 0 +syscon misc N_HCI 15 0 0 0 0 0 +syscon misc N_HDLC 13 0 0 0 0 0 +syscon misc N_IRDA 11 0 0 0 0 0 +syscon misc N_MASC 8 0 0 0 0 0 +syscon misc N_MOUSE 2 0 0 0 0 0 +syscon misc N_PPP 3 0 0 0 0 0 +syscon misc N_PROFIBUS_FDL 10 0 0 0 0 0 +syscon misc N_R3964 9 0 0 0 0 0 +syscon misc N_SLIP 1 0 0 0 0 0 +syscon misc N_SMSBLOCK 12 0 0 0 0 0 +syscon misc N_STRIP 4 0 0 0 0 0 +syscon misc N_SYNC_PPP 14 0 0 0 0 0 +syscon misc N_X25 6 0 0 0 0 0 + +syscon misc BLKTYPE 52 52 52 52 52 0 # unix consensus +syscon misc BLKBSZGET 0x80081270 0 0 0 0 0 +syscon misc BLKBSZSET 0x40081271 0 0 0 0 0 +syscon misc BLKFLSBUF 0x1261 0 0 0 0 0 +syscon misc BLKFRAGET 0x1265 0 0 0 0 0 +syscon misc BLKFRASET 0x1264 0 0 0 0 0 +syscon misc BLKGETSIZE 0x1260 0 0 0 0 0 +syscon misc BLKGETSIZE64 0x80081272 0 0 0 0 0 +syscon misc BLKRAGET 0x1263 0 0 0 0 0 +syscon misc BLKRASET 0x1262 0 0 0 0 0 +syscon misc BLKROGET 0x125e 0 0 0 0 0 +syscon misc BLKROSET 0x125d 0 0 0 0 0 +syscon misc BLKRRPART 0x125f 0 0 0 0 0 +syscon misc BLKSECTGET 0x1267 0 0 0 0 0 +syscon misc BLKSECTSET 0x1266 0 0 0 0 0 +syscon misc BLKSSZGET 0x1268 0 0 0 0 0 + +syscon misc ETH_P_CUST 0x6006 0 0 0 0 0 +syscon misc ETH_P_DDCMP 6 0 0 0 0 0 +syscon misc ETH_P_DEC 0x6000 0 0 0 0 0 +syscon misc ETH_P_DIAG 0x6005 0 0 0 0 0 +syscon misc ETH_P_DNA_DL 0x6001 0 0 0 0 0 +syscon misc ETH_P_DNA_RC 0x6002 0 0 0 0 0 +syscon misc ETH_P_DNA_RT 0x6003 0 0 0 0 0 +syscon misc ETH_P_IEEE802154 246 0 0 0 0 0 +syscon misc ETH_P_LAT 0x6004 0 0 0 0 0 +syscon misc ETH_P_LOCALTALK 9 0 0 0 0 0 +syscon misc ETH_P_PPP_MP 8 0 0 0 0 0 +syscon misc ETH_P_RARP 0x8035 0 0 0 0 0 +syscon misc ETH_P_SCA 0x6007 0 0 0 0 0 +syscon misc ETH_P_WAN_PPP 7 0 0 0 0 0 + +syscon scsi SCSI_IOCTL_BENCHMARK_COMMAND 3 0 0 0 0 0 +syscon scsi SCSI_IOCTL_DOORLOCK 0x5380 0 0 0 0 0 +syscon scsi SCSI_IOCTL_DOORUNLOCK 0x5381 0 0 0 0 0 +syscon scsi SCSI_IOCTL_GET_BUS_NUMBER 0x5386 0 0 0 0 0 +syscon scsi SCSI_IOCTL_GET_IDLUN 0x5382 0 0 0 0 0 +syscon scsi SCSI_IOCTL_PROBE_HOST 0x5385 0 0 0 0 0 +syscon scsi SCSI_IOCTL_SEND_COMMAND 1 0 0 0 0 0 +syscon scsi SCSI_IOCTL_START_UNIT 5 0 0 0 0 0 +syscon scsi SCSI_IOCTL_STOP_UNIT 6 0 0 0 0 0 +syscon scsi SCSI_IOCTL_SYNC 4 0 0 0 0 0 +syscon scsi SCSI_IOCTL_TAGGED_DISABLE 0x5384 0 0 0 0 0 +syscon scsi SCSI_IOCTL_TAGGED_ENABLE 0x5383 0 0 0 0 0 +syscon scsi SCSI_IOCTL_TEST_UNIT_READY 2 0 0 0 0 0 +syscon scsi BUS_DEVICE_RESET 12 0 0 0 0 0 # SIGBUS; +syscon scsi READ_10 40 0 0 0 0 0 +syscon scsi READ_12 168 0 0 0 0 0 +syscon scsi READ_6 8 0 0 0 0 0 +syscon scsi READ_BLOCK_LIMITS 5 0 0 0 0 0 +syscon scsi READ_BUFFER 60 0 0 0 0 0 +syscon scsi READ_CAPACITY 37 0 0 0 0 0 +syscon scsi READ_DEFECT_DATA 55 0 0 0 0 0 +syscon scsi READ_ELEMENT_STATUS 184 0 0 0 0 0 +syscon scsi READ_LONG 62 0 0 0 0 0 +syscon scsi READ_POSITION 52 0 0 0 0 0 +syscon scsi READ_REVERSE 15 0 0 0 0 0 +syscon scsi READ_TOC 67 0 0 0 0 0 +syscon scsi WRITE_10 42 0 0 0 0 0 +syscon scsi WRITE_12 170 0 0 0 0 0 +syscon scsi WRITE_6 10 0 0 0 0 0 +syscon scsi WRITE_BUFFER 59 0 0 0 0 0 +syscon scsi WRITE_FILEMARKS 0x10 0 0 0 0 0 +syscon scsi WRITE_LONG 63 0 0 0 0 0 +syscon scsi WRITE_LONG_2 234 0 0 0 0 0 +syscon scsi WRITE_SAME 65 0 0 0 0 0 +syscon scsi WRITE_VERIFY 46 0 0 0 0 0 +syscon scsi WRITE_VERIFY_12 174 0 0 0 0 0 + +syscon log LOG_EMERG 0 0 0 0 0 0 # consensus +syscon log LOG_KERN 0 0 0 0 0 0 # consensus +syscon log LOG_ALERT 1 1 1 1 1 1 # unix consensus +syscon log LOG_PID 1 1 1 1 1 1 # unix consensus +syscon log LOG_CONS 2 2 2 2 2 2 # unix consensus +syscon log LOG_CRIT 2 2 2 2 2 2 # unix consensus +syscon log LOG_ERR 3 3 3 3 3 3 # unix consensus +syscon log LOG_ODELAY 4 4 4 4 4 4 # unix consensus +syscon log LOG_WARNING 4 4 4 4 4 4 # unix consensus +syscon log LOG_NOTICE 5 5 5 5 5 5 # unix consensus +syscon log LOG_INFO 6 6 6 6 6 6 # unix consensus +syscon log LOG_DEBUG 7 7 7 7 7 7 # unix consensus +syscon log LOG_PRIMASK 7 7 7 7 7 7 # unix consensus +syscon log LOG_NDELAY 8 8 8 8 8 8 # unix consensus +syscon log LOG_USER 8 8 8 8 8 8 # unix consensus +syscon log LOG_MAIL 0x10 0x10 0x10 0x10 0x10 0x10 # unix consensus +syscon log LOG_NOWAIT 0x10 0x10 0x10 0x10 0x10 0x10 # unix consensus +syscon log LOG_DAEMON 24 24 24 24 24 24 # unix consensus +syscon log LOG_NFACILITIES 24 25 24 24 24 24 +syscon log LOG_AUTH 0x20 0x20 0x20 0x20 0x20 0x20 # unix consensus +syscon log LOG_PERROR 0x20 0x20 0x20 0x20 0x20 0x20 # unix consensus +syscon log LOG_SYSLOG 40 40 40 40 40 40 # unix consensus +syscon log LOG_LPR 48 48 48 48 48 48 # unix consensus +syscon log LOG_NEWS 56 56 56 56 56 56 # unix consensus +syscon log LOG_UUCP 0x40 0x40 0x40 0x40 0x40 40 # unix consensus +syscon log LOG_CRON 72 72 72 72 72 72 # unix consensus +syscon log LOG_SELECT 76 0 0 0 0 0 +syscon log LOG_SENSE 77 0 0 0 0 0 +syscon log LOG_LOCAL0 0x80 0x80 0x80 0x80 0x80 0x80 # unix consensus +syscon log LOG_LOCAL1 136 136 136 136 136 136 # unix consensus +syscon log LOG_LOCAL2 144 144 144 144 144 144 # unix consensus +syscon log LOG_LOCAL3 152 152 152 152 152 152 # unix consensus +syscon log LOG_LOCAL4 160 160 160 160 160 160 # unix consensus +syscon log LOG_LOCAL5 168 168 168 168 168 168 # unix consensus +syscon log LOG_LOCAL6 176 176 176 176 176 176 # unix consensus +syscon log LOG_LOCAL7 184 184 184 184 184 184 # unix consensus +syscon log LOG_FACMASK 0x03f8 0x03f8 0x03f8 0x03f8 0x03f8 0x03f8 # unix consensus + +syscon sg SG_DXFER_TO_FROM_DEV -4 0 0 0 0 0 +syscon sg SG_DXFER_FROM_DEV -3 0 0 0 0 0 +syscon sg SG_DXFER_TO_DEV -2 0 0 0 0 0 +syscon sg SG_DXFER_NONE -1 0 0 0 0 0 +syscon sg SG_DEF_COMMAND_Q 0 0 0 0 0 0 # consensus +syscon sg SG_DEF_FORCE_LOW_DMA 0 0 0 0 0 0 # consensus +syscon sg SG_DEF_FORCE_PACK_ID 0 0 0 0 0 0 # consensus +syscon sg SG_DEF_KEEP_ORPHAN 0 0 0 0 0 0 # consensus +syscon sg SG_DEF_UNDERRUN_FLAG 0 0 0 0 0 0 # consensus +syscon sg SG_INFO_INDIRECT_IO 0 0 0 0 0 0 # consensus +syscon sg SG_INFO_OK 0 0 0 0 0 0 # consensus +syscon sg SG_SCSI_RESET_NOTHING 0 0 0 0 0 0 # consensus +syscon sg SG_DEFAULT_RETRIES 1 0 0 0 0 0 +syscon sg SG_FLAG_DIRECT_IO 1 0 0 0 0 0 +syscon sg SG_INFO_CHECK 1 0 0 0 0 0 +syscon sg SG_INFO_OK_MASK 1 0 0 0 0 0 +syscon sg SG_SCSI_RESET_DEVICE 1 0 0 0 0 0 +syscon sg SG_FLAG_LUN_INHIBIT 2 0 0 0 0 0 +syscon sg SG_INFO_DIRECT_IO 2 0 0 0 0 0 +syscon sg SG_SCSI_RESET_BUS 2 0 0 0 0 0 +syscon sg SG_SCSI_RESET_HOST 3 0 0 0 0 0 +syscon sg SG_INFO_MIXED_IO 4 0 0 0 0 0 +syscon sg SG_INFO_DIRECT_IO_MASK 6 0 0 0 0 0 +syscon misc VOLUME_OVERFLOW 13 0 0 0 0 0 +syscon sg SG_MAX_QUEUE 0x10 0 0 0 0 0 +syscon sg SG_MAX_SENSE 0x10 0 0 0 0 0 +syscon sg SG_DEFAULT_TIMEOUT 0x1770 0 0 0 0 0 +syscon sg SG_SET_TIMEOUT 0x2201 0 0 0 0 0 +syscon sg SG_GET_TIMEOUT 0x2202 0 0 0 0 0 +syscon sg SG_EMULATED_HOST 0x2203 0 0 0 0 0 +syscon sg SG_SET_TRANSFORM 0x2204 0 0 0 0 0 +syscon sg SG_GET_TRANSFORM 0x2205 0 0 0 0 0 +syscon sg SG_GET_COMMAND_Q 0x2270 0 0 0 0 0 +syscon sg SG_SET_COMMAND_Q 0x2271 0 0 0 0 0 +syscon sg SG_GET_RESERVED_SIZE 0x2272 0 0 0 0 0 +syscon sg SG_SET_RESERVED_SIZE 0x2275 0 0 0 0 0 +syscon sg SG_GET_SCSI_ID 0x2276 0 0 0 0 0 +syscon sg SG_SET_FORCE_LOW_DMA 0x2279 0 0 0 0 0 +syscon sg SG_GET_LOW_DMA 0x227a 0 0 0 0 0 +syscon sg SG_SET_FORCE_PACK_ID 0x227b 0 0 0 0 0 +syscon sg SG_GET_PACK_ID 0x227c 0 0 0 0 0 +syscon sg SG_GET_NUM_WAITING 0x227d 0 0 0 0 0 +syscon sg SG_SET_DEBUG 0x227e 0 0 0 0 0 +syscon sg SG_GET_SG_TABLESIZE 0x227f 0 0 0 0 0 +syscon sg SG_GET_VERSION_NUM 0x2282 0 0 0 0 0 +syscon sg SG_NEXT_CMD_LEN 0x2283 0 0 0 0 0 +syscon sg SG_SCSI_RESET 0x2284 0 0 0 0 0 +syscon sg SG_IO 0x2285 0 0 0 0 0 +syscon sg SG_GET_REQUEST_TABLE 0x2286 0 0 0 0 0 +syscon sg SG_SET_KEEP_ORPHAN 0x2287 0 0 0 0 0 +syscon sg SG_GET_KEEP_ORPHAN 0x2288 0 0 0 0 0 +syscon sg SG_BIG_BUFF 0x8000 0 0 0 0 0 +syscon sg SG_DEF_RESERVED_SIZE 0x8000 0 0 0 0 0 +syscon sg SG_SCATTER_SZ 0x8000 0 0 0 0 0 +syscon sg SG_FLAG_NO_DXFER 0x010000 0 0 0 0 0 + # https://youtu.be/GUQUD3IMbb4?t=85 diff --git a/libc/sysv/consts/AI_ADDRCONFIG.S b/libc/sysv/consts/AI_ADDRCONFIG.S deleted file mode 100644 index 500884140..000000000 --- a/libc/sysv/consts/AI_ADDRCONFIG.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_ADDRCONFIG,0x20,0x0400,0x0400,0x40,0x40,0x0400 diff --git a/libc/sysv/consts/AI_ALL.S b/libc/sysv/consts/AI_ALL.S deleted file mode 100644 index 2193f2ef2..000000000 --- a/libc/sysv/consts/AI_ALL.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_ALL,0x10,0x0100,0x0100,0,0,0x0100 diff --git a/libc/sysv/consts/AI_CANONNAME.S b/libc/sysv/consts/AI_CANONNAME.S deleted file mode 100644 index 6639a8f20..000000000 --- a/libc/sysv/consts/AI_CANONNAME.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_CANONNAME,2,2,2,2,2,2 diff --git a/libc/sysv/consts/AI_NUMERICHOST.S b/libc/sysv/consts/AI_NUMERICHOST.S deleted file mode 100644 index 08404d179..000000000 --- a/libc/sysv/consts/AI_NUMERICHOST.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_NUMERICHOST,4,4,4,4,4,4 diff --git a/libc/sysv/consts/AI_NUMERICSERV.S b/libc/sysv/consts/AI_NUMERICSERV.S deleted file mode 100644 index f93e42cf8..000000000 --- a/libc/sysv/consts/AI_NUMERICSERV.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_NUMERICSERV,0x0400,0x1000,8,0x10,0x10,8 diff --git a/libc/sysv/consts/AI_PASSIVE.S b/libc/sysv/consts/AI_PASSIVE.S deleted file mode 100644 index fd32e1718..000000000 --- a/libc/sysv/consts/AI_PASSIVE.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_PASSIVE,1,1,1,1,1,1 diff --git a/libc/sysv/consts/AI_V4MAPPED.S b/libc/sysv/consts/AI_V4MAPPED.S deleted file mode 100644 index 08122a1b1..000000000 --- a/libc/sysv/consts/AI_V4MAPPED.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon gai,AI_V4MAPPED,8,0x0800,0x0800,0,0,0x0800 diff --git a/libc/sysv/consts/BIG_ENDIAN.S b/libc/sysv/consts/BIG_ENDIAN.S deleted file mode 100644 index 8e37ec0ad..000000000 --- a/libc/sysv/consts/BIG_ENDIAN.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BIG_ENDIAN,0x10e1,0x10e1,0x10e1,0x10e1,0x10e1,0 diff --git a/libc/sysv/consts/BLK_BYTECOUNT.S b/libc/sysv/consts/BLK_BYTECOUNT.S deleted file mode 100644 index 848166f5d..000000000 --- a/libc/sysv/consts/BLK_BYTECOUNT.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BLK_BYTECOUNT,2,2,2,2,2,0 diff --git a/libc/sysv/consts/BLK_EOF.S b/libc/sysv/consts/BLK_EOF.S deleted file mode 100644 index 9d9439db7..000000000 --- a/libc/sysv/consts/BLK_EOF.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BLK_EOF,0x40,0x40,0x40,0x40,0x40,0 diff --git a/libc/sysv/consts/BLK_EOR.S b/libc/sysv/consts/BLK_EOR.S deleted file mode 100644 index 1acd0dfe5..000000000 --- a/libc/sysv/consts/BLK_EOR.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BLK_EOR,0x80,0x80,0x80,0x80,0x80,0 diff --git a/libc/sysv/consts/BLK_ERRORS.S b/libc/sysv/consts/BLK_ERRORS.S deleted file mode 100644 index 34b41a252..000000000 --- a/libc/sysv/consts/BLK_ERRORS.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BLK_ERRORS,0x20,0x20,0x20,0x20,0x20,0 diff --git a/libc/sysv/consts/BLK_RESTART.S b/libc/sysv/consts/BLK_RESTART.S deleted file mode 100644 index 75cdc463a..000000000 --- a/libc/sysv/consts/BLK_RESTART.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BLK_RESTART,0x10,0x10,0x10,0x10,0x10,0 diff --git a/libc/sysv/consts/BUS_DEVICE_RESET.S b/libc/sysv/consts/BUS_DEVICE_RESET.S index 1d56d622f..0e33b3170 100644 --- a/libc/sysv/consts/BUS_DEVICE_RESET.S +++ b/libc/sysv/consts/BUS_DEVICE_RESET.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,BUS_DEVICE_RESET,12,0,0,0,0,0 +.syscon scsi,BUS_DEVICE_RESET,12,0,0,0,0,0 diff --git a/libc/sysv/consts/CR0.S b/libc/sysv/consts/CR0.S index 79e096b2e..02c2e947d 100644 --- a/libc/sysv/consts/CR0.S +++ b/libc/sysv/consts/CR0.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CR0,0b0000000000000000,0b000000000000000000,0b000000000000000000,0x0,0x0,0b0000000000000000 +.syscon termios,CR0,0b0000000000000000,0b000000000000000000,0b000000000000000000,0,0b000000000000000000,0b0000000000000000 diff --git a/libc/sysv/consts/CR1.S b/libc/sysv/consts/CR1.S index 49059cb78..480913c80 100644 --- a/libc/sysv/consts/CR1.S +++ b/libc/sysv/consts/CR1.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CR1,0b0000001000000000,0b000001000000000000,0b000001000000000000,0x0,0x0,0b0000001000000000 +.syscon termios,CR1,0b0000001000000000,0b000001000000000000,0b000001000000000000,0,0b000001000000000000,0b0000001000000000 diff --git a/libc/sysv/consts/CR2.S b/libc/sysv/consts/CR2.S index dbdc665bb..bb27c6949 100644 --- a/libc/sysv/consts/CR2.S +++ b/libc/sysv/consts/CR2.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CR2,0b0000010000000000,0b000010000000000000,0b000010000000000000,0x0,0x0,0b0000010000000000 +.syscon termios,CR2,0b0000010000000000,0b000010000000000000,0b000010000000000000,0,0b000000010000000000,0b0000010000000000 diff --git a/libc/sysv/consts/CR3.S b/libc/sysv/consts/CR3.S index 3cebe9dcf..5e65c9feb 100644 --- a/libc/sysv/consts/CR3.S +++ b/libc/sysv/consts/CR3.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CR3,0b0000011000000000,0b000011000000000000,0b000011000000000000,0x0,0x0,0b0000011000000000 +.syscon termios,CR3,0b0000011000000000,0b000011000000000000,0b000011000000000000,0,0b000000011000000000,0b0000011000000000 diff --git a/libc/sysv/consts/EBADFD.S b/libc/sysv/consts/EBADFD.S index 3d23845e6..451998577 100644 --- a/libc/sysv/consts/EBADFD.S +++ b/libc/sysv/consts/EBADFD.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,EBADFD,77,9,9,9,9,6 +.syscon junkerr,EBADFD,77,9,0,0,0,0 diff --git a/libc/sysv/consts/EMEDIUMTYPE.S b/libc/sysv/consts/EMEDIUMTYPE.S index 488841a65..e2397891f 100644 --- a/libc/sysv/consts/EMEDIUMTYPE.S +++ b/libc/sysv/consts/EMEDIUMTYPE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,EMEDIUMTYPE,124,0,0,86,86,0 +.syscon errno,EMEDIUMTYPE,124,0,0,86,0,0 diff --git a/libc/sysv/consts/EMPTY.S b/libc/sysv/consts/EMPTY.S index 26cd5eb86..5a9295f00 100644 --- a/libc/sysv/consts/EMPTY.S +++ b/libc/sysv/consts/EMPTY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,EMPTY,0,0,0,0,0,0 +.syscon termios,EMPTY,0,0,0,0,0,0 diff --git a/libc/sysv/consts/EMULTIHOP.S b/libc/sysv/consts/EMULTIHOP.S index cfff27b7d..434e78754 100644 --- a/libc/sysv/consts/EMULTIHOP.S +++ b/libc/sysv/consts/EMULTIHOP.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,EMULTIHOP,72,95,90,0,94,0 +.syscon errno,EMULTIHOP,72,95,90,0,94,0 diff --git a/libc/sysv/consts/ENODATA.S b/libc/sysv/consts/ENODATA.S index c406f9ae6..e9b938bbb 100644 --- a/libc/sysv/consts/ENODATA.S +++ b/libc/sysv/consts/ENODATA.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,ENODATA,61,96,0,0,89,0 +.syscon errno,ENODATA,61,96,0,0,89,0 diff --git a/libc/sysv/consts/ENOLINK.S b/libc/sysv/consts/ENOLINK.S index 9d890098e..875ea6b1b 100644 --- a/libc/sysv/consts/ENOLINK.S +++ b/libc/sysv/consts/ENOLINK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,ENOLINK,67,97,91,0,95,0 +.syscon errno,ENOLINK,67,97,91,0,95,0 diff --git a/libc/sysv/consts/ENOMEDIUM.S b/libc/sysv/consts/ENOMEDIUM.S index 7243999b8..e7125df4b 100644 --- a/libc/sysv/consts/ENOMEDIUM.S +++ b/libc/sysv/consts/ENOMEDIUM.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,ENOMEDIUM,123,0,0,85,85,0 +.syscon errno,ENOMEDIUM,123,0,0,85,0,0 diff --git a/libc/sysv/consts/ENOSR.S b/libc/sysv/consts/ENOSR.S index ea4d91cf0..6dde58df3 100644 --- a/libc/sysv/consts/ENOSR.S +++ b/libc/sysv/consts/ENOSR.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,ENOSR,63,98,0,0,90,0 +.syscon errno,ENOSR,63,98,0,90,90,0 diff --git a/libc/sysv/consts/ENOSTR.S b/libc/sysv/consts/ENOSTR.S index 9dde57279..749624fa4 100644 --- a/libc/sysv/consts/ENOSTR.S +++ b/libc/sysv/consts/ENOSTR.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon junkerr,ENOSTR,60,99,0,0,91,0 +.syscon errno,ENOSTR,60,99,0,0,91,0 diff --git a/libc/sysv/consts/ERA.S b/libc/sysv/consts/ERA.S index 59abd10c8..b356dc911 100644 --- a/libc/sysv/consts/ERA.S +++ b/libc/sysv/consts/ERA.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ERA,0x02002c,45,45,0,0,0 +.syscon termios,ERA,0x02002c,45,45,0,0,0 diff --git a/libc/sysv/consts/ERESTART.S b/libc/sysv/consts/ERESTART.S index 646d27dfd..8cd52c1b9 100644 --- a/libc/sysv/consts/ERESTART.S +++ b/libc/sysv/consts/ERESTART.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon errno,ERESTART,85,0,0,0,-3,0 +.syscon errno,ERESTART,85,-1,-1,-1,-3,0 diff --git a/libc/sysv/consts/EXTA.S b/libc/sysv/consts/EXTA.S index 802c182c5..9c56df558 100644 --- a/libc/sysv/consts/EXTA.S +++ b/libc/sysv/consts/EXTA.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,EXTA,14,0x4b00,0x4b00,0x4b00,0x4b00,0 +.syscon termios,EXTA,14,0x4b00,0x4b00,0x4b00,0x4b00,0 diff --git a/libc/sysv/consts/EXTB.S b/libc/sysv/consts/EXTB.S index 5177cf47a..82b0ece7d 100644 --- a/libc/sysv/consts/EXTB.S +++ b/libc/sysv/consts/EXTB.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,EXTB,15,0x9600,0x9600,0x9600,0x9600,0 +.syscon termios,EXTB,15,0x9600,0x9600,0x9600,0x9600,0 diff --git a/libc/sysv/consts/F_GETLK.S b/libc/sysv/consts/F_GETLK.S index 1dd0b999a..474192801 100644 --- a/libc/sysv/consts/F_GETLK.S +++ b/libc/sysv/consts/F_GETLK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_GETLK,5,7,11,7,7,0 +.syscon fcntl,F_GETLK,5,7,11,7,7,5 diff --git a/libc/sysv/consts/F_GETLK64.S b/libc/sysv/consts/F_GETLK64.S index 6d2fcfeed..b4a57a902 100644 --- a/libc/sysv/consts/F_GETLK64.S +++ b/libc/sysv/consts/F_GETLK64.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_GETLK64,5,0,0,0,0,0 +.syscon compat,F_GETLK64,5,7,11,7,7,5 diff --git a/libc/sysv/consts/F_SETLK.S b/libc/sysv/consts/F_SETLK.S index a229d7181..6f4ec8b29 100644 --- a/libc/sysv/consts/F_SETLK.S +++ b/libc/sysv/consts/F_SETLK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_SETLK,6,8,12,8,8,0 +.syscon fcntl,F_SETLK,6,8,12,8,8,6 diff --git a/libc/sysv/consts/F_SETLK64.S b/libc/sysv/consts/F_SETLK64.S index 7aa999969..0747c5aed 100644 --- a/libc/sysv/consts/F_SETLK64.S +++ b/libc/sysv/consts/F_SETLK64.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_SETLK64,6,0,0,0,0,0 +.syscon compat,F_SETLK64,6,8,12,8,8,6 diff --git a/libc/sysv/consts/F_SETLKW.S b/libc/sysv/consts/F_SETLKW.S index 48896c36e..042933722 100644 --- a/libc/sysv/consts/F_SETLKW.S +++ b/libc/sysv/consts/F_SETLKW.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_SETLKW,7,9,13,9,9,0 +.syscon fcntl,F_SETLKW,7,9,13,9,9,7 diff --git a/libc/sysv/consts/F_SETLKW64.S b/libc/sysv/consts/F_SETLKW64.S index 31dca8a64..569ba2b70 100644 --- a/libc/sysv/consts/F_SETLKW64.S +++ b/libc/sysv/consts/F_SETLKW64.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_SETLKW64,7,0,0,0,0,0 +.syscon compat,F_SETLKW64,7,9,13,9,9,7 diff --git a/libc/sysv/consts/F_UNLCK.S b/libc/sysv/consts/F_UNLCK.S index 5811e4222..6e40c08f4 100644 --- a/libc/sysv/consts/F_UNLCK.S +++ b/libc/sysv/consts/F_UNLCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_UNLCK,2,2,2,2,2,0 +.syscon fcntl,F_UNLCK,2,2,2,2,2,2 diff --git a/libc/sysv/consts/F_WRLCK.S b/libc/sysv/consts/F_WRLCK.S index 6f0aa3d8a..bf4098372 100644 --- a/libc/sysv/consts/F_WRLCK.S +++ b/libc/sysv/consts/F_WRLCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_WRLCK,1,3,3,3,3,0 +.syscon fcntl,F_WRLCK,1,3,3,3,3,1 diff --git a/libc/sysv/consts/INADDR_ALLHOSTS_GROUP.S b/libc/sysv/consts/INADDR_ALLHOSTS_GROUP.S deleted file mode 100644 index 44972e02d..000000000 --- a/libc/sysv/consts/INADDR_ALLHOSTS_GROUP.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_ALLHOSTS_GROUP,0xe0000001,0xe0000001,0xe0000001,0xe0000001,0xe0000001,0 diff --git a/libc/sysv/consts/INADDR_ALLRTRS_GROUP.S b/libc/sysv/consts/INADDR_ALLRTRS_GROUP.S deleted file mode 100644 index 1685edf35..000000000 --- a/libc/sysv/consts/INADDR_ALLRTRS_GROUP.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_ALLRTRS_GROUP,0xe0000002,0xe0000002,0xe0000002,0,0,0 diff --git a/libc/sysv/consts/INADDR_ANY.S b/libc/sysv/consts/INADDR_ANY.S deleted file mode 100644 index 0c0731778..000000000 --- a/libc/sysv/consts/INADDR_ANY.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_ANY,0,0,0,0,0,0 diff --git a/libc/sysv/consts/INADDR_BROADCAST.S b/libc/sysv/consts/INADDR_BROADCAST.S deleted file mode 100644 index 44147bdca..000000000 --- a/libc/sysv/consts/INADDR_BROADCAST.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_BROADCAST,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff diff --git a/libc/sysv/consts/INADDR_LOOPBACK.S b/libc/sysv/consts/INADDR_LOOPBACK.S deleted file mode 100644 index 035b6dcfb..000000000 --- a/libc/sysv/consts/INADDR_LOOPBACK.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_LOOPBACK,0x7f000001,0x7f000001,0x7f000001,0x7f000001,0x7f000001,0x7f000001 diff --git a/libc/sysv/consts/INADDR_MAX_LOCAL_GROUP.S b/libc/sysv/consts/INADDR_MAX_LOCAL_GROUP.S deleted file mode 100644 index dc6a9b1c6..000000000 --- a/libc/sysv/consts/INADDR_MAX_LOCAL_GROUP.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_MAX_LOCAL_GROUP,0xe00000ff,0xe00000ff,0xe00000ff,0xe00000ff,0xe00000ff,0 diff --git a/libc/sysv/consts/INADDR_NONE.S b/libc/sysv/consts/INADDR_NONE.S deleted file mode 100644 index 7add73654..000000000 --- a/libc/sysv/consts/INADDR_NONE.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_NONE,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff diff --git a/libc/sysv/consts/INADDR_UNSPEC_GROUP.S b/libc/sysv/consts/INADDR_UNSPEC_GROUP.S deleted file mode 100644 index b9533448b..000000000 --- a/libc/sysv/consts/INADDR_UNSPEC_GROUP.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,INADDR_UNSPEC_GROUP,0xe0000000,0xe0000000,0xe0000000,0xe0000000,0xe0000000,0 diff --git a/libc/sysv/consts/IUCLC.S b/libc/sysv/consts/IUCLC.S index d6e17f9c3..a65687f66 100644 --- a/libc/sysv/consts/IUCLC.S +++ b/libc/sysv/consts/IUCLC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,IUCLC,0b0000001000000000,0,0,0b0001000000000000,0b0001000000000000,0b0000001000000000 +.syscon termios,IUCLC,0b0000001000000000,0,0,0b0001000000000000,0,0b0000001000000000 diff --git a/libc/sysv/consts/LITTLE_ENDIAN.S b/libc/sysv/consts/LITTLE_ENDIAN.S deleted file mode 100644 index 0999effaa..000000000 --- a/libc/sysv/consts/LITTLE_ENDIAN.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,LITTLE_ENDIAN,0x04d2,0x04d2,0x04d2,0x04d2,0x04d2,0 diff --git a/libc/sysv/consts/MAP_CONCEAL.S b/libc/sysv/consts/MAP_CONCEAL.S index 8b4b49875..8077b1792 100644 --- a/libc/sysv/consts/MAP_CONCEAL.S +++ b/libc/sysv/consts/MAP_CONCEAL.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mmap,MAP_CONCEAL,0,0,0x20000,0x8000,0x8000,0 +.syscon mmap,MAP_CONCEAL,0,0,0,0x8000,0,0 diff --git a/libc/sysv/consts/MAP_TYPE.S b/libc/sysv/consts/MAP_TYPE.S index 8b2daa23b..d530757ed 100644 --- a/libc/sysv/consts/MAP_TYPE.S +++ b/libc/sysv/consts/MAP_TYPE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mmap,MAP_TYPE,15,0,0,0,0,0 +.syscon mmap,MAP_TYPE,15,15,15,15,15,15 diff --git a/libc/sysv/consts/MODE_B.S b/libc/sysv/consts/MODE_B.S deleted file mode 100644 index 7385006b9..000000000 --- a/libc/sysv/consts/MODE_B.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_B,2,2,2,2,2,0 diff --git a/libc/sysv/consts/MODE_C.S b/libc/sysv/consts/MODE_C.S deleted file mode 100644 index 8b01e205d..000000000 --- a/libc/sysv/consts/MODE_C.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_C,3,3,3,3,3,0 diff --git a/libc/sysv/consts/MODE_S.S b/libc/sysv/consts/MODE_S.S deleted file mode 100644 index 80a10d825..000000000 --- a/libc/sysv/consts/MODE_S.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_S,1,1,1,1,1,0 diff --git a/libc/sysv/consts/MODE_SELECT.S b/libc/sysv/consts/MODE_SELECT.S deleted file mode 100644 index 3521ec2b3..000000000 --- a/libc/sysv/consts/MODE_SELECT.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_SELECT,21,0,0,0,0,0 diff --git a/libc/sysv/consts/MODE_SELECT_10.S b/libc/sysv/consts/MODE_SELECT_10.S deleted file mode 100644 index 72200e6c6..000000000 --- a/libc/sysv/consts/MODE_SELECT_10.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_SELECT_10,85,0,0,0,0,0 diff --git a/libc/sysv/consts/MODE_SENSE.S b/libc/sysv/consts/MODE_SENSE.S deleted file mode 100644 index 40108da52..000000000 --- a/libc/sysv/consts/MODE_SENSE.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_SENSE,26,0,0,0,0,0 diff --git a/libc/sysv/consts/MODE_SENSE_10.S b/libc/sysv/consts/MODE_SENSE_10.S deleted file mode 100644 index ca1fd682b..000000000 --- a/libc/sysv/consts/MODE_SENSE_10.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MODE_SENSE_10,90,0,0,0,0,0 diff --git a/libc/sysv/consts/NL0.S b/libc/sysv/consts/NL0.S index 073fa6c8d..5d667bfd8 100644 --- a/libc/sysv/consts/NL0.S +++ b/libc/sysv/consts/NL0.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,NL0,0b0000000000000000,0b000000000000000000,0b000000000000000000,0,0,0b0000000000000000 +.syscon termios,NL0,0b0000000000000000,0b000000000000000000,0b000000000000000000,0,0b000000000000000000,0b0000000000000000 diff --git a/libc/sysv/consts/NL1.S b/libc/sysv/consts/NL1.S index e63bb35cd..c2d164edb 100644 --- a/libc/sysv/consts/NL1.S +++ b/libc/sysv/consts/NL1.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,NL1,0b0000000100000000,0b000000000100000000,0b000000000100000000,0,0,0b0000000100000000 +.syscon termios,NL1,0b0000000100000000,0b000000000100000000,0b000000000100000000,0,0b000000000100000000,0b0000000100000000 diff --git a/libc/sysv/consts/NL2.S b/libc/sysv/consts/NL2.S index 8407a6aca..38a536303 100644 --- a/libc/sysv/consts/NL2.S +++ b/libc/sysv/consts/NL2.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,NL2,0,0b000000001000000000,0b000000001000000000,0,0,0 +.syscon termios,NL2,0,0b000000001000000000,0b000000001000000000,0,0b000000001000000000,0 diff --git a/libc/sysv/consts/NL3.S b/libc/sysv/consts/NL3.S index 1f9e92aec..6bd74840d 100644 --- a/libc/sysv/consts/NL3.S +++ b/libc/sysv/consts/NL3.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,NL3,0,0b000000001100000000,0b000000001100000000,0,0,0 +.syscon termios,NL3,0,0b000000001100000000,0b000000001100000000,0,0b000000001100000000,0 diff --git a/libc/sysv/consts/OLCUC.S b/libc/sysv/consts/OLCUC.S index 8122a71db..9a644b4a5 100644 --- a/libc/sysv/consts/OLCUC.S +++ b/libc/sysv/consts/OLCUC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,OLCUC,0b0000000000000010,0b000000000000000000,0,0b0000000000100000,0b0000000000100000,0b0000000000000010 +.syscon termios,OLCUC,0b0000000000000010,0,0,0b0000000000100000,0,0b0000000000000010 diff --git a/libc/sysv/consts/O_APPEND.S b/libc/sysv/consts/O_APPEND.S index 11f5843fd..ee7a00db2 100644 --- a/libc/sysv/consts/O_APPEND.S +++ b/libc/sysv/consts/O_APPEND.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_APPEND,0x0400,8,8,8,8,0x00000004 +.syscon open,O_APPEND,0x00000400,8,8,8,8,0x00000004 diff --git a/libc/sysv/consts/O_ASYNC.S b/libc/sysv/consts/O_ASYNC.S index 6e7067b75..63cbb6d9b 100644 --- a/libc/sysv/consts/O_ASYNC.S +++ b/libc/sysv/consts/O_ASYNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_ASYNC,0x2000,0x40,0x40,0x40,0x40,0 +.syscon open,O_ASYNC,0x00002000,0x00000040,0x00000040,0x00000040,0x00000040,0 diff --git a/libc/sysv/consts/O_CLOEXEC.S b/libc/sysv/consts/O_CLOEXEC.S index 828eab068..77de11e39 100644 --- a/libc/sysv/consts/O_CLOEXEC.S +++ b/libc/sysv/consts/O_CLOEXEC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_CLOEXEC,0x080000,0x01000000,0x100000,0x010000,0x400000,0x00080000 +.syscon open,O_CLOEXEC,0x00080000,0x01000000,0x00100000,0x00010000,0x00400000,0x00080000 diff --git a/libc/sysv/consts/O_CREAT.S b/libc/sysv/consts/O_CREAT.S index ca37ec698..9924d1ecc 100644 --- a/libc/sysv/consts/O_CREAT.S +++ b/libc/sysv/consts/O_CREAT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_CREAT,0x40,0x0200,0x0200,0x0200,0x0200,0x00000040 +.syscon open,O_CREAT,0x00000040,0x00000200,0x00000200,0x00000200,0x00000200,0x00000040 diff --git a/libc/sysv/consts/O_DIRECT.S b/libc/sysv/consts/O_DIRECT.S index 65395064f..f9be1eb9c 100644 --- a/libc/sysv/consts/O_DIRECT.S +++ b/libc/sysv/consts/O_DIRECT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_DIRECT,0x4000,0,0x010000,0,0x80000,0x00200000 +.syscon open,O_DIRECT,0x00004000,0,0x00010000,0,0x00080000,0x00200000 diff --git a/libc/sysv/consts/O_DIRECTORY.S b/libc/sysv/consts/O_DIRECTORY.S index 33865aec6..00fcac4dd 100644 --- a/libc/sysv/consts/O_DIRECTORY.S +++ b/libc/sysv/consts/O_DIRECTORY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_DIRECTORY,0x010000,0x100000,0x020000,0x020000,0x200000,0x02000000 +.syscon open,O_DIRECTORY,0x00010000,0x00100000,0x00020000,0x00020000,0x00200000,0x02000000 diff --git a/libc/sysv/consts/O_DSYNC.S b/libc/sysv/consts/O_DSYNC.S index 1d55d6983..1670c5476 100644 --- a/libc/sysv/consts/O_DSYNC.S +++ b/libc/sysv/consts/O_DSYNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_DSYNC,0x1000,0x400000,0,0x80,0x10000,0 +.syscon open,O_DSYNC,0x00001000,0x00400000,0,0x00000080,0x00010000,0 diff --git a/libc/sysv/consts/O_EXCL.S b/libc/sysv/consts/O_EXCL.S index 3798997c8..07615526b 100644 --- a/libc/sysv/consts/O_EXCL.S +++ b/libc/sysv/consts/O_EXCL.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_EXCL,0x80,0x0800,0x0800,0x0800,0x0800,0x00000080 +.syscon open,O_EXCL,0x00000080,0x00000800,0x00000800,0x00000800,0x00000800,0x00000080 diff --git a/libc/sysv/consts/O_EXEC.S b/libc/sysv/consts/O_EXEC.S index 28dadbf86..f8668386a 100644 --- a/libc/sysv/consts/O_EXEC.S +++ b/libc/sysv/consts/O_EXEC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_EXEC,0,0,0x040000,0,0x4000000,0 +.syscon open,O_EXEC,0,0,0x00040000,0,0x04000000,0 diff --git a/libc/sysv/consts/O_NDELAY.S b/libc/sysv/consts/O_NDELAY.S index 4aa123055..bb2191050 100644 --- a/libc/sysv/consts/O_NDELAY.S +++ b/libc/sysv/consts/O_NDELAY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_NDELAY,0x0800,4,4,4,4,0 +.syscon open,O_NDELAY,0x00000800,0x00000004,0x00000004,0x00000004,0x00000004,0x00000800 diff --git a/libc/sysv/consts/O_NOATIME.S b/libc/sysv/consts/O_NOATIME.S index 107d98f67..3ae86dc6a 100644 --- a/libc/sysv/consts/O_NOATIME.S +++ b/libc/sysv/consts/O_NOATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_NOATIME,0x040000,0,0,0,0,0 +.syscon open,O_NOATIME,0x00040000,0,0,0,0,0 diff --git a/libc/sysv/consts/O_NOCTTY.S b/libc/sysv/consts/O_NOCTTY.S index 48e72b6f3..f6a1df496 100644 --- a/libc/sysv/consts/O_NOCTTY.S +++ b/libc/sysv/consts/O_NOCTTY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_NOCTTY,0x0100,0x020000,0x8000,0x8000,0x8000,0 +.syscon open,O_NOCTTY,0x00000100,0x00020000,0x00008000,0x00008000,0x00008000,0 diff --git a/libc/sysv/consts/O_NOFOLLOW.S b/libc/sysv/consts/O_NOFOLLOW.S index 242824fe1..b0b255d23 100644 --- a/libc/sysv/consts/O_NOFOLLOW.S +++ b/libc/sysv/consts/O_NOFOLLOW.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_NOFOLLOW,0x020000,0x0100,0x0100,0x0100,0x0100,0 +.syscon open,O_NOFOLLOW,0x00020000,0x00000100,0x00000100,0x00000100,0x00000100,0 diff --git a/libc/sysv/consts/O_NONBLOCK.S b/libc/sysv/consts/O_NONBLOCK.S index e62c9728b..1ca6b0780 100644 --- a/libc/sysv/consts/O_NONBLOCK.S +++ b/libc/sysv/consts/O_NONBLOCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_NONBLOCK,0x0800,4,4,4,4,0x00000800 +.syscon open,O_NONBLOCK,0x00000800,0x00000004,0x00000004,0x00000004,0x00000004,0x00000800 diff --git a/libc/sysv/consts/O_PATH.S b/libc/sysv/consts/O_PATH.S index 11af8d8db..d4603a0c7 100644 --- a/libc/sysv/consts/O_PATH.S +++ b/libc/sysv/consts/O_PATH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_PATH,0x200000,0,0,0,0,0 +.syscon open,O_PATH,0x00200000,0,0,0,0,0 diff --git a/libc/sysv/consts/O_RSYNC.S b/libc/sysv/consts/O_RSYNC.S index 891355ee5..e412b6b76 100644 --- a/libc/sysv/consts/O_RSYNC.S +++ b/libc/sysv/consts/O_RSYNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_RSYNC,0x101000,0,0,0x80,0x20000,0 +.syscon open,O_RSYNC,0x00101000,0,0,0x00000080,0x00020000,0 diff --git a/libc/sysv/consts/O_SYNC.S b/libc/sysv/consts/O_SYNC.S index 4845b58a7..fefb1ee29 100644 --- a/libc/sysv/consts/O_SYNC.S +++ b/libc/sysv/consts/O_SYNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_SYNC,0x101000,0x80,0x80,0x80,0x80,0 +.syscon open,O_SYNC,0x00101000,0x00000080,0x00000080,0x00000080,0x00000080,0 diff --git a/libc/sysv/consts/O_TMPFILE.S b/libc/sysv/consts/O_TMPFILE.S index 628774f13..3c060605b 100644 --- a/libc/sysv/consts/O_TMPFILE.S +++ b/libc/sysv/consts/O_TMPFILE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_TMPFILE,0x410000,0,0,0,0,0x04000100 +.syscon open,O_TMPFILE,0x00410000,0,0,0,0,0x04000100 diff --git a/libc/sysv/consts/O_TRUNC.S b/libc/sysv/consts/O_TRUNC.S index b701802f6..c54bfc428 100644 --- a/libc/sysv/consts/O_TRUNC.S +++ b/libc/sysv/consts/O_TRUNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_TRUNC,0x0200,0x0400,0x0400,0x0400,0x0400,0x00000200 +.syscon open,O_TRUNC,0x00000200,0x00000400,0x00000400,0x00000400,0x00000400,0x00000200 diff --git a/libc/sysv/consts/O_TTY_INIT.S b/libc/sysv/consts/O_TTY_INIT.S index 470a7568a..f5d9281e4 100644 --- a/libc/sysv/consts/O_TTY_INIT.S +++ b/libc/sysv/consts/O_TTY_INIT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_TTY_INIT,0,0,0x080000,0,0,0 +.syscon open,O_TTY_INIT,0,0,0x00080000,0,0,0 diff --git a/libc/sysv/consts/READ_10.S b/libc/sysv/consts/READ_10.S index 0fb0766cc..61042b8e0 100644 --- a/libc/sysv/consts/READ_10.S +++ b/libc/sysv/consts/READ_10.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_10,40,0,0,0,0,0 +.syscon scsi,READ_10,40,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_12.S b/libc/sysv/consts/READ_12.S index fa76a110c..048ee93e2 100644 --- a/libc/sysv/consts/READ_12.S +++ b/libc/sysv/consts/READ_12.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_12,168,0,0,0,0,0 +.syscon scsi,READ_12,168,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_6.S b/libc/sysv/consts/READ_6.S index 6651219bc..00dae3890 100644 --- a/libc/sysv/consts/READ_6.S +++ b/libc/sysv/consts/READ_6.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_6,8,0,0,0,0,0 +.syscon scsi,READ_6,8,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_BLOCK_LIMITS.S b/libc/sysv/consts/READ_BLOCK_LIMITS.S index 7a3404c48..91b01f5ff 100644 --- a/libc/sysv/consts/READ_BLOCK_LIMITS.S +++ b/libc/sysv/consts/READ_BLOCK_LIMITS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_BLOCK_LIMITS,5,0,0,0,0,0 +.syscon scsi,READ_BLOCK_LIMITS,5,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_BUFFER.S b/libc/sysv/consts/READ_BUFFER.S index 98b75d659..66c0bdf8e 100644 --- a/libc/sysv/consts/READ_BUFFER.S +++ b/libc/sysv/consts/READ_BUFFER.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_BUFFER,60,0,0,0,0,0 +.syscon scsi,READ_BUFFER,60,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_CAPACITY.S b/libc/sysv/consts/READ_CAPACITY.S index 93c58e317..6dd06c03e 100644 --- a/libc/sysv/consts/READ_CAPACITY.S +++ b/libc/sysv/consts/READ_CAPACITY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_CAPACITY,37,0,0,0,0,0 +.syscon scsi,READ_CAPACITY,37,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_DEFECT_DATA.S b/libc/sysv/consts/READ_DEFECT_DATA.S index e24c8202e..84fb61d8d 100644 --- a/libc/sysv/consts/READ_DEFECT_DATA.S +++ b/libc/sysv/consts/READ_DEFECT_DATA.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_DEFECT_DATA,55,0,0,0,0,0 +.syscon scsi,READ_DEFECT_DATA,55,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_ELEMENT_STATUS.S b/libc/sysv/consts/READ_ELEMENT_STATUS.S index 68c3368e1..14a56851f 100644 --- a/libc/sysv/consts/READ_ELEMENT_STATUS.S +++ b/libc/sysv/consts/READ_ELEMENT_STATUS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_ELEMENT_STATUS,184,0,0,0,0,0 +.syscon scsi,READ_ELEMENT_STATUS,184,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_LONG.S b/libc/sysv/consts/READ_LONG.S index f5f595aac..7be143b66 100644 --- a/libc/sysv/consts/READ_LONG.S +++ b/libc/sysv/consts/READ_LONG.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_LONG,62,0,0,0,0,0 +.syscon scsi,READ_LONG,62,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_POSITION.S b/libc/sysv/consts/READ_POSITION.S index eb4477af9..393cb5ca4 100644 --- a/libc/sysv/consts/READ_POSITION.S +++ b/libc/sysv/consts/READ_POSITION.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_POSITION,52,0,0,0,0,0 +.syscon scsi,READ_POSITION,52,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_REVERSE.S b/libc/sysv/consts/READ_REVERSE.S index 6d3c641ef..d206e3f65 100644 --- a/libc/sysv/consts/READ_REVERSE.S +++ b/libc/sysv/consts/READ_REVERSE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_REVERSE,15,0,0,0,0,0 +.syscon scsi,READ_REVERSE,15,0,0,0,0,0 diff --git a/libc/sysv/consts/READ_TOC.S b/libc/sysv/consts/READ_TOC.S index ae5e483a4..46d1301be 100644 --- a/libc/sysv/consts/READ_TOC.S +++ b/libc/sysv/consts/READ_TOC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,READ_TOC,67,0,0,0,0,0 +.syscon scsi,READ_TOC,67,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_BENCHMARK_COMMAND.S b/libc/sysv/consts/SCSI_IOCTL_BENCHMARK_COMMAND.S index 3676f6549..cc60c5210 100644 --- a/libc/sysv/consts/SCSI_IOCTL_BENCHMARK_COMMAND.S +++ b/libc/sysv/consts/SCSI_IOCTL_BENCHMARK_COMMAND.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_BENCHMARK_COMMAND,3,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_BENCHMARK_COMMAND,3,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_DOORLOCK.S b/libc/sysv/consts/SCSI_IOCTL_DOORLOCK.S index d799cb125..6b409e871 100644 --- a/libc/sysv/consts/SCSI_IOCTL_DOORLOCK.S +++ b/libc/sysv/consts/SCSI_IOCTL_DOORLOCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_DOORLOCK,0x5380,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_DOORLOCK,0x5380,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_DOORUNLOCK.S b/libc/sysv/consts/SCSI_IOCTL_DOORUNLOCK.S index 3454dcad0..9aa9d4b65 100644 --- a/libc/sysv/consts/SCSI_IOCTL_DOORUNLOCK.S +++ b/libc/sysv/consts/SCSI_IOCTL_DOORUNLOCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_DOORUNLOCK,0x5381,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_DOORUNLOCK,0x5381,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_GET_BUS_NUMBER.S b/libc/sysv/consts/SCSI_IOCTL_GET_BUS_NUMBER.S index 470b22e22..1b96bdc54 100644 --- a/libc/sysv/consts/SCSI_IOCTL_GET_BUS_NUMBER.S +++ b/libc/sysv/consts/SCSI_IOCTL_GET_BUS_NUMBER.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_GET_BUS_NUMBER,0x5386,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_GET_BUS_NUMBER,0x5386,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_GET_IDLUN.S b/libc/sysv/consts/SCSI_IOCTL_GET_IDLUN.S index ddf20bd62..d5d88ee0b 100644 --- a/libc/sysv/consts/SCSI_IOCTL_GET_IDLUN.S +++ b/libc/sysv/consts/SCSI_IOCTL_GET_IDLUN.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_GET_IDLUN,0x5382,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_GET_IDLUN,0x5382,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_PROBE_HOST.S b/libc/sysv/consts/SCSI_IOCTL_PROBE_HOST.S index cddb4487d..70413e978 100644 --- a/libc/sysv/consts/SCSI_IOCTL_PROBE_HOST.S +++ b/libc/sysv/consts/SCSI_IOCTL_PROBE_HOST.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_PROBE_HOST,0x5385,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_PROBE_HOST,0x5385,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_SEND_COMMAND.S b/libc/sysv/consts/SCSI_IOCTL_SEND_COMMAND.S index 5c87b94e6..db838a26e 100644 --- a/libc/sysv/consts/SCSI_IOCTL_SEND_COMMAND.S +++ b/libc/sysv/consts/SCSI_IOCTL_SEND_COMMAND.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_SEND_COMMAND,1,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_SEND_COMMAND,1,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_START_UNIT.S b/libc/sysv/consts/SCSI_IOCTL_START_UNIT.S index 48f5002dd..b46792db3 100644 --- a/libc/sysv/consts/SCSI_IOCTL_START_UNIT.S +++ b/libc/sysv/consts/SCSI_IOCTL_START_UNIT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_START_UNIT,5,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_START_UNIT,5,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_STOP_UNIT.S b/libc/sysv/consts/SCSI_IOCTL_STOP_UNIT.S index cd516713a..5ddc444d4 100644 --- a/libc/sysv/consts/SCSI_IOCTL_STOP_UNIT.S +++ b/libc/sysv/consts/SCSI_IOCTL_STOP_UNIT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_STOP_UNIT,6,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_STOP_UNIT,6,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_SYNC.S b/libc/sysv/consts/SCSI_IOCTL_SYNC.S index bfc87375e..d73e8e343 100644 --- a/libc/sysv/consts/SCSI_IOCTL_SYNC.S +++ b/libc/sysv/consts/SCSI_IOCTL_SYNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_SYNC,4,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_SYNC,4,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_TAGGED_DISABLE.S b/libc/sysv/consts/SCSI_IOCTL_TAGGED_DISABLE.S index 5058c16da..943f46500 100644 --- a/libc/sysv/consts/SCSI_IOCTL_TAGGED_DISABLE.S +++ b/libc/sysv/consts/SCSI_IOCTL_TAGGED_DISABLE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_TAGGED_DISABLE,0x5384,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_TAGGED_DISABLE,0x5384,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_TAGGED_ENABLE.S b/libc/sysv/consts/SCSI_IOCTL_TAGGED_ENABLE.S index a91bf1959..5c3ebf578 100644 --- a/libc/sysv/consts/SCSI_IOCTL_TAGGED_ENABLE.S +++ b/libc/sysv/consts/SCSI_IOCTL_TAGGED_ENABLE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_TAGGED_ENABLE,0x5383,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_TAGGED_ENABLE,0x5383,0,0,0,0,0 diff --git a/libc/sysv/consts/SCSI_IOCTL_TEST_UNIT_READY.S b/libc/sysv/consts/SCSI_IOCTL_TEST_UNIT_READY.S index 739647d14..eb37c0d1c 100644 --- a/libc/sysv/consts/SCSI_IOCTL_TEST_UNIT_READY.S +++ b/libc/sysv/consts/SCSI_IOCTL_TEST_UNIT_READY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,SCSI_IOCTL_TEST_UNIT_READY,2,0,0,0,0,0 +.syscon scsi,SCSI_IOCTL_TEST_UNIT_READY,2,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_APPEND.S b/libc/sysv/consts/ST_APPEND.S index 5cf26b7bc..99483b6f6 100644 --- a/libc/sysv/consts/ST_APPEND.S +++ b/libc/sysv/consts/ST_APPEND.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_APPEND,0x0100,0,0,0,0,0 +.syscon statvfs,ST_APPEND,0x0100,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_IMMUTABLE.S b/libc/sysv/consts/ST_IMMUTABLE.S index afa4f8978..7eaaf6d57 100644 --- a/libc/sysv/consts/ST_IMMUTABLE.S +++ b/libc/sysv/consts/ST_IMMUTABLE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_IMMUTABLE,0x0200,0,0,0,0,0 +.syscon statvfs,ST_IMMUTABLE,0x0200,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_MANDLOCK.S b/libc/sysv/consts/ST_MANDLOCK.S index a45c2a337..e23e806b8 100644 --- a/libc/sysv/consts/ST_MANDLOCK.S +++ b/libc/sysv/consts/ST_MANDLOCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_MANDLOCK,0x40,0,0,0,0,0 +.syscon statvfs,ST_MANDLOCK,0x40,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_NOATIME.S b/libc/sysv/consts/ST_NOATIME.S index 1c4a0aa96..1e4d7b62d 100644 --- a/libc/sysv/consts/ST_NOATIME.S +++ b/libc/sysv/consts/ST_NOATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_NOATIME,0x0400,0,0,0,0,0 +.syscon statvfs,ST_NOATIME,0x0400,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_NODEV.S b/libc/sysv/consts/ST_NODEV.S index 5afa0a969..7b8b1e936 100644 --- a/libc/sysv/consts/ST_NODEV.S +++ b/libc/sysv/consts/ST_NODEV.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_NODEV,4,0,0,0,0,0 +.syscon statvfs,ST_NODEV,4,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_NODIRATIME.S b/libc/sysv/consts/ST_NODIRATIME.S index 25e1e82fe..6e0a3e7a7 100644 --- a/libc/sysv/consts/ST_NODIRATIME.S +++ b/libc/sysv/consts/ST_NODIRATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_NODIRATIME,0x0800,0,0,0,0,0 +.syscon statvfs,ST_NODIRATIME,0x0800,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_NOEXEC.S b/libc/sysv/consts/ST_NOEXEC.S index a55d2b0bd..ac55a179d 100644 --- a/libc/sysv/consts/ST_NOEXEC.S +++ b/libc/sysv/consts/ST_NOEXEC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_NOEXEC,8,0,0,0,0,0 +.syscon statvfs,ST_NOEXEC,8,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_NOSUID.S b/libc/sysv/consts/ST_NOSUID.S index e67715457..288a22f4f 100644 --- a/libc/sysv/consts/ST_NOSUID.S +++ b/libc/sysv/consts/ST_NOSUID.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_NOSUID,2,2,2,2,2,0 +.syscon statvfs,ST_NOSUID,2,2,2,2,2,0 diff --git a/libc/sysv/consts/ST_RDONLY.S b/libc/sysv/consts/ST_RDONLY.S index 31a3e1224..9d677d2ee 100644 --- a/libc/sysv/consts/ST_RDONLY.S +++ b/libc/sysv/consts/ST_RDONLY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_RDONLY,1,1,1,1,1,0 +.syscon statvfs,ST_RDONLY,1,1,1,1,1,0 diff --git a/libc/sysv/consts/ST_RELATIME.S b/libc/sysv/consts/ST_RELATIME.S index 91730ce25..6b075f500 100644 --- a/libc/sysv/consts/ST_RELATIME.S +++ b/libc/sysv/consts/ST_RELATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_RELATIME,0x1000,0,0,0,0,0 +.syscon statvfs,ST_RELATIME,0x1000,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_SYNCHRONOUS.S b/libc/sysv/consts/ST_SYNCHRONOUS.S index 36fff28e3..3ee29b546 100644 --- a/libc/sysv/consts/ST_SYNCHRONOUS.S +++ b/libc/sysv/consts/ST_SYNCHRONOUS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_SYNCHRONOUS,0x10,0,0,0,0,0 +.syscon statvfs,ST_SYNCHRONOUS,0x10,0,0,0,0,0 diff --git a/libc/sysv/consts/ST_WRITE.S b/libc/sysv/consts/ST_WRITE.S index f8a6f39f1..1945a52f7 100644 --- a/libc/sysv/consts/ST_WRITE.S +++ b/libc/sysv/consts/ST_WRITE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,ST_WRITE,0x80,0,0,0,0,0 +.syscon statvfs,ST_WRITE,0x80,0,0,0,0,0 diff --git a/libc/sysv/consts/TAB0.S b/libc/sysv/consts/TAB0.S index a7ef5756b..05e012fe7 100644 --- a/libc/sysv/consts/TAB0.S +++ b/libc/sysv/consts/TAB0.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,TAB0,0b0000000000000000,0b000000000000000000,0b000000000000000000,0,0,0b0000000000000000 +.syscon termios,TAB0,0b0000000000000000,0b000000000000000000,0b000000000000000000,0,0b000000000000000000,0b0000000000000000 diff --git a/libc/sysv/consts/TAB1.S b/libc/sysv/consts/TAB1.S index 313a37ee5..5ca4f4c9f 100644 --- a/libc/sysv/consts/TAB1.S +++ b/libc/sysv/consts/TAB1.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,TAB1,0b0000100000000000,0b000000010000000000,0b000000010000000000,0,0,0b0000100000000000 +.syscon termios,TAB1,0b0000100000000000,0b000000010000000000,0b000000010000000000,0,0b000000010000000000,0b0000100000000000 diff --git a/libc/sysv/consts/TAB2.S b/libc/sysv/consts/TAB2.S index cdb741395..75b6974e5 100644 --- a/libc/sysv/consts/TAB2.S +++ b/libc/sysv/consts/TAB2.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,TAB2,0b0001000000000000,0b000000100000000000,0b000000100000000000,0,0,0b0001000000000000 +.syscon termios,TAB2,0b0001000000000000,0b000000100000000000,0b000000100000000000,0,0b000000100000000000,0b0001000000000000 diff --git a/libc/sysv/consts/TAB3.S b/libc/sysv/consts/TAB3.S index 620414746..986b1f80a 100644 --- a/libc/sysv/consts/TAB3.S +++ b/libc/sysv/consts/TAB3.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,TAB3,0b0001100000000000,0b000000000000000100,0b000000000000000100,0,0,0b0001100000000000 +.syscon termios,TAB3,0b0001100000000000,0b000000000000000100,0b000000000000000100,0,0b000000000000000100,0b0001100000000000 diff --git a/libc/sysv/consts/TCFLSH.S b/libc/sysv/consts/TCFLSH.S index af83feb9a..aa355d64d 100644 --- a/libc/sysv/consts/TCFLSH.S +++ b/libc/sysv/consts/TCFLSH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCFLSH,0x540b,0,0,0,0,0 +.syscon termios,TCFLSH,0x540b,0,0,0,0,0 diff --git a/libc/sysv/consts/TCIFLUSH.S b/libc/sysv/consts/TCIFLUSH.S index 5acc423f2..c70852957 100644 --- a/libc/sysv/consts/TCIFLUSH.S +++ b/libc/sysv/consts/TCIFLUSH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCIFLUSH,0,1,1,1,1,0 +.syscon termios,TCIFLUSH,0,1,1,1,1,0 diff --git a/libc/sysv/consts/TCIOFF.S b/libc/sysv/consts/TCIOFF.S index 58f8bd649..0b0543479 100644 --- a/libc/sysv/consts/TCIOFF.S +++ b/libc/sysv/consts/TCIOFF.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCIOFF,2,3,3,3,3,0 +.syscon termios,TCIOFF,2,3,3,3,3,0 diff --git a/libc/sysv/consts/TCIOFLUSH.S b/libc/sysv/consts/TCIOFLUSH.S index a62678a37..c407ecd1f 100644 --- a/libc/sysv/consts/TCIOFLUSH.S +++ b/libc/sysv/consts/TCIOFLUSH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCIOFLUSH,2,3,3,3,3,0 +.syscon termios,TCIOFLUSH,2,3,3,3,3,0 diff --git a/libc/sysv/consts/TCION.S b/libc/sysv/consts/TCION.S index b8e5f2d72..9020fa38b 100644 --- a/libc/sysv/consts/TCION.S +++ b/libc/sysv/consts/TCION.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCION,3,4,4,4,4,0 +.syscon termios,TCION,3,4,4,4,4,0 diff --git a/libc/sysv/consts/TCOFLUSH.S b/libc/sysv/consts/TCOFLUSH.S index 717e0ad82..a7e8523a6 100644 --- a/libc/sysv/consts/TCOFLUSH.S +++ b/libc/sysv/consts/TCOFLUSH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCOFLUSH,1,2,2,2,2,0 +.syscon termios,TCOFLUSH,1,2,2,2,2,0 diff --git a/libc/sysv/consts/TCOOFF.S b/libc/sysv/consts/TCOOFF.S index 6a35619a0..d2f98b06b 100644 --- a/libc/sysv/consts/TCOOFF.S +++ b/libc/sysv/consts/TCOOFF.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCOOFF,0,1,1,1,1,0 +.syscon termios,TCOOFF,0,1,1,1,1,0 diff --git a/libc/sysv/consts/TCOON.S b/libc/sysv/consts/TCOON.S index 01b15fc94..38c3f077f 100644 --- a/libc/sysv/consts/TCOON.S +++ b/libc/sysv/consts/TCOON.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,TCOON,1,2,2,2,2,0 +.syscon termios,TCOON,1,2,2,2,2,0 diff --git a/libc/sysv/consts/WRITE_10.S b/libc/sysv/consts/WRITE_10.S index a8a413959..951e911df 100644 --- a/libc/sysv/consts/WRITE_10.S +++ b/libc/sysv/consts/WRITE_10.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_10,42,0,0,0,0,0 +.syscon scsi,WRITE_10,42,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_12.S b/libc/sysv/consts/WRITE_12.S index 4a601fe9c..ce4375bc2 100644 --- a/libc/sysv/consts/WRITE_12.S +++ b/libc/sysv/consts/WRITE_12.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_12,170,0,0,0,0,0 +.syscon scsi,WRITE_12,170,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_6.S b/libc/sysv/consts/WRITE_6.S index ec8a380f0..63727b623 100644 --- a/libc/sysv/consts/WRITE_6.S +++ b/libc/sysv/consts/WRITE_6.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_6,10,0,0,0,0,0 +.syscon scsi,WRITE_6,10,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_BUFFER.S b/libc/sysv/consts/WRITE_BUFFER.S index 082690233..80fc29492 100644 --- a/libc/sysv/consts/WRITE_BUFFER.S +++ b/libc/sysv/consts/WRITE_BUFFER.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_BUFFER,59,0,0,0,0,0 +.syscon scsi,WRITE_BUFFER,59,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_FILEMARKS.S b/libc/sysv/consts/WRITE_FILEMARKS.S index dd55e6e69..5058a5023 100644 --- a/libc/sysv/consts/WRITE_FILEMARKS.S +++ b/libc/sysv/consts/WRITE_FILEMARKS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_FILEMARKS,0x10,0,0,0,0,0 +.syscon scsi,WRITE_FILEMARKS,0x10,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_LONG.S b/libc/sysv/consts/WRITE_LONG.S index 429178468..5dc83904e 100644 --- a/libc/sysv/consts/WRITE_LONG.S +++ b/libc/sysv/consts/WRITE_LONG.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_LONG,63,0,0,0,0,0 +.syscon scsi,WRITE_LONG,63,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_LONG_2.S b/libc/sysv/consts/WRITE_LONG_2.S index 016c7f948..6c6cea5e8 100644 --- a/libc/sysv/consts/WRITE_LONG_2.S +++ b/libc/sysv/consts/WRITE_LONG_2.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_LONG_2,234,0,0,0,0,0 +.syscon scsi,WRITE_LONG_2,234,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_SAME.S b/libc/sysv/consts/WRITE_SAME.S index 7ed5916b9..175f4989a 100644 --- a/libc/sysv/consts/WRITE_SAME.S +++ b/libc/sysv/consts/WRITE_SAME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_SAME,65,0,0,0,0,0 +.syscon scsi,WRITE_SAME,65,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_VERIFY.S b/libc/sysv/consts/WRITE_VERIFY.S index d06004a31..80fcc36d0 100644 --- a/libc/sysv/consts/WRITE_VERIFY.S +++ b/libc/sysv/consts/WRITE_VERIFY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_VERIFY,46,0,0,0,0,0 +.syscon scsi,WRITE_VERIFY,46,0,0,0,0,0 diff --git a/libc/sysv/consts/WRITE_VERIFY_12.S b/libc/sysv/consts/WRITE_VERIFY_12.S index 8b350e2a2..47d70f139 100644 --- a/libc/sysv/consts/WRITE_VERIFY_12.S +++ b/libc/sysv/consts/WRITE_VERIFY_12.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,WRITE_VERIFY_12,174,0,0,0,0,0 +.syscon scsi,WRITE_VERIFY_12,174,0,0,0,0,0 diff --git a/libc/sysv/consts/XCASE.S b/libc/sysv/consts/XCASE.S index 307c411e7..5e711bf41 100644 --- a/libc/sysv/consts/XCASE.S +++ b/libc/sysv/consts/XCASE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,XCASE,0b0000000000000100,0,0,16777216,16777216,0b0000000000000100 +.syscon termios,XCASE,0b0000000000000100,0,0,16777216,0,0b0000000000000100 diff --git a/libc/sysv/consts/XTABS.S b/libc/sysv/consts/XTABS.S index f0b7db658..d6e186fef 100644 --- a/libc/sysv/consts/XTABS.S +++ b/libc/sysv/consts/XTABS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,XTABS,0b0001100000000000,0b000000000000000000,0b000000110000000000,0,0,0b0001100000000000 +.syscon termios,XTABS,0b0001100000000000,0b000000110000000000,0b000000110000000000,0,0b000000110000000000,0b0001100000000000 diff --git a/libc/sysv/consts/ai.h b/libc/sysv/consts/ai.h deleted file mode 100644 index 21b637401..000000000 --- a/libc/sysv/consts/ai.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_AI_H_ -#define COSMOPOLITAN_LIBC_SYSV_CONSTS_AI_H_ -#include "libc/runtime/symbolic.h" -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ - -extern const long AI_ADDRCONFIG; -extern const long AI_ALL; -extern const long AI_CANONNAME; -extern const long AI_NUMERICHOST; -extern const long AI_NUMERICSERV; -extern const long AI_PASSIVE; -extern const long AI_V4MAPPED; - -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ - -#define AI_ADDRCONFIG SYMBOLIC(AI_ADDRCONFIG) -#define AI_ALL SYMBOLIC(AI_ALL) -#define AI_CANONNAME LITERALLY(2) -#define AI_NUMERICHOST LITERALLY(4) -#define AI_NUMERICSERV SYMBOLIC(AI_NUMERICSERV) -#define AI_PASSIVE LITERALLY(1) -#define AI_V4MAPPED SYMBOLIC(AI_V4MAPPED) - -#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_AI_H_ */ diff --git a/libc/sysv/consts/blk.h b/libc/sysv/consts/blk.h deleted file mode 100644 index d1159ac8a..000000000 --- a/libc/sysv/consts/blk.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_BLK_H_ -#define COSMOPOLITAN_LIBC_SYSV_CONSTS_BLK_H_ -#include "libc/runtime/symbolic.h" - -#define BLK_BYTECOUNT SYMBOLIC(BLK_BYTECOUNT) -#define BLK_EOF SYMBOLIC(BLK_EOF) -#define BLK_EOR SYMBOLIC(BLK_EOR) -#define BLK_ERRORS SYMBOLIC(BLK_ERRORS) -#define BLK_RESTART SYMBOLIC(BLK_RESTART) - -#define BLKBSZGET SYMBOLIC(BLKBSZGET) -#define BLKBSZSET SYMBOLIC(BLKBSZSET) -#define BLKFLSBUF SYMBOLIC(BLKFLSBUF) -#define BLKFRAGET SYMBOLIC(BLKFRAGET) -#define BLKFRASET SYMBOLIC(BLKFRASET) -#define BLKGETSIZE SYMBOLIC(BLKGETSIZE) -#define BLKGETSIZE64 SYMBOLIC(BLKGETSIZE64) -#define BLKRAGET SYMBOLIC(BLKRAGET) -#define BLKRASET SYMBOLIC(BLKRASET) -#define BLKROGET SYMBOLIC(BLKROGET) -#define BLKROSET SYMBOLIC(BLKROSET) -#define BLKRRPART SYMBOLIC(BLKRRPART) -#define BLKSECTGET SYMBOLIC(BLKSECTGET) -#define BLKSECTSET SYMBOLIC(BLKSECTSET) -#define BLKSSZGET SYMBOLIC(BLKSSZGET) -#define BLKTYPE SYMBOLIC(BLKTYPE) - -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ - -extern const long BLK_BYTECOUNT; -extern const long BLK_EOF; -extern const long BLK_EOR; -extern const long BLK_ERRORS; -extern const long BLK_RESTART; - -extern const long BLKBSZGET; -extern const long BLKBSZSET; -extern const long BLKFLSBUF; -extern const long BLKFRAGET; -extern const long BLKFRASET; -extern const long BLKGETSIZE64; -extern const long BLKGETSIZE; -extern const long BLKRAGET; -extern const long BLKRASET; -extern const long BLKROGET; -extern const long BLKROSET; -extern const long BLKRRPART; -extern const long BLKSECTGET; -extern const long BLKSECTSET; -extern const long BLKSSZGET; -extern const long BLKTYPE; - -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_BLK_H_ */ diff --git a/libc/sysv/consts/inaddr.h b/libc/sysv/consts/inaddr.h index cf8260058..08773d6fc 100644 --- a/libc/sysv/consts/inaddr.h +++ b/libc/sysv/consts/inaddr.h @@ -1,40 +1,22 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_INADDR_H_ #define COSMOPOLITAN_LIBC_SYSV_CONSTS_INADDR_H_ -#include "libc/runtime/symbolic.h" -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ /** * @fileoverview Well-known Internet addresses. * These need to be hard-coded as little-endian, so htonl() is needed. */ -extern const long INADDR_ALLHOSTS_GROUP; -extern const long INADDR_ALLRTRS_GROUP; -extern const long INADDR_ANY; -extern const long INADDR_BROADCAST; -extern const long INADDR_LOOPBACK; -extern const long INADDR_MAX_LOCAL_GROUP; -extern const long INADDR_NONE; -extern const long INADDR_TESTNET1; -extern const long INADDR_TESTNET2; -extern const long INADDR_TESTNET3; -extern const long INADDR_UNSPEC_GROUP; +#define INADDR_ANY 0x00000000u /* 0.0.0.0 */ +#define INADDR_BROADCAST 0xFFFFFFFFu /* 255.255.255.255 */ +#define INADDR_NONE 0xFFFFFFFFu /* 255.255.255.255 */ +#define INADDR_LOOPBACK 0x7F000001u /* 127.0.0.1 */ +#define INADDR_TESTNET1 0xC0000200u /* 192.0.2.0/24 (RFC5737§3) */ +#define INADDR_TESTNET2 0xC6336400u /* 198.51.100.0/24 */ +#define INADDR_TESTNET3 0xCB007100u /* 203.0.113.0/24 */ -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ - -#define INADDR_ANY LITERALLY(0x00000000u) /* 0.0.0.0 */ -#define INADDR_BROADCAST LITERALLY(0xffffffffu) /* 255.255.255.255 */ -#define INADDR_NONE LITERALLY(0xffffffffu) /* 255.255.255.255 */ -#define INADDR_LOOPBACK LITERALLY(0x7f000001u) /* 127.0.0.1 */ -#define INADDR_TESTNET1 LITERALLY(0xc0000200u) /* 192.0.2.0/24 (RFC5737§3) */ -#define INADDR_TESTNET2 LITERALLY(0xc6336400u) /* 198.51.100.0/24 */ -#define INADDR_TESTNET3 LITERALLY(0xcb007100u) /* 203.0.113.0/24 */ - -#define INADDR_ALLHOSTS_GROUP SYMBOLIC(INADDR_ALLHOSTS_GROUP) -#define INADDR_ALLRTRS_GROUP SYMBOLIC(INADDR_ALLRTRS_GROUP) -#define INADDR_MAX_LOCAL_GROUP SYMBOLIC(INADDR_MAX_LOCAL_GROUP) -#define INADDR_UNSPEC_GROUP SYMBOLIC(INADDR_UNSPEC_GROUP) +#define INADDR_ALLHOSTS_GROUP 0xE0000001u +#define INADDR_ALLRTRS_GROUP 0xE0000002u +#define INADDR_MAX_LOCAL_GROUP 0xE00000FFu +#define INADDR_UNSPEC_GROUP 0xE0000000u #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_INADDR_H_ */ diff --git a/libc/sysv/consts/map.h b/libc/sysv/consts/map.h index 9748e3b3a..05d656800 100644 --- a/libc/sysv/consts/map.h +++ b/libc/sysv/consts/map.h @@ -21,7 +21,7 @@ extern const long MAP_NORESERVE; extern const long MAP_POPULATE; extern const long MAP_PRIVATE; extern const long MAP_SHARED; -extern const long MAP_TYPE; +extern const long MAP_CONCEAL; COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ @@ -29,6 +29,7 @@ COSMOPOLITAN_C_END_ #define MAP_FILE 0 #define MAP_SHARED 1 #define MAP_PRIVATE 2 +#define MAP_TYPE 15 #define MAP_FIXED 16 #define MAP_32BIT SYMBOLIC(MAP_32BIT) @@ -44,7 +45,7 @@ COSMOPOLITAN_C_END_ #define MAP_NONBLOCK SYMBOLIC(MAP_NONBLOCK) #define MAP_NORESERVE SYMBOLIC(MAP_NORESERVE) #define MAP_POPULATE SYMBOLIC(MAP_POPULATE) -#define MAP_TYPE SYMBOLIC(MAP_TYPE) +#define MAP_CONCEAL SYMBOLIC(MAP_CONCEAL) #define MAP_ANON MAP_ANONYMOUS #define MAP_NOCORE MAP_CONCEAL diff --git a/libc/sysv/syscalls.sh b/libc/sysv/syscalls.sh index 09976ccae..7acd419cb 100755 --- a/libc/sysv/syscalls.sh +++ b/libc/sysv/syscalls.sh @@ -112,7 +112,7 @@ scall msgget 0x0e10e10e12103044 globl # won't polyfill for windows scall msgsnd 0x0e20e20e22104045 globl # won't polyfill for windows scall msgrcv 0x0e30e30e32105046 globl # won't polyfill for windows scall msgctl 0x1bc1291ff2102047 globl # won't polyfill for windows -scall sys_fcntl 0x05c05c05c205c048 globl hidden +scall __sys_fcntl 0x05c05c05c205c048 globl hidden scall sys_flock 0x0830830832083049 globl hidden scall sys_fsync 0x05f05f05f205f04a globl hidden scall sys_fdatasync 0x0f105f22620bb04b globl hidden # fsync() on openbsd diff --git a/libc/sysv/systemfive.S b/libc/sysv/systemfive.S index 019339aae..8d8964404 100644 --- a/libc/sysv/systemfive.S +++ b/libc/sysv/systemfive.S @@ -108,13 +108,13 @@ __systemfive: systemfive_linux: and $0xfff,%eax cmp $0xfff,%eax - je systemfive_enosys + je systemfive_enosys # never taken branches cost nothing 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 + 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 @@ -374,7 +374,7 @@ _init_systemfive_stack: # determinism ftw! mov %rsp,%rbp // 𝑠𝑙𝑖𝑑𝑒 _init_systemfive_syscall: -/* mov __NR_msyscall,%eax # syscall origin protect + mov __NR_msyscall,%eax # syscall origin protect cmp $0xfff,%ax # openbsd is pretty cool jae _init_systemfive_done push %rdi @@ -385,7 +385,7 @@ _init_systemfive_syscall: mov $__privileged_size,%esi syscall pop %rsi - pop %rdi*/ + pop %rdi // 𝑠𝑙𝑖𝑑𝑒 #endif /* TINY */ _init_systemfive_done: diff --git a/libc/testlib/testlib.mk b/libc/testlib/testlib.mk index 85ccc3c6a..f609b80c3 100644 --- a/libc/testlib/testlib.mk +++ b/libc/testlib/testlib.mk @@ -165,6 +165,7 @@ LIBC_TESTMAIN_DIRECTDEPS = \ LIBC_CALLS \ LIBC_INTRIN \ LIBC_LOG \ + LIBC_MEM \ LIBC_NEXGEN32E \ LIBC_RUNTIME \ LIBC_STDIO \ diff --git a/libc/testlib/testmain.c b/libc/testlib/testmain.c index 3220673db..8f18af359 100644 --- a/libc/testlib/testmain.c +++ b/libc/testlib/testmain.c @@ -21,6 +21,7 @@ #include "libc/calls/internal.h" #include "libc/log/log.h" #include "libc/nexgen32e/x86feature.h" +#include "libc/runtime/symbols.internal.h" #include "libc/stdio/stdio.h" #include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/exit.h" @@ -70,9 +71,13 @@ static testonly void GetOpts(int argc, char *argv[]) { * Generic test program main function. */ testonly int main(int argc, char *argv[]) { + const char *comdbg; __log_level = kLogInfo; GetOpts(argc, argv); showcrashreports(); + if ((comdbg = FindDebugBinary())) { + setenv("COMDBG", comdbg, true); + } g_testlib_shoulddebugbreak = IsDebuggerPresent(false); sys_getpid(); /* make strace easier to read */ testlib_clearxmmregisters(); diff --git a/libc/testlib/testrunner.c b/libc/testlib/testrunner.c index 50bf8d8aa..d7a5ca9ca 100644 --- a/libc/testlib/testrunner.c +++ b/libc/testlib/testrunner.c @@ -25,6 +25,7 @@ #include "libc/macros.internal.h" #include "libc/nt/process.h" #include "libc/runtime/runtime.h" +#include "libc/runtime/symbols.internal.h" #include "libc/stdio/stdio.h" #include "libc/testlib/testlib.h" #include "libc/x/x.h" diff --git a/libc/time/strftime.c b/libc/time/strftime.c index 5a610e6d0..fce7fb70b 100644 --- a/libc/time/strftime.c +++ b/libc/time/strftime.c @@ -19,6 +19,7 @@ #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/fmt/fmt.h" +#include "libc/fmt/itoa.h" #include "libc/macros.internal.h" #include "libc/nexgen32e/nexgen32e.h" #include "libc/time/struct/tm.h" @@ -31,24 +32,24 @@ Copyright 1989 The Regents of the University of California\""); asm(".include \"libc/disclaimer.inc\""); static char *strftime_add(char *p, const char *pe, const char *str) { - while (p < pe && (*p = *str++) != '\0') ++p; + while (p < pe && (*p = *str++)) ++p; return p; } static char *strftime_conv(char *p, const char *pe, int n, const char *format) { - char buf[INT_STRLEN_MAXIMUM(int) + 1]; + char buf[22]; (snprintf)(buf, sizeof(buf), format, n); return strftime_add(p, pe, buf); } static char *strftime_secs(char *p, const char *pe, const struct tm *t) { - static char buf[INT_STRLEN_MAXIMUM(int) + 1]; + char ibuf[21]; struct tm tmp; int64_t s; tmp = *t; /* Make a copy, mktime(3) modifies the tm struct. */ s = mktime(&tmp); - (snprintf)(buf, sizeof(buf), "%ld", s); - return strftime_add(p, pe, buf); + int64toarray_radix10(s, ibuf); + return strftime_add(p, pe, ibuf); } static char *strftime_timefmt(char *p, const char *pe, const char *format, diff --git a/libc/zip.h b/libc/zip.h index 79ae60b90..359a5298e 100644 --- a/libc/zip.h +++ b/libc/zip.h @@ -49,8 +49,10 @@ #define kZipCdirHdrLinkableSize \ ROUNDUP(kZipCfileHdrMinSize + PATH_MAX, kZipCdirAlign) -#define kZipCdir64HdrMagic 0x06064b50 /* PK♣♠ "PK\6\6" */ -#define kZipCdir64HdrMinSize 56 +#define kZipCdir64HdrMagic 0x06064b50 /* PK♣♠ "PK\6\6" */ +#define kZipCdir64HdrMinSize 56 +#define kZipCdir64LocatorMagic 0x07064b50 /* PK♠• "PK\6\7" */ +#define kZipCdir64LocatorSize 20 #define kZipCfileHdrMagic 0x02014b50 /* PK☺☻ "PK\1\2" */ #define kZipCfileHdrMinSize 46 @@ -112,7 +114,11 @@ #define ZIP_CDIR64_OFFSET(P) READ64LE((P) + 48) #define ZIP_CDIR64_COMMENTSIZE(P) \ (ZIP_CDIR64_HDRSIZE(P) >= 56 ? ZIP_CDIR64_HDRSIZE(P) - 56 : 0) -#define ZIP_CDIR64_COMMENT(P) ((P) + 56) /* recommend stopping at nul */ +#define ZIP_CDIR64_COMMENT(P) ((P) + 56) /* recommend stopping at nul */ +#define ZIP_LOCATE64_MAGIC(P) READ32LE(P) +#define ZIP_LOCATE64_STARTINGDISK(P) READ32LE((P) + 4) +#define ZIP_LOCATE64_OFFSET(P) READ64LE((P) + 8) +#define ZIP_LOCATE64_TOTALDISKS(P) READ32LE((P) + 12) /* central directory file header */ #define ZIP_CFILE_MAGIC(P) READ32LE(P) @@ -178,7 +184,7 @@ #define ZIP_EXTRA_CONTENT(P) ((P) + 4) #define ZIP_EXTRA_SIZE(P) (ZIP_EXTRA_CONTENTSIZE(P) + kZipExtraHdrSize) -uint8_t *GetZipCdir(const uint8_t *, size_t); +void *GetZipCdir(const uint8_t *, size_t); bool IsZipCdir32(const uint8_t *, size_t, size_t); bool IsZipCdir64(const uint8_t *, size_t, size_t); int GetZipCfileMode(const uint8_t *); diff --git a/net/http/escapejsstringliteral.c b/net/http/escapejsstringliteral.c index ca8cf274f..a5b49d593 100644 --- a/net/http/escapejsstringliteral.c +++ b/net/http/escapejsstringliteral.c @@ -16,11 +16,23 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/bits/likely.h" #include "libc/str/thompike.h" #include "libc/str/utf16.h" #include "libc/x/x.h" #include "net/http/escape.h" +static const char kEscapeLiteral[128] = { + 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 2, 9, 4, 3, 9, 9, // 0x00 + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 0x10 + 0, 0, 7, 0, 0, 0, 9, 8, 0, 0, 0, 0, 0, 0, 0, 6, // 0x20 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 0, // 0x30 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x40 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, // 0x50 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x60 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, // 0x70 +}; + /** * Escapes UTF-8 data for JavaScript or JSON string literal. * @@ -66,141 +78,51 @@ char *EscapeJsStringLiteral(const char *p, size_t n, size_t *z) { } } } - switch (x) { - case ' ': - case '!': - case '#': - case '$': - case '%': - case '(': - case ')': - case '*': - case '+': - case ',': - case '-': - case '.': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case ':': - case ';': - case '?': - case '@': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '[': - case ']': - case '^': - case '_': - case '`': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': - case '{': - case '|': - case '}': - case '~': + switch (0 <= x && x <= 127 ? kEscapeLiteral[x] : 9) { + case 0: *q++ = x; break; - case '\t': + case 1: q[0] = '\\'; q[1] = 't'; q += 2; break; - case '\n': + case 2: q[0] = '\\'; q[1] = 'n'; q += 2; break; - case '\r': + case 3: q[0] = '\\'; q[1] = 'r'; q += 2; break; - case '\f': + case 4: q[0] = '\\'; q[1] = 'f'; q += 2; break; - case '\\': + case 5: q[0] = '\\'; q[1] = '\\'; q += 2; break; - case '/': + case 6: q[0] = '\\'; q[1] = '/'; q += 2; break; - case '"': + case 7: q[0] = '\\'; q[1] = '"'; q += 2; break; - case '\'': + case 8: q[0] = '\\'; q[1] = '\''; q += 2; break; - case '<': - case '>': - case '&': - case '=': - default: + case 9: w = EncodeUtf16(x); do { q[0] = '\\'; @@ -212,6 +134,8 @@ char *EscapeJsStringLiteral(const char *p, size_t n, size_t *z) { q += 6; } while ((w >>= 16)); break; + default: + unreachable; } } if (z) *z = q - r; diff --git a/net/http/geturischeme.gperf b/net/http/geturischeme.gperf deleted file mode 100644 index 8c70ccb6b..000000000 --- a/net/http/geturischeme.gperf +++ /dev/null @@ -1,24 +0,0 @@ -%{ -#include "libc/str/str.h" -#include "net/http/uri.h" -#define GPERF_DOWNCASE -%} -%compare-strncmp -%ignore-case -%language=ANSI-C -%pic -%readonly-tables -%struct-type -struct UriSchemeSlot { unsigned char name; unsigned char code; }; -%% -http,kUriSchemeHttp -https,kUriSchemeHttps -file,kUriSchemeFile -data,kUriSchemeData -zip,kUriSchemeZip -sip,kUriSchemeSip -sips,kUriSchemeSips -tel,kUriSchemeTel -ssh,kUriSchemeSsh -gs,kUriSchemeGs -s3,kUriSchemeS3 diff --git a/net/http/geturischeme.inc b/net/http/geturischeme.inc deleted file mode 100644 index b02cce378..000000000 --- a/net/http/geturischeme.inc +++ /dev/null @@ -1,213 +0,0 @@ -/* ANSI-C code produced by gperf version 3.0.4 */ -/* Command-line: gperf net/http/geturischeme.gperf */ -/* Computed positions: -k'1-2' */ - -#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ - && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ - && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ - && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ - && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ - && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ - && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ - && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ - && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ - && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ - && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ - && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ - && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ - && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ - && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ - && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ - && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ - && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ - && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ - && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ - && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ - && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ - && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) -/* The character set is not based on ISO-646. */ -#error "gperf generated tables don't work with this execution character set. Please report a bug to ." -#endif - -#line 1 "net/http/geturischeme.gperf" - -#include "libc/str/str.h" -#include "net/http/uri.h" -#define GPERF_DOWNCASE -#line 12 "net/http/geturischeme.gperf" -struct UriSchemeSlot { unsigned char name; unsigned char code; }; - -#define TOTAL_KEYWORDS 11 -#define MIN_WORD_LENGTH 2 -#define MAX_WORD_LENGTH 5 -#define MIN_HASH_VALUE 2 -#define MAX_HASH_VALUE 19 -/* maximum key range = 18, duplicates = 0 */ - -#ifndef GPERF_DOWNCASE -#define GPERF_DOWNCASE 1 -static unsigned char gperf_downcase[256] = - { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255 - }; -#endif - -#ifndef GPERF_CASE_STRNCMP -#define GPERF_CASE_STRNCMP 1 -static int -gperf_case_strncmp (register const char *s1, register const char *s2, register unsigned int n) -{ - for (; n > 0;) - { - unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; - unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; - if (c1 != 0 && c1 == c2) - { - n--; - continue; - } - return (int)c1 - (int)c2; - } - return 0; -} -#endif - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static unsigned int -hash (register const char *str, register unsigned int len) -{ - static const unsigned char asso_values[] = - { - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 5, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 10, 20, 20, 5, 15, - 5, 0, 0, 5, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 0, 0, 20, 20, 20, 20, 20, - 5, 20, 20, 20, 20, 20, 20, 10, 20, 20, - 5, 15, 5, 0, 0, 5, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 0, 0, 20, 20, 20, - 20, 20, 5, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20 - }; - return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]]; -} - -struct stringpool_t - { - char stringpool_str2[sizeof("gs")]; - char stringpool_str3[sizeof("ssh")]; - char stringpool_str4[sizeof("http")]; - char stringpool_str5[sizeof("https")]; - char stringpool_str7[sizeof("s3")]; - char stringpool_str8[sizeof("sip")]; - char stringpool_str9[sizeof("sips")]; - char stringpool_str13[sizeof("zip")]; - char stringpool_str14[sizeof("file")]; - char stringpool_str18[sizeof("tel")]; - char stringpool_str19[sizeof("data")]; - }; -static const struct stringpool_t stringpool_contents = - { - "gs", - "ssh", - "http", - "https", - "s3", - "sip", - "sips", - "zip", - "file", - "tel", - "data" - }; -#define stringpool ((const char *) &stringpool_contents) -const struct UriSchemeSlot * -in_word_set (register const char *str, register unsigned int len) -{ - static const struct UriSchemeSlot wordlist[] = - { - {-1}, {-1}, -#line 23 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str2,kUriSchemeGs}, -#line 22 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str3,kUriSchemeSsh}, -#line 14 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str4,kUriSchemeHttp}, -#line 15 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str5,kUriSchemeHttps}, - {-1}, -#line 24 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str7,kUriSchemeS3}, -#line 19 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str8,kUriSchemeSip}, -#line 20 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str9,kUriSchemeSips}, - {-1}, {-1}, {-1}, -#line 18 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str13,kUriSchemeZip}, -#line 16 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str14,kUriSchemeFile}, - {-1}, {-1}, {-1}, -#line 21 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str18,kUriSchemeTel}, -#line 17 "net/http/geturischeme.gperf" - {(int)(long)&((struct stringpool_t *)0)->stringpool_str19,kUriSchemeData} - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - { - register int o = wordlist[key].name; - if (o >= 0) - { - register const char *s = o + stringpool; - - if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0') - return &wordlist[key]; - } - } - } - return 0; -} diff --git a/net/http/parseurl.c b/net/http/parseurl.c index cc75a4b44..fd1767bb9 100644 --- a/net/http/parseurl.c +++ b/net/http/parseurl.c @@ -24,21 +24,21 @@ #include "net/http/url.h" struct UrlParser { - int i; + unsigned i; int c; const char *data; - int size; - bool isform; - bool islatin1; - bool isopaque; + size_t size; + char isform; + char islatin1; + char isopaque; char *p; char *q; }; -static void EmitLatin1(struct UrlParser *u, int c) { - u->p[0] = 0300 | c >> 6; - u->p[1] = 0200 | c & 077; - u->p += 2; +static void EmitLatin1(char **p, int c) { + (*p)[0] = 0300 | c >> 6; + (*p)[1] = 0200 | c & 077; + *p += 2; } static bool EmitKey(struct UrlParser *u, struct UrlParams *h) { @@ -115,16 +115,18 @@ static bool ParseScheme(struct UrlParser *u, struct Url *h) { ParseEscape(u); return false; } else if (u->c >= 0200 && u->islatin1) { - EmitLatin1(u, u->c); + EmitLatin1(&u->p, u->c); return false; } else { *u->p++ = u->c; if (u->i == 1) { - if (!isalpha(u->c)) { + if (!(('A' <= u->c && u->c <= 'Z') || ('a' <= u->c && u->c <= 'z'))) { return false; } } else { - if (!isalnum(u->c) && u->c != '+' && u->c != '-' && u->c != '.') { + if (!(('0' <= u->c && u->c <= '9') || ('A' <= u->c && u->c <= 'Z') || + ('a' <= u->c && u->c <= 'z') || u->c == '+' || u->c == '-' || + u->c == '.')) { return false; } } @@ -134,17 +136,17 @@ static bool ParseScheme(struct UrlParser *u, struct Url *h) { } static void ParseAuthority(struct UrlParser *u, struct Url *h) { - int t = 0; + unsigned t = 1; const char *c = NULL; while (u->i < u->size) { u->c = u->data[u->i++] & 0xff; if (u->c == '/' || u->c == '#' || u->c == '?') { break; } else if (u->c == '[') { - t = -1; - } else if (u->c == ']') { t = 0; - } else if (u->c == ':' && t >= 0) { + } else if (u->c == ']') { + t = 1; + } else if (u->c == ':' && t > 0) { *u->p++ = ':'; c = u->p; ++t; @@ -155,7 +157,7 @@ static void ParseAuthority(struct UrlParser *u, struct Url *h) { h->pass.p = c; h->pass.n = u->p - c; c = NULL; - t = 0; + t = 1; } else { h->user.p = u->q; h->user.n = u->p - u->q; @@ -164,12 +166,12 @@ static void ParseAuthority(struct UrlParser *u, struct Url *h) { } else if (u->c == '%') { ParseEscape(u); } else if (u->c >= 0200 && u->islatin1) { - EmitLatin1(u, u->c); + EmitLatin1(&u->p, u->c); } else { *u->p++ = u->c; } } - if (t == 1) { + if (t == 2) { h->host.p = u->q; h->host.n = c - 1 - u->q; h->port.p = c; @@ -195,7 +197,7 @@ static void ParsePath(struct UrlParser *u, struct UrlView *h) { } else if (u->c == '%') { ParseEscape(u); } else if (u->c >= 0200 && u->islatin1) { - EmitLatin1(u, u->c); + EmitLatin1(&u->p, u->c); } else { *u->p++ = u->c; } @@ -226,7 +228,7 @@ static void ParseQuery(struct UrlParser *u, struct UrlParams *h) { *u->p++ = '='; } } else if (u->c >= 0200 && u->islatin1) { - EmitLatin1(u, u->c); + EmitLatin1(&u->p, u->c); } else { *u->p++ = u->c; } @@ -240,7 +242,7 @@ static void ParseFragment(struct UrlParser *u, struct UrlView *h) { if (u->c == '%') { ParseEscape(u); } else if (u->c >= 0200 && u->islatin1) { - EmitLatin1(u, u->c); + EmitLatin1(&u->p, u->c); } else { *u->p++ = u->c; } @@ -258,8 +260,8 @@ static char *ParseUrlImpl(const char *data, size_t size, struct Url *h, u.i = 0; u.c = 0; u.isform = false; - u.islatin1 = latin1; u.isopaque = false; + u.islatin1 = latin1; u.data = data; u.size = size; memset(h, 0, sizeof(*h)); diff --git a/test/libc/calls/writev_test.c b/test/libc/calls/writev_test.c index 0c712743a..ac7c99980 100644 --- a/test/libc/calls/writev_test.c +++ b/test/libc/calls/writev_test.c @@ -18,9 +18,12 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/calls/struct/iovec.h" +#include "libc/dce.h" #include "libc/errno.h" #include "libc/macros.internal.h" +#include "libc/runtime/runtime.h" #include "libc/sock/sock.h" +#include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/o.h" #include "libc/testlib/testlib.h" @@ -59,6 +62,29 @@ TEST(writev, big_fullCompletion) { EXPECT_NE(-1, close(fd)); } +TEST(writev, asanError_efaults) { + if (!IsAsan()) return; + void *malloc_(size_t) asm("malloc"); + void free_(void *) asm("free"); + void *p; + int fd; + p = malloc_(32); + EXPECT_NE(-1, (fd = open("asan", O_RDWR | O_CREAT | O_TRUNC, 0644))); + EXPECT_EQ(32, write(fd, p, 32)); + EXPECT_NE(-1, lseek(fd, 0, SEEK_SET)); + EXPECT_EQ(32, read(fd, p, 32)); + EXPECT_EQ(-1, write(fd, p, 33)); + EXPECT_EQ(EFAULT, errno); + EXPECT_EQ(-1, write(fd, p, -1)); + EXPECT_EQ(EFAULT, errno); + free_(p); + EXPECT_EQ(-1, write(fd, p, 32)); + EXPECT_EQ(EFAULT, errno); + EXPECT_EQ(-1, read(fd, p, 32)); + EXPECT_EQ(EFAULT, errno); + close(fd); +} + TEST(writev, empty_stillPerformsIoOperation) { int fd; struct iovec iov[] = {{"", 0}, {NULL, 0}}; diff --git a/test/libc/fmt/fmt_test.c b/test/libc/fmt/fmt_test.c index 644a76cfb..f35670f9a 100644 --- a/test/libc/fmt/fmt_test.c +++ b/test/libc/fmt/fmt_test.c @@ -276,3 +276,8 @@ TEST(fmt, p) { EXPECT_STREQ("0xffff800000031337", gc(xasprintf("% 10p", 0xffff800000031337))); } + +/* TEST(fmt, funchar) { */ +/* /\* TODO(jart): fix this *\/ */ +/* ASSERT_STREQ("'\\200'", gc(xasprintf("%`'c", 0200))); */ +/* } */ diff --git a/test/libc/intrin/asan_test.c b/test/libc/intrin/asan_test.c new file mode 100644 index 000000000..4cb34740e --- /dev/null +++ b/test/libc/intrin/asan_test.c @@ -0,0 +1,42 @@ +/*-*- 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/dce.h" +#include "libc/intrin/asan.internal.h" +#include "libc/mem/mem.h" +#include "libc/testlib/testlib.h" + +TEST(asan, test) { + char *p; + if (!IsAsan()) return; + p = gc(malloc(3)); + EXPECT_TRUE(__asan_is_valid(p, 3)); + EXPECT_FALSE(__asan_is_valid(p, 4)); + EXPECT_TRUE(__asan_is_valid(p + 1, 2)); + EXPECT_FALSE(__asan_is_valid(p + 1, 3)); + p = gc(malloc(8 + 3)); + EXPECT_TRUE(__asan_is_valid(p, 8 + 3)); + EXPECT_FALSE(__asan_is_valid(p, 8 + 4)); + EXPECT_TRUE(__asan_is_valid(p + 1, 8 + 2)); + EXPECT_FALSE(__asan_is_valid(p + 1, 8 + 3)); + p = gc(malloc(64 + 3)); + EXPECT_TRUE(__asan_is_valid(p, 64 + 3)); + EXPECT_FALSE(__asan_is_valid(p, 64 + 4)); + EXPECT_TRUE(__asan_is_valid(p + 1, 64 + 2)); + EXPECT_FALSE(__asan_is_valid(p + 1, 64 + 3)); +} diff --git a/test/libc/intrin/test.mk b/test/libc/intrin/test.mk index cfe41817e..a36d3189c 100644 --- a/test/libc/intrin/test.mk +++ b/test/libc/intrin/test.mk @@ -26,6 +26,7 @@ TEST_LIBC_INTRIN_DIRECTDEPS = \ LIBC_FMT \ LIBC_INTRIN \ LIBC_LOG \ + LIBC_MEM \ LIBC_NEXGEN32E \ LIBC_RAND \ LIBC_RUNTIME \ diff --git a/test/libc/str/regex_test.c b/test/libc/str/regex_test.c index 9cfc55c13..ab92eb74c 100644 --- a/test/libc/str/regex_test.c +++ b/test/libc/str/regex_test.c @@ -154,4 +154,17 @@ BENCH(regex, bench) { EZBENCH2("precompiled nosub match", donothing, D(&rx, m)); free(m); regfree(&rx); + EXPECT_EQ(REG_OK, regcomp(&rx, "^[a-z]*$", REG_EXTENDED | REG_NOSUB)); + m = calloc(rx.re_nsub + 1, sizeof(regmatch_t)); + EZBENCH2("precompiled alpha", donothing, + regexec(&rx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 0)); + free(m); + regfree(&rx); + EXPECT_EQ(REG_OK, + regcomp(&rx, "^[a-z]*$", REG_EXTENDED | REG_NOSUB | REG_ICASE)); + m = calloc(rx.re_nsub + 1, sizeof(regmatch_t)); + EZBENCH2("precompiled alpha icase", donothing, + regexec(&rx, "aaaaaaaaaaaaaaaAAAAAAAAAAAAAA", 0, 0, 0)); + free(m); + regfree(&rx); } diff --git a/third_party/zlib/internal.h b/third_party/zlib/internal.h index 3888cfc08..2ef2a6727 100644 --- a/third_party/zlib/internal.h +++ b/third_party/zlib/internal.h @@ -18,7 +18,7 @@ void crc_fold_copy(struct DeflateState *const, unsigned char *, const unsigned char *, long) hidden; unsigned crc_fold_512to32(struct DeflateState *const) hidden; void fill_window_sse(struct DeflateState *) hidden; -void *zcalloc(void *, unsigned, unsigned) hidden; +void *zcalloc(void *, uInt, uInt) hidden; void zcfree(void *, void *) hidden; COSMOPOLITAN_C_END_ diff --git a/third_party/zlib/zalloc.c b/third_party/zlib/zalloc.c index e791f50e7..6007da99b 100644 --- a/third_party/zlib/zalloc.c +++ b/third_party/zlib/zalloc.c @@ -20,7 +20,7 @@ #include "libc/mem/mem.h" #include "third_party/zlib/zutil.internal.h" -void *zcalloc(void *opaque, unsigned items, unsigned size) { +void *zcalloc(void *opaque, uInt items, uInt size) { return weaken(malloc)(items * size); } diff --git a/third_party/zlib/zconf.h b/third_party/zlib/zconf.h index 9147e264a..5a7d7272f 100644 --- a/third_party/zlib/zconf.h +++ b/third_party/zlib/zconf.h @@ -5,12 +5,12 @@ #define STDC99 #define MAX_MEM_LEVEL 9 #define DEF_MEM_LEVEL 8 -#define MAX_WBITS 15 /* 32K LZ77 window */ +#define MAX_WBITS 15 /* 32K LZ77 window */ #if !(__ASSEMBLER__ + __LINKER__ + 0) typedef unsigned char Byte; -typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ typedef Byte Bytef; typedef char charf; diff --git a/tool/build/compile.c b/tool/build/compile.c index b52435c5f..43709fbe2 100644 --- a/tool/build/compile.c +++ b/tool/build/compile.c @@ -91,6 +91,9 @@ bool wantpg; bool wantrecord; bool wantubsan; bool touchtarget; +bool no_sanitize_null; +bool no_sanitize_alignment; +bool no_sanitize_pointer_overflow; char *cmd; char *comdbg; @@ -400,6 +403,12 @@ int main(int argc, char *argv[]) { } else if (!strcmp(argv[i], "-fno-sanitize=all")) { wantasan = false; wantubsan = false; + } else if (!strcmp(argv[i], "-fno-sanitize=null")) { + if (isgcc && ccversion >= 6) no_sanitize_null = true; + } else if (!strcmp(argv[i], "-fno-sanitize=alignment")) { + if (isgcc && ccversion >= 6) no_sanitize_alignment = true; + } else if (!strcmp(argv[i], "-fno-sanitize=pointer-overflow")) { + if (isgcc && ccversion >= 6) no_sanitize_pointer_overflow = true; } else if (startswith(argv[i], "-fsanitize=implicit") && strstr(argv[i], "integer")) { if (isgcc) AddArg(argv[i]); @@ -470,6 +479,15 @@ int main(int argc, char *argv[]) { AddArg("-fsanitize=undefined"); AddArg("-fno-data-sections"); } + if (no_sanitize_null) { + AddArg("-fno-sanitize=null"); + } + if (no_sanitize_alignment) { + AddArg("-fno-sanitize=alignment"); + } + if (no_sanitize_pointer_overflow) { + AddArg("-fno-sanitize=pointer-overflow"); + } if (wantframe) { AddArg("-fno-omit-frame-pointer"); } diff --git a/tool/build/lib/errnos.S b/tool/build/lib/errnos.S index e55c7d251..d665d880e 100644 --- a/tool/build/lib/errnos.S +++ b/tool/build/lib/errnos.S @@ -21,14 +21,14 @@ .macro .errno local:req linux:req .globl \local .long \local-kLinuxErrnos - .long \linux + .byte \linux .endm // Lookup table translating errnos between systems. // // @see libc/sysv/systemfive.S .rodata - .align 8 + .align 4 kLinuxErrnos: .errno EPERM,1 .errno ENOENT,2 @@ -85,47 +85,18 @@ kLinuxErrnos: .errno EAFNOSUPPORT,97 .errno EADDRINUSE,98 .errno EADDRNOTAVAIL,99 - .errno ECHRNG,44 .errno EL2NSYNC,45 .errno EL3HLT,46 .errno EL3RST,47 .errno ELNRNG,48 - .errno EUNATCH,49 - .errno ENOCSI,50 - .errno EL2HLT,51 - .errno EBADE,52 - .errno EBADR,53 - .errno EXFULL,54 - .errno ENOANO,55 - .errno EBADRQC,56 - .errno EBADSLT,57 - .errno ENOSTR,60 - .errno ENODATA,61 .errno ETIME,62 - .errno ENOSR,63 .errno ENONET,64 - .errno ENOPKG,65 .errno EREMOTE,66 - .errno ENOLINK,67 - .errno EADV,68 - .errno ESRMNT,69 - .errno ECOMM,70 .errno EPROTO,71 - .errno EMULTIHOP,72 - .errno EDOTDOT,73 .errno EBADMSG,74 .errno EOVERFLOW,75 - .errno ENOTUNIQ,76 - .errno EBADFD,77 - .errno EREMCHG,78 - .errno ELIBACC,79 - .errno ELIBBAD,80 - .errno ELIBSCN,81 - .errno ELIBMAX,82 - .errno ELIBEXEC,83 .errno EILSEQ,84 .errno ERESTART,85 - .errno ESTRPIPE,86 .errno ENETDOWN,100 .errno ENETUNREACH,101 .errno ENETRESET,102 @@ -143,23 +114,10 @@ kLinuxErrnos: .errno EALREADY,114 .errno EINPROGRESS,115 .errno ESTALE,116 - .errno EUCLEAN,117 - .errno ENOTNAM,118 - .errno ENAVAIL,119 - .errno EISNAM,120 - .errno EREMOTEIO,121 .errno EDQUOT,122 - .errno ENOMEDIUM,123 - .errno EMEDIUMTYPE,124 .errno ECANCELED,125 - .errno ENOKEY,126 - .errno EKEYEXPIRED,127 - .errno EKEYREVOKED,128 - .errno EKEYREJECTED,129 .errno EOWNERDEAD,130 .errno ENOTRECOVERABLE,131 - .errno ERFKILL,132 - .errno EHWPOISON,133 + .long 0 + .byte 0 .endobj kLinuxErrnos,globl - kLinuxErrnosLength = (.-kLinuxErrnos)/8 - .globl kLinuxErrnosLength diff --git a/tool/build/lib/xlaterrno.c b/tool/build/lib/xlaterrno.c index a13e2405f..8e91c2462 100644 --- a/tool/build/lib/xlaterrno.c +++ b/tool/build/lib/xlaterrno.c @@ -21,42 +21,21 @@ #include "libc/runtime/carsort.h" #include "tool/build/lib/xlaterrno.h" -struct LinuxErrno { +struct thatispacked LinuxErrno { int32_t local; - int32_t linux; + uint8_t linux; }; -extern const char kLinuxErrnosLength[]; extern const struct LinuxErrno kLinuxErrnos[]; -static struct LinuxErrno *errnos; /** * Turns local errno into Linux errno. */ int XlatErrno(int local) { - static bool once; - long i, n, m, l, r; - n = (uintptr_t)kLinuxErrnosLength; - if (!once) { - errnos = malloc(sizeof(struct LinuxErrno) * n); - for (i = 0; i < n; ++i) { - errnos[i].local = - *(int *)((intptr_t)kLinuxErrnos + kLinuxErrnos[i].local); - errnos[i].linux = kLinuxErrnos[i].linux; - } - carsort100(n, (void *)errnos); - once = true; - } - l = 0; - r = n - 1; - while (l <= r) { - m = (l + r) / 2; - if (errnos[m].local < local) { - l = m + 1; - } else if (errnos[m].local > local) { - r = m - 1; - } else { - return errnos[m].linux; + int i; + for (i = 0; kLinuxErrnos[i].local; ++i) { + if (local == *(int *)((intptr_t)kLinuxErrnos + kLinuxErrnos[i].local)) { + return kLinuxErrnos[i].linux; } } return ENOSYS; diff --git a/tool/build/runit.c b/tool/build/runit.c index 99a8f86b6..cdf58e524 100644 --- a/tool/build/runit.c +++ b/tool/build/runit.c @@ -42,7 +42,6 @@ #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/sysv/consts/af.h" -#include "libc/sysv/consts/ai.h" #include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/exit.h" #include "libc/sysv/consts/f.h" diff --git a/tool/decode/lib/socknames.c b/tool/decode/lib/socknames.c index 810db2af1..f595987de 100644 --- a/tool/decode/lib/socknames.c +++ b/tool/decode/lib/socknames.c @@ -19,7 +19,6 @@ #include "libc/dns/dns.h" #include "libc/sock/sock.h" #include "libc/sysv/consts/af.h" -#include "libc/sysv/consts/ai.h" #include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/sock.h" #include "tool/decode/lib/socknames.h" diff --git a/tool/decode/zip.c b/tool/decode/zip.c index 151f74bd6..a9187e056 100644 --- a/tool/decode/zip.c +++ b/tool/decode/zip.c @@ -390,6 +390,13 @@ void ShowCentralDirHeader64(uint8_t *cd) { printf("0:"); disassemblehex(ZIP_CDIR64_COMMENT(cd), ZIP_CDIR64_COMMENTSIZE(cd), stdout); printf("1:\n"); + cd += ZIP_CDIR64_HDRSIZE(cd); + printf("\n/\t%s (%zu %s)\n", "zip64 end of central directory locator", + kZipCdir64LocatorSize, "bytes"); + show(".ascii", format(b1, "%`'.*s", 4, cd), "magic"); + show(".long", format(b1, "%d", READ32LE(cd + 4)), "startingdisk"); + show(".quad", format(b1, "%lu", READ64LE(cd + 4 + 4)), "eocd64 offset"); + show(".long", format(b1, "%d", READ32LE(cd + 4 + 4 + 8)), "totaldisks"); } uint8_t *GetZipCdir32(const uint8_t *p, size_t n) { @@ -406,12 +413,13 @@ uint8_t *GetZipCdir32(const uint8_t *p, size_t n) { } uint8_t *GetZipCdir64(const uint8_t *p, size_t n) { - size_t i; - if (n >= kZipCdir64HdrMinSize) { - i = n - kZipCdir64HdrMinSize; + uint64_t i, j; + if (n >= kZipCdir64LocatorSize) { + i = n - kZipCdir64LocatorSize; do { - if (READ32LE(p + i) == kZipCdir64HdrMagic && IsZipCdir64(p, n, i)) { - return (/*unconst*/ uint8_t *)(p + i); + if (READ32LE(p + i) == kZipCdir64LocatorMagic && + (j = ZIP_LOCATE64_OFFSET(p + i)) + kZipCdir64HdrMinSize <= n) { + return p + j; } } while (i--); } @@ -451,6 +459,7 @@ void DisassembleZip(const char *path, uint8_t *p, size_t n) { ShowCentralFileHeader(cf); pos = (cf - p) + ZIP_CFILE_HDRSIZE(cf); } + /* TODO(jart): This is absurd. */ if (eocd32 && eocd64) { if (eocd32 < eocd64) { ShowCentralDirHeader32(eocd32); @@ -458,8 +467,12 @@ void DisassembleZip(const char *path, uint8_t *p, size_t n) { ShowCentralDirHeader64(eocd64); AdvancePosition(p, &pos, eocd64 - p); } else { + /* pos = eocd64 - p + ZIP_CDIR_HDRSIZE(eocd64); */ + /* AdvancePosition(p, &pos, n); */ ShowCentralDirHeader64(eocd64); AdvancePosition(p, &pos, eocd64 - p); + /* pos = eocd32 - p + ZIP_CDIR_HDRSIZE(eocd32); */ + /* AdvancePosition(p, &pos, n); */ ShowCentralDirHeader32(eocd32); AdvancePosition(p, &pos, eocd32 - p); } @@ -470,11 +483,7 @@ void DisassembleZip(const char *path, uint8_t *p, size_t n) { ShowCentralDirHeader64(eocd64); AdvancePosition(p, &pos, eocd64 - p); } - if (!eocd64 || eocd32 > eocd64) { - pos = eocd32 - p + ZIP_CDIR_HDRSIZE(eocd32); - } else { - pos = eocd64 - p + ZIP_CDIR_HDRSIZE(eocd64); - } + pos = n; AdvancePosition(p, &pos, n); } diff --git a/tool/emacs/cosmo-stuff.el b/tool/emacs/cosmo-stuff.el index 27aa4227e..2843afa14 100644 --- a/tool/emacs/cosmo-stuff.el +++ b/tool/emacs/cosmo-stuff.el @@ -440,7 +440,10 @@ (interactive "P") (setq arg (or arg 2)) ;; -ffast-math -funsafe-math-optimizations -fsched2-use-superblocks -fjump-tables - (cond ((not (eq 0 (logand 8 arg))) + (cond ((eq arg 9) + (cosmo--assembly 1 + "V=1 OVERRIDE_COPTS='-fverbose-asm -fsanitize=undefined -fno-sanitize=null -fno-sanitize=alignment -fno-sanitize=pointer-overflow'")) + ((not (eq 0 (logand 8 arg))) (cosmo--assembly (setq arg (logand (lognot 8))) "V=1 OVERRIDE_COPTS='-fverbose-asm -fsanitize=address'")) (t (cosmo--assembly arg "V=1 OVERRIDE_COPTS='' CPPFLAGS='-DSTACK_FRAME_UNLIMITED'")))) diff --git a/tool/net/.help.txt b/tool/net/.help.txt new file mode 100644 index 000000000..5ec858a2d --- /dev/null +++ b/tool/net/.help.txt @@ -0,0 +1,158 @@ +SYNOPSIS + + redbean.com [-hvduzmbagf] [-p PORT] [-- SCRIPTARGS...] + +DESCRIPTION + + redbean - single-file distributable web server + +FLAGS + + -h help + -s increase silence [repeat] + -v increase verbosity [repeat] + -d daemonize + -u uniprocess + -z print port + -m log messages + -b log message body + -a log resource usage + -g log handler latency + -f log worker function calls + -H K:V sets http header globally [repeat] + -D DIR serve assets from local directory [repeat] + -t MS tunes read and write timeouts [default 30000] + -M INT tunes max message payload size [default 65536] + -c SEC configures static asset cache-control headers + -r /X=/Y redirect X to Y [repeat] + -R /X=/Y rewrites X to Y [repeat] + -l ADDR listen ip [default 0.0.0.0] + -p PORT listen port [default 8080] + -L PATH log file location + -P PATH pid file location + -U INT daemon set user id + -G INT daemon set group id + +FEATURES + + - Lua v5.4 + - HTTP v0.9 + - HTTP v1.0 + - HTTP v1.1 + - Pipelining + - Accounting + - Content-Encoding + - Range / Content-Range + - Last-Modified / If-Modified-Since + +USAGE + + This executable is also a ZIP file that contains static assets. + You can run redbean interactively in your terminal as follows: + + ./redbean.com -vvvmbag # starts server verbosely + open http://127.0.0.1:8080/ # shows zip listing page + CTRL-C # 1x: graceful shutdown + CTRL-C # 2x: forceful shutdown + + You can override the default listing page by adding: + + zip redbean.com index.lua # lua server pages take priority + zip redbean.com index.html # default page for directory + + The listing page only applies to the root directory. However the + default index page applies to subdirectories too. In order for it + to work, there needs to be an empty directory entry in the zip. + That should already be the default practice of your zip editor. + + wget \ + --mirror \ + --convert-links \ + --adjust-extension \ + --page-requisites \ + --no-parent \ + --no-if-modified-since \ + http://a.example/index.html + zip -r redbean.com a.example/ # default page for directory + + redbean normalizes the trailing slash for you automatically: + + $ printf 'GET /a.example HTTP/1.0\n\n' | nc 127.0.0.1 8080 + HTTP/1.0 307 Temporary Redirect + Location: /a.example/ + + Virtual hosting is accomplished this way too. The Host is simply + prepended to the path, and if it doesn't exist, it gets removed. + + $ printf 'GET / HTTP/1.1\nHost:a.example\n\n' | nc 127.0.0.1 8080 + HTTP/1.1 200 OK + Link: ; rel="canonical" + + If you mirror a lot of websites within your redbean then you can + actually tell your browser that redbean is your proxy server, in + which redbean will act as your private version of the Internet. + + $ printf 'GET http://a.example HTTP/1.0\n\n' | nc 127.0.0.1 8080 + HTTP/1.0 200 OK + Link: ; rel="canonical" + + If you use a reverse proxy, then redbean recognizes the following + provided that the proxy forwards requests over the local network: + + X-Forwarded-For: 203.0.113.42:31337 + X-Forwarded-Host: foo.example:80 + + There's a text/plain statistics page called /statusz that makes + it easy to track and monitor the health of your redbean: + + printf 'GET /statusz\n\n' | nc 127.0.0.1 8080 + + redbean will display an error page using the /redbean.png logo + by default, embedded as a bas64 data uri. You can override the + custom page for various errors by adding files to the zip root. + + zip redbean.com 404.html # custom not found page + + Audio video content should not be compressed in your ZIP files. + Uncompressed assets enable browsers to send Range HTTP request. + On the other hand compressed assets are best for gzip encoding. + + zip redbean.com index.html # adds file + zip -0 redbean.com video.mp4 # adds without compression + + You can have redbean run as a daemon by doing the following: + + redbean.com -vv -d -L redbean.log -P redbean.pid + kill -TERM $(cat redbean.pid) # 1x: graceful shutdown + kill -TERM $(cat redbean.pid) # 2x: forceful shutdown + + redbean currently has a 32kb limit on request messages and 64kb + including the payload. redbean will grow to whatever the system + limits allow. Should fork() or accept() fail redbean will react + by going into "meltdown mode" which closes lingering workers. + You can trigger this at any time using: + + kill -USR2 $(cat redbean.pid) + + Another failure condition is running out of disk space in which + case redbean reacts by truncating the log file. Lastly, redbean + does the best job possible reporting on resource usage when the + logger is in debug mode noting that NetBSD is the best at this. + + Your redbean is an actually portable executable, that's able to + run on six different operating systems. To do that, it needs to + overwrite its own MZ header at startup, with ELF or Mach-O, and + then puts the original back once the program loads. If you want + your redbean to follow the platform-local executable convention + then delete the /.ape file from zip. + + redbean contains software licensed ISC, MIT, BSD-2, BSD-3, zlib + which makes it a permissively licensed gift to anyone who might + find it useful. The transitive closure of legalese can be found + inside the binary. redbean also respects your privacy and won't + phone home because your computer is its home. + +SEE ALSO + + https://justine.lol/redbean/index.html + https://news.ycombinator.com/item?id=26271117 diff --git a/tool/net/demo/redbean.lua b/tool/net/demo/redbean.lua index 43fd7e638..be9996206 100644 --- a/tool/net/demo/redbean.lua +++ b/tool/net/demo/redbean.lua @@ -164,7 +164,7 @@ local function main() Write(EscapeHtml(VisualizeControlCodes(GetFragment()))) Write('\r\n') end - Write('
GetRemoteAddr() (from Bekeley Sockets or X-Forwarded-For header)\r\n') + Write('
GetRemoteAddr() (from Berkeley Sockets or X-Forwarded-For header)\r\n') Write('
') ip, port = GetRemoteAddr() Write(string.format('%s, %d', FormatIp(ip), port)) diff --git a/tool/net/dig.c b/tool/net/dig.c index ab56fa116..2c734bbf8 100644 --- a/tool/net/dig.c +++ b/tool/net/dig.c @@ -23,7 +23,6 @@ #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/sysv/consts/af.h" -#include "libc/sysv/consts/ai.h" #include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/sock.h" #include "tool/decode/lib/flagger.h" @@ -44,7 +43,8 @@ void lookup(const char *name) { perror("getaddrinfo"); exit(1); default: - fprintf(stderr, "getaddrinfo failed: %d (EAI_%s)\n", rc, gai_strerror(rc)); + fprintf(stderr, "getaddrinfo failed: %d (EAI_%s)\n", rc, + gai_strerror(rc)); exit(1); } if (addrs) { diff --git a/tool/net/net.mk b/tool/net/net.mk index 8750ca008..c61ee0bba 100644 --- a/tool/net/net.mk +++ b/tool/net/net.mk @@ -72,12 +72,13 @@ o/$(MODE)/tool/net/redbean.com.dbg: \ o/$(MODE)/tool/net/redbean.com: \ o/$(MODE)/tool/net/redbean.com.dbg \ tool/net/net.mk \ + tool/net/.help.txt \ tool/net/.init.lua \ tool/net/favicon.ico \ tool/net/redbean.png @$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@ @$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.ape bs=64 count=11 conv=notrunc 2>/dev/null - @$(COMPILE) -AZIP -T$@ zip -qj $@ o/$(MODE)/tool/net/.ape tool/net/.init.lua tool/net/favicon.ico tool/net/redbean.png + @$(COMPILE) -AZIP -T$@ zip -qj $@ o/$(MODE)/tool/net/.ape tool/net/.help.txt tool/net/.init.lua tool/net/favicon.ico tool/net/redbean.png o/$(MODE)/tool/net/redbean-demo.com.dbg: \ o/$(MODE)/tool/net/redbean.com.dbg @@ -88,6 +89,7 @@ o/$(MODE)/tool/net/redbean-demo.com: \ tool/net/net.mk \ tool/net/favicon.ico \ tool/net/redbean.png \ + tool/net/.help.txt \ tool/net/demo/.init.lua \ tool/net/demo/.reload.lua \ tool/net/demo/404.html \ @@ -108,7 +110,7 @@ o/$(MODE)/tool/net/redbean-demo.com: \ @$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@ @$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/.redbean-demo @$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.redbean-demo/.ape bs=64 count=11 conv=notrunc 2>/dev/null - @$(COMPILE) -AZIP -T$@ zip -qj $@ o/$(MODE)/tool/net/.redbean-demo/.ape tool/net/demo/.init.lua tool/net/demo/.reload.lua tool/net/demo/hello.lua + @$(COMPILE) -AZIP -T$@ zip -qj $@ o/$(MODE)/tool/net/.redbean-demo/.ape tool/net/.help.txt tool/net/demo/.init.lua tool/net/demo/.reload.lua tool/net/demo/hello.lua @echo "<-- check out this lua server page" | $(COMPILE) -AZIP -T$@ zip -cqj $@ tool/net/demo/redbean.lua @$(COMPILE) -AZIP -T$@ zip -qj $@ tool/net/demo/404.html tool/net/favicon.ico tool/net/redbean.png tool/net/demo/redbean-form.lua tool/net/demo/redbean-xhr.lua @echo Uncompressed for HTTP Range requests | $(COMPILE) -AZIP -T$@ zip -cqj0 $@ tool/net/demo/seekable.txt diff --git a/tool/net/redbean.c b/tool/net/redbean.c index fc45334d0..ff459ff9b 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -22,6 +22,7 @@ #include "libc/bits/safemacros.internal.h" #include "libc/calls/calls.h" #include "libc/calls/sigbits.h" +#include "libc/calls/struct/flock.h" #include "libc/calls/struct/itimerval.h" #include "libc/calls/struct/rusage.h" #include "libc/calls/struct/sigaction.h" @@ -30,9 +31,11 @@ #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/fmt/itoa.h" +#include "libc/intrin/asan.internal.h" #include "libc/log/check.h" #include "libc/log/log.h" #include "libc/math.h" +#include "libc/mem/alloca.h" #include "libc/mem/fmt.h" #include "libc/nexgen32e/bsf.h" #include "libc/nexgen32e/bsr.h" @@ -49,6 +52,7 @@ #include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/exit.h" +#include "libc/sysv/consts/f.h" #include "libc/sysv/consts/inaddr.h" #include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/itimer.h" @@ -212,8 +216,11 @@ struct Buffer { }; struct Strings { - size_t n; - char **p; + size_t n, c; + struct String { + size_t n; + const char *s; + } * p; }; static struct Freelist { @@ -234,9 +241,8 @@ static struct Redirects { size_t n; struct Redirect { int code; - const char *path; - size_t pathlen; - const char *location; + struct String path; + struct String location; } * p; } redirects; @@ -250,7 +256,7 @@ static struct Assets { int64_t lastmodified; char *lastmodifiedstr; struct File { - char *path; + struct String path; struct stat st; } * file; } * p; @@ -303,7 +309,6 @@ static bool loggednetworkorigin; static bool hasluaglobalhandler; static int zfd; -static int zprot; static int frags; static int gmtoff; static int server; @@ -319,6 +324,7 @@ static lua_State *L; static size_t zsize; static char *content; static uint8_t *zmap; +static uint8_t *zbase; static uint8_t *zcdir; static size_t hdrsize; static size_t msgsize; @@ -364,178 +370,6 @@ static char *HandleAsset(struct Asset *, const char *, size_t); static char *ServeAsset(struct Asset *, const char *, size_t); static char *SetStatus(unsigned, const char *); -static wontreturn void PrintUsage(FILE *f, int rc) { - /* clang-format off */ - fprintf(f, "\ -SYNOPSIS\n\ -\n\ - %s [-hvduzmbagf] [-p PORT] [-- SCRIPTARGS...]\n\ -\n\ -DESCRIPTION\n\ -\n\ - redbean - single-file distributable web server\n\ -\n\ -FLAGS\n\ -\n\ - -h help\n\ - -s increase silence [repeat]\n\ - -v increase verbosity [repeat]\n\ - -d daemonize\n\ - -u uniprocess\n\ - -z print port\n\ - -m log messages\n\ - -b log message body\n\ - -a log resource usage\n\ - -g log handler latency\n" -#ifndef TINY -" -f log worker function calls\n" -#endif -" -H K:V sets http header globally [repeat]\n\ - -D DIR serve assets from local directory [repeat]\n\ - -t MS tunes read and write timeouts [default 30000]\n\ - -M INT tunes max message payload size [default 65536]\n\ - -c SEC configures static asset cache-control headers\n\ - -r /X=/Y redirect X to Y [repeat]\n\ - -R /X=/Y rewrites X to Y [repeat]\n\ - -l ADDR listen ip [default 0.0.0.0]\n\ - -p PORT listen port [default 8080]\n\ - -L PATH log file location\n\ - -P PATH pid file location\n\ - -U INT daemon set user id\n\ - -G INT daemon set group id\n\ -\n\ -FEATURES\n\ -\n" -#ifndef STATIC -" - Lua v5.4\n" -#endif -" - HTTP v0.9\n\ - - HTTP v1.0\n\ - - HTTP v1.1\n\ - - Pipelining\n\ - - Accounting\n\ - - Content-Encoding\n\ - - Range / Content-Range\n\ - - Last-Modified / If-Modified-Since\n\ -\n\ -USAGE\n\ -\n\ - This executable is also a ZIP file that contains static assets.\n\ - You can run redbean interactively in your terminal as follows:\n\ -\n\ - ./redbean.com -vvvmbag # starts server verbosely\n\ - open http://127.0.0.1:8080/ # shows zip listing page\n\ - CTRL-C # 1x: graceful shutdown\n\ - CTRL-C # 2x: forceful shutdown\n\ -\n\ - You can override the default listing page by adding:\n\ -\n" -#ifndef STATIC -" zip redbean.com index.lua # lua server pages take priority\n" -#endif -" zip redbean.com index.html # default page for directory\n\ -\n\ - The listing page only applies to the root directory. However the\n\ - default index page applies to subdirectories too. In order for it\n\ - to work, there needs to be an empty directory entry in the zip.\n\ - That should already be the default practice of your zip editor.\n\ -\n\ - wget \\\n\ - --mirror \\\n\ - --convert-links \\\n\ - --adjust-extension \\\n\ - --page-requisites \\\n\ - --no-parent \\\n\ - --no-if-modified-since \\\n\ - http://a.example/index.html\n\ - zip -r redbean.com a.example/ # default page for directory\n\ -\n\ - redbean normalizes the trailing slash for you automatically:\n\ -\n\ - $ printf 'GET /a.example HTTP/1.0\\n\\n' | nc 127.0.0.1 8080\n\ - HTTP/1.0 307 Temporary Redirect\n\ - Location: /a.example/\n\ -\n\ - Virtual hosting is accomplished this way too. The Host is simply\n\ - prepended to the path, and if it doesn't exist, it gets removed.\n\ -\n\ - $ printf 'GET / HTTP/1.1\\nHost:a.example\\n\\n' | nc 127.0.0.1 8080\n\ - HTTP/1.1 200 OK\n\ - Link: ; rel=\"canonical\"\n\ -\n\ - If you mirror a lot of websites within your redbean then you can\n\ - actually tell your browser that redbean is your proxy server, in\n\ - which redbean will act as your private version of the Internet.\n\ -\n\ - $ printf 'GET http://a.example HTTP/1.0\\n\\n' | nc 127.0.0.1 8080\n\ - HTTP/1.0 200 OK\n\ - Link: ; rel=\"canonical\"\n\ -\n\ - If you use a reverse proxy, then redbean recognizes the following\n\ - provided that the proxy forwards requests over the local network:\n\ -\n\ - X-Forwarded-For: 203.0.113.42:31337\n\ - X-Forwarded-Host: foo.example:80\n\ -\n\ - There's a text/plain statistics page called /statusz that makes\n\ - it easy to track and monitor the health of your redbean:\n\ -\n\ - printf 'GET /statusz\\n\\n' | nc 127.0.0.1 8080\n\ -\n\ - redbean will display an error page using the /redbean.png logo\n\ - by default, embedded as a bas64 data uri. You can override the\n\ - custom page for various errors by adding files to the zip root.\n\ -\n\ - zip redbean.com 404.html # custom not found page\n\ -\n\ - Audio video content should not be compressed in your ZIP files.\n\ - Uncompressed assets enable browsers to send Range HTTP request.\n\ - On the other hand compressed assets are best for gzip encoding.\n\ -\n\ - zip redbean.com index.html # adds file\n\ - zip -0 redbean.com video.mp4 # adds without compression\n\ -\n\ - You can have redbean run as a daemon by doing the following:\n\ -\n\ - redbean.com -vv -d -L redbean.log -P redbean.pid\n\ - kill -TERM $(cat redbean.pid) # 1x: graceful shutdown\n\ - kill -TERM $(cat redbean.pid) # 2x: forceful shutdown\n\ -\n\ - redbean currently has a 32kb limit on request messages and 64kb\n\ - including the payload. redbean will grow to whatever the system\n\ - limits allow. Should fork() or accept() fail redbean will react\n\ - by going into \"meltdown mode\" which closes lingering workers.\n\ - You can trigger this at any time using:\n\ -\n\ - kill -USR2 $(cat redbean.pid)\n\ -\n\ - Another failure condition is running out of disk space in which\n\ - case redbean reacts by truncating the log file. Lastly, redbean\n\ - does the best job possible reporting on resource usage when the\n\ - logger is in debug mode noting that NetBSD is the best at this.\n\ -\n\ - Your redbean is an actually portable executable, that's able to\n\ - run on six different operating systems. To do that, it needs to\n\ - overwrite its own MZ header at startup, with ELF or Mach-O, and\n\ - then puts the original back once the program loads. If you want\n\ - your redbean to follow the platform-local executable convention\n\ - then delete the /.ape file from zip.\n\ -\n\ - redbean contains software licensed ISC, MIT, BSD-2, BSD-3, zlib\n\ - which makes it a permissively licensed gift to anyone who might\n\ - find it useful. The transitive closure of legalese can be found\n\ - inside the binary. redbean also respects your privacy and won't\n\ - phone home because your computer is its home.\n\ -\n\ -SEE ALSO\n\ -\n\ - https://justine.lol/redbean/index.html\n\ - https://news.ycombinator.com/item?id=26271117\n\ -\n", program_invocation_name); - /* clang-format on */ - exit(rc); -} - static void OnChld(void) { zombied = true; } @@ -601,8 +435,7 @@ static int CompareSlicesCase(const char *a, size_t n, const char *b, size_t m) { static void *FreeLater(void *p) { if (p) { if (++freelist.n > freelist.c) { - freelist.c = freelist.n + 2; - freelist.c += freelist.c >> 1; + freelist.c = freelist.n + (freelist.n >> 1); freelist.p = xrealloc(freelist.p, freelist.c * sizeof(*freelist.p)); } freelist.p[freelist.n - 1] = p; @@ -612,8 +445,7 @@ static void *FreeLater(void *p) { static void UnmapLater(int f, void *p, size_t n) { if (++unmaplist.n > unmaplist.c) { - unmaplist.c = unmaplist.n + 2; - unmaplist.c += unmaplist.c >> 1; + unmaplist.c = unmaplist.n + (unmaplist.n >> 1); unmaplist.p = xrealloc(unmaplist.p, unmaplist.c * sizeof(*unmaplist.p)); } unmaplist.p[unmaplist.n - 1].f = f; @@ -698,13 +530,13 @@ static char *MergePaths(const char *p, size_t n, const char *q, size_t m, return r; } -static long FindRedirect(const char *path, size_t n) { +static long FindRedirect(const char *s, size_t n) { int c, m, l, r, z; l = 0; r = redirects.n - 1; while (l <= r) { m = (l + r) >> 1; - c = CompareSlices(redirects.p[m].path, redirects.p[m].pathlen, path, n); + c = CompareSlices(redirects.p[m].path.s, redirects.p[m].path.n, s, n); if (c < 0) { l = m + 1; } else if (c > 0) { @@ -716,7 +548,8 @@ static long FindRedirect(const char *path, size_t n) { return -1; } -static void ProgramRedirect(int code, const char *src, const char *dst) { +static void ProgramRedirect(int code, const char *sp, size_t sn, const char *dp, + size_t dn) { long i, j; struct Redirect r; if (code && code != 301 && code != 302 && code != 307 && code != 308) { @@ -724,17 +557,18 @@ static void ProgramRedirect(int code, const char *src, const char *dst) { exit(1); } r.code = code; - r.path = strdup(src); - r.pathlen = strlen(src); - r.location = strdup(dst); - if ((i = FindRedirect(r.path, r.pathlen)) != -1) { + r.path.s = sp; + r.path.n = sn; + r.location.s = dp; + r.location.n = dn; + if ((i = FindRedirect(r.path.s, r.path.n)) != -1) { redirects.p[i] = r; } else { i = redirects.n; redirects.p = xrealloc(redirects.p, (i + 1) * sizeof(*redirects.p)); for (j = i; j; --j) { - if (CompareSlices(r.path, r.pathlen, redirects.p[j - 1].path, - redirects.p[j - 1].pathlen) < 0) { + if (CompareSlices(r.path.s, r.path.n, redirects.p[j - 1].path.s, + redirects.p[j - 1].path.n) < 0) { redirects.p[j] = redirects.p[j - 1]; } else { break; @@ -745,15 +579,15 @@ static void ProgramRedirect(int code, const char *src, const char *dst) { } } -static void ProgramRedirectArg(int code, const char *arg) { - char *s; +static void ProgramRedirectArg(int code, const char *s) { + size_t n; const char *p; - if (!(p = strchr(arg, '='))) { + n = strlen(s); + if (!(p = memchr(s, '=', n))) { fprintf(stderr, "error: redirect arg missing '='\n"); exit(1); } - ProgramRedirect(code, (s = strndup(arg, p - arg)), p + 1); - free(s); + ProgramRedirect(code, s, p - s, p + 1, n - (p - s + 1)); } static void DescribeAddress(char buf[32], uint32_t addr, uint16_t port) { @@ -862,36 +696,33 @@ static void SetDefaults(void) { if (IsWindows()) uniprocess = true; } -static char *RemoveTrailingSlashes(char *s) { - size_t n; - n = strlen(s); - while (n && (s[n - 1] == '/' || s[n - 1] == '\\')) s[--n] = '\0'; - return s; +static void AddString(struct Strings *l, const char *s, size_t n) { + if (++l->n > l->c) { + l->c = l->n + (l->n >> 1); + l->p = xrealloc(l->p, l->c * sizeof(*l->p)); + } + l->p[l->n - 1].s = s; + l->p[l->n - 1].n = n; } -static void AddString(struct Strings *l, char *s) { - l->p = xrealloc(l->p, ++l->n * sizeof(*l->p)); - l->p[l->n - 1] = s; -} - -static bool HasString(struct Strings *l, char *s) { +static bool HasString(struct Strings *l, const char *s, size_t n) { size_t i; for (i = 0; i < l->n; ++i) { - if (!strcmp(l->p[i], s)) { + if (SlicesEqual(l->p[i].s, l->p[i].n, s, n)) { return true; } } return false; } -static void AddStagingDirectory(const char *dirpath) { - char *s; - s = RemoveTrailingSlashes(strdup(dirpath)); - if (isempty(s) || !isdirectory(s)) { +static void AddStagingDirectory(char *s) { + size_t n = strlen(s); + while (n && (s[n - 1] == '/' || s[n - 1] == '\\')) s[--n] = 0; + if (!n || !isdirectory(s)) { fprintf(stderr, "error: not a directory: %`'s\n", s); exit(1); } - AddString(&stagedirs, s); + AddString(&stagedirs, s, n); } static void ProgramHeader(const char *s) { @@ -922,102 +753,10 @@ static void ProgramHeader(const char *s) { } } -static void GetOpts(int argc, char *argv[]) { - int opt; - while ((opt = getopt(argc, argv, - "azhdugvsmbfl:p:r:R:H:c:L:P:U:G:B:D:t:M:")) != -1) { - switch (opt) { - case 'v': - __log_level++; - break; - case 's': - __log_level--; - break; - case 'd': - daemonize = true; - break; - case 'a': - logrusage = true; - break; - case 'u': - uniprocess = true; - break; - case 'g': - loglatency = true; - break; - case 'm': - logmessages = true; - break; - case 'b': - logbodies = true; - break; - case 'z': - printport = true; - break; - case 'f': - funtrace = true; - break; - case 'k': - encouragekeepalive = true; - break; - case 't': - ProgramTimeout(strtol(optarg, NULL, 0)); - break; - case 'r': - ProgramRedirectArg(307, optarg); - break; - case 'R': - ProgramRedirectArg(0, optarg); - break; - case 'D': - AddStagingDirectory(optarg); - break; - case 'c': - ProgramCache(strtol(optarg, NULL, 0)); - break; - case 'p': - ProgramPort(strtol(optarg, NULL, 0)); - break; - case 'M': - maxpayloadsize = atoi(optarg); - maxpayloadsize = MAX(1450, maxpayloadsize); - break; - case 'l': - CHECK_EQ(1, inet_pton(AF_INET, optarg, &serveraddr.sin_addr)); - break; - case 'B': - ProgramBrand(optarg); - break; - case 'H': - ProgramHeader(optarg); - break; - case 'L': - logpath = optarg; - break; - case 'P': - pidpath = optarg; - break; - case 'U': - daemonuid = atoi(optarg); - break; - case 'G': - daemongid = atoi(optarg); - break; - case 'h': - PrintUsage(stdout, EXIT_SUCCESS); - default: - PrintUsage(stderr, EX_USAGE); - } - } - if (logpath) { - CHECK_NOTNULL(freopen(logpath, "a", stderr)); - } -} - static void Daemonize(void) { char ibuf[21]; int i, fd, pid; - for (i = 3; i < 128; ++i) { + for (i = 0; i < 128; ++i) { if (i != server) { close(i); } @@ -1032,9 +771,9 @@ static void Daemonize(void) { close(fd); } if (!logpath) logpath = "/dev/null"; - freopen("/dev/null", "r", stdin); - freopen(logpath, "a", stdout); - freopen(logpath, "a", stderr); + open("/dev/null", O_RDONLY); + open(logpath, O_APPEND | O_WRONLY | O_CREAT, 0640); + dup2(1, 2); LOGIFNEG1(setgid(daemongid)); LOGIFNEG1(setuid(daemonuid)); } @@ -1259,11 +998,11 @@ static int64_t GetZipCfileLastModified(const uint8_t *zcf) { for (p = ZIP_CFILE_EXTRA(zcf), pe = p + ZIP_CFILE_EXTRASIZE(zcf); p + 4 <= pe; p += ZIP_EXTRA_SIZE(p)) { if (ZIP_EXTRA_HEADERID(p) == kZipExtraNtfs && - ZIP_EXTRA_CONTENTSIZE(p) >= 4 + 4 + 8 * 3 && + ZIP_EXTRA_CONTENTSIZE(p) >= 4 + 4 + 8 && READ16LE(ZIP_EXTRA_CONTENT(p) + 4) == 1 && - READ16LE(ZIP_EXTRA_CONTENT(p) + 6) == 24) { + READ16LE(ZIP_EXTRA_CONTENT(p) + 6) >= 8) { return READ64LE(ZIP_EXTRA_CONTENT(p) + 8) / HECTONANOSECONDS - - MODERNITYSECONDS; + MODERNITYSECONDS; /* TODO(jart): update access time */ } } for (p = ZIP_CFILE_EXTRA(zcf), pe = p + ZIP_CFILE_EXTRASIZE(zcf); p + 4 <= pe; @@ -1284,13 +1023,38 @@ static int64_t GetZipCfileLastModified(const uint8_t *zcf) { ZIP_CFILE_LASTMODIFIEDTIME(zcf))); } +static int64_t GetZipCfileCreation(const uint8_t *zcf) { + const uint8_t *p, *pe; + for (p = ZIP_CFILE_EXTRA(zcf), pe = p + ZIP_CFILE_EXTRASIZE(zcf); p + 4 <= pe; + p += ZIP_EXTRA_SIZE(p)) { + if (ZIP_EXTRA_HEADERID(p) == kZipExtraNtfs && + ZIP_EXTRA_CONTENTSIZE(p) >= 4 + 4 + 8 * 3 && + READ16LE(ZIP_EXTRA_CONTENT(p) + 4) == 1 && + READ16LE(ZIP_EXTRA_CONTENT(p) + 6) >= 24) { + return READ64LE(ZIP_EXTRA_CONTENT(p) + 8 + 8 + 8) / HECTONANOSECONDS - + MODERNITYSECONDS; + } + } + for (p = ZIP_CFILE_EXTRA(zcf), pe = p + ZIP_CFILE_EXTRASIZE(zcf); p + 4 <= pe; + p += ZIP_EXTRA_SIZE(p)) { + if (ZIP_EXTRA_HEADERID(p) == kZipExtraExtendedTimestamp && + ZIP_EXTRA_CONTENTSIZE(p) >= 1 && (*ZIP_EXTRA_CONTENT(p) & 4) && + ZIP_EXTRA_CONTENTSIZE(p) >= + 1 + popcnt((*ZIP_EXTRA_CONTENT(p) & 7)) * 4) { + return (int32_t)READ32LE(ZIP_EXTRA_CONTENT(p) + 1 + + popcnt((*ZIP_EXTRA_CONTENT(p) & 3)) * 4); + } + } + return GetZipCfileLastModified(zcf); +} + forceinline bool IsCompressed(struct Asset *a) { return !a->file && - ZIP_LFILE_COMPRESSIONMETHOD(zmap + a->lf) == kZipCompressionDeflate; + ZIP_LFILE_COMPRESSIONMETHOD(zbase + a->lf) == kZipCompressionDeflate; } forceinline int GetMode(struct Asset *a) { - return a->file ? a->file->st.st_mode : GetZipCfileMode(zmap + a->cf); + return a->file ? a->file->st.st_mode : GetZipCfileMode(zbase + a->cf); } static char *FormatUnixHttpDateTime(char *s, int64_t t) { @@ -1318,31 +1082,33 @@ static void IndexAssets(void) { uint64_t cf; struct Asset *p; uint32_t i, n, m, step, hash; + DEBUGF("indexing assets"); CHECK_GE(HASH_LOAD_FACTOR, 2); CHECK(READ32LE(zcdir) == kZipCdir64HdrMagic || READ32LE(zcdir) == kZipCdirHdrMagic); n = GetZipCdirRecords(zcdir); m = roundup2pow(MAX(1, n) * HASH_LOAD_FACTOR); p = xcalloc(m, sizeof(struct Asset)); - for (cf = GetZipCdirOffset(zcdir); n--; cf += ZIP_CFILE_HDRSIZE(zmap + cf)) { - CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zmap + cf)); - if (!IsCompressionMethodSupported(ZIP_CFILE_COMPRESSIONMETHOD(zmap + cf))) { + for (cf = GetZipCdirOffset(zcdir); n--; cf += ZIP_CFILE_HDRSIZE(zbase + cf)) { + CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zbase + cf)); + if (!IsCompressionMethodSupported( + ZIP_CFILE_COMPRESSIONMETHOD(zbase + cf))) { LOGF("don't understand zip compression method %d used by %`'.*s", - ZIP_CFILE_COMPRESSIONMETHOD(zmap + cf), - ZIP_CFILE_NAMESIZE(zmap + cf), ZIP_CFILE_NAME(zmap + cf)); + ZIP_CFILE_COMPRESSIONMETHOD(zbase + cf), + ZIP_CFILE_NAMESIZE(zbase + cf), ZIP_CFILE_NAME(zbase + cf)); continue; } - hash = Hash(ZIP_CFILE_NAME(zmap + cf), ZIP_CFILE_NAMESIZE(zmap + cf)); + hash = Hash(ZIP_CFILE_NAME(zbase + cf), ZIP_CFILE_NAMESIZE(zbase + cf)); step = 0; do { i = (hash + (step * (step + 1)) >> 1) & (m - 1); ++step; } while (p[i].hash); - lm = GetZipCfileLastModified(zmap + cf); + lm = GetZipCfileLastModified(zbase + cf); p[i].hash = hash; p[i].cf = cf; - p[i].lf = GetZipCfileOffset(zmap + cf); - p[i].istext = !!(ZIP_CFILE_INTERNALATTRIBUTES(zmap + cf) & kZipIattrText); + p[i].lf = GetZipCfileOffset(zbase + cf); + p[i].istext = !!(ZIP_CFILE_INTERNALATTRIBUTES(zbase + cf) & kZipIattrText); p[i].lastmodified = lm; p[i].lastmodifiedstr = FormatUnixHttpDateTime(xmalloc(30), lm); } @@ -1350,32 +1116,54 @@ static void IndexAssets(void) { assets.n = m; } -static bool ZipCdirChanged(void) { +static bool OpenZip(bool force) { + int fd; + size_t n; struct stat st; - if (!IsZipCdir32(zmap, zsize, zcdir - zmap) && - !IsZipCdir64(zmap, zsize, zcdir - zmap)) { - return true; - } - if (stat(zpath, &st) != -1 && st.st_ino != zst.st_ino) { - return true; + uint8_t *m, *b, *d, *p; + if (stat(zpath, &st) != -1) { + if (force || st.st_ino != zst.st_ino || st.st_size > zst.st_size) { + if (st.st_ino == zst.st_ino) { + fd = zfd; + } else if ((fd = open(zpath, O_RDWR)) == -1) { + WARNF("open() failed w/ %m"); + return false; + } + if ((m = mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) != + MAP_FAILED) { + n = st.st_size; + if (endswith(zpath, ".com.dbg") && (p = memmem(m, n, "MZqFpD", 6))) { + b = p; + n -= p - m; + } else { + b = m; + } + if ((d = GetZipCdir(b, n))) { + if (zmap) { + LOGIFNEG1(munmap(zmap, zbase + zsize - zmap)); + } + zmap = m; + zbase = b; + zsize = n; + zcdir = d; + DCHECK(IsZipCdir32(zbase, zsize, zcdir - zbase) || + IsZipCdir64(zbase, zsize, zcdir - zbase)); + memcpy(&zst, &st, sizeof(st)); + IndexAssets(); + return true; + } else { + WARNF("couldn't locate central directory"); + } + } else { + WARNF("mmap() failed w/ %m"); + } + } + } else { + WARNF("stat() failed w/ %m"); } return false; } -static void OpenZip(void) { - uint8_t *p; - if (zmap) munmap(zmap, zsize); - CHECK_NE(-1, fstat(zfd, &zst)); - CHECK((zsize = zst.st_size)); - CHECK_NE(MAP_FAILED, (zmap = mmap((void *)0x0000300000000000, zsize, zprot, - MAP_FIXED | MAP_SHARED, zfd, 0))); - CHECK_NOTNULL((zcdir = GetZipCdir(zmap, zsize))); - if (endswith(zpath, ".com.dbg") && (p = memmem(zmap, zsize, "MZqFpD", 6))) { - zsize -= p - zmap; - zmap = p; - } -} - static struct Asset *GetAssetZip(const char *path, size_t pathlen) { uint32_t i, step, hash; if (pathlen > 1 && path[0] == '/') ++path, --pathlen; @@ -1384,8 +1172,8 @@ static struct Asset *GetAssetZip(const char *path, size_t pathlen) { i = (hash + (step * (step + 1)) >> 1) & (assets.n - 1); if (!assets.p[i].hash) return NULL; if (hash == assets.p[i].hash && - pathlen == ZIP_CFILE_NAMESIZE(zmap + assets.p[i].cf) && - memcmp(path, ZIP_CFILE_NAME(zmap + assets.p[i].cf), pathlen) == 0) { + pathlen == ZIP_CFILE_NAMESIZE(zbase + assets.p[i].cf) && + memcmp(path, ZIP_CFILE_NAME(zbase + assets.p[i].cf), pathlen) == 0) { return &assets.p[i]; } } @@ -1399,9 +1187,9 @@ static struct Asset *GetAssetFile(const char *path, size_t pathlen) { a->file = FreeLater(xmalloc(sizeof(struct File))); for (i = 0; i < stagedirs.n; ++i) { LockInc(&shared->c.stats); - a->file->path = FreeLater( - MergePaths(stagedirs.p[i], strlen(stagedirs.p[i]), path, pathlen, 0)); - if (stat(a->file->path, &a->file->st) != -1) { + a->file->path.s = FreeLater(MergePaths(stagedirs.p[i].s, stagedirs.p[i].n, + path, pathlen, &a->file->path.n)); + if (stat(a->file->path.s, &a->file->st) != -1) { a->lastmodifiedstr = FormatUnixHttpDateTime( FreeLater(xmalloc(30)), (a->lastmodified = a->file->st.st_mtim.tv_sec)); @@ -1488,6 +1276,7 @@ static char *AppendContentRange(char *p, long a, long b, long c) { } static bool Inflate(void *dp, size_t dn, const void *sp, size_t sn) { + int rc; z_stream zs; LockInc(&shared->c.inflates); zs.next_in = sp; @@ -1499,7 +1288,7 @@ static bool Inflate(void *dp, size_t dn, const void *sp, size_t sn) { zs.zfree = Z_NULL; zs.zalloc = Z_NULL; CHECK_EQ(Z_OK, inflateInit2(&zs, -MAX_WBITS)); - switch (inflate(&zs, Z_NO_FLUSH)) { + switch ((rc = inflate(&zs, Z_NO_FLUSH))) { case Z_STREAM_END: CHECK_EQ(Z_OK, inflateEnd(&zs)); return true; @@ -1514,7 +1303,10 @@ static bool Inflate(void *dp, size_t dn, const void *sp, size_t sn) { case Z_MEM_ERROR: FATALF("Z_MEM_ERROR"); default: - abort(); + FATALF("inflate()→%d dn=%ld sn=%ld " + "next_in=%ld avail_in=%ld next_out=%ld avail_out=%ld", + rc, dn, sn, (char *)zs.next_in - (char *)sp, zs.avail_in, + (char *)zs.next_out - (char *)dp, zs.avail_out); } } @@ -1556,18 +1348,18 @@ static void *LoadAsset(struct Asset *a, size_t *out_size) { return NULL; } if (!a->file) { - size = GetZipLfileUncompressedSize(zmap + a->lf); + size = GetZipLfileUncompressedSize(zbase + a->lf); if (size == SIZE_MAX || !(data = malloc(size + 1))) return NULL; if (IsCompressed(a)) { - if (!Inflate(data, size, ZIP_LFILE_CONTENT(zmap + a->lf), - GetZipCfileCompressedSize(zmap + a->cf))) { + if (!Inflate(data, size, ZIP_LFILE_CONTENT(zbase + a->lf), + GetZipCfileCompressedSize(zbase + a->cf))) { free(data); return NULL; } } else { - memcpy(data, ZIP_LFILE_CONTENT(zmap + a->lf), size); + memcpy(data, ZIP_LFILE_CONTENT(zbase + a->lf), size); } - if (!Verify(data, size, ZIP_LFILE_CRC32(zmap + a->lf))) { + if (!Verify(data, size, ZIP_LFILE_CRC32(zbase + a->lf))) { free(data); return NULL; } @@ -1576,7 +1368,110 @@ static void *LoadAsset(struct Asset *a, size_t *out_size) { return data; } else { LockInc(&shared->c.slurps); - return xslurp(a->file->path, out_size); + return xslurp(a->file->path.s, out_size); + } +} + +static wontreturn void PrintUsage(FILE *f, int rc) { + size_t n; + const char *p; + struct Asset *a; + if ((a = GetAssetZip("/.help.txt", 10)) && (p = LoadAsset(a, &n))) { + fwrite(p, 1, n, f); + free(p); + } + exit(rc); +} + +static void GetOpts(int argc, char *argv[]) { + int opt; + while ((opt = getopt(argc, argv, + "azhdugvsmbfl:p:r:R:H:c:L:P:U:G:B:D:t:M:")) != -1) { + switch (opt) { + case 'v': + __log_level++; + break; + case 's': + __log_level--; + break; + case 'd': + daemonize = true; + break; + case 'a': + logrusage = true; + break; + case 'u': + uniprocess = true; + break; + case 'g': + loglatency = true; + break; + case 'm': + logmessages = true; + break; + case 'b': + logbodies = true; + break; + case 'z': + printport = true; + break; + case 'f': + funtrace = true; + break; + case 'k': + encouragekeepalive = true; + break; + case 't': + ProgramTimeout(strtol(optarg, NULL, 0)); + break; + case 'r': + ProgramRedirectArg(307, optarg); + break; + case 'R': + ProgramRedirectArg(0, optarg); + break; + case 'D': + AddStagingDirectory(optarg); + break; + case 'c': + ProgramCache(strtol(optarg, NULL, 0)); + break; + case 'p': + ProgramPort(strtol(optarg, NULL, 0)); + break; + case 'M': + maxpayloadsize = atoi(optarg); + maxpayloadsize = MAX(1450, maxpayloadsize); + break; + case 'l': + CHECK_EQ(1, inet_pton(AF_INET, optarg, &serveraddr.sin_addr)); + break; + case 'B': + ProgramBrand(optarg); + break; + case 'H': + ProgramHeader(optarg); + break; + case 'L': + logpath = optarg; + break; + case 'P': + pidpath = optarg; + break; + case 'U': + daemonuid = atoi(optarg); + break; + case 'G': + daemongid = atoi(optarg); + break; + case 'h': + PrintUsage(stdout, EXIT_SUCCESS); + default: + PrintUsage(stderr, EX_USAGE); + } + } + if (logpath) { + CHECK_NOTNULL(freopen(logpath, "a", stderr)); } } @@ -1671,13 +1566,13 @@ static char *ServeErrorImpl(unsigned code, const char *reason) { return ServeDefaultErrorPage(p, code, reason); } else if (a->file) { LockInc(&shared->c.slurps); - content = FreeLater(xslurp(a->file->path, &contentlength)); + content = FreeLater(xslurp(a->file->path.s, &contentlength)); return AppendContentType(p, "text/html; charset=utf-8"); } else { - content = (char *)ZIP_LFILE_CONTENT(zmap + a->lf); - contentlength = GetZipCfileCompressedSize(zmap + a->cf); + content = (char *)ZIP_LFILE_CONTENT(zbase + a->lf); + contentlength = GetZipCfileCompressedSize(zbase + a->cf); if (IsCompressed(a)) { - n = GetZipLfileUncompressedSize(zmap + a->lf); + n = GetZipLfileUncompressedSize(zbase + a->lf); if ((s = FreeLater(malloc(n))) && Inflate(s, n, content, contentlength)) { content = s; contentlength = n; @@ -1685,7 +1580,7 @@ static char *ServeErrorImpl(unsigned code, const char *reason) { return ServeDefaultErrorPage(p, code, reason); } } - if (Verify(content, contentlength, ZIP_LFILE_CRC32(zmap + a->lf))) { + if (Verify(content, contentlength, ZIP_LFILE_CRC32(zbase + a->lf))) { return AppendContentType(p, "text/html; charset=utf-8"); } else { return ServeDefaultErrorPage(p, code, reason); @@ -1713,27 +1608,37 @@ static char *ServeAssetCompressed(struct Asset *a) { LockInc(&shared->c.compressedresponses); DEBUGF("ServeAssetCompressed()"); gzipped = true; - crc = crc32_z(0, content, contentlength); - WRITE32LE(gzip_footer + 0, crc); - WRITE32LE(gzip_footer + 4, contentlength); - content = FreeLater(Deflate(content, contentlength, &contentlength)); + if (msg.method == kHttpHead) { + content = 0; + } else { + crc = crc32_z(0, content, contentlength); + WRITE32LE(gzip_footer + 0, crc); + WRITE32LE(gzip_footer + 4, contentlength); + content = FreeLater(Deflate(content, contentlength, &contentlength)); + } return SetStatus(200, "OK"); } static char *ServeAssetDecompressed(struct Asset *a) { char *buf; size_t size; - DEBUGF("ServeAssetDecompressed()"); - size = GetZipCfileUncompressedSize(zmap + a->cf); LockInc(&shared->c.decompressedresponses); - if ((buf = FreeLater(malloc(size))) && - Inflate(buf, size, content, contentlength) && - Verify(buf, size, ZIP_CFILE_CRC32(zmap + a->cf))) { - content = buf; + size = GetZipCfileUncompressedSize(zbase + a->cf); + DEBUGF("ServeAssetDecompressed(%ld) -> %ld", contentlength, size); + if (msg.method == kHttpHead) { + content = 0; contentlength = size; return SetStatus(200, "OK"); } else { - return ServeError(500, "Internal Server Error"); + if ((buf = FreeLater(malloc(size))) && + Inflate(buf, size, content, contentlength) && + Verify(buf, size, ZIP_CFILE_CRC32(zbase + a->cf))) { + content = buf; + contentlength = size; + return SetStatus(200, "OK"); + } else { + return ServeError(500, "Internal Server Error"); + } } } @@ -1749,8 +1654,8 @@ static inline char *ServeAssetPrecompressed(struct Asset *a) { DEBUGF("ServeAssetPrecompressed()"); LockInc(&shared->c.precompressedresponses); gzipped = true; - crc = ZIP_CFILE_CRC32(zmap + a->cf); - size = GetZipCfileUncompressedSize(zmap + a->cf); + crc = ZIP_CFILE_CRC32(zbase + a->cf); + size = GetZipCfileUncompressedSize(zbase + a->cf); WRITE32LE(gzip_footer + 0, crc); WRITE32LE(gzip_footer + 4, size); return SetStatus(200, "OK"); @@ -1781,11 +1686,11 @@ static char *ServeAssetRange(struct Asset *a) { } } -static char *GetAssetPath(uint64_t cf, size_t *out_size) { +static char *GetAssetPath(uint8_t *zcf, size_t *out_size) { char *p1, *p2; size_t n1, n2; - p1 = ZIP_CFILE_NAME(zmap + cf); - n1 = ZIP_CFILE_NAMESIZE(zmap + cf); + p1 = ZIP_CFILE_NAME(zcf); + n1 = ZIP_CFILE_NAMESIZE(zcf); p2 = xmalloc(1 + n1 + 1); n2 = 1 + n1 + 1; p2[0] = '/'; @@ -1795,10 +1700,11 @@ static char *GetAssetPath(uint64_t cf, size_t *out_size) { return p2; } -static bool IsHiddenPath(const char *s) { +static bool IsHiddenPath(const char *s, size_t n) { size_t i; for (i = 0; i < hidepaths.n; ++i) { - if (startswith(s, hidepaths.p[i])) { + if (n >= hidepaths.p[i].n && + !memcmp(s, hidepaths.p[i].s, hidepaths.p[i].n)) { return true; } } @@ -1808,8 +1714,12 @@ static bool IsHiddenPath(const char *s) { static char *GetBasicAuthorization(size_t *z) { size_t n; const char *p, *q; - p = inbuf.p + msg.headers[kHttpAuthorization].a; - n = msg.headers[kHttpAuthorization].b - msg.headers[kHttpAuthorization].a; + struct HttpRequestSlice *g; + g = msg.headers + (HasHeader(kHttpProxyAuthorization) + ? kHttpProxyAuthorization + : kHttpAuthorization); + p = inbuf.p + g->a; + n = g->b - g->a; if ((q = memchr(p, ' ', n)) && SlicesEqualCase(p, q - p, "Basic", 5)) { return DecodeBase64(q + 1, n - (q + 1 - p), z); } else { @@ -1879,7 +1789,7 @@ static char *BadMethod(void) { return stpcpy(ServeError(405, "Method Not Allowed"), "Allow: GET, HEAD\r\n"); } -static int GetDecimalWidth(int x) { +static int GetDecimalWidth(long x) { int w = x ? ceil(log10(x)) : 1; return w + (w - 1) / 3; } @@ -1888,13 +1798,13 @@ static int GetOctalWidth(int x) { return !x ? 1 : x < 8 ? 2 : 1 + bsr(x) / 3; } -static const char *DescribeCompressionRatio(char rb[8], uint64_t cf) { +static const char *DescribeCompressionRatio(char rb[8], uint8_t *zcf) { long percent; - if (ZIP_CFILE_COMPRESSIONMETHOD(zmap + cf) == kZipCompressionNone) { + if (ZIP_CFILE_COMPRESSIONMETHOD(zcf) == kZipCompressionNone) { return "n/a"; } else { - percent = lround(100 - (double)GetZipCfileCompressedSize(zmap + cf) / - GetZipCfileUncompressedSize(zmap + cf) * 100); + percent = lround(100 - (double)GetZipCfileCompressedSize(zcf) / + GetZipCfileUncompressedSize(zcf) * 100); sprintf(rb, "%ld%%", MIN(999, MAX(-999, percent))); return rb; } @@ -1904,10 +1814,10 @@ static char *ServeListing(void) { long x; ldiv_t y; int w[3]; + uint8_t *zcf; struct tm tm; const char *and; int64_t lastmod; - uint64_t cf, lf; struct rusage ru; char *p, *q, *path; char rb[8], tb[64], *rp[6]; @@ -1942,46 +1852,43 @@ td { padding-right: 3em; }\r\n\ GetZipCdirComment(zcdir)); memset(w, 0, sizeof(w)); n = GetZipCdirRecords(zcdir); - for (cf = GetZipCdirOffset(zcdir); n--; cf += ZIP_CFILE_HDRSIZE(zmap + cf)) { - CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zmap + cf)); - lf = GetZipCfileOffset(zmap + cf); - path = GetAssetPath(cf, &pathlen); - if (!IsHiddenPath(path)) { + for (zcf = zbase + GetZipCdirOffset(zcdir); n--; + zcf += ZIP_CFILE_HDRSIZE(zcf)) { + CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zcf)); + path = GetAssetPath(zcf, &pathlen); + if (!IsHiddenPath(path, pathlen)) { w[0] = min(80, max(w[0], strwidth(path, 0) + 2)); - w[1] = max(w[1], GetOctalWidth(GetZipCfileMode(zmap + cf))); - w[2] = max(w[2], GetDecimalWidth(GetZipCfileUncompressedSize(zmap + cf))); + w[1] = max(w[1], GetOctalWidth(GetZipCfileMode(zcf))); + w[2] = max(w[2], GetDecimalWidth(GetZipCfileUncompressedSize(zcf))); } free(path); } n = GetZipCdirRecords(zcdir); - for (cf = GetZipCdirOffset(zcdir); n--; cf += ZIP_CFILE_HDRSIZE(zmap + cf)) { - CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zmap + cf)); - lf = GetZipCfileOffset(zmap + cf); - path = GetAssetPath(cf, &pathlen); - if (!IsHiddenPath(path)) { + for (zcf = zbase + GetZipCdirOffset(zcdir); n--; + zcf += ZIP_CFILE_HDRSIZE(zcf)) { + CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zcf)); + path = GetAssetPath(zcf, &pathlen); + if (!IsHiddenPath(path, pathlen)) { rp[0] = VisualizeControlCodes(path, pathlen, &rn[0]); rp[1] = EscapePath(path, pathlen, &rn[1]); rp[2] = EscapeHtml(rp[1], rn[1], &rn[2]); - rp[3] = VisualizeControlCodes(ZIP_CFILE_COMMENT(zmap + cf), - strnlen(ZIP_CFILE_COMMENT(zmap + cf), - ZIP_CFILE_COMMENTSIZE(zmap + cf)), - &rn[3]); + rp[3] = VisualizeControlCodes( + ZIP_CFILE_COMMENT(zcf), + strnlen(ZIP_CFILE_COMMENT(zcf), ZIP_CFILE_COMMENTSIZE(zcf)), &rn[3]); rp[4] = EscapeHtml(rp[0], rn[0], &rn[4]); - lastmod = GetZipCfileLastModified(zmap + cf); + lastmod = GetZipCfileLastModified(zcf); localtime_r(&lastmod, &tm); strftime(tb, sizeof(tb), "%Y-%m-%d %H:%M:%S %Z", &tm); - if (IsCompressionMethodSupported( - ZIP_CFILE_COMPRESSIONMETHOD(zmap + cf)) && + if (IsCompressionMethodSupported(ZIP_CFILE_COMPRESSIONMETHOD(zcf)) && IsAcceptablePath(path, pathlen)) { Append("%-*.*s %s %0*o %4s %,*ld %'s\r\n", - rn[2], rp[2], w[0], rn[4], rp[4], tb, w[1], - GetZipCfileMode(zmap + cf), DescribeCompressionRatio(rb, cf), - w[2], GetZipCfileUncompressedSize(zmap + cf), rp[3]); + rn[2], rp[2], w[0], rn[4], rp[4], tb, w[1], GetZipCfileMode(zcf), + DescribeCompressionRatio(rb, zcf), w[2], + GetZipCfileUncompressedSize(zcf), rp[3]); } else { Append("%-*.*s %s %0*o %4s %,*ld %'s\r\n", w[0], rn[4], rp[4], tb, - w[1], GetZipCfileMode(zmap + cf), - DescribeCompressionRatio(rb, cf), w[2], - GetZipCfileUncompressedSize(zmap + cf), rp[3]); + w[1], GetZipCfileMode(zcf), DescribeCompressionRatio(rb, zcf), + w[2], GetZipCfileUncompressedSize(zcf), rp[3]); } free(rp[4]); free(rp[3]); @@ -2168,12 +2075,12 @@ static char *ServeLua(struct Asset *a, const char *s, size_t n) { static char *HandleRedirect(struct Redirect *r) { int code; struct Asset *a; - if (!r->code && (a = GetAsset(r->location, strlen(r->location)))) { + if (!r->code && (a = GetAsset(r->location.s, r->location.n))) { LockInc(&shared->c.rewrites); - DEBUGF("rewriting to %`'s", r->location); - if (!HasString(&loops, r->location)) { - AddString(&loops, r->location); - return RoutePath(r->location, strlen(r->location)); + DEBUGF("rewriting to %`'s", r->location.s); + if (!HasString(&loops, r->location.s, r->location.n)) { + AddString(&loops, r->location.s, r->location.n); + return RoutePath(r->location.s, r->location.n); } else { LockInc(&shared->c.loops); return SetStatus(508, "Loop Detected"); @@ -2185,8 +2092,9 @@ static char *HandleRedirect(struct Redirect *r) { code = r->code; if (!code) code = 307; DEBUGF("%d redirecting %`'s", code, r->location); - return AppendHeader(SetStatus(code, GetHttpReason(code)), "Location", - FreeLater(EncodeHttpHeaderValue(r->location, -1, 0))); + return AppendHeader( + SetStatus(code, GetHttpReason(code)), "Location", + FreeLater(EncodeHttpHeaderValue(r->location.s, r->location.n, 0))); } } @@ -2205,11 +2113,13 @@ static char *HandleFolder(const char *path, size_t pathlen) { } } -static void Reindex(void) { - LockInc(&shared->c.reindexes); - DEBUGF("reindexing"); - OpenZip(); - IndexAssets(); +static bool Reindex(void) { + if (OpenZip(false)) { + LockInc(&shared->c.reindexes); + return true; + } else { + return false; + } } static const char *LuaCheckPath(lua_State *L, int idx, size_t *pathlen) { @@ -2344,9 +2254,9 @@ static int LuaLoadAsset(lua_State *L) { if ((a = GetAsset(path, pathlen))) { if (!a->file && !IsCompressed(a)) { /* fast path: this avoids extra copy */ - data = ZIP_LFILE_CONTENT(zmap + a->lf); - size = GetZipLfileUncompressedSize(zmap + a->lf); - if (Verify(data, size, ZIP_LFILE_CRC32(zmap + a->lf))) { + data = ZIP_LFILE_CONTENT(zbase + a->lf); + size = GetZipLfileUncompressedSize(zbase + a->lf); + if (Verify(data, size, ZIP_LFILE_CRC32(zbase + a->lf))) { lua_pushlstring(L, data, size); return 1; } @@ -2391,66 +2301,80 @@ static bool IsText(const void *data, size_t size) { return true; } -static int LuaStoreAsset(lua_State *L) { - int mode; +int LuaStoreAsset(lua_State *L) { int64_t ft; - uint8_t era; + int i, mode; uint32_t crc; + char *comp, *p; long double now; - char *comp, *p, *q; + struct Asset *a; + struct iovec v[13]; + uint8_t *cdir, era; const char *path, *data, *use; uint16_t gflags, iattrs, mtime, mdate, dosmode, method, disk; - size_t newlfileoffset, newcdiroffset, neweocdoffset, oldcdirrecords; - size_t pathlen, datalen, complen, uselen, oldcdirsize, moar, extralen; + size_t oldcdirsize, oldcdiroffset, records, cdiroffset, cdirsize, pathlen, + datalen, complen, uselen; if (IsOpenbsd() || IsNetbsd() || IsWindows()) { luaL_error(L, "StoreAsset() not available on Windows/NetBSD/OpenBSD yet"); unreachable; } - now = nowl(); path = LuaCheckPath(L, 1, &pathlen); + DCHECK(__asan_is_valid(path, pathlen)); + if (pathlen > 0xffff) { + luaL_argerror(L, 1, "path too long"); + unreachable; + } data = luaL_checklstring(L, 2, &datalen); - mode = luaL_optinteger(L, 3, 0644); - if (!(mode & S_IFMT)) mode |= S_IFREG; - if (pathlen > 1 && path[0] == '/') ++path, --pathlen; + disk = gflags = iattrs = 0; + if (IsUtf8(path, pathlen)) gflags |= kZipGflagUtf8; + if (IsText(data, datalen)) iattrs |= kZipIattrText; crc = crc32_z(0, data, datalen); if (datalen < 100) { method = kZipCompressionNone; - comp = NULL; + comp = 0; use = data; uselen = datalen; + era = kZipEra1989; } else { comp = Deflate(data, datalen, &complen); if (complen < datalen) { method = kZipCompressionDeflate; use = comp; uselen = complen; + era = kZipEra1993; } else { method = kZipCompressionNone; use = data; uselen = datalen; + era = kZipEra1989; } } - disk = gflags = iattrs = 0; - era = method ? kZipEra1993 : kZipEra1989; - ft = (now + MODERNITYSECONDS) * HECTONANOSECONDS; + ////////////////////////////////////////////////////////////////////////////// + CHECK_NE(-1, fcntl(zfd, F_SETLKW, &(struct flock){F_WRLCK})); + OpenZip(false); + + now = nowl(); + a = GetAsset(path, pathlen); + mode = luaL_optinteger(L, 3, a ? GetMode(a) : 0644); + if (!(mode & S_IFMT)) mode |= S_IFREG; + if (pathlen > 1 && path[0] == '/') ++path, --pathlen; dosmode = !(mode & 0200) ? kNtFileAttributeReadonly : 0; + ft = (now + MODERNITYSECONDS) * HECTONANOSECONDS; GetDosLocalTime(now, &mtime, &mdate); - if (IsUtf8(path, pathlen)) gflags |= kZipGflagUtf8; - if (IsText(data, datalen)) iattrs |= kZipIattrText; - CHECK_NE(-1, flock(zfd, LOCK_EX)); - if (ZipCdirChanged()) Reindex(); - oldcdirrecords = GetZipCdirRecords(zcdir); - oldcdirsize = GetZipCdirSize(zcdir); - extralen = 36; - moar = kZipLfileHdrMinSize + pathlen + datalen + oldcdirsize + - kZipCfileHdrMinSize + pathlen + extralen + kZipCdirHdrMinSize; - CHECK_NE(-1, ftruncate(zfd, zsize + moar)); - CHECK_NE(MAP_FAILED, (zmap = mmap((void *)0x0000300000000000, zsize + moar, - PROT_READ | PROT_WRITE, - MAP_FIXED | MAP_SHARED, zfd, 0))); - p = q = (char *)zmap; - p += zsize; - newlfileoffset = p - q; + + // local file header + if (uselen >= 0xffffffff || datalen >= 0xffffffff) { + era = kZipEra2001; + v[2].iov_base = p = alloca((v[2].iov_len = 2 + 2 + 8 + 8)); + p = WRITE16LE(p, kZipExtraZip64); + p = WRITE16LE(p, 8 + 8); + p = WRITE64LE(p, uselen); + p = WRITE64LE(p, datalen); + } else { + v[2].iov_len = 0; + v[2].iov_base = 0; + } + v[0].iov_base = p = alloca((v[0].iov_len = kZipLfileHdrMinSize)); p = WRITE32LE(p, kZipLfileHdrMagic); *p++ = era; *p++ = kZipOsDos; @@ -2459,14 +2383,55 @@ static int LuaStoreAsset(lua_State *L) { p = WRITE16LE(p, mtime); p = WRITE16LE(p, mdate); p = WRITE32LE(p, crc); - p = WRITE32LE(p, uselen); - p = WRITE32LE(p, datalen); + p = WRITE32LE(p, MIN(uselen, 0xffffffff)); + p = WRITE32LE(p, MIN(datalen, 0xffffffff)); p = WRITE16LE(p, pathlen); - p = WRITE16LE(p, 0); - p = mempcpy(p, path, pathlen); - p = mempcpy(p, data, datalen); - newcdiroffset = p - q; - p = mempcpy(p, zmap + GetZipCdirOffset(zcdir), oldcdirsize); + p = WRITE16LE(p, v[2].iov_len); + v[1].iov_len = pathlen; + v[1].iov_base = path; + + // file data + v[3].iov_len = datalen; + v[3].iov_base = data; + + // old central directory entries + oldcdirsize = GetZipCdirSize(zcdir); + oldcdiroffset = GetZipCdirOffset(zcdir); + if (a) { + v[4].iov_base = zbase + oldcdiroffset; + v[4].iov_len = a->cf - oldcdiroffset; + v[5].iov_base = zbase + oldcdiroffset + ZIP_CFILE_HDRSIZE(zbase + a->cf); + v[5].iov_len = + oldcdirsize - v[4].iov_len - ZIP_CFILE_HDRSIZE(zbase + a->cf); + } else { + v[4].iov_base = zbase + oldcdiroffset; + v[4].iov_len = oldcdirsize; + v[5].iov_base = 0; + v[5].iov_len = 0; + } + + // new central directory entry + if (uselen >= 0xffffffff || datalen >= 0xffffffff || zsize >= 0xffffffff) { + v[8].iov_base = p = alloca((v[8].iov_len = 2 + 2 + 8 + 8 + 8)); + p = WRITE16LE(p, kZipExtraZip64); + p = WRITE16LE(p, 8 + 8 + 8); + p = WRITE64LE(p, uselen); + p = WRITE64LE(p, datalen); + p = WRITE64LE(p, zsize); + } else { + v[8].iov_len = 0; + v[8].iov_base = 0; + } + v[9].iov_base = p = alloca((v[9].iov_len = 2 + 2 + 4 + 2 + 2 + 8 + 8 + 8)); + p = WRITE16LE(p, kZipExtraNtfs); + p = WRITE16LE(p, 4 + 2 + 2 + 8 + 8 + 8); + p = WRITE32LE(p, 0); + p = WRITE16LE(p, 1); + p = WRITE16LE(p, 8 + 8 + 8); + p = WRITE64LE(p, ft); + p = WRITE64LE(p, ft); + p = WRITE64LE(p, ft); + v[6].iov_base = p = alloca((v[6].iov_len = kZipCfileHdrMinSize)); p = WRITE32LE(p, kZipCfileHdrMagic); *p++ = kZipCosmopolitanVersion; *p++ = kZipOsUnix; @@ -2477,37 +2442,65 @@ static int LuaStoreAsset(lua_State *L) { p = WRITE16LE(p, mtime); p = WRITE16LE(p, mdate); p = WRITE32LE(p, crc); - p = WRITE32LE(p, uselen); - p = WRITE32LE(p, datalen); + p = WRITE32LE(p, MIN(uselen, 0xffffffff)); + p = WRITE32LE(p, MIN(datalen, 0xffffffff)); p = WRITE16LE(p, pathlen); - p = WRITE16LE(p, extralen); + p = WRITE16LE(p, v[8].iov_len + v[9].iov_len); p = WRITE16LE(p, 0); p = WRITE16LE(p, disk); p = WRITE16LE(p, iattrs); p = WRITE16LE(p, dosmode); p = WRITE16LE(p, mode); - p = WRITE32LE(p, newlfileoffset); - p = mempcpy(p, path, pathlen); - p = WRITE16LE(p, kZipExtraNtfs); - p = WRITE16LE(p, 32); - p = WRITE32LE(p, 0); - p = WRITE16LE(p, 1); - p = WRITE16LE(p, 24); - p = WRITE64LE(p, ft); - p = WRITE64LE(p, ft); - p = WRITE64LE(p, ft); - neweocdoffset = p - q; + p = WRITE32LE(p, MIN(zsize, 0xffffffff)); + v[7].iov_len = pathlen; + v[7].iov_base = path; + + // zip64 end of central directory + cdiroffset = + zsize + v[0].iov_len + v[1].iov_len + v[2].iov_len + v[3].iov_len; + cdirsize = v[4].iov_len + v[5].iov_len + v[6].iov_len + v[7].iov_len + + v[8].iov_len + v[9].iov_len; + records = GetZipCdirRecords(zcdir) + !a; + if (records >= 0xffff || cdiroffset >= 0xffffffff || cdirsize >= 0xffffffff) { + v[10].iov_base = p = + alloca((v[10].iov_len = kZipCdir64HdrMinSize + kZipCdir64LocatorSize)); + p = WRITE32LE(p, kZipCdir64HdrMagic); + p = WRITE64LE(p, 2 + 2 + 4 + 4 + 8 + 8 + 8 + 8); + p = WRITE16LE(p, kZipCosmopolitanVersion); + p = WRITE16LE(p, kZipEra2001); + p = WRITE32LE(p, disk); + p = WRITE32LE(p, disk); + p = WRITE64LE(p, records); + p = WRITE64LE(p, records); + p = WRITE64LE(p, cdirsize); + p = WRITE64LE(p, cdiroffset); + p = WRITE32LE(p, kZipCdir64LocatorMagic); + p = WRITE32LE(p, disk); + p = WRITE64LE(p, cdiroffset + cdirsize); + p = WRITE32LE(p, disk); + } else { + v[10].iov_len = 0; + v[10].iov_base = 0; + } + + // end of central directory + v[12].iov_base = GetZipCdirComment(zcdir); + v[12].iov_len = GetZipCdirCommentSize(zcdir); + v[11].iov_base = p = alloca((v[11].iov_len = kZipCdirHdrMinSize)); p = WRITE32LE(p, kZipCdirHdrMagic); - p = WRITE16LE(p, 0); - p = WRITE16LE(p, 0); - p = WRITE16LE(p, oldcdirrecords + 1); - p = WRITE16LE(p, oldcdirrecords + 1); - p = WRITE32LE(p, neweocdoffset - newcdiroffset); - p = WRITE32LE(p, newcdiroffset); - p = WRITE16LE(p, 0); - zcdir[0] = 'J'; - zcdir[1] = 'T'; - CHECK_NE(-1, flock(zfd, LOCK_UN)); + p = WRITE16LE(p, disk); + p = WRITE16LE(p, disk); + p = WRITE16LE(p, MIN(records, 0xffff)); + p = WRITE16LE(p, MIN(records, 0xffff)); + p = WRITE32LE(p, MIN(cdirsize, 0xffffffff)); + p = WRITE32LE(p, MIN(cdiroffset, 0xffffffff)); + p = WRITE16LE(p, v[12].iov_len); + + CHECK_NE(-1, lseek(zfd, zbase + zsize - zmap, SEEK_SET)); + CHECK_NE(-1, WritevAll(zfd, v, 13)); + CHECK_NE(-1, fcntl(zfd, F_SETLK, &(struct flock){F_UNLCK})); + ////////////////////////////////////////////////////////////////////////////// + OpenZip(false); free(comp); return 0; } @@ -3053,19 +3046,19 @@ static int LuaIsAcceptablePort(lua_State *L) { } static noinline int LuaCoderImpl(lua_State *L, - char *Coder(const char *, size_t, size_t *)) { + char *C(const char *, size_t, size_t *)) { void *p; size_t n; p = luaL_checklstring(L, 1, &n); - p = Coder(p, n, &n); + p = C(p, n, &n); lua_pushlstring(L, p, n); free(p); return 1; } static noinline int LuaCoder(lua_State *L, - char *Coder(const char *, size_t, size_t *)) { - return LuaCoderImpl(L, Coder); + char *C(const char *, size_t, size_t *)) { + return LuaCoderImpl(L, C); } static int LuaUnderlong(lua_State *L) { @@ -3214,8 +3207,8 @@ static int LuaCrc32c(lua_State *L) { return LuaHash(L, crc32c); } -static noinline int LuaProgramInt(lua_State *L, void Program(long)) { - Program(luaL_checkinteger(L, 1)); +static noinline int LuaProgramInt(lua_State *L, void P(long)) { + P(luaL_checkinteger(L, 1)); return 0; } @@ -3241,16 +3234,18 @@ static int LuaProgramBrand(lua_State *L) { } static int LuaProgramHeader(lua_State *L) { - char *s; - s = xasprintf("%s: %s", luaL_checkstring(L, 1), luaL_checkstring(L, 2)); - ProgramHeader(s); - free(s); + ProgramHeader( + gc(xasprintf("%s: %s", luaL_checkstring(L, 1), luaL_checkstring(L, 2)))); return 0; } static int LuaProgramRedirect(lua_State *L) { - ProgramRedirect(luaL_checkinteger(L, 1), luaL_checkstring(L, 2), - luaL_checkstring(L, 3)); + int code; + const char *from, *to; + code = luaL_checkinteger(L, 1); + from = luaL_checkstring(L, 2); + to = luaL_checkstring(L, 3); + ProgramRedirect(code, strdup(from), strlen(from), strdup(to), strlen(to)); return 0; } @@ -3268,7 +3263,7 @@ static int LuaHidePath(lua_State *L) { size_t pathlen; const char *path; path = luaL_checklstring(L, 1, &pathlen); - AddString(&hidepaths, strndup(path, pathlen)); + AddString(&hidepaths, path, pathlen); return 0; } @@ -3294,20 +3289,24 @@ static int LuaLog(lua_State *L) { } static int LuaIsHiddenPath(lua_State *L) { - lua_pushboolean(L, IsHiddenPath(luaL_checkstring(L, 1))); + size_t n; + const char *s; + s = luaL_checklstring(L, 1, &n); + lua_pushboolean(L, IsHiddenPath(s, n)); return 1; } static int LuaGetZipPaths(lua_State *L) { char *path; - uint64_t cf; + uint8_t *zcf; size_t i, n, pathlen; lua_newtable(L); i = 0; n = GetZipCdirRecords(zcdir); - for (cf = GetZipCdirOffset(zcdir); n--; cf += ZIP_CFILE_HDRSIZE(zmap + cf)) { - CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zmap + cf)); - path = GetAssetPath(cf, &pathlen); + for (zcf = zbase + GetZipCdirOffset(zcdir); n--; + zcf += ZIP_CFILE_HDRSIZE(zcf)) { + CHECK_EQ(kZipCfileHdrMagic, ZIP_CFILE_MAGIC(zcf)); + path = GetAssetPath(zcf, &pathlen); lua_pushlstring(L, path, pathlen); lua_seti(L, -2, ++i); free(path); @@ -3337,7 +3336,7 @@ static int LuaGetLastModifiedTime(lua_State *L) { if (a->file) { lua_pushinteger(L, a->file->st.st_mtim.tv_sec); } else { - lua_pushinteger(L, GetZipCfileLastModified(zmap + a->cf)); + lua_pushinteger(L, GetZipCfileLastModified(zbase + a->cf)); } } else { lua_pushnil(L); @@ -3354,7 +3353,7 @@ static int LuaGetAssetSize(lua_State *L) { if (a->file) { lua_pushinteger(L, a->file->st.st_size); } else { - lua_pushinteger(L, GetZipLfileUncompressedSize(zmap + a->lf)); + lua_pushinteger(L, GetZipLfileUncompressedSize(zbase + a->lf)); } } else { lua_pushnil(L); @@ -3381,9 +3380,9 @@ static int LuaGetComment(lua_State *L) { size_t pathlen, m; path = LuaCheckPath(L, 1, &pathlen); if ((a = GetAssetZip(path, pathlen)) && - (m = strnlen(ZIP_CFILE_COMMENT(zmap + a->cf), - ZIP_CFILE_COMMENTSIZE(zmap + a->cf)))) { - lua_pushlstring(L, ZIP_CFILE_COMMENT(zmap + a->cf), m); + (m = strnlen(ZIP_CFILE_COMMENT(zbase + a->cf), + ZIP_CFILE_COMMENTSIZE(zbase + a->cf)))) { + lua_pushlstring(L, ZIP_CFILE_COMMENT(zbase + a->cf), m); } else { lua_pushnil(L); } @@ -3913,7 +3912,6 @@ static void HandleFrag(size_t got) { static void HandleReload(void) { LockInc(&shared->c.reloads); - DEBUGF("reloading"); Reindex(); LuaReload(); } @@ -3921,10 +3919,7 @@ static void HandleReload(void) { static void HandleHeartbeat(void) { if (nowl() - lastrefresh > 60 * 60) RefreshTime(); UpdateCurrentDate(nowl()); - if (ZipCdirChanged()) { - shared->lastreindex = nowl(); - kill(0, SIGUSR1); - } + Reindex(); getrusage(RUSAGE_SELF, &shared->server); #ifndef STATIC LuaRun("/.heartbeat.lua"); @@ -3937,21 +3932,26 @@ static char *OpenAsset(struct Asset *a) { size_t size; if (a->file->st.st_size) { size = a->file->st.st_size; - OpenAgain: - if ((fd = open(a->file->path, O_RDONLY)) != -1) { - data = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0); - if (data != MAP_FAILED) { - LockInc(&shared->c.maps); - UnmapLater(fd, data, size); - content = data; - contentlength = size; - } else { - return HandleMapFailed(a, fd); - } - } else if (errno == EINTR) { - goto OpenAgain; + if (msg.method == kHttpHead) { + content = 0; + contentlength = size; } else { - return HandleOpenFail(a); + OpenAgain: + if ((fd = open(a->file->path.s, O_RDONLY)) != -1) { + data = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0); + if (data != MAP_FAILED) { + LockInc(&shared->c.maps); + UnmapLater(fd, data, size); + content = data; + contentlength = size; + } else { + return HandleMapFailed(a, fd); + } + } else if (errno == EINTR) { + goto OpenAgain; + } else { + return HandleOpenFail(a); + } } } else { content = ""; @@ -4178,9 +4178,13 @@ static char *RouteHost(const char *host, size_t hostlen, const char *path, static inline bool IsLua(struct Asset *a) { size_t n; const char *p; - if (a->file) return endswith(a->file->path, ".lua"); - p = ZIP_CFILE_NAME(zmap + a->cf); - n = ZIP_CFILE_NAMESIZE(zmap + a->cf); + if (a->file && a->file->path.n >= 4 && + READ32LE(a->file->path.s + a->file->path.n - 4) == + ('.' | 'l' << 8 | 'u' << 16 | 'a' << 24)) { + return true; + } + p = ZIP_CFILE_NAME(zbase + a->cf); + n = ZIP_CFILE_NAMESIZE(zbase + a->cf); return n > 4 && READ32LE(p + n - 4) == ('.' | 'l' << 8 | 'u' << 16 | 'a' << 24); } @@ -4235,13 +4239,13 @@ static const char *FindContentType(const char *p, size_t n) { static const char *GetContentType(struct Asset *a, const char *path, size_t n) { const char *r; - if (a->file && (r = FindContentType(a->file->path, strlen(a->file->path)))) { + if (a->file && (r = FindContentType(a->file->path.s, a->file->path.n))) { return r; } return firstnonnull( FindContentType(path, n), - firstnonnull(FindContentType(ZIP_CFILE_NAME(zmap + a->cf), - ZIP_CFILE_NAMESIZE(zmap + a->cf)), + firstnonnull(FindContentType(ZIP_CFILE_NAME(zbase + a->cf), + ZIP_CFILE_NAMESIZE(zbase + a->cf)), a->istext ? "text/plain" : "application/octet-stream")); } @@ -4263,8 +4267,8 @@ static char *ServeAsset(struct Asset *a, const char *path, size_t pathlen) { p = SetStatus(304, "Not Modified"); } else { if (!a->file) { - content = (char *)ZIP_LFILE_CONTENT(zmap + a->lf); - contentlength = GetZipCfileCompressedSize(zmap + a->cf); + content = (char *)ZIP_LFILE_CONTENT(zbase + a->lf); + contentlength = GetZipCfileCompressedSize(zbase + a->cf); } else if ((p = OpenAsset(a))) { return p; } @@ -4279,7 +4283,7 @@ static char *ServeAsset(struct Asset *a, const char *path, size_t pathlen) { } else if (!a->file) { LockInc(&shared->c.identityresponses); DEBUGF("ServeAssetZipIdentity(%`'s)", ct); - if (Verify(content, contentlength, ZIP_LFILE_CRC32(zmap + a->lf))) { + if (Verify(content, contentlength, ZIP_LFILE_CRC32(zbase + a->lf))) { p = SetStatus(200, "OK"); } else { return ServeError(500, "Internal Server Error"); @@ -4653,9 +4657,6 @@ static void RestoreApe(void) { if ((a = GetAssetZip("/.ape", 5)) && (p = LoadAsset(a, &n))) { write(zfd, p, n); free(p); - zprot = PROT_READ | PROT_WRITE; - CHECK_NE(MAP_FAILED, (zmap = mmap((void *)0x0000300000000000, zsize, zprot, - MAP_FIXED | MAP_SHARED, zfd, 0))); } else { WARNF("/.ape not found"); } @@ -4669,11 +4670,10 @@ void RedBean(int argc, char *argv[]) { (shared = mmap(NULL, ROUNDUP(sizeof(struct Shared), FRAMESIZE), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0))); - zprot = PROT_READ; zpath = (const char *)getauxval(AT_EXECFN); CHECK_NE(-1, (zfd = open(zpath, O_RDONLY))); - OpenZip(); - IndexAssets(); + CHECK_NE(-1, fstat(zfd, &zst)); + OpenZip(true); RestoreApe(); SetDefaults(); GetOpts(argc, argv);