Add epoll and do more release readiness changes

This change also pays off some of the remaining technical debt with
stdio, file descriptors, and memory managemnt polyfills.
This commit is contained in:
Justine Tunney 2020-11-28 12:01:51 -08:00
parent a9ea949df8
commit 3e4fd4b0ad
271 changed files with 5706 additions and 1365 deletions

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_create$sysv 0xffffffffffff00d5 globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_create 0xffffffffffff00d5 globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_create1$sysv 0xffffffffffff0123 globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_create1 0xffffffffffff0123 globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_ctl$sysv 0xffffffffffff00e9 globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_ctl 0xffffffffffff00e9 globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_wait$sysv 0xffffffffffff00e8 globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall epoll_wait 0xffffffffffff00e8 globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall getdomainname 0xffff00a2ffffffff globl

View file

@ -35,17 +35,17 @@ syscon errno E2BIG 7 7 7 7 1639 # unix consensus & kNtErrorInvalid
syscon errno ENOEXEC 8 8 8 8 193 # unix consensus & kNtErrorBadExeFormat
syscon errno EBADF 9 9 9 9 6 # bad file descriptor; cf. EBADFD; unix consensus & kNtErrorInvalidHandle
syscon errno ECHILD 10 10 10 10 128 # unix consensus & kNtErrorWaitNoChildren
syscon errno EAGAIN 11 35 35 35 0x2733 # bsd consensus
syscon errno EWOULDBLOCK 11 35 35 35 0x2733 # bsd consensus
syscon errno EAGAIN 11 35 35 35 0x2733 # bsd consensus & WSAEWOULDBLOCK
syscon errno EWOULDBLOCK 11 35 35 35 0x2733 # bsd consensus & WSAEWOULDBLOCK
syscon errno ENOMEM 12 12 12 12 14 # unix consensus & kNtErrorOutofmemory
syscon errno EACCES 13 13 13 13 5 # unix consensus & kNtErrorAccessDenied
syscon errno EFAULT 14 14 14 14 487 # unix consensus & kNtErrorInvalidAddress
syscon errno ENOTBLK 15 15 15 15 26 # unix consensus & kNtErrorNotDosDisk
syscon errno EBUSY 16 16 16 16 170 # unix consensus & kNtErrorBusy
syscon errno EEXIST 17 17 17 17 183 # unix consensus & kNtErrorAlreadyExists (should be kNtErrorFileExists too)
syscon errno EXDEV 18 18 18 18 -1 # unix consensus
syscon errno EXDEV 18 18 18 18 17 # unix consensus & kNtErrorNotSameDevice
syscon errno ENODEV 19 19 19 19 1200 # unix consensus & kNtErrorBadDevice
syscon errno ENOTDIR 20 20 20 20 3 # unix consensus & kNtErrorPathNotFound
syscon errno ENOTDIR 20 20 20 20 3 # unix consensus & kNtErrorPathNotFound (TODO)
syscon errno EISDIR 21 21 21 21 267 # unix consensus & kNtErrorDirectoryNotSupported
syscon errno EINVAL 22 22 22 22 87 # unix consensus & kNtErrorInvalidParameter
syscon errno ENFILE 23 23 23 23 331 # unix consensus & kNtErrorTooManyDescriptors
@ -62,43 +62,43 @@ syscon errno EPIPE 32 32 32 32 109 # unix consensus & kNtErrorBrok
syscon errno EDOM 33 33 33 33 -1 # bsd consensus
syscon errno ERANGE 34 34 34 34 -1 # bsd consensus
syscon errno EDEADLK 35 11 11 11 1131 # bsd consensus & kNtErrorPossibleDeadlock
syscon errno ENAMETOOLONG 36 63 63 63 0x274f # bsd consensus
syscon errno ENAMETOOLONG 36 63 63 63 0x274f # bsd consensus & WSAENAMETOOLONG
syscon errno ENOLCK 37 77 77 77 -1 # bsd consensus
syscon errno ENOTEMPTY 39 66 66 66 0x2752 # bsd consensus
syscon errno ELOOP 40 62 62 62 0x274e # bsd consensus
syscon errno ENOTEMPTY 39 66 66 66 0x2752 # bsd consensus & WSAENOTEMPTY
syscon errno ELOOP 40 62 62 62 0x274e # bsd consensus & WSAELOOP
syscon errno ENOMSG 42 91 83 90 -1
syscon errno EIDRM 43 90 82 89 -1
syscon errno EUSERS 87 68 68 68 0x2754 # bsd consensus
syscon errno ENOTSOCK 88 38 38 38 0x2736 # bsd consensus
syscon errno EDESTADDRREQ 89 39 39 39 0x2737 # bsd consensus
syscon errno EUSERS 87 68 68 68 0x2754 # bsd consensus & WSAEUSERS
syscon errno ENOTSOCK 88 38 38 38 0x2736 # bsd consensus & WSAENOTSOCK
syscon errno EDESTADDRREQ 89 39 39 39 0x2737 # bsd consensus & WSAEDESTADDRREQ
syscon errno EMSGSIZE 90 40 40 40 0x2738 # bsd consensus & WSAEMSGSIZE
syscon errno EPROTOTYPE 91 41 41 41 0x2739 # bsd consensus
syscon errno ENOPROTOOPT 92 42 42 42 0x273a # bsd consensus
syscon errno EPROTONOSUPPORT 93 43 43 43 0x273b # bsd consensus
syscon errno ESOCKTNOSUPPORT 94 44 44 44 0x273c # bsd consensus
syscon errno EPROTOTYPE 91 41 41 41 0x2739 # bsd consensus & WSAEPROTOTYPE
syscon errno ENOPROTOOPT 92 42 42 42 0x273a # bsd consensus & WSAENOPROTOOPT
syscon errno EPROTONOSUPPORT 93 43 43 43 0x273b # bsd consensus & WSAEPROTONOSUPPORT
syscon errno ESOCKTNOSUPPORT 94 44 44 44 0x273c # bsd consensus & WSAESOCKTNOSUPPORT
syscon errno ENOTSUP 95 45 45 91 0x273d
syscon errno EOPNOTSUPP 95 102 45 45 0x273d
syscon errno EPFNOSUPPORT 96 46 46 46 0x273e # bsd consensus
syscon errno EAFNOSUPPORT 97 47 47 47 0x273f # bsd consensus
syscon errno EADDRINUSE 98 48 48 48 0x2740 # bsd consensus
syscon errno EADDRNOTAVAIL 99 49 49 49 0x2741 # bsd consensus
syscon errno ENETDOWN 100 50 50 50 0x2742 # bsd consensus
syscon errno ENETUNREACH 101 51 51 51 0x2743 # bsd consensus
syscon errno ENETRESET 102 52 52 52 0x2744 # bsd consensus
syscon errno ECONNABORTED 103 53 53 53 0x2745 # bsd consensus
syscon errno EPFNOSUPPORT 96 46 46 46 0x273e # bsd consensus & WSAEPFNOSUPPORT
syscon errno EAFNOSUPPORT 97 47 47 47 0x273f # bsd consensus & WSAEAFNOSUPPORT
syscon errno EADDRINUSE 98 48 48 48 0x2740 # bsd consensus & WSAEADDRINUSE
syscon errno EADDRNOTAVAIL 99 49 49 49 0x2741 # bsd consensus & WSAEADDRNOTAVAIL
syscon errno ENETDOWN 100 50 50 50 0x2742 # bsd consensus & WSAENETDOWN
syscon errno ENETUNREACH 101 51 51 51 0x2743 # bsd consensus & WSAENETUNREACH
syscon errno ENETRESET 102 52 52 52 0x2744 # bsd consensus & WSAENETRESET
syscon errno ECONNABORTED 103 53 53 53 0x2745 # bsd consensus & WSAECONNABORTED
syscon errno ECONNRESET 104 54 54 54 0x2746 # bsd consensus & WSAECONNRESET
syscon errno ENOBUFS 105 55 55 55 0x2747 # bsd consensus
syscon errno EISCONN 106 56 56 56 0x2748 # bsd consensus
syscon errno ENOTCONN 107 57 57 57 0x2749 # bsd consensus
syscon errno ESHUTDOWN 108 58 58 58 0x274a # bsd consensus
syscon errno ETOOMANYREFS 109 59 59 59 0x274b # bsd consensus
syscon errno ETIMEDOUT 110 60 60 60 0x274c # bsd consensus
syscon errno ECONNREFUSED 111 61 61 61 0x274d # bsd consensus
syscon errno EHOSTDOWN 112 64 64 64 0x2750 # bsd consensus
syscon errno EHOSTUNREACH 113 65 65 65 0x2751 # bsd consensus
syscon errno EALREADY 114 37 37 37 0x2735 # bsd consensus
syscon errno EINPROGRESS 115 36 36 36 0x2734 # bsd consensus
syscon errno ESTALE 116 70 70 70 0x2756 # bsd consensus
syscon errno ENOBUFS 105 55 55 55 0x2747 # bsd consensus & WSAENOBUFS
syscon errno EISCONN 106 56 56 56 0x2748 # bsd consensus & WSAEISCONN
syscon errno ENOTCONN 107 57 57 57 0x2749 # bsd consensus & WSAENOTCONN
syscon errno ESHUTDOWN 108 58 58 58 0x274a # bsd consensus & WSAESHUTDOWN
syscon errno ETOOMANYREFS 109 59 59 59 0x274b # bsd consensus & WSAETOOMANYREFS
syscon errno ETIMEDOUT 110 60 60 60 0x274c # bsd consensus & WSAETIMEDOUT
syscon errno ECONNREFUSED 111 61 61 61 0x274d # bsd consensus & WSAECONNREFUSED
syscon errno EHOSTDOWN 112 64 64 64 0x2750 # bsd consensus & WSAEHOSTDOWN
syscon errno EHOSTUNREACH 113 65 65 65 0x2751 # bsd consensus & WSAEHOSTUNREACH
syscon errno EALREADY 114 37 37 37 0x2735 # bsd consensus & WSAEALREADY
syscon errno EINPROGRESS 115 36 36 36 0x2734 # bsd consensus & WSAEINPROGRESS
syscon errno ESTALE 116 70 70 70 0x2756 # bsd consensus & WSAESTALE
syscon errno ECHRNG 44 -1 -1 -1 -1 # bsd consensus
syscon errno EL2NSYNC 45 -1 -1 -1 -1 # bsd consensus
syscon errno EL3HLT 46 -1 -1 -1 -1 # bsd consensus
@ -220,7 +220,7 @@ syscon open O_CLOEXEC 0x080000 0x01000000 0x100000 0x010000 0x00080000 #
syscon open O_TMPFILE 0x410000 0 0 0 0x04000100 # Linux 3.11+ (c. 2013) & kNtFileAttributeTemporary|kNtFileFlagDeleteOnClose
syscon open O_SPARSE 0 0 0 0 0x00040000 # we invented it
syscon open O_NDELAY 0x0800 4 4 4 0 # bsd consensus & kNtFileFlagWriteThrough>>8 → 0x00800000 (???)
syscon open O_NONBLOCK 0x0800 4 4 4 0 # bsd consensus
syscon open O_NONBLOCK 0x0800 4 4 4 0x00000800 # bsd consensus & faked on nt to be same as linux
syscon open O_ASYNC 0x2000 0x40 0x40 0x40 0 # bsd consensus
syscon open O_NOFOLLOW 0x020000 0x0100 0x0100 0x0100 0 # bsd consensus
syscon open O_SYNC 0x101000 0x80 0x80 0x80 0 # bsd consensus
@ -388,10 +388,10 @@ syscon fcntl2 F_DUPFD 0 0 0 0 0 # consensus
syscon fcntl2 F_GETFD 1 1 1 1 1 # unix consensus & faked nt
syscon fcntl2 F_SETFD 2 2 2 2 2 # unix consensus & faked nt
syscon fcntl3 FD_CLOEXEC 1 1 1 1 1 # unix consensus & inverse nt (kNtHandleFlagInherit)
syscon fcntl3 FD_CLOEXEC 1 1 1 1 1 # unix consensus & faked nt
syscon fcntl2 F_GETFL 3 3 3 3 3 # unix consensus & faked nt
syscon fcntl2 F_SETFL 4 4 4 4 4 # (unix consensus & faked nt)
syscon fcntl2 F_SETFL 4 4 4 4 4 # unix consensus & faked nt
# fcntl3 O_NONBLOCK
# fcntl3 O_APPEND
# fcntl3 O_ASYNC
@ -498,25 +498,28 @@ syscon clock CLOCK_REALTIME_ALARM 8 -1 0 0 0 # bsd consensus
syscon clock CLOCK_BOOTTIME_ALARM 9 -1 0 0 0 # bsd consensus
syscon clock CLOCK_TAI 11 -1 0 0 0 # bsd consensus
syscon epoll EPOLLIN 1 0 0 0 0
syscon epoll EPOLL_CTL_ADD 1 0 0 0 0
syscon epoll EPOLLPRI 2 0 0 0 0
syscon epoll EPOLL_CTL_DEL 2 0 0 0 0
syscon epoll EPOLL_CTL_MOD 3 0 0 0 0
syscon epoll EPOLLOUT 4 0 0 0 0
syscon epoll EPOLLERR 8 0 0 0 0
syscon epoll EPOLLHUP 0x10 0 0 0 0
syscon epoll EPOLLRDNORM 0x40 0 0 0 0
syscon epoll EPOLLRDBAND 0x80 0 0 0 0
syscon epoll EPOLLWRNORM 0x0100 0 0 0 0
syscon epoll EPOLLWRBAND 0x0200 0 0 0 0
syscon epoll EPOLLMSG 0x0400 0 0 0 0
syscon epoll EPOLLRDHUP 0x2000 0 0 0 0
syscon epoll EPOLL_CLOEXEC 0x080000 0 0 0 0
syscon epoll EPOLLEXCLUSIVE 0x10000000 0 0 0 0
syscon epoll EPOLLWAKEUP 0x20000000 0 0 0 0
syscon epoll EPOLLONESHOT 0x40000000 0 0 0 0
syscon epoll EPOLLET 0x80000000 0 0 0 0
# epoll
#
# group name GNU/Systemd XNU's Not UNIX FreeBSD OpenBSD XENIX Commentary
syscon epoll EPOLL_CLOEXEC 0x080000 0x01000000 0x100000 0x010000 0x80000 # O_CLOEXEC
syscon epoll EPOLL_CTL_ADD 1 1 1 1 1 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLL_CTL_DEL 2 2 2 2 2 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLL_CTL_MOD 3 3 3 3 3 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLIN 1 1 1 1 1 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLOUT 4 4 4 4 4 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLERR 8 8 8 8 8 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLPRI 2 2 2 2 2 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLHUP 0x10 0x10 0x10 0x10 0x10 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLRDNORM 0x40 0x40 0x40 0x40 0x40 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLRDBAND 0x80 0x80 0x80 0x80 0x80 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLWRNORM 0x0100 0x0100 0x0100 0x0100 0x0100 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLWRBAND 0x0200 0x0200 0x0200 0x0200 0x0200 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLMSG 0x0400 0x0400 0x0400 0x0400 0x0400 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLRDHUP 0x2000 0x2000 0x2000 0x2000 0x2000 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLEXCLUSIVE 0x10000000 0x10000000 0x10000000 0x10000000 0x10000000 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLWAKEUP 0x20000000 0x20000000 0x20000000 0x20000000 0x20000000 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLONESHOT 0x40000000 0x40000000 0x40000000 0x40000000 0x40000000 # forced consensus, linux only natively, polyfilled elsewhere
syscon epoll EPOLLET 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 # forced consensus, linux only natively, polyfilled elsewhere
# {set,get}sockopt(fd, level=SOL_SOCKET, X, ...)
#
@ -1646,8 +1649,8 @@ syscon sock SOCK_DGRAM 2 2 2 2 2 # consensus
syscon sock SOCK_RAW 3 3 3 3 3 # consensus
syscon sock SOCK_RDM 4 4 4 4 4 # consensus
syscon sock SOCK_SEQPACKET 5 5 5 5 5 # consensus
syscon sock SOCK_CLOEXEC 0x080000 0x080000 0x10000000 0x8000 0x80 # faked xnu & WSA_FLAG_NO_HANDLE_INHERIT
syscon sock SOCK_NONBLOCK 0x0800 0x0800 0x20000000 0x4000 0x0800 # faked xnu; faked nt; socket() will ioctl(FIONBIO=1)
syscon sock SOCK_CLOEXEC 0x080000 0x080000 0x10000000 0x8000 0x00080000 # faked xnu & faked nt to be some as O_CLOEXEC
syscon sock SOCK_NONBLOCK 0x0800 0x0800 0x20000000 0x4000 0x00000800 # faked xnu & faked nt to be same as O_NONBLOC and socket() will ioctl(FIONBIO=1)
syscon sock SOCK_DCCP 6 0 0 0 0 # what is it?
syscon sock SOCK_PACKET 10 0 0 0 0 # what is it?

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLERR 8 0 0 0 0
.syscon epoll EPOLLERR 8 8 8 8 8

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLET 0x80000000 0 0 0 0
.syscon epoll EPOLLET 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLEXCLUSIVE 0x10000000 0 0 0 0
.syscon epoll EPOLLEXCLUSIVE 0x10000000 0x10000000 0x10000000 0x10000000 0x10000000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLHUP 0x10 0 0 0 0
.syscon epoll EPOLLHUP 0x10 0x10 0x10 0x10 0x10

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLIN 1 0 0 0 0
.syscon epoll EPOLLIN 1 1 1 1 1

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLMSG 0x0400 0 0 0 0
.syscon epoll EPOLLMSG 0x0400 0x0400 0x0400 0x0400 0x0400

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLONESHOT 0x40000000 0 0 0 0
.syscon epoll EPOLLONESHOT 0x40000000 0x40000000 0x40000000 0x40000000 0x40000000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLOUT 4 0 0 0 0
.syscon epoll EPOLLOUT 4 4 4 4 4

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLPRI 2 0 0 0 0
.syscon epoll EPOLLPRI 2 2 2 2 2

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLRDBAND 0x80 0 0 0 0
.syscon epoll EPOLLRDBAND 0x80 0x80 0x80 0x80 0x80

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLRDHUP 0x2000 0 0 0 0
.syscon epoll EPOLLRDHUP 0x2000 0x2000 0x2000 0x2000 0x2000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLRDNORM 0x40 0 0 0 0
.syscon epoll EPOLLRDNORM 0x40 0x40 0x40 0x40 0x40

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLWAKEUP 0x20000000 0 0 0 0
.syscon epoll EPOLLWAKEUP 0x20000000 0x20000000 0x20000000 0x20000000 0x20000000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLWRBAND 0x0200 0 0 0 0
.syscon epoll EPOLLWRBAND 0x0200 0x0200 0x0200 0x0200 0x0200

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLLWRNORM 0x0100 0 0 0 0
.syscon epoll EPOLLWRNORM 0x0100 0x0100 0x0100 0x0100 0x0100

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLL_CLOEXEC 0x080000 0 0 0 0
.syscon epoll EPOLL_CLOEXEC 0x080000 0x01000000 0x100000 0x010000 0x80000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLL_CTL_ADD 1 0 0 0 0
.syscon epoll EPOLL_CTL_ADD 1 1 1 1 1

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLL_CTL_DEL 2 0 0 0 0
.syscon epoll EPOLL_CTL_DEL 2 2 2 2 2

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon epoll EPOLL_CTL_MOD 3 0 0 0 0
.syscon epoll EPOLL_CTL_MOD 3 3 3 3 3

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon errno EXDEV 18 18 18 18 -1
.syscon errno EXDEV 18 18 18 18 17

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon open O_NONBLOCK 0x0800 4 4 4 0
.syscon open O_NONBLOCK 0x0800 4 4 4 0x00000800

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon sock SOCK_CLOEXEC 0x080000 0x080000 0x10000000 0x8000 0x80
.syscon sock SOCK_CLOEXEC 0x080000 0x080000 0x10000000 0x8000 0x00080000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon sock SOCK_NONBLOCK 0x0800 0x0800 0x20000000 0x4000 0x0800
.syscon sock SOCK_NONBLOCK 0x0800 0x0800 0x20000000 0x4000 0x00000800

