mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Strengthen the pledge() polyfill
This commit is contained in:
parent
a6f65eea7c
commit
3c92adfd6e
79 changed files with 1457 additions and 357 deletions
|
@ -19,14 +19,27 @@
|
|||
#include "libc/calls/struct/flock.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/sysv/consts/f.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
int sys_fcntl(int fd, int cmd, uintptr_t arg) {
|
||||
int rc;
|
||||
bool islock;
|
||||
islock = cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK;
|
||||
if (islock) cosmo2flock(arg);
|
||||
if ((islock = cmd == F_GETLK || //
|
||||
cmd == F_SETLK || //
|
||||
cmd == F_SETLKW)) {
|
||||
if ((!IsAsan() && !arg) ||
|
||||
(IsAsan() &&
|
||||
!__asan_is_valid((struct flock *)arg, sizeof(struct flock)))) {
|
||||
return efault();
|
||||
}
|
||||
cosmo2flock(arg);
|
||||
}
|
||||
rc = __sys_fcntl(fd, cmd, arg);
|
||||
if (islock) flock2cosmo(arg);
|
||||
if (islock) {
|
||||
flock2cosmo(arg);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
36
libc/calls/isatty-metal.c
Normal file
36
libc/calls/isatty-metal.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
bool32 sys_isatty_metal(int fd) {
|
||||
if (__isfdopen(fd)) {
|
||||
if (__isfdkind(fd, kFdSerial)) {
|
||||
return true;
|
||||
} else {
|
||||
enotty();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ebadf();
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,17 @@
|
|||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
textwindows bool32 sys_isatty_nt(int fd) {
|
||||
return __isfdkind(fd, kFdConsole) ||
|
||||
(__isfdkind(fd, kFdFile) &&
|
||||
GetFileType(__getfdhandleactual(fd)) == kNtFileTypeChar);
|
||||
if (__isfdopen(fd)) {
|
||||
if (__isfdkind(fd, kFdConsole) ||
|
||||
(__isfdkind(fd, kFdFile) &&
|
||||
GetFileType(g_fds.p[fd].handle) == kNtFileTypeChar)) {
|
||||
return true;
|
||||
} else {
|
||||
enotty();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ebadf();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,32 +22,39 @@
|
|||
#include "libc/calls/struct/winsize.h"
|
||||
#include "libc/calls/syscall-nt.internal.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/sysv/consts/termios.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
/**
|
||||
* Returns true if file descriptor is backed by a terminal device.
|
||||
* Tells if file descriptor is a terminal.
|
||||
*
|
||||
* @param fd is file descriptor
|
||||
* @return 1 if is terminal, otherwise 0 w/ errno
|
||||
* @raise EBADF if fd isn't a valid file descriptor
|
||||
* @raise ENOTTY if fd is something other than a terminal
|
||||
* @raise EPERM if pledge() was used without tty
|
||||
*/
|
||||
bool32 isatty(int fd) {
|
||||
int e;
|
||||
bool32 res;
|
||||
struct winsize ws;
|
||||
e = errno;
|
||||
if (fd >= 0) {
|
||||
if (__isfdkind(fd, kFdZip)) {
|
||||
res = false;
|
||||
} else if (IsMetal()) {
|
||||
res = false;
|
||||
} else if (!IsWindows()) {
|
||||
res = sys_ioctl(fd, TIOCGWINSZ, &ws) != -1;
|
||||
} else {
|
||||
res = sys_isatty_nt(fd);
|
||||
}
|
||||
if (__isfdkind(fd, kFdZip)) {
|
||||
enotty();
|
||||
res = false;
|
||||
} else if (IsWindows()) {
|
||||
res = sys_isatty_nt(fd);
|
||||
} else if (IsMetal()) {
|
||||
res = sys_isatty_metal(fd);
|
||||
} else if (!sys_ioctl(fd, TIOCGWINSZ, &ws)) {
|
||||
res = true;
|
||||
} else {
|
||||
res = false;
|
||||
if (errno != EBADF && errno != EPERM) {
|
||||
enotty();
|
||||
}
|
||||
}
|
||||
STRACE("isatty(%d) → %hhhd% m", fd, res);
|
||||
errno = e;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/sysv/consts/pr.h"
|
||||
|
||||
bool __is_linux_2_6_23(void) {
|
||||
privileged bool __is_linux_2_6_23(void) {
|
||||
int rc;
|
||||
if (!IsLinux()) return false;
|
||||
asm volatile("syscall"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* @raise ENOSYS on non-Linux.
|
||||
*/
|
||||
int prctl(int operation, ...) {
|
||||
privileged int prctl(int operation, ...) {
|
||||
int rc;
|
||||
va_list va;
|
||||
intptr_t a, b;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
* @raise ENOSYS on non-Linux.
|
||||
*/
|
||||
int seccomp(unsigned operation, unsigned flags, void *args) {
|
||||
privileged int seccomp(unsigned operation, unsigned flags, void *args) {
|
||||
int rc;
|
||||
if (IsLinux()) {
|
||||
asm volatile("syscall"
|
||||
|
|
|
@ -62,15 +62,15 @@ COSMOPOLITAN_C_START_
|
|||
#define BPF_TO_BE 0x08
|
||||
#define BPF_FROM_LE BPF_TO_LE
|
||||
#define BPF_FROM_BE BPF_TO_BE
|
||||
#define BPF_JNE 0x50
|
||||
#define BPF_JLT 0xa0
|
||||
#define BPF_JLE 0xb0
|
||||
#define BPF_JSGT 0x60
|
||||
#define BPF_JSGE 0x70
|
||||
#define BPF_JSLT 0xc0
|
||||
#define BPF_JSLE 0xd0
|
||||
#define BPF_CALL 0x80
|
||||
#define BPF_EXIT 0x90
|
||||
#define BPF_JNE 0x50 /* != */
|
||||
#define BPF_JLT 0xa0 /* unsigned < */
|
||||
#define BPF_JLE 0xb0 /* unsigned <= */
|
||||
#define BPF_JSGT 0x60 /* signed > */
|
||||
#define BPF_JSGE 0x70 /* signed >= */
|
||||
#define BPF_JSLT 0xc0 /* signed < */
|
||||
#define BPF_JSLE 0xd0 /* signed <= */
|
||||
#define BPF_CALL 0x80 /* call */
|
||||
#define BPF_EXIT 0x90 /* ret */
|
||||
#define BPF_FETCH 0x01
|
||||
#define BPF_XCHG (0xe0 | BPF_FETCH)
|
||||
#define BPF_CMPXCHG (0xf0 | BPF_FETCH)
|
||||
|
|
|
@ -26,8 +26,8 @@ struct sock_fprog {
|
|||
|
||||
#define BPF_STMT(code, k) \
|
||||
{ (unsigned short)(code), 0, 0, k }
|
||||
#define BPF_JUMP(code, k, jt, jf) \
|
||||
{ (unsigned short)(code), jt, jf, k }
|
||||
#define BPF_JUMP(code, k, jumptrue, jumpfalse) \
|
||||
{ (unsigned short)(code), jumptrue, jumpfalse, k }
|
||||
|
||||
#define BPF_MEMWORDS 16
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ void __restore_rt() hidden;
|
|||
void __restore_rt_netbsd(void) hidden;
|
||||
void cosmo2flock(uintptr_t);
|
||||
void flock2cosmo(uintptr_t);
|
||||
bool32 sys_isatty_metal(int);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @vforksafe
|
||||
* @noreturn
|
||||
*/
|
||||
wontreturn void _Exit(int exitcode) {
|
||||
privileged wontreturn void _Exit(int exitcode) {
|
||||
int i;
|
||||
STRACE("_Exit(%d)", exitcode);
|
||||
if (!IsWindows() && !IsMetal()) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/sysv/consts/nr.h"
|
||||
#include "libc/macros.internal.h"
|
||||
.privileged
|
||||
|
||||
_futex: mov __NR_futex,%eax
|
||||
clc
|
||||
|
|
|
@ -47,7 +47,8 @@ static union metatermios __oldtermios;
|
|||
static textstartup void __oldtermios_init() {
|
||||
int e;
|
||||
e = errno;
|
||||
if (sys_ioctl(0, TCGETS, &__oldtermios) != -1) {
|
||||
if (!IsOpenbsd() && // avoid pledge(tty)
|
||||
sys_ioctl(0, TCGETS, &__oldtermios) != -1) {
|
||||
__isrestorable = true;
|
||||
}
|
||||
errno = e;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
.privileged
|
||||
|
||||
// Invokes clone() system call on GNU/Systemd.
|
||||
//
|
||||
|
|
|
@ -34,6 +34,7 @@ extern unsigned char _ereal[]; /* αpε */
|
|||
extern unsigned char __privileged_start[]; /* αpε */
|
||||
extern unsigned char __privileged_addr[]; /* αpε */
|
||||
extern unsigned char __privileged_size[]; /* αpε */
|
||||
extern unsigned char __privileged_end[]; /* αpε */
|
||||
extern unsigned char __test_start[]; /* αpε */
|
||||
extern unsigned char __ro[]; /* αpε */
|
||||
extern unsigned char *__relo_start[]; /* αpε */
|
||||
|
|
|
@ -74,6 +74,10 @@ static textexit void LogStackUse(void) {
|
|||
}
|
||||
|
||||
static textstartup void LogStackUseInit(void) {
|
||||
if (IsOpenbsd()) {
|
||||
// avoid pledge() dependency on wpath
|
||||
return;
|
||||
}
|
||||
if (IsTiny()) return;
|
||||
if (isdirectory("o/" MODE) &&
|
||||
getcwd(stacklog, sizeof(stacklog) - strlen("/o/" MODE "/stack.log"))) {
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
#include "libc/sysv/consts/af.h"
|
||||
|
||||
/**
|
||||
* Creates bidirectional pipe.
|
||||
* Creates bidirectional pipe, e.g.
|
||||
*
|
||||
* int sv[2];
|
||||
* socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
|
||||
*
|
||||
* @param family should be AF_UNIX or synonymously AF_LOCAL
|
||||
* @param type can be SOCK_STREAM (for TCP), SOCK_DGRAM (e.g. UDP), or
|
||||
* SOCK_RAW (IP) so long as IP_HDRINCL was passed to setsockopt();
|
||||
* and additionally, may be or'd with SOCK_NONBLOCK, SOCK_CLOEXEC
|
||||
* @param type can be SOCK_STREAM or SOCK_DGRAM and additionally,
|
||||
* may be or'd with SOCK_NONBLOCK, SOCK_CLOEXEC
|
||||
* @param sv a vector of 2 integers to store the created sockets
|
||||
* @return 0 if success, -1 in case of error
|
||||
* @error EFAULT, EPFNOSUPPORT, etc.
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
_ehead = 0
|
||||
_ereal = 0
|
||||
__privileged_start = 0
|
||||
__privileged_end = 0
|
||||
__privileged_addr = 0
|
||||
__privileged_size = 0
|
||||
__test_start = 0
|
||||
|
@ -58,6 +59,7 @@
|
|||
.globl __privileged_size
|
||||
.globl __privileged_addr
|
||||
.globl __privileged_start
|
||||
.globl __privileged_end
|
||||
.globl __ro
|
||||
.globl __test_start
|
||||
.globl _edata
|
||||
|
@ -83,6 +85,7 @@
|
|||
.weak __privileged_size
|
||||
.weak __privileged_addr
|
||||
.weak __privileged_start
|
||||
.weak __privileged_end
|
||||
.weak __ro
|
||||
.weak __test_start
|
||||
.weak _edata
|
||||
|
|
|
@ -220,6 +220,7 @@ syscon compat O_LARGEFILE 0 0 0 0 0 0 #
|
|||
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary
|
||||
syscon mmap MAP_FILE 0 0 0 0 0 0 # consensus
|
||||
syscon mmap MAP_SHARED 1 1 1 1 1 1 # forced consensus & faked nt
|
||||
syscon mmap MAP_SHARED_VALIDATE 3 1 1 1 1 1 # weird linux thing
|
||||
syscon mmap MAP_PRIVATE 2 2 2 2 2 2 # forced consensus & faked nt
|
||||
syscon mmap MAP_STACK 6 6 6 6 6 6 # our definition
|
||||
syscon mmap MAP_TYPE 15 15 15 15 15 15 # mask for type of mapping
|
||||
|
@ -232,6 +233,7 @@ syscon mmap MAP_NORESERVE 0x00004000 0x00000040 0 0 0x00000040 0 # L
|
|||
syscon mmap MAP_POPULATE 0x00008000 0 0x00040000 0 0 0 # MAP_PREFAULT_READ on FreeBSD; can avoid madvise(MADV_WILLNEED) on private file mapping
|
||||
syscon mmap MAP_NONBLOCK 0x00010000 0 0 0 0 0
|
||||
syscon mmap MAP_HUGETLB 0x00040000 0 0 0 0 0x80000000 # kNtSecLargePages
|
||||
syscon mmap MAP_SYNC 0x00080000 0 0 0 0 0 # perform synchronous page faults for mapping (Linux 4.15+)
|
||||
syscon mmap MAP_INHERIT -1 -1 -1 -1 0x00000080 -1 # make it inherit across execve()
|
||||
syscon mmap MAP_HASSEMAPHORE 0 0x00000200 0x00000200 0 0x00000200 0 # does it matter on x86?
|
||||
syscon mmap MAP_NOSYNC 0 0 0x00000800 0 0 0 # flush to physical media only when necessary rather than gratuitously; be sure to use write() rather than ftruncate() with this!
|
||||
|
@ -999,11 +1001,15 @@ syscon sio SIOCSIFTXQLEN 0x8943 0 0 0 0 0
|
|||
syscon sio SIOCSRARP 0x8962 0 0 0 0 0
|
||||
syscon sio SIOGIFINDEX 0x8933 0 0 0 0 0
|
||||
|
||||
# socket() address families
|
||||
#
|
||||
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary
|
||||
syscon af AF_UNSPEC 0 0 0 0 0 0 # consensus
|
||||
syscon af AF_UNIX 1 1 1 1 1 1 # consensus
|
||||
syscon af AF_LOCAL 1 1 1 1 1 1 # consensus
|
||||
syscon af AF_FILE 1 0 0 0 0 0
|
||||
syscon af AF_INET 2 2 2 2 2 2 # consensus
|
||||
syscon af AF_INET6 10 30 28 24 24 23
|
||||
syscon af AF_AX25 3 0 0 0 0 0
|
||||
syscon af AF_IPX 4 23 23 23 23 6 # bsd consensus
|
||||
syscon af AF_APPLETALK 5 0x10 0x10 0x10 0x10 0x10 # bsd consensus
|
||||
|
@ -1011,7 +1017,6 @@ syscon af AF_NETROM 6 0 0 0 0 0
|
|||
syscon af AF_BRIDGE 7 0 0 0 0 0
|
||||
syscon af AF_ATMPVC 8 0 0 0 0 0
|
||||
syscon af AF_X25 9 0 0 0 0 0
|
||||
syscon af AF_INET6 10 30 28 24 24 23
|
||||
syscon af AF_ROSE 11 0 0 0 0 0
|
||||
syscon af AF_NETBEUI 13 0 0 0 0 0
|
||||
syscon af AF_SECURITY 14 0 0 0 0 0
|
||||
|
@ -1250,14 +1255,15 @@ syscon msg MSG_PEEK 2 2 2 2 2 2 # consensus
|
|||
syscon msg MSG_DONTROUTE 4 4 4 4 4 4 # consensus
|
||||
syscon msg MSG_FASTOPEN 0x20000000 0 0 0 0 0 # TODO
|
||||
syscon msg MSG_WAITALL 0x0100 0x40 0x40 0x40 0x40 8 # bsd consensus
|
||||
syscon msg MSG_MORE 0x8000 0 0 0 0 0 # send/sendto: manual TCP_CORK hbasically
|
||||
syscon msg MSG_NOSIGNAL 0x4000 0x80000 0x020000 0x0400 0x0400 0 # send/sendto: don't SIGPIPE on EOF
|
||||
syscon msg MSG_DONTWAIT 0x40 0x80 0x80 0x80 0x80 0 # send/sendto: manual non-blocking
|
||||
syscon msg MSG_TRUNC 0x20 0x10 0x10 0x10 0x10 0x0100 # bsd consensus
|
||||
syscon msg MSG_CTRUNC 8 0x20 0x20 0x20 0x20 0x0200 # bsd consensus
|
||||
syscon msg MSG_ERRQUEUE 0x2000 0 0 0 0 0x1000 # bsd consensus
|
||||
syscon msg MSG_NOERROR 0x1000 0x1000 0x1000 0x1000 0x1000 0 # unix consensus
|
||||
syscon msg MSG_DONTWAIT 0x40 0x80 0x80 0x80 0x80 0 # bsd consensus
|
||||
syscon msg MSG_EOR 0x80 8 8 8 8 0 # bsd consensus
|
||||
syscon msg MSG_CMSG_CLOEXEC 0x40000000 0 0x040000 0x0800 0x0800 0
|
||||
syscon msg MSG_NOSIGNAL 0x4000 0 0x020000 0x0400 0x0400 0
|
||||
syscon msg MSG_WAITFORONE 0x010000 0 0x080000 0 0x2000 0
|
||||
syscon msg MSG_BATCH 0x040000 0 0 0 0 0
|
||||
syscon msg MSG_CONFIRM 0x0800 0 0 0 0 0
|
||||
|
@ -1265,7 +1271,6 @@ syscon msg MSG_EXCEPT 0x2000 0 0 0 0 0
|
|||
syscon msg MSG_FIN 0x0200 0x0100 0x0100 0 0 0
|
||||
syscon msg MSG_EOF 0x0200 0x0100 0x0100 0 0 0
|
||||
syscon msg MSG_INFO 12 0 0 0 0 0
|
||||
syscon msg MSG_MORE 0x8000 0 0 0 0 0
|
||||
syscon msg MSG_PARITY_ERROR 9 0 0 0 0 0
|
||||
syscon msg MSG_PROXY 0x10 0 0 0 0 0
|
||||
syscon msg MSG_RST 0x1000 0 0 0 0 0
|
||||
|
@ -1327,17 +1332,17 @@ syscon compat TIOCSETAF 0x5404 0x80487416 0x802c7416 0x802c7416 0x802c74
|
|||
syscon termios TIOCGWINSZ 0x5413 1074295912 1074295912 1074295912 1074295912 0x5413 # ioctl(tty, TIOCGWINSZ, struct winsize *argp); polyfilled NT
|
||||
syscon termios TIOCSWINSZ 0x5414 0x80087467 0x80087467 0x80087467 0x80087467 0x5414 # ioctl(tty, TIOCSWINSZ, const struct winsize *argp) (faked NT)
|
||||
syscon termios TIOCOUTQ 0x5411 0x40047473 0x40047473 0x40047473 0x40047473 0 # get # bytes queued in TTY's output buffer ioctl(tty, TIOCSWINSZ, const struct winsize *argp)
|
||||
syscon termios TIOCGPGRP 0x540f 0x40047477 0x40047477 0x40047477 0x40047477 0 # get pgrp of tty
|
||||
syscon termios TIOCSPGRP 0x5410 0x80047476 0x80047476 0x80047476 0x80047476 0 # set pgrp of tty
|
||||
syscon termios TIOCSBRK 0x5427 0x2000747b 0x2000747b 0x2000747b 0x2000747b 0 # set break bit
|
||||
syscon termios TIOCCBRK 0x5428 0x2000747a 0x2000747a 0x2000747a 0x2000747a 0 # boop
|
||||
syscon termios TIOCCONS 0x541d 0x80047462 0x80047462 0x80047462 0x80047462 0 # boop
|
||||
syscon termios TIOCGETD 0x5424 0x4004741a 0x4004741a 0x4004741a 0x4004741a 0 # boop
|
||||
syscon termios TIOCGPGRP 0x540f 0x40047477 0x40047477 0x40047477 0x40047477 0 # boop
|
||||
syscon termios TIOCNOTTY 0x5422 0x20007471 0x20007471 0x20007471 0x20007471 0 # boop
|
||||
syscon termios TIOCNXCL 0x540d 0x2000740e 0x2000740e 0x2000740e 0x2000740e 0 # boop
|
||||
syscon termios TIOCSBRK 0x5427 0x2000747b 0x2000747b 0x2000747b 0x2000747b 0 # boop
|
||||
syscon termios TIOCSCTTY 0x540e 0x20007461 0x20007461 0x20007461 0x20007461 0 # boop
|
||||
syscon termios TIOCSETD 0x5423 0x8004741b 0x8004741b 0x8004741b 0x8004741b 0 # boop
|
||||
syscon termios TIOCSIG 0x40045436 0x2000745f 0x2004745f 0x8004745f 0x8004745f 0 # boop
|
||||
syscon termios TIOCSPGRP 0x5410 0x80047476 0x80047476 0x80047476 0x80047476 0 # boop
|
||||
syscon termios TIOCSTI 0x5412 0x80017472 0x80017472 0 0 0 # boop
|
||||
syscon termios TIOCGSID 0x5429 0x40047463 0x40047463 0x40047463 0x40047463 0 # boop
|
||||
syscon termios TABLDISC 0 0x3 0 0x3 0x3 0 # boop
|
||||
|
@ -1347,7 +1352,7 @@ syscon termios TCSBRK 0x5409 0x2000745e 0x2000745e 0x2000745e 0x2000745
|
|||
syscon termios TIOCDRAIN 0x5409 0x2000745e 0x2000745e 0x2000745e 0x2000745e 0 # TCSBRK on Linux
|
||||
syscon termios TIOCSTAT 0 0x20007465 0x20007465 0x20007465 0x20007465 0 # boop
|
||||
syscon termios TIOCSTART 0 0x2000746e 0x2000746e 0x2000746e 0x2000746e 0 # boop
|
||||
syscon termios TIOCCDTR 0 0x20007478 0x20007478 0x20007478 0x20007478 0 # boop
|
||||
syscon termios TIOCCDTR 0 0x20007478 0x20007478 0x20007478 0x20007478 0 # clear data terminal ready
|
||||
syscon termios TIOCSDTR 0 0x20007479 0x20007479 0x20007479 0x20007479 0 # boop
|
||||
syscon termios TIOCEXT 0 0x80047460 0x80047460 0x80047460 0x80047460 0 # boop
|
||||
syscon termios TIOCGDRAINWAIT 0 0x40047456 0x40047456 0 0 0 # boop
|
||||
|
|
2
libc/sysv/consts/MAP_SHARED_VALIDATE.S
Normal file
2
libc/sysv/consts/MAP_SHARED_VALIDATE.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_SHARED_VALIDATE,3,1,1,1,1,1
|
2
libc/sysv/consts/MAP_SYNC.S
Normal file
2
libc/sysv/consts/MAP_SYNC.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_SYNC,0x00080000,0,0,0,0,0
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon msg,MSG_NOSIGNAL,0x4000,0,0x020000,0x0400,0x0400,0
|
||||
.syscon msg,MSG_NOSIGNAL,0x4000,0x80000,0x020000,0x0400,0x0400,0
|
||||
|
|
|
@ -26,6 +26,7 @@ extern const long MAP_NOSYNC;
|
|||
extern const long MAP_POPULATE;
|
||||
extern const long MAP_PRIVATE;
|
||||
extern const long MAP_SHARED;
|
||||
extern const long MAP_SHARED_VALIDATE;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
@ -54,6 +55,7 @@ COSMOPOLITAN_C_END_
|
|||
#define MAP_NORESERVE SYMBOLIC(MAP_NORESERVE)
|
||||
#define MAP_NOSYNC SYMBOLIC(MAP_NOSYNC)
|
||||
#define MAP_POPULATE SYMBOLIC(MAP_POPULATE)
|
||||
#define MAP_SHARED_VALIDATE SYMBOLIC(MAP_SHARED_VALIDATE)
|
||||
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
#define MAP_NOCORE MAP_CONCEAL
|
||||
|
|
|
@ -58,7 +58,7 @@ scall sys_writev 0x0790790792079014 globl hidden
|
|||
scall sys_access 0x0210210212021015 globl hidden
|
||||
scall __sys_pipe 0x02a10721e202a016 globl hidden # NOTE: pipe2() on FreeBSD; XNU is pipe(void)→eax:edx
|
||||
scall sys_select 0x1a104705d205d017 globl hidden
|
||||
scall pselect 0x1b406e20a218afff globl
|
||||
scall pseletc 0x1b406e20a218afff globl
|
||||
scall pselect6 0xfffffffffffff10e globl
|
||||
scall sys_sched_yield 0x15e12a14bffff018 globl hidden # swtch on xnu? possibly removed in 12.4
|
||||
scall __sys_mremap 0x19bffffffffff019 globl hidden
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue