From owner-freebsd-questions@FreeBSD.ORG Fri Nov 5 00:16:09 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0AC5C16A4CE for ; Fri, 5 Nov 2004 00:16:09 +0000 (GMT) Received: from segfault-outgoing-helo.monkeys.com (segfault.monkeys.com [66.60.159.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id C720143D1F for ; Fri, 5 Nov 2004 00:16:08 +0000 (GMT) (envelope-from rfg@monkeys.com) Received: from segfault-nmh-helo.monkeys.com (localhost [127.0.0.1]) by segfault.monkeys.com (Postfix) with ESMTP id 6A35054A8; Thu, 4 Nov 2004 16:16:08 -0800 (PST) To: Henrik W Lund In-reply-to: Your message of Thu, 04 Nov 2004 22:03:40 +0100. <418A992C.6040806@broadpark.no> Date: Thu, 04 Nov 2004 16:16:08 -0800 Message-ID: <50176.1099613768@monkeys.com> From: "Ronald F. Guilmette" cc: freebsd-questions@freebsd.org Subject: Re: Trying to understand flock() X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2004 00:16:09 -0000 In message <418A992C.6040806@broadpark.no>, you wrote: > From the flock manpage: > >"...file descriptors duplicated through dup(2) or fork(2) do not result >in multiple instances of a lock, but rather multiple references to the >same lock." > >You're basically trying to place a lock you already hold, making the >flock function return immediately (this is what I gather, anyhow). The >fcntl function seems to operate slightly differently in this respect. > >This is the only explanation I can think of, others might think >differently, though. Thank you. That seems to make sense, now that you have explained it for me.