From owner-freebsd-current@FreeBSD.ORG Tue Oct 4 06:37:31 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0EDF106564A for ; Tue, 4 Oct 2011 06:37:31 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 603648FC17 for ; Tue, 4 Oct 2011 06:37:30 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p946bSjk025667 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Oct 2011 17:37:28 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.5/8.14.4) with ESMTP id p946bS78025218; Tue, 4 Oct 2011 17:37:28 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.5/8.14.4/Submit) id p946bRcF025217; Tue, 4 Oct 2011 17:37:27 +1100 (EST) (envelope-from peter) Date: Tue, 4 Oct 2011 17:37:27 +1100 From: Peter Jeremy To: Kostik Belousov Message-ID: <20111004063727.GA25129@server.vk2pj.dyndns.org> References: <20111002220405.GN1511@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="opJtzjQTFsWo+cga" Content-Disposition: inline In-Reply-To: <20111002220405.GN1511@deviant.kiev.zoral.com.ua> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: standards@freebsd.org, current@freebsd.org Subject: Re: st_dev and st_ino for pipes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 06:37:31 -0000 --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-Oct-03 01:04:05 +0300, Kostik Belousov wrote: >Our implementation of pipes does not provide useful values for st_dev >and st_ino when stat(2) is done on an anonymous pipe. It was noted by the =2E.. >Patch below implements the requirement, by the cost of the small overhead >at the pipe creation time, and slightly bigger cost at the destruction. Does it need to be so complex? This information isn't needed by the kernel and, to be "meaningful", all that is required is that the (st_dev,st_ino) pair is unique within the system. Given this, wouldn't it be sufficient to fake up a st_dev and then just make st_ino be a counter that starts from 0 and increments (atomically?) on every new pipe? No need to retain state or "free" anything when the pipe is destroyed. (If necessary, pick a new fake st_dev when st_ino wraps). >--- a/sys/kern/sys_pipe.c >+++ b/sys/kern/sys_pipe.c =2E.. >+static ino_t pipedev_ino; =2E. >+ ub->st_dev =3D pipedev_ino; st_dev is a dev_t and hence pipedev_ino (which seems misnamed to me) should probably be dev_t rather than ino_t --=20 Peter Jeremy --opJtzjQTFsWo+cga Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk6KqacACgkQ/opHv/APuIchwgCfWM+y8Qgms2jySC5B/5UEIvPK StoAoJjtd8kZNS5qZasE0CLWMD1Z0eB+ =Y2N3 -----END PGP SIGNATURE----- --opJtzjQTFsWo+cga--