Run clang-format (#1197)

This commit is contained in:
Jōshin 2024-06-01 13:30:43 -07:00 committed by GitHub
parent ea081b262c
commit f032b5570b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
183 changed files with 1074 additions and 983 deletions

View file

@ -10,12 +10,12 @@ void end_cancelation_point(int);
#define END_CANCELATION_POINT (void)0
#else
#define BEGIN_CANCELATION_POINT \
do { \
int _Cp; \
do { \
int _Cp; \
_Cp = begin_cancelation_point()
#define END_CANCELATION_POINT \
end_cancelation_point(_Cp); \
} \
} \
while (0)
#endif

View file

@ -23,8 +23,8 @@
#include "libc/dce.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/errfuns.h"
/**
* Duplicates file descriptor.

View file

@ -76,7 +76,7 @@ int dup2(int oldfd, int newfd) {
rc = oldfd;
} else
#endif
if (!IsWindows()) {
if (!IsWindows()) {
if (__isfdkind(oldfd, kFdZip) || __isfdkind(newfd, kFdZip)) {
if (__vforked) {
return enotsup();

View file

@ -66,7 +66,7 @@ static struct HostAdapterInfoNode {
struct sockaddr netmask;
struct sockaddr broadcast;
short flags;
} * __hostInfo;
} *__hostInfo;
static int ioctl_default(int fd, unsigned long request, void *arg) {
int rc;

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/serialize.h"
#include "libc/proc/execve.internal.h"
#include "libc/serialize.h"
/**
* Returns true if executable image is supported by APE Loader.

View file

@ -24,8 +24,8 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/errfuns.h"
/**
* Creates hard filesystem link.

View file

@ -24,9 +24,9 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
/**
* Creates directory a.k.a. folder.

View file

@ -27,13 +27,13 @@
#include "libc/mem/mem.h"
#include "libc/runtime/pc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
#ifdef __x86_64__

View file

@ -24,9 +24,9 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
/**
* Renames files relative to directories.

View file

@ -17,10 +17,10 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/stdio/sysparam.h"
#include "libc/errno.h"
#include "libc/log/log.h"
#include "libc/paths.h"
#include "libc/stdio/sysparam.h"
/**
* Returns name of terminal.

View file

@ -26,9 +26,9 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/s.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
/**
* Deletes inode and maybe the file too.

View file

@ -5,9 +5,9 @@
#include "libc/elf/struct/phdr.h"
#include "libc/elf/struct/shdr.h"
#include "libc/elf/struct/sym.h"
#include "libc/serialize.h"
#include "libc/limits.h"
#include "libc/log/libfatal.internal.h"
#include "libc/serialize.h"
COSMOPOLITAN_C_START_
#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) {
name = GetSectionName(e, GetShdr(e, i));
if (name && READ64LE(name) == READ64LE(".strtab")) {
if (n) *n = shdr->sh_size;
if (n)
*n = shdr->sh_size;
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;) {
shdr = GetShdr(e, i);
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);
}
}
@ -60,14 +62,19 @@ static inline void GetImageRange(const Elf64_Ehdr *elf, intptr_t *x,
end = 0;
for (i = 0; i < elf->e_phnum; ++i) {
phdr = GetPhdr(elf, i);
if (phdr->p_type != PT_LOAD) continue;
if (phdr->p_type != PT_LOAD)
continue;
pstart = phdr->p_vaddr;
pend = phdr->p_vaddr + phdr->p_memsz;
if (pstart < start) start = pstart;
if (pend > end) end = pend;
if (pstart < start)
start = pstart;
if (pend > end)
end = pend;
}
if (x) *x = start;
if (y) *y = end;
if (x)
*x = start;
if (y)
*y = end;
}
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;
const char *stab;
const Elf64_Sym *st;
if (!(stab = GetStrtab(ehdr, 0))) return false;
if (!(st = GetSymtab(ehdr, &n))) return false;
if (!(stab = GetStrtab(ehdr, 0)))
return false;
if (!(st = GetSymtab(ehdr, &n)))
return false;
for (i = 0; i < n; ++i) {
if (!__strcmp(GetStr(stab, st[i].st_name), name)) {
*res = st[i].st_value;

View file

@ -3,13 +3,16 @@
#include "libc/errno.h"
#include "libc/str/str.h"
#define CONSUME_SPACES(t, s, c) \
if (endptr) *endptr = (t *)(s); \
while (c == ' ' || c == '\t') c = *++s
#define CONSUME_SPACES(t, s, c) \
if (endptr) \
*endptr = (t *)(s); \
while (c == ' ' || c == '\t') \
c = *++s
#define GET_SIGN(s, c, d) \
d = c == '-' ? -1 : 1; \
if (c == '-' || c == '+') c = *++s
#define GET_SIGN(s, c, d) \
d = c == '-' ? -1 : 1; \
if (c == '-' || c == '+') \
c = *++s
#define GET_RADIX(s, c, r) \
if (!r) { \

View file

@ -33,19 +33,22 @@ static inline struct Dll *dll_last(struct Dll *list) {
static inline struct Dll *dll_first(struct Dll *list) {
struct Dll *first = 0;
if (list) first = list->next;
if (list)
first = list->next;
return first;
}
static inline struct Dll *dll_next(struct Dll *list, struct Dll *e) {
struct Dll *next = 0;
if (e != list) next = e->next;
if (e != list)
next = e->next;
return next;
}
static inline struct Dll *dll_prev(struct Dll *list, struct Dll *e) {
struct Dll *prev = 0;
if (e != list->next) prev = e->prev;
if (e != list->next)
prev = e->prev;
return prev;
}

View file

@ -22,7 +22,7 @@
*/
#define asint(x) ((union pun){x}).i
#define isnan(x) (((x) & 0x7fff) > 0x7c00)
#define isnan(x) (((x)&0x7fff) > 0x7c00)
union pun {
_Float16 f;

View file

@ -49,7 +49,8 @@ void uvprintf(const char *, va_list) libcesque;
do { \
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
##__VA_ARGS__); \
for (;;) asm volatile("cli\n\thlt"); \
for (;;) \
asm volatile("cli\n\thlt"); \
} while (0)
COSMOPOLITAN_C_END_

View file

@ -45,7 +45,7 @@
#ifdef __x86_64__
#define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x)))
#define NOPAGE ((uint64_t) - 1)
#define NOPAGE ((uint64_t)-1)
#define APE_STACK_VADDR \
({ \

View file

@ -5,7 +5,8 @@
forceinline void repmovsb(void **dest, const void **src, size_t cx) {
char *di = (char *)*dest;
const char *si = (const char *)*src;
while (cx) *di++ = *si++, cx--;
while (cx)
*di++ = *si++, cx--;
*dest = di, *src = si;
}

View file

@ -4,7 +4,8 @@
forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
unsigned char *di = (unsigned char *)dest;
while (cx) *di++ = al, cx--;
while (cx)
*di++ = al, cx--;
return di;
}

View file

@ -48,7 +48,8 @@ COSMOPOLITAN_C_START_
({ \
autotype(a) FirstNonNullA = (a); \
autotype(a) FirstNonNullB = (b); \
if (!FirstNonNullA && !FirstNonNullB) abort(); \
if (!FirstNonNullA && !FirstNonNullB) \
abort(); \
FirstNonNullA ? FirstNonNullA : FirstNonNullB; \
})

View file

@ -16,9 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/runtime/internal.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h"
__attribute__((__weak__)) void __stack_chk_fail(void) {

View file

@ -31,7 +31,7 @@ static __vex size_t __strlen(const char *s) {
m = __builtin_ia32_pmovmskb128(*++p == z);
return (const char *)p + __builtin_ctzl(m) - s;
#else
#define ONES ((word) - 1 / 255)
#define ONES ((word)-1 / 255)
#define BANE (ONES * (255 / 2 + 1))
typedef unsigned long mayalias word;
word w;

View file

@ -62,8 +62,8 @@ textstartup void _AcpiFadtInit(void) {
_Static_assert(offsetof(AcpiTableFadt, Dsdt) == 40);
_Static_assert(offsetof(AcpiTableFadt, BootFlags) == 109);
_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;
KINFOF("FADT: boot flags %#x", (unsigned)flags);
}

View file

@ -26,7 +26,6 @@
*/
#include "libc/dce.h"
#include "libc/intrin/atomic.h"
#include "libc/serialize.h"
#include "libc/intrin/directmap.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/irq/acpi.internal.h"
@ -34,6 +33,7 @@
#include "libc/macros.internal.h"
#include "libc/nt/efi.h"
#include "libc/runtime/pc.internal.h"
#include "libc/serialize.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"

View file

@ -2,16 +2,16 @@
#define COSMOPOLITAN_LIBC_ISO646_H_
#ifndef __cplusplus
#define and &&
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
#endif /* __cplusplus */

View file

@ -1,5 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_
#include "third_party/libcxxabi/include/cxxabi.h"
#include "libc/cxxabi.h"
#include "third_party/libcxxabi/include/cxxabi.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ */

View file

@ -1,6 +1,6 @@
#ifndef _FTW_H
#define _FTW_H
#include "libc/calls/weirdtypes.h"
#include "libc/sysv/consts/s.h"
#include "libc/stdio/ftw.h"
#include "libc/sysv/consts/s.h"
#endif /* _FTW_H */

View file

@ -1,12 +1,12 @@
#ifndef 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/struct/rlimit.h"
#include "libc/calls/struct/rusage.h"
#include "libc/stdio/sysparam.h"
#include "libc/calls/weirdtypes.h"
#include "libc/intrin/newbie.h"
#include "libc/limits.h"
#include "libc/stdio/sysparam.h"
#include "libc/sysv/consts/endian.h"
#include "libc/sysv/consts/prio.h"
#include "libc/sysv/consts/rlim.h"

View file

@ -3,6 +3,6 @@
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h"
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/consts/sicode.h"
#include "libc/sysv/consts/sig.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */

View file

@ -7,324 +7,316 @@
/* from https://en.cppreference.com/w/c/numeric/tgmath */
#define fabs(x) \
_Generic((x), float \
: fabsf, default \
: fabs, long double \
: fabsl, complex float \
: cabsf, complex double \
: cabs, complex long double \
: cabsl)(x)
#define fabs(x) \
_Generic((x), \
float: fabsf, \
default: fabs, \
long double: fabsl, \
complex float: cabsf, \
complex double: cabs, \
complex long double: cabsl)(x)
#define exp(x) \
_Generic((x), float \
: expf, default \
: exp, long double \
: expl, complex float \
: cexpf, complex double \
: cexp, complex long double \
: cexpl)(x)
#define exp(x) \
_Generic((x), \
float: expf, \
default: exp, \
long double: expl, \
complex float: cexpf, \
complex double: cexp, \
complex long double: cexpl)(x)
#define log(x) \
_Generic((x), float \
: logf, default \
: log, long double \
: logl, complex float \
: clogf, complex double \
: clog, complex long double \
: clogl)(x)
#define log(x) \
_Generic((x), \
float: logf, \
default: log, \
long double: logl, \
complex float: clogf, \
complex double: clog, \
complex long double: clogl)(x)
#define pow(x, y) \
_Generic((x), float \
: powf, default \
: pow, long double \
: powl, complex float \
: cpowf, complex double \
: cpow, complex long double \
: cpowl)(x, y)
#define pow(x, y) \
_Generic((x), \
float: powf, \
default: pow, \
long double: powl, \
complex float: cpowf, \
complex double: cpow, \
complex long double: cpowl)(x, y)
#define sqrt(x) \
_Generic((x), float \
: sqrtf, default \
: sqrt, long double \
: sqrtl, complex float \
: csqrtf, complex double \
: csqrt, complex long double \
: csqrtl)(x)
#define sqrt(x) \
_Generic((x), \
float: sqrtf, \
default: sqrt, \
long double: sqrtl, \
complex float: csqrtf, \
complex double: csqrt, \
complex long double: csqrtl)(x)
#define sin(x) \
_Generic((x), float \
: sinf, default \
: sin, long double \
: sinl, complex float \
: csinf, complex double \
: csin, complex long double \
: csinl)(x)
#define sin(x) \
_Generic((x), \
float: sinf, \
default: sin, \
long double: sinl, \
complex float: csinf, \
complex double: csin, \
complex long double: csinl)(x)
#define cos(x) \
_Generic((x), float \
: cosf, default \
: cos, long double \
: cosl, complex float \
: ccosf, complex double \
: ccos, complex long double \
: ccosl)(x)
#define cos(x) \
_Generic((x), \
float: cosf, \
default: cos, \
long double: cosl, \
complex float: ccosf, \
complex double: ccos, \
complex long double: ccosl)(x)
#define tan(x) \
_Generic((x), float \
: tanf, default \
: tan, long double \
: tanl, complex float \
: ctanf, complex double \
: ctan, complex long double \
: ctanl)(x)
#define tan(x) \
_Generic((x), \
float: tanf, \
default: tan, \
long double: tanl, \
complex float: ctanf, \
complex double: ctan, \
complex long double: ctanl)(x)
#define asin(x) \
_Generic((x), float \
: asinf, default \
: asin, long double \
: asinl, complex float \
: casinf, complex double \
: casin, complex long double \
: casinl)(x)
#define asin(x) \
_Generic((x), \
float: asinf, \
default: asin, \
long double: asinl, \
complex float: casinf, \
complex double: casin, \
complex long double: casinl)(x)
#define acos(x) \
_Generic((x), float \
: acosf, default \
: acos, long double \
: acosl, complex float \
: cacosf, complex double \
: cacos, complex long double \
: cacosl)(x)
#define acos(x) \
_Generic((x), \
float: acosf, \
default: acos, \
long double: acosl, \
complex float: cacosf, \
complex double: cacos, \
complex long double: cacosl)(x)
#define atan(x) \
_Generic((x), float \
: atanf, default \
: atan, long double \
: atanl, complex float \
: catanf, complex double \
: catan, complex long double \
: catanl)(x)
#define atan(x) \
_Generic((x), \
float: atanf, \
default: atan, \
long double: atanl, \
complex float: catanf, \
complex double: catan, \
complex long double: catanl)(x)
#define sinh(x) \
_Generic((x), float \
: sinhf, default \
: sinh, long double \
: sinhl, complex float \
: csinhf, complex double \
: csinh, complex long double \
: csinhl)(x)
#define sinh(x) \
_Generic((x), \
float: sinhf, \
default: sinh, \
long double: sinhl, \
complex float: csinhf, \
complex double: csinh, \
complex long double: csinhl)(x)
#define cosh(x) \
_Generic((x), float \
: coshf, default \
: cosh, long double \
: coshl, complex float \
: ccoshf, complex double \
: ccosh, complex long double \
: ccoshl)(x)
#define cosh(x) \
_Generic((x), \
float: coshf, \
default: cosh, \
long double: coshl, \
complex float: ccoshf, \
complex double: ccosh, \
complex long double: ccoshl)(x)
#define tanh(x) \
_Generic((x), float \
: tanhf, default \
: tanh, long double \
: tanhl, complex float \
: ctanhf, complex double \
: ctanh, complex long double \
: ctanhl)(x)
#define tanh(x) \
_Generic((x), \
float: tanhf, \
default: tanh, \
long double: tanhl, \
complex float: ctanhf, \
complex double: ctanh, \
complex long double: ctanhl)(x)
#define asinh(x) \
_Generic((x), float \
: asinhf, default \
: asinh, long double \
: asinhl, complex float \
: casinhf, complex double \
: casinh, complex long double \
: casinhl)(x)
#define asinh(x) \
_Generic((x), \
float: asinhf, \
default: asinh, \
long double: asinhl, \
complex float: casinhf, \
complex double: casinh, \
complex long double: casinhl)(x)
#define acosh(x) \
_Generic((x), float \
: acoshf, default \
: acosh, long double \
: acoshl, complex float \
: cacoshf, complex double \
: cacosh, complex long double \
: cacoshl)(x)
#define acosh(x) \
_Generic((x), \
float: acoshf, \
default: acosh, \
long double: acoshl, \
complex float: cacoshf, \
complex double: cacosh, \
complex long double: cacoshl)(x)
#define atanh(x) \
_Generic((x), float \
: atanhf, default \
: atanh, long double \
: atanhl, complex float \
: catanhf, complex double \
: catanh, complex long double \
: catanhl)(x)
#define atanh(x) \
_Generic((x), \
float: atanhf, \
default: atanh, \
long double: atanhl, \
complex float: catanhf, \
complex double: catanh, \
complex long double: catanhl)(x)
#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) \
_Generic((x), float : cbrtf, default : cbrt, long double : cbrtl)(x)
_Generic((x), float: cbrtf, default: cbrt, long double: cbrtl)(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) \
_Generic((x), float \
: copysignf, default \
: copysign, long double \
: copysignl)(x, y)
#define copysign(x, y) \
_Generic((x), float: copysignf, default: 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) \
_Generic((x), float : erfcf, default : erfc, long double : erfcl)(x)
_Generic((x), float: erfcf, default: erfc, long double: erfcl)(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) \
_Generic((x), float : expm1f, default : expm1, long double : expm1l)(x)
_Generic((x), float: expm1f, default: expm1, long double: expm1l)(x)
#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) \
_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) \
_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) \
_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) \
_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) \
_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) \
_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) \
_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) \
_Generic((x), float : ilogbf, default : ilogb, long double : ilogbl)(x)
_Generic((x), float: ilogbf, default: ilogb, long double: ilogbl)(x)
#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) \
_Generic((x), float : lgammaf, default : lgamma, long double : lgammal)(x)
_Generic((x), float: lgammaf, default: lgamma, long double: lgammal)(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) \
_Generic((x), float : llroundf, default : llround, long double : llroundl)(x)
_Generic((x), float: llroundf, default: llround, long double: llroundl)(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) \
_Generic((x), float : log1pf, default : log1p, long double : log1pl)(x)
_Generic((x), float: log1pf, default: log1p, long double: log1pl)(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) \
_Generic((x), float : logbf, default : logb, long double : logbl)(x)
_Generic((x), float: logbf, default: logb, long double: logbl)(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) \
_Generic((x), float : lroundf, default : lround, long double : lroundl)(x)
_Generic((x), float: lroundf, default: lround, long double: lroundl)(x)
#define nearbyint(x) \
_Generic((x), float \
: nearbyintf, default \
: nearbyint, long double \
: nearbyintl)(x)
#define nearbyint(x) \
_Generic((x), \
float: nearbyintf, \
default: nearbyint, \
long double: nearbyintl)(x)
#define nextafter(x, y) \
_Generic((x), float \
: nextafterf, default \
: nextafter, long double \
: nextafterl)(x, y)
#define nextafter(x, y) \
_Generic((x), \
float: nextafterf, \
default: nextafter, \
long double: nextafterl)(x, y)
#define nexttoward(x, y) \
_Generic((x), float \
: nexttowardf, default \
: nexttoward, long double \
: nexttowardl)(x, y)
#define nexttoward(x, y) \
_Generic((x), \
float: nexttowardf, \
default: nexttoward, \
long double: nexttowardl)(x, y)
#define remainder(x, y) \
_Generic((x), float \
: remainderf, default \
: remainder, long double \
: remainderl)(x, y)
#define remainder(x, y) \
_Generic((x), \
float: remainderf, \
default: remainder, \
long double: remainderl)(x, y)
#define remquo(x, y, z) \
_Generic((x), float \
: remquof, default \
: remquo, long double \
: remquol)(x, y, z)
#define remquo(x, y, z) \
_Generic((x), float: remquof, default: remquo, long double: remquol)(x, y, z)
#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) \
_Generic((x), float : roundf, default : round, long double : roundl)(x)
_Generic((x), float: roundf, default: round, long double: roundl)(x)
#define scalbln(x, y) \
_Generic((x), float \
: scalblnf, default \
: scalbln, long double \
: scalblnl)(x, y)
#define scalbln(x, y) \
_Generic((x), float: scalblnf, default: scalbln, long double: scalblnl)(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) \
_Generic((x), float : tgammaf, default : tgamma, long double : tgammal)(x)
_Generic((x), float: tgammaf, default: tgamma, long double: tgammal)(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) \
_Generic((x), complex float \
: cargf, default \
: carg, complex long double \
: cargl)(x)
#define carg(x) \
_Generic((x), \
complex float: cargf, \
default: carg, \
complex long double: cargl)(x)
#define conj(x) \
_Generic((x), complex float \
: conjf, default \
: conj, complex long double \
: conjl)(x)
#define conj(x) \
_Generic((x), \
complex float: conjf, \
default: conj, \
complex long double: conjl)(x)
#undef creal
#define creal(x) \
_Generic((x), complex float \
: crealf, default \
: creal, complex long double \
: creall)(x)
#define creal(x) \
_Generic((x), \
complex float: crealf, \
default: creal, \
complex long double: creall)(x)
#undef cimag
#define cimag(x) \
_Generic((x), complex float \
: cimagf, default \
: cimag, complex long double \
: cimagl)(x)
#define cimag(x) \
_Generic((x), \
complex float: cimagf, \
default: cimag, \
complex long double: cimagl)(x)
#define cproj(x) \
_Generic((x), complex float \
: cprojf, default \
: cproj, complex long double \
: cprojl)(x)
#define cproj(x) \
_Generic((x), \
complex float: cprojf, \
default: cproj, \
complex long double: cprojl)(x)
#endif /* C11 */
#endif /* _TGMATH_H */

