mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Put more thought into i/o polyfills
wait4() is now solid enough to run `make -j100` on Windows. You can now use MSG_DONTWAIT on Windows. There was a handle leak in accept() that's been fixed. Our WIN32 overlapped i/o code has been simplified. Priority class now inherits into subprocesses, so the verynice command will work and the signal mask will now be inherited by execve() and posix_spawn()
This commit is contained in:
parent
736fdb757a
commit
e961385e55
52 changed files with 679 additions and 487 deletions
|
@ -2,25 +2,27 @@
|
|||
#define COSMOPOLITAN_LIBC_PROC_H_
|
||||
#include "libc/atomic.h"
|
||||
#include "libc/calls/struct/rusage.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/dll.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
#include "third_party/nsync/cv.h"
|
||||
#include "third_party/nsync/mu.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define PROC_ALIVE 0
|
||||
#define PROC_ZOMBIE 1
|
||||
#define PROC_UNDEAD 2
|
||||
|
||||
#define PROC_CONTAINER(e) DLL_CONTAINER(struct Proc, elem, e)
|
||||
|
||||
struct Proc {
|
||||
int pid;
|
||||
int status;
|
||||
int waiters;
|
||||
bool iszombie;
|
||||
bool wasforked;
|
||||
uint32_t wstatus;
|
||||
int64_t handle;
|
||||
struct Dll elem;
|
||||
nsync_cv onexit;
|
||||
struct rusage ru;
|
||||
};
|
||||
|
||||
|
@ -28,15 +30,15 @@ struct Procs {
|
|||
int waiters;
|
||||
atomic_uint once;
|
||||
nsync_mu lock;
|
||||
nsync_cv onexit;
|
||||
intptr_t thread;
|
||||
intptr_t onstart;
|
||||
intptr_t onbirth;
|
||||
intptr_t haszombies;
|
||||
struct Dll *list;
|
||||
struct Dll *free;
|
||||
struct Dll *undead;
|
||||
struct Dll *zombies;
|
||||
struct Proc pool[8];
|
||||
unsigned allocated;
|
||||
struct CosmoTib tls;
|
||||
struct rusage ruchlds;
|
||||
};
|
||||
|
||||
|
@ -50,6 +52,7 @@ int64_t __proc_search(int);
|
|||
struct Proc *__proc_new(void);
|
||||
void __proc_add(struct Proc *);
|
||||
void __proc_free(struct Proc *);
|
||||
int __proc_harvest(struct Proc *, bool);
|
||||
int sys_wait4_nt(int, int *, int, struct rusage *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue