Remove _Hide keyword

It never did anything and isn't worthwhile as documentation.
This commit is contained in:
Justine Tunney 2023-07-24 08:31:54 -07:00
parent 4fb6cbc1fe
commit e0c2b91b3e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
131 changed files with 716 additions and 917 deletions

26
examples/showdown.c Normal file
View file

@ -0,0 +1,26 @@
#if 0
/*─────────────────────────────────────────────────────────────────╗
To the extent possible under law, Justine Tunney has waived
all copyright and related or neighboring rights to this file,
as it is written in the following disclaimers:
http://unlicense.org/ │
http://creativecommons.org/publicdomain/zero/1.0/ │
*/
#endif
#include "libc/calls/calls.h"
#include "libc/calls/struct/iovec.h"
#include "libc/errno.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
int main(int argc, char *argv[]) {
char buf[65536];
memset(buf, '\n', sizeof(buf));
for (;;) {
ssize_t rc = writev(1, &(struct iovec){buf, sizeof(buf)}, 1);
if (rc != sizeof(buf)) {
printf("got %ld (%s)\n", rc, strerror(errno));
return 1;
}
}
}

View file

@ -131,7 +131,7 @@ clock_gettime_f *__clock_gettime_get(bool *opt_out_isfast) {
return res;
}
_Hide int __clock_gettime_init(int clockid, struct timespec *ts) {
int __clock_gettime_init(int clockid, struct timespec *ts) {
clock_gettime_f *gettime;
__clock_gettime = gettime = __clock_gettime_get(0);
return gettime(clockid, ts);

View file

@ -7,9 +7,9 @@ COSMOPOLITAN_C_START_
typedef int clock_gettime_f(int, struct timespec *);
extern clock_gettime_f *__clock_gettime;
clock_gettime_f *__clock_gettime_get(bool *) _Hide;
int __clock_gettime_init(int, struct timespec *) _Hide;
int sys_clock_gettime_mono(struct timespec *) _Hide;
clock_gettime_f *__clock_gettime_get(bool *);
int __clock_gettime_init(int, struct timespec *);
int sys_clock_gettime_mono(struct timespec *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -24,7 +24,7 @@
#include "libc/nt/runtime.h"
#include "libc/sysv/consts/o.h"
void sys_fcntl_nt_lock_cleanup(int) _Hide;
void sys_fcntl_nt_lock_cleanup(int);
textwindows int sys_close_nt(struct Fd *fd, int fildes) {
int e;

View file

@ -3,7 +3,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
bool IsAPEMagic(char[8]) _Hide;
bool IsAPEMagic(char[8]);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -102,7 +102,7 @@ static textwindows bool EqualsFileLock(struct FileLock *fl, int64_t off,
return fl->off == off && off + len == fl->off + fl->len;
}
_Hide textwindows void sys_fcntl_nt_lock_cleanup(int fd) {
textwindows void sys_fcntl_nt_lock_cleanup(int fd) {
struct FileLock *fl, *ft, **flp;
pthread_mutex_lock(&g_locks.mu);
for (flp = &g_locks.list, fl = *flp; fl;) {

View file

@ -1,27 +0,0 @@
/*-*- 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 2020 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"
// Calls GetTempPathA() w/ different API.
//
// @see GetSystemDirectoryA(), GetWindowsDirectoryA()
GetTempPathA_flunk:
xchg %rcx,%rdx
jmp *__imp_GetTempPathA(%rip)
.endfn GetTempPathA_flunk,globl,hidden

View file

@ -12,15 +12,15 @@ COSMOPOLITAN_C_START_
#define kIoMotion ((const int8_t[3]){1, 0, 0})
_Hide extern struct Fds g_fds;
_Hide extern const struct Fd kEmptyFd;
extern struct Fds g_fds;
extern const struct Fd kEmptyFd;
int __reservefd(int) _Hide;
int __reservefd_unlocked(int) _Hide;
void __releasefd(int) _Hide;
int __ensurefds(int) _Hide;
int __ensurefds_unlocked(int) _Hide;
void __printfds(void) _Hide;
int __reservefd(int);
int __reservefd_unlocked(int);
void __releasefd(int);
int __ensurefds(int);
int __ensurefds_unlocked(int);
void __printfds(void);
forceinline int64_t __getfdhandleactual(int fd) {
return g_fds.p[fd].handle;
@ -34,8 +34,8 @@ forceinline bool __isfdkind(int fd, int kind) {
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind == kind;
}
int sys_close_nt(struct Fd *, int) _Hide;
int _check_interrupts(bool, struct Fd *) _Hide;
int sys_close_nt(struct Fd *, int);
int _check_interrupts(bool, struct Fd *);
int sys_openat_metal(int, const char *, int, unsigned);
COSMOPOLITAN_C_END_

View file

@ -1,27 +0,0 @@
/*-*- 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 2021 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/iovec.h"
size_t __iovec_size(const struct iovec *v, size_t n) {
size_t i, sum;
for (sum = i = 0; i < n; ++i) {
sum += v[i].iov_len;
}
return sum;
}

View file

@ -19,4 +19,4 @@
#include "libc/calls/internal.h"
#include "libc/calls/struct/fd.internal.h"
_Hide const struct Fd kEmptyFd;
const struct Fd kEmptyFd;

View file

@ -18,7 +18,7 @@
*/
#include "libc/calls/ntmagicpaths.internal.h"
_Hide const struct NtMagicPaths kNtMagicPaths = {
const struct NtMagicPaths kNtMagicPaths = {
#define TAB(NAME, STRING) STRING,
#include "libc/calls/ntmagicpaths.inc"
#undef TAB

View file

@ -9,7 +9,7 @@ struct NtMagicPaths {
#undef TAB
};
_Hide extern const struct NtMagicPaths kNtMagicPaths;
extern const struct NtMagicPaths kNtMagicPaths;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -6,13 +6,13 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int mkntcmdline(char16_t[ARG_MAX / 2], char *const[]) _Hide;
int mkntcmdline(char16_t[ARG_MAX / 2], char *const[]);
int mkntenvblock(char16_t[ARG_MAX / 2], char *const[], const char *,
char[ARG_MAX]) _Hide;
char[ARG_MAX]);
int ntspawn(const char *, char *const[], char *const[], const char *,
struct NtSecurityAttributes *, struct NtSecurityAttributes *,
bool32, uint32_t, const char16_t *, const struct NtStartupInfo *,
struct NtProcessInformation *) _Hide;
struct NtProcessInformation *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -11,10 +11,10 @@ struct Pledges {
const size_t len;
};
_Hide extern const struct Pledges kPledge[PROMISE_LEN_];
extern const struct Pledges kPledge[PROMISE_LEN_];
int sys_pledge_linux(unsigned long, int) _Hide;
int ParsePromises(const char *, unsigned long *) _Hide;
int sys_pledge_linux(unsigned long, int);
int ParsePromises(const char *, unsigned long *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -18,11 +18,11 @@ int sys_sched_get_priority_max(int);
int sys_sched_get_priority_min(int);
int sys_sched_getparam(int, struct sched_param *);
int sys_sched_getscheduler(int);
int sys_sched_setaffinity(int, uint64_t, const void *) _Hide;
int sys_sched_setaffinity(int, uint64_t, const void *);
int sys_sched_setparam(int, const struct sched_param *);
int sys_sched_setscheduler(int, int, const struct sched_param *);
int sys_sched_yield(void) _Hide;
int64_t sys_sched_getaffinity(int, uint64_t, void *) _Hide;
int sys_sched_yield(void);
int64_t sys_sched_getaffinity(int, uint64_t, void *);
int sys_sched_getscheduler_netbsd(int, struct sched_param *);
int sys_sched_setparam_netbsd(int, int, int, const struct sched_param *) //

View file

@ -21,7 +21,7 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/strace.internal.h"
int sys_sched_rr_get_interval(int, struct timespec *) _Hide;
int sys_sched_rr_get_interval(int, struct timespec *);
/**
* Returns round-robin `SCHED_RR` quantum for `pid`.

View file

@ -28,14 +28,14 @@ struct Signals {
extern struct Signals __sig;
extern atomic_long __sig_count;
bool __sig_check(bool) _Hide;
bool __sig_handle(bool, int, int, ucontext_t *) _Hide;
int __sig_add(int, int, int) _Hide;
int __sig_mask(int, const sigset_t *, sigset_t *) _Hide;
int __sig_raise(int, int) _Hide;
void __sig_check_ignore(const int, const unsigned) _Hide;
void __sig_pending(sigset_t *) _Hide;
int __sig_is_applicable(struct Signal *) _Hide;
bool __sig_check(bool);
bool __sig_handle(bool, int, int, ucontext_t *);
int __sig_add(int, int, int);
int __sig_mask(int, const sigset_t *, sigset_t *);
int __sig_raise(int, int);
void __sig_check_ignore(const int, const unsigned);
void __sig_pending(sigset_t *);
int __sig_is_applicable(struct Signal *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -7,7 +7,7 @@
COSMOPOLITAN_C_START_
int sys_sigtimedwait(const sigset_t *, union siginfo_meta *,
const struct timespec *, size_t) _Hide;
const struct timespec *, size_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -6,13 +6,13 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
_Hide extern int __vforked;
_Hide extern bool __time_critical;
_Hide extern unsigned __sighandrvas[NSIG];
_Hide extern unsigned __sighandflags[NSIG];
_Hide extern pthread_mutex_t __fds_lock_obj;
_Hide extern pthread_mutex_t __sig_lock_obj;
_Hide extern const struct NtSecurityAttributes kNtIsInheritable;
extern int __vforked;
extern bool __time_critical;
extern unsigned __sighandrvas[NSIG];
extern unsigned __sighandflags[NSIG];
extern pthread_mutex_t __fds_lock_obj;
extern pthread_mutex_t __sig_lock_obj;
extern const struct NtSecurityAttributes kNtIsInheritable;
void __fds_lock(void);
void __fds_unlock(void);

View file

@ -6,24 +6,23 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int64_t sys_preadv(int, struct iovec *, int, int64_t, int64_t) _Hide;
int64_t sys_pwritev(int, const struct iovec *, int, int64_t, int64_t) _Hide;
int64_t sys_readv(int32_t, const struct iovec *, int32_t) _Hide;
int64_t sys_vmsplice(int, const struct iovec *, int64_t, uint32_t) _Hide;
int64_t sys_writev(int32_t, const struct iovec *, int32_t) _Hide;
size_t __iovec_size(const struct iovec *, size_t) _Hide;
ssize_t WritevUninterruptible(int, struct iovec *, int);
ssize_t sys_read_nt(struct Fd *, const struct iovec *, size_t, int64_t) _Hide;
ssize_t sys_readv_metal(struct Fd *, const struct iovec *, int) _Hide;
ssize_t sys_readv_nt(struct Fd *, const struct iovec *, int) _Hide;
ssize_t sys_readv_serial(struct Fd *, const struct iovec *, int) _Hide;
ssize_t sys_write_nt(int, const struct iovec *, size_t, ssize_t) _Hide;
ssize_t sys_writev_metal(struct Fd *, const struct iovec *, int) _Hide;
ssize_t sys_writev_nt(int, const struct iovec *, int) _Hide;
ssize_t sys_writev_serial(struct Fd *, const struct iovec *, int) _Hide;
ssize_t sys_send_nt(int, const struct iovec *, size_t, uint32_t) _Hide;
ssize_t __robust_writev(int, struct iovec *, int);
int64_t sys_preadv(int, struct iovec *, int, int64_t, int64_t);
int64_t sys_pwritev(int, const struct iovec *, int, int64_t, int64_t);
int64_t sys_readv(int32_t, const struct iovec *, int32_t);
int64_t sys_vmsplice(int, const struct iovec *, int64_t, uint32_t);
int64_t sys_writev(int32_t, const struct iovec *, int32_t);
ssize_t sys_read_nt(struct Fd *, const struct iovec *, size_t, int64_t);
ssize_t sys_readv_metal(struct Fd *, const struct iovec *, int);
ssize_t sys_readv_nt(struct Fd *, const struct iovec *, int);
ssize_t sys_readv_serial(struct Fd *, const struct iovec *, int);
ssize_t sys_write_nt(int, const struct iovec *, size_t, ssize_t);
ssize_t sys_writev_metal(struct Fd *, const struct iovec *, int);
ssize_t sys_writev_nt(int, const struct iovec *, int);
ssize_t sys_writev_serial(struct Fd *, const struct iovec *, int);
ssize_t sys_send_nt(int, const struct iovec *, size_t, uint32_t);
ssize_t sys_sendto_nt(int, const struct iovec *, size_t, uint32_t, void *,
uint32_t) _Hide;
uint32_t);
const char *DescribeIovec(char[300], ssize_t, const struct iovec *, int);
#define DescribeIovec(x, y, z) DescribeIovec(alloca(300), x, y, z)

View file

@ -5,9 +5,9 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_getitimer(int, struct itimerval *) _Hide;
int sys_setitimer(int, const struct itimerval *, struct itimerval *) _Hide;
int sys_setitimer_nt(int, const struct itimerval *, struct itimerval *) _Hide;
int sys_getitimer(int, struct itimerval *);
int sys_setitimer(int, const struct itimerval *, struct itimerval *);
int sys_setitimer_nt(int, const struct itimerval *, struct itimerval *);
const char *DescribeItimerval(char[90], int, const struct itimerval *);
#define DescribeItimerval(rc, ts) DescribeItimerval(alloca(90), rc, ts)

View file

@ -112,7 +112,7 @@ union metastat {
struct stat_netbsd netbsd;
};
void __stat2cosmo(struct stat *restrict, const union metastat *) _Hide;
void __stat2cosmo(struct stat *restrict, const union metastat *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -5,9 +5,9 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_getrlimit(int, struct rlimit *) _Hide;
int sys_setrlimit(int, const struct rlimit *) _Hide;
int sys_setrlimit_nt(int, const struct rlimit *) _Hide;
int sys_getrlimit(int, struct rlimit *);
int sys_setrlimit(int, const struct rlimit *);
int sys_setrlimit_nt(int, const struct rlimit *);
const char *DescribeRlimit(char[64], int, const struct rlimit *);
#define DescribeRlimit(rc, rl) DescribeRlimit(alloca(64), rc, rl)

View file

@ -4,12 +4,12 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int __sys_getrusage(int, struct rusage *) _Hide;
int __sys_wait4(int, int *, int, struct rusage *) _Hide;
int sys_getrusage(int, struct rusage *) _Hide;
int sys_wait4(int, int *, int, struct rusage *) _Hide;
void __rusage2linux(struct rusage *) _Hide;
int sys_getrusage_nt(int, struct rusage *) _Hide;
int __sys_getrusage(int, struct rusage *);
int __sys_wait4(int, int *, int, struct rusage *);
int sys_getrusage(int, struct rusage *);
int sys_wait4(int, int *, int, struct rusage *);
void __rusage2linux(struct rusage *);
int sys_getrusage_nt(int, struct rusage *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -54,11 +54,11 @@ union metasigaction {
struct sigaction_xnu_out xnu_out;
};
void __sigenter_xnu(int, struct siginfo *, void *) _Hide;
void __sigenter_wsl(int, struct siginfo *, void *) _Hide;
void __sigenter_netbsd(int, struct siginfo *, void *) _Hide;
void __sigenter_freebsd(int, struct siginfo *, void *) _Hide;
void __sigenter_openbsd(int, struct siginfo *, void *) _Hide;
void __sigenter_xnu(int, struct siginfo *, void *);
void __sigenter_wsl(int, struct siginfo *, void *);
void __sigenter_netbsd(int, struct siginfo *, void *);
void __sigenter_freebsd(int, struct siginfo *, void *);
void __sigenter_openbsd(int, struct siginfo *, void *);
const char *DescribeSigaction(char[256], int, const struct sigaction *);
#define DescribeSigaction(rc, sa) DescribeSigaction(alloca(256), rc, sa)

View file

@ -16,7 +16,7 @@ union siginfo_meta {
struct siginfo_netbsd netbsd;
};
void __siginfo2cosmo(struct siginfo *, const union siginfo_meta *) _Hide;
void __siginfo2cosmo(struct siginfo *, const union siginfo_meta *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -5,7 +5,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_sigqueueinfo(int, const siginfo_t *) _Hide;
int sys_sigqueueinfo(int, const siginfo_t *);
const char *DescribeSiginfo(char[300], int, const siginfo_t *);
#define DescribeSiginfo(x, y) DescribeSiginfo(alloca(300), x, y)

View file

@ -5,11 +5,10 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int __sys_sigprocmask(int, const struct sigset *, struct sigset *,
uint64_t) _Hide;
int sys_sigprocmask(int, const struct sigset *, struct sigset *) _Hide;
int sys_sigsuspend(const struct sigset *, uint64_t) _Hide;
int sys_sigpending(struct sigset *, size_t) _Hide;
int __sys_sigprocmask(int, const struct sigset *, struct sigset *, uint64_t);
int sys_sigprocmask(int, const struct sigset *, struct sigset *);
int sys_sigsuspend(const struct sigset *, uint64_t);
int sys_sigpending(struct sigset *, size_t);
const char *DescribeSigset(char[128], int, const sigset_t *);
#define DescribeSigset(rc, ss) DescribeSigset(alloca(128), rc, ss)

View file

@ -4,7 +4,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_sigqueue(int, int, const union sigval) _Hide;
int sys_sigqueue(int, int, const union sigval);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -5,11 +5,11 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_fstat(int, struct stat *) _Hide;
int sys_fstatat(int, const char *, struct stat *, int) _Hide;
int sys_fstat_nt(int64_t, struct stat *) _Hide;
int sys_fstatat_nt(int, const char *, struct stat *, int) _Hide;
int sys_lstat_nt(const char *, struct stat *) _Hide;
int sys_fstat(int, struct stat *);
int sys_fstatat(int, const char *, struct stat *, int);
int sys_fstat_nt(int64_t, struct stat *);
int sys_fstatat_nt(int, const char *, struct stat *, int);
int sys_lstat_nt(const char *, struct stat *);
int sys_fstat_metal(int, struct stat *);
const char *DescribeStat(char[300], int, const struct stat *);

View file

@ -17,7 +17,7 @@ union statfs_meta {
struct statfs_netbsd netbsd;
};
void statfs2cosmo(struct statfs *, const union statfs_meta *) _Hide;
void statfs2cosmo(struct statfs *, const union statfs_meta *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -4,8 +4,8 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_sysinfo(struct sysinfo *) _Hide;
int sys_sysinfo_nt(struct sysinfo *) _Hide;
int sys_sysinfo(struct sysinfo *);
int sys_sysinfo_nt(struct sysinfo *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -6,26 +6,26 @@
COSMOPOLITAN_C_START_
/* clang-format off */
int __sys_clock_nanosleep(int, int, const struct timespec *, struct timespec *) _Hide;
int __sys_utimensat(int, const char *, const struct timespec[2], int) _Hide;
int __utimens(int, const char *, const struct timespec[2], int) _Hide;
int sys_clock_getres(int, struct timespec *) _Hide;
int __sys_clock_nanosleep(int, int, const struct timespec *, struct timespec *);
int __sys_utimensat(int, const char *, const struct timespec[2], int);
int __utimens(int, const char *, const struct timespec[2], int);
int sys_clock_getres(int, struct timespec *);
int sys_clock_settime(int, const struct timespec *);
int sys_clock_gettime(int, struct timespec *) _Hide;
int sys_clock_gettime_nt(int, struct timespec *) _Hide;
int sys_clock_gettime_m1(int, struct timespec *) _Hide;
int sys_clock_gettime_xnu(int, struct timespec *) _Hide;
int sys_clock_nanosleep_nt(int, int, const struct timespec *, struct timespec *) _Hide;
int sys_clock_nanosleep_openbsd(int, int, const struct timespec *, struct timespec *) _Hide;
int sys_clock_nanosleep_xnu(int, int, const struct timespec *, struct timespec *) _Hide;
int sys_futimens(int, const struct timespec[2]) _Hide;
int sys_nanosleep(const struct timespec *, struct timespec *) _Hide;
int sys_nanosleep_nt(const struct timespec *, struct timespec *) _Hide;
int sys_nanosleep_xnu(const struct timespec *, struct timespec *) _Hide;
int sys_sem_timedwait(int64_t, const struct timespec *) _Hide;
int sys_utimensat(int, const char *, const struct timespec[2], int) _Hide;
int sys_utimensat_nt(int, const char *, const struct timespec[2], int) _Hide;
int sys_utimensat_xnu(int, const char *, const struct timespec[2], int) _Hide;
int sys_clock_gettime(int, struct timespec *);
int sys_clock_gettime_nt(int, struct timespec *);
int sys_clock_gettime_m1(int, struct timespec *);
int sys_clock_gettime_xnu(int, struct timespec *);
int sys_clock_nanosleep_nt(int, int, const struct timespec *, struct timespec *);
int sys_clock_nanosleep_openbsd(int, int, const struct timespec *, struct timespec *);
int sys_clock_nanosleep_xnu(int, int, const struct timespec *, struct timespec *);
int sys_futimens(int, const struct timespec[2]);
int sys_nanosleep(const struct timespec *, struct timespec *);
int sys_nanosleep_nt(const struct timespec *, struct timespec *);
int sys_nanosleep_xnu(const struct timespec *, struct timespec *);
int sys_sem_timedwait(int64_t, const struct timespec *);
int sys_utimensat(int, const char *, const struct timespec[2], int);
int sys_utimensat_nt(int, const char *, const struct timespec[2], int);
int sys_utimensat_xnu(int, const char *, const struct timespec[2], int);
const char *DescribeTimespec(char[45], int, const struct timespec *);
#define DescribeTimespec(rc, ts) DescribeTimespec(alloca(45), rc, ts)

View file

@ -6,15 +6,15 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
axdx_t sys_gettimeofday(struct timeval *, struct timezone *, void *) _Hide;
int sys_settimeofday(const struct timeval *, const struct timezone *) _Hide;
int sys_futimes(int, const struct timeval *) _Hide;
int sys_lutimes(const char *, const struct timeval *) _Hide;
int sys_utimes(const char *, const struct timeval *) _Hide;
axdx_t sys_gettimeofday_m1(struct timeval *, struct timezone *, void *) _Hide;
axdx_t sys_gettimeofday_xnu(struct timeval *, struct timezone *, void *) _Hide;
axdx_t sys_gettimeofday_nt(struct timeval *, struct timezone *, void *) _Hide;
int sys_utimes_nt(const char *, const struct timeval[2]) _Hide;
axdx_t sys_gettimeofday(struct timeval *, struct timezone *, void *);
int sys_settimeofday(const struct timeval *, const struct timezone *);
int sys_futimes(int, const struct timeval *);
int sys_lutimes(const char *, const struct timeval *);
int sys_utimes(const char *, const struct timeval *);
axdx_t sys_gettimeofday_m1(struct timeval *, struct timezone *, void *);
axdx_t sys_gettimeofday_xnu(struct timeval *, struct timezone *, void *);
axdx_t sys_gettimeofday_nt(struct timeval *, struct timezone *, void *);
int sys_utimes_nt(const char *, const struct timeval[2]);
axdx_t sys_gettimeofday_metal(struct timeval *, struct timezone *, void *);
const char *DescribeTimeval(char[45], int, const struct timeval *);

View file

@ -29,8 +29,8 @@ COSMOPOLITAN_C_START_
#error "unsupported architecture"
#endif
void _ntcontext2linux(struct ucontext *, const struct NtContext *) _Hide;
void _ntlinux2context(struct NtContext *, const ucontext_t *) _Hide;
void _ntcontext2linux(struct ucontext *, const struct NtContext *);
void _ntlinux2context(struct NtContext *, const ucontext_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -6,7 +6,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int tcgetwinsize_nt(struct Fd *, struct winsize *) _Hide;
int tcgetwinsize_nt(struct Fd *, struct winsize *);
const char *DescribeWinsize(char[64], int, struct winsize *);
#define DescribeWinsize(rc, ws) DescribeWinsize(alloca(12), rc, ws)

View file

@ -3,41 +3,40 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
bool32 sys_isatty_nt(int) _Hide;
char *sys_getcwd_nt(char *, size_t) _Hide;
int sys_chdir_nt(const char *) _Hide;
int sys_close_epoll_nt(int) _Hide;
int sys_dup_nt(int, int, int, int) _Hide;
int sys_execve_nt(const char *, char *const[], char *const[]) _Hide;
int sys_faccessat_nt(int, const char *, int, uint32_t) _Hide;
int sys_fadvise_nt(int, uint64_t, uint64_t, int) _Hide;
int sys_fchdir_nt(int) _Hide;
int sys_fchmodat_nt(int, const char *, uint32_t, int) _Hide;
int sys_fcntl_nt(int, int, uintptr_t) _Hide;
int sys_fdatasync_nt(int) _Hide;
int sys_flock_nt(int, int) _Hide;
int sys_fork_nt(uint32_t) _Hide;
int sys_ftruncate_nt(int64_t, uint64_t) _Hide;
int sys_getloadavg_nt(double *, int) _Hide;
int sys_getppid_nt(void) _Hide;
int sys_getpriority_nt(int, unsigned) _Hide;
int sys_kill_nt(int, int) _Hide;
int sys_linkat_nt(int, const char *, int, const char *) _Hide;
int sys_madvise_nt(void *, size_t, int) _Hide;
int sys_mkdirat_nt(int, const char *, uint32_t) _Hide;
int sys_msync_nt(char *, size_t, int) _Hide;
int sys_open_nt(int, const char *, uint32_t, int32_t)
dontdiscard _Hide;
int sys_pipe_nt(int[hasatleast 2], unsigned) _Hide;
int sys_renameat_nt(int, const char *, int, const char *) _Hide;
int sys_sched_yield_nt(void) _Hide;
int sys_setpriority_nt(int, unsigned, int) _Hide;
int sys_symlinkat_nt(const char *, int, const char *) _Hide;
int sys_sync_nt(void) _Hide;
int sys_truncate_nt(const char *, uint64_t) _Hide;
int sys_unlinkat_nt(int, const char *, int) _Hide;
int64_t sys_lseek_nt(int, int64_t, int) _Hide;
ssize_t sys_readlinkat_nt(int, const char *, char *, size_t) _Hide;
bool32 sys_isatty_nt(int);
char *sys_getcwd_nt(char *, size_t);
int sys_chdir_nt(const char *);
int sys_close_epoll_nt(int);
int sys_dup_nt(int, int, int, int);
int sys_execve_nt(const char *, char *const[], char *const[]);
int sys_faccessat_nt(int, const char *, int, uint32_t);
int sys_fadvise_nt(int, uint64_t, uint64_t, int);
int sys_fchdir_nt(int);
int sys_fchmodat_nt(int, const char *, uint32_t, int);
int sys_fcntl_nt(int, int, uintptr_t);
int sys_fdatasync_nt(int);
int sys_flock_nt(int, int);
int sys_fork_nt(uint32_t);
int sys_ftruncate_nt(int64_t, uint64_t);
int sys_getloadavg_nt(double *, int);
int sys_getppid_nt(void);
int sys_getpriority_nt(int, unsigned);
int sys_kill_nt(int, int);
int sys_linkat_nt(int, const char *, int, const char *);
int sys_madvise_nt(void *, size_t, int);
int sys_mkdirat_nt(int, const char *, uint32_t);
int sys_msync_nt(char *, size_t, int);
int sys_open_nt(int, const char *, uint32_t, int32_t) dontdiscard;
int sys_pipe_nt(int[hasatleast 2], unsigned);
int sys_renameat_nt(int, const char *, int, const char *);
int sys_sched_yield_nt(void);
int sys_setpriority_nt(int, unsigned, int);
int sys_symlinkat_nt(const char *, int, const char *);
int sys_sync_nt(void);
int sys_truncate_nt(const char *, uint64_t);
int sys_unlinkat_nt(int, const char *, int);
int64_t sys_lseek_nt(int, int64_t, int);
ssize_t sys_readlinkat_nt(int, const char *, char *, size_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -10,135 +10,135 @@ COSMOPOLITAN_C_START_
cosmopolitan § syscalls » system five » structless synthetic jump slots
*/
axdx_t __sys_fork(void) _Hide;
axdx_t __sys_pipe(i32[hasatleast 2], i32) _Hide;
axdx_t sys_getpid(void) _Hide;
char *sys_getcwd(char *, u64) _Hide;
char *sys_getcwd_xnu(char *, u64) _Hide;
i32 __sys_dup3(i32, i32, i32) _Hide;
i32 __sys_execve(const char *, char *const[], char *const[]) _Hide;
i32 __sys_fcntl(i32, i32, ...) _Hide;
i32 __sys_fcntl_cp(i32, i32, ...) _Hide;
i32 __sys_fstat(i32, void *) _Hide;
i32 __sys_fstatat(i32, const char *, void *, i32) _Hide;
i32 __sys_gettid(i64 *) _Hide;
i32 __sys_munmap(void *, u64) _Hide;
i32 __sys_openat(i32, const char *, i32, u32) _Hide;
i32 __sys_openat_nc(i32, const char *, i32, u32) _Hide;
i32 __sys_pipe2(i32[hasatleast 2], u32) _Hide;
i32 sys_arch_prctl(i32, i64) _Hide;
i32 sys_chdir(const char *) _Hide;
i32 sys_chroot(const char *) _Hide;
i32 sys_close(i32) _Hide;
i32 sys_close_range(u32, u32, u32) _Hide;
i32 sys_closefrom(i32) _Hide;
i32 sys_dup(i32) _Hide;
i32 sys_dup2(i32, i32, i32) _Hide;
i32 sys_dup3(i32, i32, i32) _Hide;
i32 sys_execve(const char *, char *const[], char *const[]) _Hide;
i32 sys_execveat(i32, const char *, char *const[], char *const[], i32) _Hide;
i32 sys_faccessat(i32, const char *, i32, u32) _Hide;
i32 sys_faccessat2(i32, const char *, i32, u32) _Hide;
i32 sys_fadvise(i32, i64, i64, i32) _Hide;
i32 sys_fchdir(i32) _Hide;
i32 sys_fchmod(i32, u32) _Hide;
i32 sys_fchmodat(i32, const char *, u32, u32) _Hide;
i32 sys_fchown(i64, u32, u32) _Hide;
i32 sys_fchownat(i32, const char *, u32, u32, u32) _Hide;
i32 sys_fcntl(i32, i32, u64, i32 (*)(i32, i32, ...)) _Hide;
i32 sys_fdatasync(i32) _Hide;
i32 sys_fexecve(i32, char *const[], char *const[]) _Hide;
i32 sys_flock(i32, i32) _Hide;
i32 sys_fork(void) _Hide;
i32 sys_fsync(i32) _Hide;
i32 sys_ftruncate(i32, i64, i64) _Hide;
i32 sys_getcontext(void *) _Hide;
i32 sys_getpgid(i32) _Hide;
i32 sys_getppid(void) _Hide;
i32 sys_getpriority(i32, u32) _Hide;
i32 sys_getresgid(u32 *, u32 *, u32 *) _Hide;
i32 sys_getresuid(u32 *, u32 *, u32 *) _Hide;
i32 sys_getsid(i32) _Hide;
i32 sys_gettid(void) _Hide;
i32 sys_ioctl(i32, u64, ...) _Hide;
i32 sys_ioctl_cp(i32, u64, ...) _Hide;
i32 sys_issetugid(void) _Hide;
i32 sys_kill(i32, i32, i32) _Hide;
i32 sys_linkat(i32, const char *, i32, const char *, i32) _Hide;
i32 sys_madvise(void *, size_t, i32) _Hide;
i32 sys_memfd_create(const char *, u32) _Hide;
i32 sys_mincore(void *, u64, unsigned char *) _Hide;
i32 sys_mkdirat(i32, const char *, u32) _Hide;
i32 sys_mkfifo(const char *, u32) _Hide;
i32 sys_mknod(const char *, u32, u64) _Hide;
i32 sys_mknodat(i32, const char *, u32, u64) _Hide;
i32 sys_mprotect(void *, u64, i32) _Hide;
i32 sys_msync(void *, u64, i32) _Hide;
i32 sys_munmap(void *, u64) _Hide;
i32 sys_openat(i32, const char *, i32, u32) _Hide;
i32 sys_pause(void) _Hide;
i32 sys_pipe(i32[hasatleast 2]) _Hide;
i32 sys_pipe2(i32[hasatleast 2], u32) _Hide;
i32 sys_pivot_root(const char *, const char *) _Hide;
i32 sys_pledge(const char *, const char *) _Hide;
i32 sys_posix_openpt(i32) _Hide;
i32 sys_renameat(i32, const char *, i32, const char *) _Hide;
i32 sys_sem_close(i64) _Hide;
i32 sys_sem_destroy(i64) _Hide;
i32 sys_sem_getvalue(i64, u32 *) _Hide;
i32 sys_sem_init(u32, i64 *) _Hide;
i32 sys_sem_open(const char *, int, u32, i64 *) _Hide;
i32 sys_sem_post(i64) _Hide;
i32 sys_sem_trywait(i64) _Hide;
i32 sys_sem_unlink(const char *) _Hide;
i32 sys_sem_wait(i64) _Hide;
i32 sys_setfsgid(i32) _Hide;
i32 sys_setfsuid(i32) _Hide;
i32 sys_setgid(i32) _Hide;
i32 sys_setpgid(i32, i32) _Hide;
i32 sys_setpriority(i32, u32, i32) _Hide;
i32 sys_setregid(u32, u32) _Hide;
i32 sys_setresgid(u32, u32, u32) _Hide;
i32 sys_setresuid(u32, u32, u32) _Hide;
i32 sys_setreuid(u32, u32) _Hide;
i32 sys_setsid(void) _Hide;
i32 sys_setuid(i32) _Hide;
i32 sys_shm_open(const char *, i32, u32) _Hide;
i32 sys_sigaction(i32, const void *, void *, i64, i64) _Hide;
i32 sys_sigaltstack(const void *, void *) _Hide;
i32 sys_symlinkat(const char *, i32, const char *) _Hide;
i32 sys_sync(void) _Hide;
i32 sys_sync_file_range(i32, i64, i64, u32) _Hide;
i32 sys_syslog(i32, char *, i32) _Hide;
i32 sys_tgkill(i32, i32, i32) _Hide;
i32 sys_tkill(i32, i32, void *) _Hide;
i32 sys_truncate(const char *, u64, u64) _Hide;
i32 sys_uname(void *) _Hide;
i32 sys_unlink(const char *) _Hide;
i32 sys_unlinkat(i32, const char *, i32) _Hide;
i32 sys_unmount(const char *, i32) _Hide;
i32 sys_unveil(const char *, const char *) _Hide;
i64 __sys_ptrace(i32, i32, i64, long *) _Hide;
i64 sys_copy_file_range(i32, long *, i32, long *, u64, u32) _Hide;
i64 sys_getrandom(void *, u64, u32) _Hide;
i64 sys_lseek(i32, i64, i64, i64) _Hide;
i64 sys_pread(i32, void *, u64, i64, i64) _Hide;
i64 sys_pwrite(i32, const void *, u64, i64, i64) _Hide;
i64 sys_read(i32, void *, u64) _Hide;
i64 sys_readlinkat(i32, const char *, char *, u64) _Hide;
i64 sys_sendfile(i32, i32, i64 *, u64) _Hide;
i64 sys_splice(i32, i64 *, i32, i64 *, u64, u32) _Hide;
i64 sys_write(i32, const void *, u64) _Hide;
u32 sys_getegid(void) _Hide;
u32 sys_geteuid(void) _Hide;
u32 sys_getgid(void) _Hide;
u32 sys_getuid(void) _Hide;
u32 sys_umask(u32) _Hide;
unsigned long _sysret(unsigned long) _Hide;
void *__sys_mmap(void *, u64, u32, u32, i64, i64, i64) _Hide;
void *__sys_mremap(void *, u64, u64, i32, void *) _Hide;
void *sys_mremap(void *, u64, u64, i32, void *) _Hide;
void sys_exit(i32) _Hide;
axdx_t __sys_fork(void);
axdx_t __sys_pipe(i32[hasatleast 2], i32);
axdx_t sys_getpid(void);
char *sys_getcwd(char *, u64);
char *sys_getcwd_xnu(char *, u64);
i32 __sys_dup3(i32, i32, i32);
i32 __sys_execve(const char *, char *const[], char *const[]);
i32 __sys_fcntl(i32, i32, ...);
i32 __sys_fcntl_cp(i32, i32, ...);
i32 __sys_fstat(i32, void *);
i32 __sys_fstatat(i32, const char *, void *, i32);
i32 __sys_gettid(i64 *);
i32 __sys_munmap(void *, u64);
i32 __sys_openat(i32, const char *, i32, u32);
i32 __sys_openat_nc(i32, const char *, i32, u32);
i32 __sys_pipe2(i32[hasatleast 2], u32);
i32 sys_arch_prctl(i32, i64);
i32 sys_chdir(const char *);
i32 sys_chroot(const char *);
i32 sys_close(i32);
i32 sys_close_range(u32, u32, u32);
i32 sys_closefrom(i32);
i32 sys_dup(i32);
i32 sys_dup2(i32, i32, i32);
i32 sys_dup3(i32, i32, i32);
i32 sys_execve(const char *, char *const[], char *const[]);
i32 sys_execveat(i32, const char *, char *const[], char *const[], i32);
i32 sys_faccessat(i32, const char *, i32, u32);
i32 sys_faccessat2(i32, const char *, i32, u32);
i32 sys_fadvise(i32, i64, i64, i32);
i32 sys_fchdir(i32);
i32 sys_fchmod(i32, u32);
i32 sys_fchmodat(i32, const char *, u32, u32);
i32 sys_fchown(i64, u32, u32);
i32 sys_fchownat(i32, const char *, u32, u32, u32);
i32 sys_fcntl(i32, i32, u64, i32 (*)(i32, i32, ...));
i32 sys_fdatasync(i32);
i32 sys_fexecve(i32, char *const[], char *const[]);
i32 sys_flock(i32, i32);
i32 sys_fork(void);
i32 sys_fsync(i32);
i32 sys_ftruncate(i32, i64, i64);
i32 sys_getcontext(void *);
i32 sys_getpgid(i32);
i32 sys_getppid(void);
i32 sys_getpriority(i32, u32);
i32 sys_getresgid(u32 *, u32 *, u32 *);
i32 sys_getresuid(u32 *, u32 *, u32 *);
i32 sys_getsid(i32);
i32 sys_gettid(void);
i32 sys_ioctl(i32, u64, ...);
i32 sys_ioctl_cp(i32, u64, ...);
i32 sys_issetugid(void);
i32 sys_kill(i32, i32, i32);
i32 sys_linkat(i32, const char *, i32, const char *, i32);
i32 sys_madvise(void *, size_t, i32);
i32 sys_memfd_create(const char *, u32);
i32 sys_mincore(void *, u64, unsigned char *);
i32 sys_mkdirat(i32, const char *, u32);
i32 sys_mkfifo(const char *, u32);
i32 sys_mknod(const char *, u32, u64);
i32 sys_mknodat(i32, const char *, u32, u64);
i32 sys_mprotect(void *, u64, i32);
i32 sys_msync(void *, u64, i32);
i32 sys_munmap(void *, u64);
i32 sys_openat(i32, const char *, i32, u32);
i32 sys_pause(void);
i32 sys_pipe(i32[hasatleast 2]);
i32 sys_pipe2(i32[hasatleast 2], u32);
i32 sys_pivot_root(const char *, const char *);
i32 sys_pledge(const char *, const char *);
i32 sys_posix_openpt(i32);
i32 sys_renameat(i32, const char *, i32, const char *);
i32 sys_sem_close(i64);
i32 sys_sem_destroy(i64);
i32 sys_sem_getvalue(i64, u32 *);
i32 sys_sem_init(u32, i64 *);
i32 sys_sem_open(const char *, int, u32, i64 *);
i32 sys_sem_post(i64);
i32 sys_sem_trywait(i64);
i32 sys_sem_unlink(const char *);
i32 sys_sem_wait(i64);
i32 sys_setfsgid(i32);
i32 sys_setfsuid(i32);
i32 sys_setgid(i32);
i32 sys_setpgid(i32, i32);
i32 sys_setpriority(i32, u32, i32);
i32 sys_setregid(u32, u32);
i32 sys_setresgid(u32, u32, u32);
i32 sys_setresuid(u32, u32, u32);
i32 sys_setreuid(u32, u32);
i32 sys_setsid(void);
i32 sys_setuid(i32);
i32 sys_shm_open(const char *, i32, u32);
i32 sys_sigaction(i32, const void *, void *, i64, i64);
i32 sys_sigaltstack(const void *, void *);
i32 sys_symlinkat(const char *, i32, const char *);
i32 sys_sync(void);
i32 sys_sync_file_range(i32, i64, i64, u32);
i32 sys_syslog(i32, char *, i32);
i32 sys_tgkill(i32, i32, i32);
i32 sys_tkill(i32, i32, void *);
i32 sys_truncate(const char *, u64, u64);
i32 sys_uname(void *);
i32 sys_unlink(const char *);
i32 sys_unlinkat(i32, const char *, i32);
i32 sys_unmount(const char *, i32);
i32 sys_unveil(const char *, const char *);
i64 __sys_ptrace(i32, i32, i64, long *);
i64 sys_copy_file_range(i32, long *, i32, long *, u64, u32);
i64 sys_getrandom(void *, u64, u32);
i64 sys_lseek(i32, i64, i64, i64);
i64 sys_pread(i32, void *, u64, i64, i64);
i64 sys_pwrite(i32, const void *, u64, i64, i64);
i64 sys_read(i32, void *, u64);
i64 sys_readlinkat(i32, const char *, char *, u64);
i64 sys_sendfile(i32, i32, i64 *, u64);
i64 sys_splice(i32, i64 *, i32, i64 *, u64, u32);
i64 sys_write(i32, const void *, u64);
u32 sys_getegid(void);
u32 sys_geteuid(void);
u32 sys_getgid(void);
u32 sys_getuid(void);
u32 sys_umask(u32);
unsigned long _sysret(unsigned long);
void *__sys_mmap(void *, u64, u32, u32, i64, i64, i64);
void *__sys_mremap(void *, u64, u64, i32, void *);
void *sys_mremap(void *, u64, u64, i32, void *);
void sys_exit(i32);
#undef i32
#undef i64

View file

@ -3,25 +3,25 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
bool isdirectory_nt(const char *) _Hide;
bool isregularfile_nt(const char *) _Hide;
bool issymlink_nt(const char *) _Hide;
bool32 ntsetprivilege(int64_t, const char16_t *, uint32_t) _Hide;
char16_t *CreatePipeName(char16_t *) _Hide;
int __mkntpath(const char *, char16_t[hasatleast PATH_MAX]) _Hide;
int __mkntpath2(const char *, char16_t[hasatleast PATH_MAX], int) _Hide;
int __mkntpathat(int, const char *, int, char16_t[hasatleast PATH_MAX]) _Hide;
int __sample_pids(int[hasatleast 64], int64_t[hasatleast 64], bool) _Hide;
int ntaccesscheck(const char16_t *, uint32_t) paramsnonnull() _Hide;
int sys_pause_nt(void) _Hide;
int64_t __fix_enotdir(int64_t, char16_t *) _Hide;
int64_t __fix_enotdir3(int64_t, char16_t *, char16_t *) _Hide;
bool isdirectory_nt(const char *);
bool isregularfile_nt(const char *);
bool issymlink_nt(const char *);
bool32 ntsetprivilege(int64_t, const char16_t *, uint32_t);
char16_t *CreatePipeName(char16_t *);
int __mkntpath(const char *, char16_t[hasatleast PATH_MAX]);
int __mkntpath2(const char *, char16_t[hasatleast PATH_MAX], int);
int __mkntpathat(int, const char *, int, char16_t[hasatleast PATH_MAX]);
int __sample_pids(int[hasatleast 64], int64_t[hasatleast 64], bool);
int ntaccesscheck(const char16_t *, uint32_t) paramsnonnull();
int sys_pause_nt(void);
int64_t __fix_enotdir(int64_t, char16_t *);
int64_t __fix_enotdir3(int64_t, char16_t *, char16_t *);
int64_t __winerr(void) nocallback privileged;
int64_t ntreturn(uint32_t);
void *GetProcAddressModule(const char *, const char *) _Hide;
void WinMainForked(void) _Hide;
void _check_sigalrm(void) _Hide;
void _check_sigchld(void) _Hide;
void *GetProcAddressModule(const char *, const char *);
void WinMainForked(void);
void _check_sigalrm(void);
void _check_sigchld(void);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -6,27 +6,27 @@ COSMOPOLITAN_C_START_
cosmopolitan § syscalls » system five » structless support
*/
bool __is_linux_2_6_23(void) _Hide;
bool __is_linux_2_6_23(void);
bool32 sys_isatty_metal(int);
int __fixupnewfd(int, int) _Hide;
int __fixupnewfd(int, int);
int __notziposat(int, const char *);
int __tkill(int, int, void *) _Hide;
int _fork(uint32_t) _Hide;
int _isptmaster(int) _Hide;
int _ptsname(int, char *, size_t) _Hide;
int getdomainname_linux(char *, size_t) _Hide;
int gethostname_bsd(char *, size_t, int) _Hide;
int gethostname_linux(char *, size_t) _Hide;
int gethostname_nt(char *, size_t, int) _Hide;
int __tkill(int, int, void *);
int _fork(uint32_t);
int _isptmaster(int);
int _ptsname(int, char *, size_t);
int getdomainname_linux(char *, size_t);
int gethostname_bsd(char *, size_t, int);
int gethostname_linux(char *, size_t);
int gethostname_nt(char *, size_t, int);
int sys_msyscall(void *, size_t);
long sys_bogus(void);
ssize_t __getrandom(void *, size_t, unsigned) _Hide;
void *__vdsosym(const char *, const char *) _Hide;
void __onfork(void) _Hide;
void __restore_rt() _Hide;
void __restore_rt_netbsd(void) _Hide;
void cosmo2flock(uintptr_t) _Hide;
void flock2cosmo(uintptr_t) _Hide;
ssize_t __getrandom(void *, size_t, unsigned);
void *__vdsosym(const char *, const char *);
void __onfork(void);
void __restore_rt();
void __restore_rt_netbsd(void);
void cosmo2flock(uintptr_t);
void flock2cosmo(uintptr_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -4,7 +4,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_wait4_nt(int, int *, int, struct rusage *) _Hide;
int sys_wait4_nt(int, int *, int, struct rusage *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -19,9 +19,8 @@
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/iovec.internal.h"
#include "libc/errno.h"
#include "libc/sock/sock.h"
ssize_t WritevUninterruptible(int fd, struct iovec *iov, int iovlen) {
ssize_t __robust_writev(int fd, struct iovec *iov, int iovlen) {
ssize_t rc;
size_t wrote;
do {

View file

@ -29,7 +29,7 @@ char *gcvt(double, int, char *);
#ifdef COSMO
int __vcscanf(int (*)(void *), int (*)(int, void *), void *, const char *,
va_list);
int __fmt(void *, void *, const char *, va_list) _Hide;
int __fmt(void *, void *, const char *, va_list);
#endif
COSMOPOLITAN_C_END_

View file

@ -16,17 +16,17 @@ struct MagnumStr {
int x, s;
};
_Hide extern const struct MagnumStr kClockNames[];
_Hide extern const struct MagnumStr kErrnoDocs[];
_Hide extern const struct MagnumStr kErrnoNames[];
_Hide extern const struct MagnumStr kFcntlCmds[];
_Hide extern const struct MagnumStr kIpOptnames[];
_Hide extern const struct MagnumStr kOpenFlags[];
_Hide extern const struct MagnumStr kRlimitNames[];
_Hide extern const struct MagnumStr kSignalNames[];
_Hide extern const struct MagnumStr kSockOptnames[];
_Hide extern const struct MagnumStr kTcpOptnames[];
_Hide extern const struct MagnumStr kPollNames[];
extern const struct MagnumStr kClockNames[];
extern const struct MagnumStr kErrnoDocs[];
extern const struct MagnumStr kErrnoNames[];
extern const struct MagnumStr kFcntlCmds[];
extern const struct MagnumStr kIpOptnames[];
extern const struct MagnumStr kOpenFlags[];
extern const struct MagnumStr kRlimitNames[];
extern const struct MagnumStr kSignalNames[];
extern const struct MagnumStr kSockOptnames[];
extern const struct MagnumStr kTcpOptnames[];
extern const struct MagnumStr kPollNames[];
char *DescribeMagnum(char *, const struct MagnumStr *, const char *, int);

View file

@ -193,15 +193,6 @@ typedef struct {
#define strftimeesque(n)
#endif
#ifndef _Hide
#if !defined(__STRICT_ANSI__) && \
(__has_attribute(__visibility__) || defined(__GNUC__)) && !defined(_WIN32)
#define _Hide __attribute__((__visibility__("hidden")))
#else
#define _Hide
#endif
#endif
#ifndef privileged
#if !defined(__STRICT_ANSI__) && \
(__has_attribute(__visibility__) || defined(__GNUC__))

View file

@ -8,7 +8,7 @@ struct Env {
int i;
};
struct Env _getenv(char **, const char *) _Hide;
struct Env _getenv(char **, const char *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -18,7 +18,7 @@
*/
#include "libc/nt/struct/securityattributes.h"
_Hide const struct NtSecurityAttributes kNtIsInheritable = {
const struct NtSecurityAttributes kNtIsInheritable = {
sizeof(struct NtSecurityAttributes),
NULL,
true,

View file

@ -106,8 +106,8 @@
break; \
}
_Hide long __klog_handle;
extern _Hide struct SymbolTable *__symtab;
long __klog_handle;
extern struct SymbolTable *__symtab;
privileged static inline char *kadvance(char *p, char *e, long n) {
intptr_t t = (intptr_t)p;

View file

@ -12,10 +12,9 @@
*
* Users of the `cosmocc` toolchain can say, for example:
*
#include "tool/args/args.h"
* #include <cosmo.h>
*
* int main(int argc, char *argv[]) {
* main() {
* ShowCrashReports();
* kprintf("hello world\n");
* }
@ -46,7 +45,6 @@
#include "libc/nexgen32e/rdtsc.h"
#include "libc/nexgen32e/stackframe.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/morph.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/stack.h"
#include "libc/runtime/symbols.internal.h"

View file

@ -18,4 +18,4 @@
*/
#include "libc/log/gdb.h"
volatile int g_gdbsync _Hide;
volatile int g_gdbsync;

View file

@ -4,11 +4,11 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern _Hide bool __nocolor;
extern _Hide bool _wantcrashreports;
extern _Hide bool g_isrunningundermake;
extern bool __nocolor;
extern bool _wantcrashreports;
extern bool g_isrunningundermake;
void __start_fatal(const char *, int) _Hide;
void __start_fatal(const char *, int);
void __restore_tty(void);
void RestoreDefaultCrashSignalHandlers(void);
void __oncrash_amd64(int, struct siginfo *, void *) relegated;

View file

@ -24,7 +24,7 @@
#include "libc/sysv/consts/o.h"
static int __klog_fd;
extern _Hide long __klog_handle;
extern long __klog_handle;
/**
* Redirects kprintf(), `--strace`, etc. output to file.

View file

@ -9,7 +9,7 @@ struct CritbitNode {
unsigned otherbits;
};
int PutEnvImpl(char *, bool) _Hide;
int PutEnvImpl(char *, bool);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -13,12 +13,12 @@ struct RlDecode {
uint8_t byte;
};
void rldecode(void *dest, const struct RlDecode *) _Hide;
void rldecode2(void *dest, const struct RlDecode *) _Hide;
const uint8_t *lz4check(const void *data) _Hide;
void *lz4cpy(void *dest, const void *blockdata, size_t blocksize) _Hide;
size_t lz4len(const void *blockdata, size_t blocksize) _Hide;
void *lz4decode(void *dest, const void *src) _Hide;
void rldecode(void *dest, const struct RlDecode *);
void rldecode2(void *dest, const struct RlDecode *);
const uint8_t *lz4check(const void *data);
void *lz4cpy(void *dest, const void *blockdata, size_t blocksize);
size_t lz4len(const void *blockdata, size_t blocksize);
void *lz4decode(void *dest, const void *src);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -23,7 +23,7 @@
#ifdef __x86_64__
// kudos rich felker for the brilliant design
_Hide int __sigsetjmp_tail(sigjmp_buf jb, int rc) {
int __sigsetjmp_tail(sigjmp_buf jb, int rc) {
_Static_assert(
sizeof(sigjmp_buf) == sizeof(jmp_buf) + 8 + 8 + sizeof(sigset_t),
"please recompute sigjmp_buf w.r.t. sigset_t");

View file

@ -17,12 +17,8 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "ape/sections.internal.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/runtime/morph.h"
#include "libc/runtime/runtime.h"
#include "libc/thread/tls.h"
@ -30,8 +26,7 @@ extern int __threadcalls_end[] __attribute__((__weak__));
extern int __threadcalls_start[] __attribute__((__weak__));
static privileged dontinline void FixupLockNops(void) {
sigset_t mask;
__morph_begin(&mask);
__morph_begin();
/*
* _NOPL("__threadcalls", func)
*
@ -55,7 +50,7 @@ static privileged dontinline void FixupLockNops(void) {
__executable_start[*p + 1] = 0x67;
__executable_start[*p + 2] = 0xe8;
}
__morph_end(&mask);
__morph_end();
}
void __enable_threads(void) {

View file

@ -19,7 +19,7 @@
#include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h"
extern _Hide struct SymbolTable *__symtab;
extern struct SymbolTable *__symtab;
/**
* Returns low index into symbol table for address.

View file

@ -35,7 +35,7 @@
STATIC_YOINK("__get_symbol");
static pthread_spinlock_t g_lock;
_Hide struct SymbolTable *__symtab; // for kprintf
struct SymbolTable *__symtab; // for kprintf
/**
* Looks for `.symtab` in zip central directory.

View file

@ -20,7 +20,7 @@
#include "libc/calls/struct/sigset.h"
#include "libc/limits.h"
#include "libc/macros.internal.h"
#include "libc/runtime/morph.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h"
#ifdef __x86_64__
@ -109,11 +109,10 @@ static privileged void HookFunction(code_t *func, void *dest) {
privileged dontinstrument noasan int __hook(void *dest,
struct SymbolTable *st) {
long i;
sigset_t mask;
code_t *p, *pe;
intptr_t lowest;
if (!st) return -1;
__morph_begin(&mask);
__morph_begin();
lowest = MAX((intptr_t)__executable_start, (intptr_t)_ereal);
for (i = 0; i < st->count; ++i) {
if (st->symbols[i].x < 9) continue;
@ -129,6 +128,6 @@ privileged dontinstrument noasan int __hook(void *dest,
// kprintf("can't hook %t at %lx\n", p, p);
}
}
__morph_end(&mask);
__morph_end();
return 0;
}

View file

@ -31,25 +31,25 @@ extern unsigned char _tbss_offset[] __attribute__((__weak__));
extern unsigned char _tls_size[] __attribute__((__weak__));
extern unsigned char _tls_content[] __attribute__((__weak__));
void _init(void) _Hide;
int ftrace_init(void) _Hide;
void ftrace_hook(void) _Hide;
void __morph_tls(void) _Hide;
void __enable_tls(void) _Hide;
void __enable_threads(void) _Hide;
void *__cxa_finalize(void *) _Hide;
void _init(void);
int ftrace_init(void);
void ftrace_hook(void);
void __morph_tls(void);
void __enable_tls(void);
void __enable_threads(void);
void *__cxa_finalize(void *);
void __stack_chk_fail(void) wontreturn relegated;
void __stack_chk_fail_local(void) wontreturn relegated _Hide;
void __asan_init(int, char **, char **, intptr_t *) _Hide;
void _jmpstack(void *, void *, ...) _Hide wontreturn;
long _setstack(void *, void *, ...) _Hide;
void __stack_chk_fail_local(void) wontreturn relegated;
void __asan_init(int, char **, char **, intptr_t *);
void _jmpstack(void *, void *, ...) wontreturn;
long _setstack(void *, void *, ...);
int GetDosArgv(const char16_t *, char *, size_t, char **, size_t);
int GetDosEnviron(const char16_t *, char *, size_t, char **, size_t);
bool __intercept_flag(int *, char *[], const char *);
int sys_mprotect_nt(void *, size_t, int) _Hide;
int sys_mprotect_nt(void *, size_t, int);
int __inflate(void *, size_t, const void *, size_t);
noasan void *_Mmap(void *, size_t, int, int, int, int64_t) _Hide;
noasan int _Munmap(char *, size_t) _Hide;
noasan void *_Mmap(void *, size_t, int, int, int, int64_t);
noasan int _Munmap(char *, size_t);
void __on_arithmetic_overflow(void);
void __init_fds(void);

View file

@ -1,81 +0,0 @@
/*-*- 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/blockcancel.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/elf/def.h"
#include "libc/elf/elf.h"
#include "libc/elf/struct/ehdr.h"
#include "libc/elf/struct/phdr.h"
#include "libc/errno.h"
#include "libc/intrin/bits.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
/**
* Returns true if ELF executable uses dynamic loading magic.
*/
bool _IsDynamicExecutable(const char *prog) {
bool res;
Elf64_Ehdr *e;
Elf64_Phdr *p;
struct stat st;
int i, fd, err;
BLOCK_CANCELLATIONS;
fd = -1;
err = errno;
e = MAP_FAILED;
if ((fd = open(prog, O_RDONLY)) == -1) {
res = false;
goto Finish;
}
if (fstat(fd, &st) == -1 || st.st_size < 64) {
res = false;
goto Finish;
}
if ((e = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
res = false;
goto Finish;
}
if (READ32LE(e->e_ident) != READ32LE(ELFMAG)) {
res = false;
goto Finish;
}
if (e->e_type == ET_DYN) {
res = true;
goto Finish;
}
for (i = 0; i < e->e_phnum; ++i) {
p = GetElfProgramHeaderAddress(e, st.st_size, i);
if (p->p_type == PT_INTERP || p->p_type == PT_DYNAMIC) {
res = true;
goto Finish;
}
}
res = false;
goto Finish;
Finish:
if (e != MAP_FAILED) munmap(e, st.st_size);
if (fd != -1) close(fd);
errno = err;
ALLOW_CANCELLATIONS;
return res;
}

View file

@ -36,7 +36,7 @@
* This only supports %d and %s. It'll will work even if .rodata hasn't
* been loaded into memory yet.
*/
_Hide textreal void(MetalPrintf)(const char *fmt, ...) {
textreal void(MetalPrintf)(const char *fmt, ...) {
int i;
char c;
unsigned u;

View file

@ -18,22 +18,16 @@
*/
#define ShouldUseMsabiAttribute() 1
#include "ape/sections.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/sigset.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/asmflag.h"
#include "libc/intrin/kprintf.h"
#include "libc/nt/enum/pageflags.h"
#include "libc/nt/memory.h"
#include "libc/nt/runtime.h"
#include "libc/nt/thunk/msabi.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/nr.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/consts/sig.h"
__msabi extern typeof(VirtualProtect) *const __imp_VirtualProtect;
@ -77,24 +71,37 @@ __funline void __morph_mprotect(void *addr, size_t size, int prot, int ntprot) {
/**
* Begins code morphing executable.
*
* @return 0 on success, or -1 w/ errno
* The following example
*
* #include <cosmo.h>
* #include <stdlib.h>
*
* privileged int main() { // privileged code is unmodifiable
* ShowCrashReports(); // print report if trapped
* __morph_begin(0); // make executable code R+W
* *(char *)exit = 0xCC; // turn exit() into an INT3 trap
* __morph_end(); // make executable code R+X
* exit(0); // won't actually exit
* }
*
* shows how the exit() function can be recompiled at runtime to become
* an int3 (x86-64) debugger trap. What makes it tricky is Cosmopolitan
* maintains a R^X invariant, in order to support OpenBSD. So when code
* wants to modify some part of the executable image in memory the vast
* majority of the code stops being executable during that time, unless
* it's been linked into a special privileged section of the binary. It
* is only possible to code morph from privileged functions. Privileged
* functions are also only allowed to call other privileged functions.
*/
privileged void __morph_begin(sigset_t *save) {
int ax;
bool cf;
intptr_t dx;
sigset_t ss = {{-1, -1}};
privileged void __morph_begin(void) {
__morph_mprotect(__executable_start, __privileged_start - __executable_start,
PROT_READ | PROT_WRITE, kNtPageWritecopy);
}
/**
* Begins code morphing executable.
* Finishes code morphing executable.
*/
privileged void __morph_end(sigset_t *save) {
int ax;
long dx;
bool cf;
privileged void __morph_end(void) {
__morph_mprotect(__executable_start, __privileged_start - __executable_start,
PROT_READ | PROT_EXEC, kNtPageExecuteRead);
}

View file

@ -1,12 +0,0 @@
#ifndef COSMOPOLITAN_LIBC_RUNTIME_MORPH_H_
#define COSMOPOLITAN_LIBC_RUNTIME_MORPH_H_
#include "libc/calls/struct/sigset.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void __morph_begin(sigset_t *);
void __morph_end(sigset_t *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_MORPH_H_ */

View file

@ -17,11 +17,9 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "ape/sections.internal.h"
#include "libc/dce.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/kprintf.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/morph.h"
#include "libc/runtime/runtime.h"
#include "libc/thread/tls.h"
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
@ -47,10 +45,9 @@ privileged void __morph_tls(void) {
// have actually been linked into this program.
int n;
uint64_t w;
sigset_t mask;
unsigned m, dis;
unsigned char *p;
__morph_begin(&mask);
__morph_begin();
if (IsXnu()) {
// Apple is quite straightforward to patch. We basically
@ -114,6 +111,6 @@ privileged void __morph_tls(void) {
}
}
__morph_end(&mask);
__morph_end();
#endif
}

View file

@ -103,7 +103,6 @@ int _cocmd(int, char **, char **);
char *GetProgramExecutableName(void);
char *GetInterpreterExecutableName(char *, size_t);
int _OpenExecutable(void);
bool _IsDynamicExecutable(const char *);
/* execution control */
int verynice(void);
axdx_t setlongerjmp(jmp_buf)
@ -121,6 +120,9 @@ void *_mapanon(size_t) attributeallocsize((1)) mallocesque;
void *_mapshared(size_t) attributeallocsize((1)) mallocesque;
void __oom_hook(size_t);
bool _isheap(void *);
/* code morphing */
void __morph_begin(void);
void __morph_end(void);
/* portability */
int NtGetVersion(void) pureconst;
bool IsGenuineBlink(void);

View file

@ -123,13 +123,15 @@ o/$(MODE)/libc/runtime/enable_tls.o: private \
endif
# privileged functions
o/$(MODE)/libc/runtime/morph.o \
o/$(MODE)/libc/runtime/getsymbol.o \
o/$(MODE)/libc/runtime/enable_threads.o \
o/$(MODE)/libc/runtime/morph_tls.o: private \
CFLAGS += \
-ffreestanding \
-fno-sanitize=all \
-fno-stack-protector
-fno-stack-protector \
-fpatchable-function-entry=0,0
# TODO(jart): We need a way to avoid WinThreadEntry() being hooked.
o/$(MODE)/libc/runtime/clone.o: private \

View file

@ -67,7 +67,7 @@ __msabi extern typeof(VirtualProtect) *const __imp_VirtualProtect;
extern int64_t __wincrashearly;
extern const char kConsoleHandles[3];
extern void cosmo(int, char **, char **, long (*)[2]) _Hide wontreturn;
extern void cosmo(int, char **, char **, long (*)[2]) wontreturn;
static const short kConsoleModes[3] = {
kNtEnableProcessedInput | kNtEnableLineInput | kNtEnableEchoInput |

View file

@ -34,61 +34,58 @@ struct SockFd {
uint32_t sndtimeo;
};
errno_t __dos2errno(uint32_t) _Hide;
errno_t __dos2errno(uint32_t);
int32_t __sys_accept(int32_t, void *, uint32_t *, int) dontdiscard _Hide;
int32_t __sys_accept4(int32_t, void *, uint32_t *, int) dontdiscard _Hide;
int32_t __sys_bind(int32_t, const void *, uint32_t) _Hide;
int32_t __sys_connect(int32_t, const void *, uint32_t) _Hide;
int32_t __sys_getpeername(int32_t, void *, uint32_t *) _Hide;
int32_t __sys_getsockname(int32_t, void *, uint32_t *) _Hide;
int32_t __sys_socket(int32_t, int32_t, int32_t) _Hide;
int32_t __sys_socketpair(int32_t, int32_t, int32_t, int32_t[2]) _Hide;
int32_t __sys_accept(int32_t, void *, uint32_t *, int) dontdiscard;
int32_t __sys_accept4(int32_t, void *, uint32_t *, int) dontdiscard;
int32_t __sys_bind(int32_t, const void *, uint32_t);
int32_t __sys_connect(int32_t, const void *, uint32_t);
int32_t __sys_getpeername(int32_t, void *, uint32_t *);
int32_t __sys_getsockname(int32_t, void *, uint32_t *);
int32_t __sys_socket(int32_t, int32_t, int32_t);
int32_t __sys_socketpair(int32_t, int32_t, int32_t, int32_t[2]);
int32_t sys_accept4(int32_t, struct sockaddr_storage *, int) dontdiscard _Hide;
int32_t sys_bind(int32_t, const void *, uint32_t) _Hide;
int32_t sys_connect(int32_t, const void *, uint32_t) _Hide;
int32_t sys_getsockopt(int32_t, int32_t, int32_t, void *, uint32_t *) _Hide;
int32_t sys_listen(int32_t, int32_t) _Hide;
int32_t sys_getsockname(int32_t, void *, uint32_t *) _Hide;
int32_t sys_getpeername(int32_t, void *, uint32_t *) _Hide;
int32_t sys_shutdown(int32_t, int32_t) _Hide;
int32_t sys_socket(int32_t, int32_t, int32_t) _Hide;
int32_t sys_socketpair(int32_t, int32_t, int32_t, int32_t[2]) _Hide;
ssize_t sys_recvfrom(int, void *, size_t, int, void *, uint32_t *) _Hide;
ssize_t sys_sendto(int, const void *, size_t, int, const void *,
uint32_t) _Hide;
int32_t sys_select(int32_t, fd_set *, fd_set *, fd_set *,
struct timeval *) _Hide;
int32_t sys_accept4(int32_t, struct sockaddr_storage *, int) dontdiscard;
int32_t sys_bind(int32_t, const void *, uint32_t);
int32_t sys_connect(int32_t, const void *, uint32_t);
int32_t sys_getsockopt(int32_t, int32_t, int32_t, void *, uint32_t *);
int32_t sys_listen(int32_t, int32_t);
int32_t sys_getsockname(int32_t, void *, uint32_t *);
int32_t sys_getpeername(int32_t, void *, uint32_t *);
int32_t sys_shutdown(int32_t, int32_t);
int32_t sys_socket(int32_t, int32_t, int32_t);
int32_t sys_socketpair(int32_t, int32_t, int32_t, int32_t[2]);
ssize_t sys_recvfrom(int, void *, size_t, int, void *, uint32_t *);
ssize_t sys_sendto(int, const void *, size_t, int, const void *, uint32_t);
int32_t sys_select(int32_t, fd_set *, fd_set *, fd_set *, struct timeval *);
int sys_pselect(int, fd_set *, fd_set *, fd_set *, struct timespec *,
const void *) _Hide;
int sys_setsockopt(int, int, int, const void *, uint32_t) _Hide;
int32_t sys_epoll_create(int32_t) _Hide;
int32_t sys_epoll_ctl(int32_t, int32_t, int32_t, void *) _Hide;
int32_t sys_epoll_wait(int32_t, void *, int32_t, int32_t) _Hide;
const void *);
int sys_setsockopt(int, int, int, const void *, uint32_t);
int32_t sys_epoll_create(int32_t);
int32_t sys_epoll_ctl(int32_t, int32_t, int32_t, void *);
int32_t sys_epoll_wait(int32_t, void *, int32_t, int32_t);
int32_t sys_epoll_pwait(int32_t, void *, int32_t, int32_t, const sigset_t *,
size_t);
int sys_socket_nt(int, int, int) _Hide;
int sys_socket_nt(int, int, int);
/*
int sys_socketpair_nt_stream(int, int, int, int[2]) _Hide;
int sys_socketpair_nt_dgram(int, int, int, int[2]) _Hide;
int sys_socketpair_nt_stream(int, int, int, int[2]) ;
int sys_socketpair_nt_dgram(int, int, int, int[2]) ;
*/
int sys_socketpair_nt(int, int, int, int[2]) _Hide;
int sys_socketpair_nt(int, int, int, int[2]);
int sys_select_nt(int, fd_set *, fd_set *, fd_set *, struct timeval *,
const sigset_t *) _Hide;
const sigset_t *);
size_t __iovec2nt(struct NtIovec[hasatleast 16], const struct iovec *,
size_t) _Hide;
size_t __iovec2nt(struct NtIovec[hasatleast 16], const struct iovec *, size_t);
void WinSockInit(void) _Hide;
int64_t __winsockerr(void) nocallback _Hide;
int __fixupnewsockfd(int, int) _Hide;
int64_t __winsockblock(int64_t, unsigned, int64_t, uint32_t) _Hide;
struct SockFd *_dupsockfd(struct SockFd *) _Hide;
int64_t GetNtBaseSocket(int64_t) _Hide;
int sys_close_epoll(int) _Hide;
void WinSockInit(void);
int64_t __winsockerr(void) nocallback;
int __fixupnewsockfd(int, int);
int64_t __winsockblock(int64_t, unsigned, int64_t, uint32_t);
struct SockFd *_dupsockfd(struct SockFd *);
int64_t GetNtBaseSocket(int64_t);
int sys_close_epoll(int);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -34,7 +34,7 @@
* Berkeley Socket wrappers are linked. The latest version of Winsock
* was introduced alongside x64, so this should never fail.
*/
_Hide struct NtWsaData kNtWsaData;
struct NtWsaData kNtWsaData;
static textwindows void WinSockCleanup(void) {
int i, rc;

View file

@ -5,11 +5,11 @@ COSMOPOLITAN_C_START_
int sys_sendfile_xnu(int32_t infd, int32_t outfd, int64_t offset,
int64_t *out_opt_sbytes, const void *opt_hdtr,
int32_t flags) _Hide;
int32_t flags);
int sys_sendfile_freebsd(int32_t infd, int32_t outfd, int64_t offset,
size_t nbytes, const void *opt_hdtr,
int64_t *out_opt_sbytes, int32_t flags) _Hide;
int64_t *out_opt_sbytes, int32_t flags);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -14,8 +14,8 @@ struct msghdr_bsd {
uint32_t msg_flags; /* « different type */
};
ssize_t sys_sendmsg(int, const struct msghdr *, int) _Hide;
ssize_t sys_recvmsg(int, struct msghdr *, int) _Hide;
ssize_t sys_sendmsg(int, const struct msghdr *, int);
ssize_t sys_recvmsg(int, struct msghdr *, int);
bool __asan_is_valid_msghdr(const struct msghdr *);
COSMOPOLITAN_C_END_

View file

@ -7,12 +7,12 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int32_t sys_poll(struct pollfd *, uint64_t, signed) _Hide;
int32_t __sys_poll(struct pollfd *, uint64_t, signed) _Hide;
int32_t sys_poll(struct pollfd *, uint64_t, signed);
int32_t __sys_poll(struct pollfd *, uint64_t, signed);
int sys_ppoll(struct pollfd *, size_t, const struct timespec *,
const sigset_t *, size_t);
int sys_poll_metal(struct pollfd *, size_t, unsigned);
int sys_poll_nt(struct pollfd *, uint64_t, uint64_t *, const sigset_t *) _Hide;
int sys_poll_nt(struct pollfd *, uint64_t, uint64_t *, const sigset_t *);
const char *DescribePollFds(char[300], ssize_t, struct pollfd *, size_t);
#define DescribePollFds(x, y, z) DescribePollFds(alloca(300), x, y, z)

View file

@ -7,21 +7,20 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_accept_nt(struct Fd *, struct sockaddr_storage *, int) _Hide;
int sys_accept_nt(struct Fd *, struct sockaddr_storage *, int);
int sys_bind_nt(struct Fd *, const void *, uint32_t);
int sys_closesocket_nt(struct Fd *) _Hide;
int sys_connect_nt(struct Fd *, const void *, uint32_t) _Hide;
int sys_getpeername_nt(struct Fd *, void *, uint32_t *) _Hide;
int sys_getsockname_nt(struct Fd *, void *, uint32_t *) _Hide;
int sys_getsockopt_nt(struct Fd *, int, int, void *, uint32_t *) _Hide;
int sys_listen_nt(struct Fd *, int) _Hide;
int sys_setsockopt_nt(struct Fd *, int, int, const void *, uint32_t) _Hide;
int sys_shutdown_nt(struct Fd *, int) _Hide;
ssize_t sys_recv_nt(struct Fd *, const struct iovec *, size_t, uint32_t) _Hide;
int sys_closesocket_nt(struct Fd *);
int sys_connect_nt(struct Fd *, const void *, uint32_t);
int sys_getpeername_nt(struct Fd *, void *, uint32_t *);
int sys_getsockname_nt(struct Fd *, void *, uint32_t *);
int sys_getsockopt_nt(struct Fd *, int, int, void *, uint32_t *);
int sys_listen_nt(struct Fd *, int);
int sys_setsockopt_nt(struct Fd *, int, int, const void *, uint32_t);
int sys_shutdown_nt(struct Fd *, int);
ssize_t sys_recv_nt(struct Fd *, const struct iovec *, size_t, uint32_t);
ssize_t sys_recvfrom_nt(struct Fd *, const struct iovec *, size_t, uint32_t,
void *, uint32_t *) _Hide;
int __wsablock(struct Fd *, struct NtOverlapped *, uint32_t *, bool,
uint32_t) _Hide;
void *, uint32_t *);
int __wsablock(struct Fd *, struct NtOverlapped *, uint32_t *, bool, uint32_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -1,41 +0,0 @@
/*-*- 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 2020 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/intrin/weaken.h"
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
/**
* Formats internet address to string, or dies.
*
* @param af can be AF_INET, e.g. addr->sin_family
* @param src is the binary-encoded address, e.g. &addr->sin_addr
* @return allocated IP address string, which must be free()'d
*/
char *sys_xinet_ntop(int af, const void *src) {
char *res, ip[16];
if (inet_ntop(af, src, ip, sizeof(ip)) && (res = strdup(ip))) {
return res;
} else {
if (_weaken(__die)) _weaken(__die)();
abort();
__builtin_unreachable();
}
}

View file

@ -583,3 +583,5 @@ void seekdir(DIR *dir, long off) {
dir->tell = i;
_unlockdir(dir);
}
__weak_reference(readdir, readdir64);

View file

@ -17,8 +17,8 @@ struct StdioFlush {
FILE *handles_initmem[8];
};
_Hide extern struct StdioFlush __fflush;
_Hide extern pthread_mutex_t __fflush_lock_obj;
extern struct StdioFlush __fflush;
extern pthread_mutex_t __fflush_lock_obj;
void __fflush_lock(void);
void __fflush_unlock(void);

View file

@ -777,7 +777,7 @@ haveinc:
* @asyncsignalsafe if floating point isn't used
* @vforksafe if floating point isn't used
*/
_Hide int __fmt(void *fn, void *arg, const char *format, va_list va) {
int __fmt(void *fn, void *arg, const char *format, va_list va) {
long ld;
void *p;
double x;

View file

@ -19,17 +19,12 @@
#include "libc/calls/calls.h"
#include "libc/calls/struct/iovec.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/stdckdint.h"
#include "libc/stdio/internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/errfuns.h"
/**
* Reads data from stream.

View file

@ -16,18 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/iovec.internal.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/stdckdint.h"
#include "libc/stdio/internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
@ -45,7 +39,7 @@ size_t fwrite_unlocked(const void *data, size_t stride, size_t count, FILE *f) {
size_t n, m;
const char *p;
struct iovec iov[2];
if (!stride) {
if (!stride || !count) {
return 0;
}
if ((f->iomode & O_ACCMODE) == O_RDONLY) {
@ -109,7 +103,7 @@ size_t fwrite_unlocked(const void *data, size_t stride, size_t count, FILE *f) {
iov[1].iov_base = data;
iov[1].iov_len = n;
n += f->beg;
if (WritevUninterruptible(f->fd, iov, 2) == -1) {
if (__robust_writev(f->fd, iov, 2) == -1) {
f->state = errno;
return 0;
}

View file

@ -7,14 +7,14 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
_Hide extern uint64_t g_rando;
extern uint64_t g_rando;
int __fflush_impl(FILE *) _Hide;
int __fflush_register(FILE *) _Hide;
void __fflush_unregister(FILE *) _Hide;
bool __stdio_isok(FILE *) _Hide;
FILE *__stdio_alloc(void) _Hide;
void __stdio_free(FILE *) _Hide;
int __fflush_impl(FILE *);
int __fflush_register(FILE *);
void __fflush_unregister(FILE *);
bool __stdio_isok(FILE *);
FILE *__stdio_alloc(void);
void __stdio_free(FILE *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -69,10 +69,11 @@ static int RunFileActions(struct _posix_faction *a) {
* @param envp is environment variables, or `environ` if null
* @return 0 on success or error number on failure
* @see posix_spawnp() for `$PATH` searching
* @returnserrno
* @tlsrequired
* @threadsafe
*/
int posix_spawn(int *pid, const char *path,
errno_t posix_spawn(int *pid, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp, char *const argv[],
char *const envp[]) {

View file

@ -1,31 +0,0 @@
/*-*- 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
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/macros.internal.h"
readdir64:
jmp readdir
.endfn readdir64,globl

View file

@ -18,5 +18,5 @@
*/
#include "libc/stdio/internal.h"
char g_stdoutbuf[BUFSIZ] _Hide;
char g_stderrbuf[BUFSIZ] _Hide;
char g_stdoutbuf[BUFSIZ];
char g_stderrbuf[BUFSIZ];

View file

@ -8,10 +8,10 @@ struct StrList {
char **p;
};
void FreeStrList(struct StrList *) _Hide;
int AppendStrList(struct StrList *) _Hide;
void SortStrList(struct StrList *) _Hide;
int JoinStrList(struct StrList *, char **, uint64_t) _Hide;
void FreeStrList(struct StrList *);
int AppendStrList(struct StrList *);
void SortStrList(struct StrList *);
int JoinStrList(struct StrList *, char **, uint64_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -15,7 +15,7 @@ int mkstemp(char *);
int mkstemps(char *, int);
int mkostempsmi(char *, int, unsigned, uint64_t *, int,
int (*)(const char *, int, ...)) _Hide dontdiscard;
int (*)(const char *, int, ...)) dontdiscard;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -16,7 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/iovec.internal.h"
#include "libc/dce.h"
#include "libc/fmt/fmt.h"
@ -43,7 +42,7 @@ static int vdprintf_putc(const char *s, struct VdprintfState *t, size_t n) {
iov[0].iov_len = t->n;
iov[1].iov_base = s;
iov[1].iov_len = n;
if (WritevUninterruptible(t->fd, iov, 2) == -1) {
if (__robust_writev(t->fd, iov, 2) == -1) {
return -1;
}
t->t += t->n;
@ -68,7 +67,7 @@ int vdprintf(int fd, const char *fmt, va_list va) {
if (t.n) {
iov[0].iov_base = t.b;
iov[0].iov_len = t.n;
if (WritevUninterruptible(t.fd, iov, 1) == -1) {
if (__robust_writev(t.fd, iov, 1) == -1) {
return -1;
}
t.t += t.n;

View file

@ -1,27 +0,0 @@
#ifndef COSMOPOLITAN_LIBC_STR_INTERNAL_H_
#define COSMOPOLITAN_LIBC_STR_INTERNAL_H_
#ifndef __STRICT_ANSI__
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
_Hide extern const uint32_t kSha256Tab[64];
nodebuginfo forceinline bool32 ismoar(wint_t c) {
return (c & 0300) == 0300;
}
nodebuginfo forceinline bool32 iscont(wint_t c) {
return (c & 0300) == 0200;
}
char *strstr_sse42(const char *, const char *) strlenesque _Hide;
char16_t *strstr16_sse42(const char16_t *, const char16_t *) strlenesque _Hide;
void *memmem_sse42(const void *, size_t, const void *, size_t)
strlenesque _Hide;
void sha256_x86(uint32_t[hasatleast 8], const uint8_t[hasatleast 64],
uint32_t) _Hide;
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* !ANSI */
#endif /* COSMOPOLITAN_LIBC_STR_INTERNAL_H_ */

View file

@ -18,7 +18,7 @@
*/
#include "libc/time/time.h"
_Hide const unsigned short kMonthYearDay[2][12] = {
const unsigned short kMonthYearDay[2][12] = {
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335},
};

View file

@ -20,7 +20,7 @@
#include "libc/macros.internal.h"
#include "libc/nexgen32e/x86info.h"
_Hide const struct X86ProcessorModel kX86ProcessorModels[] = {
const struct X86ProcessorModel kX86ProcessorModels[] = {
/* <SORTED> */
{0x060F, X86_MARCH_CORE2, X86_GRADE_CLIENT},
{0x0616, X86_MARCH_CORE2, X86_GRADE_MOBILE},
@ -79,4 +79,4 @@ _Hide const struct X86ProcessorModel kX86ProcessorModels[] = {
/* </SORTED> */
};
_Hide const size_t kX86ProcessorModelCount = ARRAYLEN(kX86ProcessorModels);
const size_t kX86ProcessorModelCount = ARRAYLEN(kX86ProcessorModels);

View file

@ -87,18 +87,18 @@ typedef void (*atfork_f)(void);
extern struct Dll *_pthread_list;
extern pthread_spinlock_t _pthread_lock;
extern _Atomic(pthread_key_dtor) _pthread_key_dtor[PTHREAD_KEYS_MAX] _Hide;
extern _Atomic(pthread_key_dtor) _pthread_key_dtor[PTHREAD_KEYS_MAX];
int _pthread_atfork(atfork_f, atfork_f, atfork_f) _Hide;
int _pthread_reschedule(struct PosixThread *) _Hide;
int _pthread_setschedparam_freebsd(int, int, const struct sched_param *) _Hide;
void _pthread_zombify(struct PosixThread *) _Hide;
void _pthread_free(struct PosixThread *) _Hide;
void _pthread_onfork_prepare(void) _Hide;
void _pthread_onfork_parent(void) _Hide;
void _pthread_onfork_child(void) _Hide;
void _pthread_ungarbage(void) _Hide;
int _pthread_cancel_sys(void) _Hide;
int _pthread_atfork(atfork_f, atfork_f, atfork_f);
int _pthread_reschedule(struct PosixThread *);
int _pthread_setschedparam_freebsd(int, int, const struct sched_param *);
void _pthread_zombify(struct PosixThread *);
void _pthread_free(struct PosixThread *);
void _pthread_onfork_prepare(void);
void _pthread_onfork_parent(void);
void _pthread_onfork_child(void);
void _pthread_ungarbage(void);
int _pthread_cancel_sys(void);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -11,9 +11,9 @@ struct spawn {
struct CosmoTib *tib;
};
int _spawn(int (*)(void *, int), void *, struct spawn *) _Hide;
int _join(struct spawn *) _Hide;
char *_mktls(struct CosmoTib **) _Hide;
int _spawn(int (*)(void *, int), void *, struct spawn *);
int _join(struct spawn *);
char *_mktls(struct CosmoTib **);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -5,7 +5,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
errno_t _wait0(const atomic_int *, struct timespec *) _Hide;
errno_t _wait0(const atomic_int *, struct timespec *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -4,7 +4,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_utime(const char *, const struct utimbuf *) _Hide;
int sys_utime(const char *, const struct utimbuf *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -18,11 +18,11 @@ int64_t time2posix(int64_t) pureconst;
void tzset(void);
#ifdef COSMO
_Hide extern const char kWeekdayNameShort[7][4];
_Hide extern const char kWeekdayName[7][10];
_Hide extern const char kMonthNameShort[12][4];
_Hide extern const char kMonthName[12][10];
_Hide extern const unsigned short kMonthYearDay[2][12];
extern const char kWeekdayNameShort[7][4];
extern const char kWeekdayName[7][10];
extern const char kMonthNameShort[12][4];
extern const char kMonthName[12][10];
extern const unsigned short kMonthYearDay[2][12];
extern long double (*nowl)(void);
long double ConvertTicksToNanos(double);
long double dsleep(long double);

View file

@ -6,7 +6,7 @@ COSMOPOLITAN_C_START_
#define ATAN_POLY_NCOEFFS 20
extern const struct atan_poly_data {
double poly[ATAN_POLY_NCOEFFS];
} __atan_poly_data _Hide;
} __atan_poly_data;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -6,7 +6,7 @@ COSMOPOLITAN_C_START_
#define ATANF_POLY_NCOEFFS 8
extern const struct atanf_poly_data {
float poly[ATANF_POLY_NCOEFFS];
} __atanf_poly_data _Hide;
} __atanf_poly_data;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -40,8 +40,8 @@ COSMOPOLITAN_C_START_
(d) = asfloat(w); \
} while (0)
_Complex double __ldexp_cexp(_Complex double, int) _Hide;
_Complex float __ldexp_cexpf(_Complex float, int) _Hide;
_Complex double __ldexp_cexp(_Complex double, int);
_Complex float __ldexp_cexpf(_Complex float, int);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -7,7 +7,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern _Hide const struct exp2f_data {
extern const struct exp2f_data {
uint64_t tab[1 << EXP2F_TABLE_BITS];
double shift_scaled;
double poly[EXP2F_POLY_ORDER];

View file

@ -9,7 +9,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern _Hide const struct exp_data {
extern const struct exp_data {
double invln2N;
double shift;
double negln2hiN;

Some files were not shown because too many files have changed in this diff Show more