]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - readline/posixstat.h
[MIPS] Add i6500 CPU and fix i6400 default ASEs
[thirdparty/binutils-gdb.git] / readline / posixstat.h
CommitLineData
d60d9f65
SS
1/* posixstat.h -- Posix stat(2) definitions for systems that
2 don't have them. */
3
4/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
cc88a640
JK
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
d60d9f65 12
cc88a640
JK
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
d60d9f65
SS
17
18 You should have received a copy of the GNU General Public License
cc88a640
JK
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
20*/
d60d9f65
SS
21
22/* This file should be included instead of <sys/stat.h>.
23 It relies on the local sys/stat.h to work though. */
24#if !defined (_POSIXSTAT_H_)
25#define _POSIXSTAT_H_
26
27#include <sys/stat.h>
28
29#if defined (STAT_MACROS_BROKEN)
30# undef S_ISBLK
31# undef S_ISCHR
32# undef S_ISDIR
33# undef S_ISFIFO
34# undef S_ISREG
35# undef S_ISLNK
36#endif /* STAT_MACROS_BROKEN */
37
38/* These are guaranteed to work only on isc386 */
39#if !defined (S_IFDIR) && !defined (S_ISDIR)
40# define S_IFDIR 0040000
41#endif /* !S_IFDIR && !S_ISDIR */
42#if !defined (S_IFMT)
43# define S_IFMT 0170000
44#endif /* !S_IFMT */
45
46/* Posix 1003.1 5.6.1.1 <sys/stat.h> file types */
47
48/* Some Posix-wannabe systems define _S_IF* macros instead of S_IF*, but
49 do not provide the S_IS* macros that Posix requires. */
50
51#if defined (_S_IFMT) && !defined (S_IFMT)
52#define S_IFMT _S_IFMT
53#endif
54#if defined (_S_IFIFO) && !defined (S_IFIFO)
55#define S_IFIFO _S_IFIFO
56#endif
57#if defined (_S_IFCHR) && !defined (S_IFCHR)
58#define S_IFCHR _S_IFCHR
59#endif
60#if defined (_S_IFDIR) && !defined (S_IFDIR)
61#define S_IFDIR _S_IFDIR
62#endif
63#if defined (_S_IFBLK) && !defined (S_IFBLK)
64#define S_IFBLK _S_IFBLK
65#endif
66#if defined (_S_IFREG) && !defined (S_IFREG)
67#define S_IFREG _S_IFREG
68#endif
69#if defined (_S_IFLNK) && !defined (S_IFLNK)
70#define S_IFLNK _S_IFLNK
71#endif
72#if defined (_S_IFSOCK) && !defined (S_IFSOCK)
73#define S_IFSOCK _S_IFSOCK
74#endif
75
76/* Test for each symbol individually and define the ones necessary (some
77 systems claiming Posix compatibility define some but not all). */
78
79#if defined (S_IFBLK) && !defined (S_ISBLK)
80#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) /* block device */
81#endif
82
83#if defined (S_IFCHR) && !defined (S_ISCHR)
84#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) /* character device */
85#endif
86
87#if defined (S_IFDIR) && !defined (S_ISDIR)
88#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
89#endif
90
91#if defined (S_IFREG) && !defined (S_ISREG)
92#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) /* file */
93#endif
94
95#if defined (S_IFIFO) && !defined (S_ISFIFO)
96#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO) /* fifo - named pipe */
97#endif
98
99#if defined (S_IFLNK) && !defined (S_ISLNK)
100#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK) /* symbolic link */
101#endif
102
103#if defined (S_IFSOCK) && !defined (S_ISSOCK)
104#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK) /* socket */
105#endif
106
107/*
108 * POSIX 1003.1 5.6.1.2 <sys/stat.h> File Modes
109 */
110
111#if !defined (S_IRWXU)
112# if !defined (S_IREAD)
113# define S_IREAD 00400
114# define S_IWRITE 00200
115# define S_IEXEC 00100
116# endif /* S_IREAD */
117
118# if !defined (S_IRUSR)
119# define S_IRUSR S_IREAD /* read, owner */
120# define S_IWUSR S_IWRITE /* write, owner */
121# define S_IXUSR S_IEXEC /* execute, owner */
122
123# define S_IRGRP (S_IREAD >> 3) /* read, group */
124# define S_IWGRP (S_IWRITE >> 3) /* write, group */
125# define S_IXGRP (S_IEXEC >> 3) /* execute, group */
126
127# define S_IROTH (S_IREAD >> 6) /* read, other */
128# define S_IWOTH (S_IWRITE >> 6) /* write, other */
129# define S_IXOTH (S_IEXEC >> 6) /* execute, other */
130# endif /* !S_IRUSR */
131
132# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
133# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
134# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
135#endif /* !S_IRWXU */
136
137/* These are non-standard, but are used in builtins.c$symbolic_umask() */
138#define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
139#define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
140#define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
141
142#endif /* _POSIXSTAT_H_ */