Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: file-locking and postmaster.pid


  • From: korry <korry(at)appx(dot)com>
  • To: pgsql-hackers(at)postgresql(dot)org
  • Subject: Re: file-locking and postmaster.pid
  • Date: Wed, 24 May 2006 16:19:33 -0400
  • Message-id: <1148501973(dot)21335(dot)62(dot)camel(at)sakai(dot)localdomain>


Certainly on all platforms there must be *some* locking primitive.  We
just need to figure out the appropiate parameters to fcntl() or flock()
or lockf() on each.
Right.

The Win32 API for locking seems mighty strange to me.

Linux/Unix byte locking is advisory (meaning that one lock can block another lock, but it can't block a read).  Win32 locking is mandatory (at least in the most portable form) so a lock blocks a reader.  To avoid that problem, youlock a byte that you never intend to read (that is, you lock a byte past the end of the file).  Locking past the end-of-file is portable to all Unix/Linux systems that I've seen (that way, you can lock a region of a file before you grow the file).

        -- Korry



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group