From owner-freebsd-questions Wed May 22 05:49:05 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id FAA23973 for questions-outgoing; Wed, 22 May 1996 05:49:05 -0700 (PDT) Received: from mail.EUnet.hu (mail.eunet.hu [193.225.28.100]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id FAA23963 for ; Wed, 22 May 1996 05:48:45 -0700 (PDT) Received: by mail.EUnet.hu, id OAA10585; Wed, 22 May 1996 14:48:31 +0200 Received: by CoDe.CoDe.hu (LAA01574); Wed, 22 May 1996 11:33:16 GMT From: Gabor Zahemszky Message-Id: <199605221133.LAA01574@CoDe.CoDe.hu> Subject: S_ISFIFO === S_ISSOCK To: freebsd-questions@freebsd.org Date: Wed, 22 May 1996 11:33:15 +0000 (GMT) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi! I've found, that in 2.1.0R (from WC CD), in /usr/include/sys/stat.h, the macros S_ISFIFO and S_ISSOCK are generate the same (as it says in the comment). It's not so good, eg. the tar and cpio (from the distribution, they are the GNU version), both cannot save a socket. Perfectly, they can save, but save as a pipe. I tried it in some Unices, and all of them (if they have this type of file), make a difference between them. So, what's the reason, that macro defined such a non-standard (means, unusable) way. (I have to dig into the source of tar/cpio, to find it out, why are they say a saved socket, that's a pipe. - Yes, I know, that saving a pipe, or saving a socket is not a very good practice, but saving them is only one of the problems.) Eg, if I would like to write a `ls', that code doesn't work: if ( S_ISFIFO( f ) ) { printf( "fifo" ); } else if (S_ISSOCK( f ) ) { printf( "socket" ); } ... Of course, it always says, that's a pipe, and never says, socket. -- Gabor Zahemszky -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:- Earth is the cradle of human sense, but you can't stay in the cradle forever. Tsiolkovsky