View file

@ -1,87 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS__POSIX_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS__POSIX_H_
#include "libc/runtime/symbolic.h"
#define _POSIX_ADVISORY_INFO SYMBOLIC(_POSIX_ADVISORY_INFO)
#define _POSIX_AIO_LISTIO_MAX SYMBOLIC(_POSIX_AIO_LISTIO_MAX)
#define _POSIX_AIO_MAX SYMBOLIC(_POSIX_AIO_MAX)
#define _POSIX_ARG_MAX SYMBOLIC(_POSIX_ARG_MAX)
#define _POSIX_ASYNCHRONOUS_IO SYMBOLIC(_POSIX_ASYNCHRONOUS_IO)
#define _POSIX_BARRIERS SYMBOLIC(_POSIX_BARRIERS)
#define _POSIX_CHILD_MAX SYMBOLIC(_POSIX_CHILD_MAX)
#define _POSIX_CHOWN_RESTRICTED SYMBOLIC(_POSIX_CHOWN_RESTRICTED)
#define _POSIX_CLOCKRES_MIN SYMBOLIC(_POSIX_CLOCKRES_MIN)
#define _POSIX_CLOCK_SELECTION SYMBOLIC(_POSIX_CLOCK_SELECTION)
#define _POSIX_CPUTIME SYMBOLIC(_POSIX_CPUTIME)
#define _POSIX_DELAYTIMER_MAX SYMBOLIC(_POSIX_DELAYTIMER_MAX)
#define _POSIX_FSYNC SYMBOLIC(_POSIX_FSYNC)
#define _POSIX_HOST_NAME_MAX SYMBOLIC(_POSIX_HOST_NAME_MAX)
#define _POSIX_IPV6 SYMBOLIC(_POSIX_IPV6)
#define _POSIX_JOB_CONTROL SYMBOLIC(_POSIX_JOB_CONTROL)
#define _POSIX_LINK_MAX SYMBOLIC(_POSIX_LINK_MAX)
#define _POSIX_LOGIN_NAME_MAX SYMBOLIC(_POSIX_LOGIN_NAME_MAX)
#define _POSIX_MAPPED_FILES SYMBOLIC(_POSIX_MAPPED_FILES)
#define _POSIX_MAX_CANON SYMBOLIC(_POSIX_MAX_CANON)
#define _POSIX_MAX_INPUT SYMBOLIC(_POSIX_MAX_INPUT)
#define _POSIX_MEMLOCK SYMBOLIC(_POSIX_MEMLOCK)
#define _POSIX_MEMLOCK_RANGE SYMBOLIC(_POSIX_MEMLOCK_RANGE)
#define _POSIX_MEMORY_PROTECTION SYMBOLIC(_POSIX_MEMORY_PROTECTION)
#define _POSIX_MESSAGE_PASSING SYMBOLIC(_POSIX_MESSAGE_PASSING)
#define _POSIX_MONOTONIC_CLOCK SYMBOLIC(_POSIX_MONOTONIC_CLOCK)
#define _POSIX_MQ_OPEN_MAX SYMBOLIC(_POSIX_MQ_OPEN_MAX)
#define _POSIX_MQ_PRIO_MAX SYMBOLIC(_POSIX_MQ_PRIO_MAX)
#define _POSIX_NAME_MAX SYMBOLIC(_POSIX_NAME_MAX)
#define _POSIX_NGROUPS_MAX SYMBOLIC(_POSIX_NGROUPS_MAX)
#define _POSIX_NO_TRUNC SYMBOLIC(_POSIX_NO_TRUNC)
#define _POSIX_OPEN_MAX SYMBOLIC(_POSIX_OPEN_MAX)
#define _POSIX_PATH_MAX SYMBOLIC(_POSIX_PATH_MAX)
#define _POSIX_PIPE_BUF SYMBOLIC(_POSIX_PIPE_BUF)
#define _POSIX_RAW_SOCKETS SYMBOLIC(_POSIX_RAW_SOCKETS)
#define _POSIX_READER_WRITER_LOCKS SYMBOLIC(_POSIX_READER_WRITER_LOCKS)
#define _POSIX_REALTIME_SIGNALS SYMBOLIC(_POSIX_REALTIME_SIGNALS)
#define _POSIX_REGEXP SYMBOLIC(_POSIX_REGEXP)
#define _POSIX_RE_DUP_MAX SYMBOLIC(_POSIX_RE_DUP_MAX)
#define _POSIX_RTSIG_MAX SYMBOLIC(_POSIX_RTSIG_MAX)
#define _POSIX_SAVED_IDS SYMBOLIC(_POSIX_SAVED_IDS)
#define _POSIX_SEMAPHORES SYMBOLIC(_POSIX_SEMAPHORES)
#define _POSIX_SEM_NSEMS_MAX SYMBOLIC(_POSIX_SEM_NSEMS_MAX)
#define _POSIX_SEM_VALUE_MAX SYMBOLIC(_POSIX_SEM_VALUE_MAX)
#define _POSIX_SHARED_MEMORY_OBJECTS SYMBOLIC(_POSIX_SHARED_MEMORY_OBJECTS)
#define _POSIX_SHELL SYMBOLIC(_POSIX_SHELL)
#define _POSIX_SIGQUEUE_MAX SYMBOLIC(_POSIX_SIGQUEUE_MAX)
#define _POSIX_SPAWN SYMBOLIC(_POSIX_SPAWN)
#define _POSIX_SPIN_LOCKS SYMBOLIC(_POSIX_SPIN_LOCKS)
#define _POSIX_SSIZE_MAX SYMBOLIC(_POSIX_SSIZE_MAX)
#define _POSIX_SS_REPL_MAX SYMBOLIC(_POSIX_SS_REPL_MAX)
#define _POSIX_STREAM_MAX SYMBOLIC(_POSIX_STREAM_MAX)
#define _POSIX_SYMLINK_MAX SYMBOLIC(_POSIX_SYMLINK_MAX)
#define _POSIX_SYMLOOP_MAX SYMBOLIC(_POSIX_SYMLOOP_MAX)
#define _POSIX_THREADS SYMBOLIC(_POSIX_THREADS)
#define _POSIX_THREAD_ATTR_STACKADDR SYMBOLIC(_POSIX_THREAD_ATTR_STACKADDR)
#define _POSIX_THREAD_ATTR_STACKSIZE SYMBOLIC(_POSIX_THREAD_ATTR_STACKSIZE)
#define _POSIX_THREAD_CPUTIME SYMBOLIC(_POSIX_THREAD_CPUTIME)
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS \
SYMBOLIC(_POSIX_THREAD_DESTRUCTOR_ITERATIONS)
#define _POSIX_THREAD_KEYS_MAX SYMBOLIC(_POSIX_THREAD_KEYS_MAX)
#define _POSIX_THREAD_PRIORITY_SCHEDULING \
SYMBOLIC(_POSIX_THREAD_PRIORITY_SCHEDULING)
#define _POSIX_THREAD_PROCESS_SHARED SYMBOLIC(_POSIX_THREAD_PROCESS_SHARED)
#define _POSIX_THREAD_SAFE_FUNCTIONS SYMBOLIC(_POSIX_THREAD_SAFE_FUNCTIONS)
#define _POSIX_THREAD_THREADS_MAX SYMBOLIC(_POSIX_THREAD_THREADS_MAX)
#define _POSIX_TIMEOUTS SYMBOLIC(_POSIX_TIMEOUTS)
#define _POSIX_TIMERS SYMBOLIC(_POSIX_TIMERS)
#define _POSIX_TIMER_MAX SYMBOLIC(_POSIX_TIMER_MAX)
#define _POSIX_TRACE_EVENT_NAME_MAX SYMBOLIC(_POSIX_TRACE_EVENT_NAME_MAX)
#define _POSIX_TRACE_NAME_MAX SYMBOLIC(_POSIX_TRACE_NAME_MAX)
#define _POSIX_TRACE_SYS_MAX SYMBOLIC(_POSIX_TRACE_SYS_MAX)
#define _POSIX_TRACE_USER_EVENT_MAX SYMBOLIC(_POSIX_TRACE_USER_EVENT_MAX)
#define _POSIX_TTY_NAME_MAX SYMBOLIC(_POSIX_TTY_NAME_MAX)
#define _POSIX_TZNAME_MAX SYMBOLIC(_POSIX_TZNAME_MAX)
#define _POSIX_V6_LP64_OFF64 SYMBOLIC(_POSIX_V6_LP64_OFF64)
#define _POSIX_V7_LP64_OFF64 SYMBOLIC(_POSIX_V7_LP64_OFF64)
#define _POSIX_VDISABLE SYMBOLIC(_POSIX_VDISABLE)
#define _POSIX_VERSION SYMBOLIC(_POSIX_VERSION)
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -165,4 +84,85 @@ hidden extern const long _POSIX_VERSION;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define _POSIX_ADVISORY_INFO SYMBOLIC(_POSIX_ADVISORY_INFO)
#define _POSIX_AIO_LISTIO_MAX SYMBOLIC(_POSIX_AIO_LISTIO_MAX)
#define _POSIX_AIO_MAX SYMBOLIC(_POSIX_AIO_MAX)
#define _POSIX_ARG_MAX SYMBOLIC(_POSIX_ARG_MAX)
#define _POSIX_ASYNCHRONOUS_IO SYMBOLIC(_POSIX_ASYNCHRONOUS_IO)
#define _POSIX_BARRIERS SYMBOLIC(_POSIX_BARRIERS)
#define _POSIX_CHILD_MAX SYMBOLIC(_POSIX_CHILD_MAX)
#define _POSIX_CHOWN_RESTRICTED SYMBOLIC(_POSIX_CHOWN_RESTRICTED)
#define _POSIX_CLOCKRES_MIN SYMBOLIC(_POSIX_CLOCKRES_MIN)
#define _POSIX_CLOCK_SELECTION SYMBOLIC(_POSIX_CLOCK_SELECTION)
#define _POSIX_CPUTIME SYMBOLIC(_POSIX_CPUTIME)
#define _POSIX_DELAYTIMER_MAX SYMBOLIC(_POSIX_DELAYTIMER_MAX)
#define _POSIX_FSYNC SYMBOLIC(_POSIX_FSYNC)
#define _POSIX_HOST_NAME_MAX SYMBOLIC(_POSIX_HOST_NAME_MAX)
#define _POSIX_IPV6 SYMBOLIC(_POSIX_IPV6)
#define _POSIX_JOB_CONTROL SYMBOLIC(_POSIX_JOB_CONTROL)
#define _POSIX_LINK_MAX SYMBOLIC(_POSIX_LINK_MAX)
#define _POSIX_LOGIN_NAME_MAX SYMBOLIC(_POSIX_LOGIN_NAME_MAX)
#define _POSIX_MAPPED_FILES SYMBOLIC(_POSIX_MAPPED_FILES)
#define _POSIX_MAX_CANON SYMBOLIC(_POSIX_MAX_CANON)
#define _POSIX_MAX_INPUT SYMBOLIC(_POSIX_MAX_INPUT)
#define _POSIX_MEMLOCK SYMBOLIC(_POSIX_MEMLOCK)
#define _POSIX_MEMLOCK_RANGE SYMBOLIC(_POSIX_MEMLOCK_RANGE)
#define _POSIX_MEMORY_PROTECTION SYMBOLIC(_POSIX_MEMORY_PROTECTION)
#define _POSIX_MESSAGE_PASSING SYMBOLIC(_POSIX_MESSAGE_PASSING)
#define _POSIX_MONOTONIC_CLOCK SYMBOLIC(_POSIX_MONOTONIC_CLOCK)
#define _POSIX_MQ_OPEN_MAX SYMBOLIC(_POSIX_MQ_OPEN_MAX)
#define _POSIX_MQ_PRIO_MAX SYMBOLIC(_POSIX_MQ_PRIO_MAX)
#define _POSIX_NAME_MAX SYMBOLIC(_POSIX_NAME_MAX)
#define _POSIX_NGROUPS_MAX SYMBOLIC(_POSIX_NGROUPS_MAX)
#define _POSIX_NO_TRUNC SYMBOLIC(_POSIX_NO_TRUNC)
#define _POSIX_OPEN_MAX SYMBOLIC(_POSIX_OPEN_MAX)
#define _POSIX_PATH_MAX SYMBOLIC(_POSIX_PATH_MAX)
#define _POSIX_PIPE_BUF SYMBOLIC(_POSIX_PIPE_BUF)
#define _POSIX_RAW_SOCKETS SYMBOLIC(_POSIX_RAW_SOCKETS)
#define _POSIX_READER_WRITER_LOCKS SYMBOLIC(_POSIX_READER_WRITER_LOCKS)
#define _POSIX_REALTIME_SIGNALS SYMBOLIC(_POSIX_REALTIME_SIGNALS)
#define _POSIX_REGEXP SYMBOLIC(_POSIX_REGEXP)
#define _POSIX_RE_DUP_MAX SYMBOLIC(_POSIX_RE_DUP_MAX)
#define _POSIX_RTSIG_MAX SYMBOLIC(_POSIX_RTSIG_MAX)
#define _POSIX_SAVED_IDS SYMBOLIC(_POSIX_SAVED_IDS)
#define _POSIX_SEMAPHORES SYMBOLIC(_POSIX_SEMAPHORES)
#define _POSIX_SEM_NSEMS_MAX SYMBOLIC(_POSIX_SEM_NSEMS_MAX)
#define _POSIX_SEM_VALUE_MAX SYMBOLIC(_POSIX_SEM_VALUE_MAX)
#define _POSIX_SHARED_MEMORY_OBJECTS SYMBOLIC(_POSIX_SHARED_MEMORY_OBJECTS)
#define _POSIX_SHELL SYMBOLIC(_POSIX_SHELL)
#define _POSIX_SIGQUEUE_MAX SYMBOLIC(_POSIX_SIGQUEUE_MAX)
#define _POSIX_SPAWN SYMBOLIC(_POSIX_SPAWN)
#define _POSIX_SPIN_LOCKS SYMBOLIC(_POSIX_SPIN_LOCKS)
#define _POSIX_SSIZE_MAX SYMBOLIC(_POSIX_SSIZE_MAX)
#define _POSIX_SS_REPL_MAX SYMBOLIC(_POSIX_SS_REPL_MAX)
#define _POSIX_STREAM_MAX SYMBOLIC(_POSIX_STREAM_MAX)
#define _POSIX_SYMLINK_MAX SYMBOLIC(_POSIX_SYMLINK_MAX)
#define _POSIX_SYMLOOP_MAX SYMBOLIC(_POSIX_SYMLOOP_MAX)
#define _POSIX_THREADS SYMBOLIC(_POSIX_THREADS)
#define _POSIX_THREAD_ATTR_STACKADDR SYMBOLIC(_POSIX_THREAD_ATTR_STACKADDR)
#define _POSIX_THREAD_ATTR_STACKSIZE SYMBOLIC(_POSIX_THREAD_ATTR_STACKSIZE)
#define _POSIX_THREAD_CPUTIME SYMBOLIC(_POSIX_THREAD_CPUTIME)
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS \
SYMBOLIC(_POSIX_THREAD_DESTRUCTOR_ITERATIONS)
#define _POSIX_THREAD_KEYS_MAX SYMBOLIC(_POSIX_THREAD_KEYS_MAX)
#define _POSIX_THREAD_PRIORITY_SCHEDULING \
SYMBOLIC(_POSIX_THREAD_PRIORITY_SCHEDULING)
#define _POSIX_THREAD_PROCESS_SHARED SYMBOLIC(_POSIX_THREAD_PROCESS_SHARED)
#define _POSIX_THREAD_SAFE_FUNCTIONS SYMBOLIC(_POSIX_THREAD_SAFE_FUNCTIONS)
#define _POSIX_THREAD_THREADS_MAX SYMBOLIC(_POSIX_THREAD_THREADS_MAX)
#define _POSIX_TIMEOUTS SYMBOLIC(_POSIX_TIMEOUTS)
#define _POSIX_TIMERS SYMBOLIC(_POSIX_TIMERS)
#define _POSIX_TIMER_MAX SYMBOLIC(_POSIX_TIMER_MAX)
#define _POSIX_TRACE_EVENT_NAME_MAX SYMBOLIC(_POSIX_TRACE_EVENT_NAME_MAX)
#define _POSIX_TRACE_NAME_MAX SYMBOLIC(_POSIX_TRACE_NAME_MAX)
#define _POSIX_TRACE_SYS_MAX SYMBOLIC(_POSIX_TRACE_SYS_MAX)
#define _POSIX_TRACE_USER_EVENT_MAX SYMBOLIC(_POSIX_TRACE_USER_EVENT_MAX)
#define _POSIX_TTY_NAME_MAX SYMBOLIC(_POSIX_TTY_NAME_MAX)
#define _POSIX_TZNAME_MAX SYMBOLIC(_POSIX_TZNAME_MAX)
#define _POSIX_V6_LP64_OFF64 SYMBOLIC(_POSIX_V6_LP64_OFF64)
#define _POSIX_V7_LP64_OFF64 SYMBOLIC(_POSIX_V7_LP64_OFF64)
#define _POSIX_VDISABLE SYMBOLIC(_POSIX_VDISABLE)
#define _POSIX_VERSION SYMBOLIC(_POSIX_VERSION)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS__POSIX_H_ */

