Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Aug 1997 20:47:00 -0700 (PDT)
From:      Alex Belits <abelits@phobos.illtel.denver.co.us>
To:        hackers@freebsd.org
Subject:   S_ISFIFO and S_ISSOCK
Message-ID:  <Pine.LNX.3.95.970819200222.4982A-100000@phobos.illtel.denver.co.us>

next in thread | raw e-mail | index | archive | help

In /usr/include/sys/stat.h:

#ifndef _POSIX_SOURCE
[skipped]
#define S_IFIFO  0010000                /* named pipe (fifo) */
[skipped]
#define S_IFSOCK 0140000                /* socket */
#endif

[skipped]
#define S_ISFIFO(m)     (((m) & 0170000) == 0010000 || \
                         ((m) & 0170000) == 0140000)    /* fifo or socket */
#ifndef _POSIX_SOURCE
[skipped]
#define S_ISSOCK(m)     (((m) & 0170000) == 0010000 || \
                         ((m) & 0170000) == 0140000)    /* fifo or socket */
[skipped]
#endif

  In other words, fifo and socket have different flags, but checks for
them treat them as one? 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.

  Is it something that was left of BSD4.4 implementation of anonymous pipe
as a kind of socket? But #ifndef _POSIX_SOURCE around S_ISSOCK macro looks
suspicious...

--
Alex




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.95.970819200222.4982A-100000>