cosmopolitan/libc/stdio
Justine Tunney af7bd80430
Eliminate cyclic locks in runtime
This change introduces a new deadlock detector for Cosmo's POSIX threads
implementation. Error check mutexes will now track a DAG of nested locks
and report EDEADLK when a deadlock is theoretically possible. These will
occur rarely, but it's important for production hardening your code. You
don't even need to change your mutexes to use the POSIX error check mode
because `cosmocc -mdbg` will enable error checking on mutexes by default
globally. When cycles are found, an error message showing your demangled
symbols describing the strongly connected component are printed and then
the SIGTRAP is raised, which means you'll also get a backtrace if you're
using ShowCrashReports() too. This new error checker is so low-level and
so pure that it's able to verify the relationships of every libc runtime
lock, including those locks upon which the mutex implementation depends.
2024-12-16 22:25:12 -08:00
..
__fpurge.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
__freadahead.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
__freadptr.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
__freadptrinc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
__fseterr.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
alloc.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
alphasort.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
append.h Make cosmo.h work a little better 2024-02-21 16:40:09 -08:00
appendd.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
appendf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
appendr.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
appends.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
appendstrlist.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
appendw.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
appendz.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
asprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
atof.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
big5.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
BUILD.mk Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
clearerr.c more modeline errata (#1019) 2023-12-16 23:07:10 -05:00
clearerr_unlocked.c more modeline errata (#1019) 2023-12-16 23:07:10 -05:00
codepages.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
confstr.c Put confstr() in unistd.h 2024-05-21 15:35:06 -07:00
ctermid.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
dirstream.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
dprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
dprintf.h Add dontthrow attribute to most libc functions 2024-01-09 01:26:03 -08:00
dumphexc.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
ecvt.c Fix ecvt/fcvt issues w.r.t. value==0 and ndigit==0 (#1282) 2024-09-07 18:08:11 -07:00
fbufsize.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fclose.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fdopen.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
feof.c more modeline errata (#1019) 2023-12-16 23:07:10 -05:00
feof_unlocked.c more modeline errata (#1019) 2023-12-16 23:07:10 -05:00
ferror.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ferror_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fflush.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fflush_unlocked.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fgetc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fgetc_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
fgetln.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
fgetpos.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fgets.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fgets_unlocked.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
fgetwc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fgetwc_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
fgetws.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fgetws_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
fileno.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fileno_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
flbf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
flockfile.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
flushlbf.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fmemopen.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fmt.c Add the uppercase B conversion specifier to printf (#1300) 2024-09-26 04:27:45 -07:00
fopen.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fopenflags.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fpending.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fprintf_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fpurge.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fputc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fputc_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
fputs.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fputs_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
fputwc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fputwc_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fputws.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fputws_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fread.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
fread_unlocked.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
freadable.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
freading.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
freestrlist.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
freopen.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fscanf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fseek.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
fseek_unlocked.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fsetlocking.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fsetpos.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ftell.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
ftrylockfile.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ftw.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ftw.h Add dontthrow attribute to most libc functions 2024-01-09 01:26:03 -08:00
funlockfile.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fwritable.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fwrite.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
fwrite_unlocked.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
fwriting.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
gb18030.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
gcvt.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
get_current_dir_name.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getchar.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getchar_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getcwd.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
getdelim.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getdelim_unlocked.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
getentropy.c Make getentropy() faster 2024-10-10 18:45:15 -07:00
getline.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
gets.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getwchar.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getwchar_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
hex.internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
hkscs.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
iconv.h Reduce header complexity 2023-11-28 14:39:42 -08:00
internal.h Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
jis0208.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
joinstrlist.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
kappendf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ksc.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
kvappendf.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
lcg.internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
legacychars.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
lemur64.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
mt19937.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
nftw.c Fix some static analysis issues 2024-07-27 09:16:54 -07:00
printargs.c Avoid linker conflicts on DescribeFoo symbols 2024-08-24 18:10:22 -07:00
printf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
putchar.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
putchar_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
puts.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
puts_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
putwc_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
putwchar.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
putwchar_unlocked.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
rand.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
rand.h Add dontthrow attribute to most libc functions 2024-01-09 01:26:03 -08:00
random.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
rdseed.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
readpassphrase.c Fix ctype.h and wctype.h 2024-07-21 15:54:17 -07:00
readpassphrase.h Import libbsd readpassphrase (#1182) 2024-05-20 03:37:30 -04:00
real1.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
real2.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
real3.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
revjis.inc Add more missing libc functionality 2022-08-06 10:50:51 -07:00
rewind.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
rngset.c Delete ASAN 2024-06-22 05:45:49 -07:00
scandir.c Fix some static analysis issues 2024-07-27 09:16:54 -07:00
scanf.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
setbuf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
setbuffer.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
setlinebuf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
setvbuf.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
snprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
sortstrlist.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
sprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
sscanf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
stdbuf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
stderr.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
stdin.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
stdio.h Fix some static analysis issues 2024-07-27 09:16:54 -07:00
stdio_ext.h Add dontthrow attribute to most libc functions 2024-01-09 01:26:03 -08:00
stdout.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
strfry.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
strlist.internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
strtold.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
swprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
syscall.c Introduce getcpu() system call from glibc 2024-02-21 18:17:20 -08:00
syscall.h Introduce getcpu() system call from glibc 2024-02-21 18:17:20 -08:00
sysparam.h Rerun clang-format on the repo (#1217) 2024-06-15 16:34:48 -04:00
tmpfile.c Bring back gc() function 2024-01-08 10:26:28 -08:00
tmpnam.c Make improvements 2024-02-12 10:23:00 -08:00
tmpnam_r.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ungetc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ungetc_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
ungetwc.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ungetwc_unlocked.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
vappendf.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
vasprintf.c Fix some static analysis issues 2024-07-27 09:16:54 -07:00
vcscanf.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
vdprintf.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
versionsort.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vfprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vfprintf_unlocked.c Make more fixups and quality assurance 2024-10-07 15:29:53 -07:00
vfscanf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vigna.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vscanf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vsnprintf.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
vsprintf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
vsscanf.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
wcstod.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
wcstof.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
wcstold.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00