Make more compatibility improvements

This commit is contained in:
Justine Tunney 2022-09-06 07:04:13 -07:00
parent 12d9e1e128
commit 55c6297e13
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
63 changed files with 513 additions and 80 deletions

View file

@ -279,6 +279,7 @@ SECTIONS {
KEEP(*(.keep.text))
*(.text .stub .text.*)
KEEP(*(SORT_BY_NAME(.sort.text.*)))
*(.subrs)
KEEP(*(.ape.pad.test));
*(.test.unlikely)

27
libc/calls/CPU_AND.c Normal file
View file

@ -0,0 +1,27 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/macros.internal.h"
void CPU_AND(cpu_set_t *d, cpu_set_t *x, cpu_set_t *y) {
int i;
for (i = 0; i < ARRAYLEN(d->__bits); ++i) {
d->__bits[i] = x->__bits[i] & y->__bits[i];
}
}

29
libc/calls/CPU_COUNT.c Normal file
View file

@ -0,0 +1,29 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/intrin/popcnt.h"
#include "libc/macros.internal.h"
int CPU_COUNT(cpu_set_t *set) {
int i, c;
for (c = i = 0; i < ARRAYLEN(set->__bits); ++i) {
c += popcnt(set->__bits[i]);
}
return c;
}

24
libc/calls/CPU_EQUAL.c Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/str/str.h"
int CPU_EQUAL(cpu_set_t *x, cpu_set_t *y) {
return !memcmp(x, y, sizeof(*x));
}

27
libc/calls/CPU_OR.c Normal file
View file

@ -0,0 +1,27 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/macros.internal.h"
void CPU_OR(cpu_set_t *d, cpu_set_t *x, cpu_set_t *y) {
int i;
for (i = 0; i < ARRAYLEN(d->__bits); ++i) {
d->__bits[i] = x->__bits[i] | y->__bits[i];
}
}

27
libc/calls/CPU_XOR.c Normal file
View file

@ -0,0 +1,27 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/macros.internal.h"
void CPU_XOR(cpu_set_t *d, cpu_set_t *x, cpu_set_t *y) {
int i;
for (i = 0; i < ARRAYLEN(d->__bits); ++i) {
d->__bits[i] = x->__bits[i] ^ y->__bits[i];
}
}

24
libc/calls/CPU_ZERO.c Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/str/str.h"
void CPU_ZERO(cpu_set_t *set) {
bzero(set, sizeof(*set));
}

View file

@ -159,8 +159,6 @@ int rename(const char *, const char *);
int renameat(int, const char *, int, const char *);
int renameat2(long, const char *, long, const char *, int);
int rmdir(const char *);
int sched_getaffinity(int, uint64_t, void *);
int sched_setaffinity(int, uint64_t, const void *);
int sched_yield(void);
int seccomp(unsigned, unsigned, void *);
int setegid(uint32_t);
@ -184,6 +182,7 @@ int symlinkat(const char *, int, const char *);
int sync_file_range(int, int64_t, int64_t, unsigned);
int sys_ptrace(int, ...);
int sysctl(const int *, unsigned, void *, size_t *, void *, size_t);
int tcsetpgrp(int, int32_t);
int tgkill(int, int, int);
int tkill(int, int);
int tmpfd(void);
@ -199,6 +198,7 @@ int usleep(unsigned);
int vfork(void) returnstwice;
int wait(int *);
int waitpid(int, int *, int);
int32_t tcgetpgrp(int);
intptr_t syscall(int, ...);
long ptrace(int, ...);
ssize_t copy_file_range(int, long *, int, long *, size_t, uint32_t);

View file

@ -17,10 +17,11 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/intrin/popcnt.h"
#include "libc/calls/calls.h"
#include "libc/calls/sched-sysv.internal.h"
#include "libc/calls/weirdtypes.h"
#include "libc/dce.h"
#include "libc/intrin/popcnt.h"
#include "libc/macros.internal.h"
#include "libc/nt/dll.h"
#include "libc/nt/struct/systeminfo.h"
@ -36,7 +37,7 @@
static unsigned GetCpuCountLinux(void) {
uint64_t s[16];
unsigned i, c, n;
if (!sched_getaffinity(0, sizeof(s), s)) {
if (!sys_sched_getaffinity(0, sizeof(s), s)) {
for (c = i = 0; i < ARRAYLEN(s); ++i) {
c += popcnt(s[i]);
}

View file

@ -16,28 +16,56 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/sched-sysv.internal.h"
#include "libc/calls/strace.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/struct/cpuset.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/nt/process.h"
#include "libc/nt/runtime.h"
#include "libc/nt/thread.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
static textwindows int sys_sched_getaffinity_nt(int tid, size_t size,
cpu_set_t *bitset) {
uint64_t ProcessAffinityMask, SystemAffinityMask;
if (GetProcessAffinityMask(GetCurrentProcess(), &ProcessAffinityMask,
&SystemAffinityMask)) {
bzero(bitset, size);
bitset->__bits[0] = ProcessAffinityMask;
return 0;
} else {
return __winerr();
}
}
/**
* Gets kernel scheduling for particular CPUs.
* Gets CPU affinity for current thread.
*
* While Windows allows us to change the thread affinity mask, it's only
* possible to read the process affinity mask. Therefore this function
* won't reflect the changes made by sched_setaffinity() on Windows.
*
* @param pid is the process or thread id (or 0 for caller)
* @param size is byte length of bitset
* @param size is byte length of bitset, which should 128
* @param bitset receives bitset and should be uint64_t[16] in order to
* work on older versions of Linux
* @return 0 on success, or -1 w/ errno
* @raise ENOSYS on non-Linux
*/
int sched_getaffinity(int tid, size_t size, void *bitset) {
long rc;
rc = sys_sched_getaffinity(tid, size, bitset);
if (rc != -1) {
int sched_getaffinity(int tid, size_t size, cpu_set_t *bitset) {
int rc;
if (size != 128) {
rc = einval();
} else if (IsWindows()) {
rc = sys_sched_getaffinity_nt(tid, size, bitset);
} else {
rc = sys_sched_getaffinity(tid, size, bitset);
}
if (rc > 0) {
if (rc < size) {
memset((char *)bitset + rc, 0, size - rc);
bzero((char *)bitset + rc, size - rc);
}
rc = 0;
}

View file

@ -16,13 +16,14 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/sched-sysv.internal.h"
#include "libc/calls/strace.internal.h"
#include "libc/calls/struct/cpuset.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/limits.h"
#include "libc/nt/enum/processaccess.h"
#include "libc/nt/enum/threadaccess.h"
@ -30,6 +31,7 @@
#include "libc/nt/runtime.h"
#include "libc/nt/thread.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
static textwindows dontinline int sys_sched_setaffinity_nt(int pid,
uint64_t bitsetsize,
@ -67,16 +69,18 @@ static textwindows dontinline int sys_sched_setaffinity_nt(int pid,
* Asks kernel to only schedule process on particular CPUs.
*
* @param tid is the process or thread id (or 0 for caller)
* @param bitsetsize is byte length of bitset
* @param bitsetsize is byte length of bitset, which should be 128
* @return 0 on success, or -1 w/ errno
* @raise ENOSYS if not Linux or Windows
*/
int sched_setaffinity(int tid, uint64_t bitsetsize, const void *bitset) {
int sched_setaffinity(int tid, size_t bitsetsize, const cpu_set_t *bitset) {
int rc;
if (!IsWindows()) {
rc = sys_sched_setaffinity(tid, bitsetsize, bitset);
} else {
if (bitsetsize != 128) {
rc = einval();
} else if (IsWindows()) {
rc = sys_sched_setaffinity_nt(tid, bitsetsize, bitset);
} else {
rc = sys_sched_setaffinity(tid, bitsetsize, bitset);
}
STRACE("sched_setaffinity(%d, %'zu, %p) → %d% m", tid, bitsetsize, bitset);
return rc;

View file

@ -0,0 +1,29 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_CPUSET_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_CPUSET_H_
#define CPU_SETSIZE 1024
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
typedef struct cpu_set_t {
uint64_t __bits[16];
} cpu_set_t;
int sched_getcpu(void);
int sched_getaffinity(int, size_t, cpu_set_t *);
int sched_setaffinity(int, size_t, const cpu_set_t *);
#define CPU_SET(i, s) ((s)->__bits[(i) / 64] |= 1ull << ((i) % 64))
#define CPU_CLR(i, s) ((s)->__bits[(i) / 64] &= ~(1ull << ((i) % 64)))
#define CPU_ISSET(i, s) (!!((s)->__bits[(i) / 64] & (1ull << ((i) % 64))))
void CPU_ZERO(cpu_set_t *);
int CPU_COUNT(cpu_set_t *);
int CPU_EQUAL(cpu_set_t *, cpu_set_t *);
void CPU_AND(cpu_set_t *, cpu_set_t *, cpu_set_t *);
void CPU_OR(cpu_set_t *, cpu_set_t *, cpu_set_t *);
void CPU_XOR(cpu_set_t *, cpu_set_t *, cpu_set_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_CPUSET_H_ */

View file

@ -14,6 +14,7 @@ int sigfillset(sigset_t *) paramsnonnull();
int sigismember(const sigset_t *, int) paramsnonnull() nosideeffect;
int sigprocmask(int, const sigset_t *, sigset_t *);
int sigsuspend(const sigset_t *);
int pthread_sigmask(int, const sigset_t *, sigset_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -13,8 +13,6 @@ COSMOPOLITAN_C_START_
int tcgetattr(int, struct termios *);
int tcsetattr(int, int, const struct termios *);
int tcsetpgrp(int, int32_t);
int32_t tcgetpgrp(int);
int openpty(int *, int *, char *, const struct termios *,
const struct winsize *) paramsnonnull((1, 2));

View file

@ -9,8 +9,7 @@
#define blkcnt_t int64_t
#define blksize_t int64_t /* int32_t on xnu */
#define cc_t uint8_t
#define clock_t int64_t /* uint64_t on xnu */
#define cpu_set_t uint64_t
#define clock_t int64_t /* uint64_t on xnu */
#define dev_t uint64_t /* int32_t on xnu */
#define fsblkcnt_t int64_t
#define fsfilcnt_t int64_t /* uint32_t on xnu */

View file

@ -17,17 +17,18 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/fmt/fmt.internal.h"
#include "libc/fmt/internal.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/fmt/fmt.internal.h"
#include "libc/fmt/internal.h"
#include "libc/nexgen32e/bsr.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/str/thompike.h"
#include "libc/str/tpenc.h"
#include "libc/str/utf16.h"
#include "libc/str/unicode.h"
#include "libc/str/utf16.h"
typedef int (*out_f)(const char *, void *, size_t);
typedef int (*emit_f)(out_f, void *, uint64_t);

View file

@ -718,7 +718,6 @@ typedef struct {
#pragma GCC diagnostic error "-Wpointer-arith"
#pragma GCC diagnostic error "-Wnonnull"
#pragma GCC diagnostic error "-Wunused-result"
#pragma GCC diagnostic error "-Wuninitialized"
#pragma GCC diagnostic error "-Wstrict-aliasing"
#pragma GCC diagnostic error "-Wshift-negative-value"
#ifndef __cplusplus
@ -737,7 +736,6 @@ typedef struct {
#if defined(__GNUC__) && !defined(__llvm__)
#pragma GCC diagnostic error "-Wwrite-strings"
#pragma GCC diagnostic error "-Wtrampolines"
#pragma GCC diagnostic error "-Wmaybe-uninitialized"
#if __GNUC__ >= 6
#pragma GCC diagnostic error "-Wnonnull-compare"
#if defined(COSMO) && !defined(MODE_DBG) && !defined(STACK_FRAME_UNLIMITED)

4
libc/isystem/byteswap.h Normal file
View file

@ -0,0 +1,4 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_BYTESWAP_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_BYTESWAP_H_
#include "libc/intrin/bswap.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_BYTESWAP_H_ */

View file

@ -0,0 +1,4 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_XATTR_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_XATTR_H_
#include "libc/calls/xattr.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_XATTR_H_ */

View file

@ -1,4 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_LOCALE_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_LOCALE_H_
#include "libc/str/locale.h"
#include "libc/str/unicode.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_LOCALE_H_ */

7
libc/isystem/net/if.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_NET_IF_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_NET_IF_H_
#include "libc/sock/if.h"
#include "libc/sock/struct/ifconf.h"
#include "libc/sock/struct/ifreq.h"
#include "libc/sysv/consts/iff.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_NET_IF_H_ */

View file

@ -1,6 +1,7 @@
#ifndef LIBC_ISYSTEM_SCHED_H_
#define LIBC_ISYSTEM_SCHED_H_
#include "libc/calls/calls.h"
#include "libc/calls/struct/cpuset.h"
#include "libc/calls/struct/sched_param.h"
#include "libc/sysv/consts/sched.h"
#endif

6
libc/isystem/sys/event.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_EVENT_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_EVENT_H_
/* eventfd() is meh */
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_EVENT_H_ */

View file

@ -3,6 +3,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/stat.macros.h"
#include "libc/calls/struct/timespec.h"
#include "libc/calls/weirdtypes.h"
#include "libc/sysv/consts/s.h"
#include "libc/sysv/consts/utime.h"

View file

@ -0,0 +1,4 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_STATFS_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_SYS_STATFS_H_
#include "libc/calls/struct/statfs.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_STATFS_H_ */

View file

@ -1,4 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_STATVFS_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_STATVFS_H_
#include "libc/calls/struct/statvfs.h"
#include "libc/sysv/consts/st.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_STATVFS_H_ */

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_ISYSTEM_TERMIOS_H_
#define COSMOPOLITAN_LIBC_ISYSTEM_TERMIOS_H_
#include "libc/calls/termios.h"
#include "libc/sysv/consts/baud.h"
#include "libc/sysv/consts/termios.h"
#endif /* COSMOPOLITAN_LIBC_ISYSTEM_TERMIOS_H_ */

View file

@ -87,4 +87,7 @@
((uint128_t)0xffffffffffffffff << 64 | (uint128_t)0xffffffffffffffff)
#endif /* GCC 4.6+ */
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
#endif /* COSMOPOLITAN_LIBC_LIMITS_H_ */

View file

@ -58,9 +58,8 @@ uint32_t GetEnvironmentVariable(const char16_t *lpName, char16_t *lpBuffer,
uint32_t nSize);
uint32_t SetEnvironmentVariable(const char16_t *lpName, char16_t *lpValue);
int32_t SetEnvironmentStrings(char16_t *NewEnvironment);
bool32 GetProcessAffinityMask(int64_t hProcess,
uintptr_t *lpProcessAffinityMask,
uintptr_t *lpSystemAffinityMask);
bool32 GetProcessAffinityMask(int64_t hProcess, uint64_t *lpProcessAffinityMask,
uint64_t *lpSystemAffinityMask);
uint64_t /*bool32*/ SetProcessAffinityMask(int64_t hProcess,
uintptr_t dwProcessAffinityMask);

24
libc/runtime/endutent.S Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
endutent:
xor %eax,%eax
ret
.endfn endutent,globl

View file

@ -21,6 +21,6 @@
// Closes user accounting database.
// @note unsupported
endutxent:
xor %eax,%eax
ret
.endfn endutxent,globl
.alias endutxent,endutent

24
libc/runtime/getutent.S Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
getutent:
xor %eax,%eax
ret
.endfn getutent,globl

24
libc/runtime/getutid.S Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
getutid:
xor %eax,%eax
ret
.endfn getutid,globl

View file

@ -24,4 +24,3 @@ getutxent:
xor %eax,%eax
ret
.endfn getutxent,globl
.alias getutxent,getutent

View file

@ -24,4 +24,3 @@ getutxid:
xor %eax,%eax
ret
.endfn getutxid,globl
.alias getutxid,getutid

24
libc/runtime/setutent.S Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
setutent:
xor %eax,%eax
ret
.endfn setutent,globl

View file

@ -21,6 +21,6 @@
// Rewinds the user accounting database.
// @note unsupported
setutxent:
xor %eax,%eax
ret
.endfn setutxent,globl
.alias setutxent,setutent

24
libc/runtime/updwtmp.S Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
updwtmp:
xor %eax,%eax
ret
.endfn updwtmp,globl

View file

@ -21,6 +21,6 @@
// Does something to the user accounting database.
// @note unsupported
updwtmpx:
xor %eax,%eax
ret
.endfn updwtmpx,globl
.alias updwtmpx,updwtmp

6
libc/sock/if.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_IF_H_
#define COSMOPOLITAN_LIBC_SOCK_IF_H_
#define IFNAMSIZ 16
#endif /* COSMOPOLITAN_LIBC_SOCK_IF_H_ */

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/str/unicode.h"
#include "libc/str/strwidth.h"
/**
* Returns monospace display width of UTF-8 string.

13
libc/str/strwidth.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef COSMOPOLITAN_LIBC_STR_STRWIDTH_H_
#define COSMOPOLITAN_LIBC_STR_STRWIDTH_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int strwidth(const char *, size_t) strlenesque;
int strnwidth(const char *, size_t, size_t) strlenesque;
int strwidth16(const char16_t *, size_t) strlenesque;
int strnwidth16(const char16_t *, size_t, size_t) strlenesque;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_STR_STRWIDTH_H_ */

View file

@ -18,7 +18,7 @@
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/limits.h"
#include "libc/str/unicode.h"
#include "libc/str/strwidth.h"
/**
* Returns monospace display width of UTF-16 or UCS-2 string.

View file

@ -33,10 +33,6 @@ struct lconv {
int wcwidth(wchar_t) pureconst;
int wcswidth(const wchar_t *, size_t) strlenesque;
int wcsnwidth(const wchar_t *, size_t, size_t) strlenesque;
int strwidth(const char *, size_t) strlenesque;
int strnwidth(const char *, size_t, size_t) strlenesque;
int strwidth16(const char16_t *, size_t) strlenesque;
int strnwidth16(const char16_t *, size_t, size_t) strlenesque;
struct lconv *localeconv(void);
COSMOPOLITAN_C_END_

View file

@ -302,7 +302,6 @@ syscon mremap MREMAP_FIXED 2 2 2 2 2 2 # faked non-linux (b/c lin
syscon misc SIG_BLOCK 0 1 1 1 1 0 # bsd consensus; faked nt
syscon misc SIG_UNBLOCK 1 2 2 2 2 1 # bsd consensus; faked nt
syscon misc SIG_SETMASK 2 3 3 3 3 2 # bsd consensus; faked nt
syscon misc SIG_ATOMIC_MIN -2147483648 -2147483648 -9223372036854775808 -2147483648 -2147483648 0
# lseek() whence
#

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon misc,SIG_ATOMIC_MIN,-2147483648,-2147483648,-9223372036854775808,-2147483648,-2147483648,0

View file

@ -43,7 +43,6 @@ extern const int SIGWINCH;
extern const int SIGXCPU;
extern const int SIGXFSZ;
extern const int SIG_ATOMIC_MIN;
extern const int SIG_BLOCK;
extern const int SIG_SETMASK;
extern const int SIG_UNBLOCK;
@ -91,9 +90,8 @@ COSMOPOLITAN_C_END_
#define SIGUSR1 SYMBOLIC(SIGUSR1)
#define SIGUSR2 SYMBOLIC(SIGUSR2)
#define SIG_ATOMIC_MIN SYMBOLIC(SIG_ATOMIC_MIN)
#define SIG_BLOCK SYMBOLIC(SIG_BLOCK)
#define SIG_SETMASK SYMBOLIC(SIG_SETMASK)
#define SIG_UNBLOCK SYMBOLIC(SIG_UNBLOCK)
#define SIG_BLOCK SYMBOLIC(SIG_BLOCK)
#define SIG_SETMASK SYMBOLIC(SIG_SETMASK)
#define SIG_UNBLOCK SYMBOLIC(SIG_UNBLOCK)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SIG_H_ */

View file

@ -0,0 +1,27 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/sigset.h"
#include "libc/thread/thread.h"
/**
* Examines and/or changes blocked signals on current thread.
*/
int pthread_sigmask(int how, const sigset_t *set, sigset_t *old) {
return sigprocmask(how, set, old);
}

View file

@ -16,10 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/popcnt.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/cpuset.h"
#include "libc/dce.h"
#include "libc/intrin/popcnt.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/sysconf.h"
#include "libc/testlib/testlib.h"
void SetUp(void) {
@ -28,7 +30,25 @@ void SetUp(void) {
}
}
TEST(sched_getaffinity, test) {
uint64_t s[16];
EXPECT_SYS(0, 0, sched_getaffinity(0, sizeof(s), &s));
TEST(sched_getaffinity, firstOnly) {
cpu_set_t x, y;
CPU_ZERO(&x);
CPU_SET(0, &x);
ASSERT_SYS(0, 0, sched_setaffinity(0, sizeof(x), &x));
ASSERT_SYS(0, 0, sched_getaffinity(0, sizeof(y), &y));
EXPECT_EQ(1, CPU_COUNT(&y));
EXPECT_TRUE(CPU_ISSET(0, &y));
EXPECT_FALSE(CPU_ISSET(1, &y));
}
TEST(sched_getaffinity, secondOnly) {
if (GetCpuCount() < 2) return;
cpu_set_t x, y;
CPU_ZERO(&x);
CPU_SET(1, &x);
ASSERT_SYS(0, 0, sched_setaffinity(0, sizeof(x), &x));
ASSERT_SYS(0, 0, sched_getaffinity(0, sizeof(y), &y));
EXPECT_EQ(1, CPU_COUNT(&y));
EXPECT_FALSE(CPU_ISSET(0, &y));
EXPECT_TRUE(CPU_ISSET(1, &y));
}

View file

@ -17,10 +17,10 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/str/strwidth.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"
#include "libc/str/unicode.h"
TEST(strwidth, test) {
EXPECT_EQ(5, strwidth("hello", 0));

View file

@ -18,9 +18,10 @@
*/
#include "libc/intrin/bits.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/str/unicode.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/str/unicode.h"
TEST(wcwidth, test) {
ASSERT_EQ(0, wcwidth(0));

View file

@ -21,6 +21,7 @@
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/ioctl.h"
#include "libc/calls/struct/cpuset.h"
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/itimerval.h"
#include "libc/calls/struct/sigaction.h"
@ -56,11 +57,11 @@
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/str/thompike.h"
#include "libc/str/tpdecode.internal.h"
#include "libc/str/tpenc.h"
#include "libc/str/tpencode.internal.h"
#include "libc/str/unicode.h"
#include "libc/sysv/consts/auxv.h"
#include "libc/sysv/consts/ex.h"
#include "libc/sysv/consts/exit.h"
@ -3123,7 +3124,9 @@ int Emulator(int argc, char *argv[]) {
}
static void OnlyRunOnFirstCpu(void) {
uint64_t bs = 1;
cpu_set_t bs;
CPU_ZERO(&bs);
CPU_SET(0, &bs);
sched_setaffinity(0, sizeof(bs), &bs);
}

View file

@ -20,7 +20,7 @@
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/str/unicode.h"
#include "libc/str/strwidth.h"
#include "tool/build/lib/buffer.h"
#include "tool/build/lib/lines.h"
#include "tool/build/lib/panel.h"

View file

@ -1379,7 +1379,6 @@ void OpSyscall(struct Machine *m, uint32_t rde) {
SYSCALL(0x09D, OpPrctl(m, di, si, dx, r0, r8));
SYSCALL(0x09E, OpArchPrctl(m, di, si));
SYSCALL(0x0BA, OpGetTid(m));
SYSCALL(0x0CB, sched_setaffinity(di, si, P(dx)));
SYSCALL(0x0D9, OpGetdents(m, di, si, dx));
SYSCALL(0x0DD, OpFadvise(m, di, si, dx, r0));
SYSCALL(0x0E4, OpClockGettime(m, di, si));

View file

@ -76,7 +76,7 @@
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/unicode.h"
#include "libc/str/strwidth.h"
#include "libc/x/x.h"
#define IsSpace(C) ((C) == ' ')

View file

@ -43,6 +43,7 @@
#include "libc/sock/sock.h"
#include "libc/stdio/rand.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/ipproto.h"
#include "libc/sysv/consts/o.h"

View file

@ -67,6 +67,7 @@
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/slice.h"
#include "libc/str/strwidth.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/dt.h"

View file

@ -16,12 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/itoa.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/itoa.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/str/unicode.h"
#include "libc/str/strwidth.h"
#include "libc/x/x.h"
#include "tool/viz/lib/formatstringtable.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/str/unicode.h"
#include "libc/str/strwidth.h"
#include "tool/viz/lib/formatstringtable.h"
void *FreeStringTableCells(long yn, long xn, char *T[yn][xn]) {

View file

@ -18,10 +18,6 @@
*/
#include "dsp/core/gamma.h"
#include "dsp/scale/scale.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/popcnt.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/xchg.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/ioctl.h"
#include "libc/calls/struct/stat.h"
@ -32,6 +28,10 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/popcnt.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/xchg.internal.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
@ -66,13 +66,15 @@
#include "libc/nt/struct/windowplacement.h"
#include "libc/nt/struct/wndclass.h"
#include "libc/nt/windows.h"
#include "libc/stdio/rand.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/str/tpenc.h"
#include "libc/str/unicode.h"
#include "libc/sysv/consts/ex.h"
#include "libc/sysv/consts/exit.h"
#include "libc/sysv/consts/map.h"
@ -80,7 +82,6 @@
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/consts/termios.h"
#include "libc/time/time.h"
#include "libc/str/unicode.h"
#include "libc/x/x.h"
#include "third_party/getopt/getopt.h"

View file

@ -23,12 +23,7 @@
#include "dsp/scale/scale.h"
#include "dsp/tty/quant.h"
#include "dsp/tty/tty.h"
#include "libc/mem/alg.h"
#include "libc/mem/arraylist.internal.h"
#include "libc/assert.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/xchg.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/ioctl.h"
@ -46,24 +41,31 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/xchg.internal.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/alg.h"
#include "libc/mem/arraylist.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/bench.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/nt/console.h"
#include "libc/nt/runtime.h"
#include "libc/stdio/rand.h"
#include "libc/runtime/buffer.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/stdio/internal.h"
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/str/unicode.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/auxv.h"
#include "libc/sysv/consts/clock.h"
@ -89,7 +91,6 @@
#include "libc/sysv/consts/w.h"
#include "libc/sysv/errfuns.h"
#include "libc/time/time.h"
#include "libc/str/unicode.h"
#include "libc/x/x.h"
#include "third_party/getopt/getopt.h"
#include "third_party/stb/stb_image_resize.h"

View file

@ -16,19 +16,20 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/arraylist.internal.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/conv.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/mem/arraylist.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/str/unicode.h"
#include "libc/sysv/consts/ex.h"
#include "libc/sysv/consts/exit.h"
#include "libc/str/unicode.h"
#include "third_party/getopt/getopt.h"
#define kOneTrueTabWidth 8