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

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

Thread Previous | Thread Next
Mark-Jason Dominus
March 28, 2001 10:27
Re: flock() on dup'ed filehandle is not enforced
Message ID:

> 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 

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

Instead, it does:

        dup(6);                 /* yields 7 */
        dup2(7, 1);
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About