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 <sys/mman.h> #include "syscall.h" int munlockall(void) { return syscall(SYS_munlockall); }
src/mman/munlockall.c
null
null
null
null
null
source
musl
#include <sys/mman.h> #include "syscall.h" static void dummy(void) { } weak_alias(dummy, __vm_wait); int __munmap(void *start, size_t len) { __vm_wait(); return syscall(SYS_munmap, start, len); } weak_alias(__munmap, munmap);
src/mman/munmap.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/mman.h> #include "syscall.h" int posix_madvise(void *addr, size_t len, int advice) { if (advice == MADV_DONTNEED) return 0; return -__syscall(SYS_madvise, addr, len, advice); }
src/mman/posix_madvise.c
null
null
null
null
null
source
musl
#include <sys/mman.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #include <limits.h> #include <pthread.h> char *__shm_mapname(const char *name, char *buf) { char *p; while (*name == '/') name++; if (*(p = __strchrnul(name, '/')) || p==name || (p-name <= 2 && name[0]=='.' && p...
src/mman/shm_open.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include "syscall.h" int mq_close(mqd_t mqd) { return syscall(SYS_close, mqd); }
src/mq/mq_close.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include "syscall.h" int mq_getattr(mqd_t mqd, struct mq_attr *attr) { return mq_setattr(mqd, 0, attr); }
src/mq/mq_getattr.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include <pthread.h> #include <errno.h> #include <sys/socket.h> #include <signal.h> #include <unistd.h> #include <semaphore.h> #include "syscall.h" struct args { sem_t sem; int sock; mqd_t mqd; int err; const struct sigevent *sev; }; static void *start(void *p) { struct args *args = p; char...
src/mq/mq_notify.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include <fcntl.h> #include <stdarg.h> #include "syscall.h" mqd_t mq_open(const char *name, int flags, ...) { mode_t mode = 0; struct mq_attr *attr = 0; if (*name == '/') name++; if (flags & O_CREAT) { va_list ap; va_start(ap, flags); mode = va_arg(ap, mode_t); attr = va_arg(ap, struct ...
src/mq/mq_open.c
null
null
null
null
null
source
musl
#include <mqueue.h> ssize_t mq_receive(mqd_t mqd, char *msg, size_t len, unsigned *prio) { return mq_timedreceive(mqd, msg, len, prio, 0); }
src/mq/mq_receive.c
null
null
null
null
null
source
musl
#include <mqueue.h> int mq_send(mqd_t mqd, const char *msg, size_t len, unsigned prio) { return mq_timedsend(mqd, msg, len, prio, 0); }
src/mq/mq_send.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include "syscall.h" int mq_setattr(mqd_t mqd, const struct mq_attr *restrict new, struct mq_attr *restrict old) { return syscall(SYS_mq_getsetattr, mqd, new, old); }
src/mq/mq_setattr.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include <errno.h> #include "syscall.h" #define IS32BIT(x) !((x)+0x80000000ULL>>32) #define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63)) ssize_t mq_timedreceive(mqd_t mqd, char *restrict msg, size_t len, unsigned *restrict prio, const struct timespec *restrict at) { #ifdef SYS_m...
src/mq/mq_timedreceive.c
null
null
null
null
null
source
musl
#include <mqueue.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 mq_timedsend(mqd_t mqd, const char *msg, size_t len, unsigned prio, const struct timespec *at) { #ifdef SYS_mq_timedsend_time64 time_t s ...
src/mq/mq_timedsend.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include <errno.h> #include "syscall.h" int mq_unlink(const char *name) { int ret; if (*name == '/') name++; ret = __syscall(SYS_mq_unlink, name); if (ret < 0) { if (ret == -EPERM) ret = -EACCES; errno = -ret; return -1; } return ret; }
src/mq/mq_unlink.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include <fcntl.h> #include <stdarg.h> #include "syscall.h" mqd_t mq_open(const char *name, int flags, ...) { mode_t mode = 0; struct mq_attr *attr = 0; long long attrbuf[8]; if (*name == '/') name++; if (flags & O_CREAT) { va_list ap; va_start(ap, flags); mode = va_arg(ap, mode_t); at...
src/mq/x32/mq_open.c
null
null
null
null
null
source
musl
#include <mqueue.h> #include "syscall.h" int mq_setattr(mqd_t mqd, const struct mq_attr *restrict new, struct mq_attr *restrict old) { long long attr[8]; if (new) for (int i=0; i<8; i++) attr[i] = *(long *)((char *)new + i*sizeof(long)); int ret = __syscall(SYS_mq_getsetattr, mqd, new?attr:0, old?attr:0); if (re...
src/mq/x32/mq_setattr.c
null
null
null
null
null
source
musl
#include <stdio.h> #include <wchar.h> #include <stdlib.h> #include "internal.h" wint_t btowc(int c) { int b = (unsigned char)c; return b<128U ? b : (MB_CUR_MAX==1 && c!=EOF) ? CODEUNIT(c) : WEOF; }
src/multibyte/btowc.c
null
null
null
null
null
source
musl
#include <uchar.h> #include <errno.h> #include <wchar.h> size_t c16rtomb(char *restrict s, char16_t c16, mbstate_t *restrict ps) { static unsigned internal_state; if (!ps) ps = (void *)&internal_state; unsigned *x = (unsigned *)ps; wchar_t wc; if (!s) { if (*x) goto ilseq; return 1; } if (!*x && c16 - 0xd...
src/multibyte/c16rtomb.c
null
null
null
null
null
source
musl
#include <uchar.h> #include <wchar.h> size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps) { return wcrtomb(s, c32, ps); }
src/multibyte/c32rtomb.c
null
null
null
null
null
source
musl
#include "internal.h" #define C(x) ( x<2 ? -1 : ( R(0x80,0xc0) | x ) ) #define D(x) C((x+16)) #define E(x) ( ( x==0 ? R(0xa0,0xc0) : \ x==0xd ? R(0x80,0xa0) : \ R(0x80,0xc0) ) \ | ( R(0x80,0xc0) >> 6 ) \ | x ) #define F(x) ( ( x>=5 ? 0 : \ x=...
src/multibyte/internal.c
null
null
null
null
null
source
musl
#define bittab __fsmu8 #include <stdint.h> #include <features.h> extern hidden const uint32_t bittab[]; /* Upper 6 state bits are a negative integer offset to bound-check next byte */ /* equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f */ #define OOB(c,b) (((((b)>>3)-0x10)|(((b)>>3)+((int32_t)(c)>>26))) & ~7...
src/multibyte/internal.h
null
null
null
null
null
source
musl
#include <wchar.h> size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict st) { static unsigned internal; return mbrtowc(0, s, n, st ? st : (mbstate_t *)&internal); }
src/multibyte/mbrlen.c
null
null
null
null
null
source
musl
#include <uchar.h> #include <wchar.h> size_t mbrtoc16(char16_t *restrict pc16, const char *restrict s, size_t n, mbstate_t *restrict ps) { static unsigned internal_state; if (!ps) ps = (void *)&internal_state; unsigned *pending = (unsigned *)ps; if (!s) return mbrtoc16(0, "", 1, ps); /* mbrtowc states for parti...
src/multibyte/mbrtoc16.c
null
null
null
null
null
source
musl
#include <uchar.h> #include <wchar.h> size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps) { static unsigned internal_state; if (!ps) ps = (void *)&internal_state; if (!s) return mbrtoc32(0, "", 1, ps); wchar_t wc; size_t ret = mbrtowc(&wc, s, n, ps); if (ret <= 4 &&...
src/multibyte/mbrtoc32.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <wchar.h> #include <errno.h> #include "internal.h" size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate_t *restrict st) { static unsigned internal_state; unsigned c; const unsigned char *s = (const void *)src; const size_t N = n; wchar_t dummy; if (!st) s...
src/multibyte/mbrtowc.c
null
null
null
null
null
source
musl
#include <wchar.h> size_t mbsnrtowcs(wchar_t *restrict wcs, const char **restrict src, size_t n, size_t wn, mbstate_t *restrict st) { static unsigned internal_state; size_t l, cnt=0, n2; wchar_t *ws, wbuf[256]; const char *s = *src; const char *tmp_s; if (!st) st = (void *)&internal_state; if (!wcs) ws = wbuf,...
src/multibyte/mbsnrtowcs.c
null
null
null
null
null
source
musl
#include <stdint.h> #include <wchar.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include "internal.h" size_t mbsrtowcs(wchar_t *restrict ws, const char **restrict src, size_t wn, mbstate_t *restrict st) { const unsigned char *s = (const void *)*src; size_t wn0 = wn; unsigned c = 0; if (st && (c ...
src/multibyte/mbsrtowcs.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <wchar.h> size_t mbstowcs(wchar_t *restrict ws, const char *restrict s, size_t wn) { return mbsrtowcs(ws, (void*)&s, wn, 0); }
src/multibyte/mbstowcs.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <wchar.h> #include <errno.h> #include "internal.h" int mbtowc(wchar_t *restrict wc, const char *restrict src, size_t n) { unsigned c; const unsigned char *s = (const void *)src; wchar_t dummy; if (!s) return 0; if (!n) goto ilseq; if (!wc) wc = &dummy; if (*s < 0x80) return !!(*wc...
src/multibyte/mbtowc.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <wchar.h> #include <errno.h> #include "internal.h" size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict st) { if (!s) return 1; if ((unsigned)wc < 0x80) { *s = wc; return 1; } else if (MB_CUR_MAX == 1) { if (!IS_CODEUNIT(wc)) { errno = EILSEQ; return -1; } *s...
src/multibyte/wcrtomb.c
null
null
null
null
null
source
musl
#include <wchar.h> #include <limits.h> #include <string.h> size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, size_t n, mbstate_t *restrict st) { const wchar_t *ws = *wcs; size_t cnt = 0; if (!dst) n=0; while (ws && wn) { char tmp[MB_LEN_MAX]; size_t l = wcrtomb(n<MB_LEN_MAX ? tmp :...
src/multibyte/wcsnrtombs.c
null
null
null
null
null
source
musl
#include <wchar.h> size_t wcsrtombs(char *restrict s, const wchar_t **restrict ws, size_t n, mbstate_t *restrict st) { const wchar_t *ws2; char buf[4]; size_t N = n, l; if (!s) { for (n=0, ws2=*ws; *ws2; ws2++) { if (*ws2 >= 0x80u) { l = wcrtomb(buf, *ws2, 0); if (!(l+1)) return -1; n += l; } e...
src/multibyte/wcsrtombs.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <wchar.h> size_t wcstombs(char *restrict s, const wchar_t *restrict ws, size_t n) { return wcsrtombs(s, &(const wchar_t *){ws}, n, 0); }
src/multibyte/wcstombs.c
null
null
null
null
null
source
musl
#include <wchar.h> #include <stdio.h> #include <stdlib.h> #include "internal.h" int wctob(wint_t c) { if (c < 128U) return c; if (MB_CUR_MAX==1 && IS_CODEUNIT(c)) return (unsigned char)c; return EOF; }
src/multibyte/wctob.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <wchar.h> int wctomb(char *s, wchar_t wc) { if (!s) return 0; return wcrtomb(s, wc, 0); }
src/multibyte/wctomb.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" int accept(int fd, struct sockaddr *restrict addr, socklen_t *restrict len) { return socketcall_cp(accept, fd, addr, len, 0, 0, 0); }
src/network/accept.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int accept4(int fd, struct sockaddr *restrict addr, socklen_t *restrict len, int flg) { if (!flg) return accept(fd, addr, len); int ret = socketcall_cp(accept4, fd, addr, len, flg, 0, 0); if (ret>=0 || (errno != E...
src/network/accept4.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" int bind(int fd, const struct sockaddr *addr, socklen_t len) { return socketcall(bind, fd, addr, len, 0, 0, 0); }
src/network/bind.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" int connect(int fd, const struct sockaddr *addr, socklen_t len) { return socketcall_cp(connect, fd, addr, len, 0, 0, 0); }
src/network/connect.c
null
null
null
null
null
source
musl
#include <string.h> #include <resolv.h> /* RFC 1035 message compression */ /* label start offsets of a compressed domain name s */ static int getoffs(short *offs, const unsigned char *base, const unsigned char *s) { int i=0; for (;;) { while (*s & 0xc0) { if ((*s & 0xc0) != 0xc0) return 0; s = base + ((s[0]...
src/network/dn_comp.c
null
null
null
null
null
source
musl
#include <resolv.h> int __dn_expand(const unsigned char *base, const unsigned char *end, const unsigned char *src, char *dest, int space) { const unsigned char *p = src; char *dend, *dbegin = dest; int len = -1, i, j; if (p==end || space <= 0) return -1; dend = dest + (space > 254 ? 254 : space); /* detect refer...
src/network/dn_expand.c
null
null
null
null
null
source
musl
#include <resolv.h> int dn_skipname(const unsigned char *s, const unsigned char *end) { const unsigned char *p = s; while (p < end) if (!*p) return p-s+1; else if (*p>=192) if (p+1<end) return p-s+2; else break; else if (end-p<*p+1) break; else p += *p + 1; return -1; }
src/network/dn_skipname.c
null
null
null
null
null
source
musl
#include <string.h> #include "lookup.h" int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, const void *, int, const void *, int), void *ctx) { int qdcount, ancount; const unsigned char *p; int len; if (rlen<12) return -1; if ((r[3]&15)) return 0; p = r+12; qdcount = r[4]*256 + r[5];...
src/network/dns_parse.c
null
null
null
null
null
source
musl
#include <netdb.h> void sethostent(int x) { } struct hostent *gethostent() { return 0; } struct netent *getnetent() { return 0; } void endhostent(void) { } weak_alias(sethostent, setnetent); weak_alias(endhostent, endnetent);
src/network/ent.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <netinet/ether.h> #include <stdio.h> struct ether_addr *ether_aton_r (const char *x, struct ether_addr *p_a) { struct ether_addr a; char *y; for (int ii = 0; ii < 6; ii++) { unsigned long int n; if (ii != 0) { if (x[0] != ':') return 0; /* bad format */ else x++; } n = str...
src/network/ether.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stddef.h> #include <netdb.h> #include "lookup.h" #include "lock.h" void freeaddrinfo(struct addrinfo *p) { size_t cnt; for (cnt=1; p->ai_next; cnt++, p=p->ai_next); struct aibuf *b = (void *)((char *)p - offsetof(struct aibuf, ai)); b -= b->slot; LOCK(b->lock); if (!(b->ref -= cnt))...
src/network/freeaddrinfo.c
null
null
null
null
null
source
musl
#include <netdb.h> #include "locale_impl.h" static const char msgs[] = "Invalid flags\0" "Name does not resolve\0" "Try again\0" "Non-recoverable error\0" "Name has no usable address\0" "Unrecognized address family or invalid length\0" "Unrecognized socket type\0" "Unrecognized service\0" "Unknown error\0" "...
src/network/gai_strerror.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <pthread.h> #include <unistd.h> #include <endian.h> #include <errno.h> #include "lookup.h" int getaddrinfo(const char *restrict host, const char *restrict serv, const struct addrinfo *restrict hint, stru...
src/network/getaddrinfo.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <netdb.h> #include <errno.h> #include <stdlib.h> struct hostent *gethostbyaddr(const void *a, socklen_t l, int af) { static struct hostent *h; size_t size = 63; struct hostent *res; int err; do { free(h); h = malloc(size+=size+1); if (!h) { h_errno = NO_RECOVERY; return 0...
src/network/gethostbyaddr.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netdb.h> #include <string.h> #include <netinet/in.h> #include <errno.h> #include <inttypes.h> int gethostbyaddr_r(const void *a, socklen_t l, int af, struct hostent *h, char *buf, size_t buflen, struct hostent **res, int *err) { union { struct sockaddr_in sin...
src/network/gethostbyaddr_r.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netdb.h> #include <string.h> #include <netinet/in.h> struct hostent *gethostbyname(const char *name) { return gethostbyname2(name, AF_INET); }
src/network/gethostbyname.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netdb.h> #include <errno.h> #include <stdlib.h> struct hostent *gethostbyname2(const char *name, int af) { static struct hostent *h; size_t size = 63; struct hostent *res; int err; do { free(h); h = malloc(size+=size+1); if (!h) { h_errno = NO_RECOVE...
src/network/gethostbyname2.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netdb.h> #include <string.h> #include <netinet/in.h> #include <errno.h> #include <stdint.h> #include "lookup.h" int gethostbyname2_r(const char *name, int af, struct hostent *h, char *buf, size_t buflen, struct hostent **res, int *err) { struct address addrs[MA...
src/network/gethostbyname2_r.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netdb.h> int gethostbyname_r(const char *name, struct hostent *h, char *buf, size_t buflen, struct hostent **res, int *err) { return gethostbyname2_r(name, AF_INET, h, buf, buflen, res, err); }
src/network/gethostbyname_r.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <errno.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <ifaddrs.h> #include <syscall.h> #include <net/if.h> #include <netinet/in.h> #include "netlink.h" #define IFADDRS_HASH_SIZE 64 /* getifaddrs() reports hardware addresses with PF_PACKET that implies * struct so...
src/network/getifaddrs.c
null
null
null
null
null
source
musl
#include <netdb.h> #include <limits.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <net/if.h> #include <ctype.h> #include <resolv.h> #include "lookup.h" #include "stdio_impl.h" #define PTR_MAX (64 + sizeof ".in-addr.arpa") #...
src/network/getnameinfo.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" int getpeername(int fd, struct sockaddr *restrict addr, socklen_t *restrict len) { return socketcall(getpeername, fd, addr, len, 0, 0, 0); }
src/network/getpeername.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <netdb.h> struct servent *getservbyname(const char *name, const char *prots) { static struct servent se; static char *buf[2]; struct servent *res; if (getservbyname_r(name, prots, &se, (void *)buf, sizeof buf, &res)) return 0; return &se; }
src/network/getservbyname.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <inttypes.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include "lookup.h" #define ALIGN (sizeof(struct { char a; char *b; }) - sizeof(char *)) int getservbyname_r(const char *name, const char *prots, str...
src/network/getservbyname_r.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <netdb.h> struct servent *getservbyport(int port, const char *prots) { static struct servent se; static long buf[32/sizeof(long)]; struct servent *res; if (getservbyport_r(port, prots, &se, (void *)buf, sizeof buf, &res)) return 0; return &se; }
src/network/getservbyport.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <inttypes.h> #include <errno.h> #include <string.h> #include <stdlib.h> int getservbyport_r(int port, const char *prots, struct servent *se, char *buf, size_t buflen, struct servent **res) { int i; struct sockaddr_in sin...
src/network/getservbyport_r.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" int getsockname(int fd, struct sockaddr *restrict addr, socklen_t *restrict len) { return socketcall(getsockname, fd, addr, len, 0, 0, 0); }
src/network/getsockname.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <sys/time.h> #include <errno.h> #include "syscall.h" int getsockopt(int fd, int level, int optname, void *restrict optval, socklen_t *restrict optlen) { long tv32[2]; struct timeval *tv; int r = __socketcall(getsockopt, fd, level, optname, optval, optlen, 0); if (r==-ENOPROTOOPT)...
src/network/getsockopt.c
null
null
null
null
null
source
musl
#include <netdb.h> #include "pthread_impl.h" #undef h_errno int h_errno; int *__h_errno_location(void) { if (!__pthread_self()->stack) return &h_errno; return &__pthread_self()->h_errno_val; }
src/network/h_errno.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <stdio.h> #include <netdb.h> void herror(const char *msg) { fprintf(stderr, "%s%s%s\n", msg?msg:"", msg?": ":"", hstrerror(h_errno)); }
src/network/herror.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <netdb.h> #include "locale_impl.h" static const char msgs[] = "Host not found\0" "Try again\0" "Non-recoverable error\0" "Address not available\0" "\0Unknown error"; const char *hstrerror(int ecode) { const char *s; for (s=msgs, ecode--; ecode && *s; ecode--, s++) for (; *s; s++); ...
src/network/hstrerror.c
null
null
null
null
null
source
musl
#include <netinet/in.h> #include <byteswap.h> uint32_t htonl(uint32_t n) { union { int i; char c; } u = { 1 }; return u.c ? bswap_32(n) : n; }
src/network/htonl.c
null
null
null
null
null
source
musl
#include <netinet/in.h> #include <byteswap.h> uint16_t htons(uint16_t n) { union { int i; char c; } u = { 1 }; return u.c ? bswap_16(n) : n; }
src/network/htons.c
null
null
null
null
null
source
musl
#include <net/if.h> #include <stdlib.h> void if_freenameindex(struct if_nameindex *idx) { free(idx); }
src/network/if_freenameindex.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <net/if.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <string.h> #include <errno.h> #include "syscall.h" char *if_indextoname(unsigned index, char *name) { struct ifreq ifr; int fd, r; if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return 0; ifr.ifr_ifindex =...
src/network/if_indextoname.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <net/if.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include "netlink.h" #define IFADDRS_HASH_SIZE 64 struct ifnamemap { unsigned int hash_next; unsigned int index; unsigned char namelen; char name[IFNAMSIZ]; }; struct ifname...
src/network/if_nameindex.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <net/if.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <string.h> #include "syscall.h" unsigned if_nametoindex(const char *name) { struct ifreq ifr; int fd, r; if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return 0; strncpy(ifr.ifr_name, name, sizeof ifr.ifr_...
src/network/if_nametoindex.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> in_addr_t inet_addr(const char *p) { struct in_addr a; if (!__inet_aton(p, &a)) return -1; return a.s_addr; }
src/network/inet_addr.c
null
null
null
null
null
source
musl
#include <ctype.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdlib.h> int __inet_aton(const char *s0, struct in_addr *dest) { const char *s = s0; unsigned char *d = (void *)dest; unsigned long a[4] = { 0 }; char *z; int i; for (i=0; i<4; i++) { a[i] = strtoul(s, &z, 0);...
src/network/inet_aton.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <arpa/inet.h> #include <errno.h> #include <stdio.h> #include <string.h> const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen_t l) { const unsigned char *a = a0; int i, j, max, best; char buf[100]; switch (af) { case AF_INET: if (snprintf(s, l, "%d.%d...
src/network/inet_ntop.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <arpa/inet.h> #include <ctype.h> #include <errno.h> #include <string.h> static int hexval(unsigned c) { if (c-'0'<10) return c-'0'; c |= 32; if (c-'a'<6) return c-'a'+10; return -1; } int inet_pton(int af, const char *restrict s, void *restrict a0) { uint16_t ip[8]; unsigned cha...
src/network/inet_pton.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" int listen(int fd, int backlog) { return socketcall(listen, fd, backlog, 0, 0, 0, 0); }
src/network/listen.c
null
null
null
null
null
source
musl
#ifndef LOOKUP_H #define LOOKUP_H #include <stdint.h> #include <stddef.h> #include <features.h> #include <netinet/in.h> #include <netdb.h> struct aibuf { struct addrinfo ai; union sa { struct sockaddr_in sin; struct sockaddr_in6 sin6; } sa; volatile int lock[1]; short slot, ref; }; struct address { int fam...
src/network/lookup.h
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <net/if.h> #include <arpa/inet.h> #include <limits.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "lookup.h" int __lookup_ipliteral(struct address buf[static 1], const char *name, int family) { struct in_addr a4; stru...
src/network/lookup_ipliteral.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <net/if.h> #include <arpa/inet.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <pthread.h> #include <errno.h> #include <resolv.h> #include "lookup.h" #include "stdio_impl.h" #include...
src/network/lookup_name.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include "lookup.h" #include "stdio_impl.h" int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int proto, int socktype, int flags) { ...
src/network/lookup_serv.c
null
null
null
null
null
source
musl
#include <errno.h> #include <string.h> #include <syscall.h> #include <sys/socket.h> #include "netlink.h" static int __netlink_enumerate(int fd, unsigned int seq, int type, int af, int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx) { struct nlmsghdr *h; union { uint8_t buf[8192]; struct { struct nlmsghdr nl...
src/network/netlink.c
null
null
null
null
null
source
musl
#include <stdint.h> /* linux/netlink.h */ #define NETLINK_ROUTE 0 struct nlmsghdr { uint32_t nlmsg_len; uint16_t nlmsg_type; uint16_t nlmsg_flags; uint32_t nlmsg_seq; uint32_t nlmsg_pid; }; #define NLM_F_REQUEST 1 #define NLM_F_MULTI 2 #define NLM_F_ACK 4 #define NLM_F_ROOT 0x100 #define NLM_F_MATCH 0x200 #de...
src/network/netlink.h
null
null
null
null
null
source
musl
#include <netdb.h> struct netent *getnetbyaddr(uint32_t net, int type) { return 0; } struct netent *getnetbyname(const char *name) { return 0; }
src/network/netname.c
null
null
null
null
null
source
musl
#define _BSD_SOURCE #include <errno.h> #include <stddef.h> #include <resolv.h> #include <arpa/nameser.h> const struct _ns_flagdata _ns_flagdata[16] = { { 0x8000, 15 }, { 0x7800, 11 }, { 0x0400, 10 }, { 0x0200, 9 }, { 0x0100, 8 }, { 0x0080, 7 }, { 0x0040, 6 }, { 0x0020, 5 }, { 0x0010, 4 }, { 0x000f, 0 }, { 0...
src/network/ns_parse.c
null
null
null
null
null
source
musl
#include <netinet/in.h> #include <byteswap.h> uint32_t ntohl(uint32_t n) { union { int i; char c; } u = { 1 }; return u.c ? bswap_32(n) : n; }
src/network/ntohl.c
null
null
null
null
null
source
musl
#include <netinet/in.h> #include <byteswap.h> uint16_t ntohs(uint16_t n) { union { int i; char c; } u = { 1 }; return u.c ? bswap_16(n) : n; }
src/network/ntohs.c
null
null
null
null
null
source
musl
#include <netdb.h> #include <string.h> /* do we really need all these?? */ static int idx; static const unsigned char protos[] = { "\000ip\0" "\001icmp\0" "\002igmp\0" "\003ggp\0" "\004ipencap\0" "\005st\0" "\006tcp\0" "\010egp\0" "\014pup\0" "\021udp\0" "\024hmp\0" "\026xns-idp\0" "\033rdp\0" "\035iso-...
src/network/proto.c
null
null
null
null
null
source
musl
#include <sys/socket.h> ssize_t recv(int fd, void *buf, size_t len, int flags) { return recvfrom(fd, buf, len, flags, 0, 0); }
src/network/recv.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include "syscall.h" ssize_t recvfrom(int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict addr, socklen_t *restrict alen) { return socketcall_cp(recvfrom, fd, buf, len, flags, addr, alen); }
src/network/recvfrom.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <sys/socket.h> #include <limits.h> #include <errno.h> #include <time.h> #include "syscall.h" #define IS32BIT(x) !((x)+0x80000000ULL>>32) #define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63)) hidden void __convert_scm_timestamps(struct msghdr *, socklen_t); int recvmmsg(...
src/network/recvmmsg.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <limits.h> #include <time.h> #include <sys/time.h> #include <string.h> #include "syscall.h" hidden void __convert_scm_timestamps(struct msghdr *, socklen_t); void __convert_scm_timestamps(struct msghdr *msg, socklen_t csize) { if (SCM_TIMESTAMP == SCM_TIMESTAMP_OLD) return; if (!msg...
src/network/recvmsg.c
null
null
null
null
null
source
musl
#include <resolv.h> #include <string.h> #include <time.h> int __res_mkquery(int op, const char *dname, int class, int type, const unsigned char *data, int datalen, const unsigned char *newrr, unsigned char *buf, int buflen) { int id, i, j; unsigned char q[280]; struct timespec ts; size_t l = strnlen(dname, 255);...
src/network/res_mkquery.c
null
null
null
null
null
source
musl
#include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <netdb.h> #include <arpa/inet.h> #include <stdint.h> #include <string.h> #include <poll.h> #include <time.h> #include <ctype.h> #include <unistd.h> #include <errno.h> #include <pthread.h> #include "stdio_impl.h" #include "syscall.h" #incl...
src/network/res_msend.c
null
null
null
null
null
source
musl
#define _BSD_SOURCE #include <resolv.h> #include <netdb.h> int res_query(const char *name, int class, int type, unsigned char *dest, int len) { unsigned char q[280]; int ql = __res_mkquery(0, name, class, type, 0, 0, 0, q, sizeof q); if (ql < 0) return ql; int r = __res_send(q, ql, dest, len); if (r<12) { h_err...
src/network/res_query.c
null
null
null
null
null
source
musl
#include <resolv.h> #include <string.h> int res_querydomain(const char *name, const char *domain, int class, int type, unsigned char *dest, int len) { char tmp[255]; size_t nl = strnlen(name, 255); size_t dl = strnlen(domain, 255); if (nl+dl+1 > 254) return -1; memcpy(tmp, name, nl); tmp[nl] = '.'; memcpy(tmp+n...
src/network/res_querydomain.c
null
null
null
null
null
source
musl
#include <resolv.h> #include <string.h> int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen) { int r; if (anslen < 512) { unsigned char buf[512]; r = __res_send(msg, msglen, buf, sizeof buf); if (r >= 0) memcpy(answer, buf, r < anslen ? r : anslen); return r; } r = __res_...
src/network/res_send.c
null
null
null
null
null
source
musl
#include <resolv.h> /* This is completely unused, and exists purely to satisfy broken apps. */ struct __res_state *__res_state() { static struct __res_state res; return &res; }
src/network/res_state.c
null
null
null
null
null
source
musl
#include "lookup.h" #include "stdio_impl.h" #include <ctype.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <netinet/in.h> int __get_resolv_conf(struct resolvconf *conf, char *search, size_t search_sz) { char line[256]; unsigned char _buf[256]; FILE *f, _f; int nns = 0; conf->ndots = 1; c...
src/network/resolvconf.c
null
null
null
null
null
source
musl
#include <sys/socket.h> ssize_t send(int fd, const void *buf, size_t len, int flags) { return sendto(fd, buf, len, flags, 0, 0); }
src/network/send.c
null
null
null
null
null