Back to index

glibc  2.9
wait4.c
Go to the documentation of this file.
00001 /* This implements wait4 with the 4.4 BSD semantics (also those documented in
00002    SunOS 4.1) on top of SunOS's wait4 system call, which has semantics
00003    different from those documented.  Go Sun!
00004    Copyright (C) 1991,1992,1993,1995,1997,2004 Free Software Foundation, Inc.
00005    This file is part of the GNU C Library.
00006 
00007    The GNU C Library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Lesser General Public
00009    License as published by the Free Software Foundation; either
00010    version 2.1 of the License, or (at your option) any later version.
00011 
00012    The GNU C Library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Lesser General Public License for more details.
00016 
00017    You should have received a copy of the GNU Lesser General Public
00018    License along with the GNU C Library; if not, write to the Free
00019    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00020    02111-1307 USA.  */
00021 
00022 #include <sys/types.h>
00023 #include <sys/wait.h>
00024 #include <unistd.h>
00025 
00026 extern pid_t __wait4_syscall (pid_t pid, __WAIT_STATUS_DEFN stat_loc,
00027                            int options, struct rusage *usage);
00028 
00029 pid_t
00030 __wait4 (pid, stat_loc, options, usage)
00031      pid_t pid;
00032      __WAIT_STATUS_DEFN stat_loc;
00033      int options;
00034      struct rusage *usage;
00035 {
00036   switch (pid)
00037     {
00038     case WAIT_ANY:
00039       pid = 0;
00040       break;
00041 
00042     case WAIT_MYPGRP:
00043       pid = - getpgrp ();
00044       break;
00045     }
00046 
00047   return __wait4_syscall (pid, stat_loc, options, usage);
00048 }
00049 
00050 weak_alias (__wait4, wait4)