delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/19/21:12:00

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-Id: <4.2.2.20010819225911.00b94970@pop.online.no>
X-Sender: hardon AT pop DOT online DOT no (Unverified)
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.2
Date: Sun, 19 Aug 2001 23:06:13 +0200
To: cygwin AT cygwin DOT com
From: Gunnar Andre Dalsnes <hardon AT online DOT no>
Subject: Help on posix file lock semantics
Mime-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id VAA29428

Hi folks.

Have written a device driver for NT/W2K/XP which enumerates file locks per file.
This may make it possible to implement posix like file locks in cygwin:-)
But posix locks are complicated, so any feedback on issues below are appreciated.
I actually don't have linux to test it out myself (shoot me).

Gunnar André Dalsnes

Issue 1:
Affects: Uniprocess, CloseHandle (file)

Both win32 and posix discharges locks made by process when ends.

Win32 associate locks with handles. 
If one of many handles for a file close, only locks made by that handle is discharged.

Posix associate lock with files.
If one of many handles for a file close, all locks for file is discharged.

Fix:
Before every CloseHandle call (file), call driver->UNLOCKALL.
Driver unlock all locks our process holds on that file.


Issue 2:
Affects: Uniprocess, fcntl->F_SETLK->F_RDLCK/F_WRLCK/F_UNLCK

Both win32 and posix allow only one type of lock per byte of a file.

Win32 fails if any region overlap.

Posix upgrades a lock if a region overlap.
HELP! A lock can upgrade multiple overlapped regions of any type?
HELP! An unlock can unlock multiple overlapped regions of any type?

Fix:
Before every fcntl->F_SETLK->F_RDLCK/F_WRLCK call, call driver->UNLOCKOVL.
Driver unlocks conflicting overlapped regions for our process

Redirect every fcntl->F_SETLK->F_UNLCK call to driver->UNLOCKOVL. 
Driver unlocks affected overlapped regions for our process.


Issue 3:
Affects: Multiprocess, fcntl->F_GETLK

Win32 has no way of obtaining blocking locks.

Posix can obtaing blocking read locks or both.
HELP! How can readlocks be blocking if locks are upgradeable (uniprocess)?
There is no such thing as blocking read locks among multiple processes eighter!
All i can think of is blocking write locks among multiple processes.

Fix:
Redirect every fcntl->F_SETLK->F_GETLK call to driver->GETLOCK. 
Driver enumerates locks and returns first blocking lock.


Issue 4:
Affects: Multiprocess, fcntl->F_SETLKW

Win32 wait infinite on blocking locks.

HELP! Posix wait on blocking locks, but may be interupted by primitive signals?

Fix:
Clueless



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019