5 #include <sys/resource.h>
10 #define TEST(c, ...) ((c) ? 1 : (t_error(#c" failed: " __VA_ARGS__),0))
12 static void handler_errno(void)
19 t_setrlim(RLIMIT_NPROC, 0);
20 pthread_atfork(handler_errno, handler_errno, handler_errno);
23 if (!TEST((pid = fork()) == -1, "fork succeeded despite rlimit\n")) {
25 while (waitpid(pid, NULL, 0)<0 && errno==EINTR);
27 TEST(errno != 0, "fork failed but errno was clobbered\n");