From owner-freebsd-bugs Wed Nov 7 5:40: 6 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 45E3F37B405 for ; Wed, 7 Nov 2001 05:40:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fA7De2a81528; Wed, 7 Nov 2001 05:40:02 -0800 (PST) (envelope-from gnats) Date: Wed, 7 Nov 2001 05:40:02 -0800 (PST) Message-Id: <200111071340.fA7De2a81528@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Maxim Konovalov Subject: Re: kern/23353: fcntl(F_GETLK) return l_pid equal to -1 for the file loked with flock() Reply-To: Maxim Konovalov Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/23353; it has been noted by GNATS. From: Maxim Konovalov To: freebsd-gnats-submit@FreeBSD.org Cc: simon@comsys.ntu-kpi.kiev.ua Subject: Re: kern/23353: fcntl(F_GETLK) return l_pid equal to -1 for the file loked with flock() Date: Wed, 7 Nov 2001 16:30:43 +0300 (MSK) Hello, This behaviour is expected and it is not a bug. From "The Design and Implementation of the 4.4BSD Operating System" by Marshall Kirk McKusick et al, p.210: "The kernel handles the other differing semantics between the two implementations by having the byte-range locks be applied to processes whereas the whole-file locks are applied to descriptors. Because descriptors are shared with child processes, the whole-file locks are inherited. Because the child process gets its own process structure, the byte-fange locks are not inherited" Also take a look at /sys/kern/kern_descrip.c line 366 and line 1425. Flock(2) and fcntl(2) use different structures for lock identification. Imho the PR can be closed. - -maxim -- Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message