Improve system call polyfills

- Polyfill open() w/ O_CLOEXEC on RHEL5
- Remove old workaround from rmdir() on the New Technology
- preadv() and pwritev() are now smarter about demodernization
- preadv() and pwritev() are now available on the New Technology
This commit is contained in:
Justine Tunney 2021-03-08 10:07:02 -08:00
parent 816b0e1851
commit 0ad609268f
21 changed files with 260 additions and 117 deletions

View file

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

View file

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

View file

@ -446,6 +446,7 @@ syscon auxv AT_PHENT 4 0 4 0 4 0
syscon auxv AT_PHNUM 5 0 5 0 5 0
syscon auxv AT_PAGESZ 6 0 6 0 6 0
syscon auxv AT_BASE 7 0 7 0 7 0 # address of program interpreter
syscon auxv AT_FLAGS 8 0 0 0 0 0
syscon auxv AT_ENTRY 9 0 9 0 9 0 # entry address of executable
syscon auxv AT_NOTELF 10 0 10 0 0 0
syscon auxv AT_OSRELDATE 0 0 18 0 0 0
@ -453,7 +454,8 @@ syscon auxv AT_UID 11 0 0 0 2001 0
syscon auxv AT_EUID 12 0 0 0 2000 0
syscon auxv AT_GID 13 0 0 0 2003 0
syscon auxv AT_EGID 14 0 0 0 2002 0
syscon auxv AT_PLATFORM 15 0 0 0 0 0 # address of string with hardware platform for rpath interpretation [RHEL5.0 LIMIT]
syscon auxv AT_PLATFORM 15 0 0 0 0 0 # address of string with hardware platform for rpath interpretation
syscon auxv AT_HWCAP 16 0 0 0 0 0
syscon auxv AT_CLKTCK 17 0 0 0 0 0
syscon auxv AT_DCACHEBSIZE 19 0 0 0 0 0
syscon auxv AT_ICACHEBSIZE 20 0 0 0 0 0
@ -461,6 +463,7 @@ syscon auxv AT_UCACHEBSIZE 21 0 0 0 0 0
syscon auxv AT_SECURE 23 0 0 0 0 0
syscon auxv AT_BASE_PLATFORM 24 0 0 0 0 0
syscon auxv AT_RANDOM 25 0 0 0 0 0 # address of sixteen bytes of random data
syscon auxv AT_HWCAP2 26 0 0 0 0 0
syscon auxv AT_EXECFN 31 31 999 999 2014 31 # address of string containing first argument passed to execve() used when running program [faked on non-linux]
syscon auxv AT_SYSINFO_EHDR 33 0 0 0 0 0
syscon auxv AT_NO_AUTOMOUNT 0x0800 0 0 0 0 0

View file

@ -0,0 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon auxv,AT_FLAGS,8,0,0,0,0,0

View file

@ -0,0 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon auxv,AT_HWCAP,16,0,0,0,0,0

View file

@ -0,0 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon auxv,AT_HWCAP2,26,0,0,0,0,0

View file

@ -13,7 +13,10 @@ extern const long AT_ENTRY;
extern const long AT_EUID;
extern const long AT_EXECFD;
extern const long AT_EXECFN;
extern const long AT_FLAGS;
extern const long AT_GID;
extern const long AT_HWCAP2;
extern const long AT_HWCAP;
extern const long AT_ICACHEBSIZE;
extern const long AT_NOTELF;
extern const long AT_NO_AUTOMOUNT;
@ -41,7 +44,10 @@ COSMOPOLITAN_C_END_
#define AT_EUID SYMBOLIC(AT_EUID)
#define AT_EXECFD SYMBOLIC(AT_EXECFD)
#define AT_EXECFN SYMBOLIC(AT_EXECFN)
#define AT_FLAGS SYMBOLIC(AT_FLAGS)
#define AT_GID SYMBOLIC(AT_GID)
#define AT_HWCAP SYMBOLIC(AT_HWCAP)
#define AT_HWCAP2 SYMBOLIC(AT_HWCAP2)
#define AT_ICACHEBSIZE SYMBOLIC(AT_ICACHEBSIZE)
#define AT_NOTELF SYMBOLIC(AT_NOTELF)
#define AT_NO_AUTOMOUNT SYMBOLIC(AT_NO_AUTOMOUNT)

View file

@ -278,7 +278,7 @@ scall ioprio_get 0xfffffffffffff0fc globl
scall inotify_init 0xfffffffffffff0fd globl # wicked
scall inotify_add_watch 0xfffffffffffff0fe globl
scall inotify_rm_watch 0xfffffffffffff0ff globl
scall sys_openat 0x1d41411f321cf101 globl hidden # Linux 2.6.16+ (c. 2007)
scall __sys_openat 0x1d41411f321cf101 globl hidden # Linux 2.6.16+ (c. 2007)
scall sys_mkdirat 0x1cd13e1f021db102 globl hidden
scall sys_fchownat 0x1d013b1eb21d4104 globl hidden # @asyncsignalsafe
scall sys_utime 0xfffffffffffff084 globl hidden