summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-10-25 19:15:56 +0000
committerguenther <guenther@openbsd.org>2015-10-25 19:15:56 +0000
commit800a8ade7bb9667398282c53d4bb5e8ac8ee11be (patch)
treeaaa9742f172dcf911006e317074a67a0da00dda4 /lib/libc
parentRename imsg_compose_parent and imsg_compose_rde to imsg_ctl_parent and (diff)
downloadwireguard-openbsd-800a8ade7bb9667398282c53d4bb5e8ac8ee11be.tar.xz
wireguard-openbsd-800a8ade7bb9667398282c53d4bb5e8ac8ee11be.zip
Wrap waitpid() so calls go direct; weaken wait() and wait3().
Strip out unnecessary #includes and use NULL instead of (struct rusage *)0
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/wait.c6
-rw-r--r--lib/libc/gen/wait3.c5
-rw-r--r--lib/libc/gen/waitpid.c7
-rw-r--r--lib/libc/hidden/sys/wait.h28
4 files changed, 34 insertions, 12 deletions
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 <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
-#include <sys/resource.h>
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 <sys/types.h>
-#include <sys/time.h>
#include <sys/wait.h>
-#include <sys/resource.h>
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 <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
-#include <sys/resource.h>
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 <guenther@openbsd.org>
+ *
+ * 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 <sys/wait.h>
+
+PROTO_DEPRECATED(wait);
+PROTO_NORMAL(waitpid);
+PROTO_DEPRECATED(wait3);
+/*PROTO_CANCEL(wait4);*/
+
+#endif /* !_LIBC_SYS_WAIT_H_ */