Avoid linker conflicts on DescribeFoo symbols

These symbols belong to the user. It caused a confusing error for Blink.
This commit is contained in:
Justine Tunney 2024-08-24 18:10:22 -07:00
parent 38cc4b3c68
commit bb06230f1e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
120 changed files with 346 additions and 347 deletions

View file

@ -5,9 +5,9 @@ COSMOPOLITAN_C_START_
int sys_getgroups(int size, uint32_t list[]); int sys_getgroups(int size, uint32_t list[]);
int sys_setgroups(size_t size, const uint32_t list[]); int sys_setgroups(size_t size, const uint32_t list[]);
const char *DescribeGidList(char[128], int, int, const uint32_t list[]); const char *_DescribeGidList(char[128], int, int, const uint32_t list[]);
#define DescribeGidList(rc, length, gidlist) \ #define DescribeGidList(rc, length, gidlist) \
DescribeGidList(alloca(128), rc, length, gidlist) _DescribeGidList(alloca(128), rc, length, gidlist)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_ */

View file

@ -18,8 +18,8 @@
*/ */
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/state.internal.h" #include "libc/calls/state.internal.h"
#include "libc/intrin/fds.h"
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/intrin/fds.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
static const char *__fdkind2str(int x) { static const char *__fdkind2str(int x) {
@ -55,7 +55,7 @@ void __printfds(struct Fd *fds, size_t fdslen) {
continue; continue;
kprintf("%3d %s", i, __fdkind2str(fds[i].kind)); kprintf("%3d %s", i, __fdkind2str(fds[i].kind));
if (fds[i].flags) { if (fds[i].flags) {
kprintf(" flags=%s", (DescribeOpenFlags)(buf, fds[i].flags)); kprintf(" flags=%s", _DescribeOpenFlags(buf, fds[i].flags));
} }
if (fds[i].mode) if (fds[i].mode)
kprintf(" mode=%#o", fds[i].mode); kprintf(" mode=%#o", fds[i].mode);

View file

@ -82,7 +82,7 @@ int seccomp(unsigned operation, unsigned flags, void *args) {
} else { } else {
rc = enosys(); rc = enosys();
} }
STRACE("seccomp(%s, %#x, %p) → %d% m", DescribeSeccompOperation(operation), STRACE("seccomp(%s, %#x, %p) → %d% m", _DescribeSeccompOperation(operation),
flags, args, rc); flags, args, rc);
return rc; return rc;
} }

View file

