diff --git a/libc/calls/pledge-linux.c b/libc/calls/pledge-linux.c index e59bd903c..4fffd46ac 100644 --- a/libc/calls/pledge-linux.c +++ b/libc/calls/pledge-linux.c @@ -1644,7 +1644,7 @@ static privileged void AllowMmapNoexec(struct Filter *f) { /*L2*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, ~(PROT_READ | PROT_WRITE)), /*L3*/ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, 8 - 4), /*L4*/ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, OFF(args[3])), // flags - /*L5*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x5a000), + /*L5*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x52000), /*L6*/ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, 1), /*L7*/ BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), /*L8*/ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, OFF(nr)), diff --git a/libc/dlopen/BUILD.mk b/libc/dlopen/BUILD.mk index 43814e89b..d8e38f98a 100644 --- a/libc/dlopen/BUILD.mk +++ b/libc/dlopen/BUILD.mk @@ -8,16 +8,8 @@ LIBC_DLOPEN = $(LIBC_DLOPEN_A_DEPS) $(LIBC_DLOPEN_A) LIBC_DLOPEN_A = o/$(MODE)/libc/dlopen/dlopen.a LIBC_DLOPEN_A_FILES := $(wildcard libc/dlopen/*) LIBC_DLOPEN_A_HDRS = $(filter %.h,$(LIBC_DLOPEN_A_FILES)) -LIBC_DLOPEN_A_SRCS_S = $(filter %.S,$(LIBC_DLOPEN_A_FILES)) -LIBC_DLOPEN_A_SRCS_C = $(filter %.c,$(LIBC_DLOPEN_A_FILES)) - -LIBC_DLOPEN_A_SRCS = \ - $(LIBC_DLOPEN_A_SRCS_S) \ - $(LIBC_DLOPEN_A_SRCS_C) - -LIBC_DLOPEN_A_OBJS = \ - $(LIBC_DLOPEN_A_SRCS_S:%.S=o/$(MODE)/%.o) \ - $(LIBC_DLOPEN_A_SRCS_C:%.c=o/$(MODE)/%.o) +LIBC_DLOPEN_A_SRCS = $(filter %.c,$(LIBC_DLOPEN_A_FILES)) +LIBC_DLOPEN_A_OBJS = $(LIBC_DLOPEN_A_SRCS:%.c=o/$(MODE)/%.o) LIBC_DLOPEN_A_CHECKS = \ $(LIBC_DLOPEN_A).pkg \ diff --git a/libc/nexgen32e/nt2sysv.S b/libc/nexgen32e/nt2sysv.S index 0530d086c..eb7b32edd 100644 --- a/libc/nexgen32e/nt2sysv.S +++ b/libc/nexgen32e/nt2sysv.S @@ -32,8 +32,6 @@ __nt2sysv: push %rbp mov %rsp,%rbp -// TODO(jart): We should probably find some way to use our own -// stack when Windows delivers signals ;_; sub $256,%rsp push %rbx push %rdi diff --git a/libc/nexgen32e/yield.h b/libc/nexgen32e/yield.h deleted file mode 100755 index e69de29bb..000000000 diff --git a/third_party/make/job.c b/third_party/make/job.c index 8f73533cd..9b54489dc 100644 --- a/third_party/make/job.c +++ b/third_party/make/job.c @@ -3792,24 +3792,5 @@ construct_command_argv (char *line, char **restp, struct file *file, return argv; } - -#if !defined(HAVE_DUP2) && !defined(_AMIGA) -int -dup2 (int old, int new) -{ - int fd; - - (void) close (new); - EINTRLOOP (fd, dup (old)); - if (fd != new) - { - (void) close (fd); - errno = EMFILE; - return -1; - } - - return fd; -} -#endif /* !HAVE_DUP2 && !_AMIGA */ /* On VMS systems, include special VMS functions. */ diff --git a/third_party/make/misc.c b/third_party/make/misc.c index eb14f4051..37316809c 100644 --- a/third_party/make/misc.c +++ b/third_party/make/misc.c @@ -556,22 +556,6 @@ dbg (const char *fmt, ...) /* Provide support for temporary files. */ -#ifndef HAVE_STDLIB_H -# ifdef HAVE_MKSTEMP -int mkstemp (char *template); -# else -char *mktemp (char *template); -# endif -#endif - -#ifndef HAVE_UMASK -mode_t -umask (mode_t mask) -{ - return 0; -} -#endif - #ifdef VMS # define DEFAULT_TMPFILE "sys$scratch:gnv$make_cmdXXXXXX.com" #else @@ -784,260 +768,3 @@ get_tmpfile (char **name) return file; } - - -#if HAVE_TTYNAME && defined(__EMX__) -/* OS/2 kLIBC has a declaration for ttyname(), so configure finds it. - But, it is not implemented! Roll our own. */ -char *ttyname (int fd) -{ - ULONG type; - ULONG attr; - ULONG rc; - - rc = DosQueryHType (fd, &type, &attr); - if (rc) - { - errno = EBADF; - return NULL; - } - - if (type == HANDTYPE_DEVICE) - { - if (attr & 3) /* 1 = KBD$, 2 = SCREEN$ */ - return (char *) "/dev/con"; - - if (attr & 4) /* 4 = NUL */ - return (char *) "/dev/nul"; - - if (attr & 8) /* 8 = CLOCK$ */ - return (char *) "/dev/clock$"; - } - - errno = ENOTTY; - return NULL; -} -#endif - - -#if !HAVE_STRCASECMP && !HAVE_STRICMP && !HAVE_STRCMPI -/* If we don't have strcasecmp() (from POSIX), or anything that can substitute - for it, define our own version. */ - -int -strcasecmp (const char *s1, const char *s2) -{ - while (1) - { - int c1 = (unsigned char) *(s1++); - int c2 = (unsigned char) *(s2++); - - if (isalpha (c1)) - c1 = tolower (c1); - if (isalpha (c2)) - c2 = tolower (c2); - - if (c1 != '\0' && c1 == c2) - continue; - - return (c1 - c2); - } -} -#endif - -#if !HAVE_STRNCASECMP && !HAVE_STRNICMP && !HAVE_STRNCMPI -/* If we don't have strncasecmp() (from POSIX), or anything that can - substitute for it, define our own version. */ - -int -strncasecmp (const char *s1, const char *s2, size_t n) -{ - while (n-- > 0) - { - int c1 = (unsigned char) *(s1++); - int c2 = (unsigned char) *(s2++); - - if (isalpha (c1)) - c1 = tolower (c1); - if (isalpha (c2)) - c2 = tolower (c2); - - if (c1 != '\0' && c1 == c2) - continue; - - return (c1 - c2); - } - - return 0; -} -#endif - - -#ifdef NEED_GET_PATH_MAX -unsigned int -get_path_max (void) -{ - static unsigned int value; - - if (value == 0) - { - long x = pathconf ("/", _PC_PATH_MAX); - if (x > 0) - value = (unsigned int) x; - else - value = PATH_MAX; - } - - return value; -} -#endif - -#if !HAVE_MEMPCPY -void * -mempcpy (void *dest, const void *src, size_t n) -{ - return (char *) memcpy (dest, src, n) + n; -} -#endif - -#if !HAVE_STPCPY -char * -stpcpy (char *dest, const char *src) -{ - char *d = dest; - const char *s = src; - - do - *d++ = *s; - while (*s++ != '\0'); - - return d - 1; -} -#endif - -#if !HAVE_STRTOLL -# undef UNSIGNED -# undef USE_NUMBER_GROUPING -# undef USE_WIDE_CHAR -# define QUAD 1 -# include -#endif - -#if !HAVE_STRERROR -char * -strerror (int errnum) -{ - static char msg[256]; - -#define SETMSG(_e, _m) case _e: strcpy(msg, _m); break - - switch (errnum) - { -#ifdef EPERM - SETMSG (EPERM , "Operation not permitted"); -#endif -#ifdef ENOENT - SETMSG (ENOENT , "No such file or directory"); -#endif -#ifdef ESRCH - SETMSG (ESRCH , "No such process"); -#endif -#ifdef EINTR - SETMSG (EINTR , "Interrupted system call"); -#endif -#ifdef EIO - SETMSG (EIO , "I/O error"); -#endif -#ifdef ENXIO - SETMSG (ENXIO , "No such device or address"); -#endif -#ifdef E2BIG - SETMSG (E2BIG , "Argument list too long"); -#endif -#ifdef ENOEXEC - SETMSG (ENOEXEC, "Exec format error"); -#endif -#ifdef EBADF - SETMSG (EBADF , "Bad file number"); -#endif -#ifdef ECHILD - SETMSG (ECHILD , "No child processes"); -#endif -#ifdef EAGAIN - SETMSG (EAGAIN , "Try again"); -#endif -#ifdef ENOMEM - SETMSG (ENOMEM , "Out of memory"); -#endif -#ifdef EACCES - SETMSG (EACCES , "Permission denied"); -#endif -#ifdef EFAULT - SETMSG (EFAULT , "Bad address"); -#endif -#ifdef ENOTBLK - SETMSG (ENOTBLK, "Block device required"); -#endif -#ifdef EBUSY - SETMSG (EBUSY , "Device or resource busy"); -#endif -#ifdef EEXIST - SETMSG (EEXIST , "File exists"); -#endif -#ifdef EXDEV - SETMSG (EXDEV , "Cross-device link"); -#endif -#ifdef ENODEV - SETMSG (ENODEV , "No such device"); -#endif -#ifdef ENOTDIR - SETMSG (ENOTDIR, "Not a directory"); -#endif -#ifdef EISDIR - SETMSG (EISDIR , "Is a directory"); -#endif -#ifdef EINVAL - SETMSG (EINVAL , "Invalid argument"); -#endif -#ifdef ENFILE - SETMSG (ENFILE , "File table overflow"); -#endif -#ifdef EMFILE - SETMSG (EMFILE , "Too many open files"); -#endif -#ifdef ENOTTY - SETMSG (ENOTTY , "Not a typewriter"); -#endif -#ifdef ETXTBSY - SETMSG (ETXTBSY, "Text file busy"); -#endif -#ifdef EFBIG - SETMSG (EFBIG , "File too large"); -#endif -#ifdef ENOSPC - SETMSG (ENOSPC , "No space left on device"); -#endif -#ifdef ESPIPE - SETMSG (ESPIPE , "Illegal seek"); -#endif -#ifdef EROFS - SETMSG (EROFS , "Read-only file system"); -#endif -#ifdef EMLINK - SETMSG (EMLINK , "Too many links"); -#endif -#ifdef EPIPE - SETMSG (EPIPE , "Broken pipe"); -#endif -#ifdef EDOM - SETMSG (EDOM , "Math argument out of domain of func"); -#endif -#ifdef ERANGE - SETMSG (ERANGE , "Math result not representable"); -#endif - default: sprintf (msg, "Unknown error %d", errnum); break; - } - - return msg; -} -#endif