Menu

#42 Support pipe()s

1.0
open
nobody
None
False
2015-01-20
2015-01-20
No

Need to create a pipe() interface. The syscall is already present, but it does nothing (actually it returns 0, which is incorrect - it should really return -1 in its present state).

To support this properly, the kernel needs to provide a queueing mechanism, similar to STREAMS in SVR4 such that one app can write data to a pipe, which waits to be consumed by the other end.

There should be a threshold for queued data at which point writes either block or a non-blocking write returns an error. Pipes also need to be bidirectional, with separate queues for each direction.

Pipe end closure needs to be detected too, and errors returned as appropriate. A pipe must start out with both endpoints connected (albeit to the same process). Then, if the read-side of one end is closed, any further writes at the other end must return error. Any queued data should be discarded.

Given that pipes are inherently passed between processes, there may need to be some way of either transferring a pipe fd to the new process (such that it is removed from the existing process), or that a refcounting system is required to track how many currently open fd's there are pointing to an endpoint.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB