This is what
perldoc -f syscall says:
There's a problem with
syscall(SYS_pipe()): it returns the file number of the read end of the pipe it creates, but there is no way to retrieve the file number of the other end. You can avoid this problem by using
However, that doesn't check out.
syscall works with
SYS_pipe just like with any other system call, and I'm perfectly able to retrieve both ends:
perl -e ' require "syscall.ph"; my $p = pack "i2"; syscall SYS_pipe(), $p; print join(",", unpack "i2", $p), "\n" ' 3,4
That was on linux, it's the same on openbsd and solaris provided that you take care of some differences (on solaris, the system call is actually
syscall 42, $p, 0).
A comment in
fs/pipe.c in the linux kernel source says:
/* * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way Unix traditionally does this, though. */
So what was that "traditional" way? And are there any modern systems where that's still the case?