From: guenther Date: Sun, 25 Oct 2015 19:15:56 +0000 (+0000) Subject: Wrap waitpid() so calls go direct; weaken wait() and wait3(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=800a8ade7bb9667398282c53d4bb5e8ac8ee11be;p=openbsd Wrap waitpid() so calls go direct; weaken wait() and wait3(). Strip out unnecessary #includes and use NULL instead of (struct rusage *)0 --- diff --git a/lib/libc/gen/wait.c b/lib/libc/gen/wait.c index 30c1b591a9a..22cacd9f427 100644 --- a/lib/libc/gen/wait.c +++ b/lib/libc/gen/wait.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wait.c,v 1.5 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: wait.c,v 1.6 2015/10/25 19:15:56 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -28,13 +28,11 @@ * SUCH DAMAGE. */ -#include #include #include -#include pid_t wait(int *istat) { - return (wait4(WAIT_ANY, istat, 0, (struct rusage *)0)); + return (wait4(WAIT_ANY, istat, 0, NULL)); } diff --git a/lib/libc/gen/wait3.c b/lib/libc/gen/wait3.c index 5eb263b7f10..276c72c8966 100644 --- a/lib/libc/gen/wait3.c +++ b/lib/libc/gen/wait3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wait3.c,v 1.5 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: wait3.c,v 1.6 2015/10/25 19:15:56 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -28,10 +28,7 @@ * SUCH DAMAGE. */ -#include -#include #include -#include pid_t wait3(int *istat, int options, struct rusage *rup) diff --git a/lib/libc/gen/waitpid.c b/lib/libc/gen/waitpid.c index 078a6db38d9..576de085960 100644 --- a/lib/libc/gen/waitpid.c +++ b/lib/libc/gen/waitpid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: waitpid.c,v 1.6 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: waitpid.c,v 1.7 2015/10/25 19:15:56 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -28,13 +28,12 @@ * SUCH DAMAGE. */ -#include #include #include -#include pid_t waitpid(pid_t pid, int *istat, int options) { - return (wait4(pid, istat, options, (struct rusage *)0)); + return (wait4(pid, istat, options, NULL)); } +DEF_WEAK(waitpid); diff --git a/lib/libc/hidden/sys/wait.h b/lib/libc/hidden/sys/wait.h new file mode 100644 index 00000000000..4fdf0be1690 --- /dev/null +++ b/lib/libc/hidden/sys/wait.h @@ -0,0 +1,28 @@ +/* $OpenBSD: wait.h,v 1.1 2015/10/25 19:15:56 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBC_SYS_WAIT_H_ +#define _LIBC_SYS_WAIT_H_ + +#include_next + +PROTO_DEPRECATED(wait); +PROTO_NORMAL(waitpid); +PROTO_DEPRECATED(wait3); +/*PROTO_CANCEL(wait4);*/ + +#endif /* !_LIBC_SYS_WAIT_H_ */