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
/* * public domain sha512 crypt implementation * * original sha crypt design: http://people.redhat.com/drepper/SHA-crypt.txt * in this implementation at least 32bit int is assumed, * key length is limited, the $6$ prefix is mandatory, '\n' and ':' is rejected * in the salt and rounds= setting must contain a valid...
src/crypt/crypt_sha512.c
null
null
null
null
null
source
musl
#include <endian.h> #if __BYTE_ORDER == __BIG_ENDIAN #define X(x) x #else #define X(x) (((x)/256 | (x)*256) % 65536) #endif static const unsigned short table[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,...
src/ctype/__ctype_b_loc.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include "locale_impl.h" size_t __ctype_get_mb_cur_max() { return MB_CUR_MAX; }
src/ctype/__ctype_get_mb_cur_max.c
null
null
null
null
null
source
musl
#include <stdint.h> static const int32_t table[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,...
src/ctype/__ctype_tolower_loc.c
null
null
null
null
null
source
musl
#include <stdint.h> static const int32_t table[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,...
src/ctype/__ctype_toupper_loc.c
null
null
null
null
null
source
musl
18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40, 41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,1...
src/ctype/alpha.h
null
null
null
null
null
source
musl
static const unsigned char tab[] = { 7, 8, 9, 10, 11, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 6, 15, 16, 17, 18, 6, 19, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 21, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6...
src/ctype/casemap.h
null
null
null
null
null
source
musl
#include <ctype.h> int isalnum(int c) { return isalpha(c) || isdigit(c); } int __isalnum_l(int c, locale_t l) { return isalnum(c); } weak_alias(__isalnum_l, isalnum_l);
src/ctype/isalnum.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef isalpha int isalpha(int c) { return ((unsigned)c|32)-'a' < 26; } int __isalpha_l(int c, locale_t l) { return isalpha(c); } weak_alias(__isalpha_l, isalpha_l);
src/ctype/isalpha.c
null
null
null
null
null
source
musl
#include <ctype.h> int isblank(int c) { return (c == ' ' || c == '\t'); } int __isblank_l(int c, locale_t l) { return isblank(c); } weak_alias(__isblank_l, isblank_l);
src/ctype/isblank.c
null
null
null
null
null
source
musl
#include <ctype.h> int iscntrl(int c) { return (unsigned)c < 0x20 || c == 0x7f; } int __iscntrl_l(int c, locale_t l) { return iscntrl(c); } weak_alias(__iscntrl_l, iscntrl_l);
src/ctype/iscntrl.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef isdigit int isdigit(int c) { return (unsigned)c-'0' < 10; } int __isdigit_l(int c, locale_t l) { return isdigit(c); } weak_alias(__isdigit_l, isdigit_l);
src/ctype/isdigit.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef isgraph int isgraph(int c) { return (unsigned)c-0x21 < 0x5e; } int __isgraph_l(int c, locale_t l) { return isgraph(c); } weak_alias(__isgraph_l, isgraph_l);
src/ctype/isgraph.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef islower int islower(int c) { return (unsigned)c-'a' < 26; } int __islower_l(int c, locale_t l) { return islower(c); } weak_alias(__islower_l, islower_l);
src/ctype/islower.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef isprint int isprint(int c) { return (unsigned)c-0x20 < 0x5f; } int __isprint_l(int c, locale_t l) { return isprint(c); } weak_alias(__isprint_l, isprint_l);
src/ctype/isprint.c
null
null
null
null
null
source
musl
#include <ctype.h> int ispunct(int c) { return isgraph(c) && !isalnum(c); } int __ispunct_l(int c, locale_t l) { return ispunct(c); } weak_alias(__ispunct_l, ispunct_l);
src/ctype/ispunct.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef isspace int isspace(int c) { return c == ' ' || (unsigned)c-'\t' < 5; } int __isspace_l(int c, locale_t l) { return isspace(c); } weak_alias(__isspace_l, isspace_l);
src/ctype/isspace.c
null
null
null
null
null
source
musl
#include <ctype.h> #undef isupper int isupper(int c) { return (unsigned)c-'A' < 26; } int __isupper_l(int c, locale_t l) { return isupper(c); } weak_alias(__isupper_l, isupper_l);
src/ctype/isupper.c
null
null
null
null
null
source
musl
#include <wctype.h> int iswalnum(wint_t wc) { return iswdigit(wc) || iswalpha(wc); } int __iswalnum_l(wint_t c, locale_t l) { return iswalnum(c); } weak_alias(__iswalnum_l, iswalnum_l);
src/ctype/iswalnum.c
null
null
null
null
null
source
musl
#include <wctype.h> static const unsigned char table[] = { #include "alpha.h" }; int iswalpha(wint_t wc) { if (wc<0x20000U) return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1; if (wc<0x2fffeU) return 1; return 0; } int __iswalpha_l(wint_t c, locale_t l) { return iswalpha(c); } weak_alias(__iswalpha_l, ...
src/ctype/iswalpha.c
null
null
null
null
null
source
musl
#include <wctype.h> #include <ctype.h> int iswblank(wint_t wc) { return isblank(wc); } int __iswblank_l(wint_t c, locale_t l) { return iswblank(c); } weak_alias(__iswblank_l, iswblank_l);
src/ctype/iswblank.c
null
null
null
null
null
source
musl
#include <wctype.h> int iswcntrl(wint_t wc) { return (unsigned)wc < 32 || (unsigned)(wc-0x7f) < 33 || (unsigned)(wc-0x2028) < 2 || (unsigned)(wc-0xfff9) < 3; } int __iswcntrl_l(wint_t c, locale_t l) { return iswcntrl(c); } weak_alias(__iswcntrl_l, iswcntrl_l);
src/ctype/iswcntrl.c
null
null
null
null
null
source
musl
#include <wctype.h> #include <string.h> #define WCTYPE_ALNUM 1 #define WCTYPE_ALPHA 2 #define WCTYPE_BLANK 3 #define WCTYPE_CNTRL 4 #define WCTYPE_DIGIT 5 #define WCTYPE_GRAPH 6 #define WCTYPE_LOWER 7 #define WCTYPE_PRINT 8 #define WCTYPE_PUNCT 9 #define WCTYPE_SPACE 10 #define WCTYPE_UPPER 11 #define WCTYP...
src/ctype/iswctype.c
null
null
null
null
null
source
musl
#include <wctype.h> #undef iswdigit int iswdigit(wint_t wc) { return (unsigned)wc-'0' < 10; } int __iswdigit_l(wint_t c, locale_t l) { return iswdigit(c); } weak_alias(__iswdigit_l, iswdigit_l);
src/ctype/iswdigit.c
null
null
null
null
null
source
musl
#include <wctype.h> int iswgraph(wint_t wc) { /* ISO C defines this function as: */ return !iswspace(wc) && iswprint(wc); } int __iswgraph_l(wint_t c, locale_t l) { return iswgraph(c); } weak_alias(__iswgraph_l, iswgraph_l);
src/ctype/iswgraph.c
null
null
null
null
null
source
musl
#include <wctype.h> int iswlower(wint_t wc) { return towupper(wc) != wc; } int __iswlower_l(wint_t c, locale_t l) { return iswlower(c); } weak_alias(__iswlower_l, iswlower_l);
src/ctype/iswlower.c
null
null
null
null
null
source
musl
#include <wctype.h> /* Consider all legal codepoints as printable except for: * - C0 and C1 control characters * - U+2028 and U+2029 (line/para break) * - U+FFF9 through U+FFFB (interlinear annotation controls) * The following code is optimized heavily to make hot paths for the * expected printable characters. */...
src/ctype/iswprint.c
null
null
null
null
null
source
musl
#include <wctype.h> static const unsigned char table[] = { #include "punct.h" }; int iswpunct(wint_t wc) { if (wc<0x20000U) return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1; return 0; } int __iswpunct_l(wint_t c, locale_t l) { return iswpunct(c); } weak_alias(__iswpunct_l, iswpunct_l);
src/ctype/iswpunct.c
null
null
null
null
null
source
musl
#include <wchar.h> #include <wctype.h> /* Our definition of whitespace is the Unicode White_Space property, * minus non-breaking spaces (U+00A0, U+2007, and U+202F) and script- * specific characters with non-blank glyphs (U+1680 and U+180E). */ int iswspace(wint_t wc) { static const wchar_t spaces[] = { ' ', '\t...
src/ctype/iswspace.c
null
null
null
null
null
source
musl
#include <wctype.h> int iswupper(wint_t wc) { return towlower(wc) != wc; } int __iswupper_l(wint_t c, locale_t l) { return iswupper(c); } weak_alias(__iswupper_l, iswupper_l);
src/ctype/iswupper.c
null
null
null
null
null
source
musl
#include <wctype.h> int iswxdigit(wint_t wc) { return (unsigned)(wc-'0') < 10 || (unsigned)((wc|32)-'a') < 6; } int __iswxdigit_l(wint_t c, locale_t l) { return iswxdigit(c); } weak_alias(__iswxdigit_l, iswxdigit_l);
src/ctype/iswxdigit.c
null
null
null
null
null
source
musl
#include <ctype.h> int isxdigit(int c) { return isdigit(c) || ((unsigned)c|32)-'a' < 6; } int __isxdigit_l(int c, locale_t l) { return isxdigit(c); } weak_alias(__isxdigit_l, isxdigit_l);
src/ctype/isxdigit.c
null
null
null
null
null
source
musl
16,16,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,16,33,16,16,16,34,35,36, 37,38,39,40,16,16,41,16,16,16,16,16,16,16,16,16,16,16,42,43,16,16,44,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,1...
src/ctype/nonspacing.h
null
null
null
null
null
source
musl
18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,16,16,34,35,16,36,37,38,39, 40,41,42,43,16,44,45,46,17,17,47,17,17,17,17,17,17,48,49,50,51,52,53,54,55,17, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,56, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,1...
src/ctype/punct.h
null
null
null
null
null
source
musl
#include <ctype.h> /* nonsense function that should NEVER be used! */ int toascii(int c) { return c & 0x7f; }
src/ctype/toascii.c
null
null
null
null
null
source
musl
#include <ctype.h> int tolower(int c) { if (isupper(c)) return c | 32; return c; } int __tolower_l(int c, locale_t l) { return tolower(c); } weak_alias(__tolower_l, tolower_l);
src/ctype/tolower.c
null
null
null
null
null
source
musl
#include <ctype.h> int toupper(int c) { if (islower(c)) return c & 0x5f; return c; } int __toupper_l(int c, locale_t l) { return toupper(c); } weak_alias(__toupper_l, toupper_l);
src/ctype/toupper.c
null
null
null
null
null
source
musl
#include <wctype.h> static const unsigned char tab[]; static const unsigned char rulebases[512]; static const int rules[]; static const unsigned char exceptions[][2]; #include "casemap.h" static int casemap(unsigned c, int dir) { unsigned b, x, y, v, rt, xb, xn; int r, rd, c0 = c; if (c >= 0x20000) return c; ...
src/ctype/towctrans.c
null
null
null
null
null
source
musl
#include <wchar.h> int wcswidth(const wchar_t *wcs, size_t n) { int l=0, k=0; for (; n-- && *wcs && (k = wcwidth(*wcs)) >= 0; l+=k, wcs++); return (k < 0) ? k : l; }
src/ctype/wcswidth.c
null
null
null
null
null
source
musl
#include <wctype.h> #include <string.h> wctrans_t wctrans(const char *class) { if (!strcmp(class, "toupper")) return (wctrans_t)1; if (!strcmp(class, "tolower")) return (wctrans_t)2; return 0; } wint_t towctrans(wint_t wc, wctrans_t trans) { if (trans == (wctrans_t)1) return towupper(wc); if (trans == (wctrans_t...
src/ctype/wctrans.c
null
null
null
null
null
source
musl
#include <wchar.h> static const unsigned char table[] = { #include "nonspacing.h" }; static const unsigned char wtable[] = { #include "wide.h" }; int wcwidth(wchar_t wc) { if (wc < 0xffU) return (wc+1 & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0; if ((wc & 0xfffeffffU) < 0xfffe) { if ((table[table[wc>>8]*32+((wc&255)>>3)...
src/ctype/wcwidth.c
null
null
null
null
null
source
musl
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,19,16,20,21,22,16,16,16,23,16,16,24,25,26,27,28,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,29, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,1...
src/ctype/wide.h
null
null
null
null
null
source
musl
struct __dirstream { off_t tell; int fd; int buf_pos; int buf_end; volatile int lock[1]; /* Any changes to this struct must preserve the property: * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ char buf[2048]; };
src/dirent/__dirent.h
null
null
null
null
null
source
musl
#include <dirent.h> #include <unistd.h> #include <stdlib.h> #include "__dirent.h" int closedir(DIR *dir) { int ret = close(dir->fd); free(dir); return ret; }
src/dirent/closedir.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <fcntl.h> #include <sys/stat.h> #include <errno.h> #include <stdlib.h> #include "__dirent.h" DIR *fdopendir(int fd) { DIR *dir; struct stat st; if (fstat(fd, &st) < 0) { return 0; } if (fcntl(fd, F_GETFL) & O_PATH) { errno = EBADF; return 0; } if (!S_ISDIR(st.st_mode)) { er...
src/dirent/fdopendir.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <dirent.h> #include <fcntl.h> #include <stdlib.h> #include "__dirent.h" #include "syscall.h" DIR *opendir(const char *name) { int fd; DIR *dir; if ((fd = open(name, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0) return 0; if (!(dir = calloc(1, sizeof *dir))) { __syscall(SYS_close, fd); r...
src/dirent/opendir.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <limits.h> #include <errno.h> #include "syscall.h" ssize_t posix_getdents(int fd, void *buf, size_t len, int flags) { if (flags) return __syscall_ret(-EOPNOTSUPP); if (len>INT_MAX) len = INT_MAX; return syscall(SYS_getdents, fd, buf, len); }
src/dirent/posix_getdents.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <errno.h> #include <stddef.h> #include "__dirent.h" #include "syscall.h" typedef char dirstream_buf_alignment_check[1-2*(int)( offsetof(struct __dirstream, buf) % sizeof(off_t))]; struct dirent *readdir(DIR *dir) { struct dirent *de; if (dir->buf_pos >= dir->buf_end) { int len = __...
src/dirent/readdir.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <errno.h> #include <string.h> #include "__dirent.h" #include "lock.h" int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **restrict result) { struct dirent *de; int errno_save = errno; int ret; LOCK(dir->lock); errno = 0; de = readdir(dir); if ((ret = errn...
src/dirent/readdir_r.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <unistd.h> #include "__dirent.h" #include "lock.h" void rewinddir(DIR *dir) { LOCK(dir->lock); lseek(dir->fd, 0, SEEK_SET); dir->buf_pos = dir->buf_end = 0; dir->tell = 0; UNLOCK(dir->lock); }
src/dirent/rewinddir.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <string.h> #include <stdlib.h> #include <stdint.h> #include <errno.h> #include <stddef.h> int scandir(const char *path, struct dirent ***res, int (*sel)(const struct dirent *), int (*cmp)(const struct dirent **, const struct dirent **)) { DIR *d = opendir(path); struct dirent *de, **na...
src/dirent/scandir.c
null
null
null
null
null
source
musl
#include <dirent.h> #include <unistd.h> #include "__dirent.h" #include "lock.h" void seekdir(DIR *dir, long off) { LOCK(dir->lock); dir->tell = lseek(dir->fd, off, SEEK_SET); dir->buf_pos = dir->buf_end = 0; UNLOCK(dir->lock); }
src/dirent/seekdir.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <string.h> #include <dirent.h> int versionsort(const struct dirent **a, const struct dirent **b) { return strverscmp((*a)->d_name, (*b)->d_name); }
src/dirent/versionsort.c
null
null
null
null
null
source
musl
#include <unistd.h> char **__environ = 0; weak_alias(__environ, ___environ); weak_alias(__environ, _environ); weak_alias(__environ, environ);
src/env/__environ.c
null
null
null
null
null
source
musl
#define SYSCALL_NO_TLS 1 #include <elf.h> #include <limits.h> #include <sys/mman.h> #include <string.h> #include <stddef.h> #include "pthread_impl.h" #include "libc.h" #include "atomic.h" #include "syscall.h" volatile int __thread_list_lock; int __init_tp(void *p) { pthread_t td = p; td->self = td; int r = __set_t...
src/env/__init_tls.c
null
null
null
null
null
source
musl
#include <elf.h> #include <poll.h> #include <fcntl.h> #include <signal.h> #include <unistd.h> #include "syscall.h" #include "atomic.h" #include "libc.h" static void dummy(void) {} weak_alias(dummy, _init); extern weak hidden void (*const __init_array_start)(void), (*const __init_array_end)(void); static void dummy1(...
src/env/__libc_start_main.c
null
null
null
null
null
source
musl
#include <string.h> #include "pthread_impl.h" #include "libc.h" void __reset_tls() { pthread_t self = __pthread_self(); struct tls_module *p; size_t i, n = self->dtv[0]; if (n) for (p=libc.tls_head, i=1; i<=n; i++, p=p->next) { char *mem = (char *)(self->dtv[i] - DTP_OFFSET); memcpy(mem, p->image, p->len); m...
src/env/__reset_tls.c
null
null
null
null
null
source
musl
#include <string.h> #include <stdint.h> #include "pthread_impl.h" uintptr_t __stack_chk_guard; void __init_ssp(void *entropy) { if (entropy) memcpy(&__stack_chk_guard, entropy, sizeof(uintptr_t)); else __stack_chk_guard = (uintptr_t)&__stack_chk_guard * 1103515245; #if UINTPTR_MAX >= 0xffffffffffffffff /* Sacrifi...
src/env/__stack_chk_fail.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <stdlib.h> #include <unistd.h> static void dummy(char *old, char *new) {} weak_alias(dummy, __env_rm_add); int clearenv() { char **e = __environ; __environ = 0; if (e) while (*e) __env_rm_add(*e++, 0); return 0; }
src/env/clearenv.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <string.h> #include <unistd.h> char *getenv(const char *name) { size_t l = __strchrnul(name, '=') - name; if (l && !name[l] && __environ) for (char **e = __environ; *e; e++) if (!strncmp(name, *e, l) && l[*e] == '=') return *e + l+1; return 0; }
src/env/getenv.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <string.h> #include <unistd.h> static void dummy(char *old, char *new) {} weak_alias(dummy, __env_rm_add); int __putenv(char *s, size_t l, char *r) { size_t i=0; if (__environ) { for (char **e = __environ; *e; e++, i++) if (!strncmp(s, *e, l+1)) { char *tmp = *e; *e = s; ...
src/env/putenv.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <stdlib.h> #include "libc.h" char *secure_getenv(const char *name) { return libc.secure ? NULL : getenv(name); }
src/env/secure_getenv.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <string.h> #include <errno.h> void __env_rm_add(char *old, char *new) { static char **env_alloced; static size_t env_alloced_n; for (size_t i=0; i < env_alloced_n; i++) if (env_alloced[i] == old) { env_alloced[i] = new; free(old); return; } else if (!env_alloced[i] && new) ...
src/env/setenv.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> static void dummy(char *old, char *new) {} weak_alias(dummy, __env_rm_add); int unsetenv(const char *name) { size_t l = __strchrnul(name, '=') - name; if (!l || name[l]) { errno = EINVAL; return -1; } if (__environ) { char **e = ...
src/env/unsetenv.c
null
null
null
null
null
source
musl
#include <errno.h> #include "pthread_impl.h" int *__errno_location(void) { return &__pthread_self()->errno_val; } weak_alias(__errno_location, ___errno_location);
src/errno/__errno_location.c
null
null
null
null
null
source
musl
/* The first entry is a catch-all for codes not enumerated here. * This file is included multiple times to declare and define a structure * with these messages, and then to define a lookup table translating * error codes to offsets of corresponding fields in the structure. */ E(0, "No error information")...
src/errno/__strerror.h
null
null
null
null
null
source
musl
#include <errno.h> #include <stddef.h> #include <string.h> #include "locale_impl.h" /* mips has one error code outside of the 8-bit range due to a * historical typo, so we just remap it. */ #if EDQUOT==1133 #define EDQUOT_ORIG 1133 #undef EDQUOT #define EDQUOT 109 #endif static const struct errmsgstr_t { #define E(...
src/errno/strerror.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include "syscall.h" _Noreturn void _Exit(int ec) { __syscall(SYS_exit_group, ec); for (;;) __syscall(SYS_exit, ec); }
src/exit/_Exit.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <signal.h> #include "syscall.h" #include "pthread_impl.h" #include "atomic.h" #include "lock.h" #include "ksigaction.h" _Noreturn void abort(void) { raise(SIGABRT); /* If there was a SIGABRT handler installed and it returned, or if * SIGABRT was blocked or ignored, take an AS-safe loc...
src/exit/abort.c
null
null
null
null
null
source
musl
#include <stdio.h> #include <stdlib.h> _Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func) { fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line); abort(); }
src/exit/assert.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include "libc.h" #include "lock.h" #include "fork_impl.h" #define COUNT 32 static void (*funcs[COUNT])(void); static int count; static volatile int lock[1]; volatile int *const __at_quick_exit_lockptr = lock; void __funcs_on_quick_exit() { void (*func)(void); LOCK(lock); while (count > 0) { ...
src/exit/at_quick_exit.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include "libc.h" #include "lock.h" #include "fork_impl.h" #define malloc __libc_malloc #define calloc __libc_calloc #define realloc undef #define free undef /* Ensure that at least 32 atexit handlers can be registered without malloc */ #define COUNT 32 static struct fl { str...
src/exit/atexit.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include "libc.h" #include "pthread_impl.h" #include "atomic.h" #include "syscall.h" static void dummy() { } /* atexit.c and __stdio_exit.c override these. the latter is linked * as a consequence of linking either __toread.c or __towrite.c. */ weak_alias(dummy, __funcs_on_exit...
src/exit/exit.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include "libc.h" static void dummy() { } weak_alias(dummy, __funcs_on_quick_exit); _Noreturn void quick_exit(int code) { __funcs_on_quick_exit(); _Exit(code); }
src/exit/quick_exit.c
null
null
null
null
null
source
musl
int __cxa_atexit(void (*func)(void *), void *arg, void *dso); int __aeabi_atexit (void *obj, void (*func) (void *), void *d) { return __cxa_atexit (func, obj, d); }
src/exit/arm/__aeabi_atexit.c
null
null
null
null
null
source
musl
#include <fcntl.h> int creat(const char *filename, mode_t mode) { return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode); }
src/fcntl/creat.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <fcntl.h> #include <stdarg.h> #include <errno.h> #include "syscall.h" int fcntl(int fd, int cmd, ...) { unsigned long arg; va_list ap; va_start(ap, cmd); arg = va_arg(ap, unsigned long); va_end(ap); if (cmd == F_SETFL) arg |= O_LARGEFILE; if (cmd == F_SETLKW) return syscall_cp(SYS_f...
src/fcntl/fcntl.c
null
null
null
null
null
source
musl
#include <fcntl.h> #include <stdarg.h> #include "syscall.h" int open(const char *filename, int flags, ...) { mode_t mode = 0; if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) { va_list ap; va_start(ap, flags); mode = va_arg(ap, mode_t); va_end(ap); } int fd = __sys_open_cp(filename, flags, mode...
src/fcntl/open.c
null
null
null
null
null
source
musl
#include <fcntl.h> #include <stdarg.h> #include "syscall.h" int openat(int fd, const char *filename, int flags, ...) { mode_t mode = 0; if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) { va_list ap; va_start(ap, flags); mode = va_arg(ap, mode_t); va_end(ap); } return syscall_cp(SYS_openat, fd, ...
src/fcntl/openat.c
null
null
null
null
null
source
musl
#include <fcntl.h> #include "syscall.h" int posix_fadvise(int fd, off_t base, off_t len, int advice) { #if defined(SYSCALL_FADVISE_6_ARG) /* Some archs, at least arm and powerpc, have the syscall * arguments reordered to avoid needing 7 argument registers * due to 64-bit argument alignment. */ return -__syscall(...
src/fcntl/posix_fadvise.c
null
null
null
null
null
source
musl
#include <fcntl.h> #include "syscall.h" int posix_fallocate(int fd, off_t base, off_t len) { return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base), __SYSCALL_LL_E(len)); }
src/fcntl/posix_fallocate.c
null
null
null
null
null
source
musl
#include <float.h> #include <fenv.h> int __flt_rounds() { switch (fegetround()) { #ifdef FE_TOWARDZERO case FE_TOWARDZERO: return 0; #endif case FE_TONEAREST: return 1; #ifdef FE_UPWARD case FE_UPWARD: return 2; #endif #ifdef FE_DOWNWARD case FE_DOWNWARD: return 3; #endif } return -1; }
src/fenv/__flt_rounds.c
null
null
null
null
null
source
musl
#include <fenv.h> int fegetexceptflag(fexcept_t *fp, int mask) { *fp = fetestexcept(mask); return 0; }
src/fenv/fegetexceptflag.c
null
null
null
null
null
source
musl
#include <fenv.h> int feholdexcept(fenv_t *envp) { fegetenv(envp); feclearexcept(FE_ALL_EXCEPT); return 0; }
src/fenv/feholdexcept.c
null
null
null
null
null
source
musl
#include <fenv.h> /* Dummy functions for archs lacking fenv implementation */ int feclearexcept(int mask) { return 0; } int feraiseexcept(int mask) { return 0; } int fetestexcept(int mask) { return 0; } int fegetround(void) { return FE_TONEAREST; } int __fesetround(int r) { return 0; } int fegetenv(fenv_t *...
src/fenv/fenv.c
null
null
null
null
null
source
musl
#include <fenv.h> int fesetexceptflag(const fexcept_t *fp, int mask) { feclearexcept(~*fp & mask); feraiseexcept(*fp & mask); return 0; }
src/fenv/fesetexceptflag.c
null
null
null
null
null
source
musl
#include <fenv.h> #include <features.h> /* __fesetround wrapper for arch independent argument check */ hidden int __fesetround(int); int fesetround(int r) { if (r != FE_TONEAREST #ifdef FE_DOWNWARD && r != FE_DOWNWARD #endif #ifdef FE_UPWARD && r != FE_UPWARD #endif #ifdef FE_TOWARDZERO && r != FE_TOWARDZERO ...
src/fenv/fesetround.c
null
null
null
null
null
source
musl
#include <fenv.h> int feupdateenv(const fenv_t *envp) { int ex = fetestexcept(FE_ALL_EXCEPT); fesetenv(envp); feraiseexcept(ex); return 0; }
src/fenv/feupdateenv.c
null
null
null
null
null
source
musl
.global fegetround .type fegetround,%function fegetround: mrs x0, fpcr and w0, w0, #0xc00000 ret .global __fesetround .hidden __fesetround .type __fesetround,%function __fesetround: mrs x1, fpcr bic w1, w1, #0xc00000 orr w1, w1, w0 msr fpcr, x1 mov w0, #0 ret .global fetestexcept .type fetestexcept,%function...
src/fenv/aarch64/fenv.s
null
null
null
null
null
source
musl
#if __ARM_PCS_VFP .syntax unified .fpu vfp .global fegetround .type fegetround,%function fegetround: fmrx r0, fpscr and r0, r0, #0xc00000 bx lr .global __fesetround .hidden __fesetround .type __fesetround,%function __fesetround: fmrx r3, fpscr bic r3, r3, #0xc00000 orr r3, r3, r0 fmxr fpscr, r3 mov r0, #0 b...
src/fenv/arm/fenv-hf.S
null
null
null
null
null
source
musl
.hidden __hwcap .global feclearexcept .type feclearexcept,@function feclearexcept: mov 4(%esp),%ecx and $0x3f,%ecx fnstsw %ax # consider sse fenv as well if the cpu has XMM capability call 1f 1: addl $__hwcap-1b,(%esp) pop %edx testl $0x02000000,(%edx) jz 2f # maintain exceptions in the sse mxcsr, clear x8...
src/fenv/i386/fenv.s
null
null
null
null
null
source
musl
#ifndef __loongarch_soft_float #ifdef BROKEN_LOONGARCH_FCSR_ASM #define FCSR $r0 #else #define FCSR $fcsr0 #endif .global feclearexcept .type feclearexcept,@function feclearexcept: li.w $t0, 0x1f0000 and $a0, $a0, $t0 movfcsr2gr $t1, FCSR andn $t1, $t1, $a0 movgr2fcsr FCSR, $t1 li.w $a0, 0 jr ...
src/fenv/loongarch64/fenv.S
null
null
null
null
null
source
musl
#include <fenv.h> #include <features.h> #if __HAVE_68881__ || __mcffpu__ static unsigned getsr() { unsigned v; __asm__ __volatile__ ("fmove.l %%fpsr,%0" : "=dm"(v)); return v; } static void setsr(unsigned v) { __asm__ __volatile__ ("fmove.l %0,%%fpsr" : : "dm"(v)); } static unsigned getcr() { unsigned v; __as...
src/fenv/m68k/fenv.c
null
null
null
null
null
source
musl
#ifndef __mips_soft_float .set noreorder .global feclearexcept .type feclearexcept,@function feclearexcept: and $4, $4, 0x7c cfc1 $5, $31 or $5, $5, $4 xor $5, $5, $4 ctc1 $5, $31 jr $ra li $2, 0 .global feraiseexcept .type feraiseexcept,@function feraiseexcept: and $4, $4,...
src/fenv/mips/fenv.S
null
null
null
null
null
source
musl
#ifndef __mips_soft_float .set noreorder .global feclearexcept .type feclearexcept,@function feclearexcept: and $4, $4, 0x7c cfc1 $5, $31 or $5, $5, $4 xor $5, $5, $4 ctc1 $5, $31 jr $ra li $2, 0 .global feraiseexcept .type feraiseexcept,@function feraiseexcept: and $4, $4, 0x7c cfc1 $5, $31 or $5, $5, $4 ...
src/fenv/mips64/fenv.S
null
null
null
null
null
source
musl
#if !defined(_SOFT_FLOAT) && !defined(__NO_FPRS__) .global feclearexcept .type feclearexcept,@function feclearexcept: andis. 3,3,0x3e00 /* if (r3 & FE_INVALID) r3 |= all_invalid_flags */ andis. 0,3,0x2000 stwu 1,-16(1) beq- 0,1f oris 3,3,0x01f8 ori 3,3,0x0700 1: /* * note: fpscr contains various fpu status a...
src/fenv/powerpc/fenv.S
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <fenv.h> #include <features.h> static inline double get_fpscr_f(void) { double d; __asm__ __volatile__("mffs %0" : "=d"(d)); return d; } static inline long get_fpscr(void) { return (union {double f; long i;}) {get_fpscr_f()}.i; } static inline void set_fpscr_f(double fpscr) { __asm_...
src/fenv/powerpc64/fenv.c
null
null
null
null
null
source
musl
#ifdef __riscv_flen .global feclearexcept .type feclearexcept, %function feclearexcept: csrc fflags, a0 li a0, 0 ret .global feraiseexcept .type feraiseexcept, %function feraiseexcept: csrs fflags, a0 li a0, 0 ret .global fetestexcept .type fetestexcept, %function fetestexcept: frflags t0 and a0, t0, a0 ret...
src/fenv/riscv32/fenv.S
null
null
null
null
null
source
musl
#include <fenv.h> #include <features.h> static inline unsigned get_fpc(void) { unsigned fpc; __asm__ __volatile__("efpc %0" : "=r"(fpc)); return fpc; } static inline void set_fpc(unsigned fpc) { __asm__ __volatile__("sfpc %0" :: "r"(fpc)); } int feclearexcept(int mask) { mask &= FE_ALL_EXCEPT; set_fpc(get_fpc(...
src/fenv/s390x/fenv.c
null
null
null
null
null
source
musl
#if __SH_FPU_ANY__ || __SH4__ .global fegetround .type fegetround, @function fegetround: sts fpscr, r0 rts and #3, r0 .global __fesetround .hidden __fesetround .type __fesetround, @function __fesetround: sts fpscr, r0 mov #-4, r1 and r1, r0 or r4, r0 lds r0, fpscr rts mov #0, r0 .global fetestexcept...
src/fenv/sh/fenv.S
null
null
null
null
null