annotate src/sysfile.h @ 754:8661af9617f8

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