[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#7251) MDB shared mutexes ambiguous on Apple/Windows



Full_Name: Howard Chu
Version: HEAD/RE24
OS: 
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (109.151.244.127)
Submitted by: hyc


Currently since MacOSX and Windows don't support process-shared mutexes residing
in shared memory, MDB uses global named semaphores instead on these platforms.
The semaphore name is derived from a hash of the pathname of the lock file. This
approach was quick and dirty and is prone to failure if relative paths and
absolute paths are mixed, or if a file can be accessed thru multiple paths (e.g.
symlinks, loopback mounts, whatever).

Instead of the pathname, a unique file identifier of the lock file should be
used. For MacOSX we can obtain (device,inode) using fstat(). For Windows we can
obtain (dwVolumeSerialNumber,nFileIndexLow,nFileIndexHigh) using
GetFileInformationByHandle().