blob: c501eb8b59cb3b1e8b91f99d81348709f2aba2c4 (
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
28
29
30
31
32
|
/* $OpenBSD: test_fcntl.c,v 1.3 2000/01/06 06:53:52 d Exp $ */
/*
* Test fcntl() flag inheritance across a fork()
*/
#include <stdio.h>
#include <fcntl.h>
#include "test.h"
int
main()
{
int flags, newflags, 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(newflags = fcntl(0, F_GETFL));
printf ("parent %d flags = %x\n", child, newflags);
sleep(1);
}
}
|