Win 2K3 & File Locking

Discussion in 'Perl Misc' started by Paanwa, Feb 19, 2004.

  1. Paanwa

    Paanwa Guest

    Anyone aware of file locking issues specific to Perl on Windows 2003 server?
    Paanwa, Feb 19, 2004
    1. Advertisements

  2. As far as I know, only those which exist in Perl/Win32 anyway. Check the docs.

    The main biggie is twofold.

    1. Locks on windows are mandatory.
    2. Perl flock locks don't play nicely with other win32 applications.

    Windows has two kinds of mandatory locks, and no advisory locks. Share mode, which is applied at the time you open the file, and range locks, which are applied to an open file. Most applications open files with FILE_SHARE_READ|FILE_SHARE_WRITE, meaning that the file can be opened by another process with read or write access. Applications which need to lock a file generally deny sharing, which means that other applications will fail to open them. Conversely, many applications assume that if they can open the file, they will be able to read it. When they successfully open the file but fail to read any data, they will have a sort of "don't know why" error, and it will be treated differently from if they failed to open the file.

    In unix, file locks are applied after the file is opened. In order to allow this to happen in Perl on Win32, perl's flock sets a range lock when you call flock. This allows interoperation with other perl modules, but will surprise most applications, which expect that if the file is in use, the open will fail.

    I'm working on a portable locking implementation which provides share-mode opening on windows, and equivalent semantics on Unix/Linux. It also provides portable range locks on Solaris, BSD, Linux and Win32.

    Not done yet though.

    Ben Liddicott

    "Paanwa" <> wrote in message news:40350c15$0$49485$...
    > Anyone aware of file locking issues specific to Perl on Windows 2003 server?
    Ben Liddicott, Feb 22, 2004
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Esteban Felipe
    John Saunders
    Oct 27, 2003
  2. =?Utf-8?B?TSBHcmVldnk=?=

    Changing a password from ASP for a non domain win 2k3 server

    =?Utf-8?B?TSBHcmVldnk=?=, Jan 22, 2004, in forum: ASP .Net
    Jan 22, 2004
  3. Replies:
  4. Krist
    Arne Vajhøj
    May 7, 2010
  5. Pradeep

    Querying AD on Win 2K3 server

    Pradeep, May 6, 2006, in forum: ASP .Net Security
    Joe Kaplan \(MVP - ADSI\)
    May 6, 2006

Share This Page