mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Fix bugs with recent change
This change makes further effort towards improving our poll() implementation on the New Technology. The stdin worker didn't work out so well for Python so it's not being used for now. System call tracing with the --strace flag should now be less noisy now on Windows unless you modify the strace.internal.h defines to turn on some optional ones that are most useful for debugging the system call wrappers.
This commit is contained in:
parent
933411ba99
commit
dc0ea6640e
127 changed files with 1354 additions and 866 deletions
|
@ -1,2 +0,0 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall getegid,0xfff02b02b202b06c,globl
|
|
@ -1,2 +0,0 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall getpgrp,0x051051051205106f,globl
|
2
libc/sysv/calls/sys_getegid.s
Normal file
2
libc/sysv/calls/sys_getegid.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall sys_getegid,0x02b02b02b202b06c,globl,hidden
|
|
@ -1,2 +1,2 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall sys_geteuid,0xfff019019201906b,globl,hidden
|
||||
.scall sys_geteuid,0x019019019201906b,globl,hidden
|
||||
|
|
2
libc/sysv/calls/sys_getpgrp.s
Normal file
2
libc/sysv/calls/sys_getpgrp.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall sys_getpgrp,0x051051051205106f,globl,hidden
|
|
@ -901,6 +901,7 @@ syscon ptrace PTRACE_O_TRACECLONE 0x0008 -1 -1 -1 -1 -1
|
|||
syscon ptrace PTRACE_O_TRACEEXEC 0x0010 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_O_TRACEVFORKDONE 0x0020 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_O_TRACEEXIT 0x0040 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_O_TRACESECCOMP 0x0080 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_O_MASK 0x007f -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_EVENT_FORK 1 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_EVENT_VFORK 2 -1 -1 -1 -1 -1
|
||||
|
@ -908,6 +909,8 @@ syscon ptrace PTRACE_EVENT_CLONE 3 -1 -1 -1 -1 -1
|
|||
syscon ptrace PTRACE_EVENT_EXEC 4 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_EVENT_VFORK_DONE 5 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_EVENT_EXIT 6 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_EVENT_SECCOMP 7 -1 -1 -1 -1 -1
|
||||
syscon ptrace PTRACE_EVENT_STOP 128 -1 -1 -1 -1 -1
|
||||
|
||||
# clone() codes
|
||||
#
|
||||
|
@ -1807,9 +1810,9 @@ syscon misc NL_NMAX 0x7fffffff 1 1 0 0 0
|
|||
syscon misc NL_SETD 1 1 0 1 1 0
|
||||
|
||||
syscon rusage RUSAGE_SELF 0 0 0 0 0 0 # unix consensus & faked nt
|
||||
syscon rusage RUSAGE_THREAD 1 99 1 1 1 1 # faked nt & unavailable on xnu
|
||||
syscon rusage RUSAGE_CHILDREN -1 -1 -1 -1 -1 99 # unix consensus & unavailable on nt
|
||||
syscon rusage RUSAGE_BOTH -2 99 99 99 99 99 # woop
|
||||
syscon rusage RUSAGE_THREAD 1 99 1 1 1 1 # faked nt & unavailable on xnu
|
||||
|
||||
syscon misc FSETLOCKING_QUERY 0 0 0 0 0 0 # consensus
|
||||
syscon misc FSETLOCKING_BYCALLER 2 0 0 0 0 0
|
||||
|
|
2
libc/sysv/consts/PTRACE_EVENT_SECCOMP.S
Normal file
2
libc/sysv/consts/PTRACE_EVENT_SECCOMP.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon ptrace,PTRACE_EVENT_SECCOMP,7,-1,-1,-1,-1,-1
|
2
libc/sysv/consts/PTRACE_EVENT_STOP.S
Normal file
2
libc/sysv/consts/PTRACE_EVENT_STOP.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon ptrace,PTRACE_EVENT_STOP,128,-1,-1,-1,-1,-1
|
2
libc/sysv/consts/PTRACE_O_TRACESECCOMP.S
Normal file
2
libc/sysv/consts/PTRACE_O_TRACESECCOMP.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon ptrace,PTRACE_O_TRACESECCOMP,0x0080,-1,-1,-1,-1,-1
|
|
@ -43,6 +43,7 @@ extern const long PTRACE_O_TRACECLONE;
|
|||
extern const long PTRACE_O_TRACEEXEC;
|
||||
extern const long PTRACE_O_TRACEVFORKDONE;
|
||||
extern const long PTRACE_O_TRACEEXIT;
|
||||
extern const long PTRACE_O_TRACESECCOMP;
|
||||
extern const long PTRACE_O_MASK;
|
||||
extern const long PTRACE_EVENT_FORK;
|
||||
extern const long PTRACE_EVENT_VFORK;
|
||||
|
@ -50,6 +51,8 @@ extern const long PTRACE_EVENT_CLONE;
|
|||
extern const long PTRACE_EVENT_EXEC;
|
||||
extern const long PTRACE_EVENT_VFORK_DONE;
|
||||
extern const long PTRACE_EVENT_EXIT;
|
||||
extern const long PTRACE_EVENT_STOP;
|
||||
extern const long PTRACE_EVENT_SECCOMP;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
@ -93,6 +96,7 @@ COSMOPOLITAN_C_END_
|
|||
#define PTRACE_O_TRACEEXEC SYMBOLIC(PTRACE_O_TRACEEXEC)
|
||||
#define PTRACE_O_TRACEVFORKDONE SYMBOLIC(PTRACE_O_TRACEVFORKDONE)
|
||||
#define PTRACE_O_TRACEEXIT SYMBOLIC(PTRACE_O_TRACEEXIT)
|
||||
#define PTRACE_O_TRACESECCOMP SYMBOLIC(PTRACE_O_TRACESECCOMP)
|
||||
#define PTRACE_O_MASK SYMBOLIC(PTRACE_O_MASK)
|
||||
#define PTRACE_EVENT_FORK SYMBOLIC(PTRACE_EVENT_FORK)
|
||||
#define PTRACE_EVENT_VFORK SYMBOLIC(PTRACE_EVENT_VFORK)
|
||||
|
@ -100,5 +104,7 @@ COSMOPOLITAN_C_END_
|
|||
#define PTRACE_EVENT_EXEC SYMBOLIC(PTRACE_EVENT_EXEC)
|
||||
#define PTRACE_EVENT_VFORK_DONE SYMBOLIC(PTRACE_EVENT_VFORK_DONE)
|
||||
#define PTRACE_EVENT_EXIT SYMBOLIC(PTRACE_EVENT_EXIT)
|
||||
#define PTRACE_EVENT_STOP SYMBOLIC(PTRACE_EVENT_STOP)
|
||||
#define PTRACE_EVENT_SECCOMP SYMBOLIC(PTRACE_EVENT_SECCOMP)
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTRACE_H_ */
|
||||
|
|
|
@ -145,13 +145,13 @@ scall syslog 0xfffffffffffff067 globl
|
|||
scall sys_getuid 0x0180180182018066 globl hidden
|
||||
scall sys_getgid 0x02f02f02f202f068 globl hidden
|
||||
scall sys_getppid 0xfff027027202706e globl hidden # see sys_getpid()→edx for netbsd
|
||||
scall getpgrp 0x051051051205106f globl
|
||||
scall sys_getpgrp 0x051051051205106f globl hidden
|
||||
scall sys_setsid 0x0930930932093070 globl hidden
|
||||
scall sys_getsid 0x11e0ff136213607c globl hidden
|
||||
scall sys_getpgid 0x0cf0cf0cf2097079 globl hidden
|
||||
scall sys_setpgid 0x052052052205206d globl hidden
|
||||
scall sys_geteuid 0xfff019019201906b globl hidden
|
||||
scall getegid 0xfff02b02b202b06c globl
|
||||
scall sys_geteuid 0x019019019201906b globl hidden
|
||||
scall sys_getegid 0x02b02b02b202b06c globl hidden
|
||||
scall getgroups 0x04f04f04f204f073 globl
|
||||
scall setgroups 0x0500500502050074 globl
|
||||
scall setreuid 0x07e07e07e207e071 globl
|
||||
|
|
|
@ -198,27 +198,36 @@ systemfive_xnu:
|
|||
.init.start 300,_init_systemfive
|
||||
push %rbx
|
||||
push %rsi
|
||||
mov (%rdi),%eax
|
||||
// Detect the operating system.
|
||||
mov (%rdi),%eax # __hostos
|
||||
#if SupportsWindows() || SupportsXnu() || SupportsFreebsd()
|
||||
// set by libc/ape.S for XNU
|
||||
// set by libc/crt/crt.S for XNU/FreeBSD
|
||||
// set by libc/nt/winmain.greg.c for New Technology
|
||||
test %eax,%eax
|
||||
jnz _init_systemfive_detected # os is already known
|
||||
#endif
|
||||
#if SupportsOpenbsd()
|
||||
cmpq $0,(%r15) # OpenBSD has no auxv
|
||||
jnz 0f
|
||||
mov $OPENBSD,%al
|
||||
jmp _init_systemfive_detected
|
||||
0:
|
||||
#endif
|
||||
#if SupportsNetbsd()
|
||||
xor %ecx,%ecx
|
||||
0: cmpq $2014,(%r15,%rcx,8) # NetBSD AT_EXECFN
|
||||
0: cmpq $2014,(%r15,%rcx,8) # NetBSD's AT_EXECFN
|
||||
jne 1f
|
||||
mov $NETBSD,%al
|
||||
jmp _init_systemfive_detected
|
||||
1: cmpq $0,(%r15,%rcx,8)
|
||||
lea 2(%ecx),%ecx
|
||||
jnz 0b
|
||||
2:
|
||||
#endif
|
||||
test %eax,%eax
|
||||
jnz 1f
|
||||
mov $LINUX,%al
|
||||
1: stosq #→ __hostos
|
||||
_init_systemfive_detected:
|
||||
stosq #→ __hostos
|
||||
bsr %eax,%eax
|
||||
mov $_init_systemfive_jmptab,%ebx
|
||||
movzbl (%rbx,%rax),%eax
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue