Date: Tue, 4 May 1999 22:57:44 -0700 From: "David Schwartz" <davids@webmaster.com> To: "Sameer R. Manek" <manek@ecst.csuchico.edu>, <freebsd-stable@freebsd.org> Subject: RE: bug with lockf(3)? Message-ID: <000001be96bc$32002180$021d85d1@whenever.youwant.to> In-Reply-To: <Pine.GHP.4.05.9905041726110.29925-100000@polio.ecst.csuchico.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> Given 2 processes A and B, both with open file descriptors to a file, > using open ("file.txt",O_RDWR) > A calls lockf (fd,F_LOCK,0) and proceeds to read/write to file > while file is still locked.... > B calls lockf (fd,F_LOCK,0) and enters blocked stait > A calls lockf (fd,F_ULOCK,0) > B is still in blocked state, until A exit(3)s. As a wild guess, did A move the file pointer inbetween the two calls to lockf? A third parameter of zero means to lock or unlock from the current position to infinity. If you lock zero to infinity, then block on a lock from zero to infinity, the unlock to infinity must also be to zero. My guess is that A's read/write operations leave the file pointer elsewhere, thus causing it to fail to release its lock. DS To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001be96bc$32002180$021d85d1>