Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Aug 1997 08:35:48 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.ORG
Cc:        abelits@phobos.illtel.denver.co.us (Alex Belits)
Subject:   Re: S_ISFIFO and S_ISSOCK
Message-ID:  <19970820083548.RY05593@uriah.heep.sax.de>
In-Reply-To: <Pine.LNX.3.95.970819200222.4982A-100000@phobos.illtel.denver.co.us>; from Alex Belits on Aug 19, 1997 20:47:00 -0700
References:  <Pine.LNX.3.95.970819200222.4982A-100000@phobos.illtel.denver.co.us>

next in thread | previous in thread | raw e-mail | index | archive | help
As Alex Belits wrote:

>   In other words, fifo and socket have different flags, but checks for
> them treat them as one?

You ought to use up-to-date versions of the system...

#define S_ISFIFO(m)     (((m) & 0170000) == 0010000)    /* fifo or socket */
#ifndef _POSIX_SOURCE
#define S_ISLNK(m)      (((m) & 0170000) == 0120000)    /* symbolic link */
#define S_ISSOCK(m)     (((m) & 0170000) == 0140000)    /* socket */
#define S_ISWHT(m)      (((m) & 0170000) == 0160000)    /* whiteout */
#endif

Well, the first comment is still wrong.

> And it's mentioned that S_IFIFO is set for named
> pipes while in fact it's set for both anonymous and named ones, while
> S_IFSOCK is set for sockets only.

4.4BSD unnamed pipes were sockets.  John Dyson rewrote the pipe code
later, so they are no longer sockets now.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970820083548.RY05593>