diff options
Diffstat (limited to 'gl/unistd.in.h')
-rw-r--r-- | gl/unistd.in.h | 510 |
1 files changed, 357 insertions, 153 deletions
diff --git a/gl/unistd.in.h b/gl/unistd.in.h index 7914f228..2ea9af43 100644 --- a/gl/unistd.in.h +++ b/gl/unistd.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for and wrapper around <unistd.h>. | 1 | /* Substitute for and wrapper around <unistd.h>. |
2 | Copyright (C) 2003-2010 Free Software Foundation, Inc. | 2 | Copyright (C) 2003-2013 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -12,30 +12,14 @@ | |||
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software Foundation, | 15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | 16 | |
17 | #ifndef _@GUARD_PREFIX@_UNISTD_H | ||
17 | 18 | ||
18 | #if __GNUC__ >= 3 | 19 | #if __GNUC__ >= 3 |
19 | @PRAGMA_SYSTEM_HEADER@ | 20 | @PRAGMA_SYSTEM_HEADER@ |
20 | #endif | 21 | #endif |
21 | 22 | @PRAGMA_COLUMNS@ | |
22 | /* Special invocation convention: | ||
23 | - On mingw, several headers, including <winsock2.h>, include <unistd.h>, | ||
24 | but we need to ensure that both the system <unistd.h> and <winsock2.h> | ||
25 | are completely included before we replace gethostname. */ | ||
26 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ | ||
27 | && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H | ||
28 | /* <unistd.h> is being indirectly included for the first time from | ||
29 | <winsock2.h>; avoid declaring any overrides. */ | ||
30 | # if @HAVE_UNISTD_H@ | ||
31 | # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ | ||
32 | # else | ||
33 | # error unexpected; report this to bug-gnulib@gnu.org | ||
34 | # endif | ||
35 | # define _GL_WINSOCK2_H_WITNESS | ||
36 | |||
37 | /* Normal invocation. */ | ||
38 | #elif !defined _GL_UNISTD_H | ||
39 | 23 | ||
40 | /* The include_next requires a split double-inclusion guard. */ | 24 | /* The include_next requires a split double-inclusion guard. */ |
41 | #if @HAVE_UNISTD_H@ | 25 | #if @HAVE_UNISTD_H@ |
@@ -50,8 +34,8 @@ | |||
50 | # undef _GL_INCLUDING_WINSOCK2_H | 34 | # undef _GL_INCLUDING_WINSOCK2_H |
51 | #endif | 35 | #endif |
52 | 36 | ||
53 | #if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H | 37 | #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H |
54 | #define _GL_UNISTD_H | 38 | #define _@GUARD_PREFIX@_UNISTD_H |
55 | 39 | ||
56 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ | 40 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ |
57 | #include <stddef.h> | 41 | #include <stddef.h> |
@@ -60,32 +44,66 @@ | |||
60 | /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ | 44 | /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ |
61 | /* But avoid namespace pollution on glibc systems. */ | 45 | /* But avoid namespace pollution on glibc systems. */ |
62 | #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ | 46 | #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ |
63 | || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \ | 47 | || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ |
48 | && defined __CYGWIN__)) \ | ||
64 | && ! defined __GLIBC__ | 49 | && ! defined __GLIBC__ |
65 | # include <stdio.h> | 50 | # include <stdio.h> |
66 | #endif | 51 | #endif |
67 | 52 | ||
68 | /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ | 53 | /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ |
69 | /* But avoid namespace pollution on glibc systems. */ | 54 | /* But avoid namespace pollution on glibc systems. */ |
70 | #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ | 55 | #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ |
56 | && ! defined __GLIBC__ | ||
71 | # include <fcntl.h> | 57 | # include <fcntl.h> |
72 | #endif | 58 | #endif |
73 | 59 | ||
74 | /* mingw fails to declare _exit in <unistd.h>. */ | 60 | /* mingw fails to declare _exit in <unistd.h>. */ |
75 | /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ | 61 | /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in |
62 | <unistd.h>. */ | ||
76 | /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ | 63 | /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ |
64 | /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is | ||
65 | included here. */ | ||
77 | /* But avoid namespace pollution on glibc systems. */ | 66 | /* But avoid namespace pollution on glibc systems. */ |
78 | #ifndef __GLIBC__ | 67 | #if !defined __GLIBC__ && !defined __osf__ |
68 | # define __need_system_stdlib_h | ||
79 | # include <stdlib.h> | 69 | # include <stdlib.h> |
70 | # undef __need_system_stdlib_h | ||
80 | #endif | 71 | #endif |
81 | 72 | ||
82 | /* mingw declares getcwd in <io.h>, not in <unistd.h>. */ | 73 | /* Native Windows platforms declare chdir, getcwd, rmdir in |
83 | #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ | 74 | <io.h> and/or <direct.h>, not in <unistd.h>. |
75 | They also declare access(), chmod(), close(), dup(), dup2(), isatty(), | ||
76 | lseek(), read(), unlink(), write() in <io.h>. */ | ||
77 | #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ | ||
78 | || defined GNULIB_POSIXCHECK) \ | ||
84 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) | 79 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) |
80 | # include <io.h> /* mingw32, mingw64 */ | ||
81 | # include <direct.h> /* mingw64, MSVC 9 */ | ||
82 | #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \ | ||
83 | || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \ | ||
84 | || defined GNULIB_POSIXCHECK) \ | ||
85 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) | ||
85 | # include <io.h> | 86 | # include <io.h> |
86 | #endif | 87 | #endif |
87 | 88 | ||
88 | #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ | 89 | /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. |
90 | NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ | ||
91 | /* But avoid namespace pollution on glibc systems. */ | ||
92 | #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ | ||
93 | || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ | ||
94 | && !defined __GLIBC__ | ||
95 | # include <netdb.h> | ||
96 | #endif | ||
97 | |||
98 | /* MSVC defines off_t in <sys/types.h>. | ||
99 | May also define off_t to a 64-bit type on native Windows. */ | ||
100 | #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ | ||
101 | /* Get off_t. */ | ||
102 | # include <sys/types.h> | ||
103 | #endif | ||
104 | |||
105 | #if (@GNULIB_READ@ || @GNULIB_WRITE@ \ | ||
106 | || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ | ||
89 | || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) | 107 | || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) |
90 | /* Get ssize_t. */ | 108 | /* Get ssize_t. */ |
91 | # include <sys/types.h> | 109 | # include <sys/types.h> |
@@ -94,9 +112,15 @@ | |||
94 | /* Get getopt(), optarg, optind, opterr, optopt. | 112 | /* Get getopt(), optarg, optind, opterr, optopt. |
95 | But avoid namespace pollution on glibc systems. */ | 113 | But avoid namespace pollution on glibc systems. */ |
96 | #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT | 114 | #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT |
115 | # define __need_getopt | ||
97 | # include <getopt.h> | 116 | # include <getopt.h> |
98 | #endif | 117 | #endif |
99 | 118 | ||
119 | _GL_INLINE_HEADER_BEGIN | ||
120 | #ifndef _GL_UNISTD_INLINE | ||
121 | # define _GL_UNISTD_INLINE _GL_INLINE | ||
122 | #endif | ||
123 | |||
100 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 124 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
101 | 125 | ||
102 | /* The definition of _GL_ARG_NONNULL is copied here. */ | 126 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
@@ -104,78 +128,77 @@ | |||
104 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 128 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
105 | 129 | ||
106 | 130 | ||
107 | #if @GNULIB_GETHOSTNAME@ | 131 | /* Hide some function declarations from <winsock2.h>. */ |
108 | /* Get all possible declarations of gethostname(). */ | 132 | |
109 | # if @UNISTD_H_HAVE_WINSOCK2_H@ | 133 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ |
110 | # if !defined _GL_SYS_SOCKET_H | 134 | # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H |
111 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 135 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
112 | # undef socket | 136 | # undef socket |
113 | # define socket socket_used_without_including_sys_socket_h | 137 | # define socket socket_used_without_including_sys_socket_h |
114 | # undef connect | 138 | # undef connect |
115 | # define connect connect_used_without_including_sys_socket_h | 139 | # define connect connect_used_without_including_sys_socket_h |
116 | # undef accept | 140 | # undef accept |
117 | # define accept accept_used_without_including_sys_socket_h | 141 | # define accept accept_used_without_including_sys_socket_h |
118 | # undef bind | 142 | # undef bind |
119 | # define bind bind_used_without_including_sys_socket_h | 143 | # define bind bind_used_without_including_sys_socket_h |
120 | # undef getpeername | 144 | # undef getpeername |
121 | # define getpeername getpeername_used_without_including_sys_socket_h | 145 | # define getpeername getpeername_used_without_including_sys_socket_h |
122 | # undef getsockname | 146 | # undef getsockname |
123 | # define getsockname getsockname_used_without_including_sys_socket_h | 147 | # define getsockname getsockname_used_without_including_sys_socket_h |
124 | # undef getsockopt | 148 | # undef getsockopt |
125 | # define getsockopt getsockopt_used_without_including_sys_socket_h | 149 | # define getsockopt getsockopt_used_without_including_sys_socket_h |
126 | # undef listen | 150 | # undef listen |
127 | # define listen listen_used_without_including_sys_socket_h | 151 | # define listen listen_used_without_including_sys_socket_h |
128 | # undef recv | 152 | # undef recv |
129 | # define recv recv_used_without_including_sys_socket_h | 153 | # define recv recv_used_without_including_sys_socket_h |
130 | # undef send | 154 | # undef send |
131 | # define send send_used_without_including_sys_socket_h | 155 | # define send send_used_without_including_sys_socket_h |
132 | # undef recvfrom | 156 | # undef recvfrom |
133 | # define recvfrom recvfrom_used_without_including_sys_socket_h | 157 | # define recvfrom recvfrom_used_without_including_sys_socket_h |
134 | # undef sendto | 158 | # undef sendto |
135 | # define sendto sendto_used_without_including_sys_socket_h | 159 | # define sendto sendto_used_without_including_sys_socket_h |
136 | # undef setsockopt | 160 | # undef setsockopt |
137 | # define setsockopt setsockopt_used_without_including_sys_socket_h | 161 | # define setsockopt setsockopt_used_without_including_sys_socket_h |
138 | # undef shutdown | 162 | # undef shutdown |
139 | # define shutdown shutdown_used_without_including_sys_socket_h | 163 | # define shutdown shutdown_used_without_including_sys_socket_h |
140 | # else | 164 | # else |
141 | _GL_WARN_ON_USE (socket, | 165 | _GL_WARN_ON_USE (socket, |
142 | "socket() used without including <sys/socket.h>"); | 166 | "socket() used without including <sys/socket.h>"); |
143 | _GL_WARN_ON_USE (connect, | 167 | _GL_WARN_ON_USE (connect, |
144 | "connect() used without including <sys/socket.h>"); | 168 | "connect() used without including <sys/socket.h>"); |
145 | _GL_WARN_ON_USE (accept, | 169 | _GL_WARN_ON_USE (accept, |
146 | "accept() used without including <sys/socket.h>"); | 170 | "accept() used without including <sys/socket.h>"); |
147 | _GL_WARN_ON_USE (bind, | 171 | _GL_WARN_ON_USE (bind, |
148 | "bind() used without including <sys/socket.h>"); | 172 | "bind() used without including <sys/socket.h>"); |
149 | _GL_WARN_ON_USE (getpeername, | 173 | _GL_WARN_ON_USE (getpeername, |
150 | "getpeername() used without including <sys/socket.h>"); | 174 | "getpeername() used without including <sys/socket.h>"); |
151 | _GL_WARN_ON_USE (getsockname, | 175 | _GL_WARN_ON_USE (getsockname, |
152 | "getsockname() used without including <sys/socket.h>"); | 176 | "getsockname() used without including <sys/socket.h>"); |
153 | _GL_WARN_ON_USE (getsockopt, | 177 | _GL_WARN_ON_USE (getsockopt, |
154 | "getsockopt() used without including <sys/socket.h>"); | 178 | "getsockopt() used without including <sys/socket.h>"); |
155 | _GL_WARN_ON_USE (listen, | 179 | _GL_WARN_ON_USE (listen, |
156 | "listen() used without including <sys/socket.h>"); | 180 | "listen() used without including <sys/socket.h>"); |
157 | _GL_WARN_ON_USE (recv, | 181 | _GL_WARN_ON_USE (recv, |
158 | "recv() used without including <sys/socket.h>"); | 182 | "recv() used without including <sys/socket.h>"); |
159 | _GL_WARN_ON_USE (send, | 183 | _GL_WARN_ON_USE (send, |
160 | "send() used without including <sys/socket.h>"); | 184 | "send() used without including <sys/socket.h>"); |
161 | _GL_WARN_ON_USE (recvfrom, | 185 | _GL_WARN_ON_USE (recvfrom, |
162 | "recvfrom() used without including <sys/socket.h>"); | 186 | "recvfrom() used without including <sys/socket.h>"); |
163 | _GL_WARN_ON_USE (sendto, | 187 | _GL_WARN_ON_USE (sendto, |
164 | "sendto() used without including <sys/socket.h>"); | 188 | "sendto() used without including <sys/socket.h>"); |
165 | _GL_WARN_ON_USE (setsockopt, | 189 | _GL_WARN_ON_USE (setsockopt, |
166 | "setsockopt() used without including <sys/socket.h>"); | 190 | "setsockopt() used without including <sys/socket.h>"); |
167 | _GL_WARN_ON_USE (shutdown, | 191 | _GL_WARN_ON_USE (shutdown, |
168 | "shutdown() used without including <sys/socket.h>"); | 192 | "shutdown() used without including <sys/socket.h>"); |
169 | # endif | ||
170 | # endif | 193 | # endif |
171 | # if !defined _GL_SYS_SELECT_H | 194 | # endif |
172 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 195 | # if !defined _@GUARD_PREFIX@_SYS_SELECT_H |
173 | # undef select | 196 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
174 | # define select select_used_without_including_sys_select_h | 197 | # undef select |
175 | # else | 198 | # define select select_used_without_including_sys_select_h |
176 | _GL_WARN_ON_USE (select, | 199 | # else |
177 | "select() used without including <sys/select.h>"); | 200 | _GL_WARN_ON_USE (select, |
178 | # endif | 201 | "select() used without including <sys/select.h>"); |
179 | # endif | 202 | # endif |
180 | # endif | 203 | # endif |
181 | #endif | 204 | #endif |
@@ -211,12 +234,24 @@ _GL_WARN_ON_USE (access, "the access function is a security risk - " | |||
211 | #endif | 234 | #endif |
212 | 235 | ||
213 | 236 | ||
237 | #if @GNULIB_CHDIR@ | ||
238 | _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); | ||
239 | _GL_CXXALIASWARN (chdir); | ||
240 | #elif defined GNULIB_POSIXCHECK | ||
241 | # undef chdir | ||
242 | # if HAVE_RAW_DECL_CHDIR | ||
243 | _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " | ||
244 | "use gnulib module chdir for portability"); | ||
245 | # endif | ||
246 | #endif | ||
247 | |||
248 | |||
214 | #if @GNULIB_CHOWN@ | 249 | #if @GNULIB_CHOWN@ |
215 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE | 250 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE |
216 | to GID (if GID is not -1). Follow symbolic links. | 251 | to GID (if GID is not -1). Follow symbolic links. |
217 | Return 0 if successful, otherwise -1 and errno set. | 252 | Return 0 if successful, otherwise -1 and errno set. |
218 | See the POSIX:2001 specification | 253 | See the POSIX:2008 specification |
219 | <http://www.opengroup.org/susv3xsh/chown.html>. */ | 254 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ |
220 | # if @REPLACE_CHOWN@ | 255 | # if @REPLACE_CHOWN@ |
221 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 256 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
222 | # undef chown | 257 | # undef chown |
@@ -267,24 +302,32 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " | |||
267 | #endif | 302 | #endif |
268 | 303 | ||
269 | 304 | ||
270 | #if @REPLACE_DUP@ | 305 | #if @GNULIB_DUP@ |
271 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 306 | # if @REPLACE_DUP@ |
272 | # define dup rpl_dup | 307 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
273 | # endif | 308 | # define dup rpl_dup |
309 | # endif | ||
274 | _GL_FUNCDECL_RPL (dup, int, (int oldfd)); | 310 | _GL_FUNCDECL_RPL (dup, int, (int oldfd)); |
275 | _GL_CXXALIAS_RPL (dup, int, (int oldfd)); | 311 | _GL_CXXALIAS_RPL (dup, int, (int oldfd)); |
276 | #else | 312 | # else |
277 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); | 313 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); |
278 | #endif | 314 | # endif |
279 | _GL_CXXALIASWARN (dup); | 315 | _GL_CXXALIASWARN (dup); |
316 | #elif defined GNULIB_POSIXCHECK | ||
317 | # undef dup | ||
318 | # if HAVE_RAW_DECL_DUP | ||
319 | _GL_WARN_ON_USE (dup, "dup is unportable - " | ||
320 | "use gnulib module dup for portability"); | ||
321 | # endif | ||
322 | #endif | ||
280 | 323 | ||
281 | 324 | ||
282 | #if @GNULIB_DUP2@ | 325 | #if @GNULIB_DUP2@ |
283 | /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if | 326 | /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if |
284 | NEWFD = OLDFD, otherwise close NEWFD first if it is open. | 327 | NEWFD = OLDFD, otherwise close NEWFD first if it is open. |
285 | Return newfd if successful, otherwise -1 and errno set. | 328 | Return newfd if successful, otherwise -1 and errno set. |
286 | See the POSIX:2001 specification | 329 | See the POSIX:2008 specification |
287 | <http://www.opengroup.org/susv3xsh/dup2.html>. */ | 330 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ |
288 | # if @REPLACE_DUP2@ | 331 | # if @REPLACE_DUP2@ |
289 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 332 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
290 | # define dup2 rpl_dup2 | 333 | # define dup2 rpl_dup2 |
@@ -355,7 +398,7 @@ extern char **environ; | |||
355 | # endif | 398 | # endif |
356 | #elif defined GNULIB_POSIXCHECK | 399 | #elif defined GNULIB_POSIXCHECK |
357 | # if HAVE_RAW_DECL_ENVIRON | 400 | # if HAVE_RAW_DECL_ENVIRON |
358 | static inline char *** | 401 | _GL_UNISTD_INLINE char *** |
359 | rpl_environ (void) | 402 | rpl_environ (void) |
360 | { | 403 | { |
361 | return &environ; | 404 | return &environ; |
@@ -413,8 +456,8 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " | |||
413 | /* Change the process' current working directory to the directory on which | 456 | /* Change the process' current working directory to the directory on which |
414 | the given file descriptor is open. | 457 | the given file descriptor is open. |
415 | Return 0 if successful, otherwise -1 and errno set. | 458 | Return 0 if successful, otherwise -1 and errno set. |
416 | See the POSIX:2001 specification | 459 | See the POSIX:2008 specification |
417 | <http://www.opengroup.org/susv3xsh/fchdir.html>. */ | 460 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ |
418 | # if ! @HAVE_FCHDIR@ | 461 | # if ! @HAVE_FCHDIR@ |
419 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); | 462 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); |
420 | 463 | ||
@@ -425,6 +468,10 @@ _GL_EXTERN_C void _gl_unregister_fd (int fd); | |||
425 | _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); | 468 | _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); |
426 | _GL_EXTERN_C const char *_gl_directory_name (int fd); | 469 | _GL_EXTERN_C const char *_gl_directory_name (int fd); |
427 | 470 | ||
471 | # else | ||
472 | # if !@HAVE_DECL_FCHDIR@ | ||
473 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); | ||
474 | # endif | ||
428 | # endif | 475 | # endif |
429 | _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); | 476 | _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); |
430 | _GL_CXXALIASWARN (fchdir); | 477 | _GL_CXXALIASWARN (fchdir); |
@@ -467,11 +514,30 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " | |||
467 | #endif | 514 | #endif |
468 | 515 | ||
469 | 516 | ||
470 | #if @GNULIB_FSYNC@ | 517 | #if @GNULIB_FDATASYNC@ |
471 | /* Synchronize changes to a file. | 518 | /* Synchronize changes to a file. |
472 | Return 0 if successful, otherwise -1 and errno set. | 519 | Return 0 if successful, otherwise -1 and errno set. |
473 | See POSIX:2001 specification | 520 | See POSIX:2008 specification |
474 | <http://www.opengroup.org/susv3xsh/fsync.html>. */ | 521 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ |
522 | # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ | ||
523 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); | ||
524 | # endif | ||
525 | _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); | ||
526 | _GL_CXXALIASWARN (fdatasync); | ||
527 | #elif defined GNULIB_POSIXCHECK | ||
528 | # undef fdatasync | ||
529 | # if HAVE_RAW_DECL_FDATASYNC | ||
530 | _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " | ||
531 | "use gnulib module fdatasync for portability"); | ||
532 | # endif | ||
533 | #endif | ||
534 | |||
535 | |||
536 | #if @GNULIB_FSYNC@ | ||
537 | /* Synchronize changes, including metadata, to a file. | ||
538 | Return 0 if successful, otherwise -1 and errno set. | ||
539 | See POSIX:2008 specification | ||
540 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ | ||
475 | # if !@HAVE_FSYNC@ | 541 | # if !@HAVE_FSYNC@ |
476 | _GL_FUNCDECL_SYS (fsync, int, (int fd)); | 542 | _GL_FUNCDECL_SYS (fsync, int, (int fd)); |
477 | # endif | 543 | # endif |
@@ -489,12 +555,21 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " | |||
489 | #if @GNULIB_FTRUNCATE@ | 555 | #if @GNULIB_FTRUNCATE@ |
490 | /* Change the size of the file to which FD is opened to become equal to LENGTH. | 556 | /* Change the size of the file to which FD is opened to become equal to LENGTH. |
491 | Return 0 if successful, otherwise -1 and errno set. | 557 | Return 0 if successful, otherwise -1 and errno set. |
492 | See the POSIX:2001 specification | 558 | See the POSIX:2008 specification |
493 | <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ | 559 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ |
494 | # if !@HAVE_FTRUNCATE@ | 560 | # if @REPLACE_FTRUNCATE@ |
561 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
562 | # undef ftruncate | ||
563 | # define ftruncate rpl_ftruncate | ||
564 | # endif | ||
565 | _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); | ||
566 | _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); | ||
567 | # else | ||
568 | # if !@HAVE_FTRUNCATE@ | ||
495 | _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); | 569 | _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); |
496 | # endif | 570 | # endif |
497 | _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); | 571 | _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); |
572 | # endif | ||
498 | _GL_CXXALIASWARN (ftruncate); | 573 | _GL_CXXALIASWARN (ftruncate); |
499 | #elif defined GNULIB_POSIXCHECK | 574 | #elif defined GNULIB_POSIXCHECK |
500 | # undef ftruncate | 575 | # undef ftruncate |
@@ -510,8 +585,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " | |||
510 | of BUF. | 585 | of BUF. |
511 | Return BUF if successful, or NULL if the directory couldn't be determined | 586 | Return BUF if successful, or NULL if the directory couldn't be determined |
512 | or SIZE was too small. | 587 | or SIZE was too small. |
513 | See the POSIX:2001 specification | 588 | See the POSIX:2008 specification |
514 | <http://www.opengroup.org/susv3xsh/getcwd.html>. | 589 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. |
515 | Additionally, the gnulib module 'getcwd' guarantees the following GNU | 590 | Additionally, the gnulib module 'getcwd' guarantees the following GNU |
516 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array | 591 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array |
517 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as | 592 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as |
@@ -548,13 +623,21 @@ _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " | |||
548 | Null terminate it if the name is shorter than LEN. | 623 | Null terminate it if the name is shorter than LEN. |
549 | If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. | 624 | If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. |
550 | Return 0 if successful, otherwise set errno and return -1. */ | 625 | Return 0 if successful, otherwise set errno and return -1. */ |
551 | # if !@HAVE_GETDOMAINNAME@ | 626 | # if @REPLACE_GETDOMAINNAME@ |
627 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
628 | # undef getdomainname | ||
629 | # define getdomainname rpl_getdomainname | ||
630 | # endif | ||
631 | _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) | ||
632 | _GL_ARG_NONNULL ((1))); | ||
633 | _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); | ||
634 | # else | ||
635 | # if !@HAVE_DECL_GETDOMAINNAME@ | ||
552 | _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) | 636 | _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) |
553 | _GL_ARG_NONNULL ((1))); | 637 | _GL_ARG_NONNULL ((1))); |
638 | # endif | ||
639 | _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); | ||
554 | # endif | 640 | # endif |
555 | /* Need to cast, because on MacOS X 10.5 systems, the second parameter is | ||
556 | int len. */ | ||
557 | _GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len)); | ||
558 | _GL_CXXALIASWARN (getdomainname); | 641 | _GL_CXXALIASWARN (getdomainname); |
559 | #elif defined GNULIB_POSIXCHECK | 642 | #elif defined GNULIB_POSIXCHECK |
560 | # undef getdomainname | 643 | # undef getdomainname |
@@ -632,7 +715,8 @@ _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); | |||
632 | _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) | 715 | _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) |
633 | _GL_ARG_NONNULL ((1))); | 716 | _GL_ARG_NONNULL ((1))); |
634 | # endif | 717 | # endif |
635 | /* Need to cast, because on Solaris 10 systems, the second parameter is | 718 | /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second |
719 | parameter is | ||
636 | int len. */ | 720 | int len. */ |
637 | _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); | 721 | _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); |
638 | # endif | 722 | # endif |
@@ -689,13 +773,22 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " | |||
689 | ${LOGNAME-$USER} on Unix platforms, | 773 | ${LOGNAME-$USER} on Unix platforms, |
690 | $USERNAME on native Windows platforms. | 774 | $USERNAME on native Windows platforms. |
691 | */ | 775 | */ |
692 | # if !@HAVE_DECL_GETLOGIN_R@ | 776 | # if @REPLACE_GETLOGIN_R@ |
777 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
778 | # define getlogin_r rpl_getlogin_r | ||
779 | # endif | ||
780 | _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) | ||
781 | _GL_ARG_NONNULL ((1))); | ||
782 | _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); | ||
783 | # else | ||
784 | # if !@HAVE_DECL_GETLOGIN_R@ | ||
693 | _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) | 785 | _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) |
694 | _GL_ARG_NONNULL ((1))); | 786 | _GL_ARG_NONNULL ((1))); |
695 | # endif | 787 | # endif |
696 | /* Need to cast, because on Solaris 10 systems, the second argument is | 788 | /* Need to cast, because on Solaris 10 systems, the second argument is |
697 | int size. */ | 789 | int size. */ |
698 | _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); | 790 | _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); |
791 | # endif | ||
699 | _GL_CXXALIASWARN (getlogin_r); | 792 | _GL_CXXALIASWARN (getlogin_r); |
700 | #elif defined GNULIB_POSIXCHECK | 793 | #elif defined GNULIB_POSIXCHECK |
701 | # undef getlogin_r | 794 | # undef getlogin_r |
@@ -762,11 +855,14 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void)); | |||
762 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 855 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
763 | # define getpagesize() _gl_getpagesize () | 856 | # define getpagesize() _gl_getpagesize () |
764 | # else | 857 | # else |
765 | static inline int | 858 | # if !GNULIB_defined_getpagesize_function |
859 | _GL_UNISTD_INLINE int | ||
766 | getpagesize () | 860 | getpagesize () |
767 | { | 861 | { |
768 | return _gl_getpagesize (); | 862 | return _gl_getpagesize (); |
769 | } | 863 | } |
864 | # define GNULIB_defined_getpagesize_function 1 | ||
865 | # endif | ||
770 | # endif | 866 | # endif |
771 | # endif | 867 | # endif |
772 | # endif | 868 | # endif |
@@ -833,12 +929,49 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " | |||
833 | #endif | 929 | #endif |
834 | 930 | ||
835 | 931 | ||
932 | #if @GNULIB_GROUP_MEMBER@ | ||
933 | /* Determine whether group id is in calling user's group list. */ | ||
934 | # if !@HAVE_GROUP_MEMBER@ | ||
935 | _GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); | ||
936 | # endif | ||
937 | _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); | ||
938 | _GL_CXXALIASWARN (group_member); | ||
939 | #elif defined GNULIB_POSIXCHECK | ||
940 | # undef group_member | ||
941 | # if HAVE_RAW_DECL_GROUP_MEMBER | ||
942 | _GL_WARN_ON_USE (group_member, "group_member is unportable - " | ||
943 | "use gnulib module group-member for portability"); | ||
944 | # endif | ||
945 | #endif | ||
946 | |||
947 | |||
948 | #if @GNULIB_ISATTY@ | ||
949 | # if @REPLACE_ISATTY@ | ||
950 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
951 | # undef isatty | ||
952 | # define isatty rpl_isatty | ||
953 | # endif | ||
954 | _GL_FUNCDECL_RPL (isatty, int, (int fd)); | ||
955 | _GL_CXXALIAS_RPL (isatty, int, (int fd)); | ||
956 | # else | ||
957 | _GL_CXXALIAS_SYS (isatty, int, (int fd)); | ||
958 | # endif | ||
959 | _GL_CXXALIASWARN (isatty); | ||
960 | #elif defined GNULIB_POSIXCHECK | ||
961 | # undef isatty | ||
962 | # if HAVE_RAW_DECL_ISATTY | ||
963 | _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " | ||
964 | "use gnulib module isatty for portability"); | ||
965 | # endif | ||
966 | #endif | ||
967 | |||
968 | |||
836 | #if @GNULIB_LCHOWN@ | 969 | #if @GNULIB_LCHOWN@ |
837 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE | 970 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE |
838 | to GID (if GID is not -1). Do not follow symbolic links. | 971 | to GID (if GID is not -1). Do not follow symbolic links. |
839 | Return 0 if successful, otherwise -1 and errno set. | 972 | Return 0 if successful, otherwise -1 and errno set. |
840 | See the POSIX:2001 specification | 973 | See the POSIX:2008 specification |
841 | <http://www.opengroup.org/susv3xsh/lchown.html>. */ | 974 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ |
842 | # if @REPLACE_LCHOWN@ | 975 | # if @REPLACE_LCHOWN@ |
843 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 976 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
844 | # undef lchown | 977 | # undef lchown |
@@ -867,8 +1000,8 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " | |||
867 | #if @GNULIB_LINK@ | 1000 | #if @GNULIB_LINK@ |
868 | /* Create a new hard link for an existing file. | 1001 | /* Create a new hard link for an existing file. |
869 | Return 0 if successful, otherwise -1 and errno set. | 1002 | Return 0 if successful, otherwise -1 and errno set. |
870 | See POSIX:2001 specification | 1003 | See POSIX:2008 specification |
871 | <http://www.opengroup.org/susv3xsh/link.html>. */ | 1004 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ |
872 | # if @REPLACE_LINK@ | 1005 | # if @REPLACE_LINK@ |
873 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1006 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
874 | # define link rpl_link | 1007 | # define link rpl_link |
@@ -933,8 +1066,8 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " | |||
933 | #if @GNULIB_LSEEK@ | 1066 | #if @GNULIB_LSEEK@ |
934 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. | 1067 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. |
935 | Return the new offset if successful, otherwise -1 and errno set. | 1068 | Return the new offset if successful, otherwise -1 and errno set. |
936 | See the POSIX:2001 specification | 1069 | See the POSIX:2008 specification |
937 | <http://www.opengroup.org/susv3xsh/lseek.html>. */ | 1070 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ |
938 | # if @REPLACE_LSEEK@ | 1071 | # if @REPLACE_LSEEK@ |
939 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1072 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
940 | # define lseek rpl_lseek | 1073 | # define lseek rpl_lseek |
@@ -954,6 +1087,24 @@ _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " | |||
954 | #endif | 1087 | #endif |
955 | 1088 | ||
956 | 1089 | ||
1090 | #if @GNULIB_PIPE@ | ||
1091 | /* Create a pipe, defaulting to O_BINARY mode. | ||
1092 | Store the read-end as fd[0] and the write-end as fd[1]. | ||
1093 | Return 0 upon success, or -1 with errno set upon failure. */ | ||
1094 | # if !@HAVE_PIPE@ | ||
1095 | _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); | ||
1096 | # endif | ||
1097 | _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); | ||
1098 | _GL_CXXALIASWARN (pipe); | ||
1099 | #elif defined GNULIB_POSIXCHECK | ||
1100 | # undef pipe | ||
1101 | # if HAVE_RAW_DECL_PIPE | ||
1102 | _GL_WARN_ON_USE (pipe, "pipe is unportable - " | ||
1103 | "use gnulib module pipe-posix for portability"); | ||
1104 | # endif | ||
1105 | #endif | ||
1106 | |||
1107 | |||
957 | #if @GNULIB_PIPE2@ | 1108 | #if @GNULIB_PIPE2@ |
958 | /* Create a pipe, applying the given flags when opening the read-end of the | 1109 | /* Create a pipe, applying the given flags when opening the read-end of the |
959 | pipe and the write-end of the pipe. | 1110 | pipe and the write-end of the pipe. |
@@ -986,10 +1137,12 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " | |||
986 | #if @GNULIB_PREAD@ | 1137 | #if @GNULIB_PREAD@ |
987 | /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. | 1138 | /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. |
988 | Return the number of bytes placed into BUF if successful, otherwise | 1139 | Return the number of bytes placed into BUF if successful, otherwise |
989 | set errno and return -1. 0 indicates EOF. See the POSIX:2001 | 1140 | set errno and return -1. 0 indicates EOF. |
990 | specification <http://www.opengroup.org/susv3xsh/pread.html>. */ | 1141 | See the POSIX:2008 specification |
1142 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ | ||
991 | # if @REPLACE_PREAD@ | 1143 | # if @REPLACE_PREAD@ |
992 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1144 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1145 | # undef pread | ||
993 | # define pread rpl_pread | 1146 | # define pread rpl_pread |
994 | # endif | 1147 | # endif |
995 | _GL_FUNCDECL_RPL (pread, ssize_t, | 1148 | _GL_FUNCDECL_RPL (pread, ssize_t, |
@@ -1020,10 +1173,11 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " | |||
1020 | /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. | 1173 | /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. |
1021 | Return the number of bytes written if successful, otherwise | 1174 | Return the number of bytes written if successful, otherwise |
1022 | set errno and return -1. 0 indicates nothing written. See the | 1175 | set errno and return -1. 0 indicates nothing written. See the |
1023 | POSIX:2001 specification | 1176 | POSIX:2008 specification |
1024 | <http://www.opengroup.org/susv3xsh/pwrite.html>. */ | 1177 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ |
1025 | # if @REPLACE_PWRITE@ | 1178 | # if @REPLACE_PWRITE@ |
1026 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1179 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1180 | # undef pwrite | ||
1027 | # define pwrite rpl_pwrite | 1181 | # define pwrite rpl_pwrite |
1028 | # endif | 1182 | # endif |
1029 | _GL_FUNCDECL_RPL (pwrite, ssize_t, | 1183 | _GL_FUNCDECL_RPL (pwrite, ssize_t, |
@@ -1050,12 +1204,34 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " | |||
1050 | #endif | 1204 | #endif |
1051 | 1205 | ||
1052 | 1206 | ||
1207 | #if @GNULIB_READ@ | ||
1208 | /* Read up to COUNT bytes from file descriptor FD into the buffer starting | ||
1209 | at BUF. See the POSIX:2008 specification | ||
1210 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ | ||
1211 | # if @REPLACE_READ@ | ||
1212 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1213 | # undef read | ||
1214 | # define read rpl_read | ||
1215 | # endif | ||
1216 | _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) | ||
1217 | _GL_ARG_NONNULL ((2))); | ||
1218 | _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); | ||
1219 | # else | ||
1220 | /* Need to cast, because on mingw, the third parameter is | ||
1221 | unsigned int count | ||
1222 | and the return type is 'int'. */ | ||
1223 | _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); | ||
1224 | # endif | ||
1225 | _GL_CXXALIASWARN (read); | ||
1226 | #endif | ||
1227 | |||
1228 | |||
1053 | #if @GNULIB_READLINK@ | 1229 | #if @GNULIB_READLINK@ |
1054 | /* Read the contents of the symbolic link FILE and place the first BUFSIZE | 1230 | /* Read the contents of the symbolic link FILE and place the first BUFSIZE |
1055 | bytes of it into BUF. Return the number of bytes placed into BUF if | 1231 | bytes of it into BUF. Return the number of bytes placed into BUF if |
1056 | successful, otherwise -1 and errno set. | 1232 | successful, otherwise -1 and errno set. |
1057 | See the POSIX:2001 specification | 1233 | See the POSIX:2008 specification |
1058 | <http://www.opengroup.org/susv3xsh/readlink.html>. */ | 1234 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ |
1059 | # if @REPLACE_READLINK@ | 1235 | # if @REPLACE_READLINK@ |
1060 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1236 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1061 | # define readlink rpl_readlink | 1237 | # define readlink rpl_readlink |
@@ -1097,7 +1273,7 @@ _GL_CXXALIASWARN (readlinkat); | |||
1097 | # undef readlinkat | 1273 | # undef readlinkat |
1098 | # if HAVE_RAW_DECL_READLINKAT | 1274 | # if HAVE_RAW_DECL_READLINKAT |
1099 | _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " | 1275 | _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " |
1100 | "use gnulib module symlinkat for portability"); | 1276 | "use gnulib module readlinkat for portability"); |
1101 | # endif | 1277 | # endif |
1102 | #endif | 1278 | #endif |
1103 | 1279 | ||
@@ -1123,11 +1299,38 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " | |||
1123 | #endif | 1299 | #endif |
1124 | 1300 | ||
1125 | 1301 | ||
1302 | #if @GNULIB_SETHOSTNAME@ | ||
1303 | /* Set the host name of the machine. | ||
1304 | The host name may or may not be fully qualified. | ||
1305 | |||
1306 | Put LEN bytes of NAME into the host name. | ||
1307 | Return 0 if successful, otherwise, set errno and return -1. | ||
1308 | |||
1309 | Platforms with no ability to set the hostname return -1 and set | ||
1310 | errno = ENOSYS. */ | ||
1311 | # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ | ||
1312 | _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) | ||
1313 | _GL_ARG_NONNULL ((1))); | ||
1314 | # endif | ||
1315 | /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 | ||
1316 | and FreeBSD 6.4 the second parameter is int. On Solaris 11 | ||
1317 | 2011-10, the first parameter is not const. */ | ||
1318 | _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); | ||
1319 | _GL_CXXALIASWARN (sethostname); | ||
1320 | #elif defined GNULIB_POSIXCHECK | ||
1321 | # undef sethostname | ||
1322 | # if HAVE_RAW_DECL_SETHOSTNAME | ||
1323 | _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " | ||
1324 | "use gnulib module sethostname for portability"); | ||
1325 | # endif | ||
1326 | #endif | ||
1327 | |||
1328 | |||
1126 | #if @GNULIB_SLEEP@ | 1329 | #if @GNULIB_SLEEP@ |
1127 | /* Pause the execution of the current thread for N seconds. | 1330 | /* Pause the execution of the current thread for N seconds. |
1128 | Returns the number of seconds left to sleep. | 1331 | Returns the number of seconds left to sleep. |
1129 | See the POSIX:2001 specification | 1332 | See the POSIX:2008 specification |
1130 | <http://www.opengroup.org/susv3xsh/sleep.html>. */ | 1333 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ |
1131 | # if @REPLACE_SLEEP@ | 1334 | # if @REPLACE_SLEEP@ |
1132 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1335 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1133 | # undef sleep | 1336 | # undef sleep |
@@ -1208,7 +1411,7 @@ _GL_FUNCDECL_RPL (ttyname_r, int, | |||
1208 | _GL_CXXALIAS_RPL (ttyname_r, int, | 1411 | _GL_CXXALIAS_RPL (ttyname_r, int, |
1209 | (int fd, char *buf, size_t buflen)); | 1412 | (int fd, char *buf, size_t buflen)); |
1210 | # else | 1413 | # else |
1211 | # if !@HAVE_TTYNAME_R@ | 1414 | # if !@HAVE_DECL_TTYNAME_R@ |
1212 | _GL_FUNCDECL_SYS (ttyname_r, int, | 1415 | _GL_FUNCDECL_SYS (ttyname_r, int, |
1213 | (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); | 1416 | (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); |
1214 | # endif | 1417 | # endif |
@@ -1276,7 +1479,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " | |||
1276 | /* Pause the execution of the current thread for N microseconds. | 1479 | /* Pause the execution of the current thread for N microseconds. |
1277 | Returns 0 on completion, or -1 on range error. | 1480 | Returns 0 on completion, or -1 on range error. |
1278 | See the POSIX:2001 specification | 1481 | See the POSIX:2001 specification |
1279 | <http://www.opengroup.org/susv3xsh/sleep.html>. */ | 1482 | <http://www.opengroup.org/susv3xsh/usleep.html>. */ |
1280 | # if @REPLACE_USLEEP@ | 1483 | # if @REPLACE_USLEEP@ |
1281 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1484 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1282 | # undef usleep | 1485 | # undef usleep |
@@ -1302,9 +1505,9 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " | |||
1302 | 1505 | ||
1303 | #if @GNULIB_WRITE@ | 1506 | #if @GNULIB_WRITE@ |
1304 | /* Write up to COUNT bytes starting at BUF to file descriptor FD. | 1507 | /* Write up to COUNT bytes starting at BUF to file descriptor FD. |
1305 | See the POSIX:2001 specification | 1508 | See the POSIX:2008 specification |
1306 | <http://www.opengroup.org/susv3xsh/write.html>. */ | 1509 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ |
1307 | # if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ | 1510 | # if @REPLACE_WRITE@ |
1308 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1511 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1309 | # undef write | 1512 | # undef write |
1310 | # define write rpl_write | 1513 | # define write rpl_write |
@@ -1321,6 +1524,7 @@ _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); | |||
1321 | _GL_CXXALIASWARN (write); | 1524 | _GL_CXXALIASWARN (write); |
1322 | #endif | 1525 | #endif |
1323 | 1526 | ||
1527 | _GL_INLINE_HEADER_END | ||
1324 | 1528 | ||
1325 | #endif /* _GL_UNISTD_H */ | 1529 | #endif /* _@GUARD_PREFIX@_UNISTD_H */ |
1326 | #endif /* _GL_UNISTD_H */ | 1530 | #endif /* _@GUARD_PREFIX@_UNISTD_H */ |