count = select(rchildfdsn+1, (SELECT_FD_TYPE *) rchildfdsp, (SELECT_FD_TYPE *) NULL, (SELECT_FD_TYPE *) NULL, (struct timeval *) NULL);
count = select(FD_SETSIZE, (SELECT_FD_TYPE *) rchildfdsp, NULL, NULL, NULL);
extern void waitup(){#if	defined(HAVE_SELECT)	register int count;	register CHILD *pc;	fd_set *rchildfdsp = NULL;	int rchildfdsn = 0;	int bytes;	debugmsg(DM_CALL, "waitup() start\n");	if (needscan)		childscan();	if (activechildren <= 0)		return;	/*	 * Settup which children we want to select() on.	 */	for (pc = childlist; pc; pc = pc->c_next)		if (pc->c_readfd > rchildfdsn)			rchildfdsn = pc->c_readfd;	bytes = howmany(rchildfdsn+1, NFDBITS) * sizeof(fd_mask);	if ((rchildfdsp = (fd_set *)malloc(bytes)) == NULL)		return;	memset(rchildfdsp, 0, bytes);	for (pc = childlist; pc; pc = pc->c_next)		if (pc->c_readfd > 0) {			debugmsg(DM_MISC, "waitup() select on %d (%s)\n",				 pc->c_readfd, pc->c_name);			FD_SET(pc->c_readfd, rchildfdsp);		}	/*	 * Actually call select()	 */	/* XXX remove debugmsg() calls */	debugmsg(DM_MISC, "waitup() Call select(), activechildren=%d\n", 		 activechildren);	count = select(rchildfdsn+1, (SELECT_FD_TYPE *) rchildfdsp,		       (SELECT_FD_TYPE *) NULL, (SELECT_FD_TYPE *) NULL,		       (struct timeval *) NULL);	debugmsg(DM_MISC, "waitup() select returned %d activechildren = %d\n", 		 count, activechildren);	/*	 * select() will return count < 0 and errno == EINTR when	 * there are no active children left.	 */	if (count < 0) {		if (errno != EINTR)			error("Select failed reading children input: %s", 			      SYSERR);		free(rchildfdsp);		return;	}	/*	 * This should never happen.	 */	if (count == 0) {		error("Select returned an unexpected count of 0.");		free(rchildfdsp);		return;	}	/*	 * Go through the list of children and read from each child	 * which select() detected as ready for reading.	 */	for (pc = childlist; pc && count > 0; pc = pc->c_next) {		/* 		 * Make sure child still exists 		 */		if (pc->c_name && kill(pc->c_pid, 0) < 0 && 		    errno == ESRCH) {			debugmsg(DM_MISC, 				 "waitup() proc %d (%s) died unexpectedly!",				 pc->c_pid, pc->c_name);			pc->c_state = PSdead;			needscan = TRUE;		}		if (pc->c_name == NULL ||		    !FD_ISSET(pc->c_readfd, rchildfdsp))			continue;		readchild(pc);		--count;	}#else	/* !defined(HAVE_SELECT) */	/*	 * The non-select() version of waitproc()	 */	debugmsg(DM_CALL, "waitup() start\n");	if (waitproc((int *) NULL, TRUE) > 0)		--activechildren;#endif	/* defined(HAVE_SELECT) */	debugmsg(DM_CALL, "waitup() end\n");	free(rchildfdsp);}