Add more missing libc functionality

This commit is contained in:
Justine Tunney 2022-08-06 09:56:17 -07:00
parent cf93ecbbb2
commit a8cf0f7e89
74 changed files with 6981 additions and 105 deletions

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall pselect,0x1b406e20a218a10e,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_pselect,0x1b406e20a218a10e,globl,hidden

View file

@ -414,7 +414,7 @@ syscon at AT_FDCWD -100 -2 -100 -100 -100 -100 # faked nt
syscon at AT_SYMLINK_NOFOLLOW 0x0100 0x20 0x0200 2 0x200 0x0100 # faked nt
syscon at AT_SYMLINK_FOLLOW 0x0400 0x40 0x0400 4 0x400 0 # see linkat(2)
syscon at AT_REMOVEDIR 0x0200 0x80 0x0800 8 0x800 0x0200 # faked nt
syscon at AT_EACCESS 0x0200 0x10 0x0100 1 0x100 0
syscon at AT_EACCESS 0x0200 0x10 0x0100 1 0x100 0 # performs check using effective uid/gid; unnecessary nt
syscon at AT_EMPTY_PATH 0x1000 0 0 0 0 0 # linux 2.6.39+; see unlink, O_TMPFILE, etc.
# memfd_create() flags
@ -1531,7 +1531,6 @@ syscon termios VERIFY 47 0 0 0 0 0
syscon termios CIBAUD 0x100f0000 0 0 0 0 0
syscon termios CMSPAR 0x40000000 0 0 0 0 0
syscon termios BUSY 4 0 0 0 0 0
syscon termios CANBSIZ 255 0 0 0 0 0
syscon termios CBAUD 0x100f 0 0 0 0 0
syscon termios CBAUDEX 0x1000 0 0 0 0 0
syscon termios EXTA 14 0x4b00 0x4b00 0x4b00 0x4b00 0 # bsd consensus
@ -1743,8 +1742,6 @@ syscon misc EFD_CLOEXEC 0x080000 0 0 0 0 0
syscon misc EFD_NONBLOCK 0x0800 0 0 0 0 0
syscon misc EFD_SEMAPHORE 1 0 0 0 0 0
syscon misc IPPORT_RESERVED 0x0400 0x0400 0x0400 0x0400 0x0400 0x0400 # consensus
syscon misc SYNC_FILE_RANGE_WAIT_AFTER 4 0 0 0 0 0
syscon misc SYNC_FILE_RANGE_WAIT_BEFORE 1 0 0 0 0 0
syscon misc SYNC_FILE_RANGE_WRITE 2 0 0 0 0 0

View file

@ -0,0 +1,9 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_ENDIAN_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_ENDIAN_H_
#define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
#define __PDP_ENDIAN __ORDER_PDP_ENDIAN__
#define __BYTE_ORDER __BYTE_ORDER__
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_ENDIAN_H_ */

View file

@ -4,42 +4,50 @@
#define LOG_MASK(pri) (1 << (pri))
#define LOG_UPTO(pri) ((1 << ((pri) + 1)) - 1)
#define LOG_EMERG 0
#define LOG_KERN 0
#define LOG_ALERT 1
#define LOG_PID 1
#define LOG_CONS 2
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_ODELAY 4
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
#define LOG_PRIMASK 7
#define LOG_NDELAY 8
#define LOG_USER 8
#define LOG_MAIL 16
#define LOG_NOWAIT 16
#define LOG_DAEMON 24
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
#define LOG_KERN 0000
#define LOG_USER 0010
#define LOG_MAIL 0020
#define LOG_DAEMON 0030
#define LOG_AUTH 0040
#define LOG_SYSLOG 0050
#define LOG_LPR 0060
#define LOG_NEWS 0070
#define LOG_UUCP 0100
#define LOG_CRON 0110
#define LOG_AUTHPRIV 0120
#define LOG_FTP 0130
#define LOG_PID 1
#define LOG_CONS 2
#define LOG_ODELAY 4
#define LOG_NDELAY 8
#define LOG_NOWAIT 16
#define LOG_PERROR 32
#define LOG_LOCAL0 128
#define LOG_LOCAL1 136
#define LOG_LOCAL2 144
#define LOG_LOCAL3 152
#define LOG_LOCAL4 160
#define LOG_LOCAL5 168
#define LOG_LOCAL6 176
#define LOG_LOCAL7 184
#define LOG_NFACILITIES 24
#define LOG_AUTH 32
#define LOG_PERROR 32
#define LOG_SYSLOG 40
#define LOG_LPR 48
#define LOG_NEWS 56
#define LOG_UUCP 64
#define LOG_CRON 72
#define LOG_SELECT 76
#define LOG_SENSE 77
#define LOG_LOCAL0 128
#define LOG_LOCAL1 136
#define LOG_LOCAL2 144
#define LOG_LOCAL3 152
#define LOG_LOCAL4 160
#define LOG_LOCAL5 168
#define LOG_LOCAL6 176
#define LOG_LOCAL7 184
#define LOG_FACMASK 0x03f8
#define LOG_FAC(p) ((LOG_FACMASK & (p)) >> 3)
#define LOG_PRIMASK 7
#define LOG_PRI(p) (LOG_PRIMASK & (p))
#define LOG_MAKEPRI(f, p) (((f) << 3) | (p))
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOG_H_ */

View file

@ -10,7 +10,6 @@ extern const uint32_t BS1;
extern const uint32_t BS2;
extern const uint32_t BSDLY;
extern const long BUSY;
extern const long CANBSIZ;
extern const uint32_t CBAUD;
extern const uint32_t CBAUDEX;
extern const uint32_t CIBAUD;
@ -228,7 +227,6 @@ COSMOPOLITAN_C_END_
#define FF2 SYMBOLIC(FF2)
#define BUSY SYMBOLIC(BUSY)
#define CANBSIZ SYMBOLIC(CANBSIZ)
#define CBAUD SYMBOLIC(CBAUD)
#define CBAUDEX SYMBOLIC(CBAUDEX)
#define CIBAUD SYMBOLIC(CIBAUD)

View file

@ -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 0x1b406e20a218a10e globl # pselect6() on gnu/systemd
scall sys_pselect 0x1b406e20a218a10e globl hidden # pselect6() on gnu/systemd
scall sys_sched_yield 0x15e12a14bf25d018 globl hidden # select() on XNU (previously swtch() but removed in 12.4)
scall __sys_mremap 0x19bffffffffff019 globl hidden
scall sys_mincore 0x04e04e04e204e01b globl hidden