mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Add torture test for zipos file descriptors
This change hardens the code for opening /zip/ files using the system call interface. Thread safety and signal safety has been improved for file descriptors in general. We now document fixed addresses that are needed for low level allocations.
This commit is contained in:
parent
579080cd4c
commit
e466dd0553
44 changed files with 2981 additions and 307 deletions
27
libc/linux/futex.h
Normal file
27
libc/linux/futex.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_LINUX_FUTEX_H_
|
||||
#define COSMOPOLITAN_LIBC_LINUX_FUTEX_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
|
||||
forceinline int LinuxFutexWait(void *addr, int expect,
|
||||
struct timespec *timeout) {
|
||||
int ax;
|
||||
register void *r10 asm("r10") = timeout;
|
||||
asm volatile("syscall"
|
||||
: "=a"(ax)
|
||||
: "0"(202), "D"(addr), "S"(0), "d"(expect), "r"(r10)
|
||||
: "rcx", "r11", "memory");
|
||||
return ax;
|
||||
}
|
||||
|
||||
forceinline int LinuxFutexWake(void *addr, int count) {
|
||||
int ax;
|
||||
asm volatile("syscall"
|
||||
: "=a"(ax)
|
||||
: "0"(202), "D"(addr), "S"(1), "d"(count)
|
||||
: "rcx", "r11", "memory");
|
||||
return ax;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_LINUX_FUTEX_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue