xref: /freebsd/lib/libc/sys/wait3.c (revision d7847a8d351436a4654bd2c746bc9c04401160ee)
1*d7847a8dSBrooks Davis /*-
2*d7847a8dSBrooks Davis  * SPDX-License-Identifier: BSD-3-Clause
3*d7847a8dSBrooks Davis  *
4*d7847a8dSBrooks Davis  * Copyright (c) 1988, 1993
5*d7847a8dSBrooks Davis  *	The Regents of the University of California.  All rights reserved.
6*d7847a8dSBrooks Davis  *
7*d7847a8dSBrooks Davis  * Redistribution and use in source and binary forms, with or without
8*d7847a8dSBrooks Davis  * modification, are permitted provided that the following conditions
9*d7847a8dSBrooks Davis  * are met:
10*d7847a8dSBrooks Davis  * 1. Redistributions of source code must retain the above copyright
11*d7847a8dSBrooks Davis  *    notice, this list of conditions and the following disclaimer.
12*d7847a8dSBrooks Davis  * 2. Redistributions in binary form must reproduce the above copyright
13*d7847a8dSBrooks Davis  *    notice, this list of conditions and the following disclaimer in the
14*d7847a8dSBrooks Davis  *    documentation and/or other materials provided with the distribution.
15*d7847a8dSBrooks Davis  * 3. Neither the name of the University nor the names of its contributors
16*d7847a8dSBrooks Davis  *    may be used to endorse or promote products derived from this software
17*d7847a8dSBrooks Davis  *    without specific prior written permission.
18*d7847a8dSBrooks Davis  *
19*d7847a8dSBrooks Davis  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20*d7847a8dSBrooks Davis  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*d7847a8dSBrooks Davis  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*d7847a8dSBrooks Davis  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23*d7847a8dSBrooks Davis  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*d7847a8dSBrooks Davis  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*d7847a8dSBrooks Davis  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*d7847a8dSBrooks Davis  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*d7847a8dSBrooks Davis  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*d7847a8dSBrooks Davis  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*d7847a8dSBrooks Davis  * SUCH DAMAGE.
30*d7847a8dSBrooks Davis  */
31*d7847a8dSBrooks Davis 
32*d7847a8dSBrooks Davis #include "namespace.h"
33*d7847a8dSBrooks Davis #include <sys/types.h>
34*d7847a8dSBrooks Davis #include <sys/time.h>
35*d7847a8dSBrooks Davis #include <sys/wait.h>
36*d7847a8dSBrooks Davis #include <sys/resource.h>
37*d7847a8dSBrooks Davis #include "un-namespace.h"
38*d7847a8dSBrooks Davis 
39*d7847a8dSBrooks Davis #include "libc_private.h"
40*d7847a8dSBrooks Davis 
41*d7847a8dSBrooks Davis pid_t __wait3(int *, int, struct rusage *);
42*d7847a8dSBrooks Davis 
43*d7847a8dSBrooks Davis pid_t
44*d7847a8dSBrooks Davis __wait3(int *istat, int options, struct rusage *rup)
45*d7847a8dSBrooks Davis {
46*d7847a8dSBrooks Davis 	return (((pid_t (*)(pid_t, int *, int, struct rusage *))
47*d7847a8dSBrooks Davis 	    *(__libc_interposing_slot(INTERPOS_wait4)))
48*d7847a8dSBrooks Davis 	    (WAIT_ANY, istat, options, rup));
49*d7847a8dSBrooks Davis }
50*d7847a8dSBrooks Davis 
51*d7847a8dSBrooks Davis __weak_reference(__wait3, wait3);
52