Subject: select & pipe does not work!
From: [email-masked]

16 May 1997 09:23:09 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <c=CH%a=400NET%p=MIGROS%l=[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: <[email-masked]>
X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
Original-Sender: [email-masked]

Hi, 
I encountered a problem while porting some software. The select call
(waiting for a pipe) returns immediate even thougt there is no data
available from the pipe.
Then I tried a small test program (see below) and encountered the same
problem.

pipetest.c
------------------------------------------------------------------------
------------------------
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/select.h>
#include <sys/types.h>

main ()
{
    int result;
    int pipeFd [2];

    struct fd_set rset;

    if (pipe( pipeFd) < 0) {
        printf ("Error %d creating pipe\n", errno);
        exit (-1);
    }

    FD_ZERO (&rset);
    FD_SET (pipeFd[0], &rset);

    result = select (pipeFd[0]+1, &rset, (fd_set*)0,
                     (fd_set*)0, (struct timeval*)0);

    switch (result) {
        case 0:
            printf ("Select: received 0 ?!?\n");
            break;

        case -1:
            printf ("Select: Error occured\n");
            break;

        default:
            printf ("normal event\n");
            break;
    }
return (0);
}

------------------------------------------------------------------------
------------------------

compiled whith:
gcc -g -o pipetest pipetest.c

I've installes b18 on NT4.0. The same code on a UN*X box works fine.

Has anyone any ideas?
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".