pthread_rwlock regression test
[libc-test] / src / regression / pthread_create-oom.c
1 // commit: 59666802fba592a59f2f4ea4dcb053287fd55826 2011-02-15
2 // pthread_create should return EAGAIN on failure
3 #include <pthread.h>
4 #include <errno.h>
5 #include <string.h>
6 #include "test.h"
7
8 static void *start(void *arg)
9 {
10         return 0;
11 }
12
13 int main(void)
14 {
15         pthread_t td;
16         int r, arg;
17
18         r = t_vmfill(0, 0, 0);
19         if (r <= 0) {
20                 t_error("fatal: vmfill has failed\n");
21                 return 1;
22         }
23         r = pthread_create(&td, 0, start, &arg);
24         if (r == 0)
25                 t_error("pthread_create succeeded\n");
26         else if (r != EAGAIN)
27                 t_error("pthread_create should fail with EAGAIN but failed with %d (%s)\n", r, strerror(r));
28
29         return t_status;
30 }