From owner-freebsd-current@FreeBSD.ORG Sat Aug 14 15:32:31 2010 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 3BC821065693; Sat, 14 Aug 2010 15:32:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A50568FC16; Sat, 14 Aug 2010 15:32:30 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7EFVxL5071927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 Aug 2010 18:31:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o7EFVx39016875; Sat, 14 Aug 2010 18:31:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7EFVxPk016874; Sat, 14 Aug 2010 18:31:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 14 Aug 2010 18:31:59 +0300 From: Kostik Belousov To: Daniel Braniss Message-ID: <20100814153159.GC2396@deviant.kiev.zoral.com.ua> References: <201008141040.o7EAeiuR093012@fire.js.berklix.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FhvelBhrd33NvMcY" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: "Julian H. Stacey" , Gabor Kovesdan , "Sean C. Farley" , current@freebsd.org Subject: Re: Official request: Please make GNU grep the default 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: Sat, 14 Aug 2010 15:32:31 -0000 --FhvelBhrd33NvMcY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 14, 2010 at 06:23:55PM +0300, Daniel Braniss wrote: > > On Sat, 14 Aug 2010, Julian H. Stacey wrote: > >=20 > > >> why would you want to lock a file for reading anyways? > > > > > > Does current bsdgrep read lock by default ? > > > If so, it would be better off by default, enabled by an option. > > > 8.0-RELEASE man grep (gnu) does not mention locking. > >=20 > > bsdgrep in -current does lock via the call to fgetc(). That is why I= =20 > > suggested using flockfile/getchar_unlocked+/funlockfile instead. Other= =20 > > unlocked functions would also be useful, i.e., feof_unlocked().=20 > > Avoiding fgetc() does not completely solve the speed issue, yet it=20 > > certainly helps. > >=20 > > Just for reference: older bsdgrep used fgetln(). >=20 > let me rephrase the question: > why would you want to lock a file for reading anyways?? >=20 > there is no real benefit that I can see in locking a file for searching > a pattern. On a single file the overhead is irrelevant, but for 'grep -r?' Locked is not a file, but FILE. It is a measure to establish consistency in the stdio structures in the multithreaded environment, and not a file-system level lock of any kind. See the description of the flockfile() in the SUSv4. On the other hand, the overhead of locking in !mt process for FILE in our libc should be unmeasurable. --FhvelBhrd33NvMcY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxmtu4ACgkQC3+MBN1Mb4gUbgCg9ZRS9vh2EqymvaaILDfKJsfn AcIAn12itL2EA3aostuXud5aKFr8EGGq =fkkg -----END PGP SIGNATURE----- --FhvelBhrd33NvMcY--