From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/tests/posix/pthread_atfork.c | 54 ---------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 lib/mlibc/tests/posix/pthread_atfork.c (limited to 'lib/mlibc/tests/posix/pthread_atfork.c') diff --git a/lib/mlibc/tests/posix/pthread_atfork.c b/lib/mlibc/tests/posix/pthread_atfork.c deleted file mode 100644 index 45be136..0000000 --- a/lib/mlibc/tests/posix/pthread_atfork.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -_Atomic int prepare_order = 0; -_Atomic int parent_order = 0; -_Atomic int child_order = 0; - -static void prepare1() { prepare_order = 1; } -static void prepare2() { prepare_order = 2; } - -static void parent1() { parent_order = 1; } -static void parent2() { parent_order = 2; } - -static void child1() { child_order = 1; } -static void child2() { child_order = 2; } - -int main() { - assert(!pthread_atfork(prepare1, parent1, child1)); - assert(!pthread_atfork(prepare2, parent2, child2)); - - pid_t pid = fork(); - assert(pid >= 0); - - if (!pid) { - assert(child_order == 2); - exit(0); - } else { - assert(prepare_order == 1); - assert(parent_order == 2); - - while (1) { - int status = 0; - - int ret = waitpid(pid, &status, 0); - - if (ret == -1 && errno == EINTR) - continue; - - assert(ret > 0); - - if (WIFSIGNALED(status) && WTERMSIG(status) == SIGABRT) - return 1; - - return WEXITSTATUS(status); - } - } - - return 0; -} -- cgit v1.2.3