From owner-freebsd-stable Tue May 4 17:38:24 1999 Delivered-To: freebsd-stable@freebsd.org Received: from polio.ecst.csuchico.edu (polio.ecst.csuchico.edu [132.241.4.13]) by hub.freebsd.org (Postfix) with SMTP id 4B380151A8 for ; Tue, 4 May 1999 17:38:11 -0700 (PDT) (envelope-from manek@ecst.csuchico.edu) Received: (qmail 596 invoked by uid 21024); 4 May 1999 17:38:09 -0700 Date: Tue, 4 May 1999 17:38:09 -0700 (PDT) From: "Sameer R. Manek" To: freebsd-stable@freebsd.org Subject: bug with lockf(3)? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On freebsd 3-1-stable I'm not sure if this is a bug or my misinterpetation of how lockf() works. But here's the situation. 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. According to the man page: F_LOCK and F_TLOCK requests differ only by the action taken if the section is not available. F_LOCK blocks the calling process until the section is available. F_TLOCK makes the function fail if the section is already locked by another process. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Sameer Manek manek@ecst.csuchico.edu "They that will sacrifice liberty in exchange for temporary safety deserve neither liberty or safety." -Ben Franklin -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message