Creating Compressed Loop FS from stdin

ari edelkind edelkind-freebsd-hackers at episec.com
Thu Dec 30 06:23:57 PST 2004


roam at ringlet.net wrote:

> > It will not help, since AFAIK you can't seek stdin anyway, or even if I 
> > am wrong and you can seek it to the end you will be unable to seek it 
> > backward.
> 
> I tested the patch before posting it, fully expecting to find that stdin
> really cannot be seeked (sought? :), and surprisingly it worked, at least
> on RELENG_5 as of today!

You can always seek stdin, if stdin happens to be associated with a
seekable descriptor.  It isn't given any special treatment simply
because it has a vector of 0.  That is, if you use something along the
lines of:

    % ./seekme </etc/services

then /etc/services is associated with descriptor 0, and you can seek all
you like.  If you use

    % cat /etc/services |./seekme

... then the descriptor isn't associated with a file, and you'll run
into problems.

ari



More information about the freebsd-hackers mailing list