| 1 | /* |
| 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. |
| 5 | * |
| 6 | * @(#)wait_.c 5.1 6/7/85 |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * wait for a child to die |
| 11 | * |
| 12 | * calling sequence: |
| 13 | * integer wait, status, chilid |
| 14 | * chilid = wait(status) |
| 15 | * where: |
| 16 | * chilid will be - >0 if child process id |
| 17 | * - <0 if (negative of) system error code |
| 18 | * status will contain the exit status of the child |
| 19 | * (see wait(2)) |
| 20 | */ |
| 21 | |
| 22 | extern int errno; |
| 23 | |
| 24 | long wait_(status) |
| 25 | long *status; |
| 26 | { |
| 27 | int stat; |
| 28 | int chid = wait(&stat); |
| 29 | if (chid < 0) |
| 30 | return((long)(-errno)); |
| 31 | *status = (long)stat; |
| 32 | return((long)chid); |
| 33 | } |