POSIX: pipe column in FreeBSD vs Linux

On Linux (2.6.35-22-generic), the man pipe says that

pipe () creates a pipe, a one-way data channel that can be used for interprocess communication.

In FreeBSD (6.3-RELEASE-p5), the man pipe states that

The pipe () system call creates a pipe, which is an object that provides a bi-directional data stream, and allocates a couple of file descriptors. "

One is unidirectional, the other is bidirectional. I hope this is not a stupid question, but which method is the standard way? Are they POSIX compatible?

To make my intentions clear, I lost some points in the exam to believe that the pipe () was one of the ways, and I am looking for some ammunition to get some points; p

+6
linux posix pipe freebsd
source share
2 answers

I first started this as a comment on Greg, but it seems to me that it more accurately answers your specific question:

pipe() documentation in the POSIX standard explicitly indicates that the behavior in question is “unspecified”, that is, pipe() not required to be bidirectional, although this is not prohibited. Linux is unidirectional; FreeBSD is bi-directional. Both are compatible, one simply implements additional behavior that is not required (but does not interrupt applications designed to work on compatible systems).

Data can be written to file descriptor fildes [1] and read from file descriptor fildes [0]. Read on to the file descriptor fildes [0] should access the data written to the file descriptor fildes [1] at first at the beginning. it is unspecified whether fildes [0] is also open for writing and whether fildes [1] is also open for reading.

I would not expect to return the points (although I should). Professors tend to ignore the real world in favor of what they decided correctly.

+4
source share

The FreeBSD man page for pipe pretty straightforward:

The bi-directional nature of this pipe implementation does not migrate to older systems, so it is recommended that you use an agreement to use endpoints in the traditional way when using the pipe in one direction.

+3
source share

All Articles