1 | #define INCL_DOS
|
---|
2 | #include <os2.h>
|
---|
3 |
|
---|
4 | #include <stdio.h>
|
---|
5 | #include <stdlib.h>
|
---|
6 | #include <process.h>
|
---|
7 |
|
---|
8 |
|
---|
9 | int main( int argc, char argv[])
|
---|
10 | {
|
---|
11 | FILE* fp;
|
---|
12 | int rc, pid, i;
|
---|
13 | int status;
|
---|
14 |
|
---|
15 | printf( "pid %d\n", getpid());
|
---|
16 |
|
---|
17 | pid = fork();
|
---|
18 | if (pid == 0) {
|
---|
19 | printf( "pid %d, child\n", getpid());
|
---|
20 | DosSleep(1000);
|
---|
21 | printf( "pid %d, child exit\n", getpid());
|
---|
22 | exit(0);
|
---|
23 | }
|
---|
24 | if (pid == -1) {
|
---|
25 | printf( "pid %d, fork failed errno=%d\n", getpid(), errno);
|
---|
26 | }
|
---|
27 |
|
---|
28 | printf( "pid %d, exit\n", getpid());
|
---|
29 |
|
---|
30 | #if 0
|
---|
31 | // wait children
|
---|
32 | wait(&status);
|
---|
33 | #endif
|
---|
34 |
|
---|
35 |
|
---|
36 | }
|
---|
37 |
|
---|