55
libc/sysv/consts/epoll.h Normal file
View file

@ -0,0 +1,55 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_EPOLL_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_EPOLL_H_
#include "libc/runtime/symbolic.h"
#include "libc/sysv/consts/o.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
hidden extern const long EPOLL_CLOEXEC;
hidden extern const long EPOLL_CTL_ADD;
hidden extern const long EPOLL_CTL_DEL;
hidden extern const long EPOLL_CTL_MOD;
hidden extern const long EPOLLIN;
hidden extern const long EPOLLPRI;
hidden extern const long EPOLLOUT;
hidden extern const long EPOLLERR;
hidden extern const long EPOLLHUP;
hidden extern const long EPOLLRDNORM;
hidden extern const long EPOLLRDBAND;
hidden extern const long EPOLLWRNORM;
hidden extern const long EPOLLWRBAND;
hidden extern const long EPOLLMSG;
hidden extern const long EPOLLRDHUP;
hidden extern const long EPOLLEXCLUSIVE;
hidden extern const long EPOLLWAKEUP;
hidden extern const long EPOLLONESHOT;
hidden extern const long EPOLLET;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define EPOLL_CLOEXEC O_CLOEXEC
#define EPOLL_CTL_ADD LITERALLY(1)
#define EPOLL_CTL_DEL LITERALLY(2)
#define EPOLL_CTL_MOD LITERALLY(3)
#define EPOLLIN LITERALLY(1)
#define EPOLLPRI LITERALLY(2)
#define EPOLLOUT LITERALLY(4)
#define EPOLLERR LITERALLY(8)
#define EPOLLHUP LITERALLY(0x10)
#define EPOLLRDNORM LITERALLY(0x40)
#define EPOLLRDBAND LITERALLY(0x80)
#define EPOLLWRNORM LITERALLY(0x0100)
#define EPOLLWRBAND LITERALLY(0x0200)
#define EPOLLMSG LITERALLY(0x0400)
#define EPOLLRDHUP LITERALLY(0x2000)
#define EPOLLEXCLUSIVE LITERALLY(0x10000000)
#define EPOLLWAKEUP LITERALLY(0x20000000)
#define EPOLLONESHOT LITERALLY(0x40000000)
#define EPOLLET LITERALLY(0x80000000)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_EPOLL_H_ */

