Package: manpages-dev Version: 2.01-1 Severity: normal The flock(2) man page says
A process may only hold one type of lock (shared or exclusive) on a file. Subsequent flock() calls on an already locked file will convert an existing lock to the new lock mode. I read this as meaning the lock is associated with the process, and I tried converting a lock through a second opened fd per the test program below but it hung after printing "about to do second flock". The lock is actually associated with the file table entry is it? Or the table entry plus the process? Perhaps this can be clarified. #include <stdio.h> #include <sys/file.h> int main (void) { int x, y, ret; x = open ("foo.tmp", O_RDWR | O_CREAT, 0666); if (x == -1) perror ("first open"); ret = flock (x, LOCK_EX); if (ret == -1) perror ("first flock"); y = open ("foo.tmp", O_RDWR); if (y == -1) perror ("first open"); printf ("about to do second flock\n"); ret = flock (y, LOCK_SH); if (ret == -1) perror ("second flock"); printf ("done\n"); return 0; } -- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i586) Kernel: Linux 2.6.8-1-386 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages manpages-dev depends on: ii manpages 2.01-1 Manual pages about using a GNU/Lin -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]