data_type large_stringclasses 3
values | source large_stringclasses 29
values | code large_stringlengths 98 49.4M | filepath large_stringlengths 5 161 ⌀ | message large_stringclasses 234
values | commit large_stringclasses 234
values | subject large_stringclasses 418
values | critique large_stringlengths 101 1.26M ⌀ | metadata dict |
|---|---|---|---|---|---|---|---|---|
source | musl | .global feclearexcept
.type feclearexcept,@function
feclearexcept:
# maintain exceptions in the sse mxcsr, clear x87 exceptions
mov %edi,%ecx
and $0x3f,%ecx
fnstsw %ax
test %eax,%ecx
jz 1f
fnclex
1: stmxcsr -8(%esp)
and $0x3f,%eax
or %eax,-8(%esp)
test %ecx,-8(%esp)
jz 1f
not %ecx
and %ecx,-8(%esp)
ldmxc... | src/fenv/x32/fenv.s | null | null | null | null | null |
source | musl | .global feclearexcept
.type feclearexcept,@function
feclearexcept:
# maintain exceptions in the sse mxcsr, clear x87 exceptions
mov %edi,%ecx
and $0x3f,%ecx
fnstsw %ax
test %eax,%ecx
jz 1f
fnclex
1: stmxcsr -8(%rsp)
and $0x3f,%eax
or %eax,-8(%rsp)
test %ecx,-8(%rsp)
jz 1f
not %ecx
and %ecx,-8(%rsp)
ldmxc... | src/fenv/x86_64/fenv.s | null | null | null | null | null |
source | musl | #ifndef CRYPT_H
#define CRYPT_H
#include "../../include/crypt.h"
#include <features.h>
hidden char *__crypt_r(const char *, const char *, struct crypt_data *);
hidden char *__crypt_des(const char *, const char *, char *);
hidden char *__crypt_md5(const char *, const char *, char *);
hidden char *__crypt_blowfish(co... | src/include/crypt.h | null | null | null | null | null |
source | musl | #ifndef ERRNO_H
#define ERRNO_H
#include "../../include/errno.h"
#ifdef __GNUC__
__attribute__((const))
#endif
hidden int *___errno_location(void);
#undef errno
#define errno (*___errno_location())
#endif | src/include/errno.h | null | null | null | null | null |
source | musl | #ifndef FEATURES_H
#define FEATURES_H
#include "../../include/features.h"
#define weak __attribute__((__weak__))
#define hidden __attribute__((__visibility__("hidden")))
#define weak_alias(old, new) \
extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
#endif | src/include/features.h | null | null | null | null | null |
source | musl | #ifndef LANGINFO_H
#define LANGINFO_H
#include "../../include/langinfo.h"
char *__nl_langinfo_l(nl_item, locale_t);
#endif | src/include/langinfo.h | null | null | null | null | null |
source | musl | #ifndef PTHREAD_H
#define PTHREAD_H
#include "../../include/pthread.h"
hidden int __pthread_once(pthread_once_t *, void (*)(void));
hidden void __pthread_testcancel(void);
hidden int __pthread_setcancelstate(int, int *);
hidden int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *... | src/include/pthread.h | null | null | null | null | null |
source | musl | #ifndef RESOLV_H
#define RESOLV_H
#include "../../include/resolv.h"
hidden int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
hidden int __res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
hidden int __res... | src/include/resolv.h | null | null | null | null | null |
source | musl | #ifndef SIGNAL_H
#define SIGNAL_H
#include "../../include/signal.h"
hidden int __sigaction(int, const struct sigaction *, struct sigaction *);
hidden void __block_all_sigs(void *);
hidden void __block_app_sigs(void *);
hidden void __restore_sigs(void *);
hidden void __get_handler_set(sigset_t *);
#endif | src/include/signal.h | null | null | null | null | null |
source | musl | #ifndef STDIO_H
#define STDIO_H
#define __DEFINED_struct__IO_FILE
#include "../../include/stdio.h"
#undef stdin
#undef stdout
#undef stderr
extern hidden FILE __stdin_FILE;
extern hidden FILE __stdout_FILE;
extern hidden FILE __stderr_FILE;
#define stdin (&__stdin_FILE)
#define stdout (&__stdout_FILE)
#define stde... | src/include/stdio.h | null | null | null | null | null |
source | musl | #ifndef STDLIB_H
#define STDLIB_H
#include "../../include/stdlib.h"
hidden int __putenv(char *, size_t, char *);
hidden void __env_rm_add(char *, char *);
hidden int __mkostemps(char *, int, int);
hidden int __ptsname_r(int, char *, size_t);
hidden char *__randname(char *);
hidden void __qsort_r (void *, size_t, size... | src/include/stdlib.h | null | null | null | null | null |
source | musl | #ifndef STRING_H
#define STRING_H
#include "../../include/string.h"
hidden void *__memrchr(const void *, int, size_t);
hidden char *__stpcpy(char *, const char *);
hidden char *__stpncpy(char *, const char *, size_t);
hidden char *__strchrnul(const char *, int);
#endif | src/include/string.h | null | null | null | null | null |
source | musl | #ifndef TIME_H
#define TIME_H
#include "../../include/time.h"
hidden int __clock_gettime(clockid_t, struct timespec *);
hidden int __clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
hidden char *__asctime_r(const struct tm *, char *);
hidden struct tm *__gmtime_r(const time_t *restrict, s... | src/include/time.h | null | null | null | null | null |
source | musl | #ifndef UNISTD_H
#define UNISTD_H
#include "../../include/unistd.h"
extern char **__environ;
hidden int __dup3(int, int, int);
hidden int __mkostemps(char *, int, int);
hidden int __execvpe(const char *, char *const *, char *const *);
hidden off_t __lseek(int, off_t, int);
#endif | src/include/unistd.h | null | null | null | null | null |
source | musl | #ifndef WCHAR_H
#define WCHAR_H
#define __DEFINED_struct__IO_FILE
#include "../../include/wchar.h"
#endif | src/include/wchar.h | null | null | null | null | null |
source | musl | #ifndef ARPA_INET_H
#define ARPA_INET_H
#include "../../../include/arpa/inet.h"
hidden int __inet_aton(const char *, struct in_addr *);
#endif | src/include/arpa/inet.h | null | null | null | null | null |
source | musl | #ifndef SYS_AUXV_H
#define SYS_AUXV_H
#include "../../../include/sys/auxv.h"
#include <features.h>
unsigned long __getauxval(unsigned long);
#endif | src/include/sys/auxv.h | null | null | null | null | null |
source | musl | #ifndef SYS_MEMBARRIER_H
#define SYS_MEMBARRIER_H
#include "../../../include/sys/membarrier.h"
#include <features.h>
hidden int __membarrier(int, int);
#endif | src/include/sys/membarrier.h | null | null | null | null | null |
source | musl | #ifndef SYS_MMAN_H
#define SYS_MMAN_H
#include "../../../include/sys/mman.h"
hidden void __vm_wait(void);
hidden void __vm_lock(void);
hidden void __vm_unlock(void);
hidden void *__mmap(void *, size_t, int, int, int, off_t);
hidden int __munmap(void *, size_t);
hidden void *__mremap(void *, size_t, size_t, int, ...)... | src/include/sys/mman.h | null | null | null | null | null |
source | musl | #ifndef SYS_STAT_H
#define SYS_STAT_H
#include "../../../include/sys/stat.h"
hidden int __fstat(int, struct stat *);
hidden int __fstatat(int, const char *restrict, struct stat *restrict, int);
#endif | src/include/sys/stat.h | null | null | null | null | null |
source | musl | #ifndef SYS_SYSINFO_H
#define SYS_SYSINFO_H
#include "../../../include/sys/sysinfo.h"
#include <features.h>
hidden int __lsysinfo(struct sysinfo *);
#endif | src/include/sys/sysinfo.h | null | null | null | null | null |
source | musl | #ifndef SYS_TIME_H
#define SYS_TIME_H
#include "../../../include/sys/time.h"
hidden int __futimesat(int, const char *, const struct timeval [2]);
#endif | src/include/sys/time.h | null | null | null | null | null |
source | musl | #ifndef AIO_IMPL_H
#define AIO_IMPL_H
extern hidden volatile int __aio_fut;
extern hidden int __aio_close(int);
extern hidden void __aio_atfork(int);
#endif | src/internal/aio_impl.h | null | null | null | null | null |
source | musl | #ifndef _ATOMIC_H
#define _ATOMIC_H
#include <stdint.h>
#include "atomic_arch.h"
#ifdef a_ll
#ifndef a_pre_llsc
#define a_pre_llsc()
#endif
#ifndef a_post_llsc
#define a_post_llsc()
#endif
#ifndef a_cas
#define a_cas a_cas
static inline int a_cas(volatile int *p, int t, int s)
{
int old;
a_pre_llsc();
do old =... | src/internal/atomic.h | null | null | null | null | null |
source | musl | #ifndef _INTERNAL_RELOC_H
#define _INTERNAL_RELOC_H
#include <features.h>
#include <elf.h>
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#if UINTPTR_MAX == 0xffffffff
typedef Elf32_Ehdr Ehdr;
typedef Elf32_Phdr Phdr;
typedef Elf32_Sym Sym;
#define R_TYPE(x) ((x)&255)
#define R_SYM(x) ((x)>>8)
#define R_... | src/internal/dynlink.h | null | null | null | null | null |
source | musl | #include <sys/wait.h>
#include "syscall.h"
#ifndef SYS_wait4
hidden long __emulate_wait4(int pid, int *status, int options, void *kru, int cp)
{
idtype_t t;
int r;
siginfo_t info;
info.si_pid = 0;
if (pid < -1) {
t = P_PGID;
pid = -pid;
} else if (pid == -1) {
t = P_ALL;
} else if (pid == 0) {
t = P_PG... | src/internal/emulate_wait4.c | null | null | null | null | null |
source | musl | #include <stdint.h>
#include <features.h>
hidden void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z)
{
/* If map is a null pointer, the program was loaded by a
* non-FDPIC-aware ELF loader, and fixups are not needed,
* but the value for the GOT pointer is. */
if (!map) return (void *)z[-1];
struct {
u... | src/internal/fdpic_crt.h | null | null | null | null | null |
source | musl | #include <stdint.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include <limits.h>
#include <errno.h>
#include <ctype.h>
#include "shgetc.h"
#include "floatscan.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
#define LD_B1B_DIG 2
#define LD_B1B_MAX 9007199, 254740991
#define KMAX 128
#elif LDBL_MANT... | src/internal/floatscan.c | null | null | null | null | null |
source | musl | #ifndef FLOATSCAN_H
#define FLOATSCAN_H
#include <stdio.h>
hidden long double __floatscan(FILE *, int, int);
#endif | src/internal/floatscan.h | null | null | null | null | null |
source | musl | #include <features.h>
extern hidden volatile int *const __at_quick_exit_lockptr;
extern hidden volatile int *const __atexit_lockptr;
extern hidden volatile int *const __gettext_lockptr;
extern hidden volatile int *const __locale_lockptr;
extern hidden volatile int *const __random_lockptr;
extern hidden volatile int *c... | src/internal/fork_impl.h | null | null | null | null | null |
source | musl | #ifndef _INTERNAL_FUTEX_H
#define _INTERNAL_FUTEX_H
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_FD 2
#define FUTEX_REQUEUE 3
#define FUTEX_CMP_REQUEUE 4
#define FUTEX_WAKE_OP 5
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_PRI... | src/internal/futex.h | null | null | null | null | null |
source | musl | #include <limits.h>
#include <errno.h>
#include <ctype.h>
#include "shgetc.h"
/* Lookup table for digit values. -1==255>=36 -> invalid */
static const unsigned char table[] = { -1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-... | src/internal/intscan.c | null | null | null | null | null |
source | musl | #ifndef INTSCAN_H
#define INTSCAN_H
#include <stdio.h>
hidden unsigned long long __intscan(FILE *, unsigned, int, unsigned long long);
#endif | src/internal/intscan.h | null | null | null | null | null |
source | musl | #include <features.h>
/* This is the structure used for the rt_sigaction syscall on most archs,
* but it can be overridden by a file with the same name in the top-level
* arch dir for a given arch, if necessary. */
struct k_sigaction {
void (*handler)(int);
unsigned long flags;
#ifdef SA_RESTORER
void (*restorer)... | src/internal/ksigaction.h | null | null | null | null | null |
source | musl | #include "libc.h"
struct __libc __libc;
size_t __hwcap;
char *__progname=0, *__progname_full=0;
weak_alias(__progname, program_invocation_short_name);
weak_alias(__progname_full, program_invocation_name); | src/internal/libc.c | null | null | null | null | null |
source | musl | #ifndef LIBC_H
#define LIBC_H
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
struct __locale_map;
struct __locale_struct {
const struct __locale_map *cat[6];
};
struct tls_module {
struct tls_module *next;
void *image;
size_t len, size, align, offset;
};
struct __libc {
char can_do_threads;
char ... | src/internal/libc.h | null | null | null | null | null |
source | musl | #ifndef _LIBM_H
#define _LIBM_H
#include <stdint.h>
#include <float.h>
#include <math.h>
#include <endian.h>
#include "fp_arch.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN
union ldshape {
long double f;
struct {
uint64_t m... | src/internal/libm.h | null | null | null | null | null |
source | musl | #ifndef _LOCALE_IMPL_H
#define _LOCALE_IMPL_H
#include <locale.h>
#include <stdlib.h>
#include "libc.h"
#include "pthread_impl.h"
#define LOCALE_NAME_MAX 23
struct __locale_map {
const void *map;
size_t map_size;
char name[LOCALE_NAME_MAX+1];
const struct __locale_map *next;
};
extern hidden volatile int __loca... | src/internal/locale_impl.h | null | null | null | null | null |
source | musl | #ifndef LOCK_H
#define LOCK_H
hidden void __lock(volatile int *);
hidden void __unlock(volatile int *);
#define LOCK(x) __lock(x)
#define UNLOCK(x) __unlock(x)
#endif | src/internal/lock.h | null | null | null | null | null |
source | musl | #include "syscall.h"
void __procfdname(char *buf, unsigned fd)
{
unsigned i, j;
for (i=0; (buf[i] = "/proc/self/fd/"[i]); i++);
if (!fd) {
buf[i] = '0';
buf[i+1] = 0;
return;
}
for (j=fd; j; j/=10, i++);
buf[i] = 0;
for (; fd; fd/=10) buf[--i] = '0' + fd%10;
} | src/internal/procfdname.c | null | null | null | null | null |
source | musl | #ifndef _PTHREAD_IMPL_H
#define _PTHREAD_IMPL_H
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#include <limits.h>
#include <sys/mman.h>
#include "libc.h"
#include "syscall.h"
#include "atomic.h"
#include "futex.h"
#include "pthread_arch.h"
#define pthread __pthread
struct pthread {
/* Part 1 -- these... | src/internal/pthread_impl.h | null | null | null | null | null |
source | musl | #include "shgetc.h"
/* The shcnt field stores the number of bytes read so far, offset by
* the value of buf-rpos at the last function call (__shlim or __shgetc),
* so that between calls the inline shcnt macro can add rpos-buf to get
* the actual count. */
void __shlim(FILE *f, off_t lim)
{
f->shlim = lim;
f->shc... | src/internal/shgetc.c | null | null | null | null | null |
source | musl | #include "stdio_impl.h"
/* Scan helper "stdio" functions for use by scanf-family and strto*-family
* functions. These accept either a valid stdio FILE, or a minimal pseudo
* FILE whose buffer pointers point into a null-terminated string. In the
* latter case, the sh_fromstring macro should be used to setup the FILE... | src/internal/shgetc.h | null | null | null | null | null |
source | musl | #ifndef _STDIO_IMPL_H
#define _STDIO_IMPL_H
#include <stdio.h>
#include "syscall.h"
#define UNGET 8
#define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
#define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
#define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0)
#define F... | src/internal/stdio_impl.h | null | null | null | null | null |
source | musl | #ifndef _INTERNAL_SYSCALL_H
#define _INTERNAL_SYSCALL_H
#include <features.h>
#include <errno.h>
#include <sys/syscall.h>
#include "syscall_arch.h"
#ifndef SYSCALL_RLIM_INFINITY
#define SYSCALL_RLIM_INFINITY (~0ULL)
#endif
#ifndef SYSCALL_MMAP2_UNIT
#define SYSCALL_MMAP2_UNIT 4096ULL
#endif
#ifndef __SYSCALL_LL_PRW... | src/internal/syscall.h | null | null | null | null | null |
source | musl | #include <errno.h>
#include "syscall.h"
long __syscall_ret(unsigned long r)
{
if (r > -4096UL) {
errno = -r;
return -1;
}
return r;
} | src/internal/syscall_ret.c | null | null | null | null | null |
source | musl | #include <elf.h>
#include <link.h>
#include <limits.h>
#include <stdint.h>
#include <string.h>
#include "libc.h"
#include "syscall.h"
#ifdef VDSO_USEFUL
#if ULONG_MAX == 0xffffffff
typedef Elf32_Ehdr Ehdr;
typedef Elf32_Phdr Phdr;
typedef Elf32_Sym Sym;
typedef Elf32_Verdef Verdef;
typedef Elf32_Verdaux Verdaux;
#els... | src/internal/vdso.c | null | null | null | null | null |
source | musl | #include <sys/ipc.h>
#include <sys/stat.h>
key_t ftok(const char *path, int id)
{
struct stat st;
if (stat(path, &st) < 0) return -1;
return ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) | ((id & 0xffu) << 24));
} | src/ipc/ftok.c | null | null | null | null | null |
source | musl | #include "syscall.h"
#define IPCOP_semop 1
#define IPCOP_semget 2
#define IPCOP_semctl 3
#define IPCOP_semtimedop 4
#define IPCOP_msgsnd 11
#define IPCOP_msgrcv 12
#define IPCOP_msgget 13
#define IPCOP_msgctl 14
#define IPCOP_shmat 21
#define IPCOP_shmdt 22
#define IPCOP_shmget 23
#... | src/ipc/ipc.h | null | null | null | null | null |
source | musl | #include <sys/msg.h>
#include <endian.h>
#include "syscall.h"
#include "ipc.h"
#if __BYTE_ORDER != __BIG_ENDIAN
#undef SYSCALL_IPC_BROKEN_MODE
#endif
int msgctl(int q, int cmd, struct msqid_ds *buf)
{
#if IPC_TIME64
struct msqid_ds out, *orig;
if (cmd&IPC_TIME64) {
out = (struct msqid_ds){0};
orig = buf;
buf ... | src/ipc/msgctl.c | null | null | null | null | null |
source | musl | #include <sys/msg.h>
#include "syscall.h"
#include "ipc.h"
int msgget(key_t k, int flag)
{
#ifndef SYS_ipc
return syscall(SYS_msgget, k, flag);
#else
return syscall(SYS_ipc, IPCOP_msgget, k, flag);
#endif
} | src/ipc/msgget.c | null | null | null | null | null |
source | musl | #include <sys/msg.h>
#include "syscall.h"
#include "ipc.h"
ssize_t msgrcv(int q, void *m, size_t len, long type, int flag)
{
#ifndef SYS_ipc
return syscall_cp(SYS_msgrcv, q, m, len, type, flag);
#else
return syscall_cp(SYS_ipc, IPCOP_msgrcv, q, len, flag, ((long[]){ (long)m, type }));
#endif
} | src/ipc/msgrcv.c | null | null | null | null | null |
source | musl | #include <sys/msg.h>
#include "syscall.h"
#include "ipc.h"
int msgsnd(int q, const void *m, size_t len, int flag)
{
#ifndef SYS_ipc
return syscall_cp(SYS_msgsnd, q, m, len, flag);
#else
return syscall_cp(SYS_ipc, IPCOP_msgsnd, q, len, flag, m);
#endif
} | src/ipc/msgsnd.c | null | null | null | null | null |
source | musl | #include <sys/sem.h>
#include <stdarg.h>
#include <endian.h>
#include "syscall.h"
#include "ipc.h"
#if __BYTE_ORDER != __BIG_ENDIAN
#undef SYSCALL_IPC_BROKEN_MODE
#endif
union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
};
int semctl(int id, int num, int cmd, ...)
{
union semun arg = {0};
va_l... | src/ipc/semctl.c | null | null | null | null | null |
source | musl | #include <sys/sem.h>
#include <limits.h>
#include <errno.h>
#include "syscall.h"
#include "ipc.h"
int semget(key_t key, int n, int fl)
{
/* The kernel uses the wrong type for the sem_nsems member
* of struct semid_ds, and thus might not check that the
* n fits in the correct (per POSIX) userspace type, so
* we ... | src/ipc/semget.c | null | null | null | null | null |
source | musl | #include <sys/sem.h>
#include "syscall.h"
#include "ipc.h"
int semop(int id, struct sembuf *buf, size_t n)
{
#ifndef SYS_ipc
return syscall(SYS_semop, id, buf, n);
#else
return syscall(SYS_ipc, IPCOP_semop, id, n, 0, buf);
#endif
} | src/ipc/semop.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <sys/sem.h>
#include <errno.h>
#include "syscall.h"
#include "ipc.h"
#define IS32BIT(x) !((x)+0x80000000ULL>>32)
#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
#if !defined(SYS_semtimedop) && !defined(SYS_ipc) || \
SYS_semtimedop == SYS_semtimedop_time64
#define ... | src/ipc/semtimedop.c | null | null | null | null | null |
source | musl | #include <sys/shm.h>
#include "syscall.h"
#include "ipc.h"
#ifndef SYS_ipc
void *shmat(int id, const void *addr, int flag)
{
return (void *)syscall(SYS_shmat, id, addr, flag);
}
#else
void *shmat(int id, const void *addr, int flag)
{
unsigned long ret;
ret = syscall(SYS_ipc, IPCOP_shmat, id, flag, &addr, addr);
re... | src/ipc/shmat.c | null | null | null | null | null |
source | musl | #include <sys/shm.h>
#include <endian.h>
#include "syscall.h"
#include "ipc.h"
#if __BYTE_ORDER != __BIG_ENDIAN
#undef SYSCALL_IPC_BROKEN_MODE
#endif
int shmctl(int id, int cmd, struct shmid_ds *buf)
{
#if IPC_TIME64
struct shmid_ds out, *orig;
if (cmd&IPC_TIME64) {
out = (struct shmid_ds){0};
orig = buf;
buf... | src/ipc/shmctl.c | null | null | null | null | null |
source | musl | #include <sys/shm.h>
#include "syscall.h"
#include "ipc.h"
int shmdt(const void *addr)
{
#ifndef SYS_ipc
return syscall(SYS_shmdt, addr);
#else
return syscall(SYS_ipc, IPCOP_shmdt, 0, 0, 0, addr);
#endif
} | src/ipc/shmdt.c | null | null | null | null | null |
source | musl | #include <sys/shm.h>
#include <stdint.h>
#include "syscall.h"
#include "ipc.h"
int shmget(key_t key, size_t size, int flag)
{
if (size > PTRDIFF_MAX) size = SIZE_MAX;
#ifndef SYS_ipc
return syscall(SYS_shmget, key, size, flag);
#else
return syscall(SYS_ipc, IPCOP_shmget, key, size, flag);
#endif
} | src/ipc/shmget.c | null | null | null | null | null |
source | musl | #include <dlfcn.h>
#include "dynlink.h"
static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra)
{
__dl_seterr("Symbol not found: %s", s);
return 0;
}
weak_alias(stub_dlsym, __dlsym);
#if _REDIR_TIME64
weak_alias(stub_dlsym, __dlsym_redir_time64);
#endif | src/ldso/__dlsym.c | null | null | null | null | null |
source | musl | #include <elf.h>
#include <link.h>
#include "pthread_impl.h"
#include "libc.h"
#define AUX_CNT 38
extern weak hidden const size_t _DYNAMIC[];
static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void *data), void *data)
{
unsigned char *p;
ElfW(Phdr) *phdr, *tls_phdr=0;
size_t ... | src/ldso/dl_iterate_phdr.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <dlfcn.h>
static int stub_dladdr(const void *addr, Dl_info *info)
{
return 0;
}
weak_alias(stub_dladdr, dladdr); | src/ldso/dladdr.c | null | null | null | null | null |
source | musl | #include <dlfcn.h>
#include <stdlib.h>
#include <stdarg.h>
#include "pthread_impl.h"
#include "dynlink.h"
#include "atomic.h"
#define malloc __libc_malloc
#define calloc __libc_calloc
#define realloc __libc_realloc
#define free __libc_free
char *dlerror()
{
pthread_t self = __pthread_self();
if (!self->dlerror_flag... | src/ldso/dlerror.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <dlfcn.h>
#include "dynlink.h"
int dlinfo(void *dso, int req, void *res)
{
if (__dl_invalid_handle(dso)) return -1;
if (req != RTLD_DI_LINKMAP) {
__dl_seterr("Unsupported request %d", req);
return -1;
}
*(struct link_map **)res = dso;
return 0;
} | src/ldso/dlinfo.c | null | null | null | null | null |
source | musl | #include <dlfcn.h>
#include "dynlink.h"
static void *stub_dlopen(const char *file, int mode)
{
__dl_seterr("Dynamic loading not supported");
return 0;
}
weak_alias(stub_dlopen, dlopen); | src/ldso/dlopen.c | null | null | null | null | null |
source | musl | #include <dlfcn.h>
#include "dynlink.h"
void *dlsym(void *restrict p, const char *restrict s)
{
return __dlsym(p, s, 0);
} | src/ldso/dlsym.c | null | null | null | null | null |
source | musl | #include <stddef.h>
#include <dynlink.h>
ptrdiff_t __tlsdesc_static()
{
return 0;
}
weak_alias(__tlsdesc_static, __tlsdesc_dynamic); | src/ldso/tlsdesc.c | null | null | null | null | null |
source | musl | // size_t __tlsdesc_static(size_t *a)
// {
// return a[1];
// }
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,@function
__tlsdesc_static:
ldr x0,[x0,#8]
ret
// size_t __tlsdesc_dynamic(size_t *a)
// {
// struct {size_t modidx,off;} *p = (void*)a[1];
// size_t *dtv = *(size_t**)(tp - 8);... | src/ldso/aarch64/tlsdesc.s | null | null | null | null | null |
source | musl | .syntax unified
.text
.global dlsym
.hidden __dlsym
.type dlsym,%function
dlsym:
mov r2,lr
b __dlsym | src/ldso/arm/dlsym.s | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <link.h>
#include <stdint.h>
struct find_exidx_data {
uintptr_t pc, exidx_start;
int exidx_len;
};
static int find_exidx(struct dl_phdr_info *info, size_t size, void *ptr)
{
struct find_exidx_data *data = ptr;
const ElfW(Phdr) *phdr = info->dlpi_phdr;
uintptr_t addr, exidx_start = 0;... | src/ldso/arm/find_exidx.c | null | null | null | null | null |
source | musl | .syntax unified
.text
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,%function
__tlsdesc_static:
ldr r0,[r0]
bx lr
.global __tlsdesc_dynamic
.hidden __tlsdesc_dynamic
.type __tlsdesc_dynamic,%function
__tlsdesc_dynamic:
push {r2,r3,ip,lr}
ldr r1,[r0]
ldr r2,[r1,#4] // r2 = offset
ldr ... | src/ldso/arm/tlsdesc.S | null | null | null | null | null |
source | musl | .text
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
push (%esp)
push 12(%esp)
push 12(%esp)
call __dlsym
add $12,%esp
ret | src/ldso/i386/dlsym.s | null | null | null | null | null |
source | musl | .text
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,@function
__tlsdesc_static:
mov 4(%eax),%eax
ret
.global __tlsdesc_dynamic
.hidden __tlsdesc_dynamic
.type __tlsdesc_dynamic,@function
__tlsdesc_dynamic:
mov 4(%eax),%eax
push %edx
mov %gs:4,%edx
push %ecx
mov (%eax),%ecx
mov 4(%eax... | src/ldso/i386/tlsdesc.s | null | null | null | null | null |
source | musl | .global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
move $a2, $ra
la.global $t0, __dlsym
jr $t0 | src/ldso/loongarch64/dlsym.s | null | null | null | null | null |
source | musl | .text
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,%function
__tlsdesc_static:
ld.d $a0, $a0, 8
jr $ra
# size_t __tlsdesc_dynamic(size_t *a)
# {
# struct {size_t modidx,off;} *p = (void*)a[1];
# size_t *dtv = *(size_t**)(tp - 8);
# return dtv[p->modidx] + p->off - tp;
# }
.g... | src/ldso/loongarch64/tlsdesc.s | null | null | null | null | null |
source | musl | .text
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
move.l (%sp),-(%sp)
move.l 12(%sp),-(%sp)
move.l 12(%sp),-(%sp)
lea __dlsym-.-8,%a1
jsr (%pc,%a1)
add.l #12,%sp
rts | src/ldso/m68k/dlsym.s | null | null | null | null | null |
source | musl | .set noreorder
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
lui $gp, %hi(_gp_disp)
addiu $gp, %lo(_gp_disp)
addu $gp, $gp, $25
move $6, $ra
lw $25, %call16(__dlsym)($gp)
addiu $sp, $sp, -16
sw $ra, 12($sp)
jalr $25
nop
lw $ra, 12($sp)
jr $ra
addiu $sp, $sp, 16 | src/ldso/mips/dlsym.s | null | null | null | null | null |
source | musl | .set noreorder
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
lui $3, %hi(%neg(%gp_rel(dlsym)))
daddiu $3, $3, %lo(%neg(%gp_rel(dlsym)))
daddu $3, $3, $25
move $6, $ra
ld $25, %got_disp(__dlsym)($3)
daddiu $sp, $sp, -32
sd $ra, 24($sp)
jalr $25
nop
ld $ra, 24($sp)
jr $ra
daddiu $sp, $sp, 32 | src/ldso/mips64/dlsym.s | null | null | null | null | null |
source | musl | .set noreorder
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
lui $3, %hi(%neg(%gp_rel(dlsym)))
addiu $3, $3, %lo(%neg(%gp_rel(dlsym)))
addu $3, $3, $25
move $6, $ra
lw $25, %got_disp(__dlsym)($3)
addiu $sp, $sp, -32
sd $ra, 16($sp)
jalr $25
nop
ld $ra, 16($sp)
jr $ra
addiu $sp, $sp, 32 | src/ldso/mipsn32/dlsym.s | null | null | null | null | null |
source | musl | .text
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
mflr 5 # The return address is arg3.
b __dlsym
.size dlsym, .-dlsym | src/ldso/powerpc/dlsym.s | null | null | null | null | null |
source | musl | .text
.global dlsym
.hidden __dlsym
.type dlsym,@function
dlsym:
addis 2, 12, .TOC.-dlsym@ha
addi 2, 2, .TOC.-dlsym@l
.localentry dlsym,.-dlsym
mflr 5 # The return address is arg3.
b __dlsym
.size dlsym, .-dlsym | src/ldso/powerpc64/dlsym.s | null | null | null | null | null |
source | musl | .text
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,%function
__tlsdesc_static:
ld a0,8(a0)
jr t0
.global __tlsdesc_dynamic
.hidden __tlsdesc_dynamic
.type __tlsdesc_dynamic,%function
__tlsdesc_dynamic:
add sp,sp,-16
sd t1,(sp)
sd t2,8(sp)
ld t2,-8(tp) # t2=dtv
ld a0,8(a0) # a0=&{m... | src/ldso/riscv64/tlsdesc.s | null | null | null | null | null |
source | musl | .text
.global dlsym
.hidden __dlsym
.type dlsym, @function
dlsym:
mov.l L1, r0
1: braf r0
sts pr, r6
.align 2
L1: .long __dlsym@PLT-(1b+4-.) | src/ldso/sh/dlsym.s | null | null | null | null | null |
source | musl | .text
.global __tlsdesc_static
.hidden __tlsdesc_static
.type __tlsdesc_static,@function
__tlsdesc_static:
mov 8(%rax),%rax
ret
.global __tlsdesc_dynamic
.hidden __tlsdesc_dynamic
.type __tlsdesc_dynamic,@function
__tlsdesc_dynamic:
mov 8(%rax),%rax
push %rdx
mov %fs:8,%rdx
push %rcx
mov (%rax),%rcx
mov 8(%rax... | src/ldso/x86_64/tlsdesc.s | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <pwd.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
char *cuserid(char *buf)
{
static char usridbuf[L_cuserid];
struct passwd pw, *ppw;
long pwb[256];
if (buf) *buf = 0;
getpwuid_r(geteuid(), &pw, (void *)pwb, sizeof pwb, &ppw);
if (!ppw)
return buf;
size_t len = st... | src/legacy/cuserid.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <fcntl.h>
#include <unistd.h>
int daemon(int nochdir, int noclose)
{
if (!nochdir && chdir("/"))
return -1;
if (!noclose) {
int fd, failed = 0;
if ((fd = open("/dev/null", O_RDWR)) < 0) return -1;
if (dup2(fd, 0) < 0 || dup2(fd, 1) < 0 || dup2(fd, 2) < 0)
failed++;
if (fd > ... | src/legacy/daemon.c | null | null | null | null | null |
source | musl | #include <err.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
extern char *__progname;
void vwarn(const char *fmt, va_list ap)
{
fprintf (stderr, "%s: ", __progname);
if (fmt) {
vfprintf(stderr, fmt, ap);
fputs (": ", stderr);
}
perror(0);
}
void vwarnx(const char *fmt, va_list ap)
{
fprintf (... | src/legacy/err.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>
int euidaccess(const char *filename, int amode)
{
return faccessat(AT_FDCWD, filename, amode, AT_EACCESS);
}
weak_alias(euidaccess, eaccess); | src/legacy/euidaccess.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <sys/stat.h>
#include <sys/time.h>
int futimes(int fd, const struct timeval tv[2])
{
struct timespec times[2];
if (!tv) return futimens(fd, 0);
times[0].tv_sec = tv[0].tv_sec;
times[0].tv_nsec = tv[0].tv_usec * 1000;
times[1].tv_sec = tv[1].tv_sec;
times[1].tv_nsec = tv[1].tv_usec ... | src/legacy/futimes.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include <limits.h>
#include <sys/resource.h>
int getdtablesize(void)
{
struct rlimit rl;
getrlimit(RLIMIT_NOFILE, &rl);
return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX;
} | src/legacy/getdtablesize.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <stdlib.h>
#include <sys/sysinfo.h>
int getloadavg(double *a, int n)
{
struct sysinfo si;
if (n <= 0) return n ? -1 : 0;
sysinfo(&si);
if (n > 3) n = 3;
for (int i=0; i<n; i++)
a[i] = 1.0/(1<<SI_LOAD_SHIFT) * si.loads[i];
return n;
} | src/legacy/getloadavg.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include "libc.h"
int getpagesize(void)
{
return PAGE_SIZE;
} | src/legacy/getpagesize.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
char *getpass(const char *prompt)
{
int fd;
struct termios s, t;
ssize_t l;
static char password[128];
if ((fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) return 0;
tcgetattr(fd, &t);
... | src/legacy/getpass.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
static const char defshells[] = "/bin/sh\n/bin/csh\n";
static char *line;
static size_t linesize;
static FILE *f;
void endusershell(void)
{
if (f) fclose(f);
f = 0;
}
void setusershell(void)
{
if (!f) f = fopen("/etc/shells", "rbe");
if (!f) f = fmemope... | src/legacy/getusershell.c | null | null | null | null | null |
source | musl | #include <stropts.h>
#include <fcntl.h>
int isastream(int fd)
{
return fcntl(fd, F_GETFD) < 0 ? -1 : 0;
} | src/legacy/isastream.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
int lutimes(const char *filename, const struct timeval tv[2])
{
struct timespec times[2];
if (tv) {
times[0].tv_sec = tv[0].tv_sec;
times[0].tv_nsec = tv[0].tv_usec * 1000;
times[1].tv_sec = tv[1].tv_sec;
times[1].tv_nsec = ... | src/legacy/lutimes.c | null | null | null | null | null |
source | musl | #include <sys/resource.h>
#include <ulimit.h>
#include <stdarg.h>
long ulimit(int cmd, ...)
{
struct rlimit rl;
getrlimit(RLIMIT_FSIZE, &rl);
if (cmd == UL_SETFSIZE) {
long val;
va_list ap;
va_start(ap, cmd);
val = va_arg(ap, long);
va_end(ap);
rl.rlim_cur = 512ULL * val;
if (setrlimit(RLIMIT_FSIZE, &... | src/legacy/ulimit.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <utmpx.h>
#include <stddef.h>
#include <errno.h>
void endutxent(void)
{
}
void setutxent(void)
{
}
struct utmpx *getutxent(void)
{
return NULL;
}
struct utmpx *getutxid(const struct utmpx *ut)
{
return NULL;
}
struct utmpx *getutxline(const struct utmpx *ut)
{
return NULL;
}
struct... | src/legacy/utmpx.c | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.