Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Apr 1995 08:20:33 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        rpt@miles.sso.loral.com (Richard Toren)
Cc:        hackers@FreeBSD.org
Subject:   Re: aspfilter & stdin
Message-ID:  <199504170620.IAA04159@uriah.heep.sax.de>
In-Reply-To: <Pine.SUN.3.91.950416174558.11362A-100000@miles> from "Richard Toren" at Apr 16, 95 05:54:29 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As Richard Toren wrote:
> 
> Giving the following results:
>    <src/rewind-stdin># make
>    cc -s -O -o rewindstdin rewindstdin.c
>    <src/rewind-stdin># cat rewindstdin.c | (file -; ./rewindstdin ;file -) 
>    standard input:              c program text
>    standard input:              empty
...
> 
> ?? why the '< 0' of the return code??

Since you cannot rewind a pipe.  Period.  That's why i wrote ``i dunno
how it could have ever worked for Andreas.''

LSEEK(2)                   UNIX Programmer's Manual                   LSEEK(2)

NAME
     lseek - reposition read/write file offset
...
     Lseek() will fail and the file pointer will remain unchanged if:

...
     [ESPIPE]  Fildes is associated with a pipe, socket, or FIFO.


Btw., the usage of <stdio> for the rewindstdin program is even more
bogus.  <stdio> does buffering of its own, which is not sharable
across processes.  (The current position of an object descriptor
however *is* sharable across multiple processes, provided they've got
identical copies of the descriptors, by dup(2).)

The bad news is that it's almost certain that apsfilter will have to
be modified to cope with this.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504170620.IAA04159>