1 /* modetype.h -- file type bits definitions for POSIX systems
2 Requires sys/types.h sys/stat.h.
3 Copyright (C) 1990 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19 /* POSIX.1 doesn't mention the S_IFMT bits; instead, it uses S_IStype
20 test macros. To make storing file types more convenient, define
21 them; the values don't need to correspond to what the kernel uses,
22 because of the way we use them. */
23 #ifndef S_IFMT /* Doesn't have traditional Unix macros. */
39 #ifdef STAT_MACROS_BROKEN
52 /* Do the reverse: define the POSIX.1 macros for traditional Unix systems
53 that don't have them. */
54 #if !defined(S_ISBLK) && defined(S_IFBLK)
55 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
57 #if !defined(S_ISCHR) && defined(S_IFCHR)
58 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
60 #if !defined(S_ISDIR) && defined(S_IFDIR)
61 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
63 #if !defined(S_ISREG) && defined(S_IFREG)
64 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
66 #if !defined(S_ISFIFO) && defined(S_IFIFO)
67 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
69 #if !defined(S_ISLNK) && defined(S_IFLNK)
70 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
72 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
73 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
75 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
76 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
77 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
79 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
80 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)