Date: Fri, 24 May 1996 08:00:02 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs Subject: Re: bin/1242: S_ISFIFO === S_ISSOCK Message-ID: <199605241500.IAA14509@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/1242; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: FreeBSD-gnats-submit@FreeBSD.org, zgabor@code.hu Cc: Subject: Re: bin/1242: S_ISFIFO === S_ISSOCK Date: Sat, 25 May 1996 00:50:24 +1000 >>Confidential: yes >>Severity: critical >>Priority: high Sorry, fixing this would break binary compatibility. It will take years to fix. > In the /usr/include/sys/stat.h, there are two macros: > S_ISFIFO and S_ISSOCK. They are the same (as mentioned in the > comment). This was intentional. Pipes were implemented as (not very-) special cases of socket pairs. The file descriptor type to distinguish them from sockets didn't exist until recently. See kern_descrip.c. Until recently, DTYPE_SOCK was used for both sockets and fifos. Now nameless pipes are implemented differently and DTYPE_PIPE (which should be DTYPE_FIFO to match VFIFO like DTYPE_SOCKET almost matches VSOCK) is used to distinguish them from sockets. Named pipes still have tock DTYPE_SOCKET. >>Fix: > > You have to make difference between them, as in many other Unices. Eg: > #define S_ISFIFO( m ) (((m) & 0170000 ) == 0010000 ) > #define S_ISSOCK( m ) (((m) & 0170000 ) == 0140000 ) This will result in S_ISFIFO() being false for all fifos. It will fail even for nameless pipes in -current, since pipe_stat() sets S_ISOCK when it should set S_IFIFO. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605241500.IAA14509>