mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-01 03:53:33 +00:00
3265324e00
This change fixes #496 where ASAN spotted a race condition that could happen in multithreaded programs, with more than OPEN_MAX descriptors when using ZipOS or Windows NT, which require tracking open file info and this change fixes that table so it never relocates, thus allowing us to continue to enjoy the benefits of avoiding locks while reading.
35 lines
628 B
C
35 lines
628 B
C
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_
|
|
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
enum FdKind {
|
|
kFdEmpty,
|
|
kFdFile,
|
|
kFdSocket,
|
|
kFdProcess,
|
|
kFdConsole,
|
|
kFdSerial,
|
|
kFdZip,
|
|
kFdEpoll,
|
|
kFdReserved
|
|
};
|
|
|
|
struct Fd {
|
|
enum FdKind kind;
|
|
unsigned flags;
|
|
unsigned mode;
|
|
int64_t handle;
|
|
int64_t extra;
|
|
bool zombie;
|
|
};
|
|
|
|
struct Fds {
|
|
int f; /* lowest free slot */
|
|
size_t n;
|
|
struct Fd *p, *e;
|
|
};
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ */
|