summaryrefslogtreecommitdiff
path: root/lib/libc_r/TEST/test_fcntl.c
blob: bfe38cb16ec7cf482aa97e400f83d37efccdcd15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <fcntl.h>
#include "test.h"

main()
{
	int flags, child;

	CHECKe(flags = fcntl(0, F_GETFL));
	printf("flags = %x\n", flags);

	CHECKe(child = fork());
	switch(child) {
	case 0: /* child */
		CHECKe(execlp("test_create", "test_create", NULL));
		/* NOTREACHED */
	default: /* parent */
		CHECKe(wait(NULL));
		break;
	}
		
	while(1){
		CHECKe(flags = fcntl(0, F_GETFL));
		printf ("parent %d flags = %x\n", child, flags);
		sleep(1);
	}
}