cosmopolitan/libc/calls/struct
Justine Tunney 226aaf3547 Improve memory safety
This commit makes numerous refinements to cosmopolitan memory handling.

The default stack size has been reduced from 2mb to 128kb. A new macro
is now provided so you can easily reconfigure the stack size to be any
value you want. Work around the breaking change by adding to your main:

    STATIC_STACK_SIZE(0x00200000);  // 2mb stack

If you're not sure how much stack you need, then you can use:

    STATIC_YOINK("stack_usage_logging");

After which you can `sort -nr o/$MODE/stack.log`. Based on the unit test
suite, nothing in the Cosmopolitan repository (except for Python) needs
a stack size greater than 30kb. There are also new macros for detecting
the size and address of the stack at runtime, e.g. GetStackAddr(). We
also now support sigaltstack() so if you want to see nice looking crash
reports whenever a stack overflow happens, you can put this in main():

    ShowCrashReports();

Under `make MODE=dbg` and `make MODE=asan` the unit testing framework
will now automatically print backtraces of memory allocations when
things like memory leaks happen. Bugs are now fixed in ASAN global
variable overrun detection. The memtrack and asan runtimes also handle
edge cases now. The new tools helped to identify a few memory leaks,
which are fixed by this change.

This change should fix an issue reported in #288 with ARG_MAX limits.
Fixing this doubled the performance of MKDEPS.COM and AR.COM yet again.
2021-10-13 17:27:13 -07:00
..
dirent.h Add SSL to redbean 2021-06-24 13:20:50 -07:00
flock.h Make redbean StoreAsset() work better 2021-05-14 05:44:37 -07:00
framebufferfixedscreeninfo.h Initial import 2020-06-15 07:18:57 -07:00
framebuffervirtualscreeninfo.h Initial import 2020-06-15 07:18:57 -07:00
iovec.h Initial import 2020-06-15 07:18:57 -07:00
itimerval.h Initial import 2020-06-15 07:18:57 -07:00
metasigaltstack.h Improve memory safety 2021-10-13 17:27:13 -07:00
metastat.internal.h Fix termios struct on Linux 2021-09-03 22:19:41 -07:00
metatermios.internal.h Apply some touchups 2021-02-07 07:02:46 -08:00
rlimit.h Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
rusage.h Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
sched_param.h Initial import 2020-06-15 07:18:57 -07:00
sigaction-freebsd.internal.h Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
sigaction-linux.internal.h Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
sigaction-netbsd.h Add NetBSD support 2021-02-05 06:19:45 -08:00
sigaction-openbsd.internal.h Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
sigaction-xnu.internal.h Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
sigaction.h Improve memory safety 2021-10-13 17:27:13 -07:00
sigaltstack.h Improve memory safety 2021-10-13 17:27:13 -07:00
siginfo.h Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
sigset.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
sigval.h Initial import 2020-06-15 07:18:57 -07:00
sockaddr6.h Add test for ioctl(SIOCGIFCONF) and polyfill on BSDs 2021-06-25 18:44:04 -07:00
stat.h Fix termios struct on Linux 2021-09-03 22:19:41 -07:00
stat.macros.h Fix termios struct on Linux 2021-09-03 22:19:41 -07:00
sysinfo.h Initial import 2020-06-15 07:18:57 -07:00
termios.h Fix termios struct on Linux 2021-09-03 22:19:41 -07:00
timespec.h Initial import 2020-06-15 07:18:57 -07:00
timeval.h Initial import 2020-06-15 07:18:57 -07:00
tms.h Initial import 2020-06-15 07:18:57 -07:00
user_regs_struct.h Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
utsname.h Initial import 2020-06-15 07:18:57 -07:00
winsize.h Initial import 2020-06-15 07:18:57 -07:00