mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Improve mkdeps
Our makefile generator now accepts badly formatted include lines. It's now more hermetic with better error checking in the cosmo repo, and it can be configured to not be hermetic at all.
This commit is contained in:
parent
241f949540
commit
d2f49ca175
69 changed files with 466 additions and 533 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/stack.h"
|
||||
#include "libc/runtime/syslib.internal.h"
|
||||
#include "libc/sysv/consts/rlimit.h"
|
||||
|
|
|
@ -31,10 +31,6 @@ int64_t GetConsoleOutputHandle(void);
|
|||
int IsWindowsExecutable(int64_t, const char16_t *);
|
||||
void InterceptTerminalCommands(const char *, size_t);
|
||||
|
||||
forceinline int64_t __getfdhandleactual(int fd) {
|
||||
return g_fds.p[fd].handle;
|
||||
}
|
||||
|
||||
forceinline bool __isfdopen(int fd) {
|
||||
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind != kFdEmpty;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ static int ioctl_default(int fd, unsigned long request, void *arg) {
|
|||
return sys_ioctl(fd, request, arg);
|
||||
} else if (__isfdopen(fd)) {
|
||||
if (g_fds.p[fd].kind == kFdSocket) {
|
||||
handle = __getfdhandleactual(fd);
|
||||
handle = g_fds.p[fd].handle;
|
||||
if ((rc = _weaken(__sys_ioctlsocket_nt)(handle, request, arg)) != -1) {
|
||||
return rc;
|
||||
} else {
|
||||
|
|
|
@ -56,6 +56,6 @@ bool32 ischardev(int fd) {
|
|||
} else {
|
||||
return __isfdkind(fd, kFdConsole) || __isfdkind(fd, kFdDevNull) ||
|
||||
(__isfdkind(fd, kFdFile) &&
|
||||
GetFileType(__getfdhandleactual(fd)) == kNtFileTypeChar);
|
||||
GetFileType(g_fds.p[fd].handle) == kNtFileTypeChar);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/nexgen32e/yield.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/syslib.internal.h"
|
||||
#include "libc/thread/thread.h"
|
||||
|
@ -32,7 +31,7 @@ int pthread_yield(void) {
|
|||
if (IsXnuSilicon()) {
|
||||
__syslib->__pthread_yield_np();
|
||||
} else if (IsOpenbsd()) {
|
||||
spin_yield(); // sched_yield() is punishingly slow on OpenBSD
|
||||
pthread_pause_np(); // sched_yield() is punishingly slow on OpenBSD
|
||||
} else {
|
||||
sched_yield();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ struct Keystrokes {
|
|||
|
||||
static struct Keystrokes __keystroke;
|
||||
|
||||
textwindows void __keystroke_wipe(void) {
|
||||
textwindows void WipeKeystrokes(void) {
|
||||
bzero(&__keystroke, sizeof(__keystroke));
|
||||
}
|
||||
|
||||
|
@ -754,8 +754,8 @@ static textwindows ssize_t ReadFromConsole(struct Fd *f, void *data,
|
|||
return rc;
|
||||
}
|
||||
|
||||
textwindows ssize_t sys_read_nt_impl(int fd, void *data, size_t size,
|
||||
int64_t offset, sigset_t waitmask) {
|
||||
textwindows ssize_t ReadBuffer(int fd, void *data, size_t size, int64_t offset,
|
||||
sigset_t waitmask) {
|
||||
|
||||
// switch to terminal polyfill if reading from win32 console
|
||||
struct Fd *f = g_fds.p + fd;
|
||||
|
@ -786,9 +786,9 @@ textwindows ssize_t sys_read_nt_impl(int fd, void *data, size_t size,
|
|||
}
|
||||
}
|
||||
|
||||
static textwindows ssize_t sys_read_nt2(int fd, const struct iovec *iov,
|
||||
size_t iovlen, int64_t opt_offset,
|
||||
sigset_t waitmask) {
|
||||
static textwindows ssize_t ReadIovecs(int fd, const struct iovec *iov,
|
||||
size_t iovlen, int64_t opt_offset,
|
||||
sigset_t waitmask) {
|
||||
ssize_t rc;
|
||||
size_t i, total;
|
||||
if (opt_offset < -1) return einval();
|
||||
|
@ -796,8 +796,8 @@ static textwindows ssize_t sys_read_nt2(int fd, const struct iovec *iov,
|
|||
if (iovlen) {
|
||||
for (total = i = 0; i < iovlen; ++i) {
|
||||
if (!iov[i].iov_len) continue;
|
||||
rc = sys_read_nt_impl(fd, iov[i].iov_base, iov[i].iov_len, opt_offset,
|
||||
waitmask);
|
||||
rc =
|
||||
ReadBuffer(fd, iov[i].iov_base, iov[i].iov_len, opt_offset, waitmask);
|
||||
if (rc == -1) {
|
||||
if (total && errno != ECANCELED) {
|
||||
return total;
|
||||
|
@ -811,7 +811,7 @@ static textwindows ssize_t sys_read_nt2(int fd, const struct iovec *iov,
|
|||
}
|
||||
return total;
|
||||
} else {
|
||||
return sys_read_nt_impl(fd, NULL, 0, opt_offset, waitmask);
|
||||
return ReadBuffer(fd, NULL, 0, opt_offset, waitmask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -819,7 +819,7 @@ textwindows ssize_t sys_read_nt(int fd, const struct iovec *iov, size_t iovlen,
|
|||
int64_t opt_offset) {
|
||||
ssize_t rc;
|
||||
sigset_t m = __sig_block();
|
||||
rc = sys_read_nt2(fd, iov, iovlen, opt_offset, m);
|
||||
rc = ReadIovecs(fd, iov, iovlen, opt_offset, m);
|
||||
__sig_unblock(m);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/syslib.internal.h"
|
||||
#include "libc/sysv/consts/rlimit.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
|
|
@ -201,7 +201,6 @@ textwindows int __sig_raise(volatile int sig, int sic) {
|
|||
STRACE("__sig_raise(%G, %t) mask %s", sig, __sig_handler(rva),
|
||||
(DescribeSigset)(ssbuf, 0, (sigset_t *)&pt->tib->tib_sigmask));
|
||||
__sig_handler(rva)(sig, &si, &ctx);
|
||||
(void)ssbuf;
|
||||
|
||||
// record this handler
|
||||
if (flags & SA_RESTART) {
|
||||
|
@ -271,7 +270,6 @@ static textwindows wontreturn void __sig_tramp(struct SignalFrame *sf) {
|
|||
(DescribeSigset)(ssbuf[0], 0, &sf->ctx.uc_sigmask),
|
||||
(DescribeSigset)(ssbuf[1], 0, (sigset_t *)&tib->tib_sigmask));
|
||||
__sig_handler(sf->rva)(sig, &sf->si, &sf->ctx);
|
||||
(void)ssbuf;
|
||||
|
||||
// restore the signal mask that was used by the interrupted code
|
||||
// this may have been modified by the signal handler in the callback
|
||||
|
|
|
@ -51,7 +51,6 @@ int sigtimedwait(const sigset_t *set, siginfo_t *info,
|
|||
struct timespec ts;
|
||||
union siginfo_meta si = {0};
|
||||
BEGIN_CANCELATION_POINT;
|
||||
(void)strsig;
|
||||
|
||||
if (IsAsan() && (!__asan_is_valid(set, sizeof(*set)) ||
|
||||
(info && !__asan_is_valid(info, sizeof(*info))) ||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
||||
/**
|
||||
* Flushes file system changes to disk by any means necessary.
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/likely.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
||||
#define IsPeek(request) (IsLinux() && (request)-1u < 3)
|
||||
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
#include "libc/str/tab.internal.h"
|
||||
#include "third_party/linenoise/linenoise.h"
|
||||
|
||||
#define EXT(s) READ32LE(s "\0\0")
|
||||
#define Read32(s) (s[3] << 24 | s[2] << 16 | s[1] << 8 | s[0])
|
||||
#define EXT(s) Read32(s "\0\0")
|
||||
|
||||
static bool IsGraph(wint_t c) {
|
||||
static inline bool IsGraph(wint_t c) {
|
||||
return 0x21 <= c && c <= 0x7E;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue