From owner-cvs-all Tue Sep 25 13:22:55 2001 Delivered-To: cvs-all@freebsd.org Received: from misha.privatelabs.com (misha.privatelabs.com [66.9.25.166]) by hub.freebsd.org (Postfix) with ESMTP id CFB6A37B431; Tue, 25 Sep 2001 13:22:39 -0700 (PDT) Received: from misha.privatelabs.com (localhost [127.0.0.1]) by misha.privatelabs.com (8.11.6/8.11.6) with ESMTP id f8PKMMm03844; Tue, 25 Sep 2001 16:22:24 -0400 (EDT) (envelope-from mi@aldan.algebra.com) Message-Id: <200109252022.f8PKMMm03844@misha.privatelabs.com> Date: Tue, 25 Sep 2001 16:22:21 -0400 (EDT) From: mi@aldan.algebra.com Reply-To: mi@aldan.algebra.com Subject: Re: cvs commit: src/bin/cat cat.1 cat.c To: dillon@earth.backplane.com Cc: ru@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org In-Reply-To: <200109251909.f8PJ9eJ03402@earth.backplane.com> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=US-ASCII 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 On 25 Sep, 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. > > -Matt Besides, there might be some other type of object in the future, that's open()-able, which should be a preferred way to deal with it, even if it will also be connect()-able :). Looks to me like trying to open() first is better. -mi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message