cosmopolitan/libc/runtime
Justine Tunney 00611e9b06 Improve ZIP filesystem and change its prefix
The ZIP filesystem has a breaking change. You now need to use /zip/ to
open() / opendir() / etc. assets within the ZIP structure of your APE
binary, instead of the previous convention of using zip: or zip! URIs.
This is needed because Python likes to use absolute paths, and having
ZIP paths encoded like URIs simply broke too many things.

Many more system calls have been updated to be able to operate on ZIP
files and file descriptors. In particular fcntl() and ioctl() since
Python would do things like ask if a ZIP file is a terminal and get
confused when the old implementation mistakenly said yes, because the
fastest way to guarantee native file descriptors is to dup(2). This
change also improves the async signal safety of zipos and ensures it
doesn't maintain any open file descriptors beyond that which the user
has opened.

This change makes a lot of progress towards adding magic numbers that
are specific to platforms other than Linux. The philosophy here is that,
if you use an operating system like FreeBSD, then you should be able to
take advantage of FreeBSD exclusive features, even if we don't polyfill
them on other platforms. For example, you can now open() a file with the
O_VERIFY flag. If your program runs on other platforms, then Cosmo will
automatically set O_VERIFY to zero. This lets you safely use it without
the need for #ifdef or ifstatements which detract from readability.

One of the blindspots of the ASAN memory hardening we use to offer Rust
like assurances has always been that memory passed to the kernel via
system calls (e.g. writev) can't be checked automatically since the
kernel wasn't built with MODE=asan. This change makes more progress
ensuring that each system call will verify the soundness of memory
before it's passed to the kernel. The code for doing these checks is
fast, particularly for buffers, where it can verify 64 bytes a cycle.

- Correct O_LOOP definition on NT
- Introduce program_executable_name
- Add ASAN guards to more system calls
- Improve termios compatibility with BSDs
- Fix bug in Windows auxiliary value encoding
- Add BSD and XNU specific errnos and open flags
- Add check to ensure build doesn't talk to internet
2021-08-22 01:11:53 -07:00
..
abort-nt.c Improve signal handling and math 2021-02-25 18:33:33 -08:00
abort.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
arch_prctl.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
arememoryintervalsok.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
assertfail.c Add SSL to redbean 2021-06-24 13:20:50 -07:00
atexit.c Change license 2020-12-27 17:18:44 -08:00
brk.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
buffer.h Initial import 2020-06-15 07:18:57 -07:00
carsort.h Add x86_64-linux-gnu emulator 2020-08-25 04:43:42 -07:00
carsort100.c Change license 2020-12-27 17:18:44 -08:00
carsort1000.c Change license 2020-12-27 17:18:44 -08:00
clearenv.c Change license 2020-12-27 17:18:44 -08:00
clktck.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
clktck.h Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
close_s.c Change license 2020-12-27 17:18:44 -08:00
closesymboltable.c Change license 2020-12-27 17:18:44 -08:00
construct.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cosmo.S Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
cxaatexit.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
describeos.c Change license 2020-12-27 17:18:44 -08:00
directmap-metal.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
directmap-nt.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
directmap.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
directmap.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
dlfcn.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
dsohandle.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
e820.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
efimain.greg.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exit.c Restore Windows command prompt mode on exit 2021-02-27 12:53:51 -08:00
exit2.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
exit3.c Perform some code cleanup 2021-02-27 10:33:32 -08:00
ezmap.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ezmap.internal.h Improve documentation 2020-12-27 07:02:35 -08:00
fegetround.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
fenv.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
fenv.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
fesetround.c Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
findcombinary.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
finddebugbinary.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
findmemoryinterval.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
fltrounds.c Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
fork-nt.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fork.c Make redbean tinier 2021-07-04 12:26:54 -07:00
fpreset.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
free_s.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
ftrace-hook.S Make SSL handshakes much faster 2021-07-11 23:17:47 -07:00
ftrace.c Make SSL handshakes much faster 2021-07-11 23:17:47 -07:00
ftraceinit.c Improve performance of printf functions 2021-04-24 13:58:50 -07:00
ftracer.c Add SNI support to redbean and improve SSL perf 2021-07-23 13:56:13 -07:00
g_argc.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
gc.h Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
gc.internal.h Fix regression in _gclongjmp() 2021-08-19 09:34:24 -07:00
getcpucount.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
getdosargv.c Improve some unicode functions 2021-05-05 07:25:39 -07:00
getdosenviron.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
getmaxfd.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
getpagesize.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
getresourcelimit.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
grow.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
hook.greg.c Perform minor fixups 2021-03-13 19:40:04 -08:00
init.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
internal.h Restore Windows command prompt mode on exit 2021-02-27 12:53:51 -08:00
interruptiblecall.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
interruptiblecall.h Initial import 2020-06-15 07:18:57 -07:00
isheap.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
issetugid.c Change license 2020-12-27 17:18:44 -08:00
jmpstack.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ldso.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
mapanon.c Change license 2020-12-27 17:18:44 -08:00
mapelfread.c Change license 2020-12-27 17:18:44 -08:00
memtrack.c Make SSL handshakes much faster 2021-07-11 23:17:47 -07:00
memtrack.h Fix bugs and make improvements to redbean 2021-08-06 14:18:34 -07:00
memtracknt.c Eliminate some flakes 2021-02-03 06:25:27 -08:00
metalprintf.greg.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
metalprintf.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mman.greg.c Bring life.com executable size back down to 12kb 2021-03-02 01:13:32 -08:00
mman.internal.h Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
mmap.c Make more major improvements to redbean 2021-04-20 19:14:21 -07:00
mmi.c Change license 2020-12-27 17:18:44 -08:00
mremap-sysv.c Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
mremap.c Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
msync-nt.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
msync.c Make redbean StoreAsset() work better 2021-05-14 05:44:37 -07:00
munmap-metal.c Support malloc() on bare metal 2021-02-24 00:53:24 -08:00
munmap.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
openexecutable.S Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
opensymboltable.c Change license 2020-12-27 17:18:44 -08:00
pc.internal.h Improve signal handling and math 2021-02-25 18:33:33 -08:00
peekall.S Reduce number of disk seeks in redbean 2021-05-03 01:21:50 -07:00
print.greg.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
printmemoryintervals.c Improve PrintMemoryIntervals 2021-07-03 04:19:10 -07:00
progname.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
program_executable_name.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
program_invocation_short_name.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
pthread.c Work towards improving signals and processes 2021-01-27 19:34:02 -08:00
runtime.h Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
runtime.mk Undiamond Python headers 2021-08-12 14:07:40 -07:00
setstack.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
stackchkfail.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
stackchkfaillocal.c Change license 2020-12-27 17:18:44 -08:00
symbolic.h wip on intellisense (again) 2021-02-02 11:14:45 -05:00
symbols.internal.h Get codebase completely working with LLVM 2021-02-09 02:57:32 -08:00
sysconf.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
sysconf.h Fix a few more Python tests 2021-08-16 23:47:47 -07:00
untrackmemoryintervals.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
valist.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
valist.h Further refine documentation 2020-12-27 17:05:03 -08:00
vfork.S Fix popen_test in MODE=dbg 2021-05-01 17:13:48 -07:00
weakfree.c Expose public garbage collector API for C language 2021-03-08 10:59:34 -08:00
winmain.greg.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00