/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1995 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Compatibility lib for BSD's wait3() and wait4().
*/
#include <errno.h>
#include <sys/resource.h>
#include "signalmap.h"
/*
* Since sysV does not support rusage as in BSD, an approximate approach
* is:
* ...
* call times
* call waitid
* if ( a child is found )
* call times again
* rusage ~= diff in the 2 times call
* ...
*
*/
/*
* arguments to wait functions from SVR4
*/
/*
* SIGCLD signal codes from SVr4
*/
/*
* id type from SVR4 procset.h
*/
typedef enum idtype {
/* identifier. */
} idtype_t;
static void mapstatus(int *, int);
int
{
if ((int)status == -1) {
return (-1);
}
if (status)
return (ret);
}
int
{
int nstatus;
if ((int)status == -1) {
return (-1);
}
/*
* BSD's wait* routines only support WNOHANG & WUNTRACED
*/
return (EINVAL);
if (status)
return (ret);
}
/*
* It would be -so- nice just to call _wait3 and mapstatus here.
*/
int
{
}
static int wstat(int, int);
/*
* It would be -so- nice just to call _wait4 and mapstatus here.
*/
int
{
int error;
int noptions;
return(-1);
}
if (rp)
if (times(&before_tms) < 0)
return (-1); /* errno is set by times() */
/*
* BSD's wait* routines only support WNOHANG & WUNTRACED
*/
return (EINVAL);
/*
* Emulate undocumented 4.x semantics for 1186845
*/
if (pid < 0) {
} else if (pid == 0)
else
if (error == 0) {
return (0); /* no child found */
if (rp) {
return (-1); /* errno already set by times() */
/*
*/
}
if (status)
} else {
return (-1); /* error number is set by waitid() */
}
}
/*
* Convert the status code to old style wait status
*/
static int
{
switch (code) {
case CLD_EXITED:
stat <<= 8;
break;
case CLD_KILLED:
if (code == CLD_DUMPED)
break;
case CLD_DUMPED:
break;
case CLD_TRAPPED:
case CLD_STOPPED:
stat <<= 8;
break;
}
return (stat);
}
static void
{
switch(stat) {
case _WSTOPPED:
break;
case 0:
break;
default:
if (old & 0x80)
}
}