From owner-cvs-all Tue Sep 25 22: 8:12 2001 Delivered-To: cvs-all@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id C83E437B413; Tue, 25 Sep 2001 22:08:02 -0700 (PDT) Received: from hades.hell.gr (patr530-a028.otenet.gr [212.205.215.28]) by mailsrv.otenet.gr (8.11.5/8.11.5) with ESMTP id f8Q57NN04593; Wed, 26 Sep 2001 08:07:28 +0300 (EEST) Received: (from charon@localhost) by hades.hell.gr (8.11.6/8.11.6) id f8Q2uSf22152; Wed, 26 Sep 2001 05:56:29 +0300 (EEST) (envelope-from charon@labs.gr) Date: Wed, 26 Sep 2001 05:56:26 +0300 From: Giorgos Keramidas To: Matt Dillon Cc: Ruslan Ermilov , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/bin/cat cat.1 cat.c Message-ID: <20010926055625.A21817@hades.hell.gr> References: <200109150039.f8F0dFZ41705@freefall.freebsd.org> <20010925211639.C57333@sunbay.com> <200109251909.f8PJ9eJ03402@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200109251909.f8PJ9eJ03402@earth.backplane.com> User-Agent: Mutt/1.3.22.1i X-GPG-Fingerprint: C1EB 0653 DB8B A557 3829 00F9 D60F 941A 3186 03B6 X-URL: http://labs.gr/~charon/ Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Matt Dillon wrote: > > : > :How about testing with stat(2) that an argument is a socket > :thus eliminating the need to open(2) sockets and connect(2) > :to non-sockets? > > I don't see any particular reason why. An open() failure is as fast > or faster then stat(). If it fails and we get the appropriate errno, > we try a connect(). Either connect() is supported or it isn't. If it > is a case of a missing file we don't try the connect() because we get > a different errno. I see no particular need to stat the path, no ill > effects will occur if the connect() fails. And there is always a possibility of a race condition between a stat() and an open(). So relying on stat() to control what open() and/or connect() will do is kind of dangerous in my book :-/ -giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message