Hello.
After further investigation and tests, related with the change in r671604 to drop the file locking strategy in favour of a flock on the data dir.

Trying to write a similar code, but using lockf, I hit the issue that the file must be opened using O_RDWR or O_RWONLY, and that's not allowed for a directory.
The same happens trying to use a fcntl call.
And unexpectedly, the same for flock. In the solaris manual page:

<snip>
    Read permission is required on a file  to  obtain  a  shared
    lock,   and  write  permission  is  required  to  obtain  an
    exclusive lock.
</snip>

But the linux man page claims:

<snip>
A shared or exclusive lock can be placed on a file regardless of the mode in which the file was opened.
</snip>

I've searched the web for some BSD system pages, but they don't say anything about the file mode.


On the other way, POSIX fcntl specification says, apropos the failure causes:

[EBADF]
   The /fildes/ argument is not a valid open file descriptor, or the
   argument /cmd/ is F_SETLK or F_SETLKW, the type of lock, *l_type*,
   is a shared lock (F_RDLCK), and /fildes/ is not a valid file
   descriptor open for reading, or the type of lock *l_type*, is an
   exclusive lock (F_WRLCK), and /fildes/ is not a valid file
descriptor open for writing.
Posix specs also forces write permissions for lockf:
http://www.opengroup.org/onlinepubs/007908799/xsh/lockf.html



This leads to solaris not being able to lock directly on a directory, I'm afraid. Any idea?


Best regards.
--
Manuel.


Reply via email to