annotate src/sysfile.h @ 283:fa3d41851a08

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