annotate src/sysfile.h @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents 74fd4e045ea6
children de805c49cfc1
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
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
23 #ifndef INCLUDED_sysfile_h_
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
24 #define INCLUDED_sysfile_h_
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
25
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <errno.h>
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
27 #include <limits.h>
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
28
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
29 #ifndef WINDOWSNT
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <sys/errno.h> /* <errno.h> does not always imply this */
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
31 #endif
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
32
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
33 #ifdef HAVE_UNISTD_H
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
34 #include <unistd.h>
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
35 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
36
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
37 #ifndef INCLUDED_FCNTL
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
38 # define INCLUDED_FCNTL
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
39 # include <fcntl.h>
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
40 #endif /* INCLUDED_FCNTL */
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
41
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 /* Load sys/types.h if not already loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 In some systems loading it twice is suicidal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #ifndef makedev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include <sys/types.h> /* some typedefs are used in sys/file.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #include <sys/file.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 #include <sys/stat.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 #include <sys/param.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
51 #if defined (NeXT) || defined(__CYGWIN32__)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
52 /* what is needed from here? Do others need it too?
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
53 O_BINARY is in here under cygwin. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 # include <sys/fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 #endif /* NeXT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #ifdef WINDOWSNT
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
58 #include <io.h>
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 272
diff changeset
59 #include <direct.h>
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
60 #endif
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 16
diff changeset
61
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
62 #ifndef STDERR_FILENO
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
63 #define STDIN_FILENO 0
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
64 #define STDOUT_FILENO 1
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
65 #define STDERR_FILENO 2
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
66 #endif
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
67
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 #ifndef O_RDONLY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #define O_RDONLY 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 #endif
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_WRONLY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #define O_WRONLY 1
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_RDWR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #define O_RDWR 2
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
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
80 /* file opening defaults */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
81 #ifndef OPEN_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
82 #ifdef O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
83 #define OPEN_BINARY O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
84 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
85 #define OPEN_BINARY (0)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
86 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
87 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
88
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
89 #ifndef OPEN_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
90 #ifdef O_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
91 #define OPEN_TEXT O_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
92 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
93 #define OPEN_TEXT (0)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
94 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
95 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
96
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
97 #ifndef CREAT_MODE
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
98 #ifdef WINDOWSNT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
99 #define CREAT_MODE (S_IREAD | S_IWRITE)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
100 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
101 #define CREAT_MODE (0666)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
102 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
103 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
104
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
105 #ifndef READ_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
106 #ifdef O_TEXT
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
107 #define READ_TEXT "rt"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
108 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
109 #define READ_TEXT "r"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
110 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
111 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
112
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
113 #ifndef READ_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
114 #ifdef O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
115 #define READ_BINARY "rb"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
116 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
117 #define READ_BINARY "r"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
118 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
119 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
120
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
121 #ifndef WRITE_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
122 #ifdef O_BINARY
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
123 #define WRITE_BINARY "wb"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
124 #else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
125 #define WRITE_BINARY "w"
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
126 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
127 #endif
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 209
diff changeset
128
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
129 #ifndef O_NONBLOCK
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
130 #ifdef O_NDELAY
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
131 #define O_NONBLOCK O_NDELAY
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
132 #else
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
133 #define O_NONBLOCK 04000
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
134 #endif
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
135 #endif
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 371
diff changeset
136
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 /* if system does not have symbolic links, it does not have lstat.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 In that case, use ordinary stat instead. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 #ifndef S_IFLNK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 #define lstat stat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 #if !S_IRUSR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 # if S_IREAD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 # define S_IRUSR S_IREAD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 # define S_IRUSR 00400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 #if !S_IWUSR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 # if S_IWRITE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 # define S_IWUSR S_IWRITE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 # define S_IWUSR 00200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 #if !S_IXUSR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 # if S_IEXEC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 # define S_IXUSR S_IEXEC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 # define S_IXUSR 00100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 #ifdef STAT_MACROS_BROKEN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 #undef S_ISBLK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 #undef S_ISCHR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 #undef S_ISDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 #undef S_ISFIFO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 #undef S_ISLNK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 #undef S_ISMPB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 #undef S_ISMPC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 #undef S_ISNWK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 #undef S_ISREG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 #undef S_ISSOCK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 #endif /* STAT_MACROS_BROKEN. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 #if !defined(S_ISBLK) && defined(S_IFBLK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 #if !defined(S_ISCHR) && defined(S_IFCHR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 #if !defined(S_ISDIR) && defined(S_IFDIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 #if !defined(S_ISREG) && defined(S_IFREG)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
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_ISFIFO) && defined(S_IFIFO)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
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 #if !defined(S_ISLNK) && defined(S_IFLNK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
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_ISMPB) && defined(S_IFMPB) /* V7 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
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
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
210 /* Client .c files should simply use `PATH_MAX'. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
211 #ifndef PATH_MAX
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
212 # if defined (_POSIX_PATH_MAX)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
213 # define PATH_MAX _POSIX_PATH_MAX
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
214 # elif defined (MAXPATHLEN)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
215 # define PATH_MAX MAXPATHLEN
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
216 # else
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
217 # define PATH_MAX 1024
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
218 # endif
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
219 #endif
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
220
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
221 /* MAXPATHLEN is deprecated, but, as of this writing, still used. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 #ifndef MAXPATHLEN
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
223 # define MAXPATHLEN 1024
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 398
diff changeset
224 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 #ifndef X_OK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 # define X_OK 01
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 #ifndef FD_CLOEXEC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 # define FD_CLOEXEC 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
234 /* Emacs needs to use its own definitions of certain system calls on
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
235 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
236 call is interruptible but Emacs expects it not to be; and under
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
237 MULE, where all filenames need to be converted to external format).
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
238 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
239 sysdep.c. We first #undef read, in case some system file defines
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
240 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
241 read inside of sys_read will do the right thing.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
242
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
243 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
244 call the actual system calls rather than the encapsulated versions.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
245 Those files can call sys_read to get the (possibly) encapsulated
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
246 versions.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
247
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
248 IMPORTANT: the redefinition of the system call must occur *after* the
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
249 inclusion of any header files that declare or define the system call;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
250 otherwise lots of unfriendly things can happen. This goes for all
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
251 encapsulated system calls.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
252
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
253 We encapsulate the most common system calls here; we assume their
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
254 declarations are in one of the standard header files included above.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
255 Other encapsulations are declared in the appropriate sys*.h file. */
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_READ
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
258 ssize_t sys_read (int, void *, size_t);
272
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_READ) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
261 # undef read
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
262 # define read sys_read
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_READ) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
265 # define sys_read read
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_WRITE
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
269 ssize_t sys_write (int, const void *, size_t);
272
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_WRITE) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
272 # undef write
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
273 # define write sys_write
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_WRITE) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
276 # define sys_write write
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_OPEN
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
280 int sys_open (const char *, int, ...);
272
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_OPEN) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
283 # undef open
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
284 # define open sys_open
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_OPEN) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
287 # define sys_open open
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 #ifdef ENCAPSULATE_CLOSE
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
291 int sys_close (int);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
292 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
293 #if defined (ENCAPSULATE_CLOSE) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
294 # undef close
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
295 # define close sys_close
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
296 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
297 #if !defined (ENCAPSULATE_CLOSE) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
298 # define sys_close close
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
299 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
300
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
301 /* Now the stdio versions ... */
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_FREAD
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
304 size_t sys_fread (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_FREAD) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
307 # undef fread
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
308 # define fread sys_fread
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_FREAD) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
311 # define sys_fread fread
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_FWRITE
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
315 size_t sys_fwrite (const void *, size_t, size_t, FILE *);
272
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_FWRITE) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
318 # undef fwrite
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
319 # define fwrite sys_fwrite
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_FWRITE) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
322 # define sys_fwrite fwrite
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_FOPEN
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
326 FILE *sys_fopen (const char *, const char *);
272
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_FOPEN) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
329 # undef fopen
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
330 # define fopen sys_fopen
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_FOPEN) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
333 # define sys_fopen fopen
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 #ifdef ENCAPSULATE_FCLOSE
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
337 int sys_fclose (FILE *);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
338 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
339 #if defined (ENCAPSULATE_FCLOSE) && !defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
340 # undef fclose
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
341 # define fclose sys_fclose
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
342 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
343 #if !defined (ENCAPSULATE_FCLOSE) && defined (DONT_ENCAPSULATE)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
344 # define sys_fclose fclose
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
345 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
346
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 251
diff changeset
347
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 /* encapsulations: file-information calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 #ifdef ENCAPSULATE_ACCESS
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
351 int sys_access (const char *path, int mode);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 #if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 # undef access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 # define access sys_access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 #if !defined (ENCAPSULATE_ACCESS) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 # define sys_access access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
361 #ifdef ENCAPSULATE_EACCESS
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
362 int sys_eaccess (const char *path, int mode);
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
363 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
364 #if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
365 # undef eaccess
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
366 # define eaccess sys_eaccess
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
367 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
368 #if !defined (ENCAPSULATE_EACCESS) && defined (DONT_ENCAPSULATE)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
369 # define sys_eaccess eaccess
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
370 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
371
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 #ifdef ENCAPSULATE_LSTAT
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
373 int sys_lstat (const char *path, struct stat *buf);
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_LSTAT) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 # undef lstat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 # define lstat sys_lstat
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_LSTAT) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 # define sys_lstat lstat
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_READLINK
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
384 int sys_readlink (const char *path, char *buf, size_t bufsiz);
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_READLINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 # undef readlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 # define readlink sys_readlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 #if !defined (ENCAPSULATE_READLINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 # define sys_readlink readlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
394 #ifdef ENCAPSULATE_FSTAT
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
395 int sys_fstat (int fd, struct stat *buf);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
396 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
397 #if defined (ENCAPSULATE_FSTAT) && !defined (DONT_ENCAPSULATE)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
398 # undef fstat
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
399 /* Need to use arguments to avoid messing with struct stat */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
400 # define fstat(fd, buf) sys_fstat (fd, buf)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
401 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
402 #if !defined (ENCAPSULATE_FSTAT) && defined (DONT_ENCAPSULATE)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
403 # define sys_fstat fstat
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
404 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
405
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 #ifdef ENCAPSULATE_STAT
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
407 int sys_stat (const char *path, struct stat *buf);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 #if defined (ENCAPSULATE_STAT) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 # undef stat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 /* Need to use arguments to avoid messing with struct stat */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 # define stat(path, buf) sys_stat (path, buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 #if !defined (ENCAPSULATE_STAT) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 # define sys_stat stat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 /* encapsulations: file-manipulation calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 #ifdef ENCAPSULATE_CHMOD
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
421 int sys_chmod (const char *path, mode_t mode);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 #if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 # undef chmod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 # define chmod sys_chmod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 #if !defined (ENCAPSULATE_CHMOD) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 # define sys_chmod chmod
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 #ifdef ENCAPSULATE_CREAT
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
432 int sys_creat (const char *path, mode_t mode);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 #if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 # undef creat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 # define creat sys_creat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 #if !defined (ENCAPSULATE_CREAT) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 # define sys_creat creat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 #ifdef ENCAPSULATE_LINK
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
443 int sys_link (const char *existing, const char *new);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 #if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 # undef link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 # define link sys_link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 #if !defined (ENCAPSULATE_LINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 # define sys_link link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 #ifdef ENCAPSULATE_RENAME
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
454 int sys_rename (const char *old, const char *new);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 #if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 # undef rename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 # define rename sys_rename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 #if !defined (ENCAPSULATE_RENAME) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 # define sys_rename rename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 #ifdef ENCAPSULATE_SYMLINK
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
465 int sys_symlink (const char *name1, const char *name2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 #if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 # undef symlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 # define symlink sys_symlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 #if !defined (ENCAPSULATE_SYMLINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 # define sys_symlink symlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 #ifdef ENCAPSULATE_UNLINK
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
476 int sys_unlink (const char *path);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 #if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 # undef unlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 # define unlink sys_unlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 #if !defined (ENCAPSULATE_UNLINK) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 # define sys_unlink unlink
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 #endif
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
485
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
486 #ifdef ENCAPSULATE_EXECVP
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
487 int sys_execvp (const char *, char * const *);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
488 #endif
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
489 #if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
490 # undef execvp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
491 # define execvp sys_execvp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
492 #endif
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
493 #if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
494 # define sys_execvp execvp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
495 #endif
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
496
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 380
diff changeset
497 #endif /* INCLUDED_sysfile_h_ */