From 228fb7428b0b61736d1bc65c29cf2877b490d113 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 14 Aug 2021 17:16:33 -0700 Subject: [PATCH] Improve isystem includes and magic numbers --- build/config.mk | 46 +++++- libc/bits/newbie.h | 55 ++++++++ libc/calls/calls.h | 1 + libc/calls/calls.mk | 3 +- libc/calls/ftok.c | 28 ++++ libc/calls/ipc.h | 20 +++ libc/calls/mount.c | 100 +++++++++++++ libc/calls/mount.h | 17 +++ libc/calls/reboot.c | 93 ++++++++++++ libc/calls/ttydefaults.h | 33 +++++ libc/calls/unmount.c | 41 ++++++ libc/isystem/endian.h | 2 +- libc/isystem/langinfo.h | 4 + libc/isystem/locale.h | 4 + libc/isystem/signal.h | 4 + libc/isystem/stat.h | 7 + libc/isystem/strings.h | 7 + libc/isystem/sys/dir.h | 5 + libc/isystem/sys/errno.h | 4 + libc/isystem/sys/fcntl.h | 4 + libc/isystem/sys/file.h | 10 ++ libc/isystem/sys/ioctl.h | 5 + libc/isystem/sys/ipc.h | 6 + libc/isystem/sys/mman.h | 11 ++ libc/isystem/sys/mount.h | 6 + libc/isystem/sys/msg.h | 5 + libc/isystem/sys/param.h | 0 libc/isystem/sys/poll.h | 4 + libc/isystem/sys/ptrace.h | 5 + libc/isystem/sys/reboot.h | 5 + libc/isystem/sys/resource.h | 7 + libc/isystem/sys/select.h | 5 + libc/isystem/sys/signal.h | 4 + libc/isystem/sys/statvfs.h | 4 + libc/isystem/sys/syscall.h | 4 + libc/isystem/sys/termios.h | 4 + libc/isystem/sys/time.h | 2 + libc/isystem/sys/times.h | 5 + libc/isystem/sys/ttydefaults.h | 4 + libc/isystem/sys/types.h | 16 +++ libc/isystem/sys/un.h | 4 + libc/isystem/sys/utsname.h | 1 + libc/isystem/sys/wait.h | 1 + libc/isystem/uio.h | 6 + libc/isystem/wait.h | 4 + libc/isystem/zlib.h | 4 + libc/nt/PowerProf/SetSuspendState.s | 12 ++ libc/nt/advapi32/InitiateShutdownA.s | 10 ++ libc/nt/advapi32/InitiateShutdownW.s | 10 ++ libc/nt/master.sh | 5 +- libc/nt/nt.mk | 19 +++ libc/nt/system.h | 39 ++++++ libc/stdio/fgetln.c | 30 ++++ libc/stdio/stdio.h | 1 + libc/str/str.mk | 5 + libc/sysv/calls/reboot.s | 2 - libc/sysv/calls/{mount.s => sys_mount.s} | 2 +- libc/sysv/calls/sys_reboot.s | 2 + libc/sysv/calls/sys_unmount.s | 2 + libc/sysv/calls/umount2.s | 2 +- libc/sysv/calls/unmount.s | 2 - libc/sysv/consts.sh | 126 +++++++++-------- libc/sysv/consts/CSUSP.S | 2 - libc/sysv/consts/CWERASE.S | 2 - libc/sysv/consts/IPC_CREAT.S | 2 - libc/sysv/consts/IPC_EXCL.S | 2 - libc/sysv/consts/IPC_INFO.S | 2 - libc/sysv/consts/IPC_NOWAIT.S | 2 - libc/sysv/consts/IPC_PRIVATE.S | 2 - libc/sysv/consts/IPC_RMID.S | 2 - libc/sysv/consts/IPC_SET.S | 2 - libc/sysv/consts/MNT_ASYNC.S | 2 + libc/sysv/consts/MNT_BYFSID.S | 2 + libc/sysv/consts/MNT_DETACH.S | 2 +- libc/sysv/consts/MNT_EXPIRE.S | 2 +- libc/sysv/consts/MNT_FORCE.S | 2 +- libc/sysv/consts/MNT_NOATIME.S | 2 + libc/sysv/consts/MNT_NOCLUSTERR.S | 2 + libc/sysv/consts/MNT_NOCLUSTERW.S | 2 + libc/sysv/consts/MNT_NODEV.S | 2 + libc/sysv/consts/MNT_NOEXEC.S | 2 + libc/sysv/consts/MNT_NOSUID.S | 2 + libc/sysv/consts/MNT_RDONLY.S | 2 + libc/sysv/consts/MNT_RELATIME.S | 2 + libc/sysv/consts/MNT_RELOAD.S | 2 + libc/sysv/consts/MNT_SNAPSHOT.S | 2 + libc/sysv/consts/MNT_STRICTATIME.S | 2 + libc/sysv/consts/MNT_SUIDDIR.S | 2 + libc/sysv/consts/MNT_SYNCHRONOUS.S | 2 + libc/sysv/consts/MNT_UPDATE.S | 2 + libc/sysv/consts/MS_BIND.S | 2 +- libc/sysv/consts/MS_DIRSYNC.S | 2 +- libc/sysv/consts/MS_I_VERSION.S | 2 +- libc/sysv/consts/MS_KERNMOUNT.S | 2 +- libc/sysv/consts/MS_MANDLOCK.S | 2 +- libc/sysv/consts/MS_MOVE.S | 2 +- libc/sysv/consts/MS_NOATIME.S | 2 +- libc/sysv/consts/MS_NODEV.S | 2 +- libc/sysv/consts/MS_NODIRATIME.S | 2 +- libc/sysv/consts/MS_NOEXEC.S | 2 +- libc/sysv/consts/MS_NOSUID.S | 2 +- libc/sysv/consts/MS_NOUSER.S | 2 +- libc/sysv/consts/MS_POSIXACL.S | 2 +- libc/sysv/consts/MS_PRIVATE.S | 2 +- libc/sysv/consts/MS_RDONLY.S | 2 +- libc/sysv/consts/MS_REC.S | 2 +- libc/sysv/consts/MS_RELATIME.S | 2 +- libc/sysv/consts/MS_REMOUNT.S | 2 +- libc/sysv/consts/MS_SHARED.S | 2 +- libc/sysv/consts/MS_SILENT.S | 2 +- libc/sysv/consts/MS_SLAVE.S | 2 +- libc/sysv/consts/MS_STRICTATIME.S | 2 +- libc/sysv/consts/MS_SYNCHRONOUS.S | 2 +- libc/sysv/consts/MS_UNBINDABLE.S | 2 +- libc/sysv/consts/RB_AUTOBOOT.S | 2 +- libc/sysv/consts/RB_DISABLE_CAD.S | 2 +- libc/sysv/consts/RB_ENABLE_CAD.S | 2 +- libc/sysv/consts/{CBRK.S => RB_HALT.S} | 2 +- libc/sysv/consts/RB_HALT_SYSTEM.S | 2 +- libc/sysv/consts/RB_KEXEC.S | 2 +- libc/sysv/consts/RB_NOSYNC.S | 2 + libc/sysv/consts/RB_POWERDOWN.S | 2 + libc/sysv/consts/RB_POWEROFF.S | 2 + libc/sysv/consts/RB_POWER_OFF.S | 2 +- libc/sysv/consts/RB_SW_SUSPEND.S | 2 +- libc/sysv/consts/{IPC_STAT.S => SIGSTKFLT.S} | 2 +- libc/sysv/consts/UMOUNT_NOFOLLOW.S | 2 +- libc/sysv/consts/ipc.h | 28 ---- libc/sysv/consts/mnt.h | 18 --- libc/sysv/consts/mount.h | 140 +++++++++++-------- libc/sysv/consts/reboot.h | 34 +++++ libc/sysv/consts/termios.h | 6 - libc/sysv/consts/unmount.h | 22 +++ libc/sysv/syscalls.sh | 8 +- third_party/chibicc/test/test.mk | 3 + third_party/gdtoa/gdtoa.mk | 12 +- third_party/linenoise/linenoise.c | 125 ++++++++++++++++- third_party/mbedtls/test/test.mk | 2 + third_party/python/Modules/termios.c | 27 ++-- third_party/python/python.mk | 3 + third_party/quickjs/quickjs.mk | 3 + third_party/sqlite3/sqlite3.mk | 4 + tool/emacs/cosmo-cpp-constants.el | 5 +- 143 files changed, 1183 insertions(+), 266 deletions(-) create mode 100644 libc/bits/newbie.h create mode 100644 libc/calls/ftok.c create mode 100644 libc/calls/ipc.h create mode 100644 libc/calls/mount.c create mode 100644 libc/calls/mount.h create mode 100644 libc/calls/reboot.c create mode 100644 libc/calls/ttydefaults.h create mode 100644 libc/calls/unmount.c create mode 100644 libc/isystem/langinfo.h create mode 100644 libc/isystem/locale.h create mode 100644 libc/isystem/stat.h create mode 100644 libc/isystem/strings.h create mode 100644 libc/isystem/sys/dir.h create mode 100644 libc/isystem/sys/errno.h create mode 100644 libc/isystem/sys/fcntl.h create mode 100644 libc/isystem/sys/file.h create mode 100644 libc/isystem/sys/ipc.h create mode 100644 libc/isystem/sys/mount.h create mode 100644 libc/isystem/sys/msg.h delete mode 100644 libc/isystem/sys/param.h create mode 100644 libc/isystem/sys/poll.h create mode 100644 libc/isystem/sys/ptrace.h create mode 100644 libc/isystem/sys/reboot.h create mode 100644 libc/isystem/sys/select.h create mode 100644 libc/isystem/sys/signal.h create mode 100644 libc/isystem/sys/statvfs.h create mode 100644 libc/isystem/sys/syscall.h create mode 100644 libc/isystem/sys/termios.h create mode 100644 libc/isystem/sys/times.h create mode 100644 libc/isystem/sys/ttydefaults.h create mode 100644 libc/isystem/sys/un.h create mode 100644 libc/isystem/uio.h create mode 100644 libc/isystem/wait.h create mode 100644 libc/isystem/zlib.h create mode 100644 libc/nt/PowerProf/SetSuspendState.s create mode 100644 libc/nt/system.h create mode 100644 libc/stdio/fgetln.c delete mode 100644 libc/sysv/calls/reboot.s rename libc/sysv/calls/{mount.s => sys_mount.s} (50%) create mode 100644 libc/sysv/calls/sys_reboot.s create mode 100644 libc/sysv/calls/sys_unmount.s delete mode 100644 libc/sysv/calls/unmount.s delete mode 100644 libc/sysv/consts/CSUSP.S delete mode 100644 libc/sysv/consts/CWERASE.S delete mode 100644 libc/sysv/consts/IPC_CREAT.S delete mode 100644 libc/sysv/consts/IPC_EXCL.S delete mode 100644 libc/sysv/consts/IPC_INFO.S delete mode 100644 libc/sysv/consts/IPC_NOWAIT.S delete mode 100644 libc/sysv/consts/IPC_PRIVATE.S delete mode 100644 libc/sysv/consts/IPC_RMID.S delete mode 100644 libc/sysv/consts/IPC_SET.S create mode 100644 libc/sysv/consts/MNT_ASYNC.S create mode 100644 libc/sysv/consts/MNT_BYFSID.S create mode 100644 libc/sysv/consts/MNT_NOATIME.S create mode 100644 libc/sysv/consts/MNT_NOCLUSTERR.S create mode 100644 libc/sysv/consts/MNT_NOCLUSTERW.S create mode 100644 libc/sysv/consts/MNT_NODEV.S create mode 100644 libc/sysv/consts/MNT_NOEXEC.S create mode 100644 libc/sysv/consts/MNT_NOSUID.S create mode 100644 libc/sysv/consts/MNT_RDONLY.S create mode 100644 libc/sysv/consts/MNT_RELATIME.S create mode 100644 libc/sysv/consts/MNT_RELOAD.S create mode 100644 libc/sysv/consts/MNT_SNAPSHOT.S create mode 100644 libc/sysv/consts/MNT_STRICTATIME.S create mode 100644 libc/sysv/consts/MNT_SUIDDIR.S create mode 100644 libc/sysv/consts/MNT_SYNCHRONOUS.S create mode 100644 libc/sysv/consts/MNT_UPDATE.S rename libc/sysv/consts/{CBRK.S => RB_HALT.S} (50%) create mode 100644 libc/sysv/consts/RB_NOSYNC.S create mode 100644 libc/sysv/consts/RB_POWERDOWN.S create mode 100644 libc/sysv/consts/RB_POWEROFF.S rename libc/sysv/consts/{IPC_STAT.S => SIGSTKFLT.S} (56%) delete mode 100644 libc/sysv/consts/ipc.h delete mode 100644 libc/sysv/consts/mnt.h create mode 100644 libc/sysv/consts/reboot.h create mode 100644 libc/sysv/consts/unmount.h diff --git a/build/config.mk b/build/config.mk index 141977aef..0576b887f 100644 --- a/build/config.mk +++ b/build/config.mk @@ -50,6 +50,8 @@ endif # Release Mode # +# Follows traditional closed source release binary norms. +# # - `make MODE=rel` # - More optimized # - Reasonably small @@ -74,14 +76,40 @@ TARGET_ARCH ?= \ endif +# Asan Mode +# +# Safer binaries good for backend production serving. +# +# - `make MODE=asan` +# - Memory safety +# - Production worthy +# - Backtraces +# - Debuggability +# - Larger binaries + +ifeq ($(MODE), asan) + +CONFIG_CCFLAGS += \ + $(BACKTRACES) \ + -O2 + +CONFIG_COPTS += \ + -fsanitize=address + +TARGET_ARCH ?= \ + -msse3 + +endif + # Debug Mode # # - `make MODE=dbg` # - Backtraces -# - Zero optimization -# - Enables sanitization -# - Enables stack canaries -# - Enormous binaries (b/c ubsan suboptimalities) +# - Enables asan +# - Enables ubsan (TODO) +# - Stack canaries +# - No optimization (TODO) +# - Enormous binaries ifeq ($(MODE), dbg) @@ -91,11 +119,10 @@ CONFIG_CPPFLAGS += \ CONFIG_CCFLAGS += \ $(BACKTRACES) \ $(FTRACE) \ - -Og + -O2 CONFIG_COPTS += \ - $(SECURITY_BLANKETS) \ - $(SANITIZER) + -fsanitize=address TARGET_ARCH ?= \ -msse3 @@ -116,6 +143,7 @@ endif # - No backtraces # - No algorithmics # - YOLO + ifeq ($(MODE), tiny) CONFIG_CPPFLAGS += \ -DTINY \ @@ -143,6 +171,7 @@ endif # - No portability # - No algorithmics # - YOLO + ifeq ($(MODE), tinylinux) CONFIG_CPPFLAGS += \ -DTINY \ @@ -172,6 +201,7 @@ endif # - No backtraces # - No algorithmics # - YOLO + ifeq ($(MODE), tinylinuxbsd) CONFIG_CPPFLAGS += \ -DTINY \ @@ -200,6 +230,7 @@ endif # - No backtraces # - No algorithmics # - YOLO + ifeq ($(MODE), tinysysv) CONFIG_CPPFLAGS += \ -DTINY \ @@ -228,6 +259,7 @@ endif # - No backtraces # - No algorithmics # - YOLO + ifeq ($(MODE), tinynowin) CONFIG_CPPFLAGS += \ -DTINY \ diff --git a/libc/bits/newbie.h b/libc/bits/newbie.h new file mode 100644 index 000000000..5a0a673d3 --- /dev/null +++ b/libc/bits/newbie.h @@ -0,0 +1,55 @@ +#ifndef COSMOPOLITAN_LIBC_BITS_NEWBIE_H_ +#define COSMOPOLITAN_LIBC_BITS_NEWBIE_H_ +#include "libc/bits/bswap.h" + +/* + * Macros for newbies. + * https://justine.lol/endian.html + */ + +#define BYTE_ORDER __BYTE_ORDER__ +#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +#define BIG_ENDIAN __ORDER_BIG_ENDIAN__ +#define PDP_ENDIAN __ORDER_PDP_ENDIAN__ + +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define htobe16(x) bswap_16(x) +#define be16toh(x) bswap_16(x) +#define betoh16(x) bswap_16(x) +#define htobe32(x) bswap_32(x) +#define be32toh(x) bswap_32(x) +#define betoh32(x) bswap_32(x) +#define htobe64(x) bswap_64(x) +#define be64toh(x) bswap_64(x) +#define betoh64(x) bswap_64(x) +#define htole16(x) (uint16_t)(x) +#define le16toh(x) (uint16_t)(x) +#define letoh16(x) (uint16_t)(x) +#define htole32(x) (uint32_t)(x) +#define le32toh(x) (uint32_t)(x) +#define letoh32(x) (uint32_t)(x) +#define htole64(x) (uint64_t)(x) +#define le64toh(x) (uint64_t)(x) +#define letoh64(x) (uint64_t)(x) +#else +#define htobe16(x) (uint16_t)(x) +#define be16toh(x) (uint16_t)(x) +#define betoh16(x) (uint16_t)(x) +#define htobe32(x) (uint32_t)(x) +#define be32toh(x) (uint32_t)(x) +#define betoh32(x) (uint32_t)(x) +#define htobe64(x) (uint64_t)(x) +#define be64toh(x) (uint64_t)(x) +#define betoh64(x) (uint64_t)(x) +#define htole16(x) bswap_16(x) +#define le16toh(x) bswap_16(x) +#define letoh16(x) bswap_16(x) +#define htole32(x) bswap_32(x) +#define le32toh(x) bswap_32(x) +#define letoh32(x) bswap_32(x) +#define htole64(x) bswap_64(x) +#define le64toh(x) bswap_64(x) +#define letoh64(x) bswap_64(x) +#endif + +#endif /* COSMOPOLITAN_LIBC_BITS_NEWBIE_H_ */ diff --git a/libc/calls/calls.h b/libc/calls/calls.h index e224f0351..af26e853e 100644 --- a/libc/calls/calls.h +++ b/libc/calls/calls.h @@ -151,6 +151,7 @@ int posix_fadvise(int, uint64_t, uint64_t, int); int posix_madvise(void *, uint64_t, int); int prctl(); int raise(int); +int reboot(int); int readlink(const char *, char *, size_t); int remove(const char *); int rename(const char *, const char *); diff --git a/libc/calls/calls.mk b/libc/calls/calls.mk index 003d04fef..d89ef358e 100644 --- a/libc/calls/calls.mk +++ b/libc/calls/calls.mk @@ -41,10 +41,11 @@ LIBC_CALLS_A_DIRECTDEPS = \ LIBC_INTRIN \ LIBC_NEXGEN32E \ LIBC_NT_ADVAPI32 \ + LIBC_NT_IPHLPAPI \ LIBC_NT_KERNEL32 \ LIBC_NT_NTDLL \ + LIBC_NT_POWERPROF \ LIBC_NT_WS2_32 \ - LIBC_NT_IPHLPAPI \ LIBC_STR \ LIBC_STUBS \ LIBC_SYSV_CALLS \ diff --git a/libc/calls/ftok.c b/libc/calls/ftok.c new file mode 100644 index 000000000..291964e93 --- /dev/null +++ b/libc/calls/ftok.c @@ -0,0 +1,28 @@ +/*-*- 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/calls.h" +#include "libc/calls/struct/stat.h" +#include "libc/calls/weirdtypes.h" +#include "libc/str/str.h" + +int ftok(const char *path, int id) { + struct stat st; + if (stat(path, &st) == -1) return -1; + return (uint32_t)id << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xffff); +} diff --git a/libc/calls/ipc.h b/libc/calls/ipc.h new file mode 100644 index 000000000..8a90f31c8 --- /dev/null +++ b/libc/calls/ipc.h @@ -0,0 +1,20 @@ +#ifndef COSMOPOLITAN_LIBC_CALLS_IPC_H_ +#define COSMOPOLITAN_LIBC_CALLS_IPC_H_ + +#define IPC_PRIVATE 0 +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_STAT 2 +#define IPC_INFO 3 +#define IPC_CREAT 01000 +#define IPC_EXCL 02000 +#define IPC_NOWAIT 04000 + +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +int ftok(const char *, int); + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ +#endif /* COSMOPOLITAN_LIBC_CALLS_IPC_H_ */ diff --git a/libc/calls/mount.c b/libc/calls/mount.c new file mode 100644 index 000000000..36bb2560f --- /dev/null +++ b/libc/calls/mount.c @@ -0,0 +1,100 @@ +/*-*- 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/mount.h" +#include "libc/dce.h" +#include "libc/str/str.h" +#include "libc/sysv/errfuns.h" + +int32_t sys_mount_linux(const char *source, const char *target, + const char *filesystemtype, uint64_t mountflags, + const void *data) asm("sys_mount"); +int32_t sys_mount_bsd(const char *type, const char *dir, int32_t flags, + void *data) asm("sys_mount"); + +/** + * Mounts file system. + * + * The following flags may be specified: + * + * - `MS_RDONLY` (mount read-only) + * - `MS_NOSUID` (don't honor S_ISUID bit) + * - `MS_NODEV` (disallow special files) + * - `MS_NOEXEC` (disallow program execution) + * - `MS_SYNCHRONOUS` (writes are synced at once) + * - `MS_NOATIME` (do not update access times) + * - `MS_REMOUNT` (tune existing mounting) + * + * The following flags may also be used, but could be set to zero at + * runtime if the underlying kernel doesn't support them. + * + * - `MNT_ASYNC` (xnu, freebsd, openbsd, netbsd) + * - `MNT_RELOAD` (xnu, freebsd, openbsd, netbsd) + * - `MS_STRICTATIME` (linux, xnu) + * - `MS_RELATIME` (linux, netbsd) + * - `MNT_SNAPSHOT` (xnu, freebsd) + * - `MS_MANDLOCK` (linux) + * - `MS_DIRSYNC` (linux) + * - `MS_NODIRATIME` (linux) + * - `MS_BIND` (linux) + * - `MS_MOVE` (linux) + * - `MS_REC` (linux) + * - `MS_SILENT` (linux) + * - `MS_POSIXACL` (linux) + * - `MS_UNBINDABLE` (linux) + * - `MS_PRIVATE` (linux) + * - `MS_SLAVE` (linux) + * - `MS_SHARED` (linux) + * - `MS_KERNMOUNT` (linux) + * - `MS_I_VERSION` (linux) + * - `MS_LAZYTIME` (linux) + * - `MS_ACTIVE` (linux) + * - `MS_NOUSER` (linux) + * - `MS_RMT`_MASK (linux) + * - `MNT_SUIDDIR` (freebsd) + * - `MNT_NOCLUSTERR` (freebsd) + * - `MNT_NOCLUSTERW` (freebsd) + * + * Some example values for the `type` parameter: + * + * - `"nfs"` + * - `"vfat"` + * - `"tmpfs"` + * - `"iso8601"` + * + */ +int mount(const char *source, const char *target, const char *type, + unsigned long flags, const void *data) { + if (!IsWindows()) { + if (!IsBsd()) { + return sys_mount_linux(source, target, type, flags, data); + } else { + if (!strcmp(type, "iso9660")) type = "cd9660"; + if (!strcmp(type, "vfat")) { + if (IsOpenbsd() || IsNetbsd()) { + type = "msdos"; + } else { + type = "msdosfs"; + } + } + return sys_mount_bsd(type, target, flags, data); + } + } else { + return enosys(); + } +} diff --git a/libc/calls/mount.h b/libc/calls/mount.h new file mode 100644 index 000000000..ee0b88830 --- /dev/null +++ b/libc/calls/mount.h @@ -0,0 +1,17 @@ +#ifndef COSMOPOLITAN_LIBC_CALLS_MOUNT_H_ +#define COSMOPOLITAN_LIBC_CALLS_MOUNT_H_ +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +int mount(const char *, const char *, const char *, unsigned long, + const void *); +int unmount(const char *, int); + +#ifdef _GNU_SOURCE +int umount(const char *); +int umount2(const char *, int); +#endif + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ +#endif /* COSMOPOLITAN_LIBC_CALLS_MOUNT_H_ */ diff --git a/libc/calls/reboot.c b/libc/calls/reboot.c new file mode 100644 index 000000000..ed3656aef --- /dev/null +++ b/libc/calls/reboot.c @@ -0,0 +1,93 @@ +/*-*- 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/calls.h" +#include "libc/calls/internal.h" +#include "libc/calls/struct/framebuffervirtualscreeninfo.h" +#include "libc/dce.h" +#include "libc/nt/system.h" +#include "libc/runtime/runtime.h" +#include "libc/sysv/errfuns.h" + +#define kNtShutdownForceOthers 1 +#define kNtShutdownForceSelf 2 +#define kNtShutdownGraceOverride 0x20 +#define kNtShutdownHybrid 0x200 + +int32_t sys_reboot_linux(int32_t, int32_t, int32_t) asm("sys_reboot"); +int32_t sys_reboot_bsd(int32_t, const char *) asm("sys_reboot"); + +/** + * Reboots system. + * + * The `howto` argument may be one of the following: + * + * - `RB_AUTOBOOT` + * - `RB_POWER_OFF` + * - `RB_HALT_SYSTEM` + * - `RB_SW_SUSPEND` (linux and windows only) + * - `RB_KEXEC` (linux only) + * - `RB_ENABLE_CAD` (linux only) + * - `RB_DISABLE_CAD` (linux only) + * + * There's an implicit `sync()` operation before the reboot happens. + * This can be prevented by or'ing `howto` with `RB_NOSYNC`. Setting + * this option will also prevent apps on Windows from having time to + * close themselves. + */ +int reboot(int howto) { + bool ok, immediately; + if (howto != -1) { + if (!(howto & 0x20000000)) { + sync(); + immediately = false; + } else { + howto &= ~0x20000000; + immediately = true; + } + if (!IsWindows()) { + if (IsLinux()) { + return sys_reboot_linux(0xFEE1DEAD, 0x28121969, howto); + } else { + return sys_reboot_bsd(howto, 0); + } + } else { + if (howto == 0xD000FCE2u) { + ok = !!SetSuspendState(0, 0, 0); + } else { + howto |= kNtShutdownForceOthers; + howto |= kNtShutdownForceSelf; + if (NtGetVersion() >= 8) { + howto |= kNtShutdownHybrid; + } + if (immediately) { + ok = !!InitiateShutdown(0, 0, 0, howto | kNtShutdownGraceOverride, 0); + } else { + ok = !!InitiateShutdown(0, 0, 20, howto, 0); + } + } + if (ok) { + return 0; + } else { + return -1; + } + } + } else { + return einval(); + } +} diff --git a/libc/calls/ttydefaults.h b/libc/calls/ttydefaults.h new file mode 100644 index 000000000..9aac9b846 --- /dev/null +++ b/libc/calls/ttydefaults.h @@ -0,0 +1,33 @@ +#ifndef COSMOPOLITAN_LIBC_CALLS_TTYDEFAULTS_H_ +#define COSMOPOLITAN_LIBC_CALLS_TTYDEFAULTS_H_ +#include "libc/sysv/consts/baud.h" +#include "libc/sysv/consts/termios.h" + +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE | ECHOKE | ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL) +#define TTYDEF_SPEED (B9600) + +#define CTRL(x) ((x) ^ 0100) +#define CEOF CTRL('D') +#define CERASE CTRL('?') +#define CINTR CTRL('C') +#define CKILL CTRL('U') +#define CQUIT CTRL('\\') +#define CSUSP CTRL('Z') +#define CDSUSP CTRL('Y') +#define CSTART CTRL('Q') +#define CSTOP CTRL('S') +#define CLNEXT CTRL('V') +#define CDISCARD CTRL('O') +#define CWERASE CTRL('W') +#define CREPRINT CTRL('R') +#define CEOT CEOF +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD +#define CMIN 1 +#define CTIME 0 + +#endif /* COSMOPOLITAN_LIBC_CALLS_TTYDEFAULTS_H_ */ diff --git a/libc/calls/unmount.c b/libc/calls/unmount.c new file mode 100644 index 000000000..46eee4447 --- /dev/null +++ b/libc/calls/unmount.c @@ -0,0 +1,41 @@ +/*-*- 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/mount.h" + +int sys_unmount(const char *, int); + +/** + * Unmounts file system. + * + * The following flags may be specified: + * + * - `MNT_FORCE` + * + * The following flags may also be used, but could be set to zero at + * runtime if the underlying kernel doesn't support them. + * + * - `MNT_DETACH` + * - `MNT_EXPIRE` + * - `UMOUNT_NOFOLLOW` + * - `MNT_BYFSID` + * + */ +int unmount(const char *target, int flags) { + return sys_unmount(target, flags); +} diff --git a/libc/isystem/endian.h b/libc/isystem/endian.h index ff745bf41..60a154711 100644 --- a/libc/isystem/endian.h +++ b/libc/isystem/endian.h @@ -1,4 +1,4 @@ #ifndef LIBC_ISYSTEM_ENDIAN_H_ #define LIBC_ISYSTEM_ENDIAN_H_ -#include "libc/fmt/conv.h" +#include "libc/bits/newbie.h" #endif diff --git a/libc/isystem/langinfo.h b/libc/isystem/langinfo.h new file mode 100644 index 000000000..217a859d8 --- /dev/null +++ b/libc/isystem/langinfo.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_LANGINFO_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_LANGINFO_H_ + +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_LANGINFO_H_ */ diff --git a/libc/isystem/locale.h b/libc/isystem/locale.h new file mode 100644 index 000000000..e0ef4adc3 --- /dev/null +++ b/libc/isystem/locale.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_LOCALE_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_LOCALE_H_ +#include "libc/unicode/locale.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_LOCALE_H_ */ diff --git a/libc/isystem/signal.h b/libc/isystem/signal.h index e8a4084fd..cb41528f6 100644 --- a/libc/isystem/signal.h +++ b/libc/isystem/signal.h @@ -1,4 +1,8 @@ #ifndef LIBC_ISYSTEM_SIGNAL_H_ #define LIBC_ISYSTEM_SIGNAL_H_ #include "libc/calls/calls.h" +#include "libc/calls/sigbits.h" +#include "libc/calls/struct/sigaction.h" +#include "libc/calls/struct/siginfo.h" +#include "libc/sysv/consts/sicode.h" #endif diff --git a/libc/isystem/stat.h b/libc/isystem/stat.h new file mode 100644 index 000000000..586a99816 --- /dev/null +++ b/libc/isystem/stat.h @@ -0,0 +1,7 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_STAT_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_STAT_H_ +#include "libc/calls/calls.h" +#include "libc/calls/struct/stat.h" +#include "libc/calls/weirdtypes.h" +#include "libc/sysv/consts/s.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_STAT_H_ */ diff --git a/libc/isystem/strings.h b/libc/isystem/strings.h new file mode 100644 index 000000000..997b2fcca --- /dev/null +++ b/libc/isystem/strings.h @@ -0,0 +1,7 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_STRINGS_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_STRINGS_H_ +#include "libc/str/str.h" +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include "libc/nexgen32e/ffs.h" +#endif +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_STRINGS_H_ */ diff --git a/libc/isystem/sys/dir.h b/libc/isystem/sys/dir.h new file mode 100644 index 000000000..04c85bd1e --- /dev/null +++ b/libc/isystem/sys/dir.h @@ -0,0 +1,5 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_DIR_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_DIR_H_ +#include "libc/isystem/dirent.h" +#define direct dirent +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_DIR_H_ */ diff --git a/libc/isystem/sys/errno.h b/libc/isystem/sys/errno.h new file mode 100644 index 000000000..5e8358276 --- /dev/null +++ b/libc/isystem/sys/errno.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_ERRNO_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_ERRNO_H_ +#include "libc/isystem/errno.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_ERRNO_H_ */ diff --git a/libc/isystem/sys/fcntl.h b/libc/isystem/sys/fcntl.h new file mode 100644 index 000000000..9f94bba8c --- /dev/null +++ b/libc/isystem/sys/fcntl.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_FCNTL_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_FCNTL_H_ +#include "libc/isystem/fcntl.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_FCNTL_H_ */ diff --git a/libc/isystem/sys/file.h b/libc/isystem/sys/file.h new file mode 100644 index 000000000..82ec41632 --- /dev/null +++ b/libc/isystem/sys/file.h @@ -0,0 +1,10 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_FILE_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_FILE_H_ +#include "libc/calls/calls.h" +#include "libc/sysv/consts/lock.h" + +#define L_SET SEEK_SET +#define L_INCR SEEK_CUR +#define L_XTND SEEK_END + +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_FILE_H_ */ diff --git a/libc/isystem/sys/ioctl.h b/libc/isystem/sys/ioctl.h index 8b6c0725d..8d1f9d254 100644 --- a/libc/isystem/sys/ioctl.h +++ b/libc/isystem/sys/ioctl.h @@ -1,6 +1,11 @@ #ifndef LIBC_ISYSTEM_SYS_IOCTL_H_ #define LIBC_ISYSTEM_SYS_IOCTL_H_ #include "libc/calls/calls.h" +#include "libc/calls/ioctl.h" +#include "libc/calls/struct/winsize.h" #include "libc/sysv/consts/blk.h" #include "libc/sysv/consts/fd.h" +#include "libc/sysv/consts/n.h" +#include "libc/sysv/consts/pty.h" +#include "libc/sysv/consts/sio.h" #endif diff --git a/libc/isystem/sys/ipc.h b/libc/isystem/sys/ipc.h new file mode 100644 index 000000000..6b69674f1 --- /dev/null +++ b/libc/isystem/sys/ipc.h @@ -0,0 +1,6 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_IPC_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_IPC_H_ +#include "libc/calls/ipc.h" +#include "libc/calls/weirdtypes.h" +#include "libc/sysv/consts/ipc.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_IPC_H_ */ diff --git a/libc/isystem/sys/mman.h b/libc/isystem/sys/mman.h index 1342c0a0a..6a61bcbb3 100644 --- a/libc/isystem/sys/mman.h +++ b/libc/isystem/sys/mman.h @@ -1,6 +1,17 @@ #ifndef LIBC_ISYSTEM_SYS_MMAN_H_ #define LIBC_ISYSTEM_SYS_MMAN_H_ #include "libc/calls/calls.h" +#include "libc/calls/weirdtypes.h" +#include "libc/runtime/runtime.h" #include "libc/sysv/consts/map.h" +#include "libc/sysv/consts/mlock.h" +#include "libc/sysv/consts/msync.h" +#include "libc/sysv/consts/posix.h" +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#include "libc/sysv/consts/madv.h" +#endif +#if defined(_GNU_SOURCE) +#include "libc/sysv/consts/mfd.h" #include "libc/sysv/consts/mremap.h" #endif +#endif diff --git a/libc/isystem/sys/mount.h b/libc/isystem/sys/mount.h new file mode 100644 index 000000000..c83b869c3 --- /dev/null +++ b/libc/isystem/sys/mount.h @@ -0,0 +1,6 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_MOUNT_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_MOUNT_H_ +#include "libc/calls/mount.h" +#include "libc/sysv/consts/mount.h" +#include "libc/sysv/consts/unmount.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_MOUNT_H_ */ diff --git a/libc/isystem/sys/msg.h b/libc/isystem/sys/msg.h new file mode 100644 index 000000000..342b74dff --- /dev/null +++ b/libc/isystem/sys/msg.h @@ -0,0 +1,5 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_MSG_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_MSG_H_ +#include "libc/calls/weirdtypes.h" +#include "libc/sysv/consts/msg.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_MSG_H_ */ diff --git a/libc/isystem/sys/param.h b/libc/isystem/sys/param.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/libc/isystem/sys/poll.h b/libc/isystem/sys/poll.h new file mode 100644 index 000000000..1ab1d2d3b --- /dev/null +++ b/libc/isystem/sys/poll.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_POLL_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_POLL_H_ +#include "libc/isystem/poll.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_POLL_H_ */ diff --git a/libc/isystem/sys/ptrace.h b/libc/isystem/sys/ptrace.h new file mode 100644 index 000000000..aa8c47888 --- /dev/null +++ b/libc/isystem/sys/ptrace.h @@ -0,0 +1,5 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PTRACE_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PTRACE_H_ +#include "libc/calls/calls.h" +#include "libc/sysv/consts/ptrace.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_PTRACE_H_ */ diff --git a/libc/isystem/sys/reboot.h b/libc/isystem/sys/reboot.h new file mode 100644 index 000000000..7120cfe1f --- /dev/null +++ b/libc/isystem/sys/reboot.h @@ -0,0 +1,5 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_REBOOT_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_REBOOT_H_ +#include "libc/calls/calls.h" +#include "libc/sysv/consts/reboot.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_REBOOT_H_ */ diff --git a/libc/isystem/sys/resource.h b/libc/isystem/sys/resource.h index 3df985288..1053f0908 100644 --- a/libc/isystem/sys/resource.h +++ b/libc/isystem/sys/resource.h @@ -1,4 +1,11 @@ #ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_RESOURCE_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_RESOURCE_H_ #include "libc/calls/calls.h" +#include "libc/calls/struct/rlimit.h" +#include "libc/calls/struct/rusage.h" +#include "libc/calls/weirdtypes.h" +#include "libc/sysv/consts/prio.h" +#include "libc/sysv/consts/rlim.h" +#include "libc/sysv/consts/rlimit.h" +#include "libc/sysv/consts/rusage.h" #endif diff --git a/libc/isystem/sys/select.h b/libc/isystem/sys/select.h new file mode 100644 index 000000000..f9b431d21 --- /dev/null +++ b/libc/isystem/sys/select.h @@ -0,0 +1,5 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_SELECT_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_SELECT_H_ +#include "libc/calls/weirdtypes.h" +#include "libc/sock/select.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SELECT_H_ */ diff --git a/libc/isystem/sys/signal.h b/libc/isystem/sys/signal.h new file mode 100644 index 000000000..489142928 --- /dev/null +++ b/libc/isystem/sys/signal.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ +#include "libc/isystem/signal.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */ diff --git a/libc/isystem/sys/statvfs.h b/libc/isystem/sys/statvfs.h new file mode 100644 index 000000000..af486bbf9 --- /dev/null +++ b/libc/isystem/sys/statvfs.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_STATVFS_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_STATVFS_H_ +#include "libc/sysv/consts/st.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_STATVFS_H_ */ diff --git a/libc/isystem/sys/syscall.h b/libc/isystem/sys/syscall.h new file mode 100644 index 000000000..8e5bce628 --- /dev/null +++ b/libc/isystem/sys/syscall.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYSCALL_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYSCALL_H_ +#include "libc/calls/calls.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYSCALL_H_ */ diff --git a/libc/isystem/sys/termios.h b/libc/isystem/sys/termios.h new file mode 100644 index 000000000..ed53b23cf --- /dev/null +++ b/libc/isystem/sys/termios.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_TERMIOS_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_TERMIOS_H_ +#include "libc/isystem/termios.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_TERMIOS_H_ */ diff --git a/libc/isystem/sys/time.h b/libc/isystem/sys/time.h index 6774a5742..1a531ee2b 100644 --- a/libc/isystem/sys/time.h +++ b/libc/isystem/sys/time.h @@ -1,6 +1,8 @@ #ifndef LIBC_ISYSTEM_SYS_TIME_H_ #define LIBC_ISYSTEM_SYS_TIME_H_ +#include "libc/calls/struct/timeval.h" #include "libc/sysv/consts/clock.h" #include "libc/sysv/consts/itimer.h" +#include "libc/time/struct/timezone.h" #include "libc/time/time.h" #endif diff --git a/libc/isystem/sys/times.h b/libc/isystem/sys/times.h new file mode 100644 index 000000000..d7d06e0a3 --- /dev/null +++ b/libc/isystem/sys/times.h @@ -0,0 +1,5 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_TIMES_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_TIMES_H_ +#include "libc/calls/calls.h" +#include "libc/calls/struct/tms.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_TIMES_H_ */ diff --git a/libc/isystem/sys/ttydefaults.h b/libc/isystem/sys/ttydefaults.h new file mode 100644 index 000000000..9630f057d --- /dev/null +++ b/libc/isystem/sys/ttydefaults.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_TTYDEFAULTS_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_TTYDEFAULTS_H_ +#include "libc/calls/ttydefaults.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_TTYDEFAULTS_H_ */ diff --git a/libc/isystem/sys/types.h b/libc/isystem/sys/types.h index 186037fc5..770cf6fd9 100644 --- a/libc/isystem/sys/types.h +++ b/libc/isystem/sys/types.h @@ -1,4 +1,20 @@ #ifndef LIBC_ISYSTEM_SYS_TYPES_H_ #define LIBC_ISYSTEM_SYS_TYPES_H_ #include "libc/calls/weirdtypes.h" + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned u_int32_t; +typedef char *caddr_t; +typedef unsigned char u_char; +typedef unsigned short u_short, ushort; +typedef unsigned u_int, uint; +typedef unsigned long u_long, ulong; +typedef long long quad_t; +typedef unsigned long long u_quad_t; +#include +#include +#endif + #endif diff --git a/libc/isystem/sys/un.h b/libc/isystem/sys/un.h new file mode 100644 index 000000000..f93565a54 --- /dev/null +++ b/libc/isystem/sys/un.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_UN_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_UN_H_ +#include "libc/sock/sock.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_UN_H_ */ diff --git a/libc/isystem/sys/utsname.h b/libc/isystem/sys/utsname.h index 424c3d2c2..5d26809e0 100644 --- a/libc/isystem/sys/utsname.h +++ b/libc/isystem/sys/utsname.h @@ -1,4 +1,5 @@ #ifndef LIBC_ISYSTEM_SYS_UTSNAME_H_ #define LIBC_ISYSTEM_SYS_UTSNAME_H_ #include "libc/calls/calls.h" +#include "libc/calls/struct/utsname.h" #endif diff --git a/libc/isystem/sys/wait.h b/libc/isystem/sys/wait.h index 2e3fb8e79..0bf76cb6e 100644 --- a/libc/isystem/sys/wait.h +++ b/libc/isystem/sys/wait.h @@ -1,5 +1,6 @@ #ifndef LIBC_ISYSTEM_SYS_WAIT_H_ #define LIBC_ISYSTEM_SYS_WAIT_H_ #include "libc/calls/calls.h" +#include "libc/calls/weirdtypes.h" #include "libc/sysv/consts/w.h" #endif diff --git a/libc/isystem/uio.h b/libc/isystem/uio.h new file mode 100644 index 000000000..b611a00dd --- /dev/null +++ b/libc/isystem/uio.h @@ -0,0 +1,6 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_UIO_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_UIO_H_ +#include "libc/calls/calls.h" +#include "libc/calls/struct/iovec.h" +#include "libc/sock/sock.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_UIO_H_ */ diff --git a/libc/isystem/wait.h b/libc/isystem/wait.h new file mode 100644 index 000000000..2fbe3c20a --- /dev/null +++ b/libc/isystem/wait.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_WAIT_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_WAIT_H_ +#include "libc/isystem/sys/wait.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_WAIT_H_ */ diff --git a/libc/isystem/zlib.h b/libc/isystem/zlib.h new file mode 100644 index 000000000..705f3db8c --- /dev/null +++ b/libc/isystem/zlib.h @@ -0,0 +1,4 @@ +#ifndef COSMOPOLITAN_LIBC_ISYSTEM_ZLIB_H_ +#define COSMOPOLITAN_LIBC_ISYSTEM_ZLIB_H_ +#include "third_party/zlib/zlib.h" +#endif /* COSMOPOLITAN_LIBC_ISYSTEM_ZLIB_H_ */ diff --git a/libc/nt/PowerProf/SetSuspendState.s b/libc/nt/PowerProf/SetSuspendState.s new file mode 100644 index 000000000..1cc2efb42 --- /dev/null +++ b/libc/nt/PowerProf/SetSuspendState.s @@ -0,0 +1,12 @@ +.include "o/libc/nt/codegen.inc" +.imp PowerProf,__imp_SetSuspendState,SetSuspendState,0 + + .text.windows +SetSuspendState: + push %rbp + mov %rsp,%rbp + .profilable + mov __imp_SetSuspendState(%rip),%rax + jmp __sysv2nt + .endfn SetSuspendState,globl + .previous diff --git a/libc/nt/advapi32/InitiateShutdownA.s b/libc/nt/advapi32/InitiateShutdownA.s index 2907ed2c0..c95add0d4 100644 --- a/libc/nt/advapi32/InitiateShutdownA.s +++ b/libc/nt/advapi32/InitiateShutdownA.s @@ -1,2 +1,12 @@ .include "o/libc/nt/codegen.inc" .imp advapi32,__imp_InitiateShutdownA,InitiateShutdownA,1402 + + .text.windows +InitiateShutdownA: + push %rbp + mov %rsp,%rbp + .profilable + mov __imp_InitiateShutdownA(%rip),%rax + jmp __sysv2nt6 + .endfn InitiateShutdownA,globl + .previous diff --git a/libc/nt/advapi32/InitiateShutdownW.s b/libc/nt/advapi32/InitiateShutdownW.s index 4001bcfc3..df15ccf7c 100644 --- a/libc/nt/advapi32/InitiateShutdownW.s +++ b/libc/nt/advapi32/InitiateShutdownW.s @@ -1,2 +1,12 @@ .include "o/libc/nt/codegen.inc" .imp advapi32,__imp_InitiateShutdownW,InitiateShutdownW,1403 + + .text.windows +InitiateShutdown: + push %rbp + mov %rsp,%rbp + .profilable + mov __imp_InitiateShutdownW(%rip),%rax + jmp __sysv2nt6 + .endfn InitiateShutdown,globl + .previous diff --git a/libc/nt/master.sh b/libc/nt/master.sh index cce41ca42..d7b10c3ca 100755 --- a/libc/nt/master.sh +++ b/libc/nt/master.sh @@ -2897,8 +2897,8 @@ imp 'InitializeSecurityDescriptor' InitializeSecurityDescriptor advapi32 0 imp 'InitializeSid' InitializeSid advapi32 0 # KernelBase imp 'InitializeSynchronizationBarrier' InitializeSynchronizationBarrier kernel32 0 # KernelBase imp 'InitializeTouchInjection' InitializeTouchInjection user32 2034 -imp 'InitiateShutdownA' InitiateShutdownA advapi32 1402 -imp 'InitiateShutdown' InitiateShutdownW advapi32 1403 +imp 'InitiateShutdownA' InitiateShutdownA advapi32 1402 5 +imp 'InitiateShutdown' InitiateShutdownW advapi32 1403 5 imp 'InitiateSystemShutdownA' InitiateSystemShutdownA advapi32 1404 imp 'InitiateSystemShutdownExA' InitiateSystemShutdownExA advapi32 1405 imp 'InitiateSystemShutdownEx' InitiateSystemShutdownExW advapi32 1406 @@ -6358,6 +6358,7 @@ imp 'SetStateVersion' SetStateVersion KernelBase 1549 imp 'SetStdHandle' SetStdHandle kernel32 0 2 # KernelBase imp 'SetStdHandleEx' SetStdHandleEx KernelBase 1551 imp 'SetStretchBltMode' SetStretchBltMode gdi32 1908 +imp 'SetSuspendState' SetSuspendState PowerProf 0 3 imp 'SetSysColors' SetSysColors user32 2375 imp 'SetSysColorsTemp' SetSysColorsTemp user32 2376 imp 'SetSystemCursor' SetSystemCursor user32 2377 diff --git a/libc/nt/nt.mk b/libc/nt/nt.mk index b95dd5901..767e793db 100644 --- a/libc/nt/nt.mk +++ b/libc/nt/nt.mk @@ -332,6 +332,25 @@ $(LIBC_NT_IPHLPAPI_A).pkg: \ #─────────────────────────────────────────────────────────────────────────────── +LIBC_NT_ARTIFACTS += LIBC_NT_POWERPROF_A +LIBC_NT_POWERPROF = $(LIBC_NT_POWERPROF_A_DEPS) $(LIBC_NT_POWERPROF_A) +LIBC_NT_POWERPROF_A = o/$(MODE)/libc/nt/powerprof.a +LIBC_NT_POWERPROF_A_SRCS := $(wildcard libc/nt/PowerProf/*.s) +LIBC_NT_POWERPROF_A_OBJS = $(LIBC_NT_POWERPROF_A_SRCS:%.s=o/$(MODE)/%.o) +LIBC_NT_POWERPROF_A_CHECKS = $(LIBC_NT_POWERPROF_A).pkg +LIBC_NT_POWERPROF_A_DIRECTDEPS = LIBC_NT_KERNEL32 +LIBC_NT_POWERPROF_A_DEPS := \ + $(call uniq,$(foreach x,$(LIBC_NT_POWERPROF_A_DIRECTDEPS),$($(x)))) +$(LIBC_NT_POWERPROF_A): \ + libc/nt/PowerProf/ \ + $(LIBC_NT_POWERPROF_A).pkg \ + $(LIBC_NT_POWERPROF_A_OBJS) +$(LIBC_NT_POWERPROF_A).pkg: \ + $(LIBC_NT_POWERPROF_A_OBJS) \ + $(foreach x,$(LIBC_NT_POWERPROF_A_DIRECTDEPS),$($(x)_A).pkg) + +#─────────────────────────────────────────────────────────────────────────────── + $(LIBC_NT_OBJS): o/libc/nt/codegen.inc o/libc/nt/codegen.inc: \ diff --git a/libc/nt/system.h b/libc/nt/system.h new file mode 100644 index 000000000..bdfe7567a --- /dev/null +++ b/libc/nt/system.h @@ -0,0 +1,39 @@ +#ifndef COSMOPOLITAN_LIBC_NT_SYSTEM_H_ +#define COSMOPOLITAN_LIBC_NT_SYSTEM_H_ +/* ░░░░ + ▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░ + ▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░ + ▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░ + ▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█ + ▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓ + ░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█ + ▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓ + ▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒ + ▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█ + ▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓ + ░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█ + ▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓ + ░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓ + ▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████ + ▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███ + ▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███ + ▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██ + ▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██ + ▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███ + ░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██ +╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗ +│ cosmopolitan § new technology » system control ─╬─│┼ +╚────────────────────────────────────────────────────────────────────────────│*/ +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +bool32 SetSuspendState(bool32 bHibernate, bool32 bForce, + bool32 bWakeupEventsDisabled); + +uint32_t InitiateShutdown(const char16_t *lpMachineName, + const char16_t *lpMessage, uint32_t dwGracePeriod, + uint32_t dwShutdownFlags, uint32_t dwReason); + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ +#endif /* COSMOPOLITAN_LIBC_NT_SYSTEM_H_ */ diff --git a/libc/stdio/fgetln.c b/libc/stdio/fgetln.c new file mode 100644 index 000000000..6749197e3 --- /dev/null +++ b/libc/stdio/fgetln.c @@ -0,0 +1,30 @@ +/*-*- 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/stdio/stdio.h" + +char *fgetln(FILE *stream, size_t *len) { + ssize_t rc; + size_t n = 0; + if ((rc = getdelim(&stream->getln, &n, '\n', stream)) > 0) { + *len = rc; + return stream->getln; + } else { + return 0; + } +} diff --git a/libc/stdio/stdio.h b/libc/stdio/stdio.h index 7d3d06495..9ecd15cf9 100644 --- a/libc/stdio/stdio.h +++ b/libc/stdio/stdio.h @@ -24,6 +24,7 @@ typedef struct FILE { uint32_t size; /* 0x20 */ uint32_t nofree; /* 0x24 */ int pid; /* 0x28 */ + char *getln; } FILE; extern FILE *stdin; diff --git a/libc/str/str.mk b/libc/str/str.mk index e40f81e0e..4b803c785 100644 --- a/libc/str/str.mk +++ b/libc/str/str.mk @@ -81,6 +81,11 @@ o/$(MODE)/libc/str/windowstimetotime.o: \ OVERRIDE_CFLAGS += \ -O3 +o/$(MODE)/libc/str/hey-gcc.asm \ +o/$(MODE)/libc/str/hey.o: \ + OVERRIDE_CFLAGS += \ + -fsanitize=undefined + LIBC_STR_LIBS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x))) LIBC_STR_SRCS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)_SRCS)) LIBC_STR_HDRS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)_HDRS)) diff --git a/libc/sysv/calls/reboot.s b/libc/sysv/calls/reboot.s deleted file mode 100644 index 775111a97..000000000 --- a/libc/sysv/calls/reboot.s +++ /dev/null @@ -1,2 +0,0 @@ -.include "o/libc/sysv/macros.internal.inc" -.scall reboot,0x0d003703720370a9,globl diff --git a/libc/sysv/calls/mount.s b/libc/sysv/calls/sys_mount.s similarity index 50% rename from libc/sysv/calls/mount.s rename to libc/sysv/calls/sys_mount.s index b2b0c27d0..ef58d044d 100644 --- a/libc/sysv/calls/mount.s +++ b/libc/sysv/calls/sys_mount.s @@ -1,2 +1,2 @@ .include "o/libc/sysv/macros.internal.inc" -.scall mount,0x19a01501520a70a5,globl +.scall sys_mount,0x19a01501520a70a5,globl diff --git a/libc/sysv/calls/sys_reboot.s b/libc/sysv/calls/sys_reboot.s new file mode 100644 index 000000000..7883ca8d6 --- /dev/null +++ b/libc/sysv/calls/sys_reboot.s @@ -0,0 +1,2 @@ +.include "o/libc/sysv/macros.internal.inc" +.scall sys_reboot,0x0d003703720370a9,globl,hidden diff --git a/libc/sysv/calls/sys_unmount.s b/libc/sysv/calls/sys_unmount.s new file mode 100644 index 000000000..6a2117077 --- /dev/null +++ b/libc/sysv/calls/sys_unmount.s @@ -0,0 +1,2 @@ +.include "o/libc/sysv/macros.internal.inc" +.scall sys_unmount,0x016016016209f0a6,globl,hidden diff --git a/libc/sysv/calls/umount2.s b/libc/sysv/calls/umount2.s index 2609749d6..08796dc55 100644 --- a/libc/sysv/calls/umount2.s +++ b/libc/sysv/calls/umount2.s @@ -1,2 +1,2 @@ .include "o/libc/sysv/macros.internal.inc" -.scall umount2,0xfffffffffffff0a6,globl +.scall umount2,0x016016016209f0a6,globl,hidden diff --git a/libc/sysv/calls/unmount.s b/libc/sysv/calls/unmount.s deleted file mode 100644 index 97c9d9e7d..000000000 --- a/libc/sysv/calls/unmount.s +++ /dev/null @@ -1,2 +0,0 @@ -.include "o/libc/sysv/macros.internal.inc" -.scall unmount,0x016016016209ffff,globl diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index e2af91c5e..149adb832 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -135,6 +135,7 @@ syscon sig SIGUSR2 12 31 31 31 31 12 # do whatever you want; bsd syscon sig SIGPIPE 13 13 13 13 13 13 # write to closed file descriptor; unix consensus & faked on nt syscon sig SIGALRM 14 14 14 14 14 14 # sent by setitimer(2) or timer_settime(2); unix consensus & faked on nt syscon sig SIGTERM 15 15 15 15 15 15 # terminate; resumable; unix consensus & faked on nt; X3.159-1988 +syscon sig SIGSTKFLT 16 0 0 0 0 0 # wut syscon sig SIGCHLD 17 20 20 20 20 17 # child process exited or terminated and is now a zombie (unless this is SIG_IGN or SA_NOCLDWAIT) or child process stopped due to terminal i/o or profiling/debugging (unless you used SA_NOCLDSTOP); bsd consensus syscon sig SIGCONT 18 19 19 19 19 18 # child process resumed from profiling/debugging; bsd consensus syscon sig SIGSTOP 19 17 17 17 17 19 # child process stopped due to profiling/debugging; bsd consensus @@ -1232,38 +1233,78 @@ syscon sf SF_NODISKIO 0 0 1 0 0 0 syscon sf SF_MNOWAIT 0 0 2 0 0 0 syscon sf SF_SYNC 0 0 4 0 0 0 -# mount flags +# mount() flags # # 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 -syscon mount MS_I_VERSION 0x800000 0 0 0 0 0 -syscon mount MS_KERNMOUNT 0x400000 0 0 0 0 0 -syscon mount MS_LAZYTIME 0x02000000 0 0 0 0 0 -syscon mount MS_MANDLOCK 0x40 0 0 0 0 0 -syscon mount MS_MGC_VAL 0xc0ed0000 0 0 0 0 0 -syscon mount MS_MOVE 0x2000 0 0 0 0 0 -syscon mount MS_NOATIME 0x0400 0 0 0 0 0 -syscon mount MS_NODEV 4 0 0 0 0 0 -syscon mount MS_NODIRATIME 0x0800 0 0 0 0 0 -syscon mount MS_NOEXEC 8 0 0 0 0 0 -syscon mount MS_NOSUID 2 0 0 0 0 0 -syscon mount MS_NOUSER -2147483648 0 0 0 0 0 -syscon mount MS_POSIXACL 0x010000 0 0 0 0 0 -syscon mount MS_PRIVATE 0x040000 0 0 0 0 0 -syscon mount MS_RDONLY 1 0 0 0 0 0 -syscon mount MS_REC 0x4000 0 0 0 0 0 -syscon mount MS_RELATIME 0x200000 0 0 0 0 0 -syscon mount MS_REMOUNT 0x20 0 0 0 0 0 -syscon mount MS_RMT_MASK 0x02800051 0 0 0 0 0 -syscon mount MS_SHARED 0x100000 0 0 0 0 0 -syscon mount MS_SILENT 0x8000 0 0 0 0 0 -syscon mount MS_SLAVE 0x080000 0 0 0 0 0 -syscon mount MS_STRICTATIME 0x01000000 0 0 0 0 0 -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 +syscon mount MS_RDONLY 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 # consensus; MNT_RDONLY on bsd; faked nt +syscon mount MNT_RDONLY 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 0x00000001 # consensus; MS_RDONLY on linux; faked nt +syscon mount MS_NOSUID 0x00000002 0x00000008 0x00000008 0x00000008 0x00000008 0x00000001 # don't honor S_ISUID bit; bsd consensus; MNT_NOSUID on bsd; faked nt +syscon mount MNT_NOSUID 0 0x00000008 0x00000008 0x00000008 0x00000008 0x00000001 # don't honor S_ISUID bit; bsd consensus; appears incorrectly defined in linux headers; MS_NOSUID on linux; faked nt +syscon mount MS_NODEV 0x00000004 0x00000010 0x00000010 0x00000010 0x00000010 0x00000004 # disallow special files; bsd consensus; MNT_NODEV on bsd; faked nt +syscon mount MNT_NODEV 0x00000004 0x00000010 0x00000010 0x00000010 0x00000010 0x00000004 # disallow special files; bsd consensus; MS_NODEV on linux; faked nt +syscon mount MS_NOEXEC 0x00000008 0x00000004 0x00000004 0x00000004 0x00000004 0x00000008 # disallow program execution; bsd consensus; MNT_NOEXEC on bsd; faked nt +syscon mount MNT_NOEXEC 0x00000008 0x00000004 0x00000004 0x00000004 0x00000004 0x00000008 # disallow program execution; bsd consensus; MS_NOEXEC on linux; faked nt +syscon mount MS_SYNCHRONOUS 0x00000010 0x00000002 0x00000002 0x00000002 0x00000002 0x00000010 # bsd consensus; MNT_SYNCHRONOUS on bsd; faked nt +syscon mount MNT_SYNCHRONOUS 0x00000010 0x00000002 0x00000002 0x00000002 0x00000002 0x00000010 # bsd consensus; MS_SYNCHRONOUS on linux; faked nt +syscon mount MS_REMOUNT 0x00000020 0x00010000 0x00010000 0x00010000 0x00010000 0x00000020 # tune existing mounting; bsd consensus; MNT_UPDATE on bsd; faked nt +syscon mount MNT_UPDATE 0x00000020 0x00010000 0x00010000 0x00010000 0x00010000 0x00000020 # tune existing mounting; bsd consensus; MS_REMOUNT on linux; faked nt +syscon mount MS_MANDLOCK 0x00000040 0 0 0 0 0 # +syscon mount MS_DIRSYNC 0x00000080 0 0 0 0 0 # +syscon mount MS_NOATIME 0x00000400 0x10000000 0x10000000 0x00008000 0x04000000 0x00000400 # do not update access times; MNT_NOATIME on bsd +syscon mount MNT_NOATIME 0x00000400 0x10000000 0x10000000 0x00008000 0x04000000 0x00000400 # do not update access times; MS_NOATIME on linux +syscon mount MS_NODIRATIME 0x00000800 0 0 0 0 0 # +syscon mount MS_BIND 0x00001000 0 0 0 0 0 # +syscon mount MS_MOVE 0x00002000 0 0 0 0 0 # +syscon mount MS_REC 0x00004000 0 0 0 0 0 # +syscon mount MS_SILENT 0x00008000 0 0 0 0 0 # +syscon mount MS_POSIXACL 0x00010000 0 0 0 0 0 # +syscon mount MS_UNBINDABLE 0x00020000 0 0 0 0 0 # +syscon mount MS_PRIVATE 0x00040000 0 0 0 0 0 # +syscon mount MS_SLAVE 0x00080000 0 0 0 0 0 # +syscon mount MS_SHARED 0x00100000 0 0 0 0 0 # +syscon mount MS_RELATIME 0x00200000 0 0 0 0x00020000 0 # MNT_RELATIME on bsd +syscon mount MNT_RELATIME 0x00200000 0 0 0 0x00020000 0 # MS_RELATIME on linux +syscon mount MS_KERNMOUNT 0x00400000 0 0 0 0 0 # +syscon mount MS_I_VERSION 0x00800000 0 0 0 0 0 # +syscon mount MS_STRICTATIME 0x01000000 0x80000000 0 0 0 0 # enable strict update of file access time; MNT_STRICTATIME on bsd +syscon mount MNT_STRICTATIME 0x01000000 0x80000000 0 0 0 0 # enable strict update of file access time; MS_STRICTATIME on linux +syscon mount MS_LAZYTIME 0x02000000 0 0 0 0 0 # +syscon mount MS_ACTIVE 0x40000000 0 0 0 0 0 # +syscon mount MS_NOUSER 0x80000000 0 0 0 0 0 # +syscon mount MS_RMT_MASK 0x02800051 0 0 0 0 0 # +syscon mount MS_MGC_VAL 0xc0ed0000 0 0 0 0 0 # Linux 2.3 +syscon mount MS_MGC_MSK 0xffff0000 0 0 0 0 0 # Linux 2.3 +syscon mount MNT_ASYNC 0 0x00000040 0x00000040 0x00000040 0x00000040 0 # file system written asynchronously; bsd consensus +syscon mount MNT_RELOAD 0 0x00040000 0x00040000 0x00040000 0x00040000 0 # reload filesystem data; bsd consensus +syscon mount MNT_SUIDDIR 0 0 0x00100000 0 0 0 # special suid dir handling +syscon mount MNT_NOCLUSTERR 0 0 0x40000000 0 0 0 # disable cluster read +syscon mount MNT_NOCLUSTERW 0 0 0x80000000 0 0 0 # disable cluster write +syscon mount MNT_SNAPSHOT 0 0x40000000 0x01000000 0 0 0 # confusing + +# unmount() flags +# a.k.a. umount2() on linux +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon unmount MNT_FORCE 1 0x00080000 0x00080000 0x00080000 0x00080000 2 # force unmount or readonly +syscon unmount MNT_DETACH 2 0 0 0 0 0 # just detach from the tree +syscon unmount MNT_EXPIRE 4 0 0 0 0 0 # mark for expiry +syscon unmount UMOUNT_NOFOLLOW 8 0 0 0 0 0 # don't follow symlinks on unmount +syscon unmount MNT_BYFSID 0 0 0x08000000 0 0 0 # if used pass "FSID:val0:val1", where val0 and val1 are the contents of the fsid_t val[] array in decimal + +# reboot() magnums +# +# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon reboot RB_AUTOBOOT 0x01234567 0 0 0 0 4 # reboots; SHUTDOWN_RESTART on NT +syscon reboot RB_POWER_OFF 0x4321fedc 0xffffffff 0x4000 0x1000 0x808 8 # SHUTDOWN_POWEROFF on NT +syscon reboot RB_POWERDOWN 0x4321fedc 0xffffffff 0x4000 0x1000 0x808 8 # openbsd/netbsd name +syscon reboot RB_POWEROFF 0x4321fedc 0xffffffff 0x4000 0x1000 0x808 8 # freebsd name +syscon reboot RB_HALT_SYSTEM 0xcdef0123 8 8 8 8 16 # the processor is simply halted; SHUTDOWN_NOREBOOT on NT +syscon reboot RB_HALT 0xcdef0123 8 8 8 8 16 # the processor is simply halted; bsd name +syscon reboot RB_SW_SUSPEND 0xd000fce2 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xd000fce2 # +syscon reboot RB_KEXEC 0x45584543 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # +syscon reboot RB_ENABLE_CAD 0x89abcdef 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # enable control-alt-delete reboot +syscon reboot RB_DISABLE_CAD 0 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # make control-alt-delete just eintr +syscon reboot RB_NOSYNC 0x20000000 4 4 4 4 0x20000000 # prevents implicit sync() beforehand; polyfilled linux; polyfilled on nt just in case # send() / recv() flags # @@ -1484,7 +1525,6 @@ 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 @@ -1503,8 +1543,6 @@ syscon termios CSTOPB 0x40 0x0400 0x0400 0x0400 0x0400 0 # bsd c syscon termios HUPCL 0x0400 0x4000 0x4000 0x4000 0x4000 0 # bsd consensus syscon termios CSTART 17 17 17 17 17 0 # unix consensus syscon termios CSTOP 19 19 19 19 19 0 # unix consensus -syscon termios CSUSP 26 26 26 26 26 0 # unix consensus -syscon termios CWERASE 23 23 23 23 23 0 # unix consensus # Pseudoteletypewriter Control # @@ -1593,15 +1631,6 @@ syscon misc TH_PUSH 8 8 8 8 8 0 # unix consensus syscon misc TH_URG 32 32 32 32 32 32 # consensus syscon misc TH_ACK 16 16 16 16 16 16 # consensus -syscon misc IPC_PRIVATE 0 0 0 0 0 0 # consensus -syscon misc IPC_RMID 0 0 0 0 0 0 # consensus -syscon misc IPC_CREAT 0x0200 0x0200 0x0200 0x0200 0x0200 0 # unix consensus -syscon misc IPC_EXCL 0x0400 0x0400 0x0400 0x0400 0x0400 0 # unix consensus -syscon misc IPC_NOWAIT 0x0800 0x0800 0x0800 0x0800 0x0800 0 # unix consensus -syscon misc IPC_SET 1 1 1 1 1 0 # unix consensus -syscon misc IPC_STAT 2 2 2 2 2 0 # unix consensus -syscon misc IPC_INFO 3 0 3 0 0 0 - syscon shm SHM_R 0x0100 0x0100 0x0100 0x0100 0x0100 0 # unix consensus syscon shm SHM_RDONLY 0x1000 0x1000 0x1000 0x1000 0x1000 0 # unix consensus syscon shm SHM_RND 0x2000 0x2000 0x2000 0x2000 0x2000 0 # unix consensus @@ -1645,14 +1674,6 @@ syscon misc NO_ADDRESS 4 4 4 4 4 0x2afc # unix consensus syscon misc NO_DATA 4 4 4 4 4 0x2afc # unix consensus syscon misc NO_RECOVERY 3 3 3 3 3 0x2afb # unix consensus -syscon misc RB_DISABLE_CAD 0 0 0 0 0 0 # consensus -syscon misc RB_AUTOBOOT 0x01234567 0 0 0 0 0 -syscon misc RB_ENABLE_CAD 0x89abcdef 0 0 0 0 0 -syscon misc RB_HALT_SYSTEM 0xcdef0123 0 0 0 0 0 -syscon misc RB_KEXEC 0x45584543 0 0 0 0 0 -syscon misc RB_POWER_OFF 0x4321fedc 0 0 0 0 0 -syscon misc RB_SW_SUSPEND 0xd000fce2 0 0 0 0 0 - syscon misc NI_DGRAM 0x10 0x10 0x10 0x10 0x10 0x10 # consensus syscon misc NI_MAXSERV 0x20 0x20 0x20 0x20 0x20 0x20 # consensus syscon misc NI_MAXHOST 0x0401 0x0401 0x0401 0x0100 0x0100 0x0401 @@ -1894,10 +1915,6 @@ syscon misc LIO_READ 0 1 2 0 0 0 syscon misc LIO_WAIT 0 2 1 0 0 0 syscon misc LIO_NOP 2 0 0 0 0 0 -syscon misc MNT_FORCE 1 0x080000 0 0x080000 0x080000 0 -syscon misc MNT_DETACH 2 0 0 0 0 0 -syscon misc MNT_EXPIRE 4 0 0 0 0 0 - syscon misc UDP_ENCAP_ESPINUDP_NON_IKE 1 0 1 0 0 0 syscon misc UDP_NO_CHECK6_RX 102 0 0 0 0 0 syscon misc UDP_NO_CHECK6_TX 101 0 0 0 0 0 @@ -3122,7 +3139,6 @@ 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 diff --git a/libc/sysv/consts/CSUSP.S b/libc/sysv/consts/CSUSP.S deleted file mode 100644 index 919249c69..000000000 --- a/libc/sysv/consts/CSUSP.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CSUSP,26,26,26,26,26,0 diff --git a/libc/sysv/consts/CWERASE.S b/libc/sysv/consts/CWERASE.S deleted file mode 100644 index a19f3365c..000000000 --- a/libc/sysv/consts/CWERASE.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CWERASE,23,23,23,23,23,0 diff --git a/libc/sysv/consts/IPC_CREAT.S b/libc/sysv/consts/IPC_CREAT.S deleted file mode 100644 index 6c4fd5f79..000000000 --- a/libc/sysv/consts/IPC_CREAT.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_CREAT,0x0200,0x0200,0x0200,0x0200,0x0200,0 diff --git a/libc/sysv/consts/IPC_EXCL.S b/libc/sysv/consts/IPC_EXCL.S deleted file mode 100644 index 4deb0e796..000000000 --- a/libc/sysv/consts/IPC_EXCL.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_EXCL,0x0400,0x0400,0x0400,0x0400,0x0400,0 diff --git a/libc/sysv/consts/IPC_INFO.S b/libc/sysv/consts/IPC_INFO.S deleted file mode 100644 index 55310af4a..000000000 --- a/libc/sysv/consts/IPC_INFO.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_INFO,3,0,3,0,0,0 diff --git a/libc/sysv/consts/IPC_NOWAIT.S b/libc/sysv/consts/IPC_NOWAIT.S deleted file mode 100644 index c59b43548..000000000 --- a/libc/sysv/consts/IPC_NOWAIT.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_NOWAIT,0x0800,0x0800,0x0800,0x0800,0x0800,0 diff --git a/libc/sysv/consts/IPC_PRIVATE.S b/libc/sysv/consts/IPC_PRIVATE.S deleted file mode 100644 index eafa2f42d..000000000 --- a/libc/sysv/consts/IPC_PRIVATE.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_PRIVATE,0,0,0,0,0,0 diff --git a/libc/sysv/consts/IPC_RMID.S b/libc/sysv/consts/IPC_RMID.S deleted file mode 100644 index 5f1ce1e55..000000000 --- a/libc/sysv/consts/IPC_RMID.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_RMID,0,0,0,0,0,0 diff --git a/libc/sysv/consts/IPC_SET.S b/libc/sysv/consts/IPC_SET.S deleted file mode 100644 index 954631c8e..000000000 --- a/libc/sysv/consts/IPC_SET.S +++ /dev/null @@ -1,2 +0,0 @@ -#include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_SET,1,1,1,1,1,0 diff --git a/libc/sysv/consts/MNT_ASYNC.S b/libc/sysv/consts/MNT_ASYNC.S new file mode 100644 index 000000000..6d6801154 --- /dev/null +++ b/libc/sysv/consts/MNT_ASYNC.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_ASYNC,0,0x00000040,0x00000040,0x00000040,0x00000040,0 diff --git a/libc/sysv/consts/MNT_BYFSID.S b/libc/sysv/consts/MNT_BYFSID.S new file mode 100644 index 000000000..4fe55cfbe --- /dev/null +++ b/libc/sysv/consts/MNT_BYFSID.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon unmount,MNT_BYFSID,0,0,0x08000000,0,0,0 diff --git a/libc/sysv/consts/MNT_DETACH.S b/libc/sysv/consts/MNT_DETACH.S index 97e2606be..543a7cb7d 100644 --- a/libc/sysv/consts/MNT_DETACH.S +++ b/libc/sysv/consts/MNT_DETACH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MNT_DETACH,2,0,0,0,0,0 +.syscon unmount,MNT_DETACH,2,0,0,0,0,0 diff --git a/libc/sysv/consts/MNT_EXPIRE.S b/libc/sysv/consts/MNT_EXPIRE.S index 0b984b111..03cb742ac 100644 --- a/libc/sysv/consts/MNT_EXPIRE.S +++ b/libc/sysv/consts/MNT_EXPIRE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MNT_EXPIRE,4,0,0,0,0,0 +.syscon unmount,MNT_EXPIRE,4,0,0,0,0,0 diff --git a/libc/sysv/consts/MNT_FORCE.S b/libc/sysv/consts/MNT_FORCE.S index eaa6679b6..98f8c4b3d 100644 --- a/libc/sysv/consts/MNT_FORCE.S +++ b/libc/sysv/consts/MNT_FORCE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,MNT_FORCE,1,0x080000,0,0x080000,0x080000,0 +.syscon unmount,MNT_FORCE,1,0x00080000,0x00080000,0x00080000,0x00080000,2 diff --git a/libc/sysv/consts/MNT_NOATIME.S b/libc/sysv/consts/MNT_NOATIME.S new file mode 100644 index 000000000..e9d4951a2 --- /dev/null +++ b/libc/sysv/consts/MNT_NOATIME.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_NOATIME,0x00000400,0x10000000,0x10000000,0x00008000,0x04000000,0x00000400 diff --git a/libc/sysv/consts/MNT_NOCLUSTERR.S b/libc/sysv/consts/MNT_NOCLUSTERR.S new file mode 100644 index 000000000..690edfb57 --- /dev/null +++ b/libc/sysv/consts/MNT_NOCLUSTERR.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_NOCLUSTERR,0,0,0x40000000,0,0,0 diff --git a/libc/sysv/consts/MNT_NOCLUSTERW.S b/libc/sysv/consts/MNT_NOCLUSTERW.S new file mode 100644 index 000000000..2209ffe6f --- /dev/null +++ b/libc/sysv/consts/MNT_NOCLUSTERW.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_NOCLUSTERW,0,0,0x80000000,0,0,0 diff --git a/libc/sysv/consts/MNT_NODEV.S b/libc/sysv/consts/MNT_NODEV.S new file mode 100644 index 000000000..a398cc29f --- /dev/null +++ b/libc/sysv/consts/MNT_NODEV.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_NODEV,0x00000004,0x00000010,0x00000010,0x00000010,0x00000010,0x00000004 diff --git a/libc/sysv/consts/MNT_NOEXEC.S b/libc/sysv/consts/MNT_NOEXEC.S new file mode 100644 index 000000000..6ff223e32 --- /dev/null +++ b/libc/sysv/consts/MNT_NOEXEC.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_NOEXEC,0x00000008,0x00000004,0x00000004,0x00000004,0x00000004,0x00000008 diff --git a/libc/sysv/consts/MNT_NOSUID.S b/libc/sysv/consts/MNT_NOSUID.S new file mode 100644 index 000000000..c5891d684 --- /dev/null +++ b/libc/sysv/consts/MNT_NOSUID.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_NOSUID,0,0x00000008,0x00000008,0x00000008,0x00000008,0x00000001 diff --git a/libc/sysv/consts/MNT_RDONLY.S b/libc/sysv/consts/MNT_RDONLY.S new file mode 100644 index 000000000..9e2fb1b03 --- /dev/null +++ b/libc/sysv/consts/MNT_RDONLY.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_RDONLY,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001 diff --git a/libc/sysv/consts/MNT_RELATIME.S b/libc/sysv/consts/MNT_RELATIME.S new file mode 100644 index 000000000..83d8f7894 --- /dev/null +++ b/libc/sysv/consts/MNT_RELATIME.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_RELATIME,0x00200000,0,0,0,0x00020000,0 diff --git a/libc/sysv/consts/MNT_RELOAD.S b/libc/sysv/consts/MNT_RELOAD.S new file mode 100644 index 000000000..3b58a8e62 --- /dev/null +++ b/libc/sysv/consts/MNT_RELOAD.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_RELOAD,0,0x00040000,0x00040000,0x00040000,0x00040000,0 diff --git a/libc/sysv/consts/MNT_SNAPSHOT.S b/libc/sysv/consts/MNT_SNAPSHOT.S new file mode 100644 index 000000000..184bdf2f8 --- /dev/null +++ b/libc/sysv/consts/MNT_SNAPSHOT.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_SNAPSHOT,0,0x40000000,0x01000000,0,0,0 diff --git a/libc/sysv/consts/MNT_STRICTATIME.S b/libc/sysv/consts/MNT_STRICTATIME.S new file mode 100644 index 000000000..b86c625aa --- /dev/null +++ b/libc/sysv/consts/MNT_STRICTATIME.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_STRICTATIME,0x01000000,0x80000000,0,0,0,0 diff --git a/libc/sysv/consts/MNT_SUIDDIR.S b/libc/sysv/consts/MNT_SUIDDIR.S new file mode 100644 index 000000000..4c99fa5ac --- /dev/null +++ b/libc/sysv/consts/MNT_SUIDDIR.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_SUIDDIR,0,0,0x00100000,0,0,0 diff --git a/libc/sysv/consts/MNT_SYNCHRONOUS.S b/libc/sysv/consts/MNT_SYNCHRONOUS.S new file mode 100644 index 000000000..5813c0cbb --- /dev/null +++ b/libc/sysv/consts/MNT_SYNCHRONOUS.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_SYNCHRONOUS,0x00000010,0x00000002,0x00000002,0x00000002,0x00000002,0x00000010 diff --git a/libc/sysv/consts/MNT_UPDATE.S b/libc/sysv/consts/MNT_UPDATE.S new file mode 100644 index 000000000..5d98d31b7 --- /dev/null +++ b/libc/sysv/consts/MNT_UPDATE.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon mount,MNT_UPDATE,0x00000020,0x00010000,0x00010000,0x00010000,0x00010000,0x00000020 diff --git a/libc/sysv/consts/MS_BIND.S b/libc/sysv/consts/MS_BIND.S index 8e7d020ef..f039c978b 100644 --- a/libc/sysv/consts/MS_BIND.S +++ b/libc/sysv/consts/MS_BIND.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_BIND,0x1000,0,0,0,0,0 +.syscon mount,MS_BIND,0x00001000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_DIRSYNC.S b/libc/sysv/consts/MS_DIRSYNC.S index f9c37f4f8..235168d0b 100644 --- a/libc/sysv/consts/MS_DIRSYNC.S +++ b/libc/sysv/consts/MS_DIRSYNC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_DIRSYNC,0x80,0,0,0,0,0 +.syscon mount,MS_DIRSYNC,0x00000080,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_I_VERSION.S b/libc/sysv/consts/MS_I_VERSION.S index 5ef364318..c5595cca4 100644 --- a/libc/sysv/consts/MS_I_VERSION.S +++ b/libc/sysv/consts/MS_I_VERSION.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_I_VERSION,0x800000,0,0,0,0,0 +.syscon mount,MS_I_VERSION,0x00800000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_KERNMOUNT.S b/libc/sysv/consts/MS_KERNMOUNT.S index 55ffadeb2..7b36a8794 100644 --- a/libc/sysv/consts/MS_KERNMOUNT.S +++ b/libc/sysv/consts/MS_KERNMOUNT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_KERNMOUNT,0x400000,0,0,0,0,0 +.syscon mount,MS_KERNMOUNT,0x00400000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_MANDLOCK.S b/libc/sysv/consts/MS_MANDLOCK.S index 7b8736474..e91ae1447 100644 --- a/libc/sysv/consts/MS_MANDLOCK.S +++ b/libc/sysv/consts/MS_MANDLOCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_MANDLOCK,0x40,0,0,0,0,0 +.syscon mount,MS_MANDLOCK,0x00000040,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_MOVE.S b/libc/sysv/consts/MS_MOVE.S index 4bd85fcf8..576706f92 100644 --- a/libc/sysv/consts/MS_MOVE.S +++ b/libc/sysv/consts/MS_MOVE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_MOVE,0x2000,0,0,0,0,0 +.syscon mount,MS_MOVE,0x00002000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_NOATIME.S b/libc/sysv/consts/MS_NOATIME.S index 039f521eb..99e0f77cf 100644 --- a/libc/sysv/consts/MS_NOATIME.S +++ b/libc/sysv/consts/MS_NOATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_NOATIME,0x0400,0,0,0,0,0 +.syscon mount,MS_NOATIME,0x00000400,0x10000000,0x10000000,0x00008000,0x04000000,0x00000400 diff --git a/libc/sysv/consts/MS_NODEV.S b/libc/sysv/consts/MS_NODEV.S index 9a3603bad..fb6f27b4f 100644 --- a/libc/sysv/consts/MS_NODEV.S +++ b/libc/sysv/consts/MS_NODEV.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_NODEV,4,0,0,0,0,0 +.syscon mount,MS_NODEV,0x00000004,0x00000010,0x00000010,0x00000010,0x00000010,0x00000004 diff --git a/libc/sysv/consts/MS_NODIRATIME.S b/libc/sysv/consts/MS_NODIRATIME.S index ee5aba233..3750896ce 100644 --- a/libc/sysv/consts/MS_NODIRATIME.S +++ b/libc/sysv/consts/MS_NODIRATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_NODIRATIME,0x0800,0,0,0,0,0 +.syscon mount,MS_NODIRATIME,0x00000800,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_NOEXEC.S b/libc/sysv/consts/MS_NOEXEC.S index 754869359..b7c74d87c 100644 --- a/libc/sysv/consts/MS_NOEXEC.S +++ b/libc/sysv/consts/MS_NOEXEC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_NOEXEC,8,0,0,0,0,0 +.syscon mount,MS_NOEXEC,0x00000008,0x00000004,0x00000004,0x00000004,0x00000004,0x00000008 diff --git a/libc/sysv/consts/MS_NOSUID.S b/libc/sysv/consts/MS_NOSUID.S index fc3c73faf..ea06cd1f4 100644 --- a/libc/sysv/consts/MS_NOSUID.S +++ b/libc/sysv/consts/MS_NOSUID.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_NOSUID,2,0,0,0,0,0 +.syscon mount,MS_NOSUID,0x00000002,0x00000008,0x00000008,0x00000008,0x00000008,0x00000001 diff --git a/libc/sysv/consts/MS_NOUSER.S b/libc/sysv/consts/MS_NOUSER.S index e6da20356..20a756aa6 100644 --- a/libc/sysv/consts/MS_NOUSER.S +++ b/libc/sysv/consts/MS_NOUSER.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_NOUSER,-2147483648,0,0,0,0,0 +.syscon mount,MS_NOUSER,0x80000000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_POSIXACL.S b/libc/sysv/consts/MS_POSIXACL.S index e2640c92f..bbd03edae 100644 --- a/libc/sysv/consts/MS_POSIXACL.S +++ b/libc/sysv/consts/MS_POSIXACL.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_POSIXACL,0x010000,0,0,0,0,0 +.syscon mount,MS_POSIXACL,0x00010000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_PRIVATE.S b/libc/sysv/consts/MS_PRIVATE.S index 545448b14..a211ea4cb 100644 --- a/libc/sysv/consts/MS_PRIVATE.S +++ b/libc/sysv/consts/MS_PRIVATE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_PRIVATE,0x040000,0,0,0,0,0 +.syscon mount,MS_PRIVATE,0x00040000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_RDONLY.S b/libc/sysv/consts/MS_RDONLY.S index f54a70c6c..11018f7c6 100644 --- a/libc/sysv/consts/MS_RDONLY.S +++ b/libc/sysv/consts/MS_RDONLY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_RDONLY,1,0,0,0,0,0 +.syscon mount,MS_RDONLY,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001 diff --git a/libc/sysv/consts/MS_REC.S b/libc/sysv/consts/MS_REC.S index 86c13ef0e..be7980d7b 100644 --- a/libc/sysv/consts/MS_REC.S +++ b/libc/sysv/consts/MS_REC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_REC,0x4000,0,0,0,0,0 +.syscon mount,MS_REC,0x00004000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_RELATIME.S b/libc/sysv/consts/MS_RELATIME.S index 1547006ee..6d9f92c6c 100644 --- a/libc/sysv/consts/MS_RELATIME.S +++ b/libc/sysv/consts/MS_RELATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_RELATIME,0x200000,0,0,0,0,0 +.syscon mount,MS_RELATIME,0x00200000,0,0,0,0x00020000,0 diff --git a/libc/sysv/consts/MS_REMOUNT.S b/libc/sysv/consts/MS_REMOUNT.S index 72ad2f5af..1ddb46eba 100644 --- a/libc/sysv/consts/MS_REMOUNT.S +++ b/libc/sysv/consts/MS_REMOUNT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_REMOUNT,0x20,0,0,0,0,0 +.syscon mount,MS_REMOUNT,0x00000020,0x00010000,0x00010000,0x00010000,0x00010000,0x00000020 diff --git a/libc/sysv/consts/MS_SHARED.S b/libc/sysv/consts/MS_SHARED.S index 0c0cdd0a3..32d6490cd 100644 --- a/libc/sysv/consts/MS_SHARED.S +++ b/libc/sysv/consts/MS_SHARED.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_SHARED,0x100000,0,0,0,0,0 +.syscon mount,MS_SHARED,0x00100000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_SILENT.S b/libc/sysv/consts/MS_SILENT.S index 7c2511f45..0cc3d36ba 100644 --- a/libc/sysv/consts/MS_SILENT.S +++ b/libc/sysv/consts/MS_SILENT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_SILENT,0x8000,0,0,0,0,0 +.syscon mount,MS_SILENT,0x00008000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_SLAVE.S b/libc/sysv/consts/MS_SLAVE.S index a69463caa..620a82683 100644 --- a/libc/sysv/consts/MS_SLAVE.S +++ b/libc/sysv/consts/MS_SLAVE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_SLAVE,0x080000,0,0,0,0,0 +.syscon mount,MS_SLAVE,0x00080000,0,0,0,0,0 diff --git a/libc/sysv/consts/MS_STRICTATIME.S b/libc/sysv/consts/MS_STRICTATIME.S index fdf1da5d7..6745942b0 100644 --- a/libc/sysv/consts/MS_STRICTATIME.S +++ b/libc/sysv/consts/MS_STRICTATIME.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_STRICTATIME,0x01000000,0,0,0,0,0 +.syscon mount,MS_STRICTATIME,0x01000000,0x80000000,0,0,0,0 diff --git a/libc/sysv/consts/MS_SYNCHRONOUS.S b/libc/sysv/consts/MS_SYNCHRONOUS.S index 686e04fa1..2cf70af68 100644 --- a/libc/sysv/consts/MS_SYNCHRONOUS.S +++ b/libc/sysv/consts/MS_SYNCHRONOUS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_SYNCHRONOUS,0x10,0,0,0,0,0 +.syscon mount,MS_SYNCHRONOUS,0x00000010,0x00000002,0x00000002,0x00000002,0x00000002,0x00000010 diff --git a/libc/sysv/consts/MS_UNBINDABLE.S b/libc/sysv/consts/MS_UNBINDABLE.S index b347b4551..516f1a02e 100644 --- a/libc/sysv/consts/MS_UNBINDABLE.S +++ b/libc/sysv/consts/MS_UNBINDABLE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon mount,MS_UNBINDABLE,0x020000,0,0,0,0,0 +.syscon mount,MS_UNBINDABLE,0x00020000,0,0,0,0,0 diff --git a/libc/sysv/consts/RB_AUTOBOOT.S b/libc/sysv/consts/RB_AUTOBOOT.S index 29dbe20aa..af3809dd4 100644 --- a/libc/sysv/consts/RB_AUTOBOOT.S +++ b/libc/sysv/consts/RB_AUTOBOOT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_AUTOBOOT,0x01234567,0,0,0,0,0 +.syscon reboot,RB_AUTOBOOT,0x01234567,0,0,0,0,4 diff --git a/libc/sysv/consts/RB_DISABLE_CAD.S b/libc/sysv/consts/RB_DISABLE_CAD.S index 7807279ae..e7e383360 100644 --- a/libc/sysv/consts/RB_DISABLE_CAD.S +++ b/libc/sysv/consts/RB_DISABLE_CAD.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_DISABLE_CAD,0,0,0,0,0,0 +.syscon reboot,RB_DISABLE_CAD,0,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff diff --git a/libc/sysv/consts/RB_ENABLE_CAD.S b/libc/sysv/consts/RB_ENABLE_CAD.S index 46a6c23c9..32f69564c 100644 --- a/libc/sysv/consts/RB_ENABLE_CAD.S +++ b/libc/sysv/consts/RB_ENABLE_CAD.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_ENABLE_CAD,0x89abcdef,0,0,0,0,0 +.syscon reboot,RB_ENABLE_CAD,0x89abcdef,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff diff --git a/libc/sysv/consts/CBRK.S b/libc/sysv/consts/RB_HALT.S similarity index 50% rename from libc/sysv/consts/CBRK.S rename to libc/sysv/consts/RB_HALT.S index fb6927169..78a2d0f73 100644 --- a/libc/sysv/consts/CBRK.S +++ b/libc/sysv/consts/RB_HALT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon termios,CBRK,0,255,255,255,255,0 +.syscon reboot,RB_HALT,0xcdef0123,8,8,8,8,16 diff --git a/libc/sysv/consts/RB_HALT_SYSTEM.S b/libc/sysv/consts/RB_HALT_SYSTEM.S index f23082706..55564fac0 100644 --- a/libc/sysv/consts/RB_HALT_SYSTEM.S +++ b/libc/sysv/consts/RB_HALT_SYSTEM.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_HALT_SYSTEM,0xcdef0123,0,0,0,0,0 +.syscon reboot,RB_HALT_SYSTEM,0xcdef0123,8,8,8,8,16 diff --git a/libc/sysv/consts/RB_KEXEC.S b/libc/sysv/consts/RB_KEXEC.S index c71f12c01..ae434fa28 100644 --- a/libc/sysv/consts/RB_KEXEC.S +++ b/libc/sysv/consts/RB_KEXEC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_KEXEC,0x45584543,0,0,0,0,0 +.syscon reboot,RB_KEXEC,0x45584543,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff diff --git a/libc/sysv/consts/RB_NOSYNC.S b/libc/sysv/consts/RB_NOSYNC.S new file mode 100644 index 000000000..7f1891301 --- /dev/null +++ b/libc/sysv/consts/RB_NOSYNC.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon reboot,RB_NOSYNC,0x20000000,4,4,4,4,0x20000000 diff --git a/libc/sysv/consts/RB_POWERDOWN.S b/libc/sysv/consts/RB_POWERDOWN.S new file mode 100644 index 000000000..9758eebe7 --- /dev/null +++ b/libc/sysv/consts/RB_POWERDOWN.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon reboot,RB_POWERDOWN,0x4321fedc,0xffffffff,0x4000,0x1000,0x808,8 diff --git a/libc/sysv/consts/RB_POWEROFF.S b/libc/sysv/consts/RB_POWEROFF.S new file mode 100644 index 000000000..56e6b566c --- /dev/null +++ b/libc/sysv/consts/RB_POWEROFF.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon reboot,RB_POWEROFF,0x4321fedc,0xffffffff,0x4000,0x1000,0x808,8 diff --git a/libc/sysv/consts/RB_POWER_OFF.S b/libc/sysv/consts/RB_POWER_OFF.S index bebb48266..e260da637 100644 --- a/libc/sysv/consts/RB_POWER_OFF.S +++ b/libc/sysv/consts/RB_POWER_OFF.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_POWER_OFF,0x4321fedc,0,0,0,0,0 +.syscon reboot,RB_POWER_OFF,0x4321fedc,0xffffffff,0x4000,0x1000,0x808,8 diff --git a/libc/sysv/consts/RB_SW_SUSPEND.S b/libc/sysv/consts/RB_SW_SUSPEND.S index 92555f7a0..c2528864c 100644 --- a/libc/sysv/consts/RB_SW_SUSPEND.S +++ b/libc/sysv/consts/RB_SW_SUSPEND.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,RB_SW_SUSPEND,0xd000fce2,0,0,0,0,0 +.syscon reboot,RB_SW_SUSPEND,0xd000fce2,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xd000fce2 diff --git a/libc/sysv/consts/IPC_STAT.S b/libc/sysv/consts/SIGSTKFLT.S similarity index 56% rename from libc/sysv/consts/IPC_STAT.S rename to libc/sysv/consts/SIGSTKFLT.S index 5cd24e892..c6102eb0c 100644 --- a/libc/sysv/consts/IPC_STAT.S +++ b/libc/sysv/consts/SIGSTKFLT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,IPC_STAT,2,2,2,2,2,0 +.syscon sig,SIGSTKFLT,16,0,0,0,0,0 diff --git a/libc/sysv/consts/UMOUNT_NOFOLLOW.S b/libc/sysv/consts/UMOUNT_NOFOLLOW.S index 6db545ab1..3b4b593dd 100644 --- a/libc/sysv/consts/UMOUNT_NOFOLLOW.S +++ b/libc/sysv/consts/UMOUNT_NOFOLLOW.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon misc,UMOUNT_NOFOLLOW,8,0,0,0,0,0 +.syscon unmount,UMOUNT_NOFOLLOW,8,0,0,0,0,0 diff --git a/libc/sysv/consts/ipc.h b/libc/sysv/consts/ipc.h deleted file mode 100644 index 38928bcc3..000000000 --- a/libc/sysv/consts/ipc.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_IPC_H_ -#define COSMOPOLITAN_LIBC_SYSV_CONSTS_IPC_H_ -#include "libc/runtime/symbolic.h" - -#define IPC_CREAT SYMBOLIC(IPC_CREAT) -#define IPC_EXCL SYMBOLIC(IPC_EXCL) -#define IPC_INFO SYMBOLIC(IPC_INFO) -#define IPC_NOWAIT SYMBOLIC(IPC_NOWAIT) -#define IPC_PRIVATE SYMBOLIC(IPC_PRIVATE) -#define IPC_RMID SYMBOLIC(IPC_RMID) -#define IPC_SET SYMBOLIC(IPC_SET) -#define IPC_STAT SYMBOLIC(IPC_STAT) - -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ - -extern const long IPC_CREAT; -extern const long IPC_EXCL; -extern const long IPC_INFO; -extern const long IPC_NOWAIT; -extern const long IPC_PRIVATE; -extern const long IPC_RMID; -extern const long IPC_SET; -extern const long IPC_STAT; - -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPC_H_ */ diff --git a/libc/sysv/consts/mnt.h b/libc/sysv/consts/mnt.h deleted file mode 100644 index 0ecab177d..000000000 --- a/libc/sysv/consts/mnt.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_MNT_H_ -#define COSMOPOLITAN_LIBC_SYSV_CONSTS_MNT_H_ -#include "libc/runtime/symbolic.h" - -#define MNT_DETACH SYMBOLIC(MNT_DETACH) -#define MNT_EXPIRE SYMBOLIC(MNT_EXPIRE) -#define MNT_FORCE SYMBOLIC(MNT_FORCE) - -#if !(__ASSEMBLER__ + __LINKER__ + 0) -COSMOPOLITAN_C_START_ - -extern const long MNT_DETACH; -extern const long MNT_EXPIRE; -extern const long MNT_FORCE; - -COSMOPOLITAN_C_END_ -#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MNT_H_ */ diff --git a/libc/sysv/consts/mount.h b/libc/sysv/consts/mount.h index f557d773c..2840ebe2c 100644 --- a/libc/sysv/consts/mount.h +++ b/libc/sysv/consts/mount.h @@ -4,67 +4,97 @@ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ -extern const long MS_ACTIVE; -extern const long MS_BIND; -extern const long MS_DIRSYNC; -extern const long MS_I_VERSION; -extern const long MS_KERNMOUNT; -extern const long MS_LAZYTIME; -extern const long MS_MANDLOCK; -extern const long MS_MGC_MSK; -extern const long MS_MGC_VAL; -extern const long MS_MOVE; -extern const long MS_NOATIME; -extern const long MS_NODEV; -extern const long MS_NODIRATIME; -extern const long MS_NOEXEC; -extern const long MS_NOSUID; -extern const long MS_NOUSER; -extern const long MS_POSIXACL; -extern const long MS_PRIVATE; extern const long MS_RDONLY; -extern const long MS_REC; -extern const long MS_RELATIME; -extern const long MS_REMOUNT; -extern const long MS_RMT_MASK; -extern const long MS_SHARED; -extern const long MS_SILENT; -extern const long MS_SLAVE; -extern const long MS_STRICTATIME; +extern const long MNT_RDONLY; +extern const long MS_NOSUID; +extern const long MNT_NOSUID; +extern const long MS_NODEV; +extern const long MNT_NODEV; +extern const long MS_NOEXEC; +extern const long MNT_NOEXEC; extern const long MS_SYNCHRONOUS; +extern const long MNT_SYNCHRONOUS; +extern const long MS_REMOUNT; +extern const long MNT_UPDATE; +extern const long MS_MANDLOCK; +extern const long MS_DIRSYNC; +extern const long MS_NOATIME; +extern const long MNT_NOATIME; +extern const long MS_NODIRATIME; +extern const long MS_BIND; +extern const long MS_MOVE; +extern const long MS_REC; +extern const long MS_SILENT; +extern const long MS_POSIXACL; extern const long MS_UNBINDABLE; +extern const long MS_PRIVATE; +extern const long MS_SLAVE; +extern const long MS_SHARED; +extern const long MS_RELATIME; +extern const long MNT_RELATIME; +extern const long MS_KERNMOUNT; +extern const long MS_I_VERSION; +extern const long MS_STRICTATIME; +extern const long MNT_STRICTATIME; +extern const long MS_LAZYTIME; +extern const long MS_ACTIVE; +extern const long MS_NOUSER; +extern const long MS_RMT_MASK; +extern const long MS_MGC_VAL; +extern const long MS_MGC_MSK; +extern const long MNT_ASYNC; +extern const long MNT_RELOAD; +extern const long MNT_SUIDDIR; +extern const long MNT_NOCLUSTERR; +extern const long MNT_NOCLUSTERW; +extern const long MNT_SNAPSHOT; COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#define MS_ACTIVE SYMBOLIC(MS_ACTIVE) -#define MS_BIND SYMBOLIC(MS_BIND) -#define MS_DIRSYNC SYMBOLIC(MS_DIRSYNC) -#define MS_I_VERSION SYMBOLIC(MS_I_VERSION) -#define MS_KERNMOUNT SYMBOLIC(MS_KERNMOUNT) -#define MS_LAZYTIME SYMBOLIC(MS_LAZYTIME) -#define MS_MANDLOCK SYMBOLIC(MS_MANDLOCK) -#define MS_MGC_MSK SYMBOLIC(MS_MGC_MSK) -#define MS_MGC_VAL SYMBOLIC(MS_MGC_VAL) -#define MS_MOVE SYMBOLIC(MS_MOVE) -#define MS_NOATIME SYMBOLIC(MS_NOATIME) -#define MS_NODEV SYMBOLIC(MS_NODEV) -#define MS_NODIRATIME SYMBOLIC(MS_NODIRATIME) -#define MS_NOEXEC SYMBOLIC(MS_NOEXEC) -#define MS_NOSUID SYMBOLIC(MS_NOSUID) -#define MS_NOUSER SYMBOLIC(MS_NOUSER) -#define MS_POSIXACL SYMBOLIC(MS_POSIXACL) -#define MS_PRIVATE SYMBOLIC(MS_PRIVATE) -#define MS_RDONLY SYMBOLIC(MS_RDONLY) -#define MS_REC SYMBOLIC(MS_REC) -#define MS_RELATIME SYMBOLIC(MS_RELATIME) -#define MS_REMOUNT SYMBOLIC(MS_REMOUNT) -#define MS_RMT_MASK SYMBOLIC(MS_RMT_MASK) -#define MS_SHARED SYMBOLIC(MS_SHARED) -#define MS_SILENT SYMBOLIC(MS_SILENT) -#define MS_SLAVE SYMBOLIC(MS_SLAVE) -#define MS_STRICTATIME SYMBOLIC(MS_STRICTATIME) -#define MS_SYNCHRONOUS SYMBOLIC(MS_SYNCHRONOUS) -#define MS_UNBINDABLE SYMBOLIC(MS_UNBINDABLE) +#define MS_RDONLY LITERALLY(0x00000001) +#define MNT_RDONLY LITERALLY(0x00000001) +#define MS_NOSUID SYMBOLIC(MS_NOSUID) +#define MNT_NOSUID SYMBOLIC(MNT_NOSUID) +#define MS_NODEV SYMBOLIC(MS_NODEV) +#define MNT_NODEV SYMBOLIC(MNT_NODEV) +#define MS_NOEXEC SYMBOLIC(MS_NOEXEC) +#define MNT_NOEXEC SYMBOLIC(MNT_NOEXEC) +#define MS_SYNCHRONOUS SYMBOLIC(MS_SYNCHRONOUS) +#define MNT_SYNCHRONOUS SYMBOLIC(MNT_SYNCHRONOUS) +#define MS_REMOUNT SYMBOLIC(MS_REMOUNT) +#define MNT_UPDATE SYMBOLIC(MNT_UPDATE) +#define MS_MANDLOCK SYMBOLIC(MS_MANDLOCK) +#define MS_DIRSYNC SYMBOLIC(MS_DIRSYNC) +#define MS_NOATIME SYMBOLIC(MS_NOATIME) +#define MNT_NOATIME SYMBOLIC(MNT_NOATIME) +#define MS_NODIRATIME SYMBOLIC(MS_NODIRATIME) +#define MS_BIND SYMBOLIC(MS_BIND) +#define MS_MOVE SYMBOLIC(MS_MOVE) +#define MS_REC SYMBOLIC(MS_REC) +#define MS_SILENT SYMBOLIC(MS_SILENT) +#define MS_POSIXACL SYMBOLIC(MS_POSIXACL) +#define MS_UNBINDABLE SYMBOLIC(MS_UNBINDABLE) +#define MS_PRIVATE SYMBOLIC(MS_PRIVATE) +#define MS_SLAVE SYMBOLIC(MS_SLAVE) +#define MS_SHARED SYMBOLIC(MS_SHARED) +#define MS_RELATIME SYMBOLIC(MS_RELATIME) +#define MNT_RELATIME SYMBOLIC(MNT_RELATIME) +#define MS_KERNMOUNT SYMBOLIC(MS_KERNMOUNT) +#define MS_I_VERSION SYMBOLIC(MS_I_VERSION) +#define MS_STRICTATIME SYMBOLIC(MS_STRICTATIME) +#define MNT_STRICTATIME SYMBOLIC(MNT_STRICTATIME) +#define MS_LAZYTIME SYMBOLIC(MS_LAZYTIME) +#define MS_ACTIVE SYMBOLIC(MS_ACTIVE) +#define MS_NOUSER SYMBOLIC(MS_NOUSER) +#define MS_RMT_MASK SYMBOLIC(MS_RMT_MASK) +#define MS_MGC_VAL SYMBOLIC(MS_MGC_VAL) +#define MS_MGC_MSK SYMBOLIC(MS_MGC_MSK) +#define MNT_ASYNC SYMBOLIC(MNT_ASYNC) +#define MNT_RELOAD SYMBOLIC(MNT_RELOAD) +#define MNT_SUIDDIR SYMBOLIC(MNT_SUIDDIR) +#define MNT_NOCLUSTERR SYMBOLIC(MNT_NOCLUSTERR) +#define MNT_NOCLUSTERW SYMBOLIC(MNT_NOCLUSTERW) +#define MNT_SNAPSHOT SYMBOLIC(MNT_SNAPSHOT) #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */ diff --git a/libc/sysv/consts/reboot.h b/libc/sysv/consts/reboot.h new file mode 100644 index 000000000..f72bcadbc --- /dev/null +++ b/libc/sysv/consts/reboot.h @@ -0,0 +1,34 @@ +#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ +#define COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ +#include "libc/runtime/symbolic.h" +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +extern const uint32_t RB_AUTOBOOT; +extern const uint32_t RB_POWER_OFF; +extern const uint32_t RB_POWERDOWN; +extern const uint32_t RB_POWEROFF; +extern const uint32_t RB_HALT_SYSTEM; +extern const uint32_t RB_HALT; +extern const uint32_t RB_SW_SUSPEND; +extern const uint32_t RB_KEXEC; +extern const uint32_t RB_ENABLE_CAD; +extern const uint32_t RB_DISABLE_CAD; +extern const uint32_t RB_NOSYNC; + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ + +#define RB_AUTOBOOT SYMBOLIC(RB_AUTOBOOT) +#define RB_POWER_OFF SYMBOLIC(RB_POWER_OFF) +#define RB_POWERDOWN SYMBOLIC(RB_POWERDOWN) +#define RB_POWEROFF SYMBOLIC(RB_POWEROFF) +#define RB_HALT_SYSTEM SYMBOLIC(RB_HALT_SYSTEM) +#define RB_HALT SYMBOLIC(RB_HALT) +#define RB_SW_SUSPEND SYMBOLIC(RB_SW_SUSPEND) +#define RB_KEXEC SYMBOLIC(RB_KEXEC) +#define RB_ENABLE_CAD SYMBOLIC(RB_ENABLE_CAD) +#define RB_DISABLE_CAD SYMBOLIC(RB_DISABLE_CAD) +#define RB_NOSYNC SYMBOLIC(RB_NOSYNC) + +#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */ diff --git a/libc/sysv/consts/termios.h b/libc/sysv/consts/termios.h index 0ddd9d50c..d83154b2e 100644 --- a/libc/sysv/consts/termios.h +++ b/libc/sysv/consts/termios.h @@ -12,7 +12,6 @@ extern const long BUSY; extern const long CANBSIZ; extern const long CBAUD; extern const long CBAUDEX; -extern const long CBRK; extern const long CEOL; extern const long CIBAUD; extern const long CLOCAL; @@ -28,8 +27,6 @@ extern const long CS7; extern const long CS8; extern const long CSIZE; extern const long CSTOPB; -extern const long CSUSP; -extern const long CWERASE; extern const long ECHO; extern const long ECHOCTL; extern const long ECHOE; @@ -225,7 +222,6 @@ COSMOPOLITAN_C_END_ #define CANBSIZ SYMBOLIC(CANBSIZ) #define CBAUD SYMBOLIC(CBAUD) #define CBAUDEX SYMBOLIC(CBAUDEX) -#define CBRK SYMBOLIC(CBRK) #define CEOL SYMBOLIC(CEOL) #define CIBAUD SYMBOLIC(CIBAUD) #define CLOCAL SYMBOLIC(CLOCAL) @@ -237,8 +233,6 @@ COSMOPOLITAN_C_END_ #define CS8 SYMBOLIC(CS8) #define CSIZE SYMBOLIC(CSIZE) #define CSTOPB SYMBOLIC(CSTOPB) -#define CSUSP SYMBOLIC(CSUSP) -#define CWERASE SYMBOLIC(CWERASE) #define ECHO LITERALLY(8) #define ECHOCTL SYMBOLIC(ECHOCTL) #define ECHOE SYMBOLIC(ECHOE) diff --git a/libc/sysv/consts/unmount.h b/libc/sysv/consts/unmount.h new file mode 100644 index 000000000..cc1f4bb1d --- /dev/null +++ b/libc/sysv/consts/unmount.h @@ -0,0 +1,22 @@ +#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ +#define COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ +#include "libc/runtime/symbolic.h" +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +extern const long MNT_FORCE; +extern const long MNT_DETACH; +extern const long MNT_EXPIRE; +extern const long UMOUNT_NOFOLLOW; +extern const long MNT_BYFSID; + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ + +#define MNT_FORCE SYMBOLIC(MNT_FORCE) +#define MNT_DETACH SYMBOLIC(MNT_DETACH) +#define MNT_EXPIRE SYMBOLIC(MNT_EXPIRE) +#define UMOUNT_NOFOLLOW SYMBOLIC(UMOUNT_NOFOLLOW) +#define MNT_BYFSID SYMBOLIC(MNT_BYFSID) + +#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */ diff --git a/libc/sysv/syscalls.sh b/libc/sysv/syscalls.sh index 373de9bdc..278a5e612 100755 --- a/libc/sysv/syscalls.sh +++ b/libc/sysv/syscalls.sh @@ -182,8 +182,10 @@ scall chroot 0x03d03d03d203d0a1 globl scall sys_sync 0xfff02402420240a2 globl hidden scall acct 0x03303303320330a3 globl scall settimeofday 0x1a304407a207a0a4 globl -scall mount 0x19a01501520a70a5 globl -scall reboot 0x0d003703720370a9 globl +scall sys_mount 0x19a01501520a70a5 globl +scall sys_unmount 0x016016016209f0a6 globl hidden # umount2() on linux +scall umount2 0x016016016209f0a6 globl hidden # unmount() on bsd +scall sys_reboot 0x0d003703720370a9 globl hidden # two arguments b/c netbsd/sparc lool scall quotactl 0xfff09409420a50b3 globl scall setfsuid 0xfffffffffffff07a globl scall setfsgid 0xfffffffffffff07b globl @@ -209,7 +211,6 @@ scall _sysctl 0xfffffffffffff09c globl scall prctl 0xfffffffffffff09d globl scall sys_arch_prctl 0xfff0a50a5ffff09e globl hidden # sysarch() on bsd scall adjtimex 0xfffffffffffff09f globl -scall umount2 0xfffffffffffff0a6 globl scall swapon 0xffffff05520550a7 globl scall swapoff 0xffffff1a8ffff0a8 globl scall sethostname 0xffffff058ffff0aa globl @@ -398,7 +399,6 @@ scall __bsd_seteuid 0xfff0b70b720b7fff globl hidden # wrapped via setreuid() scall __bsd_setegid 0xfff0b60b620b6fff globl hidden # wrapped via setregid() scall fpathconf 0x0c00c00c020c0fff globl scall fhopen 0x18c10812a20f8fff globl -scall unmount 0x016016016209ffff globl scall issetugid 0xfff0fd0fd2147fff globl scall minherit 0x1110fa0fa20fafff globl scall pathconf 0x0bf0bf0bf20bffff globl diff --git a/third_party/chibicc/test/test.mk b/third_party/chibicc/test/test.mk index 13c14ad46..687e9a9a5 100644 --- a/third_party/chibicc/test/test.mk +++ b/third_party/chibicc/test/test.mk @@ -93,6 +93,9 @@ o/$(MODE)/third_party/chibicc/test/%2.com.dbg: \ .PRECIOUS: $(THIRD_PARTY_CHIBICC_TEST_OBJS) .PRECIOUS: $(THIRD_PARTY_CHIBICC_TEST2_OBJS) +o/$(MODE)/third_party/chibicc/test/int128_test.chibicc.o: QUOTA = -M512m +o/$(MODE)/third_party/chibicc/test/int128_test.chibicc2.o: QUOTA = -M512m + .PHONY: o/$(MODE)/third_party/chibicc/test o/$(MODE)/third_party/chibicc/test: \ $(THIRD_PARTY_CHIBICC_TEST_BINS) \ diff --git a/third_party/gdtoa/gdtoa.mk b/third_party/gdtoa/gdtoa.mk index a1bf9095d..f7bf0c7cf 100644 --- a/third_party/gdtoa/gdtoa.mk +++ b/third_party/gdtoa/gdtoa.mk @@ -9,16 +9,8 @@ THIRD_PARTY_GDTOA_A = o/$(MODE)/third_party/gdtoa/gdtoa.a THIRD_PARTY_GDTOA_A_FILES := $(wildcard third_party/gdtoa/*) THIRD_PARTY_GDTOA_A_HDRS = $(filter %.h,$(THIRD_PARTY_GDTOA_A_FILES)) THIRD_PARTY_GDTOA_A_INCS = $(filter %.inc,$(THIRD_PARTY_GDTOA_A_FILES)) -THIRD_PARTY_GDTOA_A_SRCS_S = $(filter %.S,$(THIRD_PARTY_GDTOA_A_FILES)) -THIRD_PARTY_GDTOA_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_GDTOA_A_FILES)) - -THIRD_PARTY_GDTOA_A_SRCS = \ - $(THIRD_PARTY_GDTOA_A_SRCS_S) \ - $(THIRD_PARTY_GDTOA_A_SRCS_C) - -THIRD_PARTY_GDTOA_A_OBJS = \ - $(THIRD_PARTY_GDTOA_A_SRCS_S:%.S=o/$(MODE)/%.o) \ - $(THIRD_PARTY_GDTOA_A_SRCS_C:%.c=o/$(MODE)/%.o) +THIRD_PARTY_GDTOA_A_SRCS = $(filter %.c,$(THIRD_PARTY_GDTOA_A_FILES)) +THIRD_PARTY_GDTOA_A_OBJS = $(THIRD_PARTY_GDTOA_A_SRCS:%.c=o/$(MODE)/%.o) THIRD_PARTY_GDTOA_A_CHECKS = \ $(THIRD_PARTY_GDTOA_A).pkg \ diff --git a/third_party/linenoise/linenoise.c b/third_party/linenoise/linenoise.c index f82662651..456db18fe 100644 --- a/third_party/linenoise/linenoise.c +++ b/third_party/linenoise/linenoise.c @@ -43,15 +43,11 @@ │ │ ╞══════════════════════════════════════════════════════════════════════════════╡ │ │ -│ References: │ -│ - http://invisible-island.net/xterm/ctlseqs/ctlseqs.html │ -│ - http://www.3waylabs.com/nw/WWW/products/wizcon/vt220.html │ -│ │ │ Todo list: │ │ - Filter bogus Ctrl+ combinations. │ │ - Win32 support │ │ │ -│ Bloat: │ +│ Bloat: [say what?!] MUST DO: │ │ - History search like Ctrl+r in readline? │ │ │ │ List of escape sequences used by this program, we do everything just │ @@ -103,6 +99,125 @@ │ ED (Erase display) │ │ Sequence: ESC [ 2 J │ │ Effect: clear the whole screen │ +│ │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ │ +│ REFERENCE │ +│ the big scary coding you 𝘮𝘶𝘴𝘵 use curses to abstract │ +│ │ +│ \t TAB │ +│ \a BELL │ +│ \r CURSOR START │ +│ \b CURSOR LEFT │ +│ \177 CURSOR LEFT │ +│ \n CURSOR DOWN AND START IF OPOST │ +│ \f CURSOR DOWN AND START IF OPOST │ +│ \v CURSOR DOWN AND START IF OPOST │ +│ \eD CURSOR DOWN AND START │ +│ \eE CURSOR DOWN │ +│ \eM CURSOR UP │ +│ \ec FULL RESET │ +│ \e7 SAVE CURSOR POSITION │ +│ \e8 RESTORE CURSOR POSITION │ +│ \e(0 DEC SPECIAL GRAPHICS │ +│ \e(B USAS X3.4-1967 │ +│ \e#5 SINGLE WIDTH │ +│ \e#6 DOUBLE WIDTH │ +│ \e#8 SO MANY E │ +│ \eZ → \e/Z REPORT IDENTITY │ +│ \e[𝑛A CURSOR UP [CLAMPED] │ +│ \e[𝑛B CURSOR DOWN [CLAMPED] │ +│ \e[𝑛C CURSOR RIGHT [CLAMPED] │ +│ \e[𝑛D CURSOR LEFT [CLAMPED] │ +│ \e[𝑦;𝑥H SET CURSOR POSITION [CLAMPED] │ +│ \e[𝑥G SET CURSOR COLUMN [CLAMPED] │ +│ \e[𝑦d SET CURSOR ROW [CLAMPED] │ +│ \e[𝑛E CURSOR DOWN AND START [CLAMPED] │ +│ \e[𝑛F CURSOR UP AND START [CLAMPED] │ +│ \e[𝑛S SCROLL UP │ +│ \e[𝑛T SCROLL DOWN │ +│ \e[𝑛@ INSERT CELLS │ +│ \e[𝑛P DELETE CELLS │ +│ \e[𝑛L INSERT LINES │ +│ \e[𝑛M DELETE LINES │ +│ \e[J ERASE DISPLAY FORWARDS │ +│ \e[1J ERASE DISPLAY BACKWARDS │ +│ \e[2J ERASE DISPLAY │ +│ \e[K ERASE LINE FORWARD │ +│ \e[1K ERASE LINE BACKWARD │ +│ \e[2K ERASE LINE │ +│ \e[𝑛X ERASE CELLS │ +│ \e[0m RESET │ +│ \e[1m BOLD │ +│ \e[2m FAINT │ +│ \e[3m ITALIC │ +│ \e[4m UNDER │ +│ \e[5m BLINK │ +│ \e[7m INVERT │ +│ \e[8m CONCEAL │ +│ \e[9m STRIKE │ +│ \e[20m FRAKTUR │ +│ \e[21m DUNDER │ +│ \e[22m RESET BOLD & FAINT │ +│ \e[23m RESET ITALIC & FRAKTUR │ +│ \e[24m RESET UNDER & DUNDER │ +│ \e[25m RESET BLINK │ +│ \e[27m RESET INVERT │ +│ \e[28m RESET CONCEAL │ +│ \e[29m RESET STRIKE │ +│ \e[39m RESET FOREGROUND │ +│ \e[49m RESET BACKGROUND │ +│ \e[30m BLACK FOREGROUND │ +│ \e[31m RED FOREGROUND │ +│ \e[32m GREEN FOREGROUND │ +│ \e[33m YELLOW FOREGROUND │ +│ \e[34m BLUE FOREGROUND │ +│ \e[35m MAGENTA FOREGROUND │ +│ \e[36m CYAN FOREGROUND │ +│ \e[37m WHITE FOREGROUND │ +│ \e[40m BLACK BACKGROUND │ +│ \e[41m RED BACKGROUND │ +│ \e[42m GREEN BACKGROUND │ +│ \e[44m YELLOW BACKGROUND │ +│ \e[44m BLUE BACKGROUND │ +│ \e[45m MAGENTA BACKGROUND │ +│ \e[46m CYAN BACKGROUND │ +│ \e[47m WHITE BACKGROUND │ +│ \e[90m BRIGHT BLACK FOREGROUND │ +│ \e[91m BRIGHT RED FOREGROUND │ +│ \e[92m BRIGHT GREEN FOREGROUND │ +│ \e[93m BRIGHT YELLOW FOREGROUND │ +│ \e[94m BRIGHT BLUE FOREGROUND │ +│ \e[95m BRIGHT MAGENTA FOREGROUND │ +│ \e[96m BRIGHT CYAN FOREGROUND │ +│ \e[97m BRIGHT WHITE FOREGROUND │ +│ \e[100m BRIGHT BLACK BACKGROUND │ +│ \e[101m BRIGHT RED BACKGROUND │ +│ \e[102m BRIGHT GREEN BACKGROUND │ +│ \e[103m BRIGHT YELLOW BACKGROUND │ +│ \e[104m BRIGHT BLUE BACKGROUND │ +│ \e[105m BRIGHT MAGENTA BACKGROUND │ +│ \e[106m BRIGHT CYAN BACKGROUND │ +│ \e[107m BRIGHT WHITE BACKGROUND │ +│ \e[38;5;𝑥m XTERM256 FOREGROUND │ +│ \e[48;5;𝑥m XTERM256 BACKGROUND │ +│ \e[38;2;𝑟;𝑔;𝑏m RGB FOREGROUND │ +│ \e[48;2;𝑟;𝑔;𝑏m RGB BACKGROUND │ +│ \e[?25h SHOW CURSOR │ +│ \e[?25l HIDE CURSOR │ +│ \e[s SAVE CURSOR POSITION │ +│ \e[u RESTORE CURSOR POSITION │ +│ \e[?5h ... \e[?5l REVERSE VIDEO EPILEPSY │ +│ \e[0q RESET LEDS │ +│ \e[1q TURN ON FIRST LED │ +│ \e[2q TURN ON SECOND LED │ +│ \e[3q TURN ON THIRD LED │ +│ \e[4q TURN ON FOURTH LED │ +│ \e[c → \e[?1;0c REPORT DEVICE TYPE │ +│ \e[5n → \e[0n REPORT DEVICE STATUS │ +│ \e[6n → \e[𝑦;𝑥R REPORT CURSOR POSITION │ +│ \e7\e[9979;9979H\e[6n\e8 → \e[𝑦;𝑥R REPORT DISPLAY DIMENSIONS │ +│ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/calls/termios.h" diff --git a/third_party/mbedtls/test/test.mk b/third_party/mbedtls/test/test.mk index 4e492e171..57513816b 100644 --- a/third_party/mbedtls/test/test.mk +++ b/third_party/mbedtls/test/test.mk @@ -1361,3 +1361,5 @@ o/$(MODE)/third_party/mbedtls/test/secp384r1_test.com.dbg: \ $(CRT) \ $(APE) @$(APELINK) + +o/$(MODE)/third_party/mbedtls/test/test_suite_asn1parse.com.runs: QUOTA = -M512m diff --git a/third_party/python/Modules/termios.c b/third_party/python/Modules/termios.c index db37ec525..7d3d87f0e 100644 --- a/third_party/python/Modules/termios.c +++ b/third_party/python/Modules/termios.c @@ -6,9 +6,12 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/termios.h" #include "libc/calls/termios.h" +#include "libc/calls/ttydefaults.h" #include "libc/calls/weirdtypes.h" #include "libc/sysv/consts/baud.h" +#include "libc/sysv/consts/fio.h" #include "libc/sysv/consts/modem.h" +#include "libc/sysv/consts/termios.h" #include "third_party/python/Include/bytesobject.h" #include "third_party/python/Include/fileobject.h" #include "third_party/python/Include/listobject.h" @@ -478,32 +481,32 @@ PyInit_termios(void) /* TODO(jart): B460800 */ if (CBAUD) PyModule_AddIntConstant(m, "CBAUD", CBAUD); /* TODO(jart): CDEL */ - /* TODO(jart): CDSUSP */ - /* TODO(jart): CEOF */ - if (CEOL) PyModule_AddIntConstant(m, "CEOL", CEOL); + PyModule_AddIntConstant(m, "CEOF", CEOF); + PyModule_AddIntConstant(m, "CDSUSP", CDSUSP); + PyModule_AddIntConstant(m, "CEOL", CEOL); + PyModule_AddIntConstant(m, "CFLUSH", CFLUSH); + PyModule_AddIntConstant(m, "CINTR", CINTR); /* TODO(jart): CEOL2 */ /* TODO(jart): CEOT */ /* TODO(jart): CERASE */ /* TODO(jart): CESC */ - /* TODO(jart): CFLUSH */ - /* TODO(jart): CINTR */ /* TODO(jart): CKILL */ /* TODO(jart): CLNEXT */ /* TODO(jart): CNUL */ /* TODO(jart): COMMON */ - /* TODO(jart): CQUIT */ - /* TODO(jart): CRPRNT */ - /* TODO(jart): CSTART */ - /* TODO(jart): CSTOP */ - if (CSUSP) PyModule_AddIntConstant(m, "CSUSP", CSUSP); + PyModule_AddIntConstant(m, "CQUIT", CQUIT); + PyModule_AddIntConstant(m, "CRPRNT", CRPRNT); + PyModule_AddIntConstant(m, "CSTART", CSTART); + PyModule_AddIntConstant(m, "CSTOP", CSTOP); + PyModule_AddIntConstant(m, "CSUSP", CSUSP); + PyModule_AddIntConstant(m, "FIOCLEX", FIOCLEX); + PyModule_AddIntConstant(m, "FIONCLEX", FIONCLEX); /* TODO(jart): CSWTCH */ if (CWERASE) PyModule_AddIntConstant(m, "CWERASE", CWERASE); /* TODO(jart): EXTA */ /* TODO(jart): EXTB */ /* TODO(jart): FIOASYNC */ - /* TODO(jart): FIOCLEX */ /* TODO(jart): FIONBIO */ - /* TODO(jart): FIONCLEX */ /* TODO(jart): FIONREAD */ /* TODO(jart): IBSHIFT */ /* TODO(jart): CC */ diff --git a/third_party/python/python.mk b/third_party/python/python.mk index 54336b967..4cfb9a914 100644 --- a/third_party/python/python.mk +++ b/third_party/python/python.mk @@ -480,6 +480,9 @@ $(THIRD_PARTY_PYTHON_A_OBJS): \ third_party/python/python.mk \ third_party/python/python-modules.mk +o/$(MODE)/third_party/python/libpython3.6m.a: QUOTA = -F200m +o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -M512m + THIRD_PARTY_PYTHON_LIBS = $(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x))) THIRD_PARTY_PYTHON_SRCS = $(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)_SRCS)) THIRD_PARTY_PYTHON_INCS = $(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)_INCS)) diff --git a/third_party/quickjs/quickjs.mk b/third_party/quickjs/quickjs.mk index 7444f31f4..2063502b2 100644 --- a/third_party/quickjs/quickjs.mk +++ b/third_party/quickjs/quickjs.mk @@ -185,6 +185,9 @@ o/$(MODE)/third_party/quickjs/quickjs.o: \ OVERRIDE_CPPFLAGS += \ -DSTACK_FRAME_UNLIMITED +o/$(MODE)/third_party/quickjs/call.o: QUOTA = -M1024m -C16 +o/$(MODE)/third_party/quickjs/quickjs.o: QUOTA = -M512m + .PHONY: o/$(MODE)/third_party/quickjs o/$(MODE)/third_party/quickjs: \ $(THIRD_PARTY_QUICKJS_BINS) \ diff --git a/third_party/sqlite3/sqlite3.mk b/third_party/sqlite3/sqlite3.mk index 5e341ca6b..e7eba1000 100644 --- a/third_party/sqlite3/sqlite3.mk +++ b/third_party/sqlite3/sqlite3.mk @@ -174,6 +174,10 @@ $(THIRD_PARTY_SQLITE3_SHELL_OBJS): \ o/$(MODE)/%.shell.o: %.c @$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) $< +o/$(MODE)/third_party/sqlite3/shell.shell.o: QUOTA = -M512m +o/$(MODE)/third_party/sqlite3/vdbe.o: QUOTA = -M512m +o/$(MODE)/third_party/sqlite3/vdbe.shell.o: QUOTA = -M512m + THIRD_PARTY_SQLITE3_LIBS = $(foreach x,$(THIRD_PARTY_SQLITE3_ARTIFACTS),$($(x))) THIRD_PARTY_SQLITE3_SRCS = $(foreach x,$(THIRD_PARTY_SQLITE3_ARTIFACTS),$($(x)_SRCS)) THIRD_PARTY_SQLITE3_HDRS = $(foreach x,$(THIRD_PARTY_SQLITE3_ARTIFACTS),$($(x)_HDRS)) diff --git a/tool/emacs/cosmo-cpp-constants.el b/tool/emacs/cosmo-cpp-constants.el index 23ad45e91..4213de907 100644 --- a/tool/emacs/cosmo-cpp-constants.el +++ b/tool/emacs/cosmo-cpp-constants.el @@ -128,7 +128,10 @@ "__SIZEOF_WCHAR_T__" "__SIZEOF_WINT_T__" "__SIZEOF_PTRDIFF_T__" - "__TIMESTAMP__")) + "__TIMESTAMP__" + "_GNU_SOURCE" + "_BSD_SOURCE" + "_XOPEN_SOURCE")) (defconst cosmo-cpp-constants-cosmopolitan '("__SAUCE__"