mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Make improvements
- Get threads working on NetBSD - Get threads working on OpenBSD - Fix Emacs config for Emacs v28 - Improve --strace logging of sigset_t - Improve --strace logging of struct stat - Improve memory safety of DescribeThing functions - Refactor auto stack allocation into LIBC_RUNTIME - Introduce shell.com example which works on Windows - Refactor __strace_thing into DescribeThing functions - Document the CHECK macros and improve them in NDEBUG mode - Rewrite MAP_STACK so it uses FreeBSD behavior across platforms - Deprecate and discourage the use of MAP_GROWSDOWN (it's weird)
This commit is contained in:
parent
dd9ab01d25
commit
e7611a8476
101 changed files with 967 additions and 464 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "libc/calls/strace.internal.h"
|
||||
#include "libc/calls/struct/rlimit.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/log/color.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
|
@ -37,12 +38,12 @@ static void SetLimit(int resource, uint64_t soft, uint64_t hard) {
|
|||
lim.rlim_cur = MIN(soft, lim.rlim_max);
|
||||
if (!setrlimit(resource, &lim)) {
|
||||
fprintf(stderr, "%sNOTE: SETRLIMIT(%s) DOWNGRADED TO {%,ld, %,ld}\n",
|
||||
__strace_rlimit_name(resource), lim.rlim_cur, lim.rlim_max);
|
||||
DescribeRlimitName(resource), lim.rlim_cur, lim.rlim_max);
|
||||
return;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "ERROR: SETRLIMIT(%s, %,ld, %,ld) FAILED %m%n",
|
||||
__strace_rlimit_name(resource), soft, hard);
|
||||
DescribeRlimitName(resource), soft, hard);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +64,8 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
for (i = 0; i < RLIM_NLIMITS; ++i) {
|
||||
rc = getrlimit(i, &rlim);
|
||||
printf("SETRLIMIT(%-20s, %,16ld, %,16ld) → %d %s\n",
|
||||
__strace_rlimit_name(i), rlim.rlim_cur, rlim.rlim_max, rc,
|
||||
!rc ? "" : strerror(errno));
|
||||
printf("SETRLIMIT(%-20s, %,16ld, %,16ld) → %d %s\n", DescribeRlimitName(i),
|
||||
rlim.rlim_cur, rlim.rlim_max, rc, !rc ? "" : strerror(errno));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue