cosmopolitan/libc/tinymath
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
..
acos.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
acosf.S Add more math fixes 2021-03-06 11:44:40 -08:00
acosh.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
acoshf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
acoshl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
acosl.S Add more math fixes 2021-03-06 11:44:40 -08:00
asin.S Add more math fixes 2021-03-06 11:44:40 -08:00
asinf.S Add more math fixes 2021-03-06 11:44:40 -08:00
asinh.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
asinhf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
asinhl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
asinl.S Add more math fixes 2021-03-06 11:44:40 -08:00
atan.S Add more math fixes 2021-03-06 11:44:40 -08:00
atan2.c Add tests for the greatest of all libm functions 2021-03-06 12:59:35 -08:00
atan2f.c Add tests for the greatest of all libm functions 2021-03-06 12:59:35 -08:00
atan2l.S Add tests for the greatest of all libm functions 2021-03-06 12:59:35 -08:00
atanf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
atanh.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
atanhf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
atanhl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
atanl.S Add more math fixes 2021-03-06 11:44:40 -08:00
c2rangr.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cabs.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cabsf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cabsl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
carg.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cargf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cargl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cbrt.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cbrtc.c Add NES emulator 2020-07-02 13:46:08 -07:00
cbrtf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cbrtl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ceil.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
ceilf.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
ceill.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
cimag.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cimagf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cimagl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
conj.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
conjf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
conjl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
copysign.S Make pow() conform to standard definition 2021-03-03 09:21:27 -08:00
copysignf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
copysignl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cos.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
cosf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cosh.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
coshf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
coshl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
cosl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cprojf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
cprojl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
creal.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
crealf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
creall.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
d2ld2.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
emod.h Make improvements 2020-12-01 03:43:40 -08:00
emodl.h Make improvements 2020-12-01 03:43:40 -08:00
erf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
erff.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
exp.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exp2.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exp2f.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exp2l.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exp10.S Make pow() conform to standard definition 2021-03-03 09:21:27 -08:00
exp10f.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
exp10l.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
expf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
expl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
expm1.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
expm1f.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
expm1l.S Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
expo.internal.h Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
expo2.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
expo2f.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
f2ld2.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fabs.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fabsf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fabsl.S Make pow() conform to standard definition 2021-03-03 09:21:27 -08:00
fdim.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
fdimf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
fdiml.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
feval.internal.h Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
finite.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
finitef.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
finitel.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
floor.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
floorf.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
floorl.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
fma.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
fmax.c Remove sun musl fdlibm math library 2021-01-31 18:25:16 -08:00
fmaxf.c Remove sun musl fdlibm math library 2021-01-31 18:25:16 -08:00
fmaxl.c Remove sun musl fdlibm math library 2021-01-31 18:25:16 -08:00
fmin.c Remove sun musl fdlibm math library 2021-01-31 18:25:16 -08:00
fminf.c Remove sun musl fdlibm math library 2021-01-31 18:25:16 -08:00
fminl.c Remove sun musl fdlibm math library 2021-01-31 18:25:16 -08:00
fmod.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fmodf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
fmodl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
frexp.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
frexpf.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
frexpl.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
fsum.c Introduce fsum() 2021-06-11 16:49:30 -07:00
fsumf.c Introduce fsum() 2021-06-11 16:49:30 -07:00
gamma.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
hypot.c Perform some code cleanup 2021-02-27 10:33:32 -08:00
hypotf.c Perform some code cleanup 2021-02-27 10:33:32 -08:00
hypotl.c Perform some code cleanup 2021-02-27 10:33:32 -08:00
ilogb.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ilogbf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ilogbl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
kcos.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
kernel.internal.h Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
ksin.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
ktan.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
ldexp.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ldexpf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ldexpl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
ldshape.internal.h Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
log.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log1p.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log1pf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log1pl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log2.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log2f.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log2l.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log10.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log10f.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
log10l.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
logb.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
logbf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
logbl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
logf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
logl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
lrint.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
lrintf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
lrintl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
lround.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
lroundf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
lroundl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
modf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
modff.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
modfl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
nearbyint.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
nearbyintf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
nearbyintl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
nextafter.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
nextafterf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
nextafterl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
nexttoward.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
nexttowardf.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
nexttowardl.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
pow.S Add more math fixes 2021-03-06 11:44:40 -08:00
powf.S Add more math fixes 2021-03-06 11:44:40 -08:00
powfin.c Add more math fixes 2021-03-06 11:44:40 -08:00
powi.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
powif.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
powil.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
powl.c Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
remainder.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
remainderf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
remainderl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
rempio2.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
rempio2large.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
remquo.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
remquof.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
remquol.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
rint.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
rintf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
rintl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
round.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
roundf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
roundl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
scalb.S Add more math fixes 2021-03-06 11:44:40 -08:00
scalbf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
scalbl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
signbit.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
signbitf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
signbitl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
signgam.c Add error and gamma functions 2021-03-02 11:58:00 -08:00
significand.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
significandf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
significandl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
sin.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
sincos.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
sincosf.S Add more math fixes 2021-03-06 11:44:40 -08:00
sincosl.S Add more math fixes 2021-03-06 11:44:40 -08:00
sinf.S Add more math fixes 2021-03-06 11:44:40 -08:00
sinh.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
sinhf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
sinhl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
sinl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
sqrt.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
sqrtf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
sqrtl.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
tan.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
tanf.S Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
tanh.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
tanhf.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
tanhl.c Get more Python tests passing (#141) 2021-08-16 15:26:31 -07:00
tanl.S Add more math fixes 2021-03-06 11:44:40 -08:00
tgamma.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
tgammaf.c Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
tinymath.mk Make gdtoa less tunable (#104) 2021-03-07 16:41:59 -08:00
trunc.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
truncf.S Add more libm unit tests and fixes 2021-03-02 13:57:23 -08:00
truncl.S Make pow() conform to standard definition 2021-03-03 09:21:27 -08:00