mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 02:38:31 +00:00
Make more fixes and improvements
- Remove PAGESIZE constant - Fix realloc() documentation - Fix ttyname_r() error reporting - Make forking more reliable on Windows - Make execvp() a few microseconds faster - Make system() a few microseconds faster - Tighten up the socket-related magic numbers - Loosen restrictions on mmap() offset alignment - Improve GetProgramExecutableName() with getenv("_") - Use mkstemp() as basis for mktemp(), tmpfile(), tmpfd() - Fix flakes in pthread_cancel_test, unix_test, fork_test - Fix recently introduced futex stack overflow regression - Let sockets be passed as stdio to subprocesses on Windows - Improve security of bind() on Windows w/ SO_EXCLUSIVEADDRUSE
This commit is contained in:
parent
140a8a52e5
commit
18bb5888e1
311 changed files with 1239 additions and 2622 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/bsr.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/log/backtrace.internal.h"
|
||||
#include "libc/log/internal.h"
|
||||
|
@ -64,6 +65,10 @@ static relegated void OnXfsz(int sig) {
|
|||
DieBecauseOfQuota(25, "\n\nSIGXFSZ: exceeded maximum file size");
|
||||
}
|
||||
|
||||
static unsigned long roundup2pow(unsigned long x) {
|
||||
return x > 1 ? 2ul << _bsrl(x - 1) : x ? 1 : 0;
|
||||
}
|
||||
|
||||
relegated void __oom_hook(size_t request) {
|
||||
int e;
|
||||
uint64_t toto, newlim;
|
||||
|
@ -75,7 +80,7 @@ relegated void __oom_hook(size_t request) {
|
|||
if (IsRunningUnderMake()) {
|
||||
newlim = toto + request;
|
||||
newlim += newlim >> 1;
|
||||
newlim = _roundup2pow(newlim);
|
||||
newlim = roundup2pow(newlim);
|
||||
kprintf("FIX CODE OR TUNE QUOTA += -M%dm\n", newlim / (1024 * 1024));
|
||||
}
|
||||
kprintf("\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue