1570af302Sopenharmony_ci// commit: 59666802fba592a59f2f4ea4dcb053287fd55826 2011-02-15 2570af302Sopenharmony_ci// pthread_create should return EAGAIN on failure 3570af302Sopenharmony_ci#include <pthread.h> 4570af302Sopenharmony_ci#include <stdlib.h> 5570af302Sopenharmony_ci#include <errno.h> 6570af302Sopenharmony_ci#include <string.h> 7570af302Sopenharmony_ci#include "test.h" 8570af302Sopenharmony_ci 9570af302Sopenharmony_cistatic void *start(void *arg) 10570af302Sopenharmony_ci{ 11570af302Sopenharmony_ci return 0; 12570af302Sopenharmony_ci} 13570af302Sopenharmony_ci 14570af302Sopenharmony_ciint main(void) 15570af302Sopenharmony_ci{ 16570af302Sopenharmony_ci pthread_t td; 17570af302Sopenharmony_ci int r, arg; 18570af302Sopenharmony_ci 19570af302Sopenharmony_ci if (t_memfill() < 0) 20570af302Sopenharmony_ci t_error("memfill failed\n"); 21570af302Sopenharmony_ci r = pthread_create(&td, 0, start, &arg); 22570af302Sopenharmony_ci if (r == 0) 23570af302Sopenharmony_ci t_error("pthread_create succeeded\n"); 24570af302Sopenharmony_ci else if (r != EAGAIN) 25570af302Sopenharmony_ci t_error("pthread_create should fail with EAGAIN but failed with %d (%s)\n", r, strerror(r)); 26570af302Sopenharmony_ci 27570af302Sopenharmony_ci _Exit(t_status); 28570af302Sopenharmony_ci return t_status; 29570af302Sopenharmony_ci} 30