Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!uunet!wiley!wiley.uucp!doug From: doug@wiley.uucp (Doug Rudoff) Newsgroups: comp.unix.ultrix Subject: select() on named pipes Message-ID: <9731@wiley.UUCP> Date: 4 May 90 00:47:32 GMT Sender: doug@wiley.UUCP Organization: Mobile Data International Lines: 42 Reply-To:rudoff@mdi.com On a DECstations 3100 I am trying to do a select() call to see if there's data to be read from a named pipe. I set the timeout to be 5 seconds. The problem is that it seems that select() does not recognize that there is data to be read. Here's what I'm doing: main() { struct timeval timeout; int readfds, n; cnt_init(); timeout.tv_sec = 5; timeout.tv_usec = 0; /* Wait 5 seconds for data on the pipe and then update status lines */ while (1) { readfds = 1 << pipe_fd; n = select(1, &readfds, NULL, NULL, &timeout); if (n > 0) read_pipe(); else if (n == -1) perror(""); do_maintenance(); } } select() is always returning a zero (after waiting 5 seconds) even if there is data in the pipe. I know there is data in the pipe since if I stop the program in the debugger, I can directly call read_pipe() and get the data that is there. I have select() working elsewhere with stdin so I think I'm using it correctly. Am I doing something wrong here or is there a problem with select() and pipes in Ultrix 3.1? Doug Rudoff Mobile Data International (206) 487-5937 uunet!mdisea!rudoff, rudoff@MDI.COM