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 __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm #r0: volatile. may be modified during linkage. #r1: stack frame: 16 byte alignment. #r2: tls/thread pointer on pp32 #r3,r4: return values, f...
src/thread/powerpc/syscall_cp.s
null
null
null
null
null
source
musl
.text .global __set_thread_area .hidden __set_thread_area .type __set_thread_area, %function __set_thread_area: mr 13, 3 li 3, 0 blr
src/thread/powerpc64/__set_thread_area.s
null
null
null
null
null
source
musl
.text .global __clone .hidden __clone .type __clone, %function __clone: # int clone(fn, stack, flags, arg, ptid, tls, ctid) # a b c d e f g # 3 4 5 6 7 8 9 # pseudo C code: # tid = syscall(SYS_clone,c,b,e,f,g); # if (!tid) syscall(SYS_exit, a(d)); #...
src/thread/powerpc64/clone.s
null
null
null
null
null
source
musl
.global __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm .text .type __syscall_cp_asm,%function __syscall_cp_asm: # at enter: r3 = pointer to self->cancel, r4: syscall no, r5: first arg...
src/thread/powerpc64/syscall_cp.s
null
null
null
null
null
source
musl
.global __set_thread_area .type __set_thread_area, %function __set_thread_area: mv tp, a0 li a0, 0 ret
src/thread/riscv32/__set_thread_area.s
null
null
null
null
null
source
musl
.global __unmapself .type __unmapself, %function __unmapself: li a7, 215 # SYS_munmap ecall li a7, 93 # SYS_exit ecall
src/thread/riscv32/__unmapself.s
null
null
null
null
null
source
musl
# __clone(func, stack, flags, arg, ptid, tls, ctid) # a0, a1, a2, a3, a4, a5, a6 # syscall(SYS_clone, flags, stack, ptid, tls, ctid) # a7 a0, a1, a2, a3, a4 .global __clone .type __clone, %function __clone: # Save func and arg to stack andi a1, a1, -16 addi a1, a1,...
src/thread/riscv32/clone.s
null
null
null
null
null
source
musl
.global __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm .type __syscall_cp_asm, %function __syscall_cp_asm: __cp_begin: lw t0, 0(a0) bnez t0, __cp_cancel mv t0, a1 mv a0, a2 mv a1, a3 mv a2,...
src/thread/riscv32/syscall_cp.s
null
null
null
null
null
source
musl
# __clone(func, stack, flags, arg, ptid, tls, ctid) # a0, a1, a2, a3, a4, a5, a6 # syscall(SYS_clone, flags, stack, ptid, tls, ctid) # a7 a0, a1, a2, a3, a4 .global __clone .type __clone, %function __clone: # Save func and arg to stack andi a1, a1, -16 addi a1, a1,...
src/thread/riscv64/clone.s
null
null
null
null
null
source
musl
.global __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm .type __syscall_cp_asm, %function __syscall_cp_asm: __cp_begin: lw t0, 0(a0) bnez t0, __cp_cancel mv t0, a1 mv a0, a2 mv a1, a3 mv a2,...
src/thread/riscv64/syscall_cp.s
null
null
null
null
null
source
musl
.text .global __set_thread_area .hidden __set_thread_area .type __set_thread_area, %function __set_thread_area: sar %a1, %r2 srlg %r2, %r2, 32 sar %a0, %r2 lghi %r2, 0 br %r14
src/thread/s390x/__set_thread_area.s
null
null
null
null
null
source
musl
.global __tls_get_offset .type __tls_get_offset,%function __tls_get_offset: ear %r3, %a0 sllg %r3, %r3, 32 ear %r3, %a1 la %r1, 0(%r2, %r12) lg %r0, 0(%r1) sllg %r4, %r0, 3 lg %r5, 8(%r3) lg %r2, 0(%r4, %r5) ag %r2, 8(%r1) sgr %r2, %r3 br %r14
src/thread/s390x/__tls_get_offset.s
null
null
null
null
null
source
musl
.text .global __unmapself .type __unmapself, @function __unmapself: svc 91 # SYS_munmap svc 1 # SYS_exit
src/thread/s390x/__unmapself.s
null
null
null
null
null
source
musl
.text .global __clone .hidden __clone .type __clone, %function __clone: # int clone( # fn, a = r2 # stack, b = r3 # flags, c = r4 # arg, d = r5 # ptid, e = r6 # tls, f = *(r15+160) # ctid) g = *(r15+168) # # pseudo C code: # tid = syscall(SYS_clone,b,c,e,g,f); # i...
src/thread/s390x/clone.s
null
null
null
null
null
source
musl
.global __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm .text .type __syscall_cp_asm,%function __syscall_cp_asm: __cp_begin: icm %r2, 15, 0(%r2) jne __cp_cancel stg %r6, 48(%r15) s...
src/thread/s390x/syscall_cp.s
null
null
null
null
null
source
musl
#include "pthread_impl.h" #include "libc.h" #include <elf.h> /* Also perform sh-specific init */ #define CPU_HAS_LLSC 0x0040 #define CPU_HAS_CAS_L 0x0400 extern hidden const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[]; hidden const void *__sh_cas_ptr; hidden unsigned __sh_nommu; int ...
src/thread/sh/__set_thread_area.c
null
null
null
null
null
source
musl
#include "pthread_impl.h" hidden void __unmapself_sh_mmu(void *, size_t); hidden void __unmapself_sh_nommu(void *, size_t); #if !defined(__SH3__) && !defined(__SH4__) #define __unmapself __unmapself_sh_nommu #include "dynlink.h" #undef CRTJMP #define CRTJMP(pc,sp) __asm__ __volatile__( \ "mov.l @%0+,r0 ; mov.l @%0,r...
src/thread/sh/__unmapself.c
null
null
null
null
null
source
musl
.text .global __unmapself_sh_mmu .hidden __unmapself_sh_mmu .type __unmapself_sh_mmu, @function __unmapself_sh_mmu: mov #91, r3 ! SYS_munmap trapa #31 or r0, r0 or r0, r0 or r0, r0 or r0, r0 or r0, r0 mov #1, r3 ! SYS_exit mov #0, r4 trapa #31 or r0, r0 or r0, r0 or r0...
src/thread/sh/__unmapself_mmu.s
null
null
null
null
null
source
musl
/* Contract for all versions is same as cas.l r2,r3,@r0 * pr and r1 are also clobbered (by jsr & r1 as temp). * r0,r2,r4-r15 must be preserved. * r3 contains result (==r2 iff cas succeeded). */ .align 2 .global __sh_cas_gusa .hidden __sh_cas_gusa __sh_cas_gusa: mov.l r5,@-r15 mov.l r4,@-r15 mov r0,r4 mova 1f,r...
src/thread/sh/atomics.s
null
null
null
null
null
source
musl
.text .global __clone .hidden __clone .type __clone, @function __clone: ! incoming: fn stack flags arg ptid tls ctid ! r4 r5 r6 r7 @r15 @(4,r15) @(8,r15) mov #-16, r0 and r0, r5 mov r4, r1 ! r1 = fn mov r7, r2 ! r2 = arg mov #120, r3 ! r3 = __NR_clone mov...
src/thread/sh/clone.s
null
null
null
null
null
source
musl
.text .global __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm .type __syscall_cp_asm, @function __syscall_cp_asm: __cp_begin: mov.l @r4, r4 tst r4, r4 bf __cp_cancel mov r5, r3 mov ...
src/thread/sh/syscall_cp.s
null
null
null
null
null
source
musl
/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ .text .global __set_thread_area .hidden __set_thread_area .type __set_thread_area,@function __set_thread_area: mov %edi,%esi /* shift for syscall */ movl $0x1002,%edi /* SET_FS register */ movl $0x4000009e,%eax /...
src/thread/x32/__set_thread_area.s
null
null
null
null
null
source
musl
/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ .text .global __unmapself .type __unmapself,@function __unmapself: movl $0x4000000b,%eax /* SYS_munmap */ syscall /* munmap(arg2,arg3) */ xor %rdi,%rdi /* exit() args: always return success */ movl $0x4000003c,%eax /* SY...
src/thread/x32/__unmapself.s
null
null
null
null
null
source
musl
.text .global __clone .hidden __clone .type __clone,@function __clone: movl $0x40000038,%eax /* SYS_clone */ mov %rdi,%r11 mov %rdx,%rdi mov %r8,%rdx mov %r9,%r8 mov 8(%rsp),%r10 mov %r11,%r9 and $-16,%rsi sub $8,%rsi mov %rcx,(%rsi) syscall test %eax,%eax jnz 1f xor %ebp,%ebp pop %rdi call *%r9 mov ...
src/thread/x32/clone.s
null
null
null
null
null
source
musl
.text .global __cp_begin .hidden __cp_begin .global __cp_end .hidden __cp_end .global __cp_cancel .hidden __cp_cancel .hidden __cancel .global __syscall_cp_asm .hidden __syscall_cp_asm .type __syscall_cp_asm,@function __syscall_cp_asm: __cp_begin: mov (%rdi),%eax test %eax,%eax jnz __cp_cancel mov %rdi,%r11 mov...
src/thread/x32/syscall_cp.s
null
null
null
null
null
source
musl
/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ .text .global __set_thread_area .hidden __set_thread_area .type __set_thread_area,@function __set_thread_area: mov %rdi,%rsi /* shift for syscall */ movl $0x1002,%edi /* SET_FS register */ movl $158,%eax /* set f...
src/thread/x86_64/__set_thread_area.s
null
null
null
null
null
source
musl
/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ .text .global __unmapself .type __unmapself,@function __unmapself: movl $11,%eax /* SYS_munmap */ syscall /* munmap(arg2,arg3) */ xor %rdi,%rdi /* exit() args: always return success */ movl $60,%eax /* SYS_exit */ sysca...
src/thread/x86_64/__unmapself.s
null
null
null
null
null
source
musl
.text .global __clone .hidden __clone .type __clone,@function __clone: xor %eax,%eax mov $56,%al mov %rdi,%r11 mov %rdx,%rdi mov %r8,%rdx mov %r9,%r8 mov 8(%rsp),%r10 mov %r11,%r9 and $-16,%rsi sub $8,%rsi mov %rcx,(%rsi) syscall test %eax,%eax jnz 1f xor %ebp,%ebp pop %rdi call *%r9 mov %eax,%edi ...
src/thread/x86_64/clone.s
null
null
null
null
null
source
musl
#include <sys/mman.h> #include <fcntl.h> #include <sys/stat.h> #include "syscall.h" const char unsigned *__map_file(const char *pathname, size_t *size) { struct stat st; const unsigned char *map = MAP_FAILED; int fd = sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) return 0; if (!__fstat(fd, &st)) ...
src/time/__map_file.c
null
null
null
null
null
source
musl
#include "time_impl.h" long long __tm_to_secs(const struct tm *tm) { int is_leap; long long year = tm->tm_year; int month = tm->tm_mon; if (month >= 12 || month < 0) { int adj = month / 12; month %= 12; if (month < 0) { adj--; month += 12; } year += adj; } long long t = __year_to_secs(year, &is_l...
src/time/__tm_to_secs.c
null
null
null
null
null
source
musl
#include "time_impl.h" #include <stdint.h> #include <limits.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <ctype.h> #include "libc.h" #include "lock.h" #include "fork_impl.h" #define malloc __libc_malloc #define calloc undef #define realloc undef #define free undef long __timezone = 0; in...
src/time/__tz.c
null
null
null
null
null
source
musl
long long __year_to_secs(long long year, int *is_leap) { if (year-2ULL <= 136) { int y = year; int leaps = (y-68)>>2; if (!((y-68)&3)) { leaps--; if (is_leap) *is_leap = 1; } else if (is_leap) *is_leap = 0; return 31536000*(y-70) + 86400*leaps; } int cycles, centuries, leaps, rem, dummy; if (!is_l...
src/time/__year_to_secs.c
null
null
null
null
null
source
musl
#include <time.h> char *asctime(const struct tm *tm) { static char buf[26]; return __asctime_r(tm, buf); }
src/time/asctime.c
null
null
null
null
null
source
musl
#include <time.h> #include <stdio.h> #include <langinfo.h> #include "locale_impl.h" #include "atomic.h" char *__asctime_r(const struct tm *restrict tm, char *restrict buf) { if (snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", __nl_langinfo_l(ABDAY_1+tm->tm_wday, C_LOCALE), __nl_langinfo_l(ABMON_1+tm->tm_mon...
src/time/asctime_r.c
null
null
null
null
null
source
musl
#include <time.h> #include <limits.h> clock_t clock() { struct timespec ts; if (__clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts)) return -1; if (ts.tv_sec > LONG_MAX/1000000 || ts.tv_nsec/1000 > LONG_MAX-1000000*ts.tv_sec) return -1; return ts.tv_sec*1000000 + ts.tv_nsec/1000; }
src/time/clock.c
null
null
null
null
null
source
musl
#include <time.h> #include <errno.h> #include <unistd.h> #include "syscall.h" int clock_getcpuclockid(pid_t pid, clockid_t *clk) { struct timespec ts; clockid_t id = (-pid-1)*8U + 2; int ret = __syscall(SYS_clock_getres, id, &ts); if (ret == -EINVAL) ret = -ESRCH; if (ret) return -ret; *clk = id; return 0; }
src/time/clock_getcpuclockid.c
null
null
null
null
null
source
musl
#include <time.h> #include "syscall.h" int clock_getres(clockid_t clk, struct timespec *ts) { #ifdef SYS_clock_getres_time64 /* On a 32-bit arch, use the old syscall if it exists. */ if (SYS_clock_getres != SYS_clock_getres_time64) { long ts32[2]; int r = __syscall(SYS_clock_getres, clk, ts32); if (!r && ts) {...
src/time/clock_getres.c
null
null
null
null
null
source
musl
#include <time.h> #include <errno.h> #include <stdint.h> #include "syscall.h" #include "atomic.h" #ifdef VDSO_CGT_SYM static void *volatile vdso_func; #ifdef VDSO_CGT32_SYM static void *volatile vdso_func_32; static int cgt_time32_wrap(clockid_t clk, struct timespec *ts) { long ts32[2]; int (*f)(clockid_t, long[2]...
src/time/clock_gettime.c
null
null
null
null
null
source
musl
#include <time.h> #include <errno.h> #include "syscall.h" #define IS32BIT(x) !((x)+0x80000000ULL>>32) #define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63)) int __clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem) { if (clk == CLOCK_THREAD_CPUTIME_ID) return ...
src/time/clock_nanosleep.c
null
null
null
null
null
source
musl
#include <time.h> #include <errno.h> #include "syscall.h" #define IS32BIT(x) !((x)+0x80000000ULL>>32) int clock_settime(clockid_t clk, const struct timespec *ts) { #ifdef SYS_clock_settime64 time_t s = ts->tv_sec; long ns = ts->tv_nsec; int r = -ENOSYS; if (SYS_clock_settime == SYS_clock_settime64 || !IS32BIT(s))...
src/time/clock_settime.c
null
null
null
null
null
source
musl
#include <time.h> char *ctime(const time_t *t) { struct tm *tm = localtime(t); if (!tm) return 0; return asctime(tm); }
src/time/ctime.c
null
null
null
null
null
source
musl
#include <time.h> char *ctime_r(const time_t *t, char *buf) { struct tm tm, *tm_p = localtime_r(t, &tm); return tm_p ? asctime_r(tm_p, buf) : 0; }
src/time/ctime_r.c
null
null
null
null
null
source
musl
#include <sys/timeb.h> #include <time.h> int ftime(struct timeb *tp) { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); tp->time = ts.tv_sec; tp->millitm = ts.tv_nsec / 1000000; tp->timezone = tp->dstflag = 0; return 0; }
src/time/ftime.c
null
null
null
null
null
source
musl
#include <time.h> #include <pthread.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> int getdate_err; struct tm *getdate(const char *s) { static struct tm tmbuf; struct tm *ret = 0; char *datemsk = getenv("DATEMSK"); FILE *f = 0; char fmt[100], *p; int cs; pthread_setcancelstate(PTHREAD_CANCEL_DEF...
src/time/getdate.c
null
null
null
null
null
source
musl
#include <time.h> #include <sys/time.h> #include "syscall.h" int gettimeofday(struct timeval *restrict tv, void *restrict tz) { struct timespec ts; if (!tv) return 0; clock_gettime(CLOCK_REALTIME, &ts); tv->tv_sec = ts.tv_sec; tv->tv_usec = (int)ts.tv_nsec / 1000; return 0; }
src/time/gettimeofday.c
null
null
null
null
null
source
musl
#include "time_impl.h" #include <errno.h> struct tm *gmtime(const time_t *t) { static struct tm tm; return __gmtime_r(t, &tm); }
src/time/gmtime.c
null
null
null
null
null
source
musl
#include "time_impl.h" #include <errno.h> struct tm *__gmtime_r(const time_t *restrict t, struct tm *restrict tm) { if (__secs_to_tm(*t, tm) < 0) { errno = EOVERFLOW; return 0; } tm->tm_isdst = 0; tm->__tm_gmtoff = 0; tm->__tm_zone = __utc; return tm; } weak_alias(__gmtime_r, gmtime_r);
src/time/gmtime_r.c
null
null
null
null
null
source
musl
#include "time_impl.h" struct tm *localtime(const time_t *t) { static struct tm tm; return __localtime_r(t, &tm); }
src/time/localtime.c
null
null
null
null
null
source
musl
#include "time_impl.h" #include <errno.h> #include <limits.h> struct tm *__localtime_r(const time_t *restrict t, struct tm *restrict tm) { /* Reject time_t values whose year would overflow int because * __secs_to_zone cannot safely handle them. */ if (*t < INT_MIN * 31622400LL || *t > INT_MAX * 31622400LL) { err...
src/time/localtime_r.c
null
null
null
null
null
source
musl
#include "time_impl.h" #include <errno.h> time_t mktime(struct tm *tm) { struct tm new; long opp; long long t = __tm_to_secs(tm); __secs_to_zone(t, 1, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone); if (tm->tm_isdst>=0 && new.tm_isdst!=tm->tm_isdst) t -= opp - new.__tm_gmtoff; t -= new.__tm_gmtoff; ...
src/time/mktime.c
null
null
null
null
null
source
musl
#include <time.h> #include "syscall.h" int nanosleep(const struct timespec *req, struct timespec *rem) { return __syscall_ret(-__clock_nanosleep(CLOCK_REALTIME, 0, req, rem)); }
src/time/nanosleep.c
null
null
null
null
null
source
musl
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <langinfo.h> #include <locale.h> #include <ctype.h> #include <time.h> #include <limits.h> #include "locale_impl.h" #include "time_impl.h" static int is_leap(int y) { /* Avoid overflow */ if (y>INT_MAX-1900) y -= 2000; y += 1900; return !(y%4) && (...
src/time/strftime.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <langinfo.h> #include <time.h> #include <ctype.h> #include <stddef.h> #include <string.h> #include <strings.h> char *strptime(const char *restrict s, const char *restrict f, struct tm *restrict tm) { int i, w, neg, adj, min, range, *dest, dummy; const char *ex; size_t len; int want_cen...
src/time/strptime.c
null
null
null
null
null
source
musl
#include <time.h> #include "syscall.h" time_t time(time_t *t) { struct timespec ts; __clock_gettime(CLOCK_REALTIME, &ts); if (t) *t = ts.tv_sec; return ts.tv_sec; }
src/time/time.c
null
null
null
null
null
source
musl
#include <time.h> hidden int __days_in_month(int, int); hidden int __month_to_secs(int, int); hidden long long __year_to_secs(long long, int *); hidden long long __tm_to_secs(const struct tm *); hidden const char *__tm_to_tzname(const struct tm *); hidden int __secs_to_tm(long long, struct tm *); hidden void __secs_to...
src/time/time_impl.h
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include "time_impl.h" #include <errno.h> time_t timegm(struct tm *tm) { struct tm new; long long t = __tm_to_secs(tm); if (__secs_to_tm(t, &new) < 0) { errno = EOVERFLOW; return -1; } *tm = new; tm->tm_isdst = 0; tm->__tm_gmtoff = 0; tm->__tm_zone = __utc; return t; }
src/time/timegm.c
null
null
null
null
null
source
musl
#include <time.h> #include <setjmp.h> #include <limits.h> #include <semaphore.h> #include "pthread_impl.h" #include "atomic.h" struct ksigevent { union sigval sigev_value; int sigev_signo; int sigev_notify; int sigev_tid; }; struct start_args { sem_t sem1, sem2; struct sigevent *sev; }; static void dummy_0() {...
src/time/timer_create.c
null
null
null
null
null
source
musl
#include <time.h> #include <limits.h> #include "pthread_impl.h" int timer_delete(timer_t t) { if ((intptr_t)t < 0) { pthread_t td = (void *)((uintptr_t)t << 1); a_store(&td->timer_id, td->timer_id | INT_MIN); __syscall(SYS_tkill, td->tid, SIGTIMER); return 0; } return __syscall(SYS_timer_delete, t); }
src/time/timer_delete.c
null
null
null
null
null
source
musl
#include <time.h> #include <limits.h> #include "pthread_impl.h" int timer_getoverrun(timer_t t) { if ((intptr_t)t < 0) { pthread_t td = (void *)((uintptr_t)t << 1); t = (void *)(uintptr_t)(td->timer_id & INT_MAX); } return syscall(SYS_timer_getoverrun, t); }
src/time/timer_getoverrun.c
null
null
null
null
null
source
musl
#include <time.h> #include <limits.h> #include "pthread_impl.h" int timer_gettime(timer_t t, struct itimerspec *val) { if ((intptr_t)t < 0) { pthread_t td = (void *)((uintptr_t)t << 1); t = (void *)(uintptr_t)(td->timer_id & INT_MAX); } #ifdef SYS_timer_gettime64 int r = -ENOSYS; if (sizeof(time_t) > 4) r = ...
src/time/timer_gettime.c
null
null
null
null
null
source
musl
#include <time.h> #include <limits.h> #include "pthread_impl.h" #define IS32BIT(x) !((x)+0x80000000ULL>>32) int timer_settime(timer_t t, int flags, const struct itimerspec *restrict val, struct itimerspec *restrict old) { if ((intptr_t)t < 0) { pthread_t td = (void *)((uintptr_t)t << 1); t = (void *)(uintptr_t)(...
src/time/timer_settime.c
null
null
null
null
null
source
musl
#include <sys/times.h> #include "syscall.h" clock_t times(struct tms *tms) { return __syscall(SYS_times, tms); }
src/time/times.c
null
null
null
null
null
source
musl
#include <time.h> /* There is no other implemented value than TIME_UTC; all other values * are considered erroneous. */ int timespec_get(struct timespec * ts, int base) { if (base != TIME_UTC) return 0; int ret = __clock_gettime(CLOCK_REALTIME, ts); return ret < 0 ? 0 : base; }
src/time/timespec_get.c
null
null
null
null
null
source
musl
#include <utime.h> #include <sys/stat.h> #include <time.h> #include <fcntl.h> int utime(const char *path, const struct utimbuf *times) { return utimensat(AT_FDCWD, path, times ? ((struct timespec [2]){ { .tv_sec = times->actime }, { .tv_sec = times->modtime }}) : 0, 0); }
src/time/utime.c
null
null
null
null
null
source
musl
#include <wchar.h> #include <time.h> #include <locale.h> #include "locale_impl.h" #include "time_impl.h" size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc) { size_t l, k; char buf[100]; wchar_t wbuf[100]; wchar_t *p; const char *t_mb; const w...
src/time/wcsftime.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <fcntl.h> #include "syscall.h" int access(const char *filename, int amode) { #ifdef SYS_access return syscall(SYS_access, filename, amode); #else return syscall(SYS_faccessat, AT_FDCWD, filename, amode, 0); #endif }
src/unistd/access.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <unistd.h> #include "syscall.h" int acct(const char *filename) { return syscall(SYS_acct, filename); }
src/unistd/acct.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <sys/time.h> #include "syscall.h" unsigned alarm(unsigned seconds) { struct itimerval it = { .it_value.tv_sec = seconds }, old = { 0 }; setitimer(ITIMER_REAL, &it, &old); return old.it_value.tv_sec + !!old.it_value.tv_usec; }
src/unistd/alarm.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int chdir(const char *path) { return syscall(SYS_chdir, path); }
src/unistd/chdir.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <fcntl.h> #include "syscall.h" int chown(const char *path, uid_t uid, gid_t gid) { #ifdef SYS_chown return syscall(SYS_chown, path, uid, gid); #else return syscall(SYS_fchownat, AT_FDCWD, path, uid, gid, 0); #endif }
src/unistd/chown.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include "aio_impl.h" #include "syscall.h" static int dummy(int fd) { return fd; } weak_alias(dummy, __aio_close); int close(int fd) { fd = __aio_close(fd); int r = __syscall_cp(SYS_close, fd); if (r == -EINTR) r = 0; return __syscall_ret(r); }
src/unistd/close.c
null
null
null
null
null
source
musl
#include <stdio.h> #include <string.h> char *ctermid(char *s) { return s ? strcpy(s, "/dev/tty") : "/dev/tty"; }
src/unistd/ctermid.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int dup2(int old, int new) { int r; #ifdef SYS_dup2 while ((r=__syscall(SYS_dup2, old, new))==-EBUSY); #else if (old==new) { r = __syscall(SYS_fcntl, old, F_GETFD); if (r >= 0) return old; } else { while ((r=__syscall(SYS_dup3, ol...
src/unistd/dup2.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <unistd.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int __dup3(int old, int new, int flags) { int r; #ifdef SYS_dup2 if (old==new) return __syscall_ret(-EINVAL); if (flags) { while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY); if (r!=-ENOSYS) return __syscall...
src/unistd/dup3.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <fcntl.h> #include <sys/wait.h> #include "syscall.h" #include "pthread_impl.h" struct ctx { int fd; const char *filename; int amode; int p; }; static int checker(void *p) { struct ctx *c = p; int ret; if (__syscall(SYS_setregid, __syscall(SYS_getegid), -1) || __syscall(SYS_set...
src/unistd/faccessat.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int fchdir(int fd) { int ret = __syscall(SYS_fchdir, fd); if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0) return __syscall_ret(ret); char buf[15+3*sizeof(int)]; __procfdname(buf, fd); return syscall(SYS_chdir, buf); }
src/unistd/fchdir.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int fchown(int fd, uid_t uid, gid_t gid) { int ret = __syscall(SYS_fchown, fd, uid, gid); if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0) return __syscall_ret(ret); char buf[15+3*sizeof(int)]; __procfdname(buf, fd); #ifde...
src/unistd/fchown.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag) { return syscall(SYS_fchownat, fd, path, uid, gid, flag); }
src/unistd/fchownat.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int fdatasync(int fd) { return syscall_cp(SYS_fdatasync, fd); }
src/unistd/fdatasync.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int ftruncate(int fd, off_t length) { return syscall(SYS_ftruncate, fd, __SYSCALL_LL_O(length)); }
src/unistd/ftruncate.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <limits.h> #include <string.h> #include "syscall.h" char *getcwd(char *buf, size_t size) { char tmp[buf ? 1 : PATH_MAX]; if (!buf) { buf = tmp; size = sizeof tmp; } else if (!size) { errno = EINVAL; return 0; } long ret = syscall(SYS_getcwd, buf, size); if ...
src/unistd/getcwd.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int getgroups(int count, gid_t list[]) { return syscall(SYS_getgroups, count, list); }
src/unistd/getgroups.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <sys/utsname.h> int gethostname(char *name, size_t len) { size_t i; struct utsname uts; if (uname(&uts)) return -1; if (len > sizeof uts.nodename) len = sizeof uts.nodename; for (i=0; i<len && (name[i] = uts.nodename[i]); i++); if (i && i==len) name[i-1] = 0; return 0; }
src/unistd/gethostname.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <string.h> #include <errno.h> int getlogin_r(char *name, size_t size) { char *logname = getlogin(); if (!logname) return ENXIO; /* or...? */ if (strlen(logname) >= size) return ERANGE; strcpy(name, logname); return 0; }
src/unistd/getlogin_r.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" pid_t getpgid(pid_t pid) { return syscall(SYS_getpgid, pid); }
src/unistd/getpgid.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" pid_t getpgrp(void) { return __syscall(SYS_getpgid, 0); }
src/unistd/getpgrp.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" pid_t getsid(pid_t pid) { return syscall(SYS_getsid, pid); }
src/unistd/getsid.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <sys/ioctl.h> #include "syscall.h" int isatty(int fd) { struct winsize wsz; /* +1 converts from error status (0/-1) to boolean (1/0) */ return syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz) + 1; }
src/unistd/isatty.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <fcntl.h> #include "syscall.h" int lchown(const char *path, uid_t uid, gid_t gid) { #ifdef SYS_lchown return syscall(SYS_lchown, path, uid, gid); #else return syscall(SYS_fchownat, AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW); #endif }
src/unistd/lchown.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <fcntl.h> #include "syscall.h" int link(const char *existing, const char *new) { #ifdef SYS_link return syscall(SYS_link, existing, new); #else return syscall(SYS_linkat, AT_FDCWD, existing, AT_FDCWD, new, 0); #endif }
src/unistd/link.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int linkat(int fd1, const char *existing, int fd2, const char *new, int flag) { return syscall(SYS_linkat, fd1, existing, fd2, new, flag); }
src/unistd/linkat.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" off_t __lseek(int fd, off_t offset, int whence) { #ifdef SYS__llseek off_t result; return syscall(SYS__llseek, fd, offset>>32, offset, &result, whence) ? -1 : result; #else return syscall(SYS_lseek, fd, offset, whence); #endif } weak_alias(__lseek, lseek);
src/unistd/lseek.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <sys/resource.h> #include <limits.h> #include "syscall.h" int nice(int inc) { int prio = inc; // Only query old priority if it can affect the result. // This also avoids issues with integer overflow. if (inc > -2*NZERO && inc < 2*NZERO) prio += getpriority(PRIO_PRO...
src/unistd/nice.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" int pipe(int fd[2]) { #ifdef SYS_pipe return syscall(SYS_pipe, fd); #else return syscall(SYS_pipe2, fd, 0); #endif }
src/unistd/pipe.c
null
null
null
null
null
source
musl
#include <unistd.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int pipe2(int fd[2], int flag) { if (!flag) return pipe(fd); int ret = __syscall(SYS_pipe2, fd, flag); if (ret != -ENOSYS) return __syscall_ret(ret); if (flag & ~(O_CLOEXEC|O_NONBLOCK)) return __syscall_ret(-EINVAL); ret = pipe(fd); i...
src/unistd/pipe2.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" ssize_t pread(int fd, void *buf, size_t size, off_t ofs) { return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_PRW(ofs)); }
src/unistd/pread.c
null
null
null
null
null
source
musl
#define _BSD_SOURCE #include <sys/uio.h> #include <unistd.h> #include "syscall.h" ssize_t preadv(int fd, const struct iovec *iov, int count, off_t ofs) { return syscall_cp(SYS_preadv, fd, iov, count, (long)(ofs), (long)(ofs>>32)); }
src/unistd/preadv.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <unistd.h> #include <sys/uio.h> #include <fcntl.h> #include "syscall.h" ssize_t pwrite(int fd, const void *buf, size_t size, off_t ofs) { if (ofs == -1) ofs--; int r = __syscall_cp(SYS_pwritev2, fd, (&(struct iovec){ .iov_base = (void *)buf, .iov_len = size }), 1, (long)(ofs), (long)...
src/unistd/pwrite.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/uio.h> #include <unistd.h> #include <fcntl.h> #include "syscall.h" ssize_t pwritev(int fd, const struct iovec *iov, int count, off_t ofs) { if (ofs == -1) ofs--; int r = __syscall_cp(SYS_pwritev2, fd, iov, count, (long)(ofs), (long)(ofs>>32), RWF_NOAPPEND); if (r != -EOPNOTSUPP &...
src/unistd/pwritev.c
null
null
null
null
null
source
musl
#include <unistd.h> #include "syscall.h" ssize_t read(int fd, void *buf, size_t count) { return syscall_cp(SYS_read, fd, buf, count); }
src/unistd/read.c
null
null
null
null
null