View file

@ -18,10 +18,10 @@
*/
#include "libc/calls/struct/rusage.h"
#include "libc/fmt/itoa.h"
#include "libc/serialize.h"
#include "libc/log/log.h"
#include "libc/math.h"
#include "libc/runtime/clktck.h"
#include "libc/serialize.h"
#include "libc/stdio/append.h"
struct State {

View file

@ -36,7 +36,8 @@ COSMOPOLITAN_C_START_
: "=r"(Info)); \
Cond = (x); \
++Info->total; \
if (Cond) ++Info->taken; \
if (Cond) \
++Info->taken; \
Cond; \
})

View file

@ -31,7 +31,8 @@ int AttachDebugger(intptr_t);
while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \
if (g_gdbsync) { \
g_gdbsync = 0; \
if (Rc > 0) Pid = 0; \
if (Rc > 0) \
Pid = 0; \
break; \
} else { \
sched_yield(); \

View file

@ -5,13 +5,15 @@ COSMOPOLITAN_C_START_
forceinline unsigned long __strlen(const char *s) {
unsigned long n = 0;
while (*s++) ++n;
while (*s++)
++n;
return n;
}
forceinline int __strcmp(const char *l, const char *r) {
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);
}
@ -86,12 +88,14 @@ forceinline char *__uintcpy(char p[hasatleast 21], uint64_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);
}
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';
return p;
}
@ -114,11 +118,15 @@ forceinline char *__strstr(const char *haystack, const char *needle) {
size_t i;
for (;;) {
for (i = 0;; ++i) {
if (!needle[i]) return (/*unconst*/ char *)haystack;
if (!haystack[i]) break;
if (needle[i] != haystack[i]) break;
if (!needle[i])
return (/*unconst*/ char *)haystack;
if (!haystack[i])
break;
if (needle[i] != haystack[i])
break;
}
if (!*haystack++) break;
if (!*haystack++)
break;
}
return 0;
}
@ -128,35 +136,44 @@ forceinline char16_t *__strstr16(const char16_t *haystack,
size_t i;
for (;;) {
for (i = 0;; ++i) {
if (!needle[i]) return (/*unconst*/ char16_t *)haystack;
if (!haystack[i]) break;
if (needle[i] != haystack[i]) break;
if (!needle[i])
return (/*unconst*/ char16_t *)haystack;
if (!haystack[i])
break;
if (needle[i] != haystack[i])
break;
}
if (!*haystack++) break;
if (!*haystack++)
break;
}
return 0;
}
forceinline const char *__strchr(const char *s, unsigned char c) {
for (;; ++s) {
if ((*s & 255) == c) return s;
if (!*s) return 0;
if ((*s & 255) == c)
return s;
if (!*s)
return 0;
}
}
forceinline unsigned long __atoul(const char *p) {
int c;
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;
}
forceinline long __atol(const char *p) {
int s = *p;
unsigned long x;
if (s == '-' || s == '+') ++p;
if (s == '-' || s == '+')
++p;
x = __atoul(p);
if (s == '-') x = -x;
if (s == '-')
x = -x;
return x;
}

