Fully support OpenBSD 7.3

This change (1) upgrades to OpenBSD's newer kernel ABIs, and (2)
modifies APE to have a read-only data segment. Doing this required
creating APE Loader v1.1, which is backwards and forwards compatible
with the previous version.

If you've run the following commands in the past to install your APE
Loader systemwide, then you need to run them again. Ad-hoc installations
shouldn't be impacted. It's also recommended that APE binaries be remade
after upgrading, since they embed old versions of the APE Loader.

    ape/apeuninstall.sh
    ape/apeinstall.sh

This change does more than just fix OpenBSD. The new loader is smarter
and more reliable. We're now able create much tinier ELF and Mach-O data
structures than we could before. Both APE Loader and execvpe() will now
normalize ambiguous argv[0] resolution the same way as the UNIX shell.
Badness with TLS linkage has been solved.

Fixes #826
This commit is contained in:
Justine Tunney 2023-07-01 05:10:12 -07:00
parent 963e10b9bf
commit 40eb3b9d5d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
48 changed files with 772 additions and 903 deletions

View file

@ -123,6 +123,7 @@ endif
o/$(MODE)/libc/calls/execl.o \
o/$(MODE)/libc/calls/execle.o \
o/$(MODE)/libc/calls/execlp.o \
o/$(MODE)/libc/calls/execvpe.o \
o/$(MODE)/libc/calls/statfs.o \
o/$(MODE)/libc/calls/fstatfs.o \
o/$(MODE)/libc/calls/execve-sysv.o \

View file

@ -124,6 +124,6 @@ ssize_t copy_file_range(int infd, int64_t *opt_in_out_inoffset, int outfd,
END_CANCELLATION_POINT;
STRACE("copy_file_range(%d, %s, %d, %s, %'zu, %#x) → %'ld% m", infd,
DescribeInOutInt64(rc, opt_in_out_inoffset), outfd,
DescribeInOutInt64(rc, opt_in_out_outoffset), uptobytes, flags);
DescribeInOutInt64(rc, opt_in_out_outoffset), uptobytes, flags, rc);
return rc;
}

View file

@ -19,6 +19,7 @@
#include "libc/calls/calls.h"
#include "libc/mem/alloca.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
/**
@ -40,10 +41,16 @@ int execlp(const char *prog, const char *arg, ... /*, NULL*/) {
char **argv;
va_list va, vb;
char pathbuf[PATH_MAX];
if (!(exe = commandv(prog, pathbuf, sizeof(pathbuf)))) return -1;
// resolve path of executable
if (!(exe = commandv(prog, pathbuf, sizeof(pathbuf)))) {
return -1;
}
// turn varargs into array
va_copy(vb, va);
va_start(va, arg);
for (i = 0; va_arg(va, const char *); ++i) donothing;
for (i = 0; va_arg(va, const char *); ++i) (void)0;
va_end(va);
argv = alloca((i + 2) * sizeof(char *));
va_start(vb, arg);
@ -52,5 +59,14 @@ int execlp(const char *prog, const char *arg, ... /*, NULL*/) {
if (!(argv[i] = va_arg(vb, const char *))) break;
}
va_end(vb);
// change argv[0] to resolved path if it's ambiguous
// otherwise the program won't have much luck finding itself
if (argv[0] && *prog != '/' && *exe == '/' && !strcmp(prog, argv[0])) {
argv[0] = exe;
}
// execute program
// tail call shouldn't be possible
return execv(exe, argv);
}

View file

