cosmopolitan/libc/isystem
Justine Tunney 60cb435cb4
Implement pthread_atfork()
If threads are being used, then fork() will now acquire and release and
runtime locks so that fork() may be safely used from threads. This also
makes vfork() thread safe, because pthread mutexes will do nothing when
the process is a child of vfork(). More torture tests have been written
to confirm this all works like a charm. Additionally:

- Invent hexpcpy() api
- Rename nsync_malloc_() to kmalloc()
- Complete posix named semaphore implementation
- Make pthread_create() asynchronous signal safe
- Add rm, rmdir, and touch to command interpreter builtins
- Invent sigisprecious() and modify sigset functions to use it
- Add unit tests for posix_spawn() attributes and fix its bugs

One unresolved problem is the reclaiming of *NSYNC waiter memory in the
forked child processes, within apps which have threads waiting on locks
2022-10-16 12:25:13 -07:00
..
arpa Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
linux Make some foss compatibility improvements 2022-10-14 13:59:34 -07:00
net Make more compatibility improvements 2022-09-06 07:04:13 -07:00
netinet Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
sys Elevate Windows production worthiness 2022-10-13 13:44:41 -07:00
algorithm Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
alloca.h Initial import 2020-06-15 07:18:57 -07:00
any Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
array Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
assert.h Initial import 2020-06-15 07:18:57 -07:00
atomic Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
avx2intrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
avxintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
bit Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
bitset Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
byteswap.h Make more compatibility improvements 2022-09-06 07:04:13 -07:00
cassert Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ccomplex Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cctype Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cerrno Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cfenv Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cfloat Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
charconv Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
chrono Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cinttypes Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ciso646 Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
climits Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
clocale Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cmath Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
codecvt Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
compare Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
complex Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
complex.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
condition_variable Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cpio.h Implement pthread_atfork() 2022-10-16 12:25:13 -07:00
crypt.h Make more libc improvements 2022-08-06 17:18:40 -07:00
csetjmp Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
csignal Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstdarg Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstdbool Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstddef Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstdint Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstdio Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstdlib Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cstring Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ctgmath Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ctime Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ctype.h Initial import 2020-06-15 07:18:57 -07:00
cwchar Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
cwctype Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
deque Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
dirent.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
dlfcn.h Make more libc improvements 2022-08-06 17:18:40 -07:00
elf.h Fix isystem headers including wrong files (#108) 2021-03-06 21:06:29 -08:00
emmintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
endian.h Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
err.h Make more libc improvements 2022-08-06 17:18:40 -07:00
errno.h Initial import 2020-06-15 07:18:57 -07:00
exception Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
execution Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
fcntl.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
features.h Import C++ Standard Template Library 2022-03-22 06:41:54 -07:00
fenv.h Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
filesystem Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
float.h Make more libc improvements 2022-08-06 17:18:40 -07:00
fnmatch.h Add more missing libc functionality 2022-08-06 10:50:51 -07:00
forward_list Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
fstream Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ftw.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
functional Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
getopt.h Initial import 2020-06-15 07:18:57 -07:00
glob.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
grp.h Add getgroups and setgroups (#619) 2022-09-18 02:48:53 -07:00
iconv.h Add more missing libc functionality 2022-08-06 10:50:51 -07:00
initializer_list Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
inttypes.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
iomanip Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ios Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
iosfwd Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
iostream Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
iso646.h Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
istream Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
iterator Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
langinfo.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
libgen.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
limits Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
limits.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
list Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
locale Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
locale.h Make more compatibility improvements 2022-09-06 07:04:13 -07:00
malloc.h Initial import 2020-06-15 07:18:57 -07:00
map Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
math.h Initial import 2020-06-15 07:18:57 -07:00
memory Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
memory.h Fold LIBC_ALG into LIBC_MEM 2022-08-13 08:32:34 -07:00
mntent.h Make some foss compatibility improvements 2022-10-14 13:59:34 -07:00
monetary.h Greatly expand system() shell code features 2022-10-11 21:30:31 -07:00
mutex Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
netdb.h Add more missing libc functionality 2022-08-06 10:50:51 -07:00
new Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
nl_types.h Fold LIBC_UNICODE into LIBC_STR 2022-08-13 08:42:32 -07:00
nsync.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_atomic.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_counter.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_cv.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_debug.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_mu.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_mu_wait.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_note.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_once.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_time.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
nsync_waiter.h Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
numeric Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
optional Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ostream Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
paths.h Initial import 2020-06-15 07:18:57 -07:00
pmmintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
poll.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
pthread.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
pwd.h Fix isystem headers including wrong files (#108) 2021-03-06 21:06:29 -08:00
queue Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
random Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
ratio Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
regex Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
regex.h Initial import 2020-06-15 07:18:57 -07:00
sched.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
scoped_allocator Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
semaphore.h Add posix semaphores support 2022-10-14 09:21:02 -07:00
set Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
setjmp.h Initial import 2020-06-15 07:18:57 -07:00
shaintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
signal.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
smmintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
spawn.h Revamp posix_spawn() implementation 2022-10-12 05:26:58 -07:00
sstream Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
stack Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
stdalign.h Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
stdarg.h Initial import 2020-06-15 07:18:57 -07:00
stdatomic.h Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
stdbool.h Initial import 2020-06-15 07:18:57 -07:00
stdc-predef.h Initial import 2020-06-15 07:18:57 -07:00
stddef.h Initial import 2020-06-15 07:18:57 -07:00
stdexcept Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
stdint.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
stdio.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
stdio_ext.h Add more missing libc functionality 2022-08-06 10:50:51 -07:00
stdlib.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
stdnoreturn.h Add noreturn macro (#118) 2021-03-13 20:46:12 -08:00
streambuf Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
string Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
string.h Fold LIBC_ALG into LIBC_MEM 2022-08-13 08:32:34 -07:00
string_view Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
strings.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
strstream Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
sysexits.h Add script.com and whois.com courtesy of FreeBSD 2022-09-13 20:26:13 -07:00
syslog.h Add more missing libc functionality 2022-08-06 10:50:51 -07:00
system_error Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
termios.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
tgmath.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
thread Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
thread.h Initial import 2020-06-15 07:18:57 -07:00
time.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
tmmintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
tuple Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
type_traits Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
typeindex Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
typeinfo Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
uchar.h Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
uio.h Improve isystem includes and magic numbers 2021-08-14 23:36:36 -07:00
unistd.h Elevate Windows production worthiness 2022-10-13 13:44:41 -07:00
unordered_map Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
unordered_set Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
utility Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
utime.h Add utime to utime.h (#648) 2022-10-05 07:13:23 -07:00
utmp.h Add finger demo to redbean and fix regression 2022-06-23 03:42:05 -07:00
utmpx.h Add finger demo to redbean and fix regression 2022-06-23 03:42:05 -07:00
valarray Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
variant Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
vector Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
version Add more missing C / C++ headers 2022-09-04 04:53:52 -07:00
wait.h Add more missing libc functionality 2022-08-06 10:50:51 -07:00
wchar.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
wctype.h Improve cosmo's conformance to libc-test 2022-10-10 17:52:41 -07:00
windows.h Fix some win32 definitions 2022-03-22 19:54:36 -07:00
winternl.h Restore strict header checking 2022-08-13 16:02:01 -07:00
wmmintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
xmmintrin.h Pay off more technical debt 2022-09-12 23:36:56 -07:00
zlib.h Improve isystem includes and magic numbers 2021-08-14 23:36:36 -07:00