View file

@ -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)
#define LOGF(LEVEL, FMT, ...) \
do { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} while (0)
// report an error without backtrace and debugger invocation
#define FATALF(FMT, ...) \
do { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogError, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
_log_exit(1); \
} while (0)
#define DIEF(FMT, ...) \
do { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
ffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
__builtin_unreachable(); \
} while (0)
@ -105,51 +109,62 @@ extern unsigned __log_level; /* log level for runtime check */
#define VERBOSEF(FMT, ...) \
do { \
if (LOGGABLE(kLogVerbose)) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
fverbosef(kLogVerbose, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
#define DEBUGF(FMT, ...) \
do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
fdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
#define NOISEF(FMT, ...) \
do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
fnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
#define FLOGF(F, FMT, ...) \
do { \
if (LOGGABLE(kLogInfo)) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogInfo, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
#define FWARNF(F, FMT, ...) \
do { \
if (LOGGABLE(kLogWarn)) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogWarn, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
#define FFATALF(F, FMT, ...) \
do { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
flogf(kLogError, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
_log_exit(1); \
} while (0)
@ -157,18 +172,22 @@ extern unsigned __log_level; /* log level for runtime check */
#define FDEBUGF(F, FMT, ...) \
do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
fdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
#define FNOISEF(F, FMT, ...) \
do { \
if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
fnoisef(kLogNoise, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
} \
} while (0)
@ -177,9 +196,11 @@ extern unsigned __log_level; /* log level for runtime check */
int e = _log_get_errno(); \
autotype(FORM) Ax = (FORM); \
if (_LOG_UNLIKELY(Ax == (typeof(Ax))(-1)) && LOGGABLE(kLogWarn)) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
_log_errno(__FILE__, __LINE__, #FORM); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
_log_set_errno(e); \
} \
Ax; \
@ -190,9 +211,11 @@ extern unsigned __log_level; /* log level for runtime check */
int e = _log_get_errno(); \
autotype(FORM) Ax = (FORM); \
if (Ax == NULL && LOGGABLE(kLogWarn)) { \
if (!_LOG_TINY) _log_untrace(); \
if (!_LOG_TINY) \
_log_untrace(); \
_log_errno(__FILE__, __LINE__, #FORM); \
if (!_LOG_TINY) _log_retrace(); \
if (!_LOG_TINY) \
_log_retrace(); \
_log_set_errno(e); \
} \
Ax; \

View file

@ -16,12 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/serialize.h"
#include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h"
#include "libc/serialize.h"
#include "libc/sysv/errfuns.h"
#ifdef __x86_64__

View file

@ -21,8 +21,8 @@
#define TRUE 1
#define FALSE 0
#define IS2POW(X) (!((X) & ((X) - 1)))
#define ROUNDUP(X, K) (((X) + (K) - 1) & -(K))
#define IS2POW(X) (!((X) & ((X)-1)))
#define ROUNDUP(X, K) (((X) + (K)-1) & -(K))
#define ROUNDDOWN(X, K) ((X) & -(K))
#ifndef __ASSEMBLER__
#define ABS(X) ((X) >= 0 ? (X) : -(X))
@ -40,7 +40,7 @@
#define STRINGIFY(A) __STRINGIFY(A)
#define EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y)))
#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 ARRAYLEN(A) \

View file

@ -5,7 +5,7 @@
#include "libc/nexgen32e/x86feature.h"
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)
/**
@ -25,7 +25,8 @@ COSMOPOLITAN_C_START_
: /* no inputs */ \
: "memory"); \
EcxOut = (OPT_OUT_IA32_TSC_AUX); \
if (EcxOut) *EcxOut = Ecx; \
if (EcxOut) \
*EcxOut = Ecx; \
Rdx << 32 | Rax; \
})

View file

@ -2,22 +2,22 @@
#define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_
/* input mode */
#define kNtEnableProcessedInput 0x0001u
#define kNtEnableLineInput 0x0002u
#define kNtEnableEchoInput 0x0004u
#define kNtEnableWindowInput 0x0008u
#define kNtEnableMouseInput 0x0010u
#define kNtEnableInsertMode 0x0020u
#define kNtEnableQuickEditMode 0x0040u
#define kNtEnableExtendedFlags 0x0080u
#define kNtEnableAutoPosition 0x0100u
#define kNtEnableProcessedInput 0x0001u
#define kNtEnableLineInput 0x0002u
#define kNtEnableEchoInput 0x0004u
#define kNtEnableWindowInput 0x0008u
#define kNtEnableMouseInput 0x0010u
#define kNtEnableInsertMode 0x0020u
#define kNtEnableQuickEditMode 0x0040u
#define kNtEnableExtendedFlags 0x0080u
#define kNtEnableAutoPosition 0x0100u
#define kNtEnableVirtualTerminalInput 0x0200u
/* output mode */
#define kNtEnableProcessedOutput 0x0001u
#define kNtEnableWrapAtEolOutput 0x0002u
#define kNtEnableProcessedOutput 0x0001u
#define kNtEnableWrapAtEolOutput 0x0002u
#define kNtEnableVirtualTerminalProcessing 0x0004u
#define kNtDisableNewlineAutoReturn 0x0008u
#define kNtEnableLvbGridWorldwide 0x0010u
#define kNtDisableNewlineAutoReturn 0x0008u
#define kNtEnableLvbGridWorldwide 0x0010u
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_ */

View file

@ -1,10 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_
#define kNtConsoleNoSelection 0x0000u
#define kNtConsoleNoSelection 0x0000u
#define kNtConsoleSelectionInProgress 0x0001u
#define kNtConsoleSelectionNotEmpty 0x0002u
#define kNtConsoleMouseSelection 0x0004u
#define kNtConsoleMouseDown 0x0008u
#define kNtConsoleSelectionNotEmpty 0x0002u
#define kNtConsoleMouseSelection 0x0004u
#define kNtConsoleMouseDown 0x0008u
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_ */

View file

@ -1,10 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_
#define kNtCreateNew 1
#define kNtCreateAlways 2
#define kNtOpenExisting 3
#define kNtOpenAlways 4
#define kNtCreateNew 1
#define kNtCreateAlways 2
#define kNtOpenExisting 3
#define kNtOpenAlways 4
#define kNtTruncateExisting 5
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_ */

View file

@ -1,10 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_
#define kNtCtrlCEvent 0 /* SIGINT */
#define kNtCtrlBreakEvent 1 /* SIGQUIT */
#define kNtCtrlCloseEvent 2 /* SIGHUP */
#define kNtCtrlLogoffEvent 5 /* SIGTERM */
#define kNtCtrlCEvent 0 /* SIGINT */
#define kNtCtrlBreakEvent 1 /* SIGQUIT */
#define kNtCtrlCloseEvent 2 /* SIGHUP */
#define kNtCtrlLogoffEvent 5 /* SIGTERM */
#define kNtCtrlShutdownEvent 6
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_ */

View file

@ -1,8 +1,8 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_
#define kNtExceptionExecuteHandler 0x1u
#define kNtExceptionExecuteHandler 0x1u
#define kNtExceptionContinueExecution 0xffffffffu
#define kNtExceptionContinueSearch 0x0u
#define kNtExceptionContinueSearch 0x0u
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_ */

View file

@ -1,46 +1,46 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_
#define kNtFileDirectoryInformation 1 /*→ struct NtFileDirectoryInformation */
#define kNtFileFullDirectoryInformation 2 /*→ etc. */
#define kNtFileBothDirectoryInformation 3
#define kNtFileBasicInformation 4
#define kNtFileStandardInformation 5
#define kNtFileInternalInformation 6
#define kNtFileEaInformation 7
#define kNtFileAccessInformation 8
#define kNtFileNameInformation 9
#define kNtFileRenameInformation 10
#define kNtFileLinkInformation 11
#define kNtFileNamesInformation 12
#define kNtFileDispositionInformation 13
#define kNtFilePositionInformation 14
#define kNtFileFullEaInformation 15
#define kNtFileModeInformation 16
#define kNtFileAlignmentInformation 17
#define kNtFileAllInformation 18
#define kNtFileAllocationInformation 19
#define kNtFileEndOfFileInformation 20
#define kNtFileAlternateNameInformation 21
#define kNtFileStreamInformation 22
#define kNtFilePipeInformation 23
#define kNtFilePipeLocalInformation 24
#define kNtFilePipeRemoteInformation 25
#define kNtFileMailslotQueryInformation 26
#define kNtFileMailslotSetInformation 27
#define kNtFileCompressionInformation 28
#define kNtFileObjectIdInformation 29
#define kNtFileCompletionInformation 30
#define kNtFileMoveClusterInformation 31
#define kNtFileQuotaInformation 32
#define kNtFileReparsePointInformation 33
#define kNtFileNetworkOpenInformation 34
#define kNtFileAttributeTagInformation 35
#define kNtFileTrackingInformation 36
#define kNtFileDirectoryInformation 1 /*→ struct NtFileDirectoryInformation */
#define kNtFileFullDirectoryInformation 2 /*→ etc. */
#define kNtFileBothDirectoryInformation 3
#define kNtFileBasicInformation 4
#define kNtFileStandardInformation 5
#define kNtFileInternalInformation 6
#define kNtFileEaInformation 7
#define kNtFileAccessInformation 8
#define kNtFileNameInformation 9
#define kNtFileRenameInformation 10
#define kNtFileLinkInformation 11
#define kNtFileNamesInformation 12
#define kNtFileDispositionInformation 13
#define kNtFilePositionInformation 14
#define kNtFileFullEaInformation 15
#define kNtFileModeInformation 16
#define kNtFileAlignmentInformation 17
#define kNtFileAllInformation 18
#define kNtFileAllocationInformation 19
#define kNtFileEndOfFileInformation 20
#define kNtFileAlternateNameInformation 21
#define kNtFileStreamInformation 22
#define kNtFilePipeInformation 23
#define kNtFilePipeLocalInformation 24
#define kNtFilePipeRemoteInformation 25
#define kNtFileMailslotQueryInformation 26
#define kNtFileMailslotSetInformation 27
#define kNtFileCompressionInformation 28
#define kNtFileObjectIdInformation 29
#define kNtFileCompletionInformation 30
#define kNtFileMoveClusterInformation 31
#define kNtFileQuotaInformation 32
#define kNtFileReparsePointInformation 33
#define kNtFileNetworkOpenInformation 34
#define kNtFileAttributeTagInformation 35
#define kNtFileTrackingInformation 36
#define kNtFileIdBothDirectoryInformation 37
#define kNtFileIdFullDirectoryInformation 38
#define kNtFileValidDataLengthInformation 39
#define kNtFileShortNameInformation 40
#define kNtFileInformation_MAX 40
#define kNtFileShortNameInformation 40
#define kNtFileInformation_MAX 40
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_ */

View file

@ -2,8 +2,8 @@
#define COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_
#define kNtFileShareExclusive 0x00000000u
#define kNtFileShareRead 0x00000001u
#define kNtFileShareWrite 0x00000002u
#define kNtFileShareDelete 0x00000004u
#define kNtFileShareRead 0x00000001u
#define kNtFileShareWrite 0x00000002u
#define kNtFileShareDelete 0x00000004u
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_ */

View file

@ -1,13 +1,13 @@
#ifndef COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_
#define COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_
#define kNtForegroundBlue 0x0001
#define kNtForegroundGreen 0x0002
#define kNtForegroundRed 0x0004
#define kNtForegroundBlue 0x0001
#define kNtForegroundGreen 0x0002
#define kNtForegroundRed 0x0004
#define kNtForegroundIntensity 0x0008
#define kNtBackgroundBlue 0x0010
#define kNtBackgroundGreen 0x0020
#define kNtBackgroundRed 0x0040
#define kNtBackgroundBlue 0x0010
#define kNtBackgroundGreen 0x0020
#define kNtBackgroundRed 0x0040
#define kNtBackgroundIntensity 0x0080
#endif /* COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_ */

View file

@ -1,15 +1,15 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_
#define kNtFileFsVolumeInformation 1
#define kNtFileFsLabelInformation 2
#define kNtFileFsSizeInformation 3
#define kNtFileFsDeviceInformation 4
#define kNtFileFsAttributeInformation 5
#define kNtFileFsControlInformation 6
#define kNtFileFsFullSizeInformation 7
#define kNtFileFsObjectIdInformation 8
#define kNtFileFsVolumeInformation 1
#define kNtFileFsLabelInformation 2
#define kNtFileFsSizeInformation 3
#define kNtFileFsDeviceInformation 4
#define kNtFileFsAttributeInformation 5
#define kNtFileFsControlInformation 6
#define kNtFileFsFullSizeInformation 7
#define kNtFileFsObjectIdInformation 8
#define kNtFileFsDriverPathInformation 9
#define kNtFileFsInformation_MAX 10
#define kNtFileFsInformation_MAX 10
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_ */

View file

@ -1,33 +1,33 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_
#define kNtExecutive 0
#define kNtFreePage 1
#define kNtPageIn 2
#define kNtPoolAllocation 3
#define kNtDelayExecution 4
#define kNtSuspended 5
#define kNtUserRequest 6
#define kNtWrExecutive 7
#define kNtWrFreePage 8
#define kNtWrPageIn 9
#define kNtWrPoolAllocation 10
#define kNtWrDelayExecution 11
#define kNtWrSuspended 12
#define kNtWrUserRequest 13
#define kNtWrEventPair 14
#define kNtWrQueue 15
#define kNtWrLpcReceive 16
#define kNtWrLpcReply 17
#define kNtWrVirtualMemory 18
#define kNtWrPageOut 19
#define kNtWrRendezvous 20
#define kNtSpare2 21
#define kNtSpare3 22
#define kNtSpare4 23
#define kNtSpare5 24
#define kNtSpare6 25
#define kNtWrKernel 26
#define kNtExecutive 0
#define kNtFreePage 1
#define kNtPageIn 2
#define kNtPoolAllocation 3
#define kNtDelayExecution 4
#define kNtSuspended 5
#define kNtUserRequest 6
#define kNtWrExecutive 7
#define kNtWrFreePage 8
#define kNtWrPageIn 9
#define kNtWrPoolAllocation 10
#define kNtWrDelayExecution 11
#define kNtWrSuspended 12
#define kNtWrUserRequest 13
#define kNtWrEventPair 14
#define kNtWrQueue 15
#define kNtWrLpcReceive 16
#define kNtWrLpcReply 17
#define kNtWrVirtualMemory 18
#define kNtWrPageOut 19
#define kNtWrRendezvous 20
#define kNtSpare2 21
#define kNtSpare3 22
#define kNtSpare4 23
#define kNtSpare5 24
#define kNtSpare6 25
#define kNtWrKernel 26
#define kNtMaximumWaitReason 27
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_ */

View file

@ -2,19 +2,19 @@
#define COSMOPOLITAN_LIBC_NT_ENUM_PROCESSACCESS_H_
#include "libc/nt/enum/accessmask.h"
#define kNtProcessCreateProcess 0x0080u
#define kNtProcessCreateThread 0x0002u
#define kNtProcessDupHandle 0x0040u
#define kNtProcessQueryInformation 0x0400u
#define kNtProcessCreateProcess 0x0080u
#define kNtProcessCreateThread 0x0002u
#define kNtProcessDupHandle 0x0040u
#define kNtProcessQueryInformation 0x0400u
#define kNtProcessQueryLimitedInformation 0x1000u
#define kNtProcessSetInformation 0x0200u
#define kNtProcessSetQuota 0x0100u
#define kNtProcessSuspendResume 0x0800u
#define kNtProcessTerminate 0x0001u
#define kNtProcessVmOperation 0x0008u
#define kNtProcessVmRead 0x0010u
#define kNtProcessVmWrite 0x0020u
#define kNtProcessSynchronize kNtSynchronize
#define kNtProcessSetInformation 0x0200u
#define kNtProcessSetQuota 0x0100u
#define kNtProcessSuspendResume 0x0800u
#define kNtProcessTerminate 0x0001u
#define kNtProcessVmOperation 0x0008u
#define kNtProcessVmRead 0x0010u
#define kNtProcessVmWrite 0x0020u
#define kNtProcessSynchronize kNtSynchronize
#define kNtProcessAllAccess \
(kNtStandardRightsRequired | kNtSynchronize | 0xffffu)

View file

@ -2,6 +2,6 @@
#define COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_
#define kNtProcThreadAttributeReplaceValue 1
#define kNtProcThreadAttributeHandleList 0x00020002
#define kNtProcThreadAttributeHandleList 0x00020002
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_ */

View file

@ -1,19 +1,19 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_
#define kNtOwnerSecurityInformation 0x00000001
#define kNtGroupSecurityInformation 0x00000002
#define kNtDaclSecurityInformation 0x00000004
#define kNtSaclSecurityInformation 0x00000008
#define kNtLabelSecurityInformation 0x00000010
#define kNtAttributeSecurityInformation 0x00000020
#define kNtScopeSecurityInformation 0x00000040
#define kNtOwnerSecurityInformation 0x00000001
#define kNtGroupSecurityInformation 0x00000002
#define kNtDaclSecurityInformation 0x00000004
#define kNtSaclSecurityInformation 0x00000008
#define kNtLabelSecurityInformation 0x00000010
#define kNtAttributeSecurityInformation 0x00000020
#define kNtScopeSecurityInformation 0x00000040
#define kNtProcessTrustLabelSecurityInformation 0x00000080
#define kNtAccessFilterSecurityInformation 0x00000100
#define kNtBackupSecurityInformation 0x00010000
#define kNtProtectedDaclSecurityInformation 0x80000000
#define kNtProtectedSaclSecurityInformation 0x40000000
#define kNtUnprotectedDaclSecurityInformation 0x20000000
#define kNtUnprotectedSaclSecurityInformation 0x10000000
#define kNtAccessFilterSecurityInformation 0x00000100
#define kNtBackupSecurityInformation 0x00010000
#define kNtProtectedDaclSecurityInformation 0x80000000
#define kNtProtectedSaclSecurityInformation 0x40000000
#define kNtUnprotectedDaclSecurityInformation 0x20000000
#define kNtUnprotectedSaclSecurityInformation 0x10000000
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_ */

View file

@ -1,19 +1,19 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_
#define kNtStartfUseshowwindow 0x00000001 /* otherwise wShowWindow ignored */
#define kNtStartfUsesize 0x00000002 /* otherwise dwX / dwY ignored */
#define kNtStartfUseposition 0x00000004 /* otherwise dwX/YSize ignored */
#define kNtStartfUsecountchars 0x00000008 /* otherwise dwX/YCountChars ign. */
#define kNtStartfUseshowwindow 0x00000001 /* otherwise wShowWindow ignored */
#define kNtStartfUsesize 0x00000002 /* otherwise dwX / dwY ignored */
#define kNtStartfUseposition 0x00000004 /* otherwise dwX/YSize ignored */
#define kNtStartfUsecountchars 0x00000008 /* otherwise dwX/YCountChars ign. */
#define kNtStartfUsefillattribute 0x00000010 /* etc. */
#define kNtStartfRunfullscreen 0x00000020
#define kNtStartfForceonfeedback 0x00000040
#define kNtStartfRunfullscreen 0x00000020
#define kNtStartfForceonfeedback 0x00000040
#define kNtStartfForceofffeedback 0x00000080
#define kNtStartfUsestdhandles 0x00000100 /* otherwise hStd... ignored */
#define kNtStartfUsehotkey 0x00000200
#define kNtStartfTitleislinkname 0x00000800
#define kNtStartfTitleisappid 0x00001000
#define kNtStartfPreventpinning 0x00002000
#define kNtStartfUntrustedsource 0x00008000
#define kNtStartfUsestdhandles 0x00000100 /* otherwise hStd... ignored */
#define kNtStartfUsehotkey 0x00000200
#define kNtStartfTitleislinkname 0x00000800
#define kNtStartfTitleisappid 0x00001000
#define kNtStartfPreventpinning 0x00002000
#define kNtStartfUntrustedsource 0x00008000
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_ */

View file

@ -1,20 +1,20 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_
#define kNtSystemBasicInformation 0
#define kNtSystemProcessorInformation 1
#define kNtSystemPerformanceInformation 2
#define kNtSystemTimeOfDayInformation 3
#define kNtSystemProcessInformation 5
#define kNtSystemProcessorTimes 8
#define kNtSystemGlobalFlag 9
#define kNtSystemModuleInformation 11
#define kNtSystemLockInformation 12
#define kNtSystemHandleInformation 16
#define kNtSystemObjectInformation 17
#define kNtSystemInterruptInformation 23
#define kNtSystemExceptionInformation 33
#define kNtSystemBasicInformation 0
#define kNtSystemProcessorInformation 1
#define kNtSystemPerformanceInformation 2
#define kNtSystemTimeOfDayInformation 3
#define kNtSystemProcessInformation 5
#define kNtSystemProcessorTimes 8
#define kNtSystemGlobalFlag 9
#define kNtSystemModuleInformation 11
#define kNtSystemLockInformation 12
#define kNtSystemHandleInformation 16
#define kNtSystemObjectInformation 17
#define kNtSystemInterruptInformation 23
#define kNtSystemExceptionInformation 33
#define kNtSystemRegistryQuotaInformation 37
#define kNtSystemLookasideInformation 45
#define kNtSystemLookasideInformation 45
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_ */

View file

@ -2,18 +2,18 @@
#define COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_
#include "libc/nt/enum/accessmask.h"
#define kNtThreadTerminate 0x0001
#define kNtThreadSuspendResume 0x0002
#define kNtThreadGetContext 0x0008
#define kNtThreadSetContext 0x0010
#define kNtThreadQueryInformation 0x0040
#define kNtThreadSetInformation 0x0020
#define kNtThreadSetThreadToken 0x0080
#define kNtThreadImpersonate 0x0100
#define kNtThreadDirectImpersonation 0x0200
#define kNtThreadSetLimitedInformation 0x0400
#define kNtThreadTerminate 0x0001
#define kNtThreadSuspendResume 0x0002
#define kNtThreadGetContext 0x0008
#define kNtThreadSetContext 0x0010
#define kNtThreadQueryInformation 0x0040
#define kNtThreadSetInformation 0x0020
#define kNtThreadSetThreadToken 0x0080
#define kNtThreadImpersonate 0x0100
#define kNtThreadDirectImpersonation 0x0200
#define kNtThreadSetLimitedInformation 0x0400
#define kNtThreadQueryLimitedInformation 0x0800
#define kNtThreadResume 0x1000
#define kNtThreadAllAccess (kNtStandardRightsRequired | kNtSynchronize | 0xFFFF)
#define kNtThreadResume 0x1000
#define kNtThreadAllAccess (kNtStandardRightsRequired | kNtSynchronize | 0xFFFF)
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_ */

View file

@ -1,23 +1,23 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_
#define kNtTokenUser 1
#define kNtTokenGroups 2
#define kNtTokenPrivileges 3
#define kNtTokenOwner 4
#define kNtTokenPrimaryGroup 5
#define kNtTokenDefaultDacl 6
#define kNtTokenSource 7
#define kNtTokenType 8
#define kNtTokenImpersonationLevel 9
#define kNtTokenStatistics 10
#define kNtTokenRestrictedSids 11
#define kNtTokenSessionId 12
#define kNtTokenUser 1
#define kNtTokenGroups 2
#define kNtTokenPrivileges 3
#define kNtTokenOwner 4
#define kNtTokenPrimaryGroup 5
#define kNtTokenDefaultDacl 6
#define kNtTokenSource 7
#define kNtTokenType 8
#define kNtTokenImpersonationLevel 9
#define kNtTokenStatistics 10
#define kNtTokenRestrictedSids 11
#define kNtTokenSessionId 12
#define kNtTokenGroupsAndPrivileges 13
#define kNtTokenSessionReference 14
#define kNtTokenSandBoxInert 15
#define kNtTokenAuditPolicy 16
#define kNtTokenOrigin 17
#define kNtTokenInfoClass_MAX 18
#define kNtTokenSessionReference 14
#define kNtTokenSandBoxInert 15
#define kNtTokenAuditPolicy 16
#define kNtTokenOrigin 17
#define kNtTokenInfoClass_MAX 18
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_ */

View file

@ -4,7 +4,6 @@
#define kNtExceptionMaximumParameters 15
#define kNtExceptionNoncontinuable 1
struct NtExceptionRecord {
uint32_t ExceptionCode; /* kNtException... */
uint32_t ExceptionFlags; /* kNtExceptionNoncontinuable */

View file

@ -74,8 +74,8 @@ char *GetInterpreterExecutableName(char *p, size_t n) {
cmd[2] = 12; // KERN_PROC_PATHNAME
} else { //
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) {
errno = e;
return p;

View file

@ -205,9 +205,9 @@ void __unref_page(struct mman *, uint64_t *, uint64_t);
* I/O devices.
*/
forceinline void __invert_and_perm_ref_memory_area(struct mman *mm,
uint64_t *pml4t, uint64_t ps,
uint64_t size,
uint64_t pte_flags) {
uint64_t *pml4t, uint64_t ps,
uint64_t size,
uint64_t pte_flags) {
__invert_memory_area(mm, pml4t, ps, size, pte_flags | PAGE_REFC);
}

View file

@ -31,8 +31,7 @@ static int __zipos_dupfd(int fd, int cmd, int start) {
if (start < 0)
return einval();
if (IsWindows()) {
return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0),
start);
return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0), start);
}
rc = sys_fcntl(fd, cmd, start, __sys_fcntl);
if (rc != -1) {

View file

@ -50,7 +50,7 @@
* @return virtual base address of new mapping, or MAP_FAILED w/ errno
*/
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) {
STRACE("negative zipos mmap offset");

View file

@ -17,8 +17,8 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/internal.h"
#include "libc/sysv/errfuns.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/errfuns.h"
int __zipos_notat(int dirfd, const char *path) {
struct ZiposUri zipname;

View file

@ -127,7 +127,7 @@ https://github.com/piscisaureus/wepoll");
} while (0)
#define CONTAINOF(ptr, type, member) \
((type *)((uintptr_t)(ptr) - offsetof(type, member)))
((type *)((uintptr_t)(ptr)-offsetof(type, member)))
#define TREE__ROTATE(cis, trans) \
struct TreeNode *p = node; \

View file

@ -20,11 +20,11 @@
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/serialize.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nt/errors.h"
#include "libc/nt/iphlpapi.h"
#include "libc/serialize.h"
#include "libc/sock/sock.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"

View file

@ -553,9 +553,10 @@ int __vcscanf(int callback(void *), //
items = -1;
goto Done;
} else if (rawmode && j != width) {
/* The C standard says that %c "matches a sequence of characters of
* **exactly** the number specified by the field width". If we have
* fewer characters, what we've just read is invalid. */
/* The C standard says that %c "matches a sequence of characters
* of
* **exactly** the number specified by the field width". If we
* have fewer characters, what we've just read is invalid. */
goto Done;
} else if (!rawmode && j < bufsize) {
if (charbytes == sizeof(char)) {

View file

@ -372,76 +372,76 @@ int iswpunct(wint_t c) {
case u'': // PARAGRAPHUS MARK (0x2e4d Po)
case u'': // PUNCTUS ELEVATUS MARK (0x2e4e Po)
case u'': // CORNISH VERSE DIVIDER (0x2e4f Po)
case u'': // IDEOGRAPHIC COMMA (0x3001 Po)
case u'': // IDEOGRAPHIC FULL STOP (0x3002 Po)
case u'': // DITTO MARK (0x3003 Po)
case u'': // LEFT ANGLE BRACKET (0x3008 Ps)
case u'': // RIGHT ANGLE BRACKET (0x3009 Pe)
case u'': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps)
case u'': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe)
case u'': // LEFT CORNER BRACKET (0x300c Ps)
case u'': // RIGHT CORNER BRACKET (0x300d Pe)
case u'': // LEFT WHITE CORNER BRACKET (0x300e Ps)
case u'': // RIGHT WHITE CORNER BRACKET (0x300f Pe)
case u'': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps)
case u'': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe)
case u'': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps)
case u'': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe)
case u'': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps)
case u'': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe)
case u'': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps)
case u'': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe)
case u'': // LEFT WHITE SQUARE BRACKET (0x301a Ps)
case u'': // RIGHT WHITE SQUARE BRACKET (0x301b Pe)
case u'': // WAVE DASH (0x301c Pd)
case u'': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps)
case u'': // DOUBLE PRIME QUOTATION MARK (0x301e Pe)
case u'': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe)
case u'': // WAVY DASH (0x3030 Pd)
case u'': // PART ALTERNATION MARK (0x303d Po)
case u'': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd)
case u'': // KATAKANA MIDDLE DOT (0x30fb Po)
case u'': // LISU PUNCTUATION COMMA (0xa4fe Po)
case u'': // LISU PUNCTUATION FULL STOP (0xa4ff Po)
case u'': // VAI COMMA (0xa60d Po)
case u'': // VAI FULL STOP (0xa60e Po)
case u'': // VAI QUESTION MARK (0xa60f Po)
case u'': // CYRILLIC KAVYKA (0xa67e Po)
case u'': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po)
case u'': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po)
case u'': // PHAGS-PA MARK SHAD (0xa876 Po)
case u'': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po)
case u'': // SAURASHTRA DANDA (0xa8ce Po)
case u'': // SAURASHTRA DOUBLE DANDA (0xa8cf Po)
case u'': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po)
case u'': // DEVANAGARI GAP FILLER (0xa8f9 Po)
case u'': // DEVANAGARI CARET (0xa8fa Po)
case u'': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po)
case u'': // JAVANESE LEFT RERENGGAN (0xa9c1 Po)
case u'': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po)
case u'': // JAVANESE PADA ANDAP (0xa9c3 Po)
case u'': // JAVANESE PADA MADYA (0xa9c4 Po)
case u'': // JAVANESE PADA LUHUR (0xa9c5 Po)
case u'': // JAVANESE PADA WINDU (0xa9c6 Po)
case u'': // JAVANESE PADA PANGKAT (0xa9c7 Po)
case u'': // JAVANESE PADA LINGSA (0xa9c8 Po)
case u'': // JAVANESE PADA LUNGSI (0xa9c9 Po)
case u'': // JAVANESE PADA ADEG (0xa9ca Po)
case u'': // JAVANESE PADA ADEG ADEG (0xa9cb Po)
case u'': // JAVANESE PADA PISELEH (0xa9cc Po)
case u'': // JAVANESE TURNED PADA PISELEH (0xa9cd Po)
case u'': // JAVANESE PADA TIRTA TUMETES (0xa9de Po)
case u'': // JAVANESE PADA ISEN-ISEN (0xa9df Po)
case u'': // CHAM PUNCTUATION SPIRAL (0xaa5c Po)
case u'': // CHAM PUNCTUATION DANDA (0xaa5d Po)
case u'': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po)
case u'': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po)
case u'': // TAI VIET SYMBOL HO HOI (0xaade Po)
case u'': // TAI VIET SYMBOL KOI KOI (0xaadf Po)
case u'': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po)
case u'': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po)
case u'': // MEETEI MAYEK CHEIKHEI (0xabeb Po)
case u'': // PRESENTATION FORM FOR VERTICAL COMMA (0xfe10 Po)
case u'': // IDEOGRAPHIC COMMA (0x3001 Po)
case u'': // IDEOGRAPHIC FULL STOP (0x3002 Po)
case u'': // DITTO MARK (0x3003 Po)
case u'': // LEFT ANGLE BRACKET (0x3008 Ps)
case u'': // RIGHT ANGLE BRACKET (0x3009 Pe)
case u'': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps)
case u'': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe)
case u'': // LEFT CORNER BRACKET (0x300c Ps)
case u'': // RIGHT CORNER BRACKET (0x300d Pe)
case u'': // LEFT WHITE CORNER BRACKET (0x300e Ps)
case u'': // RIGHT WHITE CORNER BRACKET (0x300f Pe)
case u'': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps)
case u'': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe)
case u'': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps)
case u'': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe)
case u'': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps)
case u'': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe)
case u'': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps)
case u'': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe)
case u'': // LEFT WHITE SQUARE BRACKET (0x301a Ps)
case u'': // RIGHT WHITE SQUARE BRACKET (0x301b Pe)
case u'': // WAVE DASH (0x301c Pd)
case u'': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps)
case u'': // DOUBLE PRIME QUOTATION MARK (0x301e Pe)
case u'': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe)
case u'': // WAVY DASH (0x3030 Pd)
case u'': // PART ALTERNATION MARK (0x303d Po)
case u'': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd)
case u'': // KATAKANA MIDDLE DOT (0x30fb Po)
case u'': // LISU PUNCTUATION COMMA (0xa4fe Po)
case u'': // LISU PUNCTUATION FULL STOP (0xa4ff Po)
case u'': // VAI COMMA (0xa60d Po)
case u'': // VAI FULL STOP (0xa60e Po)
case u'': // VAI QUESTION MARK (0xa60f Po)
case u'': // CYRILLIC KAVYKA (0xa67e Po)
case u'': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po)
case u'': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po)
case u'': // PHAGS-PA MARK SHAD (0xa876 Po)
case u'': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po)
case u'': // SAURASHTRA DANDA (0xa8ce Po)
case u'': // SAURASHTRA DOUBLE DANDA (0xa8cf Po)
case u'': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po)
case u'': // DEVANAGARI GAP FILLER (0xa8f9 Po)
case u'': // DEVANAGARI CARET (0xa8fa Po)
case u'': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po)
case u'': // JAVANESE LEFT RERENGGAN (0xa9c1 Po)
case u'': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po)
case u'': // JAVANESE PADA ANDAP (0xa9c3 Po)
case u'': // JAVANESE PADA MADYA (0xa9c4 Po)
case u'': // JAVANESE PADA LUHUR (0xa9c5 Po)
case u'': // JAVANESE PADA WINDU (0xa9c6 Po)
case u'': // JAVANESE PADA PANGKAT (0xa9c7 Po)
case u'': // JAVANESE PADA LINGSA (0xa9c8 Po)
case u'': // JAVANESE PADA LUNGSI (0xa9c9 Po)
case u'': // JAVANESE PADA ADEG (0xa9ca Po)
case u'': // JAVANESE PADA ADEG ADEG (0xa9cb Po)
case u'': // JAVANESE PADA PISELEH (0xa9cc Po)
case u'': // JAVANESE TURNED PADA PISELEH (0xa9cd Po)
case u'': // JAVANESE PADA TIRTA TUMETES (0xa9de Po)
case u'': // JAVANESE PADA ISEN-ISEN (0xa9df Po)
case u'': // CHAM PUNCTUATION SPIRAL (0xaa5c Po)
case u'': // CHAM PUNCTUATION DANDA (0xaa5d Po)
case u'': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po)
case u'': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po)
case u'': // TAI VIET SYMBOL HO HOI (0xaade Po)
case u'': // TAI VIET SYMBOL KOI KOI (0xaadf Po)
case u'': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po)
case u'': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po)
case u'': // MEETEI MAYEK CHEIKHEI (0xabeb 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 IDEO FULL STOP (0xfe12 Po)
case u'': // PRESENTATION FORM FOR VERTICAL COLON (0xfe13 Po)