@ -85,9 +85,9 @@ int sys_execve(const char *prog, char *const argv[], char *const envp[]) {
(CanExecute((ape = "/usr/bin/ape")) ||
CanExecute((ape = Join(firstnonnull(getenv("TMPDIR"),
firstnonnull(getenv("HOME"), ".")),
".ape", buf))) ||
CanExecute(
(ape = Join(firstnonnull(getenv("HOME"), "."), ".ape", buf))))) {
".ape-1.1", buf))) ||
CanExecute((ape = Join(firstnonnull(getenv("HOME"), "."), ".ape-1.1",
buf))))) {
shargs[0] = ape;
shargs[1] = "-";
shargs[2] = prog;

View file

@ -19,7 +19,9 @@
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/mem/alloca.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
/**
@ -35,9 +37,32 @@
* @vforksafe
*/
int execvpe(const char *prog, char *const argv[], char *const *envp) {
char *exe;
size_t i;
char *exe, **argv2;
char pathbuf[PATH_MAX];
if (IsAsan() && !__asan_is_valid_str(prog)) return efault();
if (!(exe = commandv(prog, pathbuf, sizeof(pathbuf)))) return -1;
// validate memory
if (IsAsan() &&
(!__asan_is_valid_str(prog) || !__asan_is_valid_strlist(argv))) {
return efault();
}
// resolve path of executable
if (!(exe = commandv(prog, pathbuf, sizeof(pathbuf)))) {
return -1;
}
// change argv[0] to resolved path if it's ambiguous
// otherwise the program won't have much luck finding itself
if (argv[0] && *prog != '/' && *exe == '/' && !strcmp(prog, argv[0])) {
for (i = 0; argv[i++];) (void)0;
argv2 = alloca(i * sizeof(*argv));
memcpy(argv2, argv, i * sizeof(*argv));
argv2[0] = exe;
argv = argv2;
}
// execute program
// tail call shouldn't be possible
return execve(exe, argv, envp);
}

View file

@ -25,6 +25,7 @@
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/log/backtrace.internal.h"
#include "libc/sysv/errfuns.h"
#include "libc/zipos/zipos.internal.h"
/**
@ -79,12 +80,14 @@ int64_t lseek(int fd, int64_t offset, int whence) {
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
rc = _weaken(__zipos_lseek)(
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, offset, whence);
} else if (!IsWindows() && !IsOpenbsd() && !IsNetbsd()) {
} else if (IsLinux() || IsXnu() || IsFreebsd() || IsOpenbsd()) {
rc = sys_lseek(fd, offset, whence, 0);
} else if (IsOpenbsd() || IsNetbsd()) {
} else if (IsNetbsd()) {
rc = sys_lseek(fd, offset, offset, whence);
} else {
} else if (IsWindows()) {
rc = sys_lseek_nt(fd, offset, whence);
} else {
rc = enosys();
}
STRACE("lseek(%d, %'ld, %s) → %'ld% m", fd, offset, DescribeWhence(whence),
rc);

View file

@ -22,6 +22,16 @@
#include "libc/runtime/internal.h"
.section .start,"ax",@progbits
#if SupportsXnu() && defined(__x86_64__)
// XNU AMD64 Entrypoint
//
// @note Rosetta barely implements MAC_LC_UNIXTHREAD
// @note Rosetta sets many registers to weird values
_apple: mov $_HOSTXNU,%cl
jmp 1f
.endfn _apple,weak,hidden
#endif
// System Five userspace program entrypoint.
//
// @param rsp is [n,argv₀..argvₙ₋₁,0,envp₀..,0,auxv₀..,0,..]
@ -32,18 +42,6 @@
_start:
#ifdef __x86_64__
#if SupportsXnu()
// Hack for detecting M1 Rosetta environment.
// https://github.com/jart/cosmopolitan/issues/429#issuecomment-1166704377
cmp $-1,%ebx
jne 0f
cmp $+1,%edx
jne 0f
mov $_HOSTXNU,%cl
xor %edi,%edi
0:
#endif
#if SupportsFreebsd()
// detect free besiyata dishmaya
test %rdi,%rdi
@ -54,7 +52,7 @@ _start:
#endif
// set operating system when already detected
mov %cl,__hostos(%rip)
1: mov %cl,__hostos(%rip)
// get startup timestamp as early as possible
// its used by --strace flag and kprintf() %T

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall __sys_mmap,0x0c50c51dd20c5009,222,197,globl,hidden
.scall __sys_mmap,0x0c50311dd20c5009,222,197,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_ftruncate,0x8c98c99e028c984d,46,201,globl,hidden
.scall sys_ftruncate,0x8c98a89e028c984d,46,201,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_lseek,0x0c70c71de20c7008,62,199,globl,hidden
.scall sys_lseek,0x0c70a61de20c7008,62,199,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_pread,0x8ad8ad9db2899811,67,153,globl,hidden
.scall sys_pread,0x8ad8a99db2899811,67,153,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_preadv,0x92190b9212a1c927,69,540,globl,hidden
.scall sys_preadv,0x9218ab9212a1c927,69,540,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_pwrite,0x8ae8ae9dc289a812,68,154,globl,hidden
.scall sys_pwrite,0x8ae8aa9dc289a812,68,154,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_pwritev,0x92290c9222a1d928,70,541,globl,hidden
.scall sys_pwritev,0x9228ac9222a1d928,70,541,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h"
.scall sys_truncate,0x8c88c89df28c884c,45,200,globl,hidden
.scall sys_truncate,0x8c88a79df28c884c,45,200,globl,hidden

View file

@ -1706,16 +1706,16 @@ syscon nr __NR_fstat 0x0005 0x0050 0x2000153 0x0153 0x0227 0x0035
syscon nr __NR_lstat 0x0006 0x0fff 0x2000154 0x0154 0x0028 0x0028 0x1b9 0xfff
syscon nr __NR_poll 0x0007 0x0fff 0x20000e6 0x00e6 0x00d1 0x00fc 0x0d1 0xfff
syscon nr __NR_ppoll 0x010f 0x0049 0xfff 0xfff 0x0221 0x006d 0xfff 0xfff
syscon nr __NR_lseek 0x0008 0x003e 0x20000c7 0x00c7 0x01de 0x00c7 0x0c7 0xfff
syscon nr __NR_mmap 0x0009 0x00de 0x20000c5 0x00c5 0x01dd 0x00c5 0x0c5 0xfff
syscon nr __NR_lseek 0x0008 0x003e 0x20000c7 0x00c7 0x01de 0x00a6 0x0c7 0xfff # OpenBSD 7.3+
syscon nr __NR_mmap 0x0009 0x00de 0x20000c5 0x00c5 0x01dd 0x0031 0x0c5 0xfff # OpenBSD 7.3+
syscon nr __NR_msync 0x001a 0x00e3 0x2000041 0x0041 0x0041 0x0100 0x115 0xfff
syscon nr __NR_mprotect 0x000a 0x00e2 0x200004a 0x004a 0x004a 0x004a 0x04a 0xfff
syscon nr __NR_munmap 0x000b 0x00d7 0x2000049 0x0049 0x0049 0x0049 0x049 0xfff
syscon nr __NR_sigaction 0x000d 0x0086 0x200002e 0x002e 0x01a0 0x002e 0x154 0xfff
syscon nr __NR_sigprocmask 0x000e 0x0087 0x2000149 0x0149 0x0154 0x0030 0x125 0xfff
syscon nr __NR_ioctl 0x0010 0x001d 0x2000036 0x0036 0x0036 0x0036 0x036 0xfff
syscon nr __NR_pread 0x0011 0x0043 0x2000099 0x0099 0x01db 0x00ad 0x0ad 0xfff
syscon nr __NR_pwrite 0x0012 0x0044 0x200009a 0x009a 0x01dc 0x00ae 0x0ae 0xfff
syscon nr __NR_pread 0x0011 0x0043 0x2000099 0x0099 0x01db 0x00a9 0x0ad 0xfff # OpenBSD 7.3+
syscon nr __NR_pwrite 0x0012 0x0044 0x200009a 0x009a 0x01dc 0x00aa 0x0ae 0xfff # OpenBSD 7.3+
syscon nr __NR_readv 0x0013 0x0041 0x2000078 0x0078 0x0078 0x0078 0x078 0xfff
syscon nr __NR_writev 0x0014 0x0042 0x2000079 0x0079 0x0079 0x0079 0x079 0xfff
syscon nr __NR_access 0x0015 0x0fff 0x2000021 0x0021 0x0021 0x0021 0x021 0xfff
@ -1779,8 +1779,8 @@ syscon nr __NR_fcntl 0x0048 0x0019 0x200005c 0x005c 0x005c 0x005c
syscon nr __NR_flock 0x0049 0x0020 0x2000083 0x0083 0x0083 0x0083 0x083 0xfff
syscon nr __NR_fsync 0x004a 0x0052 0x200005f 0x005f 0x005f 0x005f 0x05f 0xfff
syscon nr __NR_fdatasync 0x004b 0x0053 0x20000bb 0x00bb 0x0226 0x005f 0x0f1 0xfff
syscon nr __NR_truncate 0x004c 0x002d 0x20000c8 0x00c8 0x01df 0x00c8 0x0c8 0xfff
syscon nr __NR_ftruncate 0x004d 0x002e 0x20000c9 0x00c9 0x01e0 0x00c9 0x0c9 0xfff
syscon nr __NR_truncate 0x004c 0x002d 0x20000c8 0x00c8 0x01df 0x00a7 0x0c8 0xfff # OpenBSD 7.3+
syscon nr __NR_ftruncate 0x004d 0x002e 0x20000c9 0x00c9 0x01e0 0x00a8 0x0c9 0xfff # OpenBSD 7.3+
syscon nr __NR_getcwd 0x004f 0x0011 0xfff 0xfff 0x0146 0x0130 0x128 0xfff
syscon nr __NR_chdir 0x0050 0x0031 0x200000c 0x000c 0x000c 0x000c 0x00c 0xfff
syscon nr __NR_fchdir 0x0051 0x0032 0x200000d 0x000d 0x000d 0x000d 0x00d 0xfff
@ -1964,8 +1964,8 @@ syscon nr __NR_sync_file_range 0x0115 0x0054 0xfff 0xfff 0xfff 0xfff
syscon nr __NR_vmsplice 0x0116 0x004b 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff
syscon nr __NR_migrate_pages 0x0100 0x00ee 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff
syscon nr __NR_move_pages 0x0117 0x00ef 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff
syscon nr __NR_preadv 0x0127 0x0045 0xfff 0xfff 0x0121 0x010b 0x121 0xfff
syscon nr __NR_pwritev 0x0128 0x0046 0xfff 0xfff 0x0122 0x010c 0x122 0xfff
syscon nr __NR_preadv 0x0127 0x0045 0xfff 0xfff 0x0121 0x00ab 0x121 0xfff # OpenBSD 7.3+
syscon nr __NR_pwritev 0x0128 0x0046 0xfff 0xfff 0x0122 0x00aa 0x122 0xfff # OpenBSD 7.3+
syscon nr __NR_utimensat 0x0118 0x0058 0xfff 0xfff 0x0223 0x0054 0x1d3 0xfff
syscon nr __NR_fallocate 0x011d 0x002f 0xfff 0xfff 0xfff 0xfff 0xfff 0xfff
syscon nr __NR_posix_fallocate 0xfff 0xfff 0xfff 0xfff 0x0212 0xfff 0x1df 0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_ftruncate,0x004d,0x002e,0x20000c9,0x00c9,0x01e0,0x00c9,0x0c9,0xfff
.syscon nr,__NR_ftruncate,0x004d,0x002e,0x20000c9,0x00c9,0x01e0,0x00a8,0x0c9,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_lseek,0x0008,0x003e,0x20000c7,0x00c7,0x01de,0x00c7,0x0c7,0xfff
.syscon nr,__NR_lseek,0x0008,0x003e,0x20000c7,0x00c7,0x01de,0x00a6,0x0c7,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_mmap,0x0009,0x00de,0x20000c5,0x00c5,0x01dd,0x00c5,0x0c5,0xfff
.syscon nr,__NR_mmap,0x0009,0x00de,0x20000c5,0x00c5,0x01dd,0x0031,0x0c5,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_pread,0x0011,0x0043,0x2000099,0x0099,0x01db,0x00ad,0x0ad,0xfff
.syscon nr,__NR_pread,0x0011,0x0043,0x2000099,0x0099,0x01db,0x00a9,0x0ad,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_preadv,0x0127,0x0045,0xfff,0xfff,0x0121,0x010b,0x121,0xfff
.syscon nr,__NR_preadv,0x0127,0x0045,0xfff,0xfff,0x0121,0x00ab,0x121,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_pwrite,0x0012,0x0044,0x200009a,0x009a,0x01dc,0x00ae,0x0ae,0xfff
.syscon nr,__NR_pwrite,0x0012,0x0044,0x200009a,0x009a,0x01dc,0x00aa,0x0ae,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_pwritev,0x0128,0x0046,0xfff,0xfff,0x0122,0x010c,0x122,0xfff
.syscon nr,__NR_pwritev,0x0128,0x0046,0xfff,0xfff,0x0122,0x00aa,0x122,0xfff

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon nr,__NR_truncate,0x004c,0x002d,0x20000c8,0x00c8,0x01df,0x00c8,0x0c8,0xfff
.syscon nr,__NR_truncate,0x004c,0x002d,0x20000c8,0x00c8,0x01df,0x00a7,0x0c8,0xfff

View file

@ -50,6 +50,8 @@
ldr w9,[x9,#:lo12:__hostos]
tbz x9,#3,1f // !IsXnu()
mov x16,#\arm_xnu // apple ordinal
mov x9,#0 // clear carry flag
adds x9,x9,#0 // clear carry flag
svc #0 // issue system call
bcs 1f
b _sysret

View file

@ -42,8 +42,8 @@ scall __sys_fstat 0x1b80352272153005 0x050 globl hidden # needs __stat2linux()
scall __sys_lstat 0x1b90280282154006 0xfff globl hidden # needs __stat2linux(); blocked on Android
scall __sys_poll 0x8d18fc8d128e6807 0xfff globl hidden
scall sys_ppoll 0xfff86da21ffff90f 0x049 globl hidden # consider INTON/INTOFF tutorial in examples/unbourne.c
scall sys_lseek 0x0c70c71de20c7008 0x03e globl hidden # netbsd+openbsd:evilpad
scall __sys_mmap 0x0c50c51dd20c5009 0x0de globl hidden # netbsd+openbsd:pad
scall sys_lseek 0x0c70a61de20c7008 0x03e globl hidden # netbsd:evilpad, OpenBSD 7.3+
scall __sys_mmap 0x0c50311dd20c5009 0x0de globl hidden # netbsd:pad, OpenBSD 7.3+
scall sys_msync 0x915900841284181a 0x0e3 globl hidden
scall sys_mprotect 0x04a04a04a204a00a 0x0e2 globl hidden
scall __sys_munmap 0x049049049204900b 0x0d7 globl hidden
@ -51,8 +51,8 @@ scall sys_sigaction 0x15402e1a0202e00d 0x086 globl hidden # rt_sigaction on Lun
scall __sys_sigprocmask 0x125030154214900e 0x087 globl hidden # a.k.a. rt_sigprocmask, openbsd:byvalue, a.k.a. pthread_sigmask
scall sys_ioctl 0x0360360362036010 0x01d globl hidden
scall sys_ioctl_cp 0x8368368362836810 0x01d globl hidden # intended for TCSBRK
scall sys_pread 0x8ad8ad9db2899811 0x043 globl hidden # a.k.a. pread64; netbsd+openbsd:pad
scall sys_pwrite 0x8ae8ae9dc289a812 0x044 globl hidden # a.k.a. pwrite64; netbsd+openbsd:pad
scall sys_pread 0x8ad8a99db2899811 0x043 globl hidden # a.k.a. pread64; netbsd:pad, OpenBSD 7.3+
scall sys_pwrite 0x8ae8aa9dc289a812 0x044 globl hidden # a.k.a. pwrite64; netbsd:pad, OpenBSD 7.3+
scall sys_readv 0x8788788782878813 0x041 globl hidden
scall sys_writev 0x8798798792879814 0x042 globl hidden
scall __sys_pipe 0x02a10721e202a016 0x03b globl hidden # NOTE: pipe2() on FreeBSD and Linux Aarch64; XNU is pipe(void)→eax:edx
@ -118,8 +118,8 @@ scall __sys_fcntl_cp 0x85c85c85c285c848 0x019 globl hidden # intended for F_SET
scall sys_flock 0x8838838832883849 0x020 globl hidden
scall sys_fsync 0x85f85f85f285f84a 0x052 globl hidden
scall sys_fdatasync 0x8f185fa2628bb84b 0x053 globl hidden # fsync() on openbsd
scall sys_truncate 0x8c88c89df28c884c 0x02d globl hidden # netbsd+openbsd:pad
scall sys_ftruncate 0x8c98c99e028c984d 0x02e globl hidden # netbsd+openbsd:pad
scall sys_truncate 0x8c88a79df28c884c 0x02d globl hidden # netbsd:pad, OpenBSD 7.3+
scall sys_ftruncate 0x8c98a89e028c984d 0x02e globl hidden # netbsd:pad, OpenBSD 7.3+
scall sys_getcwd 0x128130146ffff04f 0x011 globl hidden
scall sys_chdir 0x00c00c00c200c050 0x031 globl hidden
scall sys_fchdir 0x00d00d00d200d051 0x032 globl hidden
@ -296,8 +296,8 @@ scall sys_vmsplice 0xfffffffffffff116 0x04b globl hidden
scall sys_migrate_pages 0xfffffffffffff100 0x0ee globl # no wrapper; numa numa yay
scall sys_move_pages 0xfffffffffffff117 0x0ef globl # no wrapper; NOTE: We view Red Hat versions as "epochs" for all distros.
#──────────────────────RHEL 5.0 LIMIT──────────────────────────────── # ←┬─ last distro with gplv2 licensed compiler c. 2007
scall sys_preadv 0x92190b9212a1c927 0x045 globl hidden # ├─ last distro with system v shell script init
scall sys_pwritev 0x92290c9222a1d928 0x046 globl hidden # ├─ rob landley unleashes busybox gpl lawsuits
scall sys_preadv 0x9218ab9212a1c927 0x045 globl hidden # ├─ last distro with system v shell script init
scall sys_pwritev 0x9228ac9222a1d928 0x046 globl hidden # ├─ rob landley unleashes busybox gpl lawsuits
scall __sys_utimensat 0x1d3054223ffff118 0x058 globl hidden # ├─ python modules need this due to pep513
scall sys_fallocate 0xfffffffffffff91d 0x02f globl # ├─ end of life 2020-11-30 (extended)
scall sys_posix_fallocate 0x9dffffa12fffffff 0xfff globl hidden # └─ cosmopolitan supports rhel5+
@ -774,7 +774,7 @@ scall sys_rtprio_thread 0xffffff1d2fffffff 0xfff globl # no wrapper
#scall getrtable 0xfff137ffffffffff 0xfff globl
#scall getthrid 0xfff12bffffffffff 0xfff globl
#scall kbind 0xfff056ffffffffff 0xfff globl
#scall mquery 0xfff11effffffffff 0xfff globl # openbsd:pad
#scall mquery 0xfff11effffffffff 0xfff globl # openbsd:pad (todo)
#scall obreak 0x011011ffffffffff 0xfff globl
#scall sendsyslog 0xfff070ffffffffff 0xfff globl
#scall setrtable 0xfff136ffffffffff 0xfff globl

View file

@ -16,6 +16,7 @@
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/errno.h"
#include "libc/fmt/fmt.h"
@ -49,9 +50,9 @@ void testlib_showerror(const char *file, int line, const char *func,
"\t\t got %s\n"
"\t%s%s\n"
"\t%s%s\n",
RED2, UNBOLD, BLUE1, file, (long)line, RESET, method, func,
g_fixturename, hostname, getpid(), gettid(), code, v1, symbol, v2,
SUBTLE, strerror(errno), GetProgramExecutableName(), RESET);
RED2, UNBOLD, BLUE1, file, line, RESET, method, func, g_fixturename,
hostname, getpid(), gettid(), code, v1, symbol, v2, SUBTLE,
strerror(errno), GetProgramExecutableName(), RESET);
free(v1);
free(v2);
}

View file

@ -16,6 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "ape/sections.internal.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/rlimit.h"
#include "libc/calls/struct/sigaction.h"
@ -49,6 +51,7 @@
#include "libc/sysv/consts/f.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/poll.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/consts/rlimit.h"
#include "libc/sysv/consts/sig.h"
#include "libc/testlib/testlib.h"