@ -194,7 +194,7 @@ textwindows int __sig_raise(volatile int sig, int sic) {
char ssbuf[128]; char ssbuf[128];
siginfo_t si = {.si_signo = sig, .si_code = sic}; siginfo_t si = {.si_signo = sig, .si_code = sic};
STRACE("__sig_raise(%G, %t) mask %s", sig, __sig_handler(rva), STRACE("__sig_raise(%G, %t) mask %s", sig, __sig_handler(rva),
(DescribeSigset)(ssbuf, 0, (sigset_t *)&pt->tib->tib_sigmask)); _DescribeSigset(ssbuf, 0, (sigset_t *)&pt->tib->tib_sigmask));
__sig_handler(rva)(sig, &si, &ctx); __sig_handler(rva)(sig, &si, &ctx);
// record this handler // record this handler
@ -265,8 +265,8 @@ static textwindows wontreturn void __sig_tramp(struct SignalFrame *sf) {
// call the user's signal handler // call the user's signal handler
char ssbuf[2][128]; char ssbuf[2][128];
STRACE("__sig_tramp(%G, %t) mask %s → %s", sig, __sig_handler(sf->rva), STRACE("__sig_tramp(%G, %t) mask %s → %s", sig, __sig_handler(sf->rva),
(DescribeSigset)(ssbuf[0], 0, &sf->ctx.uc_sigmask), _DescribeSigset(ssbuf[0], 0, &sf->ctx.uc_sigmask),
(DescribeSigset)(ssbuf[1], 0, (sigset_t *)&tib->tib_sigmask)); _DescribeSigset(ssbuf[1], 0, (sigset_t *)&tib->tib_sigmask));
__sig_handler(sf->rva)(sig, &sf->si, &sf->ctx); __sig_handler(sf->rva)(sig, &sf->si, &sf->ctx);
// restore the signal mask that was used by the interrupted code // restore the signal mask that was used by the interrupted code

View file

@ -4,8 +4,8 @@
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
const char *DescribeFlock(char[300], int, const struct flock *); const char *_DescribeFlock(char[300], int, const struct flock *);
#define DescribeFlock(c, l) DescribeFlock(alloca(300), c, l) #define DescribeFlock(c, l) _DescribeFlock(alloca(300), c, l)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FLOCK_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FLOCK_INTERNAL_H_ */

View file

@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_
#include "libc/intrin/fds.h"
#include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.h"
#include "libc/intrin/fds.h"
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -22,8 +22,8 @@ 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, const void *, ssize_t sys_sendto_nt(int, const struct iovec *, size_t, uint32_t, const void *,
uint32_t); uint32_t);
const char *DescribeIovec(char[300], ssize_t, const struct iovec *, int); const char *_DescribeIovec(char[300], ssize_t, const struct iovec *, int);
#define DescribeIovec(x, y, z) DescribeIovec(alloca(300), x, y, z) #define DescribeIovec(x, y, z) _DescribeIovec(alloca(300), x, y, z)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ */

View file

@ -8,8 +8,8 @@ int sys_getitimer(int, struct itimerval *);
int sys_setitimer(int, const struct itimerval *, struct itimerval *); int sys_setitimer(int, const struct itimerval *, struct itimerval *);
int sys_setitimer_nt(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 *); const char *_DescribeItimerval(char[90], int, const struct itimerval *);
#define DescribeItimerval(rc, ts) DescribeItimerval(alloca(90), rc, ts) #define DescribeItimerval(rc, ts) _DescribeItimerval(alloca(90), rc, ts)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_ITIMERVAL_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_ITIMERVAL_INTERNAL_H_ */

View file

@ -8,8 +8,8 @@ int sys_getrlimit(int, struct rlimit *);
int sys_setrlimit(int, const struct rlimit *); int sys_setrlimit(int, const struct rlimit *);
int sys_setrlimit_nt(int, const struct rlimit *); int sys_setrlimit_nt(int, const struct rlimit *);
const char *DescribeRlimit(char[64], int, const struct rlimit *); const char *_DescribeRlimit(char[64], int, const struct rlimit *);
#define DescribeRlimit(rc, rl) DescribeRlimit(alloca(64), rc, rl) #define DescribeRlimit(rc, rl) _DescribeRlimit(alloca(64), rc, rl)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_RLIMIT_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_RLIMIT_INTERNAL_H_ */

View file

@ -4,8 +4,8 @@
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
const char *DescribeSchedParam(char[32], const struct sched_param *); const char *_DescribeSchedParam(char[32], const struct sched_param *);
#define DescribeSchedParam(x) DescribeSchedParam(alloca(32), x) #define DescribeSchedParam(x) _DescribeSchedParam(alloca(32), x)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SCHED_PARAM_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SCHED_PARAM_INTERNAL_H_ */

View file

@ -66,8 +66,8 @@ void __sigenter_netbsd(int, siginfo_t *, void *);
void __sigenter_freebsd(int, siginfo_t *, void *); void __sigenter_freebsd(int, siginfo_t *, void *);
void __sigenter_openbsd(int, siginfo_t *, void *); void __sigenter_openbsd(int, siginfo_t *, void *);
const char *DescribeSigaction(char[256], int, const struct sigaction *); const char *_DescribeSigaction(char[256], int, const struct sigaction *);
#define DescribeSigaction(rc, sa) DescribeSigaction(alloca(256), rc, sa) #define DescribeSigaction(rc, sa) _DescribeSigaction(alloca(256), rc, sa)
void _init_onntconsoleevent(void); void _init_onntconsoleevent(void);

View file

@ -4,8 +4,8 @@
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
const char *DescribeSigaltstack(char[128], int, const struct sigaltstack *); const char *_DescribeSigaltstack(char[128], int, const struct sigaltstack *);
#define DescribeSigaltstack(rc, ss) DescribeSigaltstack(alloca(128), rc, ss) #define DescribeSigaltstack(rc, ss) _DescribeSigaltstack(alloca(128), rc, ss)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGALTSTACK_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGALTSTACK_INTERNAL_H_ */

View file

@ -6,8 +6,8 @@ COSMOPOLITAN_C_START_
int sys_sigqueueinfo(int, const siginfo_t *); int sys_sigqueueinfo(int, const siginfo_t *);
const char *DescribeSiginfo(char[300], int, const siginfo_t *); const char *_DescribeSiginfo(char[300], int, const siginfo_t *);
#define DescribeSiginfo(x, y) DescribeSiginfo(alloca(300), x, y) #define DescribeSiginfo(x, y) _DescribeSiginfo(alloca(300), x, y)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGINFO_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGINFO_INTERNAL_H_ */

View file

@ -34,8 +34,8 @@ int sys_sigprocmask(int, const sigset_t *, sigset_t *);
int sys_sigsuspend(const uint64_t *, uint64_t); int sys_sigsuspend(const uint64_t *, uint64_t);
int sys_sigpending(uint64_t *, size_t); int sys_sigpending(uint64_t *, size_t);
const char *DescribeSigset(char[128], int, const sigset_t *); const char *_DescribeSigset(char[128], int, const sigset_t *);
#define DescribeSigset(rc, ss) DescribeSigset(alloca(128), rc, ss) #define DescribeSigset(rc, ss) _DescribeSigset(alloca(128), rc, ss)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGSET_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGSET_INTERNAL_H_ */

View file

@ -13,8 +13,8 @@ int sys_fstatat_nt(int, const char *, struct stat *, int);
int sys_lstat_nt(const char *, struct stat *); int sys_lstat_nt(const char *, struct stat *);
int sys_fstat_metal(int, struct stat *); int sys_fstat_metal(int, struct stat *);
const char *DescribeStat(char[300], int, const struct stat *); const char *_DescribeStat(char[300], int, const struct stat *);
#define DescribeStat(rc, st) DescribeStat(alloca(300), rc, st) #define DescribeStat(rc, st) _DescribeStat(alloca(300), rc, st)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STAT_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STAT_INTERNAL_H_ */

View file

@ -12,8 +12,8 @@ int sys_fstatfs_nt(int64_t, struct statfs *);
int sys_statfs_nt(const char *, struct statfs *); int sys_statfs_nt(const char *, struct statfs *);
void statfs2statvfs(struct statvfs *, const struct statfs *); void statfs2statvfs(struct statvfs *, const struct statfs *);
const char *DescribeStatfs(char[300], int, const struct statfs *); const char *_DescribeStatfs(char[300], int, const struct statfs *);
#define DescribeStatfs(rc, sf) DescribeStatfs(alloca(300), rc, sf) #define DescribeStatfs(rc, sf) _DescribeStatfs(alloca(300), rc, sf)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STATFS_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STATFS_INTERNAL_H_ */

View file

@ -4,9 +4,9 @@
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
const char *DescribeTermios(char[1024], ssize_t, const struct termios *); const char *_DescribeTermios(char[1024], ssize_t, const struct termios *);
#define DescribeTermios(rc, tio) DescribeTermios(alloca(1024), rc, tio) #define DescribeTermios(rc, tio) _DescribeTermios(alloca(1024), rc, tio)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TERMIOS_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TERMIOS_INTERNAL_H_ */

View file

@ -26,8 +26,8 @@ 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_nt(int, const char *, const struct timespec[2], int);
int sys_utimensat_old(int, const char *, const struct timespec[2], int); int sys_utimensat_old(int, const char *, const struct timespec[2], int);
const char *DescribeTimespec(char[45], int, const struct timespec *); const char *_DescribeTimespec(char[45], int, const struct timespec *);
#define DescribeTimespec(rc, ts) DescribeTimespec(alloca(45), rc, ts) #define DescribeTimespec(rc, ts) _DescribeTimespec(alloca(45), rc, ts)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMESPEC_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMESPEC_INTERNAL_H_ */

View file

@ -11,8 +11,8 @@ int sys_lutimes(const char *, const struct timeval *);
int sys_utimes(const char *, const struct timeval *); int sys_utimes(const char *, const struct timeval *);
int sys_utimes_nt(const char *, const struct timeval[2]); int sys_utimes_nt(const char *, const struct timeval[2]);
const char *DescribeTimeval(char[45], int, const struct timeval *); const char *_DescribeTimeval(char[45], int, const struct timeval *);
#define DescribeTimeval(rc, ts) DescribeTimeval(alloca(45), rc, ts) #define DescribeTimeval(rc, ts) _DescribeTimeval(alloca(45), rc, ts)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMEVAL_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMEVAL_INTERNAL_H_ */

View file

@ -1,13 +1,13 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_
#include "libc/intrin/fds.h"
#include "libc/calls/struct/winsize.h" #include "libc/calls/struct/winsize.h"
#include "libc/intrin/fds.h"
#include "libc/mem/alloca.h" #include "libc/mem/alloca.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
int tcgetwinsize_nt(int, struct winsize *); int tcgetwinsize_nt(int, struct winsize *);
const char *DescribeWinsize(char[64], int, const struct winsize *); const char *_DescribeWinsize(char[64], int, const struct winsize *);
#define DescribeWinsize(rc, ws) DescribeWinsize(alloca(64), rc, ws) #define DescribeWinsize(rc, ws) _DescribeWinsize(alloca(64), rc, ws)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ */

View file

@ -28,7 +28,8 @@ extern const struct MagnumStr kSockOptnames[];
extern const struct MagnumStr kTcpOptnames[]; extern const struct MagnumStr kTcpOptnames[];
extern const struct MagnumStr kPollNames[]; extern const struct MagnumStr kPollNames[];
const char *DescribeMagnum(char *, const struct MagnumStr *, const char *, int); const char *_DescribeMagnum(char *, const struct MagnumStr *, const char *,
int);
__funline const char *GetMagnumStr(const struct MagnumStr *ms, int x) { __funline const char *GetMagnumStr(const struct MagnumStr *ms, int x) {
int i; int i;

View file

@ -53,7 +53,7 @@ void report_cancelation_point(int sysv_ordinal, int xnu_ordinal) {
char bt[160]; char bt[160];
struct StackFrame *bp = __builtin_frame_address(0); struct StackFrame *bp = __builtin_frame_address(0);
kprintf("error: report_cancelation_point(%#x, %#x) %s\n", sysv_ordinal, kprintf("error: report_cancelation_point(%#x, %#x) %s\n", sysv_ordinal,
xnu_ordinal, (DescribeBacktrace)(bt, bp)); xnu_ordinal, _DescribeBacktrace(bt, bp));
__builtin_trap(); __builtin_trap();
} }

View file

@ -57,11 +57,11 @@ TryAgain:
opt_lpSecurity, dwCreationDisposition, opt_lpSecurity, dwCreationDisposition,
dwFlagsAndAttributes, opt_hTemplateFile); dwFlagsAndAttributes, opt_hTemplateFile);
NTTRACE("CreateFile(%#hs, %s, %s, %s, %s, %s, %ld) → {%ld, %d}", lpFileName, NTTRACE("CreateFile(%#hs, %s, %s, %s, %s, %s, %ld) → {%ld, %d}", lpFileName,
(DescribeNtFileAccessFlags)(buf_accessflags, dwDesiredAccess), _DescribeNtFileAccessFlags(buf_accessflags, dwDesiredAccess),
(DescribeNtFileShareFlags)(buf_shareflags, dwShareMode), _DescribeNtFileShareFlags(buf_shareflags, dwShareMode),
(DescribeNtSecurityAttributes)(buf_secattr, opt_lpSecurity), _DescribeNtSecurityAttributes(buf_secattr, opt_lpSecurity),
DescribeNtCreationDisposition(dwCreationDisposition), _DescribeNtCreationDisposition(dwCreationDisposition),
(DescribeNtFileFlagAttr)(buf_flagattr, dwFlagsAndAttributes), _DescribeNtFileFlagAttr(buf_flagattr, dwFlagsAndAttributes),
opt_hTemplateFile, hHandle, __imp_GetLastError()); opt_hTemplateFile, hHandle, __imp_GetLastError());
if (hHandle == -1) { if (hHandle == -1) {
switch (__imp_GetLastError()) { switch (__imp_GetLastError()) {

View file

@ -21,7 +21,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/arch.h" #include "libc/sysv/consts/arch.h"
const char *(DescribeArchPrctlCode)(char buf[12], int x) { const char *_DescribeArchPrctlCode(char buf[12], int x) {
if (x == ARCH_SET_FS) if (x == ARCH_SET_FS)
return "ARCH_SET_FS"; return "ARCH_SET_FS";
if (x == ARCH_GET_FS) if (x == ARCH_GET_FS)

View file

@ -39,8 +39,8 @@ privileged static char *FormatHex(char *p, unsigned long x) {
return p; return p;
} }
privileged dontinstrument const char *( privileged dontinstrument const char *_DescribeBacktrace(
DescribeBacktrace)(char buf[N], const struct StackFrame *fr) { char buf[N], const struct StackFrame *fr) {
char *p = buf; char *p = buf;
char *pe = p + N; char *pe = p + N;
bool gotsome = false; bool gotsome = false;

View file

@ -4,8 +4,8 @@
#include "libc/nexgen32e/stackframe.h" #include "libc/nexgen32e/stackframe.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
const char *DescribeBacktrace(char[160], const struct StackFrame *) libcesque; const char *_DescribeBacktrace(char[160], const struct StackFrame *) libcesque;
#define DescribeBacktrace(x) DescribeBacktrace(alloca(160), x) #define DescribeBacktrace(x) _DescribeBacktrace(alloca(160), x)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEBACKTRACE_H_ */ #endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEBACKTRACE_H_ */

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/thread/thread.h" #include "libc/thread/thread.h"
const char *(DescribeCancelState)(char buf[12], int err, int *state) { const char *_DescribeCancelState(char buf[12], int err, int *state) {
if (err) if (err)
return "n/a"; return "n/a";
if (!state) if (!state)

View file

@ -69,7 +69,7 @@ static const struct thatispacked {
{CAP_CHECKPOINT_RESTORE, "CHECKPOINT_RESTORE"}, // {CAP_CHECKPOINT_RESTORE, "CHECKPOINT_RESTORE"}, //
}; };
const char *(DescribeCapability)(char buf[32], int x) { const char *_DescribeCapability(char buf[32], int x) {
int i; int i;
for (i = 0; i < ARRAYLEN(kCapabilityName); ++i) { for (i = 0; i < ARRAYLEN(kCapabilityName); ++i) {
if (kCapabilityName[i].x == x) { if (kCapabilityName[i].x == x) {

View file

@ -22,6 +22,6 @@
/** /**
* Describes clock_gettime() clock argument. * Describes clock_gettime() clock argument.
*/ */
const char *(DescribeClockName)(char buf[32], int x) { const char *_DescribeClockName(char buf[32], int x) {
return DescribeMagnum(buf, kClockNames, "CLOCK_", x); return _DescribeMagnum(buf, kClockNames, "CLOCK_", x);
} }

View file

@ -32,7 +32,7 @@ static const struct DescribeFlags kControlKeyState[] = {
{kNtEnhancedKey, "EnhancedKey"}, // {kNtEnhancedKey, "EnhancedKey"}, //
}; };
const char *(DescribeControlKeyState)(char buf[64], uint32_t x) { const char *_DescribeControlKeyState(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kControlKeyState, ARRAYLEN(kControlKeyState), return _DescribeFlags(buf, 64, kControlKeyState, ARRAYLEN(kControlKeyState),
"kNt", x); "kNt", x);
} }

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/at.h" #include "libc/sysv/consts/at.h"
const char *(DescribeDirfd)(char buf[12], int dirfd) { const char *_DescribeDirfd(char buf[12], int dirfd) {
if (dirfd == AT_FDCWD) if (dirfd == AT_FDCWD)
return "AT_FDCWD"; return "AT_FDCWD";
FormatInt32(buf, dirfd); FormatInt32(buf, dirfd);

View file

@ -31,7 +31,7 @@ static const struct DescribeFlags kDnotifyFlags[] = {
{DN_MULTISHOT, "MULTISHOT"}, // {DN_MULTISHOT, "MULTISHOT"}, //
}; };
const char *(DescribeDnotifyFlags)(char buf[80], int x) { const char *_DescribeDnotifyFlags(char buf[80], int x) {
return DescribeFlags(buf, 80, kDnotifyFlags, ARRAYLEN(kDnotifyFlags), "DN_", return _DescribeFlags(buf, 80, kDnotifyFlags, ARRAYLEN(kDnotifyFlags), "DN_",
x); x);
} }

View file

@ -22,7 +22,7 @@
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
const char *(DescribeErrno)(char buf[30], int ax) { const char *_DescribeErrno(char buf[30], int ax) {
char *p = buf; char *p = buf;
const char *s; const char *s;
if (ax < 0) { if (ax < 0) {

View file

@ -21,7 +21,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/str/str.h" #include "libc/str/str.h"
const char *(DescribeFcntlCmd)(char buf[20], int x) { const char *_DescribeFcntlCmd(char buf[20], int x) {
const char *s; const char *s;
if (x >= 0 && (s = GetMagnumStr(kFcntlCmds, x))) { if (x >= 0 && (s = GetMagnumStr(kFcntlCmds, x))) {
buf[0] = 'F'; buf[0] = 'F';

View file

@ -26,7 +26,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeFdSet)(char buf[N], ssize_t rc, int nfds, fd_set *fds) { const char *_DescribeFdSet(char buf[N], ssize_t rc, int nfds, fd_set *fds) {
int o = 0; int o = 0;
if (!fds) if (!fds)

View file

@ -18,7 +18,7 @@
*/ */
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
const char *DescribeFlags(char *p, size_t n, const struct DescribeFlags *d, const char *_DescribeFlags(char *p, size_t n, const struct DescribeFlags *d,
size_t m, const char *prefix, unsigned x) { size_t m, const char *prefix, unsigned x) {
bool t; bool t;
char b[21]; char b[21];

View file

@ -8,121 +8,121 @@ struct thatispacked DescribeFlags {
const char *name; const char *name;
}; };
const char *DescribeFlags(char *, size_t, const struct DescribeFlags *, size_t, const char *_DescribeFlags(char *, size_t, const struct DescribeFlags *,
const char *, unsigned) libcesque; size_t, const char *, unsigned) libcesque;
const char *DescribeArchPrctlCode(char[12], int) libcesque; const char *_DescribeArchPrctlCode(char[12], int) libcesque;
const char *DescribeCancelState(char[12], int, int *) libcesque; const char *_DescribeCancelState(char[12], int, int *) libcesque;
const char *DescribeClockName(char[32], int) libcesque; const char *_DescribeClockName(char[32], int) libcesque;
const char *DescribeControlKeyState(char[64], uint32_t) libcesque; const char *_DescribeControlKeyState(char[64], uint32_t) libcesque;
const char *DescribeDirfd(char[12], int) libcesque; const char *_DescribeDirfd(char[12], int) libcesque;
const char *DescribeDnotifyFlags(char[80], int) libcesque; const char *_DescribeDnotifyFlags(char[80], int) libcesque;
const char *DescribeErrno(char[30], int) libcesque; const char *_DescribeErrno(char[30], int) libcesque;
const char *DescribeFcntlCmd(char[20], int) libcesque; const char *_DescribeFcntlCmd(char[20], int) libcesque;
const char *DescribeFlockType(char[12], int) libcesque; const char *_DescribeFlockType(char[12], int) libcesque;
const char *DescribeFutexOp(char[64], int) libcesque; const char *_DescribeFutexOp(char[64], int) libcesque;
const char *DescribeHow(char[12], int) libcesque; const char *_DescribeHow(char[12], int) libcesque;
const char *DescribeInOutInt64(char[23], ssize_t, int64_t *) libcesque; const char *_DescribeInOutInt64(char[23], ssize_t, int64_t *) libcesque;
const char *DescribeItimer(char[12], int) libcesque; const char *_DescribeItimer(char[12], int) libcesque;
const char *DescribeMapFlags(char[64], int) libcesque; const char *_DescribeMapFlags(char[64], int) libcesque;
const char *DescribeMapping(char[8], int, int) libcesque; const char *_DescribeMapping(char[8], int, int) libcesque;
const char *DescribeMremapFlags(char[30], int) libcesque; const char *_DescribeMremapFlags(char[30], int) libcesque;
const char *DescribeMsyncFlags(char[48], int) libcesque; const char *_DescribeMsyncFlags(char[48], int) libcesque;
const char *DescribeNtConsoleInFlags(char[256], uint32_t) libcesque; const char *_DescribeNtConsoleInFlags(char[256], uint32_t) libcesque;
const char *DescribeNtConsoleOutFlags(char[128], uint32_t) libcesque; const char *_DescribeNtConsoleOutFlags(char[128], uint32_t) libcesque;
const char *DescribeNtCreationDisposition(uint32_t) libcesque; const char *_DescribeNtCreationDisposition(uint32_t) libcesque;
const char *DescribeNtFileAccessFlags(char[512], uint32_t) libcesque; const char *_DescribeNtFileAccessFlags(char[512], uint32_t) libcesque;
const char *DescribeNtFileFlagAttr(char[256], uint32_t) libcesque; const char *_DescribeNtFileFlagAttr(char[256], uint32_t) libcesque;
const char *DescribeNtFileMapFlags(char[64], uint32_t) libcesque; const char *_DescribeNtFileMapFlags(char[64], uint32_t) libcesque;
const char *DescribeNtFileShareFlags(char[64], uint32_t) libcesque; const char *_DescribeNtFileShareFlags(char[64], uint32_t) libcesque;
const char *DescribeNtFiletypeFlags(char[64], uint32_t) libcesque; const char *_DescribeNtFiletypeFlags(char[64], uint32_t) libcesque;
const char *DescribeNtLockFileFlags(char[64], uint32_t) libcesque; const char *_DescribeNtLockFileFlags(char[64], uint32_t) libcesque;
const char *DescribeNtMovFileInpFlags(char[256], uint32_t) libcesque; const char *_DescribeNtMovFileInpFlags(char[256], uint32_t) libcesque;
const char *DescribeNtPageFlags(char[64], uint32_t) libcesque; const char *_DescribeNtPageFlags(char[64], uint32_t) libcesque;
const char *DescribeNtPipeModeFlags(char[64], uint32_t) libcesque; const char *_DescribeNtPipeModeFlags(char[64], uint32_t) libcesque;
const char *DescribeNtPipeOpenFlags(char[64], uint32_t) libcesque; const char *_DescribeNtPipeOpenFlags(char[64], uint32_t) libcesque;
const char *DescribeNtProcAccessFlags(char[256], uint32_t) libcesque; const char *_DescribeNtProcAccessFlags(char[256], uint32_t) libcesque;
const char *DescribeNtStartFlags(char[128], uint32_t) libcesque; const char *_DescribeNtStartFlags(char[128], uint32_t) libcesque;
const char *DescribeNtSymlinkFlags(char[64], uint32_t) libcesque; const char *_DescribeNtSymlinkFlags(char[64], uint32_t) libcesque;
const char *DescribeOpenFlags(char[128], int) libcesque; const char *_DescribeOpenFlags(char[128], int) libcesque;
const char *DescribeOpenMode(char[15], int, int) libcesque; const char *_DescribeOpenMode(char[15], int, int) libcesque;
const char *DescribePersonalityFlags(char[128], int) libcesque; const char *_DescribePersonalityFlags(char[128], int) libcesque;
const char *DescribePollFlags(char[64], int) libcesque; const char *_DescribePollFlags(char[64], int) libcesque;
const char *DescribeProtFlags(char[48], int) libcesque; const char *_DescribeProtFlags(char[48], int) libcesque;
const char *DescribePtrace(char[12], int) libcesque; const char *_DescribePtrace(char[12], int) libcesque;
const char *DescribePtraceEvent(char[32], int) libcesque; const char *_DescribePtraceEvent(char[32], int) libcesque;
const char *DescribeRlimitName(char[20], int) libcesque; const char *_DescribeRlimitName(char[20], int) libcesque;
const char *DescribeSchedPolicy(char[48], int) libcesque; const char *_DescribeSchedPolicy(char[48], int) libcesque;
const char *DescribeSeccompOperation(int) libcesque; const char *_DescribeSeccompOperation(int) libcesque;
const char *DescribeSiCode(char[20], int, int) libcesque; const char *_DescribeSiCode(char[20], int, int) libcesque;
const char *DescribeSigaltstackFlags(char[22], int) libcesque; const char *_DescribeSigaltstackFlags(char[22], int) libcesque;
const char *DescribeSleepFlags(char[16], int) libcesque; const char *_DescribeSleepFlags(char[16], int) libcesque;
const char *DescribeSockLevel(char[12], int) libcesque; const char *_DescribeSockLevel(char[12], int) libcesque;
const char *DescribeSockOptname(char[32], int, int) libcesque; const char *_DescribeSockOptname(char[32], int, int) libcesque;
const char *DescribeSocketFamily(char[12], int) libcesque; const char *_DescribeSocketFamily(char[12], int) libcesque;
const char *DescribeSocketProtocol(char[12], int) libcesque; const char *_DescribeSocketProtocol(char[12], int) libcesque;
const char *DescribeSocketType(char[64], int) libcesque; const char *_DescribeSocketType(char[64], int) libcesque;
const char *DescribeStdioState(char[12], int) libcesque; const char *_DescribeStdioState(char[12], int) libcesque;
const char *DescribeStringList(char[300], char *const[]) libcesque; const char *_DescribeStringList(char[300], char *const[]) libcesque;
const char *DescribeThreadCreateFlags(char[64], uint32_t) libcesque; const char *_DescribeThreadCreateFlags(char[64], uint32_t) libcesque;
const char *DescribeVirtualKeyCode(char[32], uint32_t) libcesque; const char *_DescribeVirtualKeyCode(char[32], uint32_t) libcesque;
const char *DescribeWhence(char[12], int) libcesque; const char *_DescribeWhence(char[12], int) libcesque;
const char *DescribeWhichPrio(char[12], int) libcesque; const char *_DescribeWhichPrio(char[12], int) libcesque;
#define DescribeCancelState(x, y) DescribeCancelState(alloca(12), x, y) #define DescribeCancelState(x, y) _DescribeCancelState(alloca(12), x, y)
#define DescribeClockName(x) DescribeClockName(alloca(32), x) #define DescribeClockName(x) _DescribeClockName(alloca(32), x)
#define DescribeControlKeyState(x) DescribeControlKeyState(alloca(64), x) #define DescribeControlKeyState(x) _DescribeControlKeyState(alloca(64), x)
#define DescribeDirfd(x) DescribeDirfd(alloca(12), x) #define DescribeDirfd(x) _DescribeDirfd(alloca(12), x)
#define DescribeDnotifyFlags(x) DescribeDnotifyFlags(alloca(80), x) #define DescribeDnotifyFlags(x) _DescribeDnotifyFlags(alloca(80), x)
#define DescribeErrno(x) DescribeErrno(alloca(30), x) #define DescribeErrno(x) _DescribeErrno(alloca(30), x)
#define DescribeFcntlCmd(x) DescribeFcntlCmd(alloca(20), x) #define DescribeFcntlCmd(x) _DescribeFcntlCmd(alloca(20), x)
#define DescribeFlockType(x) DescribeFlockType(alloca(12), x) #define DescribeFlockType(x) _DescribeFlockType(alloca(12), x)
#define DescribeFutexOp(x) DescribeFutexOp(alloca(64), x) #define DescribeFutexOp(x) _DescribeFutexOp(alloca(64), x)
#define DescribeHow(x) DescribeHow(alloca(12), x) #define DescribeHow(x) _DescribeHow(alloca(12), x)
#define DescribeInOutInt64(rc, x) DescribeInOutInt64(alloca(23), rc, x) #define DescribeInOutInt64(rc, x) _DescribeInOutInt64(alloca(23), rc, x)
#define DescribeItimer(x) DescribeItimer(alloca(12), x) #define DescribeItimer(x) _DescribeItimer(alloca(12), x)
#define DescribeMapFlags(x) DescribeMapFlags(alloca(64), x) #define DescribeMapFlags(x) _DescribeMapFlags(alloca(64), x)
#define DescribeMapping(x, y) DescribeMapping(alloca(8), x, y) #define DescribeMapping(x, y) _DescribeMapping(alloca(8), x, y)
#define DescribeMremapFlags(x) DescribeMremapFlags(alloca(30), x) #define DescribeMremapFlags(x) _DescribeMremapFlags(alloca(30), x)
#define DescribeMsyncFlags(x) DescribeMsyncFlags(alloca(48), x) #define DescribeMsyncFlags(x) _DescribeMsyncFlags(alloca(48), x)
#define DescribeNtConsoleInFlags(x) DescribeNtConsoleInFlags(alloca(256), x) #define DescribeNtConsoleInFlags(x) _DescribeNtConsoleInFlags(alloca(256), x)
#define DescribeNtConsoleOutFlags(x) DescribeNtConsoleOutFlags(alloca(128), x) #define DescribeNtConsoleOutFlags(x) _DescribeNtConsoleOutFlags(alloca(128), x)
#define DescribeNtFileAccessFlags(x) DescribeNtFileAccessFlags(alloca(512), x) #define DescribeNtFileAccessFlags(x) _DescribeNtFileAccessFlags(alloca(512), x)
#define DescribeNtFileFlagAttr(x) DescribeNtFileFlagAttr(alloca(256), x) #define DescribeNtFileFlagAttr(x) _DescribeNtFileFlagAttr(alloca(256), x)
#define DescribeNtFileMapFlags(x) DescribeNtFileMapFlags(alloca(64), x) #define DescribeNtFileMapFlags(x) _DescribeNtFileMapFlags(alloca(64), x)
#define DescribeNtFileShareFlags(x) DescribeNtFileShareFlags(alloca(64), x) #define DescribeNtFileShareFlags(x) _DescribeNtFileShareFlags(alloca(64), x)
#define DescribeNtFiletypeFlags(x) DescribeNtFiletypeFlags(alloca(64), x) #define DescribeNtFiletypeFlags(x) _DescribeNtFiletypeFlags(alloca(64), x)
#define DescribeNtLockFileFlags(x) DescribeNtLockFileFlags(alloca(64), x) #define DescribeNtLockFileFlags(x) _DescribeNtLockFileFlags(alloca(64), x)
#define DescribeNtMovFileInpFlags(x) DescribeNtMovFileInpFlags(alloca(256), x) #define DescribeNtMovFileInpFlags(x) _DescribeNtMovFileInpFlags(alloca(256), x)
#define DescribeNtPageFlags(x) DescribeNtPageFlags(alloca(64), x) #define DescribeNtPageFlags(x) _DescribeNtPageFlags(alloca(64), x)
#define DescribeNtPipeModeFlags(x) DescribeNtPipeModeFlags(alloca(64), x) #define DescribeNtPipeModeFlags(x) _DescribeNtPipeModeFlags(alloca(64), x)
#define DescribeNtPipeOpenFlags(x) DescribeNtPipeOpenFlags(alloca(64), x) #define DescribeNtPipeOpenFlags(x) _DescribeNtPipeOpenFlags(alloca(64), x)
#define DescribeNtProcAccessFlags(x) DescribeNtProcAccessFlags(alloca(256), x) #define DescribeNtProcAccessFlags(x) _DescribeNtProcAccessFlags(alloca(256), x)
#define DescribeNtStartFlags(x) DescribeNtStartFlags(alloca(128), x) #define DescribeNtStartFlags(x) _DescribeNtStartFlags(alloca(128), x)
#define DescribeNtSymlinkFlags(x) DescribeNtSymlinkFlags(alloca(64), x) #define DescribeNtSymlinkFlags(x) _DescribeNtSymlinkFlags(alloca(64), x)
#define DescribeOpenFlags(x) DescribeOpenFlags(alloca(128), x) #define DescribeOpenFlags(x) _DescribeOpenFlags(alloca(128), x)
#define DescribeOpenMode(x, y) DescribeOpenMode(alloca(15), x, y) #define DescribeOpenMode(x, y) _DescribeOpenMode(alloca(15), x, y)
#define DescribePersonalityFlags(p) DescribePersonalityFlags(alloca(128), p) #define DescribePersonalityFlags(p) _DescribePersonalityFlags(alloca(128), p)
#define DescribePollFlags(p) DescribePollFlags(alloca(64), p) #define DescribePollFlags(p) _DescribePollFlags(alloca(64), p)
#define DescribeProtFlags(x) DescribeProtFlags(alloca(48), x) #define DescribeProtFlags(x) _DescribeProtFlags(alloca(48), x)
#define DescribePtrace(i) DescribePtrace(alloca(12), i) #define DescribePtrace(i) _DescribePtrace(alloca(12), i)
#define DescribePtraceEvent(x) DescribePtraceEvent(alloca(32), x) #define DescribePtraceEvent(x) _DescribePtraceEvent(alloca(32), x)
#define DescribeRlimitName(rl) DescribeRlimitName(alloca(20), rl) #define DescribeRlimitName(rl) _DescribeRlimitName(alloca(20), rl)
#define DescribeSchedPolicy(x) DescribeSchedPolicy(alloca(48), x) #define DescribeSchedPolicy(x) _DescribeSchedPolicy(alloca(48), x)
#define DescribeSiCode(x, y) DescribeSiCode(alloca(20), x, y) #define DescribeSiCode(x, y) _DescribeSiCode(alloca(20), x, y)
#define DescribeSigaltstackFlags(x) DescribeSigaltstackFlags(alloca(22), x) #define DescribeSigaltstackFlags(x) _DescribeSigaltstackFlags(alloca(22), x)
#define DescribeSleepFlags(x) DescribeSleepFlags(alloca(16), x) #define DescribeSleepFlags(x) _DescribeSleepFlags(alloca(16), x)
#define DescribeSockLevel(x) DescribeSockLevel(alloca(12), x) #define DescribeSockLevel(x) _DescribeSockLevel(alloca(12), x)
#define DescribeSockOptname(x, y) DescribeSockOptname(alloca(32), x, y) #define DescribeSockOptname(x, y) _DescribeSockOptname(alloca(32), x, y)
#define DescribeSocketFamily(x) DescribeSocketFamily(alloca(12), x) #define DescribeSocketFamily(x) _DescribeSocketFamily(alloca(12), x)
#define DescribeSocketProtocol(x) DescribeSocketProtocol(alloca(12), x) #define DescribeSocketProtocol(x) _DescribeSocketProtocol(alloca(12), x)
#define DescribeSocketType(x) DescribeSocketType(alloca(64), x) #define DescribeSocketType(x) _DescribeSocketType(alloca(64), x)
#define DescribeStdioState(x) DescribeStdioState(alloca(12), x) #define DescribeStdioState(x) _DescribeStdioState(alloca(12), x)
#define DescribeStringList(x) DescribeStringList(alloca(300), x) #define DescribeStringList(x) _DescribeStringList(alloca(300), x)
#define DescribeThreadCreateFlags(x) DescribeThreadCreateFlags(alloca(64), x) #define DescribeThreadCreateFlags(x) _DescribeThreadCreateFlags(alloca(64), x)
#define DescribeVirtualKeyCode(x) DescribeVirtualKeyCode(alloca(32), x) #define DescribeVirtualKeyCode(x) _DescribeVirtualKeyCode(alloca(32), x)
#define DescribeWhence(x) DescribeWhence(alloca(12), x) #define DescribeWhence(x) _DescribeWhence(alloca(12), x)
#define DescribeWhichPrio(x) DescribeWhichPrio(alloca(12), x) #define DescribeWhichPrio(x) _DescribeWhichPrio(alloca(12), x)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEFLAGS_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEFLAGS_INTERNAL_H_ */

View file

@ -27,7 +27,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeFlock)(char buf[N], int cmd, const struct flock *l) { const char *_DescribeFlock(char buf[N], int cmd, const struct flock *l) {
int o = 0; int o = 0;
if (!l) if (!l)

View file

@ -19,7 +19,7 @@
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/sysv/consts/f.h" #include "libc/sysv/consts/f.h"
const char *(DescribeFlockType)(char buf[12], int x) { const char *_DescribeFlockType(char buf[12], int x) {
if (x == F_RDLCK) if (x == F_RDLCK)
return "F_RDLCK"; return "F_RDLCK";
if (x == F_WRLCK) if (x == F_WRLCK)

View file

@ -21,7 +21,7 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/futex.h" #include "libc/sysv/consts/futex.h"
const char *(DescribeFutexOp)(char buf[64], int x) { const char *_DescribeFutexOp(char buf[64], int x) {
bool priv = false; bool priv = false;
if (x & FUTEX_PRIVATE_FLAG) { if (x & FUTEX_PRIVATE_FLAG) {

View file

@ -25,7 +25,7 @@
#define N 128 #define N 128
const char *(DescribeGidList)(char buf[N], int rc, int size, const char *_DescribeGidList(char buf[N], int rc, int size,
const uint32_t list[]) { const uint32_t list[]) {
if ((rc == -1) || (size < 0)) if ((rc == -1) || (size < 0))
return "n/a"; return "n/a";

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/sig.h" #include "libc/sysv/consts/sig.h"
const char *(DescribeHow)(char buf[12], int how) { const char *_DescribeHow(char buf[12], int how) {
if (how == SIG_BLOCK) if (how == SIG_BLOCK)
return "SIG_BLOCK"; return "SIG_BLOCK";
if (how == SIG_UNBLOCK) if (how == SIG_UNBLOCK)

View file

@ -20,7 +20,7 @@
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
const char *(DescribeInOutInt64)(char buf[23], ssize_t rc, int64_t *x) { const char *_DescribeInOutInt64(char buf[23], ssize_t rc, int64_t *x) {
if (!x) if (!x)
return "NULL"; return "NULL";
char *p = buf; char *p = buf;

View file

@ -27,7 +27,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeIovec)(char buf[N], ssize_t rc, const struct iovec *iov, const char *_DescribeIovec(char buf[N], ssize_t rc, const struct iovec *iov,
int iovlen) { int iovlen) {
const char *d; const char *d;
int i, j, o = 0; int i, j, o = 0;

View file

@ -22,7 +22,7 @@
#include "libc/macros.h" #include "libc/macros.h"
#include "libc/nt/winsock.h" #include "libc/nt/winsock.h"
void DescribeIovNt(const struct NtIovec *iov, uint32_t iovlen, ssize_t rem) { void _DescribeIovNt(const struct NtIovec *iov, uint32_t iovlen, ssize_t rem) {
int i; int i;
if (kisdangerous(iov)) { if (kisdangerous(iov)) {
kprintf("%p", iov); kprintf("%p", iov);

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/itimer.h" #include "libc/sysv/consts/itimer.h"
const char *(DescribeItimer)(char buf[12], int which) { const char *_DescribeItimer(char buf[12], int which) {
if (which == ITIMER_REAL) if (which == ITIMER_REAL)
return "ITIMER_REAL"; return "ITIMER_REAL";
if (which == ITIMER_VIRTUAL) if (which == ITIMER_VIRTUAL)

View file

@ -25,7 +25,7 @@
#define N 90 #define N 90
const char *(DescribeItimerval)(char buf[N], int rc, const char *_DescribeItimerval(char buf[N], int rc,
const struct itimerval *it) { const struct itimerval *it) {
if (!it) if (!it)
return "NULL"; return "NULL";

View file

@ -20,7 +20,7 @@
#include "libc/fmt/magnumstrs.internal.h" #include "libc/fmt/magnumstrs.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
const char *DescribeMagnum(char *b, const struct MagnumStr *m, const char *p, const char *_DescribeMagnum(char *b, const struct MagnumStr *m, const char *p,
int x) { int x) {
const char *s; const char *s;
if (x == 127) if (x == 127)

View file

@ -22,7 +22,7 @@
#include "libc/sysv/consts/map.h" #include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"
const char *(DescribeMapFlags)(char buf[64], int x) { const char *_DescribeMapFlags(char buf[64], int x) {
const struct DescribeFlags kMapFlags[] = { const struct DescribeFlags kMapFlags[] = {
{MAP_PRIVATE, "PRIVATE"}, // {MAP_PRIVATE, "PRIVATE"}, //
{MAP_ANONYMOUS, "ANONYMOUS"}, // {MAP_ANONYMOUS, "ANONYMOUS"}, //
@ -36,5 +36,5 @@ const char *(DescribeMapFlags)(char buf[64], int x) {
{MAP_NONBLOCK, "NONBLOCK"}, // {MAP_NONBLOCK, "NONBLOCK"}, //
{MAP_POPULATE, "POPULATE"}, // {MAP_POPULATE, "POPULATE"}, //
}; };
return DescribeFlags(buf, 64, kMapFlags, ARRAYLEN(kMapFlags), "MAP_", x); return _DescribeFlags(buf, 64, kMapFlags, ARRAYLEN(kMapFlags), "MAP_", x);
} }

View file

@ -45,7 +45,7 @@ char *DescribeProt(char p[4], int prot) {
return p; return p;
} }
const char *(DescribeMapping)(char p[8], int prot, int flags) { const char *_DescribeMapping(char p[8], int prot, int flags) {
/* asan runtime depends on this function */ /* asan runtime depends on this function */
DescribeProt(p, prot); DescribeProt(p, prot);
p[3] = DescribeMapType(flags); p[3] = DescribeMapType(flags);

View file

@ -25,7 +25,7 @@ static const struct DescribeFlags kMremapFlags[] = {
{MREMAP_FIXED, "FIXED"}, // {MREMAP_FIXED, "FIXED"}, //
}; };
const char *(DescribeMremapFlags)(char buf[30], int x) { const char *_DescribeMremapFlags(char buf[30], int x) {
return DescribeFlags(buf, 30, kMremapFlags, ARRAYLEN(kMremapFlags), "MREMAP_", return _DescribeFlags(buf, 30, kMremapFlags, ARRAYLEN(kMremapFlags),
x); "MREMAP_", x);
} }

View file

@ -20,11 +20,11 @@
#include "libc/macros.h" #include "libc/macros.h"
#include "libc/sysv/consts/msync.h" #include "libc/sysv/consts/msync.h"
const char *(DescribeMsyncFlags)(char buf[48], int x) { const char *_DescribeMsyncFlags(char buf[48], int x) {
const struct DescribeFlags kMsyncFlags[] = { const struct DescribeFlags kMsyncFlags[] = {
{MS_SYNC, "SYNC"}, // {MS_SYNC, "SYNC"}, //
{MS_ASYNC, "ASYNC"}, // {MS_ASYNC, "ASYNC"}, //
{MS_INVALIDATE, "INVALIDATE"}, // {MS_INVALIDATE, "INVALIDATE"}, //
}; };
return DescribeFlags(buf, 48, kMsyncFlags, ARRAYLEN(kMsyncFlags), "MS_", x); return _DescribeFlags(buf, 48, kMsyncFlags, ARRAYLEN(kMsyncFlags), "MS_", x);
} }

View file

@ -33,7 +33,7 @@ static const struct DescribeFlags kConsoleModeInputFlags[] = {
{kNtEnableVirtualTerminalInput, "VirtualTerminalInput"}, // {kNtEnableVirtualTerminalInput, "VirtualTerminalInput"}, //
}; };
const char *(DescribeNtConsoleInFlags)(char buf[256], uint32_t x) { const char *_DescribeNtConsoleInFlags(char buf[256], uint32_t x) {
return DescribeFlags(buf, 256, kConsoleModeInputFlags, return _DescribeFlags(buf, 256, kConsoleModeInputFlags,
ARRAYLEN(kConsoleModeInputFlags), "kNtEnable", x); ARRAYLEN(kConsoleModeInputFlags), "kNtEnable", x);
} }

View file

@ -28,7 +28,7 @@ static const struct DescribeFlags kConsoleModeOutputFlags[] = {
{kNtEnableLvbGridWorldwide, "EnableLvbGridWorldwide"}, // {kNtEnableLvbGridWorldwide, "EnableLvbGridWorldwide"}, //
}; };
const char *(DescribeNtConsoleOutFlags)(char buf[128], uint32_t x) { const char *_DescribeNtConsoleOutFlags(char buf[128], uint32_t x) {
return DescribeFlags(buf, 128, kConsoleModeOutputFlags, return _DescribeFlags(buf, 128, kConsoleModeOutputFlags,
ARRAYLEN(kConsoleModeOutputFlags), "kNt", x); ARRAYLEN(kConsoleModeOutputFlags), "kNt", x);
} }

View file

@ -19,7 +19,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/nt/enum/creationdisposition.h" #include "libc/nt/enum/creationdisposition.h"
const char *DescribeNtCreationDisposition(uint32_t x) { const char *_DescribeNtCreationDisposition(uint32_t x) {
switch (x) { switch (x) {
case kNtCreateNew: case kNtCreateNew:
return "kNtCreateNew"; return "kNtCreateNew";

View file

@ -72,7 +72,7 @@ static const struct DescribeFlags kFileAccessflags[] = {
{kNtTokenAdjustSessionid, "kNtTokenAdjustSessionid"}, {kNtTokenAdjustSessionid, "kNtTokenAdjustSessionid"},
}; };
const char *(DescribeNtFileAccessFlags)(char buf[512], uint32_t x) { const char *_DescribeNtFileAccessFlags(char buf[512], uint32_t x) {
return DescribeFlags(buf, 512, kFileAccessflags, ARRAYLEN(kFileAccessflags), return _DescribeFlags(buf, 512, kFileAccessflags, ARRAYLEN(kFileAccessflags),
"", x); "", x);
} }

View file

@ -50,9 +50,9 @@ static const struct DescribeFlags kFileFlags[] = {
{kNtFileFlagFirstPipeInstance, "FlagFirstPipeInstance"}, // {kNtFileFlagFirstPipeInstance, "FlagFirstPipeInstance"}, //
}; };
const char *(DescribeNtFileFlagAttr)(char buf[256], uint32_t x) { const char *_DescribeNtFileFlagAttr(char buf[256], uint32_t x) {
if (x == -1u) if (x == -1u)
return "-1u"; return "-1u";
return DescribeFlags(buf, 256, kFileFlags, ARRAYLEN(kFileFlags), "kNtFile", return _DescribeFlags(buf, 256, kFileFlags, ARRAYLEN(kFileFlags), "kNtFile",
x); x);
} }

View file

@ -30,7 +30,7 @@ static const struct DescribeFlags kFileMapFlags[] = {
{kNtFileMapLargePages, "LargePages"}, // {kNtFileMapLargePages, "LargePages"}, //
}; };
const char *(DescribeNtFileMapFlags)(char buf[64], uint32_t x) { const char *_DescribeNtFileMapFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kFileMapFlags, ARRAYLEN(kFileMapFlags), return _DescribeFlags(buf, 64, kFileMapFlags, ARRAYLEN(kFileMapFlags),
"kNtFileMap", x); "kNtFileMap", x);
} }

View file

@ -26,7 +26,7 @@ static const struct DescribeFlags kFileShareflags[] = {
{kNtFileShareDelete, "Delete"}, // {kNtFileShareDelete, "Delete"}, //
}; };
const char *(DescribeNtFileShareFlags)(char buf[64], uint32_t x) { const char *_DescribeNtFileShareFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kFileShareflags, ARRAYLEN(kFileShareflags), return _DescribeFlags(buf, 64, kFileShareflags, ARRAYLEN(kFileShareflags),
"kNtFileShare", x); "kNtFileShare", x);
} }

View file

@ -28,7 +28,7 @@ static const struct DescribeFlags kFiletypeFlags[] = {
{kNtFileTypeChar, "Char"}, // {kNtFileTypeChar, "Char"}, //
}; };
const char *(DescribeNtFiletypeFlags)(char buf[64], uint32_t x) { const char *_DescribeNtFiletypeFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kFiletypeFlags, ARRAYLEN(kFiletypeFlags), return _DescribeFlags(buf, 64, kFiletypeFlags, ARRAYLEN(kFiletypeFlags),
"kNtFileType", x); "kNtFileType", x);
} }

View file

@ -25,7 +25,7 @@ static const struct DescribeFlags kNtLockFileFlags[] = {
{kNtLockfileExclusiveLock, "ExclusiveLock"}, // {kNtLockfileExclusiveLock, "ExclusiveLock"}, //
}; };
const char *(DescribeNtLockFileFlags)(char buf[64], uint32_t x) { const char *_DescribeNtLockFileFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kNtLockFileFlags, ARRAYLEN(kNtLockFileFlags), return _DescribeFlags(buf, 64, kNtLockFileFlags, ARRAYLEN(kNtLockFileFlags),
"kNtLockfile", x); "kNtLockfile", x);
} }

View file

@ -29,7 +29,7 @@ static const struct DescribeFlags kMoveFileInputFlags[] = {
{kNtMovefileFailIfNotTrackable, "FailIfNotTrackable"}, // {kNtMovefileFailIfNotTrackable, "FailIfNotTrackable"}, //
}; };
const char *(DescribeNtMovFileInpFlags)(char buf[256], uint32_t x) { const char *_DescribeNtMovFileInpFlags(char buf[256], uint32_t x) {
return DescribeFlags(buf, 256, kMoveFileInputFlags, return _DescribeFlags(buf, 256, kMoveFileInputFlags,
ARRAYLEN(kMoveFileInputFlags), "kNtMovefile", x); ARRAYLEN(kMoveFileInputFlags), "kNtMovefile", x);
} }

View file

@ -20,7 +20,7 @@
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/macros.h" #include "libc/macros.h"
const char *(DescribeNtOverlapped)(char b[128], const struct NtOverlapped *o) { const char *_DescribeNtOverlapped(char b[128], const struct NtOverlapped *o) {
int i = 0, n = 128; int i = 0, n = 128;
bool gotsome = false; bool gotsome = false;
if (!o) if (!o)

View file

@ -4,8 +4,8 @@
#include "libc/nt/struct/overlapped.h" #include "libc/nt/struct/overlapped.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
const char *DescribeNtOverlapped(char[128], const struct NtOverlapped *); const char *_DescribeNtOverlapped(char[128], const struct NtOverlapped *);
#define DescribeNtOverlapped(x) DescribeNtOverlapped(alloca(128), x) #define DescribeNtOverlapped(x) _DescribeNtOverlapped(alloca(128), x)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBENTOVERLAPPED_INTERNAL_H_ */ #endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBENTOVERLAPPED_INTERNAL_H_ */

View file

@ -41,6 +41,6 @@ static const struct DescribeFlags kPageFlags[] = {
{kNtSecWritecombine, "SecWritecombine"}, // {kNtSecWritecombine, "SecWritecombine"}, //
}; };
const char *(DescribeNtPageFlags)(char buf[64], uint32_t x) { const char *_DescribeNtPageFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kPageFlags, ARRAYLEN(kPageFlags), "kNt", x); return _DescribeFlags(buf, 64, kPageFlags, ARRAYLEN(kPageFlags), "kNt", x);
} }

View file

@ -32,7 +32,7 @@ static const struct DescribeFlags kPipeModeFlags[] = {
//{kNtPipeTypeByte, "TypeByte"}, // 0x00000000 //{kNtPipeTypeByte, "TypeByte"}, // 0x00000000
}; };
const char *(DescribeNtPipeModeFlags)(char buf[64], uint32_t x) { const char *_DescribeNtPipeModeFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kPipeModeFlags, ARRAYLEN(kPipeModeFlags), return _DescribeFlags(buf, 64, kPipeModeFlags, ARRAYLEN(kPipeModeFlags),
"kNtPipe", x); "kNtPipe", x);
} }

View file

@ -35,7 +35,7 @@ static const struct DescribeFlags kPipeOpenFlags[] = {
{kNtAccessSystemSecurity, "kNtAccessSystemSecurity"}, {kNtAccessSystemSecurity, "kNtAccessSystemSecurity"},
}; };
const char *(DescribeNtPipeOpenFlags)(char buf[64], uint32_t x) { const char *_DescribeNtPipeOpenFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kPipeOpenFlags, ARRAYLEN(kPipeOpenFlags), "", return _DescribeFlags(buf, 64, kPipeOpenFlags, ARRAYLEN(kPipeOpenFlags), "",
x); x);
} }

View file

@ -37,7 +37,7 @@ static const struct DescribeFlags kProcessAccessflags[] = {
{kNtProcessSynchronize, "Synchronize"}, // {kNtProcessSynchronize, "Synchronize"}, //
}; };
const char *(DescribeNtProcAccessFlags)(char buf[256], uint32_t x) { const char *_DescribeNtProcAccessFlags(char buf[256], uint32_t x) {
return DescribeFlags(buf, 256, kProcessAccessflags, return _DescribeFlags(buf, 256, kProcessAccessflags,
ARRAYLEN(kProcessAccessflags), "kNtProcess", x); ARRAYLEN(kProcessAccessflags), "kNtProcess", x);
} }

View file

@ -21,9 +21,8 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/nt/struct/securityattributes.h" #include "libc/nt/struct/securityattributes.h"
const char *( const char *_DescribeNtSecurityAttributes(
DescribeNtSecurityAttributes)(char buf[32], char buf[32], const struct NtSecurityAttributes *p) {
const struct NtSecurityAttributes *p) {
FormatInt64(buf, (uintptr_t)p); FormatInt64(buf, (uintptr_t)p);
return buf; return buf;
} }

View file

@ -38,7 +38,7 @@ static const struct DescribeFlags kNtStartFlags[] = {
{kNtStartfUntrustedsource, "Untrustedsource"}, // {kNtStartfUntrustedsource, "Untrustedsource"}, //
}; };
const char *(DescribeNtStartFlags)(char buf[128], uint32_t x) { const char *_DescribeNtStartFlags(char buf[128], uint32_t x) {
return DescribeFlags(buf, 128, kNtStartFlags, ARRAYLEN(kNtStartFlags), return _DescribeFlags(buf, 128, kNtStartFlags, ARRAYLEN(kNtStartFlags),
"kNtStartf", x); "kNtStartf", x);
} }

View file

@ -25,7 +25,7 @@ static const struct DescribeFlags kSymbolicLinkflags[] = {
{kNtSymbolicLinkFlagAllowUnprivilegedCreate, "AllowUnprivilegedCreate"}, // {kNtSymbolicLinkFlagAllowUnprivilegedCreate, "AllowUnprivilegedCreate"}, //
}; };
const char *(DescribeNtSymlinkFlags)(char buf[64], uint32_t x) { const char *_DescribeNtSymlinkFlags(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kSymbolicLinkflags, return _DescribeFlags(buf, 64, kSymbolicLinkflags,
ARRAYLEN(kSymbolicLinkflags), "kNtSymbolicLinkFlag", x); ARRAYLEN(kSymbolicLinkflags), "kNtSymbolicLinkFlag", x);
} }

View file

@ -30,7 +30,7 @@
/** /**
* Describes clock_gettime() clock argument. * Describes clock_gettime() clock argument.
*/ */
const char *(DescribeOpenFlags)(char buf[128], int x) { const char *_DescribeOpenFlags(char buf[128], int x) {
char *p; char *p;
int i, n; int i, n;
const char *pipe; const char *pipe;
@ -68,7 +68,7 @@ const char *(DescribeOpenFlags)(char buf[128], int x) {
d[i].flag = MAGNUM_NUMBER(kOpenFlags, i); d[i].flag = MAGNUM_NUMBER(kOpenFlags, i);
d[i].name = MAGNUM_STRING(kOpenFlags, i); d[i].name = MAGNUM_STRING(kOpenFlags, i);
} }
DescribeFlags(p, 128 - (p - buf), d, n, "O_", x); _DescribeFlags(p, 128 - (p - buf), d, n, "O_", x);
} }
return buf; return buf;
} }

View file

@ -28,7 +28,7 @@ static bool IsCreatingFile(int flags) {
(IsLinux() && (flags & O_TMPFILE_LINUX) == O_TMPFILE_LINUX); (IsLinux() && (flags & O_TMPFILE_LINUX) == O_TMPFILE_LINUX);
} }
const char *(DescribeOpenMode)(char buf[15], int flags, int mode) { const char *_DescribeOpenMode(char buf[15], int flags, int mode) {
if (!IsCreatingFile(flags)) { if (!IsCreatingFile(flags)) {
return ""; return "";
} }

View file

@ -36,7 +36,7 @@ static const struct DescribeFlags kPersonalityFlags[] = {
{UNAME26, "UNAME26"}, // {UNAME26, "UNAME26"}, //
}; };
const char *(DescribePersonalityFlags)(char buf[128], int x) { const char *_DescribePersonalityFlags(char buf[128], int x) {
return DescribeFlags(buf, 128, kPersonalityFlags, ARRAYLEN(kPersonalityFlags), return _DescribeFlags(buf, 128, kPersonalityFlags,
"", x); ARRAYLEN(kPersonalityFlags), "", x);
} }

View file

@ -28,7 +28,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribePollFds)(char buf[N], ssize_t rc, struct pollfd *fds, const char *_DescribePollFds(char buf[N], ssize_t rc, struct pollfd *fds,
size_t nfds) { size_t nfds) {
char b64[64]; char b64[64];
int i, o = 0; int i, o = 0;
@ -45,9 +45,9 @@ const char *(DescribePollFds)(char buf[N], ssize_t rc, struct pollfd *fds,
for (i = 0; i < nfds; ++i) { for (i = 0; i < nfds; ++i) {
if (i) if (i)
append(", "); append(", ");
append("{%d, %s", fds[i].fd, (DescribePollFlags)(b64, fds[i].events)); append("{%d, %s", fds[i].fd, _DescribePollFlags(b64, fds[i].events));
if (rc >= 0) { if (rc >= 0) {
append(", [%s]", (DescribePollFlags)(b64, fds[i].revents)); append(", [%s]", _DescribePollFlags(b64, fds[i].revents));
} }
append("}"); append("}");
} }

View file

@ -21,7 +21,7 @@
#include "libc/nt/enum/filemapflags.h" #include "libc/nt/enum/filemapflags.h"
#include "libc/sysv/consts/poll.h" #include "libc/sysv/consts/poll.h"
const char *(DescribePollFlags)(char buf[64], int x) { const char *_DescribePollFlags(char buf[64], int x) {
const struct DescribeFlags kPollFlags[] = { const struct DescribeFlags kPollFlags[] = {
{POLLIN, "IN"}, // order matters {POLLIN, "IN"}, // order matters
{POLLOUT, "OUT"}, // order matters {POLLOUT, "OUT"}, // order matters
@ -35,5 +35,5 @@ const char *(DescribePollFlags)(char buf[64], int x) {
{POLLWRBAND, "WRBAND"}, // {POLLWRBAND, "WRBAND"}, //
{POLLWRNORM, "WRNORM"}, // {POLLWRNORM, "WRNORM"}, //
}; };
return DescribeFlags(buf, 64, kPollFlags, ARRAYLEN(kPollFlags), "POLL", x); return _DescribeFlags(buf, 64, kPollFlags, ARRAYLEN(kPollFlags), "POLL", x);
} }

View file

@ -20,12 +20,12 @@
#include "libc/macros.h" #include "libc/macros.h"
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"
const char *(DescribeProtFlags)(char buf[48], int x) { const char *_DescribeProtFlags(char buf[48], int x) {
const struct DescribeFlags kProtFlags[] = { const struct DescribeFlags kProtFlags[] = {
{PROT_READ, "READ"}, // {PROT_READ, "READ"}, //
{PROT_WRITE, "WRITE"}, // {PROT_WRITE, "WRITE"}, //
{PROT_EXEC, "EXEC"}, // {PROT_EXEC, "EXEC"}, //
{PROT_GUARD, "GUARD"}, // {PROT_GUARD, "GUARD"}, //
}; };
return DescribeFlags(buf, 48, kProtFlags, ARRAYLEN(kProtFlags), "PROT_", x); return _DescribeFlags(buf, 48, kProtFlags, ARRAYLEN(kProtFlags), "PROT_", x);
} }

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/ptrace.h" #include "libc/sysv/consts/ptrace.h"
const char *(DescribePtrace)(char buf[12], int x) { const char *_DescribePtrace(char buf[12], int x) {
if (x == -1) if (x == -1)
return "-1"; return "-1";
if (x == PTRACE_TRACEME) if (x == PTRACE_TRACEME)

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/ptrace.h" #include "libc/sysv/consts/ptrace.h"
const char *(DescribePtraceEvent)(char buf[32], int x) { const char *_DescribePtraceEvent(char buf[32], int x) {
if (x == PTRACE_EVENT_FORK) if (x == PTRACE_EVENT_FORK)
return "PTRACE_EVENT_FORK"; return "PTRACE_EVENT_FORK";
if (x == PTRACE_EVENT_VFORK) if (x == PTRACE_EVENT_VFORK)

View file

@ -24,7 +24,7 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/rlim.h" #include "libc/sysv/consts/rlim.h"
const char *DescribeRlimit(char buf[64], int rc, const struct rlimit *rlim) { const char *_DescribeRlimit(char buf[64], int rc, const struct rlimit *rlim) {
if (rc == -1) if (rc == -1)
return "n/a"; return "n/a";
if (!rlim) if (!rlim)

View file

@ -22,8 +22,8 @@
/** /**
* Describes setrlimit() / getrlimit() argument. * Describes setrlimit() / getrlimit() argument.
*/ */
const char *(DescribeRlimitName)(char buf[20], int x) { const char *_DescribeRlimitName(char buf[20], int x) {
if (x == 127) if (x == 127)
return "n/a"; return "n/a";
return DescribeMagnum(buf, kRlimitNames, "RLIMIT_", x); return _DescribeMagnum(buf, kRlimitNames, "RLIMIT_", x);
} }

View file

@ -24,7 +24,7 @@
/** /**
* Describes clock_gettime() clock argument. * Describes clock_gettime() clock argument.
*/ */
const char *(DescribeSchedParam)(char buf[32], const struct sched_param *x) { const char *_DescribeSchedParam(char buf[32], const struct sched_param *x) {
char *p; char *p;
if (!x) if (!x)
return "0"; return "0";

View file

@ -26,7 +26,7 @@
/** /**
* Describes clock_gettime() clock argument. * Describes clock_gettime() clock argument.
*/ */
const char *(DescribeSchedPolicy)(char buf[48], int x) { const char *_DescribeSchedPolicy(char buf[48], int x) {
char *p = buf; char *p = buf;
if (x == -1) { if (x == -1) {
goto DoNumber; goto DoNumber;

View file

@ -19,7 +19,7 @@
#include "libc/calls/struct/seccomp.internal.h" #include "libc/calls/struct/seccomp.internal.h"
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
const char *DescribeSeccompOperation(int x) { const char *_DescribeSeccompOperation(int x) {
switch (x) { switch (x) {
case SECCOMP_SET_MODE_STRICT: case SECCOMP_SET_MODE_STRICT:
return "SECCOMP_SET_MODE_STRICT"; return "SECCOMP_SET_MODE_STRICT";

View file

@ -38,7 +38,7 @@ static void NameIt(char p[20], const char *s, int si_code) {
/** /**
* Returns symbolic name for siginfo::si_code value. * Returns symbolic name for siginfo::si_code value.
*/ */
const char *(DescribeSiCode)(char b[20], int sig, int si_code) { const char *_DescribeSiCode(char b[20], int sig, int si_code) {
NameIt(b, "SI_", si_code); NameIt(b, "SI_", si_code);
if (si_code == SI_QUEUE) { if (si_code == SI_QUEUE) {
strcpy(b + 3, "QUEUE"); /* sent by sigqueue(2) */ strcpy(b + 3, "QUEUE"); /* sent by sigqueue(2) */

View file

@ -51,14 +51,14 @@ static const char *DescribeSigFlags(char buf[64], int x) {
{SA_ONESHOT, "ONESHOT"}, // {SA_ONESHOT, "ONESHOT"}, //
{0x04000000, "RESTORER"}, // {0x04000000, "RESTORER"}, //
}; };
return DescribeFlags(buf, 64, kSigFlags, ARRAYLEN(kSigFlags), "SA_", x); return _DescribeFlags(buf, 64, kSigFlags, ARRAYLEN(kSigFlags), "SA_", x);
} }
#define N 256 #define N 256
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeSigaction)(char buf[N], int rc, const char *_DescribeSigaction(char buf[N], int rc,
const struct sigaction *sa) { const struct sigaction *sa) {
int o = 0; int o = 0;
char b64[64]; char b64[64];

View file

@ -21,7 +21,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
const char *(DescribeSigaltstack)(char buf[128], int rc, const char *_DescribeSigaltstack(char buf[128], int rc,
const struct sigaltstack *ss) { const struct sigaltstack *ss) {
if (rc == -1) if (rc == -1)
return "n/a"; return "n/a";

View file

@ -20,11 +20,11 @@
#include "libc/macros.h" #include "libc/macros.h"
#include "libc/sysv/consts/ss.h" #include "libc/sysv/consts/ss.h"
const char *(DescribeSigaltstackFlags)(char buf[22], int x) { const char *_DescribeSigaltstackFlags(char buf[22], int x) {
const struct DescribeFlags kSigaltstackFlags[] = { const struct DescribeFlags kSigaltstackFlags[] = {
{SS_ONSTACK, "ONSTACK"}, // {SS_ONSTACK, "ONSTACK"}, //
{SS_DISABLE, "DISABLE"}, // {SS_DISABLE, "DISABLE"}, //
}; };
return DescribeFlags(buf, 48, kSigaltstackFlags, ARRAYLEN(kSigaltstackFlags), return _DescribeFlags(buf, 48, kSigaltstackFlags, ARRAYLEN(kSigaltstackFlags),
"SS_", x); "SS_", x);
} }

View file

@ -29,7 +29,7 @@
#define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__) #define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__)
const char *(DescribeSiginfo)(char buf[N], int rc, const siginfo_t *si) { const char *_DescribeSiginfo(char buf[N], int rc, const siginfo_t *si) {
int i = 0; int i = 0;
if (rc == -1) if (rc == -1)

View file

@ -31,7 +31,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeSigset)(char buf[N], int rc, const sigset_t *ss) { const char *_DescribeSigset(char buf[N], int rc, const sigset_t *ss) {
int olderr; int olderr;
bool gotsome; bool gotsome;
const char *s; const char *s;

View file

@ -24,7 +24,7 @@
/** /**
* Describes clock_nanosleep() flags argument. * Describes clock_nanosleep() flags argument.
*/ */
const char *(DescribeSleepFlags)(char buf[16], int x) { const char *_DescribeSleepFlags(char buf[16], int x) {
switch (x) { switch (x) {
case 0: case 0:
return "0"; return "0";

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
const char *(DescribeSocketFamily)(char buf[12], int family) { const char *_DescribeSocketFamily(char buf[12], int family) {
if (family == AF_UNIX) if (family == AF_UNIX)
return "AF_UNIX"; return "AF_UNIX";
if (family == AF_INET) if (family == AF_INET)

View file

@ -20,7 +20,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/ipproto.h"
const char *(DescribeSocketProtocol)(char buf[12], int family) { const char *_DescribeSocketProtocol(char buf[12], int family) {
if (family == IPPROTO_IP) if (family == IPPROTO_IP)
return "IPPROTO_IP"; return "IPPROTO_IP";
if (family == IPPROTO_ICMP) if (family == IPPROTO_ICMP)

View file

@ -21,7 +21,7 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/sock.h" #include "libc/sysv/consts/sock.h"
const char *(DescribeSocketType)(char buf[64], int type) { const char *_DescribeSocketType(char buf[64], int type) {
int x; int x;
char *p; char *p;
p = buf; p = buf;

View file

@ -23,7 +23,7 @@
/** /**
* Describes setsockopt() level arguments. * Describes setsockopt() level arguments.
*/ */
const char *(DescribeSockLevel)(char buf[12], int x) { const char *_DescribeSockLevel(char buf[12], int x) {
if (x == SOL_SOCKET) if (x == SOL_SOCKET)
return "SOL_SOCKET"; return "SOL_SOCKET";
if (x == SOL_IP) if (x == SOL_IP)

View file

@ -25,7 +25,7 @@
/** /**
* Describes setsockopt() optname arguments. * Describes setsockopt() optname arguments.
*/ */
const char *(DescribeSockOptname)(char buf[32], int l, int x) { const char *_DescribeSockOptname(char buf[32], int l, int x) {
char *p; char *p;
const char *s; const char *s;
const struct MagnumStr *ms; const struct MagnumStr *ms;

View file

@ -25,7 +25,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeStat)(char buf[N], int rc, const struct stat *st) { const char *_DescribeStat(char buf[N], int rc, const struct stat *st) {
int o = 0; int o = 0;
if (rc == -1) if (rc == -1)

View file

@ -27,7 +27,7 @@
#define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__) #define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__)
const char *(DescribeStatfs)(char buf[N], int rc, const struct statfs *f) { const char *_DescribeStatfs(char buf[N], int rc, const struct statfs *f) {
int i = 0; int i = 0;
char ibuf[21]; char ibuf[21];
int64_t flags; int64_t flags;

View file

@ -21,7 +21,7 @@
#include "libc/intrin/describeflags.h" #include "libc/intrin/describeflags.h"
#include "libc/str/str.h" #include "libc/str/str.h"
const char *(DescribeStdioState)(char buf[12], int x) { const char *_DescribeStdioState(char buf[12], int x) {
if (!x) if (!x)
return ""; return "";
if (x == -1) if (x == -1)

View file

@ -24,7 +24,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeStringList)(char buf[N], char *const list[]) { const char *_DescribeStringList(char buf[N], char *const list[]) {
int i, o = 0; int i, o = 0;
if (!list) if (!list)

View file

@ -29,7 +29,7 @@
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeTermios)(char buf[N], ssize_t rc, const char *_DescribeTermios(char buf[N], ssize_t rc,
const struct termios *tio) { const struct termios *tio) {
int o = 0; int o = 0;
char b128[128]; char b128[128];
@ -61,7 +61,7 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc,
{IUTF8, "IUTF8"}, // {IUTF8, "IUTF8"}, //
}; };
append(".c_iflag=%s", append(".c_iflag=%s",
DescribeFlags(b128, 128, kInput, ARRAYLEN(kInput), "", tio->c_iflag)); _DescribeFlags(b128, 128, kInput, ARRAYLEN(kInput), "", tio->c_iflag));
struct DescribeFlags kOutput[] = { struct DescribeFlags kOutput[] = {
{OPOST, "OPOST"}, // {OPOST, "OPOST"}, //
@ -83,7 +83,7 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc,
{VT1, "VT1"}, // {VT1, "VT1"}, //
{FF1, "FF1"}, // {FF1, "FF1"}, //
}; };
append(", .c_oflag=%s", DescribeFlags(b128, 128, kOutput, ARRAYLEN(kOutput), append(", .c_oflag=%s", _DescribeFlags(b128, 128, kOutput, ARRAYLEN(kOutput),
"", tio->c_oflag)); "", tio->c_oflag));
struct DescribeFlags kControl[] = { struct DescribeFlags kControl[] = {
@ -98,8 +98,8 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc,
{CLOCAL, "CLOCAL"}, // {CLOCAL, "CLOCAL"}, //
{CRTSCTS, "CRTSCTS"}, // {CRTSCTS, "CRTSCTS"}, //
}; };
append(", .c_cflag=%s", DescribeFlags(b128, 128, kControl, ARRAYLEN(kControl), append(", .c_cflag=%s", _DescribeFlags(b128, 128, kControl,
"", tio->c_cflag)); ARRAYLEN(kControl), "", tio->c_cflag));
struct DescribeFlags kLocal[] = { struct DescribeFlags kLocal[] = {
{ISIG, "ISIG"}, // {ISIG, "ISIG"}, //
@ -125,7 +125,7 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc,
".c_cc[VTIME]=%d, " ".c_cc[VTIME]=%d, "
".c_cc[VINTR]=CTRL(%#c), " ".c_cc[VINTR]=CTRL(%#c), "
".c_cc[VQUIT]=CTRL(%#c)", ".c_cc[VQUIT]=CTRL(%#c)",
DescribeFlags(b128, 128, kLocal, ARRAYLEN(kLocal), "", tio->c_lflag), _DescribeFlags(b128, 128, kLocal, ARRAYLEN(kLocal), "", tio->c_lflag),
tio->c_cc[VMIN], tio->c_cc[VTIME], CTRL(tio->c_cc[VINTR]), tio->c_cc[VMIN], tio->c_cc[VTIME], CTRL(tio->c_cc[VINTR]),
CTRL(tio->c_cc[VQUIT])); CTRL(tio->c_cc[VQUIT]));

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