authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-06-20 23:14:22-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-06-20 23:14:22-04:00
loge2eabbbc5142f11defc56ad51cd5b8a5e97cdbda
treecc1127bc0a31d50e35d6200c3824cdbbe83f8ebc
parent8875efe54873b721cc3a6f6d83525b19d1c59ec3
parent09c7f1bd7c4410948a984f2f155a6e36ff6279fd
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #16098 from ziglang/musl-v1.2.4

update musl from v1.2.3 to v1.2.4

241 files changed, 2889 insertions(+), 2526 deletions(-)

lib/libc/include/generic-musl/aio.h+1-1
...@@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *);...@@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *);
4949
50int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);50int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
5151
52#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)52#if defined(_LARGEFILE64_SOURCE)
53#define aiocb64 aiocb53#define aiocb64 aiocb
54#define aio_read64 aio_read54#define aio_read64 aio_read
55#define aio_write64 aio_write55#define aio_write64 aio_write
lib/libc/include/generic-musl/arpa/nameser.h+71
...@@ -188,6 +188,36 @@ typedef enum __ns_type {...@@ -188,6 +188,36 @@ typedef enum __ns_type {
188 ns_t_sink = 40,188 ns_t_sink = 40,
189 ns_t_opt = 41,189 ns_t_opt = 41,
190 ns_t_apl = 42,190 ns_t_apl = 42,
191 ns_t_ds = 43,
192 ns_t_sshfp = 44,
193 ns_t_ipseckey = 45,
194 ns_t_rrsig = 46,
195 ns_t_nsec = 47,
196 ns_t_dnskey = 48,
197 ns_t_dhcid = 49,
198 ns_t_nsec3 = 50,
199 ns_t_nsec3param = 51,
200 ns_t_tlsa = 52,
201 ns_t_smimea = 53,
202 ns_t_hip = 55,
203 ns_t_ninfo = 56,
204 ns_t_rkey = 57,
205 ns_t_talink = 58,
206 ns_t_cds = 59,
207 ns_t_cdnskey = 60,
208 ns_t_openpgpkey = 61,
209 ns_t_csync = 62,
210 ns_t_spf = 99,
211 ns_t_uinfo = 100,
212 ns_t_uid = 101,
213 ns_t_gid = 102,
214 ns_t_unspec = 103,
215 ns_t_nid = 104,
216 ns_t_l32 = 105,
217 ns_t_l64 = 106,
218 ns_t_lp = 107,
219 ns_t_eui48 = 108,
220 ns_t_eui64 = 109,
191 ns_t_tkey = 249,221 ns_t_tkey = 249,
192 ns_t_tsig = 250,222 ns_t_tsig = 250,
193 ns_t_ixfr = 251,223 ns_t_ixfr = 251,
...@@ -196,6 +226,11 @@ typedef enum __ns_type {...@@ -196,6 +226,11 @@ typedef enum __ns_type {
196 ns_t_maila = 254,226 ns_t_maila = 254,
197 ns_t_any = 255,227 ns_t_any = 255,
198 ns_t_zxfr = 256,228 ns_t_zxfr = 256,
229 ns_t_uri = 256,
230 ns_t_caa = 257,
231 ns_t_avc = 258,
232 ns_t_ta = 32768,
233 ns_t_dlv = 32769,
199 ns_t_max = 65536234 ns_t_max = 65536
200} ns_type;235} ns_type;
201236
...@@ -430,12 +465,48 @@ typedef struct {...@@ -430,12 +465,48 @@ typedef struct {
430#define T_NAPTR ns_t_naptr465#define T_NAPTR ns_t_naptr
431#define T_A6 ns_t_a6466#define T_A6 ns_t_a6
432#define T_DNAME ns_t_dname467#define T_DNAME ns_t_dname
468#define T_DS ns_t_ds
469#define T_SSHFP ns_t_sshfp
470#define T_IPSECKEY ns_t_ipseckey
471#define T_RRSIG ns_t_rrsig
472#define T_NSEC ns_t_nsec
473#define T_DNSKEY ns_t_dnskey
474#define T_DHCID ns_t_dhcid
475#define T_NSEC3 ns_t_nsec3
476#define T_NSEC3PARAM ns_t_nsec3param
477#define T_TLSA ns_t_tlsa
478#define T_SMIMEA ns_t_smimea
479#define T_HIP ns_t_hip
480#define T_NINFO ns_t_ninfo
481#define T_RKEY ns_t_rkey
482#define T_TALINK ns_t_talink
483#define T_CDS ns_t_cds
484#define T_CDNSKEY ns_t_cdnskey
485#define T_OPENPGPKEY ns_t_openpgpkey
486#define T_CSYNC ns_t_csync
487#define T_SPF ns_t_spf
488#define T_UINFO ns_t_uinfo
489#define T_UID ns_t_uid
490#define T_GID ns_t_gid
491#define T_UNSPEC ns_t_unspec
492#define T_NID ns_t_nid
493#define T_L32 ns_t_l32
494#define T_L64 ns_t_l64
495#define T_LP ns_t_lp
496#define T_EUI48 ns_t_eui48
497#define T_EUI64 ns_t_eui64
498#define T_TKEY ns_t_tkey
433#define T_TSIG ns_t_tsig499#define T_TSIG ns_t_tsig
434#define T_IXFR ns_t_ixfr500#define T_IXFR ns_t_ixfr
435#define T_AXFR ns_t_axfr501#define T_AXFR ns_t_axfr
436#define T_MAILB ns_t_mailb502#define T_MAILB ns_t_mailb
437#define T_MAILA ns_t_maila503#define T_MAILA ns_t_maila
438#define T_ANY ns_t_any504#define T_ANY ns_t_any
505#define T_URI ns_t_uri
506#define T_CAA ns_t_caa
507#define T_AVC ns_t_avc
508#define T_TA ns_t_ta
509#define T_DLV ns_t_dlv
439510
440#define C_IN ns_c_in511#define C_IN ns_c_in
441#define C_CHAOS ns_c_chaos512#define C_CHAOS ns_c_chaos
lib/libc/include/generic-musl/dirent.h+1-1
...@@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t);...@@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t);
56int versionsort(const struct dirent **, const struct dirent **);56int versionsort(const struct dirent **, const struct dirent **);
57#endif57#endif
5858
59#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)59#if defined(_LARGEFILE64_SOURCE)
60#define dirent64 dirent60#define dirent64 dirent
61#define readdir64 readdir61#define readdir64 readdir
62#define readdir64_r readdir_r62#define readdir64_r readdir_r
lib/libc/include/generic-musl/elf.h+7-2
...@@ -385,7 +385,8 @@ typedef struct {...@@ -385,7 +385,8 @@ typedef struct {
385#define SHT_PREINIT_ARRAY 16385#define SHT_PREINIT_ARRAY 16
386#define SHT_GROUP 17386#define SHT_GROUP 17
387#define SHT_SYMTAB_SHNDX 18387#define SHT_SYMTAB_SHNDX 18
388#define SHT_NUM 19388#define SHT_RELR 19
389#define SHT_NUM 20
389#define SHT_LOOS 0x60000000390#define SHT_LOOS 0x60000000
390#define SHT_GNU_ATTRIBUTES 0x6ffffff5391#define SHT_GNU_ATTRIBUTES 0x6ffffff5
391#define SHT_GNU_HASH 0x6ffffff6392#define SHT_GNU_HASH 0x6ffffff6
...@@ -436,6 +437,7 @@ typedef struct {...@@ -436,6 +437,7 @@ typedef struct {
436} Elf64_Chdr;437} Elf64_Chdr;
437438
438#define ELFCOMPRESS_ZLIB 1439#define ELFCOMPRESS_ZLIB 1
440#define ELFCOMPRESS_ZSTD 2
439#define ELFCOMPRESS_LOOS 0x60000000441#define ELFCOMPRESS_LOOS 0x60000000
440#define ELFCOMPRESS_HIOS 0x6fffffff442#define ELFCOMPRESS_HIOS 0x6fffffff
441#define ELFCOMPRESS_LOPROC 0x70000000443#define ELFCOMPRESS_LOPROC 0x70000000
...@@ -754,7 +756,10 @@ typedef struct {...@@ -754,7 +756,10 @@ typedef struct {
754#define DT_PREINIT_ARRAY 32756#define DT_PREINIT_ARRAY 32
755#define DT_PREINIT_ARRAYSZ 33757#define DT_PREINIT_ARRAYSZ 33
756#define DT_SYMTAB_SHNDX 34758#define DT_SYMTAB_SHNDX 34
757#define DT_NUM 35759#define DT_RELRSZ 35
760#define DT_RELR 36
761#define DT_RELRENT 37
762#define DT_NUM 38
758#define DT_LOOS 0x6000000d763#define DT_LOOS 0x6000000d
759#define DT_HIOS 0x6ffff000764#define DT_HIOS 0x6ffff000
760#define DT_LOPROC 0x70000000765#define DT_LOPROC 0x70000000
lib/libc/include/generic-musl/fcntl.h+1-1
...@@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned);...@@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned);
195#define loff_t off_t195#define loff_t off_t
196#endif196#endif
197197
198#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)198#if defined(_LARGEFILE64_SOURCE)
199#define F_GETLK64 F_GETLK199#define F_GETLK64 F_GETLK
200#define F_SETLK64 F_SETLK200#define F_SETLK64 F_SETLK
201#define F_SETLKW64 F_SETLKW201#define F_SETLKW64 F_SETLKW
lib/libc/include/generic-musl/ftw.h+1-1
...@@ -29,7 +29,7 @@ struct FTW {...@@ -29,7 +29,7 @@ struct FTW {
29int ftw(const char *, int (*)(const char *, const struct stat *, int), int);29int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
30int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);30int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
3131
32#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)32#if defined(_LARGEFILE64_SOURCE)
33#define ftw64 ftw33#define ftw64 ftw
34#define nftw64 nftw34#define nftw64 nftw
35#endif35#endif
lib/libc/include/generic-musl/glob.h+1-1
...@@ -39,7 +39,7 @@ void globfree(glob_t *);...@@ -39,7 +39,7 @@ void globfree(glob_t *);
39#define GLOB_NOMATCH 339#define GLOB_NOMATCH 3
40#define GLOB_NOSYS 440#define GLOB_NOSYS 4
4141
42#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)42#if defined(_LARGEFILE64_SOURCE)
43#define glob64 glob43#define glob64 glob
44#define globfree64 globfree44#define globfree64 globfree
45#define glob64_t glob_t45#define glob64_t glob_t
lib/libc/include/generic-musl/netdb.h+1
...@@ -44,6 +44,7 @@ struct addrinfo {...@@ -44,6 +44,7 @@ struct addrinfo {
44#define EAI_NONAME -244#define EAI_NONAME -2
45#define EAI_AGAIN -345#define EAI_AGAIN -3
46#define EAI_FAIL -446#define EAI_FAIL -4
47#define EAI_NODATA -5
47#define EAI_FAMILY -648#define EAI_FAMILY -6
48#define EAI_SOCKTYPE -749#define EAI_SOCKTYPE -7
49#define EAI_SERVICE -850#define EAI_SERVICE -8
lib/libc/include/generic-musl/sched.h+1-1
...@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)...@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)
124#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))124#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
125#define CPU_FREE(set) free(set)125#define CPU_FREE(set) free(set)
126126
127#define CPU_SETSIZE 128127#define CPU_SETSIZE 1024
128128
129#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)129#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
130#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)130#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
lib/libc/include/generic-musl/stdio.h+1-1
...@@ -205,7 +205,7 @@ typedef struct _IO_cookie_io_functions_t {...@@ -205,7 +205,7 @@ typedef struct _IO_cookie_io_functions_t {
205FILE *fopencookie(void *, const char *, cookie_io_functions_t);205FILE *fopencookie(void *, const char *, cookie_io_functions_t);
206#endif206#endif
207207
208#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)208#if defined(_LARGEFILE64_SOURCE)
209#define tmpfile64 tmpfile209#define tmpfile64 tmpfile
210#define fopen64 fopen210#define fopen64 fopen
211#define freopen64 freopen211#define freopen64 freopen
lib/libc/include/generic-musl/stdlib.h+2-2
...@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);...@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);
95#define WTERMSIG(s) ((s) & 0x7f)95#define WTERMSIG(s) ((s) & 0x7f)
96#define WSTOPSIG(s) WEXITSTATUS(s)96#define WSTOPSIG(s) WEXITSTATUS(s)
97#define WIFEXITED(s) (!WTERMSIG(s))97#define WIFEXITED(s) (!WTERMSIG(s))
98#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)98#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
99#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)99#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
100100
101int posix_memalign (void **, size_t, size_t);101int posix_memalign (void **, size_t, size_t);
...@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc...@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc
163long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);163long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
164#endif164#endif
165165
166#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)166#if defined(_LARGEFILE64_SOURCE)
167#define mkstemp64 mkstemp167#define mkstemp64 mkstemp
168#define mkostemp64 mkostemp168#define mkostemp64 mkostemp
169#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)169#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
lib/libc/include/generic-musl/string.h+1-1
...@@ -73,6 +73,7 @@ char *strsignal(int);...@@ -73,6 +73,7 @@ char *strsignal(int);
73char *strerror_l (int, locale_t);73char *strerror_l (int, locale_t);
74int strcoll_l (const char *, const char *, locale_t);74int strcoll_l (const char *, const char *, locale_t);
75size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);75size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
76void *memmem(const void *, size_t, const void *, size_t);
76#endif77#endif
7778
78#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \79#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
...@@ -92,7 +93,6 @@ void explicit_bzero (void *, size_t);...@@ -92,7 +93,6 @@ void explicit_bzero (void *, size_t);
92int strverscmp (const char *, const char *);93int strverscmp (const char *, const char *);
93char *strchrnul(const char *, int);94char *strchrnul(const char *, int);
94char *strcasestr(const char *, const char *);95char *strcasestr(const char *, const char *);
95void *memmem(const void *, size_t, const void *, size_t);
96void *memrchr(const void *, int, size_t);96void *memrchr(const void *, int, size_t);
97void *mempcpy(void *, const void *, size_t);97void *mempcpy(void *, const void *, size_t);
98#ifndef __cplusplus98#ifndef __cplusplus
lib/libc/include/generic-musl/strings.h+1
...@@ -5,6 +5,7 @@...@@ -5,6 +5,7 @@
5extern "C" {5extern "C" {
6#endif6#endif
77
8#include <features.h>
89
9#define __NEED_size_t10#define __NEED_size_t
10#define __NEED_locale_t11#define __NEED_locale_t
lib/libc/include/generic-musl/sys/mman.h+1-1
...@@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *);...@@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *);
141int shm_open (const char *, int, mode_t);141int shm_open (const char *, int, mode_t);
142int shm_unlink (const char *);142int shm_unlink (const char *);
143143
144#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)144#if defined(_LARGEFILE64_SOURCE)
145#define mmap64 mmap145#define mmap64 mmap
146#define off64_t off_t146#define off64_t off_t
147#endif147#endif
lib/libc/include/generic-musl/sys/resource.h+1-1
...@@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);...@@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
9595
96#define RLIM_NLIMITS RLIMIT_NLIMITS96#define RLIM_NLIMITS RLIMIT_NLIMITS
9797
98#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)98#if defined(_LARGEFILE64_SOURCE)
99#define RLIM64_INFINITY RLIM_INFINITY99#define RLIM64_INFINITY RLIM_INFINITY
100#define RLIM64_SAVED_CUR RLIM_SAVED_CUR100#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
101#define RLIM64_SAVED_MAX RLIM_SAVED_MAX101#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
lib/libc/include/generic-musl/sys/sendfile.h+1-1
...@@ -10,7 +10,7 @@ extern "C" {...@@ -10,7 +10,7 @@ extern "C" {
1010
11ssize_t sendfile(int, int, off_t *, size_t);11ssize_t sendfile(int, int, off_t *, size_t);
1212
13#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)13#if defined(_LARGEFILE64_SOURCE)
14#define sendfile64 sendfile14#define sendfile64 sendfile
15#define off64_t off_t15#define off64_t off_t
16#endif16#endif
lib/libc/include/generic-musl/sys/stat.h+1-1
...@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t);...@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t);
98#define S_IEXEC S_IXUSR98#define S_IEXEC S_IXUSR
99#endif99#endif
100100
101#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)101#if defined(_LARGEFILE64_SOURCE)
102#define stat64 stat102#define stat64 stat
103#define fstat64 fstat103#define fstat64 fstat
104#define lstat64 lstat104#define lstat64 lstat
lib/libc/include/generic-musl/sys/statfs.h+1-1
...@@ -18,7 +18,7 @@ typedef struct __fsid_t {...@@ -18,7 +18,7 @@ typedef struct __fsid_t {
18int statfs (const char *, struct statfs *);18int statfs (const char *, struct statfs *);
19int fstatfs (int, struct statfs *);19int fstatfs (int, struct statfs *);
2020
21#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)21#if defined(_LARGEFILE64_SOURCE)
22#define statfs64 statfs22#define statfs64 statfs
23#define fstatfs64 fstatfs23#define fstatfs64 fstatfs
24#define fsblkcnt64_t fsblkcnt_t24#define fsblkcnt64_t fsblkcnt_t
lib/libc/include/generic-musl/sys/statvfs.h+1-1
...@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *);...@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *);
42#define ST_NODIRATIME 204842#define ST_NODIRATIME 2048
43#define ST_RELATIME 409643#define ST_RELATIME 4096
4444
45#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)45#if defined(_LARGEFILE64_SOURCE)
46#define statvfs64 statvfs46#define statvfs64 statvfs
47#define fstatvfs64 fstatvfs47#define fstatvfs64 fstatvfs
48#define fsblkcnt64_t fsblkcnt_t48#define fsblkcnt64_t fsblkcnt_t
lib/libc/include/generic-musl/sys/types.h+1-1
...@@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t;...@@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t;
71#include <sys/select.h>71#include <sys/select.h>
72#endif72#endif
7373
74#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)74#if defined(_LARGEFILE64_SOURCE)
75#define blkcnt64_t blkcnt_t75#define blkcnt64_t blkcnt_t
76#define fsblkcnt64_t fsblkcnt_t76#define fsblkcnt64_t fsblkcnt_t
77#define fsfilcnt64_t fsfilcnt_t77#define fsfilcnt64_t fsfilcnt_t
lib/libc/include/generic-musl/sys/uio.h+1-1
...@@ -29,7 +29,7 @@ ssize_t writev (int, const struct iovec *, int);...@@ -29,7 +29,7 @@ ssize_t writev (int, const struct iovec *, int);
29#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)29#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
30ssize_t preadv (int, const struct iovec *, int, off_t);30ssize_t preadv (int, const struct iovec *, int, off_t);
31ssize_t pwritev (int, const struct iovec *, int, off_t);31ssize_t pwritev (int, const struct iovec *, int, off_t);
32#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)32#if defined(_LARGEFILE64_SOURCE)
33#define preadv64 preadv33#define preadv64 preadv
34#define pwritev64 pwritev34#define pwritev64 pwritev
35#define off64_t off_t35#define off64_t off_t
lib/libc/include/generic-musl/sys/wait.h+1-1
...@@ -50,7 +50,7 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);...@@ -50,7 +50,7 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);
50#define WSTOPSIG(s) WEXITSTATUS(s)50#define WSTOPSIG(s) WEXITSTATUS(s)
51#define WCOREDUMP(s) ((s) & 0x80)51#define WCOREDUMP(s) ((s) & 0x80)
52#define WIFEXITED(s) (!WTERMSIG(s))52#define WIFEXITED(s) (!WTERMSIG(s))
53#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)53#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
54#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)54#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
55#define WIFCONTINUED(s) ((s) == 0xffff)55#define WIFCONTINUED(s) ((s) == 0xffff)
5656
lib/libc/include/generic-musl/unistd.h+5-1
...@@ -198,7 +198,7 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);...@@ -198,7 +198,7 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
198pid_t gettid(void);198pid_t gettid(void);
199#endif199#endif
200200
201#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)201#if defined(_LARGEFILE64_SOURCE)
202#define lseek64 lseek202#define lseek64 lseek
203#define pread64 pread203#define pread64 pread
204#define pwrite64 pwrite204#define pwrite64 pwrite
...@@ -425,6 +425,8 @@ pid_t gettid(void);...@@ -425,6 +425,8 @@ pid_t gettid(void);
425#define _SC_XOPEN_STREAMS 246425#define _SC_XOPEN_STREAMS 246
426#define _SC_THREAD_ROBUST_PRIO_INHERIT 247426#define _SC_THREAD_ROBUST_PRIO_INHERIT 247
427#define _SC_THREAD_ROBUST_PRIO_PROTECT 248427#define _SC_THREAD_ROBUST_PRIO_PROTECT 248
428#define _SC_MINSIGSTKSZ 249
429#define _SC_SIGSTKSZ 250
428430
429#define _CS_PATH 0431#define _CS_PATH 0
430#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1432#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1
...@@ -467,6 +469,8 @@ pid_t gettid(void);...@@ -467,6 +469,8 @@ pid_t gettid(void);
467#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147469#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147
468#define _CS_V6_ENV 1148470#define _CS_V6_ENV 1148
469#define _CS_V7_ENV 1149471#define _CS_V7_ENV 1149
472#define _CS_POSIX_V7_THREADS_CFLAGS 1150
473#define _CS_POSIX_V7_THREADS_LDFLAGS 1151
470474
471#ifdef __cplusplus475#ifdef __cplusplus
472}476}
lib/libc/include/i386-linux-musl/bits/alltypes.h deleted-438
...@@ -1,438 +0,0 @@
1#define _REDIR_TIME64 1
2#define _Addr int
3#define _Int64 long long
4#define _Reg int
5
6#define __BYTE_ORDER 1234
7#define __LONG_MAX 0x7fffffffL
8
9#ifndef __cplusplus
10#ifdef __WCHAR_TYPE__
11#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
12typedef __WCHAR_TYPE__ wchar_t;
13#define __DEFINED_wchar_t
14#endif
15
16#else
17#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
18typedef long wchar_t;
19#define __DEFINED_wchar_t
20#endif
21
22#endif
23#endif
24
25#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
26#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
27typedef float float_t;
28#define __DEFINED_float_t
29#endif
30
31#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
32typedef double double_t;
33#define __DEFINED_double_t
34#endif
35
36#else
37#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
38typedef long double float_t;
39#define __DEFINED_float_t
40#endif
41
42#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
43typedef long double double_t;
44#define __DEFINED_double_t
45#endif
46
47#endif
48
49#if !defined(__cplusplus)
50#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
51typedef struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
52#define __DEFINED_max_align_t
53#endif
54
55#elif defined(__GNUC__)
56#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
57typedef struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t;
58#define __DEFINED_max_align_t
59#endif
60
61#else
62#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
63typedef struct { alignas(8) long long __ll; long double __ld; } max_align_t;
64#define __DEFINED_max_align_t
65#endif
66
67#endif
68#define __LITTLE_ENDIAN 1234
69#define __BIG_ENDIAN 4321
70#define __USE_TIME_BITS64 1
71
72#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
73typedef unsigned _Addr size_t;
74#define __DEFINED_size_t
75#endif
76
77#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
78typedef unsigned _Addr uintptr_t;
79#define __DEFINED_uintptr_t
80#endif
81
82#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
83typedef _Addr ptrdiff_t;
84#define __DEFINED_ptrdiff_t
85#endif
86
87#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
88typedef _Addr ssize_t;
89#define __DEFINED_ssize_t
90#endif
91
92#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
93typedef _Addr intptr_t;
94#define __DEFINED_intptr_t
95#endif
96
97#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
98typedef _Addr regoff_t;
99#define __DEFINED_regoff_t
100#endif
101
102#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
103typedef _Reg register_t;
104#define __DEFINED_register_t
105#endif
106
107#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
108typedef _Int64 time_t;
109#define __DEFINED_time_t
110#endif
111
112#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
113typedef _Int64 suseconds_t;
114#define __DEFINED_suseconds_t
115#endif
116
117
118#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
119typedef signed char int8_t;
120#define __DEFINED_int8_t
121#endif
122
123#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
124typedef signed short int16_t;
125#define __DEFINED_int16_t
126#endif
127
128#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
129typedef signed int int32_t;
130#define __DEFINED_int32_t
131#endif
132
133#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
134typedef signed _Int64 int64_t;
135#define __DEFINED_int64_t
136#endif
137
138#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
139typedef signed _Int64 intmax_t;
140#define __DEFINED_intmax_t
141#endif
142
143#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
144typedef unsigned char uint8_t;
145#define __DEFINED_uint8_t
146#endif
147
148#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
149typedef unsigned short uint16_t;
150#define __DEFINED_uint16_t
151#endif
152
153#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
154typedef unsigned int uint32_t;
155#define __DEFINED_uint32_t
156#endif
157
158#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
159typedef unsigned _Int64 uint64_t;
160#define __DEFINED_uint64_t
161#endif
162
163#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
164typedef unsigned _Int64 u_int64_t;
165#define __DEFINED_u_int64_t
166#endif
167
168#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
169typedef unsigned _Int64 uintmax_t;
170#define __DEFINED_uintmax_t
171#endif
172
173
174#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
175typedef unsigned mode_t;
176#define __DEFINED_mode_t
177#endif
178
179#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
180typedef unsigned _Reg nlink_t;
181#define __DEFINED_nlink_t
182#endif
183
184#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
185typedef _Int64 off_t;
186#define __DEFINED_off_t
187#endif
188
189#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
190typedef unsigned _Int64 ino_t;
191#define __DEFINED_ino_t
192#endif
193
194#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
195typedef unsigned _Int64 dev_t;
196#define __DEFINED_dev_t
197#endif
198
199#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
200typedef long blksize_t;
201#define __DEFINED_blksize_t
202#endif
203
204#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
205typedef _Int64 blkcnt_t;
206#define __DEFINED_blkcnt_t
207#endif
208
209#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
210typedef unsigned _Int64 fsblkcnt_t;
211#define __DEFINED_fsblkcnt_t
212#endif
213
214#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
215typedef unsigned _Int64 fsfilcnt_t;
216#define __DEFINED_fsfilcnt_t
217#endif
218
219
220#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
221typedef unsigned wint_t;
222#define __DEFINED_wint_t
223#endif
224
225#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
226typedef unsigned long wctype_t;
227#define __DEFINED_wctype_t
228#endif
229
230
231#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
232typedef void * timer_t;
233#define __DEFINED_timer_t
234#endif
235
236#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
237typedef int clockid_t;
238#define __DEFINED_clockid_t
239#endif
240
241#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
242typedef long clock_t;
243#define __DEFINED_clock_t
244#endif
245
246#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
247struct timeval { time_t tv_sec; suseconds_t tv_usec; };
248#define __DEFINED_struct_timeval
249#endif
250
251#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
252struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
253#define __DEFINED_struct_timespec
254#endif
255
256
257#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
258typedef int pid_t;
259#define __DEFINED_pid_t
260#endif
261
262#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
263typedef unsigned id_t;
264#define __DEFINED_id_t
265#endif
266
267#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
268typedef unsigned uid_t;
269#define __DEFINED_uid_t
270#endif
271
272#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
273typedef unsigned gid_t;
274#define __DEFINED_gid_t
275#endif
276
277#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
278typedef int key_t;
279#define __DEFINED_key_t
280#endif
281
282#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
283typedef unsigned useconds_t;
284#define __DEFINED_useconds_t
285#endif
286
287
288#ifdef __cplusplus
289#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
290typedef unsigned long pthread_t;
291#define __DEFINED_pthread_t
292#endif
293
294#else
295#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
296typedef struct __pthread * pthread_t;
297#define __DEFINED_pthread_t
298#endif
299
300#endif
301#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
302typedef int pthread_once_t;
303#define __DEFINED_pthread_once_t
304#endif
305
306#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
307typedef unsigned pthread_key_t;
308#define __DEFINED_pthread_key_t
309#endif
310
311#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
312typedef int pthread_spinlock_t;
313#define __DEFINED_pthread_spinlock_t
314#endif
315
316#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
317typedef struct { unsigned __attr; } pthread_mutexattr_t;
318#define __DEFINED_pthread_mutexattr_t
319#endif
320
321#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
322typedef struct { unsigned __attr; } pthread_condattr_t;
323#define __DEFINED_pthread_condattr_t
324#endif
325
326#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
327typedef struct { unsigned __attr; } pthread_barrierattr_t;
328#define __DEFINED_pthread_barrierattr_t
329#endif
330
331#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
332typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
333#define __DEFINED_pthread_rwlockattr_t
334#endif
335
336
337#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
338struct _IO_FILE { char __x; };
339#define __DEFINED_struct__IO_FILE
340#endif
341
342#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
343typedef struct _IO_FILE FILE;
344#define __DEFINED_FILE
345#endif
346
347
348#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
349typedef __builtin_va_list va_list;
350#define __DEFINED_va_list
351#endif
352
353#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
354typedef __builtin_va_list __isoc_va_list;
355#define __DEFINED___isoc_va_list
356#endif
357
358
359#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
360typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
361#define __DEFINED_mbstate_t
362#endif
363
364
365#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
366typedef struct __locale_struct * locale_t;
367#define __DEFINED_locale_t
368#endif
369
370
371#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
372typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
373#define __DEFINED_sigset_t
374#endif
375
376
377#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
378struct iovec { void *iov_base; size_t iov_len; };
379#define __DEFINED_struct_iovec
380#endif
381
382
383#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
384struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
385#define __DEFINED_struct_winsize
386#endif
387
388
389#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
390typedef unsigned socklen_t;
391#define __DEFINED_socklen_t
392#endif
393
394#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
395typedef unsigned short sa_family_t;
396#define __DEFINED_sa_family_t
397#endif
398
399
400#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
401typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
402#define __DEFINED_pthread_attr_t
403#endif
404
405#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
406typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
407#define __DEFINED_pthread_mutex_t
408#endif
409
410#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
411typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
412#define __DEFINED_mtx_t
413#endif
414
415#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
416typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
417#define __DEFINED_pthread_cond_t
418#endif
419
420#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
421typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
422#define __DEFINED_cnd_t
423#endif
424
425#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
426typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
427#define __DEFINED_pthread_rwlock_t
428#endif
429
430#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
431typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
432#define __DEFINED_pthread_barrier_t
433#endif
434
435
436#undef _Addr
437#undef _Int64
438#undef _Reg
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/fenv.h deleted-33
...@@ -1,33 +0,0 @@
1#define FE_INVALID 1
2#define __FE_DENORM 2
3#define FE_DIVBYZERO 4
4#define FE_OVERFLOW 8
5#define FE_UNDERFLOW 16
6#define FE_INEXACT 32
7
8#define FE_ALL_EXCEPT 63
9
10#define FE_TONEAREST 0
11#define FE_DOWNWARD 0x400
12#define FE_UPWARD 0x800
13#define FE_TOWARDZERO 0xc00
14
15typedef unsigned short fexcept_t;
16
17typedef struct {
18 unsigned short __control_word;
19 unsigned short __unused1;
20 unsigned short __status_word;
21 unsigned short __unused2;
22 unsigned short __tags;
23 unsigned short __unused3;
24 unsigned int __eip;
25 unsigned short __cs_selector;
26 unsigned int __opcode:11;
27 unsigned int __unused4:5;
28 unsigned int __data_offset;
29 unsigned short __data_selector;
30 unsigned short __unused5;
31} fenv_t;
32
33#define FE_DFL_ENV ((const fenv_t *) -1)
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/float.h deleted-20
...@@ -1,20 +0,0 @@
1#ifdef __FLT_EVAL_METHOD__
2#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
3#else
4#define FLT_EVAL_METHOD 2
5#endif
6
7#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
8#define LDBL_MIN 3.3621031431120935063e-4932L
9#define LDBL_MAX 1.1897314953572317650e+4932L
10#define LDBL_EPSILON 1.0842021724855044340e-19L
11
12#define LDBL_MANT_DIG 64
13#define LDBL_MIN_EXP (-16381)
14#define LDBL_MAX_EXP 16384
15
16#define LDBL_DIG 18
17#define LDBL_MIN_10_EXP (-4931)
18#define LDBL_MAX_10_EXP 4932
19
20#define DECIMAL_DIG 21
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/io.h deleted-77
...@@ -1,77 +0,0 @@
1static __inline void outb(unsigned char __val, unsigned short __port)
2{
3 __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
4}
5
6static __inline void outw(unsigned short __val, unsigned short __port)
7{
8 __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
9}
10
11static __inline void outl(unsigned int __val, unsigned short __port)
12{
13 __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
14}
15
16static __inline unsigned char inb(unsigned short __port)
17{
18 unsigned char __val;
19 __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
20 return __val;
21}
22
23static __inline unsigned short inw(unsigned short __port)
24{
25 unsigned short __val;
26 __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
27 return __val;
28}
29
30static __inline unsigned int inl(unsigned short __port)
31{
32 unsigned int __val;
33 __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
34 return __val;
35}
36
37static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
38{
39 __asm__ volatile ("cld; rep; outsb"
40 : "+S" (__buf), "+c" (__n)
41 : "d" (__port));
42}
43
44static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
45{
46 __asm__ volatile ("cld; rep; outsw"
47 : "+S" (__buf), "+c" (__n)
48 : "d" (__port));
49}
50
51static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
52{
53 __asm__ volatile ("cld; rep; outsl"
54 : "+S" (__buf), "+c"(__n)
55 : "d" (__port));
56}
57
58static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
59{
60 __asm__ volatile ("cld; rep; insb"
61 : "+D" (__buf), "+c" (__n)
62 : "d" (__port));
63}
64
65static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
66{
67 __asm__ volatile ("cld; rep; insw"
68 : "+D" (__buf), "+c" (__n)
69 : "d" (__port));
70}
71
72static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
73{
74 __asm__ volatile ("cld; rep; insl"
75 : "+D" (__buf), "+c" (__n)
76 : "d" (__port));
77}
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/ipcstat.h deleted-1
...@@ -1 +0,0 @@
1#define IPC_STAT 0x102
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/limits.h deleted-1
...@@ -1 +0,0 @@
1#define PAGESIZE 4096
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/mman.h deleted-1
...@@ -1 +0,0 @@
1#define MAP_32BIT 0x40
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/msg.h deleted-18
...@@ -1,18 +0,0 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 unsigned long __msg_stime_lo;
4 unsigned long __msg_stime_hi;
5 unsigned long __msg_rtime_lo;
6 unsigned long __msg_rtime_hi;
7 unsigned long __msg_ctime_lo;
8 unsigned long __msg_ctime_hi;
9 unsigned long msg_cbytes;
10 msgqnum_t msg_qnum;
11 msglen_t msg_qbytes;
12 pid_t msg_lspid;
13 pid_t msg_lrpid;
14 unsigned long __unused[2];
15 time_t msg_stime;
16 time_t msg_rtime;
17 time_t msg_ctime;
18};
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/ptrace.h deleted-11
...@@ -1,11 +0,0 @@
1#define PTRACE_GET_THREAD_AREA 25
2#define PTRACE_SET_THREAD_AREA 26
3#define PTRACE_SYSEMU 31
4#define PTRACE_SYSEMU_SINGLESTEP 32
5#define PTRACE_SINGLEBLOCK 33
6
7#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
8#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
9#define PT_SYSEMU PTRACE_SYSEMU
10#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
11#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/reg.h deleted-19
...@@ -1,19 +0,0 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3#define EBX 0
4#define ECX 1
5#define EDX 2
6#define ESI 3
7#define EDI 4
8#define EBP 5
9#define EAX 6
10#define DS 7
11#define ES 8
12#define FS 9
13#define GS 10
14#define ORIG_EAX 11
15#define EIP 12
16#define CS 13
17#define EFL 14
18#define UESP 15
19#define SS 16
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/sem.h deleted-13
...@@ -1,13 +0,0 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 unsigned long __sem_otime_lo;
4 unsigned long __sem_otime_hi;
5 unsigned long __sem_ctime_lo;
6 unsigned long __sem_ctime_hi;
7 unsigned short sem_nsems;
8 char __sem_nsems_pad[sizeof(long)-sizeof(short)];
9 long __unused3;
10 long __unused4;
11 time_t sem_otime;
12 time_t sem_ctime;
13};
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/setjmp.h deleted-1
...@@ -1 +0,0 @@
1typedef unsigned long __jmp_buf[6];
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/shm.h deleted-31
...@@ -1,31 +0,0 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 unsigned long __shm_atime_lo;
7 unsigned long __shm_atime_hi;
8 unsigned long __shm_dtime_lo;
9 unsigned long __shm_dtime_hi;
10 unsigned long __shm_ctime_lo;
11 unsigned long __shm_ctime_hi;
12 pid_t shm_cpid;
13 pid_t shm_lpid;
14 unsigned long shm_nattch;
15 unsigned long __pad1;
16 unsigned long __pad2;
17 unsigned long __pad3;
18 time_t shm_atime;
19 time_t shm_dtime;
20 time_t shm_ctime;
21};
22
23struct shminfo {
24 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
25};
26
27struct shm_info {
28 int __used_ids;
29 unsigned long shm_tot, shm_rss, shm_swp;
30 unsigned long __swap_attempts, __swap_successes;
31};
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/signal.h deleted-141
...@@ -1,141 +0,0 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#ifdef _GNU_SOURCE
10enum { REG_GS = 0 };
11#define REG_GS REG_GS
12enum { REG_FS = 1 };
13#define REG_FS REG_FS
14enum { REG_ES = 2 };
15#define REG_ES REG_ES
16enum { REG_DS = 3 };
17#define REG_DS REG_DS
18enum { REG_EDI = 4 };
19#define REG_EDI REG_EDI
20enum { REG_ESI = 5 };
21#define REG_ESI REG_ESI
22enum { REG_EBP = 6 };
23#define REG_EBP REG_EBP
24enum { REG_ESP = 7 };
25#define REG_ESP REG_ESP
26enum { REG_EBX = 8 };
27#define REG_EBX REG_EBX
28enum { REG_EDX = 9 };
29#define REG_EDX REG_EDX
30enum { REG_ECX = 10 };
31#define REG_ECX REG_ECX
32enum { REG_EAX = 11 };
33#define REG_EAX REG_EAX
34enum { REG_TRAPNO = 12 };
35#define REG_TRAPNO REG_TRAPNO
36enum { REG_ERR = 13 };
37#define REG_ERR REG_ERR
38enum { REG_EIP = 14 };
39#define REG_EIP REG_EIP
40enum { REG_CS = 15 };
41#define REG_CS REG_CS
42enum { REG_EFL = 16 };
43#define REG_EFL REG_EFL
44enum { REG_UESP = 17 };
45#define REG_UESP REG_UESP
46enum { REG_SS = 18 };
47#define REG_SS REG_SS
48#endif
49
50#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
51typedef int greg_t, gregset_t[19];
52typedef struct _fpstate {
53 unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel;
54 struct {
55 unsigned short significand[4], exponent;
56 } _st[8];
57 unsigned long status;
58} *fpregset_t;
59struct sigcontext {
60 unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
61 unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
62 unsigned long trapno, err, eip;
63 unsigned short cs, __csh;
64 unsigned long eflags, esp_at_signal;
65 unsigned short ss, __ssh;
66 struct _fpstate *fpstate;
67 unsigned long oldmask, cr2;
68};
69typedef struct {
70 gregset_t gregs;
71 fpregset_t fpregs;
72 unsigned long oldmask, cr2;
73} mcontext_t;
74#else
75typedef struct {
76 unsigned __space[22];
77} mcontext_t;
78#endif
79
80struct sigaltstack {
81 void *ss_sp;
82 int ss_flags;
83 size_t ss_size;
84};
85
86typedef struct __ucontext {
87 unsigned long uc_flags;
88 struct __ucontext *uc_link;
89 stack_t uc_stack;
90 mcontext_t uc_mcontext;
91 sigset_t uc_sigmask;
92 unsigned long __fpregs_mem[28];
93} ucontext_t;
94
95#define SA_NOCLDSTOP 1
96#define SA_NOCLDWAIT 2
97#define SA_SIGINFO 4
98#define SA_ONSTACK 0x08000000
99#define SA_RESTART 0x10000000
100#define SA_NODEFER 0x40000000
101#define SA_RESETHAND 0x80000000
102#define SA_RESTORER 0x04000000
103
104#endif
105
106#define SIGHUP 1
107#define SIGINT 2
108#define SIGQUIT 3
109#define SIGILL 4
110#define SIGTRAP 5
111#define SIGABRT 6
112#define SIGIOT SIGABRT
113#define SIGBUS 7
114#define SIGFPE 8
115#define SIGKILL 9
116#define SIGUSR1 10
117#define SIGSEGV 11
118#define SIGUSR2 12
119#define SIGPIPE 13
120#define SIGALRM 14
121#define SIGTERM 15
122#define SIGSTKFLT 16
123#define SIGCHLD 17
124#define SIGCONT 18
125#define SIGSTOP 19
126#define SIGTSTP 20
127#define SIGTTIN 21
128#define SIGTTOU 22
129#define SIGURG 23
130#define SIGXCPU 24
131#define SIGXFSZ 25
132#define SIGVTALRM 26
133#define SIGPROF 27
134#define SIGWINCH 28
135#define SIGIO 29
136#define SIGPOLL 29
137#define SIGPWR 30
138#define SIGSYS 31
139#define SIGUNUSED SIGSYS
140
141#define _NSIG 65
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/stat.h deleted-25
...@@ -1,25 +0,0 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 int __st_dev_padding;
7 long __st_ino_truncated;
8 mode_t st_mode;
9 nlink_t st_nlink;
10 uid_t st_uid;
11 gid_t st_gid;
12 dev_t st_rdev;
13 int __st_rdev_padding;
14 off_t st_size;
15 blksize_t st_blksize;
16 blkcnt_t st_blocks;
17 struct {
18 long tv_sec;
19 long tv_nsec;
20 } __st_atim32, __st_mtim32, __st_ctim32;
21 ino_t st_ino;
22 struct timespec st_atim;
23 struct timespec st_mtim;
24 struct timespec st_ctim;
25};
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/stdint.h deleted-20
...@@ -1,20 +0,0 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/syscall.h deleted-875
...@@ -1,875 +0,0 @@
1#define __NR_restart_syscall 0
2#define __NR_exit 1
3#define __NR_fork 2
4#define __NR_read 3
5#define __NR_write 4
6#define __NR_open 5
7#define __NR_close 6
8#define __NR_waitpid 7
9#define __NR_creat 8
10#define __NR_link 9
11#define __NR_unlink 10
12#define __NR_execve 11
13#define __NR_chdir 12
14#define __NR_time 13
15#define __NR_mknod 14
16#define __NR_chmod 15
17#define __NR_lchown 16
18#define __NR_break 17
19#define __NR_oldstat 18
20#define __NR_lseek 19
21#define __NR_getpid 20
22#define __NR_mount 21
23#define __NR_umount 22
24#define __NR_setuid 23
25#define __NR_getuid 24
26#define __NR_stime 25
27#define __NR_ptrace 26
28#define __NR_alarm 27
29#define __NR_oldfstat 28
30#define __NR_pause 29
31#define __NR_utime 30
32#define __NR_stty 31
33#define __NR_gtty 32
34#define __NR_access 33
35#define __NR_nice 34
36#define __NR_ftime 35
37#define __NR_sync 36
38#define __NR_kill 37
39#define __NR_rename 38
40#define __NR_mkdir 39
41#define __NR_rmdir 40
42#define __NR_dup 41
43#define __NR_pipe 42
44#define __NR_times 43
45#define __NR_prof 44
46#define __NR_brk 45
47#define __NR_setgid 46
48#define __NR_getgid 47
49#define __NR_signal 48
50#define __NR_geteuid 49
51#define __NR_getegid 50
52#define __NR_acct 51
53#define __NR_umount2 52
54#define __NR_lock 53
55#define __NR_ioctl 54
56#define __NR_fcntl 55
57#define __NR_mpx 56
58#define __NR_setpgid 57
59#define __NR_ulimit 58
60#define __NR_oldolduname 59
61#define __NR_umask 60
62#define __NR_chroot 61
63#define __NR_ustat 62
64#define __NR_dup2 63
65#define __NR_getppid 64
66#define __NR_getpgrp 65
67#define __NR_setsid 66
68#define __NR_sigaction 67
69#define __NR_sgetmask 68
70#define __NR_ssetmask 69
71#define __NR_setreuid 70
72#define __NR_setregid 71
73#define __NR_sigsuspend 72
74#define __NR_sigpending 73
75#define __NR_sethostname 74
76#define __NR_setrlimit 75
77#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
78#define __NR_getrusage 77
79#define __NR_gettimeofday_time32 78
80#define __NR_settimeofday_time32 79
81#define __NR_getgroups 80
82#define __NR_setgroups 81
83#define __NR_select 82
84#define __NR_symlink 83
85#define __NR_oldlstat 84
86#define __NR_readlink 85
87#define __NR_uselib 86
88#define __NR_swapon 87
89#define __NR_reboot 88
90#define __NR_readdir 89
91#define __NR_mmap 90
92#define __NR_munmap 91
93#define __NR_truncate 92
94#define __NR_ftruncate 93
95#define __NR_fchmod 94
96#define __NR_fchown 95
97#define __NR_getpriority 96
98#define __NR_setpriority 97
99#define __NR_profil 98
100#define __NR_statfs 99
101#define __NR_fstatfs 100
102#define __NR_ioperm 101
103#define __NR_socketcall 102
104#define __NR_syslog 103
105#define __NR_setitimer 104
106#define __NR_getitimer 105
107#define __NR_stat 106
108#define __NR_lstat 107
109#define __NR_fstat 108
110#define __NR_olduname 109
111#define __NR_iopl 110
112#define __NR_vhangup 111
113#define __NR_idle 112
114#define __NR_vm86old 113
115#define __NR_wait4 114
116#define __NR_swapoff 115
117#define __NR_sysinfo 116
118#define __NR_ipc 117
119#define __NR_fsync 118
120#define __NR_sigreturn 119
121#define __NR_clone 120
122#define __NR_setdomainname 121
123#define __NR_uname 122
124#define __NR_modify_ldt 123
125#define __NR_adjtimex 124
126#define __NR_mprotect 125
127#define __NR_sigprocmask 126
128#define __NR_create_module 127
129#define __NR_init_module 128
130#define __NR_delete_module 129
131#define __NR_get_kernel_syms 130
132#define __NR_quotactl 131
133#define __NR_getpgid 132
134#define __NR_fchdir 133
135#define __NR_bdflush 134
136#define __NR_sysfs 135
137#define __NR_personality 136
138#define __NR_afs_syscall 137
139#define __NR_setfsuid 138
140#define __NR_setfsgid 139
141#define __NR__llseek 140
142#define __NR_getdents 141
143#define __NR__newselect 142
144#define __NR_flock 143
145#define __NR_msync 144
146#define __NR_readv 145
147#define __NR_writev 146
148#define __NR_getsid 147
149#define __NR_fdatasync 148
150#define __NR__sysctl 149
151#define __NR_mlock 150
152#define __NR_munlock 151
153#define __NR_mlockall 152
154#define __NR_munlockall 153
155#define __NR_sched_setparam 154
156#define __NR_sched_getparam 155
157#define __NR_sched_setscheduler 156
158#define __NR_sched_getscheduler 157
159#define __NR_sched_yield 158
160#define __NR_sched_get_priority_max 159
161#define __NR_sched_get_priority_min 160
162#define __NR_sched_rr_get_interval 161
163#define __NR_nanosleep 162
164#define __NR_mremap 163
165#define __NR_setresuid 164
166#define __NR_getresuid 165
167#define __NR_vm86 166
168#define __NR_query_module 167
169#define __NR_poll 168
170#define __NR_nfsservctl 169
171#define __NR_setresgid 170
172#define __NR_getresgid 171
173#define __NR_prctl 172
174#define __NR_rt_sigreturn 173
175#define __NR_rt_sigaction 174
176#define __NR_rt_sigprocmask 175
177#define __NR_rt_sigpending 176
178#define __NR_rt_sigtimedwait 177
179#define __NR_rt_sigqueueinfo 178
180#define __NR_rt_sigsuspend 179
181#define __NR_pread64 180
182#define __NR_pwrite64 181
183#define __NR_chown 182
184#define __NR_getcwd 183
185#define __NR_capget 184
186#define __NR_capset 185
187#define __NR_sigaltstack 186
188#define __NR_sendfile 187
189#define __NR_getpmsg 188
190#define __NR_putpmsg 189
191#define __NR_vfork 190
192#define __NR_ugetrlimit 191
193#define __NR_mmap2 192
194#define __NR_truncate64 193
195#define __NR_ftruncate64 194
196#define __NR_stat64 195
197#define __NR_lstat64 196
198#define __NR_fstat64 197
199#define __NR_lchown32 198
200#define __NR_getuid32 199
201#define __NR_getgid32 200
202#define __NR_geteuid32 201
203#define __NR_getegid32 202
204#define __NR_setreuid32 203
205#define __NR_setregid32 204
206#define __NR_getgroups32 205
207#define __NR_setgroups32 206
208#define __NR_fchown32 207
209#define __NR_setresuid32 208
210#define __NR_getresuid32 209
211#define __NR_setresgid32 210
212#define __NR_getresgid32 211
213#define __NR_chown32 212
214#define __NR_setuid32 213
215#define __NR_setgid32 214
216#define __NR_setfsuid32 215
217#define __NR_setfsgid32 216
218#define __NR_pivot_root 217
219#define __NR_mincore 218
220#define __NR_madvise 219
221#define __NR_getdents64 220
222#define __NR_fcntl64 221
223/* 223 is unused */
224#define __NR_gettid 224
225#define __NR_readahead 225
226#define __NR_setxattr 226
227#define __NR_lsetxattr 227
228#define __NR_fsetxattr 228
229#define __NR_getxattr 229
230#define __NR_lgetxattr 230
231#define __NR_fgetxattr 231
232#define __NR_listxattr 232
233#define __NR_llistxattr 233
234#define __NR_flistxattr 234
235#define __NR_removexattr 235
236#define __NR_lremovexattr 236
237#define __NR_fremovexattr 237
238#define __NR_tkill 238
239#define __NR_sendfile64 239
240#define __NR_futex 240
241#define __NR_sched_setaffinity 241
242#define __NR_sched_getaffinity 242
243#define __NR_set_thread_area 243
244#define __NR_get_thread_area 244
245#define __NR_io_setup 245
246#define __NR_io_destroy 246
247#define __NR_io_getevents 247
248#define __NR_io_submit 248
249#define __NR_io_cancel 249
250#define __NR_fadvise64 250
251/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
252#define __NR_exit_group 252
253#define __NR_lookup_dcookie 253
254#define __NR_epoll_create 254
255#define __NR_epoll_ctl 255
256#define __NR_epoll_wait 256
257#define __NR_remap_file_pages 257
258#define __NR_set_tid_address 258
259#define __NR_timer_create 259
260#define __NR_timer_settime32 (__NR_timer_create+1)
261#define __NR_timer_gettime32 (__NR_timer_create+2)
262#define __NR_timer_getoverrun (__NR_timer_create+3)
263#define __NR_timer_delete (__NR_timer_create+4)
264#define __NR_clock_settime32 (__NR_timer_create+5)
265#define __NR_clock_gettime32 (__NR_timer_create+6)
266#define __NR_clock_getres_time32 (__NR_timer_create+7)
267#define __NR_clock_nanosleep_time32 (__NR_timer_create+8)
268#define __NR_statfs64 268
269#define __NR_fstatfs64 269
270#define __NR_tgkill 270
271#define __NR_utimes 271
272#define __NR_fadvise64_64 272
273#define __NR_vserver 273
274#define __NR_mbind 274
275#define __NR_get_mempolicy 275
276#define __NR_set_mempolicy 276
277#define __NR_mq_open 277
278#define __NR_mq_unlink (__NR_mq_open+1)
279#define __NR_mq_timedsend (__NR_mq_open+2)
280#define __NR_mq_timedreceive (__NR_mq_open+3)
281#define __NR_mq_notify (__NR_mq_open+4)
282#define __NR_mq_getsetattr (__NR_mq_open+5)
283#define __NR_kexec_load 283
284#define __NR_waitid 284
285/* #define __NR_sys_setaltroot 285 */
286#define __NR_add_key 286
287#define __NR_request_key 287
288#define __NR_keyctl 288
289#define __NR_ioprio_set 289
290#define __NR_ioprio_get 290
291#define __NR_inotify_init 291
292#define __NR_inotify_add_watch 292
293#define __NR_inotify_rm_watch 293
294#define __NR_migrate_pages 294
295#define __NR_openat 295
296#define __NR_mkdirat 296
297#define __NR_mknodat 297
298#define __NR_fchownat 298
299#define __NR_futimesat 299
300#define __NR_fstatat64 300
301#define __NR_unlinkat 301
302#define __NR_renameat 302
303#define __NR_linkat 303
304#define __NR_symlinkat 304
305#define __NR_readlinkat 305
306#define __NR_fchmodat 306
307#define __NR_faccessat 307
308#define __NR_pselect6 308
309#define __NR_ppoll 309
310#define __NR_unshare 310
311#define __NR_set_robust_list 311
312#define __NR_get_robust_list 312
313#define __NR_splice 313
314#define __NR_sync_file_range 314
315#define __NR_tee 315
316#define __NR_vmsplice 316
317#define __NR_move_pages 317
318#define __NR_getcpu 318
319#define __NR_epoll_pwait 319
320#define __NR_utimensat 320
321#define __NR_signalfd 321
322#define __NR_timerfd_create 322
323#define __NR_eventfd 323
324#define __NR_fallocate 324
325#define __NR_timerfd_settime32 325
326#define __NR_timerfd_gettime32 326
327#define __NR_signalfd4 327
328#define __NR_eventfd2 328
329#define __NR_epoll_create1 329
330#define __NR_dup3 330
331#define __NR_pipe2 331
332#define __NR_inotify_init1 332
333#define __NR_preadv 333
334#define __NR_pwritev 334
335#define __NR_rt_tgsigqueueinfo 335
336#define __NR_perf_event_open 336
337#define __NR_recvmmsg 337
338#define __NR_fanotify_init 338
339#define __NR_fanotify_mark 339
340#define __NR_prlimit64 340
341#define __NR_name_to_handle_at 341
342#define __NR_open_by_handle_at 342
343#define __NR_clock_adjtime 343
344#define __NR_syncfs 344
345#define __NR_sendmmsg 345
346#define __NR_setns 346
347#define __NR_process_vm_readv 347
348#define __NR_process_vm_writev 348
349#define __NR_kcmp 349
350#define __NR_finit_module 350
351#define __NR_sched_setattr 351
352#define __NR_sched_getattr 352
353#define __NR_renameat2 353
354#define __NR_seccomp 354
355#define __NR_getrandom 355
356#define __NR_memfd_create 356
357#define __NR_bpf 357
358#define __NR_execveat 358
359#define __NR_socket 359
360#define __NR_socketpair 360
361#define __NR_bind 361
362#define __NR_connect 362
363#define __NR_listen 363
364#define __NR_accept4 364
365#define __NR_getsockopt 365
366#define __NR_setsockopt 366
367#define __NR_getsockname 367
368#define __NR_getpeername 368
369#define __NR_sendto 369
370#define __NR_sendmsg 370
371#define __NR_recvfrom 371
372#define __NR_recvmsg 372
373#define __NR_shutdown 373
374#define __NR_userfaultfd 374
375#define __NR_membarrier 375
376#define __NR_mlock2 376
377#define __NR_copy_file_range 377
378#define __NR_preadv2 378
379#define __NR_pwritev2 379
380#define __NR_pkey_mprotect 380
381#define __NR_pkey_alloc 381
382#define __NR_pkey_free 382
383#define __NR_statx 383
384#define __NR_arch_prctl 384
385#define __NR_io_pgetevents 385
386#define __NR_rseq 386
387#define __NR_semget 393
388#define __NR_semctl 394
389#define __NR_shmget 395
390#define __NR_shmctl 396
391#define __NR_shmat 397
392#define __NR_shmdt 398
393#define __NR_msgget 399
394#define __NR_msgsnd 400
395#define __NR_msgrcv 401
396#define __NR_msgctl 402
397#define __NR_clock_gettime64 403
398#define __NR_clock_settime64 404
399#define __NR_clock_adjtime64 405
400#define __NR_clock_getres_time64 406
401#define __NR_clock_nanosleep_time64 407
402#define __NR_timer_gettime64 408
403#define __NR_timer_settime64 409
404#define __NR_timerfd_gettime64 410
405#define __NR_timerfd_settime64 411
406#define __NR_utimensat_time64 412
407#define __NR_pselect6_time64 413
408#define __NR_ppoll_time64 414
409#define __NR_io_pgetevents_time64 416
410#define __NR_recvmmsg_time64 417
411#define __NR_mq_timedsend_time64 418
412#define __NR_mq_timedreceive_time64 419
413#define __NR_semtimedop_time64 420
414#define __NR_rt_sigtimedwait_time64 421
415#define __NR_futex_time64 422
416#define __NR_sched_rr_get_interval_time64 423
417#define __NR_pidfd_send_signal 424
418#define __NR_io_uring_setup 425
419#define __NR_io_uring_enter 426
420#define __NR_io_uring_register 427
421#define __NR_open_tree 428
422#define __NR_move_mount 429
423#define __NR_fsopen 430
424#define __NR_fsconfig 431
425#define __NR_fsmount 432
426#define __NR_fspick 433
427#define __NR_pidfd_open 434
428#define __NR_clone3 435
429#define __NR_close_range 436
430#define __NR_openat2 437
431#define __NR_pidfd_getfd 438
432#define __NR_faccessat2 439
433#define __NR_process_madvise 440
434#define __NR_epoll_pwait2 441
435#define __NR_mount_setattr 442
436#define __NR_landlock_create_ruleset 444
437#define __NR_landlock_add_rule 445
438#define __NR_landlock_restrict_self 446
439
440#define SYS_restart_syscall 0
441#define SYS_exit 1
442#define SYS_fork 2
443#define SYS_read 3
444#define SYS_write 4
445#define SYS_open 5
446#define SYS_close 6
447#define SYS_waitpid 7
448#define SYS_creat 8
449#define SYS_link 9
450#define SYS_unlink 10
451#define SYS_execve 11
452#define SYS_chdir 12
453#define SYS_time 13
454#define SYS_mknod 14
455#define SYS_chmod 15
456#define SYS_lchown 16
457#define SYS_break 17
458#define SYS_oldstat 18
459#define SYS_lseek 19
460#define SYS_getpid 20
461#define SYS_mount 21
462#define SYS_umount 22
463#define SYS_setuid 23
464#define SYS_getuid 24
465#define SYS_stime 25
466#define SYS_ptrace 26
467#define SYS_alarm 27
468#define SYS_oldfstat 28
469#define SYS_pause 29
470#define SYS_utime 30
471#define SYS_stty 31
472#define SYS_gtty 32
473#define SYS_access 33
474#define SYS_nice 34
475#define SYS_ftime 35
476#define SYS_sync 36
477#define SYS_kill 37
478#define SYS_rename 38
479#define SYS_mkdir 39
480#define SYS_rmdir 40
481#define SYS_dup 41
482#define SYS_pipe 42
483#define SYS_times 43
484#define SYS_prof 44
485#define SYS_brk 45
486#define SYS_setgid 46
487#define SYS_getgid 47
488#define SYS_signal 48
489#define SYS_geteuid 49
490#define SYS_getegid 50
491#define SYS_acct 51
492#define SYS_umount2 52
493#define SYS_lock 53
494#define SYS_ioctl 54
495#define SYS_fcntl 55
496#define SYS_mpx 56
497#define SYS_setpgid 57
498#define SYS_ulimit 58
499#define SYS_oldolduname 59
500#define SYS_umask 60
501#define SYS_chroot 61
502#define SYS_ustat 62
503#define SYS_dup2 63
504#define SYS_getppid 64
505#define SYS_getpgrp 65
506#define SYS_setsid 66
507#define SYS_sigaction 67
508#define SYS_sgetmask 68
509#define SYS_ssetmask 69
510#define SYS_setreuid 70
511#define SYS_setregid 71
512#define SYS_sigsuspend 72
513#define SYS_sigpending 73
514#define SYS_sethostname 74
515#define SYS_setrlimit 75
516#define SYS_getrlimit 76 /* Back compatible 2Gig limited rlimit */
517#define SYS_getrusage 77
518#define SYS_gettimeofday_time32 78
519#define SYS_settimeofday_time32 79
520#define SYS_getgroups 80
521#define SYS_setgroups 81
522#define SYS_select 82
523#define SYS_symlink 83
524#define SYS_oldlstat 84
525#define SYS_readlink 85
526#define SYS_uselib 86
527#define SYS_swapon 87
528#define SYS_reboot 88
529#define SYS_readdir 89
530#define SYS_mmap 90
531#define SYS_munmap 91
532#define SYS_truncate 92
533#define SYS_ftruncate 93
534#define SYS_fchmod 94
535#define SYS_fchown 95
536#define SYS_getpriority 96
537#define SYS_setpriority 97
538#define SYS_profil 98
539#define SYS_statfs 99
540#define SYS_fstatfs 100
541#define SYS_ioperm 101
542#define SYS_socketcall 102
543#define SYS_syslog 103
544#define SYS_setitimer 104
545#define SYS_getitimer 105
546#define SYS_stat 106
547#define SYS_lstat 107
548#define SYS_fstat 108
549#define SYS_olduname 109
550#define SYS_iopl 110
551#define SYS_vhangup 111
552#define SYS_idle 112
553#define SYS_vm86old 113
554#define SYS_wait4 114
555#define SYS_swapoff 115
556#define SYS_sysinfo 116
557#define SYS_ipc 117
558#define SYS_fsync 118
559#define SYS_sigreturn 119
560#define SYS_clone 120
561#define SYS_setdomainname 121
562#define SYS_uname 122
563#define SYS_modify_ldt 123
564#define SYS_adjtimex 124
565#define SYS_mprotect 125
566#define SYS_sigprocmask 126
567#define SYS_create_module 127
568#define SYS_init_module 128
569#define SYS_delete_module 129
570#define SYS_get_kernel_syms 130
571#define SYS_quotactl 131
572#define SYS_getpgid 132
573#define SYS_fchdir 133
574#define SYS_bdflush 134
575#define SYS_sysfs 135
576#define SYS_personality 136
577#define SYS_afs_syscall 137
578#define SYS_setfsuid 138
579#define SYS_setfsgid 139
580#define SYS__llseek 140
581#define SYS_getdents 141
582#define SYS__newselect 142
583#define SYS_flock 143
584#define SYS_msync 144
585#define SYS_readv 145
586#define SYS_writev 146
587#define SYS_getsid 147
588#define SYS_fdatasync 148
589#define SYS__sysctl 149
590#define SYS_mlock 150
591#define SYS_munlock 151
592#define SYS_mlockall 152
593#define SYS_munlockall 153
594#define SYS_sched_setparam 154
595#define SYS_sched_getparam 155
596#define SYS_sched_setscheduler 156
597#define SYS_sched_getscheduler 157
598#define SYS_sched_yield 158
599#define SYS_sched_get_priority_max 159
600#define SYS_sched_get_priority_min 160
601#define SYS_sched_rr_get_interval 161
602#define SYS_nanosleep 162
603#define SYS_mremap 163
604#define SYS_setresuid 164
605#define SYS_getresuid 165
606#define SYS_vm86 166
607#define SYS_query_module 167
608#define SYS_poll 168
609#define SYS_nfsservctl 169
610#define SYS_setresgid 170
611#define SYS_getresgid 171
612#define SYS_prctl 172
613#define SYS_rt_sigreturn 173
614#define SYS_rt_sigaction 174
615#define SYS_rt_sigprocmask 175
616#define SYS_rt_sigpending 176
617#define SYS_rt_sigtimedwait 177
618#define SYS_rt_sigqueueinfo 178
619#define SYS_rt_sigsuspend 179
620#define SYS_pread64 180
621#define SYS_pwrite64 181
622#define SYS_chown 182
623#define SYS_getcwd 183
624#define SYS_capget 184
625#define SYS_capset 185
626#define SYS_sigaltstack 186
627#define SYS_sendfile 187
628#define SYS_getpmsg 188
629#define SYS_putpmsg 189
630#define SYS_vfork 190
631#define SYS_ugetrlimit 191
632#define SYS_mmap2 192
633#define SYS_truncate64 193
634#define SYS_ftruncate64 194
635#define SYS_stat64 195
636#define SYS_lstat64 196
637#define SYS_fstat64 197
638#define SYS_lchown32 198
639#define SYS_getuid32 199
640#define SYS_getgid32 200
641#define SYS_geteuid32 201
642#define SYS_getegid32 202
643#define SYS_setreuid32 203
644#define SYS_setregid32 204
645#define SYS_getgroups32 205
646#define SYS_setgroups32 206
647#define SYS_fchown32 207
648#define SYS_setresuid32 208
649#define SYS_getresuid32 209
650#define SYS_setresgid32 210
651#define SYS_getresgid32 211
652#define SYS_chown32 212
653#define SYS_setuid32 213
654#define SYS_setgid32 214
655#define SYS_setfsuid32 215
656#define SYS_setfsgid32 216
657#define SYS_pivot_root 217
658#define SYS_mincore 218
659#define SYS_madvise 219
660#define SYS_getdents64 220
661#define SYS_fcntl64 221
662#define SYS_gettid 224
663#define SYS_readahead 225
664#define SYS_setxattr 226
665#define SYS_lsetxattr 227
666#define SYS_fsetxattr 228
667#define SYS_getxattr 229
668#define SYS_lgetxattr 230
669#define SYS_fgetxattr 231
670#define SYS_listxattr 232
671#define SYS_llistxattr 233
672#define SYS_flistxattr 234
673#define SYS_removexattr 235
674#define SYS_lremovexattr 236
675#define SYS_fremovexattr 237
676#define SYS_tkill 238
677#define SYS_sendfile64 239
678#define SYS_futex 240
679#define SYS_sched_setaffinity 241
680#define SYS_sched_getaffinity 242
681#define SYS_set_thread_area 243
682#define SYS_get_thread_area 244
683#define SYS_io_setup 245
684#define SYS_io_destroy 246
685#define SYS_io_getevents 247
686#define SYS_io_submit 248
687#define SYS_io_cancel 249
688#define SYS_fadvise64 250
689#define SYS_exit_group 252
690#define SYS_lookup_dcookie 253
691#define SYS_epoll_create 254
692#define SYS_epoll_ctl 255
693#define SYS_epoll_wait 256
694#define SYS_remap_file_pages 257
695#define SYS_set_tid_address 258
696#define SYS_timer_create 259
697#define SYS_timer_settime32 (__NR_timer_create+1)
698#define SYS_timer_gettime32 (__NR_timer_create+2)
699#define SYS_timer_getoverrun (__NR_timer_create+3)
700#define SYS_timer_delete (__NR_timer_create+4)
701#define SYS_clock_settime32 (__NR_timer_create+5)
702#define SYS_clock_gettime32 (__NR_timer_create+6)
703#define SYS_clock_getres_time32 (__NR_timer_create+7)
704#define SYS_clock_nanosleep_time32 (__NR_timer_create+8)
705#define SYS_statfs64 268
706#define SYS_fstatfs64 269
707#define SYS_tgkill 270
708#define SYS_utimes 271
709#define SYS_fadvise64_64 272
710#define SYS_vserver 273
711#define SYS_mbind 274
712#define SYS_get_mempolicy 275
713#define SYS_set_mempolicy 276
714#define SYS_mq_open 277
715#define SYS_mq_unlink (__NR_mq_open+1)
716#define SYS_mq_timedsend (__NR_mq_open+2)
717#define SYS_mq_timedreceive (__NR_mq_open+3)
718#define SYS_mq_notify (__NR_mq_open+4)
719#define SYS_mq_getsetattr (__NR_mq_open+5)
720#define SYS_kexec_load 283
721#define SYS_waitid 284
722/* #define SYS_sys_setaltroot 285 */
723#define SYS_add_key 286
724#define SYS_request_key 287
725#define SYS_keyctl 288
726#define SYS_ioprio_set 289
727#define SYS_ioprio_get 290
728#define SYS_inotify_init 291
729#define SYS_inotify_add_watch 292
730#define SYS_inotify_rm_watch 293
731#define SYS_migrate_pages 294
732#define SYS_openat 295
733#define SYS_mkdirat 296
734#define SYS_mknodat 297
735#define SYS_fchownat 298
736#define SYS_futimesat 299
737#define SYS_fstatat64 300
738#define SYS_unlinkat 301
739#define SYS_renameat 302
740#define SYS_linkat 303
741#define SYS_symlinkat 304
742#define SYS_readlinkat 305
743#define SYS_fchmodat 306
744#define SYS_faccessat 307
745#define SYS_pselect6 308
746#define SYS_ppoll 309
747#define SYS_unshare 310
748#define SYS_set_robust_list 311
749#define SYS_get_robust_list 312
750#define SYS_splice 313
751#define SYS_sync_file_range 314
752#define SYS_tee 315
753#define SYS_vmsplice 316
754#define SYS_move_pages 317
755#define SYS_getcpu 318
756#define SYS_epoll_pwait 319
757#define SYS_utimensat 320
758#define SYS_signalfd 321
759#define SYS_timerfd_create 322
760#define SYS_eventfd 323
761#define SYS_fallocate 324
762#define SYS_timerfd_settime32 325
763#define SYS_timerfd_gettime32 326
764#define SYS_signalfd4 327
765#define SYS_eventfd2 328
766#define SYS_epoll_create1 329
767#define SYS_dup3 330
768#define SYS_pipe2 331
769#define SYS_inotify_init1 332
770#define SYS_preadv 333
771#define SYS_pwritev 334
772#define SYS_rt_tgsigqueueinfo 335
773#define SYS_perf_event_open 336
774#define SYS_recvmmsg 337
775#define SYS_fanotify_init 338
776#define SYS_fanotify_mark 339
777#define SYS_prlimit64 340
778#define SYS_name_to_handle_at 341
779#define SYS_open_by_handle_at 342
780#define SYS_clock_adjtime 343
781#define SYS_syncfs 344
782#define SYS_sendmmsg 345
783#define SYS_setns 346
784#define SYS_process_vm_readv 347
785#define SYS_process_vm_writev 348
786#define SYS_kcmp 349
787#define SYS_finit_module 350
788#define SYS_sched_setattr 351
789#define SYS_sched_getattr 352
790#define SYS_renameat2 353
791#define SYS_seccomp 354
792#define SYS_getrandom 355
793#define SYS_memfd_create 356
794#define SYS_bpf 357
795#define SYS_execveat 358
796#define SYS_socket 359
797#define SYS_socketpair 360
798#define SYS_bind 361
799#define SYS_connect 362
800#define SYS_listen 363
801#define SYS_accept4 364
802#define SYS_getsockopt 365
803#define SYS_setsockopt 366
804#define SYS_getsockname 367
805#define SYS_getpeername 368
806#define SYS_sendto 369
807#define SYS_sendmsg 370
808#define SYS_recvfrom 371
809#define SYS_recvmsg 372
810#define SYS_shutdown 373
811#define SYS_userfaultfd 374
812#define SYS_membarrier 375
813#define SYS_mlock2 376
814#define SYS_copy_file_range 377
815#define SYS_preadv2 378
816#define SYS_pwritev2 379
817#define SYS_pkey_mprotect 380
818#define SYS_pkey_alloc 381
819#define SYS_pkey_free 382
820#define SYS_statx 383
821#define SYS_arch_prctl 384
822#define SYS_io_pgetevents 385
823#define SYS_rseq 386
824#define SYS_semget 393
825#define SYS_semctl 394
826#define SYS_shmget 395
827#define SYS_shmctl 396
828#define SYS_shmat 397
829#define SYS_shmdt 398
830#define SYS_msgget 399
831#define SYS_msgsnd 400
832#define SYS_msgrcv 401
833#define SYS_msgctl 402
834#define SYS_clock_gettime64 403
835#define SYS_clock_settime64 404
836#define SYS_clock_adjtime64 405
837#define SYS_clock_getres_time64 406
838#define SYS_clock_nanosleep_time64 407
839#define SYS_timer_gettime64 408
840#define SYS_timer_settime64 409
841#define SYS_timerfd_gettime64 410
842#define SYS_timerfd_settime64 411
843#define SYS_utimensat_time64 412
844#define SYS_pselect6_time64 413
845#define SYS_ppoll_time64 414
846#define SYS_io_pgetevents_time64 416
847#define SYS_recvmmsg_time64 417
848#define SYS_mq_timedsend_time64 418
849#define SYS_mq_timedreceive_time64 419
850#define SYS_semtimedop_time64 420
851#define SYS_rt_sigtimedwait_time64 421
852#define SYS_futex_time64 422
853#define SYS_sched_rr_get_interval_time64 423
854#define SYS_pidfd_send_signal 424
855#define SYS_io_uring_setup 425
856#define SYS_io_uring_enter 426
857#define SYS_io_uring_register 427
858#define SYS_open_tree 428
859#define SYS_move_mount 429
860#define SYS_fsopen 430
861#define SYS_fsconfig 431
862#define SYS_fsmount 432
863#define SYS_fspick 433
864#define SYS_pidfd_open 434
865#define SYS_clone3 435
866#define SYS_close_range 436
867#define SYS_openat2 437
868#define SYS_pidfd_getfd 438
869#define SYS_faccessat2 439
870#define SYS_process_madvise 440
871#define SYS_epoll_pwait2 441
872#define SYS_mount_setattr 442
873#define SYS_landlock_create_ruleset 444
874#define SYS_landlock_add_rule 445
875#define SYS_landlock_restrict_self 446
\ No newline at end of file
lib/libc/include/i386-linux-musl/bits/user.h deleted-44
...@@ -1,44 +0,0 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3
4typedef struct user_fpregs_struct {
5 long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
6} elf_fpregset_t;
7
8typedef struct user_fpxregs_struct {
9 unsigned short cwd, swd, twd, fop;
10 long fip, fcs, foo, fos, mxcsr, reserved;
11 long st_space[32], xmm_space[32], padding[56];
12} elf_fpxregset_t;
13
14struct user_regs_struct {
15 long ebx, ecx, edx, esi, edi, ebp, eax, xds, xes, xfs, xgs;
16 long orig_eax, eip, xcs, eflags, esp, xss;
17};
18
19#define ELF_NGREG 17
20typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
21
22struct user {
23 struct user_regs_struct regs;
24 int u_fpvalid;
25 struct user_fpregs_struct i387;
26 unsigned long u_tsize;
27 unsigned long u_dsize;
28 unsigned long u_ssize;
29 unsigned long start_code;
30 unsigned long start_stack;
31 long signal;
32 int reserved;
33 struct user_regs_struct *u_ar0;
34 struct user_fpregs_struct *u_fpstate;
35 unsigned long magic;
36 char u_comm[32];
37 int u_debugreg[8];
38};
39
40#define PAGE_MASK (~(PAGESIZE-1))
41#define NBPG PAGESIZE
42#define UPAGES 1
43#define HOST_TEXT_START_ADDR (u.start_code)
44#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
\ No newline at end of file
lib/libc/include/mips-linux-musl/bits/signal.h-1
...@@ -66,7 +66,6 @@ typedef struct __ucontext {...@@ -66,7 +66,6 @@ typedef struct __ucontext {
66#define SA_RESTART 0x1000000066#define SA_RESTART 0x10000000
67#define SA_NODEFER 0x4000000067#define SA_NODEFER 0x40000000
68#define SA_RESETHAND 0x8000000068#define SA_RESETHAND 0x80000000
69#define SA_RESTORER 0x04000000
7069
71#undef SIG_BLOCK70#undef SIG_BLOCK
72#undef SIG_UNBLOCK71#undef SIG_UNBLOCK
lib/libc/include/mips64-linux-musl/bits/signal.h-1
...@@ -85,7 +85,6 @@ typedef struct __ucontext {...@@ -85,7 +85,6 @@ typedef struct __ucontext {
85#define SA_RESTART 0x1000000085#define SA_RESTART 0x10000000
86#define SA_NODEFER 0x4000000086#define SA_NODEFER 0x40000000
87#define SA_RESETHAND 0x8000000087#define SA_RESETHAND 0x80000000
88#define SA_RESTORER 0x04000000
8988
90#undef SIG_BLOCK89#undef SIG_BLOCK
91#undef SIG_UNBLOCK90#undef SIG_UNBLOCK
lib/libc/include/riscv64-linux-musl/bits/signal.h-1
...@@ -76,7 +76,6 @@ typedef struct __ucontext...@@ -76,7 +76,6 @@ typedef struct __ucontext
76#define SA_RESTART 0x1000000076#define SA_RESTART 0x10000000
77#define SA_NODEFER 0x4000000077#define SA_NODEFER 0x40000000
78#define SA_RESETHAND 0x8000000078#define SA_RESETHAND 0x80000000
79#define SA_RESTORER 0x04000000
8079
81#endif80#endif
8281
lib/libc/include/x86-linux-musl/bits/alltypes.h created+438
...@@ -0,0 +1,438 @@
1#define _REDIR_TIME64 1
2#define _Addr int
3#define _Int64 long long
4#define _Reg int
5
6#define __BYTE_ORDER 1234
7#define __LONG_MAX 0x7fffffffL
8
9#ifndef __cplusplus
10#ifdef __WCHAR_TYPE__
11#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
12typedef __WCHAR_TYPE__ wchar_t;
13#define __DEFINED_wchar_t
14#endif
15
16#else
17#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
18typedef long wchar_t;
19#define __DEFINED_wchar_t
20#endif
21
22#endif
23#endif
24
25#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
26#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
27typedef float float_t;
28#define __DEFINED_float_t
29#endif
30
31#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
32typedef double double_t;
33#define __DEFINED_double_t
34#endif
35
36#else
37#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
38typedef long double float_t;
39#define __DEFINED_float_t
40#endif
41
42#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
43typedef long double double_t;
44#define __DEFINED_double_t
45#endif
46
47#endif
48
49#if !defined(__cplusplus)
50#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
51typedef struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
52#define __DEFINED_max_align_t
53#endif
54
55#elif defined(__GNUC__)
56#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
57typedef struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t;
58#define __DEFINED_max_align_t
59#endif
60
61#else
62#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
63typedef struct { alignas(8) long long __ll; long double __ld; } max_align_t;
64#define __DEFINED_max_align_t
65#endif
66
67#endif
68#define __LITTLE_ENDIAN 1234
69#define __BIG_ENDIAN 4321
70#define __USE_TIME_BITS64 1
71
72#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
73typedef unsigned _Addr size_t;
74#define __DEFINED_size_t
75#endif
76
77#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
78typedef unsigned _Addr uintptr_t;
79#define __DEFINED_uintptr_t
80#endif
81
82#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
83typedef _Addr ptrdiff_t;
84#define __DEFINED_ptrdiff_t
85#endif
86
87#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
88typedef _Addr ssize_t;
89#define __DEFINED_ssize_t
90#endif
91
92#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
93typedef _Addr intptr_t;
94#define __DEFINED_intptr_t
95#endif
96
97#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
98typedef _Addr regoff_t;
99#define __DEFINED_regoff_t
100#endif
101
102#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
103typedef _Reg register_t;
104#define __DEFINED_register_t
105#endif
106
107#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
108typedef _Int64 time_t;
109#define __DEFINED_time_t
110#endif
111
112#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
113typedef _Int64 suseconds_t;
114#define __DEFINED_suseconds_t
115#endif
116
117
118#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
119typedef signed char int8_t;
120#define __DEFINED_int8_t
121#endif
122
123#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
124typedef signed short int16_t;
125#define __DEFINED_int16_t
126#endif
127
128#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
129typedef signed int int32_t;
130#define __DEFINED_int32_t
131#endif
132
133#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
134typedef signed _Int64 int64_t;
135#define __DEFINED_int64_t
136#endif
137
138#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
139typedef signed _Int64 intmax_t;
140#define __DEFINED_intmax_t
141#endif
142
143#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
144typedef unsigned char uint8_t;
145#define __DEFINED_uint8_t
146#endif
147
148#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
149typedef unsigned short uint16_t;
150#define __DEFINED_uint16_t
151#endif
152
153#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
154typedef unsigned int uint32_t;
155#define __DEFINED_uint32_t
156#endif
157
158#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
159typedef unsigned _Int64 uint64_t;
160#define __DEFINED_uint64_t
161#endif
162
163#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
164typedef unsigned _Int64 u_int64_t;
165#define __DEFINED_u_int64_t
166#endif
167
168#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
169typedef unsigned _Int64 uintmax_t;
170#define __DEFINED_uintmax_t
171#endif
172
173
174#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
175typedef unsigned mode_t;
176#define __DEFINED_mode_t
177#endif
178
179#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
180typedef unsigned _Reg nlink_t;
181#define __DEFINED_nlink_t
182#endif
183
184#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
185typedef _Int64 off_t;
186#define __DEFINED_off_t
187#endif
188
189#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
190typedef unsigned _Int64 ino_t;
191#define __DEFINED_ino_t
192#endif
193
194#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
195typedef unsigned _Int64 dev_t;
196#define __DEFINED_dev_t
197#endif
198
199#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
200typedef long blksize_t;
201#define __DEFINED_blksize_t
202#endif
203
204#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
205typedef _Int64 blkcnt_t;
206#define __DEFINED_blkcnt_t
207#endif
208
209#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
210typedef unsigned _Int64 fsblkcnt_t;
211#define __DEFINED_fsblkcnt_t
212#endif
213
214#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
215typedef unsigned _Int64 fsfilcnt_t;
216#define __DEFINED_fsfilcnt_t
217#endif
218
219
220#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
221typedef unsigned wint_t;
222#define __DEFINED_wint_t
223#endif
224
225#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
226typedef unsigned long wctype_t;
227#define __DEFINED_wctype_t
228#endif
229
230
231#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
232typedef void * timer_t;
233#define __DEFINED_timer_t
234#endif
235
236#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
237typedef int clockid_t;
238#define __DEFINED_clockid_t
239#endif
240
241#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
242typedef long clock_t;
243#define __DEFINED_clock_t
244#endif
245
246#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
247struct timeval { time_t tv_sec; suseconds_t tv_usec; };
248#define __DEFINED_struct_timeval
249#endif
250
251#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
252struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
253#define __DEFINED_struct_timespec
254#endif
255
256
257#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
258typedef int pid_t;
259#define __DEFINED_pid_t
260#endif
261
262#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
263typedef unsigned id_t;
264#define __DEFINED_id_t
265#endif
266
267#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
268typedef unsigned uid_t;
269#define __DEFINED_uid_t
270#endif
271
272#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
273typedef unsigned gid_t;
274#define __DEFINED_gid_t
275#endif
276
277#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
278typedef int key_t;
279#define __DEFINED_key_t
280#endif
281
282#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
283typedef unsigned useconds_t;
284#define __DEFINED_useconds_t
285#endif
286
287
288#ifdef __cplusplus
289#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
290typedef unsigned long pthread_t;
291#define __DEFINED_pthread_t
292#endif
293
294#else
295#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
296typedef struct __pthread * pthread_t;
297#define __DEFINED_pthread_t
298#endif
299
300#endif
301#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
302typedef int pthread_once_t;
303#define __DEFINED_pthread_once_t
304#endif
305
306#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
307typedef unsigned pthread_key_t;
308#define __DEFINED_pthread_key_t
309#endif
310
311#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
312typedef int pthread_spinlock_t;
313#define __DEFINED_pthread_spinlock_t
314#endif
315
316#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
317typedef struct { unsigned __attr; } pthread_mutexattr_t;
318#define __DEFINED_pthread_mutexattr_t
319#endif
320
321#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
322typedef struct { unsigned __attr; } pthread_condattr_t;
323#define __DEFINED_pthread_condattr_t
324#endif
325
326#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
327typedef struct { unsigned __attr; } pthread_barrierattr_t;
328#define __DEFINED_pthread_barrierattr_t
329#endif
330
331#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
332typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
333#define __DEFINED_pthread_rwlockattr_t
334#endif
335
336
337#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
338struct _IO_FILE { char __x; };
339#define __DEFINED_struct__IO_FILE
340#endif
341
342#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
343typedef struct _IO_FILE FILE;
344#define __DEFINED_FILE
345#endif
346
347
348#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
349typedef __builtin_va_list va_list;
350#define __DEFINED_va_list
351#endif
352
353#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
354typedef __builtin_va_list __isoc_va_list;
355#define __DEFINED___isoc_va_list
356#endif
357
358
359#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
360typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
361#define __DEFINED_mbstate_t
362#endif
363
364
365#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
366typedef struct __locale_struct * locale_t;
367#define __DEFINED_locale_t
368#endif
369
370
371#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
372typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
373#define __DEFINED_sigset_t
374#endif
375
376
377#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
378struct iovec { void *iov_base; size_t iov_len; };
379#define __DEFINED_struct_iovec
380#endif
381
382
383#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
384struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
385#define __DEFINED_struct_winsize
386#endif
387
388
389#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
390typedef unsigned socklen_t;
391#define __DEFINED_socklen_t
392#endif
393
394#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
395typedef unsigned short sa_family_t;
396#define __DEFINED_sa_family_t
397#endif
398
399
400#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
401typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
402#define __DEFINED_pthread_attr_t
403#endif
404
405#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
406typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
407#define __DEFINED_pthread_mutex_t
408#endif
409
410#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
411typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
412#define __DEFINED_mtx_t
413#endif
414
415#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
416typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
417#define __DEFINED_pthread_cond_t
418#endif
419
420#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
421typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
422#define __DEFINED_cnd_t
423#endif
424
425#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
426typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
427#define __DEFINED_pthread_rwlock_t
428#endif
429
430#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
431typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
432#define __DEFINED_pthread_barrier_t
433#endif
434
435
436#undef _Addr
437#undef _Int64
438#undef _Reg
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/fenv.h created+33
...@@ -0,0 +1,33 @@
1#define FE_INVALID 1
2#define __FE_DENORM 2
3#define FE_DIVBYZERO 4
4#define FE_OVERFLOW 8
5#define FE_UNDERFLOW 16
6#define FE_INEXACT 32
7
8#define FE_ALL_EXCEPT 63
9
10#define FE_TONEAREST 0
11#define FE_DOWNWARD 0x400
12#define FE_UPWARD 0x800
13#define FE_TOWARDZERO 0xc00
14
15typedef unsigned short fexcept_t;
16
17typedef struct {
18 unsigned short __control_word;
19 unsigned short __unused1;
20 unsigned short __status_word;
21 unsigned short __unused2;
22 unsigned short __tags;
23 unsigned short __unused3;
24 unsigned int __eip;
25 unsigned short __cs_selector;
26 unsigned int __opcode:11;
27 unsigned int __unused4:5;
28 unsigned int __data_offset;
29 unsigned short __data_selector;
30 unsigned short __unused5;
31} fenv_t;
32
33#define FE_DFL_ENV ((const fenv_t *) -1)
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/float.h created+20
...@@ -0,0 +1,20 @@
1#ifdef __FLT_EVAL_METHOD__
2#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
3#else
4#define FLT_EVAL_METHOD 2
5#endif
6
7#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
8#define LDBL_MIN 3.3621031431120935063e-4932L
9#define LDBL_MAX 1.1897314953572317650e+4932L
10#define LDBL_EPSILON 1.0842021724855044340e-19L
11
12#define LDBL_MANT_DIG 64
13#define LDBL_MIN_EXP (-16381)
14#define LDBL_MAX_EXP 16384
15
16#define LDBL_DIG 18
17#define LDBL_MIN_10_EXP (-4931)
18#define LDBL_MAX_10_EXP 4932
19
20#define DECIMAL_DIG 21
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/io.h created+77
...@@ -0,0 +1,77 @@
1static __inline void outb(unsigned char __val, unsigned short __port)
2{
3 __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
4}
5
6static __inline void outw(unsigned short __val, unsigned short __port)
7{
8 __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
9}
10
11static __inline void outl(unsigned int __val, unsigned short __port)
12{
13 __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
14}
15
16static __inline unsigned char inb(unsigned short __port)
17{
18 unsigned char __val;
19 __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
20 return __val;
21}
22
23static __inline unsigned short inw(unsigned short __port)
24{
25 unsigned short __val;
26 __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
27 return __val;
28}
29
30static __inline unsigned int inl(unsigned short __port)
31{
32 unsigned int __val;
33 __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
34 return __val;
35}
36
37static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
38{
39 __asm__ volatile ("cld; rep; outsb"
40 : "+S" (__buf), "+c" (__n)
41 : "d" (__port));
42}
43
44static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
45{
46 __asm__ volatile ("cld; rep; outsw"
47 : "+S" (__buf), "+c" (__n)
48 : "d" (__port));
49}
50
51static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
52{
53 __asm__ volatile ("cld; rep; outsl"
54 : "+S" (__buf), "+c"(__n)
55 : "d" (__port));
56}
57
58static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
59{
60 __asm__ volatile ("cld; rep; insb"
61 : "+D" (__buf), "+c" (__n)
62 : "d" (__port));
63}
64
65static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
66{
67 __asm__ volatile ("cld; rep; insw"
68 : "+D" (__buf), "+c" (__n)
69 : "d" (__port));
70}
71
72static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
73{
74 __asm__ volatile ("cld; rep; insl"
75 : "+D" (__buf), "+c" (__n)
76 : "d" (__port));
77}
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/ipcstat.h created+1
...@@ -0,0 +1 @@
1#define IPC_STAT 0x102
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/limits.h created+1
...@@ -0,0 +1 @@
1#define PAGESIZE 4096
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/mman.h created+1
...@@ -0,0 +1 @@
1#define MAP_32BIT 0x40
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/msg.h created+18
...@@ -0,0 +1,18 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 unsigned long __msg_stime_lo;
4 unsigned long __msg_stime_hi;
5 unsigned long __msg_rtime_lo;
6 unsigned long __msg_rtime_hi;
7 unsigned long __msg_ctime_lo;
8 unsigned long __msg_ctime_hi;
9 unsigned long msg_cbytes;
10 msgqnum_t msg_qnum;
11 msglen_t msg_qbytes;
12 pid_t msg_lspid;
13 pid_t msg_lrpid;
14 unsigned long __unused[2];
15 time_t msg_stime;
16 time_t msg_rtime;
17 time_t msg_ctime;
18};
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/ptrace.h created+11
...@@ -0,0 +1,11 @@
1#define PTRACE_GET_THREAD_AREA 25
2#define PTRACE_SET_THREAD_AREA 26
3#define PTRACE_SYSEMU 31
4#define PTRACE_SYSEMU_SINGLESTEP 32
5#define PTRACE_SINGLEBLOCK 33
6
7#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
8#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
9#define PT_SYSEMU PTRACE_SYSEMU
10#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
11#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/reg.h created+19
...@@ -0,0 +1,19 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3#define EBX 0
4#define ECX 1
5#define EDX 2
6#define ESI 3
7#define EDI 4
8#define EBP 5
9#define EAX 6
10#define DS 7
11#define ES 8
12#define FS 9
13#define GS 10
14#define ORIG_EAX 11
15#define EIP 12
16#define CS 13
17#define EFL 14
18#define UESP 15
19#define SS 16
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/sem.h created+13
...@@ -0,0 +1,13 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 unsigned long __sem_otime_lo;
4 unsigned long __sem_otime_hi;
5 unsigned long __sem_ctime_lo;
6 unsigned long __sem_ctime_hi;
7 unsigned short sem_nsems;
8 char __sem_nsems_pad[sizeof(long)-sizeof(short)];
9 long __unused3;
10 long __unused4;
11 time_t sem_otime;
12 time_t sem_ctime;
13};
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[6];
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/shm.h created+31
...@@ -0,0 +1,31 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 unsigned long __shm_atime_lo;
7 unsigned long __shm_atime_hi;
8 unsigned long __shm_dtime_lo;
9 unsigned long __shm_dtime_hi;
10 unsigned long __shm_ctime_lo;
11 unsigned long __shm_ctime_hi;
12 pid_t shm_cpid;
13 pid_t shm_lpid;
14 unsigned long shm_nattch;
15 unsigned long __pad1;
16 unsigned long __pad2;
17 unsigned long __pad3;
18 time_t shm_atime;
19 time_t shm_dtime;
20 time_t shm_ctime;
21};
22
23struct shminfo {
24 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
25};
26
27struct shm_info {
28 int __used_ids;
29 unsigned long shm_tot, shm_rss, shm_swp;
30 unsigned long __swap_attempts, __swap_successes;
31};
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/signal.h created+141
...@@ -0,0 +1,141 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#ifdef _GNU_SOURCE
10enum { REG_GS = 0 };
11#define REG_GS REG_GS
12enum { REG_FS = 1 };
13#define REG_FS REG_FS
14enum { REG_ES = 2 };
15#define REG_ES REG_ES
16enum { REG_DS = 3 };
17#define REG_DS REG_DS
18enum { REG_EDI = 4 };
19#define REG_EDI REG_EDI
20enum { REG_ESI = 5 };
21#define REG_ESI REG_ESI
22enum { REG_EBP = 6 };
23#define REG_EBP REG_EBP
24enum { REG_ESP = 7 };
25#define REG_ESP REG_ESP
26enum { REG_EBX = 8 };
27#define REG_EBX REG_EBX
28enum { REG_EDX = 9 };
29#define REG_EDX REG_EDX
30enum { REG_ECX = 10 };
31#define REG_ECX REG_ECX
32enum { REG_EAX = 11 };
33#define REG_EAX REG_EAX
34enum { REG_TRAPNO = 12 };
35#define REG_TRAPNO REG_TRAPNO
36enum { REG_ERR = 13 };
37#define REG_ERR REG_ERR
38enum { REG_EIP = 14 };
39#define REG_EIP REG_EIP
40enum { REG_CS = 15 };
41#define REG_CS REG_CS
42enum { REG_EFL = 16 };
43#define REG_EFL REG_EFL
44enum { REG_UESP = 17 };
45#define REG_UESP REG_UESP
46enum { REG_SS = 18 };
47#define REG_SS REG_SS
48#endif
49
50#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
51typedef int greg_t, gregset_t[19];
52typedef struct _fpstate {
53 unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel;
54 struct {
55 unsigned short significand[4], exponent;
56 } _st[8];
57 unsigned long status;
58} *fpregset_t;
59struct sigcontext {
60 unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
61 unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
62 unsigned long trapno, err, eip;
63 unsigned short cs, __csh;
64 unsigned long eflags, esp_at_signal;
65 unsigned short ss, __ssh;
66 struct _fpstate *fpstate;
67 unsigned long oldmask, cr2;
68};
69typedef struct {
70 gregset_t gregs;
71 fpregset_t fpregs;
72 unsigned long oldmask, cr2;
73} mcontext_t;
74#else
75typedef struct {
76 unsigned __space[22];
77} mcontext_t;
78#endif
79
80struct sigaltstack {
81 void *ss_sp;
82 int ss_flags;
83 size_t ss_size;
84};
85
86typedef struct __ucontext {
87 unsigned long uc_flags;
88 struct __ucontext *uc_link;
89 stack_t uc_stack;
90 mcontext_t uc_mcontext;
91 sigset_t uc_sigmask;
92 unsigned long __fpregs_mem[28];
93} ucontext_t;
94
95#define SA_NOCLDSTOP 1
96#define SA_NOCLDWAIT 2
97#define SA_SIGINFO 4
98#define SA_ONSTACK 0x08000000
99#define SA_RESTART 0x10000000
100#define SA_NODEFER 0x40000000
101#define SA_RESETHAND 0x80000000
102#define SA_RESTORER 0x04000000
103
104#endif
105
106#define SIGHUP 1
107#define SIGINT 2
108#define SIGQUIT 3
109#define SIGILL 4
110#define SIGTRAP 5
111#define SIGABRT 6
112#define SIGIOT SIGABRT
113#define SIGBUS 7
114#define SIGFPE 8
115#define SIGKILL 9
116#define SIGUSR1 10
117#define SIGSEGV 11
118#define SIGUSR2 12
119#define SIGPIPE 13
120#define SIGALRM 14
121#define SIGTERM 15
122#define SIGSTKFLT 16
123#define SIGCHLD 17
124#define SIGCONT 18
125#define SIGSTOP 19
126#define SIGTSTP 20
127#define SIGTTIN 21
128#define SIGTTOU 22
129#define SIGURG 23
130#define SIGXCPU 24
131#define SIGXFSZ 25
132#define SIGVTALRM 26
133#define SIGPROF 27
134#define SIGWINCH 28
135#define SIGIO 29
136#define SIGPOLL 29
137#define SIGPWR 30
138#define SIGSYS 31
139#define SIGUNUSED SIGSYS
140
141#define _NSIG 65
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/stat.h created+25
...@@ -0,0 +1,25 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 int __st_dev_padding;
7 long __st_ino_truncated;
8 mode_t st_mode;
9 nlink_t st_nlink;
10 uid_t st_uid;
11 gid_t st_gid;
12 dev_t st_rdev;
13 int __st_rdev_padding;
14 off_t st_size;
15 blksize_t st_blksize;
16 blkcnt_t st_blocks;
17 struct {
18 long tv_sec;
19 long tv_nsec;
20 } __st_atim32, __st_mtim32, __st_ctim32;
21 ino_t st_ino;
22 struct timespec st_atim;
23 struct timespec st_mtim;
24 struct timespec st_ctim;
25};
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/syscall.h created+875
...@@ -0,0 +1,875 @@
1#define __NR_restart_syscall 0
2#define __NR_exit 1
3#define __NR_fork 2
4#define __NR_read 3
5#define __NR_write 4
6#define __NR_open 5
7#define __NR_close 6
8#define __NR_waitpid 7
9#define __NR_creat 8
10#define __NR_link 9
11#define __NR_unlink 10
12#define __NR_execve 11
13#define __NR_chdir 12
14#define __NR_time 13
15#define __NR_mknod 14
16#define __NR_chmod 15
17#define __NR_lchown 16
18#define __NR_break 17
19#define __NR_oldstat 18
20#define __NR_lseek 19
21#define __NR_getpid 20
22#define __NR_mount 21
23#define __NR_umount 22
24#define __NR_setuid 23
25#define __NR_getuid 24
26#define __NR_stime 25
27#define __NR_ptrace 26
28#define __NR_alarm 27
29#define __NR_oldfstat 28
30#define __NR_pause 29
31#define __NR_utime 30
32#define __NR_stty 31
33#define __NR_gtty 32
34#define __NR_access 33
35#define __NR_nice 34
36#define __NR_ftime 35
37#define __NR_sync 36
38#define __NR_kill 37
39#define __NR_rename 38
40#define __NR_mkdir 39
41#define __NR_rmdir 40
42#define __NR_dup 41
43#define __NR_pipe 42
44#define __NR_times 43
45#define __NR_prof 44
46#define __NR_brk 45
47#define __NR_setgid 46
48#define __NR_getgid 47
49#define __NR_signal 48
50#define __NR_geteuid 49
51#define __NR_getegid 50
52#define __NR_acct 51
53#define __NR_umount2 52
54#define __NR_lock 53
55#define __NR_ioctl 54
56#define __NR_fcntl 55
57#define __NR_mpx 56
58#define __NR_setpgid 57
59#define __NR_ulimit 58
60#define __NR_oldolduname 59
61#define __NR_umask 60
62#define __NR_chroot 61
63#define __NR_ustat 62
64#define __NR_dup2 63
65#define __NR_getppid 64
66#define __NR_getpgrp 65
67#define __NR_setsid 66
68#define __NR_sigaction 67
69#define __NR_sgetmask 68
70#define __NR_ssetmask 69
71#define __NR_setreuid 70
72#define __NR_setregid 71
73#define __NR_sigsuspend 72
74#define __NR_sigpending 73
75#define __NR_sethostname 74
76#define __NR_setrlimit 75
77#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
78#define __NR_getrusage 77
79#define __NR_gettimeofday_time32 78
80#define __NR_settimeofday_time32 79
81#define __NR_getgroups 80
82#define __NR_setgroups 81
83#define __NR_select 82
84#define __NR_symlink 83
85#define __NR_oldlstat 84
86#define __NR_readlink 85
87#define __NR_uselib 86
88#define __NR_swapon 87
89#define __NR_reboot 88
90#define __NR_readdir 89
91#define __NR_mmap 90
92#define __NR_munmap 91
93#define __NR_truncate 92
94#define __NR_ftruncate 93
95#define __NR_fchmod 94
96#define __NR_fchown 95
97#define __NR_getpriority 96
98#define __NR_setpriority 97
99#define __NR_profil 98
100#define __NR_statfs 99
101#define __NR_fstatfs 100
102#define __NR_ioperm 101
103#define __NR_socketcall 102
104#define __NR_syslog 103
105#define __NR_setitimer 104
106#define __NR_getitimer 105
107#define __NR_stat 106
108#define __NR_lstat 107
109#define __NR_fstat 108
110#define __NR_olduname 109
111#define __NR_iopl 110
112#define __NR_vhangup 111
113#define __NR_idle 112
114#define __NR_vm86old 113
115#define __NR_wait4 114
116#define __NR_swapoff 115
117#define __NR_sysinfo 116
118#define __NR_ipc 117
119#define __NR_fsync 118
120#define __NR_sigreturn 119
121#define __NR_clone 120
122#define __NR_setdomainname 121
123#define __NR_uname 122
124#define __NR_modify_ldt 123
125#define __NR_adjtimex 124
126#define __NR_mprotect 125
127#define __NR_sigprocmask 126
128#define __NR_create_module 127
129#define __NR_init_module 128
130#define __NR_delete_module 129
131#define __NR_get_kernel_syms 130
132#define __NR_quotactl 131
133#define __NR_getpgid 132
134#define __NR_fchdir 133
135#define __NR_bdflush 134
136#define __NR_sysfs 135
137#define __NR_personality 136
138#define __NR_afs_syscall 137
139#define __NR_setfsuid 138
140#define __NR_setfsgid 139
141#define __NR__llseek 140
142#define __NR_getdents 141
143#define __NR__newselect 142
144#define __NR_flock 143
145#define __NR_msync 144
146#define __NR_readv 145
147#define __NR_writev 146
148#define __NR_getsid 147
149#define __NR_fdatasync 148
150#define __NR__sysctl 149
151#define __NR_mlock 150
152#define __NR_munlock 151
153#define __NR_mlockall 152
154#define __NR_munlockall 153
155#define __NR_sched_setparam 154
156#define __NR_sched_getparam 155
157#define __NR_sched_setscheduler 156
158#define __NR_sched_getscheduler 157
159#define __NR_sched_yield 158
160#define __NR_sched_get_priority_max 159
161#define __NR_sched_get_priority_min 160
162#define __NR_sched_rr_get_interval 161
163#define __NR_nanosleep 162
164#define __NR_mremap 163
165#define __NR_setresuid 164
166#define __NR_getresuid 165
167#define __NR_vm86 166
168#define __NR_query_module 167
169#define __NR_poll 168
170#define __NR_nfsservctl 169
171#define __NR_setresgid 170
172#define __NR_getresgid 171
173#define __NR_prctl 172
174#define __NR_rt_sigreturn 173
175#define __NR_rt_sigaction 174
176#define __NR_rt_sigprocmask 175
177#define __NR_rt_sigpending 176
178#define __NR_rt_sigtimedwait 177
179#define __NR_rt_sigqueueinfo 178
180#define __NR_rt_sigsuspend 179
181#define __NR_pread64 180
182#define __NR_pwrite64 181
183#define __NR_chown 182
184#define __NR_getcwd 183
185#define __NR_capget 184
186#define __NR_capset 185
187#define __NR_sigaltstack 186
188#define __NR_sendfile 187
189#define __NR_getpmsg 188
190#define __NR_putpmsg 189
191#define __NR_vfork 190
192#define __NR_ugetrlimit 191
193#define __NR_mmap2 192
194#define __NR_truncate64 193
195#define __NR_ftruncate64 194
196#define __NR_stat64 195
197#define __NR_lstat64 196
198#define __NR_fstat64 197
199#define __NR_lchown32 198
200#define __NR_getuid32 199
201#define __NR_getgid32 200
202#define __NR_geteuid32 201
203#define __NR_getegid32 202
204#define __NR_setreuid32 203
205#define __NR_setregid32 204
206#define __NR_getgroups32 205
207#define __NR_setgroups32 206
208#define __NR_fchown32 207
209#define __NR_setresuid32 208
210#define __NR_getresuid32 209
211#define __NR_setresgid32 210
212#define __NR_getresgid32 211
213#define __NR_chown32 212
214#define __NR_setuid32 213
215#define __NR_setgid32 214
216#define __NR_setfsuid32 215
217#define __NR_setfsgid32 216
218#define __NR_pivot_root 217
219#define __NR_mincore 218
220#define __NR_madvise 219
221#define __NR_getdents64 220
222#define __NR_fcntl64 221
223/* 223 is unused */
224#define __NR_gettid 224
225#define __NR_readahead 225
226#define __NR_setxattr 226
227#define __NR_lsetxattr 227
228#define __NR_fsetxattr 228
229#define __NR_getxattr 229
230#define __NR_lgetxattr 230
231#define __NR_fgetxattr 231
232#define __NR_listxattr 232
233#define __NR_llistxattr 233
234#define __NR_flistxattr 234
235#define __NR_removexattr 235
236#define __NR_lremovexattr 236
237#define __NR_fremovexattr 237
238#define __NR_tkill 238
239#define __NR_sendfile64 239
240#define __NR_futex 240
241#define __NR_sched_setaffinity 241
242#define __NR_sched_getaffinity 242
243#define __NR_set_thread_area 243
244#define __NR_get_thread_area 244
245#define __NR_io_setup 245
246#define __NR_io_destroy 246
247#define __NR_io_getevents 247
248#define __NR_io_submit 248
249#define __NR_io_cancel 249
250#define __NR_fadvise64 250
251/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
252#define __NR_exit_group 252
253#define __NR_lookup_dcookie 253
254#define __NR_epoll_create 254
255#define __NR_epoll_ctl 255
256#define __NR_epoll_wait 256
257#define __NR_remap_file_pages 257
258#define __NR_set_tid_address 258
259#define __NR_timer_create 259
260#define __NR_timer_settime32 (__NR_timer_create+1)
261#define __NR_timer_gettime32 (__NR_timer_create+2)
262#define __NR_timer_getoverrun (__NR_timer_create+3)
263#define __NR_timer_delete (__NR_timer_create+4)
264#define __NR_clock_settime32 (__NR_timer_create+5)
265#define __NR_clock_gettime32 (__NR_timer_create+6)
266#define __NR_clock_getres_time32 (__NR_timer_create+7)
267#define __NR_clock_nanosleep_time32 (__NR_timer_create+8)
268#define __NR_statfs64 268
269#define __NR_fstatfs64 269
270#define __NR_tgkill 270
271#define __NR_utimes 271
272#define __NR_fadvise64_64 272
273#define __NR_vserver 273
274#define __NR_mbind 274
275#define __NR_get_mempolicy 275
276#define __NR_set_mempolicy 276
277#define __NR_mq_open 277
278#define __NR_mq_unlink (__NR_mq_open+1)
279#define __NR_mq_timedsend (__NR_mq_open+2)
280#define __NR_mq_timedreceive (__NR_mq_open+3)
281#define __NR_mq_notify (__NR_mq_open+4)
282#define __NR_mq_getsetattr (__NR_mq_open+5)
283#define __NR_kexec_load 283
284#define __NR_waitid 284
285/* #define __NR_sys_setaltroot 285 */
286#define __NR_add_key 286
287#define __NR_request_key 287
288#define __NR_keyctl 288
289#define __NR_ioprio_set 289
290#define __NR_ioprio_get 290
291#define __NR_inotify_init 291
292#define __NR_inotify_add_watch 292
293#define __NR_inotify_rm_watch 293
294#define __NR_migrate_pages 294
295#define __NR_openat 295
296#define __NR_mkdirat 296
297#define __NR_mknodat 297
298#define __NR_fchownat 298
299#define __NR_futimesat 299
300#define __NR_fstatat64 300
301#define __NR_unlinkat 301
302#define __NR_renameat 302
303#define __NR_linkat 303
304#define __NR_symlinkat 304
305#define __NR_readlinkat 305
306#define __NR_fchmodat 306
307#define __NR_faccessat 307
308#define __NR_pselect6 308
309#define __NR_ppoll 309
310#define __NR_unshare 310
311#define __NR_set_robust_list 311
312#define __NR_get_robust_list 312
313#define __NR_splice 313
314#define __NR_sync_file_range 314
315#define __NR_tee 315
316#define __NR_vmsplice 316
317#define __NR_move_pages 317
318#define __NR_getcpu 318
319#define __NR_epoll_pwait 319
320#define __NR_utimensat 320
321#define __NR_signalfd 321
322#define __NR_timerfd_create 322
323#define __NR_eventfd 323
324#define __NR_fallocate 324
325#define __NR_timerfd_settime32 325
326#define __NR_timerfd_gettime32 326
327#define __NR_signalfd4 327
328#define __NR_eventfd2 328
329#define __NR_epoll_create1 329
330#define __NR_dup3 330
331#define __NR_pipe2 331
332#define __NR_inotify_init1 332
333#define __NR_preadv 333
334#define __NR_pwritev 334
335#define __NR_rt_tgsigqueueinfo 335
336#define __NR_perf_event_open 336
337#define __NR_recvmmsg 337
338#define __NR_fanotify_init 338
339#define __NR_fanotify_mark 339
340#define __NR_prlimit64 340
341#define __NR_name_to_handle_at 341
342#define __NR_open_by_handle_at 342
343#define __NR_clock_adjtime 343
344#define __NR_syncfs 344
345#define __NR_sendmmsg 345
346#define __NR_setns 346
347#define __NR_process_vm_readv 347
348#define __NR_process_vm_writev 348
349#define __NR_kcmp 349
350#define __NR_finit_module 350
351#define __NR_sched_setattr 351
352#define __NR_sched_getattr 352
353#define __NR_renameat2 353
354#define __NR_seccomp 354
355#define __NR_getrandom 355
356#define __NR_memfd_create 356
357#define __NR_bpf 357
358#define __NR_execveat 358
359#define __NR_socket 359
360#define __NR_socketpair 360
361#define __NR_bind 361
362#define __NR_connect 362
363#define __NR_listen 363
364#define __NR_accept4 364
365#define __NR_getsockopt 365
366#define __NR_setsockopt 366
367#define __NR_getsockname 367
368#define __NR_getpeername 368
369#define __NR_sendto 369
370#define __NR_sendmsg 370
371#define __NR_recvfrom 371
372#define __NR_recvmsg 372
373#define __NR_shutdown 373
374#define __NR_userfaultfd 374
375#define __NR_membarrier 375
376#define __NR_mlock2 376
377#define __NR_copy_file_range 377
378#define __NR_preadv2 378
379#define __NR_pwritev2 379
380#define __NR_pkey_mprotect 380
381#define __NR_pkey_alloc 381
382#define __NR_pkey_free 382
383#define __NR_statx 383
384#define __NR_arch_prctl 384
385#define __NR_io_pgetevents 385
386#define __NR_rseq 386
387#define __NR_semget 393
388#define __NR_semctl 394
389#define __NR_shmget 395
390#define __NR_shmctl 396
391#define __NR_shmat 397
392#define __NR_shmdt 398
393#define __NR_msgget 399
394#define __NR_msgsnd 400
395#define __NR_msgrcv 401
396#define __NR_msgctl 402
397#define __NR_clock_gettime64 403
398#define __NR_clock_settime64 404
399#define __NR_clock_adjtime64 405
400#define __NR_clock_getres_time64 406
401#define __NR_clock_nanosleep_time64 407
402#define __NR_timer_gettime64 408
403#define __NR_timer_settime64 409
404#define __NR_timerfd_gettime64 410
405#define __NR_timerfd_settime64 411
406#define __NR_utimensat_time64 412
407#define __NR_pselect6_time64 413
408#define __NR_ppoll_time64 414
409#define __NR_io_pgetevents_time64 416
410#define __NR_recvmmsg_time64 417
411#define __NR_mq_timedsend_time64 418
412#define __NR_mq_timedreceive_time64 419
413#define __NR_semtimedop_time64 420
414#define __NR_rt_sigtimedwait_time64 421
415#define __NR_futex_time64 422
416#define __NR_sched_rr_get_interval_time64 423
417#define __NR_pidfd_send_signal 424
418#define __NR_io_uring_setup 425
419#define __NR_io_uring_enter 426
420#define __NR_io_uring_register 427
421#define __NR_open_tree 428
422#define __NR_move_mount 429
423#define __NR_fsopen 430
424#define __NR_fsconfig 431
425#define __NR_fsmount 432
426#define __NR_fspick 433
427#define __NR_pidfd_open 434
428#define __NR_clone3 435
429#define __NR_close_range 436
430#define __NR_openat2 437
431#define __NR_pidfd_getfd 438
432#define __NR_faccessat2 439
433#define __NR_process_madvise 440
434#define __NR_epoll_pwait2 441
435#define __NR_mount_setattr 442
436#define __NR_landlock_create_ruleset 444
437#define __NR_landlock_add_rule 445
438#define __NR_landlock_restrict_self 446
439
440#define SYS_restart_syscall 0
441#define SYS_exit 1
442#define SYS_fork 2
443#define SYS_read 3
444#define SYS_write 4
445#define SYS_open 5
446#define SYS_close 6
447#define SYS_waitpid 7
448#define SYS_creat 8
449#define SYS_link 9
450#define SYS_unlink 10
451#define SYS_execve 11
452#define SYS_chdir 12
453#define SYS_time 13
454#define SYS_mknod 14
455#define SYS_chmod 15
456#define SYS_lchown 16
457#define SYS_break 17
458#define SYS_oldstat 18
459#define SYS_lseek 19
460#define SYS_getpid 20
461#define SYS_mount 21
462#define SYS_umount 22
463#define SYS_setuid 23
464#define SYS_getuid 24
465#define SYS_stime 25
466#define SYS_ptrace 26
467#define SYS_alarm 27
468#define SYS_oldfstat 28
469#define SYS_pause 29
470#define SYS_utime 30
471#define SYS_stty 31
472#define SYS_gtty 32
473#define SYS_access 33
474#define SYS_nice 34
475#define SYS_ftime 35
476#define SYS_sync 36
477#define SYS_kill 37
478#define SYS_rename 38
479#define SYS_mkdir 39
480#define SYS_rmdir 40
481#define SYS_dup 41
482#define SYS_pipe 42
483#define SYS_times 43
484#define SYS_prof 44
485#define SYS_brk 45
486#define SYS_setgid 46
487#define SYS_getgid 47
488#define SYS_signal 48
489#define SYS_geteuid 49
490#define SYS_getegid 50
491#define SYS_acct 51
492#define SYS_umount2 52
493#define SYS_lock 53
494#define SYS_ioctl 54
495#define SYS_fcntl 55
496#define SYS_mpx 56
497#define SYS_setpgid 57
498#define SYS_ulimit 58
499#define SYS_oldolduname 59
500#define SYS_umask 60
501#define SYS_chroot 61
502#define SYS_ustat 62
503#define SYS_dup2 63
504#define SYS_getppid 64
505#define SYS_getpgrp 65
506#define SYS_setsid 66
507#define SYS_sigaction 67
508#define SYS_sgetmask 68
509#define SYS_ssetmask 69
510#define SYS_setreuid 70
511#define SYS_setregid 71
512#define SYS_sigsuspend 72
513#define SYS_sigpending 73
514#define SYS_sethostname 74
515#define SYS_setrlimit 75
516#define SYS_getrlimit 76 /* Back compatible 2Gig limited rlimit */
517#define SYS_getrusage 77
518#define SYS_gettimeofday_time32 78
519#define SYS_settimeofday_time32 79
520#define SYS_getgroups 80
521#define SYS_setgroups 81
522#define SYS_select 82
523#define SYS_symlink 83
524#define SYS_oldlstat 84
525#define SYS_readlink 85
526#define SYS_uselib 86
527#define SYS_swapon 87
528#define SYS_reboot 88
529#define SYS_readdir 89
530#define SYS_mmap 90
531#define SYS_munmap 91
532#define SYS_truncate 92
533#define SYS_ftruncate 93
534#define SYS_fchmod 94
535#define SYS_fchown 95
536#define SYS_getpriority 96
537#define SYS_setpriority 97
538#define SYS_profil 98
539#define SYS_statfs 99
540#define SYS_fstatfs 100
541#define SYS_ioperm 101
542#define SYS_socketcall 102
543#define SYS_syslog 103
544#define SYS_setitimer 104
545#define SYS_getitimer 105
546#define SYS_stat 106
547#define SYS_lstat 107
548#define SYS_fstat 108
549#define SYS_olduname 109
550#define SYS_iopl 110
551#define SYS_vhangup 111
552#define SYS_idle 112
553#define SYS_vm86old 113
554#define SYS_wait4 114
555#define SYS_swapoff 115
556#define SYS_sysinfo 116
557#define SYS_ipc 117
558#define SYS_fsync 118
559#define SYS_sigreturn 119
560#define SYS_clone 120
561#define SYS_setdomainname 121
562#define SYS_uname 122
563#define SYS_modify_ldt 123
564#define SYS_adjtimex 124
565#define SYS_mprotect 125
566#define SYS_sigprocmask 126
567#define SYS_create_module 127
568#define SYS_init_module 128
569#define SYS_delete_module 129
570#define SYS_get_kernel_syms 130
571#define SYS_quotactl 131
572#define SYS_getpgid 132
573#define SYS_fchdir 133
574#define SYS_bdflush 134
575#define SYS_sysfs 135
576#define SYS_personality 136
577#define SYS_afs_syscall 137
578#define SYS_setfsuid 138
579#define SYS_setfsgid 139
580#define SYS__llseek 140
581#define SYS_getdents 141
582#define SYS__newselect 142
583#define SYS_flock 143
584#define SYS_msync 144
585#define SYS_readv 145
586#define SYS_writev 146
587#define SYS_getsid 147
588#define SYS_fdatasync 148
589#define SYS__sysctl 149
590#define SYS_mlock 150
591#define SYS_munlock 151
592#define SYS_mlockall 152
593#define SYS_munlockall 153
594#define SYS_sched_setparam 154
595#define SYS_sched_getparam 155
596#define SYS_sched_setscheduler 156
597#define SYS_sched_getscheduler 157
598#define SYS_sched_yield 158
599#define SYS_sched_get_priority_max 159
600#define SYS_sched_get_priority_min 160
601#define SYS_sched_rr_get_interval 161
602#define SYS_nanosleep 162
603#define SYS_mremap 163
604#define SYS_setresuid 164
605#define SYS_getresuid 165
606#define SYS_vm86 166
607#define SYS_query_module 167
608#define SYS_poll 168
609#define SYS_nfsservctl 169
610#define SYS_setresgid 170
611#define SYS_getresgid 171
612#define SYS_prctl 172
613#define SYS_rt_sigreturn 173
614#define SYS_rt_sigaction 174
615#define SYS_rt_sigprocmask 175
616#define SYS_rt_sigpending 176
617#define SYS_rt_sigtimedwait 177
618#define SYS_rt_sigqueueinfo 178
619#define SYS_rt_sigsuspend 179
620#define SYS_pread64 180
621#define SYS_pwrite64 181
622#define SYS_chown 182
623#define SYS_getcwd 183
624#define SYS_capget 184
625#define SYS_capset 185
626#define SYS_sigaltstack 186
627#define SYS_sendfile 187
628#define SYS_getpmsg 188
629#define SYS_putpmsg 189
630#define SYS_vfork 190
631#define SYS_ugetrlimit 191
632#define SYS_mmap2 192
633#define SYS_truncate64 193
634#define SYS_ftruncate64 194
635#define SYS_stat64 195
636#define SYS_lstat64 196
637#define SYS_fstat64 197
638#define SYS_lchown32 198
639#define SYS_getuid32 199
640#define SYS_getgid32 200
641#define SYS_geteuid32 201
642#define SYS_getegid32 202
643#define SYS_setreuid32 203
644#define SYS_setregid32 204
645#define SYS_getgroups32 205
646#define SYS_setgroups32 206
647#define SYS_fchown32 207
648#define SYS_setresuid32 208
649#define SYS_getresuid32 209
650#define SYS_setresgid32 210
651#define SYS_getresgid32 211
652#define SYS_chown32 212
653#define SYS_setuid32 213
654#define SYS_setgid32 214
655#define SYS_setfsuid32 215
656#define SYS_setfsgid32 216
657#define SYS_pivot_root 217
658#define SYS_mincore 218
659#define SYS_madvise 219
660#define SYS_getdents64 220
661#define SYS_fcntl64 221
662#define SYS_gettid 224
663#define SYS_readahead 225
664#define SYS_setxattr 226
665#define SYS_lsetxattr 227
666#define SYS_fsetxattr 228
667#define SYS_getxattr 229
668#define SYS_lgetxattr 230
669#define SYS_fgetxattr 231
670#define SYS_listxattr 232
671#define SYS_llistxattr 233
672#define SYS_flistxattr 234
673#define SYS_removexattr 235
674#define SYS_lremovexattr 236
675#define SYS_fremovexattr 237
676#define SYS_tkill 238
677#define SYS_sendfile64 239
678#define SYS_futex 240
679#define SYS_sched_setaffinity 241
680#define SYS_sched_getaffinity 242
681#define SYS_set_thread_area 243
682#define SYS_get_thread_area 244
683#define SYS_io_setup 245
684#define SYS_io_destroy 246
685#define SYS_io_getevents 247
686#define SYS_io_submit 248
687#define SYS_io_cancel 249
688#define SYS_fadvise64 250
689#define SYS_exit_group 252
690#define SYS_lookup_dcookie 253
691#define SYS_epoll_create 254
692#define SYS_epoll_ctl 255
693#define SYS_epoll_wait 256
694#define SYS_remap_file_pages 257
695#define SYS_set_tid_address 258
696#define SYS_timer_create 259
697#define SYS_timer_settime32 (__NR_timer_create+1)
698#define SYS_timer_gettime32 (__NR_timer_create+2)
699#define SYS_timer_getoverrun (__NR_timer_create+3)
700#define SYS_timer_delete (__NR_timer_create+4)
701#define SYS_clock_settime32 (__NR_timer_create+5)
702#define SYS_clock_gettime32 (__NR_timer_create+6)
703#define SYS_clock_getres_time32 (__NR_timer_create+7)
704#define SYS_clock_nanosleep_time32 (__NR_timer_create+8)
705#define SYS_statfs64 268
706#define SYS_fstatfs64 269
707#define SYS_tgkill 270
708#define SYS_utimes 271
709#define SYS_fadvise64_64 272
710#define SYS_vserver 273
711#define SYS_mbind 274
712#define SYS_get_mempolicy 275
713#define SYS_set_mempolicy 276
714#define SYS_mq_open 277
715#define SYS_mq_unlink (__NR_mq_open+1)
716#define SYS_mq_timedsend (__NR_mq_open+2)
717#define SYS_mq_timedreceive (__NR_mq_open+3)
718#define SYS_mq_notify (__NR_mq_open+4)
719#define SYS_mq_getsetattr (__NR_mq_open+5)
720#define SYS_kexec_load 283
721#define SYS_waitid 284
722/* #define SYS_sys_setaltroot 285 */
723#define SYS_add_key 286
724#define SYS_request_key 287
725#define SYS_keyctl 288
726#define SYS_ioprio_set 289
727#define SYS_ioprio_get 290
728#define SYS_inotify_init 291
729#define SYS_inotify_add_watch 292
730#define SYS_inotify_rm_watch 293
731#define SYS_migrate_pages 294
732#define SYS_openat 295
733#define SYS_mkdirat 296
734#define SYS_mknodat 297
735#define SYS_fchownat 298
736#define SYS_futimesat 299
737#define SYS_fstatat64 300
738#define SYS_unlinkat 301
739#define SYS_renameat 302
740#define SYS_linkat 303
741#define SYS_symlinkat 304
742#define SYS_readlinkat 305
743#define SYS_fchmodat 306
744#define SYS_faccessat 307
745#define SYS_pselect6 308
746#define SYS_ppoll 309
747#define SYS_unshare 310
748#define SYS_set_robust_list 311
749#define SYS_get_robust_list 312
750#define SYS_splice 313
751#define SYS_sync_file_range 314
752#define SYS_tee 315
753#define SYS_vmsplice 316
754#define SYS_move_pages 317
755#define SYS_getcpu 318
756#define SYS_epoll_pwait 319
757#define SYS_utimensat 320
758#define SYS_signalfd 321
759#define SYS_timerfd_create 322
760#define SYS_eventfd 323
761#define SYS_fallocate 324
762#define SYS_timerfd_settime32 325
763#define SYS_timerfd_gettime32 326
764#define SYS_signalfd4 327
765#define SYS_eventfd2 328
766#define SYS_epoll_create1 329
767#define SYS_dup3 330
768#define SYS_pipe2 331
769#define SYS_inotify_init1 332
770#define SYS_preadv 333
771#define SYS_pwritev 334
772#define SYS_rt_tgsigqueueinfo 335
773#define SYS_perf_event_open 336
774#define SYS_recvmmsg 337
775#define SYS_fanotify_init 338
776#define SYS_fanotify_mark 339
777#define SYS_prlimit64 340
778#define SYS_name_to_handle_at 341
779#define SYS_open_by_handle_at 342
780#define SYS_clock_adjtime 343
781#define SYS_syncfs 344
782#define SYS_sendmmsg 345
783#define SYS_setns 346
784#define SYS_process_vm_readv 347
785#define SYS_process_vm_writev 348
786#define SYS_kcmp 349
787#define SYS_finit_module 350
788#define SYS_sched_setattr 351
789#define SYS_sched_getattr 352
790#define SYS_renameat2 353
791#define SYS_seccomp 354
792#define SYS_getrandom 355
793#define SYS_memfd_create 356
794#define SYS_bpf 357
795#define SYS_execveat 358
796#define SYS_socket 359
797#define SYS_socketpair 360
798#define SYS_bind 361
799#define SYS_connect 362
800#define SYS_listen 363
801#define SYS_accept4 364
802#define SYS_getsockopt 365
803#define SYS_setsockopt 366
804#define SYS_getsockname 367
805#define SYS_getpeername 368
806#define SYS_sendto 369
807#define SYS_sendmsg 370
808#define SYS_recvfrom 371
809#define SYS_recvmsg 372
810#define SYS_shutdown 373
811#define SYS_userfaultfd 374
812#define SYS_membarrier 375
813#define SYS_mlock2 376
814#define SYS_copy_file_range 377
815#define SYS_preadv2 378
816#define SYS_pwritev2 379
817#define SYS_pkey_mprotect 380
818#define SYS_pkey_alloc 381
819#define SYS_pkey_free 382
820#define SYS_statx 383
821#define SYS_arch_prctl 384
822#define SYS_io_pgetevents 385
823#define SYS_rseq 386
824#define SYS_semget 393
825#define SYS_semctl 394
826#define SYS_shmget 395
827#define SYS_shmctl 396
828#define SYS_shmat 397
829#define SYS_shmdt 398
830#define SYS_msgget 399
831#define SYS_msgsnd 400
832#define SYS_msgrcv 401
833#define SYS_msgctl 402
834#define SYS_clock_gettime64 403
835#define SYS_clock_settime64 404
836#define SYS_clock_adjtime64 405
837#define SYS_clock_getres_time64 406
838#define SYS_clock_nanosleep_time64 407
839#define SYS_timer_gettime64 408
840#define SYS_timer_settime64 409
841#define SYS_timerfd_gettime64 410
842#define SYS_timerfd_settime64 411
843#define SYS_utimensat_time64 412
844#define SYS_pselect6_time64 413
845#define SYS_ppoll_time64 414
846#define SYS_io_pgetevents_time64 416
847#define SYS_recvmmsg_time64 417
848#define SYS_mq_timedsend_time64 418
849#define SYS_mq_timedreceive_time64 419
850#define SYS_semtimedop_time64 420
851#define SYS_rt_sigtimedwait_time64 421
852#define SYS_futex_time64 422
853#define SYS_sched_rr_get_interval_time64 423
854#define SYS_pidfd_send_signal 424
855#define SYS_io_uring_setup 425
856#define SYS_io_uring_enter 426
857#define SYS_io_uring_register 427
858#define SYS_open_tree 428
859#define SYS_move_mount 429
860#define SYS_fsopen 430
861#define SYS_fsconfig 431
862#define SYS_fsmount 432
863#define SYS_fspick 433
864#define SYS_pidfd_open 434
865#define SYS_clone3 435
866#define SYS_close_range 436
867#define SYS_openat2 437
868#define SYS_pidfd_getfd 438
869#define SYS_faccessat2 439
870#define SYS_process_madvise 440
871#define SYS_epoll_pwait2 441
872#define SYS_mount_setattr 442
873#define SYS_landlock_create_ruleset 444
874#define SYS_landlock_add_rule 445
875#define SYS_landlock_restrict_self 446
\ No newline at end of file
lib/libc/include/x86-linux-musl/bits/user.h created+44
...@@ -0,0 +1,44 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3
4typedef struct user_fpregs_struct {
5 long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
6} elf_fpregset_t;
7
8typedef struct user_fpxregs_struct {
9 unsigned short cwd, swd, twd, fop;
10 long fip, fcs, foo, fos, mxcsr, reserved;
11 long st_space[32], xmm_space[32], padding[56];
12} elf_fpxregset_t;
13
14struct user_regs_struct {
15 long ebx, ecx, edx, esi, edi, ebp, eax, xds, xes, xfs, xgs;
16 long orig_eax, eip, xcs, eflags, esp, xss;
17};
18
19#define ELF_NGREG 17
20typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
21
22struct user {
23 struct user_regs_struct regs;
24 int u_fpvalid;
25 struct user_fpregs_struct i387;
26 unsigned long u_tsize;
27 unsigned long u_dsize;
28 unsigned long u_ssize;
29 unsigned long start_code;
30 unsigned long start_stack;
31 long signal;
32 int reserved;
33 struct user_regs_struct *u_ar0;
34 struct user_fpregs_struct *u_fpstate;
35 unsigned long magic;
36 char u_comm[32];
37 int u_debugreg[8];
38};
39
40#define PAGE_MASK (~(PAGESIZE-1))
41#define NBPG PAGESIZE
42#define UPAGES 1
43#define HOST_TEXT_START_ADDR (u.start_code)
44#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
\ No newline at end of file
lib/libc/musl/arch/arm/syscall_arch.h+7
...@@ -101,3 +101,10 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo...@@ -101,3 +101,10 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
101#define SYSCALL_FADVISE_6_ARG101#define SYSCALL_FADVISE_6_ARG
102102
103#define SYSCALL_IPC_BROKEN_MODE103#define SYSCALL_IPC_BROKEN_MODE
104
105#define VDSO_USEFUL
106#define VDSO_CGT32_SYM "__vdso_clock_gettime"
107#define VDSO_CGT32_VER "LINUX_2.6"
108#define VDSO_CGT_SYM "__vdso_clock_gettime64"
109#define VDSO_CGT_VER "LINUX_2.6"
110#define VDSO_CGT_WORKAROUND 1
lib/libc/musl/arch/i386/arch.mak deleted-1
...@@ -1 +0,0 @@
1COMPAT_SRC_DIRS = compat/time32
lib/libc/musl/arch/m68k/arch.mak deleted-1
...@@ -1 +0,0 @@
1COMPAT_SRC_DIRS = compat/time32
lib/libc/musl/arch/mips/arch.mak deleted-1
...@@ -1 +0,0 @@
1COMPAT_SRC_DIRS = compat/time32
lib/libc/musl/arch/mips/bits/signal.h-1
...@@ -66,7 +66,6 @@ typedef struct __ucontext {...@@ -66,7 +66,6 @@ typedef struct __ucontext {
66#define SA_RESTART 0x1000000066#define SA_RESTART 0x10000000
67#define SA_NODEFER 0x4000000067#define SA_NODEFER 0x40000000
68#define SA_RESETHAND 0x8000000068#define SA_RESETHAND 0x80000000
69#define SA_RESTORER 0x04000000
7069
71#undef SIG_BLOCK70#undef SIG_BLOCK
72#undef SIG_UNBLOCK71#undef SIG_UNBLOCK
lib/libc/musl/arch/mips/ksigaction.h+1-4
...@@ -4,10 +4,7 @@ struct k_sigaction {...@@ -4,10 +4,7 @@ struct k_sigaction {
4 unsigned flags;4 unsigned flags;
5 void (*handler)(int);5 void (*handler)(int);
6 unsigned long mask[4];6 unsigned long mask[4];
7 /* The following field is past the end of the structure the7 void *unused;
8 * kernel will read or write, and exists only to avoid having
9 * mips-specific preprocessor conditionals in sigaction.c. */
10 void (*restorer)();
11};8};
129
13hidden void __restore(), __restore_rt();10hidden void __restore(), __restore_rt();
lib/libc/musl/arch/mips/reloc.h+1
...@@ -29,6 +29,7 @@...@@ -29,6 +29,7 @@
2929
30#define NEED_MIPS_GOT_RELOCS 130#define NEED_MIPS_GOT_RELOCS 1
31#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP31#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
32#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL
32#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))33#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
3334
34#define CRTJMP(pc,sp) __asm__ __volatile__( \35#define CRTJMP(pc,sp) __asm__ __volatile__( \
lib/libc/musl/arch/mips64/bits/signal.h-1
...@@ -85,7 +85,6 @@ typedef struct __ucontext {...@@ -85,7 +85,6 @@ typedef struct __ucontext {
85#define SA_RESTART 0x1000000085#define SA_RESTART 0x10000000
86#define SA_NODEFER 0x4000000086#define SA_NODEFER 0x40000000
87#define SA_RESETHAND 0x8000000087#define SA_RESETHAND 0x80000000
88#define SA_RESTORER 0x04000000
8988
90#undef SIG_BLOCK89#undef SIG_BLOCK
91#undef SIG_UNBLOCK90#undef SIG_UNBLOCK
lib/libc/musl/arch/mips64/ksigaction.h+1-1
...@@ -4,7 +4,7 @@ struct k_sigaction {...@@ -4,7 +4,7 @@ struct k_sigaction {
4 unsigned flags;4 unsigned flags;
5 void (*handler)(int);5 void (*handler)(int);
6 unsigned long mask[2];6 unsigned long mask[2];
7 void (*restorer)();7 void *unused;
8};8};
99
10hidden void __restore(), __restore_rt();10hidden void __restore(), __restore_rt();
lib/libc/musl/arch/mips64/reloc.h+1
...@@ -38,6 +38,7 @@...@@ -38,6 +38,7 @@
3838
39#define NEED_MIPS_GOT_RELOCS 139#define NEED_MIPS_GOT_RELOCS 1
40#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP40#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
41#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL
41#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))42#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
4243
43#define CRTJMP(pc,sp) __asm__ __volatile__( \44#define CRTJMP(pc,sp) __asm__ __volatile__( \
lib/libc/musl/arch/powerpc/arch.mak deleted-1
...@@ -1 +0,0 @@
1COMPAT_SRC_DIRS = compat/time32
lib/libc/musl/arch/riscv64/bits/signal.h-1
...@@ -76,7 +76,6 @@ typedef struct __ucontext...@@ -76,7 +76,6 @@ typedef struct __ucontext
76#define SA_RESTART 0x1000000076#define SA_RESTART 0x10000000
77#define SA_NODEFER 0x4000000077#define SA_NODEFER 0x40000000
78#define SA_RESETHAND 0x8000000078#define SA_RESETHAND 0x80000000
79#define SA_RESTORER 0x04000000
8079
81#endif80#endif
8281
lib/libc/musl/compat/time32/__xstat.c+4-4
...@@ -3,22 +3,22 @@...@@ -3,22 +3,22 @@
33
4struct stat32;4struct stat32;
55
6int __fxstat64(int ver, int fd, struct stat32 *buf)6int __fxstat(int ver, int fd, struct stat32 *buf)
7{7{
8 return __fstat_time32(fd, buf);8 return __fstat_time32(fd, buf);
9}9}
1010
11int __fxstatat64(int ver, int fd, const char *path, struct stat32 *buf, int flag)11int __fxstatat(int ver, int fd, const char *path, struct stat32 *buf, int flag)
12{12{
13 return __fstatat_time32(fd, path, buf, flag);13 return __fstatat_time32(fd, path, buf, flag);
14}14}
1515
16int __lxstat64(int ver, const char *path, struct stat32 *buf)16int __lxstat(int ver, const char *path, struct stat32 *buf)
17{17{
18 return __lstat_time32(path, buf);18 return __lstat_time32(path, buf);
19}19}
2020
21int __xstat64(int ver, const char *path, struct stat32 *buf)21int __xstat(int ver, const char *path, struct stat32 *buf)
22{22{
23 return __stat_time32(path, buf);23 return __stat_time32(path, buf);
24}24}
lib/libc/musl/compat/time32/aio_suspend_time32.c-2
...@@ -7,5 +7,3 @@ int __aio_suspend_time32(const struct aiocb *const cbs[], int cnt, const struct...@@ -7,5 +7,3 @@ int __aio_suspend_time32(const struct aiocb *const cbs[], int cnt, const struct
7 return aio_suspend(cbs, cnt, ts32 ? (&(struct timespec){7 return aio_suspend(cbs, cnt, ts32 ? (&(struct timespec){
8 .tv_sec = ts32->tv_sec, .tv_nsec = ts32->tv_nsec}) : 0);8 .tv_sec = ts32->tv_sec, .tv_nsec = ts32->tv_nsec}) : 0);
9}9}
10
11weak_alias(aio_suspend, aio_suspend64);
lib/libc/musl/compat/time32/fstat_time32.c-2
...@@ -13,5 +13,3 @@ int __fstat_time32(int fd, struct stat32 *restrict st32)...@@ -13,5 +13,3 @@ int __fstat_time32(int fd, struct stat32 *restrict st32)
13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
14 return r;14 return r;
15}15}
16
17weak_alias(fstat, fstat64);
lib/libc/musl/compat/time32/fstatat_time32.c-2
...@@ -13,5 +13,3 @@ int __fstatat_time32(int fd, const char *restrict path, struct stat32 *restrict...@@ -13,5 +13,3 @@ int __fstatat_time32(int fd, const char *restrict path, struct stat32 *restrict
13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
14 return r;14 return r;
15}15}
16
17weak_alias(fstatat, fstatat64);
lib/libc/musl/compat/time32/lstat_time32.c-2
...@@ -13,5 +13,3 @@ int __lstat_time32(const char *restrict path, struct stat32 *restrict st32)...@@ -13,5 +13,3 @@ int __lstat_time32(const char *restrict path, struct stat32 *restrict st32)
13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
14 return r;14 return r;
15}15}
16
17weak_alias(lstat, lstat64);
lib/libc/musl/compat/time32/stat_time32.c-2
...@@ -13,5 +13,3 @@ int __stat_time32(const char *restrict path, struct stat32 *restrict st32)...@@ -13,5 +13,3 @@ int __stat_time32(const char *restrict path, struct stat32 *restrict st32)
13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));13 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
14 return r;14 return r;
15}15}
16
17weak_alias(stat, stat64);
lib/libc/musl/include/aio.h+1-1
...@@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *);...@@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *);
4949
50int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);50int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
5151
52#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)52#if defined(_LARGEFILE64_SOURCE)
53#define aiocb64 aiocb53#define aiocb64 aiocb
54#define aio_read64 aio_read54#define aio_read64 aio_read
55#define aio_write64 aio_write55#define aio_write64 aio_write
lib/libc/musl/include/arpa/nameser.h+71
...@@ -188,6 +188,36 @@ typedef enum __ns_type {...@@ -188,6 +188,36 @@ typedef enum __ns_type {
188 ns_t_sink = 40,188 ns_t_sink = 40,
189 ns_t_opt = 41,189 ns_t_opt = 41,
190 ns_t_apl = 42,190 ns_t_apl = 42,
191 ns_t_ds = 43,
192 ns_t_sshfp = 44,
193 ns_t_ipseckey = 45,
194 ns_t_rrsig = 46,
195 ns_t_nsec = 47,
196 ns_t_dnskey = 48,
197 ns_t_dhcid = 49,
198 ns_t_nsec3 = 50,
199 ns_t_nsec3param = 51,
200 ns_t_tlsa = 52,
201 ns_t_smimea = 53,
202 ns_t_hip = 55,
203 ns_t_ninfo = 56,
204 ns_t_rkey = 57,
205 ns_t_talink = 58,
206 ns_t_cds = 59,
207 ns_t_cdnskey = 60,
208 ns_t_openpgpkey = 61,
209 ns_t_csync = 62,
210 ns_t_spf = 99,
211 ns_t_uinfo = 100,
212 ns_t_uid = 101,
213 ns_t_gid = 102,
214 ns_t_unspec = 103,
215 ns_t_nid = 104,
216 ns_t_l32 = 105,
217 ns_t_l64 = 106,
218 ns_t_lp = 107,
219 ns_t_eui48 = 108,
220 ns_t_eui64 = 109,
191 ns_t_tkey = 249,221 ns_t_tkey = 249,
192 ns_t_tsig = 250,222 ns_t_tsig = 250,
193 ns_t_ixfr = 251,223 ns_t_ixfr = 251,
...@@ -196,6 +226,11 @@ typedef enum __ns_type {...@@ -196,6 +226,11 @@ typedef enum __ns_type {
196 ns_t_maila = 254,226 ns_t_maila = 254,
197 ns_t_any = 255,227 ns_t_any = 255,
198 ns_t_zxfr = 256,228 ns_t_zxfr = 256,
229 ns_t_uri = 256,
230 ns_t_caa = 257,
231 ns_t_avc = 258,
232 ns_t_ta = 32768,
233 ns_t_dlv = 32769,
199 ns_t_max = 65536234 ns_t_max = 65536
200} ns_type;235} ns_type;
201236
...@@ -430,12 +465,48 @@ typedef struct {...@@ -430,12 +465,48 @@ typedef struct {
430#define T_NAPTR ns_t_naptr465#define T_NAPTR ns_t_naptr
431#define T_A6 ns_t_a6466#define T_A6 ns_t_a6
432#define T_DNAME ns_t_dname467#define T_DNAME ns_t_dname
468#define T_DS ns_t_ds
469#define T_SSHFP ns_t_sshfp
470#define T_IPSECKEY ns_t_ipseckey
471#define T_RRSIG ns_t_rrsig
472#define T_NSEC ns_t_nsec
473#define T_DNSKEY ns_t_dnskey
474#define T_DHCID ns_t_dhcid
475#define T_NSEC3 ns_t_nsec3
476#define T_NSEC3PARAM ns_t_nsec3param
477#define T_TLSA ns_t_tlsa
478#define T_SMIMEA ns_t_smimea
479#define T_HIP ns_t_hip
480#define T_NINFO ns_t_ninfo
481#define T_RKEY ns_t_rkey
482#define T_TALINK ns_t_talink
483#define T_CDS ns_t_cds
484#define T_CDNSKEY ns_t_cdnskey
485#define T_OPENPGPKEY ns_t_openpgpkey
486#define T_CSYNC ns_t_csync
487#define T_SPF ns_t_spf
488#define T_UINFO ns_t_uinfo
489#define T_UID ns_t_uid
490#define T_GID ns_t_gid
491#define T_UNSPEC ns_t_unspec
492#define T_NID ns_t_nid
493#define T_L32 ns_t_l32
494#define T_L64 ns_t_l64
495#define T_LP ns_t_lp
496#define T_EUI48 ns_t_eui48
497#define T_EUI64 ns_t_eui64
498#define T_TKEY ns_t_tkey
433#define T_TSIG ns_t_tsig499#define T_TSIG ns_t_tsig
434#define T_IXFR ns_t_ixfr500#define T_IXFR ns_t_ixfr
435#define T_AXFR ns_t_axfr501#define T_AXFR ns_t_axfr
436#define T_MAILB ns_t_mailb502#define T_MAILB ns_t_mailb
437#define T_MAILA ns_t_maila503#define T_MAILA ns_t_maila
438#define T_ANY ns_t_any504#define T_ANY ns_t_any
505#define T_URI ns_t_uri
506#define T_CAA ns_t_caa
507#define T_AVC ns_t_avc
508#define T_TA ns_t_ta
509#define T_DLV ns_t_dlv
439510
440#define C_IN ns_c_in511#define C_IN ns_c_in
441#define C_CHAOS ns_c_chaos512#define C_CHAOS ns_c_chaos
lib/libc/musl/include/dirent.h+1-1
...@@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t);...@@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t);
56int versionsort(const struct dirent **, const struct dirent **);56int versionsort(const struct dirent **, const struct dirent **);
57#endif57#endif
5858
59#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)59#if defined(_LARGEFILE64_SOURCE)
60#define dirent64 dirent60#define dirent64 dirent
61#define readdir64 readdir61#define readdir64 readdir
62#define readdir64_r readdir_r62#define readdir64_r readdir_r
lib/libc/musl/include/elf.h+7-2
...@@ -385,7 +385,8 @@ typedef struct {...@@ -385,7 +385,8 @@ typedef struct {
385#define SHT_PREINIT_ARRAY 16385#define SHT_PREINIT_ARRAY 16
386#define SHT_GROUP 17386#define SHT_GROUP 17
387#define SHT_SYMTAB_SHNDX 18387#define SHT_SYMTAB_SHNDX 18
388#define SHT_NUM 19388#define SHT_RELR 19
389#define SHT_NUM 20
389#define SHT_LOOS 0x60000000390#define SHT_LOOS 0x60000000
390#define SHT_GNU_ATTRIBUTES 0x6ffffff5391#define SHT_GNU_ATTRIBUTES 0x6ffffff5
391#define SHT_GNU_HASH 0x6ffffff6392#define SHT_GNU_HASH 0x6ffffff6
...@@ -436,6 +437,7 @@ typedef struct {...@@ -436,6 +437,7 @@ typedef struct {
436} Elf64_Chdr;437} Elf64_Chdr;
437438
438#define ELFCOMPRESS_ZLIB 1439#define ELFCOMPRESS_ZLIB 1
440#define ELFCOMPRESS_ZSTD 2
439#define ELFCOMPRESS_LOOS 0x60000000441#define ELFCOMPRESS_LOOS 0x60000000
440#define ELFCOMPRESS_HIOS 0x6fffffff442#define ELFCOMPRESS_HIOS 0x6fffffff
441#define ELFCOMPRESS_LOPROC 0x70000000443#define ELFCOMPRESS_LOPROC 0x70000000
...@@ -754,7 +756,10 @@ typedef struct {...@@ -754,7 +756,10 @@ typedef struct {
754#define DT_PREINIT_ARRAY 32756#define DT_PREINIT_ARRAY 32
755#define DT_PREINIT_ARRAYSZ 33757#define DT_PREINIT_ARRAYSZ 33
756#define DT_SYMTAB_SHNDX 34758#define DT_SYMTAB_SHNDX 34
757#define DT_NUM 35759#define DT_RELRSZ 35
760#define DT_RELR 36
761#define DT_RELRENT 37
762#define DT_NUM 38
758#define DT_LOOS 0x6000000d763#define DT_LOOS 0x6000000d
759#define DT_HIOS 0x6ffff000764#define DT_HIOS 0x6ffff000
760#define DT_LOPROC 0x70000000765#define DT_LOPROC 0x70000000
lib/libc/musl/include/fcntl.h+1-1
...@@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned);...@@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned);
195#define loff_t off_t195#define loff_t off_t
196#endif196#endif
197197
198#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)198#if defined(_LARGEFILE64_SOURCE)
199#define F_GETLK64 F_GETLK199#define F_GETLK64 F_GETLK
200#define F_SETLK64 F_SETLK200#define F_SETLK64 F_SETLK
201#define F_SETLKW64 F_SETLKW201#define F_SETLKW64 F_SETLKW
lib/libc/musl/include/ftw.h+1-1
...@@ -29,7 +29,7 @@ struct FTW {...@@ -29,7 +29,7 @@ struct FTW {
29int ftw(const char *, int (*)(const char *, const struct stat *, int), int);29int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
30int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);30int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
3131
32#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)32#if defined(_LARGEFILE64_SOURCE)
33#define ftw64 ftw33#define ftw64 ftw
34#define nftw64 nftw34#define nftw64 nftw
35#endif35#endif
lib/libc/musl/include/glob.h+1-1
...@@ -39,7 +39,7 @@ void globfree(glob_t *);...@@ -39,7 +39,7 @@ void globfree(glob_t *);
39#define GLOB_NOMATCH 339#define GLOB_NOMATCH 3
40#define GLOB_NOSYS 440#define GLOB_NOSYS 4
4141
42#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)42#if defined(_LARGEFILE64_SOURCE)
43#define glob64 glob43#define glob64 glob
44#define globfree64 globfree44#define globfree64 globfree
45#define glob64_t glob_t45#define glob64_t glob_t
lib/libc/musl/include/netdb.h+1
...@@ -44,6 +44,7 @@ struct addrinfo {...@@ -44,6 +44,7 @@ struct addrinfo {
44#define EAI_NONAME -244#define EAI_NONAME -2
45#define EAI_AGAIN -345#define EAI_AGAIN -3
46#define EAI_FAIL -446#define EAI_FAIL -4
47#define EAI_NODATA -5
47#define EAI_FAMILY -648#define EAI_FAMILY -6
48#define EAI_SOCKTYPE -749#define EAI_SOCKTYPE -7
49#define EAI_SERVICE -850#define EAI_SERVICE -8
lib/libc/musl/include/sched.h+1-1
...@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)...@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)
124#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))124#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
125#define CPU_FREE(set) free(set)125#define CPU_FREE(set) free(set)
126126
127#define CPU_SETSIZE 128127#define CPU_SETSIZE 1024
128128
129#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)129#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
130#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)130#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
lib/libc/musl/include/stdio.h+1-1
...@@ -205,7 +205,7 @@ typedef struct _IO_cookie_io_functions_t {...@@ -205,7 +205,7 @@ typedef struct _IO_cookie_io_functions_t {
205FILE *fopencookie(void *, const char *, cookie_io_functions_t);205FILE *fopencookie(void *, const char *, cookie_io_functions_t);
206#endif206#endif
207207
208#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)208#if defined(_LARGEFILE64_SOURCE)
209#define tmpfile64 tmpfile209#define tmpfile64 tmpfile
210#define fopen64 fopen210#define fopen64 fopen
211#define freopen64 freopen211#define freopen64 freopen
lib/libc/musl/include/stdlib.h+2-2
...@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);...@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);
95#define WTERMSIG(s) ((s) & 0x7f)95#define WTERMSIG(s) ((s) & 0x7f)
96#define WSTOPSIG(s) WEXITSTATUS(s)96#define WSTOPSIG(s) WEXITSTATUS(s)
97#define WIFEXITED(s) (!WTERMSIG(s))97#define WIFEXITED(s) (!WTERMSIG(s))
98#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)98#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
99#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)99#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
100100
101int posix_memalign (void **, size_t, size_t);101int posix_memalign (void **, size_t, size_t);
...@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc...@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc
163long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);163long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
164#endif164#endif
165165
166#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)166#if defined(_LARGEFILE64_SOURCE)
167#define mkstemp64 mkstemp167#define mkstemp64 mkstemp
168#define mkostemp64 mkostemp168#define mkostemp64 mkostemp
169#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)169#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
lib/libc/musl/include/string.h+1-1
...@@ -73,6 +73,7 @@ char *strsignal(int);...@@ -73,6 +73,7 @@ char *strsignal(int);
73char *strerror_l (int, locale_t);73char *strerror_l (int, locale_t);
74int strcoll_l (const char *, const char *, locale_t);74int strcoll_l (const char *, const char *, locale_t);
75size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);75size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
76void *memmem(const void *, size_t, const void *, size_t);
76#endif77#endif
7778
78#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \79#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
...@@ -92,7 +93,6 @@ void explicit_bzero (void *, size_t);...@@ -92,7 +93,6 @@ void explicit_bzero (void *, size_t);
92int strverscmp (const char *, const char *);93int strverscmp (const char *, const char *);
93char *strchrnul(const char *, int);94char *strchrnul(const char *, int);
94char *strcasestr(const char *, const char *);95char *strcasestr(const char *, const char *);
95void *memmem(const void *, size_t, const void *, size_t);
96void *memrchr(const void *, int, size_t);96void *memrchr(const void *, int, size_t);
97void *mempcpy(void *, const void *, size_t);97void *mempcpy(void *, const void *, size_t);
98#ifndef __cplusplus98#ifndef __cplusplus
lib/libc/musl/include/strings.h+1
...@@ -5,6 +5,7 @@...@@ -5,6 +5,7 @@
5extern "C" {5extern "C" {
6#endif6#endif
77
8#include <features.h>
89
9#define __NEED_size_t10#define __NEED_size_t
10#define __NEED_locale_t11#define __NEED_locale_t
lib/libc/musl/include/sys/mman.h+1-1
...@@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *);...@@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *);
141int shm_open (const char *, int, mode_t);141int shm_open (const char *, int, mode_t);
142int shm_unlink (const char *);142int shm_unlink (const char *);
143143
144#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)144#if defined(_LARGEFILE64_SOURCE)
145#define mmap64 mmap145#define mmap64 mmap
146#define off64_t off_t146#define off64_t off_t
147#endif147#endif
lib/libc/musl/include/sys/resource.h+1-1
...@@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);...@@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
9595
96#define RLIM_NLIMITS RLIMIT_NLIMITS96#define RLIM_NLIMITS RLIMIT_NLIMITS
9797
98#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)98#if defined(_LARGEFILE64_SOURCE)
99#define RLIM64_INFINITY RLIM_INFINITY99#define RLIM64_INFINITY RLIM_INFINITY
100#define RLIM64_SAVED_CUR RLIM_SAVED_CUR100#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
101#define RLIM64_SAVED_MAX RLIM_SAVED_MAX101#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
lib/libc/musl/include/sys/sendfile.h+1-1
...@@ -10,7 +10,7 @@ extern "C" {...@@ -10,7 +10,7 @@ extern "C" {
1010
11ssize_t sendfile(int, int, off_t *, size_t);11ssize_t sendfile(int, int, off_t *, size_t);
1212
13#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)13#if defined(_LARGEFILE64_SOURCE)
14#define sendfile64 sendfile14#define sendfile64 sendfile
15#define off64_t off_t15#define off64_t off_t
16#endif16#endif
lib/libc/musl/include/sys/stat.h+1-1
...@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t);...@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t);
98#define S_IEXEC S_IXUSR98#define S_IEXEC S_IXUSR
99#endif99#endif
100100
101#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)101#if defined(_LARGEFILE64_SOURCE)
102#define stat64 stat102#define stat64 stat
103#define fstat64 fstat103#define fstat64 fstat
104#define lstat64 lstat104#define lstat64 lstat
lib/libc/musl/include/sys/statfs.h+1-1
...@@ -18,7 +18,7 @@ typedef struct __fsid_t {...@@ -18,7 +18,7 @@ typedef struct __fsid_t {
18int statfs (const char *, struct statfs *);18int statfs (const char *, struct statfs *);
19int fstatfs (int, struct statfs *);19int fstatfs (int, struct statfs *);
2020
21#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)21#if defined(_LARGEFILE64_SOURCE)
22#define statfs64 statfs22#define statfs64 statfs
23#define fstatfs64 fstatfs23#define fstatfs64 fstatfs
24#define fsblkcnt64_t fsblkcnt_t24#define fsblkcnt64_t fsblkcnt_t
lib/libc/musl/include/sys/statvfs.h+1-1
...@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *);...@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *);
42#define ST_NODIRATIME 204842#define ST_NODIRATIME 2048
43#define ST_RELATIME 409643#define ST_RELATIME 4096
4444
45#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)45#if defined(_LARGEFILE64_SOURCE)
46#define statvfs64 statvfs46#define statvfs64 statvfs
47#define fstatvfs64 fstatvfs47#define fstatvfs64 fstatvfs
48#define fsblkcnt64_t fsblkcnt_t48#define fsblkcnt64_t fsblkcnt_t
lib/libc/musl/include/sys/types.h+1-1
...@@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t;...@@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t;
71#include <sys/select.h>71#include <sys/select.h>
72#endif72#endif
7373
74#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)74#if defined(_LARGEFILE64_SOURCE)
75#define blkcnt64_t blkcnt_t75#define blkcnt64_t blkcnt_t
76#define fsblkcnt64_t fsblkcnt_t76#define fsblkcnt64_t fsblkcnt_t
77#define fsfilcnt64_t fsfilcnt_t77#define fsfilcnt64_t fsfilcnt_t
lib/libc/musl/include/sys/uio.h+1-1
...@@ -29,7 +29,7 @@ ssize_t writev (int, const struct iovec *, int);...@@ -29,7 +29,7 @@ ssize_t writev (int, const struct iovec *, int);
29#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)29#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
30ssize_t preadv (int, const struct iovec *, int, off_t);30ssize_t preadv (int, const struct iovec *, int, off_t);
31ssize_t pwritev (int, const struct iovec *, int, off_t);31ssize_t pwritev (int, const struct iovec *, int, off_t);
32#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)32#if defined(_LARGEFILE64_SOURCE)
33#define preadv64 preadv33#define preadv64 preadv
34#define pwritev64 pwritev34#define pwritev64 pwritev
35#define off64_t off_t35#define off64_t off_t
lib/libc/musl/include/sys/wait.h+1-1
...@@ -50,7 +50,7 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);...@@ -50,7 +50,7 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);
50#define WSTOPSIG(s) WEXITSTATUS(s)50#define WSTOPSIG(s) WEXITSTATUS(s)
51#define WCOREDUMP(s) ((s) & 0x80)51#define WCOREDUMP(s) ((s) & 0x80)
52#define WIFEXITED(s) (!WTERMSIG(s))52#define WIFEXITED(s) (!WTERMSIG(s))
53#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)53#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
54#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)54#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
55#define WIFCONTINUED(s) ((s) == 0xffff)55#define WIFCONTINUED(s) ((s) == 0xffff)
5656
lib/libc/musl/include/unistd.h+5-1
...@@ -198,7 +198,7 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);...@@ -198,7 +198,7 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
198pid_t gettid(void);198pid_t gettid(void);
199#endif199#endif
200200
201#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)201#if defined(_LARGEFILE64_SOURCE)
202#define lseek64 lseek202#define lseek64 lseek
203#define pread64 pread203#define pread64 pread
204#define pwrite64 pwrite204#define pwrite64 pwrite
...@@ -425,6 +425,8 @@ pid_t gettid(void);...@@ -425,6 +425,8 @@ pid_t gettid(void);
425#define _SC_XOPEN_STREAMS 246425#define _SC_XOPEN_STREAMS 246
426#define _SC_THREAD_ROBUST_PRIO_INHERIT 247426#define _SC_THREAD_ROBUST_PRIO_INHERIT 247
427#define _SC_THREAD_ROBUST_PRIO_PROTECT 248427#define _SC_THREAD_ROBUST_PRIO_PROTECT 248
428#define _SC_MINSIGSTKSZ 249
429#define _SC_SIGSTKSZ 250
428430
429#define _CS_PATH 0431#define _CS_PATH 0
430#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1432#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1
...@@ -467,6 +469,8 @@ pid_t gettid(void);...@@ -467,6 +469,8 @@ pid_t gettid(void);
467#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147469#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147
468#define _CS_V6_ENV 1148470#define _CS_V6_ENV 1148
469#define _CS_V7_ENV 1149471#define _CS_V7_ENV 1149
472#define _CS_POSIX_V7_THREADS_CFLAGS 1150
473#define _CS_POSIX_V7_THREADS_LDFLAGS 1151
470474
471#ifdef __cplusplus475#ifdef __cplusplus
472}476}
lib/libc/musl/libc.S+30-203
...@@ -168,7 +168,7 @@ _IO_putc:...@@ -168,7 +168,7 @@ _IO_putc:
168.weak _IO_putc_unlocked168.weak _IO_putc_unlocked
169.type _IO_putc_unlocked, %function;169.type _IO_putc_unlocked, %function;
170_IO_putc_unlocked:170_IO_putc_unlocked:
171#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)171#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
172.globl ___tls_get_addr172.globl ___tls_get_addr
173.type ___tls_get_addr, %function;173.type ___tls_get_addr, %function;
174___tls_get_addr:174___tls_get_addr:
...@@ -187,7 +187,7 @@ __aio_suspend_time64:...@@ -187,7 +187,7 @@ __aio_suspend_time64:
187.globl __assert_fail187.globl __assert_fail
188.type __assert_fail, %function;188.type __assert_fail, %function;
189__assert_fail:189__assert_fail:
190#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)190#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
191.globl __cachectl191.globl __cachectl
192.type __cachectl, %function;192.type __cachectl, %function;
193__cachectl:193__cachectl:
...@@ -313,10 +313,10 @@ __fseterr:...@@ -313,10 +313,10 @@ __fseterr:
313.type __fsetlocking, %function;313.type __fsetlocking, %function;
314__fsetlocking:314__fsetlocking:
315#ifdef PTR32315#ifdef PTR32
316.globl __fstat_time64316.weak __fstat_time64
317.type __fstat_time64, %function;317.type __fstat_time64, %function;
318__fstat_time64:318__fstat_time64:
319.globl __fstatat_time64319.weak __fstatat_time64
320.type __fstatat_time64, %function;320.type __fstatat_time64, %function;
321__fstatat_time64:321__fstatat_time64:
322.globl __ftime64322.globl __ftime64
...@@ -338,22 +338,12 @@ __fwritable:...@@ -338,22 +338,12 @@ __fwritable:
338.globl __fwriting338.globl __fwriting
339.type __fwriting, %function;339.type __fwriting, %function;
340__fwriting:340__fwriting:
341#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
342.globl __fxstat341.globl __fxstat
343.type __fxstat, %function;342.type __fxstat, %function;
344__fxstat:343__fxstat:
345#endif
346WEAK64 __fxstat64
347.type __fxstat64, %function;
348__fxstat64:
349#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
350.globl __fxstatat344.globl __fxstatat
351.type __fxstatat, %function;345.type __fxstatat, %function;
352__fxstatat:346__fxstatat:
353#endif
354WEAK64 __fxstatat64
355.type __fxstatat64, %function;
356__fxstatat64:
357.weak __getdelim347.weak __getdelim
358.type __getdelim, %function;348.type __getdelim, %function;
359__getdelim:349__getdelim:
...@@ -508,7 +498,7 @@ __localtime64:...@@ -508,7 +498,7 @@ __localtime64:
508.type __localtime64_r, %function;498.type __localtime64_r, %function;
509__localtime64_r:499__localtime64_r:
510#endif500#endif
511#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)501#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
512.globl __longjmp502.globl __longjmp
513.type __longjmp, %function;503.type __longjmp, %function;
514__longjmp:504__longjmp:
...@@ -521,14 +511,9 @@ __lstat_time64:...@@ -521,14 +511,9 @@ __lstat_time64:
521.type __lutimes_time64, %function;511.type __lutimes_time64, %function;
522__lutimes_time64:512__lutimes_time64:
523#endif513#endif
524#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
525.globl __lxstat514.globl __lxstat
526.type __lxstat, %function;515.type __lxstat, %function;
527__lxstat:516__lxstat:
528#endif
529WEAK64 __lxstat64
530.type __lxstat64, %function;
531__lxstat64:
532#ifdef PTR32517#ifdef PTR32
533.globl __mktime64518.globl __mktime64
534.type __mktime64, %function;519.type __mktime64, %function;
...@@ -591,7 +576,17 @@ __recvmmsg_time64:...@@ -591,7 +576,17 @@ __recvmmsg_time64:
591.globl __res_state576.globl __res_state
592.type __res_state, %function;577.type __res_state, %function;
593__res_state:578__res_state:
594#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)579#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
580.globl __restore
581.type __restore, %function;
582__restore:
583#endif
584#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
585.globl __restore_rt
586.type __restore_rt, %function;
587__restore_rt:
588#endif
589#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
595.globl __riscv_flush_icache590.globl __riscv_flush_icache
596.type __riscv_flush_icache, %function;591.type __riscv_flush_icache, %function;
597__riscv_flush_icache:592__riscv_flush_icache:
...@@ -792,27 +787,27 @@ __xpg_basename:...@@ -792,27 +787,27 @@ __xpg_basename:
792.weak __xpg_strerror_r787.weak __xpg_strerror_r
793.type __xpg_strerror_r, %function;788.type __xpg_strerror_r, %function;
794__xpg_strerror_r:789__xpg_strerror_r:
795#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
796.globl __xstat790.globl __xstat
797.type __xstat, %function;791.type __xstat, %function;
798__xstat:792__xstat:
799#endif
800WEAK64 __xstat64
801.type __xstat64, %function;
802__xstat64:
803.weak _dl_debug_state793.weak _dl_debug_state
804.type _dl_debug_state, %function;794.type _dl_debug_state, %function;
805_dl_debug_state:795_dl_debug_state:
806.globl _dlstart796.globl _dlstart
807.type _dlstart, %function;797.type _dlstart, %function;
808_dlstart:798_dlstart:
799#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
800.globl _dlstart_data
801.type _dlstart_data, %function;
802_dlstart_data:
803#endif
809.globl _exit804.globl _exit
810.type _exit, %function;805.type _exit, %function;
811_exit:806_exit:
812.weak _fini807.weak _fini
813.type _fini, %function;808.type _fini, %function;
814_fini:809_fini:
815#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)810#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
816.globl _flush_cache811.globl _flush_cache
817.type _flush_cache, %function;812.type _flush_cache, %function;
818_flush_cache:813_flush_cache:
...@@ -886,45 +881,24 @@ adjtimex:...@@ -886,45 +881,24 @@ adjtimex:
886.globl aio_cancel881.globl aio_cancel
887.type aio_cancel, %function;882.type aio_cancel, %function;
888aio_cancel:883aio_cancel:
889.weak aio_cancel64
890.type aio_cancel64, %function;
891aio_cancel64:
892.globl aio_error884.globl aio_error
893.type aio_error, %function;885.type aio_error, %function;
894aio_error:886aio_error:
895.weak aio_error64
896.type aio_error64, %function;
897aio_error64:
898.globl aio_fsync887.globl aio_fsync
899.type aio_fsync, %function;888.type aio_fsync, %function;
900aio_fsync:889aio_fsync:
901.weak aio_fsync64
902.type aio_fsync64, %function;
903aio_fsync64:
904.globl aio_read890.globl aio_read
905.type aio_read, %function;891.type aio_read, %function;
906aio_read:892aio_read:
907.weak aio_read64
908.type aio_read64, %function;
909aio_read64:
910.globl aio_return893.globl aio_return
911.type aio_return, %function;894.type aio_return, %function;
912aio_return:895aio_return:
913.weak aio_return64
914.type aio_return64, %function;
915aio_return64:
916.globl aio_suspend896.globl aio_suspend
917.type aio_suspend, %function;897.type aio_suspend, %function;
918aio_suspend:898aio_suspend:
919.weak aio_suspend64
920.type aio_suspend64, %function;
921aio_suspend64:
922.globl aio_write899.globl aio_write
923.type aio_write, %function;900.type aio_write, %function;
924aio_write:901aio_write:
925.weak aio_write64
926.type aio_write64, %function;
927aio_write64:
928.globl alarm902.globl alarm
929.type alarm, %function;903.type alarm, %function;
930alarm:904alarm:
...@@ -934,10 +908,7 @@ aligned_alloc:...@@ -934,10 +908,7 @@ aligned_alloc:
934.globl alphasort908.globl alphasort
935.type alphasort, %function;909.type alphasort, %function;
936alphasort:910alphasort:
937.weak alphasort64911#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
938.type alphasort64, %function;
939alphasort64:
940#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
941.globl arch_prctl912.globl arch_prctl
942.type arch_prctl, %function;913.type arch_prctl, %function;
943arch_prctl:914arch_prctl:
...@@ -1062,12 +1033,12 @@ cabsf:...@@ -1062,12 +1033,12 @@ cabsf:
1062.globl cabsl1033.globl cabsl
1063.type cabsl, %function;1034.type cabsl, %function;
1064cabsl:1035cabsl:
1065#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)1036#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
1066.weak cachectl1037.weak cachectl
1067.type cachectl, %function;1038.type cachectl, %function;
1068cachectl:1039cachectl:
1069#endif1040#endif
1070#if !defined(ARCH_riscv64) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)1041#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
1071.weak cacheflush1042.weak cacheflush
1072.type cacheflush, %function;1043.type cacheflush, %function;
1073cacheflush:1044cacheflush:
...@@ -1384,9 +1355,6 @@ creall:...@@ -1384,9 +1355,6 @@ creall:
1384.globl creat1355.globl creat
1385.type creat, %function;1356.type creat, %function;
1386creat:1357creat:
1387.weak creat64
1388.type creat64, %function;
1389creat64:
1390.globl crypt1358.globl crypt
1391.type crypt, %function;1359.type crypt, %function;
1392crypt:1360crypt:
...@@ -1729,9 +1697,6 @@ faccessat:...@@ -1729,9 +1697,6 @@ faccessat:
1729.globl fallocate1697.globl fallocate
1730.type fallocate, %function;1698.type fallocate, %function;
1731fallocate:1699fallocate:
1732.weak fallocate64
1733.type fallocate64, %function;
1734fallocate64:
1735.globl fanotify_init1700.globl fanotify_init
1736.type fanotify_init, %function;1701.type fanotify_init, %function;
1737fanotify_init:1702fanotify_init:
...@@ -1858,9 +1823,6 @@ fgetln:...@@ -1858,9 +1823,6 @@ fgetln:
1858.globl fgetpos1823.globl fgetpos
1859.type fgetpos, %function;1824.type fgetpos, %function;
1860fgetpos:1825fgetpos:
1861.weak fgetpos64
1862.type fgetpos64, %function;
1863fgetpos64:
1864.globl fgetpwent1826.globl fgetpwent
1865.type fgetpwent, %function;1827.type fgetpwent, %function;
1866fgetpwent:1828fgetpwent:
...@@ -1966,9 +1928,6 @@ fnmatch:...@@ -1966,9 +1928,6 @@ fnmatch:
1966.globl fopen1928.globl fopen
1967.type fopen, %function;1929.type fopen, %function;
1968fopen:1930fopen:
1969.weak fopen64
1970.type fopen64, %function;
1971fopen64:
1972.globl fopencookie1931.globl fopencookie
1973.type fopencookie, %function;1932.type fopencookie, %function;
1974fopencookie:1933fopencookie:
...@@ -2035,9 +1994,6 @@ fremovexattr:...@@ -2035,9 +1994,6 @@ fremovexattr:
2035.globl freopen1994.globl freopen
2036.type freopen, %function;1995.type freopen, %function;
2037freopen:1996freopen:
2038.weak freopen64
2039.type freopen64, %function;
2040freopen64:
2041.globl frexp1997.globl frexp
2042.type frexp, %function;1998.type frexp, %function;
2043frexp:1999frexp:
...@@ -2056,42 +2012,24 @@ fseek:...@@ -2056,42 +2012,24 @@ fseek:
2056.weak fseeko2012.weak fseeko
2057.type fseeko, %function;2013.type fseeko, %function;
2058fseeko:2014fseeko:
2059.weak fseeko64
2060.type fseeko64, %function;
2061fseeko64:
2062.globl fsetpos2015.globl fsetpos
2063.type fsetpos, %function;2016.type fsetpos, %function;
2064fsetpos:2017fsetpos:
2065.weak fsetpos64
2066.type fsetpos64, %function;
2067fsetpos64:
2068.globl fsetxattr2018.globl fsetxattr
2069.type fsetxattr, %function;2019.type fsetxattr, %function;
2070fsetxattr:2020fsetxattr:
2071.globl fstat2021WEAK64 fstat
2072.type fstat, %function;2022.type fstat, %function;
2073fstat:2023fstat:
2074.weak fstat642024WEAK64 fstatat
2075.type fstat64, %function;
2076fstat64:
2077.globl fstatat
2078.type fstatat, %function;2025.type fstatat, %function;
2079fstatat:2026fstatat:
2080.weak fstatat64
2081.type fstatat64, %function;
2082fstatat64:
2083.weak fstatfs2027.weak fstatfs
2084.type fstatfs, %function;2028.type fstatfs, %function;
2085fstatfs:2029fstatfs:
2086.weak fstatfs64
2087.type fstatfs64, %function;
2088fstatfs64:
2089.globl fstatvfs2030.globl fstatvfs
2090.type fstatvfs, %function;2031.type fstatvfs, %function;
2091fstatvfs:2032fstatvfs:
2092.weak fstatvfs64
2093.type fstatvfs64, %function;
2094fstatvfs64:
2095.globl fsync2033.globl fsync
2096.type fsync, %function;2034.type fsync, %function;
2097fsync:2035fsync:
...@@ -2101,9 +2039,6 @@ ftell:...@@ -2101,9 +2039,6 @@ ftell:
2101.weak ftello2039.weak ftello
2102.type ftello, %function;2040.type ftello, %function;
2103ftello:2041ftello:
2104.weak ftello64
2105.type ftello64, %function;
2106ftello64:
2107.globl ftime2042.globl ftime
2108.type ftime, %function;2043.type ftime, %function;
2109ftime:2044ftime:
...@@ -2113,18 +2048,12 @@ ftok:...@@ -2113,18 +2048,12 @@ ftok:
2113.globl ftruncate2048.globl ftruncate
2114.type ftruncate, %function;2049.type ftruncate, %function;
2115ftruncate:2050ftruncate:
2116.weak ftruncate64
2117.type ftruncate64, %function;
2118ftruncate64:
2119.globl ftrylockfile2051.globl ftrylockfile
2120.type ftrylockfile, %function;2052.type ftrylockfile, %function;
2121ftrylockfile:2053ftrylockfile:
2122.globl ftw2054.globl ftw
2123.type ftw, %function;2055.type ftw, %function;
2124ftw:2056ftw:
2125.weak ftw64
2126.type ftw64, %function;
2127ftw64:
2128.globl funlockfile2057.globl funlockfile
2129.type funlockfile, %function;2058.type funlockfile, %function;
2130funlockfile:2059funlockfile:
...@@ -2203,9 +2132,6 @@ getdelim:...@@ -2203,9 +2132,6 @@ getdelim:
2203.globl getdents2132.globl getdents
2204.type getdents, %function;2133.type getdents, %function;
2205getdents:2134getdents:
2206.weak getdents64
2207.type getdents64, %function;
2208getdents64:
2209.globl getdomainname2135.globl getdomainname
2210.type getdomainname, %function;2136.type getdomainname, %function;
2211getdomainname:2137getdomainname:
...@@ -2380,9 +2306,6 @@ getresuid:...@@ -2380,9 +2306,6 @@ getresuid:
2380.globl getrlimit2306.globl getrlimit
2381.type getrlimit, %function;2307.type getrlimit, %function;
2382getrlimit:2308getrlimit:
2383.weak getrlimit64
2384.type getrlimit64, %function;
2385getrlimit64:
2386.globl getrusage2309.globl getrusage
2387.type getrusage, %function;2310.type getrusage, %function;
2388getrusage:2311getrusage:
...@@ -2479,15 +2402,9 @@ getxattr:...@@ -2479,15 +2402,9 @@ getxattr:
2479.globl glob2402.globl glob
2480.type glob, %function;2403.type glob, %function;
2481glob:2404glob:
2482.weak glob64
2483.type glob64, %function;
2484glob64:
2485.globl globfree2405.globl globfree
2486.type globfree, %function;2406.type globfree, %function;
2487globfree:2407globfree:
2488.weak globfree64
2489.type globfree64, %function;
2490globfree64:
2491.globl gmtime2408.globl gmtime
2492.type gmtime, %function;2409.type gmtime, %function;
2493gmtime:2410gmtime:
...@@ -2632,12 +2549,12 @@ insque:...@@ -2632,12 +2549,12 @@ insque:
2632.globl ioctl2549.globl ioctl
2633.type ioctl, %function;2550.type ioctl, %function;
2634ioctl:2551ioctl:
2635#if !defined(ARCH_riscv64) && !defined(ARCH_aarch64)2552#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)
2636.globl ioperm2553.globl ioperm
2637.type ioperm, %function;2554.type ioperm, %function;
2638ioperm:2555ioperm:
2639#endif2556#endif
2640#if !defined(ARCH_riscv64) && !defined(ARCH_aarch64)2557#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)
2641.globl iopl2558.globl iopl
2642.type iopl, %function;2559.type iopl, %function;
2643iopl:2560iopl:
...@@ -2897,9 +2814,6 @@ linkat:...@@ -2897,9 +2814,6 @@ linkat:
2897.globl lio_listio2814.globl lio_listio
2898.type lio_listio, %function;2815.type lio_listio, %function;
2899lio_listio:2816lio_listio:
2900.weak lio_listio64
2901.type lio_listio64, %function;
2902lio_listio64:
2903.globl listen2817.globl listen
2904.type listen, %function;2818.type listen, %function;
2905listen:2819listen:
...@@ -2945,9 +2859,6 @@ localtime_r:...@@ -2945,9 +2859,6 @@ localtime_r:
2945.globl lockf2859.globl lockf
2946.type lockf, %function;2860.type lockf, %function;
2947lockf:2861lockf:
2948.weak lockf64
2949.type lockf64, %function;
2950lockf64:
2951.globl log2862.globl log
2952.type log, %function;2863.type log, %function;
2953log:2864log:
...@@ -3029,18 +2940,12 @@ lsearch:...@@ -3029,18 +2940,12 @@ lsearch:
3029.weak lseek2940.weak lseek
3030.type lseek, %function;2941.type lseek, %function;
3031lseek:2942lseek:
3032.weak lseek64
3033.type lseek64, %function;
3034lseek64:
3035.globl lsetxattr2943.globl lsetxattr
3036.type lsetxattr, %function;2944.type lsetxattr, %function;
3037lsetxattr:2945lsetxattr:
3038.globl lstat2946.globl lstat
3039.type lstat, %function;2947.type lstat, %function;
3040lstat:2948lstat:
3041.weak lstat64
3042.type lstat64, %function;
3043lstat64:
3044.globl lutimes2949.globl lutimes
3045.type lutimes, %function;2950.type lutimes, %function;
3046lutimes:2951lutimes:
...@@ -3146,27 +3051,15 @@ mknodat:...@@ -3146,27 +3051,15 @@ mknodat:
3146.globl mkostemp3051.globl mkostemp
3147.type mkostemp, %function;3052.type mkostemp, %function;
3148mkostemp:3053mkostemp:
3149.weak mkostemp64
3150.type mkostemp64, %function;
3151mkostemp64:
3152.weak mkostemps3054.weak mkostemps
3153.type mkostemps, %function;3055.type mkostemps, %function;
3154mkostemps:3056mkostemps:
3155.weak mkostemps64
3156.type mkostemps64, %function;
3157mkostemps64:
3158.globl mkstemp3057.globl mkstemp
3159.type mkstemp, %function;3058.type mkstemp, %function;
3160mkstemp:3059mkstemp:
3161.weak mkstemp64
3162.type mkstemp64, %function;
3163mkstemp64:
3164.globl mkstemps3060.globl mkstemps
3165.type mkstemps, %function;3061.type mkstemps, %function;
3166mkstemps:3062mkstemps:
3167.weak mkstemps64
3168.type mkstemps64, %function;
3169mkstemps64:
3170.globl mktemp3063.globl mktemp
3171.type mktemp, %function;3064.type mktemp, %function;
3172mktemp:3065mktemp:
...@@ -3185,9 +3078,6 @@ mlockall:...@@ -3185,9 +3078,6 @@ mlockall:
3185.weak mmap3078.weak mmap
3186.type mmap, %function;3079.type mmap, %function;
3187mmap:3080mmap:
3188.weak mmap64
3189.type mmap64, %function;
3190mmap64:
3191.globl modf3081.globl modf
3192.type modf, %function;3082.type modf, %function;
3193modf:3083modf:
...@@ -3329,9 +3219,6 @@ nexttowardl:...@@ -3329,9 +3219,6 @@ nexttowardl:
3329.globl nftw3219.globl nftw
3330.type nftw, %function;3220.type nftw, %function;
3331nftw:3221nftw:
3332.weak nftw64
3333.type nftw64, %function;
3334nftw64:
3335.globl ngettext3222.globl ngettext
3336.type ngettext, %function;3223.type ngettext, %function;
3337ngettext:3224ngettext:
...@@ -3380,9 +3267,6 @@ ntohs:...@@ -3380,9 +3267,6 @@ ntohs:
3380.globl open3267.globl open
3381.type open, %function;3268.type open, %function;
3382open:3269open:
3383.weak open64
3384.type open64, %function;
3385open64:
3386.globl open_by_handle_at3270.globl open_by_handle_at
3387.type open_by_handle_at, %function;3271.type open_by_handle_at, %function;
3388open_by_handle_at:3272open_by_handle_at:
...@@ -3395,9 +3279,6 @@ open_wmemstream:...@@ -3395,9 +3279,6 @@ open_wmemstream:
3395.globl openat3279.globl openat
3396.type openat, %function;3280.type openat, %function;
3397openat:3281openat:
3398.weak openat64
3399.type openat64, %function;
3400openat64:
3401.globl opendir3282.globl opendir
3402.type opendir, %function;3283.type opendir, %function;
3403opendir:3284opendir:
...@@ -3443,15 +3324,9 @@ posix_close:...@@ -3443,15 +3324,9 @@ posix_close:
3443.globl posix_fadvise3324.globl posix_fadvise
3444.type posix_fadvise, %function;3325.type posix_fadvise, %function;
3445posix_fadvise:3326posix_fadvise:
3446.weak posix_fadvise64
3447.type posix_fadvise64, %function;
3448posix_fadvise64:
3449.globl posix_fallocate3327.globl posix_fallocate
3450.type posix_fallocate, %function;3328.type posix_fallocate, %function;
3451posix_fallocate:3329posix_fallocate:
3452.weak posix_fallocate64
3453.type posix_fallocate64, %function;
3454posix_fallocate64:
3455.globl posix_madvise3330.globl posix_madvise
3456.type posix_madvise, %function;3331.type posix_madvise, %function;
3457posix_madvise:3332posix_madvise:
...@@ -3557,24 +3432,15 @@ prctl:...@@ -3557,24 +3432,15 @@ prctl:
3557.globl pread3432.globl pread
3558.type pread, %function;3433.type pread, %function;
3559pread:3434pread:
3560.weak pread64
3561.type pread64, %function;
3562pread64:
3563.globl preadv3435.globl preadv
3564.type preadv, %function;3436.type preadv, %function;
3565preadv:3437preadv:
3566.weak preadv64
3567.type preadv64, %function;
3568preadv64:
3569.globl printf3438.globl printf
3570.type printf, %function;3439.type printf, %function;
3571printf:3440printf:
3572.globl prlimit3441.globl prlimit
3573.type prlimit, %function;3442.type prlimit, %function;
3574prlimit:3443prlimit:
3575.weak prlimit64
3576.type prlimit64, %function;
3577prlimit64:
3578.globl process_vm_readv3444.globl process_vm_readv
3579.type process_vm_readv, %function;3445.type process_vm_readv, %function;
3580process_vm_readv:3446process_vm_readv:
...@@ -3971,15 +3837,9 @@ putwchar_unlocked:...@@ -3971,15 +3837,9 @@ putwchar_unlocked:
3971.globl pwrite3837.globl pwrite
3972.type pwrite, %function;3838.type pwrite, %function;
3973pwrite:3839pwrite:
3974.weak pwrite64
3975.type pwrite64, %function;
3976pwrite64:
3977.globl pwritev3840.globl pwritev
3978.type pwritev, %function;3841.type pwritev, %function;
3979pwritev:3842pwritev:
3980.weak pwritev64
3981.type pwritev64, %function;
3982pwritev64:
3983.globl qsort3843.globl qsort
3984.type qsort, %function;3844.type qsort, %function;
3985qsort:3845qsort:
...@@ -4013,12 +3873,6 @@ readahead:...@@ -4013,12 +3873,6 @@ readahead:
4013.globl readdir3873.globl readdir
4014.type readdir, %function;3874.type readdir, %function;
4015readdir:3875readdir:
4016.weak readdir64
4017.type readdir64, %function;
4018readdir64:
4019.weak readdir64_r
4020.type readdir64_r, %function;
4021readdir64_r:
4022.globl readdir_r3876.globl readdir_r
4023.type readdir_r, %function;3877.type readdir_r, %function;
4024readdir_r:3878readdir_r:
...@@ -4139,7 +3993,7 @@ rintf:...@@ -4139,7 +3993,7 @@ rintf:
4139.globl rintl3993.globl rintl
4140.type rintl, %function;3994.type rintl, %function;
4141rintl:3995rintl:
4142#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)3996#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
4143.weak riscv_flush_icache3997.weak riscv_flush_icache
4144.type riscv_flush_icache, %function;3998.type riscv_flush_icache, %function;
4145riscv_flush_icache:3999riscv_flush_icache:
...@@ -4186,9 +4040,6 @@ scalbnl:...@@ -4186,9 +4040,6 @@ scalbnl:
4186.globl scandir4040.globl scandir
4187.type scandir, %function;4041.type scandir, %function;
4188scandir:4042scandir:
4189.weak scandir64
4190.type scandir64, %function;
4191scandir64:
4192.globl scanf4043.globl scanf
4193.type scanf, %function;4044.type scanf, %function;
4194scanf:4045scanf:
...@@ -4285,9 +4136,6 @@ send:...@@ -4285,9 +4136,6 @@ send:
4285.globl sendfile4136.globl sendfile
4286.type sendfile, %function;4137.type sendfile, %function;
4287sendfile:4138sendfile:
4288.weak sendfile64
4289.type sendfile64, %function;
4290sendfile64:
4291.globl sendmmsg4139.globl sendmmsg
4292.type sendmmsg, %function;4140.type sendmmsg, %function;
4293sendmmsg:4141sendmmsg:
...@@ -4393,9 +4241,6 @@ setreuid:...@@ -4393,9 +4241,6 @@ setreuid:
4393.globl setrlimit4241.globl setrlimit
4394.type setrlimit, %function;4242.type setrlimit, %function;
4395setrlimit:4243setrlimit:
4396.weak setrlimit64
4397.type setrlimit64, %function;
4398setrlimit64:
4399.globl setservent4244.globl setservent
4400.type setservent, %function;4245.type setservent, %function;
4401setservent:4246setservent:
...@@ -4612,21 +4457,12 @@ sscanf:...@@ -4612,21 +4457,12 @@ sscanf:
4612.globl stat4457.globl stat
4613.type stat, %function;4458.type stat, %function;
4614stat:4459stat:
4615.weak stat64
4616.type stat64, %function;
4617stat64:
4618.weak statfs4460.weak statfs
4619.type statfs, %function;4461.type statfs, %function;
4620statfs:4462statfs:
4621.weak statfs64
4622.type statfs64, %function;
4623statfs64:
4624.globl statvfs4463.globl statvfs
4625.type statvfs, %function;4464.type statvfs, %function;
4626statvfs:4465statvfs:
4627.weak statvfs64
4628.type statvfs64, %function;
4629statvfs64:
4630.globl stime4466.globl stime
4631.type stime, %function;4467.type stime, %function;
4632stime:4468stime:
...@@ -4984,9 +4820,6 @@ timespec_get:...@@ -4984,9 +4820,6 @@ timespec_get:
4984.globl tmpfile4820.globl tmpfile
4985.type tmpfile, %function;4821.type tmpfile, %function;
4986tmpfile:4822tmpfile:
4987.weak tmpfile64
4988.type tmpfile64, %function;
4989tmpfile64:
4990.globl tmpnam4823.globl tmpnam
4991.type tmpnam, %function;4824.type tmpnam, %function;
4992tmpnam:4825tmpnam:
...@@ -5029,9 +4862,6 @@ trunc:...@@ -5029,9 +4862,6 @@ trunc:
5029.globl truncate4862.globl truncate
5030.type truncate, %function;4863.type truncate, %function;
5031truncate:4864truncate:
5032.weak truncate64
5033.type truncate64, %function;
5034truncate64:
5035.globl truncf4865.globl truncf
5036.type truncf, %function;4866.type truncf, %function;
5037truncf:4867truncf:
...@@ -5152,9 +4982,6 @@ verrx:...@@ -5152,9 +4982,6 @@ verrx:
5152.globl versionsort4982.globl versionsort
5153.type versionsort, %function;4983.type versionsort, %function;
5154versionsort:4984versionsort:
5155.weak versionsort64
5156.type versionsort64, %function;
5157versionsort64:
5158.globl vfork4985.globl vfork
5159.type vfork, %function;4986.type vfork, %function;
5160vfork:4987vfork:
lib/libc/musl/src/aio/aio.c+23-9
...@@ -82,6 +82,8 @@ static size_t io_thread_stack_size;...@@ -82,6 +82,8 @@ static size_t io_thread_stack_size;
8282
83static struct aio_queue *__aio_get_queue(int fd, int need)83static struct aio_queue *__aio_get_queue(int fd, int need)
84{84{
85 sigset_t allmask, origmask;
86 int masked = 0;
85 if (fd < 0) {87 if (fd < 0) {
86 errno = EBADF;88 errno = EBADF;
87 return 0;89 return 0;
...@@ -93,6 +95,9 @@ static struct aio_queue *__aio_get_queue(int fd, int need)...@@ -93,6 +95,9 @@ static struct aio_queue *__aio_get_queue(int fd, int need)
93 if ((!map || !map[a] || !map[a][b] || !map[a][b][c] || !(q=map[a][b][c][d])) && need) {95 if ((!map || !map[a] || !map[a][b] || !map[a][b][c] || !(q=map[a][b][c][d])) && need) {
94 pthread_rwlock_unlock(&maplock);96 pthread_rwlock_unlock(&maplock);
95 if (fcntl(fd, F_GETFD) < 0) return 0;97 if (fcntl(fd, F_GETFD) < 0) return 0;
98 sigfillset(&allmask);
99 masked = 1;
100 pthread_sigmask(SIG_BLOCK, &allmask, &origmask);
96 pthread_rwlock_wrlock(&maplock);101 pthread_rwlock_wrlock(&maplock);
97 if (!io_thread_stack_size) {102 if (!io_thread_stack_size) {
98 unsigned long val = __getauxval(AT_MINSIGSTKSZ);103 unsigned long val = __getauxval(AT_MINSIGSTKSZ);
...@@ -119,6 +124,7 @@ static struct aio_queue *__aio_get_queue(int fd, int need)...@@ -119,6 +124,7 @@ static struct aio_queue *__aio_get_queue(int fd, int need)
119 if (q) pthread_mutex_lock(&q->lock);124 if (q) pthread_mutex_lock(&q->lock);
120out:125out:
121 pthread_rwlock_unlock(&maplock);126 pthread_rwlock_unlock(&maplock);
127 if (masked) pthread_sigmask(SIG_SETMASK, &origmask, 0);
122 return q;128 return q;
123}129}
124130
...@@ -401,18 +407,26 @@ void __aio_atfork(int who)...@@ -401,18 +407,26 @@ void __aio_atfork(int who)
401 if (who<0) {407 if (who<0) {
402 pthread_rwlock_rdlock(&maplock);408 pthread_rwlock_rdlock(&maplock);
403 return;409 return;
410 } else if (!who) {
411 pthread_rwlock_unlock(&maplock);
412 return;
404 }413 }
405 if (who>0 && map) for (int a=0; a<(-1U/2+1)>>24; a++)414 aio_fd_cnt = 0;
415 if (pthread_rwlock_tryrdlock(&maplock)) {
416 /* Obtaining lock may fail if _Fork was called nor via
417 * fork. In this case, no further aio is possible from
418 * child and we can just null out map so __aio_close
419 * does not attempt to do anything. */
420 map = 0;
421 return;
422 }
423 if (map) for (int a=0; a<(-1U/2+1)>>24; a++)
406 if (map[a]) for (int b=0; b<256; b++)424 if (map[a]) for (int b=0; b<256; b++)
407 if (map[a][b]) for (int c=0; c<256; c++)425 if (map[a][b]) for (int c=0; c<256; c++)
408 if (map[a][b][c]) for (int d=0; d<256; d++)426 if (map[a][b][c]) for (int d=0; d<256; d++)
409 map[a][b][c][d] = 0;427 map[a][b][c][d] = 0;
410 pthread_rwlock_unlock(&maplock);428 /* Re-initialize the rwlock rather than unlocking since there
429 * may have been more than one reference on it in the parent.
430 * We are not a lock holder anyway; the thread in the parent was. */
431 pthread_rwlock_init(&maplock, 0);
411}432}
412
413weak_alias(aio_cancel, aio_cancel64);
414weak_alias(aio_error, aio_error64);
415weak_alias(aio_fsync, aio_fsync64);
416weak_alias(aio_read, aio_read64);
417weak_alias(aio_write, aio_write64);
418weak_alias(aio_return, aio_return64);
lib/libc/musl/src/aio/aio_suspend.c+1-5
...@@ -9,7 +9,7 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec...@@ -9,7 +9,7 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec
9{9{
10 int i, tid = 0, ret, expect = 0;10 int i, tid = 0, ret, expect = 0;
11 struct timespec at;11 struct timespec at;
12 volatile int dummy_fut, *pfut;12 volatile int dummy_fut = 0, *pfut;
13 int nzcnt = 0;13 int nzcnt = 0;
14 const struct aiocb *cb = 0;14 const struct aiocb *cb = 0;
1515
...@@ -73,7 +73,3 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec...@@ -73,7 +73,3 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec
73 }73 }
74 }74 }
75}75}
76
77#if !_REDIR_TIME64
78weak_alias(aio_suspend, aio_suspend64);
79#endif
lib/libc/musl/src/aio/lio_listio.c-2
...@@ -139,5 +139,3 @@ int lio_listio(int mode, struct aiocb *restrict const *restrict cbs, int cnt, st...@@ -139,5 +139,3 @@ int lio_listio(int mode, struct aiocb *restrict const *restrict cbs, int cnt, st
139139
140 return 0;140 return 0;
141}141}
142
143weak_alias(lio_listio, lio_listio64);
lib/libc/musl/src/conf/confstr.c+1-1
...@@ -7,7 +7,7 @@ size_t confstr(int name, char *buf, size_t len)...@@ -7,7 +7,7 @@ size_t confstr(int name, char *buf, size_t len)
7 const char *s = "";7 const char *s = "";
8 if (!name) {8 if (!name) {
9 s = "/bin:/usr/bin";9 s = "/bin:/usr/bin";
10 } else if ((name&~4U)!=1 && name-_CS_POSIX_V6_ILP32_OFF32_CFLAGS>33U) {10 } else if ((name&~4U)!=1 && name-_CS_POSIX_V6_ILP32_OFF32_CFLAGS>35U) {
11 errno = EINVAL;11 errno = EINVAL;
12 return 0;12 return 0;
13 }13 }
lib/libc/musl/src/conf/sysconf.c+13
...@@ -4,6 +4,7 @@...@@ -4,6 +4,7 @@
4#include <sys/resource.h>4#include <sys/resource.h>
5#include <signal.h>5#include <signal.h>
6#include <sys/sysinfo.h>6#include <sys/sysinfo.h>
7#include <sys/auxv.h>
7#include "syscall.h"8#include "syscall.h"
8#include "libc.h"9#include "libc.h"
910
...@@ -19,6 +20,8 @@...@@ -19,6 +20,8 @@
19#define JT_AVPHYS_PAGES JT(9)20#define JT_AVPHYS_PAGES JT(9)
20#define JT_ZERO JT(10)21#define JT_ZERO JT(10)
21#define JT_DELAYTIMER_MAX JT(11)22#define JT_DELAYTIMER_MAX JT(11)
23#define JT_MINSIGSTKSZ JT(12)
24#define JT_SIGSTKSZ JT(13)
2225
23#define RLIM(x) (-32768|(RLIMIT_ ## x))26#define RLIM(x) (-32768|(RLIMIT_ ## x))
2427
...@@ -165,6 +168,9 @@ long sysconf(int name)...@@ -165,6 +168,9 @@ long sysconf(int name)
165 [_SC_XOPEN_STREAMS] = JT_ZERO,168 [_SC_XOPEN_STREAMS] = JT_ZERO,
166 [_SC_THREAD_ROBUST_PRIO_INHERIT] = -1,169 [_SC_THREAD_ROBUST_PRIO_INHERIT] = -1,
167 [_SC_THREAD_ROBUST_PRIO_PROTECT] = -1,170 [_SC_THREAD_ROBUST_PRIO_PROTECT] = -1,
171
172 [_SC_MINSIGSTKSZ] = JT_MINSIGSTKSZ,
173 [_SC_SIGSTKSZ] = JT_SIGSTKSZ,
168 };174 };
169175
170 if (name >= sizeof(values)/sizeof(values[0]) || !values[name]) {176 if (name >= sizeof(values)/sizeof(values[0]) || !values[name]) {
...@@ -212,6 +218,13 @@ long sysconf(int name)...@@ -212,6 +218,13 @@ long sysconf(int name)
212 mem *= si.mem_unit;218 mem *= si.mem_unit;
213 mem /= PAGE_SIZE;219 mem /= PAGE_SIZE;
214 return (mem > LONG_MAX) ? LONG_MAX : mem;220 return (mem > LONG_MAX) ? LONG_MAX : mem;
221 case JT_MINSIGSTKSZ & 255:
222 case JT_SIGSTKSZ & 255: ;
223 long val = __getauxval(AT_MINSIGSTKSZ);
224 if (val < MINSIGSTKSZ) val = MINSIGSTKSZ;
225 if (values[name] == JT_SIGSTKSZ)
226 val += SIGSTKSZ - MINSIGSTKSZ;
227 return val;
215 case JT_ZERO & 255:228 case JT_ZERO & 255:
216 return 0;229 return 0;
217 }230 }
lib/libc/musl/src/dirent/alphasort.c-2
...@@ -5,5 +5,3 @@ int alphasort(const struct dirent **a, const struct dirent **b)...@@ -5,5 +5,3 @@ int alphasort(const struct dirent **a, const struct dirent **b)
5{5{
6 return strcoll((*a)->d_name, (*b)->d_name);6 return strcoll((*a)->d_name, (*b)->d_name);
7}7}
8
9weak_alias(alphasort, alphasort64);
lib/libc/musl/src/dirent/readdir.c-2
...@@ -25,5 +25,3 @@ struct dirent *readdir(DIR *dir)...@@ -25,5 +25,3 @@ struct dirent *readdir(DIR *dir)
25 dir->tell = de->d_off;25 dir->tell = de->d_off;
26 return de;26 return de;
27}27}
28
29weak_alias(readdir, readdir64);
lib/libc/musl/src/dirent/readdir_r.c-2
...@@ -25,5 +25,3 @@ int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **re...@@ -25,5 +25,3 @@ int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **re
25 *result = buf;25 *result = buf;
26 return 0;26 return 0;
27}27}
28
29weak_alias(readdir_r, readdir64_r);
lib/libc/musl/src/dirent/scandir.c-2
...@@ -43,5 +43,3 @@ int scandir(const char *path, struct dirent ***res,...@@ -43,5 +43,3 @@ int scandir(const char *path, struct dirent ***res,
43 *res = names;43 *res = names;
44 return cnt;44 return cnt;
45}45}
46
47weak_alias(scandir, scandir64);
lib/libc/musl/src/dirent/versionsort.c-3
...@@ -6,6 +6,3 @@ int versionsort(const struct dirent **a, const struct dirent **b)...@@ -6,6 +6,3 @@ int versionsort(const struct dirent **a, const struct dirent **b)
6{6{
7 return strverscmp((*a)->d_name, (*b)->d_name);7 return strverscmp((*a)->d_name, (*b)->d_name);
8}8}
9
10#undef versionsort64
11weak_alias(versionsort, versionsort64);
lib/libc/musl/src/fcntl/creat.c-2
...@@ -4,5 +4,3 @@ int creat(const char *filename, mode_t mode)...@@ -4,5 +4,3 @@ int creat(const char *filename, mode_t mode)
4{4{
5 return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode);5 return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode);
6}6}
7
8weak_alias(creat, creat64);
lib/libc/musl/src/fcntl/open.c-2
...@@ -19,5 +19,3 @@ int open(const char *filename, int flags, ...)...@@ -19,5 +19,3 @@ int open(const char *filename, int flags, ...)
1919
20 return __syscall_ret(fd);20 return __syscall_ret(fd);
21}21}
22
23weak_alias(open, open64);
lib/libc/musl/src/fcntl/openat.c-2
...@@ -15,5 +15,3 @@ int openat(int fd, const char *filename, int flags, ...)...@@ -15,5 +15,3 @@ int openat(int fd, const char *filename, int flags, ...)
1515
16 return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode);16 return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode);
17}17}
18
19weak_alias(openat, openat64);
lib/libc/musl/src/fcntl/posix_fadvise.c-2
...@@ -14,5 +14,3 @@ int posix_fadvise(int fd, off_t base, off_t len, int advice)...@@ -14,5 +14,3 @@ int posix_fadvise(int fd, off_t base, off_t len, int advice)
14 __SYSCALL_LL_E(len), advice);14 __SYSCALL_LL_E(len), advice);
15#endif15#endif
16}16}
17
18weak_alias(posix_fadvise, posix_fadvise64);
lib/libc/musl/src/fcntl/posix_fallocate.c-2
...@@ -6,5 +6,3 @@ int posix_fallocate(int fd, off_t base, off_t len)...@@ -6,5 +6,3 @@ int posix_fallocate(int fd, off_t base, off_t len)
6 return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base),6 return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base),
7 __SYSCALL_LL_E(len));7 __SYSCALL_LL_E(len));
8}8}
9
10weak_alias(posix_fallocate, posix_fallocate64);
lib/libc/musl/src/include/sys/stat.h created+9
...@@ -0,0 +1,9 @@
1#ifndef SYS_STAT_H
2#define SYS_STAT_H
3
4#include "../../../include/sys/stat.h"
5
6hidden int __fstat(int, struct stat *);
7hidden int __fstatat(int, const char *restrict, struct stat *restrict, int);
8
9#endif
lib/libc/musl/src/internal/dynlink.h+5-1
...@@ -92,8 +92,12 @@ struct fdpic_dummy_loadmap {...@@ -92,8 +92,12 @@ struct fdpic_dummy_loadmap {
92#define DT_DEBUG_INDIRECT 092#define DT_DEBUG_INDIRECT 0
93#endif93#endif
9494
95#ifndef DT_DEBUG_INDIRECT_REL
96#define DT_DEBUG_INDIRECT_REL 0
97#endif
98
95#define AUX_CNT 3299#define AUX_CNT 32
96#define DYN_CNT 32100#define DYN_CNT 37
97101
98typedef void (*stage2_func)(unsigned char *, size_t *);102typedef void (*stage2_func)(unsigned char *, size_t *);
99103
lib/libc/musl/src/internal/fork_impl.h+1-1
...@@ -2,7 +2,6 @@...@@ -2,7 +2,6 @@
22
3extern hidden volatile int *const __at_quick_exit_lockptr;3extern hidden volatile int *const __at_quick_exit_lockptr;
4extern hidden volatile int *const __atexit_lockptr;4extern hidden volatile int *const __atexit_lockptr;
5extern hidden volatile int *const __dlerror_lockptr;
6extern hidden volatile int *const __gettext_lockptr;5extern hidden volatile int *const __gettext_lockptr;
7extern hidden volatile int *const __locale_lockptr;6extern hidden volatile int *const __locale_lockptr;
8extern hidden volatile int *const __random_lockptr;7extern hidden volatile int *const __random_lockptr;
...@@ -17,3 +16,4 @@ extern hidden volatile int *const __vmlock_lockptr;...@@ -17,3 +16,4 @@ extern hidden volatile int *const __vmlock_lockptr;
1716
18hidden void __malloc_atfork(int);17hidden void __malloc_atfork(int);
19hidden void __ldso_atfork(int);18hidden void __ldso_atfork(int);
19hidden void __pthread_key_atfork(int);
lib/libc/musl/src/internal/ksigaction.h+5
...@@ -6,8 +6,13 @@...@@ -6,8 +6,13 @@
6struct k_sigaction {6struct k_sigaction {
7 void (*handler)(int);7 void (*handler)(int);
8 unsigned long flags;8 unsigned long flags;
9#ifdef SA_RESTORER
9 void (*restorer)(void);10 void (*restorer)(void);
11#endif
10 unsigned mask[2];12 unsigned mask[2];
13#ifndef SA_RESTORER
14 void *unused;
15#endif
11};16};
1217
13hidden void __restore(), __restore_rt();18hidden void __restore(), __restore_rt();
lib/libc/musl/src/internal/syscall.h+13-13
...@@ -58,7 +58,7 @@ hidden long __syscall_ret(unsigned long),...@@ -58,7 +58,7 @@ hidden long __syscall_ret(unsigned long),
58#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__)58#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__)
59#define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))59#define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))
6060
61static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, long c, long d, long e, long f)61static inline long __alt_socketcall(int sys, int sock, int cp, syscall_arg_t a, syscall_arg_t b, syscall_arg_t c, syscall_arg_t d, syscall_arg_t e, syscall_arg_t f)
62{62{
63 long r;63 long r;
64 if (cp) r = __syscall_cp(sys, a, b, c, d, e, f);64 if (cp) r = __syscall_cp(sys, a, b, c, d, e, f);
...@@ -71,9 +71,9 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l...@@ -71,9 +71,9 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l
71 return r;71 return r;
72}72}
73#define __socketcall(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 0, \73#define __socketcall(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 0, \
74 (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f))74 __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f))
75#define __socketcall_cp(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 1, \75#define __socketcall_cp(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 1, \
76 (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f))76 __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f))
7777
78/* fixup legacy 16-bit junk */78/* fixup legacy 16-bit junk */
7979
...@@ -201,43 +201,43 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l...@@ -201,43 +201,43 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l
201#define SYS_sendfile SYS_sendfile64201#define SYS_sendfile SYS_sendfile64
202#endif202#endif
203203
204#ifndef SYS_timer_settime204#ifdef SYS_timer_settime32
205#define SYS_timer_settime SYS_timer_settime32205#define SYS_timer_settime SYS_timer_settime32
206#endif206#endif
207207
208#ifndef SYS_timer_gettime208#ifdef SYS_timer_gettime32
209#define SYS_timer_gettime SYS_timer_gettime32209#define SYS_timer_gettime SYS_timer_gettime32
210#endif210#endif
211211
212#ifndef SYS_timerfd_settime212#ifdef SYS_timerfd_settime32
213#define SYS_timerfd_settime SYS_timerfd_settime32213#define SYS_timerfd_settime SYS_timerfd_settime32
214#endif214#endif
215215
216#ifndef SYS_timerfd_gettime216#ifdef SYS_timerfd_gettime32
217#define SYS_timerfd_gettime SYS_timerfd_gettime32217#define SYS_timerfd_gettime SYS_timerfd_gettime32
218#endif218#endif
219219
220#ifndef SYS_clock_settime220#ifdef SYS_clock_settime32
221#define SYS_clock_settime SYS_clock_settime32221#define SYS_clock_settime SYS_clock_settime32
222#endif222#endif
223223
224#ifndef SYS_clock_gettime224#ifdef SYS_clock_gettime32
225#define SYS_clock_gettime SYS_clock_gettime32225#define SYS_clock_gettime SYS_clock_gettime32
226#endif226#endif
227227
228#ifndef SYS_clock_getres228#ifdef SYS_clock_getres_time32
229#define SYS_clock_getres SYS_clock_getres_time32229#define SYS_clock_getres SYS_clock_getres_time32
230#endif230#endif
231231
232#ifndef SYS_clock_nanosleep232#ifdef SYS_clock_nanosleep_time32
233#define SYS_clock_nanosleep SYS_clock_nanosleep_time32233#define SYS_clock_nanosleep SYS_clock_nanosleep_time32
234#endif234#endif
235235
236#ifndef SYS_gettimeofday236#ifdef SYS_gettimeofday_time32
237#define SYS_gettimeofday SYS_gettimeofday_time32237#define SYS_gettimeofday SYS_gettimeofday_time32
238#endif238#endif
239239
240#ifndef SYS_settimeofday240#ifdef SYS_settimeofday_time32
241#define SYS_settimeofday SYS_settimeofday_time32241#define SYS_settimeofday SYS_settimeofday_time32
242#endif242#endif
243243
lib/libc/musl/src/internal/version.h+1-1
...@@ -1 +1 @@...@@ -1 +1 @@
1#define VERSION "1.2.3"1#define VERSION "1.2.4"
lib/libc/musl/src/ipc/semtimedop.c+2-1
...@@ -7,7 +7,8 @@...@@ -7,7 +7,8 @@
7#define IS32BIT(x) !((x)+0x80000000ULL>>32)7#define IS32BIT(x) !((x)+0x80000000ULL>>32)
8#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))8#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
99
10#if !defined(SYS_semtimedop) && !defined(SYS_ipc)10#if !defined(SYS_semtimedop) && !defined(SYS_ipc) || \
11 SYS_semtimedop == SYS_semtimedop_time64
11#define NO_TIME32 112#define NO_TIME32 1
12#else13#else
13#define NO_TIME32 014#define NO_TIME32 0
lib/libc/musl/src/ldso/dlerror.c+18-16
...@@ -3,8 +3,7 @@...@@ -3,8 +3,7 @@
3#include <stdarg.h>3#include <stdarg.h>
4#include "pthread_impl.h"4#include "pthread_impl.h"
5#include "dynlink.h"5#include "dynlink.h"
6#include "lock.h"6#include "atomic.h"
7#include "fork_impl.h"
87
9#define malloc __libc_malloc8#define malloc __libc_malloc
10#define calloc __libc_calloc9#define calloc __libc_calloc
...@@ -23,28 +22,31 @@ char *dlerror()...@@ -23,28 +22,31 @@ char *dlerror()
23 return s;22 return s;
24}23}
2524
26static volatile int freebuf_queue_lock[1];25/* Atomic singly-linked list, used to store list of thread-local dlerror
27static void **freebuf_queue;26 * buffers for deferred free. They cannot be freed at thread exit time
28volatile int *const __dlerror_lockptr = freebuf_queue_lock;27 * because, by the time it's known they can be freed, the exiting thread
28 * is in a highly restrictive context where it cannot call (even the
29 * libc-internal) free. It also can't take locks; thus the atomic list. */
30
31static void *volatile freebuf_queue;
2932
30void __dl_thread_cleanup(void)33void __dl_thread_cleanup(void)
31{34{
32 pthread_t self = __pthread_self();35 pthread_t self = __pthread_self();
33 if (self->dlerror_buf && self->dlerror_buf != (void *)-1) {36 if (!self->dlerror_buf || self->dlerror_buf == (void *)-1)
34 LOCK(freebuf_queue_lock);37 return;
35 void **p = (void **)self->dlerror_buf;38 void *h;
36 *p = freebuf_queue;39 do {
37 freebuf_queue = p;40 h = freebuf_queue;
38 UNLOCK(freebuf_queue_lock);41 *(void **)self->dlerror_buf = h;
39 }42 } while (a_cas_p(&freebuf_queue, h, self->dlerror_buf) != h);
40}43}
4144
42hidden void __dl_vseterr(const char *fmt, va_list ap)45hidden void __dl_vseterr(const char *fmt, va_list ap)
43{46{
44 LOCK(freebuf_queue_lock);47 void **q;
45 void **q = freebuf_queue;48 do q = freebuf_queue;
46 freebuf_queue = 0;49 while (q && a_cas_p(&freebuf_queue, q, 0) != q);
47 UNLOCK(freebuf_queue_lock);
4850
49 while (q) {51 while (q) {
50 void **p = *q;52 void **p = *q;
lib/libc/musl/src/legacy/ftw.c-2
...@@ -7,5 +7,3 @@ int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int...@@ -7,5 +7,3 @@ int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int
7 * actually undefined, but works on all real-world machines. */7 * actually undefined, but works on all real-world machines. */
8 return nftw(path, (int (*)())fn, fd_limit, FTW_PHYS);8 return nftw(path, (int (*)())fn, fd_limit, FTW_PHYS);
9}9}
10
11weak_alias(ftw, ftw64);
lib/libc/musl/src/linux/epoll.c+1
...@@ -5,6 +5,7 @@...@@ -5,6 +5,7 @@
55
6int epoll_create(int size)6int epoll_create(int size)
7{7{
8 if (size<=0) return __syscall_ret(-EINVAL);
8 return epoll_create1(0);9 return epoll_create1(0);
9}10}
1011
lib/libc/musl/src/linux/fallocate.c-3
...@@ -7,6 +7,3 @@ int fallocate(int fd, int mode, off_t base, off_t len)...@@ -7,6 +7,3 @@ int fallocate(int fd, int mode, off_t base, off_t len)
7 return syscall(SYS_fallocate, fd, mode, __SYSCALL_LL_E(base),7 return syscall(SYS_fallocate, fd, mode, __SYSCALL_LL_E(base),
8 __SYSCALL_LL_E(len));8 __SYSCALL_LL_E(len));
9}9}
10
11#undef fallocate64
12weak_alias(fallocate, fallocate64);
lib/libc/musl/src/linux/getdents.c-2
...@@ -8,5 +8,3 @@ int getdents(int fd, struct dirent *buf, size_t len)...@@ -8,5 +8,3 @@ int getdents(int fd, struct dirent *buf, size_t len)
8 if (len>INT_MAX) len = INT_MAX;8 if (len>INT_MAX) len = INT_MAX;
9 return syscall(SYS_getdents, fd, buf, len);9 return syscall(SYS_getdents, fd, buf, len);
10}10}
11
12weak_alias(getdents, getdents64);
lib/libc/musl/src/linux/membarrier.c+1-1
...@@ -35,7 +35,7 @@ int __membarrier(int cmd, int flags)...@@ -35,7 +35,7 @@ int __membarrier(int cmd, int flags)
35 __tl_lock();35 __tl_lock();
36 sem_init(&barrier_sem, 0, 0);36 sem_init(&barrier_sem, 0, 0);
37 struct sigaction sa = {37 struct sigaction sa = {
38 .sa_flags = SA_RESTART,38 .sa_flags = SA_RESTART | SA_ONSTACK,
39 .sa_handler = bcast_barrier39 .sa_handler = bcast_barrier
40 };40 };
41 memset(&sa.sa_mask, -1, sizeof sa.sa_mask);41 memset(&sa.sa_mask, -1, sizeof sa.sa_mask);
lib/libc/musl/src/linux/prlimit.c-3
...@@ -21,6 +21,3 @@ int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlim...@@ -21,6 +21,3 @@ int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlim
21 }21 }
22 return r;22 return r;
23}23}
24
25#undef prlimit64
26weak_alias(prlimit, prlimit64);
lib/libc/musl/src/linux/sendfile.c-2
...@@ -5,5 +5,3 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *ofs, size_t count)...@@ -5,5 +5,3 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *ofs, size_t count)
5{5{
6 return syscall(SYS_sendfile, out_fd, in_fd, ofs, count);6 return syscall(SYS_sendfile, out_fd, in_fd, ofs, count);
7}7}
8
9weak_alias(sendfile, sendfile64);
lib/libc/musl/src/linux/wait4.c+1-1
...@@ -12,7 +12,7 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru)...@@ -12,7 +12,7 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru)
12 if (ru) {12 if (ru) {
13 long long kru64[18];13 long long kru64[18];
14 r = __syscall(SYS_wait4_time64, pid, status, options, kru64);14 r = __syscall(SYS_wait4_time64, pid, status, options, kru64);
15 if (!r) {15 if (r > 0) {
16 ru->ru_utime = (struct timeval)16 ru->ru_utime = (struct timeval)
17 { .tv_sec = kru64[0], .tv_usec = kru64[1] };17 { .tv_sec = kru64[0], .tv_usec = kru64[1] };
18 ru->ru_stime = (struct timeval)18 ru->ru_stime = (struct timeval)
lib/libc/musl/src/malloc/mallocng/free.c+1-1
...@@ -119,7 +119,7 @@ void free(void *p)...@@ -119,7 +119,7 @@ void free(void *p)
119 if (((uintptr_t)(start-1) ^ (uintptr_t)end) >= 2*PGSZ && g->last_idx) {119 if (((uintptr_t)(start-1) ^ (uintptr_t)end) >= 2*PGSZ && g->last_idx) {
120 unsigned char *base = start + (-(uintptr_t)start & (PGSZ-1));120 unsigned char *base = start + (-(uintptr_t)start & (PGSZ-1));
121 size_t len = (end-base) & -PGSZ;121 size_t len = (end-base) & -PGSZ;
122 if (len) {122 if (len && USE_MADV_FREE) {
123 int e = errno;123 int e = errno;
124 madvise(base, len, MADV_FREE);124 madvise(base, len, MADV_FREE);
125 errno = e;125 errno = e;
lib/libc/musl/src/malloc/mallocng/glue.h+2
...@@ -24,6 +24,8 @@...@@ -24,6 +24,8 @@
24#define realloc __libc_realloc24#define realloc __libc_realloc
25#define free __libc_free25#define free __libc_free
2626
27#define USE_MADV_FREE 0
28
27#if USE_REAL_ASSERT29#if USE_REAL_ASSERT
28#include <assert.h>30#include <assert.h>
29#else31#else
lib/libc/musl/src/math/logf.c+1-1
...@@ -53,7 +53,7 @@ float logf(float x)...@@ -53,7 +53,7 @@ float logf(float x)
53 tmp = ix - OFF;53 tmp = ix - OFF;
54 i = (tmp >> (23 - LOGF_TABLE_BITS)) % N;54 i = (tmp >> (23 - LOGF_TABLE_BITS)) % N;
55 k = (int32_t)tmp >> 23; /* arithmetic shift */55 k = (int32_t)tmp >> 23; /* arithmetic shift */
56 iz = ix - (tmp & 0x1ff << 23);56 iz = ix - (tmp & 0xff800000);
57 invc = T[i].invc;57 invc = T[i].invc;
58 logc = T[i].logc;58 logc = T[i].logc;
59 z = (double_t)asfloat(iz);59 z = (double_t)asfloat(iz);
lib/libc/musl/src/misc/getopt.c+2-1
...@@ -87,7 +87,8 @@ int getopt(int argc, char * const argv[], const char *optstring)...@@ -87,7 +87,8 @@ int getopt(int argc, char * const argv[], const char *optstring)
87 if (optstring[i] == ':') {87 if (optstring[i] == ':') {
88 optarg = 0;88 optarg = 0;
89 if (optstring[i+1] != ':' || optpos) {89 if (optstring[i+1] != ':' || optpos) {
90 optarg = argv[optind++] + optpos;90 optarg = argv[optind++];
91 if (optpos) optarg += optpos;
91 optpos = 0;92 optpos = 0;
92 }93 }
93 if (optind > argc) {94 if (optind > argc) {
lib/libc/musl/src/misc/getrlimit.c+5-3
...@@ -6,12 +6,13 @@...@@ -6,12 +6,13 @@
66
7int getrlimit(int resource, struct rlimit *rlim)7int getrlimit(int resource, struct rlimit *rlim)
8{8{
9 unsigned long k_rlim[2];
10 int ret = syscall(SYS_prlimit64, 0, resource, 0, rlim);9 int ret = syscall(SYS_prlimit64, 0, resource, 0, rlim);
11 if (!ret) {10 if (!ret) {
12 FIX(rlim->rlim_cur);11 FIX(rlim->rlim_cur);
13 FIX(rlim->rlim_max);12 FIX(rlim->rlim_max);
14 }13 }
14#ifdef SYS_getrlimit
15 unsigned long k_rlim[2];
15 if (!ret || errno != ENOSYS)16 if (!ret || errno != ENOSYS)
16 return ret;17 return ret;
17 if (syscall(SYS_getrlimit, resource, k_rlim) < 0)18 if (syscall(SYS_getrlimit, resource, k_rlim) < 0)
...@@ -21,6 +22,7 @@ int getrlimit(int resource, struct rlimit *rlim)...@@ -21,6 +22,7 @@ int getrlimit(int resource, struct rlimit *rlim)
21 FIX(rlim->rlim_cur);22 FIX(rlim->rlim_cur);
22 FIX(rlim->rlim_max);23 FIX(rlim->rlim_max);
23 return 0;24 return 0;
25#else
26 return ret;
27#endif
24}28}
25
26weak_alias(getrlimit, getrlimit64);
lib/libc/musl/src/misc/lockf.c-2
...@@ -28,5 +28,3 @@ int lockf(int fd, int op, off_t size)...@@ -28,5 +28,3 @@ int lockf(int fd, int op, off_t size)
28 errno = EINVAL;28 errno = EINVAL;
29 return -1;29 return -1;
30}30}
31
32weak_alias(lockf, lockf64);
lib/libc/musl/src/misc/mntent.c+9-3
...@@ -2,6 +2,7 @@...@@ -2,6 +2,7 @@
2#include <string.h>2#include <string.h>
3#include <mntent.h>3#include <mntent.h>
4#include <errno.h>4#include <errno.h>
5#include <limits.h>
56
6static char *internal_buf;7static char *internal_buf;
7static size_t internal_bufsize;8static size_t internal_bufsize;
...@@ -21,7 +22,8 @@ int endmntent(FILE *f)...@@ -21,7 +22,8 @@ int endmntent(FILE *f)
2122
22struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen)23struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen)
23{24{
24 int cnt, n[8], use_internal = (linebuf == SENTINEL);25 int n[8], use_internal = (linebuf == SENTINEL);
26 size_t len, i;
2527
26 mnt->mnt_freq = 0;28 mnt->mnt_freq = 0;
27 mnt->mnt_passno = 0;29 mnt->mnt_passno = 0;
...@@ -39,10 +41,14 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle...@@ -39,10 +41,14 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle
39 errno = ERANGE;41 errno = ERANGE;
40 return 0;42 return 0;
41 }43 }
42 cnt = sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d",44
45 len = strlen(linebuf);
46 if (len > INT_MAX) continue;
47 for (i = 0; i < sizeof n / sizeof *n; i++) n[i] = len;
48 sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d",
43 n, n+1, n+2, n+3, n+4, n+5, n+6, n+7,49 n, n+1, n+2, n+3, n+4, n+5, n+6, n+7,
44 &mnt->mnt_freq, &mnt->mnt_passno);50 &mnt->mnt_freq, &mnt->mnt_passno);
45 } while (cnt < 2 || linebuf[n[0]] == '#');51 } while (linebuf[n[0]] == '#' || n[1]==len);
4652
47 linebuf[n[1]] = 0;53 linebuf[n[1]] = 0;
48 linebuf[n[3]] = 0;54 linebuf[n[3]] = 0;
lib/libc/musl/src/misc/nftw.c+3-3
...@@ -31,6 +31,8 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,...@@ -31,6 +31,8 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,
31 int err;31 int err;
32 struct FTW lev;32 struct FTW lev;
3333
34 st.st_dev = st.st_ino = 0;
35
34 if ((flags & FTW_PHYS) ? lstat(path, &st) : stat(path, &st) < 0) {36 if ((flags & FTW_PHYS) ? lstat(path, &st) : stat(path, &st) < 0) {
35 if (!(flags & FTW_PHYS) && errno==ENOENT && !lstat(path, &st))37 if (!(flags & FTW_PHYS) && errno==ENOENT && !lstat(path, &st))
36 type = FTW_SLN;38 type = FTW_SLN;
...@@ -46,7 +48,7 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,...@@ -46,7 +48,7 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,
46 type = FTW_F;48 type = FTW_F;
47 }49 }
4850
49 if ((flags & FTW_MOUNT) && h && st.st_dev != h->dev)51 if ((flags & FTW_MOUNT) && h && type != FTW_NS && st.st_dev != h->dev)
50 return 0;52 return 0;
51 53
52 new.chain = h;54 new.chain = h;
...@@ -138,5 +140,3 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str...@@ -138,5 +140,3 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str
138 pthread_setcancelstate(cs, 0);140 pthread_setcancelstate(cs, 0);
139 return r;141 return r;
140}142}
141
142weak_alias(nftw, nftw64);
lib/libc/musl/src/misc/setrlimit.c+6-2
...@@ -12,12 +12,14 @@ struct ctx {...@@ -12,12 +12,14 @@ struct ctx {
12 int err;12 int err;
13};13};
1414
15#ifdef SYS_setrlimit
15static void do_setrlimit(void *p)16static void do_setrlimit(void *p)
16{17{
17 struct ctx *c = p;18 struct ctx *c = p;
18 if (c->err>0) return;19 if (c->err>0) return;
19 c->err = -__syscall(SYS_setrlimit, c->res, c->lim);20 c->err = -__syscall(SYS_setrlimit, c->res, c->lim);
20}21}
22#endif
2123
22int setrlimit(int resource, const struct rlimit *rlim)24int setrlimit(int resource, const struct rlimit *rlim)
23{25{
...@@ -29,6 +31,7 @@ int setrlimit(int resource, const struct rlimit *rlim)...@@ -29,6 +31,7 @@ int setrlimit(int resource, const struct rlimit *rlim)
29 rlim = &tmp;31 rlim = &tmp;
30 }32 }
31 int ret = __syscall(SYS_prlimit64, 0, resource, rlim, 0);33 int ret = __syscall(SYS_prlimit64, 0, resource, rlim, 0);
34#ifdef SYS_setrlimit
32 if (ret != -ENOSYS) return __syscall_ret(ret);35 if (ret != -ENOSYS) return __syscall_ret(ret);
3336
34 struct ctx c = {37 struct ctx c = {
...@@ -42,6 +45,7 @@ int setrlimit(int resource, const struct rlimit *rlim)...@@ -42,6 +45,7 @@ int setrlimit(int resource, const struct rlimit *rlim)
42 return -1;45 return -1;
43 }46 }
44 return 0;47 return 0;
48#else
49 return __syscall_ret(ret);
50#endif
45}51}
46
47weak_alias(setrlimit, setrlimit64);
lib/libc/musl/src/mman/mmap.c-2
...@@ -37,5 +37,3 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)...@@ -37,5 +37,3 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
37}37}
3838
39weak_alias(__mmap, mmap);39weak_alias(__mmap, mmap);
40
41weak_alias(mmap, mmap64);
lib/libc/musl/src/mq/mq_notify.c+33-14
...@@ -4,11 +4,14 @@...@@ -4,11 +4,14 @@
4#include <sys/socket.h>4#include <sys/socket.h>
5#include <signal.h>5#include <signal.h>
6#include <unistd.h>6#include <unistd.h>
7#include <semaphore.h>
7#include "syscall.h"8#include "syscall.h"
89
9struct args {10struct args {
10 pthread_barrier_t barrier;11 sem_t sem;
11 int sock;12 int sock;
13 mqd_t mqd;
14 int err;
12 const struct sigevent *sev;15 const struct sigevent *sev;
13};16};
1417
...@@ -20,8 +23,19 @@ static void *start(void *p)...@@ -20,8 +23,19 @@ static void *start(void *p)
20 int s = args->sock;23 int s = args->sock;
21 void (*func)(union sigval) = args->sev->sigev_notify_function;24 void (*func)(union sigval) = args->sev->sigev_notify_function;
22 union sigval val = args->sev->sigev_value;25 union sigval val = args->sev->sigev_value;
26 struct sigevent sev2;
27 static const char zeros[32];
28 int err;
29
30 sev2.sigev_notify = SIGEV_THREAD;
31 sev2.sigev_signo = s;
32 sev2.sigev_value.sival_ptr = (void *)&zeros;
33
34 args->err = err = -__syscall(SYS_mq_notify, args->mqd, &sev2);
35 sem_post(&args->sem);
36 if (err) return 0;
2337
24 pthread_barrier_wait(&args->barrier);38 pthread_detach(pthread_self());
25 n = recv(s, buf, sizeof(buf), MSG_NOSIGNAL|MSG_WAITALL);39 n = recv(s, buf, sizeof(buf), MSG_NOSIGNAL|MSG_WAITALL);
26 close(s);40 close(s);
27 if (n==sizeof buf && buf[sizeof buf - 1] == 1)41 if (n==sizeof buf && buf[sizeof buf - 1] == 1)
...@@ -35,8 +49,8 @@ int mq_notify(mqd_t mqd, const struct sigevent *sev)...@@ -35,8 +49,8 @@ int mq_notify(mqd_t mqd, const struct sigevent *sev)
35 pthread_attr_t attr;49 pthread_attr_t attr;
36 pthread_t td;50 pthread_t td;
37 int s;51 int s;
38 struct sigevent sev2;52 int cs;
39 static const char zeros[32];53 sigset_t allmask, origmask;
4054
41 if (!sev || sev->sigev_notify != SIGEV_THREAD)55 if (!sev || sev->sigev_notify != SIGEV_THREAD)
42 return syscall(SYS_mq_notify, mqd, sev);56 return syscall(SYS_mq_notify, mqd, sev);
...@@ -44,30 +58,35 @@ int mq_notify(mqd_t mqd, const struct sigevent *sev)...@@ -44,30 +58,35 @@ int mq_notify(mqd_t mqd, const struct sigevent *sev)
44 s = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, 0);58 s = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, 0);
45 if (s < 0) return -1;59 if (s < 0) return -1;
46 args.sock = s;60 args.sock = s;
61 args.mqd = mqd;
4762
48 if (sev->sigev_notify_attributes) attr = *sev->sigev_notify_attributes;63 if (sev->sigev_notify_attributes) attr = *sev->sigev_notify_attributes;
49 else pthread_attr_init(&attr);64 else pthread_attr_init(&attr);
50 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);65 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
51 pthread_barrier_init(&args.barrier, 0, 2);66 sem_init(&args.sem, 0, 0);
5267
68 sigfillset(&allmask);
69 pthread_sigmask(SIG_BLOCK, &allmask, &origmask);
53 if (pthread_create(&td, &attr, start, &args)) {70 if (pthread_create(&td, &attr, start, &args)) {
54 __syscall(SYS_close, s);71 __syscall(SYS_close, s);
72 pthread_sigmask(SIG_SETMASK, &origmask, 0);
55 errno = EAGAIN;73 errno = EAGAIN;
56 return -1;74 return -1;
57 }75 }
76 pthread_sigmask(SIG_SETMASK, &origmask, 0);
5877
59 pthread_barrier_wait(&args.barrier);78 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
60 pthread_barrier_destroy(&args.barrier);79 sem_wait(&args.sem);
6180 sem_destroy(&args.sem);
62 sev2.sigev_notify = SIGEV_THREAD;
63 sev2.sigev_signo = s;
64 sev2.sigev_value.sival_ptr = (void *)&zeros;
6581
66 if (syscall(SYS_mq_notify, mqd, &sev2) < 0) {82 if (args.err) {
67 pthread_cancel(td);
68 __syscall(SYS_close, s);83 __syscall(SYS_close, s);
84 pthread_join(td, 0);
85 pthread_setcancelstate(cs, 0);
86 errno = args.err;
69 return -1;87 return -1;
70 }88 }
7189
90 pthread_setcancelstate(cs, 0);
72 return 0;91 return 0;
73}92}
lib/libc/musl/src/network/accept4.c+4
...@@ -9,6 +9,10 @@ int accept4(int fd, struct sockaddr *restrict addr, socklen_t *restrict len, int...@@ -9,6 +9,10 @@ int accept4(int fd, struct sockaddr *restrict addr, socklen_t *restrict len, int
9 if (!flg) return accept(fd, addr, len);9 if (!flg) return accept(fd, addr, len);
10 int ret = socketcall_cp(accept4, fd, addr, len, flg, 0, 0);10 int ret = socketcall_cp(accept4, fd, addr, len, flg, 0, 0);
11 if (ret>=0 || (errno != ENOSYS && errno != EINVAL)) return ret;11 if (ret>=0 || (errno != ENOSYS && errno != EINVAL)) return ret;
12 if (flg & ~(SOCK_CLOEXEC|SOCK_NONBLOCK)) {
13 errno = EINVAL;
14 return -1;
15 }
12 ret = accept(fd, addr, len);16 ret = accept(fd, addr, len);
13 if (ret<0) return ret;17 if (ret<0) return ret;
14 if (flg & SOCK_CLOEXEC)18 if (flg & SOCK_CLOEXEC)
lib/libc/musl/src/network/dns_parse.c+5-5
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1#include <string.h>1#include <string.h>
2#include "lookup.h"2#include "lookup.h"
33
4int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, const void *, int, const void *), void *ctx)4int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, const void *, int, const void *, int), void *ctx)
5{5{
6 int qdcount, ancount;6 int qdcount, ancount;
7 const unsigned char *p;7 const unsigned char *p;
...@@ -15,18 +15,18 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c...@@ -15,18 +15,18 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c
15 if (qdcount+ancount > 64) return -1;15 if (qdcount+ancount > 64) return -1;
16 while (qdcount--) {16 while (qdcount--) {
17 while (p-r < rlen && *p-1U < 127) p++;17 while (p-r < rlen && *p-1U < 127) p++;
18 if (*p>193 || (*p==193 && p[1]>254) || p>r+rlen-6)18 if (p>r+rlen-6 || *p>193 || (*p==193 && p[1]>254))
19 return -1;19 return -1;
20 p += 5 + !!*p;20 p += 5 + !!*p;
21 }21 }
22 while (ancount--) {22 while (ancount--) {
23 while (p-r < rlen && *p-1U < 127) p++;23 while (p-r < rlen && *p-1U < 127) p++;
24 if (*p>193 || (*p==193 && p[1]>254) || p>r+rlen-6)24 if (p>r+rlen-12 || *p>193 || (*p==193 && p[1]>254))
25 return -1;25 return -1;
26 p += 1 + !!*p;26 p += 1 + !!*p;
27 len = p[8]*256 + p[9];27 len = p[8]*256 + p[9];
28 if (p+len > r+rlen) return -1;28 if (len+10 > r+rlen-p) return -1;
29 if (callback(ctx, p[1], p+10, len, r) < 0) return -1;29 if (callback(ctx, p[1], p+10, len, r, rlen) < 0) return -1;
30 p += 10 + len;30 p += 10 + len;
31 }31 }
32 return 0;32 return 0;
lib/libc/musl/src/network/gai_strerror.c+1-1
...@@ -6,7 +6,7 @@ static const char msgs[] =...@@ -6,7 +6,7 @@ static const char msgs[] =
6 "Name does not resolve\0"6 "Name does not resolve\0"
7 "Try again\0"7 "Try again\0"
8 "Non-recoverable error\0"8 "Non-recoverable error\0"
9 "Unknown error\0"9 "Name has no usable address\0"
10 "Unrecognized address family or invalid length\0"10 "Unrecognized address family or invalid length\0"
11 "Unrecognized socket type\0"11 "Unrecognized socket type\0"
12 "Unrecognized service\0"12 "Unrecognized service\0"
lib/libc/musl/src/network/getaddrinfo.c+6-1
...@@ -16,6 +16,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru...@@ -16,6 +16,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
16 char canon[256], *outcanon;16 char canon[256], *outcanon;
17 int nservs, naddrs, nais, canon_len, i, j, k;17 int nservs, naddrs, nais, canon_len, i, j, k;
18 int family = AF_UNSPEC, flags = 0, proto = 0, socktype = 0;18 int family = AF_UNSPEC, flags = 0, proto = 0, socktype = 0;
19 int no_family = 0;
19 struct aibuf *out;20 struct aibuf *out;
2021
21 if (!host && !serv) return EAI_NONAME;22 if (!host && !serv) return EAI_NONAME;
...@@ -66,9 +67,11 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru...@@ -66,9 +67,11 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
66 pthread_setcancelstate(67 pthread_setcancelstate(
67 PTHREAD_CANCEL_DISABLE, &cs);68 PTHREAD_CANCEL_DISABLE, &cs);
68 int r = connect(s, ta[i], tl[i]);69 int r = connect(s, ta[i], tl[i]);
70 int saved_errno = errno;
69 pthread_setcancelstate(cs, 0);71 pthread_setcancelstate(cs, 0);
70 close(s);72 close(s);
71 if (!r) continue;73 if (!r) continue;
74 errno = saved_errno;
72 }75 }
73 switch (errno) {76 switch (errno) {
74 case EADDRNOTAVAIL:77 case EADDRNOTAVAIL:
...@@ -80,7 +83,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru...@@ -80,7 +83,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
80 default:83 default:
81 return EAI_SYSTEM;84 return EAI_SYSTEM;
82 }85 }
83 if (family == tf[i]) return EAI_NONAME;86 if (family == tf[i]) no_family = 1;
84 family = tf[1-i];87 family = tf[1-i];
85 }88 }
86 }89 }
...@@ -91,6 +94,8 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru...@@ -91,6 +94,8 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
91 naddrs = __lookup_name(addrs, canon, host, family, flags);94 naddrs = __lookup_name(addrs, canon, host, family, flags);
92 if (naddrs < 0) return naddrs;95 if (naddrs < 0) return naddrs;
9396
97 if (no_family) return EAI_NODATA;
98
94 nais = nservs * naddrs;99 nais = nservs * naddrs;
95 canon_len = strlen(canon);100 canon_len = strlen(canon);
96 out = calloc(1, nais * sizeof(*out) + canon_len + 1);101 out = calloc(1, nais * sizeof(*out) + canon_len + 1);
lib/libc/musl/src/network/gethostbyaddr.c+1-1
...@@ -20,5 +20,5 @@ struct hostent *gethostbyaddr(const void *a, socklen_t l, int af)...@@ -20,5 +20,5 @@ struct hostent *gethostbyaddr(const void *a, socklen_t l, int af)
20 err = gethostbyaddr_r(a, l, af, h,20 err = gethostbyaddr_r(a, l, af, h,
21 (void *)(h+1), size-sizeof *h, &res, &h_errno);21 (void *)(h+1), size-sizeof *h, &res, &h_errno);
22 } while (err == ERANGE);22 } while (err == ERANGE);
23 return err ? 0 : h;23 return res;
24}24}
lib/libc/musl/src/network/gethostbyaddr_r.c+3-2
...@@ -54,9 +54,10 @@ int gethostbyaddr_r(const void *a, socklen_t l, int af,...@@ -54,9 +54,10 @@ int gethostbyaddr_r(const void *a, socklen_t l, int af,
54 case EAI_OVERFLOW:54 case EAI_OVERFLOW:
55 return ERANGE;55 return ERANGE;
56 default:56 default:
57 case EAI_MEMORY:
58 case EAI_SYSTEM:
59 case EAI_FAIL:57 case EAI_FAIL:
58 *err = NO_RECOVERY;
59 return EBADMSG;
60 case EAI_SYSTEM:
60 *err = NO_RECOVERY;61 *err = NO_RECOVERY;
61 return errno;62 return errno;
62 case 0:63 case 0:
lib/libc/musl/src/network/gethostbyname2.c+1-1
...@@ -21,5 +21,5 @@ struct hostent *gethostbyname2(const char *name, int af)...@@ -21,5 +21,5 @@ struct hostent *gethostbyname2(const char *name, int af)
21 err = gethostbyname2_r(name, af, h,21 err = gethostbyname2_r(name, af, h,
22 (void *)(h+1), size-sizeof *h, &res, &h_errno);22 (void *)(h+1), size-sizeof *h, &res, &h_errno);
23 } while (err == ERANGE);23 } while (err == ERANGE);
24 return err ? 0 : h;24 return res;
25}25}
lib/libc/musl/src/network/gethostbyname2_r.c+4-2
...@@ -22,7 +22,10 @@ int gethostbyname2_r(const char *name, int af,...@@ -22,7 +22,10 @@ int gethostbyname2_r(const char *name, int af,
22 if (cnt<0) switch (cnt) {22 if (cnt<0) switch (cnt) {
23 case EAI_NONAME:23 case EAI_NONAME:
24 *err = HOST_NOT_FOUND;24 *err = HOST_NOT_FOUND;
25 return ENOENT;25 return 0;
26 case EAI_NODATA:
27 *err = NO_DATA;
28 return 0;
26 case EAI_AGAIN:29 case EAI_AGAIN:
27 *err = TRY_AGAIN;30 *err = TRY_AGAIN;
28 return EAGAIN;31 return EAGAIN;
...@@ -30,7 +33,6 @@ int gethostbyname2_r(const char *name, int af,...@@ -30,7 +33,6 @@ int gethostbyname2_r(const char *name, int af,
30 case EAI_FAIL:33 case EAI_FAIL:
31 *err = NO_RECOVERY;34 *err = NO_RECOVERY;
32 return EBADMSG;35 return EBADMSG;
33 case EAI_MEMORY:
34 case EAI_SYSTEM:36 case EAI_SYSTEM:
35 *err = NO_RECOVERY;37 *err = NO_RECOVERY;
36 return errno;38 return errno;
lib/libc/musl/src/network/getifaddrs.c+7-7
...@@ -39,8 +39,8 @@ struct ifaddrs_storage {...@@ -39,8 +39,8 @@ struct ifaddrs_storage {
39};39};
4040
41struct ifaddrs_ctx {41struct ifaddrs_ctx {
42 struct ifaddrs_storage *first;42 struct ifaddrs *first;
43 struct ifaddrs_storage *last;43 struct ifaddrs *last;
44 struct ifaddrs_storage *hash[IFADDRS_HASH_SIZE];44 struct ifaddrs_storage *hash[IFADDRS_HASH_SIZE];
45};45};
4646
...@@ -195,9 +195,9 @@ static int netlink_msg_to_ifaddr(void *pctx, struct nlmsghdr *h)...@@ -195,9 +195,9 @@ static int netlink_msg_to_ifaddr(void *pctx, struct nlmsghdr *h)
195 }195 }
196196
197 if (ifs->ifa.ifa_name) {197 if (ifs->ifa.ifa_name) {
198 if (!ctx->first) ctx->first = ifs;198 if (!ctx->first) ctx->first = &ifs->ifa;
199 if (ctx->last) ctx->last->ifa.ifa_next = &ifs->ifa;199 if (ctx->last) ctx->last->ifa_next = &ifs->ifa;
200 ctx->last = ifs;200 ctx->last = &ifs->ifa;
201 } else {201 } else {
202 free(ifs);202 free(ifs);
203 }203 }
...@@ -210,7 +210,7 @@ int getifaddrs(struct ifaddrs **ifap)...@@ -210,7 +210,7 @@ int getifaddrs(struct ifaddrs **ifap)
210 int r;210 int r;
211 memset(ctx, 0, sizeof *ctx);211 memset(ctx, 0, sizeof *ctx);
212 r = __rtnetlink_enumerate(AF_UNSPEC, AF_UNSPEC, netlink_msg_to_ifaddr, ctx);212 r = __rtnetlink_enumerate(AF_UNSPEC, AF_UNSPEC, netlink_msg_to_ifaddr, ctx);
213 if (r == 0) *ifap = &ctx->first->ifa;213 if (r == 0) *ifap = ctx->first;
214 else freeifaddrs(&ctx->first->ifa);214 else freeifaddrs(ctx->first);
215 return r;215 return r;
216}216}
lib/libc/musl/src/network/getnameinfo.c+3-2
...@@ -58,6 +58,7 @@ static void reverse_hosts(char *buf, const unsigned char *a, unsigned scopeid, i...@@ -58,6 +58,7 @@ static void reverse_hosts(char *buf, const unsigned char *a, unsigned scopeid, i
58 if ((p=strchr(line, '#'))) *p++='\n', *p=0;58 if ((p=strchr(line, '#'))) *p++='\n', *p=0;
5959
60 for (p=line; *p && !isspace(*p); p++);60 for (p=line; *p && !isspace(*p); p++);
61 if (!*p) continue;
61 *p++ = 0;62 *p++ = 0;
62 if (__lookup_ipliteral(&iplit, line, AF_UNSPEC)<=0)63 if (__lookup_ipliteral(&iplit, line, AF_UNSPEC)<=0)
63 continue;64 continue;
...@@ -108,10 +109,10 @@ static void reverse_services(char *buf, int port, int dgram)...@@ -108,10 +109,10 @@ static void reverse_services(char *buf, int port, int dgram)
108 __fclose_ca(f);109 __fclose_ca(f);
109}110}
110111
111static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet)112static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet, int plen)
112{113{
113 if (rr != RR_PTR) return 0;114 if (rr != RR_PTR) return 0;
114 if (__dn_expand(packet, (const unsigned char *)packet + 512,115 if (__dn_expand(packet, (const unsigned char *)packet + plen,
115 data, c, 256) <= 0)116 data, c, 256) <= 0)
116 *(char *)c = 0;117 *(char *)c = 0;
117 return 0;118 return 0;
lib/libc/musl/src/network/getservbyport_r.c+3-1
...@@ -26,7 +26,7 @@ int getservbyport_r(int port, const char *prots,...@@ -26,7 +26,7 @@ int getservbyport_r(int port, const char *prots,
26 /* Align buffer */26 /* Align buffer */
27 i = (uintptr_t)buf & sizeof(char *)-1;27 i = (uintptr_t)buf & sizeof(char *)-1;
28 if (!i) i = sizeof(char *);28 if (!i) i = sizeof(char *);
29 if (buflen < 3*sizeof(char *)-i)29 if (buflen <= 3*sizeof(char *)-i)
30 return ERANGE;30 return ERANGE;
31 buf += sizeof(char *)-i;31 buf += sizeof(char *)-i;
32 buflen -= sizeof(char *)-i;32 buflen -= sizeof(char *)-i;
...@@ -46,6 +46,8 @@ int getservbyport_r(int port, const char *prots,...@@ -46,6 +46,8 @@ int getservbyport_r(int port, const char *prots,
46 case EAI_MEMORY:46 case EAI_MEMORY:
47 case EAI_SYSTEM:47 case EAI_SYSTEM:
48 return ENOMEM;48 return ENOMEM;
49 case EAI_OVERFLOW:
50 return ERANGE;
49 default:51 default:
50 return ENOENT;52 return ENOENT;
51 case 0:53 case 0:
lib/libc/musl/src/network/inet_pton.c+1
...@@ -54,6 +54,7 @@ int inet_pton(int af, const char *restrict s, void *restrict a0)...@@ -54,6 +54,7 @@ int inet_pton(int af, const char *restrict s, void *restrict a0)
54 if (s[j]!='.' || (i<6 && brk<0)) return 0;54 if (s[j]!='.' || (i<6 && brk<0)) return 0;
55 need_v4=1;55 need_v4=1;
56 i++;56 i++;
57 ip[i&7]=0;
57 break;58 break;
58 }59 }
59 s += j+1;60 s += j+1;
lib/libc/musl/src/network/lookup.h+1-1
...@@ -50,6 +50,6 @@ hidden int __lookup_ipliteral(struct address buf[static 1], const char *name, in...@@ -50,6 +50,6 @@ hidden int __lookup_ipliteral(struct address buf[static 1], const char *name, in
50hidden int __get_resolv_conf(struct resolvconf *, char *, size_t);50hidden int __get_resolv_conf(struct resolvconf *, char *, size_t);
51hidden int __res_msend_rc(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int, const struct resolvconf *);51hidden int __res_msend_rc(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int, const struct resolvconf *);
5252
53hidden int __dns_parse(const unsigned char *, int, int (*)(void *, int, const void *, int, const void *), void *);53hidden int __dns_parse(const unsigned char *, int, int (*)(void *, int, const void *, int, const void *, int), void *);
5454
55#endif55#endif
lib/libc/musl/src/network/lookup_ipliteral.c+2-2
...@@ -15,7 +15,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil...@@ -15,7 +15,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
15 struct in6_addr a6;15 struct in6_addr a6;
16 if (__inet_aton(name, &a4) > 0) {16 if (__inet_aton(name, &a4) > 0) {
17 if (family == AF_INET6) /* wrong family */17 if (family == AF_INET6) /* wrong family */
18 return EAI_NONAME;18 return EAI_NODATA;
19 memcpy(&buf[0].addr, &a4, sizeof a4);19 memcpy(&buf[0].addr, &a4, sizeof a4);
20 buf[0].family = AF_INET;20 buf[0].family = AF_INET;
21 buf[0].scopeid = 0;21 buf[0].scopeid = 0;
...@@ -34,7 +34,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil...@@ -34,7 +34,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
34 if (inet_pton(AF_INET6, name, &a6) <= 0)34 if (inet_pton(AF_INET6, name, &a6) <= 0)
35 return 0;35 return 0;
36 if (family == AF_INET) /* wrong family */36 if (family == AF_INET) /* wrong family */
37 return EAI_NONAME;37 return EAI_NODATA;
3838
39 memcpy(&buf[0].addr, &a6, sizeof a6);39 memcpy(&buf[0].addr, &a6, sizeof a6);
40 buf[0].family = AF_INET6;40 buf[0].family = AF_INET6;
lib/libc/musl/src/network/lookup_name.c+31-19
...@@ -79,7 +79,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati...@@ -79,7 +79,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati
79 case 0:79 case 0:
80 continue;80 continue;
81 default:81 default:
82 badfam = EAI_NONAME;82 badfam = EAI_NODATA;
83 break;83 break;
84 }84 }
8585
...@@ -102,45 +102,50 @@ struct dpc_ctx {...@@ -102,45 +102,50 @@ struct dpc_ctx {
102 struct address *addrs;102 struct address *addrs;
103 char *canon;103 char *canon;
104 int cnt;104 int cnt;
105 int rrtype;
105};106};
106107
107#define RR_A 1108#define RR_A 1
108#define RR_CNAME 5109#define RR_CNAME 5
109#define RR_AAAA 28110#define RR_AAAA 28
110111
111static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet)112#define ABUF_SIZE 768
113
114static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet, int plen)
112{115{
113 char tmp[256];116 char tmp[256];
117 int family;
114 struct dpc_ctx *ctx = c;118 struct dpc_ctx *ctx = c;
115 if (ctx->cnt >= MAXADDRS) return -1;119 if (rr == RR_CNAME) {
120 if (__dn_expand(packet, (const unsigned char *)packet + plen,
121 data, tmp, sizeof tmp) > 0 && is_valid_hostname(tmp))
122 strcpy(ctx->canon, tmp);
123 return 0;
124 }
125 if (ctx->cnt >= MAXADDRS) return 0;
126 if (rr != ctx->rrtype) return 0;
116 switch (rr) {127 switch (rr) {
117 case RR_A:128 case RR_A:
118 if (len != 4) return -1;129 if (len != 4) return -1;
119 ctx->addrs[ctx->cnt].family = AF_INET;130 family = AF_INET;
120 ctx->addrs[ctx->cnt].scopeid = 0;
121 memcpy(ctx->addrs[ctx->cnt++].addr, data, 4);
122 break;131 break;
123 case RR_AAAA:132 case RR_AAAA:
124 if (len != 16) return -1;133 if (len != 16) return -1;
125 ctx->addrs[ctx->cnt].family = AF_INET6;134 family = AF_INET6;
126 ctx->addrs[ctx->cnt].scopeid = 0;
127 memcpy(ctx->addrs[ctx->cnt++].addr, data, 16);
128 break;
129 case RR_CNAME:
130 if (__dn_expand(packet, (const unsigned char *)packet + 512,
131 data, tmp, sizeof tmp) > 0 && is_valid_hostname(tmp))
132 strcpy(ctx->canon, tmp);
133 break;135 break;
134 }136 }
137 ctx->addrs[ctx->cnt].family = family;
138 ctx->addrs[ctx->cnt].scopeid = 0;
139 memcpy(ctx->addrs[ctx->cnt++].addr, data, len);
135 return 0;140 return 0;
136}141}
137142
138static int name_from_dns(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, const struct resolvconf *conf)143static int name_from_dns(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, const struct resolvconf *conf)
139{144{
140 unsigned char qbuf[2][280], abuf[2][512];145 unsigned char qbuf[2][280], abuf[2][ABUF_SIZE];
141 const unsigned char *qp[2] = { qbuf[0], qbuf[1] };146 const unsigned char *qp[2] = { qbuf[0], qbuf[1] };
142 unsigned char *ap[2] = { abuf[0], abuf[1] };147 unsigned char *ap[2] = { abuf[0], abuf[1] };
143 int qlens[2], alens[2];148 int qlens[2], alens[2], qtypes[2];
144 int i, nq = 0;149 int i, nq = 0;
145 struct dpc_ctx ctx = { .addrs = buf, .canon = canon };150 struct dpc_ctx ctx = { .addrs = buf, .canon = canon };
146 static const struct { int af; int rr; } afrr[2] = {151 static const struct { int af; int rr; } afrr[2] = {
...@@ -153,8 +158,12 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static...@@ -153,8 +158,12 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static
153 qlens[nq] = __res_mkquery(0, name, 1, afrr[i].rr,158 qlens[nq] = __res_mkquery(0, name, 1, afrr[i].rr,
154 0, 0, 0, qbuf[nq], sizeof *qbuf);159 0, 0, 0, qbuf[nq], sizeof *qbuf);
155 if (qlens[nq] == -1)160 if (qlens[nq] == -1)
156 return EAI_NONAME;161 return 0;
162 qtypes[nq] = afrr[i].rr;
157 qbuf[nq][3] = 0; /* don't need AD flag */163 qbuf[nq][3] = 0; /* don't need AD flag */
164 /* Ensure query IDs are distinct. */
165 if (nq && qbuf[nq][0] == qbuf[0][0])
166 qbuf[nq][0]++;
158 nq++;167 nq++;
159 }168 }
160 }169 }
...@@ -168,11 +177,14 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static...@@ -168,11 +177,14 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static
168 if ((abuf[i][3] & 15) != 0) return EAI_FAIL;177 if ((abuf[i][3] & 15) != 0) return EAI_FAIL;
169 }178 }
170179
171 for (i=0; i<nq; i++)180 for (i=nq-1; i>=0; i--) {
181 ctx.rrtype = qtypes[i];
182 if (alens[i] > sizeof(abuf[i])) alens[i] = sizeof abuf[i];
172 __dns_parse(abuf[i], alens[i], dns_parse_callback, &ctx);183 __dns_parse(abuf[i], alens[i], dns_parse_callback, &ctx);
184 }
173185
174 if (ctx.cnt) return ctx.cnt;186 if (ctx.cnt) return ctx.cnt;
175 return EAI_NONAME;187 return EAI_NODATA;
176}188}
177189
178static int name_from_dns_search(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family)190static int name_from_dns_search(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family)
lib/libc/musl/src/network/netlink.h+1-1
...@@ -86,7 +86,7 @@ struct ifaddrmsg {...@@ -86,7 +86,7 @@ struct ifaddrmsg {
86#define RTA_DATALEN(rta) ((rta)->rta_len-sizeof(struct rtattr))86#define RTA_DATALEN(rta) ((rta)->rta_len-sizeof(struct rtattr))
87#define RTA_DATAEND(rta) ((char*)(rta)+(rta)->rta_len)87#define RTA_DATAEND(rta) ((char*)(rta)+(rta)->rta_len)
88#define RTA_NEXT(rta) (struct rtattr*)((char*)(rta)+NETLINK_ALIGN((rta)->rta_len))88#define RTA_NEXT(rta) (struct rtattr*)((char*)(rta)+NETLINK_ALIGN((rta)->rta_len))
89#define RTA_OK(nlh,end) ((char*)(end)-(char*)(rta) >= sizeof(struct rtattr))89#define RTA_OK(rta,end) ((char*)(end)-(char*)(rta) >= sizeof(struct rtattr))
9090
91#define NLMSG_RTA(nlh,len) ((void*)((char*)(nlh)+sizeof(struct nlmsghdr)+NETLINK_ALIGN(len)))91#define NLMSG_RTA(nlh,len) ((void*)((char*)(nlh)+sizeof(struct nlmsghdr)+NETLINK_ALIGN(len)))
92#define NLMSG_RTAOK(rta,nlh) RTA_OK(rta,NLMSG_DATAEND(nlh))92#define NLMSG_RTAOK(rta,nlh) RTA_OK(rta,NLMSG_DATAEND(nlh))
lib/libc/musl/src/network/res_mkquery.c+1
...@@ -13,6 +13,7 @@ int __res_mkquery(int op, const char *dname, int class, int type,...@@ -13,6 +13,7 @@ int __res_mkquery(int op, const char *dname, int class, int type,
13 int n;13 int n;
1414
15 if (l && dname[l-1]=='.') l--;15 if (l && dname[l-1]=='.') l--;
16 if (l && dname[l-1]=='.') return -1;
16 n = 17+l+!!l;17 n = 17+l+!!l;
17 if (l>253 || buflen<n || op>15u || class>255u || type>255u)18 if (l>253 || buflen<n || op>15u || class>255u || type>255u)
18 return -1;19 return -1;
lib/libc/musl/src/network/res_msend.c+160-23
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1#include <sys/socket.h>1#include <sys/socket.h>
2#include <netinet/in.h>2#include <netinet/in.h>
3#include <netinet/tcp.h>
3#include <netdb.h>4#include <netdb.h>
4#include <arpa/inet.h>5#include <arpa/inet.h>
5#include <stdint.h>6#include <stdint.h>
...@@ -16,17 +17,65 @@...@@ -16,17 +17,65 @@
1617
17static void cleanup(void *p)18static void cleanup(void *p)
18{19{
19 __syscall(SYS_close, (intptr_t)p);20 struct pollfd *pfd = p;
21 for (int i=0; pfd[i].fd >= -1; i++)
22 if (pfd[i].fd >= 0) __syscall(SYS_close, pfd[i].fd);
20}23}
2124
22static unsigned long mtime()25static unsigned long mtime()
23{26{
24 struct timespec ts;27 struct timespec ts;
25 clock_gettime(CLOCK_REALTIME, &ts);28 if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0 && errno == ENOSYS)
29 clock_gettime(CLOCK_REALTIME, &ts);
26 return (unsigned long)ts.tv_sec * 100030 return (unsigned long)ts.tv_sec * 1000
27 + ts.tv_nsec / 1000000;31 + ts.tv_nsec / 1000000;
28}32}
2933
34static int start_tcp(struct pollfd *pfd, int family, const void *sa, socklen_t sl, const unsigned char *q, int ql)
35{
36 struct msghdr mh = {
37 .msg_name = (void *)sa,
38 .msg_namelen = sl,
39 .msg_iovlen = 2,
40 .msg_iov = (struct iovec [2]){
41 { .iov_base = (uint8_t[]){ ql>>8, ql }, .iov_len = 2 },
42 { .iov_base = (void *)q, .iov_len = ql } }
43 };
44 int r;
45 int fd = socket(family, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
46 pfd->fd = fd;
47 pfd->events = POLLOUT;
48 if (!setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN_CONNECT,
49 &(int){1}, sizeof(int))) {
50 r = sendmsg(fd, &mh, MSG_FASTOPEN|MSG_NOSIGNAL);
51 if (r == ql+2) pfd->events = POLLIN;
52 if (r >= 0) return r;
53 if (errno == EINPROGRESS) return 0;
54 }
55 r = connect(fd, sa, sl);
56 if (!r || errno == EINPROGRESS) return 0;
57 close(fd);
58 pfd->fd = -1;
59 return -1;
60}
61
62static void step_mh(struct msghdr *mh, size_t n)
63{
64 /* Adjust iovec in msghdr to skip first n bytes. */
65 while (mh->msg_iovlen && n >= mh->msg_iov->iov_len) {
66 n -= mh->msg_iov->iov_len;
67 mh->msg_iov++;
68 mh->msg_iovlen--;
69 }
70 if (!mh->msg_iovlen) return;
71 mh->msg_iov->iov_base = (char *)mh->msg_iov->iov_base + n;
72 mh->msg_iov->iov_len -= n;
73}
74
75/* Internal contract for __res_msend[_rc]: asize must be >=512, nqueries
76 * must be sufficiently small to be safe as VLA size. In practice it's
77 * either 1 or 2, anyway. */
78
30int __res_msend_rc(int nqueries, const unsigned char *const *queries,79int __res_msend_rc(int nqueries, const unsigned char *const *queries,
31 const int *qlens, unsigned char *const *answers, int *alens, int asize,80 const int *qlens, unsigned char *const *answers, int *alens, int asize,
32 const struct resolvconf *conf)81 const struct resolvconf *conf)
...@@ -44,7 +93,10 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,...@@ -44,7 +93,10 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
44 int next;93 int next;
45 int i, j;94 int i, j;
46 int cs;95 int cs;
47 struct pollfd pfd;96 struct pollfd pfd[nqueries+2];
97 int qpos[nqueries], apos[nqueries];
98 unsigned char alen_buf[nqueries][2];
99 int r;
48 unsigned long t0, t1, t2;100 unsigned long t0, t1, t2;
49101
50 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);102 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
...@@ -68,29 +120,22 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,...@@ -68,29 +120,22 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
68 }120 }
69121
70 /* Get local address and open/bind a socket */122 /* Get local address and open/bind a socket */
71 sa.sin.sin_family = family;
72 fd = socket(family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);123 fd = socket(family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
73124
74 /* Handle case where system lacks IPv6 support */125 /* Handle case where system lacks IPv6 support */
75 if (fd < 0 && family == AF_INET6 && errno == EAFNOSUPPORT) {126 if (fd < 0 && family == AF_INET6 && errno == EAFNOSUPPORT) {
127 for (i=0; i<nns && conf->ns[nns].family == AF_INET6; i++);
128 if (i==nns) {
129 pthread_setcancelstate(cs, 0);
130 return -1;
131 }
76 fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);132 fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
77 family = AF_INET;133 family = AF_INET;
134 sl = sizeof sa.sin;
78 }135 }
79 if (fd < 0 || bind(fd, (void *)&sa, sl) < 0) {
80 if (fd >= 0) close(fd);
81 pthread_setcancelstate(cs, 0);
82 return -1;
83 }
84
85 /* Past this point, there are no errors. Each individual query will
86 * yield either no reply (indicated by zero length) or an answer
87 * packet which is up to the caller to interpret. */
88
89 pthread_cleanup_push(cleanup, (void *)(intptr_t)fd);
90 pthread_setcancelstate(cs, 0);
91136
92 /* Convert any IPv4 addresses in a mixed environment to v4-mapped */137 /* Convert any IPv4 addresses in a mixed environment to v4-mapped */
93 if (family == AF_INET6) {138 if (fd >= 0 && family == AF_INET6) {
94 setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &(int){0}, sizeof 0);139 setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &(int){0}, sizeof 0);
95 for (i=0; i<nns; i++) {140 for (i=0; i<nns; i++) {
96 if (ns[i].sin.sin_family != AF_INET) continue;141 if (ns[i].sin.sin_family != AF_INET) continue;
...@@ -104,16 +149,38 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,...@@ -104,16 +149,38 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
104 }149 }
105 }150 }
106151
152 sa.sin.sin_family = family;
153 if (fd < 0 || bind(fd, (void *)&sa, sl) < 0) {
154 if (fd >= 0) close(fd);
155 pthread_setcancelstate(cs, 0);
156 return -1;
157 }
158
159 /* Past this point, there are no errors. Each individual query will
160 * yield either no reply (indicated by zero length) or an answer
161 * packet which is up to the caller to interpret. */
162
163 for (i=0; i<nqueries; i++) pfd[i].fd = -1;
164 pfd[nqueries].fd = fd;
165 pfd[nqueries].events = POLLIN;
166 pfd[nqueries+1].fd = -2;
167
168 pthread_cleanup_push(cleanup, pfd);
169 pthread_setcancelstate(cs, 0);
170
107 memset(alens, 0, sizeof *alens * nqueries);171 memset(alens, 0, sizeof *alens * nqueries);
108172
109 pfd.fd = fd;
110 pfd.events = POLLIN;
111 retry_interval = timeout / attempts;173 retry_interval = timeout / attempts;
112 next = 0;174 next = 0;
113 t0 = t2 = mtime();175 t0 = t2 = mtime();
114 t1 = t2 - retry_interval;176 t1 = t2 - retry_interval;
115177
116 for (; t2-t0 < timeout; t2=mtime()) {178 for (; t2-t0 < timeout; t2=mtime()) {
179 /* This is the loop exit condition: that all queries
180 * have an accepted answer. */
181 for (i=0; i<nqueries && alens[i]>0; i++);
182 if (i==nqueries) break;
183
117 if (t2-t1 >= retry_interval) {184 if (t2-t1 >= retry_interval) {
118 /* Query all configured namservers in parallel */185 /* Query all configured namservers in parallel */
119 for (i=0; i<nqueries; i++)186 for (i=0; i<nqueries; i++)
...@@ -127,10 +194,20 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,...@@ -127,10 +194,20 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
127 }194 }
128195
129 /* Wait for a response, or until time to retry */196 /* Wait for a response, or until time to retry */
130 if (poll(&pfd, 1, t1+retry_interval-t2) <= 0) continue;197 if (poll(pfd, nqueries+1, t1+retry_interval-t2) <= 0) continue;
131198
132 while ((rlen = recvfrom(fd, answers[next], asize, 0,199 while (next < nqueries) {
133 (void *)&sa, (socklen_t[1]){sl})) >= 0) {200 struct msghdr mh = {
201 .msg_name = (void *)&sa,
202 .msg_namelen = sl,
203 .msg_iovlen = 1,
204 .msg_iov = (struct iovec []){
205 { .iov_base = (void *)answers[next],
206 .iov_len = asize }
207 }
208 };
209 rlen = recvmsg(fd, &mh, 0);
210 if (rlen < 0) break;
134211
135 /* Ignore non-identifiable packets */212 /* Ignore non-identifiable packets */
136 if (rlen < 4) continue;213 if (rlen < 4) continue;
...@@ -170,12 +247,72 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,...@@ -170,12 +247,72 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
170 else247 else
171 memcpy(answers[i], answers[next], rlen);248 memcpy(answers[i], answers[next], rlen);
172249
173 if (next == nqueries) goto out;250 /* Ignore further UDP if all slots full or TCP-mode */
251 if (next == nqueries) pfd[nqueries].events = 0;
252
253 /* If answer is truncated (TC bit), fallback to TCP */
254 if ((answers[i][2] & 2) || (mh.msg_flags & MSG_TRUNC)) {
255 alens[i] = -1;
256 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
257 r = start_tcp(pfd+i, family, ns+j, sl, queries[i], qlens[i]);
258 pthread_setcancelstate(cs, 0);
259 if (r >= 0) {
260 qpos[i] = r;
261 apos[i] = 0;
262 }
263 continue;
264 }
265 }
266
267 for (i=0; i<nqueries; i++) if (pfd[i].revents & POLLOUT) {
268 struct msghdr mh = {
269 .msg_iovlen = 2,
270 .msg_iov = (struct iovec [2]){
271 { .iov_base = (uint8_t[]){ qlens[i]>>8, qlens[i] }, .iov_len = 2 },
272 { .iov_base = (void *)queries[i], .iov_len = qlens[i] } }
273 };
274 step_mh(&mh, qpos[i]);
275 r = sendmsg(pfd[i].fd, &mh, MSG_NOSIGNAL);
276 if (r < 0) goto out;
277 qpos[i] += r;
278 if (qpos[i] == qlens[i]+2)
279 pfd[i].events = POLLIN;
280 }
281
282 for (i=0; i<nqueries; i++) if (pfd[i].revents & POLLIN) {
283 struct msghdr mh = {
284 .msg_iovlen = 2,
285 .msg_iov = (struct iovec [2]){
286 { .iov_base = alen_buf[i], .iov_len = 2 },
287 { .iov_base = answers[i], .iov_len = asize } }
288 };
289 step_mh(&mh, apos[i]);
290 r = recvmsg(pfd[i].fd, &mh, 0);
291 if (r <= 0) goto out;
292 apos[i] += r;
293 if (apos[i] < 2) continue;
294 int alen = alen_buf[i][0]*256 + alen_buf[i][1];
295 if (alen < 13) goto out;
296 if (apos[i] < alen+2 && apos[i] < asize+2)
297 continue;
298 int rcode = answers[i][3] & 15;
299 if (rcode != 0 && rcode != 3)
300 goto out;
301
302 /* Storing the length here commits the accepted answer.
303 * Immediately close TCP socket so as not to consume
304 * resources we no longer need. */
305 alens[i] = alen;
306 __syscall(SYS_close, pfd[i].fd);
307 pfd[i].fd = -1;
174 }308 }
175 }309 }
176out:310out:
177 pthread_cleanup_pop(1);311 pthread_cleanup_pop(1);
178312
313 /* Disregard any incomplete TCP results */
314 for (i=0; i<nqueries; i++) if (alens[i]<0) alens[i] = 0;
315
179 return 0;316 return 0;
180}317}
181318
lib/libc/musl/src/network/res_send.c+9-1
...@@ -1,8 +1,16 @@...@@ -1,8 +1,16 @@
1#include <resolv.h>1#include <resolv.h>
2#include <string.h>
23
3int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen)4int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen)
4{5{
5 int r = __res_msend(1, &msg, &msglen, &answer, &anslen, anslen);6 int r;
7 if (anslen < 512) {
8 unsigned char buf[512];
9 r = __res_send(msg, msglen, buf, sizeof buf);
10 if (r >= 0) memcpy(answer, buf, r < anslen ? r : anslen);
11 return r;
12 }
13 r = __res_msend(1, &msg, &msglen, &answer, &anslen, anslen);
6 return r<0 || !anslen ? -1 : anslen;14 return r<0 || !anslen ? -1 : anslen;
7}15}
816
lib/libc/musl/src/network/sendmsg.c+5-2
...@@ -8,13 +8,16 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)...@@ -8,13 +8,16 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
8{8{
9#if LONG_MAX > INT_MAX9#if LONG_MAX > INT_MAX
10 struct msghdr h;10 struct msghdr h;
11 struct cmsghdr chbuf[1024/sizeof(struct cmsghdr)+1], *c;11 /* Kernels before 2.6.38 set SCM_MAX_FD to 255, allocate enough
12 * space to support an SCM_RIGHTS ancillary message with 255 fds.
13 * Kernels since 2.6.38 set SCM_MAX_FD to 253. */
14 struct cmsghdr chbuf[CMSG_SPACE(255*sizeof(int))/sizeof(struct cmsghdr)+1], *c;
12 if (msg) {15 if (msg) {
13 h = *msg;16 h = *msg;
14 h.__pad1 = h.__pad2 = 0;17 h.__pad1 = h.__pad2 = 0;
15 msg = &h;18 msg = &h;
16 if (h.msg_controllen) {19 if (h.msg_controllen) {
17 if (h.msg_controllen > 1024) {20 if (h.msg_controllen > sizeof chbuf) {
18 errno = ENOMEM;21 errno = ENOMEM;
19 return -1;22 return -1;
20 }23 }
lib/libc/musl/src/process/_Fork.c+1-2
...@@ -14,7 +14,6 @@ pid_t _Fork(void)...@@ -14,7 +14,6 @@ pid_t _Fork(void)
14 pid_t ret;14 pid_t ret;
15 sigset_t set;15 sigset_t set;
16 __block_all_sigs(&set);16 __block_all_sigs(&set);
17 __aio_atfork(-1);
18 LOCK(__abort_lock);17 LOCK(__abort_lock);
19#ifdef SYS_fork18#ifdef SYS_fork
20 ret = __syscall(SYS_fork);19 ret = __syscall(SYS_fork);
...@@ -32,7 +31,7 @@ pid_t _Fork(void)...@@ -32,7 +31,7 @@ pid_t _Fork(void)
32 if (libc.need_locks) libc.need_locks = -1;31 if (libc.need_locks) libc.need_locks = -1;
33 }32 }
34 UNLOCK(__abort_lock);33 UNLOCK(__abort_lock);
35 __aio_atfork(!ret);34 if (!ret) __aio_atfork(1);
36 __restore_sigs(&set);35 __restore_sigs(&set);
37 return __syscall_ret(ret);36 return __syscall_ret(ret);
38}37}
lib/libc/musl/src/process/aarch64/vfork.s created+9
...@@ -0,0 +1,9 @@
1.global vfork
2.type vfork,%function
3vfork:
4 mov x8, 220 // SYS_clone
5 mov x0, 0x4111 // SIGCHLD | CLONE_VM | CLONE_VFORK
6 mov x1, 0
7 svc 0
8 .hidden __syscall_ret
9 b __syscall_ret
lib/libc/musl/src/process/fork.c+6-2
...@@ -9,7 +9,6 @@ static volatile int *const dummy_lockptr = 0;...@@ -9,7 +9,6 @@ static volatile int *const dummy_lockptr = 0;
99
10weak_alias(dummy_lockptr, __at_quick_exit_lockptr);10weak_alias(dummy_lockptr, __at_quick_exit_lockptr);
11weak_alias(dummy_lockptr, __atexit_lockptr);11weak_alias(dummy_lockptr, __atexit_lockptr);
12weak_alias(dummy_lockptr, __dlerror_lockptr);
13weak_alias(dummy_lockptr, __gettext_lockptr);12weak_alias(dummy_lockptr, __gettext_lockptr);
14weak_alias(dummy_lockptr, __locale_lockptr);13weak_alias(dummy_lockptr, __locale_lockptr);
15weak_alias(dummy_lockptr, __random_lockptr);14weak_alias(dummy_lockptr, __random_lockptr);
...@@ -24,7 +23,6 @@ weak_alias(dummy_lockptr, __vmlock_lockptr);...@@ -24,7 +23,6 @@ weak_alias(dummy_lockptr, __vmlock_lockptr);
24static volatile int *const *const atfork_locks[] = {23static volatile int *const *const atfork_locks[] = {
25 &__at_quick_exit_lockptr,24 &__at_quick_exit_lockptr,
26 &__atexit_lockptr,25 &__atexit_lockptr,
27 &__dlerror_lockptr,
28 &__gettext_lockptr,26 &__gettext_lockptr,
29 &__locale_lockptr,27 &__locale_lockptr,
30 &__random_lockptr,28 &__random_lockptr,
...@@ -38,6 +36,8 @@ static volatile int *const *const atfork_locks[] = {...@@ -38,6 +36,8 @@ static volatile int *const *const atfork_locks[] = {
38static void dummy(int x) { }36static void dummy(int x) { }
39weak_alias(dummy, __fork_handler);37weak_alias(dummy, __fork_handler);
40weak_alias(dummy, __malloc_atfork);38weak_alias(dummy, __malloc_atfork);
39weak_alias(dummy, __aio_atfork);
40weak_alias(dummy, __pthread_key_atfork);
41weak_alias(dummy, __ldso_atfork);41weak_alias(dummy, __ldso_atfork);
4242
43static void dummy_0(void) { }43static void dummy_0(void) { }
...@@ -52,6 +52,8 @@ pid_t fork(void)...@@ -52,6 +52,8 @@ pid_t fork(void)
52 int need_locks = libc.need_locks > 0;52 int need_locks = libc.need_locks > 0;
53 if (need_locks) {53 if (need_locks) {
54 __ldso_atfork(-1);54 __ldso_atfork(-1);
55 __pthread_key_atfork(-1);
56 __aio_atfork(-1);
55 __inhibit_ptc();57 __inhibit_ptc();
56 for (int i=0; i<sizeof atfork_locks/sizeof *atfork_locks; i++)58 for (int i=0; i<sizeof atfork_locks/sizeof *atfork_locks; i++)
57 if (*atfork_locks[i]) LOCK(*atfork_locks[i]);59 if (*atfork_locks[i]) LOCK(*atfork_locks[i]);
...@@ -77,6 +79,8 @@ pid_t fork(void)...@@ -77,6 +79,8 @@ pid_t fork(void)
77 if (ret) UNLOCK(*atfork_locks[i]);79 if (ret) UNLOCK(*atfork_locks[i]);
78 else **atfork_locks[i] = 0;80 else **atfork_locks[i] = 0;
79 __release_ptc();81 __release_ptc();
82 if (ret) __aio_atfork(0);
83 __pthread_key_atfork(!ret);
80 __ldso_atfork(!ret);84 __ldso_atfork(!ret);
81 }85 }
82 __restore_sigs(&set);86 __restore_sigs(&set);
lib/libc/musl/src/process/riscv64/vfork.s created+12
...@@ -0,0 +1,12 @@
1.global vfork
2.type vfork,@function
3vfork:
4 /* riscv does not have SYS_vfork, so we must use clone instead */
5 /* note: riscv's clone = clone(flags, sp, ptidptr, tls, ctidptr) */
6 li a7, 220
7 li a0, 0x100 | 0x4000 | 17 /* flags = CLONE_VM | CLONE_VFORK | SIGCHLD */
8 mv a1, sp
9 /* the other arguments are ignoreable */
10 ecall
11 .hidden __syscall_ret
12 j __syscall_ret
lib/libc/musl/src/regex/glob.c-3
...@@ -306,6 +306,3 @@ void globfree(glob_t *g)...@@ -306,6 +306,3 @@ void globfree(glob_t *g)
306 g->gl_pathc = 0;306 g->gl_pathc = 0;
307 g->gl_pathv = NULL;307 g->gl_pathv = NULL;
308}308}
309
310weak_alias(glob, glob64);
311weak_alias(globfree, globfree64);
lib/libc/musl/src/search/hsearch.c+2-2
...@@ -41,9 +41,9 @@ static int resize(size_t nel, struct hsearch_data *htab)...@@ -41,9 +41,9 @@ static int resize(size_t nel, struct hsearch_data *htab)
41{41{
42 size_t newsize;42 size_t newsize;
43 size_t i, j;43 size_t i, j;
44 size_t oldsize = htab->__tab->mask + 1;
44 ENTRY *e, *newe;45 ENTRY *e, *newe;
45 ENTRY *oldtab = htab->__tab->entries;46 ENTRY *oldtab = htab->__tab->entries;
46 ENTRY *oldend = htab->__tab->entries + htab->__tab->mask + 1;
4747
48 if (nel > MAXSIZE)48 if (nel > MAXSIZE)
49 nel = MAXSIZE;49 nel = MAXSIZE;
...@@ -56,7 +56,7 @@ static int resize(size_t nel, struct hsearch_data *htab)...@@ -56,7 +56,7 @@ static int resize(size_t nel, struct hsearch_data *htab)
56 htab->__tab->mask = newsize - 1;56 htab->__tab->mask = newsize - 1;
57 if (!oldtab)57 if (!oldtab)
58 return 1;58 return 1;
59 for (e = oldtab; e < oldend; e++)59 for (e = oldtab; e < oldtab + oldsize; e++)
60 if (e->key) {60 if (e->key) {
61 for (i=keyhash(e->key),j=1; ; i+=j++) {61 for (i=keyhash(e->key),j=1; ; i+=j++) {
62 newe = htab->__tab->entries + (i & htab->__tab->mask);62 newe = htab->__tab->entries + (i & htab->__tab->mask);
lib/libc/musl/src/select/poll.c+7-2
...@@ -8,8 +8,13 @@ int poll(struct pollfd *fds, nfds_t n, int timeout)...@@ -8,8 +8,13 @@ int poll(struct pollfd *fds, nfds_t n, int timeout)
8#ifdef SYS_poll8#ifdef SYS_poll
9 return syscall_cp(SYS_poll, fds, n, timeout);9 return syscall_cp(SYS_poll, fds, n, timeout);
10#else10#else
11#if SYS_ppoll_time64 == SYS_ppoll
12 typedef long long ppoll_ts_t[2];
13#else
14 typedef long ppoll_ts_t[2];
15#endif
11 return syscall_cp(SYS_ppoll, fds, n, timeout>=0 ?16 return syscall_cp(SYS_ppoll, fds, n, timeout>=0 ?
12 &((struct timespec){ .tv_sec = timeout/1000,17 ((ppoll_ts_t){ timeout/1000, timeout%1000*1000000 }) : 0,
13 .tv_nsec = timeout%1000*1000000 }) : 0, 0, _NSIG/8);18 0, _NSIG/8);
14#endif19#endif
15}20}
lib/libc/musl/src/select/select.c+1
...@@ -33,6 +33,7 @@ int select(int n, fd_set *restrict rfds, fd_set *restrict wfds, fd_set *restrict...@@ -33,6 +33,7 @@ int select(int n, fd_set *restrict rfds, fd_set *restrict wfds, fd_set *restrict
33 ((syscall_arg_t[]){ 0, _NSIG/8 }));33 ((syscall_arg_t[]){ 0, _NSIG/8 }));
34 if (SYS_pselect6 == SYS_pselect6_time64 || r!=-ENOSYS)34 if (SYS_pselect6 == SYS_pselect6_time64 || r!=-ENOSYS)
35 return __syscall_ret(r);35 return __syscall_ret(r);
36 s = CLAMP(s);
36#endif37#endif
37#ifdef SYS_select38#ifdef SYS_select
38 return syscall_cp(SYS_select, n, rfds, wfds, efds,39 return syscall_cp(SYS_select, n, rfds, wfds, efds,
lib/libc/musl/src/setjmp/powerpc/longjmp.S+4-4
...@@ -42,10 +42,10 @@ longjmp:...@@ -42,10 +42,10 @@ longjmp:
42 bl 1f42 bl 1f
43 .hidden __hwcap43 .hidden __hwcap
44 .long __hwcap-.44 .long __hwcap-.
451: mflr 4451: mflr 6
46 lwz 5, 0(4)46 lwz 5, 0(6)
47 lwzx 4, 4, 547 lwzx 6, 6, 5
48 andis. 4, 4, 0x8048 andis. 6, 6, 0x80
49 beq 1f49 beq 1f
50 .long 0x11c35b01 /* evldd 14,88(3) */50 .long 0x11c35b01 /* evldd 14,88(3) */
51 .long 0x11e36301 /* ... */51 .long 0x11e36301 /* ... */
lib/libc/musl/src/signal/mips/restore.s deleted-15
...@@ -1,15 +0,0 @@
1.set noreorder
2
3.global __restore_rt
4.hidden __restore_rt
5.type __restore_rt,@function
6__restore_rt:
7 li $2, 4193
8 syscall
9
10.global __restore
11.hidden __restore
12.type __restore,@function
13__restore:
14 li $2, 4119
15 syscall
lib/libc/musl/src/signal/mips64/restore.s deleted-11
...@@ -1,11 +0,0 @@
1.set noreorder
2.global __restore_rt
3.global __restore
4.hidden __restore_rt
5.hidden __restore
6.type __restore_rt,@function
7.type __restore,@function
8__restore_rt:
9__restore:
10 li $2,5211
11 syscall
lib/libc/musl/src/signal/mipsn32/restore.s deleted-11
...@@ -1,11 +0,0 @@
1.set noreorder
2.global __restore_rt
3.global __restore
4.hidden __restore_rt
5.hidden __restore
6.type __restore_rt,@function
7.type __restore,@function
8__restore_rt:
9__restore:
10 li $2,6211
11 syscall
lib/libc/musl/src/signal/sigaction.c+4-1
...@@ -44,8 +44,11 @@ int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigact...@@ -44,8 +44,11 @@ int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigact
44 }44 }
45 }45 }
46 ksa.handler = sa->sa_handler;46 ksa.handler = sa->sa_handler;
47 ksa.flags = sa->sa_flags | SA_RESTORER;47 ksa.flags = sa->sa_flags;
48#ifdef SA_RESTORER
49 ksa.flags |= SA_RESTORER;
48 ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;50 ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
51#endif
49 memcpy(&ksa.mask, &sa->sa_mask, _NSIG/8);52 memcpy(&ksa.mask, &sa->sa_mask, _NSIG/8);
50 }53 }
51 int r = __syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, _NSIG/8);54 int r = __syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, _NSIG/8);
lib/libc/musl/src/stat/__xstat.c-5
...@@ -22,11 +22,6 @@ int __xstat(int ver, const char *path, struct stat *buf)...@@ -22,11 +22,6 @@ int __xstat(int ver, const char *path, struct stat *buf)
22 return stat(path, buf);22 return stat(path, buf);
23}23}
2424
25weak_alias(__fxstat, __fxstat64);
26weak_alias(__fxstatat, __fxstatat64);
27weak_alias(__lxstat, __lxstat64);
28weak_alias(__xstat, __xstat64);
29
30#endif25#endif
3126
32int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev)27int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev)
lib/libc/musl/src/stat/fchmodat.c+7-8
...@@ -2,7 +2,6 @@...@@ -2,7 +2,6 @@
2#include <fcntl.h>2#include <fcntl.h>
3#include <errno.h>3#include <errno.h>
4#include "syscall.h"4#include "syscall.h"
5#include "kstat.h"
65
7int fchmodat(int fd, const char *path, mode_t mode, int flag)6int fchmodat(int fd, const char *path, mode_t mode, int flag)
8{7{
...@@ -11,12 +10,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)...@@ -11,12 +10,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)
11 if (flag != AT_SYMLINK_NOFOLLOW)10 if (flag != AT_SYMLINK_NOFOLLOW)
12 return __syscall_ret(-EINVAL);11 return __syscall_ret(-EINVAL);
1312
14 struct kstat st;13 struct stat st;
15 int ret, fd2;14 int ret, fd2;
16 char proc[15+3*sizeof(int)];15 char proc[15+3*sizeof(int)];
1716
18 if ((ret = __syscall(SYS_fstatat, fd, path, &st, flag)))17 if (fstatat(fd, path, &st, flag))
19 return __syscall_ret(ret);18 return -1;
20 if (S_ISLNK(st.st_mode))19 if (S_ISLNK(st.st_mode))
21 return __syscall_ret(-EOPNOTSUPP);20 return __syscall_ret(-EOPNOTSUPP);
2221
...@@ -27,12 +26,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)...@@ -27,12 +26,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)
27 }26 }
2827
29 __procfdname(proc, fd2);28 __procfdname(proc, fd2);
30 ret = __syscall(SYS_fstatat, AT_FDCWD, proc, &st, 0);29 ret = stat(proc, &st);
31 if (!ret) {30 if (!ret) {
32 if (S_ISLNK(st.st_mode)) ret = -EOPNOTSUPP;31 if (S_ISLNK(st.st_mode)) ret = __syscall_ret(-EOPNOTSUPP);
33 else ret = __syscall(SYS_fchmodat, AT_FDCWD, proc, mode);32 else ret = syscall(SYS_fchmodat, AT_FDCWD, proc, mode);
34 }33 }
3534
36 __syscall(SYS_close, fd2);35 __syscall(SYS_close, fd2);
37 return __syscall_ret(ret);36 return ret;
38}37}
lib/libc/musl/src/stat/fstat.c+3-5
...@@ -4,12 +4,10 @@...@@ -4,12 +4,10 @@
4#include <fcntl.h>4#include <fcntl.h>
5#include "syscall.h"5#include "syscall.h"
66
7int fstat(int fd, struct stat *st)7int __fstat(int fd, struct stat *st)
8{8{
9 if (fd<0) return __syscall_ret(-EBADF);9 if (fd<0) return __syscall_ret(-EBADF);
10 return fstatat(fd, "", st, AT_EMPTY_PATH);10 return __fstatat(fd, "", st, AT_EMPTY_PATH);
11}11}
1212
13#if !_REDIR_TIME6413weak_alias(__fstat, fstat);
14weak_alias(fstat, fstat64);
15#endif
lib/libc/musl/src/stat/fstatat.c+11-5
...@@ -6,7 +6,6 @@...@@ -6,7 +6,6 @@
6#include <stdint.h>6#include <stdint.h>
7#include <sys/sysmacros.h>7#include <sys/sysmacros.h>
8#include "syscall.h"8#include "syscall.h"
9#include "kstat.h"
109
11struct statx {10struct statx {
12 uint32_t stx_mask;11 uint32_t stx_mask;
...@@ -69,6 +68,10 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric...@@ -69,6 +68,10 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric
69 return 0;68 return 0;
70}69}
7170
71#ifdef SYS_fstatat
72
73#include "kstat.h"
74
72static int fstatat_kstat(int fd, const char *restrict path, struct stat *restrict st, int flag)75static int fstatat_kstat(int fd, const char *restrict path, struct stat *restrict st, int flag)
73{76{
74 int ret;77 int ret;
...@@ -130,18 +133,21 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric...@@ -130,18 +133,21 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric
130133
131 return 0;134 return 0;
132}135}
136#endif
133137
134int fstatat(int fd, const char *restrict path, struct stat *restrict st, int flag)138int __fstatat(int fd, const char *restrict path, struct stat *restrict st, int flag)
135{139{
136 int ret;140 int ret;
141#ifdef SYS_fstatat
137 if (sizeof((struct kstat){0}.st_atime_sec) < sizeof(time_t)) {142 if (sizeof((struct kstat){0}.st_atime_sec) < sizeof(time_t)) {
138 ret = fstatat_statx(fd, path, st, flag);143 ret = fstatat_statx(fd, path, st, flag);
139 if (ret!=-ENOSYS) return __syscall_ret(ret);144 if (ret!=-ENOSYS) return __syscall_ret(ret);
140 }145 }
141 ret = fstatat_kstat(fd, path, st, flag);146 ret = fstatat_kstat(fd, path, st, flag);
147#else
148 ret = fstatat_statx(fd, path, st, flag);
149#endif
142 return __syscall_ret(ret);150 return __syscall_ret(ret);
143}151}
144152
145#if !_REDIR_TIME64153weak_alias(__fstatat, fstatat);
146weak_alias(fstatat, fstatat64);
147#endif
lib/libc/musl/src/stat/lstat.c-4
...@@ -5,7 +5,3 @@ int lstat(const char *restrict path, struct stat *restrict buf)...@@ -5,7 +5,3 @@ int lstat(const char *restrict path, struct stat *restrict buf)
5{5{
6 return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW);6 return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW);
7}7}
8
9#if !_REDIR_TIME64
10weak_alias(lstat, lstat64);
11#endif
lib/libc/musl/src/stat/stat.c-4
...@@ -5,7 +5,3 @@ int stat(const char *restrict path, struct stat *restrict buf)...@@ -5,7 +5,3 @@ int stat(const char *restrict path, struct stat *restrict buf)
5{5{
6 return fstatat(AT_FDCWD, path, buf, 0);6 return fstatat(AT_FDCWD, path, buf, 0);
7}7}
8
9#if !_REDIR_TIME64
10weak_alias(stat, stat64);
11#endif
lib/libc/musl/src/stat/statvfs.c-5
...@@ -56,8 +56,3 @@ int fstatvfs(int fd, struct statvfs *buf)...@@ -56,8 +56,3 @@ int fstatvfs(int fd, struct statvfs *buf)
56 fixup(buf, &kbuf);56 fixup(buf, &kbuf);
57 return 0;57 return 0;
58}58}
59
60weak_alias(statvfs, statvfs64);
61weak_alias(statfs, statfs64);
62weak_alias(fstatvfs, fstatvfs64);
63weak_alias(fstatfs, fstatfs64);
lib/libc/musl/src/stdio/fgetpos.c-2
...@@ -7,5 +7,3 @@ int fgetpos(FILE *restrict f, fpos_t *restrict pos)...@@ -7,5 +7,3 @@ int fgetpos(FILE *restrict f, fpos_t *restrict pos)
7 *(long long *)pos = off;7 *(long long *)pos = off;
8 return 0;8 return 0;
9}9}
10
11weak_alias(fgetpos, fgetpos64);
lib/libc/musl/src/stdio/fgets.c+3-2
...@@ -12,13 +12,14 @@ char *fgets(char *restrict s, int n, FILE *restrict f)...@@ -12,13 +12,14 @@ char *fgets(char *restrict s, int n, FILE *restrict f)
1212
13 FLOCK(f);13 FLOCK(f);
1414
15 if (n--<=1) {15 if (n<=1) {
16 f->mode |= f->mode-1;16 f->mode |= f->mode-1;
17 FUNLOCK(f);17 FUNLOCK(f);
18 if (n) return 0;18 if (n<1) return 0;
19 *s = 0;19 *s = 0;
20 return s;20 return s;
21 }21 }
22 n--;
2223
23 while (n) {24 while (n) {
24 if (f->rpos != f->rend) {25 if (f->rpos != f->rend) {
lib/libc/musl/src/stdio/fopen.c-2
...@@ -29,5 +29,3 @@ FILE *fopen(const char *restrict filename, const char *restrict mode)...@@ -29,5 +29,3 @@ FILE *fopen(const char *restrict filename, const char *restrict mode)
29 __syscall(SYS_close, fd);29 __syscall(SYS_close, fd);
30 return 0;30 return 0;
31}31}
32
33weak_alias(fopen, fopen64);
lib/libc/musl/src/stdio/freopen.c+2-2
...@@ -40,6 +40,8 @@ FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *re...@@ -40,6 +40,8 @@ FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *re
40 fclose(f2);40 fclose(f2);
41 }41 }
4242
43 f->mode = 0;
44 f->locale = 0;
43 FUNLOCK(f);45 FUNLOCK(f);
44 return f;46 return f;
4547
...@@ -49,5 +51,3 @@ fail:...@@ -49,5 +51,3 @@ fail:
49 fclose(f);51 fclose(f);
50 return NULL;52 return NULL;
51}53}
52
53weak_alias(freopen, freopen64);
lib/libc/musl/src/stdio/fseek.c-2
...@@ -46,5 +46,3 @@ int fseek(FILE *f, long off, int whence)...@@ -46,5 +46,3 @@ int fseek(FILE *f, long off, int whence)
46}46}
4747
48weak_alias(__fseeko, fseeko);48weak_alias(__fseeko, fseeko);
49
50weak_alias(fseeko, fseeko64);
lib/libc/musl/src/stdio/fsetpos.c-2
...@@ -4,5 +4,3 @@ int fsetpos(FILE *f, const fpos_t *pos)...@@ -4,5 +4,3 @@ int fsetpos(FILE *f, const fpos_t *pos)
4{4{
5 return __fseeko(f, *(const long long *)pos, SEEK_SET);5 return __fseeko(f, *(const long long *)pos, SEEK_SET);
6}6}
7
8weak_alias(fsetpos, fsetpos64);
lib/libc/musl/src/stdio/ftell.c-2
...@@ -37,5 +37,3 @@ long ftell(FILE *f)...@@ -37,5 +37,3 @@ long ftell(FILE *f)
37}37}
3838
39weak_alias(__ftello, ftello);39weak_alias(__ftello, ftello);
40
41weak_alias(ftello, ftello64);
lib/libc/musl/src/stdio/open_wmemstream.c+5-1
...@@ -40,8 +40,12 @@ fail:...@@ -40,8 +40,12 @@ fail:
40static size_t wms_write(FILE *f, const unsigned char *buf, size_t len)40static size_t wms_write(FILE *f, const unsigned char *buf, size_t len)
41{41{
42 struct cookie *c = f->cookie;42 struct cookie *c = f->cookie;
43 size_t len2;43 size_t len2 = f->wpos - f->wbase;
44 wchar_t *newbuf;44 wchar_t *newbuf;
45 if (len2) {
46 f->wpos = f->wbase;
47 if (wms_write(f, f->wbase, len2) < len2) return 0;
48 }
45 if (len + c->pos >= c->space) {49 if (len + c->pos >= c->space) {
46 len2 = 2*c->space+1 | c->pos+len+1;50 len2 = 2*c->space+1 | c->pos+len+1;
47 if (len2 > SSIZE_MAX/4) return 0;51 if (len2 > SSIZE_MAX/4) return 0;
lib/libc/musl/src/stdio/tempnam.c+3-5
...@@ -6,7 +6,6 @@...@@ -6,7 +6,6 @@
6#include <string.h>6#include <string.h>
7#include <stdlib.h>7#include <stdlib.h>
8#include "syscall.h"8#include "syscall.h"
9#include "kstat.h"
109
11#define MAXTRIES 10010#define MAXTRIES 100
1211
...@@ -37,11 +36,10 @@ char *tempnam(const char *dir, const char *pfx)...@@ -37,11 +36,10 @@ char *tempnam(const char *dir, const char *pfx)
3736
38 for (try=0; try<MAXTRIES; try++) {37 for (try=0; try<MAXTRIES; try++) {
39 __randname(s+l-6);38 __randname(s+l-6);
40#ifdef SYS_lstat39#ifdef SYS_readlink
41 r = __syscall(SYS_lstat, s, &(struct kstat){0});40 r = __syscall(SYS_readlink, s, (char[1]){0}, 1);
42#else41#else
43 r = __syscall(SYS_fstatat, AT_FDCWD, s,42 r = __syscall(SYS_readlinkat, AT_FDCWD, s, (char[1]){0}, 1);
44 &(struct kstat){0}, AT_SYMLINK_NOFOLLOW);
45#endif43#endif
46 if (r == -ENOENT) return strdup(s);44 if (r == -ENOENT) return strdup(s);
47 }45 }
lib/libc/musl/src/stdio/tmpfile.c-2
...@@ -27,5 +27,3 @@ FILE *tmpfile(void)...@@ -27,5 +27,3 @@ FILE *tmpfile(void)
27 }27 }
28 return 0;28 return 0;
29}29}
30
31weak_alias(tmpfile, tmpfile64);
lib/libc/musl/src/stdio/tmpnam.c+3-5
...@@ -5,7 +5,6 @@...@@ -5,7 +5,6 @@
5#include <string.h>5#include <string.h>
6#include <stdlib.h>6#include <stdlib.h>
7#include "syscall.h"7#include "syscall.h"
8#include "kstat.h"
98
10#define MAXTRIES 1009#define MAXTRIES 100
1110
...@@ -17,11 +16,10 @@ char *tmpnam(char *buf)...@@ -17,11 +16,10 @@ char *tmpnam(char *buf)
17 int r;16 int r;
18 for (try=0; try<MAXTRIES; try++) {17 for (try=0; try<MAXTRIES; try++) {
19 __randname(s+12);18 __randname(s+12);
20#ifdef SYS_lstat19#ifdef SYS_readlink
21 r = __syscall(SYS_lstat, s, &(struct kstat){0});20 r = __syscall(SYS_readlink, s, (char[1]){0}, 1);
22#else21#else
23 r = __syscall(SYS_fstatat, AT_FDCWD, s,22 r = __syscall(SYS_readlinkat, AT_FDCWD, s, (char[1]){0}, 1);
24 &(struct kstat){0}, AT_SYMLINK_NOFOLLOW);
25#endif23#endif
26 if (r == -ENOENT) return strcpy(buf ? buf : internal, s);24 if (r == -ENOENT) return strcpy(buf ? buf : internal, s);
27 }25 }
lib/libc/musl/src/stdio/vfprintf.c+14-9
...@@ -132,7 +132,7 @@ static void pop_arg(union arg *arg, int type, va_list *ap)...@@ -132,7 +132,7 @@ static void pop_arg(union arg *arg, int type, va_list *ap)
132132
133static void out(FILE *f, const char *s, size_t l)133static void out(FILE *f, const char *s, size_t l)
134{134{
135 if (!(f->flags & F_ERR)) __fwritex((void *)s, l, f);135 if (!ferror(f)) __fwritex((void *)s, l, f);
136}136}
137137
138static void pad(FILE *f, char c, int w, int l, int fl)138static void pad(FILE *f, char c, int w, int l, int fl)
...@@ -478,8 +478,8 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,...@@ -478,8 +478,8 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
478 if (*s=='*') {478 if (*s=='*') {
479 if (isdigit(s[1]) && s[2]=='$') {479 if (isdigit(s[1]) && s[2]=='$') {
480 l10n=1;480 l10n=1;
481 nl_type[s[1]-'0'] = INT;481 if (!f) nl_type[s[1]-'0'] = INT, w = 0;
482 w = nl_arg[s[1]-'0'].i;482 else w = nl_arg[s[1]-'0'].i;
483 s+=3;483 s+=3;
484 } else if (!l10n) {484 } else if (!l10n) {
485 w = f ? va_arg(*ap, int) : 0;485 w = f ? va_arg(*ap, int) : 0;
...@@ -491,8 +491,8 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,...@@ -491,8 +491,8 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
491 /* Read precision */491 /* Read precision */
492 if (*s=='.' && s[1]=='*') {492 if (*s=='.' && s[1]=='*') {
493 if (isdigit(s[2]) && s[3]=='$') {493 if (isdigit(s[2]) && s[3]=='$') {
494 nl_type[s[2]-'0'] = INT;494 if (!f) nl_type[s[2]-'0'] = INT, p = 0;
495 p = nl_arg[s[2]-'0'].i;495 else p = nl_arg[s[2]-'0'].i;
496 s+=4;496 s+=4;
497 } else if (!l10n) {497 } else if (!l10n) {
498 p = f ? va_arg(*ap, int) : 0;498 p = f ? va_arg(*ap, int) : 0;
...@@ -521,13 +521,18 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,...@@ -521,13 +521,18 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
521 if (st==NOARG) {521 if (st==NOARG) {
522 if (argpos>=0) goto inval;522 if (argpos>=0) goto inval;
523 } else {523 } else {
524 if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos];524 if (argpos>=0) {
525 else if (f) pop_arg(&arg, st, ap);525 if (!f) nl_type[argpos]=st;
526 else arg=nl_arg[argpos];
527 } else if (f) pop_arg(&arg, st, ap);
526 else return 0;528 else return 0;
527 }529 }
528530
529 if (!f) continue;531 if (!f) continue;
530532
533 /* Do not process any new directives once in error state. */
534 if (ferror(f)) return -1;
535
531 z = buf + sizeof(buf);536 z = buf + sizeof(buf);
532 prefix = "-+ 0X0x";537 prefix = "-+ 0X0x";
533 pl = 0;538 pl = 0;
...@@ -672,7 +677,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)...@@ -672,7 +677,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
672677
673 FLOCK(f);678 FLOCK(f);
674 olderr = f->flags & F_ERR;679 olderr = f->flags & F_ERR;
675 if (f->mode < 1) f->flags &= ~F_ERR;680 f->flags &= ~F_ERR;
676 if (!f->buf_size) {681 if (!f->buf_size) {
677 saved_buf = f->buf;682 saved_buf = f->buf;
678 f->buf = internal_buf;683 f->buf = internal_buf;
...@@ -688,7 +693,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)...@@ -688,7 +693,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
688 f->buf_size = 0;693 f->buf_size = 0;
689 f->wpos = f->wbase = f->wend = 0;694 f->wpos = f->wbase = f->wend = 0;
690 }695 }
691 if (f->flags & F_ERR) ret = -1;696 if (ferror(f)) ret = -1;
692 f->flags |= olderr;697 f->flags |= olderr;
693 FUNLOCK(f);698 FUNLOCK(f);
694 va_end(ap2);699 va_end(ap2);
lib/libc/musl/src/stdio/vfwprintf.c+23-16
...@@ -125,7 +125,13 @@ static void pop_arg(union arg *arg, int type, va_list *ap)...@@ -125,7 +125,13 @@ static void pop_arg(union arg *arg, int type, va_list *ap)
125125
126static void out(FILE *f, const wchar_t *s, size_t l)126static void out(FILE *f, const wchar_t *s, size_t l)
127{127{
128 while (l-- && !(f->flags & F_ERR)) fputwc(*s++, f);128 while (l-- && !ferror(f)) fputwc(*s++, f);
129}
130
131static void pad(FILE *f, int n, int fl)
132{
133 if ((fl & LEFT_ADJ) || !n || ferror(f)) return;
134 fprintf(f, "%*s", n, "");
129}135}
130136
131static int getint(wchar_t **s) {137static int getint(wchar_t **s) {
...@@ -242,6 +248,10 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_...@@ -242,6 +248,10 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
242 }248 }
243249
244 if (!f) continue;250 if (!f) continue;
251
252 /* Do not process any new directives once in error state. */
253 if (ferror(f)) return -1;
254
245 t = s[-1];255 t = s[-1];
246 if (ps && (t&15)==3) t&=~32;256 if (ps && (t&15)==3) t&=~32;
247257
...@@ -258,25 +268,22 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_...@@ -258,25 +268,22 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
258 }268 }
259 continue;269 continue;
260 case 'c':270 case 'c':
271 case 'C':
261 if (w<1) w=1;272 if (w<1) w=1;
262 if (w>1 && !(fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, "");273 pad(f, w-1, fl);
263 fputwc(btowc(arg.i), f);274 out(f, &(wchar_t){t=='C' ? arg.i : btowc(arg.i)}, 1);
264 if (w>1 && (fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, "");275 pad(f, w-1, fl^LEFT_ADJ);
265 l = w;276 l = w;
266 continue;277 continue;
267 case 'C':
268 fputwc(arg.i, f);
269 l = 1;
270 continue;
271 case 'S':278 case 'S':
272 a = arg.p;279 a = arg.p;
273 z = a + wcsnlen(a, p<0 ? INT_MAX : p);280 z = a + wcsnlen(a, p<0 ? INT_MAX : p);
274 if (p<0 && *z) goto overflow;281 if (p<0 && *z) goto overflow;
275 p = z-a;282 p = z-a;
276 if (w<p) w=p;283 if (w<p) w=p;
277 if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");284 pad(f, w-p, fl);
278 out(f, a, p);285 out(f, a, p);
279 if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");286 pad(f, w-p, fl^LEFT_ADJ);
280 l=w;287 l=w;
281 continue;288 continue;
282 case 'm':289 case 'm':
...@@ -289,14 +296,14 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_...@@ -289,14 +296,14 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
289 if (p<0 && *bs) goto overflow;296 if (p<0 && *bs) goto overflow;
290 p=l;297 p=l;
291 if (w<p) w=p;298 if (w<p) w=p;
292 if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");299 pad(f, w-p, fl);
293 bs = arg.p;300 bs = arg.p;
294 while (l--) {301 while (l--) {
295 i=mbtowc(&wc, bs, MB_LEN_MAX);302 i=mbtowc(&wc, bs, MB_LEN_MAX);
296 bs+=i;303 bs+=i;
297 fputwc(wc, f);304 out(f, &wc, 1);
298 }305 }
299 if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");306 pad(f, w-p, fl^LEFT_ADJ);
300 l=w;307 l=w;
301 continue;308 continue;
302 }309 }
...@@ -340,8 +347,8 @@ overflow:...@@ -340,8 +347,8 @@ overflow:
340int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)347int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
341{348{
342 va_list ap2;349 va_list ap2;
343 int nl_type[NL_ARGMAX] = {0};350 int nl_type[NL_ARGMAX+1] = {0};
344 union arg nl_arg[NL_ARGMAX];351 union arg nl_arg[NL_ARGMAX+1];
345 int olderr;352 int olderr;
346 int ret;353 int ret;
347354
...@@ -357,7 +364,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)...@@ -357,7 +364,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
357 olderr = f->flags & F_ERR;364 olderr = f->flags & F_ERR;
358 f->flags &= ~F_ERR;365 f->flags &= ~F_ERR;
359 ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);366 ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
360 if (f->flags & F_ERR) ret = -1;367 if (ferror(f)) ret = -1;
361 f->flags |= olderr;368 f->flags |= olderr;
362 FUNLOCK(f);369 FUNLOCK(f);
363 va_end(ap2);370 va_end(ap2);
lib/libc/musl/src/stdio/vswprintf.c+1
...@@ -18,6 +18,7 @@ static size_t sw_write(FILE *f, const unsigned char *s, size_t l)...@@ -18,6 +18,7 @@ static size_t sw_write(FILE *f, const unsigned char *s, size_t l)
18 if (s!=f->wbase && sw_write(f, f->wbase, f->wpos-f->wbase)==-1)18 if (s!=f->wbase && sw_write(f, f->wbase, f->wpos-f->wbase)==-1)
19 return -1;19 return -1;
20 while (c->l && l && (i=mbtowc(c->ws, (void *)s, l))>=0) {20 while (c->l && l && (i=mbtowc(c->ws, (void *)s, l))>=0) {
21 if (!i) i=1;
21 s+=i;22 s+=i;
22 l-=i;23 l-=i;
23 c->l--;24 c->l--;
lib/libc/musl/src/stdlib/qsort_nr.c+1-1
...@@ -10,5 +10,5 @@ static int wrapper_cmp(const void *v1, const void *v2, void *cmp)...@@ -10,5 +10,5 @@ static int wrapper_cmp(const void *v1, const void *v2, void *cmp)
1010
11void qsort(void *base, size_t nel, size_t width, cmpfun cmp)11void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
12{12{
13 __qsort_r(base, nel, width, wrapper_cmp, cmp);13 __qsort_r(base, nel, width, wrapper_cmp, (void *)cmp);
14}14}
lib/libc/musl/src/string/strverscmp.c+3-3
...@@ -18,9 +18,9 @@ int strverscmp(const char *l0, const char *r0)...@@ -18,9 +18,9 @@ int strverscmp(const char *l0, const char *r0)
18 else if (c!='0') z=0;18 else if (c!='0') z=0;
19 }19 }
2020
21 if (l[dp]!='0' && r[dp]!='0') {21 if (l[dp]-'1'<9U && r[dp]-'1'<9U) {
22 /* If we're not looking at a digit sequence that began22 /* If we're looking at non-degenerate digit sequences starting
23 * with a zero, longest digit string is greater. */23 * with nonzero digits, longest digit string is greater. */
24 for (j=i; isdigit(l[j]); j++)24 for (j=i; isdigit(l[j]); j++)
25 if (!isdigit(r[j])) return 1;25 if (!isdigit(r[j])) return 1;
26 if (isdigit(r[j])) return -1;26 if (isdigit(r[j])) return -1;
lib/libc/musl/src/string/wcscmp.c+1-1
...@@ -3,5 +3,5 @@...@@ -3,5 +3,5 @@
3int wcscmp(const wchar_t *l, const wchar_t *r)3int wcscmp(const wchar_t *l, const wchar_t *r)
4{4{
5 for (; *l==*r && *l && *r; l++, r++);5 for (; *l==*r && *l && *r; l++, r++);
6 return *l - *r;6 return *l < *r ? -1 : *l > *r;
7}7}
lib/libc/musl/src/string/wcsncmp.c+1-1
...@@ -3,5 +3,5 @@...@@ -3,5 +3,5 @@
3int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n)3int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n)
4{4{
5 for (; n && *l==*r && *l && *r; n--, l++, r++);5 for (; n && *l==*r && *l && *r; n--, l++, r++);
6 return n ? *l - *r : 0;6 return n ? (*l < *r ? -1 : *l > *r) : 0;
7}7}
lib/libc/musl/src/string/wmemcmp.c+1-1
...@@ -3,5 +3,5 @@...@@ -3,5 +3,5 @@
3int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n)3int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n)
4{4{
5 for (; n && *l==*r; n--, l++, r++);5 for (; n && *l==*r; n--, l++, r++);
6 return n ? *l-*r : 0;6 return n ? (*l < *r ? -1 : *l > *r) : 0;
7}7}
lib/libc/musl/src/temp/__randname.c+2-1
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1#include <time.h>1#include <time.h>
2#include <stdint.h>2#include <stdint.h>
3#include "pthread_impl.h"
34
4/* This assumes that a check for the5/* This assumes that a check for the
5 template size has already been made */6 template size has already been made */
...@@ -10,7 +11,7 @@ char *__randname(char *template)...@@ -10,7 +11,7 @@ char *__randname(char *template)
10 unsigned long r;11 unsigned long r;
1112
12 __clock_gettime(CLOCK_REALTIME, &ts);13 __clock_gettime(CLOCK_REALTIME, &ts);
13 r = ts.tv_nsec*65537 ^ (uintptr_t)&ts / 16 + (uintptr_t)template;14 r = ts.tv_sec + ts.tv_nsec + __pthread_self()->tid * 65537UL;
14 for (i=0; i<6; i++, r>>=5)15 for (i=0; i<6; i++, r>>=5)
15 template[i] = 'A'+(r&15)+(r&16)*2;16 template[i] = 'A'+(r&15)+(r&16)*2;
1617
lib/libc/musl/src/temp/mkostemp.c-2
...@@ -5,5 +5,3 @@ int mkostemp(char *template, int flags)...@@ -5,5 +5,3 @@ int mkostemp(char *template, int flags)
5{5{
6 return __mkostemps(template, 0, flags);6 return __mkostemps(template, 0, flags);
7}7}
8
9weak_alias(mkostemp, mkostemp64);
lib/libc/musl/src/temp/mkostemps.c-1
...@@ -26,4 +26,3 @@ int __mkostemps(char *template, int len, int flags)...@@ -26,4 +26,3 @@ int __mkostemps(char *template, int len, int flags)
26}26}
2727
28weak_alias(__mkostemps, mkostemps);28weak_alias(__mkostemps, mkostemps);
29weak_alias(__mkostemps, mkostemps64);
lib/libc/musl/src/temp/mkstemp.c-2
...@@ -4,5 +4,3 @@ int mkstemp(char *template)...@@ -4,5 +4,3 @@ int mkstemp(char *template)
4{4{
5 return __mkostemps(template, 0, 0);5 return __mkostemps(template, 0, 0);
6}6}
7
8weak_alias(mkstemp, mkstemp64);
lib/libc/musl/src/temp/mkstemps.c-2
...@@ -5,5 +5,3 @@ int mkstemps(char *template, int len)...@@ -5,5 +5,3 @@ int mkstemps(char *template, int len)
5{5{
6 return __mkostemps(template, len, 0);6 return __mkostemps(template, len, 0);
7}7}
8
9weak_alias(mkstemps, mkstemps64);
lib/libc/musl/src/thread/pthread_atfork.c+7-1
...@@ -1,7 +1,13 @@...@@ -1,7 +1,13 @@
1#include <pthread.h>1#include <pthread.h>
2#include <errno.h>
2#include "libc.h"3#include "libc.h"
3#include "lock.h"4#include "lock.h"
45
6#define malloc __libc_malloc
7#define calloc undef
8#define realloc undef
9#define free undef
10
5static struct atfork_funcs {11static struct atfork_funcs {
6 void (*prepare)(void);12 void (*prepare)(void);
7 void (*parent)(void);13 void (*parent)(void);
...@@ -34,7 +40,7 @@ void __fork_handler(int who)...@@ -34,7 +40,7 @@ void __fork_handler(int who)
34int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))40int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
35{41{
36 struct atfork_funcs *new = malloc(sizeof *new);42 struct atfork_funcs *new = malloc(sizeof *new);
37 if (!new) return -1;43 if (!new) return ENOMEM;
3844
39 LOCK(lock);45 LOCK(lock);
40 new->next = funcs;46 new->next = funcs;
lib/libc/musl/src/thread/pthread_cancel.c+7-2
...@@ -56,7 +56,12 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)...@@ -56,7 +56,12 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
5656
57 _sigaddset(&uc->uc_sigmask, SIGCANCEL);57 _sigaddset(&uc->uc_sigmask, SIGCANCEL);
5858
59 if (self->cancelasync || pc >= (uintptr_t)__cp_begin && pc < (uintptr_t)__cp_end) {59 if (self->cancelasync) {
60 pthread_sigmask(SIG_SETMASK, &uc->uc_sigmask, 0);
61 __cancel();
62 }
63
64 if (pc >= (uintptr_t)__cp_begin && pc < (uintptr_t)__cp_end) {
60 uc->uc_mcontext.MC_PC = (uintptr_t)__cp_cancel;65 uc->uc_mcontext.MC_PC = (uintptr_t)__cp_cancel;
61#ifdef CANCEL_GOT66#ifdef CANCEL_GOT
62 uc->uc_mcontext.MC_GOT = CANCEL_GOT;67 uc->uc_mcontext.MC_GOT = CANCEL_GOT;
...@@ -77,7 +82,7 @@ void __testcancel()...@@ -77,7 +82,7 @@ void __testcancel()
77static void init_cancellation()82static void init_cancellation()
78{83{
79 struct sigaction sa = {84 struct sigaction sa = {
80 .sa_flags = SA_SIGINFO | SA_RESTART,85 .sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK,
81 .sa_sigaction = cancel_handler86 .sa_sigaction = cancel_handler
82 };87 };
83 memset(&sa.sa_mask, -1, _NSIG/8);88 memset(&sa.sa_mask, -1, _NSIG/8);
lib/libc/musl/src/thread/pthread_create.c+10-6
...@@ -107,6 +107,16 @@ _Noreturn void __pthread_exit(void *result)...@@ -107,6 +107,16 @@ _Noreturn void __pthread_exit(void *result)
107107
108 /* At this point we are committed to thread termination. */108 /* At this point we are committed to thread termination. */
109109
110 /* After the kernel thread exits, its tid may be reused. Clear it
111 * to prevent inadvertent use and inform functions that would use
112 * it that it's no longer available. At this point the killlock
113 * may be released, since functions that use it will consistently
114 * see the thread as having exited. Release it now so that no
115 * remaining locks (except thread list) are held if we end up
116 * resetting need_locks below. */
117 self->tid = 0;
118 UNLOCK(self->killlock);
119
110 /* Process robust list in userspace to handle non-pshared mutexes120 /* Process robust list in userspace to handle non-pshared mutexes
111 * and the detached thread case where the robust list head will121 * and the detached thread case where the robust list head will
112 * be invalid when the kernel would process it. */122 * be invalid when the kernel would process it. */
...@@ -159,12 +169,6 @@ _Noreturn void __pthread_exit(void *result)...@@ -159,12 +169,6 @@ _Noreturn void __pthread_exit(void *result)
159 a_store(&self->detach_state, DT_EXITED);169 a_store(&self->detach_state, DT_EXITED);
160 __wake(&self->detach_state, 1, 1);170 __wake(&self->detach_state, 1, 1);
161171
162 /* After the kernel thread exits, its tid may be reused. Clear it
163 * to prevent inadvertent use and inform functions that would use
164 * it that it's no longer available. */
165 self->tid = 0;
166 UNLOCK(self->killlock);
167
168 for (;;) __syscall(SYS_exit, 0);172 for (;;) __syscall(SYS_exit, 0);
169}173}
170174
lib/libc/musl/src/thread/pthread_detach.c+6-2
...@@ -5,8 +5,12 @@ static int __pthread_detach(pthread_t t)...@@ -5,8 +5,12 @@ static int __pthread_detach(pthread_t t)
5{5{
6 /* If the cas fails, detach state is either already-detached6 /* If the cas fails, detach state is either already-detached
7 * or exiting/exited, and pthread_join will trap or cleanup. */7 * or exiting/exited, and pthread_join will trap or cleanup. */
8 if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE)8 if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE) {
9 return __pthread_join(t, 0);9 int cs;
10 __pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
11 __pthread_join(t, 0);
12 __pthread_setcancelstate(cs, 0);
13 }
10 return 0;14 return 0;
11}15}
1216
lib/libc/musl/src/thread/pthread_key_create.c+8
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1#include "pthread_impl.h"1#include "pthread_impl.h"
2#include "fork_impl.h"
23
3volatile size_t __pthread_tsd_size = sizeof(void *) * PTHREAD_KEYS_MAX;4volatile size_t __pthread_tsd_size = sizeof(void *) * PTHREAD_KEYS_MAX;
4void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };5void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
...@@ -20,6 +21,13 @@ static void dummy_0(void)...@@ -20,6 +21,13 @@ static void dummy_0(void)
20weak_alias(dummy_0, __tl_lock);21weak_alias(dummy_0, __tl_lock);
21weak_alias(dummy_0, __tl_unlock);22weak_alias(dummy_0, __tl_unlock);
2223
24void __pthread_key_atfork(int who)
25{
26 if (who<0) __pthread_rwlock_rdlock(&key_lock);
27 else if (!who) __pthread_rwlock_unlock(&key_lock);
28 else key_lock = (pthread_rwlock_t)PTHREAD_RWLOCK_INITIALIZER;
29}
30
23int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *))31int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
24{32{
25 pthread_t self = __pthread_self();33 pthread_t self = __pthread_self();
lib/libc/musl/src/thread/sem_getvalue.c+2-1
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1#include <semaphore.h>1#include <semaphore.h>
2#include <limits.h>
23
3int sem_getvalue(sem_t *restrict sem, int *restrict valp)4int sem_getvalue(sem_t *restrict sem, int *restrict valp)
4{5{
5 int val = sem->__val[0];6 int val = sem->__val[0];
6 *valp = val < 0 ? 0 : val;7 *valp = val & SEM_VALUE_MAX;
7 return 0;8 return 0;
8}9}
lib/libc/musl/src/thread/sem_post.c+8-4
...@@ -1,17 +1,21 @@...@@ -1,17 +1,21 @@
1#include <semaphore.h>1#include <semaphore.h>
2#include <limits.h>
2#include "pthread_impl.h"3#include "pthread_impl.h"
34
4int sem_post(sem_t *sem)5int sem_post(sem_t *sem)
5{6{
6 int val, waiters, priv = sem->__val[2];7 int val, new, waiters, priv = sem->__val[2];
7 do {8 do {
8 val = sem->__val[0];9 val = sem->__val[0];
9 waiters = sem->__val[1];10 waiters = sem->__val[1];
10 if (val == SEM_VALUE_MAX) {11 if ((val & SEM_VALUE_MAX) == SEM_VALUE_MAX) {
11 errno = EOVERFLOW;12 errno = EOVERFLOW;
12 return -1;13 return -1;
13 }14 }
14 } while (a_cas(sem->__val, val, val+1+(val<0)) != val);15 new = val + 1;
15 if (val<0 || waiters) __wake(sem->__val, 1, priv);16 if (waiters <= 1)
17 new &= ~0x80000000;
18 } while (a_cas(sem->__val, val, new) != val);
19 if (val<0) __wake(sem->__val, waiters>1 ? 1 : -1, priv);
16 return 0;20 return 0;
17}21}
lib/libc/musl/src/thread/sem_timedwait.c+6-4
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1#include <semaphore.h>1#include <semaphore.h>
2#include <limits.h>
2#include "pthread_impl.h"3#include "pthread_impl.h"
34
4static void cleanup(void *p)5static void cleanup(void *p)
...@@ -13,14 +14,15 @@ int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict at)...@@ -13,14 +14,15 @@ int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict at)
13 if (!sem_trywait(sem)) return 0;14 if (!sem_trywait(sem)) return 0;
1415
15 int spins = 100;16 int spins = 100;
16 while (spins-- && sem->__val[0] <= 0 && !sem->__val[1]) a_spin();17 while (spins-- && !(sem->__val[0] & SEM_VALUE_MAX) && !sem->__val[1])
18 a_spin();
1719
18 while (sem_trywait(sem)) {20 while (sem_trywait(sem)) {
19 int r;21 int r, priv = sem->__val[2];
20 a_inc(sem->__val+1);22 a_inc(sem->__val+1);
21 a_cas(sem->__val, 0, -1);23 a_cas(sem->__val, 0, 0x80000000);
22 pthread_cleanup_push(cleanup, (void *)(sem->__val+1));24 pthread_cleanup_push(cleanup, (void *)(sem->__val+1));
23 r = __timedwait_cp(sem->__val, -1, CLOCK_REALTIME, at, sem->__val[2]);25 r = __timedwait_cp(sem->__val, 0x80000000, CLOCK_REALTIME, at, priv);
24 pthread_cleanup_pop(1);26 pthread_cleanup_pop(1);
25 if (r) {27 if (r) {
26 errno = r;28 errno = r;
lib/libc/musl/src/thread/sem_trywait.c+3-3
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1#include <semaphore.h>1#include <semaphore.h>
2#include <limits.h>
2#include "pthread_impl.h"3#include "pthread_impl.h"
34
4int sem_trywait(sem_t *sem)5int sem_trywait(sem_t *sem)
5{6{
6 int val;7 int val;
7 while ((val=sem->__val[0]) > 0) {8 while ((val=sem->__val[0]) & SEM_VALUE_MAX) {
8 int new = val-1-(val==1 && sem->__val[1]);9 if (a_cas(sem->__val, val, val-1)==val) return 0;
9 if (a_cas(sem->__val, val, new)==val) return 0;
10 }10 }
11 errno = EAGAIN;11 errno = EAGAIN;
12 return -1;12 return -1;
lib/libc/musl/src/thread/synccall.c+1-1
...@@ -45,7 +45,7 @@ void __synccall(void (*func)(void *), void *ctx)...@@ -45,7 +45,7 @@ void __synccall(void (*func)(void *), void *ctx)
45{45{
46 sigset_t oldmask;46 sigset_t oldmask;
47 int cs, i, r;47 int cs, i, r;
48 struct sigaction sa = { .sa_flags = SA_RESTART, .sa_handler = handler };48 struct sigaction sa = { .sa_flags = SA_RESTART | SA_ONSTACK, .sa_handler = handler };
49 pthread_t self = __pthread_self(), td;49 pthread_t self = __pthread_self(), td;
50 int count = 0;50 int count = 0;
5151
lib/libc/musl/src/time/__map_file.c+2-3
...@@ -2,15 +2,14 @@...@@ -2,15 +2,14 @@
2#include <fcntl.h>2#include <fcntl.h>
3#include <sys/stat.h>3#include <sys/stat.h>
4#include "syscall.h"4#include "syscall.h"
5#include "kstat.h"
65
7const char unsigned *__map_file(const char *pathname, size_t *size)6const char unsigned *__map_file(const char *pathname, size_t *size)
8{7{
9 struct kstat st;8 struct stat st;
10 const unsigned char *map = MAP_FAILED;9 const unsigned char *map = MAP_FAILED;
11 int fd = sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK);10 int fd = sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
12 if (fd < 0) return 0;11 if (fd < 0) return 0;
13 if (!syscall(SYS_fstat, fd, &st)) {12 if (!__fstat(fd, &st)) {
14 map = __mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);13 map = __mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
15 *size = st.st_size;14 *size = st.st_size;
16 }15 }
lib/libc/musl/src/time/clock_getcpuclockid.c+1
...@@ -8,6 +8,7 @@ int clock_getcpuclockid(pid_t pid, clockid_t *clk)...@@ -8,6 +8,7 @@ int clock_getcpuclockid(pid_t pid, clockid_t *clk)
8 struct timespec ts;8 struct timespec ts;
9 clockid_t id = (-pid-1)*8U + 2;9 clockid_t id = (-pid-1)*8U + 2;
10 int ret = __syscall(SYS_clock_getres, id, &ts);10 int ret = __syscall(SYS_clock_getres, id, &ts);
11 if (ret == -EINVAL) ret = -ESRCH;
11 if (ret) return -ret;12 if (ret) return -ret;
12 *clk = id;13 *clk = id;
13 return 0;14 return 0;
lib/libc/musl/src/time/clock_gettime.c+7
...@@ -42,6 +42,9 @@ static int cgt_init(clockid_t clk, struct timespec *ts)...@@ -42,6 +42,9 @@ static int cgt_init(clockid_t clk, struct timespec *ts)
42 p = cgt_time32_wrap;42 p = cgt_time32_wrap;
43 }43 }
44 }44 }
45#ifdef VDSO_CGT_WORKAROUND
46 if (!__vdsosym(VDSO_CGT32_VER, VDSO_CGT32_SYM)) p = 0;
47#endif
45#endif48#endif
46 int (*f)(clockid_t, struct timespec *) =49 int (*f)(clockid_t, struct timespec *) =
47 (int (*)(clockid_t, struct timespec *))p;50 (int (*)(clockid_t, struct timespec *))p;
...@@ -80,10 +83,12 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)...@@ -80,10 +83,12 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
80 return __syscall_ret(r);83 return __syscall_ret(r);
81 long ts32[2];84 long ts32[2];
82 r = __syscall(SYS_clock_gettime, clk, ts32);85 r = __syscall(SYS_clock_gettime, clk, ts32);
86#ifdef SYS_gettimeofday
83 if (r==-ENOSYS && clk==CLOCK_REALTIME) {87 if (r==-ENOSYS && clk==CLOCK_REALTIME) {
84 r = __syscall(SYS_gettimeofday, ts32, 0);88 r = __syscall(SYS_gettimeofday, ts32, 0);
85 ts32[1] *= 1000;89 ts32[1] *= 1000;
86 }90 }
91#endif
87 if (!r) {92 if (!r) {
88 ts->tv_sec = ts32[0];93 ts->tv_sec = ts32[0];
89 ts->tv_nsec = ts32[1];94 ts->tv_nsec = ts32[1];
...@@ -92,6 +97,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)...@@ -92,6 +97,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
92 return __syscall_ret(r);97 return __syscall_ret(r);
93#else98#else
94 r = __syscall(SYS_clock_gettime, clk, ts);99 r = __syscall(SYS_clock_gettime, clk, ts);
100#ifdef SYS_gettimeofday
95 if (r == -ENOSYS) {101 if (r == -ENOSYS) {
96 if (clk == CLOCK_REALTIME) {102 if (clk == CLOCK_REALTIME) {
97 __syscall(SYS_gettimeofday, ts, 0);103 __syscall(SYS_gettimeofday, ts, 0);
...@@ -100,6 +106,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)...@@ -100,6 +106,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
100 }106 }
101 r = -EINVAL;107 r = -EINVAL;
102 }108 }
109#endif
103 return __syscall_ret(r);110 return __syscall_ret(r);
104#endif111#endif
105}112}
lib/libc/musl/src/time/timer_create.c+5-1
...@@ -43,6 +43,8 @@ static void *start(void *arg)...@@ -43,6 +43,8 @@ static void *start(void *arg)
43 union sigval val = args->sev->sigev_value;43 union sigval val = args->sev->sigev_value;
4444
45 pthread_barrier_wait(&args->b);45 pthread_barrier_wait(&args->b);
46 if (self->cancel)
47 return 0;
46 for (;;) {48 for (;;) {
47 siginfo_t si;49 siginfo_t si;
48 while (sigwaitinfo(SIGTIMER_SET, &si) < 0);50 while (sigwaitinfo(SIGTIMER_SET, &si) < 0);
...@@ -113,8 +115,10 @@ int timer_create(clockid_t clk, struct sigevent *restrict evp, timer_t *restrict...@@ -113,8 +115,10 @@ int timer_create(clockid_t clk, struct sigevent *restrict evp, timer_t *restrict
113 ksev.sigev_signo = SIGTIMER;115 ksev.sigev_signo = SIGTIMER;
114 ksev.sigev_notify = SIGEV_THREAD_ID;116 ksev.sigev_notify = SIGEV_THREAD_ID;
115 ksev.sigev_tid = td->tid;117 ksev.sigev_tid = td->tid;
116 if (syscall(SYS_timer_create, clk, &ksev, &timerid) < 0)118 if (syscall(SYS_timer_create, clk, &ksev, &timerid) < 0) {
117 timerid = -1;119 timerid = -1;
120 td->cancel = 1;
121 }
118 td->timer_id = timerid;122 td->timer_id = timerid;
119 pthread_barrier_wait(&args.b);123 pthread_barrier_wait(&args.b);
120 if (timerid < 0) return -1;124 if (timerid < 0) return -1;
lib/libc/musl/src/unistd/dup3.c+4-2
...@@ -9,12 +9,14 @@ int __dup3(int old, int new, int flags)...@@ -9,12 +9,14 @@ int __dup3(int old, int new, int flags)
9 int r;9 int r;
10#ifdef SYS_dup210#ifdef SYS_dup2
11 if (old==new) return __syscall_ret(-EINVAL);11 if (old==new) return __syscall_ret(-EINVAL);
12 if (flags & O_CLOEXEC) {12 if (flags) {
13 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);13 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);
14 if (r!=-ENOSYS) return __syscall_ret(r);14 if (r!=-ENOSYS) return __syscall_ret(r);
15 if (flags & ~O_CLOEXEC) return __syscall_ret(-EINVAL);
15 }16 }
16 while ((r=__syscall(SYS_dup2, old, new))==-EBUSY);17 while ((r=__syscall(SYS_dup2, old, new))==-EBUSY);
17 if (flags & O_CLOEXEC) __syscall(SYS_fcntl, new, F_SETFD, FD_CLOEXEC);18 if (r >= 0 && (flags & O_CLOEXEC))
19 __syscall(SYS_fcntl, new, F_SETFD, FD_CLOEXEC);
18#else20#else
19 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);21 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);
20#endif22#endif
lib/libc/musl/src/unistd/ftruncate.c-2
...@@ -5,5 +5,3 @@ int ftruncate(int fd, off_t length)...@@ -5,5 +5,3 @@ int ftruncate(int fd, off_t length)
5{5{
6 return syscall(SYS_ftruncate, fd, __SYSCALL_LL_O(length));6 return syscall(SYS_ftruncate, fd, __SYSCALL_LL_O(length));
7}7}
8
9weak_alias(ftruncate, ftruncate64);
lib/libc/musl/src/unistd/lseek.c-1
...@@ -12,4 +12,3 @@ off_t __lseek(int fd, off_t offset, int whence)...@@ -12,4 +12,3 @@ off_t __lseek(int fd, off_t offset, int whence)
12}12}
1313
14weak_alias(__lseek, lseek);14weak_alias(__lseek, lseek);
15weak_alias(__lseek, lseek64);
lib/libc/musl/src/unistd/mipsn32/lseek.c-1
...@@ -17,4 +17,3 @@ off_t __lseek(int fd, off_t offset, int whence)...@@ -17,4 +17,3 @@ off_t __lseek(int fd, off_t offset, int whence)
17}17}
1818
19weak_alias(__lseek, lseek);19weak_alias(__lseek, lseek);
20weak_alias(__lseek, lseek64);
lib/libc/musl/src/unistd/pipe2.c+1
...@@ -8,6 +8,7 @@ int pipe2(int fd[2], int flag)...@@ -8,6 +8,7 @@ int pipe2(int fd[2], int flag)
8 if (!flag) return pipe(fd);8 if (!flag) return pipe(fd);
9 int ret = __syscall(SYS_pipe2, fd, flag);9 int ret = __syscall(SYS_pipe2, fd, flag);
10 if (ret != -ENOSYS) return __syscall_ret(ret);10 if (ret != -ENOSYS) return __syscall_ret(ret);
11 if (flag & ~(O_CLOEXEC|O_NONBLOCK)) return __syscall_ret(-EINVAL);
11 ret = pipe(fd);12 ret = pipe(fd);
12 if (ret) return ret;13 if (ret) return ret;
13 if (flag & O_CLOEXEC) {14 if (flag & O_CLOEXEC) {
lib/libc/musl/src/unistd/pread.c-2
...@@ -5,5 +5,3 @@ ssize_t pread(int fd, void *buf, size_t size, off_t ofs)...@@ -5,5 +5,3 @@ ssize_t pread(int fd, void *buf, size_t size, off_t ofs)
5{5{
6 return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_PRW(ofs));6 return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_PRW(ofs));
7}7}
8
9weak_alias(pread, pread64);
lib/libc/musl/src/unistd/preadv.c-2
...@@ -8,5 +8,3 @@ ssize_t preadv(int fd, const struct iovec *iov, int count, off_t ofs)...@@ -8,5 +8,3 @@ ssize_t preadv(int fd, const struct iovec *iov, int count, off_t ofs)
8 return syscall_cp(SYS_preadv, fd, iov, count,8 return syscall_cp(SYS_preadv, fd, iov, count,
9 (long)(ofs), (long)(ofs>>32));9 (long)(ofs), (long)(ofs>>32));
10}10}
11
12weak_alias(preadv, preadv64);
lib/libc/musl/src/unistd/pwrite.c-2
...@@ -5,5 +5,3 @@ ssize_t pwrite(int fd, const void *buf, size_t size, off_t ofs)...@@ -5,5 +5,3 @@ ssize_t pwrite(int fd, const void *buf, size_t size, off_t ofs)
5{5{
6 return syscall_cp(SYS_pwrite, fd, buf, size, __SYSCALL_LL_PRW(ofs));6 return syscall_cp(SYS_pwrite, fd, buf, size, __SYSCALL_LL_PRW(ofs));
7}7}
8
9weak_alias(pwrite, pwrite64);
lib/libc/musl/src/unistd/pwritev.c-2
...@@ -8,5 +8,3 @@ ssize_t pwritev(int fd, const struct iovec *iov, int count, off_t ofs)...@@ -8,5 +8,3 @@ ssize_t pwritev(int fd, const struct iovec *iov, int count, off_t ofs)
8 return syscall_cp(SYS_pwritev, fd, iov, count,8 return syscall_cp(SYS_pwritev, fd, iov, count,
9 (long)(ofs), (long)(ofs>>32));9 (long)(ofs), (long)(ofs>>32));
10}10}
11
12weak_alias(pwritev, pwritev64);
lib/libc/musl/src/unistd/truncate.c-2
...@@ -5,5 +5,3 @@ int truncate(const char *path, off_t length)...@@ -5,5 +5,3 @@ int truncate(const char *path, off_t length)
5{5{
6 return syscall(SYS_truncate, path, __SYSCALL_LL_O(length));6 return syscall(SYS_truncate, path, __SYSCALL_LL_O(length));
7}7}
8
9weak_alias(truncate, truncate64);
lib/libc/musl/src/unistd/x32/lseek.c-1
...@@ -12,4 +12,3 @@ off_t __lseek(int fd, off_t offset, int whence)...@@ -12,4 +12,3 @@ off_t __lseek(int fd, off_t offset, int whence)
12}12}
1313
14weak_alias(__lseek, lseek);14weak_alias(__lseek, lseek);
15weak_alias(__lseek, lseek64);
lib/std/os.zig+19-68
...@@ -890,10 +890,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {...@@ -890,10 +890,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {
890 };890 };
891 const adjusted_len = @min(max_count, buf.len);891 const adjusted_len = @min(max_count, buf.len);
892892
893 const pread_sym = if (builtin.os.tag == .linux and builtin.link_libc)893 const pread_sym = if (lfs64_abi) system.pread64 else system.pread;
894 system.pread64
895 else
896 system.pread;
897894
898 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned895 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
899 while (true) {896 while (true) {
...@@ -966,10 +963,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {...@@ -966,10 +963,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {
966 }963 }
967964
968 while (true) {965 while (true) {
969 const ftruncate_sym = if (builtin.os.tag == .linux and builtin.link_libc)966 const ftruncate_sym = if (lfs64_abi) system.ftruncate64 else system.ftruncate;
970 system.ftruncate64
971 else
972 system.ftruncate;
973967
974 const ilen = @bitCast(i64, length); // the OS treats this as unsigned968 const ilen = @bitCast(i64, length); // the OS treats this as unsigned
975 switch (errno(ftruncate_sym(fd, ilen))) {969 switch (errno(ftruncate_sym(fd, ilen))) {
...@@ -1034,10 +1028,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {...@@ -1034,10 +1028,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
10341028
1035 const iov_count = math.cast(u31, iov.len) orelse math.maxInt(u31);1029 const iov_count = math.cast(u31, iov.len) orelse math.maxInt(u31);
10361030
1037 const preadv_sym = if (builtin.os.tag == .linux and builtin.link_libc)1031 const preadv_sym = if (lfs64_abi) system.preadv64 else system.preadv;
1038 system.preadv64
1039 else
1040 system.preadv;
10411032
1042 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned1033 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
1043 while (true) {1034 while (true) {
...@@ -1311,10 +1302,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {...@@ -1311,10 +1302,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
1311 };1302 };
1312 const adjusted_len = @min(max_count, bytes.len);1303 const adjusted_len = @min(max_count, bytes.len);
13131304
1314 const pwrite_sym = if (builtin.os.tag == .linux and builtin.link_libc)1305 const pwrite_sym = if (lfs64_abi) system.pwrite64 else system.pwrite;
1315 system.pwrite64
1316 else
1317 system.pwrite;
13181306
1319 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned1307 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
1320 while (true) {1308 while (true) {
...@@ -1400,10 +1388,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz...@@ -1400,10 +1388,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz
1400 }1388 }
1401 }1389 }
14021390
1403 const pwritev_sym = if (builtin.os.tag == .linux and builtin.link_libc)1391 const pwritev_sym = if (lfs64_abi) system.pwritev64 else system.pwritev;
1404 system.pwritev64
1405 else
1406 system.pwritev;
14071392
1408 const iov_count = if (iov.len > IOV_MAX) IOV_MAX else @intCast(u31, iov.len);1393 const iov_count = if (iov.len > IOV_MAX) IOV_MAX else @intCast(u31, iov.len);
1409 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned1394 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
...@@ -1514,10 +1499,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: u32, perm: mode_t) OpenError!fd_t...@@ -1514,10 +1499,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: u32, perm: mode_t) OpenError!fd_t
1514 return open(mem.sliceTo(file_path, 0), flags, perm);1499 return open(mem.sliceTo(file_path, 0), flags, perm);
1515 }1500 }
15161501
1517 const open_sym = if (builtin.os.tag == .linux and builtin.link_libc)1502 const open_sym = if (lfs64_abi) system.open64 else system.open;
1518 system.open64
1519 else
1520 system.open;
15211503
1522 while (true) {1504 while (true) {
1523 const rc = open_sym(file_path, flags, perm);1505 const rc = open_sym(file_path, flags, perm);
...@@ -1730,10 +1712,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t)...@@ -1730,10 +1712,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t)
1730 return openat(dir_fd, mem.sliceTo(file_path, 0), flags, mode);1712 return openat(dir_fd, mem.sliceTo(file_path, 0), flags, mode);
1731 }1713 }
17321714
1733 const openat_sym = if (builtin.os.tag == .linux and builtin.link_libc)1715 const openat_sym = if (lfs64_abi) system.openat64 else system.openat;
1734 system.openat64
1735 else
1736 system.openat;
17371716
1738 while (true) {1717 while (true) {
1739 const rc = openat_sym(dir_fd, file_path, flags, mode);1718 const rc = openat_sym(dir_fd, file_path, flags, mode);
...@@ -4117,10 +4096,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat {...@@ -4117,10 +4096,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat {
4117 @compileError("fstat is not yet implemented on Windows");4096 @compileError("fstat is not yet implemented on Windows");
4118 }4097 }
41194098
4120 const fstat_sym = if (builtin.os.tag == .linux and builtin.link_libc)4099 const fstat_sym = if (lfs64_abi) system.fstat64 else system.fstat;
4121 system.fstat64
4122 else
4123 system.fstat;
41244100
4125 var stat = mem.zeroes(Stat);4101 var stat = mem.zeroes(Stat);
4126 switch (errno(fstat_sym(fd, &stat))) {4102 switch (errno(fstat_sym(fd, &stat))) {
...@@ -4176,10 +4152,7 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S...@@ -4176,10 +4152,7 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S
4176 return fstatatWasi(dirfd, mem.sliceTo(pathname), flags);4152 return fstatatWasi(dirfd, mem.sliceTo(pathname), flags);
4177 }4153 }
41784154
4179 const fstatat_sym = if (builtin.os.tag == .linux and builtin.link_libc)4155 const fstatat_sym = if (lfs64_abi) system.fstatat64 else system.fstatat;
4180 system.fstatat64
4181 else
4182 system.fstatat;
41834156
4184 var stat = mem.zeroes(Stat);4157 var stat = mem.zeroes(Stat);
4185 switch (errno(fstatat_sym(dirfd, pathname, &stat, flags))) {4158 switch (errno(fstatat_sym(dirfd, pathname, &stat, flags))) {
...@@ -4416,10 +4389,7 @@ pub fn mmap(...@@ -4416,10 +4389,7 @@ pub fn mmap(
4416 fd: fd_t,4389 fd: fd_t,
4417 offset: u64,4390 offset: u64,
4418) MMapError![]align(mem.page_size) u8 {4391) MMapError![]align(mem.page_size) u8 {
4419 const mmap_sym = if (builtin.os.tag == .linux and builtin.link_libc)4392 const mmap_sym = if (lfs64_abi) system.mmap64 else system.mmap;
4420 system.mmap64
4421 else
4422 system.mmap;
44234393
4424 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned4394 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
4425 const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset);4395 const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset);
...@@ -4823,10 +4793,7 @@ pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void {...@@ -4823,10 +4793,7 @@ pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void {
4823 }4793 }
4824 }4794 }
48254795
4826 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)4796 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
4827 system.lseek64
4828 else
4829 system.lseek;
48304797
4831 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned4798 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
4832 switch (errno(lseek_sym(fd, ioffset, SEEK.SET))) {4799 switch (errno(lseek_sym(fd, ioffset, SEEK.SET))) {
...@@ -4870,10 +4837,7 @@ pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void {...@@ -4870,10 +4837,7 @@ pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void {
4870 else => |err| return unexpectedErrno(err),4837 else => |err| return unexpectedErrno(err),
4871 }4838 }
4872 }4839 }
4873 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)4840 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
4874 system.lseek64
4875 else
4876 system.lseek;
48774841
4878 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned4842 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
4879 switch (errno(lseek_sym(fd, ioffset, SEEK.CUR))) {4843 switch (errno(lseek_sym(fd, ioffset, SEEK.CUR))) {
...@@ -4917,10 +4881,7 @@ pub fn lseek_END(fd: fd_t, offset: i64) SeekError!void {...@@ -4917,10 +4881,7 @@ pub fn lseek_END(fd: fd_t, offset: i64) SeekError!void {
4917 else => |err| return unexpectedErrno(err),4881 else => |err| return unexpectedErrno(err),
4918 }4882 }
4919 }4883 }
4920 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)4884 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
4921 system.lseek64
4922 else
4923 system.lseek;
49244885
4925 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned4886 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
4926 switch (errno(lseek_sym(fd, ioffset, SEEK.END))) {4887 switch (errno(lseek_sym(fd, ioffset, SEEK.END))) {
...@@ -4964,10 +4925,7 @@ pub fn lseek_CUR_get(fd: fd_t) SeekError!u64 {...@@ -4964,10 +4925,7 @@ pub fn lseek_CUR_get(fd: fd_t) SeekError!u64 {
4964 else => |err| return unexpectedErrno(err),4925 else => |err| return unexpectedErrno(err),
4965 }4926 }
4966 }4927 }
4967 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)4928 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
4968 system.lseek64
4969 else
4970 system.lseek;
49714929
4972 const rc = lseek_sym(fd, 0, SEEK.CUR);4930 const rc = lseek_sym(fd, 0, SEEK.CUR);
4973 switch (errno(rc)) {4931 switch (errno(rc)) {
...@@ -6169,10 +6127,7 @@ pub fn sendfile(...@@ -6169,10 +6127,7 @@ pub fn sendfile(
6169 // TODO we should not need this cast; improve return type of @min6127 // TODO we should not need this cast; improve return type of @min
6170 const adjusted_count = @intCast(usize, adjusted_count_tmp);6128 const adjusted_count = @intCast(usize, adjusted_count_tmp);
61716129
6172 const sendfile_sym = if (builtin.link_libc)6130 const sendfile_sym = if (lfs64_abi) system.sendfile64 else system.sendfile;
6173 system.sendfile64
6174 else
6175 system.sendfile;
61766131
6177 while (true) {6132 while (true) {
6178 var offset: off_t = @bitCast(off_t, in_offset);6133 var offset: off_t = @bitCast(off_t, in_offset);
...@@ -7050,10 +7005,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 {...@@ -7050,10 +7005,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 {
7050pub const GetrlimitError = UnexpectedError;7005pub const GetrlimitError = UnexpectedError;
70517006
7052pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit {7007pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit {
7053 const getrlimit_sym = if (builtin.os.tag == .linux and builtin.link_libc)7008 const getrlimit_sym = if (lfs64_abi) system.getrlimit64 else system.getrlimit;
7054 system.getrlimit64
7055 else
7056 system.getrlimit;
70577009
7058 var limits: rlimit = undefined;7010 var limits: rlimit = undefined;
7059 switch (errno(getrlimit_sym(resource, &limits))) {7011 switch (errno(getrlimit_sym(resource, &limits))) {
...@@ -7067,10 +7019,7 @@ pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit {...@@ -7067,10 +7019,7 @@ pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit {
7067pub const SetrlimitError = error{ PermissionDenied, LimitTooBig } || UnexpectedError;7019pub const SetrlimitError = error{ PermissionDenied, LimitTooBig } || UnexpectedError;
70687020
7069pub fn setrlimit(resource: rlimit_resource, limits: rlimit) SetrlimitError!void {7021pub fn setrlimit(resource: rlimit_resource, limits: rlimit) SetrlimitError!void {
7070 const setrlimit_sym = if (builtin.os.tag == .linux and builtin.link_libc)7022 const setrlimit_sym = if (lfs64_abi) system.setrlimit64 else system.setrlimit;
7071 system.setrlimit64
7072 else
7073 system.setrlimit;
70747023
7075 switch (errno(setrlimit_sym(resource, &limits))) {7024 switch (errno(setrlimit_sym(resource, &limits))) {
7076 .SUCCESS => return,7025 .SUCCESS => return,
...@@ -7339,3 +7288,5 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, signal: usize) PtraceError!...@@ -7339,3 +7288,5 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, signal: usize) PtraceError!
7339 },7288 },
7340 };7289 };
7341}7290}
7291
7292const lfs64_abi = builtin.os.tag == .linux and builtin.link_libc and builtin.abi.isGnu();
src/Compilation.zig+1-1
...@@ -4918,7 +4918,7 @@ fn detectLibCFromBuilding(...@@ -4918,7 +4918,7 @@ fn detectLibCFromBuilding(
4918 const generic_name = target_util.libCGenericName(target);4918 const generic_name = target_util.libCGenericName(target);
4919 // Some architectures are handled by the same set of headers.4919 // Some architectures are handled by the same set of headers.
4920 const arch_name = if (target.abi.isMusl())4920 const arch_name = if (target.abi.isMusl())
4921 musl.archName(target.cpu.arch)4921 musl.archNameHeaders(target.cpu.arch)
4922 else if (target.cpu.arch.isThumb())4922 else if (target.cpu.arch.isThumb())
4923 // ARM headers are valid for Thumb too.4923 // ARM headers are valid for Thumb too.
4924 switch (target.cpu.arch) {4924 switch (target.cpu.arch) {
src/musl.zig+13-5
...@@ -258,7 +258,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr...@@ -258,7 +258,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
258 }258 }
259}259}
260260
261pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {261fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
262 switch (arch) {262 switch (arch) {
263 .aarch64, .aarch64_be => return "aarch64",263 .aarch64, .aarch64_be => return "aarch64",
264 .arm, .armeb, .thumb, .thumbeb => return "arm",264 .arm, .armeb, .thumb, .thumbeb => return "arm",
...@@ -275,6 +275,13 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {...@@ -275,6 +275,13 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
275 }275 }
276}276}
277277
278pub fn archNameHeaders(arch: std.Target.Cpu.Arch) [:0]const u8 {
279 return switch (arch) {
280 .x86 => return "x86",
281 else => archName(arch),
282 };
283}
284
278// Return true if musl has arch-specific crti/crtn sources.285// Return true if musl has arch-specific crti/crtn sources.
279// See lib/libc/musl/crt/ARCH/crt?.s .286// See lib/libc/musl/crt/ARCH/crt?.s .
280pub fn needsCrtiCrtn(target: std.Target) bool {287pub fn needsCrtiCrtn(target: std.Target) bool {
...@@ -361,7 +368,9 @@ fn addCcArgs(...@@ -361,7 +368,9 @@ fn addCcArgs(
361 const target = comp.getTarget();368 const target = comp.getTarget();
362 const arch_name = archName(target.cpu.arch);369 const arch_name = archName(target.cpu.arch);
363 const os_name = @tagName(target.os.tag);370 const os_name = @tagName(target.os.tag);
364 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });371 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{
372 archNameHeaders(target.cpu.arch), os_name,
373 });
365 const o_arg = if (want_O3) "-O3" else "-Os";374 const o_arg = if (want_O3) "-O3" else "-Os";
366375
367 try args.appendSlice(&[_][]const u8{376 try args.appendSlice(&[_][]const u8{
...@@ -1457,6 +1466,7 @@ const src_files = [_][]const u8{...@@ -1457,6 +1466,7 @@ const src_files = [_][]const u8{
1457 "musl/src/prng/seed48.c",1466 "musl/src/prng/seed48.c",
1458 "musl/src/prng/srand48.c",1467 "musl/src/prng/srand48.c",
1459 "musl/src/process/_Fork.c",1468 "musl/src/process/_Fork.c",
1469 "musl/src/process/aarch64/vfork.s",
1460 "musl/src/process/arm/vfork.s",1470 "musl/src/process/arm/vfork.s",
1461 "musl/src/process/execl.c",1471 "musl/src/process/execl.c",
1462 "musl/src/process/execle.c",1472 "musl/src/process/execle.c",
...@@ -1487,6 +1497,7 @@ const src_files = [_][]const u8{...@@ -1487,6 +1497,7 @@ const src_files = [_][]const u8{
1487 "musl/src/process/posix_spawnattr_setsigdefault.c",1497 "musl/src/process/posix_spawnattr_setsigdefault.c",
1488 "musl/src/process/posix_spawnattr_setsigmask.c",1498 "musl/src/process/posix_spawnattr_setsigmask.c",
1489 "musl/src/process/posix_spawnp.c",1499 "musl/src/process/posix_spawnp.c",
1500 "musl/src/process/riscv64/vfork.s",
1490 "musl/src/process/s390x/vfork.s",1501 "musl/src/process/s390x/vfork.s",
1491 "musl/src/process/sh/vfork.s",1502 "musl/src/process/sh/vfork.s",
1492 "musl/src/process/system.c",1503 "musl/src/process/system.c",
...@@ -1570,11 +1581,8 @@ const src_files = [_][]const u8{...@@ -1570,11 +1581,8 @@ const src_files = [_][]const u8{
1570 "musl/src/signal/m68k/sigsetjmp.s",1581 "musl/src/signal/m68k/sigsetjmp.s",
1571 "musl/src/signal/microblaze/restore.s",1582 "musl/src/signal/microblaze/restore.s",
1572 "musl/src/signal/microblaze/sigsetjmp.s",1583 "musl/src/signal/microblaze/sigsetjmp.s",
1573 "musl/src/signal/mips/restore.s",
1574 "musl/src/signal/mips/sigsetjmp.s",1584 "musl/src/signal/mips/sigsetjmp.s",
1575 "musl/src/signal/mips64/restore.s",
1576 "musl/src/signal/mips64/sigsetjmp.s",1585 "musl/src/signal/mips64/sigsetjmp.s",
1577 "musl/src/signal/mipsn32/restore.s",
1578 "musl/src/signal/mipsn32/sigsetjmp.s",1586 "musl/src/signal/mipsn32/sigsetjmp.s",
1579 "musl/src/signal/or1k/sigsetjmp.s",1587 "musl/src/signal/or1k/sigsetjmp.s",
1580 "musl/src/signal/powerpc/restore.s",1588 "musl/src/signal/powerpc/restore.s",
src/wasi_libc.zig+1-1
...@@ -256,7 +256,7 @@ fn addCCArgs(...@@ -256,7 +256,7 @@ fn addCCArgs(
256 want_O3: bool,256 want_O3: bool,
257) error{OutOfMemory}!void {257) error{OutOfMemory}!void {
258 const target = comp.getTarget();258 const target = comp.getTarget();
259 const arch_name = musl.archName(target.cpu.arch);259 const arch_name = musl.archNameHeaders(target.cpu.arch);
260 const os_name = @tagName(target.os.tag);260 const os_name = @tagName(target.os.tag);
261 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });261 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });
262 const o_arg = if (want_O3) "-O3" else "-Os";262 const o_arg = if (want_O3) "-O3" else "-Os";
tools/gen_stubs.zig+218-15
...@@ -11,6 +11,7 @@...@@ -11,6 +11,7 @@
11//! * One of the following, corresponding to the CPU architecture:11//! * One of the following, corresponding to the CPU architecture:
12//! - `-DARCH_riscv64`12//! - `-DARCH_riscv64`
13//! - `-DARCH_mips`13//! - `-DARCH_mips`
14//! - `-DARCH_mips64`
14//! - `-DARCH_i386`15//! - `-DARCH_i386`
15//! - `-DARCH_x86_64`16//! - `-DARCH_x86_64`
16//! - `-DARCH_powerpc`17//! - `-DARCH_powerpc`
...@@ -28,9 +29,20 @@ const log = std.log;...@@ -28,9 +29,20 @@ const log = std.log;
28const elf = std.elf;29const elf = std.elf;
29const native_endian = @import("builtin").target.cpu.arch.endian();30const native_endian = @import("builtin").target.cpu.arch.endian();
3031
31const arches: [7]std.Target.Cpu.Arch = blk: {32const inputs = .{
32 var result: [7]std.Target.Cpu.Arch = undefined;33 .riscv64,
33 for (.{ .riscv64, .mips, .x86, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| {34 .mips,
35 .mips64,
36 .x86,
37 .x86_64,
38 .powerpc,
39 .powerpc64,
40 .aarch64,
41};
42
43const arches: [inputs.len]std.Target.Cpu.Arch = blk: {
44 var result: [inputs.len]std.Target.Cpu.Arch = undefined;
45 for (inputs) |arch| {
34 result[archIndex(arch)] = arch;46 result[archIndex(arch)] = arch;
35 }47 }
36 break :blk result;48 break :blk result;
...@@ -56,6 +68,7 @@ const MultiSym = struct {...@@ -56,6 +68,7 @@ const MultiSym = struct {
56 fn is32Only(ms: MultiSym) bool {68 fn is32Only(ms: MultiSym) bool {
57 return ms.present[archIndex(.riscv64)] == false and69 return ms.present[archIndex(.riscv64)] == false and
58 ms.present[archIndex(.mips)] == true and70 ms.present[archIndex(.mips)] == true and
71 ms.present[archIndex(.mips64)] == false and
59 ms.present[archIndex(.x86)] == true and72 ms.present[archIndex(.x86)] == true and
60 ms.present[archIndex(.x86_64)] == false and73 ms.present[archIndex(.x86_64)] == false and
61 ms.present[archIndex(.powerpc)] == true and74 ms.present[archIndex(.powerpc)] == true and
...@@ -97,6 +110,7 @@ const MultiSym = struct {...@@ -97,6 +110,7 @@ const MultiSym = struct {
97 const map = .{110 const map = .{
98 .{ .riscv64, 8 },111 .{ .riscv64, 8 },
99 .{ .mips, 4 },112 .{ .mips, 4 },
113 .{ .mips64, 8 },
100 .{ .x86, 4 },114 .{ .x86, 4 },
101 .{ .x86_64, 8 },115 .{ .x86_64, 8 },
102 .{ .powerpc, 4 },116 .{ .powerpc, 4 },
...@@ -118,6 +132,7 @@ const MultiSym = struct {...@@ -118,6 +132,7 @@ const MultiSym = struct {
118 const map = .{132 const map = .{
119 .{ .riscv64, 16 },133 .{ .riscv64, 16 },
120 .{ .mips, 8 },134 .{ .mips, 8 },
135 .{ .mips64, 16 },
121 .{ .x86, 8 },136 .{ .x86, 8 },
122 .{ .x86_64, 16 },137 .{ .x86_64, 16 },
123 .{ .powerpc, 8 },138 .{ .powerpc, 8 },
...@@ -139,6 +154,7 @@ const MultiSym = struct {...@@ -139,6 +154,7 @@ const MultiSym = struct {
139 const map = .{154 const map = .{
140 .{ .riscv64, 2 },155 .{ .riscv64, 2 },
141 .{ .mips, 1 },156 .{ .mips, 1 },
157 .{ .mips64, 2 },
142 .{ .x86, 1 },158 .{ .x86, 1 },
143 .{ .x86_64, 2 },159 .{ .x86_64, 2 },
144 .{ .powerpc, 1 },160 .{ .powerpc, 1 },
...@@ -187,17 +203,23 @@ pub fn main() !void {...@@ -187,17 +203,23 @@ pub fn main() !void {
187 }203 }
188204
189 for (arches) |arch| {205 for (arches) |arch| {
190 const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{@tagName(arch)});206 const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{
207 archMuslName(arch),
208 });
191209
192 // Read the ELF header.210 // Read the ELF header.
193 const elf_bytes = try build_all_dir.readFileAllocOptions(211 const elf_bytes = build_all_dir.readFileAllocOptions(
194 arena,212 arena,
195 libc_so_path,213 libc_so_path,
196 100 * 1024 * 1024,214 100 * 1024 * 1024,
197 1 * 1024 * 1024,215 1 * 1024 * 1024,
198 @alignOf(elf.Elf64_Ehdr),216 @alignOf(elf.Elf64_Ehdr),
199 null,217 null,
200 );218 ) catch |err| {
219 std.debug.panic("unable to read '{s}/{s}': {s}", .{
220 build_all_path, libc_so_path, @errorName(err),
221 });
222 };
201 const header = try elf.Header.parse(elf_bytes[0..@sizeOf(elf.Elf64_Ehdr)]);223 const header = try elf.Header.parse(elf_bytes[0..@sizeOf(elf.Elf64_Ehdr)]);
202224
203 const parse: Parse = .{225 const parse: Parse = .{
...@@ -437,9 +459,15 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)...@@ -437,9 +459,15 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
437 const dynstr = elf_bytes[dynstr_offset..];459 const dynstr = elf_bytes[dynstr_offset..];
438460
439 // Sort the list by address, ascending.461 // Sort the list by address, ascending.
440 mem.sort(Sym, @alignCast(8, dyn_syms), {}, S.symbolAddrLessThan);462 // We need a copy to fix alignment.
463 const copied_dyn_syms = copy: {
464 const ptr = try arena.alloc(Sym, dyn_syms.len);
465 @memcpy(ptr, dyn_syms);
466 break :copy ptr;
467 };
468 mem.sort(Sym, copied_dyn_syms, {}, S.symbolAddrLessThan);
441469
442 for (dyn_syms) |sym| {470 for (copied_dyn_syms) |sym| {
443 const this_section = s(sym.st_shndx);471 const this_section = s(sym.st_shndx);
444 const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0));472 const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0));
445 const ty = @truncate(u4, sym.st_info);473 const ty = @truncate(u4, sym.st_info);
...@@ -555,19 +583,36 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {...@@ -555,19 +583,36 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
555 // zig fmt: off583 // zig fmt: off
556 .riscv64 => 0,584 .riscv64 => 0,
557 .mips => 1,585 .mips => 1,
558 .x86 => 2,586 .mips64 => 2,
559 .x86_64 => 3,587 .x86 => 3,
560 .powerpc => 4,588 .x86_64 => 4,
561 .powerpc64 => 5,589 .powerpc => 5,
562 .aarch64 => 6,590 .powerpc64 => 6,
591 .aarch64 => 7,
592 else => unreachable,
593 // zig fmt: on
594 };
595}
596
597fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 {
598 return switch (arch) {
599 // zig fmt: off
600 .riscv64 => "riscv64",
601 .mips => "mips",
602 .mips64 => "mips64",
603 .x86 => "i386",
604 .x86_64 => "x86_64",
605 .powerpc => "powerpc",
606 .powerpc64 => "powerpc64",
607 .aarch64 => "aarch64",
563 else => unreachable,608 else => unreachable,
564 // zig fmt: on609 // zig fmt: on
565 };610 };
566}611}
567612
568fn archSetName(arch_set: [arches.len]bool) []const u8 {613fn archSetName(arch_set: [arches.len]bool) []const u8 {
569 for (arches, 0..) |arch, i| {614 for (arches, arch_set) |arch, set_item| {
570 if (arch_set[i]) {615 if (set_item) {
571 return @tagName(arch);616 return @tagName(arch);
572 }617 }
573 }618 }
...@@ -913,4 +958,162 @@ const blacklisted_symbols = [_][]const u8{...@@ -913,4 +958,162 @@ const blacklisted_symbols = [_][]const u8{
913 "sinf128",958 "sinf128",
914 "sqrtf128",959 "sqrtf128",
915 "truncf128",960 "truncf128",
961 "__aarch64_cas16_acq",
962 "__aarch64_cas16_acq_rel",
963 "__aarch64_cas16_rel",
964 "__aarch64_cas16_relax",
965 "__aarch64_cas1_acq",
966 "__aarch64_cas1_acq_rel",
967 "__aarch64_cas1_rel",
968 "__aarch64_cas1_relax",
969 "__aarch64_cas2_acq",
970 "__aarch64_cas2_acq_rel",
971 "__aarch64_cas2_rel",
972 "__aarch64_cas2_relax",
973 "__aarch64_cas4_acq",
974 "__aarch64_cas4_acq_rel",
975 "__aarch64_cas4_rel",
976 "__aarch64_cas4_relax",
977 "__aarch64_cas8_acq",
978 "__aarch64_cas8_acq_rel",
979 "__aarch64_cas8_rel",
980 "__aarch64_cas8_relax",
981 "__aarch64_ldadd1_acq",
982 "__aarch64_ldadd1_acq_rel",
983 "__aarch64_ldadd1_rel",
984 "__aarch64_ldadd1_relax",
985 "__aarch64_ldadd2_acq",
986 "__aarch64_ldadd2_acq_rel",
987 "__aarch64_ldadd2_rel",
988 "__aarch64_ldadd2_relax",
989 "__aarch64_ldadd4_acq",
990 "__aarch64_ldadd4_acq_rel",
991 "__aarch64_ldadd4_rel",
992 "__aarch64_ldadd4_relax",
993 "__aarch64_ldadd8_acq",
994 "__aarch64_ldadd8_acq_rel",
995 "__aarch64_ldadd8_rel",
996 "__aarch64_ldadd8_relax",
997 "__aarch64_ldclr1_acq",
998 "__aarch64_ldclr1_acq_rel",
999 "__aarch64_ldclr1_rel",
1000 "__aarch64_ldclr1_relax",
1001 "__aarch64_ldclr2_acq",
1002 "__aarch64_ldclr2_acq_rel",
1003 "__aarch64_ldclr2_rel",
1004 "__aarch64_ldclr2_relax",
1005 "__aarch64_ldclr4_acq",
1006 "__aarch64_ldclr4_acq_rel",
1007 "__aarch64_ldclr4_rel",
1008 "__aarch64_ldclr4_relax",
1009 "__aarch64_ldclr8_acq",
1010 "__aarch64_ldclr8_acq_rel",
1011 "__aarch64_ldclr8_rel",
1012 "__aarch64_ldclr8_relax",
1013 "__aarch64_ldeor1_acq",
1014 "__aarch64_ldeor1_acq_rel",
1015 "__aarch64_ldeor1_rel",
1016 "__aarch64_ldeor1_relax",
1017 "__aarch64_ldeor2_acq",
1018 "__aarch64_ldeor2_acq_rel",
1019 "__aarch64_ldeor2_rel",
1020 "__aarch64_ldeor2_relax",
1021 "__aarch64_ldeor4_acq",
1022 "__aarch64_ldeor4_acq_rel",
1023 "__aarch64_ldeor4_rel",
1024 "__aarch64_ldeor4_relax",
1025 "__aarch64_ldeor8_acq",
1026 "__aarch64_ldeor8_acq_rel",
1027 "__aarch64_ldeor8_rel",
1028 "__aarch64_ldeor8_relax",
1029 "__aarch64_ldset1_acq",
1030 "__aarch64_ldset1_acq_rel",
1031 "__aarch64_ldset1_rel",
1032 "__aarch64_ldset1_relax",
1033 "__aarch64_ldset2_acq",
1034 "__aarch64_ldset2_acq_rel",
1035 "__aarch64_ldset2_rel",
1036 "__aarch64_ldset2_relax",
1037 "__aarch64_ldset4_acq",
1038 "__aarch64_ldset4_acq_rel",
1039 "__aarch64_ldset4_rel",
1040 "__aarch64_ldset4_relax",
1041 "__aarch64_ldset8_acq",
1042 "__aarch64_ldset8_acq_rel",
1043 "__aarch64_ldset8_rel",
1044 "__aarch64_ldset8_relax",
1045 "__aarch64_swp1_acq",
1046 "__aarch64_swp1_acq_rel",
1047 "__aarch64_swp1_rel",
1048 "__aarch64_swp1_relax",
1049 "__aarch64_swp2_acq",
1050 "__aarch64_swp2_acq_rel",
1051 "__aarch64_swp2_rel",
1052 "__aarch64_swp2_relax",
1053 "__aarch64_swp4_acq",
1054 "__aarch64_swp4_acq_rel",
1055 "__aarch64_swp4_rel",
1056 "__aarch64_swp4_relax",
1057 "__aarch64_swp8_acq",
1058 "__aarch64_swp8_acq_rel",
1059 "__aarch64_swp8_rel",
1060 "__aarch64_swp8_relax",
1061 "__addhf3",
1062 "__atomic_compare_exchange_16",
1063 "__atomic_exchange_16",
1064 "__atomic_fetch_add_16",
1065 "__atomic_fetch_and_16",
1066 "__atomic_fetch_nand_16",
1067 "__atomic_fetch_or_16",
1068 "__atomic_fetch_sub_16",
1069 "__atomic_fetch_umax_1",
1070 "__atomic_fetch_umax_16",
1071 "__atomic_fetch_umax_2",
1072 "__atomic_fetch_umax_4",
1073 "__atomic_fetch_umax_8",
1074 "__atomic_fetch_umin_1",
1075 "__atomic_fetch_umin_16",
1076 "__atomic_fetch_umin_2",
1077 "__atomic_fetch_umin_4",
1078 "__atomic_fetch_umin_8",
1079 "__atomic_fetch_xor_16",
1080 "__atomic_load_16",
1081 "__atomic_store_16",
1082 "__cmphf2",
1083 "__cmpxf2",
1084 "__divdc3",
1085 "__divhc3",
1086 "__divhf3",
1087 "__divkc3",
1088 "__divsc3",
1089 "__divtc3",
1090 "__divxc3",
1091 "__eqhf2",
1092 "__extendhfdf2",
1093 "__fixhfdi",
1094 "__fixhfsi",
1095 "__fixhfti",
1096 "__fixunshfdi",
1097 "__fixunshfsi",
1098 "__fixunshfti",
1099 "__floatdihf",
1100 "__floatsihf",
1101 "__floattihf",
1102 "__floatundihf",
1103 "__floatunsihf",
1104 "__floatuntihf",
1105 "__gehf2",
1106 "__gthf2",
1107 "__lehf2",
1108 "__lthf2",
1109 "__mulhc3",
1110 "__mulhf3",
1111 "__neghf2",
1112 "__negkf2",
1113 "__negtf2",
1114 "__negxf2",
1115 "__nehf2",
1116 "__subhf3",
1117 "__unordhf2",
1118 "__unordxf2",
916};1119};
tools/process_headers.zig+1-1
...@@ -208,7 +208,7 @@ const musl_targets = [_]LibCTarget{...@@ -208,7 +208,7 @@ const musl_targets = [_]LibCTarget{
208 .abi = MultiAbi.musl,208 .abi = MultiAbi.musl,
209 },209 },
210 LibCTarget{210 LibCTarget{
211 .name = "x86",211 .name = "i386",
212 .arch = MultiArch{ .specific = .x86 },212 .arch = MultiArch{ .specific = .x86 },
213 .abi = MultiAbi.musl,213 .abi = MultiAbi.musl,
214 },214 },