Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 May 1999 22:57:44 -0700
From:      "David Schwartz" <>
To:        "Sameer R. Manek" <>, <>
Subject:   RE: bug with lockf(3)?
Message-ID:  <000001be96bc$32002180$>
In-Reply-To: <>

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.


To Unsubscribe: send mail to
with "unsubscribe freebsd-stable" in the body of the message

Want to link to this message? Use this URL: <$32002180$021d85d1>