mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-23 14:39:02 +00:00
Run clang-format (#1197)
This commit is contained in:
parent
ea081b262c
commit
f032b5570b
183 changed files with 1074 additions and 983 deletions
ape
dsp
examples
libc
calls
cp.internal.hdup.cdup2.cioctl.cisapemagic.clinkat.cmkdirat.copenat-metal.crenameat.cttyname.cunlinkat.c
elf
fmt
intrin
irq
iso646.internal.hisystem
log
macros.internal.hnexgen32e
nt
enum
consolemodeflags.hconsoleselectionflags.hcreationdisposition.hctrlevent.hexceptionhandleractions.hfileinformationclass.hfilesharemode.hfillattribute.hfsinformationclass.hkwaitreason.hprocessaccess.hprocthreadattributes.hsecurityinformation.hstartf.hsysteminformationclass.hthreadaccess.htokeninformationclass.h
struct
runtime
sock
stdio
str
sysv/consts
|
@ -132,7 +132,7 @@
|
||||||
#define SHSTUB2(SYM, X) \
|
#define SHSTUB2(SYM, X) \
|
||||||
HIDDEN(SYM##_bcs0 = BCD_LEFT(X)); \
|
HIDDEN(SYM##_bcs0 = BCD_LEFT(X)); \
|
||||||
HIDDEN(SYM##_bcs1 = BCD_RIGHT(X))
|
HIDDEN(SYM##_bcs1 = BCD_RIGHT(X))
|
||||||
#define BCD_SMEAR(X) ((X) + (X) * 10000)
|
#define BCD_SMEAR(X) ((X) + (X)*10000)
|
||||||
#define BCD_LEFT(X) \
|
#define BCD_LEFT(X) \
|
||||||
(((X)) < 10000 ? BCD_RIGHT(BCD_SMEAR(X)) | 0x10 \
|
(((X)) < 10000 ? BCD_RIGHT(BCD_SMEAR(X)) | 0x10 \
|
||||||
: (X) < 100000 ? BCD_RIGHT(BCD_SMEAR((X) / 10)) \
|
: (X) < 100000 ? BCD_RIGHT(BCD_SMEAR((X) / 10)) \
|
||||||
|
@ -140,23 +140,16 @@
|
||||||
: (X) < 10000000 ? BCD_RIGHT(BCD_SMEAR((X) / 1000)) \
|
: (X) < 10000000 ? BCD_RIGHT(BCD_SMEAR((X) / 1000)) \
|
||||||
: (X) < 100000000 ? BCD_RIGHT(BCD_SMEAR((X) / 10000)) \
|
: (X) < 100000000 ? BCD_RIGHT(BCD_SMEAR((X) / 10000)) \
|
||||||
: 0xffffffffffffffff)
|
: 0xffffffffffffffff)
|
||||||
#define BCD_RIGHT(X) \
|
#define BCD_RIGHT(X) \
|
||||||
(((X)) < 10000 ? 0x20202020 \
|
(((X)) < 10000 ? 0x20202020 \
|
||||||
: (X) < 100000 ? 0x20202030 + \
|
: (X) < 100000 ? 0x20202030 + (X) % 10 \
|
||||||
(X) % 10 \
|
: (X) < 1000000 ? 0x20203030 + ((X) / 10) % 10 + (X) % 10 * 0x100 \
|
||||||
: (X) < 1000000 ? 0x20203030 + \
|
: (X) < 10000000 ? 0x20303030 + ((X) / 100) % 10 + \
|
||||||
((X) / 10) % 10 + \
|
((X) / 10) % 10 * 0x100 + (X) % 10 * 0x10000 \
|
||||||
(X) % 10 * 0x100 \
|
: (X) < 100000000 \
|
||||||
: (X) < 10000000 ? 0x20303030 + \
|
? 0x30303030 + ((X) / 1000) % 10 + ((X) / 100) % 10 * 0x100 + \
|
||||||
((X) / 100) % 10 + \
|
((X) / 10) % 10 * 0x10000 + (X) % 10 * 0x1000000 \
|
||||||
((X) / 10) % 10 * 0x100 + \
|
: 0xffffffffffffffff)
|
||||||
(X) % 10 * 0x10000 \
|
|
||||||
: (X) < 100000000 ? 0x30303030 + \
|
|
||||||
((X) / 1000) % 10 + \
|
|
||||||
((X) / 100) % 10 * 0x100 + \
|
|
||||||
((X) / 10) % 10 * 0x10000 + \
|
|
||||||
(X) % 10 * 0x1000000 \
|
|
||||||
: 0xffffffffffffffff)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Laying out the GDT entries for a TSS for bare metal operation.
|
* Laying out the GDT entries for a TSS for bare metal operation.
|
||||||
|
@ -165,15 +158,11 @@
|
||||||
HIDDEN(SYM##_desc_ent0 = TSSDESC_ENT0(BASE, LIM)); \
|
HIDDEN(SYM##_desc_ent0 = TSSDESC_ENT0(BASE, LIM)); \
|
||||||
HIDDEN(SYM##_desc_ent1 = TSSDESC_ENT1(BASE)); \
|
HIDDEN(SYM##_desc_ent1 = TSSDESC_ENT1(BASE)); \
|
||||||
ASSERT((LIM) >= 0 && (LIM) <= 0xffff, "bare metal TSS is suspiciously fat")
|
ASSERT((LIM) >= 0 && (LIM) <= 0xffff, "bare metal TSS is suspiciously fat")
|
||||||
#define TSSDESC_ENT0(BASE, LIM) \
|
#define TSSDESC_ENT0(BASE, LIM) \
|
||||||
(((LIM) << 0 & 0x000000000000ffff) | \
|
(((LIM) << 0 & 0x000000000000ffff) | ((BASE) << 16 & 0x000000ffffff0000) | \
|
||||||
((BASE) << 16 & 0x000000ffffff0000) | \
|
0x89 << 40 | ((LIM) >> 16 << 48 & 0x000f000000000000) | 0x2 << 52 | \
|
||||||
0x89 << 40 | \
|
|
||||||
((LIM) >> 16 << 48 & 0x000f000000000000) | \
|
|
||||||
0x2 << 52 | \
|
|
||||||
((BASE) >> 24 << 56 & 0xff00000000000000))
|
((BASE) >> 24 << 56 & 0xff00000000000000))
|
||||||
#define TSSDESC_ENT1(BASE) \
|
#define TSSDESC_ENT1(BASE) ((BASE) >> 32 << 0 & 0x00000000ffffffff)
|
||||||
((BASE) >> 32 << 0 & 0x00000000ffffffff)
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLER__ */
|
#endif /* __ASSEMBLER__ */
|
||||||
#endif /* APE_MACROS_H_ */
|
#endif /* APE_MACROS_H_ */
|
||||||
|
|
|
@ -9,8 +9,8 @@ int mulaw(int);
|
||||||
int unmulaw(int);
|
int unmulaw(int);
|
||||||
void *double2byte(long, const void *, double, double) vallocesque;
|
void *double2byte(long, const void *, double, double) vallocesque;
|
||||||
void *byte2double(long, const void *, double, double) vallocesque;
|
void *byte2double(long, const void *, double, double) vallocesque;
|
||||||
void *dct(float[restrict hasatleast 8][8], unsigned,
|
void *dct(float[restrict hasatleast 8][8], unsigned, float, float, float, float,
|
||||||
float, float, float, float, float);
|
float);
|
||||||
void *dctjpeg(float[restrict hasatleast 8][8], unsigned);
|
void *dctjpeg(float[restrict hasatleast 8][8], unsigned);
|
||||||
double det3(const double[3][3]) nosideeffect;
|
double det3(const double[3][3]) nosideeffect;
|
||||||
void *inv3(double[restrict 3][3], const double[restrict 3][3], double);
|
void *inv3(double[restrict 3][3], const double[restrict 3][3], double);
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
*
|
*
|
||||||
* @cost ~100ns
|
* @cost ~100ns
|
||||||
*/
|
*/
|
||||||
void *dct(float M[restrict hasatleast 8][8], unsigned stride,
|
void *dct(float M[restrict hasatleast 8][8], unsigned stride, float c0,
|
||||||
float c0, float c1, float c2, float c3, float c4) {
|
float c1, float c2, float c3, float c4) {
|
||||||
unsigned y, x;
|
unsigned y, x;
|
||||||
for (y = 0; y < stride * 8; y += stride) {
|
for (y = 0; y < stride * 8; y += stride) {
|
||||||
DCT(M[y][0], M[y][1], M[y][2], M[y][3], M[y][4], M[y][5], M[y][6], M[y][7],
|
DCT(M[y][0], M[y][1], M[y][2], M[y][3], M[y][4], M[y][5], M[y][6], M[y][7],
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
│ 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 "dsp/core/core.h"
|
|
||||||
#include "dsp/core/gamma.h"
|
#include "dsp/core/gamma.h"
|
||||||
|
#include "dsp/core/core.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
|
|
||||||
double rgb2stdpc(double x, double g) {
|
double rgb2stdpc(double x, double g) {
|
||||||
|
|
|
@ -64,7 +64,8 @@ forceinline bool plm_buffer_has(plm_buffer_t *b, size_t bits) {
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline int plm_buffer_read(plm_buffer_t *self, int count) {
|
forceinline int plm_buffer_read(plm_buffer_t *self, int count) {
|
||||||
if (!plm_buffer_has(self, count)) return 0;
|
if (!plm_buffer_has(self, count))
|
||||||
|
return 0;
|
||||||
int value = 0;
|
int value = 0;
|
||||||
while (count) {
|
while (count) {
|
||||||
int current_byte = self->bytes[self->bit_index >> 3];
|
int current_byte = self->bytes[self->bit_index >> 3];
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include "dsp/mpeg/mpeg.h"
|
#include "dsp/mpeg/mpeg.h"
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
#define START_PACK 0xBA
|
#define START_PACK 0xBA
|
||||||
#define START_END 0xB9
|
#define START_END 0xB9
|
||||||
#define START_SYSTEM 0xBB
|
#define START_SYSTEM 0xBB
|
||||||
|
|
||||||
typedef struct plm_demux_t {
|
typedef struct plm_demux_t {
|
||||||
|
|
|
@ -24,9 +24,13 @@
|
||||||
* The alternate buffer trick lets one restore the console exactly as it
|
* The alternate buffer trick lets one restore the console exactly as it
|
||||||
* was, once the program is done running.
|
* was, once the program is done running.
|
||||||
*/
|
*/
|
||||||
int ttyenablealtbuf(int ttyfd) { return ttysend(ttyfd, "\e[?1049h"); }
|
int ttyenablealtbuf(int ttyfd) {
|
||||||
|
return ttysend(ttyfd, "\e[?1049h");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks teletypewriter to restore blinking box thing.
|
* Asks teletypewriter to restore blinking box thing.
|
||||||
*/
|
*/
|
||||||
int ttydisablealtbuf(int ttyfd) { return ttysend(ttyfd, "\e[?1049l"); }
|
int ttydisablealtbuf(int ttyfd) {
|
||||||
|
return ttysend(ttyfd, "\e[?1049l");
|
||||||
|
}
|
||||||
|
|
|
@ -21,9 +21,13 @@
|
||||||
/**
|
/**
|
||||||
* Asks teletypewriter to push current position.
|
* Asks teletypewriter to push current position.
|
||||||
*/
|
*/
|
||||||
int ttysavecursor(int ttyfd) { return ttysend(ttyfd, "\e[s"); }
|
int ttysavecursor(int ttyfd) {
|
||||||
|
return ttysend(ttyfd, "\e[s");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks teletypewriter to pop previous position.
|
* Asks teletypewriter to pop previous position.
|
||||||
*/
|
*/
|
||||||
int ttyrestorecursor(int ttyfd) { return ttysend(ttyfd, "\e[u"); }
|
int ttyrestorecursor(int ttyfd) {
|
||||||
|
return ttysend(ttyfd, "\e[u");
|
||||||
|
}
|
||||||
|
|
|
@ -39,8 +39,12 @@ static char *setansibgfg(char *p, unsigned bg, unsigned fg) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *setbg16_(char *p, struct TtyRgb bg) { return setansibgfg(p, bg.xt, -1u); }
|
char *setbg16_(char *p, struct TtyRgb bg) {
|
||||||
char *setfg16_(char *p, struct TtyRgb fg) { return setansibgfg(p, -1u, fg.xt); }
|
return setansibgfg(p, bg.xt, -1u);
|
||||||
|
}
|
||||||
|
char *setfg16_(char *p, struct TtyRgb fg) {
|
||||||
|
return setansibgfg(p, -1u, fg.xt);
|
||||||
|
}
|
||||||
char *setbgfg16_(char *p, struct TtyRgb bg, struct TtyRgb fg) {
|
char *setbgfg16_(char *p, struct TtyRgb bg, struct TtyRgb fg) {
|
||||||
return setansibgfg(p, bg.xt, fg.xt);
|
return setansibgfg(p, bg.xt, fg.xt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "libc/stdio/stdio.h"
|
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
#include "libc/stdio/stdio.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
fprintf(stderr, "%s (%s)\n", argv[0], GetProgramExecutableName());
|
fprintf(stderr, "%s (%s)\n", argv[0], GetProgramExecutableName());
|
||||||
for (char **p = environ; *p; ++p) {
|
for (char** p = environ; *p; ++p) {
|
||||||
printf("%s\n", *p);
|
printf("%s\n", *p);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||||
╚─────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────*/
|
||||||
#endif
|
#endif
|
||||||
#include "libc/runtime/runtime.h"
|
#include "third_party/hiredis/hiredis.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.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"
|
||||||
#include "third_party/hiredis/hiredis.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview Demo of using hiredis to connect to a Redis server
|
* @fileoverview Demo of using hiredis to connect to a Redis server
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define PARSE_AND_PRINT(type, scan_fmt, print_fmt, str) \
|
#define PARSE_AND_PRINT(type, scan_fmt, print_fmt, str) \
|
||||||
do { \
|
do { \
|
||||||
type val; int ret; \
|
type val; \
|
||||||
ret = sscanf(str, scan_fmt, &val); \
|
int ret; \
|
||||||
printf("\"%s\" => " print_fmt " = %d\n", str, val, ret); \
|
ret = sscanf(str, scan_fmt, &val); \
|
||||||
|
printf("\"%s\" => " print_fmt " = %d\n", str, val, ret); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
int main()
|
int main() {
|
||||||
{
|
PARSE_AND_PRINT(float, "%f", "%f", "0.3715");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "0.3715");
|
PARSE_AND_PRINT(float, "%f", "%f", ".3715");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", ".3715");
|
PARSE_AND_PRINT(float, "%f", "%f", "3715");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "3715");
|
PARSE_AND_PRINT(float, "%f", "%f", "111.11");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "111.11");
|
PARSE_AND_PRINT(float, "%f", "%f", "-2.22");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "-2.22");
|
PARSE_AND_PRINT(float, "%f", "%f", "Nan");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "Nan");
|
PARSE_AND_PRINT(float, "%f", "%f", "nAn(2)");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "nAn(2)");
|
PARSE_AND_PRINT(float, "%f", "%f", "-NAN(_asdfZXCV1234_)");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "-NAN(_asdfZXCV1234_)");
|
PARSE_AND_PRINT(float, "%f", "%f", "-nan");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "-nan");
|
PARSE_AND_PRINT(float, "%f", "%f", "+nan");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "+nan");
|
PARSE_AND_PRINT(float, "%f", "%f", "inF");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "inF");
|
PARSE_AND_PRINT(float, "%f", "%f", "iNfINiTy");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "iNfINiTy");
|
PARSE_AND_PRINT(float, "%f", "%f", "+inf");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "+inf");
|
PARSE_AND_PRINT(float, "%f", "%f", "-inf");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "-inf");
|
PARSE_AND_PRINT(float, "%f", "%f", "0X1.BC70A3D70A3D7P+6");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "0X1.BC70A3D70A3D7P+6");
|
PARSE_AND_PRINT(float, "%f", "%f", "1.18973e+4932zzz");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "1.18973e+4932zzz");
|
PARSE_AND_PRINT(float, "%f", "%.10f", " -0.0000000123junk");
|
||||||
PARSE_AND_PRINT(float, "%f", "%.10f", " -0.0000000123junk");
|
PARSE_AND_PRINT(float, "%f", "%f", "junk");
|
||||||
PARSE_AND_PRINT(float, "%f", "%f", "junk");
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2601,7 +2601,8 @@ static int shlex() {
|
||||||
case 'y':
|
case 'y':
|
||||||
case 'z':
|
case 'z':
|
||||||
p = buf;
|
p = buf;
|
||||||
while (buf++, is_in_name(*buf));
|
while (buf++, is_in_name(*buf))
|
||||||
|
;
|
||||||
yylval.name = stalloc(buf - p + 1);
|
yylval.name = stalloc(buf - p + 1);
|
||||||
*(char *)mempcpy(yylval.name, p, buf - p) = 0;
|
*(char *)mempcpy(yylval.name, p, buf - p) = 0;
|
||||||
value = ARITH_VAR;
|
value = ARITH_VAR;
|
||||||
|
@ -7757,7 +7758,8 @@ static int ulimitcmd(int argc, char **argv) {
|
||||||
what = optc;
|
what = optc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (l = limits; l->option != what; l++);
|
for (l = limits; l->option != what; l++)
|
||||||
|
;
|
||||||
set = *argptr ? 1 : 0;
|
set = *argptr ? 1 : 0;
|
||||||
if (set) {
|
if (set) {
|
||||||
char *p = *argptr;
|
char *p = *argptr;
|
||||||
|
@ -7986,7 +7988,8 @@ static void setparam(char **argv) {
|
||||||
char **newparam;
|
char **newparam;
|
||||||
char **ap;
|
char **ap;
|
||||||
int nparam;
|
int nparam;
|
||||||
for (nparam = 0; argv[nparam]; nparam++);
|
for (nparam = 0; argv[nparam]; nparam++)
|
||||||
|
;
|
||||||
ap = newparam = ckmalloc((nparam + 1) * sizeof *ap);
|
ap = newparam = ckmalloc((nparam + 1) * sizeof *ap);
|
||||||
while (*argv) {
|
while (*argv) {
|
||||||
*ap++ = savestr(*argv++);
|
*ap++ = savestr(*argv++);
|
||||||
|
@ -8664,7 +8667,8 @@ static void parsefname(void) {
|
||||||
if (heredoclist == NULL)
|
if (heredoclist == NULL)
|
||||||
heredoclist = here;
|
heredoclist = here;
|
||||||
else {
|
else {
|
||||||
for (p = heredoclist; p->next; p = p->next);
|
for (p = heredoclist; p->next; p = p->next)
|
||||||
|
;
|
||||||
p->next = here;
|
p->next = here;
|
||||||
}
|
}
|
||||||
} else if (n->type == NTOFD || n->type == NFROMFD) {
|
} else if (n->type == NTOFD || n->type == NFROMFD) {
|
||||||
|
@ -8788,7 +8792,8 @@ static int xxreadtoken(void) {
|
||||||
case '\t':
|
case '\t':
|
||||||
continue;
|
continue;
|
||||||
case '#':
|
case '#':
|
||||||
while ((c = pgetc()) != '\n' && c != PEOF);
|
while ((c = pgetc()) != '\n' && c != PEOF)
|
||||||
|
;
|
||||||
pungetc();
|
pungetc();
|
||||||
continue;
|
continue;
|
||||||
case '\n':
|
case '\n':
|
||||||
|
@ -8912,7 +8917,7 @@ static int readtoken1(int firstc, char const *syntax, char *eofmark,
|
||||||
quotef = 0;
|
quotef = 0;
|
||||||
bqlist = NULL;
|
bqlist = NULL;
|
||||||
STARTSTACKSTR(out);
|
STARTSTACKSTR(out);
|
||||||
loop: { /* for each line, until end of word */
|
loop : { /* for each line, until end of word */
|
||||||
CHECKEND(); /* set c to PEOF if at end of here document */
|
CHECKEND(); /* set c to PEOF if at end of here document */
|
||||||
for (;;) { /* until end of line or end of word */
|
for (;;) { /* until end of line or end of word */
|
||||||
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
||||||
|
@ -9064,7 +9069,7 @@ endword:
|
||||||
* is called, c is set to the first character of the next input line. If
|
* is called, c is set to the first character of the next input line. If
|
||||||
* we are at the end of the here document, this routine sets the c to PEOF.
|
* we are at the end of the here document, this routine sets the c to PEOF.
|
||||||
*/
|
*/
|
||||||
checkend: {
|
checkend : {
|
||||||
if (realeofmark(eofmark)) {
|
if (realeofmark(eofmark)) {
|
||||||
int markloc;
|
int markloc;
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -9107,7 +9112,7 @@ checkend: {
|
||||||
* specifying the fd to be redirected. The variable "c" contains the
|
* specifying the fd to be redirected. The variable "c" contains the
|
||||||
* first character of the redirection operator.
|
* first character of the redirection operator.
|
||||||
*/
|
*/
|
||||||
parseredir: {
|
parseredir : {
|
||||||
char fd = *out;
|
char fd = *out;
|
||||||
union node *np;
|
union node *np;
|
||||||
np = (union node *)stalloc(sizeof(struct nfile));
|
np = (union node *)stalloc(sizeof(struct nfile));
|
||||||
|
@ -9164,7 +9169,7 @@ parseredir: {
|
||||||
* Parse a substitution. At this point, we have read the dollar sign
|
* Parse a substitution. At this point, we have read the dollar sign
|
||||||
* and nothing else.
|
* and nothing else.
|
||||||
*/
|
*/
|
||||||
parsesub: {
|
parsesub : {
|
||||||
int subtype;
|
int subtype;
|
||||||
int typeloc;
|
int typeloc;
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -9282,7 +9287,7 @@ parsesub: {
|
||||||
* list of commands (passed by reference), and savelen is the number of
|
* list of commands (passed by reference), and savelen is the number of
|
||||||
* characters on the top of the stack which must be preserved.
|
* characters on the top of the stack which must be preserved.
|
||||||
*/
|
*/
|
||||||
parsebackq: {
|
parsebackq : {
|
||||||
struct nodelist **nlpp;
|
struct nodelist **nlpp;
|
||||||
union node *n;
|
union node *n;
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -9377,7 +9382,7 @@ parsebackq: {
|
||||||
/*
|
/*
|
||||||
* Parse an arithmetic expansion (indicate start of one and set state)
|
* Parse an arithmetic expansion (indicate start of one and set state)
|
||||||
*/
|
*/
|
||||||
parsearith: {
|
parsearith : {
|
||||||
synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)),
|
synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)),
|
||||||
ARISYNTAX);
|
ARISYNTAX);
|
||||||
synstack->dblquote = 1;
|
synstack->dblquote = 1;
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
#endif
|
#endif
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
#include "libc/stdio/ftw.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/exit.h"
|
#include "libc/sysv/consts/exit.h"
|
||||||
#include "libc/sysv/consts/s.h"
|
#include "libc/sysv/consts/s.h"
|
||||||
#include "libc/stdio/ftw.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview Directory walker example.
|
* @fileoverview Directory walker example.
|
||||||
|
|
|
@ -10,12 +10,12 @@ void end_cancelation_point(int);
|
||||||
#define END_CANCELATION_POINT (void)0
|
#define END_CANCELATION_POINT (void)0
|
||||||
#else
|
#else
|
||||||
#define BEGIN_CANCELATION_POINT \
|
#define BEGIN_CANCELATION_POINT \
|
||||||
do { \
|
do { \
|
||||||
int _Cp; \
|
int _Cp; \
|
||||||
_Cp = begin_cancelation_point()
|
_Cp = begin_cancelation_point()
|
||||||
#define END_CANCELATION_POINT \
|
#define END_CANCELATION_POINT \
|
||||||
end_cancelation_point(_Cp); \
|
end_cancelation_point(_Cp); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/strace.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/runtime/zipos.internal.h"
|
#include "libc/runtime/zipos.internal.h"
|
||||||
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicates file descriptor.
|
* Duplicates file descriptor.
|
||||||
|
|
|
@ -76,7 +76,7 @@ int dup2(int oldfd, int newfd) {
|
||||||
rc = oldfd;
|
rc = oldfd;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (!IsWindows()) {
|
if (!IsWindows()) {
|
||||||
if (__isfdkind(oldfd, kFdZip) || __isfdkind(newfd, kFdZip)) {
|
if (__isfdkind(oldfd, kFdZip) || __isfdkind(newfd, kFdZip)) {
|
||||||
if (__vforked) {
|
if (__vforked) {
|
||||||
return enotsup();
|
return enotsup();
|
||||||
|
|
|
@ -66,7 +66,7 @@ static struct HostAdapterInfoNode {
|
||||||
struct sockaddr netmask;
|
struct sockaddr netmask;
|
||||||
struct sockaddr broadcast;
|
struct sockaddr broadcast;
|
||||||
short flags;
|
short flags;
|
||||||
} * __hostInfo;
|
} *__hostInfo;
|
||||||
|
|
||||||
static int ioctl_default(int fd, unsigned long request, void *arg) {
|
static int ioctl_default(int fd, unsigned long request, void *arg) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
│ 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/serialize.h"
|
|
||||||
#include "libc/proc/execve.internal.h"
|
#include "libc/proc/execve.internal.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if executable image is supported by APE Loader.
|
* Returns true if executable image is supported by APE Loader.
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
#include "libc/intrin/strace.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/runtime/zipos.internal.h"
|
#include "libc/runtime/zipos.internal.h"
|
||||||
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates hard filesystem link.
|
* Creates hard filesystem link.
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
#include "libc/intrin/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
|
#include "libc/runtime/zipos.internal.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/runtime/zipos.internal.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates directory a.k.a. folder.
|
* Creates directory a.k.a. folder.
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/pc.internal.h"
|
#include "libc/runtime/pc.internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
#include "libc/runtime/zipos.internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/at.h"
|
#include "libc/sysv/consts/at.h"
|
||||||
#include "libc/sysv/consts/map.h"
|
#include "libc/sysv/consts/map.h"
|
||||||
#include "libc/sysv/consts/o.h"
|
#include "libc/sysv/consts/o.h"
|
||||||
#include "libc/sysv/consts/prot.h"
|
#include "libc/sysv/consts/prot.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/runtime/zipos.internal.h"
|
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
#include "libc/intrin/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
|
#include "libc/runtime/zipos.internal.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/runtime/zipos.internal.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renames files relative to directories.
|
* Renames files relative to directories.
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/stdio/sysparam.h"
|
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/paths.h"
|
#include "libc/paths.h"
|
||||||
|
#include "libc/stdio/sysparam.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns name of terminal.
|
* Returns name of terminal.
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include "libc/intrin/describeflags.internal.h"
|
#include "libc/intrin/describeflags.internal.h"
|
||||||
#include "libc/intrin/strace.internal.h"
|
#include "libc/intrin/strace.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
|
#include "libc/runtime/zipos.internal.h"
|
||||||
#include "libc/sysv/consts/s.h"
|
#include "libc/sysv/consts/s.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
#include "libc/runtime/zipos.internal.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes inode and maybe the file too.
|
* Deletes inode and maybe the file too.
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include "libc/elf/struct/phdr.h"
|
#include "libc/elf/struct/phdr.h"
|
||||||
#include "libc/elf/struct/shdr.h"
|
#include "libc/elf/struct/shdr.h"
|
||||||
#include "libc/elf/struct/sym.h"
|
#include "libc/elf/struct/sym.h"
|
||||||
#include "libc/serialize.h"
|
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/log/libfatal.internal.h"
|
#include "libc/log/libfatal.internal.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
#define GetStr(tab, rva) ((char *)(tab) + (rva))
|
#define GetStr(tab, rva) ((char *)(tab) + (rva))
|
||||||
|
@ -30,7 +30,8 @@ static inline char *GetStrtab(const Elf64_Ehdr *e, size_t *n) {
|
||||||
if (shdr->sh_type == SHT_STRTAB) {
|
if (shdr->sh_type == SHT_STRTAB) {
|
||||||
name = GetSectionName(e, GetShdr(e, i));
|
name = GetSectionName(e, GetShdr(e, i));
|
||||||
if (name && READ64LE(name) == READ64LE(".strtab")) {
|
if (name && READ64LE(name) == READ64LE(".strtab")) {
|
||||||
if (n) *n = shdr->sh_size;
|
if (n)
|
||||||
|
*n = shdr->sh_size;
|
||||||
return GetSection(e, shdr);
|
return GetSection(e, shdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +45,8 @@ static inline Elf64_Sym *GetSymtab(const Elf64_Ehdr *e, Elf64_Xword *n) {
|
||||||
for (i = e->e_shnum; i-- > 0;) {
|
for (i = e->e_shnum; i-- > 0;) {
|
||||||
shdr = GetShdr(e, i);
|
shdr = GetShdr(e, i);
|
||||||
if (shdr->sh_type == SHT_SYMTAB) {
|
if (shdr->sh_type == SHT_SYMTAB) {
|
||||||
if (n) *n = shdr->sh_size / sizeof(Elf64_Sym);
|
if (n)
|
||||||
|
*n = shdr->sh_size / sizeof(Elf64_Sym);
|
||||||
return GetSection(e, shdr);
|
return GetSection(e, shdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,14 +62,19 @@ static inline void GetImageRange(const Elf64_Ehdr *elf, intptr_t *x,
|
||||||
end = 0;
|
end = 0;
|
||||||
for (i = 0; i < elf->e_phnum; ++i) {
|
for (i = 0; i < elf->e_phnum; ++i) {
|
||||||
phdr = GetPhdr(elf, i);
|
phdr = GetPhdr(elf, i);
|
||||||
if (phdr->p_type != PT_LOAD) continue;
|
if (phdr->p_type != PT_LOAD)
|
||||||
|
continue;
|
||||||
pstart = phdr->p_vaddr;
|
pstart = phdr->p_vaddr;
|
||||||
pend = phdr->p_vaddr + phdr->p_memsz;
|
pend = phdr->p_vaddr + phdr->p_memsz;
|
||||||
if (pstart < start) start = pstart;
|
if (pstart < start)
|
||||||
if (pend > end) end = pend;
|
start = pstart;
|
||||||
|
if (pend > end)
|
||||||
|
end = pend;
|
||||||
}
|
}
|
||||||
if (x) *x = start;
|
if (x)
|
||||||
if (y) *y = end;
|
*x = start;
|
||||||
|
if (y)
|
||||||
|
*y = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name,
|
static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name,
|
||||||
|
@ -75,8 +82,10 @@ static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name,
|
||||||
Elf64_Xword i, n;
|
Elf64_Xword i, n;
|
||||||
const char *stab;
|
const char *stab;
|
||||||
const Elf64_Sym *st;
|
const Elf64_Sym *st;
|
||||||
if (!(stab = GetStrtab(ehdr, 0))) return false;
|
if (!(stab = GetStrtab(ehdr, 0)))
|
||||||
if (!(st = GetSymtab(ehdr, &n))) return false;
|
return false;
|
||||||
|
if (!(st = GetSymtab(ehdr, &n)))
|
||||||
|
return false;
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
if (!__strcmp(GetStr(stab, st[i].st_name), name)) {
|
if (!__strcmp(GetStr(stab, st[i].st_name), name)) {
|
||||||
*res = st[i].st_value;
|
*res = st[i].st_value;
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
#define CONSUME_SPACES(t, s, c) \
|
#define CONSUME_SPACES(t, s, c) \
|
||||||
if (endptr) *endptr = (t *)(s); \
|
if (endptr) \
|
||||||
while (c == ' ' || c == '\t') c = *++s
|
*endptr = (t *)(s); \
|
||||||
|
while (c == ' ' || c == '\t') \
|
||||||
|
c = *++s
|
||||||
|
|
||||||
#define GET_SIGN(s, c, d) \
|
#define GET_SIGN(s, c, d) \
|
||||||
d = c == '-' ? -1 : 1; \
|
d = c == '-' ? -1 : 1; \
|
||||||
if (c == '-' || c == '+') c = *++s
|
if (c == '-' || c == '+') \
|
||||||
|
c = *++s
|
||||||
|
|
||||||
#define GET_RADIX(s, c, r) \
|
#define GET_RADIX(s, c, r) \
|
||||||
if (!r) { \
|
if (!r) { \
|
||||||
|
|
|
@ -33,19 +33,22 @@ static inline struct Dll *dll_last(struct Dll *list) {
|
||||||
|
|
||||||
static inline struct Dll *dll_first(struct Dll *list) {
|
static inline struct Dll *dll_first(struct Dll *list) {
|
||||||
struct Dll *first = 0;
|
struct Dll *first = 0;
|
||||||
if (list) first = list->next;
|
if (list)
|
||||||
|
first = list->next;
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct Dll *dll_next(struct Dll *list, struct Dll *e) {
|
static inline struct Dll *dll_next(struct Dll *list, struct Dll *e) {
|
||||||
struct Dll *next = 0;
|
struct Dll *next = 0;
|
||||||
if (e != list) next = e->next;
|
if (e != list)
|
||||||
|
next = e->next;
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct Dll *dll_prev(struct Dll *list, struct Dll *e) {
|
static inline struct Dll *dll_prev(struct Dll *list, struct Dll *e) {
|
||||||
struct Dll *prev = 0;
|
struct Dll *prev = 0;
|
||||||
if (e != list->next) prev = e->prev;
|
if (e != list->next)
|
||||||
|
prev = e->prev;
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define asint(x) ((union pun){x}).i
|
#define asint(x) ((union pun){x}).i
|
||||||
#define isnan(x) (((x) & 0x7fff) > 0x7c00)
|
#define isnan(x) (((x)&0x7fff) > 0x7c00)
|
||||||
|
|
||||||
union pun {
|
union pun {
|
||||||
_Float16 f;
|
_Float16 f;
|
||||||
|
|
|
@ -49,7 +49,8 @@ void uvprintf(const char *, va_list) libcesque;
|
||||||
do { \
|
do { \
|
||||||
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
||||||
##__VA_ARGS__); \
|
##__VA_ARGS__); \
|
||||||
for (;;) asm volatile("cli\n\thlt"); \
|
for (;;) \
|
||||||
|
asm volatile("cli\n\thlt"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
#define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x)))
|
#define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x)))
|
||||||
#define NOPAGE ((uint64_t) - 1)
|
#define NOPAGE ((uint64_t)-1)
|
||||||
|
|
||||||
#define APE_STACK_VADDR \
|
#define APE_STACK_VADDR \
|
||||||
({ \
|
({ \
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
forceinline void repmovsb(void **dest, const void **src, size_t cx) {
|
forceinline void repmovsb(void **dest, const void **src, size_t cx) {
|
||||||
char *di = (char *)*dest;
|
char *di = (char *)*dest;
|
||||||
const char *si = (const char *)*src;
|
const char *si = (const char *)*src;
|
||||||
while (cx) *di++ = *si++, cx--;
|
while (cx)
|
||||||
|
*di++ = *si++, cx--;
|
||||||
*dest = di, *src = si;
|
*dest = di, *src = si;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
|
forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
|
||||||
unsigned char *di = (unsigned char *)dest;
|
unsigned char *di = (unsigned char *)dest;
|
||||||
while (cx) *di++ = al, cx--;
|
while (cx)
|
||||||
|
*di++ = al, cx--;
|
||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,8 @@ COSMOPOLITAN_C_START_
|
||||||
({ \
|
({ \
|
||||||
autotype(a) FirstNonNullA = (a); \
|
autotype(a) FirstNonNullA = (a); \
|
||||||
autotype(a) FirstNonNullB = (b); \
|
autotype(a) FirstNonNullB = (b); \
|
||||||
if (!FirstNonNullA && !FirstNonNullB) abort(); \
|
if (!FirstNonNullA && !FirstNonNullB) \
|
||||||
|
abort(); \
|
||||||
FirstNonNullA ? FirstNonNullA : FirstNonNullB; \
|
FirstNonNullA ? FirstNonNullA : FirstNonNullB; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
│ 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/errno.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
#include "libc/runtime/internal.h"
|
#include "libc/runtime/internal.h"
|
||||||
#include "libc/errno.h"
|
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
|
||||||
__attribute__((__weak__)) void __stack_chk_fail(void) {
|
__attribute__((__weak__)) void __stack_chk_fail(void) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ static __vex size_t __strlen(const char *s) {
|
||||||
m = __builtin_ia32_pmovmskb128(*++p == z);
|
m = __builtin_ia32_pmovmskb128(*++p == z);
|
||||||
return (const char *)p + __builtin_ctzl(m) - s;
|
return (const char *)p + __builtin_ctzl(m) - s;
|
||||||
#else
|
#else
|
||||||
#define ONES ((word) - 1 / 255)
|
#define ONES ((word)-1 / 255)
|
||||||
#define BANE (ONES * (255 / 2 + 1))
|
#define BANE (ONES * (255 / 2 + 1))
|
||||||
typedef unsigned long mayalias word;
|
typedef unsigned long mayalias word;
|
||||||
word w;
|
word w;
|
||||||
|
|
|
@ -62,8 +62,8 @@ textstartup void _AcpiFadtInit(void) {
|
||||||
_Static_assert(offsetof(AcpiTableFadt, Dsdt) == 40);
|
_Static_assert(offsetof(AcpiTableFadt, Dsdt) == 40);
|
||||||
_Static_assert(offsetof(AcpiTableFadt, BootFlags) == 109);
|
_Static_assert(offsetof(AcpiTableFadt, BootFlags) == 109);
|
||||||
_Static_assert(offsetof(AcpiTableFadt, XDsdt) == 140);
|
_Static_assert(offsetof(AcpiTableFadt, XDsdt) == 140);
|
||||||
if (length >= offsetof(AcpiTableFadt, BootFlags) + sizeof(fadt->BootFlags))
|
if (length >=
|
||||||
{
|
offsetof(AcpiTableFadt, BootFlags) + sizeof(fadt->BootFlags)) {
|
||||||
_AcpiBootFlags = flags = fadt->BootFlags;
|
_AcpiBootFlags = flags = fadt->BootFlags;
|
||||||
KINFOF("FADT: boot flags %#x", (unsigned)flags);
|
KINFOF("FADT: boot flags %#x", (unsigned)flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/atomic.h"
|
#include "libc/intrin/atomic.h"
|
||||||
#include "libc/serialize.h"
|
|
||||||
#include "libc/intrin/directmap.internal.h"
|
#include "libc/intrin/directmap.internal.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
#include "libc/irq/acpi.internal.h"
|
#include "libc/irq/acpi.internal.h"
|
||||||
|
@ -34,6 +33,7 @@
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/nt/efi.h"
|
#include "libc/nt/efi.h"
|
||||||
#include "libc/runtime/pc.internal.h"
|
#include "libc/runtime/pc.internal.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/map.h"
|
#include "libc/sysv/consts/map.h"
|
||||||
#include "libc/sysv/consts/prot.h"
|
#include "libc/sysv/consts/prot.h"
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
#define COSMOPOLITAN_LIBC_ISO646_H_
|
#define COSMOPOLITAN_LIBC_ISO646_H_
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#define and &&
|
#define and &&
|
||||||
#define and_eq &=
|
#define and_eq &=
|
||||||
#define bitand &
|
#define bitand &
|
||||||
#define bitor |
|
#define bitor |
|
||||||
#define compl ~
|
#define compl ~
|
||||||
#define not !
|
#define not !
|
||||||
#define not_eq !=
|
#define not_eq !=
|
||||||
#define or ||
|
#define or ||
|
||||||
#define or_eq |=
|
#define or_eq |=
|
||||||
#define xor ^
|
#define xor ^
|
||||||
#define xor_eq ^=
|
#define xor_eq ^=
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
|
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
|
||||||
#define COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
|
#define COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
|
||||||
#include "third_party/libcxxabi/include/cxxabi.h"
|
|
||||||
#include "libc/cxxabi.h"
|
#include "libc/cxxabi.h"
|
||||||
|
#include "third_party/libcxxabi/include/cxxabi.h"
|
||||||
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ */
|
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _FTW_H
|
#ifndef _FTW_H
|
||||||
#define _FTW_H
|
#define _FTW_H
|
||||||
#include "libc/calls/weirdtypes.h"
|
#include "libc/calls/weirdtypes.h"
|
||||||
#include "libc/sysv/consts/s.h"
|
|
||||||
#include "libc/stdio/ftw.h"
|
#include "libc/stdio/ftw.h"
|
||||||
|
#include "libc/sysv/consts/s.h"
|
||||||
#endif /* _FTW_H */
|
#endif /* _FTW_H */
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_
|
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_
|
||||||
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_
|
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_
|
||||||
#include "libc/intrin/newbie.h"
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/rlimit.h"
|
#include "libc/calls/struct/rlimit.h"
|
||||||
#include "libc/calls/struct/rusage.h"
|
#include "libc/calls/struct/rusage.h"
|
||||||
#include "libc/stdio/sysparam.h"
|
|
||||||
#include "libc/calls/weirdtypes.h"
|
#include "libc/calls/weirdtypes.h"
|
||||||
|
#include "libc/intrin/newbie.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
|
#include "libc/stdio/sysparam.h"
|
||||||
#include "libc/sysv/consts/endian.h"
|
#include "libc/sysv/consts/endian.h"
|
||||||
#include "libc/sysv/consts/prio.h"
|
#include "libc/sysv/consts/prio.h"
|
||||||
#include "libc/sysv/consts/rlim.h"
|
#include "libc/sysv/consts/rlim.h"
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/calls/struct/siginfo.h"
|
#include "libc/calls/struct/siginfo.h"
|
||||||
#include "libc/sysv/consts/sig.h"
|
|
||||||
#include "libc/sysv/consts/sicode.h"
|
#include "libc/sysv/consts/sicode.h"
|
||||||
|
#include "libc/sysv/consts/sig.h"
|
||||||
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */
|
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */
|
||||||
|
|
|
@ -7,324 +7,316 @@
|
||||||
|
|
||||||
/* from https://en.cppreference.com/w/c/numeric/tgmath */
|
/* from https://en.cppreference.com/w/c/numeric/tgmath */
|
||||||
|
|
||||||
#define fabs(x) \
|
#define fabs(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: fabsf, default \
|
float: fabsf, \
|
||||||
: fabs, long double \
|
default: fabs, \
|
||||||
: fabsl, complex float \
|
long double: fabsl, \
|
||||||
: cabsf, complex double \
|
complex float: cabsf, \
|
||||||
: cabs, complex long double \
|
complex double: cabs, \
|
||||||
: cabsl)(x)
|
complex long double: cabsl)(x)
|
||||||
|
|
||||||
#define exp(x) \
|
#define exp(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: expf, default \
|
float: expf, \
|
||||||
: exp, long double \
|
default: exp, \
|
||||||
: expl, complex float \
|
long double: expl, \
|
||||||
: cexpf, complex double \
|
complex float: cexpf, \
|
||||||
: cexp, complex long double \
|
complex double: cexp, \
|
||||||
: cexpl)(x)
|
complex long double: cexpl)(x)
|
||||||
|
|
||||||
#define log(x) \
|
#define log(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: logf, default \
|
float: logf, \
|
||||||
: log, long double \
|
default: log, \
|
||||||
: logl, complex float \
|
long double: logl, \
|
||||||
: clogf, complex double \
|
complex float: clogf, \
|
||||||
: clog, complex long double \
|
complex double: clog, \
|
||||||
: clogl)(x)
|
complex long double: clogl)(x)
|
||||||
|
|
||||||
#define pow(x, y) \
|
#define pow(x, y) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: powf, default \
|
float: powf, \
|
||||||
: pow, long double \
|
default: pow, \
|
||||||
: powl, complex float \
|
long double: powl, \
|
||||||
: cpowf, complex double \
|
complex float: cpowf, \
|
||||||
: cpow, complex long double \
|
complex double: cpow, \
|
||||||
: cpowl)(x, y)
|
complex long double: cpowl)(x, y)
|
||||||
|
|
||||||
#define sqrt(x) \
|
#define sqrt(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: sqrtf, default \
|
float: sqrtf, \
|
||||||
: sqrt, long double \
|
default: sqrt, \
|
||||||
: sqrtl, complex float \
|
long double: sqrtl, \
|
||||||
: csqrtf, complex double \
|
complex float: csqrtf, \
|
||||||
: csqrt, complex long double \
|
complex double: csqrt, \
|
||||||
: csqrtl)(x)
|
complex long double: csqrtl)(x)
|
||||||
|
|
||||||
#define sin(x) \
|
#define sin(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: sinf, default \
|
float: sinf, \
|
||||||
: sin, long double \
|
default: sin, \
|
||||||
: sinl, complex float \
|
long double: sinl, \
|
||||||
: csinf, complex double \
|
complex float: csinf, \
|
||||||
: csin, complex long double \
|
complex double: csin, \
|
||||||
: csinl)(x)
|
complex long double: csinl)(x)
|
||||||
|
|
||||||
#define cos(x) \
|
#define cos(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: cosf, default \
|
float: cosf, \
|
||||||
: cos, long double \
|
default: cos, \
|
||||||
: cosl, complex float \
|
long double: cosl, \
|
||||||
: ccosf, complex double \
|
complex float: ccosf, \
|
||||||
: ccos, complex long double \
|
complex double: ccos, \
|
||||||
: ccosl)(x)
|
complex long double: ccosl)(x)
|
||||||
|
|
||||||
#define tan(x) \
|
#define tan(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: tanf, default \
|
float: tanf, \
|
||||||
: tan, long double \
|
default: tan, \
|
||||||
: tanl, complex float \
|
long double: tanl, \
|
||||||
: ctanf, complex double \
|
complex float: ctanf, \
|
||||||
: ctan, complex long double \
|
complex double: ctan, \
|
||||||
: ctanl)(x)
|
complex long double: ctanl)(x)
|
||||||
|
|
||||||
#define asin(x) \
|
#define asin(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: asinf, default \
|
float: asinf, \
|
||||||
: asin, long double \
|
default: asin, \
|
||||||
: asinl, complex float \
|
long double: asinl, \
|
||||||
: casinf, complex double \
|
complex float: casinf, \
|
||||||
: casin, complex long double \
|
complex double: casin, \
|
||||||
: casinl)(x)
|
complex long double: casinl)(x)
|
||||||
|
|
||||||
#define acos(x) \
|
#define acos(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: acosf, default \
|
float: acosf, \
|
||||||
: acos, long double \
|
default: acos, \
|
||||||
: acosl, complex float \
|
long double: acosl, \
|
||||||
: cacosf, complex double \
|
complex float: cacosf, \
|
||||||
: cacos, complex long double \
|
complex double: cacos, \
|
||||||
: cacosl)(x)
|
complex long double: cacosl)(x)
|
||||||
|
|
||||||
#define atan(x) \
|
#define atan(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: atanf, default \
|
float: atanf, \
|
||||||
: atan, long double \
|
default: atan, \
|
||||||
: atanl, complex float \
|
long double: atanl, \
|
||||||
: catanf, complex double \
|
complex float: catanf, \
|
||||||
: catan, complex long double \
|
complex double: catan, \
|
||||||
: catanl)(x)
|
complex long double: catanl)(x)
|
||||||
|
|
||||||
#define sinh(x) \
|
#define sinh(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: sinhf, default \
|
float: sinhf, \
|
||||||
: sinh, long double \
|
default: sinh, \
|
||||||
: sinhl, complex float \
|
long double: sinhl, \
|
||||||
: csinhf, complex double \
|
complex float: csinhf, \
|
||||||
: csinh, complex long double \
|
complex double: csinh, \
|
||||||
: csinhl)(x)
|
complex long double: csinhl)(x)
|
||||||
|
|
||||||
#define cosh(x) \
|
#define cosh(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: coshf, default \
|
float: coshf, \
|
||||||
: cosh, long double \
|
default: cosh, \
|
||||||
: coshl, complex float \
|
long double: coshl, \
|
||||||
: ccoshf, complex double \
|
complex float: ccoshf, \
|
||||||
: ccosh, complex long double \
|
complex double: ccosh, \
|
||||||
: ccoshl)(x)
|
complex long double: ccoshl)(x)
|
||||||
|
|
||||||
#define tanh(x) \
|
#define tanh(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: tanhf, default \
|
float: tanhf, \
|
||||||
: tanh, long double \
|
default: tanh, \
|
||||||
: tanhl, complex float \
|
long double: tanhl, \
|
||||||
: ctanhf, complex double \
|
complex float: ctanhf, \
|
||||||
: ctanh, complex long double \
|
complex double: ctanh, \
|
||||||
: ctanhl)(x)
|
complex long double: ctanhl)(x)
|
||||||
|
|
||||||
#define asinh(x) \
|
#define asinh(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: asinhf, default \
|
float: asinhf, \
|
||||||
: asinh, long double \
|
default: asinh, \
|
||||||
: asinhl, complex float \
|
long double: asinhl, \
|
||||||
: casinhf, complex double \
|
complex float: casinhf, \
|
||||||
: casinh, complex long double \
|
complex double: casinh, \
|
||||||
: casinhl)(x)
|
complex long double: casinhl)(x)
|
||||||
|
|
||||||
#define acosh(x) \
|
#define acosh(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: acoshf, default \
|
float: acoshf, \
|
||||||
: acosh, long double \
|
default: acosh, \
|
||||||
: acoshl, complex float \
|
long double: acoshl, \
|
||||||
: cacoshf, complex double \
|
complex float: cacoshf, \
|
||||||
: cacosh, complex long double \
|
complex double: cacosh, \
|
||||||
: cacoshl)(x)
|
complex long double: cacoshl)(x)
|
||||||
|
|
||||||
#define atanh(x) \
|
#define atanh(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: atanhf, default \
|
float: atanhf, \
|
||||||
: atanh, long double \
|
default: atanh, \
|
||||||
: atanhl, complex float \
|
long double: atanhl, \
|
||||||
: catanhf, complex double \
|
complex float: catanhf, \
|
||||||
: catanh, complex long double \
|
complex double: catanh, \
|
||||||
: catanhl)(x)
|
complex long double: catanhl)(x)
|
||||||
|
|
||||||
#define atan2(x, y) \
|
#define atan2(x, y) \
|
||||||
_Generic((x), float : atan2f, default : atan2, long double : atan2l)(x, y)
|
_Generic((x), float: atan2f, default: atan2, long double: atan2l)(x, y)
|
||||||
|
|
||||||
#define cbrt(x) \
|
#define cbrt(x) \
|
||||||
_Generic((x), float : cbrtf, default : cbrt, long double : cbrtl)(x)
|
_Generic((x), float: cbrtf, default: cbrt, long double: cbrtl)(x)
|
||||||
|
|
||||||
#define ceil(x) \
|
#define ceil(x) \
|
||||||
_Generic((x), float : ceilf, default : ceil, long double : ceill)(x)
|
_Generic((x), float: ceilf, default: ceil, long double: ceill)(x)
|
||||||
|
|
||||||
#define copysign(x, y) \
|
#define copysign(x, y) \
|
||||||
_Generic((x), float \
|
_Generic((x), float: copysignf, default: copysign, long double: copysignl)( \
|
||||||
: copysignf, default \
|
x, y)
|
||||||
: copysign, long double \
|
|
||||||
: copysignl)(x, y)
|
|
||||||
|
|
||||||
#define erf(x) _Generic((x), float : erff, default : erf, long double : erfl)(x)
|
#define erf(x) _Generic((x), float: erff, default: erf, long double: erfl)(x)
|
||||||
|
|
||||||
#define erfc(x) \
|
#define erfc(x) \
|
||||||
_Generic((x), float : erfcf, default : erfc, long double : erfcl)(x)
|
_Generic((x), float: erfcf, default: erfc, long double: erfcl)(x)
|
||||||
|
|
||||||
#define exp2(x) \
|
#define exp2(x) \
|
||||||
_Generic((x), float : exp2f, default : exp2, long double : exp2l)(x)
|
_Generic((x), float: exp2f, default: exp2, long double: exp2l)(x)
|
||||||
|
|
||||||
#define expm1(x) \
|
#define expm1(x) \
|
||||||
_Generic((x), float : expm1f, default : expm1, long double : expm1l)(x)
|
_Generic((x), float: expm1f, default: expm1, long double: expm1l)(x)
|
||||||
|
|
||||||
#define fdim(x, y) \
|
#define fdim(x, y) \
|
||||||
_Generic((x), float : fdimf, default : fdim, long double : fdiml)(x, y)
|
_Generic((x), float: fdimf, default: fdim, long double: fdiml)(x, y)
|
||||||
|
|
||||||
#define floor(x) \
|
#define floor(x) \
|
||||||
_Generic((x), float : floorf, default : floor, long double : floorl)(x)
|
_Generic((x), float: floorf, default: floor, long double: floorl)(x)
|
||||||
|
|
||||||
#define fma(x, y, z) \
|
#define fma(x, y, z) \
|
||||||
_Generic((x), float : fmaf, default : fma, long double : fmal)(x, y, z)
|
_Generic((x), float: fmaf, default: fma, long double: fmal)(x, y, z)
|
||||||
|
|
||||||
#define fmax(x, y) \
|
#define fmax(x, y) \
|
||||||
_Generic((x), float : fmaxf, default : fmax, long double : fmaxl)(x, y)
|
_Generic((x), float: fmaxf, default: fmax, long double: fmaxl)(x, y)
|
||||||
|
|
||||||
#define fmin(x, y) \
|
#define fmin(x, y) \
|
||||||
_Generic((x), float : fminf, default : fmin, long double : fminl)(x, y)
|
_Generic((x), float: fminf, default: fmin, long double: fminl)(x, y)
|
||||||
|
|
||||||
#define fmod(x, y) \
|
#define fmod(x, y) \
|
||||||
_Generic((x), float : fmodf, default : fmod, long double : fmodl)(x, y)
|
_Generic((x), float: fmodf, default: fmod, long double: fmodl)(x, y)
|
||||||
|
|
||||||
#define frexp(x, y) \
|
#define frexp(x, y) \
|
||||||
_Generic((x), float : frexpf, default : frexp, long double : frexpl)(x, y)
|
_Generic((x), float: frexpf, default: frexp, long double: frexpl)(x, y)
|
||||||
|
|
||||||
#define hypot(x, y) \
|
#define hypot(x, y) \
|
||||||
_Generic((x), float : hypotf, default : hypot, long double : hypotl)(x, y)
|
_Generic((x), float: hypotf, default: hypot, long double: hypotl)(x, y)
|
||||||
|
|
||||||
#define ilogb(x) \
|
#define ilogb(x) \
|
||||||
_Generic((x), float : ilogbf, default : ilogb, long double : ilogbl)(x)
|
_Generic((x), float: ilogbf, default: ilogb, long double: ilogbl)(x)
|
||||||
|
|
||||||
#define ldexp(x, y) \
|
#define ldexp(x, y) \
|
||||||
_Generic((x), float : ldexpf, default : ldexp, long double : ldexpl)(x, y)
|
_Generic((x), float: ldexpf, default: ldexp, long double: ldexpl)(x, y)
|
||||||
|
|
||||||
#define lgamma(x) \
|
#define lgamma(x) \
|
||||||
_Generic((x), float : lgammaf, default : lgamma, long double : lgammal)(x)
|
_Generic((x), float: lgammaf, default: lgamma, long double: lgammal)(x)
|
||||||
|
|
||||||
#define llrint(x) \
|
#define llrint(x) \
|
||||||
_Generic((x), float : llrintf, default : llrint, long double : llrintl)(x)
|
_Generic((x), float: llrintf, default: llrint, long double: llrintl)(x)
|
||||||
|
|
||||||
#define llround(x) \
|
#define llround(x) \
|
||||||
_Generic((x), float : llroundf, default : llround, long double : llroundl)(x)
|
_Generic((x), float: llroundf, default: llround, long double: llroundl)(x)
|
||||||
|
|
||||||
#define log10(x) \
|
#define log10(x) \
|
||||||
_Generic((x), float : log10f, default : log10, long double : log10l)(x)
|
_Generic((x), float: log10f, default: log10, long double: log10l)(x)
|
||||||
|
|
||||||
#define log1p(x) \
|
#define log1p(x) \
|
||||||
_Generic((x), float : log1pf, default : log1p, long double : log1pl)(x)
|
_Generic((x), float: log1pf, default: log1p, long double: log1pl)(x)
|
||||||
|
|
||||||
#define log2(x) \
|
#define log2(x) \
|
||||||
_Generic((x), float : log2f, default : log2, long double : log2l)(x)
|
_Generic((x), float: log2f, default: log2, long double: log2l)(x)
|
||||||
|
|
||||||
#define logb(x) \
|
#define logb(x) \
|
||||||
_Generic((x), float : logbf, default : logb, long double : logbl)(x)
|
_Generic((x), float: logbf, default: logb, long double: logbl)(x)
|
||||||
|
|
||||||
#define lrint(x) \
|
#define lrint(x) \
|
||||||
_Generic((x), float : lrintf, default : lrint, long double : lrintl)(x)
|
_Generic((x), float: lrintf, default: lrint, long double: lrintl)(x)
|
||||||
|
|
||||||
#define lround(x) \
|
#define lround(x) \
|
||||||
_Generic((x), float : lroundf, default : lround, long double : lroundl)(x)
|
_Generic((x), float: lroundf, default: lround, long double: lroundl)(x)
|
||||||
|
|
||||||
#define nearbyint(x) \
|
#define nearbyint(x) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: nearbyintf, default \
|
float: nearbyintf, \
|
||||||
: nearbyint, long double \
|
default: nearbyint, \
|
||||||
: nearbyintl)(x)
|
long double: nearbyintl)(x)
|
||||||
|
|
||||||
#define nextafter(x, y) \
|
#define nextafter(x, y) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: nextafterf, default \
|
float: nextafterf, \
|
||||||
: nextafter, long double \
|
default: nextafter, \
|
||||||
: nextafterl)(x, y)
|
long double: nextafterl)(x, y)
|
||||||
|
|
||||||
#define nexttoward(x, y) \
|
#define nexttoward(x, y) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: nexttowardf, default \
|
float: nexttowardf, \
|
||||||
: nexttoward, long double \
|
default: nexttoward, \
|
||||||
: nexttowardl)(x, y)
|
long double: nexttowardl)(x, y)
|
||||||
|
|
||||||
#define remainder(x, y) \
|
#define remainder(x, y) \
|
||||||
_Generic((x), float \
|
_Generic((x), \
|
||||||
: remainderf, default \
|
float: remainderf, \
|
||||||
: remainder, long double \
|
default: remainder, \
|
||||||
: remainderl)(x, y)
|
long double: remainderl)(x, y)
|
||||||
|
|
||||||
#define remquo(x, y, z) \
|
#define remquo(x, y, z) \
|
||||||
_Generic((x), float \
|
_Generic((x), float: remquof, default: remquo, long double: remquol)(x, y, z)
|
||||||
: remquof, default \
|
|
||||||
: remquo, long double \
|
|
||||||
: remquol)(x, y, z)
|
|
||||||
|
|
||||||
#define rint(x) \
|
#define rint(x) \
|
||||||
_Generic((x), float : rintf, default : rint, long double : rintl)(x)
|
_Generic((x), float: rintf, default: rint, long double: rintl)(x)
|
||||||
|
|
||||||
#define round(x) \
|
#define round(x) \
|
||||||
_Generic((x), float : roundf, default : round, long double : roundl)(x)
|
_Generic((x), float: roundf, default: round, long double: roundl)(x)
|
||||||
|
|
||||||
#define scalbln(x, y) \
|
#define scalbln(x, y) \
|
||||||
_Generic((x), float \
|
_Generic((x), float: scalblnf, default: scalbln, long double: scalblnl)(x, y)
|
||||||
: scalblnf, default \
|
|
||||||
: scalbln, long double \
|
|
||||||
: scalblnl)(x, y)
|
|
||||||
|
|
||||||
#define scalbn(x, y) \
|
#define scalbn(x, y) \
|
||||||
_Generic((x), float : scalbnf, default : scalbn, long double : scalbnl)(x, y)
|
_Generic((x), float: scalbnf, default: scalbn, long double: scalbnl)(x, y)
|
||||||
|
|
||||||
#define tgamma(x) \
|
#define tgamma(x) \
|
||||||
_Generic((x), float : tgammaf, default : tgamma, long double : tgammal)(x)
|
_Generic((x), float: tgammaf, default: tgamma, long double: tgammal)(x)
|
||||||
|
|
||||||
#define trunc(x) \
|
#define trunc(x) \
|
||||||
_Generic((x), float : truncf, default : trunc, long double : truncl)(x)
|
_Generic((x), float: truncf, default: trunc, long double: truncl)(x)
|
||||||
|
|
||||||
#define carg(x) \
|
#define carg(x) \
|
||||||
_Generic((x), complex float \
|
_Generic((x), \
|
||||||
: cargf, default \
|
complex float: cargf, \
|
||||||
: carg, complex long double \
|
default: carg, \
|
||||||
: cargl)(x)
|
complex long double: cargl)(x)
|
||||||
|
|
||||||
#define conj(x) \
|
#define conj(x) \
|
||||||
_Generic((x), complex float \
|
_Generic((x), \
|
||||||
: conjf, default \
|
complex float: conjf, \
|
||||||
: conj, complex long double \
|
default: conj, \
|
||||||
: conjl)(x)
|
complex long double: conjl)(x)
|
||||||
|
|
||||||
#undef creal
|
#undef creal
|
||||||
#define creal(x) \
|
#define creal(x) \
|
||||||
_Generic((x), complex float \
|
_Generic((x), \
|
||||||
: crealf, default \
|
complex float: crealf, \
|
||||||
: creal, complex long double \
|
default: creal, \
|
||||||
: creall)(x)
|
complex long double: creall)(x)
|
||||||
|
|
||||||
#undef cimag
|
#undef cimag
|
||||||
#define cimag(x) \
|
#define cimag(x) \
|
||||||
_Generic((x), complex float \
|
_Generic((x), \
|
||||||
: cimagf, default \
|
complex float: cimagf, \
|
||||||
: cimag, complex long double \
|
default: cimag, \
|
||||||
: cimagl)(x)
|
complex long double: cimagl)(x)
|
||||||
|
|
||||||
#define cproj(x) \
|
#define cproj(x) \
|
||||||
_Generic((x), complex float \
|
_Generic((x), \
|
||||||
: cprojf, default \
|
complex float: cprojf, \
|
||||||
: cproj, complex long double \
|
default: cproj, \
|
||||||
: cprojl)(x)
|
complex long double: cprojl)(x)
|
||||||
|
|
||||||
#endif /* C11 */
|
#endif /* C11 */
|
||||||
#endif /* _TGMATH_H */
|
#endif /* _TGMATH_H */
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/struct/rusage.h"
|
#include "libc/calls/struct/rusage.h"
|
||||||
#include "libc/fmt/itoa.h"
|
#include "libc/fmt/itoa.h"
|
||||||
#include "libc/serialize.h"
|
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
#include "libc/runtime/clktck.h"
|
#include "libc/runtime/clktck.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/stdio/append.h"
|
#include "libc/stdio/append.h"
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
|
|
|
@ -36,7 +36,8 @@ COSMOPOLITAN_C_START_
|
||||||
: "=r"(Info)); \
|
: "=r"(Info)); \
|
||||||
Cond = (x); \
|
Cond = (x); \
|
||||||
++Info->total; \
|
++Info->total; \
|
||||||
if (Cond) ++Info->taken; \
|
if (Cond) \
|
||||||
|
++Info->taken; \
|
||||||
Cond; \
|
Cond; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ int AttachDebugger(intptr_t);
|
||||||
while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \
|
while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \
|
||||||
if (g_gdbsync) { \
|
if (g_gdbsync) { \
|
||||||
g_gdbsync = 0; \
|
g_gdbsync = 0; \
|
||||||
if (Rc > 0) Pid = 0; \
|
if (Rc > 0) \
|
||||||
|
Pid = 0; \
|
||||||
break; \
|
break; \
|
||||||
} else { \
|
} else { \
|
||||||
sched_yield(); \
|
sched_yield(); \
|
||||||
|
|
|
@ -5,13 +5,15 @@ COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
forceinline unsigned long __strlen(const char *s) {
|
forceinline unsigned long __strlen(const char *s) {
|
||||||
unsigned long n = 0;
|
unsigned long n = 0;
|
||||||
while (*s++) ++n;
|
while (*s++)
|
||||||
|
++n;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline int __strcmp(const char *l, const char *r) {
|
forceinline int __strcmp(const char *l, const char *r) {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (l[i] == r[i] && r[i]) ++i;
|
while (l[i] == r[i] && r[i])
|
||||||
|
++i;
|
||||||
return (l[i] & 255) - (r[i] & 255);
|
return (l[i] & 255) - (r[i] & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +88,14 @@ forceinline char *__uintcpy(char p[hasatleast 21], uint64_t x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline char *__intcpy(char p[hasatleast 21], int64_t x) {
|
forceinline char *__intcpy(char p[hasatleast 21], int64_t x) {
|
||||||
if (x < 0) *p++ = '-', x = -(uint64_t)x;
|
if (x < 0)
|
||||||
|
*p++ = '-', x = -(uint64_t)x;
|
||||||
return __uintcpy(p, x);
|
return __uintcpy(p, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline char *__fixcpy(char p[hasatleast 17], uint64_t x, uint8_t k) {
|
forceinline char *__fixcpy(char p[hasatleast 17], uint64_t x, uint8_t k) {
|
||||||
while (k > 0) *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15];
|
while (k > 0)
|
||||||
|
*p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15];
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -114,11 +118,15 @@ forceinline char *__strstr(const char *haystack, const char *needle) {
|
||||||
size_t i;
|
size_t i;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (i = 0;; ++i) {
|
for (i = 0;; ++i) {
|
||||||
if (!needle[i]) return (/*unconst*/ char *)haystack;
|
if (!needle[i])
|
||||||
if (!haystack[i]) break;
|
return (/*unconst*/ char *)haystack;
|
||||||
if (needle[i] != haystack[i]) break;
|
if (!haystack[i])
|
||||||
|
break;
|
||||||
|
if (needle[i] != haystack[i])
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!*haystack++) break;
|
if (!*haystack++)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -128,35 +136,44 @@ forceinline char16_t *__strstr16(const char16_t *haystack,
|
||||||
size_t i;
|
size_t i;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (i = 0;; ++i) {
|
for (i = 0;; ++i) {
|
||||||
if (!needle[i]) return (/*unconst*/ char16_t *)haystack;
|
if (!needle[i])
|
||||||
if (!haystack[i]) break;
|
return (/*unconst*/ char16_t *)haystack;
|
||||||
if (needle[i] != haystack[i]) break;
|
if (!haystack[i])
|
||||||
|
break;
|
||||||
|
if (needle[i] != haystack[i])
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!*haystack++) break;
|
if (!*haystack++)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline const char *__strchr(const char *s, unsigned char c) {
|
forceinline const char *__strchr(const char *s, unsigned char c) {
|
||||||
for (;; ++s) {
|
for (;; ++s) {
|
||||||
if ((*s & 255) == c) return s;
|
if ((*s & 255) == c)
|
||||||
if (!*s) return 0;
|
return s;
|
||||||
|
if (!*s)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline unsigned long __atoul(const char *p) {
|
forceinline unsigned long __atoul(const char *p) {
|
||||||
int c;
|
int c;
|
||||||
unsigned long x = 0;
|
unsigned long x = 0;
|
||||||
while ('0' <= (c = *p++) && c <= '9') x *= 10, x += c - '0';
|
while ('0' <= (c = *p++) && c <= '9')
|
||||||
|
x *= 10, x += c - '0';
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
forceinline long __atol(const char *p) {
|
forceinline long __atol(const char *p) {
|
||||||
int s = *p;
|
int s = *p;
|
||||||
unsigned long x;
|
unsigned long x;
|
||||||
if (s == '-' || s == '+') ++p;
|
if (s == '-' || s == '+')
|
||||||
|
++p;
|
||||||
x = __atoul(p);
|
x = __atoul(p);
|
||||||
if (s == '-') x = -x;
|
if (s == '-')
|
||||||
|
x = -x;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,22 +61,26 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
// log a message with the specified log level (not checking if LOGGABLE)
|
// log a message with the specified log level (not checking if LOGGABLE)
|
||||||
#define LOGF(LEVEL, FMT, ...) \
|
#define LOGF(LEVEL, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// report an error without backtrace and debugger invocation
|
// report an error without backtrace and debugger invocation
|
||||||
#define FATALF(FMT, ...) \
|
#define FATALF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
flogf(kLogError, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
flogf(kLogError, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
_log_exit(1); \
|
_log_exit(1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DIEF(FMT, ...) \
|
#define DIEF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
ffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
ffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
__builtin_unreachable(); \
|
__builtin_unreachable(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -105,51 +109,62 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
#define VERBOSEF(FMT, ...) \
|
#define VERBOSEF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (LOGGABLE(kLogVerbose)) { \
|
if (LOGGABLE(kLogVerbose)) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
fverbosef(kLogVerbose, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
fverbosef(kLogVerbose, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DEBUGF(FMT, ...) \
|
#define DEBUGF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
|
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
fdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
fdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define NOISEF(FMT, ...) \
|
#define NOISEF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
|
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
fnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
fnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FLOGF(F, FMT, ...) \
|
#define FLOGF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (LOGGABLE(kLogInfo)) { \
|
if (LOGGABLE(kLogInfo)) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
flogf(kLogInfo, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
flogf(kLogInfo, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FWARNF(F, FMT, ...) \
|
#define FWARNF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (LOGGABLE(kLogWarn)) { \
|
if (LOGGABLE(kLogWarn)) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
flogf(kLogWarn, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
flogf(kLogWarn, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FFATALF(F, FMT, ...) \
|
#define FFATALF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
flogf(kLogError, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
flogf(kLogError, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
||||||
_log_exit(1); \
|
_log_exit(1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -157,18 +172,22 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
#define FDEBUGF(F, FMT, ...) \
|
#define FDEBUGF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
|
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
fdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
fdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FNOISEF(F, FMT, ...) \
|
#define FNOISEF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
|
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
fnoisef(kLogNoise, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
fnoisef(kLogNoise, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -177,9 +196,11 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
int e = _log_get_errno(); \
|
int e = _log_get_errno(); \
|
||||||
autotype(FORM) Ax = (FORM); \
|
autotype(FORM) Ax = (FORM); \
|
||||||
if (_LOG_UNLIKELY(Ax == (typeof(Ax))(-1)) && LOGGABLE(kLogWarn)) { \
|
if (_LOG_UNLIKELY(Ax == (typeof(Ax))(-1)) && LOGGABLE(kLogWarn)) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
_log_errno(__FILE__, __LINE__, #FORM); \
|
_log_errno(__FILE__, __LINE__, #FORM); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
_log_set_errno(e); \
|
_log_set_errno(e); \
|
||||||
} \
|
} \
|
||||||
Ax; \
|
Ax; \
|
||||||
|
@ -190,9 +211,11 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
int e = _log_get_errno(); \
|
int e = _log_get_errno(); \
|
||||||
autotype(FORM) Ax = (FORM); \
|
autotype(FORM) Ax = (FORM); \
|
||||||
if (Ax == NULL && LOGGABLE(kLogWarn)) { \
|
if (Ax == NULL && LOGGABLE(kLogWarn)) { \
|
||||||
if (!_LOG_TINY) _log_untrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_untrace(); \
|
||||||
_log_errno(__FILE__, __LINE__, #FORM); \
|
_log_errno(__FILE__, __LINE__, #FORM); \
|
||||||
if (!_LOG_TINY) _log_retrace(); \
|
if (!_LOG_TINY) \
|
||||||
|
_log_retrace(); \
|
||||||
_log_set_errno(e); \
|
_log_set_errno(e); \
|
||||||
} \
|
} \
|
||||||
Ax; \
|
Ax; \
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
│ 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/serialize.h"
|
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
#include "libc/log/backtrace.internal.h"
|
#include "libc/log/backtrace.internal.h"
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/runtime/symbols.internal.h"
|
#include "libc/runtime/symbols.internal.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
#define IS2POW(X) (!((X) & ((X) - 1)))
|
#define IS2POW(X) (!((X) & ((X)-1)))
|
||||||
#define ROUNDUP(X, K) (((X) + (K) - 1) & -(K))
|
#define ROUNDUP(X, K) (((X) + (K)-1) & -(K))
|
||||||
#define ROUNDDOWN(X, K) ((X) & -(K))
|
#define ROUNDDOWN(X, K) ((X) & -(K))
|
||||||
#ifndef __ASSEMBLER__
|
#ifndef __ASSEMBLER__
|
||||||
#define ABS(X) ((X) >= 0 ? (X) : -(X))
|
#define ABS(X) ((X) >= 0 ? (X) : -(X))
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
#define STRINGIFY(A) __STRINGIFY(A)
|
#define STRINGIFY(A) __STRINGIFY(A)
|
||||||
#define EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y)))
|
#define EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y)))
|
||||||
#define TYPE_BIT(type) (sizeof(type) * CHAR_BIT)
|
#define TYPE_BIT(type) (sizeof(type) * CHAR_BIT)
|
||||||
#define TYPE_SIGNED(type) (((type) - 1) < 0)
|
#define TYPE_SIGNED(type) (((type)-1) < 0)
|
||||||
#define TYPE_INTEGRAL(type) (((type)0.5) != 0.5)
|
#define TYPE_INTEGRAL(type) (((type)0.5) != 0.5)
|
||||||
|
|
||||||
#define ARRAYLEN(A) \
|
#define ARRAYLEN(A) \
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "libc/nexgen32e/x86feature.h"
|
#include "libc/nexgen32e/x86feature.h"
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
#define TSC_AUX_CORE(MSR) ((MSR) & 0xfff)
|
#define TSC_AUX_CORE(MSR) ((MSR)&0xfff)
|
||||||
#define TSC_AUX_NODE(MSR) (((MSR) >> 12) & 0xfff)
|
#define TSC_AUX_NODE(MSR) (((MSR) >> 12) & 0xfff)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,8 @@ COSMOPOLITAN_C_START_
|
||||||
: /* no inputs */ \
|
: /* no inputs */ \
|
||||||
: "memory"); \
|
: "memory"); \
|
||||||
EcxOut = (OPT_OUT_IA32_TSC_AUX); \
|
EcxOut = (OPT_OUT_IA32_TSC_AUX); \
|
||||||
if (EcxOut) *EcxOut = Ecx; \
|
if (EcxOut) \
|
||||||
|
*EcxOut = Ecx; \
|
||||||
Rdx << 32 | Rax; \
|
Rdx << 32 | Rax; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,22 @@
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_
|
||||||
|
|
||||||
/* input mode */
|
/* input mode */
|
||||||
#define kNtEnableProcessedInput 0x0001u
|
#define kNtEnableProcessedInput 0x0001u
|
||||||
#define kNtEnableLineInput 0x0002u
|
#define kNtEnableLineInput 0x0002u
|
||||||
#define kNtEnableEchoInput 0x0004u
|
#define kNtEnableEchoInput 0x0004u
|
||||||
#define kNtEnableWindowInput 0x0008u
|
#define kNtEnableWindowInput 0x0008u
|
||||||
#define kNtEnableMouseInput 0x0010u
|
#define kNtEnableMouseInput 0x0010u
|
||||||
#define kNtEnableInsertMode 0x0020u
|
#define kNtEnableInsertMode 0x0020u
|
||||||
#define kNtEnableQuickEditMode 0x0040u
|
#define kNtEnableQuickEditMode 0x0040u
|
||||||
#define kNtEnableExtendedFlags 0x0080u
|
#define kNtEnableExtendedFlags 0x0080u
|
||||||
#define kNtEnableAutoPosition 0x0100u
|
#define kNtEnableAutoPosition 0x0100u
|
||||||
#define kNtEnableVirtualTerminalInput 0x0200u
|
#define kNtEnableVirtualTerminalInput 0x0200u
|
||||||
|
|
||||||
/* output mode */
|
/* output mode */
|
||||||
#define kNtEnableProcessedOutput 0x0001u
|
#define kNtEnableProcessedOutput 0x0001u
|
||||||
#define kNtEnableWrapAtEolOutput 0x0002u
|
#define kNtEnableWrapAtEolOutput 0x0002u
|
||||||
#define kNtEnableVirtualTerminalProcessing 0x0004u
|
#define kNtEnableVirtualTerminalProcessing 0x0004u
|
||||||
#define kNtDisableNewlineAutoReturn 0x0008u
|
#define kNtDisableNewlineAutoReturn 0x0008u
|
||||||
#define kNtEnableLvbGridWorldwide 0x0010u
|
#define kNtEnableLvbGridWorldwide 0x0010u
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_ */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_
|
||||||
|
|
||||||
#define kNtConsoleNoSelection 0x0000u
|
#define kNtConsoleNoSelection 0x0000u
|
||||||
#define kNtConsoleSelectionInProgress 0x0001u
|
#define kNtConsoleSelectionInProgress 0x0001u
|
||||||
#define kNtConsoleSelectionNotEmpty 0x0002u
|
#define kNtConsoleSelectionNotEmpty 0x0002u
|
||||||
#define kNtConsoleMouseSelection 0x0004u
|
#define kNtConsoleMouseSelection 0x0004u
|
||||||
#define kNtConsoleMouseDown 0x0008u
|
#define kNtConsoleMouseDown 0x0008u
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_ */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_
|
||||||
|
|
||||||
#define kNtCreateNew 1
|
#define kNtCreateNew 1
|
||||||
#define kNtCreateAlways 2
|
#define kNtCreateAlways 2
|
||||||
#define kNtOpenExisting 3
|
#define kNtOpenExisting 3
|
||||||
#define kNtOpenAlways 4
|
#define kNtOpenAlways 4
|
||||||
#define kNtTruncateExisting 5
|
#define kNtTruncateExisting 5
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_ */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_
|
||||||
|
|
||||||
#define kNtCtrlCEvent 0 /* SIGINT */
|
#define kNtCtrlCEvent 0 /* SIGINT */
|
||||||
#define kNtCtrlBreakEvent 1 /* SIGQUIT */
|
#define kNtCtrlBreakEvent 1 /* SIGQUIT */
|
||||||
#define kNtCtrlCloseEvent 2 /* SIGHUP */
|
#define kNtCtrlCloseEvent 2 /* SIGHUP */
|
||||||
#define kNtCtrlLogoffEvent 5 /* SIGTERM */
|
#define kNtCtrlLogoffEvent 5 /* SIGTERM */
|
||||||
#define kNtCtrlShutdownEvent 6
|
#define kNtCtrlShutdownEvent 6
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_ */
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_
|
||||||
|
|
||||||
#define kNtExceptionExecuteHandler 0x1u
|
#define kNtExceptionExecuteHandler 0x1u
|
||||||
#define kNtExceptionContinueExecution 0xffffffffu
|
#define kNtExceptionContinueExecution 0xffffffffu
|
||||||
#define kNtExceptionContinueSearch 0x0u
|
#define kNtExceptionContinueSearch 0x0u
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_ */
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_
|
||||||
|
|
||||||
#define kNtFileDirectoryInformation 1 /*→ struct NtFileDirectoryInformation */
|
#define kNtFileDirectoryInformation 1 /*→ struct NtFileDirectoryInformation */
|
||||||
#define kNtFileFullDirectoryInformation 2 /*→ etc. */
|
#define kNtFileFullDirectoryInformation 2 /*→ etc. */
|
||||||
#define kNtFileBothDirectoryInformation 3
|
#define kNtFileBothDirectoryInformation 3
|
||||||
#define kNtFileBasicInformation 4
|
#define kNtFileBasicInformation 4
|
||||||
#define kNtFileStandardInformation 5
|
#define kNtFileStandardInformation 5
|
||||||
#define kNtFileInternalInformation 6
|
#define kNtFileInternalInformation 6
|
||||||
#define kNtFileEaInformation 7
|
#define kNtFileEaInformation 7
|
||||||
#define kNtFileAccessInformation 8
|
#define kNtFileAccessInformation 8
|
||||||
#define kNtFileNameInformation 9
|
#define kNtFileNameInformation 9
|
||||||
#define kNtFileRenameInformation 10
|
#define kNtFileRenameInformation 10
|
||||||
#define kNtFileLinkInformation 11
|
#define kNtFileLinkInformation 11
|
||||||
#define kNtFileNamesInformation 12
|
#define kNtFileNamesInformation 12
|
||||||
#define kNtFileDispositionInformation 13
|
#define kNtFileDispositionInformation 13
|
||||||
#define kNtFilePositionInformation 14
|
#define kNtFilePositionInformation 14
|
||||||
#define kNtFileFullEaInformation 15
|
#define kNtFileFullEaInformation 15
|
||||||
#define kNtFileModeInformation 16
|
#define kNtFileModeInformation 16
|
||||||
#define kNtFileAlignmentInformation 17
|
#define kNtFileAlignmentInformation 17
|
||||||
#define kNtFileAllInformation 18
|
#define kNtFileAllInformation 18
|
||||||
#define kNtFileAllocationInformation 19
|
#define kNtFileAllocationInformation 19
|
||||||
#define kNtFileEndOfFileInformation 20
|
#define kNtFileEndOfFileInformation 20
|
||||||
#define kNtFileAlternateNameInformation 21
|
#define kNtFileAlternateNameInformation 21
|
||||||
#define kNtFileStreamInformation 22
|
#define kNtFileStreamInformation 22
|
||||||
#define kNtFilePipeInformation 23
|
#define kNtFilePipeInformation 23
|
||||||
#define kNtFilePipeLocalInformation 24
|
#define kNtFilePipeLocalInformation 24
|
||||||
#define kNtFilePipeRemoteInformation 25
|
#define kNtFilePipeRemoteInformation 25
|
||||||
#define kNtFileMailslotQueryInformation 26
|
#define kNtFileMailslotQueryInformation 26
|
||||||
#define kNtFileMailslotSetInformation 27
|
#define kNtFileMailslotSetInformation 27
|
||||||
#define kNtFileCompressionInformation 28
|
#define kNtFileCompressionInformation 28
|
||||||
#define kNtFileObjectIdInformation 29
|
#define kNtFileObjectIdInformation 29
|
||||||
#define kNtFileCompletionInformation 30
|
#define kNtFileCompletionInformation 30
|
||||||
#define kNtFileMoveClusterInformation 31
|
#define kNtFileMoveClusterInformation 31
|
||||||
#define kNtFileQuotaInformation 32
|
#define kNtFileQuotaInformation 32
|
||||||
#define kNtFileReparsePointInformation 33
|
#define kNtFileReparsePointInformation 33
|
||||||
#define kNtFileNetworkOpenInformation 34
|
#define kNtFileNetworkOpenInformation 34
|
||||||
#define kNtFileAttributeTagInformation 35
|
#define kNtFileAttributeTagInformation 35
|
||||||
#define kNtFileTrackingInformation 36
|
#define kNtFileTrackingInformation 36
|
||||||
#define kNtFileIdBothDirectoryInformation 37
|
#define kNtFileIdBothDirectoryInformation 37
|
||||||
#define kNtFileIdFullDirectoryInformation 38
|
#define kNtFileIdFullDirectoryInformation 38
|
||||||
#define kNtFileValidDataLengthInformation 39
|
#define kNtFileValidDataLengthInformation 39
|
||||||
#define kNtFileShortNameInformation 40
|
#define kNtFileShortNameInformation 40
|
||||||
#define kNtFileInformation_MAX 40
|
#define kNtFileInformation_MAX 40
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_ */
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_
|
||||||
|
|
||||||
#define kNtFileShareExclusive 0x00000000u
|
#define kNtFileShareExclusive 0x00000000u
|
||||||
#define kNtFileShareRead 0x00000001u
|
#define kNtFileShareRead 0x00000001u
|
||||||
#define kNtFileShareWrite 0x00000002u
|
#define kNtFileShareWrite 0x00000002u
|
||||||
#define kNtFileShareDelete 0x00000004u
|
#define kNtFileShareDelete 0x00000004u
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_ */
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_
|
#define COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_
|
||||||
|
|
||||||
#define kNtForegroundBlue 0x0001
|
#define kNtForegroundBlue 0x0001
|
||||||
#define kNtForegroundGreen 0x0002
|
#define kNtForegroundGreen 0x0002
|
||||||
#define kNtForegroundRed 0x0004
|
#define kNtForegroundRed 0x0004
|
||||||
#define kNtForegroundIntensity 0x0008
|
#define kNtForegroundIntensity 0x0008
|
||||||
#define kNtBackgroundBlue 0x0010
|
#define kNtBackgroundBlue 0x0010
|
||||||
#define kNtBackgroundGreen 0x0020
|
#define kNtBackgroundGreen 0x0020
|
||||||
#define kNtBackgroundRed 0x0040
|
#define kNtBackgroundRed 0x0040
|
||||||
#define kNtBackgroundIntensity 0x0080
|
#define kNtBackgroundIntensity 0x0080
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_ */
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_
|
||||||
|
|
||||||
#define kNtFileFsVolumeInformation 1
|
#define kNtFileFsVolumeInformation 1
|
||||||
#define kNtFileFsLabelInformation 2
|
#define kNtFileFsLabelInformation 2
|
||||||
#define kNtFileFsSizeInformation 3
|
#define kNtFileFsSizeInformation 3
|
||||||
#define kNtFileFsDeviceInformation 4
|
#define kNtFileFsDeviceInformation 4
|
||||||
#define kNtFileFsAttributeInformation 5
|
#define kNtFileFsAttributeInformation 5
|
||||||
#define kNtFileFsControlInformation 6
|
#define kNtFileFsControlInformation 6
|
||||||
#define kNtFileFsFullSizeInformation 7
|
#define kNtFileFsFullSizeInformation 7
|
||||||
#define kNtFileFsObjectIdInformation 8
|
#define kNtFileFsObjectIdInformation 8
|
||||||
#define kNtFileFsDriverPathInformation 9
|
#define kNtFileFsDriverPathInformation 9
|
||||||
#define kNtFileFsInformation_MAX 10
|
#define kNtFileFsInformation_MAX 10
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_ */
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_
|
||||||
|
|
||||||
#define kNtExecutive 0
|
#define kNtExecutive 0
|
||||||
#define kNtFreePage 1
|
#define kNtFreePage 1
|
||||||
#define kNtPageIn 2
|
#define kNtPageIn 2
|
||||||
#define kNtPoolAllocation 3
|
#define kNtPoolAllocation 3
|
||||||
#define kNtDelayExecution 4
|
#define kNtDelayExecution 4
|
||||||
#define kNtSuspended 5
|
#define kNtSuspended 5
|
||||||
#define kNtUserRequest 6
|
#define kNtUserRequest 6
|
||||||
#define kNtWrExecutive 7
|
#define kNtWrExecutive 7
|
||||||
#define kNtWrFreePage 8
|
#define kNtWrFreePage 8
|
||||||
#define kNtWrPageIn 9
|
#define kNtWrPageIn 9
|
||||||
#define kNtWrPoolAllocation 10
|
#define kNtWrPoolAllocation 10
|
||||||
#define kNtWrDelayExecution 11
|
#define kNtWrDelayExecution 11
|
||||||
#define kNtWrSuspended 12
|
#define kNtWrSuspended 12
|
||||||
#define kNtWrUserRequest 13
|
#define kNtWrUserRequest 13
|
||||||
#define kNtWrEventPair 14
|
#define kNtWrEventPair 14
|
||||||
#define kNtWrQueue 15
|
#define kNtWrQueue 15
|
||||||
#define kNtWrLpcReceive 16
|
#define kNtWrLpcReceive 16
|
||||||
#define kNtWrLpcReply 17
|
#define kNtWrLpcReply 17
|
||||||
#define kNtWrVirtualMemory 18
|
#define kNtWrVirtualMemory 18
|
||||||
#define kNtWrPageOut 19
|
#define kNtWrPageOut 19
|
||||||
#define kNtWrRendezvous 20
|
#define kNtWrRendezvous 20
|
||||||
#define kNtSpare2 21
|
#define kNtSpare2 21
|
||||||
#define kNtSpare3 22
|
#define kNtSpare3 22
|
||||||
#define kNtSpare4 23
|
#define kNtSpare4 23
|
||||||
#define kNtSpare5 24
|
#define kNtSpare5 24
|
||||||
#define kNtSpare6 25
|
#define kNtSpare6 25
|
||||||
#define kNtWrKernel 26
|
#define kNtWrKernel 26
|
||||||
#define kNtMaximumWaitReason 27
|
#define kNtMaximumWaitReason 27
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_ */
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_PROCESSACCESS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_PROCESSACCESS_H_
|
||||||
#include "libc/nt/enum/accessmask.h"
|
#include "libc/nt/enum/accessmask.h"
|
||||||
|
|
||||||
#define kNtProcessCreateProcess 0x0080u
|
#define kNtProcessCreateProcess 0x0080u
|
||||||
#define kNtProcessCreateThread 0x0002u
|
#define kNtProcessCreateThread 0x0002u
|
||||||
#define kNtProcessDupHandle 0x0040u
|
#define kNtProcessDupHandle 0x0040u
|
||||||
#define kNtProcessQueryInformation 0x0400u
|
#define kNtProcessQueryInformation 0x0400u
|
||||||
#define kNtProcessQueryLimitedInformation 0x1000u
|
#define kNtProcessQueryLimitedInformation 0x1000u
|
||||||
#define kNtProcessSetInformation 0x0200u
|
#define kNtProcessSetInformation 0x0200u
|
||||||
#define kNtProcessSetQuota 0x0100u
|
#define kNtProcessSetQuota 0x0100u
|
||||||
#define kNtProcessSuspendResume 0x0800u
|
#define kNtProcessSuspendResume 0x0800u
|
||||||
#define kNtProcessTerminate 0x0001u
|
#define kNtProcessTerminate 0x0001u
|
||||||
#define kNtProcessVmOperation 0x0008u
|
#define kNtProcessVmOperation 0x0008u
|
||||||
#define kNtProcessVmRead 0x0010u
|
#define kNtProcessVmRead 0x0010u
|
||||||
#define kNtProcessVmWrite 0x0020u
|
#define kNtProcessVmWrite 0x0020u
|
||||||
#define kNtProcessSynchronize kNtSynchronize
|
#define kNtProcessSynchronize kNtSynchronize
|
||||||
#define kNtProcessAllAccess \
|
#define kNtProcessAllAccess \
|
||||||
(kNtStandardRightsRequired | kNtSynchronize | 0xffffu)
|
(kNtStandardRightsRequired | kNtSynchronize | 0xffffu)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_
|
||||||
|
|
||||||
#define kNtProcThreadAttributeReplaceValue 1
|
#define kNtProcThreadAttributeReplaceValue 1
|
||||||
#define kNtProcThreadAttributeHandleList 0x00020002
|
#define kNtProcThreadAttributeHandleList 0x00020002
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_ */
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_
|
||||||
|
|
||||||
#define kNtOwnerSecurityInformation 0x00000001
|
#define kNtOwnerSecurityInformation 0x00000001
|
||||||
#define kNtGroupSecurityInformation 0x00000002
|
#define kNtGroupSecurityInformation 0x00000002
|
||||||
#define kNtDaclSecurityInformation 0x00000004
|
#define kNtDaclSecurityInformation 0x00000004
|
||||||
#define kNtSaclSecurityInformation 0x00000008
|
#define kNtSaclSecurityInformation 0x00000008
|
||||||
#define kNtLabelSecurityInformation 0x00000010
|
#define kNtLabelSecurityInformation 0x00000010
|
||||||
#define kNtAttributeSecurityInformation 0x00000020
|
#define kNtAttributeSecurityInformation 0x00000020
|
||||||
#define kNtScopeSecurityInformation 0x00000040
|
#define kNtScopeSecurityInformation 0x00000040
|
||||||
#define kNtProcessTrustLabelSecurityInformation 0x00000080
|
#define kNtProcessTrustLabelSecurityInformation 0x00000080
|
||||||
#define kNtAccessFilterSecurityInformation 0x00000100
|
#define kNtAccessFilterSecurityInformation 0x00000100
|
||||||
#define kNtBackupSecurityInformation 0x00010000
|
#define kNtBackupSecurityInformation 0x00010000
|
||||||
#define kNtProtectedDaclSecurityInformation 0x80000000
|
#define kNtProtectedDaclSecurityInformation 0x80000000
|
||||||
#define kNtProtectedSaclSecurityInformation 0x40000000
|
#define kNtProtectedSaclSecurityInformation 0x40000000
|
||||||
#define kNtUnprotectedDaclSecurityInformation 0x20000000
|
#define kNtUnprotectedDaclSecurityInformation 0x20000000
|
||||||
#define kNtUnprotectedSaclSecurityInformation 0x10000000
|
#define kNtUnprotectedSaclSecurityInformation 0x10000000
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_ */
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_
|
||||||
|
|
||||||
#define kNtStartfUseshowwindow 0x00000001 /* otherwise wShowWindow ignored */
|
#define kNtStartfUseshowwindow 0x00000001 /* otherwise wShowWindow ignored */
|
||||||
#define kNtStartfUsesize 0x00000002 /* otherwise dwX / dwY ignored */
|
#define kNtStartfUsesize 0x00000002 /* otherwise dwX / dwY ignored */
|
||||||
#define kNtStartfUseposition 0x00000004 /* otherwise dwX/YSize ignored */
|
#define kNtStartfUseposition 0x00000004 /* otherwise dwX/YSize ignored */
|
||||||
#define kNtStartfUsecountchars 0x00000008 /* otherwise dwX/YCountChars ign. */
|
#define kNtStartfUsecountchars 0x00000008 /* otherwise dwX/YCountChars ign. */
|
||||||
#define kNtStartfUsefillattribute 0x00000010 /* etc. */
|
#define kNtStartfUsefillattribute 0x00000010 /* etc. */
|
||||||
#define kNtStartfRunfullscreen 0x00000020
|
#define kNtStartfRunfullscreen 0x00000020
|
||||||
#define kNtStartfForceonfeedback 0x00000040
|
#define kNtStartfForceonfeedback 0x00000040
|
||||||
#define kNtStartfForceofffeedback 0x00000080
|
#define kNtStartfForceofffeedback 0x00000080
|
||||||
#define kNtStartfUsestdhandles 0x00000100 /* otherwise hStd... ignored */
|
#define kNtStartfUsestdhandles 0x00000100 /* otherwise hStd... ignored */
|
||||||
#define kNtStartfUsehotkey 0x00000200
|
#define kNtStartfUsehotkey 0x00000200
|
||||||
#define kNtStartfTitleislinkname 0x00000800
|
#define kNtStartfTitleislinkname 0x00000800
|
||||||
#define kNtStartfTitleisappid 0x00001000
|
#define kNtStartfTitleisappid 0x00001000
|
||||||
#define kNtStartfPreventpinning 0x00002000
|
#define kNtStartfPreventpinning 0x00002000
|
||||||
#define kNtStartfUntrustedsource 0x00008000
|
#define kNtStartfUntrustedsource 0x00008000
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_ */
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_
|
||||||
|
|
||||||
#define kNtSystemBasicInformation 0
|
#define kNtSystemBasicInformation 0
|
||||||
#define kNtSystemProcessorInformation 1
|
#define kNtSystemProcessorInformation 1
|
||||||
#define kNtSystemPerformanceInformation 2
|
#define kNtSystemPerformanceInformation 2
|
||||||
#define kNtSystemTimeOfDayInformation 3
|
#define kNtSystemTimeOfDayInformation 3
|
||||||
#define kNtSystemProcessInformation 5
|
#define kNtSystemProcessInformation 5
|
||||||
#define kNtSystemProcessorTimes 8
|
#define kNtSystemProcessorTimes 8
|
||||||
#define kNtSystemGlobalFlag 9
|
#define kNtSystemGlobalFlag 9
|
||||||
#define kNtSystemModuleInformation 11
|
#define kNtSystemModuleInformation 11
|
||||||
#define kNtSystemLockInformation 12
|
#define kNtSystemLockInformation 12
|
||||||
#define kNtSystemHandleInformation 16
|
#define kNtSystemHandleInformation 16
|
||||||
#define kNtSystemObjectInformation 17
|
#define kNtSystemObjectInformation 17
|
||||||
#define kNtSystemInterruptInformation 23
|
#define kNtSystemInterruptInformation 23
|
||||||
#define kNtSystemExceptionInformation 33
|
#define kNtSystemExceptionInformation 33
|
||||||
#define kNtSystemRegistryQuotaInformation 37
|
#define kNtSystemRegistryQuotaInformation 37
|
||||||
#define kNtSystemLookasideInformation 45
|
#define kNtSystemLookasideInformation 45
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_ */
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_
|
||||||
#include "libc/nt/enum/accessmask.h"
|
#include "libc/nt/enum/accessmask.h"
|
||||||
|
|
||||||
#define kNtThreadTerminate 0x0001
|
#define kNtThreadTerminate 0x0001
|
||||||
#define kNtThreadSuspendResume 0x0002
|
#define kNtThreadSuspendResume 0x0002
|
||||||
#define kNtThreadGetContext 0x0008
|
#define kNtThreadGetContext 0x0008
|
||||||
#define kNtThreadSetContext 0x0010
|
#define kNtThreadSetContext 0x0010
|
||||||
#define kNtThreadQueryInformation 0x0040
|
#define kNtThreadQueryInformation 0x0040
|
||||||
#define kNtThreadSetInformation 0x0020
|
#define kNtThreadSetInformation 0x0020
|
||||||
#define kNtThreadSetThreadToken 0x0080
|
#define kNtThreadSetThreadToken 0x0080
|
||||||
#define kNtThreadImpersonate 0x0100
|
#define kNtThreadImpersonate 0x0100
|
||||||
#define kNtThreadDirectImpersonation 0x0200
|
#define kNtThreadDirectImpersonation 0x0200
|
||||||
#define kNtThreadSetLimitedInformation 0x0400
|
#define kNtThreadSetLimitedInformation 0x0400
|
||||||
#define kNtThreadQueryLimitedInformation 0x0800
|
#define kNtThreadQueryLimitedInformation 0x0800
|
||||||
#define kNtThreadResume 0x1000
|
#define kNtThreadResume 0x1000
|
||||||
#define kNtThreadAllAccess (kNtStandardRightsRequired | kNtSynchronize | 0xFFFF)
|
#define kNtThreadAllAccess (kNtStandardRightsRequired | kNtSynchronize | 0xFFFF)
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_ */
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_
|
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_
|
||||||
#define COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_
|
#define COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_
|
||||||
|
|
||||||
#define kNtTokenUser 1
|
#define kNtTokenUser 1
|
||||||
#define kNtTokenGroups 2
|
#define kNtTokenGroups 2
|
||||||
#define kNtTokenPrivileges 3
|
#define kNtTokenPrivileges 3
|
||||||
#define kNtTokenOwner 4
|
#define kNtTokenOwner 4
|
||||||
#define kNtTokenPrimaryGroup 5
|
#define kNtTokenPrimaryGroup 5
|
||||||
#define kNtTokenDefaultDacl 6
|
#define kNtTokenDefaultDacl 6
|
||||||
#define kNtTokenSource 7
|
#define kNtTokenSource 7
|
||||||
#define kNtTokenType 8
|
#define kNtTokenType 8
|
||||||
#define kNtTokenImpersonationLevel 9
|
#define kNtTokenImpersonationLevel 9
|
||||||
#define kNtTokenStatistics 10
|
#define kNtTokenStatistics 10
|
||||||
#define kNtTokenRestrictedSids 11
|
#define kNtTokenRestrictedSids 11
|
||||||
#define kNtTokenSessionId 12
|
#define kNtTokenSessionId 12
|
||||||
#define kNtTokenGroupsAndPrivileges 13
|
#define kNtTokenGroupsAndPrivileges 13
|
||||||
#define kNtTokenSessionReference 14
|
#define kNtTokenSessionReference 14
|
||||||
#define kNtTokenSandBoxInert 15
|
#define kNtTokenSandBoxInert 15
|
||||||
#define kNtTokenAuditPolicy 16
|
#define kNtTokenAuditPolicy 16
|
||||||
#define kNtTokenOrigin 17
|
#define kNtTokenOrigin 17
|
||||||
#define kNtTokenInfoClass_MAX 18
|
#define kNtTokenInfoClass_MAX 18
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_ */
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#define kNtExceptionMaximumParameters 15
|
#define kNtExceptionMaximumParameters 15
|
||||||
#define kNtExceptionNoncontinuable 1
|
#define kNtExceptionNoncontinuable 1
|
||||||
|
|
||||||
|
|
||||||
struct NtExceptionRecord {
|
struct NtExceptionRecord {
|
||||||
uint32_t ExceptionCode; /* kNtException... */
|
uint32_t ExceptionCode; /* kNtException... */
|
||||||
uint32_t ExceptionFlags; /* kNtExceptionNoncontinuable */
|
uint32_t ExceptionFlags; /* kNtExceptionNoncontinuable */
|
||||||
|
|
|
@ -74,8 +74,8 @@ char *GetInterpreterExecutableName(char *p, size_t n) {
|
||||||
cmd[2] = 12; // KERN_PROC_PATHNAME
|
cmd[2] = 12; // KERN_PROC_PATHNAME
|
||||||
} else { //
|
} else { //
|
||||||
cmd[2] = 5; // KERN_PROC_PATHNAME
|
cmd[2] = 5; // KERN_PROC_PATHNAME
|
||||||
} //
|
} //
|
||||||
cmd[3] = -1; // current process
|
cmd[3] = -1; // current process
|
||||||
if (sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) {
|
if (sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) {
|
||||||
errno = e;
|
errno = e;
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -205,9 +205,9 @@ void __unref_page(struct mman *, uint64_t *, uint64_t);
|
||||||
* I/O devices.
|
* I/O devices.
|
||||||
*/
|
*/
|
||||||
forceinline void __invert_and_perm_ref_memory_area(struct mman *mm,
|
forceinline void __invert_and_perm_ref_memory_area(struct mman *mm,
|
||||||
uint64_t *pml4t, uint64_t ps,
|
uint64_t *pml4t, uint64_t ps,
|
||||||
uint64_t size,
|
uint64_t size,
|
||||||
uint64_t pte_flags) {
|
uint64_t pte_flags) {
|
||||||
__invert_memory_area(mm, pml4t, ps, size, pte_flags | PAGE_REFC);
|
__invert_memory_area(mm, pml4t, ps, size, pte_flags | PAGE_REFC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,7 @@ static int __zipos_dupfd(int fd, int cmd, int start) {
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
return einval();
|
return einval();
|
||||||
if (IsWindows()) {
|
if (IsWindows()) {
|
||||||
return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0),
|
return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0), start);
|
||||||
start);
|
|
||||||
}
|
}
|
||||||
rc = sys_fcntl(fd, cmd, start, __sys_fcntl);
|
rc = sys_fcntl(fd, cmd, start, __sys_fcntl);
|
||||||
if (rc != -1) {
|
if (rc != -1) {
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
* @return virtual base address of new mapping, or MAP_FAILED w/ errno
|
* @return virtual base address of new mapping, or MAP_FAILED w/ errno
|
||||||
*/
|
*/
|
||||||
void *__zipos_mmap(void *addr, size_t size, int prot, int flags,
|
void *__zipos_mmap(void *addr, size_t size, int prot, int flags,
|
||||||
struct ZiposHandle *h, int64_t off) {
|
struct ZiposHandle *h, int64_t off) {
|
||||||
|
|
||||||
if (off < 0) {
|
if (off < 0) {
|
||||||
STRACE("negative zipos mmap offset");
|
STRACE("negative zipos mmap offset");
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/sysv/errfuns.h"
|
|
||||||
#include "libc/runtime/zipos.internal.h"
|
#include "libc/runtime/zipos.internal.h"
|
||||||
|
#include "libc/sysv/errfuns.h"
|
||||||
|
|
||||||
int __zipos_notat(int dirfd, const char *path) {
|
int __zipos_notat(int dirfd, const char *path) {
|
||||||
struct ZiposUri zipname;
|
struct ZiposUri zipname;
|
||||||
|
|
|
@ -127,7 +127,7 @@ https://github.com/piscisaureus/wepoll");
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CONTAINOF(ptr, type, member) \
|
#define CONTAINOF(ptr, type, member) \
|
||||||
((type *)((uintptr_t)(ptr) - offsetof(type, member)))
|
((type *)((uintptr_t)(ptr)-offsetof(type, member)))
|
||||||
|
|
||||||
#define TREE__ROTATE(cis, trans) \
|
#define TREE__ROTATE(cis, trans) \
|
||||||
struct TreeNode *p = node; \
|
struct TreeNode *p = node; \
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
#include "libc/calls/syscall-sysv.internal.h"
|
#include "libc/calls/syscall-sysv.internal.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/serialize.h"
|
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/nt/errors.h"
|
#include "libc/nt/errors.h"
|
||||||
#include "libc/nt/iphlpapi.h"
|
#include "libc/nt/iphlpapi.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/sock/sock.h"
|
#include "libc/sock/sock.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/af.h"
|
#include "libc/sysv/consts/af.h"
|
||||||
|
|
|
@ -553,9 +553,10 @@ int __vcscanf(int callback(void *), //
|
||||||
items = -1;
|
items = -1;
|
||||||
goto Done;
|
goto Done;
|
||||||
} else if (rawmode && j != width) {
|
} else if (rawmode && j != width) {
|
||||||
/* The C standard says that %c "matches a sequence of characters of
|
/* The C standard says that %c "matches a sequence of characters
|
||||||
* **exactly** the number specified by the field width". If we have
|
* of
|
||||||
* fewer characters, what we've just read is invalid. */
|
* **exactly** the number specified by the field width". If we
|
||||||
|
* have fewer characters, what we've just read is invalid. */
|
||||||
goto Done;
|
goto Done;
|
||||||
} else if (!rawmode && j < bufsize) {
|
} else if (!rawmode && j < bufsize) {
|
||||||
if (charbytes == sizeof(char)) {
|
if (charbytes == sizeof(char)) {
|
||||||
|
|
|
@ -372,76 +372,76 @@ int iswpunct(wint_t c) {
|
||||||
case u'⹍': // PARAGRAPHUS MARK (0x2e4d Po)
|
case u'⹍': // PARAGRAPHUS MARK (0x2e4d Po)
|
||||||
case u'⹎': // PUNCTUS ELEVATUS MARK (0x2e4e Po)
|
case u'⹎': // PUNCTUS ELEVATUS MARK (0x2e4e Po)
|
||||||
case u'⹏': // CORNISH VERSE DIVIDER (0x2e4f Po)
|
case u'⹏': // CORNISH VERSE DIVIDER (0x2e4f Po)
|
||||||
case u'、': // IDEOGRAPHIC COMMA (0x3001 Po)
|
case u'、': // IDEOGRAPHIC COMMA (0x3001 Po)
|
||||||
case u'。': // IDEOGRAPHIC FULL STOP (0x3002 Po)
|
case u'。': // IDEOGRAPHIC FULL STOP (0x3002 Po)
|
||||||
case u'〃': // DITTO MARK (0x3003 Po)
|
case u'〃': // DITTO MARK (0x3003 Po)
|
||||||
case u'〈': // LEFT ANGLE BRACKET (0x3008 Ps)
|
case u'〈': // LEFT ANGLE BRACKET (0x3008 Ps)
|
||||||
case u'〉': // RIGHT ANGLE BRACKET (0x3009 Pe)
|
case u'〉': // RIGHT ANGLE BRACKET (0x3009 Pe)
|
||||||
case u'《': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps)
|
case u'《': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps)
|
||||||
case u'》': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe)
|
case u'》': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe)
|
||||||
case u'「': // LEFT CORNER BRACKET (0x300c Ps)
|
case u'「': // LEFT CORNER BRACKET (0x300c Ps)
|
||||||
case u'」': // RIGHT CORNER BRACKET (0x300d Pe)
|
case u'」': // RIGHT CORNER BRACKET (0x300d Pe)
|
||||||
case u'『': // LEFT WHITE CORNER BRACKET (0x300e Ps)
|
case u'『': // LEFT WHITE CORNER BRACKET (0x300e Ps)
|
||||||
case u'』': // RIGHT WHITE CORNER BRACKET (0x300f Pe)
|
case u'』': // RIGHT WHITE CORNER BRACKET (0x300f Pe)
|
||||||
case u'【': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps)
|
case u'【': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps)
|
||||||
case u'】': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe)
|
case u'】': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe)
|
||||||
case u'〔': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps)
|
case u'〔': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps)
|
||||||
case u'〕': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe)
|
case u'〕': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe)
|
||||||
case u'〖': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps)
|
case u'〖': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps)
|
||||||
case u'〗': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe)
|
case u'〗': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe)
|
||||||
case u'〘': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps)
|
case u'〘': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps)
|
||||||
case u'〙': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe)
|
case u'〙': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe)
|
||||||
case u'〚': // LEFT WHITE SQUARE BRACKET (0x301a Ps)
|
case u'〚': // LEFT WHITE SQUARE BRACKET (0x301a Ps)
|
||||||
case u'〛': // RIGHT WHITE SQUARE BRACKET (0x301b Pe)
|
case u'〛': // RIGHT WHITE SQUARE BRACKET (0x301b Pe)
|
||||||
case u'〜': // WAVE DASH (0x301c Pd)
|
case u'〜': // WAVE DASH (0x301c Pd)
|
||||||
case u'〝': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps)
|
case u'〝': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps)
|
||||||
case u'〞': // DOUBLE PRIME QUOTATION MARK (0x301e Pe)
|
case u'〞': // DOUBLE PRIME QUOTATION MARK (0x301e Pe)
|
||||||
case u'〟': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe)
|
case u'〟': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe)
|
||||||
case u'〰': // WAVY DASH (0x3030 Pd)
|
case u'〰': // WAVY DASH (0x3030 Pd)
|
||||||
case u'〽': // PART ALTERNATION MARK (0x303d Po)
|
case u'〽': // PART ALTERNATION MARK (0x303d Po)
|
||||||
case u'゠': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd)
|
case u'゠': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd)
|
||||||
case u'・': // KATAKANA MIDDLE DOT (0x30fb Po)
|
case u'・': // KATAKANA MIDDLE DOT (0x30fb Po)
|
||||||
case u'꓾': // LISU PUNCTUATION COMMA (0xa4fe Po)
|
case u'꓾': // LISU PUNCTUATION COMMA (0xa4fe Po)
|
||||||
case u'꓿': // LISU PUNCTUATION FULL STOP (0xa4ff Po)
|
case u'꓿': // LISU PUNCTUATION FULL STOP (0xa4ff Po)
|
||||||
case u'꘍': // VAI COMMA (0xa60d Po)
|
case u'꘍': // VAI COMMA (0xa60d Po)
|
||||||
case u'꘎': // VAI FULL STOP (0xa60e Po)
|
case u'꘎': // VAI FULL STOP (0xa60e Po)
|
||||||
case u'꘏': // VAI QUESTION MARK (0xa60f Po)
|
case u'꘏': // VAI QUESTION MARK (0xa60f Po)
|
||||||
case u'꙾': // CYRILLIC KAVYKA (0xa67e Po)
|
case u'꙾': // CYRILLIC KAVYKA (0xa67e Po)
|
||||||
case u'꡴': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po)
|
case u'꡴': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po)
|
||||||
case u'꡵': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po)
|
case u'꡵': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po)
|
||||||
case u'꡶': // PHAGS-PA MARK SHAD (0xa876 Po)
|
case u'꡶': // PHAGS-PA MARK SHAD (0xa876 Po)
|
||||||
case u'꡷': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po)
|
case u'꡷': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po)
|
||||||
case u'꣎': // SAURASHTRA DANDA (0xa8ce Po)
|
case u'꣎': // SAURASHTRA DANDA (0xa8ce Po)
|
||||||
case u'꣏': // SAURASHTRA DOUBLE DANDA (0xa8cf Po)
|
case u'꣏': // SAURASHTRA DOUBLE DANDA (0xa8cf Po)
|
||||||
case u'꣸': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po)
|
case u'꣸': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po)
|
||||||
case u'꣹': // DEVANAGARI GAP FILLER (0xa8f9 Po)
|
case u'꣹': // DEVANAGARI GAP FILLER (0xa8f9 Po)
|
||||||
case u'꣺': // DEVANAGARI CARET (0xa8fa Po)
|
case u'꣺': // DEVANAGARI CARET (0xa8fa Po)
|
||||||
case u'꣼': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po)
|
case u'꣼': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po)
|
||||||
case u'꧁': // JAVANESE LEFT RERENGGAN (0xa9c1 Po)
|
case u'꧁': // JAVANESE LEFT RERENGGAN (0xa9c1 Po)
|
||||||
case u'꧂': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po)
|
case u'꧂': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po)
|
||||||
case u'꧃': // JAVANESE PADA ANDAP (0xa9c3 Po)
|
case u'꧃': // JAVANESE PADA ANDAP (0xa9c3 Po)
|
||||||
case u'꧄': // JAVANESE PADA MADYA (0xa9c4 Po)
|
case u'꧄': // JAVANESE PADA MADYA (0xa9c4 Po)
|
||||||
case u'꧅': // JAVANESE PADA LUHUR (0xa9c5 Po)
|
case u'꧅': // JAVANESE PADA LUHUR (0xa9c5 Po)
|
||||||
case u'꧆': // JAVANESE PADA WINDU (0xa9c6 Po)
|
case u'꧆': // JAVANESE PADA WINDU (0xa9c6 Po)
|
||||||
case u'꧇': // JAVANESE PADA PANGKAT (0xa9c7 Po)
|
case u'꧇': // JAVANESE PADA PANGKAT (0xa9c7 Po)
|
||||||
case u'꧈': // JAVANESE PADA LINGSA (0xa9c8 Po)
|
case u'꧈': // JAVANESE PADA LINGSA (0xa9c8 Po)
|
||||||
case u'꧉': // JAVANESE PADA LUNGSI (0xa9c9 Po)
|
case u'꧉': // JAVANESE PADA LUNGSI (0xa9c9 Po)
|
||||||
case u'꧊': // JAVANESE PADA ADEG (0xa9ca Po)
|
case u'꧊': // JAVANESE PADA ADEG (0xa9ca Po)
|
||||||
case u'꧋': // JAVANESE PADA ADEG ADEG (0xa9cb Po)
|
case u'꧋': // JAVANESE PADA ADEG ADEG (0xa9cb Po)
|
||||||
case u'꧌': // JAVANESE PADA PISELEH (0xa9cc Po)
|
case u'꧌': // JAVANESE PADA PISELEH (0xa9cc Po)
|
||||||
case u'꧍': // JAVANESE TURNED PADA PISELEH (0xa9cd Po)
|
case u'꧍': // JAVANESE TURNED PADA PISELEH (0xa9cd Po)
|
||||||
case u'꧞': // JAVANESE PADA TIRTA TUMETES (0xa9de Po)
|
case u'꧞': // JAVANESE PADA TIRTA TUMETES (0xa9de Po)
|
||||||
case u'꧟': // JAVANESE PADA ISEN-ISEN (0xa9df Po)
|
case u'꧟': // JAVANESE PADA ISEN-ISEN (0xa9df Po)
|
||||||
case u'꩜': // CHAM PUNCTUATION SPIRAL (0xaa5c Po)
|
case u'꩜': // CHAM PUNCTUATION SPIRAL (0xaa5c Po)
|
||||||
case u'꩝': // CHAM PUNCTUATION DANDA (0xaa5d Po)
|
case u'꩝': // CHAM PUNCTUATION DANDA (0xaa5d Po)
|
||||||
case u'꩞': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po)
|
case u'꩞': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po)
|
||||||
case u'꩟': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po)
|
case u'꩟': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po)
|
||||||
case u'꫞': // TAI VIET SYMBOL HO HOI (0xaade Po)
|
case u'꫞': // TAI VIET SYMBOL HO HOI (0xaade Po)
|
||||||
case u'꫟': // TAI VIET SYMBOL KOI KOI (0xaadf Po)
|
case u'꫟': // TAI VIET SYMBOL KOI KOI (0xaadf Po)
|
||||||
case u'꫰': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po)
|
case u'꫰': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po)
|
||||||
case u'꫱': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po)
|
case u'꫱': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po)
|
||||||
case u'꯫': // MEETEI MAYEK CHEIKHEI (0xabeb Po)
|
case u'꯫': // MEETEI MAYEK CHEIKHEI (0xabeb Po)
|
||||||
case u'︐': // PRESENTATION FORM FOR VERTICAL COMMA (0xfe10 Po)
|
case u'︐': // PRESENTATION FORM FOR VERTICAL COMMA (0xfe10 Po)
|
||||||
case u'︑': // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (0xfe11 Po)
|
case u'︑': // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (0xfe11 Po)
|
||||||
case u'︒': // PRESENTATION FORM FOR VERTICAL IDEO FULL STOP (0xfe12 Po)
|
case u'︒': // PRESENTATION FORM FOR VERTICAL IDEO FULL STOP (0xfe12 Po)
|
||||||
case u'︓': // PRESENTATION FORM FOR VERTICAL COLON (0xfe13 Po)
|
case u'︓': // PRESENTATION FORM FOR VERTICAL COLON (0xfe13 Po)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
#define LC_GLOBAL_LOCALE ((locale_t) - 1)
|
#define LC_GLOBAL_LOCALE ((locale_t)-1)
|
||||||
|
|
||||||
struct __locale_map {
|
struct __locale_map {
|
||||||
const void *map;
|
const void *map;
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
│ 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/serialize.h"
|
|
||||||
#include "libc/intrin/pushpop.internal.h"
|
#include "libc/intrin/pushpop.internal.h"
|
||||||
#include "libc/intrin/repmovsb.h"
|
#include "libc/intrin/repmovsb.h"
|
||||||
#include "libc/nexgen32e/kompressor.h"
|
#include "libc/nexgen32e/kompressor.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,25 +13,30 @@
|
||||||
forceinline int tpdecodecb(wint_t *out, int first,
|
forceinline int tpdecodecb(wint_t *out, int first,
|
||||||
int get(void *arg, uint32_t i), void *arg) {
|
int get(void *arg, uint32_t i), void *arg) {
|
||||||
uint32_t wc, cb, need, msb, j, i = 1;
|
uint32_t wc, cb, need, msb, j, i = 1;
|
||||||
if (__builtin_expect((wc = first) == -1, 0)) return -1;
|
if (__builtin_expect((wc = first) == -1, 0))
|
||||||
|
return -1;
|
||||||
while (__builtin_expect((wc & 0b11000000) == 0b10000000, 0)) {
|
while (__builtin_expect((wc & 0b11000000) == 0b10000000, 0)) {
|
||||||
if ((wc = get(arg, i++)) == -1) return -1;
|
if ((wc = get(arg, i++)) == -1)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) {
|
if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) {
|
||||||
msb = wc < 252 ? bsr(~wc & 0xff) : 1;
|
msb = wc < 252 ? bsr(~wc & 0xff) : 1;
|
||||||
need = 7 - msb;
|
need = 7 - msb;
|
||||||
wc &= ((1u << msb) - 1) | 0b00000011;
|
wc &= ((1u << msb) - 1) | 0b00000011;
|
||||||
for (j = 1; j < need; ++j) {
|
for (j = 1; j < need; ++j) {
|
||||||
if ((cb = get(arg, i++)) == -1) return -1;
|
if ((cb = get(arg, i++)) == -1)
|
||||||
|
return -1;
|
||||||
if ((cb & 0b11000000) == 0b10000000) {
|
if ((cb & 0b11000000) == 0b10000000) {
|
||||||
wc = wc << 6 | (cb & 0b00111111);
|
wc = wc << 6 | (cb & 0b00111111);
|
||||||
} else {
|
} else {
|
||||||
if (out) *out = u'\xFFFD';
|
if (out)
|
||||||
|
*out = u'\xFFFD';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (__builtin_expect(!!out, 1)) *out = (wint_t)wc;
|
if (__builtin_expect(!!out, 1))
|
||||||
|
*out = (wint_t)wc;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
│ 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/serialize.h"
|
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
static const char kWcTypeNames[][8] = {
|
static const char kWcTypeNames[][8] = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_FILENO_H_
|
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_FILENO_H_
|
||||||
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_FILENO_H_
|
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_FILENO_H_
|
||||||
|
|
||||||
#define STDIN_FILENO 0
|
#define STDIN_FILENO 0
|
||||||
#define STDOUT_FILENO 1
|
#define STDOUT_FILENO 1
|
||||||
#define STDERR_FILENO 2
|
#define STDERR_FILENO 2
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,36 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_
|
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_
|
||||||
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_
|
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_
|
||||||
|
|
||||||
#define ICMP6_DST_UNREACH ICMP6_DST_UNREACH
|
#define ICMP6_DST_UNREACH ICMP6_DST_UNREACH
|
||||||
#define ICMP6_DST_UNREACH_ADDR ICMP6_DST_UNREACH_ADDR
|
#define ICMP6_DST_UNREACH_ADDR ICMP6_DST_UNREACH_ADDR
|
||||||
#define ICMP6_DST_UNREACH_ADMIN ICMP6_DST_UNREACH_ADMIN
|
#define ICMP6_DST_UNREACH_ADMIN ICMP6_DST_UNREACH_ADMIN
|
||||||
#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_BEYONDSCOPE
|
#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_BEYONDSCOPE
|
||||||
#define ICMP6_DST_UNREACH_NOPORT ICMP6_DST_UNREACH_NOPORT
|
#define ICMP6_DST_UNREACH_NOPORT ICMP6_DST_UNREACH_NOPORT
|
||||||
#define ICMP6_DST_UNREACH_NOROUTE ICMP6_DST_UNREACH_NOROUTE
|
#define ICMP6_DST_UNREACH_NOROUTE ICMP6_DST_UNREACH_NOROUTE
|
||||||
#define ICMP6_ECHO_REPLY ICMP6_ECHO_REPLY
|
#define ICMP6_ECHO_REPLY ICMP6_ECHO_REPLY
|
||||||
#define ICMP6_ECHO_REQUEST ICMP6_ECHO_REQUEST
|
#define ICMP6_ECHO_REQUEST ICMP6_ECHO_REQUEST
|
||||||
#define ICMP6_FILTER ICMP6_FILTER
|
#define ICMP6_FILTER ICMP6_FILTER
|
||||||
#define ICMP6_INFOMSG_MASK ICMP6_INFOMSG_MASK
|
#define ICMP6_INFOMSG_MASK ICMP6_INFOMSG_MASK
|
||||||
#define ICMP6_PACKET_TOO_BIG ICMP6_PACKET_TOO_BIG
|
#define ICMP6_PACKET_TOO_BIG ICMP6_PACKET_TOO_BIG
|
||||||
#define ICMP6_PARAMPROB_HEADER ICMP6_PARAMPROB_HEADER
|
#define ICMP6_PARAMPROB_HEADER ICMP6_PARAMPROB_HEADER
|
||||||
#define ICMP6_PARAMPROB_NEXTHEADER ICMP6_PARAMPROB_NEXTHEADER
|
#define ICMP6_PARAMPROB_NEXTHEADER ICMP6_PARAMPROB_NEXTHEADER
|
||||||
#define ICMP6_PARAMPROB_OPTION ICMP6_PARAMPROB_OPTION
|
#define ICMP6_PARAMPROB_OPTION ICMP6_PARAMPROB_OPTION
|
||||||
#define ICMP6_PARAM_PROB ICMP6_PARAM_PROB
|
#define ICMP6_PARAM_PROB ICMP6_PARAM_PROB
|
||||||
#define ICMP6_ROUTER_RENUMBERING ICMP6_ROUTER_RENUMBERING
|
#define ICMP6_ROUTER_RENUMBERING ICMP6_ROUTER_RENUMBERING
|
||||||
#define ICMP6_RR_FLAGS_FORCEAPPLY ICMP6_RR_FLAGS_FORCEAPPLY
|
#define ICMP6_RR_FLAGS_FORCEAPPLY ICMP6_RR_FLAGS_FORCEAPPLY
|
||||||
#define ICMP6_RR_FLAGS_PREVDONE ICMP6_RR_FLAGS_PREVDONE
|
#define ICMP6_RR_FLAGS_PREVDONE ICMP6_RR_FLAGS_PREVDONE
|
||||||
#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT
|
#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT
|
||||||
#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE
|
#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE
|
||||||
#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST
|
#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST
|
||||||
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME \
|
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME
|
||||||
ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME
|
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME
|
||||||
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME \
|
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO
|
||||||
ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME
|
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK
|
||||||
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO
|
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ICMP6_RR_RESULT_FLAGS_FORBIDDEN
|
||||||
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK
|
#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB
|
||||||
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN \
|
#define ICMP6_TIME_EXCEEDED ICMP6_TIME_EXCEEDED
|
||||||
ICMP6_RR_RESULT_FLAGS_FORBIDDEN
|
#define ICMP6_TIME_EXCEED_REASSEMBLY ICMP6_TIME_EXCEED_REASSEMBLY
|
||||||
#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB
|
#define ICMP6_TIME_EXCEED_TRANSIT ICMP6_TIME_EXCEED_TRANSIT
|
||||||
#define ICMP6_TIME_EXCEEDED ICMP6_TIME_EXCEEDED
|
|
||||||
#define ICMP6_TIME_EXCEED_REASSEMBLY ICMP6_TIME_EXCEED_REASSEMBLY
|
|
||||||
#define ICMP6_TIME_EXCEED_TRANSIT ICMP6_TIME_EXCEED_TRANSIT
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
|
|
@ -38,5 +38,4 @@ COSMOPOLITAN_C_END_
|
||||||
#define IFF_RUNNING IFF_RUNNING
|
#define IFF_RUNNING IFF_RUNNING
|
||||||
#define IFF_SLAVE IFF_SLAVE
|
#define IFF_SLAVE IFF_SLAVE
|
||||||
|
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IFF_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IFF_H_ */
|
||||||
|
|
|
@ -102,6 +102,5 @@ extern const int IP_XFRM_POLICY;
|
||||||
#define IP_UNICAST_IF IP_UNICAST_IF
|
#define IP_UNICAST_IF IP_UNICAST_IF
|
||||||
#define IP_XFRM_POLICY IP_XFRM_POLICY
|
#define IP_XFRM_POLICY IP_XFRM_POLICY
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IP_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IP_H_ */
|
||||||
|
|
|
@ -122,6 +122,5 @@ extern const int IPV6_XFRM_POLICY;
|
||||||
#define IPV6_V6ONLY IPV6_V6ONLY
|
#define IPV6_V6ONLY IPV6_V6ONLY
|
||||||
#define IPV6_XFRM_POLICY IPV6_XFRM_POLICY
|
#define IPV6_XFRM_POLICY IPV6_XFRM_POLICY
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPV6_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPV6_H_ */
|
||||||
|
|
|
@ -24,6 +24,5 @@ extern const int MAX_INPUT;
|
||||||
#define MAX_CANON MAX_CANON
|
#define MAX_CANON MAX_CANON
|
||||||
#define MAX_INPUT MAX_INPUT
|
#define MAX_INPUT MAX_INPUT
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LIMITS_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LIMITS_H_ */
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_LIO_H_
|
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_LIO_H_
|
||||||
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_LIO_H_
|
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_LIO_H_
|
||||||
|
|
||||||
#define LIO_NOP LIO_NOP
|
#define LIO_NOP LIO_NOP
|
||||||
#define LIO_NOWAIT LIO_NOWAIT
|
#define LIO_NOWAIT LIO_NOWAIT
|
||||||
#define LIO_READ LIO_READ
|
#define LIO_READ LIO_READ
|
||||||
#define LIO_WAIT LIO_WAIT
|
#define LIO_WAIT LIO_WAIT
|
||||||
#define LIO_WRITE LIO_WRITE
|
#define LIO_WRITE LIO_WRITE
|
||||||
|
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,4 @@ COSMOPOLITAN_C_END_
|
||||||
#define LOCK_SH LOCK_SH
|
#define LOCK_SH LOCK_SH
|
||||||
#define LOCK_UN LOCK_UN
|
#define LOCK_UN LOCK_UN
|
||||||
|
|
||||||
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOCK_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOCK_H_ */
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_
|
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_
|
||||||
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_
|
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_
|
||||||
|
|
||||||
#define MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE
|
#define MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE
|
||||||
#define MCAST_EXCLUDE MCAST_EXCLUDE
|
#define MCAST_EXCLUDE MCAST_EXCLUDE
|
||||||
#define MCAST_INCLUDE MCAST_INCLUDE
|
#define MCAST_INCLUDE MCAST_INCLUDE
|
||||||
#define MCAST_JOIN_GROUP MCAST_JOIN_GROUP
|
#define MCAST_JOIN_GROUP MCAST_JOIN_GROUP
|
||||||
#define MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP
|
#define MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP
|
||||||
#define MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP
|
#define MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP
|
||||||
#define MCAST_LEAVE_SOURCE_GROUP MCAST_LEAVE_SOURCE_GROUP
|
#define MCAST_LEAVE_SOURCE_GROUP MCAST_LEAVE_SOURCE_GROUP
|
||||||
#define MCAST_MSFILTER MCAST_MSFILTER
|
#define MCAST_MSFILTER MCAST_MSFILTER
|
||||||
#define MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE
|
#define MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE
|
||||||
|
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,5 @@ extern const int TIOCM_ST;
|
||||||
#define TIOCMBIC TIOCMBIC
|
#define TIOCMBIC TIOCMBIC
|
||||||
#define TIOCMBIS TIOCMBIS
|
#define TIOCMBIS TIOCMBIS
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MODEM_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MODEM_H_ */
|
||||||
|
|
|
@ -92,6 +92,5 @@ extern const int MNT_SNAPSHOT;
|
||||||
#define MNT_NOCLUSTERW MNT_NOCLUSTERW
|
#define MNT_NOCLUSTERW MNT_NOCLUSTERW
|
||||||
#define MNT_SNAPSHOT MNT_SNAPSHOT
|
#define MNT_SNAPSHOT MNT_SNAPSHOT
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */
|
||||||
|
|
|
@ -94,6 +94,5 @@ extern const int PF_X25;
|
||||||
#define PF_WANPIPE PF_WANPIPE
|
#define PF_WANPIPE PF_WANPIPE
|
||||||
#define PF_X25 PF_X25
|
#define PF_X25 PF_X25
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PF_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PF_H_ */
|
||||||
|
|
|
@ -27,6 +27,5 @@ extern const int16_t POLLWRNORM;
|
||||||
#define POLLWRBAND POLLWRBAND
|
#define POLLWRBAND POLLWRBAND
|
||||||
#define POLLWRNORM POLLWRNORM
|
#define POLLWRNORM POLLWRNORM
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POLL_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POLL_H_ */
|
||||||
|
|
|
@ -22,6 +22,5 @@ extern const int POSIX_MADV_DONTNEED;
|
||||||
|
|
||||||
#define POSIX_MADV_DONTNEED POSIX_MADV_DONTNEED
|
#define POSIX_MADV_DONTNEED POSIX_MADV_DONTNEED
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */
|
||||||
|
|
|
@ -23,6 +23,5 @@ extern const int TIOCPKT_STOP;
|
||||||
|
|
||||||
#define TIOCPKT TIOCPKT
|
#define TIOCPKT TIOCPKT
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTY_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTY_H_ */
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_
|
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_
|
||||||
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_
|
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_
|
||||||
|
|
||||||
#define READ_10 READ_10
|
#define READ_10 READ_10
|
||||||
#define READ_12 READ_12
|
#define READ_12 READ_12
|
||||||
#define READ_6 READ_6
|
#define READ_6 READ_6
|
||||||
#define READ_BLOCK_LIMITS READ_BLOCK_LIMITS
|
#define READ_BLOCK_LIMITS READ_BLOCK_LIMITS
|
||||||
#define READ_BUFFER READ_BUFFER
|
#define READ_BUFFER READ_BUFFER
|
||||||
#define READ_CAPACITY READ_CAPACITY
|
#define READ_CAPACITY READ_CAPACITY
|
||||||
#define READ_DEFECT_DATA READ_DEFECT_DATA
|
#define READ_DEFECT_DATA READ_DEFECT_DATA
|
||||||
#define READ_ELEMENT_STATUS READ_ELEMENT_STATUS
|
#define READ_ELEMENT_STATUS READ_ELEMENT_STATUS
|
||||||
#define READ_LONG READ_LONG
|
#define READ_LONG READ_LONG
|
||||||
#define READ_POSITION READ_POSITION
|
#define READ_POSITION READ_POSITION
|
||||||
#define READ_REVERSE READ_REVERSE
|
#define READ_REVERSE READ_REVERSE
|
||||||
#define READ_TOC READ_TOC
|
#define READ_TOC READ_TOC
|
||||||
|
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,5 @@ extern const unsigned RB_NOSYNC;
|
||||||
#define RB_DISABLE_CAD RB_DISABLE_CAD
|
#define RB_DISABLE_CAD RB_DISABLE_CAD
|
||||||
#define RB_NOSYNC RB_NOSYNC
|
#define RB_NOSYNC RB_NOSYNC
|
||||||
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */
|
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue