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 | #define _GNU_SOURCE
#include <sys/socket.h>
#include <limits.h>
#include <errno.h>
#include "syscall.h"
int sendmmsg(int fd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags)
{
#if LONG_MAX > INT_MAX
/* Can't use the syscall directly because the kernel has the wrong
* idea for the types of msg_iovlen, ... | src/network/sendmmsg.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include <limits.h>
#include <string.h>
#include <errno.h>
#include "syscall.h"
ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
{
#if LONG_MAX > INT_MAX
struct msghdr h;
/* Kernels before 2.6.38 set SCM_MAX_FD to 255, allocate enough
* space to support an SCM_RIGHTS ancillary m... | src/network/sendmsg.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include "syscall.h"
ssize_t sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
{
return socketcall_cp(sendto, fd, buf, len, flags, addr, alen);
} | src/network/sendto.c | null | null | null | null | null |
source | musl | #include <netdb.h>
void endservent(void)
{
}
void setservent(int stayopen)
{
}
struct servent *getservent(void)
{
return 0;
} | src/network/serv.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include <sys/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 setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen)
{
const struct timeval *tv;
t... | src/network/setsockopt.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include "syscall.h"
int shutdown(int fd, int how)
{
return socketcall(shutdown, fd, how, 0, 0, 0, 0);
} | src/network/shutdown.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include <sys/ioctl.h>
int sockatmark(int s)
{
int ret;
if (ioctl(s, SIOCATMARK, &ret) < 0)
return -1;
return ret;
} | src/network/sockatmark.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include <fcntl.h>
#include <errno.h>
#include "syscall.h"
int socket(int domain, int type, int protocol)
{
int s = __socketcall(socket, domain, type, protocol, 0, 0, 0);
if ((s==-EINVAL || s==-EPROTONOSUPPORT)
&& (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) {
s = __socketcall(socket, domain,
... | src/network/socket.c | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include <fcntl.h>
#include <errno.h>
#include "syscall.h"
int socketpair(int domain, int type, int protocol, int fd[2])
{
int r = socketcall(socketpair, domain, type, protocol, fd, 0, 0);
if (r<0 && (errno==EINVAL || errno==EPROTONOSUPPORT)
&& (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) {
r ... | src/network/socketpair.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include "pwf.h"
struct group *fgetgrent(FILE *f)
{
static char *line, **mem;
static struct group gr;
struct group *res;
size_t size=0, nmem=0;
__getgrent_a(f, &gr, &line, &size, &mem, &nmem, &res);
return res;
} | src/passwd/fgetgrent.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include "pwf.h"
struct passwd *fgetpwent(FILE *f)
{
static char *line;
static struct passwd pw;
size_t size=0;
struct passwd *res;
__getpwent_a(f, &pw, &line, &size, &res);
return res;
} | src/passwd/fgetpwent.c | null | null | null | null | null |
source | musl | #include "pwf.h"
#include <pthread.h>
struct spwd *fgetspent(FILE *f)
{
static char *line;
static struct spwd sp;
size_t size = 0;
struct spwd *res = 0;
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
if (getline(&line, &size, f) >= 0 && __parsespent(line, &sp) >= 0) res = &sp;
pthread_setcancelst... | src/passwd/fgetspent.c | null | null | null | null | null |
source | musl | #include <pthread.h>
#include <byteswap.h>
#include <string.h>
#include <unistd.h>
#include "pwf.h"
#include "nscd.h"
static char *itoa(char *p, uint32_t x)
{
// number of digits in a uint32_t + NUL
p += 11;
*--p = 0;
do {
*--p = '0' + x % 10;
x /= 10;
} while (x);
return p;
}
int __getgr_a(const char *name... | src/passwd/getgr_a.c | null | null | null | null | null |
source | musl | #include "pwf.h"
#include <pthread.h>
#define FIX(x) (gr->gr_##x = gr->gr_##x-line+buf)
static int getgr_r(const char *name, gid_t gid, struct group *gr, char *buf, size_t size, struct group **res)
{
char *line = 0;
size_t len = 0;
char **mem = 0;
size_t nmem = 0;
int rv = 0;
size_t i;
int cs;
pthread_setcan... | src/passwd/getgr_r.c | null | null | null | null | null |
source | musl | #include "pwf.h"
static FILE *f;
static char *line, **mem;
static struct group gr;
void setgrent()
{
if (f) fclose(f);
f = 0;
}
weak_alias(setgrent, endgrent);
struct group *getgrent()
{
struct group *res;
size_t size=0, nmem=0;
if (!f) f = fopen("/etc/group", "rbe");
if (!f) return 0;
__getgrent_a(f, &gr, &... | src/passwd/getgrent.c | null | null | null | null | null |
source | musl | #include "pwf.h"
#include <pthread.h>
static unsigned atou(char **s)
{
unsigned x;
for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0');
return x;
}
int __getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, char ***mem, size_t *nmem, struct group **res)
{
ssize_t l;
char *s, *mems;
size_t i;
int rv = 0;
... | src/passwd/getgrent_a.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include "pwf.h"
#include <grp.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <byteswap.h>
#include <errno.h>
#include "nscd.h"
int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
{
int rv, nlim, ret = -1;
ssize_t i, n = 1;
struc... | src/passwd/getgrouplist.c | null | null | null | null | null |
source | musl | #include <pthread.h>
#include <byteswap.h>
#include <string.h>
#include <unistd.h>
#include "pwf.h"
#include "nscd.h"
static char *itoa(char *p, uint32_t x)
{
// number of digits in a uint32_t + NUL
p += 11;
*--p = 0;
do {
*--p = '0' + x % 10;
x /= 10;
} while (x);
return p;
}
int __getpw_a(const char *name... | src/passwd/getpw_a.c | null | null | null | null | null |
source | musl | #include "pwf.h"
#include <pthread.h>
#define FIX(x) (pw->pw_##x = pw->pw_##x-line+buf)
static int getpw_r(const char *name, uid_t uid, struct passwd *pw, char *buf, size_t size, struct passwd **res)
{
char *line = 0;
size_t len = 0;
int rv = 0;
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
rv ... | src/passwd/getpw_r.c | null | null | null | null | null |
source | musl | #include "pwf.h"
static FILE *f;
static char *line;
static struct passwd pw;
static size_t size;
void setpwent()
{
if (f) fclose(f);
f = 0;
}
weak_alias(setpwent, endpwent);
struct passwd *getpwent()
{
struct passwd *res;
if (!f) f = fopen("/etc/passwd", "rbe");
if (!f) return 0;
__getpwent_a(f, &pw, &line, &... | src/passwd/getpwent.c | null | null | null | null | null |
source | musl | #include "pwf.h"
#include <pthread.h>
static unsigned atou(char **s)
{
unsigned x;
for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0');
return x;
}
int __getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size, struct passwd **res)
{
ssize_t l;
char *s;
int rv = 0;
int cs;
pthread_setcancelstate(PTHREAD_CA... | src/passwd/getpwent_a.c | null | null | null | null | null |
source | musl | #include "pwf.h"
#define LINE_LIM 256
struct spwd *getspnam(const char *name)
{
static struct spwd sp;
static char *line;
struct spwd *res;
int e;
int orig_errno = errno;
if (!line) line = malloc(LINE_LIM);
if (!line) return 0;
e = getspnam_r(name, &sp, line, LINE_LIM, &res);
errno = e ? e : orig_errno;
re... | src/passwd/getspnam.c | null | null | null | null | null |
source | musl | #include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <ctype.h>
#include <pthread.h>
#include "pwf.h"
/* This implementation support Openwall-style TCB passwords in place of
* traditional shadow, if the appropriate directories and files exist.
* Thus, it is careful to avoid following symlinks or bloc... | src/passwd/getspnam_r.c | null | null | null | null | null |
source | musl | #ifndef NSCD_H
#define NSCD_H
#include <stdint.h>
#define NSCDVERSION 2
#define GETPWBYNAME 0
#define GETPWBYUID 1
#define GETGRBYNAME 2
#define GETGRBYGID 3
#define GETINITGR 15
#define REQVERSION 0
#define REQTYPE 1
#define REQKEYLEN 2
#define REQ_LEN 3
#define PWVERSION 0
#define PWFOUND 1
#define PWNAMELEN 2
#d... | src/passwd/nscd.h | null | null | null | null | null |
source | musl | #include <sys/socket.h>
#include <byteswap.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include "nscd.h"
static const struct {
short sun_family;
char sun_path[21];
} addr = {
AF_UNIX,
"/var/run/nscd/socket"
};
FILE *__nscd_query(int32_t req, const char *key... | src/passwd/nscd_query.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <grp.h>
#include <stdio.h>
int putgrent(const struct group *gr, FILE *f)
{
int r;
size_t i;
flockfile(f);
if ((r = fprintf(f, "%s:%s:%u:", gr->gr_name, gr->gr_passwd, gr->gr_gid))<0) goto done;
if (gr->gr_mem) for (i=0; gr->gr_mem[i]; i++)
if ((r = fprintf(f, "%s%s", i?",":"", gr->g... | src/passwd/putgrent.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <pwd.h>
#include <stdio.h>
int putpwent(const struct passwd *pw, FILE *f)
{
return fprintf(f, "%s:%s:%u:%u:%s:%s:%s\n",
pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid,
pw->pw_gecos, pw->pw_dir, pw->pw_shell)<0 ? -1 : 0;
} | src/passwd/putpwent.c | null | null | null | null | null |
source | musl | #include <shadow.h>
#include <stdio.h>
#define NUM(n) ((n) == -1 ? 0 : -1), ((n) == -1 ? 0 : (n))
#define STR(s) ((s) ? (s) : "")
int putspent(const struct spwd *sp, FILE *f)
{
return fprintf(f, "%s:%s:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*ld:%.*lu\n",
STR(sp->sp_namp), STR(sp->sp_pwdp), NUM(sp->sp_lstchg),
NUM(sp->s... | src/passwd/putspent.c | null | null | null | null | null |
source | musl | #include <pwd.h>
#include <grp.h>
#include <shadow.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
hidden int __getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size, struct passwd **res);
hidden int __getpw_a(const char *name, uid_t u... | src/passwd/pwf.h | null | null | null | null | null |
source | musl | #include <stdint.h>
#include "rand48.h"
uint64_t __rand48_step(unsigned short *xi, unsigned short *lc)
{
uint64_t a, x;
x = xi[0] | xi[1]+0U<<16 | xi[2]+0ULL<<32;
a = lc[0] | lc[1]+0U<<16 | lc[2]+0ULL<<32;
x = a*x + lc[3];
xi[0] = x;
xi[1] = x>>16;
xi[2] = x>>32;
return x & 0xffffffffffffull;
} | src/prng/__rand48_step.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <inttypes.h>
#include "rand48.h"
double erand48(unsigned short s[3])
{
union {
uint64_t u;
double f;
} x = { 0x3ff0000000000000ULL | __rand48_step(s, __seed48+3)<<4 };
return x.f - 1.0;
}
double drand48(void)
{
return erand48(__seed48);
} | src/prng/drand48.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <string.h>
#include "rand48.h"
void lcong48(unsigned short p[7])
{
memcpy(__seed48, p, sizeof __seed48);
} | src/prng/lcong48.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <inttypes.h>
#include "rand48.h"
long nrand48(unsigned short s[3])
{
return __rand48_step(s, __seed48+3) >> 17;
}
long lrand48(void)
{
return nrand48(__seed48);
} | src/prng/lrand48.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <inttypes.h>
#include "rand48.h"
long jrand48(unsigned short s[3])
{
return (int32_t)(__rand48_step(s, __seed48+3) >> 16);
}
long mrand48(void)
{
return jrand48(__seed48);
} | src/prng/mrand48.c | null | null | null | null | null |
source | musl | #include <stdint.h>
#include <features.h>
hidden uint64_t __rand48_step(unsigned short *xi, unsigned short *lc);
extern hidden unsigned short __seed48[7]; | src/prng/rand48.h | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <stdint.h>
#include "lock.h"
#include "fork_impl.h"
/*
this code uses the same lagged fibonacci generator as the
original bsd random implementation except for the seeding
which was broken in the original
*/
static uint32_t init[] = {
0x00000000,0x5851f42d,0xc0b18ccf,0xcbb5f646,
0xc7033129... | src/prng/random.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <string.h>
#include "rand48.h"
unsigned short *seed48(unsigned short *s)
{
static unsigned short p[3];
memcpy(p, __seed48, sizeof p);
memcpy(__seed48, s, sizeof p);
return p;
} | src/prng/seed48.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
void srand48(long seed)
{
seed48((unsigned short [3]){ 0x330e, seed, seed>>16 });
} | src/prng/srand48.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <signal.h>
#include "syscall.h"
#include "libc.h"
#include "lock.h"
#include "pthread_impl.h"
#include "aio_impl.h"
#include "fork_impl.h"
static void dummy(int x) { }
weak_alias(dummy, __aio_atfork);
void __post_Fork(int ret)
{
if (!ret) {
pthread_t self = __pthread_self();
self->ti... | src/process/_Fork.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <stdarg.h>
int execl(const char *path, const char *argv0, ...)
{
int argc;
va_list ap;
va_start(ap, argv0);
for (argc=1; va_arg(ap, const char *); argc++);
va_end(ap);
{
int i;
char *argv[argc+1];
va_start(ap, argv0);
argv[0] = (char *)argv0;
for (i=1; i<argc; i++)
argv[... | src/process/execl.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <stdarg.h>
int execle(const char *path, const char *argv0, ...)
{
int argc;
va_list ap;
va_start(ap, argv0);
for (argc=1; va_arg(ap, const char *); argc++);
va_end(ap);
{
int i;
char *argv[argc+1];
char **envp;
va_start(ap, argv0);
argv[0] = (char *)argv0;
for (i=1; i<=ar... | src/process/execle.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <stdarg.h>
int execlp(const char *file, const char *argv0, ...)
{
int argc;
va_list ap;
va_start(ap, argv0);
for (argc=1; va_arg(ap, const char *); argc++);
va_end(ap);
{
int i;
char *argv[argc+1];
va_start(ap, argv0);
argv[0] = (char *)argv0;
for (i=1; i<argc; i++)
argv... | src/process/execlp.c | null | null | null | null | null |
source | musl | #include <unistd.h>
extern char **__environ;
int execv(const char *path, char *const argv[])
{
return execve(path, argv, __environ);
} | src/process/execv.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include "syscall.h"
int execve(const char *path, char *const argv[], char *const envp[])
{
/* do we need to use environ if envp is null? */
return syscall(SYS_execve, path, argv, envp);
} | src/process/execve.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
extern char **__environ;
int __execvpe(const char *file, char *const argv[], char *const envp[])
{
const char *p, *z, *path = getenv("PATH");
size_t l, k;
int seen_eacces = 0;
errno = ENOENT;
if (!*file) return -1... | src/process/execvp.c | null | null | null | null | null |
source | musl | #define FDOP_CLOSE 1
#define FDOP_DUP2 2
#define FDOP_OPEN 3
#define FDOP_CHDIR 4
#define FDOP_FCHDIR 5
struct fdop {
struct fdop *next, *prev;
int cmd, fd, srcfd, oflag;
mode_t mode;
char path[];
};
#define malloc __libc_malloc
#define calloc __libc_calloc
#define realloc undef
#define free __libc_free | src/process/fdop.h | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include "syscall.h"
int fexecve(int fd, char *const argv[], char *const envp[])
{
int r = __syscall(SYS_execveat, fd, "", argv, envp, AT_EMPTY_PATH);
if (r != -ENOSYS) return __syscall_ret(r);
char buf[15 + 3*sizeof(int)];
__procfdname(... | src/process/fexecve.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <errno.h>
#include "libc.h"
#include "lock.h"
#include "pthread_impl.h"
#include "fork_impl.h"
static volatile int *const dummy_lockptr = 0;
weak_alias(dummy_lockptr, __at_quick_exit_lockptr);
weak_alias(dummy_lockptr, __atexit_lockptr);
weak_alias(dummy_lockptr, __gettext_lockptr);
weak_... | src/process/fork.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <spawn.h>
#include <sched.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/wait.h>
#include "syscall.h"
#include "lock.h"
#include "pthread_impl.h"
#include "fdop.h"
struct args {
int p[2];
sigset_t oldmask;
const char *path;
const posix_sp... | src/process/posix_spawn.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "fdop.h"
int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *restrict fa, const char *restrict path)
{
struct fdop *op = malloc(sizeof *op + strlen(path) + 1);
if (!op) return ENOMEM;
op->cmd = FDOP_CHDIR;
op->f... | src/process/posix_spawn_file_actions_addchdir.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <stdlib.h>
#include <errno.h>
#include "fdop.h"
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *fa, int fd)
{
if (fd < 0) return EBADF;
struct fdop *op = malloc(sizeof *op);
if (!op) return ENOMEM;
op->cmd = FDOP_CLOSE;
op->fd = fd;
if ((op->next = fa->__actions)) op... | src/process/posix_spawn_file_actions_addclose.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <stdlib.h>
#include <errno.h>
#include "fdop.h"
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *fa, int srcfd, int fd)
{
if (srcfd < 0 || fd < 0) return EBADF;
struct fdop *op = malloc(sizeof *op);
if (!op) return ENOMEM;
op->cmd = FDOP_DUP2;
op->srcfd = srcfd;
op->fd... | src/process/posix_spawn_file_actions_adddup2.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "fdop.h"
int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *fa, int fd)
{
if (fd < 0) return EBADF;
struct fdop *op = malloc(sizeof *op);
if (!op) return ENOMEM;
op->cmd = FDOP_FCHDIR;
op->fd = fd;
if ((op->... | src/process/posix_spawn_file_actions_addfchdir.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "fdop.h"
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *restrict fa, int fd, const char *restrict path, int flags, mode_t mode)
{
if (fd < 0) return EBADF;
struct fdop *op = malloc(sizeof *op + strlen(path) + 1);... | src/process/posix_spawn_file_actions_addopen.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <stdlib.h>
#include "fdop.h"
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *fa)
{
struct fdop *op = fa->__actions, *next;
while (op) {
next = op->next;
free(op);
op = next;
}
return 0;
} | src/process/posix_spawn_file_actions_destroy.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *fa)
{
fa->__actions = 0;
return 0;
} | src/process/posix_spawn_file_actions_init.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr, short *restrict flags)
{
*flags = attr->__flags;
return 0;
} | src/process/posix_spawnattr_getflags.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr, pid_t *restrict pgrp)
{
*pgrp = attr->__pgrp;
return 0;
} | src/process/posix_spawnattr_getpgroup.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_getsigdefault(const posix_spawnattr_t *restrict attr, sigset_t *restrict def)
{
*def = attr->__def;
return 0;
} | src/process/posix_spawnattr_getsigdefault.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_getsigmask(const posix_spawnattr_t *restrict attr, sigset_t *restrict mask)
{
*mask = attr->__mask;
return 0;
} | src/process/posix_spawnattr_getsigmask.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_init(posix_spawnattr_t *attr)
{
*attr = (posix_spawnattr_t){ 0 };
return 0;
} | src/process/posix_spawnattr_init.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <sched.h>
#include <errno.h>
int posix_spawnattr_getschedparam(const posix_spawnattr_t *restrict attr,
struct sched_param *restrict schedparam)
{
return ENOSYS;
}
int posix_spawnattr_setschedparam(posix_spawnattr_t *restrict attr,
const struct sched_param *restrict schedparam)
{
return... | src/process/posix_spawnattr_sched.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <errno.h>
int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags)
{
const unsigned all_flags =
POSIX_SPAWN_RESETIDS |
POSIX_SPAWN_SETPGROUP |
POSIX_SPAWN_SETSIGDEF |
POSIX_SPAWN_SETSIGMASK |
POSIX_SPAWN_SETSCHEDPARAM |
POSIX_SPAWN_SETSCHEDULER |
POSIX_SPAWN_USEVFOR... | src/process/posix_spawnattr_setflags.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgrp)
{
attr->__pgrp = pgrp;
return 0;
} | src/process/posix_spawnattr_setpgroup.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_setsigdefault(posix_spawnattr_t *restrict attr, const sigset_t *restrict def)
{
attr->__def = *def;
return 0;
} | src/process/posix_spawnattr_setsigdefault.c | null | null | null | null | null |
source | musl | #include <spawn.h>
int posix_spawnattr_setsigmask(posix_spawnattr_t *restrict attr, const sigset_t *restrict mask)
{
attr->__mask = *mask;
return 0;
} | src/process/posix_spawnattr_setsigmask.c | null | null | null | null | null |
source | musl | #include <spawn.h>
#include <unistd.h>
int posix_spawnp(pid_t *restrict res, const char *restrict file,
const posix_spawn_file_actions_t *fa,
const posix_spawnattr_t *restrict attr,
char *const argv[restrict], char *const envp[restrict])
{
posix_spawnattr_t spawnp_attr = { 0 };
if (attr) spawnp_attr = *attr;
spa... | src/process/posix_spawnp.c | null | null | null | null | null |
source | musl | #include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <spawn.h>
#include <errno.h>
#include "pthread_impl.h"
extern char **__environ;
int system(const char *cmd)
{
pid_t pid;
sigset_t old, reset;
struct sigaction sa = { .sa_handler = SIG_IGN }, oldint, oldquit;
int status = -1... | src/process/system.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <unistd.h>
#include <signal.h>
#include "syscall.h"
pid_t vfork(void)
{
/* vfork syscall cannot be made from C code */
#ifdef SYS_fork
return syscall(SYS_fork);
#else
return syscall(SYS_clone, SIGCHLD, 0);
#endif
} | src/process/vfork.c | null | null | null | null | null |
source | musl | #include <sys/wait.h>
#include "syscall.h"
int waitid(idtype_t type, id_t id, siginfo_t *info, int options)
{
return syscall_cp(SYS_waitid, type, id, info, options, 0);
} | src/process/waitid.c | null | null | null | null | null |
source | musl | #include <sys/wait.h>
#include "syscall.h"
pid_t waitpid(pid_t pid, int *status, int options)
{
return sys_wait4_cp(pid, status, options, 0);
} | src/process/waitpid.c | null | null | null | null | null |
source | musl | .global vfork
.type vfork,%function
vfork:
mov x8, 220 // SYS_clone
mov x0, 0x4111 // SIGCHLD | CLONE_VM | CLONE_VFORK
mov x1, 0
svc 0
.hidden __syscall_ret
b __syscall_ret | src/process/aarch64/vfork.s | null | null | null | null | null |
source | musl | .syntax unified
.global vfork
.type vfork,%function
vfork:
mov ip, r7
mov r7, 190
svc 0
mov r7, ip
.hidden __syscall_ret
b __syscall_ret | src/process/arm/vfork.s | null | null | null | null | null |
source | musl | .global vfork
.type vfork,@function
vfork:
pop %edx
mov $190,%eax
int $128
push %edx
push %eax
.hidden __syscall_ret
call __syscall_ret
pop %edx
ret | src/process/i386/vfork.s | null | null | null | null | null |
source | musl | .global vfork
.type vfork,@function
vfork:
/* riscv does not have SYS_vfork, so we must use clone instead */
/* note: riscv's clone = clone(flags, sp, ptidptr, tls, ctidptr) */
li a7, 220
li a0, 0x100 | 0x4000 | 17 /* flags = CLONE_VM | CLONE_VFORK | SIGCHLD */
mv a1, sp
/* the other arguments are ignoreable */
... | src/process/riscv64/vfork.s | null | null | null | null | null |
source | musl | .global vfork
.type vfork,@function
vfork:
mov #95, r3
add r3, r3
trapa #31
or r0, r0
or r0, r0
or r0, r0
or r0, r0
or r0, r0
mov r0, r4
mov.l 1f, r0
2: braf r0
nop
.align 2
.hidden __syscall_ret
1: .long __syscall_ret@PLT-(2b+4-.) | src/process/sh/vfork.s | null | null | null | null | null |
source | musl | .global vfork
.type vfork,@function
vfork:
pop %rdx
mov $0x4000003a,%eax /* SYS_vfork */
syscall
push %rdx
mov %rax,%rdi
.hidden __syscall_ret
jmp __syscall_ret | src/process/x32/vfork.s | null | null | null | null | null |
source | musl | .global vfork
.type vfork,@function
vfork:
pop %rdx
mov $58,%eax
syscall
push %rdx
mov %rax,%rdi
.hidden __syscall_ret
jmp __syscall_ret | src/process/x86_64/vfork.s | null | null | null | null | null |
source | musl | /*
* An implementation of what I call the "Sea of Stars" algorithm for
* POSIX fnmatch(). The basic idea is that we factor the pattern into
* a head component (which we match first and can reject without ever
* measuring the length of the string), an optional tail component
* (which only exists if the pattern cont... | src/regex/fnmatch.c | null | null | null | null | null |
source | musl | #define _BSD_SOURCE
#include <glob.h>
#include <fnmatch.h>
#include <sys/stat.h>
#include <dirent.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stddef.h>
#include <unistd.h>
#include <pwd.h>
struct match
{
struct match *next;
char name[];
};
static int append(struct mat... | src/regex/glob.c | null | null | null | null | null |
source | musl | /*
regcomp.c - TRE POSIX compatible regex compilation functions.
Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions o... | src/regex/regcomp.c | null | null | null | null | null |
source | musl | #include <string.h>
#include <regex.h>
#include <stdio.h>
#include "locale_impl.h"
/* Error message strings for error codes listed in `regex.h'. This list
needs to be in sync with the codes listed there, naturally. */
/* Converted to single string by Rich Felker to remove the need for
* data relocations at runti... | src/regex/regerror.c | null | null | null | null | null |
source | musl | /*
regexec.c - TRE POSIX compatible matching functions (and more).
Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions... | src/regex/regexec.c | null | null | null | null | null |
source | musl | /*
tre-mem.c - TRE memory allocator
Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the... | src/regex/tre-mem.c | null | null | null | null | null |
source | musl | /*
tre-internal.h - TRE internal definitions
Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must r... | src/regex/tre.h | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <sched.h>
#include <string.h>
#include "pthread_impl.h"
#include "syscall.h"
int sched_setaffinity(pid_t tid, size_t size, const cpu_set_t *set)
{
return syscall(SYS_sched_setaffinity, tid, size, set);
}
int pthread_setaffinity_np(pthread_t td, size_t size, const cpu_set_t *set)
{
retur... | src/sched/affinity.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <sched.h>
int __sched_cpucount(size_t size, const cpu_set_t *set)
{
size_t i, j, cnt=0;
const unsigned char *p = (const void *)set;
for (i=0; i<size; i++) for (j=0; j<8; j++)
if (p[i] & (1<<j)) cnt++;
return cnt;
} | src/sched/sched_cpucount.c | null | null | null | null | null |
source | musl | #include <sched.h>
#include "syscall.h"
int sched_get_priority_max(int policy)
{
return syscall(SYS_sched_get_priority_max, policy);
}
int sched_get_priority_min(int policy)
{
return syscall(SYS_sched_get_priority_min, policy);
} | src/sched/sched_get_priority_max.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include "syscall.h"
#include "atomic.h"
#ifdef VDSO_GETCPU_SYM
static void *volatile vdso_func;
typedef long (*getcpu_f)(unsigned *, unsigned *, void *);
static long getcpu_init(unsigned *cpu, unsigned *node, void *unused)
{
void *p = __vdsosym(VDSO_GETCPU... | src/sched/sched_getcpu.c | null | null | null | null | null |
source | musl | #include <sched.h>
#include <errno.h>
#include "syscall.h"
int sched_getparam(pid_t pid, struct sched_param *param)
{
return __syscall_ret(-ENOSYS);
} | src/sched/sched_getparam.c | null | null | null | null | null |
source | musl | #include <sched.h>
#include <errno.h>
#include "syscall.h"
int sched_getscheduler(pid_t pid)
{
return __syscall_ret(-ENOSYS);
} | src/sched/sched_getscheduler.c | null | null | null | null | null |
source | musl | #include <sched.h>
#include "syscall.h"
int sched_rr_get_interval(pid_t pid, struct timespec *ts)
{
#ifdef SYS_sched_rr_get_interval_time64
/* On a 32-bit arch, use the old syscall if it exists. */
if (SYS_sched_rr_get_interval != SYS_sched_rr_get_interval_time64) {
long ts32[2];
int r = __syscall(SYS_sched_rr_g... | src/sched/sched_rr_get_interval.c | null | null | null | null | null |
source | musl | #include <sched.h>
#include <errno.h>
#include "syscall.h"
int sched_setparam(pid_t pid, const struct sched_param *param)
{
return __syscall_ret(-ENOSYS);
} | src/sched/sched_setparam.c | null | null | null | null | null |
source | musl | #include <sched.h>
#include <errno.h>
#include "syscall.h"
int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
{
return __syscall_ret(-ENOSYS);
} | src/sched/sched_setscheduler.c | null | null | null | null | null |
source | musl | #define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <search.h>
/*
open addressing hash table with 2^n table size
quadratic probing is used in case of hash collision
tab indices and hash are size_t
after resize fails with ENOMEM the state of tab is still usable
with the posix api items cannot be itera... | src/search/hsearch.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <search.h>
#include "tsearch.h"
void *tdelete(const void *restrict key, void **restrict rootp,
int(*cmp)(const void *, const void *))
{
if (!rootp)
return 0;
void **a[MAXH+1];
struct node *n = *rootp;
struct node *parent;
struct node *child;
int i=0;
/* *a[0] is an arbitrary non... | src/search/tdelete.c | null | null | null | null | null |
source | musl | #include <search.h>
#include "tsearch.h"
void *tfind(const void *key, void *const *rootp,
int(*cmp)(const void *, const void *))
{
if (!rootp)
return 0;
struct node *n = *rootp;
for (;;) {
if (!n)
break;
int c = cmp(key, n->key);
if (!c)
break;
n = n->a[c>0];
}
return n;
} | src/search/tfind.c | null | null | null | null | null |
source | musl | #include <stdlib.h>
#include <search.h>
#include "tsearch.h"
static inline int height(struct node *n) { return n ? n->h : 0; }
static int rot(void **p, struct node *x, int dir /* deeper side */)
{
struct node *y = x->a[dir];
struct node *z = y->a[!dir];
int hx = x->h;
int hz = height(z);
if (hz > height(y->a[dir... | src/search/tsearch.c | null | null | null | null | null |
source | musl | #include <poll.h>
#include <time.h>
#include <signal.h>
#include "syscall.h"
int poll(struct pollfd *fds, nfds_t n, int timeout)
{
#ifdef SYS_poll
return syscall_cp(SYS_poll, fds, n, timeout);
#else
#if SYS_ppoll_time64 == SYS_ppoll
typedef long long ppoll_ts_t[2];
#else
typedef long ppoll_ts_t[2];
#endif
return s... | src/select/poll.c | null | null | null | null | null |
source | musl | #define _BSD_SOURCE
#include <poll.h>
#include <signal.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 ppoll(struct pollfd *fds, nfds_t n, const struct timespec *to, const sigset_t *mask)
{
time_t s = t... | src/select/ppoll.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.