FD_CLR (curclient, &clientsReadable);
clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient);
WaitForSomething(pClientsReady)    int        *pClientsReady;{    struct timeval *wt,                waittime;    fd_set      clientsReadable;    fd_set      clientsWriteable;    long        curclient;    int         selecterr;    long        current_time = 0;    long        timeout;    int         nready,                i;    while (1) {	/* handle the work Q */	if (workQueue)	    ProcessWorkQueue();	if (XFD_ANYSET(&ClientsWithInput)) {	    XFD_COPYSET(&ClientsWithInput, &clientsReadable);	    break;	}	/*	 * deal with KeepAlive timeouts.  if this seems to costly, SIGALRM	 * could be used, but its more dangerous since some it could catch us	 * at an inopportune moment (like inside un-reentrant malloc()).	 */	current_time = GetTimeInMillis();	timeout = current_time - LastReapTime;	if (timeout > ReapClientTime) {	    ReapAnyOldClients();	    LastReapTime = current_time;	    timeout = ReapClientTime;	}	timeout = ReapClientTime - timeout;	waittime.tv_sec = timeout / MILLI_PER_SECOND;	waittime.tv_usec = (timeout % MILLI_PER_SECOND) *	    (1000000 / MILLI_PER_SECOND);	wt = &waittime;	XFD_COPYSET(&AllSockets, &LastSelectMask);	BlockHandler((pointer) &wt, (pointer) &LastSelectMask);	if (NewOutputPending)	    FlushAllOutput();	if (AnyClientsWriteBlocked) {	    XFD_COPYSET(&ClientsWriteBlocked, &clientsWriteable);	    i = Select(MAXSOCKS, &LastSelectMask, &clientsWriteable, NULL, wt);	} else {	    i = Select(MAXSOCKS, &LastSelectMask, NULL, NULL, wt);	}	selecterr = errno;	WakeupHandler(i, (pointer) &LastSelectMask);	if (i <= 0) {		/* error or timeout */	    FD_ZERO(&clientsWriteable);	    if (i < 0) {		if (selecterr == EBADF) {	/* somebody disconnected */		    CheckConnections();		} else if (selecterr != EINTR) {		    ErrorF("WaitForSomething: select(): errno %d\n", selecterr);		} else {		    /*		     * must have been broken by a signal.  go deal with any		     * exception flags		     */		    return 0;		}	    } else {		/* must have timed out */		ReapAnyOldClients();		LastReapTime = GetTimeInMillis();	    }	} else {	    if (AnyClientsWriteBlocked && XFD_ANYSET(&clientsWriteable)) {		NewOutputPending = TRUE;		XFD_ORSET(&OutputPending, &clientsWriteable, &OutputPending);		XFD_UNSET(&ClientsWriteBlocked, &clientsWriteable);		if (!XFD_ANYSET(&ClientsWriteBlocked))		    AnyClientsWriteBlocked = FALSE;	    }	    XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients);	    if (LastSelectMask.fds_bits[0] & WellKnownConnections.fds_bits[0])		MakeNewConnections();	    if (XFD_ANYSET(&clientsReadable))		break;	}    }    nready = 0;    if (XFD_ANYSET(&clientsReadable)) {	ClientPtr   client;	int         conn;	if (current_time)	/* may not have been set */	    current_time = GetTimeInMillis();	for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {	    while (clientsReadable.fds_bits[i]) {		curclient = ffs(clientsReadable.fds_bits[i]) - 1;		conn = ConnectionTranslation[curclient + (i << 5)];		FD_CLR (curclient, &clientsReadable);		client = clients[conn];		if (!client)		    continue;		pClientsReady[nready++] = conn;		client->last_request_time = current_time;		client->clientGone = CLIENT_ALIVE;	    }	}    }    return nready;}