Blame src/regression/pthread_create-oom.c
|
Szabolcs Nagy |
cfa23c |
// commit: 59666802fba592a59f2f4ea4dcb053287fd55826 2011-02-15
|
|
Szabolcs Nagy |
cfa23c |
// pthread_create should return EAGAIN on failure
|
|
Szabolcs Nagy |
cfa23c |
#include <pthread.h>
|
|
Szabolcs Nagy |
cfa23c |
#include <errno.h>
|
|
Szabolcs Nagy |
cfa23c |
#include <string.h>
|
|
Szabolcs Nagy |
cfa23c |
#include "test.h"
|
|
Szabolcs Nagy |
cfa23c |
|
|
Szabolcs Nagy |
cfa23c |
static void *start(void *arg)
|
|
Szabolcs Nagy |
cfa23c |
{
|
|
Szabolcs Nagy |
cfa23c |
return 0;
|
|
Szabolcs Nagy |
cfa23c |
}
|
|
Szabolcs Nagy |
cfa23c |
|
|
Szabolcs Nagy |
cfa23c |
int main(void)
|
|
Szabolcs Nagy |
cfa23c |
{
|
|
Szabolcs Nagy |
cfa23c |
pthread_t td;
|
|
Szabolcs Nagy |
cfa23c |
int r, arg;
|
|
Szabolcs Nagy |
cfa23c |
|
|
Szabolcs Nagy |
cfa23c |
r = t_vmfill(0, 0, 0);
|
|
Szabolcs Nagy |
cfa23c |
if (r <= 0) {
|
|
Szabolcs Nagy |
cfa23c |
t_error("fatal: vmfill has failed\n");
|
|
Szabolcs Nagy |
cfa23c |
return 1;
|
|
Szabolcs Nagy |
cfa23c |
}
|
|
Szabolcs Nagy |
cfa23c |
r = pthread_create(&td, 0, start, &arg;;
|
|
Szabolcs Nagy |
cfa23c |
if (r == 0)
|
|
Szabolcs Nagy |
cfa23c |
t_error("pthread_create succeeded\n");
|
|
Szabolcs Nagy |
cfa23c |
else if (r != EAGAIN)
|
|
Szabolcs Nagy |
cfa23c |
t_error("pthread_create should fail with EAGAIN but failed with %d (%s)\n", r, strerror(r));
|
|
Szabolcs Nagy |
cfa23c |
|
|
Szabolcs Nagy |
cfa23c |
return t_status;
|
|
Szabolcs Nagy |
cfa23c |
}
|