annotate src/sysfile.h @ 464:5aa1854ad537 r21-2-47

Import from CVS: tag r21-2-47
author cvs
date Mon, 13 Aug 2007 11:45:51 +0200
parents 0784d089fdc9
children ed498ef2108b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: Not really in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
23 #ifndef INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
24 #define INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
25
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include <errno.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
28 #ifndef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <sys/errno.h> /* <errno.h> does not always imply this */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #ifdef HAVE_UNISTD_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <unistd.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #ifndef INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 # define INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 # include <fcntl.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #endif /* INCLUDED_FCNTL */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 /* Load sys/types.h if not already loaded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 In some systems loading it twice is suicidal. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #ifndef makedev
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include <sys/types.h> /* some typedefs are used in sys/file.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #endif
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
46
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
47 #ifndef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #include <sys/file.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
49 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
50
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #include <sys/stat.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
52
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
53 #ifndef WIN32_NATIVE
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
54 /* Some configuration files' definitions for the LOAD_AVE_CVT macro
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
55 (like sparc.h's) use macros like FSCALE, defined here. */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
56 #ifdef HAVE_GTK
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
57 /* I hate GTK */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
58 #undef MIN
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
59 #undef MAX
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
60 #endif /* HAVE_GTK */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 #include <sys/param.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
64 #if defined (NeXT) || defined(CYGWIN)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 /* what is needed from here? Do others need it too?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 O_BINARY is in here under cygwin. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 # include <sys/fcntl.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 #endif /* NeXT */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70 #ifdef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 #include <io.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 #include <direct.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 #ifndef STDERR_FILENO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 #define STDIN_FILENO 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 #define STDOUT_FILENO 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 #define STDERR_FILENO 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 #ifndef O_RDONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 #define O_RDONLY 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #ifndef O_WRONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #define O_WRONLY 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #ifndef O_RDWR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #define O_RDWR 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 /* file opening defaults */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 #ifndef OPEN_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 #define OPEN_BINARY O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 #define OPEN_BINARY (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #ifndef OPEN_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #define OPEN_TEXT O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #define OPEN_TEXT (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #ifndef CREAT_MODE
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
111 #ifdef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #define CREAT_MODE (S_IREAD | S_IWRITE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #define CREAT_MODE (0666)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #ifndef READ_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 #define READ_TEXT "rt"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 #define READ_TEXT "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 #ifndef READ_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 #define READ_BINARY "rb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 #define READ_BINARY "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
134 #ifndef READ_PLUS_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
135 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
136 #define READ_PLUS_TEXT "r+t"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
137 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
138 #define READ_PLUS_TEXT "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
139 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
140 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
141
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
142 #ifndef READ_PLUS_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
143 #ifdef O_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
144 #define READ_PLUS_BINARY "r+b"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
145 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
146 #define READ_PLUS_BINARY "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
149
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 #ifndef WRITE_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152 #define WRITE_TEXT "wt"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
154 #define WRITE_TEXT "w"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
157
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 #ifndef WRITE_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 #define WRITE_BINARY "wb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 #define WRITE_BINARY "w"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 #ifndef O_NONBLOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 #ifdef O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 #define O_NONBLOCK O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 #define O_NONBLOCK 04000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 /* if system does not have symbolic links, it does not have lstat.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 In that case, use ordinary stat instead. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 #ifndef S_IFLNK
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 442
diff changeset
178 #define lstat xemacs_stat
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 #if !S_IRUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 # if S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 # define S_IRUSR S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 # define S_IRUSR 00400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 #if !S_IWUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 # if S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 # define S_IWUSR S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 # define S_IWUSR 00200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 #if !S_IXUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 # if S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 # define S_IXUSR S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 # define S_IXUSR 00100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 #ifdef STAT_MACROS_BROKEN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 #undef S_ISBLK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 #undef S_ISCHR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 #undef S_ISDIR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 #undef S_ISFIFO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 #undef S_ISLNK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 #undef S_ISMPB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #undef S_ISMPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #undef S_ISNWK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 #undef S_ISREG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 #undef S_ISSOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 #endif /* STAT_MACROS_BROKEN. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 #if !defined(S_ISBLK) && defined(S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 #if !defined(S_ISCHR) && defined(S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 #if !defined(S_ISDIR) && defined(S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 #if !defined(S_ISREG) && defined(S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 #if !defined(S_ISFIFO) && defined(S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 #if !defined(S_ISLNK) && defined(S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
247 /* Client .c files should simply use `PATH_MAX'. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
248 #ifndef PATH_MAX
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
249 # if defined (_POSIX_PATH_MAX)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
250 # define PATH_MAX _POSIX_PATH_MAX
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
251 # elif defined (MAXPATHLEN)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
252 # define PATH_MAX MAXPATHLEN
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
253 # else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
254 # define PATH_MAX 1024
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
255 # endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
256 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
257
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
258 /* MAXPATHLEN is deprecated, but, as of this writing, still used. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 #ifndef MAXPATHLEN
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260 # define MAXPATHLEN 1024
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
261 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
262
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
263 /* The following definitions are needed under Windows, at least */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
264 #ifndef X_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
265 # define X_OK 1
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
266 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
268 #ifndef R_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
269 # define R_OK 4
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
270 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
272 #ifndef W_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
273 # define W_OK 2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
274 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
275
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 #ifndef F_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 # define F_OK 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 #ifndef FD_CLOEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 # define FD_CLOEXEC 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 /* Emacs needs to use its own definitions of certain system calls on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 some systems (like SunOS 4.1 and USG systems, where the read system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 call is interruptible but Emacs expects it not to be; and under
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 MULE, where all filenames need to be converted to external format).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 To do this, we #define read to be sys_read, which is defined in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 sysdep.c. We first #undef read, in case some system file defines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 read as a macro. sysdep.c doesn't encapsulate read, so the call to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 read inside of sys_read will do the right thing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 DONT_ENCAPSULATE is used in files such as sysdep.c that want to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 call the actual system calls rather than the encapsulated versions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 Those files can call sys_read to get the (possibly) encapsulated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 versions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 IMPORTANT: the redefinition of the system call must occur *after* the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 inclusion of any header files that declare or define the system call;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 otherwise lots of unfriendly things can happen. This goes for all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 encapsulated system calls.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 We encapsulate the most common system calls here; we assume their
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 declarations are in one of the standard header files included above.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 Other encapsulations are declared in the appropriate sys*.h file. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 #ifdef ENCAPSULATE_READ
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 ssize_t sys_read (int, void *, size_t);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 #if defined (ENCAPSULATE_READ) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 # undef read
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 # define read sys_read
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 #if !defined (ENCAPSULATE_READ) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 # define sys_read read
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 #ifdef ENCAPSULATE_WRITE
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
319 ssize_t sys_write (int, const void *, size_t);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 #if defined (ENCAPSULATE_WRITE) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 # undef write
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 # define write sys_write
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 #if !defined (ENCAPSULATE_WRITE) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 # define sys_write write
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 #ifdef ENCAPSULATE_OPEN
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
330 int sys_open (const char *, int, ...);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 #if defined (ENCAPSULATE_OPEN) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 # undef open
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 # define open sys_open
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 #if !defined (ENCAPSULATE_OPEN) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 # define sys_open open
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 #ifdef ENCAPSULATE_CLOSE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 int sys_close (int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 #if defined (ENCAPSULATE_CLOSE) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 # undef close
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 # define close sys_close
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 #if !defined (ENCAPSULATE_CLOSE) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 # define sys_close close
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 /* Now the stdio versions ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 #ifdef ENCAPSULATE_FREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 size_t sys_fread (void *, size_t, size_t, FILE *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 #if defined (ENCAPSULATE_FREAD) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 # undef fread
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 # define fread sys_fread
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 #if !defined (ENCAPSULATE_FREAD) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 # define sys_fread fread
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 #ifdef ENCAPSULATE_FWRITE
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
365 size_t sys_fwrite (const void *, size_t, size_t, FILE *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 #if defined (ENCAPSULATE_FWRITE) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 # undef fwrite
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 # define fwrite sys_fwrite
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 #if !defined (ENCAPSULATE_FWRITE) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 # define sys_fwrite fwrite
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 #ifdef ENCAPSULATE_FOPEN
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
376 FILE *sys_fopen (const char *, const char *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 #if defined (ENCAPSULATE_FOPEN) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 # undef fopen
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 # define fopen sys_fopen
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 #if !defined (ENCAPSULATE_FOPEN) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 # define sys_fopen fopen
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 #ifdef ENCAPSULATE_FCLOSE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 int sys_fclose (FILE *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 #if defined (ENCAPSULATE_FCLOSE) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 # undef fclose
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 # define fclose sys_fclose
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 #if !defined (ENCAPSULATE_FCLOSE) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 # define sys_fclose fclose
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 /* encapsulations: file-information calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 #ifdef ENCAPSULATE_ACCESS
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
401 int sys_access (const char *path, int mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 #if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 # undef access
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 # define access sys_access
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 #if !defined (ENCAPSULATE_ACCESS) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 # define sys_access access
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 #ifdef ENCAPSULATE_EACCESS
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
412 int sys_eaccess (const char *path, int mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 #if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 # undef eaccess
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 # define eaccess sys_eaccess
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 #if !defined (ENCAPSULATE_EACCESS) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 # define sys_eaccess eaccess
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 #ifdef ENCAPSULATE_LSTAT
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
423 int sys_lstat (const char *path, struct stat *buf);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 #if defined (ENCAPSULATE_LSTAT) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 # undef lstat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 # define lstat sys_lstat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 #if !defined (ENCAPSULATE_LSTAT) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 # define sys_lstat lstat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 #ifdef ENCAPSULATE_READLINK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
434 int sys_readlink (const char *path, char *buf, size_t bufsiz);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 #if defined (ENCAPSULATE_READLINK) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 # undef readlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 # define readlink sys_readlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 #if !defined (ENCAPSULATE_READLINK) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 # define sys_readlink readlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
444 #ifdef ENCAPSULATE_FSTAT
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
445 int sys_fstat (int fd, struct stat *buf);
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
446 #endif
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
447 #if defined (ENCAPSULATE_FSTAT) && !defined (DONT_ENCAPSULATE)
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
448 # undef fstat
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
449 # define fstat sys_fstat
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
450 #endif
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
451 #if !defined (ENCAPSULATE_FSTAT) && defined (DONT_ENCAPSULATE)
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
452 # define sys_fstat fstat
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
453 #endif
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
454
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
455 int xemacs_stat (const char *path, struct stat *buf);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 /* encapsulations: file-manipulation calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 #ifdef ENCAPSULATE_CHMOD
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
460 int sys_chmod (const char *path, mode_t mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 #if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 # undef chmod
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 # define chmod sys_chmod
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 #if !defined (ENCAPSULATE_CHMOD) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 # define sys_chmod chmod
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 #ifdef ENCAPSULATE_CREAT
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
471 int sys_creat (const char *path, mode_t mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 #if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 # undef creat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 # define creat sys_creat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 #if !defined (ENCAPSULATE_CREAT) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 # define sys_creat creat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 #ifdef ENCAPSULATE_LINK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
482 int sys_link (const char *existing, const char *new);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 #if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 # undef link
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 # define link sys_link
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 #if !defined (ENCAPSULATE_LINK) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 # define sys_link link
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 #ifdef ENCAPSULATE_RENAME
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
493 int sys_rename (const char *old, const char *new);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 #if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 # undef rename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 # define rename sys_rename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 #if !defined (ENCAPSULATE_RENAME) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 # define sys_rename rename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 #ifdef ENCAPSULATE_SYMLINK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
504 int sys_symlink (const char *name1, const char *name2);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 #if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 # undef symlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 # define symlink sys_symlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 #if !defined (ENCAPSULATE_SYMLINK) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 # define sys_symlink symlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 #ifdef ENCAPSULATE_UNLINK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
515 int sys_unlink (const char *path);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 #if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 # undef unlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 # define unlink sys_unlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 #if !defined (ENCAPSULATE_UNLINK) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 # define sys_unlink unlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 #ifdef ENCAPSULATE_EXECVP
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
526 int sys_execvp (const char *, char * const *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 #if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 # undef execvp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 # define execvp sys_execvp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 #if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 # define sys_execvp execvp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
535
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
536 #endif /* INCLUDED_sysfile_h_ */