Commit | Line | Data |
---|---|---|
a918866c | 1 | /* |
161423a6 RE |
2 | * Copyright (c) 1980 Regents of the University of California. |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
a918866c | 5 | * |
161423a6 RE |
6 | * @(#)fork_.c 5.1 %G% |
7 | */ | |
8 | ||
9 | /* | |
a918866c DW |
10 | * fork a copy of this process |
11 | * | |
12 | * calling sequence: | |
13 | * integer fork | |
14 | * ierror = fork() | |
15 | * where: | |
16 | * ierror will be - child pid if parent and successful | |
17 | * - 0 if child | |
18 | * - -errno if unsuccessful | |
19 | */ | |
20 | ||
21 | #include "../libI77/fiodefs.h" | |
22 | ||
23 | extern int errno; | |
24 | ||
25 | long fork_() | |
26 | { | |
27 | long i; | |
28 | ||
29 | for (i = 0; i < MXUNIT; i++) | |
30 | flush_(&i); | |
31 | i = (long)fork(); | |
32 | if (i < 0) | |
33 | return((long)(-errno)); | |
34 | return(i); | |
35 | } |