From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 27 23:45:37 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 89EB016A41F for ; Wed, 27 Jul 2005 23:45:37 +0000 (GMT) (envelope-from uvarovsl@mail.pnpi.spb.ru) Received: from mail.lsi.ru (mail.lsi.ru [212.58.192.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D2BD43D45 for ; Wed, 27 Jul 2005 23:45:36 +0000 (GMT) (envelope-from uvarovsl@mail.pnpi.spb.ru) Received: by mail.lsi.ru (Postfix, from userid 426) id CF12B386DA2; Thu, 28 Jul 2005 03:45:35 +0400 (MSD) Received: from [10.0.0.3] (unknown [212.58.210.222]) by mail.lsi.ru (Postfix) with ESMTP id 6F540386D92 for ; Thu, 28 Jul 2005 03:45:34 +0400 (MSD) Message-ID: <42E81D52.1020909@mail.pnpi.spb.ru> Date: Thu, 28 Jul 2005 03:48:34 +0400 From: Sergey Uvarov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: file locking X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2005 23:45:37 -0000 Hello hackers, man page for flock(2) and fcntl(2) reads that a system call returns EOPNOTSUPP if file descriptor refers to an object that does not support file locking. However, it seems that it is not always true. For example, if underlying object is a device or a fifo returned error code depends on type of lock. When I look at sources of VOP_ADVLOCK for fifo (sys/fs/fifofs/fifo_vnops.c, fifo_advlock() function) I see the following line: ... return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL); ... I.e. for freebsd locks EOPNOTSUPP error code is returned. It is correct. But for posix locks EINVAL error code is returned. Is it correct? Thanks you in advance, Sergey.