View file

@ -21,7 +21,7 @@
COSMOPOLITAN_C_START_
#define LC_GLOBAL_LOCALE ((locale_t) - 1)
#define LC_GLOBAL_LOCALE ((locale_t)-1)
struct __locale_map {
const void *map;

View file

@ -16,10 +16,10 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/serialize.h"
#include "libc/intrin/pushpop.internal.h"
#include "libc/intrin/repmovsb.h"
#include "libc/nexgen32e/kompressor.h"
#include "libc/serialize.h"
#include "libc/str/str.h"
/**

View file

@ -13,25 +13,30 @@
forceinline int tpdecodecb(wint_t *out, int first,
int get(void *arg, uint32_t i), void *arg) {
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)) {
if ((wc = get(arg, i++)) == -1) return -1;
if ((wc = get(arg, i++)) == -1)
return -1;
}
if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) {
msb = wc < 252 ? bsr(~wc & 0xff) : 1;
need = 7 - msb;
wc &= ((1u << msb) - 1) | 0b00000011;
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) {
wc = wc << 6 | (cb & 0b00111111);
} else {
if (out) *out = u'\xFFFD';
if (out)
*out = u'\xFFFD';
return -1;
}
}
}
if (__builtin_expect(!!out, 1)) *out = (wint_t)wc;
if (__builtin_expect(!!out, 1))
*out = (wint_t)wc;
return i;
}

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/serialize.h"
#include "libc/macros.internal.h"
#include "libc/serialize.h"
#include "libc/str/str.h"
static const char kWcTypeNames[][8] = {

View file

@ -1,7 +1,7 @@
#ifndef 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 STDERR_FILENO 2

View file

@ -1,39 +1,36 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_
#define ICMP6_DST_UNREACH ICMP6_DST_UNREACH
#define ICMP6_DST_UNREACH_ADDR ICMP6_DST_UNREACH_ADDR
#define ICMP6_DST_UNREACH_ADMIN ICMP6_DST_UNREACH_ADMIN
#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_BEYONDSCOPE
#define ICMP6_DST_UNREACH_NOPORT ICMP6_DST_UNREACH_NOPORT
#define ICMP6_DST_UNREACH_NOROUTE ICMP6_DST_UNREACH_NOROUTE
#define ICMP6_ECHO_REPLY ICMP6_ECHO_REPLY
#define ICMP6_ECHO_REQUEST ICMP6_ECHO_REQUEST
#define ICMP6_FILTER ICMP6_FILTER
#define ICMP6_INFOMSG_MASK ICMP6_INFOMSG_MASK
#define ICMP6_PACKET_TOO_BIG ICMP6_PACKET_TOO_BIG
#define ICMP6_PARAMPROB_HEADER ICMP6_PARAMPROB_HEADER
#define ICMP6_PARAMPROB_NEXTHEADER ICMP6_PARAMPROB_NEXTHEADER
#define ICMP6_PARAMPROB_OPTION ICMP6_PARAMPROB_OPTION
#define ICMP6_PARAM_PROB ICMP6_PARAM_PROB
#define ICMP6_ROUTER_RENUMBERING ICMP6_ROUTER_RENUMBERING
#define ICMP6_RR_FLAGS_FORCEAPPLY ICMP6_RR_FLAGS_FORCEAPPLY
#define ICMP6_RR_FLAGS_PREVDONE ICMP6_RR_FLAGS_PREVDONE
#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT
#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE
#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST
#define 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_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN \
ICMP6_RR_RESULT_FLAGS_FORBIDDEN
#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB
#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
#define ICMP6_DST_UNREACH ICMP6_DST_UNREACH
#define ICMP6_DST_UNREACH_ADDR ICMP6_DST_UNREACH_ADDR
#define ICMP6_DST_UNREACH_ADMIN ICMP6_DST_UNREACH_ADMIN
#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_BEYONDSCOPE
#define ICMP6_DST_UNREACH_NOPORT ICMP6_DST_UNREACH_NOPORT
#define ICMP6_DST_UNREACH_NOROUTE ICMP6_DST_UNREACH_NOROUTE
#define ICMP6_ECHO_REPLY ICMP6_ECHO_REPLY
#define ICMP6_ECHO_REQUEST ICMP6_ECHO_REQUEST
#define ICMP6_FILTER ICMP6_FILTER
#define ICMP6_INFOMSG_MASK ICMP6_INFOMSG_MASK
#define ICMP6_PACKET_TOO_BIG ICMP6_PACKET_TOO_BIG
#define ICMP6_PARAMPROB_HEADER ICMP6_PARAMPROB_HEADER
#define ICMP6_PARAMPROB_NEXTHEADER ICMP6_PARAMPROB_NEXTHEADER
#define ICMP6_PARAMPROB_OPTION ICMP6_PARAMPROB_OPTION
#define ICMP6_PARAM_PROB ICMP6_PARAM_PROB
#define ICMP6_ROUTER_RENUMBERING ICMP6_ROUTER_RENUMBERING
#define ICMP6_RR_FLAGS_FORCEAPPLY ICMP6_RR_FLAGS_FORCEAPPLY
#define ICMP6_RR_FLAGS_PREVDONE ICMP6_RR_FLAGS_PREVDONE
#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT
#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE
#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST
#define 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_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ICMP6_RR_RESULT_FLAGS_FORBIDDEN
#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB
#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_

View file

@ -38,5 +38,4 @@ COSMOPOLITAN_C_END_
#define IFF_RUNNING IFF_RUNNING
#define IFF_SLAVE IFF_SLAVE
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IFF_H_ */

View file

@ -102,6 +102,5 @@ extern const int IP_XFRM_POLICY;
#define IP_UNICAST_IF IP_UNICAST_IF
#define IP_XFRM_POLICY IP_XFRM_POLICY
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IP_H_ */

View file

@ -122,6 +122,5 @@ extern const int IPV6_XFRM_POLICY;
#define IPV6_V6ONLY IPV6_V6ONLY
#define IPV6_XFRM_POLICY IPV6_XFRM_POLICY
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPV6_H_ */

View file

@ -24,6 +24,5 @@ extern const int MAX_INPUT;
#define MAX_CANON MAX_CANON
#define MAX_INPUT MAX_INPUT
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LIMITS_H_ */

View file

@ -1,11 +1,11 @@
#ifndef 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_READ LIO_READ
#define LIO_WAIT LIO_WAIT
#define LIO_WRITE LIO_WRITE
#define LIO_READ LIO_READ
#define LIO_WAIT LIO_WAIT
#define LIO_WRITE LIO_WRITE
COSMOPOLITAN_C_START_

View file

@ -15,5 +15,4 @@ COSMOPOLITAN_C_END_
#define LOCK_SH LOCK_SH
#define LOCK_UN LOCK_UN
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOCK_H_ */

View file

@ -1,15 +1,15 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_
#define MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE
#define MCAST_EXCLUDE MCAST_EXCLUDE
#define MCAST_INCLUDE MCAST_INCLUDE
#define MCAST_JOIN_GROUP MCAST_JOIN_GROUP
#define MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP
#define MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP
#define MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE
#define MCAST_EXCLUDE MCAST_EXCLUDE
#define MCAST_INCLUDE MCAST_INCLUDE
#define MCAST_JOIN_GROUP MCAST_JOIN_GROUP
#define MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP
#define MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP
#define MCAST_LEAVE_SOURCE_GROUP MCAST_LEAVE_SOURCE_GROUP
#define MCAST_MSFILTER MCAST_MSFILTER
#define MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE
#define MCAST_MSFILTER MCAST_MSFILTER
#define MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE
COSMOPOLITAN_C_START_

View file

@ -36,6 +36,5 @@ extern const int TIOCM_ST;
#define TIOCMBIC TIOCMBIC
#define TIOCMBIS TIOCMBIS
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MODEM_H_ */

View file

@ -92,6 +92,5 @@ extern const int MNT_SNAPSHOT;
#define MNT_NOCLUSTERW MNT_NOCLUSTERW
#define MNT_SNAPSHOT MNT_SNAPSHOT
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */

View file

@ -94,6 +94,5 @@ extern const int PF_X25;
#define PF_WANPIPE PF_WANPIPE
#define PF_X25 PF_X25
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PF_H_ */

View file

@ -27,6 +27,5 @@ extern const int16_t POLLWRNORM;
#define POLLWRBAND POLLWRBAND
#define POLLWRNORM POLLWRNORM
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POLL_H_ */

View file

@ -22,6 +22,5 @@ extern const int POSIX_MADV_DONTNEED;
#define POSIX_MADV_DONTNEED POSIX_MADV_DONTNEED
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */

View file

@ -23,6 +23,5 @@ extern const int TIOCPKT_STOP;
#define TIOCPKT TIOCPKT
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTY_H_ */

View file

@ -1,18 +1,18 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_
#define READ_10 READ_10
#define READ_12 READ_12
#define READ_6 READ_6
#define READ_BLOCK_LIMITS READ_BLOCK_LIMITS
#define READ_BUFFER READ_BUFFER
#define READ_CAPACITY READ_CAPACITY
#define READ_DEFECT_DATA READ_DEFECT_DATA
#define READ_10 READ_10
#define READ_12 READ_12
#define READ_6 READ_6
#define READ_BLOCK_LIMITS READ_BLOCK_LIMITS
#define READ_BUFFER READ_BUFFER
#define READ_CAPACITY READ_CAPACITY
#define READ_DEFECT_DATA READ_DEFECT_DATA
#define READ_ELEMENT_STATUS READ_ELEMENT_STATUS
#define READ_LONG READ_LONG
#define READ_POSITION READ_POSITION
#define READ_REVERSE READ_REVERSE
#define READ_TOC READ_TOC
#define READ_LONG READ_LONG
#define READ_POSITION READ_POSITION
#define READ_REVERSE READ_REVERSE
#define READ_TOC READ_TOC
COSMOPOLITAN_C_START_

View file

@ -26,6 +26,5 @@ extern const unsigned RB_NOSYNC;
#define RB_DISABLE_CAD RB_DISABLE_CAD
#define RB_NOSYNC RB_NOSYNC
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */

View file

@ -12,6 +12,5 @@ extern const uint64_t RLIM_SAVED_MAX;
#define RLIM_SAVED_CUR RLIM_SAVED_CUR
#define RLIM_SAVED_MAX RLIM_SAVED_MAX
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_RLIM_H_ */

View file

@ -22,6 +22,5 @@ extern const uint64_t SA_SIGINFO;
#define SA_RESTART SA_RESTART
#define SA_SIGINFO SA_SIGINFO
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SA_H_ */

View file

@ -19,6 +19,5 @@ extern const int SCHED_RR;
#define SCHED_RESET_ON_FORK SCHED_RESET_ON_FORK
#define SCHED_RR SCHED_RR
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCHED_H_ */

View file

@ -17,5 +17,4 @@ COSMOPOLITAN_C_END_
#define SCM_TIMESTAMPNS SCM_TIMESTAMPNS
#define SCM_WIFI_STATUS SCM_WIFI_STATUS
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCM_H_ */

View file

@ -17,6 +17,5 @@ extern const int SF_SYNC;
#define SF_NODISKIO SF_NODISKIO
#define SF_SYNC SF_SYNC
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SF_H_ */

View file

@ -105,6 +105,5 @@ extern const int32_t SYS_USER_DISPATCH;
#define SYS_SECCOMP SYS_SECCOMP
#define SYS_USER_DISPATCH SYS_USER_DISPATCH
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SICODE_H_ */

View file

@ -28,6 +28,5 @@ extern const int ST_WRITE;
#define ST_SYNCHRONOUS ST_SYNCHRONOUS
#define ST_WRITE ST_WRITE
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_ST_H_ */

View file

@ -66,6 +66,5 @@ extern const int TCP_WINDOW_CLAMP;
#define TCP_USER_TIMEOUT TCP_USER_TIMEOUT
#define TCP_WINDOW_CLAMP TCP_WINDOW_CLAMP
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_TCP_H_ */

View file

@ -10,5 +10,4 @@ COSMOPOLITAN_C_END_
#define UTIME_NOW UTIME_NOW
#define UTIME_OMIT UTIME_OMIT
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_ */

View file

@ -10,6 +10,5 @@ extern const int WCONTINUED;
#define WUNTRACED WUNTRACED
#define WCONTINUED WCONTINUED
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_W_H_ */

View file

@ -35,7 +35,8 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" speculative"); \
Tries = 0; \
do { \
__testlib_yield(); \
@ -51,94 +52,100 @@ COSMOPOLITAN_C_START_
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport( \
NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \
MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \
} while (0)
#define EZBENCH3(NAME, NUM, INIT, EXPR) \
do { \
int Core, Tries, Interrupts; \
double Speculative, MemoryStrict; \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
INIT; \
EXPR; \
Speculative = BENCHLOOP(__startbench, __endbench, NUM, ({ \
INIT; \
__polluteregisters(); \
}), \
(EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
INIT; \
EXPR; \
MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, NUM, ({ \
INIT; \
__polluteregisters(); \
}), \
(EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport( \
NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \
MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \
#define EZBENCH3(NAME, NUM, INIT, EXPR) \
do { \
int Core, Tries, Interrupts; \
double Speculative, MemoryStrict; \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
INIT; \
EXPR; \
Speculative = BENCHLOOP(__startbench, __endbench, NUM, ({ \
INIT; \
__polluteregisters(); \
}), \
(EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" speculative"); \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
INIT; \
EXPR; \
MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, NUM, ({ \
INIT; \
__polluteregisters(); \
}), \
(EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport( \
NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \
MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \
} while (0)
#define EZBENCH_C(NAME, CONTROL, EXPR) \
do { \
int Core, Tries, Interrupts; \
double Control, Speculative, MemoryStrict; \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
Control = BENCHLOOP(__startbench_m, __endbench_m, EZBENCH_COUNT, \
({ __polluteregisters(); }), (CONTROL)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" control"); \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
EXPR; \
Speculative = BENCHLOOP(__startbench, __endbench, EZBENCH_COUNT, \
__polluteregisters(), (EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
EXPR; \
MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, 8, \
({ __polluteregisters(); }), (EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport(NAME, MAX(.001, Speculative - Control), \
MAX(.001, MemoryStrict - Control)); \
#define EZBENCH_C(NAME, CONTROL, EXPR) \
do { \
int Core, Tries, Interrupts; \
double Control, Speculative, MemoryStrict; \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
Control = BENCHLOOP(__startbench_m, __endbench_m, EZBENCH_COUNT, \
({ __polluteregisters(); }), (CONTROL)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" control"); \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
EXPR; \
Speculative = BENCHLOOP(__startbench, __endbench, EZBENCH_COUNT, \
__polluteregisters(), (EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" speculative"); \
Tries = 0; \
do { \
__testlib_yield(); \
Core = __testlib_getcore(); \
Interrupts = __testlib_getinterrupts(); \
EXPR; \
MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, 8, \
({ __polluteregisters(); }), (EXPR)); \
} while (++Tries < EZBENCH_TRIES && \
(__testlib_getcore() != Core && \
__testlib_getinterrupts() > Interrupts)); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(" memory strict"); \
__testlib_ezbenchreport(NAME, MAX(.001, Speculative - Control), \
MAX(.001, MemoryStrict - Control)); \
} while (0)
#define EZBENCH_N(NAME, N, EXPR) \
@ -156,7 +163,8 @@ COSMOPOLITAN_C_START_
EXPR; \
Speculative = BENCHLOOPER(__startbench, __endbench, 32, (EXPR)); \
} while (++Tries < EZBENCH_TRIES && !Speculative); \
if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(""); \
if (Tries == EZBENCH_TRIES) \
__testlib_ezbenchwarn(""); \
__testlib_ezbenchreport_n(NAME, 'n', N, Speculative); \
} while (0)

View file

@ -420,8 +420,10 @@ forceinline void testlib_onfail2(bool isfatal) {
forceinline void assertNotEquals(FILIFU_ARGS intptr_t donotwant, intptr_t got,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
if (got != donotwant) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (got != donotwant)
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertNotEquals", "=", gotcode,
testlib_formatint(got), testlib_formatint(donotwant));
testlib_onfail2(isfatal);
@ -455,8 +457,10 @@ forceinline void assertBetween(FILIFU_ARGS intptr_t beg, intptr_t end,
intptr_t got, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (beg <= got && got <= end) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (beg <= got && got <= end)
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertBetween", "", gotcode,
testlib_formatint(got), testlib_formatrange(beg, end));
testlib_onfail2(isfatal);
@ -466,8 +470,10 @@ forceinline void assertStringEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (testlib_strequals(cw, want, got)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_strequals(cw, want, got))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringEquals", "", gotcode,
testlib_formatstr(cw, want, -1),
testlib_formatstr(cw, got, -1));
@ -478,8 +484,10 @@ forceinline void assertStringNotEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (!testlib_strequals(cw, want, got)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (!testlib_strequals(cw, want, got))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringNotEquals", "=", gotcode,
testlib_formatstr(cw, want, -1),
testlib_formatstr(cw, got, -1));
@ -490,8 +498,10 @@ forceinline void assertStrnEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, size_t n,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
if (testlib_strnequals(cw, want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_strnequals(cw, want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnEquals", "", gotcode,
testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n));
@ -502,8 +512,10 @@ forceinline void assertStrnNotEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, size_t n,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
if (!testlib_strnequals(cw, want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (!testlib_strnequals(cw, want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnNotEquals", "=", gotcode,
testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n));
@ -514,8 +526,10 @@ forceinline void assertStringCaseEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (testlib_strcaseequals(cw, want, got)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_strcaseequals(cw, want, got))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringCaseEquals", "", gotcode,
testlib_formatstr(cw, got, -1),
testlib_formatstr(cw, want, -1));
@ -526,8 +540,10 @@ forceinline void assertStringCaseNotEquals(FILIFU_ARGS size_t cw,
const void *want, const void *got,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
if (!testlib_strcaseequals(cw, want, got)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (!testlib_strcaseequals(cw, want, got))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStringCaseNotEquals", "=", gotcode,
testlib_formatstr(cw, got, -1),
testlib_formatstr(cw, want, -1));
@ -538,8 +554,10 @@ forceinline void assertStrnCaseEquals(FILIFU_ARGS size_t cw, const void *want,
const void *got, size_t n,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
if (testlib_strncaseequals(cw, want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_strncaseequals(cw, want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnCaseEquals", "", gotcode,
testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n));
@ -551,8 +569,10 @@ forceinline void assertStrnCaseNotEquals(FILIFU_ARGS size_t cw,
size_t n, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (!testlib_strncaseequals(cw, want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (!testlib_strncaseequals(cw, want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStrnCaseNotEquals", "=", gotcode,
testlib_formatstr(cw, got, n),
testlib_formatstr(cw, want, n));
@ -563,8 +583,10 @@ forceinline void assertStartsWith(FILIFU_ARGS size_t cw, const char *prefix,
const char *s, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (testlib_startswith(cw, s, prefix)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_startswith(cw, s, prefix))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertStartsWith", "", gotcode,
testlib_formatstr(1, prefix, -1),
testlib_formatstr(1, s, -1));
@ -575,8 +597,10 @@ forceinline void assertEndsWith(FILIFU_ARGS size_t cw, const char *suffix,
const char *s, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (testlib_endswith(cw, s, suffix)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_endswith(cw, s, suffix))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertEndsWith", "", gotcode,
testlib_formatstr(1, s, -1),
testlib_formatstr(1, suffix, -1));
@ -587,8 +611,10 @@ forceinline void assertContains(FILIFU_ARGS size_t cw, const char *needle,
const char *s, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (testlib_contains(cw, s, needle)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_contains(cw, s, needle))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertContains", "", gotcode,
testlib_formatstr(1, s, -1),
testlib_formatstr(1, needle, -1));
@ -600,8 +626,10 @@ forceinline void assertBinaryEquals_cp437(FILIFU_ARGS const char16_t *want,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
char *v1, *v2;
if (testlib_binequals(want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_binequals(want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryasglyphs(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryEquals", "", gotcode, v1,
v2);
@ -613,8 +641,10 @@ forceinline void assertBinaryEquals_hex(FILIFU_ARGS const char *want,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
char *v1, *v2;
if (testlib_hexequals(want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_hexequals(want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryashex(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryEquals", "", gotcode, v1,
v2);
@ -627,8 +657,10 @@ forceinline void assertBinaryNotEquals_cp437(FILIFU_ARGS const char16_t *want,
bool isfatal) {
++g_testlib_ran;
char *v1, *v2;
if (!testlib_binequals(want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (!testlib_binequals(want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryasglyphs(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1,
v2);
@ -640,8 +672,10 @@ forceinline void assertBinaryNotEquals_hex(FILIFU_ARGS const char *want,
const char *gotcode, bool isfatal) {
++g_testlib_ran;
char *v1, *v2;
if (!testlib_hexequals(want, got, n)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (!testlib_hexequals(want, got, n))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_formatbinaryashex(want, got, n, &v1, &v2);
testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1,
v2);
@ -652,8 +686,10 @@ forceinline void assertLongDoubleEquals(FILIFU_ARGS long double want,
long double got, const char *gotcode,
bool isfatal) {
++g_testlib_ran;
if (testlib_almostequallongdouble(want, got)) return;
if (g_testlib_shoulddebugbreak) DebugBreak();
if (testlib_almostequallongdouble(want, got))
return;
if (g_testlib_shoulddebugbreak)
DebugBreak();
testlib_showerror(file, line, func, "assertLongDoubleEquals", "", gotcode,
testlib_formatfloat(want), testlib_formatfloat(got));
testlib_onfail2(isfatal);

View file

@ -48,7 +48,7 @@ static struct Semaphores {
char *path;
bool dead;
int refs;
} * list;
} *list;
} g_semaphores;
static void sem_open_lock(void) {

View file

@ -44,7 +44,8 @@ COSMOPOLITAN_C_START_
#define PTHREAD_COND_INITIALIZER _PTHREAD_INIT
#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_INIT
#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_INIT
#define _PTHREAD_INIT {0}
#define _PTHREAD_INIT \
{ 0 }
typedef uintptr_t pthread_t;
typedef int pthread_id_np_t;