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 | #include <math.h>
#ifdef __VSX__
float fmaxf(float x, float y)
{
__asm__ ("xsmaxdp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y));
return x;
}
#else
#include "../fmaxf.c"
#endif | src/math/powerpc64/fmaxf.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef __VSX__
double fmin(double x, double y)
{
__asm__ ("xsmindp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y));
return x;
}
#else
#include "../fmin.c"
#endif | src/math/powerpc64/fmin.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef __VSX__
float fminf(float x, float y)
{
__asm__ ("xsmindp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y));
return x;
}
#else
#include "../fminf.c"
#endif | src/math/powerpc64/fminf.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef _ARCH_PWR5X
long lrint(double x)
{
long n;
__asm__ ("fctid %0, %1" : "=d"(n) : "d"(x));
return n;
}
#else
#include "../lrint.c"
#endif | src/math/powerpc64/lrint.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef _ARCH_PWR5X
long lrintf(float x)
{
long n;
__asm__ ("fctid %0, %1" : "=d"(n) : "f"(x));
return n;
}
#else
#include "../lrintf.c"
#endif | src/math/powerpc64/lrintf.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef __VSX__
long lround(double x)
{
long n;
__asm__ (
"xsrdpi %1, %1\n"
"fctid %0, %1\n" : "=d"(n), "+d"(x));
return n;
}
#else
#include "../lround.c"
#endif | src/math/powerpc64/lround.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef __VSX__
long lroundf(float x)
{
long n;
__asm__ (
"xsrdpi %1, %1\n"
"fctid %0, %1\n" : "=d"(n), "+f"(x));
return n;
}
#else
#include "../lroundf.c"
#endif | src/math/powerpc64/lroundf.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef _ARCH_PWR5X
double round(double x)
{
__asm__ ("frin %0, %1" : "=d"(x) : "d"(x));
return x;
}
#else
#include "../round.c"
#endif | src/math/powerpc64/round.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef _ARCH_PWR5X
float roundf(float x)
{
__asm__ ("frin %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../roundf.c"
#endif | src/math/powerpc64/roundf.c | null | null | null | null | null |
source | musl | #include <math.h>
double sqrt(double x)
{
__asm__ ("fsqrt %0, %1" : "=d"(x) : "d"(x));
return x;
} | src/math/powerpc64/sqrt.c | null | null | null | null | null |
source | musl | #include <math.h>
float sqrtf(float x)
{
__asm__ ("fsqrts %0, %1" : "=f"(x) : "f"(x));
return x;
} | src/math/powerpc64/sqrtf.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef _ARCH_PWR5X
double trunc(double x)
{
__asm__ ("friz %0, %1" : "=d"(x) : "d"(x));
return x;
}
#else
#include "../trunc.c"
#endif | src/math/powerpc64/trunc.c | null | null | null | null | null |
source | musl | #include <math.h>
#ifdef _ARCH_PWR5X
float truncf(float x)
{
__asm__ ("friz %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../truncf.c"
#endif | src/math/powerpc64/truncf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double ceil(double x)
{
__asm__ ("fidbra %0, 6, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../ceil.c"
#endif | src/math/s390x/ceil.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float ceilf(float x)
{
__asm__ ("fiebra %0, 6, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../ceilf.c"
#endif | src/math/s390x/ceilf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double ceill(long double x)
{
__asm__ ("fixbra %0, 6, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../ceill.c"
#endif | src/math/s390x/ceill.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double fabs(double x)
{
__asm__ ("lpdbr %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../fabs.c"
#endif | src/math/s390x/fabs.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float fabsf(float x)
{
__asm__ ("lpebr %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../fabsf.c"
#endif | src/math/s390x/fabsf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double fabsl(long double x)
{
__asm__ ("lpxbr %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../fabsl.c"
#endif | src/math/s390x/fabsl.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double floor(double x)
{
__asm__ ("fidbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../floor.c"
#endif | src/math/s390x/floor.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float floorf(float x)
{
__asm__ ("fiebra %0, 7, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../floorf.c"
#endif | src/math/s390x/floorf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double floorl(long double x)
{
__asm__ ("fixbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../floorl.c"
#endif | src/math/s390x/floorl.c | null | null | null | null | null |
source | musl | #include <math.h>
double fma(double x, double y, double z)
{
__asm__ ("madbr %0, %1, %2" : "+f"(z) : "f"(x), "f"(y));
return z;
} | src/math/s390x/fma.c | null | null | null | null | null |
source | musl | #include <math.h>
float fmaf(float x, float y, float z)
{
__asm__ ("maebr %0, %1, %2" : "+f"(z) : "f"(x), "f"(y));
return z;
} | src/math/s390x/fmaf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double nearbyint(double x)
{
__asm__ ("fidbra %0, 0, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../nearbyint.c"
#endif | src/math/s390x/nearbyint.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float nearbyintf(float x)
{
__asm__ ("fiebra %0, 0, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../nearbyintf.c"
#endif | src/math/s390x/nearbyintf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double nearbyintl(long double x)
{
__asm__ ("fixbra %0, 0, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../nearbyintl.c"
#endif | src/math/s390x/nearbyintl.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double rint(double x)
{
__asm__ ("fidbr %0, 0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../rint.c"
#endif | src/math/s390x/rint.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float rintf(float x)
{
__asm__ ("fiebr %0, 0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../rintf.c"
#endif | src/math/s390x/rintf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double rintl(long double x)
{
__asm__ ("fixbr %0, 0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../rintl.c"
#endif | src/math/s390x/rintl.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double round(double x)
{
__asm__ ("fidbra %0, 1, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../round.c"
#endif | src/math/s390x/round.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float roundf(float x)
{
__asm__ ("fiebra %0, 1, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../roundf.c"
#endif | src/math/s390x/roundf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double roundl(long double x)
{
__asm__ ("fixbra %0, 1, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../roundl.c"
#endif | src/math/s390x/roundl.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double sqrt(double x)
{
__asm__ ("sqdbr %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../sqrt.c"
#endif | src/math/s390x/sqrt.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float sqrtf(float x)
{
__asm__ ("sqebr %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../sqrtf.c"
#endif | src/math/s390x/sqrtf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double sqrtl(long double x)
{
__asm__ ("sqxbr %0, %1" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../sqrtl.c"
#endif | src/math/s390x/sqrtl.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
double trunc(double x)
{
__asm__ ("fidbra %0, 5, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../trunc.c"
#endif | src/math/s390x/trunc.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
float truncf(float x)
{
__asm__ ("fiebra %0, 5, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../truncf.c"
#endif | src/math/s390x/truncf.c | null | null | null | null | null |
source | musl | #include <math.h>
#if defined(__HTM__) || __ARCH__ >= 9
long double truncl(long double x)
{
__asm__ ("fixbra %0, 5, %1, 4" : "=f"(x) : "f"(x));
return x;
}
#else
#include "../truncl.c"
#endif | src/math/s390x/truncl.c | null | null | null | null | null |
source | musl | # see ../i386/acos.s
.global acosl
.type acosl,@function
acosl:
fldt 8(%esp)
1: fld %st(0)
fld1
fsub %st(0),%st(1)
fadd %st(2)
fmulp
fsqrt
fabs
fxch %st(1)
fpatan
ret | src/math/x32/acosl.s | null | null | null | null | null |
source | musl | .global asinl
.type asinl,@function
asinl:
fldt 8(%esp)
1: fld %st(0)
fld1
fsub %st(0),%st(1)
fadd %st(2)
fmulp
fsqrt
fpatan
ret | src/math/x32/asinl.s | null | null | null | null | null |
source | musl | .global expm1l
.type expm1l,@function
expm1l:
fldt 8(%esp)
fldl2e
fmulp
movl $0xc2820000,-4(%esp)
flds -4(%esp)
fucomip %st(1),%st
fld1
jb 1f
# x*log2e <= -65, return -1 without underflow
fstp %st(1)
fchs
ret
1: fld %st(1)
fabs
fucomip %st(1),%st
fstp %st(0)
ja 1f
f2xm1
ret
1: push %rax
call 1f
pop... | src/math/x32/exp2l.s | null | null | null | null | null |
source | musl | # exp(x) = 2^hi + 2^hi (2^lo - 1)
# where hi+lo = log2e*x with 128bit precision
# exact log2e*x calculation depends on nearest rounding mode
# using the exact multiplication method of Dekker and Veltkamp
.global expl
.type expl,@function
expl:
fldt 8(%esp)
# interesting case: 0x1p-32 <= |x| < 16384
# check if (e... | src/math/x32/expl.s | null | null | null | null | null |
source | musl | .global floorl
.type floorl,@function
floorl:
fldt 8(%esp)
1: mov $0x7,%al
1: fstcw 8(%esp)
mov 9(%esp),%ah
mov %al,9(%esp)
fldcw 8(%esp)
frndint
mov %ah,9(%esp)
fldcw 8(%esp)
ret
.global ceill
.type ceill,@function
ceill:
fldt 8(%esp)
mov $0xb,%al
jmp 1b
.global truncl
.type truncl,@function
truncl:
fldt... | src/math/x32/floorl.s | null | null | null | null | null |
source | musl | .global fmodl
.type fmodl,@function
fmodl:
fldt 24(%esp)
fldt 8(%esp)
1: fprem
fnstsw %ax
testb $4,%ah
jnz 1b
fstp %st(1)
ret | src/math/x32/fmodl.s | null | null | null | null | null |
source | musl | .global llrintl
.type llrintl,@function
llrintl:
fldt 8(%esp)
fistpll 8(%esp)
mov 8(%esp),%rax
ret | src/math/x32/llrintl.s | null | null | null | null | null |
source | musl | .global log1pl
.type log1pl,@function
log1pl:
mov 14(%esp),%eax
fldln2
and $0x7fffffff,%eax
fldt 8(%esp)
cmp $0x3ffd9400,%eax
ja 1f
fyl2xp1
ret
1: fld1
faddp
fyl2x
ret | src/math/x32/log1pl.s | null | null | null | null | null |
source | musl | .global lrintl
.type lrintl,@function
lrintl:
fldt 8(%esp)
fistpl 8(%esp)
movl 8(%esp),%eax
ret | src/math/x32/lrintl.s | null | null | null | null | null |
source | musl | .global remainderl
.type remainderl,@function
remainderl:
fldt 24(%esp)
fldt 8(%esp)
1: fprem1
fnstsw %ax
testb $4,%ah
jnz 1b
fstp %st(1)
ret | src/math/x32/remainderl.s | null | null | null | null | null |
source | musl | #include <math.h>
double fabs(double x)
{
double t;
__asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0
__asm__ ("psrlq $1, %0" : "+x"(t)); // t >>= 1
__asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t
return x;
} | src/math/x86_64/fabs.c | null | null | null | null | null |
source | musl | #include <math.h>
float fabsf(float x)
{
float t;
__asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0
__asm__ ("psrld $1, %0" : "+x"(t)); // t >>= 1
__asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t
return x;
} | src/math/x86_64/fabsf.c | null | null | null | null | null |
source | musl | #include <math.h>
long long llrint(double x)
{
long long r;
__asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x));
return r;
} | src/math/x86_64/llrint.c | null | null | null | null | null |
source | musl | #include <math.h>
long long llrintf(float x)
{
long long r;
__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
return r;
} | src/math/x86_64/llrintf.c | null | null | null | null | null |
source | musl | #include <math.h>
long lrint(double x)
{
long r;
__asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x));
return r;
} | src/math/x86_64/lrint.c | null | null | null | null | null |
source | musl | #include <math.h>
long lrintf(float x)
{
long r;
__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
return r;
} | src/math/x86_64/lrintf.c | null | null | null | null | null |
source | musl | #include <math.h>
long lrintl(long double x)
{
long r;
__asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st");
return r;
} | src/math/x86_64/lrintl.c | null | null | null | null | null |
source | musl | #include <math.h>
long double remquol(long double x, long double y, int *quo)
{
signed char *cx = (void *)&x, *cy = (void *)&y;
/* By ensuring that addresses of x and y cannot be discarded,
* this empty asm guides GCC into representing extraction of
* their sign bits as memory loads rather than making x and y
... | src/math/x86_64/remquol.c | null | null | null | null | null |
source | musl | #include <math.h>
double sqrt(double x)
{
__asm__ ("sqrtsd %1, %0" : "=x"(x) : "x"(x));
return x;
} | src/math/x86_64/sqrt.c | null | null | null | null | null |
source | musl | #include <math.h>
float sqrtf(float x)
{
__asm__ ("sqrtss %1, %0" : "=x"(x) : "x"(x));
return x;
} | src/math/x86_64/sqrtf.c | null | null | null | null | null |
source | musl | #include <string.h>
#include <libgen.h>
char *basename(char *s)
{
size_t i;
if (!s || !*s) return ".";
i = strlen(s)-1;
for (; i&&s[i]=='/'; i--) s[i] = 0;
for (; i&&s[i-1]!='/'; i--);
return s+i;
}
weak_alias(basename, __xpg_basename); | src/misc/basename.c | null | null | null | null | null |
source | musl | /* Public domain fmtmsg()
* Written by Isaac Dunham, 2014
*/
#include <fmtmsg.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
/*
* If lstr is the first part of bstr, check that the next char in bstr
* is either \0 or :
*/
static int _strcol... | src/misc/fmtmsg.c | null | null | null | null | null |
source | musl | #include <pty.h>
#include <utmp.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <pthread.h>
int forkpty(int *pm, char *name, const struct termios *tio, const struct winsize *ws)
{
int m, s, ec=0, p[2], cs;
pid_t pid=-1;
sigset_t set, oldset;
if (openpty(&m, &s, name, ti... | src/misc/forkpty.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <sys/stat.h>
char *get_current_dir_name(void) {
struct stat a, b;
char *res = getenv("PWD");
if (res && *res && !stat(res, &a) && !stat(".", &b)
&& (a.st_dev == b.st_dev) && (a.st_ino == b.st_ino))
re... | src/misc/get_current_dir_name.c | null | null | null | null | null |
source | musl | #include <sys/auxv.h>
#include <errno.h>
#include "libc.h"
unsigned long __getauxval(unsigned long item)
{
size_t *auxv = libc.auxv;
if (item == AT_SECURE) return libc.secure;
for (; *auxv; auxv+=2)
if (*auxv==item) return auxv[1];
errno = ENOENT;
return 0;
}
weak_alias(__getauxval, getauxval); | src/misc/getauxval.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include <sys/utsname.h>
#include <string.h>
#include <errno.h>
int getdomainname(char *name, size_t len)
{
struct utsname temp;
uname(&temp);
if (!len || strlen(temp.domainname) >= len) {
errno = EINVAL;
return -1;
}
strcpy(name, temp.domainname);
return 0;
} | src/misc/getdomainname.c | null | null | null | null | null |
source | musl | #define _BSD_SOURCE
#include <unistd.h>
#include <sys/random.h>
#include <pthread.h>
#include <errno.h>
int getentropy(void *buffer, size_t len)
{
int cs, ret = 0;
char *pos = buffer;
if (len > 256) {
errno = EIO;
return -1;
}
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
while (len) {
ret = getr... | src/misc/getentropy.c | null | null | null | null | null |
source | musl | #define _BSD_SOURCE
#include <unistd.h>
#include <wchar.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include "locale_impl.h"
#include "stdio_impl.h"
char *optarg;
int optind=1, opterr=1, optopt, __optpos, __optreset=0;
#define optpos __optpos
weak_alias(__optreset, optreset);
void __getopt_msg(con... | src/misc/getopt.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include "stdio_impl.h"
extern int __optpos, __optreset;
static void permute(char *const *argv, int dest, int src)
{
char **av = (char **)argv;
char *tmp = av[src];
int i;
for... | src/misc/getopt_long.c | null | null | null | null | null |
source | musl | #include <sys/resource.h>
#include "syscall.h"
int getpriority(int which, id_t who)
{
int ret = syscall(SYS_getpriority, which, who);
if (ret < 0) return ret;
return 20-ret;
} | src/misc/getpriority.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
{
return syscall(SYS_getresgid, rgid, egid, sgid);
} | src/misc/getresgid.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
{
return syscall(SYS_getresuid, ruid, euid, suid);
} | src/misc/getresuid.c | null | null | null | null | null |
source | musl | #include <sys/resource.h>
#include <errno.h>
#include "syscall.h"
#define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0)
int getrlimit(int resource, struct rlimit *rlim)
{
int ret = syscall(SYS_prlimit64, 0, resource, 0, rlim);
if (!ret) {
FIX(rlim->rlim_cur);
FIX(rlim->rlim_max);
}
#i... | src/misc/getrlimit.c | null | null | null | null | null |
source | musl | #include <sys/resource.h>
#include <string.h>
#include <errno.h>
#include "syscall.h"
int getrusage(int who, struct rusage *ru)
{
int r;
#ifdef SYS_getrusage_time64
long long kru64[18];
r = __syscall(SYS_getrusage_time64, who, kru64);
if (!r) {
ru->ru_utime = (struct timeval)
{ .tv_sec = kru64[0], .tv_usec = ... | src/misc/getrusage.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <grp.h>
#include <limits.h>
#include <stdlib.h>
int initgroups(const char *user, gid_t gid)
{
gid_t buf[32], *groups = buf;
int count = sizeof buf / sizeof *buf, prev_count = count;
while (getgrouplist(user, gid, groups, &count) < 0) {
if (groups != buf) free(groups);
/* Return if ... | src/misc/initgroups.c | null | null | null | null | null |
source | musl | #include <sys/ioctl.h>
#include <stdarg.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <endian.h>
#include "syscall.h"
#define alignof(t) offsetof(struct { char c; t x; }, x)
#define W 1
#define R 2
#define WR 3
struct ioctl_compat_m... | src/misc/ioctl.c | null | null | null | null | null |
source | musl | #define _BSD_SOURCE
#include <unistd.h>
#include "libc.h"
int issetugid(void)
{
return libc.secure;
} | src/misc/issetugid.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <fcntl.h>
#include <errno.h>
int lockf(int fd, int op, off_t size)
{
struct flock l = {
.l_type = F_WRLCK,
.l_whence = SEEK_CUR,
.l_len = size,
};
switch (op) {
case F_TEST:
l.l_type = F_RDLCK;
if (fcntl(fd, F_GETLK, &l) < 0)
return -1;
if (l.l_type == F_UNLCK || l.l_pid... | src/misc/lockf.c | null | null | null | null | null |
source | musl | #include <utmp.h>
#include <sys/ioctl.h>
#include <unistd.h>
int login_tty(int fd)
{
setsid();
if (ioctl(fd, TIOCSCTTY, (char *)0)) return -1;
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
if (fd>2) close(fd);
return 0;
} | src/misc/login_tty.c | null | null | null | null | null |
source | musl | #include <stdio.h>
#include <string.h>
#include <mntent.h>
#include <errno.h>
#include <limits.h>
static char *internal_buf;
static size_t internal_bufsize;
#define SENTINEL (char *)&internal_buf
FILE *setmntent(const char *name, const char *mode)
{
return fopen(name, mode);
}
int endmntent(FILE *f)
{
if (f) fclo... | src/misc/mntent.c | null | null | null | null | null |
source | musl | #include <ftw.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <pthread.h>
struct history
{
struct history *chain;
dev_t dev;
ino_t ino;
int level;
int base;
};
#undef dirfd
#define dirfd(d) (*(int *)d)
static... | src/misc/nftw.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <pty.h>
#include <stdio.h>
#include <pthread.h>
/* Nonstandard, but vastly superior to the standard functions */
int openpty(int *pm, int *ps, char *name, const struct termios *tio, const struct winsize *ws)
{
int m, s, n=0, cs;
char buf[20];
m =... | src/misc/openpty.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <errno.h>
char *ptsname(int fd)
{
static char buf[9 + sizeof(int)*3 + 1];
int err = __ptsname_r(fd, buf, sizeof buf);
if (err) {
errno = err;
return 0;
}
return buf;
} | src/misc/ptsname.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include "syscall.h"
int posix_openpt(int flags)
{
int r = open("/dev/ptmx", flags);
if (r < 0 && errno == ENOSPC) errno = EAGAIN;
return r;
}
int grantpt(int fd)
{
return 0;
}
int unlockpt(int fd)
{
int unlock =... | src/misc/pty.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
static size_t slash_len(const char *s)
{
const char *s0 = s;
while (*s == '/') s++;
return s-s0;
}
char *realpath(const char *restrict filename, char *restrict resolved)
{
char stack[PATH_MAX+1];
char output[PATH_M... | src/misc/realpath.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
int setdomainname(const char *name, size_t len)
{
return syscall(SYS_setdomainname, name, len);
} | src/misc/setdomainname.c | null | null | null | null | null |
source | musl | #include <sys/resource.h>
#include "syscall.h"
int setpriority(int which, id_t who, int prio)
{
return syscall(SYS_setpriority, which, who, prio);
} | src/misc/setpriority.c | null | null | null | null | null |
source | musl | #include <sys/resource.h>
#include <errno.h>
#include "syscall.h"
#include "libc.h"
#define MIN(a, b) ((a)<(b) ? (a) : (b))
#define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0)
struct ctx {
unsigned long lim[2];
int res;
int err;
};
#ifdef SYS_setrlimit
static void do_setrlimit(void *p)... | src/misc/setrlimit.c | null | null | null | null | null |
source | musl | #define _BSD_SOURCE
#include <unistd.h>
#include "syscall.h"
#include <stdarg.h>
#undef syscall
long syscall(long n, ...)
{
va_list ap;
syscall_arg_t a,b,c,d,e,f;
va_start(ap, n);
a=va_arg(ap, syscall_arg_t);
b=va_arg(ap, syscall_arg_t);
c=va_arg(ap, syscall_arg_t);
d=va_arg(ap, syscall_arg_t);
e=va_arg(ap, s... | src/misc/syscall.c | null | null | null | null | null |
source | musl | #include <stdarg.h>
#include <sys/socket.h>
#include <stdio.h>
#include <unistd.h>
#include <syslog.h>
#include <time.h>
#include <signal.h>
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include <fcntl.h>
#include "lock.h"
#include "fork_impl.h"
#include "locale_impl.h"
static volatile int lock[1];
stat... | src/misc/syslog.c | null | null | null | null | null |
source | musl | #include <sys/utsname.h>
#include "syscall.h"
int uname(struct utsname *uts)
{
return syscall(SYS_uname, uts);
} | src/misc/uname.c | null | null | null | null | null |
source | musl | #include <wordexp.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include "pthread_impl.h"
static void reap(pid_t pid)
{
int status;
while (waitpid(pid, &status, ... | src/misc/wordexp.c | null | null | null | null | null |
source | musl | #include <sys/mman.h>
#include "syscall.h"
int __madvise(void *addr, size_t len, int advice)
{
return syscall(SYS_madvise, addr, len, advice);
}
weak_alias(__madvise, madvise); | src/mman/madvise.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <sys/mman.h>
#include "syscall.h"
int mincore (void *addr, size_t len, unsigned char *vec)
{
return syscall(SYS_mincore, addr, len, vec);
} | src/mman/mincore.c | null | null | null | null | null |
source | musl | #include <sys/mman.h>
#include "syscall.h"
int mlock(const void *addr, size_t len)
{
#ifdef SYS_mlock
return syscall(SYS_mlock, addr, len);
#else
return syscall(SYS_mlock2, addr, len, 0);
#endif
} | src/mman/mlock.c | null | null | null | null | null |
source | musl | #include <sys/mman.h>
#include "syscall.h"
int mlockall(int flags)
{
return syscall(SYS_mlockall, flags);
} | src/mman/mlockall.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdint.h>
#include <limits.h>
#include "syscall.h"
static void dummy(void) { }
weak_alias(dummy, __vm_wait);
#define UNIT SYSCALL_MMAP2_UNIT
#define OFF_MASK ((-0x2000ULL << (8*sizeof(syscall_arg_t)-1)) | (UNIT-1))
void *__mmap(void *start, size_... | src/mman/mmap.c | null | null | null | null | null |
source | musl | #include <sys/mman.h>
#include "libc.h"
#include "syscall.h"
int __mprotect(void *addr, size_t len, int prot)
{
size_t start, end;
start = (size_t)addr & -PAGE_SIZE;
end = (size_t)((char *)addr + len + PAGE_SIZE-1) & -PAGE_SIZE;
return syscall(SYS_mprotect, start, end-start, prot);
}
weak_alias(__mprotect, mprote... | src/mman/mprotect.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdint.h>
#include <stdarg.h>
#include "syscall.h"
static void dummy(void) { }
weak_alias(dummy, __vm_wait);
void *__mremap(void *old_addr, size_t old_len, size_t new_len, int flags, ...)
{
va_list ap;
void *new_addr = 0;
i... | src/mman/mremap.c | null | null | null | null | null |
source | musl | #include <sys/mman.h>
#include "syscall.h"
int msync(void *start, size_t len, int flags)
{
return syscall_cp(SYS_msync, start, len, flags);
} | src/mman/msync.c | null | null | null | null | null |
source | musl | #include <sys/mman.h>
#include "syscall.h"
int munlock(const void *addr, size_t len)
{
return syscall(SYS_munlock, addr, len);
} | src/mman/munlock.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.