--- a/Make.unix 2024-03-12 18:28:22.000000000 +0100 +++ b/Make.unix 2026-10-19 18:08:43.373584622 +0200 @@ -20,4 +20,5 @@ all: default libmachdep.a: arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/; s/x86_64/amd64/; s/armv[567].*/arm/; s/aarch64/arm64/'`; \ + [ -d posix-$$arch ] || arch=port; \ (cd posix-$$arch && make) --- a/posix-port/Makefile 2024-03-12 18:28:22.000000000 +0100 +++ b/posix-port/Makefile 2026-10-19 18:08:43.373453383 +0200 @@ -4,6 +4,7 @@ LIB=../libmachdep.a OFILES=\ getcallerpc.$O\ + tas.$O default: $(LIB) $(LIB): $(OFILES) --- a/posix-port/tas.c 1970-01-01 01:00:00.000000000 +0100 +++ b/posix-port/tas.c 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,18 @@ +#include "u.h" +#include "libc.h" + +int +tas(int *x) +{ + int v; + + v = __atomic_exchange_n(x, 1, __ATOMIC_ACQUIRE); + switch(v) { + case 0: + case 1: + return v; + default: + print("canlock: corrupted 0x%lux\n", v); + return 1; + } +}