Re: seekable pipes

Bryan Henderson <[email protected]> Tue, 21 Jun 2005 17:53:02 -0700
Newsgroups gmane.linux.file-systems,gmane.linux.userfs
Message-ID <OF74F441E9.0AB3FE3A-ON88257028.0003A904-88257028.0004DEAA@us.ibm.com>
>Actually, I don't see how it matters either way. Named
>pipes get set up in pretty much the same way as
>anonymous ones, except the two processes don't have to
>be related.

It's the fact that the two processes don't have to be related that is 
crucial.  Maybe worded better:  It's the fact that someone who knows about 
seekable pipes can synchronize the process that makes the pipe seekable 
with the process that needs it to be seekable.  In the anonymous case 
(more precisely, the case of the anonymous pipe generated and deployed by 
a seekable-pipe-agnostic program such as Bash), you can't make sure the 
guy who makes the pipe seekable does so before the guy who needs it to be 
seekable notices that it's not.  In the named case, the user can make sure 
he doesn't start the process that needs the pipe to be seekable until the 
process that makes it seekable has done so.

>one can imagine
>being able to do:
>$ command_that_understands_seekable_pipes |
>command_that_requires_seekable_stdin
>without the second command or the shell having to know
>anything in particular about the seekable pipes API. 

If you mean without making Bash seekable-pipe-aware, then 
"command_that_requires_seekable_stdin" might try to seek (or conclude from 
its S_IFIFO mode that it isn't seekable) before 
"command_that_understands_seekable_pipes" makes the seek possible (or 
makes sure S_IFIFO isn't set).

By the way, I don't think reader vs writer is what we care about.  It's 
what we've been calling master vs slave (from pseudo-tty terminology), and 
would probably better be termed client vs server.  The client is the 
program that thinks he's looking at a conventional file, so he can seek, 
read, and write.  The server is the guy who knows it's a special seekable 
pipe file and whose job it is to make the client see a conventional file.

--
Bryan Henderson                     IBM Almaden Research Center
San Jose CA                         Filesystems 
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html