/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* POSIX waitpid()
*
* pid < -1 WUNTRACED may not be fully supported
* process group specifics ignored by non-{waitpid,wait4}
*/
#include <ast.h>
#include <wait.h>
#if _lib_waitpid
#else
#if _lib_wait4
struct rusage;
{
}
#else
#if _lib_wait3
#else
#if _lib_wait2
extern int wait2(int*, int);
#else
#include <sig.h>
static int caught;
static void
int sig;
{
caught = 1;
}
#endif
#endif
#include <error.h>
struct zombie
{
int status;
};
{
register int p;
int s;
#if !_lib_wait2 && !_lib_wait3
#if !defined(SIGCLD)
int n;
int oerrno;
#endif
#endif
pp = 0;
while (zp)
{
{
return(pid);
}
}
for (;;)
{
#if !_lib_wait2 && !_lib_wait3
#if !defined(SIGCLD)
#endif
{
caught = 0;
#if defined(SIGCLD)
if (!caught)
{
return(0);
}
#else
#if defined(SIGALRM)
n = alarm(1);
#endif
#endif
}
#endif
#if !_lib_wait3
#if !_lib_wait2
#if defined(SIGCLD)
#else
#if defined(SIGALRM)
{
}
{
p = 0;
s = 0;
}
#endif
#endif
#else
#endif
#endif
if (p <= 0)
{
return(p);
}
{
return(p);
}
}
/*NOTREACHED*/
}
#endif
#endif