problem opening multiple pipes with pipe(2) in 2.4.1[78]

From: sean finney (seanius@seanius.net)
Date: Mon Oct 21 2002 - 20:32:20 EST


hi everyone

i'm not sure whether i should be sending this here or to some libc
mailing list, but i couldn't seem to find the code for pipe(2) in libc
so i'm assuming it's in the kernel.

i have a simple program that illustrates a problem i'm having in a more
complex program. if i try to open multiple pipes with calls to pipe(),
Really Wierd Stuff seems to start happening:

#include <unistd.h>

int main(){
        int p1[2], p2[2];
        pipe(p1);
        perror("p1");
        pipe(p2);
        perror("p2");
        return 0;
}

produces the following output:

oil[~]21:22:03$ ./a.out
p1b: Success
p2b: Illegal seek

i'm really confused here. first of all, pipe's manpage doesn't say
anything about setting errno to ESPIPE (which is what it's doing), and
secondly, PIPE IS RETURNING 0. i just spent the past 4 hours trying to
figure why my program was segfaulting before i got to this, which is
even more frustrating because i was checking for errors from the result
of pipe().

so i'm hoping i've just completely overlooked something and someone will
be able to point out the error of my ways. any advice or pointers would
really be appreciated, thanks

--sean



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:56 EST