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