strange note in fcntl docs

Skip Montanaro skip at pobox.com
Mon Jan 17 10:01:25 EST 2005


    John> In the fnctl docs for both python 2.3 and 2.4 there is a note at
    John> the bottom that says

    John> The os.open() function supports locking flags and is available on
    John> a wider variety of platforms than the lockf() and flock()
    John> functions, providing a more platform-independent file locking
    John> facility.

    John> however, in neither of those versions does os.open support any
    John> kind of mysterious "locking flags", nor is there any reference in
    John> os to any kind of locking magic (nor do any C open()s I know of
    John> support any kind of locking semantics). The note seems bogus; am I
    John> missing something, or should it be elided?

I could have sworn that os.open supported the O_SHLOCK and O_EXLOCK flags.
I'm pretty sure I've used them in the past, but don't see them now.  (They
aren't in 2.2 either.)

If you try this:

    O_SHLOCK = 0x0010
    O_EXLOCK = 0x0020

(those are the definitions on my Mac - YMMV) does

    os.open("somefile", O_SHLOCK|<other flags>)

work?

Skip



More information about the Python-list mailing list