summaryrefslogtreecommitdiff
path: root/usr.bin/rdist
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-07-05 06:35:04 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-07-05 06:35:04 +0000
commit3a16bc8e4b527e3c3f136faf6906e4f8577c2205 (patch)
treea182342462058eadb7dada2fae232fe15ae4ea95 /usr.bin/rdist
parent47f09c8b22830d8fa71a3a4807d04601d6c1e4a6 (diff)
Assume POSIX: waitpid(), select(), and <sys/select.h>
Diffstat (limited to 'usr.bin/rdist')
-rw-r--r--usr.bin/rdist/child.c36
-rw-r--r--usr.bin/rdist/config-def.h8
-rw-r--r--usr.bin/rdist/os-openbsd.h13
3 files changed, 5 insertions, 52 deletions
diff --git a/usr.bin/rdist/child.c b/usr.bin/rdist/child.c
index 553e6125991..72e55d41335 100644
--- a/usr.bin/rdist/child.c
+++ b/usr.bin/rdist/child.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: child.c,v 1.20 2014/07/05 06:18:58 guenther Exp $ */
+/* $OpenBSD: child.c,v 1.21 2014/07/05 06:35:03 guenther Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -36,10 +36,8 @@
*/
#include <sys/types.h>
-#include <sys/wait.h>
-#if defined(NEED_SYS_SELECT_H)
#include <sys/select.h>
-#endif /* NEED_SYS_SELECT_H */
+#include <sys/wait.h>
typedef enum _PROCSTATE {
PSrunning,
@@ -225,26 +223,16 @@ readchild(CHILD *child)
static pid_t
waitproc(int *statval, int block)
{
- WAIT_ARG_TYPE status;
+ int status;
pid_t pid;
int exitval;
debugmsg(DM_CALL, "waitproc() %s, active children = %d...\n",
(block) ? "blocking" : "nonblocking", activechildren);
-#if WAIT_TYPE == WAIT_WAITPID
pid = waitpid(-1, &status, (block) ? 0 : WNOHANG);
-#else
-#if WAIT_TYPE == WAIT_WAIT3
- pid = wait3(&status, (block) ? 0 : WNOHANG, NULL);
-#endif /* WAIT_WAIT3 */
-#endif /* WAIT_WAITPID */
-#if defined(WEXITSTATUS)
exitval = WEXITSTATUS(status);
-#else
- exitval = status.w_retcode;
-#endif /* defined(WEXITSTATUS) */
if (pid > 0 && exitval != 0) {
nerrs++;
@@ -345,20 +333,13 @@ childscan(void)
}
/*
-#if defined HAVE_SELECT
*
* Wait for children to send output for us to read.
*
-#else !HAVE_SELECT
- *
- * Wait up for children to exit.
- *
-#endif
*/
void
waitup(void)
{
-#if defined(HAVE_SELECT)
int count;
CHILD *pc;
fd_set *rchildfdsp = NULL;
@@ -447,17 +428,6 @@ waitup(void)
}
free(rchildfdsp);
-#else /* !defined(HAVE_SELECT) */
-
- /*
- * The non-select() version of waitproc()
- */
- debugmsg(DM_CALL, "waitup() start\n");
-
- if (waitproc(NULL, TRUE) > 0)
- --activechildren;
-
-#endif /* defined(HAVE_SELECT) */
debugmsg(DM_CALL, "waitup() end\n");
}
diff --git a/usr.bin/rdist/config-def.h b/usr.bin/rdist/config-def.h
index e5f2a8f9a6d..78ba23178b1 100644
--- a/usr.bin/rdist/config-def.h
+++ b/usr.bin/rdist/config-def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: config-def.h,v 1.8 2014/07/05 06:18:58 guenther Exp $ */
+/* $OpenBSD: config-def.h,v 1.9 2014/07/05 06:35:03 guenther Exp $ */
/*
* Copyright (c) 1993 Michael A. Cooper
@@ -43,12 +43,6 @@
*/
/*
- * Types of wait() functions
- */
-#define WAIT_WAIT3 1
-#define WAIT_WAITPID 2
-
-/*
* Types of directory routines
*/
#define DIR_DIRECT 1
diff --git a/usr.bin/rdist/os-openbsd.h b/usr.bin/rdist/os-openbsd.h
index fa97c10b41a..c71cc91a980 100644
--- a/usr.bin/rdist/os-openbsd.h
+++ b/usr.bin/rdist/os-openbsd.h
@@ -29,7 +29,7 @@
*/
/*
- * $OpenBSD: os-openbsd.h,v 1.15 2014/07/05 06:18:58 guenther Exp $
+ * $OpenBSD: os-openbsd.h,v 1.16 2014/07/05 06:35:03 guenther Exp $
*/
/*
@@ -61,16 +61,6 @@
#define FSI_TYPE FSI_GETFSSTAT
/*
- * Type of wait() function to use.
- */
-#define WAIT_TYPE WAIT_WAIT3
-
-/*
- * Type of argument passed to wait() (above).
- */
-#define WAIT_ARG_TYPE int
-
-/*
* Select the type of statfs() system call (if any).
*/
#define STATFS_TYPE STATFS_44BSD
@@ -113,7 +103,6 @@ typedef void POINTER;
#define HAVE_LCHOWN /* Have lchown() */
#define HAVE_FCHMOD /* Have fchmod() */
#define HAVE_FTRUNCATE /* Have ftruncate() */
-#define HAVE_SELECT /* Have select() */
#define HAVE_SAVED_IDS /* Have POSIX style saved [ug]id's */
#define HAVE_VIS /* Have vis() */
#define HAVE_VSNPRINTF /* Have vsnprintf() */