View file

@ -240,9 +240,9 @@ scall io_getevents 0xffffffffffff00d0 globl
scall io_submit 0xffffffffffff00d1 globl
scall io_cancel 0xffffffffffff00d2 globl
scall lookup_dcookie 0xffffffffffff00d4 globl
scall epoll_create 0xffffffffffff00d5 globl
scall epoll_wait 0xffffffffffff00e8 globl
scall epoll_ctl 0xffffffffffff00e9 globl
scall 'epoll_create$sysv' 0xffffffffffff00d5 globl
scall 'epoll_wait$sysv' 0xffffffffffff00e8 globl
scall 'epoll_ctl$sysv' 0xffffffffffff00e9 globl
scall getdents 0x00630110ffff00d9 globl hidden # getdents64 on linux
scall set_tid_address 0xffffffffffff00da globl
scall restart_syscall 0xffffffffffff00db globl
@ -310,7 +310,7 @@ scall '__accept4$sysv' 0x005d021dffff0120 globl hidden # Linux 2.6.28+
scall '__dup3$sysv' 0x0066ffffffff0124 globl hidden # Linux 2.6.27+
scall '__pipe2$sysv' 0x0065021effff0125 globl hidden # Linux 2.6.27+
scall epoll_pwait 0xffffffffffff0119 globl
scall epoll_create1 0xffffffffffff0123 globl
scall 'epoll_create1$sysv' 0xffffffffffff0123 globl
scall perf_event_open 0xffffffffffff012a globl
scall inotify_init1 0xffffffffffff0126 globl
scall rt_tgsigqueueinfo 0xffffffffffff0129 globl