mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Delete LIBC_CALLS_HEFTY
- fork() no longer requires malloc() - readdir() moved to LIBC_STDIO - Custom APIs moved to LIBC_X
This commit is contained in:
parent
c843243322
commit
23a14b537c
44 changed files with 95 additions and 168 deletions
|
@ -48,7 +48,6 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
|
|||
struct Garbages *garbage;
|
||||
sigset_t chldmask, savemask;
|
||||
const struct StackFrame *frame;
|
||||
struct sigaction ignore, saveint, savequit;
|
||||
const char *debugbin, *p1, *p2, *p3, *addr2line;
|
||||
char buf[kBacktraceBufSize], *argv[kBacktraceMaxFrames];
|
||||
if (IsOpenbsd()) return -1;
|
||||
|
@ -77,18 +76,11 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
|
|||
j += uint64toarray_radix16(addr - 1, buf + j) + 1;
|
||||
}
|
||||
argv[i++] = NULL;
|
||||
ignore.sa_flags = 0;
|
||||
ignore.sa_handler = SIG_IGN;
|
||||
sigemptyset(&ignore.sa_mask);
|
||||
sigaction(SIGINT, &ignore, &saveint);
|
||||
sigaction(SIGQUIT, &ignore, &savequit);
|
||||
sigemptyset(&chldmask);
|
||||
sigaddset(&chldmask, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &chldmask, &savemask);
|
||||
pipe(pipefds);
|
||||
if (!(pid = vfork())) {
|
||||
sigaction(SIGINT, &saveint, NULL);
|
||||
sigaction(SIGQUIT, &savequit, NULL);
|
||||
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
||||
dup2(pipefds[1], 1);
|
||||
close(pipefds[0]);
|
||||
|
@ -124,8 +116,6 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
|
|||
if (errno == EINTR) continue;
|
||||
return -1;
|
||||
}
|
||||
sigaction(SIGINT, &saveint, NULL);
|
||||
sigaction(SIGQUIT, &savequit, NULL);
|
||||
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
||||
if (WIFEXITED(ws) && !WEXITSTATUS(ws)) {
|
||||
return 0;
|
||||
|
|
|
@ -25,19 +25,30 @@
|
|||
|
||||
/**
|
||||
* Finds full executable path in overridable way.
|
||||
*
|
||||
* This is a higher level version of the commandv() function. Programs
|
||||
* that spawn subprocesses can use this function to determine the path
|
||||
* at startup.
|
||||
*
|
||||
* @param var is environment variable which may be used to override
|
||||
* PATH search, and it can force a NULL result if it's empty
|
||||
* @param cmd is name of program, which is returned asap if it's an
|
||||
* absolute path
|
||||
* @return pointer to exe path string, or NULL if it couldn't be found
|
||||
* or the environment variable was empty; noting that the caller
|
||||
* should copy this string before saving it
|
||||
*/
|
||||
nodiscard char *commandvenv(const char *var, const char *cmd) {
|
||||
const char *commandvenv(const char *var, const char *cmd) {
|
||||
const char *exepath;
|
||||
char pathbuf[PATH_MAX];
|
||||
static char pathbuf[PATH_MAX];
|
||||
if (*cmd == '/' || *cmd == '\\') return cmd;
|
||||
if ((exepath = getenv(var))) {
|
||||
if (!isempty(exepath) && access(exepath, X_OK) != -1) {
|
||||
return strdup(exepath);
|
||||
if (isempty(exepath)) return NULL;
|
||||
if (access(exepath, X_OK) != -1) {
|
||||
return exepath;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
} else if ((exepath = commandv(cmd, pathbuf))) {
|
||||
return strdup(exepath);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
return commandv(cmd, pathbuf);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void memsummary(int); /* light version of same thing */
|
|||
uint16_t getttycols(uint16_t);
|
||||
int getttysize(int, struct winsize *) paramsnonnull();
|
||||
bool IsTerminalInarticulate(void) nosideeffect;
|
||||
char *commandvenv(const char *, const char *) nodiscard;
|
||||
const char *commandvenv(const char *, const char *);
|
||||
const char *GetAddr2linePath(void);
|
||||
const char *GetGdbPath(void);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ LIBC_LOG_A_CHECKS = \
|
|||
LIBC_LOG_A_DIRECTDEPS = \
|
||||
LIBC_ALG \
|
||||
LIBC_CALLS \
|
||||
LIBC_CALLS_HEFTY \
|
||||
LIBC_ELF \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue