~mysql/mysql-server/mysql-6.0

« back to all changes in this revision

Viewing changes to mit-pthreads/tests/test_fcntl.c

  • Committer: bk at mysql
  • Date: 2000-07-31 19:29:14 UTC
  • Revision ID: sp1r-bk@work.mysql.com-20000731192914-08846
Import changeset

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <fcntl.h>
 
3
 
 
4
main()
 
5
{
 
6
        int flags, child;
 
7
 
 
8
        if ((flags = fcntl(0, F_GETFL)) < 0) {
 
9
                perror("fcntl 1st GETFL");
 
10
        }
 
11
        printf ("flags = %x\n", flags);
 
12
 
 
13
        switch(child = fork()) {
 
14
        case -1:
 
15
                printf("error during fork\n");
 
16
                break;
 
17
        case 0: /* child */
 
18
                execlp("test_create", "test_create", NULL);
 
19
                break;
 
20
        default: /* parent */
 
21
                wait(NULL);
 
22
                break;
 
23
        }
 
24
                
 
25
        while(1){
 
26
        if ((flags = fcntl(0, F_GETFL)) < 0) {
 
27
                perror("fcntl parent GETFL");
 
28
        }
 
29
        printf ("parent %d flags = %x\n", child, flags);
 
30
        sleep(1);
 
31
        }
 
32
}