diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ddacc1a61..0f663b93f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - mode: ["", tiny, opt, rel] + mode: ["", tiny, rel, aarch64] steps: - uses: actions/checkout@v3 diff --git a/libc/calls/struct/timeval.h b/libc/calls/struct/timeval.h index 5c31ddeae..c66fc8e3e 100644 --- a/libc/calls/struct/timeval.h +++ b/libc/calls/struct/timeval.h @@ -9,6 +9,7 @@ #define timeval_frommillis __timeval_frommillis #define timeval_add __timeval_add #define timeval_sub __timeval_sub +#define timespec_totimeval __timespec_totimeval #define timeval_totimespec __timeval_totimespec #endif /* COSMO */ diff --git a/libc/intrin/directmap.c b/libc/intrin/directmap.c index f9fd91840..e224379d9 100644 --- a/libc/intrin/directmap.c +++ b/libc/intrin/directmap.c @@ -37,7 +37,6 @@ */ struct DirectMap sys_mmap(void *addr, size_t size, int prot, int flags, int fd, int64_t off) { -#ifdef __x86_64__ struct DirectMap d; if (!IsWindows() && !IsMetal()) { d.addr = __sys_mmap(addr, size, prot, flags, fd, off, off); @@ -52,29 +51,4 @@ struct DirectMap sys_mmap(void *addr, size_t size, int prot, int flags, int fd, DescribeProtFlags(prot), DescribeMapFlags(flags), fd, off, d.addr, d.maphandle); return d; -#elif defined(__aarch64__) - register long r0 asm("x0") = (long)addr; - register long r1 asm("x1") = (long)size; - register long r2 asm("x2") = (long)prot; - register long r3 asm("x3") = (long)flags; - register long r4 asm("x4") = (long)fd; - register long r5 asm("x5") = (long)off; - register long res_x0 asm("x0"); - long res; - asm volatile("mov\tx8,%1\n\t" - "mov\tx16,%2\n\t" - "svc\t0" - : "=r"(res_x0) - : "i"(222), "i"(197), "r"(r0), "r"(r1), "r"(r2), "r"(r3), - "r"(r4), "r"(r5) - : "x8", "memory"); - res = res_x0; - if ((unsigned long)res >= (unsigned long)-4095) { - errno = (int)-res; - res = -1; - } - return (struct DirectMap){(void *)res, kNtInvalidHandleValue}; -#else -#error "arch unsupported" -#endif } diff --git a/libc/runtime/finddebugbinary.c b/libc/runtime/finddebugbinary.c index 56b8fd209..8722c5d69 100644 --- a/libc/runtime/finddebugbinary.c +++ b/libc/runtime/finddebugbinary.c @@ -95,7 +95,7 @@ const char *FindDebugBinary(void) { if (!once) { p = GetProgramExecutableName(); n = strlen(p); - if (n > 4 && READ32LE(p + n - 4) == READ32LE(".dbg") || + if ((n > 4 && READ32LE(p + n - 4) == READ32LE(".dbg")) || IsMyDebugBinary(p)) { res = p; } else if (n > 4 && READ32LE(p + n - 4) == READ32LE(".com") && diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index 663894bca..4fbaf2cd6 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -205,8 +205,8 @@ syscon open O_NOFOLLOW_ANY 0 0 0x20000000 0x20000000 0 0 0 0 # syscon open O_SYNC 0x00101000 0x00101000 0x00000080 0x00000080 0x00000080 0x00000080 0x00000080 0 # bsd consensus syscon open O_NOCTTY 0x00000100 0x00000100 0x00020000 0x00020000 0x00008000 0x00008000 0x00008000 0 # used for remote viewing (default behavior on freebsd) syscon open O_NOATIME 0x00040000 0x00040000 0 0 0 0 0 0 # optimize away access time update -syscon open O_EXEC 0x00200000 0x00200000 0 0 0x00040000 0 0x04000000 0 # open only for executing (POSIX.1 hack for when file mode is 0111); see fexecve(); O_PATH on Linux -syscon open O_SEARCH 0 0 0 0 0x00040000 0 0x00800000 0 # it's specified by posix what does it mean +syscon open O_EXEC 0x00200000 0x00200000 0 0x40000000 0x00040000 0 0x04000000 0 # open only for executing (POSIX.1 hack for when file mode is 0111); see fexecve(); O_PATH on Linux +syscon open O_SEARCH 0 0 0 0x40100000 0x00040000 0 0x00800000 0 # it's specified by posix what does it mean syscon open O_DSYNC 0x00001000 0x00001000 0x00400000 0x00400000 0 0x00000080 0x00010000 0 # syscon open O_RSYNC 0x00101000 0x00101000 0 0 0 0x00000080 0x00020000 0 # syscon open O_PATH 0x00200000 0x00200000 0 0 0 0 0 0 # Linux 2.6.39+ @@ -246,7 +246,7 @@ syscon compat MAP_NOCORE 0 0 0 0 0x00020000 0x00008000 0x00008000 syscon compat MAP_ANON 0x00000020 0x00000020 0x00001000 0x00001000 0x00001000 0x00001000 0x00001000 0x00000020 # bsd consensus; faked nt syscon compat MAP_EXECUTABLE 0x00001000 0x00001000 0 0 0 0 0 0 # ignored syscon compat MAP_DENYWRITE 0x00000800 0x00000800 0 0 0 0 0 0 -syscon compat MAP_32BIT 0x00000040 0x00000040 0 0 0x00080000 0 0 0 # iffy +syscon compat MAP_32BIT 0x00000040 0x00000040 0 0x00008000 0x00080000 0 0 0 # iffy # madvise() flags # @@ -402,8 +402,8 @@ syscon fcntl F_SETSIG 10 10 -1 -1 -1 -1 -1 -1 syscon fcntl F_GETSIG 11 11 -1 -1 -1 -1 -1 -1 syscon fcntl F_SETOWN_EX 15 15 -1 -1 -1 -1 -1 -1 syscon fcntl F_GETOWN_EX 0x10 0x10 -1 -1 -1 -1 -1 -1 -syscon fcntl F_SETLEASE 0x0400 0x0400 -1 -1 -1 -1 -1 -1 -syscon fcntl F_GETLEASE 0x0401 0x0401 -1 -1 -1 -1 -1 -1 +syscon fcntl F_SETLEASE 0x0400 0x0400 -1 106 -1 -1 -1 -1 +syscon fcntl F_GETLEASE 0x0401 0x0401 -1 107 -1 -1 -1 -1 syscon ioctl FIONBIO 0x5421 0x5421 0x8004667e 0x8004667e 0x8004667e 0x8004667e 0x8004667e 0x8004667e # BSD-The New Technology consensus; FIONBIO is traditional O_NONBLOCK; see F_SETFL for re-imagined api syscon ioctl FIOASYNC 0x5452 0x5452 0x8004667d 0x8004667d 0x8004667d 0x8004667d 0x8004667d 0x8004667d # BSD-The New Technology consensus @@ -426,8 +426,8 @@ syscon at AT_EMPTY_PATH 0x1000 0x1000 0 0 0 0 0 0 # linux 2.6 # utimensat() special values # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary -syscon utime UTIME_NOW 0x3fffffff 0x3fffffff 0x3fffffff 0x3fffffff -1 -2 0x3fffffff -2 # timespec::tv_sec may be this; polyfilled xnu/nt -syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe 0x3ffffffe 0x3ffffffe -2 -1 0x3ffffffe -1 # timespec::tv_nsec may be this; polyfilled xnu/nt +syscon utime UTIME_NOW 0x3fffffff 0x3fffffff -1 -1 -1 -2 0x3fffffff -2 # timespec::tv_sec may be this; polyfilled xnu/nt +syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe -2 -2 -2 -1 0x3ffffffe -1 # timespec::tv_nsec may be this; polyfilled xnu/nt # getauxval() keys # @@ -716,6 +716,7 @@ syscon so SO_TIMESTAMPING 37 37 0 0 0 0 0 0 syscon so SO_TIMESTAMPNS 35 35 0 0 0 0 0 0 syscon so SO_WIFI_STATUS 41 41 0 0 0 0 0 0 +# these are IPPROTO_* on non-Linux syscon sol SOL_IP 0 0 0 0 0 0 0 0 # consensus syscon sol SOL_SOCKET 1 1 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff # yes it's actually 0xffff; bsd+nt consensus (todo: what's up with ipproto_icmp overlap) syscon sol SOL_TCP 6 6 6 6 6 6 6 6 # consensus @@ -745,6 +746,42 @@ syscon sol SOL_RXRPC 272 272 -1 -1 -1 -1 -1 -1 syscon sol SOL_TIPC 271 271 -1 -1 -1 -1 -1 -1 syscon sol SOL_X25 262 262 -1 -1 -1 -1 -1 -1 +# IPPROTO_* +# +# group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary +syscon iproto IPPROTO_IP 0 0 0 0 0 0 0 0 # consensus +syscon iproto IPPROTO_ICMP 1 1 1 1 1 1 1 1 # consensus +syscon iproto IPPROTO_TCP 6 6 6 6 6 6 6 6 # consensus +syscon iproto IPPROTO_UDP 17 17 17 17 17 17 17 17 # consensus +syscon iproto IPPROTO_RAW 255 255 255 255 255 255 255 255 # consensus +syscon iproto IPPROTO_HOPOPTS 0 0 0 0 0 0 0 -1 # consensus +syscon iproto IPPROTO_IDP 22 22 22 22 22 22 22 22 # consensus +syscon iproto IPPROTO_IGMP 2 2 2 2 2 2 2 2 # consensus +syscon iproto IPPROTO_PUP 12 12 12 12 12 12 12 12 # consensus +syscon iproto IPPROTO_AH 51 51 51 51 51 51 51 -1 # unix consensus +syscon iproto IPPROTO_DSTOPTS 60 60 60 60 60 60 60 -1 # unix consensus +syscon iproto IPPROTO_EGP 8 8 8 8 8 8 8 -1 # unix consensus +syscon iproto IPPROTO_ENCAP 98 98 98 98 98 98 98 -1 # unix consensus +syscon iproto IPPROTO_ESP 50 50 50 50 50 50 50 -1 # unix consensus +syscon iproto IPPROTO_FRAGMENT 44 44 44 44 44 44 44 -1 # unix consensus +syscon iproto IPPROTO_GRE 47 47 47 47 47 47 47 -1 # unix consensus +syscon iproto IPPROTO_ICMPV6 58 58 58 58 58 58 58 -1 # unix consensus +syscon iproto IPPROTO_IPIP 4 4 4 4 4 4 4 -1 # unix consensus +syscon iproto IPPROTO_IPV6 41 41 41 41 41 41 41 -1 # unix consensus +syscon iproto IPPROTO_NONE 59 59 59 59 59 59 59 -1 # unix consensus +syscon iproto IPPROTO_PIM 103 103 103 103 103 103 103 -1 # unix consensus +syscon iproto IPPROTO_ROUTING 43 43 43 43 43 43 43 -1 # unix consensus +syscon iproto IPPROTO_RSVP 46 46 46 46 46 46 46 -1 # unix consensus +syscon iproto IPPROTO_TP 29 29 29 29 29 29 29 -1 # unix consensus +syscon iproto IPPROTO_MPLS 137 137 -1 -1 137 137 137 -1 +syscon iproto IPPROTO_MTP 92 92 92 92 92 -1 -1 -1 +syscon iproto IPPROTO_SCTP 132 132 132 132 132 -1 -1 -1 +syscon iproto IPPROTO_MH 135 135 -1 -1 135 -1 -1 -1 +syscon iproto IPPROTO_UDPLITE 136 136 -1 -1 136 -1 -1 -1 +syscon iproto IPPROTO_BEETPH 94 94 -1 -1 -1 -1 -1 -1 +syscon iproto IPPROTO_COMP 108 108 -1 -1 -1 -1 -1 -1 +syscon iproto IPPROTO_DCCP 33 33 -1 -1 -1 -1 -1 -1 + syscon alg ALG_SET_KEY 1 1 0 0 0 0 0 0 syscon alg ALG_SET_IV 2 2 0 0 0 0 0 0 syscon alg ALG_SET_OP 3 3 0 0 0 0 0 0 @@ -762,7 +799,7 @@ syscon alg ALG_SET_DRBG_ENTROPY 6 6 0 0 0 0 0 0 syscon tcp TCP_NODELAY 1 1 1 1 1 1 1 1 # strong consensus for disabling nagle's algorithm; so be sure to disable it by turning this on syscon tcp TCP_CORK 3 3 4 4 4 16 4 0 # nagle's algorithm strikes again; TCP_NOPUSH on BSD; be sure to turn it off; protip: mmap+writev vs. write+sendfile; see also /proc/sys/net/ipv4/tcp_autocorking; netbsd is 4 but not implemented syscon tcp TCP_MAXSEG 2 2 2 2 2 2 2 0 # reduces tcp segment size; see also tcp offloading -syscon tcp TCP_FASTOPEN 23 23 0 0 0x0401 0 0 15 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true +syscon tcp TCP_FASTOPEN 23 23 0x105 0x105 0x0401 0 0 15 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true syscon tcp TCP_FASTOPEN_CONNECT 30 30 0 0 0 0 0 0 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true syscon tcp TCP_KEEPIDLE 4 4 0 0 0x100 0 3 0 # start keepalives after this period syscon tcp TCP_KEEPINTVL 5 5 0x101 0x101 0x200 0 5 0 # interval between keepalives @@ -913,42 +950,6 @@ syscon ptrace PTRACE_EVENT_STOP 128 128 -1 -1 -1 -1 -1 -1 # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary syscon clone CLONE_VM 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 0x00000100 # intentionally symbolic so we can tell if clone() is being used to create threads -# IPPROTO_* -# -# group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary -syscon iproto IPPROTO_IP 0 0 0 0 0 0 0 0 # consensus -syscon iproto IPPROTO_ICMP 1 1 1 1 1 1 1 1 # consensus -syscon iproto IPPROTO_TCP 6 6 6 6 6 6 6 6 # consensus -syscon iproto IPPROTO_UDP 17 17 17 17 17 17 17 17 # consensus -syscon iproto IPPROTO_RAW 255 255 255 255 255 255 255 255 # consensus -syscon iproto IPPROTO_HOPOPTS -1 -1 -1 -1 -1 -1 -1 -1 # consensus -syscon iproto IPPROTO_IDP 22 22 22 22 22 22 22 22 # consensus -syscon iproto IPPROTO_IGMP 2 2 2 2 2 2 2 2 # consensus -syscon iproto IPPROTO_PUP 12 12 12 12 12 12 12 12 # consensus -syscon iproto IPPROTO_AH 51 51 51 51 51 51 51 -1 # unix consensus -syscon iproto IPPROTO_DSTOPTS 60 60 60 60 60 60 60 -1 # unix consensus -syscon iproto IPPROTO_EGP 8 8 8 8 8 8 8 -1 # unix consensus -syscon iproto IPPROTO_ENCAP 98 98 98 98 98 98 98 -1 # unix consensus -syscon iproto IPPROTO_ESP 50 50 50 50 50 50 50 -1 # unix consensus -syscon iproto IPPROTO_FRAGMENT 44 44 44 44 44 44 44 -1 # unix consensus -syscon iproto IPPROTO_GRE 47 47 47 47 47 47 47 -1 # unix consensus -syscon iproto IPPROTO_ICMPV6 58 58 58 58 58 58 58 -1 # unix consensus -syscon iproto IPPROTO_IPIP 4 4 4 4 4 4 4 -1 # unix consensus -syscon iproto IPPROTO_IPV6 41 41 41 41 41 41 41 -1 # unix consensus -syscon iproto IPPROTO_NONE 59 59 59 59 59 59 59 -1 # unix consensus -syscon iproto IPPROTO_PIM 103 103 103 103 103 103 103 -1 # unix consensus -syscon iproto IPPROTO_ROUTING 43 43 43 43 43 43 43 -1 # unix consensus -syscon iproto IPPROTO_RSVP 46 46 46 46 46 46 46 -1 # unix consensus -syscon iproto IPPROTO_TP 29 29 29 29 29 29 29 -1 # unix consensus -syscon iproto IPPROTO_MPLS 137 137 -1 -1 137 137 137 -1 -syscon iproto IPPROTO_MTP 92 92 92 92 92 -1 -1 -1 -syscon iproto IPPROTO_SCTP 132 132 132 132 132 -1 -1 -1 -syscon iproto IPPROTO_MH 135 135 -1 -1 135 -1 -1 -1 -syscon iproto IPPROTO_UDPLITE 136 136 -1 -1 136 -1 -1 -1 -syscon iproto IPPROTO_BEETPH 94 94 -1 -1 -1 -1 -1 -1 -syscon iproto IPPROTO_COMP 108 108 -1 -1 -1 -1 -1 -1 -syscon iproto IPPROTO_DCCP 33 33 -1 -1 -1 -1 -1 -1 - # socket ioctl() # # group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary diff --git a/libc/sysv/consts/F_GETLEASE.S b/libc/sysv/consts/F_GETLEASE.S index b5759e39c..4f8129db4 100644 --- a/libc/sysv/consts/F_GETLEASE.S +++ b/libc/sysv/consts/F_GETLEASE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_GETLEASE,0x0401,0x0401,-1,-1,-1,-1,-1,-1 +.syscon fcntl,F_GETLEASE,0x0401,0x0401,-1,107,-1,-1,-1,-1 diff --git a/libc/sysv/consts/F_SETLEASE.S b/libc/sysv/consts/F_SETLEASE.S index d0c797a6e..ce96d487f 100644 --- a/libc/sysv/consts/F_SETLEASE.S +++ b/libc/sysv/consts/F_SETLEASE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon fcntl,F_SETLEASE,0x0400,0x0400,-1,-1,-1,-1,-1,-1 +.syscon fcntl,F_SETLEASE,0x0400,0x0400,-1,106,-1,-1,-1,-1 diff --git a/libc/sysv/consts/IPPROTO_HOPOPTS.S b/libc/sysv/consts/IPPROTO_HOPOPTS.S index 04ff49dea..834d549db 100644 --- a/libc/sysv/consts/IPPROTO_HOPOPTS.S +++ b/libc/sysv/consts/IPPROTO_HOPOPTS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon iproto,IPPROTO_HOPOPTS,-1,-1,-1,-1,-1,-1,-1,-1 +.syscon iproto,IPPROTO_HOPOPTS,0,0,0,0,0,0,0,-1 diff --git a/libc/sysv/consts/MAP_32BIT.S b/libc/sysv/consts/MAP_32BIT.S index 1a358d1c2..665b0a28a 100644 --- a/libc/sysv/consts/MAP_32BIT.S +++ b/libc/sysv/consts/MAP_32BIT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon compat,MAP_32BIT,0x00000040,0x00000040,0,0,0x00080000,0,0,0 +.syscon compat,MAP_32BIT,0x00000040,0x00000040,0,0x00008000,0x00080000,0,0,0 diff --git a/libc/sysv/consts/O_EXEC.S b/libc/sysv/consts/O_EXEC.S index ddc6d4488..b1341bfe1 100644 --- a/libc/sysv/consts/O_EXEC.S +++ b/libc/sysv/consts/O_EXEC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_EXEC,0x00200000,0x00200000,0,0,0x00040000,0,0x04000000,0 +.syscon open,O_EXEC,0x00200000,0x00200000,0,0x40000000,0x00040000,0,0x04000000,0 diff --git a/libc/sysv/consts/O_SEARCH.S b/libc/sysv/consts/O_SEARCH.S index b876e9ef2..1f5a47ab0 100644 --- a/libc/sysv/consts/O_SEARCH.S +++ b/libc/sysv/consts/O_SEARCH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_SEARCH,0,0,0,0,0x00040000,0,0x00800000,0 +.syscon open,O_SEARCH,0,0,0,0x40100000,0x00040000,0,0x00800000,0 diff --git a/libc/sysv/consts/TCP_FASTOPEN.S b/libc/sysv/consts/TCP_FASTOPEN.S index a0ffdb0c0..bef5052a5 100644 --- a/libc/sysv/consts/TCP_FASTOPEN.S +++ b/libc/sysv/consts/TCP_FASTOPEN.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_FASTOPEN,23,23,0,0,0x0401,0,0,15 +.syscon tcp,TCP_FASTOPEN,23,23,0x105,0x105,0x0401,0,0,15 diff --git a/libc/sysv/consts/UTIME_NOW.S b/libc/sysv/consts/UTIME_NOW.S index 2fbdb7b6b..6935aa7bb 100644 --- a/libc/sysv/consts/UTIME_NOW.S +++ b/libc/sysv/consts/UTIME_NOW.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon utime,UTIME_NOW,0x3fffffff,0x3fffffff,0x3fffffff,0x3fffffff,-1,-2,0x3fffffff,-2 +.syscon utime,UTIME_NOW,0x3fffffff,0x3fffffff,-1,-1,-1,-2,0x3fffffff,-2 diff --git a/libc/sysv/consts/UTIME_OMIT.S b/libc/sysv/consts/UTIME_OMIT.S index e316ac854..4bc40e8c5 100644 --- a/libc/sysv/consts/UTIME_OMIT.S +++ b/libc/sysv/consts/UTIME_OMIT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon utime,UTIME_OMIT,0x3ffffffe,0x3ffffffe,0x3ffffffe,0x3ffffffe,-2,-1,0x3ffffffe,-1 +.syscon utime,UTIME_OMIT,0x3ffffffe,0x3ffffffe,-2,-2,-2,-1,0x3ffffffe,-1 diff --git a/test/libc/thread/spawn_test.c b/test/libc/thread/spawn_test.c index bd7c6815f..8964a60d4 100644 --- a/test/libc/thread/spawn_test.c +++ b/test/libc/thread/spawn_test.c @@ -16,17 +16,17 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/thread/spawn.h" #include "libc/assert.h" #include "libc/atomic.h" #include "libc/calls/calls.h" #include "libc/calls/syscall-sysv.internal.h" #include "libc/intrin/atomic.h" #include "libc/macros.internal.h" -#include "libc/mem/mem.h" #include "libc/mem/gc.internal.h" +#include "libc/mem/mem.h" #include "libc/runtime/internal.h" #include "libc/testlib/testlib.h" -#include "libc/thread/spawn.h" atomic_int itworked; _Thread_local int var; @@ -48,7 +48,7 @@ int Worker(void *arg, int tid) { } TEST(_spawn, test) { - long i, n = 128; + long i, n = 64; struct spawn *t = gc(malloc(sizeof(struct spawn) * n)); for (i = 0; i < n; ++i) ASSERT_SYS(0, 0, _spawn(Worker, (void *)i, t + i)); for (i = 0; i < n; ++i) EXPECT_SYS(0, 0, _join(t + i));