Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: mdtanx@cs.umd.edu (Michael D. Tan)
Subject: BUG[?]: select() for reading from unattached FIFO
Date: 6 Jul 1994 08:27:15 -0400	[thread overview]
Message-ID: <2ve7v3$fap@poptart.cs.umd.edu> (raw)


Can anyone else confirm this bug?  I have a FIFO which I have opened
for reading on one side using O_RDONLY | O_NDELAY.  No writers are
attached to the FIFO yet.  When I do a select() for reading on this
FIFO, select() returns that the FIFO is ready for reading, but a
read() returns nothing (correctly).  In SunOS, select() *doesn't* say
the FIFO is readable, but my same test program in OSF/1 v2.0 says it
is.  This is a bug, isn't it?


Thanks.
Michael Tan
mdtanx@cs.umd.edu


Here's the test program:

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>

#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>


main() {
    int fd,;
    fd_set readfds;

    unlink("AFIFO");
    mkfifo("AFIFO", 0660);

    if ((fd = open("AFIFO", O_RDONLY | O_NDELAY)) < 0)
    {
        printf("open for workin failed\n");
        exit (-1);
    }
    FD_ZERO(&readfds);
    FD_SET(fd, &readfds);
    select(fd+1, &readfds, NULL, NULL, NULL);
    if (FD_ISSET(fd, &readfds))
    {
        char ss[200];
        int amt;
        ss[0] = '\0';
        printf("fd was set\n");
        if ((amt = read(fd, ss, 200)) < 0)
            printf("read error %d\n", errno);
        printf("Read %d bytes: %s\n", amt, ss);
    }
}




             reply	other threads:[~1994-07-06 12:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-07-06 12:27 Michael D. Tan [this message]
1994-07-07  6:37 ` BUG[?]: select() for reading from unattached FIFO Burkhard Neidecker-Lutz
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox