annotate src/sysfile.h @ 251:677f6a0ee643 r20-5b24

Import from CVS: tag r20-5b24
author cvs
date Mon, 13 Aug 2007 10:19:59 +0200
parents 41ff10fd062f
children c5d627a313b1
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
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* Load sys/types.h if not already loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 In some systems loading it twice is suicidal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #ifndef makedev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <sys/types.h> /* some typedefs are used in sys/file.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include <sys/file.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include <sys/stat.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include <sys/param.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
38 #if defined (NeXT) || defined(__CYGWIN32__)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
39 /* what is needed from here? Do others need it too?
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
40 O_BINARY is in here under cygwin. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 # include <sys/fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #endif /* NeXT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #ifdef WINDOWSNT
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
45 #include <io.h>
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
46 #endif
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
47
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
48 #if 0
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
49 #ifdef WINDOWSNT
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 #include <windows.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 #include <stdlib.h> /* for proper declaration of environ */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #include <fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 #include "nt.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 #define _P_NOWAIT 1 /* from process.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 #endif
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
56 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #include <dos.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 #include "msdos.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 #endif /* MSDOS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #ifndef O_RDONLY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 #define O_RDONLY 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 #ifndef O_WRONLY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 #define O_WRONLY 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 #ifndef O_RDWR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 #define O_RDWR 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
75 /* file opening defaults */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
76 #ifndef OPEN_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
77 #ifdef O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
78 #define OPEN_BINARY O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
79 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
80 #define OPEN_BINARY (0)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
81 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
82 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
83
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
84 #ifndef OPEN_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
85 #ifdef O_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
86 #define OPEN_TEXT O_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
87 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
88 #define OPEN_TEXT (0)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
89 #endif
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
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
92 #ifndef CREAT_MODE
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
93 #ifdef WINDOWSNT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
94 #define CREAT_MODE (S_IREAD | S_IWRITE)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
95 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
96 #define CREAT_MODE (0666)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
97 #endif
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
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
100 #ifndef READ_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
101 #ifdef O_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
102 #define READ_TEXT "rt"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
103 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
104 #define READ_TEXT "r"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
105 #endif
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
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
108 #ifndef READ_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
109 #ifdef O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
110 #define READ_BINARY "rb"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
111 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
112 #define READ_BINARY "r"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
113 #endif
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
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
116 #ifndef WRITE_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
117 #ifdef O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
118 #define WRITE_BINARY "wb"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
119 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
120 #define WRITE_BINARY "w"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
121 #endif
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
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 /* if system does not have symbolic links, it does not have lstat.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 In that case, use ordinary stat instead. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 #ifndef S_IFLNK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 #define lstat stat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 #if !S_IRUSR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 # if S_IREAD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 # define S_IRUSR S_IREAD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 # define S_IRUSR 00400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 #if !S_IWUSR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 # if S_IWRITE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 # define S_IWUSR S_IWRITE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 # define S_IWUSR 00200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 # endif
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 #if !S_IXUSR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 # if S_IEXEC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 # define S_IXUSR S_IEXEC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 # define S_IXUSR 00100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 # endif
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #ifdef STAT_MACROS_BROKEN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 #undef S_ISBLK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 #undef S_ISCHR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 #undef S_ISDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 #undef S_ISFIFO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 #undef S_ISLNK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 #undef S_ISMPB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 #undef S_ISMPC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 #undef S_ISNWK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 #undef S_ISREG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 #undef S_ISSOCK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 #endif /* STAT_MACROS_BROKEN. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 #if !defined(S_ISBLK) && defined(S_IFBLK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 #if !defined(S_ISCHR) && defined(S_IFCHR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 #if !defined(S_ISDIR) && defined(S_IFDIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 #if !defined(S_ISREG) && defined(S_IFREG)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
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_ISFIFO) && defined(S_IFIFO)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
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_ISLNK) && defined(S_IFLNK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
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_ISSOCK) && defined(S_IFSOCK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
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_ISMPB) && defined(S_IFMPB) /* V7 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 100
diff changeset
197 #if !defined (USG) && !defined (WINDOWSNT)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 # define HAVE_FSYNC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 #ifndef MAXPATHLEN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 /* in 4.1, param.h fails to define this. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 #define MAXPATHLEN 1024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 #endif /* not MAXPATHLEN */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 #ifndef X_OK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 # define X_OK 01
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 FD_CLOEXEC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 # define FD_CLOEXEC 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 /* encapsulations: file-information calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 #ifdef ENCAPSULATE_ACCESS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 extern int sys_access (CONST char *path, int mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 #if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 # undef access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 # define access sys_access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 #if !defined (ENCAPSULATE_ACCESS) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 # define sys_access access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
227 #ifdef ENCAPSULATE_EACCESS
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
228 extern int sys_eaccess (CONST char *path, int mode);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
229 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
230 #if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
231 # undef eaccess
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
232 # define eaccess sys_eaccess
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
233 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
234 #if !defined (ENCAPSULATE_EACCESS) && defined (DONT_ENCAPSULATE)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
235 # define sys_eaccess eaccess
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
236 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
237
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 #ifdef ENCAPSULATE_LSTAT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 extern int sys_lstat (CONST char *path, struct stat *buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 #if defined (ENCAPSULATE_LSTAT) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 # undef lstat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 # define lstat sys_lstat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 #if !defined (ENCAPSULATE_LSTAT) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 # define sys_lstat lstat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 #ifdef ENCAPSULATE_READLINK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 extern int sys_readlink (CONST char *path, char *buf, int bufsiz);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 #if defined (ENCAPSULATE_READLINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 # undef readlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 # define readlink sys_readlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 #if !defined (ENCAPSULATE_READLINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 # define sys_readlink readlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 #ifdef ENCAPSULATE_STAT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 extern int sys_stat (CONST char *path, struct stat *buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 #if defined (ENCAPSULATE_STAT) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 # undef stat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 /* Need to use arguments to avoid messing with struct stat */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 # define stat(path, buf) sys_stat (path, buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 #if !defined (ENCAPSULATE_STAT) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 # define sys_stat stat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 /* encapsulations: file-manipulation calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 #ifdef ENCAPSULATE_CHMOD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 extern int sys_chmod (CONST char *path, int mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 #if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 # undef chmod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 # define chmod sys_chmod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 #if !defined (ENCAPSULATE_CHMOD) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 # define sys_chmod chmod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 #ifdef ENCAPSULATE_CREAT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 extern int sys_creat (CONST char *path, int mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 #if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 # undef creat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 # define creat sys_creat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 #if !defined (ENCAPSULATE_CREAT) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 # define sys_creat creat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 #ifdef ENCAPSULATE_LINK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 extern int sys_link (CONST char *existing, CONST char *new);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 #if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 # undef link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 # define link sys_link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 #if !defined (ENCAPSULATE_LINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 # define sys_link link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 #ifdef ENCAPSULATE_RENAME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 extern int sys_rename (CONST char *old, CONST char *new);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 #if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 # undef rename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 # define rename sys_rename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 #if !defined (ENCAPSULATE_RENAME) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 # define sys_rename rename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 #ifdef ENCAPSULATE_SYMLINK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 extern int sys_symlink (CONST char *name1, CONST char *name2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 #if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 # undef symlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 # define symlink sys_symlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 #if !defined (ENCAPSULATE_SYMLINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 # define sys_symlink symlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 #ifdef ENCAPSULATE_UNLINK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 extern int sys_unlink (CONST char *path);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 #if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 # undef unlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 # define unlink sys_unlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 #if !defined (ENCAPSULATE_UNLINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 # define sys_unlink unlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 #endif
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
339
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
340 #ifdef ENCAPSULATE_EXECVP
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
341 extern int sys_execvp (CONST char *, char * CONST *);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
342 #endif
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
343 #if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
344 # undef execvp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
345 # define execvp sys_execvp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
346 #endif
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
347 #if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
348 # define sys_execvp execvp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
349 #endif