develooper Front page | perl.perl5.porters | Postings from June 2004

Re: [perl #29883] Closing file seems to cause a seek operation

Thread Previous | Thread Next
Nick Ing-Simmons
June 1, 2004 09:20
Re: [perl #29883] Closing file seems to cause a seek operation
Message ID:
Dave Mitchell <> writes:
>On Fri, May 28, 2004 at 11:26:51AM +0200, LAUN Wolfgang wrote:
>> According to a colleague who has looked into this, it is not clear
>> whether it is in the standard io library or buried deep in fork
>> handling. It should be reported to Sun, and we'd like to cooperate on
>> this with you. 
>Judging by a truss on a Solaris machine, the child process (which still
>has the file open), does, just before exiting:
>9041:   llseek(3, 0xFFFFFFFFFFFFFFE4, SEEK_CUR)         = 10
>9041:   close(3)                                        = 0
>ie its diddling with the current tell position, which is shared between
>parent and child. This then confuses the parent. Why the first child is
>subtracting 28 from the position I do not know. Looks a bit like it's
>trying to undo the stuff read into the buffer but not yet read by the

I believe that is the intent, and it was added because in the system()
case it was expected that 
   while (<>)
carried on where child left off.

>Given that perl doesn't use the OS's stdio library, I'm not sure we can
>entirely rule Perl out of the equation yet. But I'm tired and am going to
>bed now....

I think we can rule perl in - but the reset file position stuff 
was copied from somesystems stdio behaviour.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About