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 *);
4949
5050int 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)
5353#define aiocb64 aiocb
5454#define aio_read64 aio_read
5555#define aio_write64 aio_write
lib/libc/include/generic-musl/arpa/nameser.h+71
......@@ -188,6 +188,36 @@ typedef enum __ns_type {
188188 ns_t_sink = 40,
189189 ns_t_opt = 41,
190190 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,
191221 ns_t_tkey = 249,
192222 ns_t_tsig = 250,
193223 ns_t_ixfr = 251,
......@@ -196,6 +226,11 @@ typedef enum __ns_type {
196226 ns_t_maila = 254,
197227 ns_t_any = 255,
198228 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,
199234 ns_t_max = 65536
200235} ns_type;
201236
......@@ -430,12 +465,48 @@ typedef struct {
430465#define T_NAPTR ns_t_naptr
431466#define T_A6 ns_t_a6
432467#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
433499#define T_TSIG ns_t_tsig
434500#define T_IXFR ns_t_ixfr
435501#define T_AXFR ns_t_axfr
436502#define T_MAILB ns_t_mailb
437503#define T_MAILA ns_t_maila
438504#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
440511#define C_IN ns_c_in
441512#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);
5656int versionsort(const struct dirent **, const struct dirent **);
5757#endif
5858
59#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
59#if defined(_LARGEFILE64_SOURCE)
6060#define dirent64 dirent
6161#define readdir64 readdir
6262#define readdir64_r readdir_r
lib/libc/include/generic-musl/elf.h+7-2
......@@ -385,7 +385,8 @@ typedef struct {
385385#define SHT_PREINIT_ARRAY 16
386386#define SHT_GROUP 17
387387#define SHT_SYMTAB_SHNDX 18
388#define SHT_NUM 19
388#define SHT_RELR 19
389#define SHT_NUM 20
389390#define SHT_LOOS 0x60000000
390391#define SHT_GNU_ATTRIBUTES 0x6ffffff5
391392#define SHT_GNU_HASH 0x6ffffff6
......@@ -436,6 +437,7 @@ typedef struct {
436437} Elf64_Chdr;
437438
438439#define ELFCOMPRESS_ZLIB 1
440#define ELFCOMPRESS_ZSTD 2
439441#define ELFCOMPRESS_LOOS 0x60000000
440442#define ELFCOMPRESS_HIOS 0x6fffffff
441443#define ELFCOMPRESS_LOPROC 0x70000000
......@@ -754,7 +756,10 @@ typedef struct {
754756#define DT_PREINIT_ARRAY 32
755757#define DT_PREINIT_ARRAYSZ 33
756758#define DT_SYMTAB_SHNDX 34
757#define DT_NUM 35
759#define DT_RELRSZ 35
760#define DT_RELR 36
761#define DT_RELRENT 37
762#define DT_NUM 38
758763#define DT_LOOS 0x6000000d
759764#define DT_HIOS 0x6ffff000
760765#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);
195195#define loff_t off_t
196196#endif
197197
198#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
198#if defined(_LARGEFILE64_SOURCE)
199199#define F_GETLK64 F_GETLK
200200#define F_SETLK64 F_SETLK
201201#define F_SETLKW64 F_SETLKW
lib/libc/include/generic-musl/ftw.h+1-1
......@@ -29,7 +29,7 @@ struct FTW {
2929int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
3030int 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)
3333#define ftw64 ftw
3434#define nftw64 nftw
3535#endif
lib/libc/include/generic-musl/glob.h+1-1
......@@ -39,7 +39,7 @@ void globfree(glob_t *);
3939#define GLOB_NOMATCH 3
4040#define GLOB_NOSYS 4
4141
42#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
42#if defined(_LARGEFILE64_SOURCE)
4343#define glob64 glob
4444#define globfree64 globfree
4545#define glob64_t glob_t
lib/libc/include/generic-musl/netdb.h+1
......@@ -44,6 +44,7 @@ struct addrinfo {
4444#define EAI_NONAME -2
4545#define EAI_AGAIN -3
4646#define EAI_FAIL -4
47#define EAI_NODATA -5
4748#define EAI_FAMILY -6
4849#define EAI_SOCKTYPE -7
4950#define EAI_SERVICE -8
lib/libc/include/generic-musl/sched.h+1-1
......@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)
124124#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
125125#define CPU_FREE(set) free(set)
126126
127#define CPU_SETSIZE 128
127#define CPU_SETSIZE 1024
128128
129129#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
130130#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 {
205205FILE *fopencookie(void *, const char *, cookie_io_functions_t);
206206#endif
207207
208#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
208#if defined(_LARGEFILE64_SOURCE)
209209#define tmpfile64 tmpfile
210210#define fopen64 fopen
211211#define freopen64 freopen
lib/libc/include/generic-musl/stdlib.h+2-2
......@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);
9595#define WTERMSIG(s) ((s) & 0x7f)
9696#define WSTOPSIG(s) WEXITSTATUS(s)
9797#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)
9999#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
100100
101101int posix_memalign (void **, size_t, size_t);
......@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc
163163long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
164164#endif
165165
166#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
166#if defined(_LARGEFILE64_SOURCE)
167167#define mkstemp64 mkstemp
168168#define mkostemp64 mkostemp
169169#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
lib/libc/include/generic-musl/string.h+1-1
......@@ -73,6 +73,7 @@ char *strsignal(int);
7373char *strerror_l (int, locale_t);
7474int strcoll_l (const char *, const char *, locale_t);
7575size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
76void *memmem(const void *, size_t, const void *, size_t);
7677#endif
7778
7879#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
......@@ -92,7 +93,6 @@ void explicit_bzero (void *, size_t);
9293int strverscmp (const char *, const char *);
9394char *strchrnul(const char *, int);
9495char *strcasestr(const char *, const char *);
95void *memmem(const void *, size_t, const void *, size_t);
9696void *memrchr(const void *, int, size_t);
9797void *mempcpy(void *, const void *, size_t);
9898#ifndef __cplusplus
lib/libc/include/generic-musl/strings.h+1
......@@ -5,6 +5,7 @@
55extern "C" {
66#endif
77
8#include <features.h>
89
910#define __NEED_size_t
1011#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 *);
141141int shm_open (const char *, int, mode_t);
142142int shm_unlink (const char *);
143143
144#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
144#if defined(_LARGEFILE64_SOURCE)
145145#define mmap64 mmap
146146#define off64_t off_t
147147#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 *);
9595
9696#define RLIM_NLIMITS RLIMIT_NLIMITS
9797
98#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
98#if defined(_LARGEFILE64_SOURCE)
9999#define RLIM64_INFINITY RLIM_INFINITY
100100#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
101101#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
lib/libc/include/generic-musl/sys/sendfile.h+1-1
......@@ -10,7 +10,7 @@ extern "C" {
1010
1111ssize_t sendfile(int, int, off_t *, size_t);
1212
13#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
13#if defined(_LARGEFILE64_SOURCE)
1414#define sendfile64 sendfile
1515#define off64_t off_t
1616#endif
lib/libc/include/generic-musl/sys/stat.h+1-1
......@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t);
9898#define S_IEXEC S_IXUSR
9999#endif
100100
101#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
101#if defined(_LARGEFILE64_SOURCE)
102102#define stat64 stat
103103#define fstat64 fstat
104104#define lstat64 lstat
lib/libc/include/generic-musl/sys/statfs.h+1-1
......@@ -18,7 +18,7 @@ typedef struct __fsid_t {
1818int statfs (const char *, struct statfs *);
1919int fstatfs (int, struct statfs *);
2020
21#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
21#if defined(_LARGEFILE64_SOURCE)
2222#define statfs64 statfs
2323#define fstatfs64 fstatfs
2424#define fsblkcnt64_t fsblkcnt_t
lib/libc/include/generic-musl/sys/statvfs.h+1-1
......@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *);
4242#define ST_NODIRATIME 2048
4343#define ST_RELATIME 4096
4444
45#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
45#if defined(_LARGEFILE64_SOURCE)
4646#define statvfs64 statvfs
4747#define fstatvfs64 fstatvfs
4848#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;
7171#include <sys/select.h>
7272#endif
7373
74#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
74#if defined(_LARGEFILE64_SOURCE)
7575#define blkcnt64_t blkcnt_t
7676#define fsblkcnt64_t fsblkcnt_t
7777#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);
2929#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3030ssize_t preadv (int, const struct iovec *, int, off_t);
3131ssize_t pwritev (int, const struct iovec *, int, off_t);
32#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
32#if defined(_LARGEFILE64_SOURCE)
3333#define preadv64 preadv
3434#define pwritev64 pwritev
3535#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 *);
5050#define WSTOPSIG(s) WEXITSTATUS(s)
5151#define WCOREDUMP(s) ((s) & 0x80)
5252#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)
5454#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
5555#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);
198198pid_t gettid(void);
199199#endif
200200
201#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
201#if defined(_LARGEFILE64_SOURCE)
202202#define lseek64 lseek
203203#define pread64 pread
204204#define pwrite64 pwrite
......@@ -425,6 +425,8 @@ pid_t gettid(void);
425425#define _SC_XOPEN_STREAMS 246
426426#define _SC_THREAD_ROBUST_PRIO_INHERIT 247
427427#define _SC_THREAD_ROBUST_PRIO_PROTECT 248
428#define _SC_MINSIGSTKSZ 249
429#define _SC_SIGSTKSZ 250
428430
429431#define _CS_PATH 0
430432#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1
......@@ -467,6 +469,8 @@ pid_t gettid(void);
467469#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147
468470#define _CS_V6_ENV 1148
469471#define _CS_V7_ENV 1149
472#define _CS_POSIX_V7_THREADS_CFLAGS 1150
473#define _CS_POSIX_V7_THREADS_LDFLAGS 1151
470474
471475#ifdef __cplusplus
472476}
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 {
6666#define SA_RESTART 0x10000000
6767#define SA_NODEFER 0x40000000
6868#define SA_RESETHAND 0x80000000
69#define SA_RESTORER 0x04000000
7069
7170#undef SIG_BLOCK
7271#undef SIG_UNBLOCK
lib/libc/include/mips64-linux-musl/bits/signal.h-1
......@@ -85,7 +85,6 @@ typedef struct __ucontext {
8585#define SA_RESTART 0x10000000
8686#define SA_NODEFER 0x40000000
8787#define SA_RESETHAND 0x80000000
88#define SA_RESTORER 0x04000000
8988
9089#undef SIG_BLOCK
9190#undef SIG_UNBLOCK
lib/libc/include/riscv64-linux-musl/bits/signal.h-1
......@@ -76,7 +76,6 @@ typedef struct __ucontext
7676#define SA_RESTART 0x10000000
7777#define SA_NODEFER 0x40000000
7878#define SA_RESETHAND 0x80000000
79#define SA_RESTORER 0x04000000
8079
8180#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
101101#define SYSCALL_FADVISE_6_ARG
102102
103103#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 {
6666#define SA_RESTART 0x10000000
6767#define SA_NODEFER 0x40000000
6868#define SA_RESETHAND 0x80000000
69#define SA_RESTORER 0x04000000
7069
7170#undef SIG_BLOCK
7271#undef SIG_UNBLOCK
lib/libc/musl/arch/mips/ksigaction.h+1-4
......@@ -4,10 +4,7 @@ struct k_sigaction {
44 unsigned flags;
55 void (*handler)(int);
66 unsigned long mask[4];
7 /* The following field is past the end of the structure the
8 * kernel will read or write, and exists only to avoid having
9 * mips-specific preprocessor conditionals in sigaction.c. */
10 void (*restorer)();
7 void *unused;
118};
129
1310hidden void __restore(), __restore_rt();
lib/libc/musl/arch/mips/reloc.h+1
......@@ -29,6 +29,7 @@
2929
3030#define NEED_MIPS_GOT_RELOCS 1
3131#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
32#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL
3233#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
3334
3435#define CRTJMP(pc,sp) __asm__ __volatile__( \
lib/libc/musl/arch/mips64/bits/signal.h-1
......@@ -85,7 +85,6 @@ typedef struct __ucontext {
8585#define SA_RESTART 0x10000000
8686#define SA_NODEFER 0x40000000
8787#define SA_RESETHAND 0x80000000
88#define SA_RESTORER 0x04000000
8988
9089#undef SIG_BLOCK
9190#undef SIG_UNBLOCK
lib/libc/musl/arch/mips64/ksigaction.h+1-1
......@@ -4,7 +4,7 @@ struct k_sigaction {
44 unsigned flags;
55 void (*handler)(int);
66 unsigned long mask[2];
7 void (*restorer)();
7 void *unused;
88};
99
1010hidden void __restore(), __restore_rt();
lib/libc/musl/arch/mips64/reloc.h+1
......@@ -38,6 +38,7 @@
3838
3939#define NEED_MIPS_GOT_RELOCS 1
4040#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
41#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL
4142#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
4243
4344#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
7676#define SA_RESTART 0x10000000
7777#define SA_NODEFER 0x40000000
7878#define SA_RESETHAND 0x80000000
79#define SA_RESTORER 0x04000000
8079
8180#endif
8281
lib/libc/musl/compat/time32/__xstat.c+4-4
......@@ -3,22 +3,22 @@
33
44struct stat32;
55
6int __fxstat64(int ver, int fd, struct stat32 *buf)
6int __fxstat(int ver, int fd, struct stat32 *buf)
77{
88 return __fstat_time32(fd, buf);
99}
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)
1212{
1313 return __fstatat_time32(fd, path, buf, flag);
1414}
1515
16int __lxstat64(int ver, const char *path, struct stat32 *buf)
16int __lxstat(int ver, const char *path, struct stat32 *buf)
1717{
1818 return __lstat_time32(path, buf);
1919}
2020
21int __xstat64(int ver, const char *path, struct stat32 *buf)
21int __xstat(int ver, const char *path, struct stat32 *buf)
2222{
2323 return __stat_time32(path, buf);
2424}
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
77 return aio_suspend(cbs, cnt, ts32 ? (&(struct timespec){
88 .tv_sec = ts32->tv_sec, .tv_nsec = ts32->tv_nsec}) : 0);
99}
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)
1313 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
1414 return r;
1515}
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
1313 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
1414 return r;
1515}
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)
1313 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
1414 return r;
1515}
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)
1313 if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim));
1414 return r;
1515}
16
17weak_alias(stat, stat64);
lib/libc/musl/include/aio.h+1-1
......@@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *);
4949
5050int 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)
5353#define aiocb64 aiocb
5454#define aio_read64 aio_read
5555#define aio_write64 aio_write
lib/libc/musl/include/arpa/nameser.h+71
......@@ -188,6 +188,36 @@ typedef enum __ns_type {
188188 ns_t_sink = 40,
189189 ns_t_opt = 41,
190190 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,
191221 ns_t_tkey = 249,
192222 ns_t_tsig = 250,
193223 ns_t_ixfr = 251,
......@@ -196,6 +226,11 @@ typedef enum __ns_type {
196226 ns_t_maila = 254,
197227 ns_t_any = 255,
198228 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,
199234 ns_t_max = 65536
200235} ns_type;
201236
......@@ -430,12 +465,48 @@ typedef struct {
430465#define T_NAPTR ns_t_naptr
431466#define T_A6 ns_t_a6
432467#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
433499#define T_TSIG ns_t_tsig
434500#define T_IXFR ns_t_ixfr
435501#define T_AXFR ns_t_axfr
436502#define T_MAILB ns_t_mailb
437503#define T_MAILA ns_t_maila
438504#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
440511#define C_IN ns_c_in
441512#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);
5656int versionsort(const struct dirent **, const struct dirent **);
5757#endif
5858
59#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
59#if defined(_LARGEFILE64_SOURCE)
6060#define dirent64 dirent
6161#define readdir64 readdir
6262#define readdir64_r readdir_r
lib/libc/musl/include/elf.h+7-2
......@@ -385,7 +385,8 @@ typedef struct {
385385#define SHT_PREINIT_ARRAY 16
386386#define SHT_GROUP 17
387387#define SHT_SYMTAB_SHNDX 18
388#define SHT_NUM 19
388#define SHT_RELR 19
389#define SHT_NUM 20
389390#define SHT_LOOS 0x60000000
390391#define SHT_GNU_ATTRIBUTES 0x6ffffff5
391392#define SHT_GNU_HASH 0x6ffffff6
......@@ -436,6 +437,7 @@ typedef struct {
436437} Elf64_Chdr;
437438
438439#define ELFCOMPRESS_ZLIB 1
440#define ELFCOMPRESS_ZSTD 2
439441#define ELFCOMPRESS_LOOS 0x60000000
440442#define ELFCOMPRESS_HIOS 0x6fffffff
441443#define ELFCOMPRESS_LOPROC 0x70000000
......@@ -754,7 +756,10 @@ typedef struct {
754756#define DT_PREINIT_ARRAY 32
755757#define DT_PREINIT_ARRAYSZ 33
756758#define DT_SYMTAB_SHNDX 34
757#define DT_NUM 35
759#define DT_RELRSZ 35
760#define DT_RELR 36
761#define DT_RELRENT 37
762#define DT_NUM 38
758763#define DT_LOOS 0x6000000d
759764#define DT_HIOS 0x6ffff000
760765#define DT_LOPROC 0x70000000
lib/libc/musl/include/fcntl.h+1-1
......@@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned);
195195#define loff_t off_t
196196#endif
197197
198#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
198#if defined(_LARGEFILE64_SOURCE)
199199#define F_GETLK64 F_GETLK
200200#define F_SETLK64 F_SETLK
201201#define F_SETLKW64 F_SETLKW
lib/libc/musl/include/ftw.h+1-1
......@@ -29,7 +29,7 @@ struct FTW {
2929int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
3030int 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)
3333#define ftw64 ftw
3434#define nftw64 nftw
3535#endif
lib/libc/musl/include/glob.h+1-1
......@@ -39,7 +39,7 @@ void globfree(glob_t *);
3939#define GLOB_NOMATCH 3
4040#define GLOB_NOSYS 4
4141
42#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
42#if defined(_LARGEFILE64_SOURCE)
4343#define glob64 glob
4444#define globfree64 globfree
4545#define glob64_t glob_t
lib/libc/musl/include/netdb.h+1
......@@ -44,6 +44,7 @@ struct addrinfo {
4444#define EAI_NONAME -2
4545#define EAI_AGAIN -3
4646#define EAI_FAIL -4
47#define EAI_NODATA -5
4748#define EAI_FAMILY -6
4849#define EAI_SOCKTYPE -7
4950#define EAI_SERVICE -8
lib/libc/musl/include/sched.h+1-1
......@@ -124,7 +124,7 @@ __CPU_op_func_S(XOR, ^)
124124#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
125125#define CPU_FREE(set) free(set)
126126
127#define CPU_SETSIZE 128
127#define CPU_SETSIZE 1024
128128
129129#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
130130#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 {
205205FILE *fopencookie(void *, const char *, cookie_io_functions_t);
206206#endif
207207
208#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
208#if defined(_LARGEFILE64_SOURCE)
209209#define tmpfile64 tmpfile
210210#define fopen64 fopen
211211#define freopen64 freopen
lib/libc/musl/include/stdlib.h+2-2
......@@ -95,7 +95,7 @@ size_t __ctype_get_mb_cur_max(void);
9595#define WTERMSIG(s) ((s) & 0x7f)
9696#define WSTOPSIG(s) WEXITSTATUS(s)
9797#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)
9999#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
100100
101101int posix_memalign (void **, size_t, size_t);
......@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc
163163long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
164164#endif
165165
166#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
166#if defined(_LARGEFILE64_SOURCE)
167167#define mkstemp64 mkstemp
168168#define mkostemp64 mkostemp
169169#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
lib/libc/musl/include/string.h+1-1
......@@ -73,6 +73,7 @@ char *strsignal(int);
7373char *strerror_l (int, locale_t);
7474int strcoll_l (const char *, const char *, locale_t);
7575size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
76void *memmem(const void *, size_t, const void *, size_t);
7677#endif
7778
7879#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
......@@ -92,7 +93,6 @@ void explicit_bzero (void *, size_t);
9293int strverscmp (const char *, const char *);
9394char *strchrnul(const char *, int);
9495char *strcasestr(const char *, const char *);
95void *memmem(const void *, size_t, const void *, size_t);
9696void *memrchr(const void *, int, size_t);
9797void *mempcpy(void *, const void *, size_t);
9898#ifndef __cplusplus
lib/libc/musl/include/strings.h+1
......@@ -5,6 +5,7 @@
55extern "C" {
66#endif
77
8#include <features.h>
89
910#define __NEED_size_t
1011#define __NEED_locale_t
lib/libc/musl/include/sys/mman.h+1-1
......@@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *);
141141int shm_open (const char *, int, mode_t);
142142int shm_unlink (const char *);
143143
144#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
144#if defined(_LARGEFILE64_SOURCE)
145145#define mmap64 mmap
146146#define off64_t off_t
147147#endif
lib/libc/musl/include/sys/resource.h+1-1
......@@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
9595
9696#define RLIM_NLIMITS RLIMIT_NLIMITS
9797
98#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
98#if defined(_LARGEFILE64_SOURCE)
9999#define RLIM64_INFINITY RLIM_INFINITY
100100#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
101101#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
lib/libc/musl/include/sys/sendfile.h+1-1
......@@ -10,7 +10,7 @@ extern "C" {
1010
1111ssize_t sendfile(int, int, off_t *, size_t);
1212
13#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
13#if defined(_LARGEFILE64_SOURCE)
1414#define sendfile64 sendfile
1515#define off64_t off_t
1616#endif
lib/libc/musl/include/sys/stat.h+1-1
......@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t);
9898#define S_IEXEC S_IXUSR
9999#endif
100100
101#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
101#if defined(_LARGEFILE64_SOURCE)
102102#define stat64 stat
103103#define fstat64 fstat
104104#define lstat64 lstat
lib/libc/musl/include/sys/statfs.h+1-1
......@@ -18,7 +18,7 @@ typedef struct __fsid_t {
1818int statfs (const char *, struct statfs *);
1919int fstatfs (int, struct statfs *);
2020
21#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
21#if defined(_LARGEFILE64_SOURCE)
2222#define statfs64 statfs
2323#define fstatfs64 fstatfs
2424#define fsblkcnt64_t fsblkcnt_t
lib/libc/musl/include/sys/statvfs.h+1-1
......@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *);
4242#define ST_NODIRATIME 2048
4343#define ST_RELATIME 4096
4444
45#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
45#if defined(_LARGEFILE64_SOURCE)
4646#define statvfs64 statvfs
4747#define fstatvfs64 fstatvfs
4848#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;
7171#include <sys/select.h>
7272#endif
7373
74#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
74#if defined(_LARGEFILE64_SOURCE)
7575#define blkcnt64_t blkcnt_t
7676#define fsblkcnt64_t fsblkcnt_t
7777#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);
2929#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3030ssize_t preadv (int, const struct iovec *, int, off_t);
3131ssize_t pwritev (int, const struct iovec *, int, off_t);
32#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
32#if defined(_LARGEFILE64_SOURCE)
3333#define preadv64 preadv
3434#define pwritev64 pwritev
3535#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 *);
5050#define WSTOPSIG(s) WEXITSTATUS(s)
5151#define WCOREDUMP(s) ((s) & 0x80)
5252#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)
5454#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
5555#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);
198198pid_t gettid(void);
199199#endif
200200
201#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
201#if defined(_LARGEFILE64_SOURCE)
202202#define lseek64 lseek
203203#define pread64 pread
204204#define pwrite64 pwrite
......@@ -425,6 +425,8 @@ pid_t gettid(void);
425425#define _SC_XOPEN_STREAMS 246
426426#define _SC_THREAD_ROBUST_PRIO_INHERIT 247
427427#define _SC_THREAD_ROBUST_PRIO_PROTECT 248
428#define _SC_MINSIGSTKSZ 249
429#define _SC_SIGSTKSZ 250
428430
429431#define _CS_PATH 0
430432#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1
......@@ -467,6 +469,8 @@ pid_t gettid(void);
467469#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147
468470#define _CS_V6_ENV 1148
469471#define _CS_V7_ENV 1149
472#define _CS_POSIX_V7_THREADS_CFLAGS 1150
473#define _CS_POSIX_V7_THREADS_LDFLAGS 1151
470474
471475#ifdef __cplusplus
472476}
lib/libc/musl/libc.S+30-203
......@@ -168,7 +168,7 @@ _IO_putc:
168168.weak _IO_putc_unlocked
169169.type _IO_putc_unlocked, %function;
170170_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)
172172.globl ___tls_get_addr
173173.type ___tls_get_addr, %function;
174174___tls_get_addr:
......@@ -187,7 +187,7 @@ __aio_suspend_time64:
187187.globl __assert_fail
188188.type __assert_fail, %function;
189189__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)
191191.globl __cachectl
192192.type __cachectl, %function;
193193__cachectl:
......@@ -313,10 +313,10 @@ __fseterr:
313313.type __fsetlocking, %function;
314314__fsetlocking:
315315#ifdef PTR32
316.globl __fstat_time64
316.weak __fstat_time64
317317.type __fstat_time64, %function;
318318__fstat_time64:
319.globl __fstatat_time64
319.weak __fstatat_time64
320320.type __fstatat_time64, %function;
321321__fstatat_time64:
322322.globl __ftime64
......@@ -338,22 +338,12 @@ __fwritable:
338338.globl __fwriting
339339.type __fwriting, %function;
340340__fwriting:
341#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
342341.globl __fxstat
343342.type __fxstat, %function;
344343__fxstat:
345#endif
346WEAK64 __fxstat64
347.type __fxstat64, %function;
348__fxstat64:
349#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
350344.globl __fxstatat
351345.type __fxstatat, %function;
352346__fxstatat:
353#endif
354WEAK64 __fxstatat64
355.type __fxstatat64, %function;
356__fxstatat64:
357347.weak __getdelim
358348.type __getdelim, %function;
359349__getdelim:
......@@ -508,7 +498,7 @@ __localtime64:
508498.type __localtime64_r, %function;
509499__localtime64_r:
510500#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)
512502.globl __longjmp
513503.type __longjmp, %function;
514504__longjmp:
......@@ -521,14 +511,9 @@ __lstat_time64:
521511.type __lutimes_time64, %function;
522512__lutimes_time64:
523513#endif
524#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
525514.globl __lxstat
526515.type __lxstat, %function;
527516__lxstat:
528#endif
529WEAK64 __lxstat64
530.type __lxstat64, %function;
531__lxstat64:
532517#ifdef PTR32
533518.globl __mktime64
534519.type __mktime64, %function;
......@@ -591,7 +576,17 @@ __recvmmsg_time64:
591576.globl __res_state
592577.type __res_state, %function;
593578__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)
595590.globl __riscv_flush_icache
596591.type __riscv_flush_icache, %function;
597592__riscv_flush_icache:
......@@ -792,27 +787,27 @@ __xpg_basename:
792787.weak __xpg_strerror_r
793788.type __xpg_strerror_r, %function;
794789__xpg_strerror_r:
795#if !defined(ARCH_mips) && !defined(ARCH_i386) && !defined(ARCH_powerpc)
796790.globl __xstat
797791.type __xstat, %function;
798792__xstat:
799#endif
800WEAK64 __xstat64
801.type __xstat64, %function;
802__xstat64:
803793.weak _dl_debug_state
804794.type _dl_debug_state, %function;
805795_dl_debug_state:
806796.globl _dlstart
807797.type _dlstart, %function;
808798_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
809804.globl _exit
810805.type _exit, %function;
811806_exit:
812807.weak _fini
813808.type _fini, %function;
814809_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)
816811.globl _flush_cache
817812.type _flush_cache, %function;
818813_flush_cache:
......@@ -886,45 +881,24 @@ adjtimex:
886881.globl aio_cancel
887882.type aio_cancel, %function;
888883aio_cancel:
889.weak aio_cancel64
890.type aio_cancel64, %function;
891aio_cancel64:
892884.globl aio_error
893885.type aio_error, %function;
894886aio_error:
895.weak aio_error64
896.type aio_error64, %function;
897aio_error64:
898887.globl aio_fsync
899888.type aio_fsync, %function;
900889aio_fsync:
901.weak aio_fsync64
902.type aio_fsync64, %function;
903aio_fsync64:
904890.globl aio_read
905891.type aio_read, %function;
906892aio_read:
907.weak aio_read64
908.type aio_read64, %function;
909aio_read64:
910893.globl aio_return
911894.type aio_return, %function;
912895aio_return:
913.weak aio_return64
914.type aio_return64, %function;
915aio_return64:
916896.globl aio_suspend
917897.type aio_suspend, %function;
918898aio_suspend:
919.weak aio_suspend64
920.type aio_suspend64, %function;
921aio_suspend64:
922899.globl aio_write
923900.type aio_write, %function;
924901aio_write:
925.weak aio_write64
926.type aio_write64, %function;
927aio_write64:
928902.globl alarm
929903.type alarm, %function;
930904alarm:
......@@ -934,10 +908,7 @@ aligned_alloc:
934908.globl alphasort
935909.type alphasort, %function;
936910alphasort:
937.weak alphasort64
938.type alphasort64, %function;
939alphasort64:
940#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
911#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64)
941912.globl arch_prctl
942913.type arch_prctl, %function;
943914arch_prctl:
......@@ -1062,12 +1033,12 @@ cabsf:
10621033.globl cabsl
10631034.type cabsl, %function;
10641035cabsl:
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)
10661037.weak cachectl
10671038.type cachectl, %function;
10681039cachectl:
10691040#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)
10711042.weak cacheflush
10721043.type cacheflush, %function;
10731044cacheflush:
......@@ -1384,9 +1355,6 @@ creall:
13841355.globl creat
13851356.type creat, %function;
13861357creat:
1387.weak creat64
1388.type creat64, %function;
1389creat64:
13901358.globl crypt
13911359.type crypt, %function;
13921360crypt:
......@@ -1729,9 +1697,6 @@ faccessat:
17291697.globl fallocate
17301698.type fallocate, %function;
17311699fallocate:
1732.weak fallocate64
1733.type fallocate64, %function;
1734fallocate64:
17351700.globl fanotify_init
17361701.type fanotify_init, %function;
17371702fanotify_init:
......@@ -1858,9 +1823,6 @@ fgetln:
18581823.globl fgetpos
18591824.type fgetpos, %function;
18601825fgetpos:
1861.weak fgetpos64
1862.type fgetpos64, %function;
1863fgetpos64:
18641826.globl fgetpwent
18651827.type fgetpwent, %function;
18661828fgetpwent:
......@@ -1966,9 +1928,6 @@ fnmatch:
19661928.globl fopen
19671929.type fopen, %function;
19681930fopen:
1969.weak fopen64
1970.type fopen64, %function;
1971fopen64:
19721931.globl fopencookie
19731932.type fopencookie, %function;
19741933fopencookie:
......@@ -2035,9 +1994,6 @@ fremovexattr:
20351994.globl freopen
20361995.type freopen, %function;
20371996freopen:
2038.weak freopen64
2039.type freopen64, %function;
2040freopen64:
20411997.globl frexp
20421998.type frexp, %function;
20431999frexp:
......@@ -2056,42 +2012,24 @@ fseek:
20562012.weak fseeko
20572013.type fseeko, %function;
20582014fseeko:
2059.weak fseeko64
2060.type fseeko64, %function;
2061fseeko64:
20622015.globl fsetpos
20632016.type fsetpos, %function;
20642017fsetpos:
2065.weak fsetpos64
2066.type fsetpos64, %function;
2067fsetpos64:
20682018.globl fsetxattr
20692019.type fsetxattr, %function;
20702020fsetxattr:
2071.globl fstat
2021WEAK64 fstat
20722022.type fstat, %function;
20732023fstat:
2074.weak fstat64
2075.type fstat64, %function;
2076fstat64:
2077.globl fstatat
2024WEAK64 fstatat
20782025.type fstatat, %function;
20792026fstatat:
2080.weak fstatat64
2081.type fstatat64, %function;
2082fstatat64:
20832027.weak fstatfs
20842028.type fstatfs, %function;
20852029fstatfs:
2086.weak fstatfs64
2087.type fstatfs64, %function;
2088fstatfs64:
20892030.globl fstatvfs
20902031.type fstatvfs, %function;
20912032fstatvfs:
2092.weak fstatvfs64
2093.type fstatvfs64, %function;
2094fstatvfs64:
20952033.globl fsync
20962034.type fsync, %function;
20972035fsync:
......@@ -2101,9 +2039,6 @@ ftell:
21012039.weak ftello
21022040.type ftello, %function;
21032041ftello:
2104.weak ftello64
2105.type ftello64, %function;
2106ftello64:
21072042.globl ftime
21082043.type ftime, %function;
21092044ftime:
......@@ -2113,18 +2048,12 @@ ftok:
21132048.globl ftruncate
21142049.type ftruncate, %function;
21152050ftruncate:
2116.weak ftruncate64
2117.type ftruncate64, %function;
2118ftruncate64:
21192051.globl ftrylockfile
21202052.type ftrylockfile, %function;
21212053ftrylockfile:
21222054.globl ftw
21232055.type ftw, %function;
21242056ftw:
2125.weak ftw64
2126.type ftw64, %function;
2127ftw64:
21282057.globl funlockfile
21292058.type funlockfile, %function;
21302059funlockfile:
......@@ -2203,9 +2132,6 @@ getdelim:
22032132.globl getdents
22042133.type getdents, %function;
22052134getdents:
2206.weak getdents64
2207.type getdents64, %function;
2208getdents64:
22092135.globl getdomainname
22102136.type getdomainname, %function;
22112137getdomainname:
......@@ -2380,9 +2306,6 @@ getresuid:
23802306.globl getrlimit
23812307.type getrlimit, %function;
23822308getrlimit:
2383.weak getrlimit64
2384.type getrlimit64, %function;
2385getrlimit64:
23862309.globl getrusage
23872310.type getrusage, %function;
23882311getrusage:
......@@ -2479,15 +2402,9 @@ getxattr:
24792402.globl glob
24802403.type glob, %function;
24812404glob:
2482.weak glob64
2483.type glob64, %function;
2484glob64:
24852405.globl globfree
24862406.type globfree, %function;
24872407globfree:
2488.weak globfree64
2489.type globfree64, %function;
2490globfree64:
24912408.globl gmtime
24922409.type gmtime, %function;
24932410gmtime:
......@@ -2632,12 +2549,12 @@ insque:
26322549.globl ioctl
26332550.type ioctl, %function;
26342551ioctl:
2635#if !defined(ARCH_riscv64) && !defined(ARCH_aarch64)
2552#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)
26362553.globl ioperm
26372554.type ioperm, %function;
26382555ioperm:
26392556#endif
2640#if !defined(ARCH_riscv64) && !defined(ARCH_aarch64)
2557#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64)
26412558.globl iopl
26422559.type iopl, %function;
26432560iopl:
......@@ -2897,9 +2814,6 @@ linkat:
28972814.globl lio_listio
28982815.type lio_listio, %function;
28992816lio_listio:
2900.weak lio_listio64
2901.type lio_listio64, %function;
2902lio_listio64:
29032817.globl listen
29042818.type listen, %function;
29052819listen:
......@@ -2945,9 +2859,6 @@ localtime_r:
29452859.globl lockf
29462860.type lockf, %function;
29472861lockf:
2948.weak lockf64
2949.type lockf64, %function;
2950lockf64:
29512862.globl log
29522863.type log, %function;
29532864log:
......@@ -3029,18 +2940,12 @@ lsearch:
30292940.weak lseek
30302941.type lseek, %function;
30312942lseek:
3032.weak lseek64
3033.type lseek64, %function;
3034lseek64:
30352943.globl lsetxattr
30362944.type lsetxattr, %function;
30372945lsetxattr:
30382946.globl lstat
30392947.type lstat, %function;
30402948lstat:
3041.weak lstat64
3042.type lstat64, %function;
3043lstat64:
30442949.globl lutimes
30452950.type lutimes, %function;
30462951lutimes:
......@@ -3146,27 +3051,15 @@ mknodat:
31463051.globl mkostemp
31473052.type mkostemp, %function;
31483053mkostemp:
3149.weak mkostemp64
3150.type mkostemp64, %function;
3151mkostemp64:
31523054.weak mkostemps
31533055.type mkostemps, %function;
31543056mkostemps:
3155.weak mkostemps64
3156.type mkostemps64, %function;
3157mkostemps64:
31583057.globl mkstemp
31593058.type mkstemp, %function;
31603059mkstemp:
3161.weak mkstemp64
3162.type mkstemp64, %function;
3163mkstemp64:
31643060.globl mkstemps
31653061.type mkstemps, %function;
31663062mkstemps:
3167.weak mkstemps64
3168.type mkstemps64, %function;
3169mkstemps64:
31703063.globl mktemp
31713064.type mktemp, %function;
31723065mktemp:
......@@ -3185,9 +3078,6 @@ mlockall:
31853078.weak mmap
31863079.type mmap, %function;
31873080mmap:
3188.weak mmap64
3189.type mmap64, %function;
3190mmap64:
31913081.globl modf
31923082.type modf, %function;
31933083modf:
......@@ -3329,9 +3219,6 @@ nexttowardl:
33293219.globl nftw
33303220.type nftw, %function;
33313221nftw:
3332.weak nftw64
3333.type nftw64, %function;
3334nftw64:
33353222.globl ngettext
33363223.type ngettext, %function;
33373224ngettext:
......@@ -3380,9 +3267,6 @@ ntohs:
33803267.globl open
33813268.type open, %function;
33823269open:
3383.weak open64
3384.type open64, %function;
3385open64:
33863270.globl open_by_handle_at
33873271.type open_by_handle_at, %function;
33883272open_by_handle_at:
......@@ -3395,9 +3279,6 @@ open_wmemstream:
33953279.globl openat
33963280.type openat, %function;
33973281openat:
3398.weak openat64
3399.type openat64, %function;
3400openat64:
34013282.globl opendir
34023283.type opendir, %function;
34033284opendir:
......@@ -3443,15 +3324,9 @@ posix_close:
34433324.globl posix_fadvise
34443325.type posix_fadvise, %function;
34453326posix_fadvise:
3446.weak posix_fadvise64
3447.type posix_fadvise64, %function;
3448posix_fadvise64:
34493327.globl posix_fallocate
34503328.type posix_fallocate, %function;
34513329posix_fallocate:
3452.weak posix_fallocate64
3453.type posix_fallocate64, %function;
3454posix_fallocate64:
34553330.globl posix_madvise
34563331.type posix_madvise, %function;
34573332posix_madvise:
......@@ -3557,24 +3432,15 @@ prctl:
35573432.globl pread
35583433.type pread, %function;
35593434pread:
3560.weak pread64
3561.type pread64, %function;
3562pread64:
35633435.globl preadv
35643436.type preadv, %function;
35653437preadv:
3566.weak preadv64
3567.type preadv64, %function;
3568preadv64:
35693438.globl printf
35703439.type printf, %function;
35713440printf:
35723441.globl prlimit
35733442.type prlimit, %function;
35743443prlimit:
3575.weak prlimit64
3576.type prlimit64, %function;
3577prlimit64:
35783444.globl process_vm_readv
35793445.type process_vm_readv, %function;
35803446process_vm_readv:
......@@ -3971,15 +3837,9 @@ putwchar_unlocked:
39713837.globl pwrite
39723838.type pwrite, %function;
39733839pwrite:
3974.weak pwrite64
3975.type pwrite64, %function;
3976pwrite64:
39773840.globl pwritev
39783841.type pwritev, %function;
39793842pwritev:
3980.weak pwritev64
3981.type pwritev64, %function;
3982pwritev64:
39833843.globl qsort
39843844.type qsort, %function;
39853845qsort:
......@@ -4013,12 +3873,6 @@ readahead:
40133873.globl readdir
40143874.type readdir, %function;
40153875readdir:
4016.weak readdir64
4017.type readdir64, %function;
4018readdir64:
4019.weak readdir64_r
4020.type readdir64_r, %function;
4021readdir64_r:
40223876.globl readdir_r
40233877.type readdir_r, %function;
40243878readdir_r:
......@@ -4139,7 +3993,7 @@ rintf:
41393993.globl rintl
41403994.type rintl, %function;
41413995rintl:
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)
41433997.weak riscv_flush_icache
41443998.type riscv_flush_icache, %function;
41453999riscv_flush_icache:
......@@ -4186,9 +4040,6 @@ scalbnl:
41864040.globl scandir
41874041.type scandir, %function;
41884042scandir:
4189.weak scandir64
4190.type scandir64, %function;
4191scandir64:
41924043.globl scanf
41934044.type scanf, %function;
41944045scanf:
......@@ -4285,9 +4136,6 @@ send:
42854136.globl sendfile
42864137.type sendfile, %function;
42874138sendfile:
4288.weak sendfile64
4289.type sendfile64, %function;
4290sendfile64:
42914139.globl sendmmsg
42924140.type sendmmsg, %function;
42934141sendmmsg:
......@@ -4393,9 +4241,6 @@ setreuid:
43934241.globl setrlimit
43944242.type setrlimit, %function;
43954243setrlimit:
4396.weak setrlimit64
4397.type setrlimit64, %function;
4398setrlimit64:
43994244.globl setservent
44004245.type setservent, %function;
44014246setservent:
......@@ -4612,21 +4457,12 @@ sscanf:
46124457.globl stat
46134458.type stat, %function;
46144459stat:
4615.weak stat64
4616.type stat64, %function;
4617stat64:
46184460.weak statfs
46194461.type statfs, %function;
46204462statfs:
4621.weak statfs64
4622.type statfs64, %function;
4623statfs64:
46244463.globl statvfs
46254464.type statvfs, %function;
46264465statvfs:
4627.weak statvfs64
4628.type statvfs64, %function;
4629statvfs64:
46304466.globl stime
46314467.type stime, %function;
46324468stime:
......@@ -4984,9 +4820,6 @@ timespec_get:
49844820.globl tmpfile
49854821.type tmpfile, %function;
49864822tmpfile:
4987.weak tmpfile64
4988.type tmpfile64, %function;
4989tmpfile64:
49904823.globl tmpnam
49914824.type tmpnam, %function;
49924825tmpnam:
......@@ -5029,9 +4862,6 @@ trunc:
50294862.globl truncate
50304863.type truncate, %function;
50314864truncate:
5032.weak truncate64
5033.type truncate64, %function;
5034truncate64:
50354865.globl truncf
50364866.type truncf, %function;
50374867truncf:
......@@ -5152,9 +4982,6 @@ verrx:
51524982.globl versionsort
51534983.type versionsort, %function;
51544984versionsort:
5155.weak versionsort64
5156.type versionsort64, %function;
5157versionsort64:
51584985.globl vfork
51594986.type vfork, %function;
51604987vfork:
lib/libc/musl/src/aio/aio.c+23-9
......@@ -82,6 +82,8 @@ static size_t io_thread_stack_size;
8282
8383static struct aio_queue *__aio_get_queue(int fd, int need)
8484{
85 sigset_t allmask, origmask;
86 int masked = 0;
8587 if (fd < 0) {
8688 errno = EBADF;
8789 return 0;
......@@ -93,6 +95,9 @@ static struct aio_queue *__aio_get_queue(int fd, int need)
9395 if ((!map || !map[a] || !map[a][b] || !map[a][b][c] || !(q=map[a][b][c][d])) && need) {
9496 pthread_rwlock_unlock(&maplock);
9597 if (fcntl(fd, F_GETFD) < 0) return 0;
98 sigfillset(&allmask);
99 masked = 1;
100 pthread_sigmask(SIG_BLOCK, &allmask, &origmask);
96101 pthread_rwlock_wrlock(&maplock);
97102 if (!io_thread_stack_size) {
98103 unsigned long val = __getauxval(AT_MINSIGSTKSZ);
......@@ -119,6 +124,7 @@ static struct aio_queue *__aio_get_queue(int fd, int need)
119124 if (q) pthread_mutex_lock(&q->lock);
120125out:
121126 pthread_rwlock_unlock(&maplock);
127 if (masked) pthread_sigmask(SIG_SETMASK, &origmask, 0);
122128 return q;
123129}
124130
......@@ -401,18 +407,26 @@ void __aio_atfork(int who)
401407 if (who<0) {
402408 pthread_rwlock_rdlock(&maplock);
403409 return;
410 } else if (!who) {
411 pthread_rwlock_unlock(&maplock);
412 return;
404413 }
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++)
406424 if (map[a]) for (int b=0; b<256; b++)
407425 if (map[a][b]) for (int c=0; c<256; c++)
408426 if (map[a][b][c]) for (int d=0; d<256; d++)
409427 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);
411432}
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
99{
1010 int i, tid = 0, ret, expect = 0;
1111 struct timespec at;
12 volatile int dummy_fut, *pfut;
12 volatile int dummy_fut = 0, *pfut;
1313 int nzcnt = 0;
1414 const struct aiocb *cb = 0;
1515
......@@ -73,7 +73,3 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec
7373 }
7474 }
7575}
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
139139
140140 return 0;
141141}
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)
77 const char *s = "";
88 if (!name) {
99 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) {
1111 errno = EINVAL;
1212 return 0;
1313 }
lib/libc/musl/src/conf/sysconf.c+13
......@@ -4,6 +4,7 @@
44#include <sys/resource.h>
55#include <signal.h>
66#include <sys/sysinfo.h>
7#include <sys/auxv.h>
78#include "syscall.h"
89#include "libc.h"
910
......@@ -19,6 +20,8 @@
1920#define JT_AVPHYS_PAGES JT(9)
2021#define JT_ZERO JT(10)
2122#define JT_DELAYTIMER_MAX JT(11)
23#define JT_MINSIGSTKSZ JT(12)
24#define JT_SIGSTKSZ JT(13)
2225
2326#define RLIM(x) (-32768|(RLIMIT_ ## x))
2427
......@@ -165,6 +168,9 @@ long sysconf(int name)
165168 [_SC_XOPEN_STREAMS] = JT_ZERO,
166169 [_SC_THREAD_ROBUST_PRIO_INHERIT] = -1,
167170 [_SC_THREAD_ROBUST_PRIO_PROTECT] = -1,
171
172 [_SC_MINSIGSTKSZ] = JT_MINSIGSTKSZ,
173 [_SC_SIGSTKSZ] = JT_SIGSTKSZ,
168174 };
169175
170176 if (name >= sizeof(values)/sizeof(values[0]) || !values[name]) {
......@@ -212,6 +218,13 @@ long sysconf(int name)
212218 mem *= si.mem_unit;
213219 mem /= PAGE_SIZE;
214220 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;
215228 case JT_ZERO & 255:
216229 return 0;
217230 }
lib/libc/musl/src/dirent/alphasort.c-2
......@@ -5,5 +5,3 @@ int alphasort(const struct dirent **a, const struct dirent **b)
55{
66 return strcoll((*a)->d_name, (*b)->d_name);
77}
8
9weak_alias(alphasort, alphasort64);
lib/libc/musl/src/dirent/readdir.c-2
......@@ -25,5 +25,3 @@ struct dirent *readdir(DIR *dir)
2525 dir->tell = de->d_off;
2626 return de;
2727}
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
2525 *result = buf;
2626 return 0;
2727}
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,
4343 *res = names;
4444 return cnt;
4545}
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)
66{
77 return strverscmp((*a)->d_name, (*b)->d_name);
88}
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)
44{
55 return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode);
66}
7
8weak_alias(creat, creat64);
lib/libc/musl/src/fcntl/open.c-2
......@@ -19,5 +19,3 @@ int open(const char *filename, int flags, ...)
1919
2020 return __syscall_ret(fd);
2121}
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, ...)
1515
1616 return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode);
1717}
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)
1414 __SYSCALL_LL_E(len), advice);
1515#endif
1616}
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)
66 return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base),
77 __SYSCALL_LL_E(len));
88}
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 {
9292#define DT_DEBUG_INDIRECT 0
9393#endif
9494
95#ifndef DT_DEBUG_INDIRECT_REL
96#define DT_DEBUG_INDIRECT_REL 0
97#endif
98
9599#define AUX_CNT 32
96#define DYN_CNT 32
100#define DYN_CNT 37
97101
98102typedef void (*stage2_func)(unsigned char *, size_t *);
99103
lib/libc/musl/src/internal/fork_impl.h+1-1
......@@ -2,7 +2,6 @@
22
33extern hidden volatile int *const __at_quick_exit_lockptr;
44extern hidden volatile int *const __atexit_lockptr;
5extern hidden volatile int *const __dlerror_lockptr;
65extern hidden volatile int *const __gettext_lockptr;
76extern hidden volatile int *const __locale_lockptr;
87extern hidden volatile int *const __random_lockptr;
......@@ -17,3 +16,4 @@ extern hidden volatile int *const __vmlock_lockptr;
1716
1817hidden void __malloc_atfork(int);
1918hidden void __ldso_atfork(int);
19hidden void __pthread_key_atfork(int);
lib/libc/musl/src/internal/ksigaction.h+5
......@@ -6,8 +6,13 @@
66struct k_sigaction {
77 void (*handler)(int);
88 unsigned long flags;
9#ifdef SA_RESTORER
910 void (*restorer)(void);
11#endif
1012 unsigned mask[2];
13#ifndef SA_RESTORER
14 void *unused;
15#endif
1116};
1217
1318hidden void __restore(), __restore_rt();
lib/libc/musl/src/internal/syscall.h+13-13
......@@ -58,7 +58,7 @@ hidden long __syscall_ret(unsigned long),
5858#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__)
5959#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)
6262{
6363 long r;
6464 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
7171 return r;
7272}
7373#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))
7575#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
7878/* 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
201201#define SYS_sendfile SYS_sendfile64
202202#endif
203203
204#ifndef SYS_timer_settime
204#ifdef SYS_timer_settime32
205205#define SYS_timer_settime SYS_timer_settime32
206206#endif
207207
208#ifndef SYS_timer_gettime
208#ifdef SYS_timer_gettime32
209209#define SYS_timer_gettime SYS_timer_gettime32
210210#endif
211211
212#ifndef SYS_timerfd_settime
212#ifdef SYS_timerfd_settime32
213213#define SYS_timerfd_settime SYS_timerfd_settime32
214214#endif
215215
216#ifndef SYS_timerfd_gettime
216#ifdef SYS_timerfd_gettime32
217217#define SYS_timerfd_gettime SYS_timerfd_gettime32
218218#endif
219219
220#ifndef SYS_clock_settime
220#ifdef SYS_clock_settime32
221221#define SYS_clock_settime SYS_clock_settime32
222222#endif
223223
224#ifndef SYS_clock_gettime
224#ifdef SYS_clock_gettime32
225225#define SYS_clock_gettime SYS_clock_gettime32
226226#endif
227227
228#ifndef SYS_clock_getres
228#ifdef SYS_clock_getres_time32
229229#define SYS_clock_getres SYS_clock_getres_time32
230230#endif
231231
232#ifndef SYS_clock_nanosleep
232#ifdef SYS_clock_nanosleep_time32
233233#define SYS_clock_nanosleep SYS_clock_nanosleep_time32
234234#endif
235235
236#ifndef SYS_gettimeofday
236#ifdef SYS_gettimeofday_time32
237237#define SYS_gettimeofday SYS_gettimeofday_time32
238238#endif
239239
240#ifndef SYS_settimeofday
240#ifdef SYS_settimeofday_time32
241241#define SYS_settimeofday SYS_settimeofday_time32
242242#endif
243243
lib/libc/musl/src/internal/version.h+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 @@
77#define IS32BIT(x) !((x)+0x80000000ULL>>32)
88#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
1112#define NO_TIME32 1
1213#else
1314#define NO_TIME32 0
lib/libc/musl/src/ldso/dlerror.c+18-16
......@@ -3,8 +3,7 @@
33#include <stdarg.h>
44#include "pthread_impl.h"
55#include "dynlink.h"
6#include "lock.h"
7#include "fork_impl.h"
6#include "atomic.h"
87
98#define malloc __libc_malloc
109#define calloc __libc_calloc
......@@ -23,28 +22,31 @@ char *dlerror()
2322 return s;
2423}
2524
26static volatile int freebuf_queue_lock[1];
27static void **freebuf_queue;
28volatile int *const __dlerror_lockptr = freebuf_queue_lock;
25/* Atomic singly-linked list, used to store list of thread-local dlerror
26 * buffers for deferred free. They cannot be freed at thread exit time
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
3033void __dl_thread_cleanup(void)
3134{
3235 pthread_t self = __pthread_self();
33 if (self->dlerror_buf && self->dlerror_buf != (void *)-1) {
34 LOCK(freebuf_queue_lock);
35 void **p = (void **)self->dlerror_buf;
36 *p = freebuf_queue;
37 freebuf_queue = p;
38 UNLOCK(freebuf_queue_lock);
39 }
36 if (!self->dlerror_buf || self->dlerror_buf == (void *)-1)
37 return;
38 void *h;
39 do {
40 h = freebuf_queue;
41 *(void **)self->dlerror_buf = h;
42 } while (a_cas_p(&freebuf_queue, h, self->dlerror_buf) != h);
4043}
4144
4245hidden void __dl_vseterr(const char *fmt, va_list ap)
4346{
44 LOCK(freebuf_queue_lock);
45 void **q = freebuf_queue;
46 freebuf_queue = 0;
47 UNLOCK(freebuf_queue_lock);
47 void **q;
48 do q = freebuf_queue;
49 while (q && a_cas_p(&freebuf_queue, q, 0) != q);
4850
4951 while (q) {
5052 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
77 * actually undefined, but works on all real-world machines. */
88 return nftw(path, (int (*)())fn, fd_limit, FTW_PHYS);
99}
10
11weak_alias(ftw, ftw64);
lib/libc/musl/src/linux/epoll.c+1
......@@ -5,6 +5,7 @@
55
66int epoll_create(int size)
77{
8 if (size<=0) return __syscall_ret(-EINVAL);
89 return epoll_create1(0);
910}
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)
77 return syscall(SYS_fallocate, fd, mode, __SYSCALL_LL_E(base),
88 __SYSCALL_LL_E(len));
99}
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)
88 if (len>INT_MAX) len = INT_MAX;
99 return syscall(SYS_getdents, fd, buf, len);
1010}
11
12weak_alias(getdents, getdents64);
lib/libc/musl/src/linux/membarrier.c+1-1
......@@ -35,7 +35,7 @@ int __membarrier(int cmd, int flags)
3535 __tl_lock();
3636 sem_init(&barrier_sem, 0, 0);
3737 struct sigaction sa = {
38 .sa_flags = SA_RESTART,
38 .sa_flags = SA_RESTART | SA_ONSTACK,
3939 .sa_handler = bcast_barrier
4040 };
4141 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
2121 }
2222 return r;
2323}
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)
55{
66 return syscall(SYS_sendfile, out_fd, in_fd, ofs, count);
77}
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)
1212 if (ru) {
1313 long long kru64[18];
1414 r = __syscall(SYS_wait4_time64, pid, status, options, kru64);
15 if (!r) {
15 if (r > 0) {
1616 ru->ru_utime = (struct timeval)
1717 { .tv_sec = kru64[0], .tv_usec = kru64[1] };
1818 ru->ru_stime = (struct timeval)
lib/libc/musl/src/malloc/mallocng/free.c+1-1
......@@ -119,7 +119,7 @@ void free(void *p)
119119 if (((uintptr_t)(start-1) ^ (uintptr_t)end) >= 2*PGSZ && g->last_idx) {
120120 unsigned char *base = start + (-(uintptr_t)start & (PGSZ-1));
121121 size_t len = (end-base) & -PGSZ;
122 if (len) {
122 if (len && USE_MADV_FREE) {
123123 int e = errno;
124124 madvise(base, len, MADV_FREE);
125125 errno = e;
lib/libc/musl/src/malloc/mallocng/glue.h+2
......@@ -24,6 +24,8 @@
2424#define realloc __libc_realloc
2525#define free __libc_free
2626
27#define USE_MADV_FREE 0
28
2729#if USE_REAL_ASSERT
2830#include <assert.h>
2931#else
lib/libc/musl/src/math/logf.c+1-1
......@@ -53,7 +53,7 @@ float logf(float x)
5353 tmp = ix - OFF;
5454 i = (tmp >> (23 - LOGF_TABLE_BITS)) % N;
5555 k = (int32_t)tmp >> 23; /* arithmetic shift */
56 iz = ix - (tmp & 0x1ff << 23);
56 iz = ix - (tmp & 0xff800000);
5757 invc = T[i].invc;
5858 logc = T[i].logc;
5959 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)
8787 if (optstring[i] == ':') {
8888 optarg = 0;
8989 if (optstring[i+1] != ':' || optpos) {
90 optarg = argv[optind++] + optpos;
90 optarg = argv[optind++];
91 if (optpos) optarg += optpos;
9192 optpos = 0;
9293 }
9394 if (optind > argc) {
lib/libc/musl/src/misc/getrlimit.c+5-3
......@@ -6,12 +6,13 @@
66
77int getrlimit(int resource, struct rlimit *rlim)
88{
9 unsigned long k_rlim[2];
109 int ret = syscall(SYS_prlimit64, 0, resource, 0, rlim);
1110 if (!ret) {
1211 FIX(rlim->rlim_cur);
1312 FIX(rlim->rlim_max);
1413 }
14#ifdef SYS_getrlimit
15 unsigned long k_rlim[2];
1516 if (!ret || errno != ENOSYS)
1617 return ret;
1718 if (syscall(SYS_getrlimit, resource, k_rlim) < 0)
......@@ -21,6 +22,7 @@ int getrlimit(int resource, struct rlimit *rlim)
2122 FIX(rlim->rlim_cur);
2223 FIX(rlim->rlim_max);
2324 return 0;
25#else
26 return ret;
27#endif
2428}
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)
2828 errno = EINVAL;
2929 return -1;
3030}
31
32weak_alias(lockf, lockf64);
lib/libc/musl/src/misc/mntent.c+9-3
......@@ -2,6 +2,7 @@
22#include <string.h>
33#include <mntent.h>
44#include <errno.h>
5#include <limits.h>
56
67static char *internal_buf;
78static size_t internal_bufsize;
......@@ -21,7 +22,8 @@ int endmntent(FILE *f)
2122
2223struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen)
2324{
24 int cnt, n[8], use_internal = (linebuf == SENTINEL);
25 int n[8], use_internal = (linebuf == SENTINEL);
26 size_t len, i;
2527
2628 mnt->mnt_freq = 0;
2729 mnt->mnt_passno = 0;
......@@ -39,10 +41,14 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle
3941 errno = ERANGE;
4042 return 0;
4143 }
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",
4349 n, n+1, n+2, n+3, n+4, n+5, n+6, n+7,
4450 &mnt->mnt_freq, &mnt->mnt_passno);
45 } while (cnt < 2 || linebuf[n[0]] == '#');
51 } while (linebuf[n[0]] == '#' || n[1]==len);
4652
4753 linebuf[n[1]] = 0;
4854 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,
3131 int err;
3232 struct FTW lev;
3333
34 st.st_dev = st.st_ino = 0;
35
3436 if ((flags & FTW_PHYS) ? lstat(path, &st) : stat(path, &st) < 0) {
3537 if (!(flags & FTW_PHYS) && errno==ENOENT && !lstat(path, &st))
3638 type = FTW_SLN;
......@@ -46,7 +48,7 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,
4648 type = FTW_F;
4749 }
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)
5052 return 0;
5153
5254 new.chain = h;
......@@ -138,5 +140,3 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str
138140 pthread_setcancelstate(cs, 0);
139141 return r;
140142}
141
142weak_alias(nftw, nftw64);
lib/libc/musl/src/misc/setrlimit.c+6-2
......@@ -12,12 +12,14 @@ struct ctx {
1212 int err;
1313};
1414
15#ifdef SYS_setrlimit
1516static void do_setrlimit(void *p)
1617{
1718 struct ctx *c = p;
1819 if (c->err>0) return;
1920 c->err = -__syscall(SYS_setrlimit, c->res, c->lim);
2021}
22#endif
2123
2224int setrlimit(int resource, const struct rlimit *rlim)
2325{
......@@ -29,6 +31,7 @@ int setrlimit(int resource, const struct rlimit *rlim)
2931 rlim = &tmp;
3032 }
3133 int ret = __syscall(SYS_prlimit64, 0, resource, rlim, 0);
34#ifdef SYS_setrlimit
3235 if (ret != -ENOSYS) return __syscall_ret(ret);
3336
3437 struct ctx c = {
......@@ -42,6 +45,7 @@ int setrlimit(int resource, const struct rlimit *rlim)
4245 return -1;
4346 }
4447 return 0;
48#else
49 return __syscall_ret(ret);
50#endif
4551}
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)
3737}
3838
3939weak_alias(__mmap, mmap);
40
41weak_alias(mmap, mmap64);
lib/libc/musl/src/mq/mq_notify.c+33-14
......@@ -4,11 +4,14 @@
44#include <sys/socket.h>
55#include <signal.h>
66#include <unistd.h>
7#include <semaphore.h>
78#include "syscall.h"
89
910struct args {
10 pthread_barrier_t barrier;
11 sem_t sem;
1112 int sock;
13 mqd_t mqd;
14 int err;
1215 const struct sigevent *sev;
1316};
1417
......@@ -20,8 +23,19 @@ static void *start(void *p)
2023 int s = args->sock;
2124 void (*func)(union sigval) = args->sev->sigev_notify_function;
2225 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());
2539 n = recv(s, buf, sizeof(buf), MSG_NOSIGNAL|MSG_WAITALL);
2640 close(s);
2741 if (n==sizeof buf && buf[sizeof buf - 1] == 1)
......@@ -35,8 +49,8 @@ int mq_notify(mqd_t mqd, const struct sigevent *sev)
3549 pthread_attr_t attr;
3650 pthread_t td;
3751 int s;
38 struct sigevent sev2;
39 static const char zeros[32];
52 int cs;
53 sigset_t allmask, origmask;
4054
4155 if (!sev || sev->sigev_notify != SIGEV_THREAD)
4256 return syscall(SYS_mq_notify, mqd, sev);
......@@ -44,30 +58,35 @@ int mq_notify(mqd_t mqd, const struct sigevent *sev)
4458 s = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, 0);
4559 if (s < 0) return -1;
4660 args.sock = s;
61 args.mqd = mqd;
4762
4863 if (sev->sigev_notify_attributes) attr = *sev->sigev_notify_attributes;
4964 else pthread_attr_init(&attr);
50 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
51 pthread_barrier_init(&args.barrier, 0, 2);
65 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
66 sem_init(&args.sem, 0, 0);
5267
68 sigfillset(&allmask);
69 pthread_sigmask(SIG_BLOCK, &allmask, &origmask);
5370 if (pthread_create(&td, &attr, start, &args)) {
5471 __syscall(SYS_close, s);
72 pthread_sigmask(SIG_SETMASK, &origmask, 0);
5573 errno = EAGAIN;
5674 return -1;
5775 }
76 pthread_sigmask(SIG_SETMASK, &origmask, 0);
5877
59 pthread_barrier_wait(&args.barrier);
60 pthread_barrier_destroy(&args.barrier);
61
62 sev2.sigev_notify = SIGEV_THREAD;
63 sev2.sigev_signo = s;
64 sev2.sigev_value.sival_ptr = (void *)&zeros;
78 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
79 sem_wait(&args.sem);
80 sem_destroy(&args.sem);
6581
66 if (syscall(SYS_mq_notify, mqd, &sev2) < 0) {
67 pthread_cancel(td);
82 if (args.err) {
6883 __syscall(SYS_close, s);
84 pthread_join(td, 0);
85 pthread_setcancelstate(cs, 0);
86 errno = args.err;
6987 return -1;
7088 }
7189
90 pthread_setcancelstate(cs, 0);
7291 return 0;
7392}
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
99 if (!flg) return accept(fd, addr, len);
1010 int ret = socketcall_cp(accept4, fd, addr, len, flg, 0, 0);
1111 if (ret>=0 || (errno != ENOSYS && errno != EINVAL)) return ret;
12 if (flg & ~(SOCK_CLOEXEC|SOCK_NONBLOCK)) {
13 errno = EINVAL;
14 return -1;
15 }
1216 ret = accept(fd, addr, len);
1317 if (ret<0) return ret;
1418 if (flg & SOCK_CLOEXEC)
lib/libc/musl/src/network/dns_parse.c+5-5
......@@ -1,7 +1,7 @@
11#include <string.h>
22#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)
55{
66 int qdcount, ancount;
77 const unsigned char *p;
......@@ -15,18 +15,18 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c
1515 if (qdcount+ancount > 64) return -1;
1616 while (qdcount--) {
1717 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))
1919 return -1;
2020 p += 5 + !!*p;
2121 }
2222 while (ancount--) {
2323 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))
2525 return -1;
2626 p += 1 + !!*p;
2727 len = p[8]*256 + p[9];
28 if (p+len > r+rlen) return -1;
29 if (callback(ctx, p[1], p+10, len, r) < 0) return -1;
28 if (len+10 > r+rlen-p) return -1;
29 if (callback(ctx, p[1], p+10, len, r, rlen) < 0) return -1;
3030 p += 10 + len;
3131 }
3232 return 0;
lib/libc/musl/src/network/gai_strerror.c+1-1
......@@ -6,7 +6,7 @@ static const char msgs[] =
66 "Name does not resolve\0"
77 "Try again\0"
88 "Non-recoverable error\0"
9 "Unknown error\0"
9 "Name has no usable address\0"
1010 "Unrecognized address family or invalid length\0"
1111 "Unrecognized socket type\0"
1212 "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
1616 char canon[256], *outcanon;
1717 int nservs, naddrs, nais, canon_len, i, j, k;
1818 int family = AF_UNSPEC, flags = 0, proto = 0, socktype = 0;
19 int no_family = 0;
1920 struct aibuf *out;
2021
2122 if (!host && !serv) return EAI_NONAME;
......@@ -66,9 +67,11 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
6667 pthread_setcancelstate(
6768 PTHREAD_CANCEL_DISABLE, &cs);
6869 int r = connect(s, ta[i], tl[i]);
70 int saved_errno = errno;
6971 pthread_setcancelstate(cs, 0);
7072 close(s);
7173 if (!r) continue;
74 errno = saved_errno;
7275 }
7376 switch (errno) {
7477 case EADDRNOTAVAIL:
......@@ -80,7 +83,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
8083 default:
8184 return EAI_SYSTEM;
8285 }
83 if (family == tf[i]) return EAI_NONAME;
86 if (family == tf[i]) no_family = 1;
8487 family = tf[1-i];
8588 }
8689 }
......@@ -91,6 +94,8 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
9194 naddrs = __lookup_name(addrs, canon, host, family, flags);
9295 if (naddrs < 0) return naddrs;
9396
97 if (no_family) return EAI_NODATA;
98
9499 nais = nservs * naddrs;
95100 canon_len = strlen(canon);
96101 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)
2020 err = gethostbyaddr_r(a, l, af, h,
2121 (void *)(h+1), size-sizeof *h, &res, &h_errno);
2222 } while (err == ERANGE);
23 return err ? 0 : h;
23 return res;
2424}
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,
5454 case EAI_OVERFLOW:
5555 return ERANGE;
5656 default:
57 case EAI_MEMORY:
58 case EAI_SYSTEM:
5957 case EAI_FAIL:
58 *err = NO_RECOVERY;
59 return EBADMSG;
60 case EAI_SYSTEM:
6061 *err = NO_RECOVERY;
6162 return errno;
6263 case 0:
lib/libc/musl/src/network/gethostbyname2.c+1-1
......@@ -21,5 +21,5 @@ struct hostent *gethostbyname2(const char *name, int af)
2121 err = gethostbyname2_r(name, af, h,
2222 (void *)(h+1), size-sizeof *h, &res, &h_errno);
2323 } while (err == ERANGE);
24 return err ? 0 : h;
24 return res;
2525}
lib/libc/musl/src/network/gethostbyname2_r.c+4-2
......@@ -22,7 +22,10 @@ int gethostbyname2_r(const char *name, int af,
2222 if (cnt<0) switch (cnt) {
2323 case EAI_NONAME:
2424 *err = HOST_NOT_FOUND;
25 return ENOENT;
25 return 0;
26 case EAI_NODATA:
27 *err = NO_DATA;
28 return 0;
2629 case EAI_AGAIN:
2730 *err = TRY_AGAIN;
2831 return EAGAIN;
......@@ -30,7 +33,6 @@ int gethostbyname2_r(const char *name, int af,
3033 case EAI_FAIL:
3134 *err = NO_RECOVERY;
3235 return EBADMSG;
33 case EAI_MEMORY:
3436 case EAI_SYSTEM:
3537 *err = NO_RECOVERY;
3638 return errno;
lib/libc/musl/src/network/getifaddrs.c+7-7
......@@ -39,8 +39,8 @@ struct ifaddrs_storage {
3939};
4040
4141struct ifaddrs_ctx {
42 struct ifaddrs_storage *first;
43 struct ifaddrs_storage *last;
42 struct ifaddrs *first;
43 struct ifaddrs *last;
4444 struct ifaddrs_storage *hash[IFADDRS_HASH_SIZE];
4545};
4646
......@@ -195,9 +195,9 @@ static int netlink_msg_to_ifaddr(void *pctx, struct nlmsghdr *h)
195195 }
196196
197197 if (ifs->ifa.ifa_name) {
198 if (!ctx->first) ctx->first = ifs;
199 if (ctx->last) ctx->last->ifa.ifa_next = &ifs->ifa;
200 ctx->last = ifs;
198 if (!ctx->first) ctx->first = &ifs->ifa;
199 if (ctx->last) ctx->last->ifa_next = &ifs->ifa;
200 ctx->last = &ifs->ifa;
201201 } else {
202202 free(ifs);
203203 }
......@@ -210,7 +210,7 @@ int getifaddrs(struct ifaddrs **ifap)
210210 int r;
211211 memset(ctx, 0, sizeof *ctx);
212212 r = __rtnetlink_enumerate(AF_UNSPEC, AF_UNSPEC, netlink_msg_to_ifaddr, ctx);
213 if (r == 0) *ifap = &ctx->first->ifa;
214 else freeifaddrs(&ctx->first->ifa);
213 if (r == 0) *ifap = ctx->first;
214 else freeifaddrs(ctx->first);
215215 return r;
216216}
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
5858 if ((p=strchr(line, '#'))) *p++='\n', *p=0;
5959
6060 for (p=line; *p && !isspace(*p); p++);
61 if (!*p) continue;
6162 *p++ = 0;
6263 if (__lookup_ipliteral(&iplit, line, AF_UNSPEC)<=0)
6364 continue;
......@@ -108,10 +109,10 @@ static void reverse_services(char *buf, int port, int dgram)
108109 __fclose_ca(f);
109110}
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)
112113{
113114 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,
115116 data, c, 256) <= 0)
116117 *(char *)c = 0;
117118 return 0;
lib/libc/musl/src/network/getservbyport_r.c+3-1
......@@ -26,7 +26,7 @@ int getservbyport_r(int port, const char *prots,
2626 /* Align buffer */
2727 i = (uintptr_t)buf & sizeof(char *)-1;
2828 if (!i) i = sizeof(char *);
29 if (buflen < 3*sizeof(char *)-i)
29 if (buflen <= 3*sizeof(char *)-i)
3030 return ERANGE;
3131 buf += sizeof(char *)-i;
3232 buflen -= sizeof(char *)-i;
......@@ -46,6 +46,8 @@ int getservbyport_r(int port, const char *prots,
4646 case EAI_MEMORY:
4747 case EAI_SYSTEM:
4848 return ENOMEM;
49 case EAI_OVERFLOW:
50 return ERANGE;
4951 default:
5052 return ENOENT;
5153 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)
5454 if (s[j]!='.' || (i<6 && brk<0)) return 0;
5555 need_v4=1;
5656 i++;
57 ip[i&7]=0;
5758 break;
5859 }
5960 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
5050hidden int __get_resolv_conf(struct resolvconf *, char *, size_t);
5151hidden 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
5555#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
1515 struct in6_addr a6;
1616 if (__inet_aton(name, &a4) > 0) {
1717 if (family == AF_INET6) /* wrong family */
18 return EAI_NONAME;
18 return EAI_NODATA;
1919 memcpy(&buf[0].addr, &a4, sizeof a4);
2020 buf[0].family = AF_INET;
2121 buf[0].scopeid = 0;
......@@ -34,7 +34,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
3434 if (inet_pton(AF_INET6, name, &a6) <= 0)
3535 return 0;
3636 if (family == AF_INET) /* wrong family */
37 return EAI_NONAME;
37 return EAI_NODATA;
3838
3939 memcpy(&buf[0].addr, &a6, sizeof a6);
4040 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
7979 case 0:
8080 continue;
8181 default:
82 badfam = EAI_NONAME;
82 badfam = EAI_NODATA;
8383 break;
8484 }
8585
......@@ -102,45 +102,50 @@ struct dpc_ctx {
102102 struct address *addrs;
103103 char *canon;
104104 int cnt;
105 int rrtype;
105106};
106107
107108#define RR_A 1
108109#define RR_CNAME 5
109110#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)
112115{
113116 char tmp[256];
117 int family;
114118 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;
116127 switch (rr) {
117128 case RR_A:
118129 if (len != 4) return -1;
119 ctx->addrs[ctx->cnt].family = AF_INET;
120 ctx->addrs[ctx->cnt].scopeid = 0;
121 memcpy(ctx->addrs[ctx->cnt++].addr, data, 4);
130 family = AF_INET;
122131 break;
123132 case RR_AAAA:
124133 if (len != 16) return -1;
125 ctx->addrs[ctx->cnt].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);
134 family = AF_INET6;
133135 break;
134136 }
137 ctx->addrs[ctx->cnt].family = family;
138 ctx->addrs[ctx->cnt].scopeid = 0;
139 memcpy(ctx->addrs[ctx->cnt++].addr, data, len);
135140 return 0;
136141}
137142
138143static int name_from_dns(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, const struct resolvconf *conf)
139144{
140 unsigned char qbuf[2][280], abuf[2][512];
145 unsigned char qbuf[2][280], abuf[2][ABUF_SIZE];
141146 const unsigned char *qp[2] = { qbuf[0], qbuf[1] };
142147 unsigned char *ap[2] = { abuf[0], abuf[1] };
143 int qlens[2], alens[2];
148 int qlens[2], alens[2], qtypes[2];
144149 int i, nq = 0;
145150 struct dpc_ctx ctx = { .addrs = buf, .canon = canon };
146151 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
153158 qlens[nq] = __res_mkquery(0, name, 1, afrr[i].rr,
154159 0, 0, 0, qbuf[nq], sizeof *qbuf);
155160 if (qlens[nq] == -1)
156 return EAI_NONAME;
161 return 0;
162 qtypes[nq] = afrr[i].rr;
157163 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]++;
158167 nq++;
159168 }
160169 }
......@@ -168,11 +177,14 @@ static int name_from_dns(struct address buf[static MAXADDRS], char canon[static
168177 if ((abuf[i][3] & 15) != 0) return EAI_FAIL;
169178 }
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];
172183 __dns_parse(abuf[i], alens[i], dns_parse_callback, &ctx);
184 }
173185
174186 if (ctx.cnt) return ctx.cnt;
175 return EAI_NONAME;
187 return EAI_NODATA;
176188}
177189
178190static 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 {
8686#define RTA_DATALEN(rta) ((rta)->rta_len-sizeof(struct rtattr))
8787#define RTA_DATAEND(rta) ((char*)(rta)+(rta)->rta_len)
8888#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
9191#define NLMSG_RTA(nlh,len) ((void*)((char*)(nlh)+sizeof(struct nlmsghdr)+NETLINK_ALIGN(len)))
9292#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,
1313 int n;
1414
1515 if (l && dname[l-1]=='.') l--;
16 if (l && dname[l-1]=='.') return -1;
1617 n = 17+l+!!l;
1718 if (l>253 || buflen<n || op>15u || class>255u || type>255u)
1819 return -1;
lib/libc/musl/src/network/res_msend.c+160-23
......@@ -1,5 +1,6 @@
11#include <sys/socket.h>
22#include <netinet/in.h>
3#include <netinet/tcp.h>
34#include <netdb.h>
45#include <arpa/inet.h>
56#include <stdint.h>
......@@ -16,17 +17,65 @@
1617
1718static void cleanup(void *p)
1819{
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);
2023}
2124
2225static unsigned long mtime()
2326{
2427 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);
2630 return (unsigned long)ts.tv_sec * 1000
2731 + ts.tv_nsec / 1000000;
2832}
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
3079int __res_msend_rc(int nqueries, const unsigned char *const *queries,
3180 const int *qlens, unsigned char *const *answers, int *alens, int asize,
3281 const struct resolvconf *conf)
......@@ -44,7 +93,10 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
4493 int next;
4594 int i, j;
4695 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;
48100 unsigned long t0, t1, t2;
49101
50102 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
......@@ -68,29 +120,22 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
68120 }
69121
70122 /* Get local address and open/bind a socket */
71 sa.sin.sin_family = family;
72123 fd = socket(family, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
73124
74125 /* Handle case where system lacks IPv6 support */
75126 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 }
76132 fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
77133 family = AF_INET;
134 sl = sizeof sa.sin;
78135 }
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
92137 /* Convert any IPv4 addresses in a mixed environment to v4-mapped */
93 if (family == AF_INET6) {
138 if (fd >= 0 && family == AF_INET6) {
94139 setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &(int){0}, sizeof 0);
95140 for (i=0; i<nns; i++) {
96141 if (ns[i].sin.sin_family != AF_INET) continue;
......@@ -104,16 +149,38 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
104149 }
105150 }
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
107171 memset(alens, 0, sizeof *alens * nqueries);
108172
109 pfd.fd = fd;
110 pfd.events = POLLIN;
111173 retry_interval = timeout / attempts;
112174 next = 0;
113175 t0 = t2 = mtime();
114176 t1 = t2 - retry_interval;
115177
116178 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
117184 if (t2-t1 >= retry_interval) {
118185 /* Query all configured namservers in parallel */
119186 for (i=0; i<nqueries; i++)
......@@ -127,10 +194,20 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
127194 }
128195
129196 /* 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,
133 (void *)&sa, (socklen_t[1]){sl})) >= 0) {
199 while (next < nqueries) {
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
135212 /* Ignore non-identifiable packets */
136213 if (rlen < 4) continue;
......@@ -170,12 +247,72 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
170247 else
171248 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;
174308 }
175309 }
176310out:
177311 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
179316 return 0;
180317}
181318
lib/libc/musl/src/network/res_send.c+9-1
......@@ -1,8 +1,16 @@
11#include <resolv.h>
2#include <string.h>
23
34int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen)
45{
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);
614 return r<0 || !anslen ? -1 : anslen;
715}
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)
88{
99#if LONG_MAX > INT_MAX
1010 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;
1215 if (msg) {
1316 h = *msg;
1417 h.__pad1 = h.__pad2 = 0;
1518 msg = &h;
1619 if (h.msg_controllen) {
17 if (h.msg_controllen > 1024) {
20 if (h.msg_controllen > sizeof chbuf) {
1821 errno = ENOMEM;
1922 return -1;
2023 }
lib/libc/musl/src/process/_Fork.c+1-2
......@@ -14,7 +14,6 @@ pid_t _Fork(void)
1414 pid_t ret;
1515 sigset_t set;
1616 __block_all_sigs(&set);
17 __aio_atfork(-1);
1817 LOCK(__abort_lock);
1918#ifdef SYS_fork
2019 ret = __syscall(SYS_fork);
......@@ -32,7 +31,7 @@ pid_t _Fork(void)
3231 if (libc.need_locks) libc.need_locks = -1;
3332 }
3433 UNLOCK(__abort_lock);
35 __aio_atfork(!ret);
34 if (!ret) __aio_atfork(1);
3635 __restore_sigs(&set);
3736 return __syscall_ret(ret);
3837}
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;
99
1010weak_alias(dummy_lockptr, __at_quick_exit_lockptr);
1111weak_alias(dummy_lockptr, __atexit_lockptr);
12weak_alias(dummy_lockptr, __dlerror_lockptr);
1312weak_alias(dummy_lockptr, __gettext_lockptr);
1413weak_alias(dummy_lockptr, __locale_lockptr);
1514weak_alias(dummy_lockptr, __random_lockptr);
......@@ -24,7 +23,6 @@ weak_alias(dummy_lockptr, __vmlock_lockptr);
2423static volatile int *const *const atfork_locks[] = {
2524 &__at_quick_exit_lockptr,
2625 &__atexit_lockptr,
27 &__dlerror_lockptr,
2826 &__gettext_lockptr,
2927 &__locale_lockptr,
3028 &__random_lockptr,
......@@ -38,6 +36,8 @@ static volatile int *const *const atfork_locks[] = {
3836static void dummy(int x) { }
3937weak_alias(dummy, __fork_handler);
4038weak_alias(dummy, __malloc_atfork);
39weak_alias(dummy, __aio_atfork);
40weak_alias(dummy, __pthread_key_atfork);
4141weak_alias(dummy, __ldso_atfork);
4242
4343static void dummy_0(void) { }
......@@ -52,6 +52,8 @@ pid_t fork(void)
5252 int need_locks = libc.need_locks > 0;
5353 if (need_locks) {
5454 __ldso_atfork(-1);
55 __pthread_key_atfork(-1);
56 __aio_atfork(-1);
5557 __inhibit_ptc();
5658 for (int i=0; i<sizeof atfork_locks/sizeof *atfork_locks; i++)
5759 if (*atfork_locks[i]) LOCK(*atfork_locks[i]);
......@@ -77,6 +79,8 @@ pid_t fork(void)
7779 if (ret) UNLOCK(*atfork_locks[i]);
7880 else **atfork_locks[i] = 0;
7981 __release_ptc();
82 if (ret) __aio_atfork(0);
83 __pthread_key_atfork(!ret);
8084 __ldso_atfork(!ret);
8185 }
8286 __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)
306306 g->gl_pathc = 0;
307307 g->gl_pathv = NULL;
308308}
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)
4141{
4242 size_t newsize;
4343 size_t i, j;
44 size_t oldsize = htab->__tab->mask + 1;
4445 ENTRY *e, *newe;
4546 ENTRY *oldtab = htab->__tab->entries;
46 ENTRY *oldend = htab->__tab->entries + htab->__tab->mask + 1;
4747
4848 if (nel > MAXSIZE)
4949 nel = MAXSIZE;
......@@ -56,7 +56,7 @@ static int resize(size_t nel, struct hsearch_data *htab)
5656 htab->__tab->mask = newsize - 1;
5757 if (!oldtab)
5858 return 1;
59 for (e = oldtab; e < oldend; e++)
59 for (e = oldtab; e < oldtab + oldsize; e++)
6060 if (e->key) {
6161 for (i=keyhash(e->key),j=1; ; i+=j++) {
6262 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)
88#ifdef SYS_poll
99 return syscall_cp(SYS_poll, fds, n, timeout);
1010#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
1116 return syscall_cp(SYS_ppoll, fds, n, timeout>=0 ?
12 &((struct timespec){ .tv_sec = timeout/1000,
13 .tv_nsec = timeout%1000*1000000 }) : 0, 0, _NSIG/8);
17 ((ppoll_ts_t){ timeout/1000, timeout%1000*1000000 }) : 0,
18 0, _NSIG/8);
1419#endif
1520}
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
3333 ((syscall_arg_t[]){ 0, _NSIG/8 }));
3434 if (SYS_pselect6 == SYS_pselect6_time64 || r!=-ENOSYS)
3535 return __syscall_ret(r);
36 s = CLAMP(s);
3637#endif
3738#ifdef SYS_select
3839 return syscall_cp(SYS_select, n, rfds, wfds, efds,
lib/libc/musl/src/setjmp/powerpc/longjmp.S+4-4
......@@ -42,10 +42,10 @@ longjmp:
4242 bl 1f
4343 .hidden __hwcap
4444 .long __hwcap-.
451: mflr 4
46 lwz 5, 0(4)
47 lwzx 4, 4, 5
48 andis. 4, 4, 0x80
451: mflr 6
46 lwz 5, 0(6)
47 lwzx 6, 6, 5
48 andis. 6, 6, 0x80
4949 beq 1f
5050 .long 0x11c35b01 /* evldd 14,88(3) */
5151 .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
4444 }
4545 }
4646 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;
4850 ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
51#endif
4952 memcpy(&ksa.mask, &sa->sa_mask, _NSIG/8);
5053 }
5154 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)
2222 return stat(path, buf);
2323}
2424
25weak_alias(__fxstat, __fxstat64);
26weak_alias(__fxstatat, __fxstatat64);
27weak_alias(__lxstat, __lxstat64);
28weak_alias(__xstat, __xstat64);
29
3025#endif
3126
3227int __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 @@
22#include <fcntl.h>
33#include <errno.h>
44#include "syscall.h"
5#include "kstat.h"
65
76int fchmodat(int fd, const char *path, mode_t mode, int flag)
87{
......@@ -11,12 +10,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)
1110 if (flag != AT_SYMLINK_NOFOLLOW)
1211 return __syscall_ret(-EINVAL);
1312
14 struct kstat st;
13 struct stat st;
1514 int ret, fd2;
1615 char proc[15+3*sizeof(int)];
1716
18 if ((ret = __syscall(SYS_fstatat, fd, path, &st, flag)))
19 return __syscall_ret(ret);
17 if (fstatat(fd, path, &st, flag))
18 return -1;
2019 if (S_ISLNK(st.st_mode))
2120 return __syscall_ret(-EOPNOTSUPP);
2221
......@@ -27,12 +26,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)
2726 }
2827
2928 __procfdname(proc, fd2);
30 ret = __syscall(SYS_fstatat, AT_FDCWD, proc, &st, 0);
29 ret = stat(proc, &st);
3130 if (!ret) {
32 if (S_ISLNK(st.st_mode)) ret = -EOPNOTSUPP;
33 else ret = __syscall(SYS_fchmodat, AT_FDCWD, proc, mode);
31 if (S_ISLNK(st.st_mode)) ret = __syscall_ret(-EOPNOTSUPP);
32 else ret = syscall(SYS_fchmodat, AT_FDCWD, proc, mode);
3433 }
3534
3635 __syscall(SYS_close, fd2);
37 return __syscall_ret(ret);
36 return ret;
3837}
lib/libc/musl/src/stat/fstat.c+3-5
......@@ -4,12 +4,10 @@
44#include <fcntl.h>
55#include "syscall.h"
66
7int fstat(int fd, struct stat *st)
7int __fstat(int fd, struct stat *st)
88{
99 if (fd<0) return __syscall_ret(-EBADF);
10 return fstatat(fd, "", st, AT_EMPTY_PATH);
10 return __fstatat(fd, "", st, AT_EMPTY_PATH);
1111}
1212
13#if !_REDIR_TIME64
14weak_alias(fstat, fstat64);
15#endif
13weak_alias(__fstat, fstat);
lib/libc/musl/src/stat/fstatat.c+11-5
......@@ -6,7 +6,6 @@
66#include <stdint.h>
77#include <sys/sysmacros.h>
88#include "syscall.h"
9#include "kstat.h"
109
1110struct statx {
1211 uint32_t stx_mask;
......@@ -69,6 +68,10 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric
6968 return 0;
7069}
7170
71#ifdef SYS_fstatat
72
73#include "kstat.h"
74
7275static int fstatat_kstat(int fd, const char *restrict path, struct stat *restrict st, int flag)
7376{
7477 int ret;
......@@ -130,18 +133,21 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric
130133
131134 return 0;
132135}
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)
135139{
136140 int ret;
141#ifdef SYS_fstatat
137142 if (sizeof((struct kstat){0}.st_atime_sec) < sizeof(time_t)) {
138143 ret = fstatat_statx(fd, path, st, flag);
139144 if (ret!=-ENOSYS) return __syscall_ret(ret);
140145 }
141146 ret = fstatat_kstat(fd, path, st, flag);
147#else
148 ret = fstatat_statx(fd, path, st, flag);
149#endif
142150 return __syscall_ret(ret);
143151}
144152
145#if !_REDIR_TIME64
146weak_alias(fstatat, fstatat64);
147#endif
153weak_alias(__fstatat, fstatat);
lib/libc/musl/src/stat/lstat.c-4
......@@ -5,7 +5,3 @@ int lstat(const char *restrict path, struct stat *restrict buf)
55{
66 return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW);
77}
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)
55{
66 return fstatat(AT_FDCWD, path, buf, 0);
77}
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)
5656 fixup(buf, &kbuf);
5757 return 0;
5858}
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)
77 *(long long *)pos = off;
88 return 0;
99}
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)
1212
1313 FLOCK(f);
1414
15 if (n--<=1) {
15 if (n<=1) {
1616 f->mode |= f->mode-1;
1717 FUNLOCK(f);
18 if (n) return 0;
18 if (n<1) return 0;
1919 *s = 0;
2020 return s;
2121 }
22 n--;
2223
2324 while (n) {
2425 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)
2929 __syscall(SYS_close, fd);
3030 return 0;
3131}
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
4040 fclose(f2);
4141 }
4242
43 f->mode = 0;
44 f->locale = 0;
4345 FUNLOCK(f);
4446 return f;
4547
......@@ -49,5 +51,3 @@ fail:
4951 fclose(f);
5052 return NULL;
5153}
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)
4646}
4747
4848weak_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)
44{
55 return __fseeko(f, *(const long long *)pos, SEEK_SET);
66}
7
8weak_alias(fsetpos, fsetpos64);
lib/libc/musl/src/stdio/ftell.c-2
......@@ -37,5 +37,3 @@ long ftell(FILE *f)
3737}
3838
3939weak_alias(__ftello, ftello);
40
41weak_alias(ftello, ftello64);
lib/libc/musl/src/stdio/open_wmemstream.c+5-1
......@@ -40,8 +40,12 @@ fail:
4040static size_t wms_write(FILE *f, const unsigned char *buf, size_t len)
4141{
4242 struct cookie *c = f->cookie;
43 size_t len2;
43 size_t len2 = f->wpos - f->wbase;
4444 wchar_t *newbuf;
45 if (len2) {
46 f->wpos = f->wbase;
47 if (wms_write(f, f->wbase, len2) < len2) return 0;
48 }
4549 if (len + c->pos >= c->space) {
4650 len2 = 2*c->space+1 | c->pos+len+1;
4751 if (len2 > SSIZE_MAX/4) return 0;
lib/libc/musl/src/stdio/tempnam.c+3-5
......@@ -6,7 +6,6 @@
66#include <string.h>
77#include <stdlib.h>
88#include "syscall.h"
9#include "kstat.h"
109
1110#define MAXTRIES 100
1211
......@@ -37,11 +36,10 @@ char *tempnam(const char *dir, const char *pfx)
3736
3837 for (try=0; try<MAXTRIES; try++) {
3938 __randname(s+l-6);
40#ifdef SYS_lstat
41 r = __syscall(SYS_lstat, s, &(struct kstat){0});
39#ifdef SYS_readlink
40 r = __syscall(SYS_readlink, s, (char[1]){0}, 1);
4241#else
43 r = __syscall(SYS_fstatat, AT_FDCWD, s,
44 &(struct kstat){0}, AT_SYMLINK_NOFOLLOW);
42 r = __syscall(SYS_readlinkat, AT_FDCWD, s, (char[1]){0}, 1);
4543#endif
4644 if (r == -ENOENT) return strdup(s);
4745 }
lib/libc/musl/src/stdio/tmpfile.c-2
......@@ -27,5 +27,3 @@ FILE *tmpfile(void)
2727 }
2828 return 0;
2929}
30
31weak_alias(tmpfile, tmpfile64);
lib/libc/musl/src/stdio/tmpnam.c+3-5
......@@ -5,7 +5,6 @@
55#include <string.h>
66#include <stdlib.h>
77#include "syscall.h"
8#include "kstat.h"
98
109#define MAXTRIES 100
1110
......@@ -17,11 +16,10 @@ char *tmpnam(char *buf)
1716 int r;
1817 for (try=0; try<MAXTRIES; try++) {
1918 __randname(s+12);
20#ifdef SYS_lstat
21 r = __syscall(SYS_lstat, s, &(struct kstat){0});
19#ifdef SYS_readlink
20 r = __syscall(SYS_readlink, s, (char[1]){0}, 1);
2221#else
23 r = __syscall(SYS_fstatat, AT_FDCWD, s,
24 &(struct kstat){0}, AT_SYMLINK_NOFOLLOW);
22 r = __syscall(SYS_readlinkat, AT_FDCWD, s, (char[1]){0}, 1);
2523#endif
2624 if (r == -ENOENT) return strcpy(buf ? buf : internal, s);
2725 }
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)
132132
133133static void out(FILE *f, const char *s, size_t l)
134134{
135 if (!(f->flags & F_ERR)) __fwritex((void *)s, l, f);
135 if (!ferror(f)) __fwritex((void *)s, l, f);
136136}
137137
138138static 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,
478478 if (*s=='*') {
479479 if (isdigit(s[1]) && s[2]=='$') {
480480 l10n=1;
481 nl_type[s[1]-'0'] = INT;
482 w = nl_arg[s[1]-'0'].i;
481 if (!f) nl_type[s[1]-'0'] = INT, w = 0;
482 else w = nl_arg[s[1]-'0'].i;
483483 s+=3;
484484 } else if (!l10n) {
485485 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,
491491 /* Read precision */
492492 if (*s=='.' && s[1]=='*') {
493493 if (isdigit(s[2]) && s[3]=='$') {
494 nl_type[s[2]-'0'] = INT;
495 p = nl_arg[s[2]-'0'].i;
494 if (!f) nl_type[s[2]-'0'] = INT, p = 0;
495 else p = nl_arg[s[2]-'0'].i;
496496 s+=4;
497497 } else if (!l10n) {
498498 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,
521521 if (st==NOARG) {
522522 if (argpos>=0) goto inval;
523523 } else {
524 if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos];
525 else if (f) pop_arg(&arg, st, ap);
524 if (argpos>=0) {
525 if (!f) nl_type[argpos]=st;
526 else arg=nl_arg[argpos];
527 } else if (f) pop_arg(&arg, st, ap);
526528 else return 0;
527529 }
528530
529531 if (!f) continue;
530532
533 /* Do not process any new directives once in error state. */
534 if (ferror(f)) return -1;
535
531536 z = buf + sizeof(buf);
532537 prefix = "-+ 0X0x";
533538 pl = 0;
......@@ -672,7 +677,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
672677
673678 FLOCK(f);
674679 olderr = f->flags & F_ERR;
675 if (f->mode < 1) f->flags &= ~F_ERR;
680 f->flags &= ~F_ERR;
676681 if (!f->buf_size) {
677682 saved_buf = f->buf;
678683 f->buf = internal_buf;
......@@ -688,7 +693,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
688693 f->buf_size = 0;
689694 f->wpos = f->wbase = f->wend = 0;
690695 }
691 if (f->flags & F_ERR) ret = -1;
696 if (ferror(f)) ret = -1;
692697 f->flags |= olderr;
693698 FUNLOCK(f);
694699 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)
125125
126126static void out(FILE *f, const wchar_t *s, size_t l)
127127{
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, "");
129135}
130136
131137static 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_
242248 }
243249
244250 if (!f) continue;
251
252 /* Do not process any new directives once in error state. */
253 if (ferror(f)) return -1;
254
245255 t = s[-1];
246256 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_
258268 }
259269 continue;
260270 case 'c':
271 case 'C':
261272 if (w<1) w=1;
262 if (w>1 && !(fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, "");
263 fputwc(btowc(arg.i), f);
264 if (w>1 && (fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, "");
273 pad(f, w-1, fl);
274 out(f, &(wchar_t){t=='C' ? arg.i : btowc(arg.i)}, 1);
275 pad(f, w-1, fl^LEFT_ADJ);
265276 l = w;
266277 continue;
267 case 'C':
268 fputwc(arg.i, f);
269 l = 1;
270 continue;
271278 case 'S':
272279 a = arg.p;
273280 z = a + wcsnlen(a, p<0 ? INT_MAX : p);
274281 if (p<0 && *z) goto overflow;
275282 p = z-a;
276283 if (w<p) w=p;
277 if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
284 pad(f, w-p, fl);
278285 out(f, a, p);
279 if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
286 pad(f, w-p, fl^LEFT_ADJ);
280287 l=w;
281288 continue;
282289 case 'm':
......@@ -289,14 +296,14 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
289296 if (p<0 && *bs) goto overflow;
290297 p=l;
291298 if (w<p) w=p;
292 if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
299 pad(f, w-p, fl);
293300 bs = arg.p;
294301 while (l--) {
295302 i=mbtowc(&wc, bs, MB_LEN_MAX);
296303 bs+=i;
297 fputwc(wc, f);
304 out(f, &wc, 1);
298305 }
299 if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
306 pad(f, w-p, fl^LEFT_ADJ);
300307 l=w;
301308 continue;
302309 }
......@@ -340,8 +347,8 @@ overflow:
340347int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
341348{
342349 va_list ap2;
343 int nl_type[NL_ARGMAX] = {0};
344 union arg nl_arg[NL_ARGMAX];
350 int nl_type[NL_ARGMAX+1] = {0};
351 union arg nl_arg[NL_ARGMAX+1];
345352 int olderr;
346353 int ret;
347354
......@@ -357,7 +364,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
357364 olderr = f->flags & F_ERR;
358365 f->flags &= ~F_ERR;
359366 ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
360 if (f->flags & F_ERR) ret = -1;
367 if (ferror(f)) ret = -1;
361368 f->flags |= olderr;
362369 FUNLOCK(f);
363370 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)
1818 if (s!=f->wbase && sw_write(f, f->wbase, f->wpos-f->wbase)==-1)
1919 return -1;
2020 while (c->l && l && (i=mbtowc(c->ws, (void *)s, l))>=0) {
21 if (!i) i=1;
2122 s+=i;
2223 l-=i;
2324 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)
1010
1111void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
1212{
13 __qsort_r(base, nel, width, wrapper_cmp, cmp);
13 __qsort_r(base, nel, width, wrapper_cmp, (void *)cmp);
1414}
lib/libc/musl/src/string/strverscmp.c+3-3
......@@ -18,9 +18,9 @@ int strverscmp(const char *l0, const char *r0)
1818 else if (c!='0') z=0;
1919 }
2020
21 if (l[dp]!='0' && r[dp]!='0') {
22 /* If we're not looking at a digit sequence that began
23 * with a zero, longest digit string is greater. */
21 if (l[dp]-'1'<9U && r[dp]-'1'<9U) {
22 /* If we're looking at non-degenerate digit sequences starting
23 * with nonzero digits, longest digit string is greater. */
2424 for (j=i; isdigit(l[j]); j++)
2525 if (!isdigit(r[j])) return 1;
2626 if (isdigit(r[j])) return -1;
lib/libc/musl/src/string/wcscmp.c+1-1
......@@ -3,5 +3,5 @@
33int wcscmp(const wchar_t *l, const wchar_t *r)
44{
55 for (; *l==*r && *l && *r; l++, r++);
6 return *l - *r;
6 return *l < *r ? -1 : *l > *r;
77}
lib/libc/musl/src/string/wcsncmp.c+1-1
......@@ -3,5 +3,5 @@
33int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n)
44{
55 for (; n && *l==*r && *l && *r; n--, l++, r++);
6 return n ? *l - *r : 0;
6 return n ? (*l < *r ? -1 : *l > *r) : 0;
77}
lib/libc/musl/src/string/wmemcmp.c+1-1
......@@ -3,5 +3,5 @@
33int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n)
44{
55 for (; n && *l==*r; n--, l++, r++);
6 return n ? *l-*r : 0;
6 return n ? (*l < *r ? -1 : *l > *r) : 0;
77}
lib/libc/musl/src/temp/__randname.c+2-1
......@@ -1,5 +1,6 @@
11#include <time.h>
22#include <stdint.h>
3#include "pthread_impl.h"
34
45/* This assumes that a check for the
56 template size has already been made */
......@@ -10,7 +11,7 @@ char *__randname(char *template)
1011 unsigned long r;
1112
1213 __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;
1415 for (i=0; i<6; i++, r>>=5)
1516 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)
55{
66 return __mkostemps(template, 0, flags);
77}
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)
2626}
2727
2828weak_alias(__mkostemps, mkostemps);
29weak_alias(__mkostemps, mkostemps64);
lib/libc/musl/src/temp/mkstemp.c-2
......@@ -4,5 +4,3 @@ int mkstemp(char *template)
44{
55 return __mkostemps(template, 0, 0);
66}
7
8weak_alias(mkstemp, mkstemp64);
lib/libc/musl/src/temp/mkstemps.c-2
......@@ -5,5 +5,3 @@ int mkstemps(char *template, int len)
55{
66 return __mkostemps(template, len, 0);
77}
8
9weak_alias(mkstemps, mkstemps64);
lib/libc/musl/src/thread/pthread_atfork.c+7-1
......@@ -1,7 +1,13 @@
11#include <pthread.h>
2#include <errno.h>
23#include "libc.h"
34#include "lock.h"
45
6#define malloc __libc_malloc
7#define calloc undef
8#define realloc undef
9#define free undef
10
511static struct atfork_funcs {
612 void (*prepare)(void);
713 void (*parent)(void);
......@@ -34,7 +40,7 @@ void __fork_handler(int who)
3440int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
3541{
3642 struct atfork_funcs *new = malloc(sizeof *new);
37 if (!new) return -1;
43 if (!new) return ENOMEM;
3844
3945 LOCK(lock);
4046 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)
5656
5757 _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) {
6065 uc->uc_mcontext.MC_PC = (uintptr_t)__cp_cancel;
6166#ifdef CANCEL_GOT
6267 uc->uc_mcontext.MC_GOT = CANCEL_GOT;
......@@ -77,7 +82,7 @@ void __testcancel()
7782static void init_cancellation()
7883{
7984 struct sigaction sa = {
80 .sa_flags = SA_SIGINFO | SA_RESTART,
85 .sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK,
8186 .sa_sigaction = cancel_handler
8287 };
8388 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)
107107
108108 /* 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
110120 /* Process robust list in userspace to handle non-pshared mutexes
111121 * and the detached thread case where the robust list head will
112122 * be invalid when the kernel would process it. */
......@@ -159,12 +169,6 @@ _Noreturn void __pthread_exit(void *result)
159169 a_store(&self->detach_state, DT_EXITED);
160170 __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
168172 for (;;) __syscall(SYS_exit, 0);
169173}
170174
lib/libc/musl/src/thread/pthread_detach.c+6-2
......@@ -5,8 +5,12 @@ static int __pthread_detach(pthread_t t)
55{
66 /* If the cas fails, detach state is either already-detached
77 * or exiting/exited, and pthread_join will trap or cleanup. */
8 if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE)
9 return __pthread_join(t, 0);
8 if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE) {
9 int cs;
10 __pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
11 __pthread_join(t, 0);
12 __pthread_setcancelstate(cs, 0);
13 }
1014 return 0;
1115}
1216
lib/libc/musl/src/thread/pthread_key_create.c+8
......@@ -1,4 +1,5 @@
11#include "pthread_impl.h"
2#include "fork_impl.h"
23
34volatile size_t __pthread_tsd_size = sizeof(void *) * PTHREAD_KEYS_MAX;
45void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
......@@ -20,6 +21,13 @@ static void dummy_0(void)
2021weak_alias(dummy_0, __tl_lock);
2122weak_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
2331int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
2432{
2533 pthread_t self = __pthread_self();
lib/libc/musl/src/thread/sem_getvalue.c+2-1
......@@ -1,8 +1,9 @@
11#include <semaphore.h>
2#include <limits.h>
23
34int sem_getvalue(sem_t *restrict sem, int *restrict valp)
45{
56 int val = sem->__val[0];
6 *valp = val < 0 ? 0 : val;
7 *valp = val & SEM_VALUE_MAX;
78 return 0;
89}
lib/libc/musl/src/thread/sem_post.c+8-4
......@@ -1,17 +1,21 @@
11#include <semaphore.h>
2#include <limits.h>
23#include "pthread_impl.h"
34
45int sem_post(sem_t *sem)
56{
6 int val, waiters, priv = sem->__val[2];
7 int val, new, waiters, priv = sem->__val[2];
78 do {
89 val = sem->__val[0];
910 waiters = sem->__val[1];
10 if (val == SEM_VALUE_MAX) {
11 if ((val & SEM_VALUE_MAX) == SEM_VALUE_MAX) {
1112 errno = EOVERFLOW;
1213 return -1;
1314 }
14 } while (a_cas(sem->__val, val, val+1+(val<0)) != val);
15 if (val<0 || waiters) __wake(sem->__val, 1, priv);
15 new = val + 1;
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);
1620 return 0;
1721}
lib/libc/musl/src/thread/sem_timedwait.c+6-4
......@@ -1,4 +1,5 @@
11#include <semaphore.h>
2#include <limits.h>
23#include "pthread_impl.h"
34
45static void cleanup(void *p)
......@@ -13,14 +14,15 @@ int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict at)
1314 if (!sem_trywait(sem)) return 0;
1415
1516 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
1820 while (sem_trywait(sem)) {
19 int r;
21 int r, priv = sem->__val[2];
2022 a_inc(sem->__val+1);
21 a_cas(sem->__val, 0, -1);
23 a_cas(sem->__val, 0, 0x80000000);
2224 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);
2426 pthread_cleanup_pop(1);
2527 if (r) {
2628 errno = r;
lib/libc/musl/src/thread/sem_trywait.c+3-3
......@@ -1,12 +1,12 @@
11#include <semaphore.h>
2#include <limits.h>
23#include "pthread_impl.h"
34
45int sem_trywait(sem_t *sem)
56{
67 int val;
7 while ((val=sem->__val[0]) > 0) {
8 int new = val-1-(val==1 && sem->__val[1]);
9 if (a_cas(sem->__val, val, new)==val) return 0;
8 while ((val=sem->__val[0]) & SEM_VALUE_MAX) {
9 if (a_cas(sem->__val, val, val-1)==val) return 0;
1010 }
1111 errno = EAGAIN;
1212 return -1;
lib/libc/musl/src/thread/synccall.c+1-1
......@@ -45,7 +45,7 @@ void __synccall(void (*func)(void *), void *ctx)
4545{
4646 sigset_t oldmask;
4747 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 };
4949 pthread_t self = __pthread_self(), td;
5050 int count = 0;
5151
lib/libc/musl/src/time/__map_file.c+2-3
......@@ -2,15 +2,14 @@
22#include <fcntl.h>
33#include <sys/stat.h>
44#include "syscall.h"
5#include "kstat.h"
65
76const char unsigned *__map_file(const char *pathname, size_t *size)
87{
9 struct kstat st;
8 struct stat st;
109 const unsigned char *map = MAP_FAILED;
1110 int fd = sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
1211 if (fd < 0) return 0;
13 if (!syscall(SYS_fstat, fd, &st)) {
12 if (!__fstat(fd, &st)) {
1413 map = __mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
1514 *size = st.st_size;
1615 }
lib/libc/musl/src/time/clock_getcpuclockid.c+1
......@@ -8,6 +8,7 @@ int clock_getcpuclockid(pid_t pid, clockid_t *clk)
88 struct timespec ts;
99 clockid_t id = (-pid-1)*8U + 2;
1010 int ret = __syscall(SYS_clock_getres, id, &ts);
11 if (ret == -EINVAL) ret = -ESRCH;
1112 if (ret) return -ret;
1213 *clk = id;
1314 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)
4242 p = cgt_time32_wrap;
4343 }
4444 }
45#ifdef VDSO_CGT_WORKAROUND
46 if (!__vdsosym(VDSO_CGT32_VER, VDSO_CGT32_SYM)) p = 0;
47#endif
4548#endif
4649 int (*f)(clockid_t, struct timespec *) =
4750 (int (*)(clockid_t, struct timespec *))p;
......@@ -80,10 +83,12 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
8083 return __syscall_ret(r);
8184 long ts32[2];
8285 r = __syscall(SYS_clock_gettime, clk, ts32);
86#ifdef SYS_gettimeofday
8387 if (r==-ENOSYS && clk==CLOCK_REALTIME) {
8488 r = __syscall(SYS_gettimeofday, ts32, 0);
8589 ts32[1] *= 1000;
8690 }
91#endif
8792 if (!r) {
8893 ts->tv_sec = ts32[0];
8994 ts->tv_nsec = ts32[1];
......@@ -92,6 +97,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
9297 return __syscall_ret(r);
9398#else
9499 r = __syscall(SYS_clock_gettime, clk, ts);
100#ifdef SYS_gettimeofday
95101 if (r == -ENOSYS) {
96102 if (clk == CLOCK_REALTIME) {
97103 __syscall(SYS_gettimeofday, ts, 0);
......@@ -100,6 +106,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
100106 }
101107 r = -EINVAL;
102108 }
109#endif
103110 return __syscall_ret(r);
104111#endif
105112}
lib/libc/musl/src/time/timer_create.c+5-1
......@@ -43,6 +43,8 @@ static void *start(void *arg)
4343 union sigval val = args->sev->sigev_value;
4444
4545 pthread_barrier_wait(&args->b);
46 if (self->cancel)
47 return 0;
4648 for (;;) {
4749 siginfo_t si;
4850 while (sigwaitinfo(SIGTIMER_SET, &si) < 0);
......@@ -113,8 +115,10 @@ int timer_create(clockid_t clk, struct sigevent *restrict evp, timer_t *restrict
113115 ksev.sigev_signo = SIGTIMER;
114116 ksev.sigev_notify = SIGEV_THREAD_ID;
115117 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) {
117119 timerid = -1;
120 td->cancel = 1;
121 }
118122 td->timer_id = timerid;
119123 pthread_barrier_wait(&args.b);
120124 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)
99 int r;
1010#ifdef SYS_dup2
1111 if (old==new) return __syscall_ret(-EINVAL);
12 if (flags & O_CLOEXEC) {
12 if (flags) {
1313 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);
1414 if (r!=-ENOSYS) return __syscall_ret(r);
15 if (flags & ~O_CLOEXEC) return __syscall_ret(-EINVAL);
1516 }
1617 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);
1820#else
1921 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);
2022#endif
lib/libc/musl/src/unistd/ftruncate.c-2
......@@ -5,5 +5,3 @@ int ftruncate(int fd, off_t length)
55{
66 return syscall(SYS_ftruncate, fd, __SYSCALL_LL_O(length));
77}
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)
1212}
1313
1414weak_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)
1717}
1818
1919weak_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)
88 if (!flag) return pipe(fd);
99 int ret = __syscall(SYS_pipe2, fd, flag);
1010 if (ret != -ENOSYS) return __syscall_ret(ret);
11 if (flag & ~(O_CLOEXEC|O_NONBLOCK)) return __syscall_ret(-EINVAL);
1112 ret = pipe(fd);
1213 if (ret) return ret;
1314 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)
55{
66 return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_PRW(ofs));
77}
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)
88 return syscall_cp(SYS_preadv, fd, iov, count,
99 (long)(ofs), (long)(ofs>>32));
1010}
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)
55{
66 return syscall_cp(SYS_pwrite, fd, buf, size, __SYSCALL_LL_PRW(ofs));
77}
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)
88 return syscall_cp(SYS_pwritev, fd, iov, count,
99 (long)(ofs), (long)(ofs>>32));
1010}
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)
55{
66 return syscall(SYS_truncate, path, __SYSCALL_LL_O(length));
77}
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)
1212}
1313
1414weak_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 {
890890 };
891891 const adjusted_len = @min(max_count, buf.len);
892892
893 const pread_sym = if (builtin.os.tag == .linux and builtin.link_libc)
894 system.pread64
895 else
896 system.pread;
893 const pread_sym = if (lfs64_abi) system.pread64 else system.pread;
897894
898895 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
899896 while (true) {
......@@ -966,10 +963,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {
966963 }
967964
968965 while (true) {
969 const ftruncate_sym = if (builtin.os.tag == .linux and builtin.link_libc)
970 system.ftruncate64
971 else
972 system.ftruncate;
966 const ftruncate_sym = if (lfs64_abi) system.ftruncate64 else system.ftruncate;
973967
974968 const ilen = @bitCast(i64, length); // the OS treats this as unsigned
975969 switch (errno(ftruncate_sym(fd, ilen))) {
......@@ -1034,10 +1028,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
10341028
10351029 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)
1038 system.preadv64
1039 else
1040 system.preadv;
1031 const preadv_sym = if (lfs64_abi) system.preadv64 else system.preadv;
10411032
10421033 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
10431034 while (true) {
......@@ -1311,10 +1302,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
13111302 };
13121303 const adjusted_len = @min(max_count, bytes.len);
13131304
1314 const pwrite_sym = if (builtin.os.tag == .linux and builtin.link_libc)
1315 system.pwrite64
1316 else
1317 system.pwrite;
1305 const pwrite_sym = if (lfs64_abi) system.pwrite64 else system.pwrite;
13181306
13191307 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
13201308 while (true) {
......@@ -1400,10 +1388,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz
14001388 }
14011389 }
14021390
1403 const pwritev_sym = if (builtin.os.tag == .linux and builtin.link_libc)
1404 system.pwritev64
1405 else
1406 system.pwritev;
1391 const pwritev_sym = if (lfs64_abi) system.pwritev64 else system.pwritev;
14071392
14081393 const iov_count = if (iov.len > IOV_MAX) IOV_MAX else @intCast(u31, iov.len);
14091394 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
15141499 return open(mem.sliceTo(file_path, 0), flags, perm);
15151500 }
15161501
1517 const open_sym = if (builtin.os.tag == .linux and builtin.link_libc)
1518 system.open64
1519 else
1520 system.open;
1502 const open_sym = if (lfs64_abi) system.open64 else system.open;
15211503
15221504 while (true) {
15231505 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)
17301712 return openat(dir_fd, mem.sliceTo(file_path, 0), flags, mode);
17311713 }
17321714
1733 const openat_sym = if (builtin.os.tag == .linux and builtin.link_libc)
1734 system.openat64
1735 else
1736 system.openat;
1715 const openat_sym = if (lfs64_abi) system.openat64 else system.openat;
17371716
17381717 while (true) {
17391718 const rc = openat_sym(dir_fd, file_path, flags, mode);
......@@ -4117,10 +4096,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat {
41174096 @compileError("fstat is not yet implemented on Windows");
41184097 }
41194098
4120 const fstat_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4121 system.fstat64
4122 else
4123 system.fstat;
4099 const fstat_sym = if (lfs64_abi) system.fstat64 else system.fstat;
41244100
41254101 var stat = mem.zeroes(Stat);
41264102 switch (errno(fstat_sym(fd, &stat))) {
......@@ -4176,10 +4152,7 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S
41764152 return fstatatWasi(dirfd, mem.sliceTo(pathname), flags);
41774153 }
41784154
4179 const fstatat_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4180 system.fstatat64
4181 else
4182 system.fstatat;
4155 const fstatat_sym = if (lfs64_abi) system.fstatat64 else system.fstatat;
41834156
41844157 var stat = mem.zeroes(Stat);
41854158 switch (errno(fstatat_sym(dirfd, pathname, &stat, flags))) {
......@@ -4416,10 +4389,7 @@ pub fn mmap(
44164389 fd: fd_t,
44174390 offset: u64,
44184391) MMapError![]align(mem.page_size) u8 {
4419 const mmap_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4420 system.mmap64
4421 else
4422 system.mmap;
4392 const mmap_sym = if (lfs64_abi) system.mmap64 else system.mmap;
44234393
44244394 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
44254395 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 {
48234793 }
48244794 }
48254795
4826 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4827 system.lseek64
4828 else
4829 system.lseek;
4796 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
48304797
48314798 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
48324799 switch (errno(lseek_sym(fd, ioffset, SEEK.SET))) {
......@@ -4870,10 +4837,7 @@ pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void {
48704837 else => |err| return unexpectedErrno(err),
48714838 }
48724839 }
4873 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4874 system.lseek64
4875 else
4876 system.lseek;
4840 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
48774841
48784842 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
48794843 switch (errno(lseek_sym(fd, ioffset, SEEK.CUR))) {
......@@ -4917,10 +4881,7 @@ pub fn lseek_END(fd: fd_t, offset: i64) SeekError!void {
49174881 else => |err| return unexpectedErrno(err),
49184882 }
49194883 }
4920 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4921 system.lseek64
4922 else
4923 system.lseek;
4884 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
49244885
49254886 const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned
49264887 switch (errno(lseek_sym(fd, ioffset, SEEK.END))) {
......@@ -4964,10 +4925,7 @@ pub fn lseek_CUR_get(fd: fd_t) SeekError!u64 {
49644925 else => |err| return unexpectedErrno(err),
49654926 }
49664927 }
4967 const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc)
4968 system.lseek64
4969 else
4970 system.lseek;
4928 const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek;
49714929
49724930 const rc = lseek_sym(fd, 0, SEEK.CUR);
49734931 switch (errno(rc)) {
......@@ -6169,10 +6127,7 @@ pub fn sendfile(
61696127 // TODO we should not need this cast; improve return type of @min
61706128 const adjusted_count = @intCast(usize, adjusted_count_tmp);
61716129
6172 const sendfile_sym = if (builtin.link_libc)
6173 system.sendfile64
6174 else
6175 system.sendfile;
6130 const sendfile_sym = if (lfs64_abi) system.sendfile64 else system.sendfile;
61766131
61776132 while (true) {
61786133 var offset: off_t = @bitCast(off_t, in_offset);
......@@ -7050,10 +7005,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 {
70507005pub const GetrlimitError = UnexpectedError;
70517006
70527007pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit {
7053 const getrlimit_sym = if (builtin.os.tag == .linux and builtin.link_libc)
7054 system.getrlimit64
7055 else
7056 system.getrlimit;
7008 const getrlimit_sym = if (lfs64_abi) system.getrlimit64 else system.getrlimit;
70577009
70587010 var limits: rlimit = undefined;
70597011 switch (errno(getrlimit_sym(resource, &limits))) {
......@@ -7067,10 +7019,7 @@ pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit {
70677019pub const SetrlimitError = error{ PermissionDenied, LimitTooBig } || UnexpectedError;
70687020
70697021pub fn setrlimit(resource: rlimit_resource, limits: rlimit) SetrlimitError!void {
7070 const setrlimit_sym = if (builtin.os.tag == .linux and builtin.link_libc)
7071 system.setrlimit64
7072 else
7073 system.setrlimit;
7022 const setrlimit_sym = if (lfs64_abi) system.setrlimit64 else system.setrlimit;
70747023
70757024 switch (errno(setrlimit_sym(resource, &limits))) {
70767025 .SUCCESS => return,
......@@ -7339,3 +7288,5 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, signal: usize) PtraceError!
73397288 },
73407289 };
73417290}
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(
49184918 const generic_name = target_util.libCGenericName(target);
49194919 // Some architectures are handled by the same set of headers.
49204920 const arch_name = if (target.abi.isMusl())
4921 musl.archName(target.cpu.arch)
4921 musl.archNameHeaders(target.cpu.arch)
49224922 else if (target.cpu.arch.isThumb())
49234923 // ARM headers are valid for Thumb too.
49244924 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
258258 }
259259}
260260
261pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
261fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
262262 switch (arch) {
263263 .aarch64, .aarch64_be => return "aarch64",
264264 .arm, .armeb, .thumb, .thumbeb => return "arm",
......@@ -275,6 +275,13 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
275275 }
276276}
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
278285// Return true if musl has arch-specific crti/crtn sources.
279286// See lib/libc/musl/crt/ARCH/crt?.s .
280287pub fn needsCrtiCrtn(target: std.Target) bool {
......@@ -361,7 +368,9 @@ fn addCcArgs(
361368 const target = comp.getTarget();
362369 const arch_name = archName(target.cpu.arch);
363370 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 });
365374 const o_arg = if (want_O3) "-O3" else "-Os";
366375
367376 try args.appendSlice(&[_][]const u8{
......@@ -1457,6 +1466,7 @@ const src_files = [_][]const u8{
14571466 "musl/src/prng/seed48.c",
14581467 "musl/src/prng/srand48.c",
14591468 "musl/src/process/_Fork.c",
1469 "musl/src/process/aarch64/vfork.s",
14601470 "musl/src/process/arm/vfork.s",
14611471 "musl/src/process/execl.c",
14621472 "musl/src/process/execle.c",
......@@ -1487,6 +1497,7 @@ const src_files = [_][]const u8{
14871497 "musl/src/process/posix_spawnattr_setsigdefault.c",
14881498 "musl/src/process/posix_spawnattr_setsigmask.c",
14891499 "musl/src/process/posix_spawnp.c",
1500 "musl/src/process/riscv64/vfork.s",
14901501 "musl/src/process/s390x/vfork.s",
14911502 "musl/src/process/sh/vfork.s",
14921503 "musl/src/process/system.c",
......@@ -1570,11 +1581,8 @@ const src_files = [_][]const u8{
15701581 "musl/src/signal/m68k/sigsetjmp.s",
15711582 "musl/src/signal/microblaze/restore.s",
15721583 "musl/src/signal/microblaze/sigsetjmp.s",
1573 "musl/src/signal/mips/restore.s",
15741584 "musl/src/signal/mips/sigsetjmp.s",
1575 "musl/src/signal/mips64/restore.s",
15761585 "musl/src/signal/mips64/sigsetjmp.s",
1577 "musl/src/signal/mipsn32/restore.s",
15781586 "musl/src/signal/mipsn32/sigsetjmp.s",
15791587 "musl/src/signal/or1k/sigsetjmp.s",
15801588 "musl/src/signal/powerpc/restore.s",
src/wasi_libc.zig+1-1
......@@ -256,7 +256,7 @@ fn addCCArgs(
256256 want_O3: bool,
257257) error{OutOfMemory}!void {
258258 const target = comp.getTarget();
259 const arch_name = musl.archName(target.cpu.arch);
259 const arch_name = musl.archNameHeaders(target.cpu.arch);
260260 const os_name = @tagName(target.os.tag);
261261 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });
262262 const o_arg = if (want_O3) "-O3" else "-Os";
tools/gen_stubs.zig+218-15
......@@ -11,6 +11,7 @@
1111//! * One of the following, corresponding to the CPU architecture:
1212//! - `-DARCH_riscv64`
1313//! - `-DARCH_mips`
14//! - `-DARCH_mips64`
1415//! - `-DARCH_i386`
1516//! - `-DARCH_x86_64`
1617//! - `-DARCH_powerpc`
......@@ -28,9 +29,20 @@ const log = std.log;
2829const elf = std.elf;
2930const native_endian = @import("builtin").target.cpu.arch.endian();
3031
31const arches: [7]std.Target.Cpu.Arch = blk: {
32 var result: [7]std.Target.Cpu.Arch = undefined;
33 for (.{ .riscv64, .mips, .x86, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| {
32const inputs = .{
33 .riscv64,
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| {
3446 result[archIndex(arch)] = arch;
3547 }
3648 break :blk result;
......@@ -56,6 +68,7 @@ const MultiSym = struct {
5668 fn is32Only(ms: MultiSym) bool {
5769 return ms.present[archIndex(.riscv64)] == false and
5870 ms.present[archIndex(.mips)] == true and
71 ms.present[archIndex(.mips64)] == false and
5972 ms.present[archIndex(.x86)] == true and
6073 ms.present[archIndex(.x86_64)] == false and
6174 ms.present[archIndex(.powerpc)] == true and
......@@ -97,6 +110,7 @@ const MultiSym = struct {
97110 const map = .{
98111 .{ .riscv64, 8 },
99112 .{ .mips, 4 },
113 .{ .mips64, 8 },
100114 .{ .x86, 4 },
101115 .{ .x86_64, 8 },
102116 .{ .powerpc, 4 },
......@@ -118,6 +132,7 @@ const MultiSym = struct {
118132 const map = .{
119133 .{ .riscv64, 16 },
120134 .{ .mips, 8 },
135 .{ .mips64, 16 },
121136 .{ .x86, 8 },
122137 .{ .x86_64, 16 },
123138 .{ .powerpc, 8 },
......@@ -139,6 +154,7 @@ const MultiSym = struct {
139154 const map = .{
140155 .{ .riscv64, 2 },
141156 .{ .mips, 1 },
157 .{ .mips64, 2 },
142158 .{ .x86, 1 },
143159 .{ .x86_64, 2 },
144160 .{ .powerpc, 1 },
......@@ -187,17 +203,23 @@ pub fn main() !void {
187203 }
188204
189205 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
192210 // Read the ELF header.
193 const elf_bytes = try build_all_dir.readFileAllocOptions(
211 const elf_bytes = build_all_dir.readFileAllocOptions(
194212 arena,
195213 libc_so_path,
196214 100 * 1024 * 1024,
197215 1 * 1024 * 1024,
198216 @alignOf(elf.Elf64_Ehdr),
199217 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 };
201223 const header = try elf.Header.parse(elf_bytes[0..@sizeOf(elf.Elf64_Ehdr)]);
202224
203225 const parse: Parse = .{
......@@ -437,9 +459,15 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
437459 const dynstr = elf_bytes[dynstr_offset..];
438460
439461 // 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| {
443471 const this_section = s(sym.st_shndx);
444472 const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0));
445473 const ty = @truncate(u4, sym.st_info);
......@@ -555,19 +583,36 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
555583 // zig fmt: off
556584 .riscv64 => 0,
557585 .mips => 1,
558 .x86 => 2,
559 .x86_64 => 3,
560 .powerpc => 4,
561 .powerpc64 => 5,
562 .aarch64 => 6,
586 .mips64 => 2,
587 .x86 => 3,
588 .x86_64 => 4,
589 .powerpc => 5,
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",
563608 else => unreachable,
564609 // zig fmt: on
565610 };
566611}
567612
568613fn archSetName(arch_set: [arches.len]bool) []const u8 {
569 for (arches, 0..) |arch, i| {
570 if (arch_set[i]) {
614 for (arches, arch_set) |arch, set_item| {
615 if (set_item) {
571616 return @tagName(arch);
572617 }
573618 }
......@@ -913,4 +958,162 @@ const blacklisted_symbols = [_][]const u8{
913958 "sinf128",
914959 "sqrtf128",
915960 "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",
9161119};
tools/process_headers.zig+1-1
......@@ -208,7 +208,7 @@ const musl_targets = [_]LibCTarget{
208208 .abi = MultiAbi.musl,
209209 },
210210 LibCTarget{
211 .name = "x86",
211 .name = "i386",
212212 .arch = MultiArch{ .specific = .x86 },
213213 .abi = MultiAbi.musl,
214214 },