develooper Front page | perl.perl5.porters | Postings from March 2001

Re: flock() on dup'ed filehandle is not enforced

Thread Previous | Thread Next
From:
Mark-Jason Dominus
Date:
March 28, 2001 10:27
Subject:
Re: flock() on dup'ed filehandle is not enforced
Message ID:
20010328182920.26357.qmail@plover.com

> Silly question - but do the failing suns have the files in question on NFS
> mounts? - if so do the NFS servers have the flock daemon working?

I did my test on /tmp, which was not nfs-MOUNTED.

Gwyn Judd says in clp.misc that the problem is as follows: The Perl 
        open STDOUT, ">>&F"
operation does not correspond to 

        close(1);
        dup2(6, 1);             /* here fileno(F) == 6 */

Instead, it does:

        dup(6);                 /* yields 7 */
        dup2(7, 1);
        close(7);                  
        
According to Gwyn, the close(7) releases the lock on the file, and
this semantics is mandated by POSIX.  If this is true, then it only
works on Linux because of a bug in Linux!



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About