| author | |
| committer | |
| log | d3caacfab70736b43719b92391c9d343b54a03fd |
| tree | 48c83d2764be807835c1e1d53a45f1d16ae63fac |
| parent | 27610b0a0f0b2fc0695b0687d1e93ce910c155db |
| parent | 8c630376952546ddd09e76fcc72d3d2a8d12e0b6 |
| signature |
Update the WASI libc to 30094b6ed05f19cee102115215863d185f2db4f081 files changed, 581 insertions(+), 225 deletions(-)
lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/sys/stat/stat_impl.h+6| ... | ... | @@ -75,14 +75,18 @@ static inline bool utimens_get_timestamps(const struct timespec *times, |
| 75 | 75 | if (times == NULL) { |
| 76 | 76 | // Update both timestamps. |
| 77 | 77 | *flags = __WASI_FSTFLAGS_ATIM_NOW | __WASI_FSTFLAGS_MTIM_NOW; |
| 78 | *st_atim = (__wasi_timestamp_t) { 0 }; | |
| 79 | *st_mtim = (__wasi_timestamp_t) { 0 }; | |
| 78 | 80 | } else { |
| 79 | 81 | // Set individual timestamps. |
| 80 | 82 | *flags = 0; |
| 81 | 83 | switch (times[0].tv_nsec) { |
| 82 | 84 | case UTIME_NOW: |
| 83 | 85 | *flags |= __WASI_FSTFLAGS_ATIM_NOW; |
| 86 | *st_atim = (__wasi_timestamp_t) { 0 }; | |
| 84 | 87 | break; |
| 85 | 88 | case UTIME_OMIT: |
| 89 | *st_atim = (__wasi_timestamp_t) { 0 }; | |
| 86 | 90 | break; |
| 87 | 91 | default: |
| 88 | 92 | *flags |= __WASI_FSTFLAGS_ATIM; |
| ... | ... | @@ -94,8 +98,10 @@ static inline bool utimens_get_timestamps(const struct timespec *times, |
| 94 | 98 | switch (times[1].tv_nsec) { |
| 95 | 99 | case UTIME_NOW: |
| 96 | 100 | *flags |= __WASI_FSTFLAGS_MTIM_NOW; |
| 101 | *st_mtim = (__wasi_timestamp_t) { 0 }; | |
| 97 | 102 | break; |
| 98 | 103 | case UTIME_OMIT: |
| 104 | *st_mtim = (__wasi_timestamp_t) { 0 }; | |
| 99 | 105 | break; |
| 100 | 106 | default: |
| 101 | 107 | *flags |= __WASI_FSTFLAGS_MTIM; |
lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/sys/time/gettimeofday.c+5-3| ... | ... | @@ -9,8 +9,10 @@ |
| 9 | 9 | #include <wasi/api.h> |
| 10 | 10 | |
| 11 | 11 | int gettimeofday(struct timeval *restrict tp, void *tz) { |
| 12 | __wasi_timestamp_t ts = 0; | |
| 13 | (void)__wasi_clock_time_get(__WASI_CLOCKID_REALTIME, 1000, &ts); | |
| 14 | *tp = timestamp_to_timeval(ts); | |
| 12 | if (tp != NULL) { | |
| 13 | __wasi_timestamp_t ts = 0; | |
| 14 | (void)__wasi_clock_time_get(__WASI_CLOCKID_REALTIME, 1000, &ts); | |
| 15 | *tp = timestamp_to_timeval(ts); | |
| 16 | } | |
| 15 | 17 | return 0; |
| 16 | 18 | } |
lib/libc/wasi/libc-bottom-half/sources/__wasilibc_real.c-12| ... | ... | @@ -574,18 +574,6 @@ _Noreturn void __wasi_proc_exit( |
| 574 | 574 | __imported_wasi_snapshot_preview1_proc_exit((int32_t) rval); |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | int32_t __imported_wasi_snapshot_preview1_proc_raise(int32_t arg0) __attribute__(( | |
| 578 | __import_module__("wasi_snapshot_preview1"), | |
| 579 | __import_name__("proc_raise") | |
| 580 | )); | |
| 581 | ||
| 582 | __wasi_errno_t __wasi_proc_raise( | |
| 583 | __wasi_signal_t sig | |
| 584 | ){ | |
| 585 | int32_t ret = __imported_wasi_snapshot_preview1_proc_raise((int32_t) sig); | |
| 586 | return (uint16_t) ret; | |
| 587 | } | |
| 588 | ||
| 589 | 577 | int32_t __imported_wasi_snapshot_preview1_sched_yield() __attribute__(( |
| 590 | 578 | __import_module__("wasi_snapshot_preview1"), |
| 591 | 579 | __import_name__("sched_yield") |
lib/libc/wasi/libc-bottom-half/sources/accept.c created+51| ... | ... | @@ -0,0 +1,51 @@ |
| 1 | // SPDX-License-Identifier: BSD-2-Clause | |
| 2 | ||
| 3 | #include <sys/socket.h> | |
| 4 | ||
| 5 | #include <assert.h> | |
| 6 | #include <wasi/api.h> | |
| 7 | #include <errno.h> | |
| 8 | #include <string.h> | |
| 9 | ||
| 10 | int accept(int socket, struct sockaddr *restrict addr, socklen_t *restrict addrlen) { | |
| 11 | int ret = -1; | |
| 12 | ||
| 13 | __wasi_errno_t error = __wasi_sock_accept(socket, 0, &ret); | |
| 14 | ||
| 15 | if (error != 0) { | |
| 16 | errno = error; | |
| 17 | return -1; | |
| 18 | } | |
| 19 | ||
| 20 | // Clear sockaddr to indicate undefined address | |
| 21 | memset(addr, 0, *addrlen); | |
| 22 | // might be AF_UNIX or AF_INET | |
| 23 | addr->sa_family = AF_UNSPEC; | |
| 24 | *addrlen = sizeof(struct sockaddr); | |
| 25 | ||
| 26 | return ret; | |
| 27 | } | |
| 28 | ||
| 29 | int accept4(int socket, struct sockaddr *restrict addr, socklen_t *restrict addrlen, int flags) { | |
| 30 | int ret = -1; | |
| 31 | ||
| 32 | if (flags & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)) { | |
| 33 | errno = EINVAL; | |
| 34 | return -1; | |
| 35 | } | |
| 36 | ||
| 37 | __wasi_errno_t error = __wasi_sock_accept(socket, (flags & SOCK_NONBLOCK) ? __WASI_FDFLAGS_NONBLOCK : 0, &ret); | |
| 38 | ||
| 39 | if (error != 0) { | |
| 40 | errno = error; | |
| 41 | return -1; | |
| 42 | } | |
| 43 | ||
| 44 | // Clear sockaddr to indicate undefined address | |
| 45 | memset(addr, 0, *addrlen); | |
| 46 | // might be AF_UNIX or AF_INET | |
| 47 | addr->sa_family = AF_UNSPEC; | |
| 48 | *addrlen = sizeof(struct sockaddr); | |
| 49 | ||
| 50 | return ret; | |
| 51 | } |
lib/libc/wasi/libc-bottom-half/sources/chdir.c+5-4| ... | ... | @@ -46,7 +46,7 @@ int chdir(const char *path) |
| 46 | 46 | size_t len = strlen(abs) + 1; |
| 47 | 47 | int copy_relative = strcmp(relative_buf, ".") != 0; |
| 48 | 48 | int mid = copy_relative && abs[0] != 0; |
| 49 | char *new_cwd = malloc(len + (copy_relative ? strlen(relative_buf) + mid: 0)); | |
| 49 | char *new_cwd = malloc(len + (copy_relative ? strlen(relative_buf) + mid: 0)+1); | |
| 50 | 50 | if (new_cwd == NULL) { |
| 51 | 51 | errno = ENOMEM; |
| 52 | 52 | return -1; |
| ... | ... | @@ -54,7 +54,7 @@ int chdir(const char *path) |
| 54 | 54 | new_cwd[0] = '/'; |
| 55 | 55 | strcpy(new_cwd + 1, abs); |
| 56 | 56 | if (mid) |
| 57 | new_cwd[strlen(abs) + 1] = '/'; | |
| 57 | new_cwd[len] = '/'; | |
| 58 | 58 | if (copy_relative) |
| 59 | 59 | strcpy(new_cwd + 1 + mid + strlen(abs), relative_buf); |
| 60 | 60 | |
| ... | ... | @@ -95,9 +95,10 @@ static const char *make_absolute(const char *path) { |
| 95 | 95 | int need_slash = __wasilibc_cwd[cwd_len - 1] == '/' ? 0 : 1; |
| 96 | 96 | size_t alloc_len = cwd_len + path_len + 1 + need_slash; |
| 97 | 97 | if (alloc_len > make_absolute_len) { |
| 98 | make_absolute_buf = realloc(make_absolute_buf, alloc_len); | |
| 99 | if (make_absolute_buf == NULL) | |
| 98 | char *tmp = realloc(make_absolute_buf, alloc_len); | |
| 99 | if (tmp == NULL) | |
| 100 | 100 | return NULL; |
| 101 | make_absolute_buf = tmp; | |
| 101 | 102 | make_absolute_len = alloc_len; |
| 102 | 103 | } |
| 103 | 104 | strcpy(make_absolute_buf, __wasilibc_cwd); |
lib/libc/wasi/libc-bottom-half/sources/posix.c+28-2| ... | ... | @@ -31,16 +31,20 @@ static int find_relpath2( |
| 31 | 31 | static int find_relpath(const char *path, char **relative) { |
| 32 | 32 | static __thread char *relative_buf = NULL; |
| 33 | 33 | static __thread size_t relative_buf_len = 0; |
| 34 | int fd = find_relpath2(path, &relative_buf, &relative_buf_len); | |
| 35 | // find_relpath2 can update relative_buf, so assign it after the call | |
| 34 | 36 | *relative = relative_buf; |
| 35 | return find_relpath2(path, relative, &relative_buf_len); | |
| 37 | return fd; | |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | // same as `find_relpath`, but uses another set of static variables to cache |
| 39 | 41 | static int find_relpath_alt(const char *path, char **relative) { |
| 40 | 42 | static __thread char *relative_buf = NULL; |
| 41 | 43 | static __thread size_t relative_buf_len = 0; |
| 44 | int fd = find_relpath2(path, &relative_buf, &relative_buf_len); | |
| 45 | // find_relpath2 can update relative_buf, so assign it after the call | |
| 42 | 46 | *relative = relative_buf; |
| 43 | return find_relpath2(path, relative, &relative_buf_len); | |
| 47 | return fd; | |
| 44 | 48 | } |
| 45 | 49 | |
| 46 | 50 | int open(const char *path, int oflag, ...) { |
| ... | ... | @@ -139,6 +143,28 @@ int utime(const char *path, const struct utimbuf *times) { |
| 139 | 143 | 0); |
| 140 | 144 | } |
| 141 | 145 | |
| 146 | int utimes(const char *path, const struct timeval times[2]) { | |
| 147 | char *relative_path; | |
| 148 | int dirfd = find_relpath(path, &relative_path); | |
| 149 | ||
| 150 | // If we can't find a preopen for it, indicate that we lack capabilities. | |
| 151 | if (dirfd == -1) { | |
| 152 | errno = ENOTCAPABLE; | |
| 153 | return -1; | |
| 154 | } | |
| 155 | ||
| 156 | return __wasilibc_nocwd_utimensat( | |
| 157 | dirfd, relative_path, | |
| 158 | times ? ((struct timespec [2]) { | |
| 159 | { .tv_sec = times[0].tv_sec, | |
| 160 | 				 .tv_nsec = times[0].tv_usec * 1000 }, | |
| 161 | { .tv_sec = times[1].tv_sec, | |
| 162 | 				 .tv_nsec = times[1].tv_usec * 1000 }, | |
| 163 | }) | |
| 164 | : NULL, | |
| 165 | 0); | |
| 166 | } | |
| 167 | ||
| 142 | 168 | int unlink(const char *path) { |
| 143 | 169 | char *relative_path; |
| 144 | 170 | int dirfd = find_relpath(path, &relative_path); |
lib/libc/wasi/libc-top-half/musl/include/ctype.h+2| ... | ... | @@ -64,7 +64,9 @@ int isascii(int); |
| 64 | 64 | int toascii(int); |
| 65 | 65 | #define _tolower(a) ((a)|0x20) |
| 66 | 66 | #define _toupper(a) ((a)&0x5f) |
| 67 | #ifndef __cplusplus | |
| 67 | 68 | #define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) |
| 69 | #endif | |
| 68 | 70 | |
| 69 | 71 | #endif |
| 70 | 72 |
lib/libc/wasi/libc-top-half/musl/include/elf.h+2| ... | ... | @@ -686,6 +686,8 @@ typedef struct { |
| 686 | 686 | #define NT_ARM_PAC_MASK	0x406 |
| 687 | 687 | #define NT_ARM_PACA_KEYS	0x407 |
| 688 | 688 | #define NT_ARM_PACG_KEYS	0x408 |
| 689 | #define NT_ARM_TAGGED_ADDR_CTRL	0x409 | |
| 690 | #define NT_ARM_PAC_ENABLED_KEYS	0x40a | |
| 689 | 691 | #define NT_METAG_CBUF	0x500 |
| 690 | 692 | #define NT_METAG_RPIPE	0x501 |
| 691 | 693 | #define NT_METAG_TLS	0x502 |
lib/libc/wasi/libc-top-half/musl/include/locale.h+3-1| ... | ... | @@ -8,7 +8,9 @@ extern "C" { |
| 8 | 8 | #include <features.h> |
| 9 | 9 | |
| 10 | 10 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 11 | #ifdef __cplusplus | |
| 11 | #if __cplusplus >= 201103L | |
| 12 | #define NULL nullptr | |
| 13 | #elif defined(__cplusplus) | |
| 12 | 14 | #define NULL 0L |
| 13 | 15 | #else |
| 14 | 16 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/include/netinet/if_ether.h+1| ... | ... | @@ -66,6 +66,7 @@ |
| 66 | 66 | #define ETH_P_1588	0x88F7 |
| 67 | 67 | #define ETH_P_NCSI	0x88F8 |
| 68 | 68 | #define ETH_P_PRP	0x88FB |
| 69 | #define ETH_P_CFM	0x8902 | |
| 69 | 70 | #define ETH_P_FCOE	0x8906 |
| 70 | 71 | #define ETH_P_TDLS	0x890D |
| 71 | 72 | #define ETH_P_FIP	0x8914 |
lib/libc/wasi/libc-top-half/musl/include/netinet/in.h+1| ... | ... | @@ -60,6 +60,7 @@ struct ipv6_mreq { |
| 60 | 60 | #define INADDR_BROADCAST ((in_addr_t) 0xffffffff) |
| 61 | 61 | #define INADDR_NONE ((in_addr_t) 0xffffffff) |
| 62 | 62 | #define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) |
| 63 | #define INADDR_DUMMY ((in_addr_t) 0xc0000008) | |
| 63 | 64 | |
| 64 | 65 | #define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) |
| 65 | 66 | #define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) |
lib/libc/wasi/libc-top-half/musl/include/netinet/tcp.h+11| ... | ... | @@ -80,6 +80,8 @@ enum { |
| 80 | 80 | 	TCP_NLA_SRTT, |
| 81 | 81 | 	TCP_NLA_TIMEOUT_REHASH, |
| 82 | 82 | 	TCP_NLA_BYTES_NOTSENT, |
| 83 | 	TCP_NLA_EDT, | |
| 84 | 	TCP_NLA_TTL, | |
| 83 | 85 | }; |
| 84 | 86 | |
| 85 | 87 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| ... | ... | @@ -281,12 +283,21 @@ struct tcp_repair_window { |
| 281 | 283 | 	uint32_t rcv_wup; |
| 282 | 284 | }; |
| 283 | 285 | |
| 286 | #define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1 | |
| 287 | ||
| 284 | 288 | struct tcp_zerocopy_receive { |
| 285 | 289 | 	uint64_t address; |
| 286 | 290 | 	uint32_t length; |
| 287 | 291 | 	uint32_t recv_skip_hint; |
| 288 | 292 | 	uint32_t inq; |
| 289 | 293 | 	int32_t err; |
| 294 | 	uint64_t copybuf_address; | |
| 295 | 	int32_t copybuf_len; | |
| 296 | 	uint32_t flags; | |
| 297 | 	uint64_t msg_control; | |
| 298 | 	uint64_t msg_controllen; | |
| 299 | 	uint32_t msg_flags; | |
| 300 | 	uint32_t reserved; | |
| 290 | 301 | }; |
| 291 | 302 | |
| 292 | 303 | #endif |
lib/libc/wasi/libc-top-half/musl/include/pthread.h+1| ... | ... | @@ -227,6 +227,7 @@ int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *); |
| 227 | 227 | int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *); |
| 228 | 228 | int pthread_getattr_np(pthread_t, pthread_attr_t *); |
| 229 | 229 | int pthread_setname_np(pthread_t, const char *); |
| 230 | int pthread_getname_np(pthread_t, char *, size_t); | |
| 230 | 231 | int pthread_getattr_default_np(pthread_attr_t *); |
| 231 | 232 | int pthread_setattr_default_np(const pthread_attr_t *); |
| 232 | 233 | int pthread_tryjoin_np(pthread_t, void **); |
lib/libc/wasi/libc-top-half/musl/include/setjmp.h+11-3| ... | ... | @@ -16,21 +16,27 @@ typedef struct __jmp_buf_tag { |
| 16 | 16 | 	unsigned long __ss[128/sizeof(long)]; |
| 17 | 17 | } jmp_buf[1]; |
| 18 | 18 | |
| 19 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) | |
| 20 | #define __setjmp_attr __attribute__((__returns_twice__)) | |
| 21 | #else | |
| 22 | #define __setjmp_attr | |
| 23 | #endif | |
| 24 | ||
| 19 | 25 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 20 | 26 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 21 | 27 | || defined(_BSD_SOURCE) |
| 22 | 28 | typedef jmp_buf sigjmp_buf; |
| 23 | int sigsetjmp (sigjmp_buf, int); | |
| 29 | int sigsetjmp (sigjmp_buf, int) __setjmp_attr; | |
| 24 | 30 | _Noreturn void siglongjmp (sigjmp_buf, int); |
| 25 | 31 | #endif |
| 26 | 32 | |
| 27 | 33 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 28 | 34 | || defined(_BSD_SOURCE) |
| 29 | int _setjmp (jmp_buf); | |
| 35 | int _setjmp (jmp_buf) __setjmp_attr; | |
| 30 | 36 | _Noreturn void _longjmp (jmp_buf, int); |
| 31 | 37 | #endif |
| 32 | 38 | |
| 33 | int setjmp (jmp_buf); | |
| 39 | int setjmp (jmp_buf) __setjmp_attr; | |
| 34 | 40 | _Noreturn void longjmp (jmp_buf, int); |
| 35 | 41 | |
| 36 | 42 | #define setjmp setjmp |
| ... | ... | @@ -38,6 +44,8 @@ _Noreturn void longjmp (jmp_buf, int); |
| 38 | 44 | #warning setjmp is not yet implemented for WASI |
| 39 | 45 | #endif |
| 40 | 46 | |
| 47 | #undef __setjmp_attr | |
| 48 | ||
| 41 | 49 | #ifdef __cplusplus |
| 42 | 50 | } |
| 43 | 51 | #endif |
lib/libc/wasi/libc-top-half/musl/include/signal.h+8| ... | ... | @@ -82,6 +82,8 @@ typedef struct sigaltstack stack_t; |
| 82 | 82 | #define SEGV_ACCERR 2 |
| 83 | 83 | #define SEGV_BNDERR 3 |
| 84 | 84 | #define SEGV_PKUERR 4 |
| 85 | #define SEGV_MTEAERR 8 | |
| 86 | #define SEGV_MTESERR 9 | |
| 85 | 87 | |
| 86 | 88 | #define BUS_ADRALN 1 |
| 87 | 89 | #define BUS_ADRERR 2 |
| ... | ... | @@ -183,6 +185,9 @@ struct sigaction { |
| 183 | 185 | #define sa_handler __sa_handler.sa_handler |
| 184 | 186 | #define sa_sigaction __sa_handler.sa_sigaction |
| 185 | 187 | |
| 188 | #define SA_UNSUPPORTED 0x00000400 | |
| 189 | #define SA_EXPOSE_TAGBITS 0x00000800 | |
| 190 | ||
| 186 | 191 | struct sigevent { |
| 187 | 192 | 	union sigval sigev_value; |
| 188 | 193 | 	int sigev_signo; |
| ... | ... | @@ -277,6 +282,9 @@ void (*sigset(int, void (*)(int)))(int); |
| 277 | 282 | #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
| 278 | 283 | #define NSIG _NSIG |
| 279 | 284 | typedef void (*sig_t)(int); |
| 285 | ||
| 286 | #define SYS_SECCOMP 1 | |
| 287 | #define SYS_USER_DISPATCH 2 | |
| 280 | 288 | #endif |
| 281 | 289 | |
| 282 | 290 | #ifdef _GNU_SOURCE |
lib/libc/wasi/libc-top-half/musl/include/stdc-predef.h+3| ... | ... | @@ -7,4 +7,7 @@ |
| 7 | 7 | #define __STDC_IEC_559__ 1 |
| 8 | 8 | #endif |
| 9 | 9 | |
| 10 | #define __STDC_UTF_16__ 1 | |
| 11 | #define __STDC_UTF_32__ 1 | |
| 12 | ||
| 10 | 13 | #endif |
lib/libc/wasi/libc-top-half/musl/include/stddef.h+3-1| ... | ... | @@ -1,7 +1,9 @@ |
| 1 | 1 | #ifndef _STDDEF_H |
| 2 | 2 | #define _STDDEF_H |
| 3 | 3 | |
| 4 | #ifdef __cplusplus | |
| 4 | #if __cplusplus >= 201103L | |
| 5 | #define NULL nullptr | |
| 6 | #elif defined(__cplusplus) | |
| 5 | 7 | #define NULL 0L |
| 6 | 8 | #else |
| 7 | 9 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/include/stdio.h+3-1| ... | ... | @@ -28,7 +28,9 @@ extern "C" { |
| 28 | 28 | #include <bits/alltypes.h> |
| 29 | 29 | |
| 30 | 30 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 31 | #ifdef __cplusplus | |
| 31 | #if __cplusplus >= 201103L | |
| 32 | #define NULL nullptr | |
| 33 | #elif defined(__cplusplus) | |
| 32 | 34 | #define NULL 0L |
| 33 | 35 | #else |
| 34 | 36 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/include/stdlib.h+4-1| ... | ... | @@ -13,7 +13,9 @@ extern "C" { |
| 13 | 13 | #include <features.h> |
| 14 | 14 | |
| 15 | 15 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 16 | #ifdef __cplusplus | |
| 16 | #if __cplusplus >= 201103L | |
| 17 | #define NULL nullptr | |
| 18 | #elif defined(__cplusplus) | |
| 17 | 19 | #define NULL 0L |
| 18 | 20 | #else |
| 19 | 21 | #define NULL ((void*)0) |
| ... | ... | @@ -171,6 +173,7 @@ int clearenv(void); |
| 171 | 173 | #define WCOREDUMP(s) ((s) & 0x80) |
| 172 | 174 | #define WIFCONTINUED(s) ((s) == 0xffff) |
| 173 | 175 | void *reallocarray (void *, size_t, size_t); |
| 176 | void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); | |
| 174 | 177 | #endif |
| 175 | 178 | #endif |
| 176 | 179 |
lib/libc/wasi/libc-top-half/musl/include/string.h+3-1| ... | ... | @@ -12,7 +12,9 @@ extern "C" { |
| 12 | 12 | #include <features.h> |
| 13 | 13 | |
| 14 | 14 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 15 | #ifdef __cplusplus | |
| 15 | #if __cplusplus >= 201103L | |
| 16 | #define NULL nullptr | |
| 17 | #elif defined(__cplusplus) | |
| 16 | 18 | #define NULL 0L |
| 17 | 19 | #else |
| 18 | 20 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/include/sys/membarrier.h+4| ... | ... | @@ -9,9 +9,13 @@ |
| 9 | 9 | #define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16 |
| 10 | 10 | #define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32 |
| 11 | 11 | #define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64 |
| 12 | #define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128 | |
| 13 | #define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256 | |
| 12 | 14 | |
| 13 | 15 | #define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL |
| 14 | 16 | |
| 17 | #define MEMBARRIER_CMD_FLAG_CPU 1 | |
| 18 | ||
| 15 | 19 | int membarrier(int, int); |
| 16 | 20 | |
| 17 | 21 | #endif |
lib/libc/wasi/libc-top-half/musl/include/sys/mman.h+1| ... | ... | @@ -44,6 +44,7 @@ extern "C" { |
| 44 | 44 | |
| 45 | 45 | #define MAP_HUGE_SHIFT 26 |
| 46 | 46 | #define MAP_HUGE_MASK 0x3f |
| 47 | #define MAP_HUGE_16KB (14 << 26) | |
| 47 | 48 | #define MAP_HUGE_64KB (16 << 26) |
| 48 | 49 | #define MAP_HUGE_512KB (19 << 26) |
| 49 | 50 | #define MAP_HUGE_1MB (20 << 26) |
lib/libc/wasi/libc-top-half/musl/include/sys/mount.h+1| ... | ... | @@ -31,6 +31,7 @@ extern "C" { |
| 31 | 31 | #define MS_REMOUNT 32 |
| 32 | 32 | #define MS_MANDLOCK 64 |
| 33 | 33 | #define MS_DIRSYNC 128 |
| 34 | #define MS_NOSYMFOLLOW 256 | |
| 34 | 35 | #define MS_NOATIME 1024 |
| 35 | 36 | #define MS_NODIRATIME 2048 |
| 36 | 37 | #define MS_BIND 4096 |
lib/libc/wasi/libc-top-half/musl/include/sys/prctl.h+16| ... | ... | @@ -157,10 +157,26 @@ struct prctl_mm_map { |
| 157 | 157 | #define PR_SET_TAGGED_ADDR_CTRL 55 |
| 158 | 158 | #define PR_GET_TAGGED_ADDR_CTRL 56 |
| 159 | 159 | #define PR_TAGGED_ADDR_ENABLE (1UL << 0) |
| 160 | #define PR_MTE_TCF_SHIFT 1 | |
| 161 | #define PR_MTE_TCF_NONE (0UL << 1) | |
| 162 | #define PR_MTE_TCF_SYNC (1UL << 1) | |
| 163 | #define PR_MTE_TCF_ASYNC (2UL << 1) | |
| 164 | #define PR_MTE_TCF_MASK (3UL << 1) | |
| 165 | #define PR_MTE_TAG_SHIFT 3 | |
| 166 | #define PR_MTE_TAG_MASK (0xffffUL << 3) | |
| 160 | 167 | |
| 161 | 168 | #define PR_SET_IO_FLUSHER 57 |
| 162 | 169 | #define PR_GET_IO_FLUSHER 58 |
| 163 | 170 | |
| 171 | #define PR_SET_SYSCALL_USER_DISPATCH 59 | |
| 172 | #define PR_SYS_DISPATCH_OFF 0 | |
| 173 | #define PR_SYS_DISPATCH_ON 1 | |
| 174 | #define SYSCALL_DISPATCH_FILTER_ALLOW 0 | |
| 175 | #define SYSCALL_DISPATCH_FILTER_BLOCK 1 | |
| 176 | ||
| 177 | #define PR_PAC_SET_ENABLED_KEYS 60 | |
| 178 | #define PR_PAC_GET_ENABLED_KEYS 61 | |
| 179 | ||
| 164 | 180 | int prctl (int, ...); |
| 165 | 181 | |
| 166 | 182 | #ifdef __cplusplus |
lib/libc/wasi/libc-top-half/musl/include/sys/ptrace.h+9| ... | ... | @@ -42,6 +42,7 @@ extern "C" { |
| 42 | 42 | #define PTRACE_SECCOMP_GET_FILTER 0x420c |
| 43 | 43 | #define PTRACE_SECCOMP_GET_METADATA 0x420d |
| 44 | 44 | #define PTRACE_GET_SYSCALL_INFO 0x420e |
| 45 | #define PTRACE_GET_RSEQ_CONFIGURATION	0x420f | |
| 45 | 46 | |
| 46 | 47 | #define PT_READ_I PTRACE_PEEKTEXT |
| 47 | 48 | #define PT_READ_D PTRACE_PEEKDATA |
| ... | ... | @@ -130,6 +131,14 @@ struct __ptrace_syscall_info { |
| 130 | 131 | 	}; |
| 131 | 132 | }; |
| 132 | 133 | |
| 134 | struct __ptrace_rseq_configuration { | |
| 135 | 	uint64_t rseq_abi_pointer; | |
| 136 | 	uint32_t rseq_abi_size; | |
| 137 | 	uint32_t signature; | |
| 138 | 	uint32_t flags; | |
| 139 | 	uint32_t pad; | |
| 140 | }; | |
| 141 | ||
| 133 | 142 | long ptrace(int, ...); |
| 134 | 143 | |
| 135 | 144 | #ifdef __cplusplus |
lib/libc/wasi/libc-top-half/musl/include/sys/socket.h+4-1| ... | ... | @@ -298,6 +298,8 @@ struct linger { |
| 298 | 298 | #define SCM_TXTIME SO_TXTIME |
| 299 | 299 | #define SO_BINDTOIFINDEX 62 |
| 300 | 300 | #define SO_DETACH_REUSEPORT_BPF 68 |
| 301 | #define SO_PREFER_BUSY_POLL 69 | |
| 302 | #define SO_BUSY_POLL_BUDGET 70 | |
| 301 | 303 | |
| 302 | 304 | #ifndef SOL_SOCKET |
| 303 | 305 | #define SOL_SOCKET 1 |
| ... | ... | @@ -404,9 +406,10 @@ int shutdown (int, int); |
| 404 | 406 | int bind (int, const struct sockaddr *, socklen_t); |
| 405 | 407 | int connect (int, const struct sockaddr *, socklen_t); |
| 406 | 408 | int listen (int, int); |
| 409 | #endif | |
| 410 | ||
| 407 | 411 | int accept (int, struct sockaddr *__restrict, socklen_t *__restrict); |
| 408 | 412 | int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int); |
| 409 | #endif | |
| 410 | 413 | |
| 411 | 414 | #ifdef __wasilibc_unmodified_upstream /* WASI has no getsockname/getpeername */ |
| 412 | 415 | int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict); |
lib/libc/wasi/libc-top-half/musl/include/sys/time.h+2-2| ... | ... | @@ -23,9 +23,7 @@ struct itimerval { |
| 23 | 23 | int getitimer (int, struct itimerval *); |
| 24 | 24 | int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict); |
| 25 | 25 | #endif |
| 26 | #ifdef __wasilibc_unmodified_upstream /* WASI libc doesn't build the legacy functions */ | |
| 27 | 26 | int utimes (const char *, const struct timeval [2]); |
| 28 | #endif | |
| 29 | 27 | |
| 30 | 28 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 31 | 29 | struct timezone { |
| ... | ... | @@ -34,7 +32,9 @@ struct timezone { |
| 34 | 32 | }; |
| 35 | 33 | #ifdef __wasilibc_unmodified_upstream /* WASI libc doesn't build the legacy functions */ |
| 36 | 34 | int futimes(int, const struct timeval [2]); |
| 35 | #endif | |
| 37 | 36 | int futimesat(int, const char *, const struct timeval [2]); |
| 37 | #ifdef __wasilibc_unmodified_upstream /* WASI libc doesn't build the legacy functions */ | |
| 38 | 38 | int lutimes(const char *, const struct timeval [2]); |
| 39 | 39 | #endif |
| 40 | 40 | #ifdef __wasilibc_unmodified_upstream /* WASI has no way to set the time */ |
lib/libc/wasi/libc-top-half/musl/include/time.h+3-1| ... | ... | @@ -8,7 +8,9 @@ extern "C" { |
| 8 | 8 | #include <features.h> |
| 9 | 9 | |
| 10 | 10 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 11 | #ifdef __cplusplus | |
| 11 | #if __cplusplus >= 201103L | |
| 12 | #define NULL nullptr | |
| 13 | #elif defined(__cplusplus) | |
| 12 | 14 | #define NULL 0L |
| 13 | 15 | #else |
| 14 | 16 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/include/unistd.h+5-1| ... | ... | @@ -15,12 +15,16 @@ extern "C" { |
| 15 | 15 | #define SEEK_SET 0 |
| 16 | 16 | #define SEEK_CUR 1 |
| 17 | 17 | #define SEEK_END 2 |
| 18 | #define SEEK_DATA 3 | |
| 19 | #define SEEK_HOLE 4 | |
| 18 | 20 | #else |
| 19 | 21 | #include <__header_unistd.h> |
| 20 | 22 | #endif |
| 21 | 23 | |
| 22 | 24 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 23 | #ifdef __cplusplus | |
| 25 | #if __cplusplus >= 201103L | |
| 26 | #define NULL nullptr | |
| 27 | #elif defined(__cplusplus) | |
| 24 | 28 | #define NULL 0L |
| 25 | 29 | #else |
| 26 | 30 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/include/wchar.h+3-1| ... | ... | @@ -41,7 +41,9 @@ extern "C" { |
| 41 | 41 | #endif |
| 42 | 42 | |
| 43 | 43 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 44 | #ifdef __cplusplus | |
| 44 | #if __cplusplus >= 201103L | |
| 45 | #define NULL nullptr | |
| 46 | #elif defined(__cplusplus) | |
| 45 | 47 | #define NULL 0L |
| 46 | 48 | #else |
| 47 | 49 | #define NULL ((void*)0) |
lib/libc/wasi/libc-top-half/musl/src/complex/cacosf.c+3-1| ... | ... | @@ -2,8 +2,10 @@ |
| 2 | 2 | |
| 3 | 3 | // FIXME |
| 4 | 4 | |
| 5 | static const float float_pi_2 = M_PI_2; | |
| 6 | ||
| 5 | 7 | float complex cacosf(float complex z) |
| 6 | 8 | { |
| 7 | 9 | 	z = casinf(z); |
| 8 | 	return CMPLXF((float)M_PI_2 - crealf(z), -cimagf(z)); | |
| 10 | 	return CMPLXF(float_pi_2 - crealf(z), -cimagf(z)); | |
| 9 | 11 | } |
lib/libc/wasi/libc-top-half/musl/src/complex/catanf.c+3-1| ... | ... | @@ -61,13 +61,15 @@ static const double DP1 = 3.140625; |
| 61 | 61 | static const double DP2 = 9.67502593994140625E-4; |
| 62 | 62 | static const double DP3 = 1.509957990978376432E-7; |
| 63 | 63 | |
| 64 | static const float float_pi = M_PI; | |
| 65 | ||
| 64 | 66 | static float _redupif(float xx) |
| 65 | 67 | { |
| 66 | 68 | 	float x, t; |
| 67 | 69 | 	long i; |
| 68 | 70 | |
| 69 | 71 | 	x = xx; |
| 70 | 	t = x/(float)M_PI; | |
| 72 | 	t = x/float_pi; | |
| 71 | 73 | 	if (t >= 0.0f) |
| 72 | 74 | 		t += 0.5f; |
| 73 | 75 | 	else |
lib/libc/wasi/libc-top-half/musl/src/complex/cproj.c+1-1| ... | ... | @@ -3,6 +3,6 @@ |
| 3 | 3 | double complex cproj(double complex z) |
| 4 | 4 | { |
| 5 | 5 | 	if (isinf(creal(z)) || isinf(cimag(z))) |
| 6 | 		return CMPLX(INFINITY, copysign(0.0, creal(z))); | |
| 6 | 		return CMPLX(INFINITY, copysign(0.0, cimag(z))); | |
| 7 | 7 | 	return z; |
| 8 | 8 | } |
lib/libc/wasi/libc-top-half/musl/src/complex/cprojf.c+1-1| ... | ... | @@ -3,6 +3,6 @@ |
| 3 | 3 | float complex cprojf(float complex z) |
| 4 | 4 | { |
| 5 | 5 | 	if (isinf(crealf(z)) || isinf(cimagf(z))) |
| 6 | 		return CMPLXF(INFINITY, copysignf(0.0, crealf(z))); | |
| 6 | 		return CMPLXF(INFINITY, copysignf(0.0, cimagf(z))); | |
| 7 | 7 | 	return z; |
| 8 | 8 | } |
lib/libc/wasi/libc-top-half/musl/src/complex/cprojl.c+1-1| ... | ... | @@ -9,7 +9,7 @@ long double complex cprojl(long double complex z) |
| 9 | 9 | long double complex cprojl(long double complex z) |
| 10 | 10 | { |
| 11 | 11 | 	if (isinf(creall(z)) || isinf(cimagl(z))) |
| 12 | 		return CMPLXL(INFINITY, copysignl(0.0, creall(z))); | |
| 12 | 		return CMPLXL(INFINITY, copysignl(0.0, cimagl(z))); | |
| 13 | 13 | 	return z; |
| 14 | 14 | } |
| 15 | 15 | #endif |
lib/libc/wasi/libc-top-half/musl/src/ctype/nonspacing.h+60-58| ... | ... | @@ -1,23 +1,23 @@ |
| 1 | 16,16,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,16,16,32,16,16,16,33,34,35, | |
| 2 | 36,37,38,39,16,16,40,16,16,16,16,16,16,16,16,16,16,16,41,42,16,16,43,16,16,16, | |
| 1 | 16,16,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,16,33,16,16,16,34,35,36, | |
| 2 | 37,38,39,40,16,16,41,16,16,16,16,16,16,16,16,16,16,16,42,43,16,16,44,16,16,16, | |
| 3 | 3 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 4 | 4 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 5 | 5 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 6 | 6 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 7 | 16,16,16,16,16,16,16,16,16,16,44,16,45,46,47,48,16,16,16,16,16,16,16,16,16,16, | |
| 7 | 16,16,16,16,16,16,16,16,16,16,45,16,46,47,48,49,16,16,16,16,16,16,16,16,16,16, | |
| 8 | 8 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 9 | 16,16,16,16,16,16,16,50,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 10 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,51,16,16,52, | |
| 11 | 53,16,54,55,56,16,16,16,16,16,16,57,16,16,58,16,59,60,61,62,63,64,65,66,67,68, | |
| 12 | 69,70,16,71,72,73,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 13 | 16,74,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 9 | 14 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 10 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,49,16,16,50, | |
| 11 | 51,16,52,53,54,16,16,16,16,16,16,55,16,16,56,16,57,58,59,60,61,62,63,64,65,66, | |
| 12 | 67,68,16,69,70,71,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 13 | 16,72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 15 | 16,16,16,75,76,16,16,16,77,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 14 | 16 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 15 | 16,16,16,73,74,16,16,16,75,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 16 | 17 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 17 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 18 | 16,16,16,16,16,16,16,76,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 19 | 16,16,77,78,16,16,16,16,16,16,16,79,16,16,16,16,16,80,81,82,16,16,16,16,16,83, | |
| 20 | 84,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 18 | 16,16,16,16,16,16,16,78,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 19 | 16,16,79,80,16,16,16,16,16,16,16,81,16,16,16,16,16,82,83,84,16,16,16,16,16,85, | |
| 20 | 86,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | |
| 21 | 21 | 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, |
| 22 | 22 | 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, |
| 23 | 23 | 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, |
| ... | ... | @@ -35,55 +35,57 @@ |
| 35 | 35 | 242,7,128,127,0,0,0,0,0,0,0,0,0,0,0,0,242,31,0,63,0,0,0,0,0,0,0,0,0,3,0,0,160, |
| 36 | 36 | 2,0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,0,0,0,0,0,0,0,0, |
| 37 | 37 | 0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,0,0,0,0,0,0,0, |
| 38 | 0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0, | |
| 39 | 0,0,28,0,0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,15,32,0,0,0,0,0,120,0,0, | |
| 40 | 0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,1,4,14,0, | |
| 41 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,9,0,0,0,0,0,0,64,127, | |
| 42 | 229,31,248,159,0,0,0,0,0,0,255,127,0,0,0,0,0,0,0,0,15,0,0,0,0,0,208,23,4,0,0, | |
| 43 | 0,0,248,15,0,3,0,0,0,60,59,0,0,0,0,0,0,64,163,3,0,0,0,0,0,0,240,207,0,0,0,0,0, | |
| 44 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 45 | 0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255, | |
| 38 | 0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255, | |
| 39 | 255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 40 | 0,0,0,0,0,0,0,0,0,0,28,0,0,0,28,0,0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254, | |
| 41 | 15,32,0,0,0,0,0,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,0,0,0,0,0,0, | |
| 42 | 0,0,0,0,0,0,135,1,4,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 43 | 128,9,0,0,0,0,0,0,64,127,229,31,248,159,0,0,0,0,0,0,255,127,0,0,0,0,0,0,0,0, | |
| 44 | 15,0,0,0,0,0,208,23,4,0,0,0,0,248,15,0,3,0,0,0,60,59,0,0,0,0,0,0,64,163,3,0,0, | |
| 45 | 0,0,0,0,240,207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,255,253,33,16, | |
| 46 | 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255, | |
| 46 | 47 | 251,0,248,0,0,0,124,0,0,0,0,0,0,223,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255, |
| 47 | 48 | 255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,0,0,0, |
| 48 | 49 | 0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0, |
| 49 | 50 | 0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 50 | 51 | 0,0,0,128,247,63,0,0,0,192,0,0,0,0,0,0,0,0,0,0,3,0,68,8,0,0,96,0,0,0,0,0,0,0, |
| 51 | 52 | 0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,255,255,3,128,0,0,0,0,192,63,0,0,128,255,3,0, |
| 52 | 0,0,0,0,7,0,0,0,0,0,200,51,0,0,0,0,32,0,0,0,0,0,0,0,0,126,102,0,8,16,0,0,0,0, | |
| 53 | 0,16,0,0,0,0,0,0,157,193,2,0,0,0,0,48,64, | |
| 54 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,33,0,0,0,0,0,64, | |
| 55 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,255,255,0, | |
| 56 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 57 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 58 | 0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 59 | 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 60 | 0,110,240,0,0,0,0,0,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0, | |
| 61 | 0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 62 | 0,0,0,192,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,255, | |
| 63 | 127,0,0,0,0,0,0,128,3,0,0,0,0,0,120,38,0,32,0,0,0,0,0,0,7,0,0,0,128,239,31,0, | |
| 64 | 0,0,0,0,0,0,8,0,3,0,0,0,0,0,192,127,0,30,0,0,0,0,0,0,0,0,0,0,0,128,211,64,0,0, | |
| 65 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,248,7,0,0,3,0,0,0,0,0,0,24,1,0,0,0,192, | |
| 66 | 31,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,92,0,0,64,0,0,0,0,0, | |
| 67 | 0,0,0,0,0,248,133,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 68 | 0,60,176,1,0,0,48,0,0,0, | |
| 69 | 0,0,0,0,0,0,0,248,167,1,0,0,0,0,0,0,0,0,0,0,0,0,40,191,0,0,0,0,0,0,0,0,0,0,0, | |
| 70 | 0,224,188,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 71 | 128,255,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 72 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,12,1,0,0,0,254,7,0,0,0,0,248,121,128,0, | |
| 73 | 126,14,0,0,0,0,0,252,127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,191,0,0,0, | |
| 74 | 0,0,0,0,0,0,0,252,255,255,252,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,180,191,0, | |
| 75 | 0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 76 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,24, | |
| 77 | 0,0,0,0,0,0,0,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 78 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,127,0,0,0, | |
| 79 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0, | |
| 80 | 0,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,15, | |
| 81 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,248,255,231,15,0,0,0,60,0, | |
| 82 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 83 | 0,0,0,255,255,255,255,255,255,127,248,255,255,255,255,255,31,32,0,16,0,0,248, | |
| 84 | 254,255,0,0,0,0,0,0,0,0,0, | |
| 85 | 0,127,255,255,249,219,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 86 | 0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 87 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 88 | 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,240,7,0,0,0,0,0,0,0,0, | |
| 89 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 53 | 0,0,0,0,7,0,0,0,0,0,200,51,0,0,0,0,32,0,0, | |
| 54 | 0,0,0,0,0,0,126,102,0,8,16,0,0,0,0,0,16,0,0,0,0,0,0,157,193,2,0,0,0,0,48,64,0, | |
| 55 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,33,0,0,0,0,0,0,0,0, | |
| 56 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,0,0,0, | |
| 57 | 64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,255, | |
| 58 | 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0, | |
| 59 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 60 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 61 | 0,0,0,0,0,0,1,0,0, | |
| 62 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,240,0, | |
| 63 | 0,0,0,0,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,240,0,0, | |
| 64 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,1,0, | |
| 65 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,255,127,0,0,0,0,0,0,128, | |
| 66 | 3,0,0,0,0,0,120,38,0,32,0,0,0,0,0,0,7,0,0,0,128,239,31,0,0,0,0,0,0,0,8,0,3,0, | |
| 67 | 0,0,0,0,192,127,0,30,0,0,0,0,0,0,0,0,0,0,0,128,211,64,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 68 | 0,0,0,0,0,0,0,128,248,7,0,0,3,0,0,0,0,0,0,24,1,0,0,0,192,31,31,0,0,0,0,0,0,0, | |
| 69 | 0,0,0,0,0,0,0,0,0, | |
| 70 | 0,0,0,0,0,0,0,0,255,92,0,0,64,0,0,0,0,0,0,0,0,0,0,248,133,13,0,0,0,0,0,0,0,0, | |
| 71 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,176,1,0,0,48,0,0,0,0,0,0,0,0,0,0, | |
| 72 | 248,167,1,0,0,0,0,0,0,0,0,0,0,0,0,40,191,0,0,0,0,0,0,0,0,0,0,0,0,224,188,15,0, | |
| 73 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,6,0,0,0,0, | |
| 74 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 75 | 0,0,0,0,0,0,0,240,12,1,0,0,0,254,7,0,0,0,0,248,121,128,0,126,14,0,0,0,0,0,252, | |
| 76 | 127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,191,0,0,0,0,0,0,0,0,0,0,252,255, | |
| 77 | 255,252,109,0,0,0,0,0,0,0,0, | |
| 78 | 0,0,0,0,0,0,0,126,180,191,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 79 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,255, | |
| 80 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 81 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 82 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,128,7,0,0,0,0,0, | |
| 83 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,15,0,0,0,0,0,0,0,0,0, | |
| 84 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,248,255,231,15,0,0,0,60,0,0,0,0,0,0,0,0,0, | |
| 85 | 0,0,0,0,0,0,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, | |
| 86 | 255,255,255,255,127,248,255,255,255,255,255,31,32,0,16,0,0,248,254,255,0,0,0, | |
| 87 | 0,0,0,0,0,0,0,127,255,255,249,219,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 88 | 0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| 89 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0, | |
| 90 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,240,7,0,0, | |
| 91 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
lib/libc/wasi/libc-top-half/musl/src/env/__libc_start_main.c+2-1| ... | ... | @@ -69,7 +69,8 @@ weak_alias(libc_start_init, __libc_start_init); |
| 69 | 69 | typedef int lsm2_fn(int (*)(int,char **,char **), int, char **); |
| 70 | 70 | static lsm2_fn libc_start_main_stage2; |
| 71 | 71 | |
| 72 | int __libc_start_main(int (*main)(int,char **,char **), int argc, char **argv) | |
| 72 | int __libc_start_main(int (*main)(int,char **,char **), int argc, char **argv, | |
| 73 | 	void (*init_dummy)(), void(*fini_dummy)(), void(*ldso_dummy)()) | |
| 73 | 74 | { |
| 74 | 75 | 	char **envp = argv+argc+1; |
| 75 | 76 |
lib/libc/wasi/libc-top-half/musl/src/env/__stack_chk_fail.c+9| ... | ... | @@ -9,6 +9,15 @@ void __init_ssp(void *entropy) |
| 9 | 9 | 	if (entropy) memcpy(&__stack_chk_guard, entropy, sizeof(uintptr_t)); |
| 10 | 10 | 	else __stack_chk_guard = (uintptr_t)&__stack_chk_guard * 1103515245; |
| 11 | 11 | |
| 12 | #if UINTPTR_MAX >= 0xffffffffffffffff | |
| 13 | 	/* Sacrifice 8 bits of entropy on 64bit to prevent leaking/ | |
| 14 | 	 * overwriting the canary via string-manipulation functions. | |
| 15 | 	 * The NULL byte is on the second byte so that off-by-ones can | |
| 16 | 	 * still be detected. Endianness is taken care of | |
| 17 | 	 * automatically. */ | |
| 18 | 	((char *)&__stack_chk_guard)[1] = 0; | |
| 19 | #endif | |
| 20 | ||
| 12 | 21 | 	__pthread_self()->canary = __stack_chk_guard; |
| 13 | 22 | } |
| 14 | 23 |
lib/libc/wasi/libc-top-half/musl/src/errno/__strerror.h+6| ... | ... | @@ -124,6 +124,12 @@ E(ENOMEDIUM, "No medium found") |
| 124 | 124 | E(EMEDIUMTYPE, "Wrong medium type") |
| 125 | 125 | #endif |
| 126 | 126 | E(EMULTIHOP, "Multihop attempted") |
| 127 | #ifdef __wasilibc_unmodified_upstream // errno value not in WASI | |
| 128 | E(ENOKEY, "Required key not available") | |
| 129 | E(EKEYEXPIRED, "Key has expired") | |
| 130 | E(EKEYREVOKED, "Key has been revoked") | |
| 131 | E(EKEYREJECTED, "Key was rejected by service") | |
| 132 | #endif | |
| 127 | 133 | #ifdef __wasilibc_unmodified_upstream // errno value in WASI and not musl |
| 128 | 134 | #else |
| 129 | 135 | // WASI adds this errno code. |
lib/libc/wasi/libc-top-half/musl/src/fenv/powerpc/fenv-sf.c+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | #ifdef _SOFT_FLOAT | |
| 1 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) | |
| 2 | 2 | #include "../fenv.c" |
| 3 | 3 | #endif |
lib/libc/wasi/libc-top-half/musl/src/fenv/powerpc/fenv.S+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #ifndef _SOFT_FLOAT | |
| 1 | #if !defined(_SOFT_FLOAT) && !defined(__NO_FPRS__) | |
| 2 | 2 | .global feclearexcept |
| 3 | 3 | .type feclearexcept,@function |
| 4 | 4 | feclearexcept: |
lib/libc/wasi/libc-top-half/musl/src/include/stdlib.h+1| ... | ... | @@ -8,6 +8,7 @@ hidden void __env_rm_add(char *, char *); |
| 8 | 8 | hidden int __mkostemps(char *, int, int); |
| 9 | 9 | hidden int __ptsname_r(int, char *, size_t); |
| 10 | 10 | hidden char *__randname(char *); |
| 11 | hidden void __qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); | |
| 11 | 12 | |
| 12 | 13 | hidden void *__libc_malloc(size_t); |
| 13 | 14 | hidden void *__libc_malloc_impl(size_t); |
lib/libc/wasi/libc-top-half/musl/src/ldso/dl_iterate_phdr.c+2-1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | #include <elf.h> |
| 2 | 2 | #include <link.h> |
| 3 | #include "pthread_impl.h" | |
| 3 | 4 | #include "libc.h" |
| 4 | 5 | |
| 5 | 6 | #define AUX_CNT 38 |
| ... | ... | @@ -35,7 +36,7 @@ static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size |
| 35 | 36 | 	info.dlpi_subs = 0; |
| 36 | 37 | 	if (tls_phdr) { |
| 37 | 38 | 		info.dlpi_tls_modid = 1; |
| 38 | 		info.dlpi_tls_data = (void *)(base + tls_phdr->p_vaddr); | |
| 39 | 		info.dlpi_tls_data = __tls_get_addr((tls_mod_off_t[]){1,0}); | |
| 39 | 40 | 	} else { |
| 40 | 41 | 		info.dlpi_tls_modid = 0; |
| 41 | 42 | 		info.dlpi_tls_data = 0; |
lib/libc/wasi/libc-top-half/musl/src/legacy/cuserid.c+11-3| ... | ... | @@ -2,13 +2,21 @@ |
| 2 | 2 | #include <pwd.h> |
| 3 | 3 | #include <stdio.h> |
| 4 | 4 | #include <unistd.h> |
| 5 | #include <string.h> | |
| 5 | 6 | |
| 6 | 7 | char *cuserid(char *buf) |
| 7 | 8 | { |
| 9 | 	static char usridbuf[L_cuserid]; | |
| 8 | 10 | 	struct passwd pw, *ppw; |
| 9 | 11 | 	long pwb[256]; |
| 10 | 	if (getpwuid_r(geteuid(), &pw, (void *)pwb, sizeof pwb, &ppw)) | |
| 11 | 		return 0; | |
| 12 | 	snprintf(buf, L_cuserid, "%s", pw.pw_name); | |
| 12 | 	if (buf) *buf = 0; | |
| 13 | 	getpwuid_r(geteuid(), &pw, (void *)pwb, sizeof pwb, &ppw); | |
| 14 | 	if (!ppw) | |
| 15 | 		return buf; | |
| 16 | 	size_t len = strnlen(pw.pw_name, L_cuserid); | |
| 17 | 	if (len == L_cuserid) | |
| 18 | 		return buf; | |
| 19 | 	if (!buf) buf = usridbuf; | |
| 20 | 	memcpy(buf, pw.pw_name, len+1); | |
| 13 | 21 | 	return buf; |
| 14 | 22 | } |
lib/libc/wasi/libc-top-half/musl/src/linux/epoll.c+2-2| ... | ... | @@ -24,9 +24,9 @@ int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev) |
| 24 | 24 | |
| 25 | 25 | int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs) |
| 26 | 26 | { |
| 27 | 	int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8); | |
| 27 | 	int r = __syscall_cp(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8); | |
| 28 | 28 | #ifdef SYS_epoll_wait |
| 29 | 	if (r==-ENOSYS && !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to); | |
| 29 | 	if (r==-ENOSYS && !sigs) r = __syscall_cp(SYS_epoll_wait, fd, ev, cnt, to); | |
| 30 | 30 | #endif |
| 31 | 31 | 	return __syscall_ret(r); |
| 32 | 32 | } |
lib/libc/wasi/libc-top-half/musl/src/locale/dcngettext.c+3| ... | ... | @@ -132,6 +132,9 @@ char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, |
| 132 | 132 | 	struct binding *q; |
| 133 | 133 | 	int old_errno = errno; |
| 134 | 134 | |
| 135 | 	/* match gnu gettext behaviour */ | |
| 136 | 	if (!msgid1) goto notrans; | |
| 137 | ||
| 135 | 138 | 	if ((unsigned)category >= LC_ALL) goto notrans; |
| 136 | 139 | |
| 137 | 140 | 	if (!domainname) domainname = __gettextdomain(); |
lib/libc/wasi/libc-top-half/musl/src/locale/duplocale.c+5| ... | ... | @@ -3,6 +3,11 @@ |
| 3 | 3 | #include "locale_impl.h" |
| 4 | 4 | #include "libc.h" |
| 5 | 5 | |
| 6 | #define malloc __libc_malloc | |
| 7 | #define calloc undef | |
| 8 | #define realloc undef | |
| 9 | #define free undef | |
| 10 | ||
| 6 | 11 | locale_t __duplocale(locale_t old) |
| 7 | 12 | { |
| 8 | 13 | 	locale_t new = malloc(sizeof *new); |
lib/libc/wasi/libc-top-half/musl/src/locale/strtod_l.c created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | #define _GNU_SOURCE | |
| 2 | #include <stdlib.h> | |
| 3 | #include <locale.h> | |
| 4 | ||
| 5 | float strtof_l(const char *restrict s, char **restrict p, locale_t l) | |
| 6 | { | |
| 7 | 	return strtof(s, p); | |
| 8 | } | |
| 9 | ||
| 10 | double strtod_l(const char *restrict s, char **restrict p, locale_t l) | |
| 11 | { | |
| 12 | 	return strtod(s, p); | |
| 13 | } | |
| 14 | ||
| 15 | long double strtold_l(const char *restrict s, char **restrict p, locale_t l) | |
| 16 | { | |
| 17 | 	return strtold(s, p); | |
| 18 | } | |
| 19 | ||
| 20 | weak_alias(strtof_l, __strtof_l); | |
| 21 | weak_alias(strtod_l, __strtod_l); | |
| 22 | weak_alias(strtold_l, __strtold_l); |
lib/libc/wasi/libc-top-half/musl/src/malloc/free.c+1-1| ... | ... | @@ -2,5 +2,5 @@ |
| 2 | 2 | |
| 3 | 3 | void free(void *p) |
| 4 | 4 | { |
| 5 | 	return __libc_free(p); | |
| 5 | 	__libc_free(p); | |
| 6 | 6 | } |
lib/libc/wasi/libc-top-half/musl/src/malloc/mallocng/aligned_alloc.c+3| ... | ... | @@ -22,6 +22,9 @@ void *aligned_alloc(size_t align, size_t len) |
| 22 | 22 | 	if (align <= UNIT) align = UNIT; |
| 23 | 23 | |
| 24 | 24 | 	unsigned char *p = malloc(len + align - UNIT); |
| 25 | 	if (!p) | |
| 26 | 		return 0; | |
| 27 | ||
| 25 | 28 | 	struct meta *g = get_meta(p); |
| 26 | 29 | 	int idx = get_slot_index(p); |
| 27 | 30 | 	size_t stride = get_stride(g); |
lib/libc/wasi/libc-top-half/musl/src/malloc/mallocng/free.c+10-2| ... | ... | @@ -119,7 +119,11 @@ void free(void *p) |
| 119 | 119 | 	if (((uintptr_t)(start-1) ^ (uintptr_t)end) >= 2*PGSZ && g->last_idx) { |
| 120 | 120 | 		unsigned char *base = start + (-(uintptr_t)start & (PGSZ-1)); |
| 121 | 121 | 		size_t len = (end-base) & -PGSZ; |
| 122 | 		if (len) madvise(base, len, MADV_FREE); | |
| 122 | 		if (len) { | |
| 123 | 			int e = errno; | |
| 124 | 			madvise(base, len, MADV_FREE); | |
| 125 | 			errno = e; | |
| 126 | 		} | |
| 123 | 127 | 	} |
| 124 | 128 | |
| 125 | 129 | 	// atomic free without locking if this is neither first or last slot |
| ... | ... | @@ -139,5 +143,9 @@ void free(void *p) |
| 139 | 143 | 	wrlock(); |
| 140 | 144 | 	struct mapinfo mi = nontrivial_free(g, idx); |
| 141 | 145 | 	unlock(); |
| 142 | 	if (mi.len) munmap(mi.base, mi.len); | |
| 146 | 	if (mi.len) { | |
| 147 | 		int e = errno; | |
| 148 | 		munmap(mi.base, mi.len); | |
| 149 | 		errno = e; | |
| 150 | 	} | |
| 143 | 151 | } |
lib/libc/wasi/libc-top-half/musl/src/malloc/oldmalloc/malloc.c+5-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | #include "malloc_impl.h" |
| 12 | 12 | #include "fork_impl.h" |
| 13 | 13 | |
| 14 | #define malloc __libc_malloc | |
| 14 | #define malloc __libc_malloc_impl | |
| 15 | 15 | #define realloc __libc_realloc |
| 16 | 16 | #define free __libc_free |
| 17 | 17 | |
| ... | ... | @@ -481,12 +481,14 @@ void __bin_chunk(struct chunk *self) |
| 481 | 481 | 	if (size > RECLAIM && (size^(size-osize)) > size-osize) { |
| 482 | 482 | 		uintptr_t a = (uintptr_t)self + SIZE_ALIGN+PAGE_SIZE-1 & -PAGE_SIZE; |
| 483 | 483 | 		uintptr_t b = (uintptr_t)next - SIZE_ALIGN & -PAGE_SIZE; |
| 484 | 		int e = errno; | |
| 484 | 485 | #if 1 |
| 485 | 486 | 		__madvise((void *)a, b-a, MADV_DONTNEED); |
| 486 | 487 | #else |
| 487 | 488 | 		__mmap((void *)a, b-a, PROT_READ|PROT_WRITE, |
| 488 | 489 | 			MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); |
| 489 | 490 | #endif |
| 491 | 		errno = e; | |
| 490 | 492 | 	} |
| 491 | 493 | |
| 492 | 494 | 	unlock_bin(i); |
| ... | ... | @@ -499,7 +501,9 @@ static void unmap_chunk(struct chunk *self) |
| 499 | 501 | 	size_t len = CHUNK_SIZE(self) + extra; |
| 500 | 502 | 	/* Crash on double free */ |
| 501 | 503 | 	if (extra & 1) a_crash(); |
| 504 | 	int e = errno; | |
| 502 | 505 | 	__munmap(base, len); |
| 506 | 	errno = e; | |
| 503 | 507 | } |
| 504 | 508 | |
| 505 | 509 | void free(void *p) |
lib/libc/wasi/libc-top-half/musl/src/math/acoshf.c+4-4| ... | ... | @@ -15,12 +15,12 @@ float acoshf(float x) |
| 15 | 15 | 	uint32_t a = u.i & 0x7fffffff; |
| 16 | 16 | |
| 17 | 17 | 	if (a < 0x3f800000+(1<<23)) |
| 18 | 		/* |x| < 2, invalid if x < 1 or nan */ | |
| 18 | 		/* |x| < 2, invalid if x < 1 */ | |
| 19 | 19 | 		/* up to 2ulp error in [1,1.125] */ |
| 20 | 20 | 		return log1pf(x-1 + sqrtf((x-1)*(x-1)+2*(x-1))); |
| 21 | 	if (a < 0x3f800000+(12<<23)) | |
| 22 | 		/* |x| < 0x1p12 */ | |
| 21 | 	if (u.i < 0x3f800000+(12<<23)) | |
| 22 | 		/* 2 <= x < 0x1p12 */ | |
| 23 | 23 | 		return logf(2*x - 1/(x+sqrtf(x*x-1))); |
| 24 | 	/* x >= 0x1p12 */ | |
| 24 | 	/* x >= 0x1p12 or x <= -2 or nan */ | |
| 25 | 25 | 	return logf(x) + 0.693147180559945309417232121458176568f; |
| 26 | 26 | } |
lib/libc/wasi/libc-top-half/musl/src/math/expm1f.c+1-2| ... | ... | @@ -16,7 +16,6 @@ |
| 16 | 16 | #include "libm.h" |
| 17 | 17 | |
| 18 | 18 | static const float |
| 19 | o_threshold = 8.8721679688e+01, /* 0x42b17180 */ | |
| 20 | 19 | ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ |
| 21 | 20 | ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ |
| 22 | 21 | invln2 = 1.4426950216e+00, /* 0x3fb8aa3b */ |
| ... | ... | @@ -41,7 +40,7 @@ float expm1f(float x) |
| 41 | 40 | 			return x; |
| 42 | 41 | 		if (sign) |
| 43 | 42 | 			return -1; |
| 44 | 		if (x > o_threshold) { | |
| 43 | 		if (hx > 0x42b17217) { /* x > log(FLT_MAX) */ | |
| 45 | 44 | 			x *= 0x1p127f; |
| 46 | 45 | 			return x; |
| 47 | 46 | 		} |
lib/libc/wasi/libc-top-half/musl/src/math/fmaf.c+10-15| ... | ... | @@ -77,21 +77,16 @@ float fmaf(float x, float y, float z) |
| 77 | 77 | 	 * If result is inexact, and exactly halfway between two float values, |
| 78 | 78 | 	 * we need to adjust the low-order bit in the direction of the error. |
| 79 | 79 | 	 */ |
| 80 | #ifdef FE_TOWARDZERO | |
| 81 | 	fesetround(FE_TOWARDZERO); | |
| 82 | #endif | |
| 83 | #ifdef __wasilibc_unmodified_upstream // WASI doesn't need old GCC workarounds | |
| 84 | 	volatile double vxy = xy; /* XXX work around gcc CSE bug */ | |
| 85 | #else | |
| 86 | 	double vxy = xy; | |
| 87 | #endif | |
| 88 | 	double adjusted_result = vxy + z; | |
| 89 | 	fesetround(FE_TONEAREST); | |
| 90 | 	if (result == adjusted_result) { | |
| 91 | 		u.f = adjusted_result; | |
| 80 | 	double err; | |
| 81 | 	int neg = u.i >> 63; | |
| 82 | 	if (neg == (z > xy)) | |
| 83 | 		err = xy - result + z; | |
| 84 | 	else | |
| 85 | 		err = z - result + xy; | |
| 86 | 	if (neg == (err < 0)) | |
| 92 | 87 | 		u.i++; |
| 93 | 		adjusted_result = u.f; | |
| 94 | 	} | |
| 95 | 	z = adjusted_result; | |
| 88 | 	else | |
| 89 | 		u.i--; | |
| 90 | 	z = u.f; | |
| 96 | 91 | 	return z; |
| 97 | 92 | } |
lib/libc/wasi/libc-top-half/musl/src/math/powerpc/fabs.c+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | #include <math.h> |
| 2 | 2 | |
| 3 | #if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM) | |
| 3 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) || defined(BROKEN_PPC_D_ASM) | |
| 4 | 4 | |
| 5 | 5 | #include "../fabs.c" |
| 6 | 6 |
lib/libc/wasi/libc-top-half/musl/src/math/powerpc/fabsf.c+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | #include <math.h> |
| 2 | 2 | |
| 3 | #ifdef _SOFT_FLOAT | |
| 3 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) | |
| 4 | 4 | |
| 5 | 5 | #include "../fabsf.c" |
| 6 | 6 |
lib/libc/wasi/libc-top-half/musl/src/math/powerpc/fma.c+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | #include <math.h> |
| 2 | 2 | |
| 3 | #if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM) | |
| 3 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) || defined(BROKEN_PPC_D_ASM) | |
| 4 | 4 | |
| 5 | 5 | #include "../fma.c" |
| 6 | 6 |
lib/libc/wasi/libc-top-half/musl/src/math/powerpc/fmaf.c+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | #include <math.h> |
| 2 | 2 | |
| 3 | #ifdef _SOFT_FLOAT | |
| 3 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) | |
| 4 | 4 | |
| 5 | 5 | #include "../fmaf.c" |
| 6 | 6 |
lib/libc/wasi/libc-top-half/musl/src/misc/ioctl.c+7-2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | #include <stddef.h> |
| 7 | 7 | #include <stdint.h> |
| 8 | 8 | #include <string.h> |
| 9 | #include <endian.h> | |
| 9 | 10 | #include "syscall.h" |
| 10 | 11 | |
| 11 | 12 | #define alignof(t) offsetof(struct { char c; t x; }, x) |
| ... | ... | @@ -53,7 +54,7 @@ static const struct ioctl_compat_map compat_map[] = { |
| 53 | 54 | 	{ _IOWR('A', 0x23, char[136]), _IOWR('A', 0x23, char[132]), 0, WR, 1, 0 }, |
| 54 | 55 | 	{ 0, 0, 4, WR, 1, 0 }, /* snd_pcm_sync_ptr (flags only) */ |
| 55 | 56 | 	{ 0, 0, 32, WR, 1, OFFS(8,12,16,24,28) }, /* snd_pcm_mmap_status */ |
| 56 | 	{ 0, 0, 8, WR, 1, OFFS(0,4) }, /* snd_pcm_mmap_control */ | |
| 57 | 	{ 0, 0, 4, WR, 1, 0 }, /* snd_pcm_mmap_control (each member) */ | |
| 57 | 58 | |
| 58 | 59 | 	/* VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF, VIDIOC_PREPARE_BUF */ |
| 59 | 60 | 	{ _IOWR('V', 9, new_misaligned(68)), _IOWR('V', 9, char[68]), 68, WR, 1, OFFS(20, 24) }, |
| ... | ... | @@ -90,7 +91,11 @@ static void convert_ioctl_struct(const struct ioctl_compat_map *map, char *old, |
| 90 | 91 | 		 * if another exception appears this needs changing. */ |
| 91 | 92 | 		convert_ioctl_struct(map+1, old, new, dir); |
| 92 | 93 | 		convert_ioctl_struct(map+2, old+4, new+8, dir); |
| 93 | 		convert_ioctl_struct(map+3, old+68, new+72, dir); | |
| 94 | 		/* snd_pcm_mmap_control, special-cased due to kernel | |
| 95 | 		 * type definition having been botched. */ | |
| 96 | 		int adj = BYTE_ORDER==BIG_ENDIAN ? 4 : 0; | |
| 97 | 		convert_ioctl_struct(map+3, old+68, new+72+adj, dir); | |
| 98 | 		convert_ioctl_struct(map+3, old+72, new+76+3*adj, dir); | |
| 94 | 99 | 		return; |
| 95 | 100 | 	} |
| 96 | 101 | 	for (int i=0; i < map->noffs; i++) { |
lib/libc/wasi/libc-top-half/musl/src/passwd/nscd_query.c+9-1| ... | ... | @@ -40,7 +40,15 @@ retry: |
| 40 | 40 | 	buf[0] = NSCDVERSION; |
| 41 | 41 | |
| 42 | 42 | 	fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); |
| 43 | 	if (fd < 0) return NULL; | |
| 43 | 	if (fd < 0) { | |
| 44 | 		if (errno == EAFNOSUPPORT) { | |
| 45 | 			f = fopen("/dev/null", "re"); | |
| 46 | 			if (f) | |
| 47 | 				errno = errno_save; | |
| 48 | 			return f; | |
| 49 | 		} | |
| 50 | 		return 0; | |
| 51 | 	} | |
| 44 | 52 | |
| 45 | 53 | 	if(!(f = fdopen(fd, "r"))) { |
| 46 | 54 | 		close(fd); |
lib/libc/wasi/libc-top-half/musl/src/process/fdop.h+5| ... | ... | @@ -10,3 +10,8 @@ struct fdop { |
| 10 | 10 | 	mode_t mode; |
| 11 | 11 | 	char path[]; |
| 12 | 12 | }; |
| 13 | ||
| 14 | #define malloc __libc_malloc | |
| 15 | #define calloc __libc_calloc | |
| 16 | #define realloc undef | |
| 17 | #define free __libc_free |
lib/libc/wasi/libc-top-half/musl/src/process/posix_spawn_file_actions_addclose.c+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *fa, int fd) |
| 7 | 7 | { |
| 8 | 	if (fd < 0) return EBADF; | |
| 8 | 9 | 	struct fdop *op = malloc(sizeof *op); |
| 9 | 10 | 	if (!op) return ENOMEM; |
| 10 | 11 | 	op->cmd = FDOP_CLOSE; |
lib/libc/wasi/libc-top-half/musl/src/process/posix_spawn_file_actions_adddup2.c+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *fa, int srcfd, int fd) |
| 7 | 7 | { |
| 8 | 	if (srcfd < 0 || fd < 0) return EBADF; | |
| 8 | 9 | 	struct fdop *op = malloc(sizeof *op); |
| 9 | 10 | 	if (!op) return ENOMEM; |
| 10 | 11 | 	op->cmd = FDOP_DUP2; |
lib/libc/wasi/libc-top-half/musl/src/process/posix_spawn_file_actions_addfchdir.c+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *fa, int fd) |
| 8 | 8 | { |
| 9 | 	if (fd < 0) return EBADF; | |
| 9 | 10 | 	struct fdop *op = malloc(sizeof *op); |
| 10 | 11 | 	if (!op) return ENOMEM; |
| 11 | 12 | 	op->cmd = FDOP_FCHDIR; |
lib/libc/wasi/libc-top-half/musl/src/process/posix_spawn_file_actions_addopen.c+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *restrict fa, int fd, const char *restrict path, int flags, mode_t mode) |
| 8 | 8 | { |
| 9 | 	if (fd < 0) return EBADF; | |
| 9 | 10 | 	struct fdop *op = malloc(sizeof *op + strlen(path) + 1); |
| 10 | 11 | 	if (!op) return ENOMEM; |
| 11 | 12 | 	op->cmd = FDOP_OPEN; |
lib/libc/wasi/libc-top-half/musl/src/setjmp/powerpc/longjmp.S+31-1| ... | ... | @@ -37,7 +37,37 @@ longjmp: |
| 37 | 37 | 	lwz 29, 72(3) |
| 38 | 38 | 	lwz 30, 76(3) |
| 39 | 39 | 	lwz 31, 80(3) |
| 40 | #ifndef _SOFT_FLOAT | |
| 40 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) | |
| 41 | 	mflr 0 | |
| 42 | 	bl 1f | |
| 43 | 	.hidden __hwcap | |
| 44 | 	.long __hwcap-. | |
| 45 | 1:	mflr 4 | |
| 46 | 	lwz 5, 0(4) | |
| 47 | 	lwzx 4, 4, 5 | |
| 48 | 	andis. 4, 4, 0x80 | |
| 49 | 	beq 1f | |
| 50 | 	.long 0x11c35b01 /* evldd 14,88(3) */ | |
| 51 | 	.long 0x11e36301 /* ... */ | |
| 52 | 	.long 0x12036b01 | |
| 53 | 	.long 0x12237301 | |
| 54 | 	.long 0x12437b01 | |
| 55 | 	.long 0x12638301 | |
| 56 | 	.long 0x12838b01 | |
| 57 | 	.long 0x12a39301 | |
| 58 | 	.long 0x12c39b01 | |
| 59 | 	.long 0x12e3a301 | |
| 60 | 	.long 0x1303ab01 | |
| 61 | 	.long 0x1323b301 | |
| 62 | 	.long 0x1343bb01 | |
| 63 | 	.long 0x1363c301 | |
| 64 | 	.long 0x1383cb01 | |
| 65 | 	.long 0x13a3d301 | |
| 66 | 	.long 0x13c3db01 | |
| 67 | 	.long 0x13e3e301 /* evldd 31,224(3) */ | |
| 68 | 	.long 0x11a3eb01 /* evldd 13,232(3) */ | |
| 69 | 1:	mtlr 0 | |
| 70 | #else | |
| 41 | 71 | 	lfd 14,88(3) |
| 42 | 72 | 	lfd 15,96(3) |
| 43 | 73 | 	lfd 16,104(3) |
lib/libc/wasi/libc-top-half/musl/src/setjmp/powerpc/setjmp.S+31-1| ... | ... | @@ -37,7 +37,37 @@ setjmp: |
| 37 | 37 | 	stw 29, 72(3) |
| 38 | 38 | 	stw 30, 76(3) |
| 39 | 39 | 	stw 31, 80(3) |
| 40 | #ifndef _SOFT_FLOAT | |
| 40 | #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) | |
| 41 | 	mflr 0 | |
| 42 | 	bl 1f | |
| 43 | 	.hidden __hwcap | |
| 44 | 	.long __hwcap-. | |
| 45 | 1:	mflr 4 | |
| 46 | 	lwz 5, 0(4) | |
| 47 | 	lwzx 4, 4, 5 | |
| 48 | 	andis. 4, 4, 0x80 | |
| 49 | 	beq 1f | |
| 50 | 	.long 0x11c35b21 /* evstdd 14,88(3) */ | |
| 51 | 	.long 0x11e36321 /* ... */ | |
| 52 | 	.long 0x12036b21 | |
| 53 | 	.long 0x12237321 | |
| 54 | 	.long 0x12437b21 | |
| 55 | 	.long 0x12638321 | |
| 56 | 	.long 0x12838b21 | |
| 57 | 	.long 0x12a39321 | |
| 58 | 	.long 0x12c39b21 | |
| 59 | 	.long 0x12e3a321 | |
| 60 | 	.long 0x1303ab21 | |
| 61 | 	.long 0x1323b321 | |
| 62 | 	.long 0x1343bb21 | |
| 63 | 	.long 0x1363c321 | |
| 64 | 	.long 0x1383cb21 | |
| 65 | 	.long 0x13a3d321 | |
| 66 | 	.long 0x13c3db21 | |
| 67 | 	.long 0x13e3e321 /* evstdd 31,224(3) */ | |
| 68 | 	.long 0x11a3eb21 /* evstdd 13,232(3) */ | |
| 69 | 1:	mtlr 0 | |
| 70 | #else | |
| 41 | 71 | 	stfd 14,88(3) |
| 42 | 72 | 	stfd 15,96(3) |
| 43 | 73 | 	stfd 16,104(3) |
lib/libc/wasi/libc-top-half/musl/src/signal/block.c+2-2| ... | ... | @@ -3,9 +3,9 @@ |
| 3 | 3 | #include <signal.h> |
| 4 | 4 | |
| 5 | 5 | static const unsigned long all_mask[] = { |
| 6 | #if ULONG_MAX == 0xffffffff && _NSIG == 129 | |
| 6 | #if ULONG_MAX == 0xffffffff && _NSIG > 65 | |
| 7 | 7 | 	-1UL, -1UL, -1UL, -1UL |
| 8 | #elif ULONG_MAX == 0xffffffff | |
| 8 | #elif ULONG_MAX == 0xffffffff || _NSIG > 65 | |
| 9 | 9 | 	-1UL, -1UL |
| 10 | 10 | #else |
| 11 | 11 | 	-1UL |
lib/libc/wasi/libc-top-half/musl/src/stat/futimesat.c+9| ... | ... | @@ -2,7 +2,9 @@ |
| 2 | 2 | #include <sys/time.h> |
| 3 | 3 | #include <sys/stat.h> |
| 4 | 4 | #include <errno.h> |
| 5 | #ifdef __wasilibc_unmodified_upstream // WASI has no syscall | |
| 5 | 6 | #include "syscall.h" |
| 7 | #endif | |
| 6 | 8 | |
| 7 | 9 | int __futimesat(int dirfd, const char *pathname, const struct timeval times[2]) |
| 8 | 10 | { |
| ... | ... | @@ -10,8 +12,15 @@ int __futimesat(int dirfd, const char *pathname, const struct timeval times[2]) |
| 10 | 12 | 	if (times) { |
| 11 | 13 | 		int i; |
| 12 | 14 | 		for (i=0; i<2; i++) { |
| 15 | #ifdef __wasilibc_unmodified_upstream // WASI has no syscall | |
| 13 | 16 | 			if (times[i].tv_usec >= 1000000ULL) |
| 14 | 17 | 				return __syscall_ret(-EINVAL); |
| 18 | #else | |
| 19 | 			if (times[i].tv_usec >= 1000000ULL) { | |
| 20 | 				errno = EINVAL; | |
| 21 | 				return -1; | |
| 22 | 			} | |
| 23 | #endif | |
| 15 | 24 | 			ts[i].tv_sec = times[i].tv_sec; |
| 16 | 25 | 			ts[i].tv_nsec = times[i].tv_usec * 1000; |
| 17 | 26 | 		} |
lib/libc/wasi/libc-top-half/musl/src/stdio/fgetws.c+1-6| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | #include "stdio_impl.h" |
| 2 | 2 | #include <wchar.h> |
| 3 | #include <errno.h> | |
| 4 | 3 | |
| 5 | 4 | wint_t __fgetwc_unlocked(FILE *); |
| 6 | 5 | |
| ... | ... | @@ -12,10 +11,6 @@ wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f) |
| 12 | 11 | |
| 13 | 12 | 	FLOCK(f); |
| 14 | 13 | |
| 15 | 	/* Setup a dummy errno so we can detect EILSEQ. This is | |
| 16 | 	 * the only way to catch encoding errors in the form of a | |
| 17 | 	 * partial character just before EOF. */ | |
| 18 | 	errno = EAGAIN; | |
| 19 | 14 | 	for (; n; n--) { |
| 20 | 15 | 		wint_t c = __fgetwc_unlocked(f); |
| 21 | 16 | 		if (c == WEOF) break; |
| ... | ... | @@ -23,7 +18,7 @@ wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f) |
| 23 | 18 | 		if (c == '\n') break; |
| 24 | 19 | 	} |
| 25 | 20 | 	*p = 0; |
| 26 | 	if (ferror(f) || errno==EILSEQ) p = s; | |
| 21 | 	if (ferror(f)) p = s; | |
| 27 | 22 | |
| 28 | 23 | 	FUNLOCK(f); |
| 29 | 24 |
lib/libc/wasi/libc-top-half/musl/src/stdio/fseek.c+7| ... | ... | @@ -1,7 +1,14 @@ |
| 1 | 1 | #include "stdio_impl.h" |
| 2 | #include <errno.h> | |
| 2 | 3 | |
| 3 | 4 | int __fseeko_unlocked(FILE *f, off_t off, int whence) |
| 4 | 5 | { |
| 6 | 	/* Fail immediately for invalid whence argument. */ | |
| 7 | 	if (whence != SEEK_CUR && whence != SEEK_SET && whence != SEEK_END) { | |
| 8 | 		errno = EINVAL; | |
| 9 | 		return -1; | |
| 10 | 	} | |
| 11 | ||
| 5 | 12 | 	/* Adjust relative offset for unread data in buffer, if any. */ |
| 6 | 13 | 	if (whence == SEEK_CUR && f->rend) off -= f->rend - f->rpos; |
| 7 | 14 |
lib/libc/wasi/libc-top-half/musl/src/stdio/getdelim.c+5-3| ... | ... | @@ -55,9 +55,11 @@ ssize_t getdelim(char **restrict s, size_t *restrict n, int delim, FILE *restric |
| 55 | 55 | 			*s = tmp; |
| 56 | 56 | 			*n = m; |
| 57 | 57 | 		} |
| 58 | 		memcpy(*s+i, f->rpos, k); | |
| 59 | 		f->rpos += k; | |
| 60 | 		i += k; | |
| 58 | 		if (k) { | |
| 59 | 			memcpy(*s+i, f->rpos, k); | |
| 60 | 			f->rpos += k; | |
| 61 | 			i += k; | |
| 62 | 		} | |
| 61 | 63 | 		if (z) break; |
| 62 | 64 | 		if ((c = getc_unlocked(f)) == EOF) { |
| 63 | 65 | 			if (!i || !feof(f)) { |
lib/libc/wasi/libc-top-half/musl/src/stdio/popen.c+6-18| ... | ... | @@ -31,25 +31,12 @@ FILE *popen(const char *cmd, const char *mode) |
| 31 | 31 | 		__syscall(SYS_close, p[1]); |
| 32 | 32 | 		return NULL; |
| 33 | 33 | 	} |
| 34 | 	FLOCK(f); | |
| 35 | ||
| 36 | 	/* If the child's end of the pipe happens to already be on the final | |
| 37 | 	 * fd number to which it will be assigned (either 0 or 1), it must | |
| 38 | 	 * be moved to a different fd. Otherwise, there is no safe way to | |
| 39 | 	 * remove the close-on-exec flag in the child without also creating | |
| 40 | 	 * a file descriptor leak race condition in the parent. */ | |
| 41 | 	if (p[1-op] == 1-op) { | |
| 42 | 		int tmp = fcntl(1-op, F_DUPFD_CLOEXEC, 0); | |
| 43 | 		if (tmp < 0) { | |
| 44 | 			e = errno; | |
| 45 | 			goto fail; | |
| 46 | 		} | |
| 47 | 		__syscall(SYS_close, p[1-op]); | |
| 48 | 		p[1-op] = tmp; | |
| 49 | 	} | |
| 50 | 34 | |
| 51 | 35 | 	e = ENOMEM; |
| 52 | 36 | 	if (!posix_spawn_file_actions_init(&fa)) { |
| 37 | 		for (FILE *l = *__ofl_lock(); l; l=l->next) | |
| 38 | 			if (l->pipe_pid && posix_spawn_file_actions_addclose(&fa, l->fd)) | |
| 39 | 				goto fail; | |
| 53 | 40 | 		if (!posix_spawn_file_actions_adddup2(&fa, p[1-op], 1-op)) { |
| 54 | 41 | 			if (!(e = posix_spawn(&pid, "/bin/sh", &fa, 0, |
| 55 | 42 | 			 (char *[]){ "sh", "-c", (char *)cmd, 0 }, __environ))) { |
| ... | ... | @@ -58,13 +45,14 @@ FILE *popen(const char *cmd, const char *mode) |
| 58 | 45 | 				if (!strchr(mode, 'e')) |
| 59 | 46 | 					fcntl(p[op], F_SETFD, 0); |
| 60 | 47 | 				__syscall(SYS_close, p[1-op]); |
| 61 | 				FUNLOCK(f); | |
| 48 | 				__ofl_unlock(); | |
| 62 | 49 | 				return f; |
| 63 | 50 | 			} |
| 64 | 51 | 		} |
| 52 | fail: | |
| 53 | 		__ofl_unlock(); | |
| 65 | 54 | 		posix_spawn_file_actions_destroy(&fa); |
| 66 | 55 | 	} |
| 67 | fail: | |
| 68 | 56 | 	fclose(f); |
| 69 | 57 | 	__syscall(SYS_close, p[1-op]); |
| 70 | 58 |
lib/libc/wasi/libc-top-half/musl/src/stdlib/qsort.c+20-17| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | /* Smoothsort, an adaptive variant of Heapsort. Memory usage: O(1). |
| 25 | 25 | Run time: Worst case O(n log n), close to O(n) in the mostly-sorted case. */ |
| 26 | 26 | |
| 27 | #define _BSD_SOURCE | |
| 27 | 28 | #include <stdint.h> |
| 28 | 29 | #include <stdlib.h> |
| 29 | 30 | #include <string.h> |
| ... | ... | @@ -31,7 +32,7 @@ |
| 31 | 32 | #include "atomic.h" |
| 32 | 33 | #define ntz(x) a_ctz_l((x)) |
| 33 | 34 | |
| 34 | typedef int (*cmpfun)(const void *, const void *); | |
| 35 | typedef int (*cmpfun)(const void *, const void *, void *); | |
| 35 | 36 | |
| 36 | 37 | static inline int pntz(size_t p[2]) { |
| 37 | 38 | 	int r = ntz(p[0] - 1); |
| ... | ... | @@ -88,7 +89,7 @@ static inline void shr(size_t p[2], int n) |
| 88 | 89 | 	p[1] >>= n; |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size_t lp[]) | |
| 92 | static void sift(unsigned char *head, size_t width, cmpfun cmp, void *arg, int pshift, size_t lp[]) | |
| 92 | 93 | { |
| 93 | 94 | 	unsigned char *rt, *lf; |
| 94 | 95 | 	unsigned char *ar[14 * sizeof(size_t) + 1]; |
| ... | ... | @@ -99,10 +100,10 @@ static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size |
| 99 | 100 | 		rt = head - width; |
| 100 | 101 | 		lf = head - width - lp[pshift - 2]; |
| 101 | 102 | |
| 102 | 		if((*cmp)(ar[0], lf) >= 0 && (*cmp)(ar[0], rt) >= 0) { | |
| 103 | 		if(cmp(ar[0], lf, arg) >= 0 && cmp(ar[0], rt, arg) >= 0) { | |
| 103 | 104 | 			break; |
| 104 | 105 | 		} |
| 105 | 		if((*cmp)(lf, rt) >= 0) { | |
| 106 | 		if(cmp(lf, rt, arg) >= 0) { | |
| 106 | 107 | 			ar[i++] = lf; |
| 107 | 108 | 			head = lf; |
| 108 | 109 | 			pshift -= 1; |
| ... | ... | @@ -115,7 +116,7 @@ static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size |
| 115 | 116 | 	cycle(width, ar, i); |
| 116 | 117 | } |
| 117 | 118 | |
| 118 | static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2], int pshift, int trusty, size_t lp[]) | |
| 119 | static void trinkle(unsigned char *head, size_t width, cmpfun cmp, void *arg, size_t pp[2], int pshift, int trusty, size_t lp[]) | |
| 119 | 120 | { |
| 120 | 121 | 	unsigned char *stepson, |
| 121 | 122 | 	 *rt, *lf; |
| ... | ... | @@ -130,13 +131,13 @@ static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2], |
| 130 | 131 | 	ar[0] = head; |
| 131 | 132 | 	while(p[0] != 1 || p[1] != 0) { |
| 132 | 133 | 		stepson = head - lp[pshift]; |
| 133 | 		if((*cmp)(stepson, ar[0]) <= 0) { | |
| 134 | 		if(cmp(stepson, ar[0], arg) <= 0) { | |
| 134 | 135 | 			break; |
| 135 | 136 | 		} |
| 136 | 137 | 		if(!trusty && pshift > 1) { |
| 137 | 138 | 			rt = head - width; |
| 138 | 139 | 			lf = head - width - lp[pshift - 2]; |
| 139 | 			if((*cmp)(rt, stepson) >= 0 || (*cmp)(lf, stepson) >= 0) { | |
| 140 | 			if(cmp(rt, stepson, arg) >= 0 || cmp(lf, stepson, arg) >= 0) { | |
| 140 | 141 | 				break; |
| 141 | 142 | 			} |
| 142 | 143 | 		} |
| ... | ... | @@ -150,11 +151,11 @@ static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2], |
| 150 | 151 | 	} |
| 151 | 152 | 	if(!trusty) { |
| 152 | 153 | 		cycle(width, ar, i); |
| 153 | 		sift(head, width, cmp, pshift, lp); | |
| 154 | 		sift(head, width, cmp, arg, pshift, lp); | |
| 154 | 155 | 	} |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | void qsort(void *base, size_t nel, size_t width, cmpfun cmp) | |
| 158 | void __qsort_r(void *base, size_t nel, size_t width, cmpfun cmp, void *arg) | |
| 158 | 159 | { |
| 159 | 160 | 	size_t lp[12*sizeof(size_t)]; |
| 160 | 161 | 	size_t i, size = width * nel; |
| ... | ... | @@ -173,16 +174,16 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp) |
| 173 | 174 | |
| 174 | 175 | 	while(head < high) { |
| 175 | 176 | 		if((p[0] & 3) == 3) { |
| 176 | 			sift(head, width, cmp, pshift, lp); | |
| 177 | 			sift(head, width, cmp, arg, pshift, lp); | |
| 177 | 178 | 			shr(p, 2); |
| 178 | 179 | 			pshift += 2; |
| 179 | 180 | 		} else { |
| 180 | 181 | 			if(lp[pshift - 1] >= high - head) { |
| 181 | 				trinkle(head, width, cmp, p, pshift, 0, lp); | |
| 182 | 				trinkle(head, width, cmp, arg, p, pshift, 0, lp); | |
| 182 | 183 | 			} else { |
| 183 | 				sift(head, width, cmp, pshift, lp); | |
| 184 | 				sift(head, width, cmp, arg, pshift, lp); | |
| 184 | 185 | 			} |
| 185 | 			 | |
| 186 | ||
| 186 | 187 | 			if(pshift == 1) { |
| 187 | 188 | 				shl(p, 1); |
| 188 | 189 | 				pshift = 0; |
| ... | ... | @@ -191,12 +192,12 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp) |
| 191 | 192 | 				pshift = 1; |
| 192 | 193 | 			} |
| 193 | 194 | 		} |
| 194 | 		 | |
| 195 | ||
| 195 | 196 | 		p[0] |= 1; |
| 196 | 197 | 		head += width; |
| 197 | 198 | 	} |
| 198 | 199 | |
| 199 | 	trinkle(head, width, cmp, p, pshift, 0, lp); | |
| 200 | 	trinkle(head, width, cmp, arg, p, pshift, 0, lp); | |
| 200 | 201 | |
| 201 | 202 | 	while(pshift != 1 || p[0] != 1 || p[1] != 0) { |
| 202 | 203 | 		if(pshift <= 1) { |
| ... | ... | @@ -208,11 +209,13 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp) |
| 208 | 209 | 			pshift -= 2; |
| 209 | 210 | 			p[0] ^= 7; |
| 210 | 211 | 			shr(p, 1); |
| 211 | 			trinkle(head - lp[pshift] - width, width, cmp, p, pshift + 1, 1, lp); | |
| 212 | 			trinkle(head - lp[pshift] - width, width, cmp, arg, p, pshift + 1, 1, lp); | |
| 212 | 213 | 			shl(p, 1); |
| 213 | 214 | 			p[0] |= 1; |
| 214 | 			trinkle(head - width, width, cmp, p, pshift, 1, lp); | |
| 215 | 			trinkle(head - width, width, cmp, arg, p, pshift, 1, lp); | |
| 215 | 216 | 		} |
| 216 | 217 | 		head -= width; |
| 217 | 218 | 	} |
| 218 | 219 | } |
| 220 | ||
| 221 | weak_alias(__qsort_r, qsort_r); |
lib/libc/wasi/libc-top-half/musl/src/stdlib/qsort_nr.c created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | #define _BSD_SOURCE | |
| 2 | #include <stdlib.h> | |
| 3 | ||
| 4 | typedef int (*cmpfun)(const void *, const void *); | |
| 5 | ||
| 6 | static int wrapper_cmp(const void *v1, const void *v2, void *cmp) | |
| 7 | { | |
| 8 | 	return ((cmpfun)cmp)(v1, v2); | |
| 9 | } | |
| 10 | ||
| 11 | void qsort(void *base, size_t nel, size_t width, cmpfun cmp) | |
| 12 | { | |
| 13 | 	__qsort_r(base, nel, width, wrapper_cmp, cmp); | |
| 14 | } |
lib/libc/wasi/libc-top-half/musl/src/stdlib/strtod.c-21| ... | ... | @@ -46,24 +46,3 @@ long double strtold(const char *restrict s, char **restrict p) |
| 46 | 46 | 	return strtox(s, p, 2); |
| 47 | 47 | #endif |
| 48 | 48 | } |
| 49 | ||
| 50 | #ifdef __wasilibc_unmodified_upstream // WASI doesn't support signature-changing aliases | |
| 51 | weak_alias(strtof, strtof_l); | |
| 52 | weak_alias(strtod, strtod_l); | |
| 53 | weak_alias(strtold, strtold_l); | |
| 54 | weak_alias(strtof, __strtof_l); | |
| 55 | weak_alias(strtod, __strtod_l); | |
| 56 | weak_alias(strtold, __strtold_l); | |
| 57 | #else | |
| 58 | // WebAssembly doesn't permit signature-changing aliases, so use wrapper | |
| 59 | // functions instead. | |
| 60 | weak float strtof_l(const char *restrict s, char **restrict p, locale_t loc) { | |
| 61 | 	return strtof(s, p); | |
| 62 | } | |
| 63 | weak double strtod_l(const char *restrict s, char **restrict p, locale_t loc) { | |
| 64 | 	return strtod(s, p); | |
| 65 | } | |
| 66 | weak long double strtold_l(const char *restrict s, char **restrict p, locale_t loc) { | |
| 67 | 	return strtold(s, p); | |
| 68 | } | |
| 69 | #endif |
lib/libc/wasi/libc-top-half/musl/src/thread/pthread_getname_np.c created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | #define _GNU_SOURCE | |
| 2 | #include <fcntl.h> | |
| 3 | #include <unistd.h> | |
| 4 | #include <sys/prctl.h> | |
| 5 | ||
| 6 | #include "pthread_impl.h" | |
| 7 | ||
| 8 | int pthread_getname_np(pthread_t thread, char *name, size_t len) | |
| 9 | { | |
| 10 | 	int fd, cs, status = 0; | |
| 11 | 	char f[sizeof "/proc/self/task//comm" + 3*sizeof(int)]; | |
| 12 | ||
| 13 | 	if (len < 16) return ERANGE; | |
| 14 | ||
| 15 | 	if (thread == pthread_self()) | |
| 16 | 		return prctl(PR_GET_NAME, (unsigned long)name, 0UL, 0UL, 0UL) ? errno : 0; | |
| 17 | ||
| 18 | 	snprintf(f, sizeof f, "/proc/self/task/%d/comm", thread->tid); | |
| 19 | 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); | |
| 20 | 	if ((fd = open(f, O_RDONLY|O_CLOEXEC)) < 0 || (len = read(fd, name, len)) == -1) status = errno; | |
| 21 | 	else name[len-1] = 0; /* remove trailing new line only if successful */ | |
| 22 | 	if (fd >= 0) close(fd); | |
| 23 | 	pthread_setcancelstate(cs, 0); | |
| 24 | 	return status; | |
| 25 | } |
lib/libc/wasi/libc-top-half/musl/src/thread/pthread_setname_np.c+1-1| ... | ... | @@ -19,7 +19,7 @@ int pthread_setname_np(pthread_t thread, const char *name) |
| 19 | 19 | |
| 20 | 20 | 	snprintf(f, sizeof f, "/proc/self/task/%d/comm", thread->tid); |
| 21 | 21 | 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); |
| 22 | 	if ((fd = open(f, O_WRONLY)) < 0 || write(fd, name, len) < 0) status = errno; | |
| 22 | 	if ((fd = open(f, O_WRONLY|O_CLOEXEC)) < 0 || write(fd, name, len) < 0) status = errno; | |
| 23 | 23 | 	if (fd >= 0) close(fd); |
| 24 | 24 | 	pthread_setcancelstate(cs, 0); |
| 25 | 25 | 	return status; |
lib/libc/wasi/libc-top-half/musl/src/time/__tz.c+25-15| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | #include <string.h> |
| 6 | 6 | #ifdef __wasilibc_unmodified_upstream // timezone data |
| 7 | 7 | #include <sys/mman.h> |
| 8 | #include <ctype.h> | |
| 8 | 9 | #endif |
| 9 | 10 | #include "libc.h" |
| 10 | 11 | #include "lock.h" |
| ... | ... | @@ -159,10 +160,21 @@ static void do_tzset() |
| 159 | 160 | 	} |
| 160 | 161 | 	if (old_tz) memcpy(old_tz, s, i+1); |
| 161 | 162 | |
| 163 | 	int posix_form = 0; | |
| 164 | 	if (*s != ':') { | |
| 165 | 		p = s; | |
| 166 | 		char dummy_name[TZNAME_MAX+1]; | |
| 167 | 		getname(dummy_name, &p); | |
| 168 | 		if (p!=s && (*p == '+' || *p == '-' || isdigit(*p) | |
| 169 | 		 || !strcmp(dummy_name, "UTC") | |
| 170 | 		 || !strcmp(dummy_name, "GMT"))) | |
| 171 | 			posix_form = 1; | |
| 172 | 	}	 | |
| 173 | ||
| 162 | 174 | 	/* Non-suid can use an absolute tzfile pathname or a relative |
| 163 | 175 | 	 * pathame beginning with "."; in secure mode, only the |
| 164 | 176 | 	 * standard path will be searched. */ |
| 165 | 	if (*s == ':' || ((p=strchr(s, '/')) && !memchr(s, ',', p-s))) { | |
| 177 | 	if (!posix_form) { | |
| 166 | 178 | 		if (*s == ':') s++; |
| 167 | 179 | 		if (*s == '/' || *s == '.') { |
| 168 | 180 | 			if (!libc.secure || !strcmp(s, "/etc/localtime")) |
| ... | ... | @@ -286,22 +298,20 @@ static size_t scan_trans(long long t, int local, size_t *alt) |
| 286 | 298 | 	n = (index-trans)>>scale; |
| 287 | 299 | 	if (a == n-1) return -1; |
| 288 | 300 | 	if (a == 0) { |
| 289 | 		x = zi_read32(trans + (a<<scale)); | |
| 290 | 		if (scale == 3) x = x<<32 | zi_read32(trans + (a<<scale) + 4); | |
| 301 | 		x = zi_read32(trans); | |
| 302 | 		if (scale == 3) x = x<<32 | zi_read32(trans + 4); | |
| 291 | 303 | 		else x = (int32_t)x; |
| 292 | 		if (local) off = (int32_t)zi_read32(types + 6 * index[a-1]); | |
| 304 | 		/* Find the lowest non-DST type, or 0 if none. */ | |
| 305 | 		size_t j = 0; | |
| 306 | 		for (size_t i=abbrevs-types; i; i-=6) { | |
| 307 | 			if (!types[i-6+4]) j = i-6; | |
| 308 | 		} | |
| 309 | 		if (local) off = (int32_t)zi_read32(types + j); | |
| 310 | 		/* If t is before first transition, use the above-found type | |
| 311 | 		 * and the index-zero (after transition) type as the alt. */ | |
| 293 | 312 | 		if (t - off < (int64_t)x) { |
| 294 | 			for (a=0; a<(abbrevs-types)/6; a++) { | |
| 295 | 				if (types[6*a+4] != types[4]) break; | |
| 296 | 			} | |
| 297 | 			if (a == (abbrevs-types)/6) a = 0; | |
| 298 | 			if (types[6*a+4]) { | |
| 299 | 				*alt = a; | |
| 300 | 				return 0; | |
| 301 | 			} else { | |
| 302 | 				*alt = 0; | |
| 303 | 				return a; | |
| 304 | 			} | |
| 313 | 			if (alt) *alt = index[0]; | |
| 314 | 			return j/6; | |
| 305 | 315 | 		} |
| 306 | 316 | 	} |
| 307 | 317 |
lib/libc/wasi/libc-top-half/musl/src/unistd/nice.c+8-1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | #include <unistd.h> |
| 2 | #include <errno.h> | |
| 2 | 3 | #include <sys/resource.h> |
| 3 | 4 | #include <limits.h> |
| 4 | 5 | #include "syscall.h" |
| ... | ... | @@ -12,5 +13,11 @@ int nice(int inc) |
| 12 | 13 | 		prio += getpriority(PRIO_PROCESS, 0); |
| 13 | 14 | 	if (prio > NZERO-1) prio = NZERO-1; |
| 14 | 15 | 	if (prio < -NZERO) prio = -NZERO; |
| 15 | 	return setpriority(PRIO_PROCESS, 0, prio) ? -1 : prio; | |
| 16 | 	if (setpriority(PRIO_PROCESS, 0, prio)) { | |
| 17 | 		if (errno == EACCES) | |
| 18 | 			errno = EPERM; | |
| 19 | 		return -1; | |
| 20 | 	} else { | |
| 21 | 		return prio; | |
| 22 | 	} | |
| 16 | 23 | } |