blob: 60bc77ce4649478acf343cb0b45f9826bf5792ec (
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
|
#include <stdio.h>
#include <fcntl.h>
main()
{
int flags, child;
if ((flags = fcntl(0, F_GETFL)) < 0) {
perror("fcntl 1st GETFL");
}
printf ("flags = %x\n", flags);
switch(child = fork()) {
case -1:
printf("error during fork\n");
break;
case 0: /* child */
execlp("test_create", "test_create", NULL);
break;
default: /* parent */
wait(NULL);
break;
}
while(1){
if ((flags = fcntl(0, F_GETFL)) < 0) {
perror("fcntl parent GETFL");
}
printf ("parent %d flags = %x\n", child, flags);
sleep(1);
}
}
|