mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Pay off more technical debt
This makes breaking changes to add underscores to many non-standard
function names provided by the c library. MODE=tiny is now tinier and
we now use smaller locks that are better for tiny apps in this mode.
Some headers have been renamed to be in the same folder as the build
package, so it'll be easier to know which build dependency is needed.
Certain old misguided interfaces have been removed. Intel intrinsics
headers are now listed in libc/isystem (but not in the amalgamation)
to help further improve open source compatibility. Header complexity
has also been reduced. Lastly, more shell scripts are now available.
Compared to 6f7d0cb1c3
, some tiny corrections were made in libc/intrin/g_fds.c and libc/zipos/open.c including double semi colons and incorrect indentation for existing vista changes that were manually pulled from this commit previously.
This commit is contained in:
parent
555260d2e5
commit
7b26b42769
959 changed files with 4065 additions and 4868 deletions
|
@ -39,7 +39,6 @@
|
||||||
#include "libc/elf/def.h"
|
#include "libc/elf/def.h"
|
||||||
#include "libc/macho.internal.h"
|
#include "libc/macho.internal.h"
|
||||||
#include "libc/nexgen32e/uart.internal.h"
|
#include "libc/nexgen32e/uart.internal.h"
|
||||||
#include "libc/nexgen32e/vidya.internal.h"
|
|
||||||
#include "libc/nt/pedef.internal.h"
|
#include "libc/nt/pedef.internal.h"
|
||||||
#include "libc/runtime/pc.internal.h"
|
#include "libc/runtime/pc.internal.h"
|
||||||
#include "libc/sysv/consts/prot.h"
|
#include "libc/sysv/consts/prot.h"
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
#include "dsp/core/ituround.h"
|
#include "dsp/core/ituround.h"
|
||||||
#include "dsp/core/q.h"
|
#include "dsp/core/q.h"
|
||||||
#include "dsp/core/twixt8.h"
|
#include "dsp/core/twixt8.h"
|
||||||
|
#include "libc/intrin/bsr.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
|
#include "libc/mem/gc.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/nexgen32e/bsr.h"
|
|
||||||
#include "libc/runtime/gc.internal.h"
|
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/testlib/testlib.h"
|
#include "libc/testlib/testlib.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
@ -203,8 +203,8 @@ void *Gyarados(long dyw, long dxw, int dst[dyw][dxw], long syw, long sxw,
|
||||||
CHECK_LE(sxn, sxw);
|
CHECK_LE(sxn, sxw);
|
||||||
CHECK_LE(dyn, dyw);
|
CHECK_LE(dyn, dyw);
|
||||||
CHECK_LE(dxn, dxw);
|
CHECK_LE(dxn, dxw);
|
||||||
CHECK_LT(bsrl(syn) + bsrl(sxn), 32);
|
CHECK_LT(_bsrl(syn) + _bsrl(sxn), 32);
|
||||||
CHECK_LT(bsrl(dyn) + bsrl(dxn), 32);
|
CHECK_LT(_bsrl(dyn) + _bsrl(dxn), 32);
|
||||||
CHECK_LE(dyw, 0x7fff);
|
CHECK_LE(dyw, 0x7fff);
|
||||||
CHECK_LE(dxw, 0x7fff);
|
CHECK_LE(dxw, 0x7fff);
|
||||||
CHECK_LE(syw, 0x7fff);
|
CHECK_LE(syw, 0x7fff);
|
||||||
|
|
|
@ -83,10 +83,11 @@ int ttyident(struct TtyIdent *ti, int ttyinfd, int ttyoutfd) {
|
||||||
if (ttyident_probe(ti, ttyinfd, ttyoutfd, "\e[>c") != -1) {
|
if (ttyident_probe(ti, ttyinfd, ttyoutfd, "\e[>c") != -1) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
memset(&outer, 0, sizeof(outer));
|
memset(&outer, 0, sizeof(outer));
|
||||||
if (ti->id == 83 /* GNU Screen */ && (ti->next || weaken(malloc)) &&
|
if (ti->id == 83 /* GNU Screen */ && (ti->next || _weaken(malloc)) &&
|
||||||
ttyident_probe(&outer, ttyinfd, ttyoutfd, "\eP\e[>c\e\\") != -1 &&
|
ttyident_probe(&outer, ttyinfd, ttyoutfd, "\eP\e[>c\e\\") != -1 &&
|
||||||
(ti->next = (ti->next ? ti->next
|
(ti->next =
|
||||||
: weaken(malloc)(sizeof(struct TtyIdent))))) {
|
(ti->next ? ti->next
|
||||||
|
: _weaken(malloc)(sizeof(struct TtyIdent))))) {
|
||||||
memcpy(ti->next, &outer, sizeof(outer));
|
memcpy(ti->next, &outer, sizeof(outer));
|
||||||
} else {
|
} else {
|
||||||
free_s(&ti->next);
|
free_s(&ti->next);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "dsp/tty/tty.h"
|
#include "dsp/tty/tty.h"
|
||||||
#include "libc/mem/arraylist2.internal.h"
|
#include "libc/mem/arraylist2.internal.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
#include "libc/mem/gc.internal.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
|
||||||
/* TODO(jart): DELETE */
|
/* TODO(jart): DELETE */
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "libc/calls/ucontext.h"
|
#include "libc/calls/ucontext.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
#include "libc/mem/gc.internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/fileno.h"
|
#include "libc/sysv/consts/fileno.h"
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
#include "libc/sysv/consts/sig.h"
|
#include "libc/sysv/consts/sig.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
#include "libc/x/xsigaction.h"
|
||||||
|
|
||||||
/* TODO(jart): DELETE */
|
/* TODO(jart): DELETE */
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
#include "libc/mem/gc.internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
|
@ -9,18 +9,21 @@
|
||||||
#endif
|
#endif
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/dirent.h"
|
#include "libc/calls/struct/dirent.h"
|
||||||
|
#include "libc/calls/struct/rusage.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/calls/struct/sigset.h"
|
#include "libc/calls/struct/sigset.h"
|
||||||
#include "libc/calls/struct/timespec.h"
|
#include "libc/calls/struct/timespec.h"
|
||||||
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/fmt/itoa.h"
|
#include "libc/fmt/itoa.h"
|
||||||
|
#include "libc/log/appendresourcereport.internal.h"
|
||||||
#include "libc/log/internal.h"
|
#include "libc/log/internal.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/internal.h"
|
#include "libc/runtime/internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/append.internal.h"
|
#include "libc/stdio/append.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/clock.h"
|
#include "libc/sysv/consts/clock.h"
|
||||||
|
@ -151,7 +154,7 @@ int main(int argc, char *argv[]) {
|
||||||
while ((line = linenoiseWithHistory(prompt, "cmd"))) {
|
while ((line = linenoiseWithHistory(prompt, "cmd"))) {
|
||||||
n = 0;
|
n = 0;
|
||||||
start = line;
|
start = line;
|
||||||
if (startswith(start, "time ")) {
|
if (_startswith(start, "time ")) {
|
||||||
timeit = true;
|
timeit = true;
|
||||||
start += 5;
|
start += 5;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
|
#include "libc/calls/struct/sigset.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/intrin/safemacros.internal.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/iovec.h"
|
#include "libc/calls/struct/iovec.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
@ -15,15 +14,16 @@
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
|
#include "libc/intrin/safemacros.internal.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/stdio/rand.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/runtime/gc.h"
|
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/sock/goodsocket.internal.h"
|
#include "libc/sock/goodsocket.internal.h"
|
||||||
#include "libc/sock/sock.h"
|
#include "libc/sock/sock.h"
|
||||||
#include "libc/stdio/append.internal.h"
|
#include "libc/stdio/append.h"
|
||||||
|
#include "libc/stdio/rand.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/slice.h"
|
#include "libc/str/slice.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
@ -40,6 +40,7 @@
|
||||||
#include "libc/sysv/consts/tcp.h"
|
#include "libc/sysv/consts/tcp.h"
|
||||||
#include "libc/time/struct/tm.h"
|
#include "libc/time/struct/tm.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
#include "libc/x/xsigaction.h"
|
||||||
#include "net/http/http.h"
|
#include "net/http/http.h"
|
||||||
#include "net/http/url.h"
|
#include "net/http/url.h"
|
||||||
#include "net/https/https.h"
|
#include "net/https/https.h"
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
#include "libc/mem/gc.internal.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
#include "net/http/escape.h"
|
#include "net/http/escape.h"
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/runtime/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/xiso8601.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview ISO-8601 international high-precision timestamp printer.
|
* @fileoverview ISO-8601 international high-precision timestamp printer.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
#include "libc/mem/gc.internal.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "third_party/zlib/zlib.h"
|
#include "third_party/zlib/zlib.h"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/nt/nt/process.h"
|
#include "libc/nt/nt/process.h"
|
||||||
#include "libc/runtime/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/runtime/memtrack.internal.h"
|
#include "libc/runtime/memtrack.internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/rand.h"
|
#include "libc/stdio/rand.h"
|
||||||
|
|
17
examples/gc.c
Normal file
17
examples/gc.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#if 0
|
||||||
|
/*─────────────────────────────────────────────────────────────────╗
|
||||||
|
│ To the extent possible under law, Justine Tunney has waived │
|
||||||
|
│ all copyright and related or neighboring rights to this file, │
|
||||||
|
│ as it is written in the following disclaimers: │
|
||||||
|
│ • http://unlicense.org/ │
|
||||||
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
|
#endif
|
||||||
|
#include "libc/mem/gc.h"
|
||||||
|
#include "libc/mem/mem.h"
|
||||||
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
char *p = _gc(malloc(64));
|
||||||
|
strcpy(p, "this memory is free'd when main() returns");
|
||||||
|
}
|
|
@ -7,20 +7,21 @@
|
||||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/intrin/bits.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
|
#include "libc/intrin/bits.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/nexgen32e/x86feature.h"
|
#include "libc/nexgen32e/x86feature.h"
|
||||||
#include "libc/nt/runtime.h"
|
#include "libc/nt/runtime.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/rand.h"
|
#include "libc/stdio/rand.h"
|
||||||
#include "libc/stdio/xorshift.h"
|
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
|
#include "libc/stdio/xorshift.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/ex.h"
|
#include "libc/sysv/consts/ex.h"
|
||||||
#include "libc/sysv/consts/exit.h"
|
#include "libc/sysv/consts/exit.h"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "libc/calls/struct/timespec.h"
|
#include "libc/calls/struct/timespec.h"
|
||||||
#include "libc/calls/struct/timeval.h"
|
#include "libc/calls/struct/timeval.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/fmt/itoa.h"
|
#include "libc/fmt/itoa.h"
|
||||||
#include "libc/intrin/atomic.h"
|
#include "libc/intrin/atomic.h"
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/sysv/consts/itimer.h"
|
#include "libc/sysv/consts/itimer.h"
|
||||||
#include "libc/sysv/consts/sig.h"
|
#include "libc/sysv/consts/sig.h"
|
||||||
#include "libc/time/time.h"
|
#include "libc/x/xsigaction.h"
|
||||||
#include "libc/x/x.h"
|
|
||||||
|
|
||||||
const struct itimerval kHertz = {
|
const struct itimerval kHertz = {
|
||||||
{1, 0},
|
{1, 0},
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
#endif
|
#endif
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
#include "libc/mem/gc.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
#include "libc/x/xasprintf.h"
|
||||||
#include "net/http/escape.h"
|
#include "net/http/escape.h"
|
||||||
#include "net/http/http.h"
|
#include "net/http/http.h"
|
||||||
#include "third_party/getopt/getopt.h"
|
#include "third_party/getopt/getopt.h"
|
||||||
|
@ -43,15 +45,15 @@ void PrintImg(const char *path) {
|
||||||
size_t n;
|
size_t n;
|
||||||
int opt, i, yn, xn, cn, w, h;
|
int opt, i, yn, xn, cn, w, h;
|
||||||
void *img, *pix, *src, *mime;
|
void *img, *pix, *src, *mime;
|
||||||
if (!(img = gc(xslurp(path, &n)))) exit(2);
|
if (!(img = _gc(xslurp(path, &n)))) exit(2);
|
||||||
if (!(pix = gc(stbi_load_from_memory(img, n, &xn, &yn, &cn, 0)))) exit(3);
|
if (!(pix = _gc(stbi_load_from_memory(img, n, &xn, &yn, &cn, 0)))) exit(3);
|
||||||
if (linktag) {
|
if (linktag) {
|
||||||
printf("<a href=\"%s\"\n >", path);
|
printf("<a href=\"%s\"\n >", path);
|
||||||
}
|
}
|
||||||
src = path;
|
src = path;
|
||||||
if (datauri) {
|
if (datauri) {
|
||||||
src = xasprintf("data:%s;base64,%s", FindContentType(path, -1),
|
src = xasprintf("data:%s;base64,%s", FindContentType(path, -1),
|
||||||
gc(EncodeBase64(img, n, &n)));
|
_gc(EncodeBase64(img, n, &n)));
|
||||||
}
|
}
|
||||||
w = (xn + (1 << scale) / 2) >> scale;
|
w = (xn + (1 << scale) / 2) >> scale;
|
||||||
h = (yn + (1 << scale) / 2) >> scale;
|
h = (yn + (1 << scale) / 2) >> scale;
|
||||||
|
|
|
@ -1,160 +0,0 @@
|
||||||
#if 0
|
|
||||||
/*─────────────────────────────────────────────────────────────────╗
|
|
||||||
│ To the extent possible under law, Justine Tunney has waived │
|
|
||||||
│ all copyright and related or neighboring rights to this file, │
|
|
||||||
│ as it is written in the following disclaimers: │
|
|
||||||
│ • http://unlicense.org/ │
|
|
||||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
|
||||||
#endif
|
|
||||||
#include "libc/mem/alg.h"
|
|
||||||
#include "libc/mem/arraylist.internal.h"
|
|
||||||
#include "libc/mem/critbit0.h"
|
|
||||||
#include "libc/intrin/bits.h"
|
|
||||||
#include "libc/calls/calls.h"
|
|
||||||
#include "libc/fmt/conv.h"
|
|
||||||
#include "libc/log/check.h"
|
|
||||||
#include "libc/log/log.h"
|
|
||||||
#include "libc/macros.internal.h"
|
|
||||||
#include "libc/mem/mem.h"
|
|
||||||
#include "libc/stdio/stdio.h"
|
|
||||||
#include "libc/str/str.h"
|
|
||||||
#include "libc/str/tpdecode.internal.h"
|
|
||||||
#include "libc/sysv/consts/fileno.h"
|
|
||||||
#include "libc/x/x.h"
|
|
||||||
|
|
||||||
STATIC_YOINK("zip_uri_support");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @fileoverview Simple Interactive Spell Checker.
|
|
||||||
*
|
|
||||||
* This is an attempt to get spell checking to work in Emacs across
|
|
||||||
* platforms. While the computer science behind spell checking is very
|
|
||||||
* simple, unfortunately Emacs probes all these System Five spell progs
|
|
||||||
* similar to how websites have been known to probe User-Agent strings.
|
|
||||||
*
|
|
||||||
* Here's how we believe the repl works:
|
|
||||||
*
|
|
||||||
* $ make -j8 o//examples/ispell.com
|
|
||||||
* $ o//examples/ispell.com
|
|
||||||
* @(#) Cosmopolitan Ispell Version 3.4.00 8 Feb 2015
|
|
||||||
* word: hello
|
|
||||||
* ok
|
|
||||||
* word: héllo
|
|
||||||
* how about: hills, hello, hilly, jello
|
|
||||||
* word: lova
|
|
||||||
* how about: diva, dona, dora, dove, elva, fora, hove, iota
|
|
||||||
* word: hecruhecrue
|
|
||||||
* not found
|
|
||||||
*
|
|
||||||
* The dictionary for this program is embedded as a text file within the
|
|
||||||
* zip structure of the binary. It can be edited after distribution.
|
|
||||||
*
|
|
||||||
* It's possible to go even fancier than what this code is doing, by
|
|
||||||
* using cmudict phonemes, bloom filters, unicode tables e.g. e vs. é,
|
|
||||||
* and even doing ML similar to Google's online spell checker.
|
|
||||||
*
|
|
||||||
* TODO: Figure out why Emacs rejects this interface.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MISSING_LETTER_DISTANCE 5
|
|
||||||
#define MAX_NEARBY_WORD_DISTANCE 6
|
|
||||||
#define MAX_NEARBY_RESULTS 8
|
|
||||||
|
|
||||||
FILE *f;
|
|
||||||
char *line;
|
|
||||||
size_t linesize;
|
|
||||||
const char *query;
|
|
||||||
struct critbit0 words; /* does O(log 𝑛) fast path lookup */
|
|
||||||
|
|
||||||
struct NearbyWords {
|
|
||||||
size_t i, n;
|
|
||||||
struct WordMatch {
|
|
||||||
long dist;
|
|
||||||
char *word;
|
|
||||||
} * p;
|
|
||||||
} nearby;
|
|
||||||
|
|
||||||
long WordDistance(const char *a, const char *b) {
|
|
||||||
long dist;
|
|
||||||
int gota, gotb;
|
|
||||||
unsigned long h, p;
|
|
||||||
wint_t chara, charb;
|
|
||||||
dist = p = 0;
|
|
||||||
for (;;) {
|
|
||||||
gota = abs(tpdecode(a, &chara)); /* parses utf-8 multibyte characters */
|
|
||||||
gotb = abs(tpdecode(b, &charb)); /* abs() handles -1, always yields <20> */
|
|
||||||
if (!chara && !charb) break;
|
|
||||||
if (!chara || !charb) {
|
|
||||||
dist += MISSING_LETTER_DISTANCE;
|
|
||||||
} else if ((h = hamming(chara, charb))) {
|
|
||||||
dist += h + p++; /* penalize multiple mismatched letters */
|
|
||||||
}
|
|
||||||
if (chara) a += gota;
|
|
||||||
if (charb) b += gotb;
|
|
||||||
}
|
|
||||||
return dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
intptr_t ConsiderWord(const char *word, void *arg) {
|
|
||||||
long dist;
|
|
||||||
if ((dist = WordDistance(word, query)) < MAX_NEARBY_WORD_DISTANCE) {
|
|
||||||
append(&nearby, &((struct WordMatch){dist, word}));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CompareWords(const struct WordMatch *a, const struct WordMatch *b) {
|
|
||||||
return a->dist < b->dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FindNearbyWords(void) {
|
|
||||||
nearby.i = 0;
|
|
||||||
critbit0_allprefixed(&words, "", ConsiderWord, NULL);
|
|
||||||
qsort(nearby.p, nearby.i, sizeof(struct WordMatch), (void *)CompareWords);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellChecker(void) {
|
|
||||||
int i;
|
|
||||||
printf("@(#) Cosmopolitan Ispell Version 3.4.00 8 Feb 2015\r\n");
|
|
||||||
while (!feof(stdin)) {
|
|
||||||
printf("word: ");
|
|
||||||
fflush(stdout);
|
|
||||||
if (getline(&line, &linesize, stdin) > 0) {
|
|
||||||
query = strtolower(_chomp(line));
|
|
||||||
if (critbit0_contains(&words, query)) {
|
|
||||||
printf("ok\r\n");
|
|
||||||
} else {
|
|
||||||
FindNearbyWords();
|
|
||||||
if (nearby.i) {
|
|
||||||
printf("how about: ");
|
|
||||||
for (i = 0; i < MIN(MAX_NEARBY_RESULTS, nearby.i); ++i) {
|
|
||||||
if (i) printf(", ");
|
|
||||||
fputs(nearby.p[i].word, stdout);
|
|
||||||
}
|
|
||||||
printf("\r\n");
|
|
||||||
} else {
|
|
||||||
printf("not found\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("\r\n");
|
|
||||||
}
|
|
||||||
CHECK_NE(-1, fclose(stdin));
|
|
||||||
CHECK_NE(-1, fclose(stdout));
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadWords(void) {
|
|
||||||
CHECK_NOTNULL((f = fopen("/zip/usr/share/dict/words", "r")));
|
|
||||||
while (getline(&line, &linesize, f) > 0) {
|
|
||||||
critbit0_insert(&words, strtolower(_chomp(line)));
|
|
||||||
}
|
|
||||||
CHECK_NE(-1, fclose(f));
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
if (!NoDebug()) ShowCrashReports();
|
|
||||||
LoadWords();
|
|
||||||
SpellChecker();
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -58,14 +58,14 @@ Contact: antirez@gmail.com\"\n\
|
||||||
#endif
|
#endif
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
#include "libc/mem/alg.h"
|
|
||||||
#include "libc/mem/arraylist2.internal.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/termios.h"
|
#include "libc/calls/termios.h"
|
||||||
#include "libc/calls/weirdtypes.h"
|
#include "libc/calls/weirdtypes.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
|
#include "libc/mem/alg.h"
|
||||||
|
#include "libc/mem/arraylist2.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
|
@ -355,7 +355,7 @@ int getCursorPosition(int64_t ifd, int64_t ofd, int *rows, int *cols) {
|
||||||
* Returns 0 on success, -1 on error. */
|
* Returns 0 on success, -1 on error. */
|
||||||
int getWindowSize(int64_t ifd, int64_t ofd, int *rows, int *cols) {
|
int getWindowSize(int64_t ifd, int64_t ofd, int *rows, int *cols) {
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
if (getttysize(STDOUT_FILENO, &ws) == -1 || ws.ws_col == 0) {
|
if (_getttysize(1, &ws) == -1 || ws.ws_col == 0) {
|
||||||
/* ioctl() failed. Try to query the terminal itself. */
|
/* ioctl() failed. Try to query the terminal itself. */
|
||||||
int orig_row, orig_col, retval;
|
int orig_row, orig_col, retval;
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
#include "libc/calls/struct/dirent.h"
|
#include "libc/calls/struct/dirent.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/runtime/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/dt.h"
|
#include "libc/sysv/consts/dt.h"
|
||||||
#include "libc/sysv/consts/s.h"
|
#include "libc/sysv/consts/s.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/xasprintf.h"
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void List(const char *path) {
|
||||||
const char *vpath;
|
const char *vpath;
|
||||||
if (strcmp(path, ".") == 0) {
|
if (strcmp(path, ".") == 0) {
|
||||||
vpath = "";
|
vpath = "";
|
||||||
} else if (!endswith(path, "/")) {
|
} else if (!_endswith(path, "/")) {
|
||||||
vpath = _gc(xasprintf("%s/", path));
|
vpath = _gc(xasprintf("%s/", path));
|
||||||
} else {
|
} else {
|
||||||
vpath = path;
|
vpath = path;
|
||||||
|
|
|
@ -7,19 +7,20 @@
|
||||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/mem/alg.h"
|
|
||||||
#include "libc/mem/arraylist2.internal.h"
|
|
||||||
#include "libc/intrin/safemacros.internal.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/dirent.h"
|
#include "libc/calls/struct/dirent.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/calls/struct/timespec.h"
|
#include "libc/calls/struct/timespec.h"
|
||||||
|
#include "libc/intrin/safemacros.internal.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
|
#include "libc/mem/alg.h"
|
||||||
|
#include "libc/mem/arraylist2.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/sysv/consts/dt.h"
|
#include "libc/sysv/consts/dt.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
#include "libc/x/xiso8601.h"
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct Files {
|
struct Files {
|
||||||
|
|
|
@ -10,21 +10,21 @@
|
||||||
#include "dsp/tty/itoa8.h"
|
#include "dsp/tty/itoa8.h"
|
||||||
#include "dsp/tty/quant.h"
|
#include "dsp/tty/quant.h"
|
||||||
#include "dsp/tty/tty.h"
|
#include "dsp/tty/tty.h"
|
||||||
#include "libc/mem/arraylist2.internal.h"
|
|
||||||
#include "libc/assert.h"
|
#include "libc/assert.h"
|
||||||
#include "libc/intrin/bits.h"
|
|
||||||
#include "libc/intrin/safemacros.internal.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/itimerval.h"
|
#include "libc/calls/struct/itimerval.h"
|
||||||
#include "libc/calls/struct/winsize.h"
|
#include "libc/calls/struct/winsize.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
|
#include "libc/intrin/bits.h"
|
||||||
|
#include "libc/intrin/safemacros.internal.h"
|
||||||
#include "libc/inttypes.h"
|
#include "libc/inttypes.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
|
#include "libc/mem/arraylist2.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/sock/sock.h"
|
#include "libc/sock/sock.h"
|
||||||
|
@ -39,7 +39,8 @@
|
||||||
#include "libc/sysv/consts/poll.h"
|
#include "libc/sysv/consts/poll.h"
|
||||||
#include "libc/sysv/consts/sig.h"
|
#include "libc/sysv/consts/sig.h"
|
||||||
#include "libc/time/time.h"
|
#include "libc/time/time.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/xasprintf.h"
|
||||||
|
#include "libc/x/xsigaction.h"
|
||||||
#include "libc/zip.h"
|
#include "libc/zip.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
#include "third_party/getopt/getopt.h"
|
#include "third_party/getopt/getopt.h"
|
||||||
|
@ -286,7 +287,7 @@ void GetTermSize(void) {
|
||||||
struct winsize wsize_;
|
struct winsize wsize_;
|
||||||
wsize_.ws_row = 25;
|
wsize_.ws_row = 25;
|
||||||
wsize_.ws_col = 80;
|
wsize_.ws_col = 80;
|
||||||
getttysize(STDIN_FILENO, &wsize_);
|
_getttysize(0, &wsize_);
|
||||||
FreeSamplingSolution(ssy_);
|
FreeSamplingSolution(ssy_);
|
||||||
FreeSamplingSolution(ssx_);
|
FreeSamplingSolution(ssx_);
|
||||||
tyn_ = wsize_.ws_row * 2;
|
tyn_ = wsize_.ws_row * 2;
|
||||||
|
|
|
@ -17,14 +17,15 @@
|
||||||
#include "libc/log/gdb.h"
|
#include "libc/log/gdb.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/mem/gc.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/gc.internal.h"
|
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/sa.h"
|
#include "libc/sysv/consts/sa.h"
|
||||||
#include "libc/sysv/consts/sig.h"
|
#include "libc/sysv/consts/sig.h"
|
||||||
#include "libc/sysv/consts/termios.h"
|
#include "libc/sysv/consts/termios.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
#include "libc/x/xasprintf.h"
|
||||||
#include "tool/build/lib/panel.h"
|
#include "tool/build/lib/panel.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +77,7 @@ void GetTtySize(void) {
|
||||||
struct winsize wsize;
|
struct winsize wsize;
|
||||||
wsize.ws_row = tyn;
|
wsize.ws_row = tyn;
|
||||||
wsize.ws_col = txn;
|
wsize.ws_col = txn;
|
||||||
getttysize(1, &wsize);
|
_getttysize(1, &wsize);
|
||||||
tyn = wsize.ws_row;
|
tyn = wsize.ws_row;
|
||||||
txn = wsize.ws_col;
|
txn = wsize.ws_col;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/rlimit.h"
|
#include "libc/calls/struct/rlimit.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/runtime/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/s.h"
|
#include "libc/sysv/consts/s.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/xiso8601.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview File metadata viewer.
|
* @fileoverview File metadata viewer.
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/stdio/append.internal.h"
|
#include "libc/stdio/append.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
#include "libc/fmt/itoa.h"
|
#include "libc/fmt/itoa.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/ex.h"
|
#include "libc/sysv/consts/ex.h"
|
||||||
#include "libc/time/time.h"
|
#include "libc/time/time.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/xspawn.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview command for showing how long a command takes
|
* @fileoverview command for showing how long a command takes
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/append.internal.h"
|
#include "libc/stdio/append.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/itimer.h"
|
#include "libc/sysv/consts/itimer.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "libc/sysv/consts/o.h"
|
#include "libc/sysv/consts/o.h"
|
||||||
#include "libc/sysv/consts/sig.h"
|
#include "libc/sysv/consts/sig.h"
|
||||||
#include "libc/sysv/consts/termios.h"
|
#include "libc/sysv/consts/termios.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/xsigaction.h"
|
||||||
|
|
||||||
#define CTRL(C) ((C) ^ 0b01000000)
|
#define CTRL(C) ((C) ^ 0b01000000)
|
||||||
#define WRITE(FD, SLIT) write(FD, SLIT, strlen(SLIT))
|
#define WRITE(FD, SLIT) write(FD, SLIT, strlen(SLIT))
|
||||||
|
@ -80,7 +80,7 @@ int rawmode(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void getsize(void) {
|
void getsize(void) {
|
||||||
if (getttysize(1, &wsize) != -1) {
|
if (_getttysize(1, &wsize) != -1) {
|
||||||
printf("termios says terminal size is %hu×%hu\r\n", wsize.ws_col,
|
printf("termios says terminal size is %hu×%hu\r\n", wsize.ws_col,
|
||||||
wsize.ws_row);
|
wsize.ws_row);
|
||||||
} else {
|
} else {
|
||||||
|
@ -148,12 +148,12 @@ int main(int argc, char *argv[]) {
|
||||||
if (iscntrl(code[0]) && !code[1]) {
|
if (iscntrl(code[0]) && !code[1]) {
|
||||||
printf("is CTRL-%c a.k.a. ^%c\r\n", CTRL(code[0]), CTRL(code[0]));
|
printf("is CTRL-%c a.k.a. ^%c\r\n", CTRL(code[0]), CTRL(code[0]));
|
||||||
if (code[0] == CTRL('C') || code[0] == CTRL('D')) break;
|
if (code[0] == CTRL('C') || code[0] == CTRL('D')) break;
|
||||||
} else if (startswith(code, "\e[") && endswith(code, "R")) {
|
} else if (_startswith(code, "\e[") && _endswith(code, "R")) {
|
||||||
yn = 1, xn = 1;
|
yn = 1, xn = 1;
|
||||||
sscanf(code, "\e[%d;%dR", &yn, &xn);
|
sscanf(code, "\e[%d;%dR", &yn, &xn);
|
||||||
printf("inband signalling says terminal size is %d×%d\r\n", xn, yn);
|
printf("inband signalling says terminal size is %d×%d\r\n", xn, yn);
|
||||||
} else if (startswith(code, "\e[<") &&
|
} else if (_startswith(code, "\e[<") &&
|
||||||
(endswith(code, "m") || endswith(code, "M"))) {
|
(_endswith(code, "m") || _endswith(code, "M"))) {
|
||||||
e = 0, y = 1, x = 1;
|
e = 0, y = 1, x = 1;
|
||||||
sscanf(code, "\e[<%d;%d;%d%c", &e, &y, &x, &c);
|
sscanf(code, "\e[<%d;%d;%d%c", &e, &y, &x, &c);
|
||||||
printf("mouse %s at %d×%d\r\n", describemouseevent(e | (c == 'm') << 2),
|
printf("mouse %s at %d×%d\r\n", describemouseevent(e | (c == 'm') << 2),
|
||||||
|
|
|
@ -110,12 +110,11 @@
|
||||||
│ cosmopolitan § the unbourne shell » macros ─╬─│┼
|
│ cosmopolitan § the unbourne shell » macros ─╬─│┼
|
||||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||||
|
|
||||||
#include "libc/mem/alg.h"
|
|
||||||
#include "libc/assert.h"
|
#include "libc/assert.h"
|
||||||
#include "libc/intrin/safemacros.internal.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/dirent.h"
|
#include "libc/calls/struct/dirent.h"
|
||||||
#include "libc/calls/struct/rlimit.h"
|
#include "libc/calls/struct/rlimit.h"
|
||||||
|
#include "libc/calls/struct/rusage.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/calls/struct/tms.h"
|
#include "libc/calls/struct/tms.h"
|
||||||
|
@ -124,9 +123,11 @@
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
|
#include "libc/intrin/safemacros.internal.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/mem/alg.h"
|
||||||
#include "libc/mem/alloca.h"
|
#include "libc/mem/alloca.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/paths.h"
|
#include "libc/paths.h"
|
||||||
|
|
|
@ -68,7 +68,6 @@ int chdir(const char *);
|
||||||
int chmod(const char *, uint32_t);
|
int chmod(const char *, uint32_t);
|
||||||
int chown(const char *, uint32_t, uint32_t);
|
int chown(const char *, uint32_t, uint32_t);
|
||||||
int chroot(const char *);
|
int chroot(const char *);
|
||||||
int clone(void *, void *, size_t, int, void *, int *, void *, int *);
|
|
||||||
int close(int);
|
int close(int);
|
||||||
int close_range(unsigned, unsigned, unsigned);
|
int close_range(unsigned, unsigned, unsigned);
|
||||||
int closefrom(int);
|
int closefrom(int);
|
||||||
|
@ -94,7 +93,6 @@ int fchown(int, uint32_t, uint32_t);
|
||||||
int fchownat(int, const char *, uint32_t, uint32_t, int);
|
int fchownat(int, const char *, uint32_t, uint32_t, int);
|
||||||
int fcntl(int, int, ...);
|
int fcntl(int, int, ...);
|
||||||
int fdatasync(int);
|
int fdatasync(int);
|
||||||
int filecmp(const char *, const char *);
|
|
||||||
int flock(int, int);
|
int flock(int, int);
|
||||||
int fork(void);
|
int fork(void);
|
||||||
int fsync(int);
|
int fsync(int);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/asan.internal.h"
|
#include "libc/calls/asan.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/timespec.internal.h"
|
#include "libc/calls/struct/timespec.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "libc/calls/asan.internal.h"
|
#include "libc/calls/asan.internal.h"
|
||||||
#include "libc/calls/clock_gettime.internal.h"
|
#include "libc/calls/clock_gettime.internal.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/timespec.internal.h"
|
#include "libc/calls/struct/timespec.internal.h"
|
||||||
#include "libc/calls/struct/timeval.h"
|
#include "libc/calls/struct/timeval.h"
|
||||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sock/syscall_fd.internal.h"
|
#include "libc/sock/syscall_fd.internal.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
@ -59,7 +59,7 @@ int close(int fd) {
|
||||||
// file descriptors the way __zipos_open() does need to retry if
|
// file descriptors the way __zipos_open() does need to retry if
|
||||||
// there's indication this race condition happened.
|
// there's indication this race condition happened.
|
||||||
if (__isfdkind(fd, kFdZip)) {
|
if (__isfdkind(fd, kFdZip)) {
|
||||||
rc = weaken(__zipos_close)(fd);
|
rc = _weaken(__zipos_close)(fd);
|
||||||
} else {
|
} else {
|
||||||
if (!IsWindows() && !IsMetal()) {
|
if (!IsWindows() && !IsMetal()) {
|
||||||
rc = sys_close(fd);
|
rc = sys_close(fd);
|
||||||
|
@ -67,9 +67,9 @@ int close(int fd) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else {
|
} else {
|
||||||
if (__isfdkind(fd, kFdEpoll)) {
|
if (__isfdkind(fd, kFdEpoll)) {
|
||||||
rc = weaken(sys_close_epoll_nt)(fd);
|
rc = _weaken(sys_close_epoll_nt)(fd);
|
||||||
} else if (__isfdkind(fd, kFdSocket)) {
|
} else if (__isfdkind(fd, kFdSocket)) {
|
||||||
rc = weaken(sys_closesocket_nt)(g_fds.p + fd);
|
rc = _weaken(sys_closesocket_nt)(g_fds.p + fd);
|
||||||
} else if (__isfdkind(fd, kFdFile) || //
|
} else if (__isfdkind(fd, kFdFile) || //
|
||||||
__isfdkind(fd, kFdConsole) || //
|
__isfdkind(fd, kFdConsole) || //
|
||||||
__isfdkind(fd, kFdProcess)) { //
|
__isfdkind(fd, kFdProcess)) { //
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "libc/intrin/bits.h"
|
#include "libc/intrin/bits.h"
|
||||||
#include "libc/intrin/safemacros.internal.h"
|
#include "libc/intrin/safemacros.internal.h"
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/log/libfatal.internal.h"
|
#include "libc/log/libfatal.internal.h"
|
||||||
|
|
|
@ -110,8 +110,8 @@ static int sys_copyfile(const char *src, const char *dst, int flags) {
|
||||||
* @param flags may have COPYFILE_PRESERVE_TIMESTAMPS, COPYFILE_NOCLOBBER
|
* @param flags may have COPYFILE_PRESERVE_TIMESTAMPS, COPYFILE_NOCLOBBER
|
||||||
* @return 0 on success, or -1 w/ errno
|
* @return 0 on success, or -1 w/ errno
|
||||||
*/
|
*/
|
||||||
int copyfile(const char *src, const char *dst, int flags) {
|
int _copyfile(const char *src, const char *dst, int flags) {
|
||||||
if (!IsWindows() || startswith(src, "/zip/") || startswith(dst, "/zip/")) {
|
if (!IsWindows() || _startswith(src, "/zip/") || _startswith(dst, "/zip/")) {
|
||||||
return sys_copyfile(src, dst, flags);
|
return sys_copyfile(src, dst, flags);
|
||||||
} else {
|
} else {
|
||||||
return sys_copyfile_nt(src, dst, flags);
|
return sys_copyfile_nt(src, dst, flags);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
int copyfile(const char *, const char *, int) paramsnonnull();
|
int _copyfile(const char *, const char *, int) paramsnonnull();
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
|
|
|
@ -80,9 +80,9 @@ textwindows int sys_dup_nt(int oldfd, int newfd, int flags, int start) {
|
||||||
g_fds.p[newfd].mode = g_fds.p[oldfd].mode;
|
g_fds.p[newfd].mode = g_fds.p[oldfd].mode;
|
||||||
g_fds.p[newfd].flags = g_fds.p[oldfd].flags & ~O_CLOEXEC;
|
g_fds.p[newfd].flags = g_fds.p[oldfd].flags & ~O_CLOEXEC;
|
||||||
if (flags & O_CLOEXEC) g_fds.p[newfd].flags |= O_CLOEXEC;
|
if (flags & O_CLOEXEC) g_fds.p[newfd].flags |= O_CLOEXEC;
|
||||||
if (g_fds.p[oldfd].kind == kFdSocket && weaken(_dupsockfd)) {
|
if (g_fds.p[oldfd].kind == kFdSocket && _weaken(_dupsockfd)) {
|
||||||
g_fds.p[newfd].extra =
|
g_fds.p[newfd].extra =
|
||||||
(intptr_t)weaken(_dupsockfd)((struct SockFd *)g_fds.p[oldfd].extra);
|
(intptr_t)_weaken(_dupsockfd)((struct SockFd *)g_fds.p[oldfd].extra);
|
||||||
} else {
|
} else {
|
||||||
g_fds.p[newfd].extra = g_fds.p[oldfd].extra;
|
g_fds.p[newfd].extra = g_fds.p[oldfd].extra;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -20,9 +20,8 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/ntspawn.h"
|
#include "libc/calls/ntspawn.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/mem/alloca.h"
|
#include "libc/mem/alloca.h"
|
||||||
#include "libc/nt/accounting.h"
|
#include "libc/nt/accounting.h"
|
||||||
#include "libc/nt/console.h"
|
#include "libc/nt/console.h"
|
||||||
|
|
|
@ -16,18 +16,18 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/intrin/likely.h"
|
|
||||||
#include "libc/intrin/weaken.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/pledge.h"
|
#include "libc/calls/pledge.h"
|
||||||
#include "libc/calls/pledge.internal.h"
|
#include "libc/calls/pledge.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
|
#include "libc/intrin/likely.h"
|
||||||
#include "libc/intrin/promises.internal.h"
|
#include "libc/intrin/promises.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/log/libfatal.internal.h"
|
#include "libc/log/libfatal.internal.h"
|
||||||
#include "libc/sysv/consts/o.h"
|
#include "libc/sysv/consts/o.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
@ -75,8 +75,8 @@ int execve(const char *prog, char *const argv[], char *const envp[]) {
|
||||||
#endif
|
#endif
|
||||||
if (!IsWindows()) {
|
if (!IsWindows()) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
if (IsLinux() && __execpromises && weaken(sys_pledge_linux)) {
|
if (IsLinux() && __execpromises && _weaken(sys_pledge_linux)) {
|
||||||
rc = weaken(sys_pledge_linux)(__execpromises, __pledge_mode);
|
rc = _weaken(sys_pledge_linux)(__execpromises, __pledge_mode);
|
||||||
}
|
}
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
rc = sys_execve(prog, argv, envp);
|
rc = sys_execve(prog, argv, envp);
|
||||||
|
|
|
@ -16,15 +16,15 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/intrin/weaken.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sysv/consts/at.h"
|
#include "libc/sysv/consts/at.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
|
@ -45,8 +45,8 @@ int faccessat(int dirfd, const char *path, int mode, uint32_t flags) {
|
||||||
int e, rc;
|
int e, rc;
|
||||||
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
||||||
rc = efault();
|
rc = efault();
|
||||||
} else if (weaken(__zipos_notat) &&
|
} else if (_weaken(__zipos_notat) &&
|
||||||
weaken(__zipos_notat)(dirfd, path) == -1) {
|
_weaken(__zipos_notat)(dirfd, path) == -1) {
|
||||||
rc = -1; /* TODO(jart): implement me */
|
rc = -1; /* TODO(jart): implement me */
|
||||||
} else if (!IsWindows()) {
|
} else if (!IsWindows()) {
|
||||||
e = errno;
|
e = errno;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/intrin/weaken.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ int fchmodat(int dirfd, const char *path, uint32_t mode, int flags) {
|
||||||
int rc;
|
int rc;
|
||||||
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
||||||
rc = efault();
|
rc = efault();
|
||||||
} else if (weaken(__zipos_notat) && (rc = __zipos_notat(dirfd, path)) == -1) {
|
} else if (_weaken(__zipos_notat) &&
|
||||||
|
(rc = __zipos_notat(dirfd, path)) == -1) {
|
||||||
rc = eopnotsupp();
|
rc = eopnotsupp();
|
||||||
} else if (!IsWindows()) {
|
} else if (!IsWindows()) {
|
||||||
rc = sys_fchmodat(dirfd, path, mode, flags);
|
rc = sys_fchmodat(dirfd, path, mode, flags);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/sysv/consts/at.h"
|
#include "libc/sysv/consts/at.h"
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/intrin/weaken.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@ int fchownat(int dirfd, const char *path, uint32_t uid, uint32_t gid,
|
||||||
int rc;
|
int rc;
|
||||||
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
||||||
rc = efault();
|
rc = efault();
|
||||||
} else if (weaken(__zipos_notat) && (rc = __zipos_notat(dirfd, path)) == -1) {
|
} else if (_weaken(__zipos_notat) &&
|
||||||
|
(rc = __zipos_notat(dirfd, path)) == -1) {
|
||||||
STRACE("zipos fchownat not supported yet");
|
STRACE("zipos fchownat not supported yet");
|
||||||
} else {
|
} else {
|
||||||
rc = sys_fchownat(dirfd, path, uid, gid, flags);
|
rc = sys_fchownat(dirfd, path, uid, gid, flags);
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
|
@ -61,7 +61,7 @@ int fcntl(int fd, int cmd, ...) {
|
||||||
va_end(va);
|
va_end(va);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
|
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
|
||||||
rc = weaken(__zipos_fcntl)(fd, cmd, arg);
|
rc = _weaken(__zipos_fcntl)(fd, cmd, arg);
|
||||||
} else if (!IsWindows()) {
|
} else if (!IsWindows()) {
|
||||||
rc = sys_fcntl(fd, cmd, arg);
|
rc = sys_fcntl(fd, cmd, arg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -16,9 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/intrin/weaken.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/metastat.internal.h"
|
#include "libc/calls/struct/metastat.internal.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
|
@ -26,6 +24,8 @@
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/nt/files.h"
|
#include "libc/nt/files.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/at.h"
|
#include "libc/sysv/consts/at.h"
|
||||||
|
@ -54,9 +54,9 @@ bool fileexists(const char *path) {
|
||||||
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
if (IsAsan() && !__asan_is_valid(path, 1)) {
|
||||||
efault();
|
efault();
|
||||||
res = false;
|
res = false;
|
||||||
} else if (weaken(__zipos_open) &&
|
} else if (_weaken(__zipos_open) &&
|
||||||
weaken(__zipos_parseuri)(path, &zipname) != -1) {
|
_weaken(__zipos_parseuri)(path, &zipname) != -1) {
|
||||||
if (weaken(__zipos_stat)(&zipname, &st.cosmo) != -1) {
|
if (_weaken(__zipos_stat)(&zipname, &st.cosmo) != -1) {
|
||||||
res = true;
|
res = true;
|
||||||
} else {
|
} else {
|
||||||
res = false;
|
res = false;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,12 +17,13 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/calls/syscall_support-nt.internal.h"
|
#include "libc/calls/syscall_support-nt.internal.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
|
#include "libc/intrin/bsr.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/tpenc.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/nexgen32e/bsr.h"
|
|
||||||
#include "libc/nt/enum/fileflagandattributes.h"
|
#include "libc/nt/enum/fileflagandattributes.h"
|
||||||
#include "libc/nt/enum/fileinfobyhandleclass.h"
|
#include "libc/nt/enum/fileinfobyhandleclass.h"
|
||||||
#include "libc/nt/enum/filetype.h"
|
#include "libc/nt/enum/filetype.h"
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
#include "libc/nt/struct/filecompressioninfo.h"
|
#include "libc/nt/struct/filecompressioninfo.h"
|
||||||
#include "libc/nt/struct/reparsedatabuffer.h"
|
#include "libc/nt/struct/reparsedatabuffer.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/str/tpenc.h"
|
|
||||||
#include "libc/str/utf16.h"
|
#include "libc/str/utf16.h"
|
||||||
#include "libc/sysv/consts/s.h"
|
#include "libc/sysv/consts/s.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
@ -61,7 +61,7 @@ static textwindows uint32_t GetSizeOfReparsePoint(int64_t fh) {
|
||||||
x = 0xfffd;
|
x = 0xfffd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
z += x < 0200 ? 1 : bsrl(tpenc(x)) >> 3;
|
z += x < 0200 ? 1 : _bsrl(_tpenc(x)) >> 3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
STRACE("%s failed %m", "GetSizeOfReparsePoint");
|
STRACE("%s failed %m", "GetSizeOfReparsePoint");
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/stat.internal.h"
|
#include "libc/calls/struct/stat.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/zipos/zipos.internal.h"
|
#include "libc/zipos/zipos.internal.h"
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
int fstat(int fd, struct stat *st) {
|
int fstat(int fd, struct stat *st) {
|
||||||
int rc;
|
int rc;
|
||||||
if (__isfdkind(fd, kFdZip)) {
|
if (__isfdkind(fd, kFdZip)) {
|
||||||
rc = weaken(__zipos_fstat)(
|
rc = _weaken(__zipos_fstat)(
|
||||||
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, st);
|
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, st);
|
||||||
} else if (!IsWindows() && !IsMetal()) {
|
} else if (!IsWindows() && !IsMetal()) {
|
||||||
rc = sys_fstat(fd, st);
|
rc = sys_fstat(fd, st);
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/stat.internal.h"
|
#include "libc/calls/struct/stat.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/fmt/itoa.h"
|
#include "libc/fmt/itoa.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/mem/alloca.h"
|
#include "libc/mem/alloca.h"
|
||||||
|
@ -59,10 +59,10 @@ int fstatat(int dirfd, const char *path, struct stat *st, int flags) {
|
||||||
if (__isfdkind(dirfd, kFdZip)) {
|
if (__isfdkind(dirfd, kFdZip)) {
|
||||||
STRACE("zipos dirfd not supported yet");
|
STRACE("zipos dirfd not supported yet");
|
||||||
rc = einval();
|
rc = einval();
|
||||||
} else if (weaken(__zipos_stat) &&
|
} else if (_weaken(__zipos_stat) &&
|
||||||
weaken(__zipos_parseuri)(path, &zipname) != -1) {
|
_weaken(__zipos_parseuri)(path, &zipname) != -1) {
|
||||||
if (!__vforked) {
|
if (!__vforked) {
|
||||||
rc = weaken(__zipos_stat)(&zipname, st);
|
rc = _weaken(__zipos_stat)(&zipname, st);
|
||||||
} else {
|
} else {
|
||||||
rc = enotsup();
|
rc = enotsup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "libc/calls/struct/statfs.h"
|
#include "libc/calls/struct/statfs.h"
|
||||||
#include "libc/calls/struct/statfs.internal.h"
|
#include "libc/calls/struct/statfs.internal.h"
|
||||||
#include "libc/calls/syscall_support-nt.internal.h"
|
#include "libc/calls/syscall_support-nt.internal.h"
|
||||||
|
#include "libc/intrin/tpenc.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/nt/enum/fsinformationclass.h"
|
#include "libc/nt/enum/fsinformationclass.h"
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
#include "libc/nt/struct/filefsfullsizeinformation.h"
|
#include "libc/nt/struct/filefsfullsizeinformation.h"
|
||||||
#include "libc/nt/struct/iostatusblock.h"
|
#include "libc/nt/struct/iostatusblock.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/str/tpenc.h"
|
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
textwindows int sys_fstatfs_nt(int64_t handle, struct statfs *f) {
|
textwindows int sys_fstatfs_nt(int64_t handle, struct statfs *f) {
|
||||||
|
@ -60,7 +60,7 @@ textwindows int sys_fstatfs_nt(int64_t handle, struct statfs *f) {
|
||||||
return eio();
|
return eio();
|
||||||
}
|
}
|
||||||
for (h = j = i = 0; FileSystemNameBuffer[i]; i++) {
|
for (h = j = i = 0; FileSystemNameBuffer[i]; i++) {
|
||||||
w = tpenc(FileSystemNameBuffer[i]);
|
w = _tpenc(FileSystemNameBuffer[i]);
|
||||||
do {
|
do {
|
||||||
if (j + 1 < sizeof(f->f_fstypename)) {
|
if (j + 1 < sizeof(f->f_fstypename)) {
|
||||||
h = ((unsigned)(w & 255) + h) * 0x9e3779b1u;
|
h = ((unsigned)(w & 255) + h) * 0x9e3779b1u;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/statfs-meta.internal.h"
|
#include "libc/calls/struct/statfs-meta.internal.h"
|
||||||
#include "libc/calls/struct/statfs.internal.h"
|
#include "libc/calls/struct/statfs.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/syscall_support-nt.internal.h"
|
#include "libc/calls/syscall_support-nt.internal.h"
|
||||||
|
#include "libc/intrin/tpenc.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/nt/files.h"
|
#include "libc/nt/files.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/str/tpenc.h"
|
|
||||||
#include "libc/str/utf16.h"
|
#include "libc/str/utf16.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ textwindows char *sys_getcwd_nt(char *buf, size_t size) {
|
||||||
}
|
}
|
||||||
w = x;
|
w = x;
|
||||||
} else {
|
} else {
|
||||||
w = tpenc(x);
|
w = _tpenc(x);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
if (j < size) {
|
if (j < size) {
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/assert.h"
|
#include "libc/assert.h"
|
||||||
#include "libc/intrin/weaken.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/log/backtrace.internal.h"
|
#include "libc/log/backtrace.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
@ -51,10 +51,10 @@ char *getcwd(char *buf, size_t size) {
|
||||||
STRACE("getcwd(%p, %'zu) %m", buf, size);
|
STRACE("getcwd(%p, %'zu) %m", buf, size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (weaken(malloc)) {
|
} else if (_weaken(malloc)) {
|
||||||
assert(!__vforked);
|
assert(!__vforked);
|
||||||
if (!size) size = PATH_MAX;
|
if (!size) size = PATH_MAX;
|
||||||
if (!(p = weaken(malloc)(size))) {
|
if (!(p = _weaken(malloc)(size))) {
|
||||||
STRACE("getcwd(%p, %'zu) %m", buf, size);
|
STRACE("getcwd(%p, %'zu) %m", buf, size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -79,12 +79,12 @@ char *getcwd(char *buf, size_t size) {
|
||||||
}
|
}
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if (weaken(free)) {
|
if (_weaken(free)) {
|
||||||
weaken(free)(p);
|
_weaken(free)(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (weaken(realloc)) {
|
if (_weaken(realloc)) {
|
||||||
if ((p = weaken(realloc)(r, strlen(r) + 1))) {
|
if ((p = _weaken(realloc)(r, strlen(r) + 1))) {
|
||||||
r = p;
|
r = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/metastat.internal.h"
|
#include "libc/calls/struct/metastat.internal.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/nt/enum/fileinfobyhandleclass.h"
|
#include "libc/nt/enum/fileinfobyhandleclass.h"
|
||||||
|
@ -52,7 +52,7 @@ ssize_t getfiledescriptorsize(int fd) {
|
||||||
struct NtFileStandardInformation info;
|
struct NtFileStandardInformation info;
|
||||||
e = errno;
|
e = errno;
|
||||||
if (__isfdkind(fd, kFdZip)) {
|
if (__isfdkind(fd, kFdZip)) {
|
||||||
if (weaken(__zipos_fstat)(
|
if (_weaken(__zipos_fstat)(
|
||||||
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, &st.cosmo) !=
|
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, &st.cosmo) !=
|
||||||
-1) {
|
-1) {
|
||||||
rc = st.cosmo.st_size;
|
rc = st.cosmo.st_size;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall_support-sysv.internal.h"
|
#include "libc/calls/syscall_support-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/itimerval.h"
|
#include "libc/calls/struct/itimerval.h"
|
||||||
#include "libc/calls/struct/itimerval.internal.h"
|
#include "libc/calls/struct/itimerval.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/sysinfo.h"
|
#include "libc/calls/struct/sysinfo.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/rlimit.internal.h"
|
#include "libc/calls/struct/rlimit.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/rusage.h"
|
#include "libc/calls/struct/rusage.h"
|
||||||
#include "libc/calls/struct/rusage.internal.h"
|
#include "libc/calls/struct/rusage.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/assert.h"
|
#include "libc/assert.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/itimerval.internal.h"
|
#include "libc/calls/struct/itimerval.internal.h"
|
||||||
#include "libc/calls/struct/timeval.h"
|
#include "libc/calls/struct/timeval.h"
|
||||||
#include "libc/calls/struct/timeval.internal.h"
|
#include "libc/calls/struct/timeval.internal.h"
|
||||||
|
|
|
@ -16,13 +16,11 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/ioctl.h"
|
||||||
#include "libc/calls/termios.h"
|
#include "libc/calls/struct/winsize.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/intrin/safemacros.internal.h"
|
#include "libc/intrin/safemacros.internal.h"
|
||||||
#include "libc/log/internal.h"
|
#include "libc/log/internal.h"
|
||||||
#include "libc/log/log.h"
|
|
||||||
#include "libc/runtime/runtime.h"
|
|
||||||
#include "libc/sysv/consts/termios.h"
|
#include "libc/sysv/consts/termios.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +32,7 @@
|
||||||
* @param out stores determined dimensions, only on success
|
* @param out stores determined dimensions, only on success
|
||||||
* @returns -1 on error or something else on success
|
* @returns -1 on error or something else on success
|
||||||
*/
|
*/
|
||||||
int getttysize(int fd, struct winsize *out) {
|
int _getttysize(int fd, struct winsize *out) {
|
||||||
if (__nocolor) {
|
if (__nocolor) {
|
||||||
out->ws_col = atoi(firstnonnull(getenv("COLUMNS"), "80"));
|
out->ws_col = atoi(firstnonnull(getenv("COLUMNS"), "80"));
|
||||||
out->ws_row = atoi(firstnonnull(getenv("ROWS"), "40"));
|
out->ws_row = atoi(firstnonnull(getenv("ROWS"), "40"));
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/sig.internal.h"
|
#include "libc/calls/sig.internal.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/fd.internal.h"
|
#include "libc/calls/struct/fd.internal.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/calls/syscall_support-nt.internal.h"
|
#include "libc/calls/syscall_support-nt.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/lockcmpxchgp.h"
|
#include "libc/intrin/lockcmpxchgp.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/thread/tls.h"
|
#include "libc/thread/tls.h"
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ textwindows bool _check_interrupts(bool restartable, struct Fd *fd) {
|
||||||
bool res;
|
bool res;
|
||||||
if (__time_critical) return false;
|
if (__time_critical) return false;
|
||||||
if (__threaded && __threaded != gettid()) return false;
|
if (__threaded && __threaded != gettid()) return false;
|
||||||
if (weaken(_check_sigalrm)) weaken(_check_sigalrm)();
|
if (_weaken(_check_sigalrm)) _weaken(_check_sigalrm)();
|
||||||
if (weaken(_check_sigchld)) weaken(_check_sigchld)();
|
if (_weaken(_check_sigchld)) _weaken(_check_sigchld)();
|
||||||
if (fd && weaken(_check_sigwinch)) weaken(_check_sigwinch)(fd);
|
if (fd && _weaken(_check_sigwinch)) _weaken(_check_sigwinch)(fd);
|
||||||
res = weaken(__sig_check) && weaken(__sig_check)(restartable);
|
res = _weaken(__sig_check) && _weaken(__sig_check)(restartable);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,10 @@ int ioctl_default(int fd, uint64_t request, ...) {
|
||||||
} else if (__isfdopen(fd)) {
|
} else if (__isfdopen(fd)) {
|
||||||
if (g_fds.p[fd].kind == kFdSocket) {
|
if (g_fds.p[fd].kind == kFdSocket) {
|
||||||
handle = __getfdhandleactual(fd);
|
handle = __getfdhandleactual(fd);
|
||||||
if ((rc = weaken(__sys_ioctlsocket_nt)(handle, request, arg)) != -1) {
|
if ((rc = _weaken(__sys_ioctlsocket_nt)(handle, request, arg)) != -1) {
|
||||||
return rc;
|
return rc;
|
||||||
} else {
|
} else {
|
||||||
return weaken(__winsockerr)();
|
return _weaken(__winsockerr)();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return eopnotsupp();
|
return eopnotsupp();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/ioctl.h"
|
#include "libc/calls/ioctl.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/sysv/consts/o.h"
|
#include "libc/sysv/consts/o.h"
|
||||||
|
|
|
@ -53,10 +53,10 @@ struct HostAdapterInfoNode {
|
||||||
/* Frees all the nodes of the _hostInfo */
|
/* Frees all the nodes of the _hostInfo */
|
||||||
static void freeHostInfo(void) {
|
static void freeHostInfo(void) {
|
||||||
struct HostAdapterInfoNode *next, *node = __hostInfo;
|
struct HostAdapterInfoNode *next, *node = __hostInfo;
|
||||||
if (weaken(free)) {
|
if (_weaken(free)) {
|
||||||
while (node) {
|
while (node) {
|
||||||
next = node->next;
|
next = node->next;
|
||||||
weaken(free)(node);
|
_weaken(free)(node);
|
||||||
node = next;
|
node = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ struct HostAdapterInfoNode *appendHostInfo(
|
||||||
struct sockaddr_in *a;
|
struct sockaddr_in *a;
|
||||||
int attemptNum;
|
int attemptNum;
|
||||||
|
|
||||||
if (!weaken(calloc) || !(node = weaken(calloc)(1, sizeof(*node)))) {
|
if (!_weaken(calloc) || !(node = _weaken(calloc)(1, sizeof(*node)))) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -143,8 +143,8 @@ struct HostAdapterInfoNode *appendHostInfo(
|
||||||
|
|
||||||
if (attemptNum == MAX_NAME_CLASH) {
|
if (attemptNum == MAX_NAME_CLASH) {
|
||||||
/* Cannot resolve the conflict */
|
/* Cannot resolve the conflict */
|
||||||
if (weaken(free)) {
|
if (_weaken(free)) {
|
||||||
weaken(free)(node);
|
_weaken(free)(node);
|
||||||
}
|
}
|
||||||
errno = EEXIST;
|
errno = EEXIST;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -315,8 +315,8 @@ static int readAdapterAddresses(void) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!weaken(malloc) ||
|
if (!_weaken(malloc) ||
|
||||||
!(aa = (struct NtIpAdapterAddresses *)weaken(malloc)(size))) {
|
!(aa = (struct NtIpAdapterAddresses *)_weaken(malloc)(size))) {
|
||||||
enomem();
|
enomem();
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -336,14 +336,14 @@ static int readAdapterAddresses(void) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weaken(free)) {
|
if (_weaken(free)) {
|
||||||
weaken(free)(aa);
|
_weaken(free)(aa);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (weaken(free)) {
|
if (_weaken(free)) {
|
||||||
weaken(free)(aa);
|
_weaken(free)(aa);
|
||||||
}
|
}
|
||||||
freeHostInfo();
|
freeHostInfo();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/assert.h"
|
#include "libc/assert.h"
|
||||||
#include "libc/calls/ioctl.h"
|
#include "libc/calls/ioctl.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/bits.h"
|
#include "libc/intrin/bits.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
|
@ -63,9 +63,9 @@ static int ioctl_siocgifconf_sysv(int fd, struct ifconf *ifc) {
|
||||||
uint32_t bufLen, ip;
|
uint32_t bufLen, ip;
|
||||||
size_t numReq, bufMax;
|
size_t numReq, bufMax;
|
||||||
if (IsLinux()) return sys_ioctl(fd, SIOCGIFCONF, ifc);
|
if (IsLinux()) return sys_ioctl(fd, SIOCGIFCONF, ifc);
|
||||||
if (!weaken(malloc)) return enomem();
|
if (!_weaken(malloc)) return enomem();
|
||||||
bufMax = 15000; /* conservative guesstimate */
|
bufMax = 15000; /* conservative guesstimate */
|
||||||
if (!(b = weaken(malloc)(bufMax))) return enomem();
|
if (!(b = _weaken(malloc)(bufMax))) return enomem();
|
||||||
memcpy(ifcBsd, &bufMax, 8); /* ifc_len */
|
memcpy(ifcBsd, &bufMax, 8); /* ifc_len */
|
||||||
memcpy(ifcBsd + (IsXnu() ? 4 : 8), &b, 8); /* ifc_buf */
|
memcpy(ifcBsd + (IsXnu() ? 4 : 8), &b, 8); /* ifc_buf */
|
||||||
if ((rc = sys_ioctl(fd, SIOCGIFCONF, &ifcBsd)) != -1) {
|
if ((rc = sys_ioctl(fd, SIOCGIFCONF, &ifcBsd)) != -1) {
|
||||||
|
@ -92,7 +92,7 @@ static int ioctl_siocgifconf_sysv(int fd, struct ifconf *ifc) {
|
||||||
}
|
}
|
||||||
ifc->ifc_len = (char *)req - ifc->ifc_buf; /* Adjust len */
|
ifc->ifc_len = (char *)req - ifc->ifc_buf; /* Adjust len */
|
||||||
}
|
}
|
||||||
if (weaken(free)) weaken(free)(b);
|
if (_weaken(free)) _weaken(free)(b);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/ioctl.h"
|
#include "libc/calls/ioctl.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/metatermios.internal.h"
|
#include "libc/calls/struct/metatermios.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/calls/termios.internal.h"
|
#include "libc/calls/termios.internal.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/metatermios.internal.h"
|
#include "libc/calls/struct/metatermios.internal.h"
|
||||||
#include "libc/calls/termios.internal.h"
|
#include "libc/calls/termios.internal.h"
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/ioctl.h"
|
#include "libc/calls/ioctl.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/metatermios.internal.h"
|
#include "libc/calls/struct/metatermios.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
#include "libc/calls/termios.internal.h"
|
#include "libc/calls/termios.internal.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/nomultics.internal.h"
|
#include "libc/intrin/nomultics.internal.h"
|
||||||
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/sysv/consts/termios.h"
|
#include "libc/sysv/consts/termios.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
@ -72,9 +72,9 @@ int ioctl_tcsets(int fd, uint64_t request, ...) {
|
||||||
va_start(va, request);
|
va_start(va, request);
|
||||||
tio = va_arg(va, const struct termios *);
|
tio = va_arg(va, const struct termios *);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
if (weaken(__on_ioctl_tcsets)) {
|
if (_weaken(__on_ioctl_tcsets)) {
|
||||||
if (!once) {
|
if (!once) {
|
||||||
weaken(__on_ioctl_tcsets)();
|
_weaken(__on_ioctl_tcsets)();
|
||||||
once = true;
|
once = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,12 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/state.internal.h"
|
#include "libc/calls/state.internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
|
||||||
#include "libc/calls/struct/fd.internal.h"
|
#include "libc/calls/struct/fd.internal.h"
|
||||||
#include "libc/calls/struct/termios.h"
|
#include "libc/calls/struct/termios.h"
|
||||||
#include "libc/calls/struct/winsize.h"
|
#include "libc/calls/struct/winsize.h"
|
||||||
#include "libc/calls/syscall_support-nt.internal.h"
|
#include "libc/calls/syscall_support-nt.internal.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/nt/console.h"
|
#include "libc/nt/console.h"
|
||||||
#include "libc/nt/enum/startf.h"
|
#include "libc/nt/enum/startf.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/ioctl.h"
|
#include "libc/calls/ioctl.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/winsize.h"
|
#include "libc/calls/struct/winsize.h"
|
||||||
#include "libc/calls/struct/winsize.internal.h"
|
#include "libc/calls/struct/winsize.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/calls/struct/winsize.h"
|
#include "libc/calls/struct/winsize.h"
|
||||||
#include "libc/calls/syscall-nt.internal.h"
|
#include "libc/calls/syscall-nt.internal.h"
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.h"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue