Backport main branch improvements (#658)

* Add sys_ prefix to unwrapped system calls
* This change also implements getlogin() and getlogin_r().
* Add getgroups and setgroups (#619)
* Fix getgroups / setgroups tests across platforms. See #619
* Change accept type to struct sockaddr * (#630)
* vista: use old strace path
This commit is contained in:
Gavin Hayes 2022-10-10 23:44:29 -04:00 committed by GitHub
parent 4381b3d925
commit f4ff1729d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
831 changed files with 1381 additions and 1822 deletions

View file

@ -166,7 +166,7 @@ void *Worker(void *id) {
// wait for client connection
clientaddrsize = sizeof(clientaddr);
client = accept(server, &clientaddr, &clientaddrsize);
client = accept(server, (struct sockaddr *)&clientaddr, &clientaddrsize);
// accept() can raise a very diverse number of errors but none of
// them are really true showstoppers that would necessitate us to

View file

@ -99,11 +99,11 @@ int flock(int, int);
int fork(void);
int fsync(int);
int ftruncate(int, int64_t);
int getdents(unsigned, void *, unsigned, long *);
int getdomainname(char *, size_t);
int getegid(void) nosideeffect;
int geteuid(void) nosideeffect;
int getgid(void) nosideeffect;
uint32_t getegid(void) nosideeffect;
uint32_t geteuid(void) nosideeffect;
uint32_t getgid(void) nosideeffect;
int getgroups(int size, uint32_t list[]);
int gethostname(char *, size_t);
int getloadavg(double *, int);
int getpgid(int) libcesque;
@ -115,8 +115,8 @@ int getresgid(uint32_t *, uint32_t *, uint32_t *);
int getresuid(uint32_t *, uint32_t *, uint32_t *);
int getsid(int) nosideeffect libcesque;
int gettid(void) libcesque;
int getuid(void) libcesque;
int iopl(int);
uint32_t getuid(void) libcesque;
int sys_iopl(int);
int ioprio_get(int, int);
int ioprio_set(int, int, int);
int issetugid(void);
@ -135,11 +135,11 @@ int mkfifo(const char *, uint32_t);
int mkfifoat(int, const char *, uint32_t);
int mknod(const char *, uint32_t, uint64_t);
int mknodat(int, const char *, int32_t, uint64_t);
int mlock(const void *, size_t);
int mlock2(const void *, size_t, int);
int mlockall(int);
int munlock(const void *, size_t);
int munlockall(void);
int sys_mlock(const void *, size_t);
int sys_mlock2(const void *, size_t, int);
int sys_mlockall(int);
int sys_munlock(const void *, size_t);
int sys_munlockall(void);
int nice(int);
int open(const char *, int, ...);
int openat(int, const char *, int, ...);
@ -166,6 +166,7 @@ int seteuid(uint32_t);
int setfsgid(int);
int setfsuid(int);
int setgid(int);
int setgroups(size_t size, const uint32_t list[]);
int setpgid(int, int);
int setpgrp(void);
int setpriority(int, unsigned, int);
@ -181,7 +182,7 @@ int symlink(const char *, const char *);
int symlinkat(const char *, int, const char *);
int sync_file_range(int, int64_t, int64_t, unsigned);
int sys_ptrace(int, ...);
int sysctl(const int *, unsigned, void *, size_t *, void *, size_t);
int sys_sysctl(const int *, unsigned, void *, size_t *, void *, size_t);
int tcsetpgrp(int, int32_t);
int tgkill(int, int, int);
int tkill(int, int);

View file

@ -54,7 +54,7 @@ static unsigned GetCpuCountBsd(void) {
} else {
cmd[1] = HW_NCPU;
}
if (!sysctl(cmd, 2, &c, &n, 0, 0)) {
if (!sys_sysctl(cmd, 2, &c, &n, 0, 0)) {
return c;
} else {
return 0;

View file

@ -26,13 +26,13 @@
* Returns effective group ID of calling process.
* @return group id
*/
int getegid(void) {
int rc;
uint32_t getegid(void) {
uint32_t rc;
if (!IsWindows()) {
rc = sys_getegid();
} else {
rc = getgid();
}
STRACE("%s() → %d% m", "getegid", rc);
STRACE("%s() → %u% m", "getegid", rc);
return rc;
}

View file

@ -25,13 +25,13 @@
* Returns effective user ID of calling process.
* @return user id
*/
int geteuid(void) {
int rc;
uint32_t geteuid(void) {
uint32_t rc;
if (!IsWindows()) {
rc = sys_geteuid();
} else {
rc = getuid();
}
STRACE("%s() → %d% m", "geteuid", rc);
STRACE("%s() → %u% m", "geteuid", rc);
return rc;
}

45
libc/calls/getgroups.c Normal file
View file

@ -0,0 +1,45 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/calls/groups.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/sysv/errfuns.h"
/**
* Gets list of supplementary group IDs
*
* @param size - maximum number of items that can be stored in list
* @param list - buffer to store output gid_t
* @return -1 w/ EFAULT
*/
int getgroups(int size, uint32_t list[]) {
int rc;
if (IsAsan() && size && !__asan_is_valid(list, size * sizeof(list[0]))) {
rc = efault();
} else if (IsLinux() || IsNetbsd() || IsOpenbsd() || IsFreebsd() || IsXnu()) {
rc = sys_getgroups(size, list);
} else {
rc = enosys();
}
STRACE("getgroups(%d, %s) → %d% m", size, DescribeGidList(rc, rc, list), rc);
return rc;
}

View file

@ -24,7 +24,7 @@
int gethostname_bsd(char *name, size_t len, int kind) {
int cmd[2] = {CTL_KERN, kind};
if (sysctl(cmd, 2, name, &len, 0, 0) != -1) {
if (sys_sysctl(cmd, 2, name, &len, 0, 0) != -1) {
return 0;
} else {
if (errno == ENOMEM) {

View file

@ -62,7 +62,7 @@ int getloadavg(double *a, int n) {
struct loadavg loadinfo;
int mib[2] = {CTL_VM, VM_LOADAVG};
size = sizeof(loadinfo);
if ((rc = sysctl(mib, 2, &loadinfo, &size, 0, 0)) != -1) {
if ((rc = sys_sysctl(mib, 2, &loadinfo, &size, 0, 0)) != -1) {
for (i = 0; i < n; i++) {
a[i] = (double)loadinfo.ldavg[i] / loadinfo.fscale;
}

View file

@ -113,7 +113,7 @@ static inline void GetProgramExecutableNameImpl(char *p, char *e) {
}
u.cmd[3] = -1; // current process
n = e - p;
if (sysctl(u.cmd, ARRAYLEN(u.cmd), p, &n, 0, 0) != -1) {
if (sys_sysctl(u.cmd, ARRAYLEN(u.cmd), p, &n, 0, 0) != -1) {
return;
}
}

View file

@ -50,15 +50,15 @@ static textwindows dontinline uint32_t GetUserNameHash(void) {
* @asyncsignalsafe
* @vforksafe
*/
int getuid(void) {
int rc;
uint32_t getuid(void) {
uint32_t rc;
if (!IsWindows()) {
rc = sys_getuid();
} else {
rc = GetUserNameHash();
}
STRACE("%s() → %d% m", "getuid", rc);
STRACE("%s() → %u% m", "getuid", rc);
return rc;
}
@ -71,13 +71,13 @@ int getuid(void) {
* @asyncsignalsafe
* @vforksafe
*/
int getgid(void) {
int rc;
uint32_t getgid(void) {
uint32_t rc;
if (!IsWindows()) {
rc = sys_getgid();
} else {
rc = GetUserNameHash();
}
STRACE("%s() → %d% m", "getgid", rc);
STRACE("%s() → %u% m", "getgid", rc);
return rc;
}

View file

@ -0,0 +1,16 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int sys_getgroups(int size, uint32_t list[]);
int sys_setgroups(size_t size, uint32_t list[]);
const char *DescribeGidList(char[128], int, int, const uint32_t list[]);
#define DescribeGidList(rc, length, gidlist) \
DescribeGidList(alloca(128), rc, length, gidlist)
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_ */

52
libc/calls/setgroups.c Normal file
View file

@ -0,0 +1,52 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/groups.internal.h"
#include "libc/calls/strace.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/sysv/errfuns.h"
/**
* Sets list of supplementary group IDs.
*
* On recent versions of Linux only, it's possible to say:
*
* setgroups(0, NULL);
*
* Which will cause subsequent calls to `EPERM`.
*
* @param size number of items in list
* @param list input set of gid_t to set
* @return -1 w/ EFAULT
*/
int setgroups(size_t size, const uint32_t list[]) {
int rc;
if (IsAsan() && size && !__asan_is_valid(list, size * sizeof(list[0]))) {
rc = efault();
} else if (IsLinux() || IsNetbsd() || IsOpenbsd() || IsFreebsd() || IsXnu()) {
rc = sys_setgroups(size, list);
} else {
rc = enosys();
}
STRACE("setgroups(%u, %s) → %d% m", size, DescribeGidList(rc, size, list),
rc);
return rc;
}

View file

@ -39,7 +39,7 @@ static int64_t GetUptime(void) {
struct timeval x;
size_t n = sizeof(x);
int mib[] = {CTL_KERN, KERN_BOOTTIME};
if (sysctl(mib, ARRAYLEN(mib), &x, &n, 0, 0) == -1) return 0;
if (sys_sysctl(mib, ARRAYLEN(mib), &x, &n, 0, 0) == -1) return 0;
return _timespec_real().tv_sec - x.tv_sec;
}
@ -47,7 +47,7 @@ static int64_t GetPhysmem(void) {
uint64_t x;
size_t n = sizeof(x);
int mib[] = {CTL_HW, HW_PHYSMEM};
if (sysctl(mib, ARRAYLEN(mib), &x, &n, 0, 0) == -1) return 0;
if (sys_sysctl(mib, ARRAYLEN(mib), &x, &n, 0, 0) == -1) return 0;
return x;
}

View file

@ -57,7 +57,7 @@ static void GetBsdStr(int c0, int c1, char *s) {
size_t n = SYS_NMLN;
int cmd[2] = {c0, c1};
bzero(s, n), --n;
sysctl(cmd, 2, s, &n, NULL, 0);
sys_sysctl(cmd, 2, s, &n, NULL, 0);
errno = e;
// sysctl kern.version is too verbose for uname
if ((p = strchr(s, '\n'))) {

View file

@ -0,0 +1,51 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/groups.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/popcnt.h"
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#define N 128
const char *(DescribeGidList)(char buf[N], int rc, int size,
const uint32_t list[]) {
if ((rc == -1) || (size < 0)) return "n/a";
if (!size) return "{}";
if (!list) return "NULL";
if ((!IsAsan() && kisdangerous(list)) ||
(IsAsan() && !__asan_is_valid(list, size * sizeof(list[0])))) {
ksnprintf(buf, N, "%p", list);
return buf;
}
int i = 0, n = N;
i += ksnprintf(buf + i, MAX(0, n - i), "{");
unsigned c;
for (c = 0; c < size && MAX(0, n - i) > 0; c++) {
i += ksnprintf(buf + i, MAX(0, n - i), "%u, ", list[c]);
}
if (c == size) {
if (buf[i - 1] == ' ') i--;
if (buf[i - 1] == ',') i--;
i += ksnprintf(buf + i, MAX(0, n - i), "}");
}
return buf;
}

View file

@ -28,6 +28,13 @@
sched_yield:
push %rbp
mov %rsp,%rbp
xor %eax,%eax
mov __hostos(%rip),%dl
#if SupportsMetal()
testb $METAL,%dl
jnz 9f
#endif
#if SupportsWindows()
// Windows Support
@ -39,7 +46,7 @@ sched_yield:
// threads ready to run and no user APCs are queued, the function
// returns immediately, and the thread continues execution.
// Quoth MSDN
testb IsWindows()
testb $WINDOWS,%dl
jz 1f
xor %ecx,%ecx
xor %edx,%edx

View file

@ -1,4 +1,5 @@
#ifndef LIBC_ISYSTEM_GRP_H_
#define LIBC_ISYSTEM_GRP_H_
#include "libc/calls/calls.h"
#include "third_party/musl/passwd.h"
#endif

View file

@ -49,7 +49,7 @@ static dontinline int __clk_tck_init(void) {
cmd[0] = 1; // CTL_KERN
cmd[1] = 12; // KERN_CLOCKRATE
len = sizeof(clock);
if (sysctl(cmd, 2, &clock, &len, NULL, 0) != -1) {
if (sys_sysctl(cmd, 2, &clock, &len, NULL, 0) != -1) {
x = clock.hz;
} else {
x = -1;

View file

@ -78,7 +78,7 @@ char *GetInterpreterExecutableName(char *p, size_t n) {
cmd[2] = 5; // KERN_PROC_PATHNAME
} //
cmd[3] = -1; // current process
if (sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) {
if (sys_sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) {
errno = e;
return p;
}

View file

@ -1,5 +1,5 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
@ -16,8 +16,46 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/strace.internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/macros.internal.h"
#include "libc/nt/accounting.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
prlimit64:
jmp prlimit
.endfn prlimit64,globl
int sys_getlogin(char *, uint32_t);
/**
* Returns login name.
*/
char *getlogin(void) {
uint32_t size;
const char *p, *res;
char16_t buf16[257];
static char login[128];
if (IsBsd()) {
if (sys_getlogin(login, sizeof(login)) != -1) {
res = login;
} else {
res = 0;
}
} else if (IsWindows()) {
size = ARRAYLEN(buf16);
if (GetUserName(&buf16, &size)) {
tprecode16to8(login, sizeof(login), buf16);
res = login;
} else {
__winerr();
res = 0;
}
} else if ((p = getenv("LOGNAME"))) {
res = p;
} else {
enoent();
res = 0;
}
STRACE("getlogin() → %#s% m", res);
return res;
}

61
libc/runtime/getlogin_r.c Normal file
View file

@ -0,0 +1,61 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/strace.internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/intrin/kprintf.h"
#include "libc/macros.internal.h"
#include "libc/nt/accounting.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
int sys_getlogin(char *, uint32_t);
/**
* Returns login name.
*/
int getlogin_r(char *buf, size_t size) {
int rc;
uint32_t n32;
const char *p;
char16_t buf16[257];
if (IsBsd()) {
rc = sys_getlogin(buf, size);
} else if (IsWindows()) {
n32 = ARRAYLEN(buf16);
if (GetUserName(&buf16, &n32)) {
tprecode16to8(buf, sizeof(size), buf16);
rc = 0;
} else {
rc = __winerr();
}
} else if ((p = getenv("LOGNAME"))) {
if (strlen(p) < size) {
strcpy(buf, p);
rc = 0;
} else {
rc = enomem();
}
} else {
rc = enoent();
}
STRACE("getlogin_r([%#s], %'zu) → %d% m", rc != -1 ? buf : "n/a", size, rc);
return rc;
}

View file

@ -82,7 +82,6 @@ int mprotect(void *, uint64_t, int) privileged;
int msync(void *, size_t, int);
void *sbrk(intptr_t);
int brk(void *);
int getgroups(int, uint32_t[]);
long gethostid(void);
int sethostid(long);
char *getlogin(void);

View file

@ -38,6 +38,7 @@ LIBC_RUNTIME_A_DIRECTDEPS = \
LIBC_FMT \
LIBC_INTRIN \
LIBC_NEXGEN32E \
LIBC_NT_ADVAPI32 \
LIBC_NT_KERNEL32 \
LIBC_STR \
LIBC_STUBS \

View file

@ -28,6 +28,6 @@
* @asyncsignalsafe
* @restartable (unless SO_RCVTIMEO)
*/
int accept(int fd, void *out_addr, uint32_t *inout_addrsize) {
int accept(int fd, struct sockaddr *out_addr, uint32_t *inout_addrsize) {
return accept4(fd, out_addr, inout_addrsize, 0);
}

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_SOCK_H_
#define COSMOPOLITAN_LIBC_SOCK_SOCK_H_
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*───────────────────────────────────────────────────────────────────────────│─╗
@ -29,7 +30,7 @@ uint32_t *GetHostIps(void);
int nointernet(void);
int socket(int, int, int);
int accept(int, void *, uint32_t *);
int accept(int, struct sockaddr *, uint32_t *);
int accept4(int, void *, uint32_t *, int);
int bind(int, const void *, uint32_t);
int connect(int, const void *, uint32_t);

View file

@ -51,6 +51,8 @@
* has been done for five platforms, having a remarkably tiny footprint.
*/
int sys_getdents(unsigned, void *, unsigned, long *);
/**
* Directory stream object.
*/
@ -375,8 +377,8 @@ static struct dirent *readdir_impl(DIR *dir) {
} else if (!IsWindows()) {
if (dir->buf_pos >= dir->buf_end) {
basep = dir->tell; /* TODO(jart): what does xnu do */
rc = getdents(dir->fd, dir->buf, sizeof(dir->buf) - 256, &basep);
STRACE("getdents(%d) → %d% m", dir->fd, rc);
rc = sys_getdents(dir->fd, dir->buf, sizeof(dir->buf) - 256, &basep);
STRACE("sys_getdents(%d) → %d% m", dir->fd, rc);
if (!rc || rc == -1) return NULL;
dir->buf_pos = 0;
dir->buf_end = rc;

View file

@ -99,7 +99,7 @@ ssize_t getrandom(void *p, size_t n, unsigned f) {
cmd[1] = 81; /* KERN_ARND */
}
m = n;
if ((rc = sysctl(cmd, 2, p, &m, 0, 0)) != -1) {
if ((rc = sys_sysctl(cmd, 2, p, &m, 0, 0)) != -1) {
rc = m;
}
} else if (have_getrandom) {

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_aclcheck_fd,0xffffff162fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_aclcheck_file,0xffffff161fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_aclcheck_link,0xffffff1acfffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_delete_fd,0xffffff160fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_delete_file,0xffffff15ffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_delete_link,0xffffff1abfffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_get_fd,0xffffff15dfffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_get_file,0xffffff15bfffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_get_link,0xffffff1a9fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_set_fd,0xffffff15efffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_set_file,0xffffff15cfffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __acl_set_link,0xffffff1aafffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __cap_rights_get,0xffffff203fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __disable_threadsignal,0xfffffffff214bfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_execve,0xffffff19f217cfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_get_fd,0xffffff1822184fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_get_file,0xffffff183217efff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_get_link,0xffffff19a2180fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_get_mount,0xfffffffff21a9fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_get_pid,0xffffff1992186fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_get_proc,0xffffff1802182fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_getfsstat,0xfffffffff21aafff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_mount,0xfffffffff21a8fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_set_fd,0xffffff1842185fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_set_file,0xffffff185217ffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_set_link,0xffffff19b2181fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_set_proc,0xffffff1812183fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __mac_syscall,0xfffffffff217dfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __old_semwait_signal,0xfffffffff2172fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __old_semwait_signal_nocancel,0xfffffffff2173fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __pthread_canceled,0xfffffffff214dfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __pthread_chdir,0xfffffffff215cfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __pthread_fchdir,0xfffffffff215dfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __pthread_kill,0xfffffffff2148fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __pthread_markcancel,0xfffffffff214cfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __pthread_sigmask,0xfffffffff2149fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __semwait_signal,0xfffffffff214efff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __semwait_signal_nocancel,0xfffffffff21a7fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __sigwait_nocancel,0xfffffffff21a6fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __threxit,0xfff12effffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __thrsigdivert,0xfff12fffffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __thrsleep,0xfff05effffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall __thrwakeup,0xfff12dffffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall abort_with_payload,0xfffffffff2209fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall accept_nocancel,0xfffffffff2194fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall access_extended,0xfffffffff211cfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall add_key,0xfffffffffffff0f8,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall adjfreq,0xfff131ffffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall adjtime,0x1a508c08c208cfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall adjtimex,0xfffffffffffff09f,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall afs3_syscall,0xffffff179fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_cancel,0x18ffff13c213cfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_error,0x190fff13d213dfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_fsync,0x191fff1d12139fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_mlock,0xffffff21ffffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_read,0x192fff13e213efff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_return,0x193fff13a213afff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_suspend,0x1b6fff13b213bfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_suspend_nocancel,0xfffffffff21a5fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_waitcomplete,0xffffff167fffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall aio_write,0x195fff13f213ffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall audit,0xffffff1bd215efff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall audit_session_join,0xfffffffff21adfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall audit_session_port,0xfffffffff21b0fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall audit_session_self,0xfffffffff21acfff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall auditctl,0xffffff1c52167fff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall auditon,0xffffff1be215ffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall bindat,0xffffff21afffffff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall bpf,0xfffffffffffff141,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall bsdthread_create,0xfffffffff2168fff,globl,hidden

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall bsdthread_ctl,0xfffffffff21defff,globl

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall bsdthread_register,0xfffffffff216efff,globl,hidden

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.internal.inc"
.scall bsdthread_terminate,0xfffffffff2169fff,globl

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