summaryrefslogtreecommitdiffstats
path: root/gl/sys
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-08-25 16:23:54 (GMT)
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-09-14 09:08:55 (GMT)
commit5da988e07a96ff154db040befb5472f0dc784a17 (patch)
treea1fcbed4faf137b17ef57e1089c18cd7a0394890 /gl/sys
parent5a03f41d495bb3329596850c734d780c558d7a73 (diff)
downloadmonitoring-plugins-5da988e07a96ff154db040befb5472f0dc784a17.tar.gz
Add random files ...
Diffstat (limited to 'gl/sys')
-rw-r--r--gl/sys/socket.h1241
-rw-r--r--gl/sys/stat.h1461
-rw-r--r--gl/sys/types.h107
-rw-r--r--gl/sys/uio.h64
4 files changed, 2873 insertions, 0 deletions
diff --git a/gl/sys/socket.h b/gl/sys/socket.h
new file mode 100644
index 0000000..0519ccb
--- /dev/null
+++ b/gl/sys/socket.h
@@ -0,0 +1,1241 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Provide a sys/socket header file for systems lacking it (read: MinGW)
3 and for systems where it is incomplete.
4 Copyright (C) 2005-2022 Free Software Foundation, Inc.
5 Written by Simon Josefsson.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20/* This file is supposed to be used on platforms that lack <sys/socket.h>,
21 on platforms where <sys/socket.h> cannot be included standalone, and on
22 platforms where <sys/socket.h> does not provide all necessary definitions.
23 It is intended to provide definitions and prototypes needed by an
24 application. */
25
26#if __GNUC__ >= 3
27#pragma GCC system_header
28#endif
29
30
31#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
32/* Special invocation convention:
33 - On Cygwin 1.5.x we have a sequence of nested includes
34 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
35 and the latter includes <sys/socket.h>. In this situation, the functions
36 are not yet declared, therefore we cannot provide the C++ aliases. */
37
38#include_next <sys/socket.h>
39
40#else
41/* Normal invocation convention. */
42
43#ifndef _GL_SYS_SOCKET_H
44
45#if 1
46
47# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
48
49/* On many platforms, <sys/socket.h> assumes prior inclusion of
50 <sys/types.h>. */
51# include <sys/types.h>
52
53/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
54 is defined. */
55# include <stddef.h>
56
57/* The include_next requires a split double-inclusion guard. */
58# include_next <sys/socket.h>
59
60# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
61
62#endif
63
64#ifndef _GL_SYS_SOCKET_H
65#define _GL_SYS_SOCKET_H
66
67#ifndef _GL_INLINE_HEADER_BEGIN
68 #error "Please include config.h first."
69#endif
70_GL_INLINE_HEADER_BEGIN
71#ifndef _GL_SYS_SOCKET_INLINE
72# define _GL_SYS_SOCKET_INLINE _GL_INLINE
73#endif
74
75/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
76/* C++ compatible function declaration macros.
77 Copyright (C) 2010-2022 Free Software Foundation, Inc.
78
79 This program is free software: you can redistribute it and/or modify it
80 under the terms of the GNU Lesser General Public License as published
81 by the Free Software Foundation; either version 2 of the License, or
82 (at your option) any later version.
83
84 This program is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 Lesser General Public License for more details.
88
89 You should have received a copy of the GNU Lesser General Public License
90 along with this program. If not, see <https://www.gnu.org/licenses/>. */
91
92#ifndef _GL_CXXDEFS_H
93#define _GL_CXXDEFS_H
94
95/* Begin/end the GNULIB_NAMESPACE namespace. */
96#if defined __cplusplus && defined GNULIB_NAMESPACE
97# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
98# define _GL_END_NAMESPACE }
99#else
100# define _GL_BEGIN_NAMESPACE
101# define _GL_END_NAMESPACE
102#endif
103
104/* The three most frequent use cases of these macros are:
105
106 * For providing a substitute for a function that is missing on some
107 platforms, but is declared and works fine on the platforms on which
108 it exists:
109
110 #if @GNULIB_FOO@
111 # if !@HAVE_FOO@
112 _GL_FUNCDECL_SYS (foo, ...);
113 # endif
114 _GL_CXXALIAS_SYS (foo, ...);
115 _GL_CXXALIASWARN (foo);
116 #elif defined GNULIB_POSIXCHECK
117 ...
118 #endif
119
120 * For providing a replacement for a function that exists on all platforms,
121 but is broken/insufficient and needs to be replaced on some platforms:
122
123 #if @GNULIB_FOO@
124 # if @REPLACE_FOO@
125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126 # undef foo
127 # define foo rpl_foo
128 # endif
129 _GL_FUNCDECL_RPL (foo, ...);
130 _GL_CXXALIAS_RPL (foo, ...);
131 # else
132 _GL_CXXALIAS_SYS (foo, ...);
133 # endif
134 _GL_CXXALIASWARN (foo);
135 #elif defined GNULIB_POSIXCHECK
136 ...
137 #endif
138
139 * For providing a replacement for a function that exists on some platforms
140 but is broken/insufficient and needs to be replaced on some of them and
141 is additionally either missing or undeclared on some other platforms:
142
143 #if @GNULIB_FOO@
144 # if @REPLACE_FOO@
145 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
146 # undef foo
147 # define foo rpl_foo
148 # endif
149 _GL_FUNCDECL_RPL (foo, ...);
150 _GL_CXXALIAS_RPL (foo, ...);
151 # else
152 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
153 _GL_FUNCDECL_SYS (foo, ...);
154 # endif
155 _GL_CXXALIAS_SYS (foo, ...);
156 # endif
157 _GL_CXXALIASWARN (foo);
158 #elif defined GNULIB_POSIXCHECK
159 ...
160 #endif
161*/
162
163/* _GL_EXTERN_C declaration;
164 performs the declaration with C linkage. */
165#if defined __cplusplus
166# define _GL_EXTERN_C extern "C"
167#else
168# define _GL_EXTERN_C extern
169#endif
170
171/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
172 declares a replacement function, named rpl_func, with the given prototype,
173 consisting of return type, parameters, and attributes.
174 Example:
175 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
176 _GL_ARG_NONNULL ((1)));
177 */
178#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
179 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
180#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
181 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
182
183/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
184 declares the system function, named func, with the given prototype,
185 consisting of return type, parameters, and attributes.
186 Example:
187 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
188 _GL_ARG_NONNULL ((1)));
189 */
190#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
191 _GL_EXTERN_C rettype func parameters_and_attributes
192
193/* _GL_CXXALIAS_RPL (func, rettype, parameters);
194 declares a C++ alias called GNULIB_NAMESPACE::func
195 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
196 Example:
197 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
198
199 Wrapping rpl_func in an object with an inline conversion operator
200 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
201 actually used in the program. */
202#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
203 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
204#if defined __cplusplus && defined GNULIB_NAMESPACE
205# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
206 namespace GNULIB_NAMESPACE \
207 { \
208 static const struct _gl_ ## func ## _wrapper \
209 { \
210 typedef rettype (*type) parameters; \
211 \
212 inline operator type () const \
213 { \
214 return ::rpl_func; \
215 } \
216 } func = {}; \
217 } \
218 _GL_EXTERN_C int _gl_cxxalias_dummy
219#else
220# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
221 _GL_EXTERN_C int _gl_cxxalias_dummy
222#endif
223
224/* _GL_CXXALIAS_MDA (func, rettype, parameters);
225 is to be used when func is a Microsoft deprecated alias, on native Windows.
226 It declares a C++ alias called GNULIB_NAMESPACE::func
227 that redirects to _func, if GNULIB_NAMESPACE is defined.
228 Example:
229 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
230 */
231#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
232 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
233
234/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
235 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
236 except that the C function rpl_func may have a slightly different
237 declaration. A cast is used to silence the "invalid conversion" error
238 that would otherwise occur. */
239#if defined __cplusplus && defined GNULIB_NAMESPACE
240# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
241 namespace GNULIB_NAMESPACE \
242 { \
243 static const struct _gl_ ## func ## _wrapper \
244 { \
245 typedef rettype (*type) parameters; \
246 \
247 inline operator type () const \
248 { \
249 return reinterpret_cast<type>(::rpl_func); \
250 } \
251 } func = {}; \
252 } \
253 _GL_EXTERN_C int _gl_cxxalias_dummy
254#else
255# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
256 _GL_EXTERN_C int _gl_cxxalias_dummy
257#endif
258
259/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
260 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
261 except that the C function func may have a slightly different declaration.
262 A cast is used to silence the "invalid conversion" error that would
263 otherwise occur. */
264#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
265 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
266
267/* _GL_CXXALIAS_SYS (func, rettype, parameters);
268 declares a C++ alias called GNULIB_NAMESPACE::func
269 that redirects to the system provided function func, if GNULIB_NAMESPACE
270 is defined.
271 Example:
272 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
273
274 Wrapping func in an object with an inline conversion operator
275 avoids a reference to func unless GNULIB_NAMESPACE::func is
276 actually used in the program. */
277#if defined __cplusplus && defined GNULIB_NAMESPACE
278# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
279 namespace GNULIB_NAMESPACE \
280 { \
281 static const struct _gl_ ## func ## _wrapper \
282 { \
283 typedef rettype (*type) parameters; \
284 \
285 inline operator type () const \
286 { \
287 return ::func; \
288 } \
289 } func = {}; \
290 } \
291 _GL_EXTERN_C int _gl_cxxalias_dummy
292#else
293# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
294 _GL_EXTERN_C int _gl_cxxalias_dummy
295#endif
296
297/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
298 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
299 except that the C function func may have a slightly different declaration.
300 A cast is used to silence the "invalid conversion" error that would
301 otherwise occur. */
302#if defined __cplusplus && defined GNULIB_NAMESPACE
303# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
304 namespace GNULIB_NAMESPACE \
305 { \
306 static const struct _gl_ ## func ## _wrapper \
307 { \
308 typedef rettype (*type) parameters; \
309 \
310 inline operator type () const \
311 { \
312 return reinterpret_cast<type>(::func); \
313 } \
314 } func = {}; \
315 } \
316 _GL_EXTERN_C int _gl_cxxalias_dummy
317#else
318# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
319 _GL_EXTERN_C int _gl_cxxalias_dummy
320#endif
321
322/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
323 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
324 except that the C function is picked among a set of overloaded functions,
325 namely the one with rettype2 and parameters2. Two consecutive casts
326 are used to silence the "cannot find a match" and "invalid conversion"
327 errors that would otherwise occur. */
328#if defined __cplusplus && defined GNULIB_NAMESPACE
329 /* The outer cast must be a reinterpret_cast.
330 The inner cast: When the function is defined as a set of overloaded
331 functions, it works as a static_cast<>, choosing the designated variant.
332 When the function is defined as a single variant, it works as a
333 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
334# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
335 namespace GNULIB_NAMESPACE \
336 { \
337 static const struct _gl_ ## func ## _wrapper \
338 { \
339 typedef rettype (*type) parameters; \
340 \
341 inline operator type () const \
342 { \
343 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
344 } \
345 } func = {}; \
346 } \
347 _GL_EXTERN_C int _gl_cxxalias_dummy
348#else
349# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
350 _GL_EXTERN_C int _gl_cxxalias_dummy
351#endif
352
353/* _GL_CXXALIASWARN (func);
354 causes a warning to be emitted when ::func is used but not when
355 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
356 variants. */
357#if defined __cplusplus && defined GNULIB_NAMESPACE
358# define _GL_CXXALIASWARN(func) \
359 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
360# define _GL_CXXALIASWARN_1(func,namespace) \
361 _GL_CXXALIASWARN_2 (func, namespace)
362/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
363 we enable the warning only when not optimizing. */
364# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
365# define _GL_CXXALIASWARN_2(func,namespace) \
366 _GL_WARN_ON_USE (func, \
367 "The symbol ::" #func " refers to the system function. " \
368 "Use " #namespace "::" #func " instead.")
369# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
370# define _GL_CXXALIASWARN_2(func,namespace) \
371 extern __typeof__ (func) func
372# else
373# define _GL_CXXALIASWARN_2(func,namespace) \
374 _GL_EXTERN_C int _gl_cxxalias_dummy
375# endif
376#else
377# define _GL_CXXALIASWARN(func) \
378 _GL_EXTERN_C int _gl_cxxalias_dummy
379#endif
380
381/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
382 causes a warning to be emitted when the given overloaded variant of ::func
383 is used but not when GNULIB_NAMESPACE::func is used. */
384#if defined __cplusplus && defined GNULIB_NAMESPACE
385# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
386 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
387 GNULIB_NAMESPACE)
388# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
389 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
390/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
391 we enable the warning only when not optimizing. */
392# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
393# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
394 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
395 "The symbol ::" #func " refers to the system function. " \
396 "Use " #namespace "::" #func " instead.")
397# else
398# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
399 _GL_EXTERN_C int _gl_cxxalias_dummy
400# endif
401#else
402# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
403 _GL_EXTERN_C int _gl_cxxalias_dummy
404#endif
405
406#endif /* _GL_CXXDEFS_H */
407
408/* The definition of _GL_ARG_NONNULL is copied here. */
409/* A C macro for declaring that specific arguments must not be NULL.
410 Copyright (C) 2009-2022 Free Software Foundation, Inc.
411
412 This program is free software: you can redistribute it and/or modify it
413 under the terms of the GNU Lesser General Public License as published
414 by the Free Software Foundation; either version 2 of the License, or
415 (at your option) any later version.
416
417 This program is distributed in the hope that it will be useful,
418 but WITHOUT ANY WARRANTY; without even the implied warranty of
419 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
420 Lesser General Public License for more details.
421
422 You should have received a copy of the GNU Lesser General Public License
423 along with this program. If not, see <https://www.gnu.org/licenses/>. */
424
425/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
426 that the values passed as arguments n, ..., m must be non-NULL pointers.
427 n = 1 stands for the first argument, n = 2 for the second argument etc. */
428#ifndef _GL_ARG_NONNULL
429# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
430# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
431# else
432# define _GL_ARG_NONNULL(params)
433# endif
434#endif
435
436/* The definition of _GL_WARN_ON_USE is copied here. */
437/* A C macro for emitting warnings if a function is used.
438 Copyright (C) 2010-2022 Free Software Foundation, Inc.
439
440 This program is free software: you can redistribute it and/or modify it
441 under the terms of the GNU Lesser General Public License as published
442 by the Free Software Foundation; either version 2 of the License, or
443 (at your option) any later version.
444
445 This program is distributed in the hope that it will be useful,
446 but WITHOUT ANY WARRANTY; without even the implied warranty of
447 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
448 Lesser General Public License for more details.
449
450 You should have received a copy of the GNU Lesser General Public License
451 along with this program. If not, see <https://www.gnu.org/licenses/>. */
452
453/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
454 for FUNCTION which will then trigger a compiler warning containing
455 the text of "literal string" anywhere that function is called, if
456 supported by the compiler. If the compiler does not support this
457 feature, the macro expands to an unused extern declaration.
458
459 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
460 attribute used in _GL_WARN_ON_USE. If the compiler does not support
461 this feature, it expands to empty.
462
463 These macros are useful for marking a function as a potential
464 portability trap, with the intent that "literal string" include
465 instructions on the replacement function that should be used
466 instead.
467 _GL_WARN_ON_USE is for functions with 'extern' linkage.
468 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
469 linkage.
470
471 However, one of the reasons that a function is a portability trap is
472 if it has the wrong signature. Declaring FUNCTION with a different
473 signature in C is a compilation error, so this macro must use the
474 same type as any existing declaration so that programs that avoid
475 the problematic FUNCTION do not fail to compile merely because they
476 included a header that poisoned the function. But this implies that
477 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
478 have a declaration. Use of this macro implies that there must not
479 be any other macro hiding the declaration of FUNCTION; but
480 undefining FUNCTION first is part of the poisoning process anyway
481 (although for symbols that are provided only via a macro, the result
482 is a compilation error rather than a warning containing
483 "literal string"). Also note that in C++, it is only safe to use if
484 FUNCTION has no overloads.
485
486 For an example, it is possible to poison 'getline' by:
487 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
488 [getline]) in configure.ac, which potentially defines
489 HAVE_RAW_DECL_GETLINE
490 - adding this code to a header that wraps the system <stdio.h>:
491 #undef getline
492 #if HAVE_RAW_DECL_GETLINE
493 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
494 "not universally present; use the gnulib module getline");
495 #endif
496
497 It is not possible to directly poison global variables. But it is
498 possible to write a wrapper accessor function, and poison that
499 (less common usage, like &environ, will cause a compilation error
500 rather than issue the nice warning, but the end result of informing
501 the developer about their portability problem is still achieved):
502 #if HAVE_RAW_DECL_ENVIRON
503 static char ***
504 rpl_environ (void) { return &environ; }
505 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
506 # undef environ
507 # define environ (*rpl_environ ())
508 #endif
509 or better (avoiding contradictory use of 'static' and 'extern'):
510 #if HAVE_RAW_DECL_ENVIRON
511 static char ***
512 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
513 rpl_environ (void) { return &environ; }
514 # undef environ
515 # define environ (*rpl_environ ())
516 #endif
517 */
518#ifndef _GL_WARN_ON_USE
519
520# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
521/* A compiler attribute is available in gcc versions 4.3.0 and later. */
522# define _GL_WARN_ON_USE(function, message) \
523_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
524# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
525 __attribute__ ((__warning__ (message)))
526# elif __clang_major__ >= 4
527/* Another compiler attribute is available in clang. */
528# define _GL_WARN_ON_USE(function, message) \
529_GL_WARN_EXTERN_C __typeof__ (function) function \
530 __attribute__ ((__diagnose_if__ (1, message, "warning")))
531# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
532 __attribute__ ((__diagnose_if__ (1, message, "warning")))
533# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
534/* Verify the existence of the function. */
535# define _GL_WARN_ON_USE(function, message) \
536_GL_WARN_EXTERN_C __typeof__ (function) function
537# define _GL_WARN_ON_USE_ATTRIBUTE(message)
538# else /* Unsupported. */
539# define _GL_WARN_ON_USE(function, message) \
540_GL_WARN_EXTERN_C int _gl_warn_on_use
541# define _GL_WARN_ON_USE_ATTRIBUTE(message)
542# endif
543#endif
544
545/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
546 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
547 function is declared with the given prototype, consisting of return type,
548 parameters, and attributes.
549 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
550 not work in this case. */
551#ifndef _GL_WARN_ON_USE_CXX
552# if !defined __cplusplus
553# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
554 _GL_WARN_ON_USE (function, msg)
555# else
556# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
557/* A compiler attribute is available in gcc versions 4.3.0 and later. */
558# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
559extern rettype_gcc function parameters_and_attributes \
560 __attribute__ ((__warning__ (msg)))
561# elif __clang_major__ >= 4
562/* Another compiler attribute is available in clang. */
563# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
564extern rettype_clang function parameters_and_attributes \
565 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
566# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
567/* Verify the existence of the function. */
568# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
569extern rettype_gcc function parameters_and_attributes
570# else /* Unsupported. */
571# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
572_GL_WARN_EXTERN_C int _gl_warn_on_use
573# endif
574# endif
575#endif
576
577/* _GL_WARN_EXTERN_C declaration;
578 performs the declaration with C linkage. */
579#ifndef _GL_WARN_EXTERN_C
580# if defined __cplusplus
581# define _GL_WARN_EXTERN_C extern "C"
582# else
583# define _GL_WARN_EXTERN_C extern
584# endif
585#endif
586
587#if !1
588# if !GNULIB_defined_sa_family_t
589/* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
590# if !defined __KLIBC__ || defined TCPV40HDRS
591typedef unsigned short sa_family_t;
592# else
593typedef unsigned char sa_family_t;
594# endif
595# define GNULIB_defined_sa_family_t 1
596# endif
597#endif
598
599#if 1
600/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */
601# if !1
602# ifndef ss_family
603# define ss_family __ss_family
604# endif
605# endif
606#else
607# include <stdalign.h>
608/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
609 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
610# define __ss_aligntype unsigned long int
611# define _SS_SIZE 256
612# define _SS_PADSIZE \
613 (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \
614 ? sizeof (sa_family_t) \
615 : alignof (__ss_aligntype)) \
616 + sizeof (__ss_aligntype)))
617
618# if !GNULIB_defined_struct_sockaddr_storage
619struct sockaddr_storage
620{
621 sa_family_t ss_family; /* Address family, etc. */
622 __ss_aligntype __ss_align; /* Force desired alignment. */
623 char __ss_padding[_SS_PADSIZE];
624};
625# define GNULIB_defined_struct_sockaddr_storage 1
626# endif
627
628#endif
629
630/* Get struct iovec. */
631/* But avoid namespace pollution on glibc systems. */
632#if ! defined __GLIBC__
633# include <sys/uio.h>
634#endif
635
636#if 1
637
638/* A platform that has <sys/socket.h>. */
639
640/* For shutdown(). */
641# if !defined SHUT_RD
642# define SHUT_RD 0
643# endif
644# if !defined SHUT_WR
645# define SHUT_WR 1
646# endif
647# if !defined SHUT_RDWR
648# define SHUT_RDWR 2
649# endif
650
651# ifdef __VMS /* OpenVMS */
652# ifndef CMSG_SPACE
653# define CMSG_SPACE(length) _CMSG_SPACE(length)
654# endif
655# ifndef CMSG_LEN
656# define CMSG_LEN(length) _CMSG_LEN(length)
657# endif
658# endif
659
660#else
661
662# ifdef __CYGWIN__
663# error "Cygwin does have a sys/socket.h, doesn't it?!?"
664# endif
665
666/* A platform that lacks <sys/socket.h>.
667
668 Currently only MinGW is supported. See the gnulib manual regarding
669 Windows sockets. MinGW has the header files winsock2.h and
670 ws2tcpip.h that declare the sys/socket.h definitions we need. Note
671 that you can influence which definitions you get by setting the
672 WINVER symbol before including these two files. For example,
673 getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
674 symbol is set indirectly through WINVER). You can set this by
675 adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
676 code may not run on older Windows releases then. My Windows 2000
677 box was not able to run the code, for example. The situation is
678 slightly confusing because
679 <https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
680 suggests that getaddrinfo should be available on all Windows
681 releases. */
682
683# if 0
684# include <winsock2.h>
685# endif
686# if 0
687# include <ws2tcpip.h>
688# endif
689
690/* For shutdown(). */
691# if !defined SHUT_RD && defined SD_RECEIVE
692# define SHUT_RD SD_RECEIVE
693# endif
694# if !defined SHUT_WR && defined SD_SEND
695# define SHUT_WR SD_SEND
696# endif
697# if !defined SHUT_RDWR && defined SD_BOTH
698# define SHUT_RDWR SD_BOTH
699# endif
700
701# if 0
702/* Include headers needed by the emulation code. */
703# include <sys/types.h>
704# include <io.h>
705/* If these headers don't define socklen_t, <config.h> does. */
706# endif
707
708/* Rudimentary 'struct msghdr'; this works as long as you don't try to
709 access msg_control or msg_controllen. */
710struct msghdr {
711 void *msg_name;
712 socklen_t msg_namelen;
713 struct iovec *msg_iov;
714 int msg_iovlen;
715 int msg_flags;
716};
717
718#endif
719
720/* Ensure SO_REUSEPORT is defined. */
721/* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see
722 https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
723 and https://lwn.net/Articles/542629/
724 */
725#ifndef SO_REUSEPORT
726# define SO_REUSEPORT SO_REUSEADDR
727#endif
728
729/* Fix some definitions from <winsock2.h>. */
730
731#if 0
732
733# if !GNULIB_defined_rpl_fd_isset
734
735/* Re-define FD_ISSET to avoid a WSA call while we are not using
736 network sockets. */
737_GL_SYS_SOCKET_INLINE int
738rpl_fd_isset (SOCKET fd, fd_set * set)
739{
740 u_int i;
741 if (set == NULL)
742 return 0;
743
744 for (i = 0; i < set->fd_count; i++)
745 if (set->fd_array[i] == fd)
746 return 1;
747
748 return 0;
749}
750
751# define GNULIB_defined_rpl_fd_isset 1
752# endif
753
754# undef FD_ISSET
755# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
756
757#endif
758
759/* Hide some function declarations from <winsock2.h>. */
760
761#if 0
762# if !defined _GL_UNISTD_H
763# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
764# undef close
765# define close close_used_without_including_unistd_h
766# elif !defined __clang__
767 _GL_WARN_ON_USE (close,
768 "close() used without including <unistd.h>");
769# endif
770# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
771# undef gethostname
772# define gethostname gethostname_used_without_including_unistd_h
773# else
774 _GL_WARN_ON_USE (gethostname,
775 "gethostname() used without including <unistd.h>");
776# endif
777# endif
778# if !defined _GL_SYS_SELECT_H
779# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780# undef select
781# define select select_used_without_including_sys_select_h
782# else
783 _GL_WARN_ON_USE (select,
784 "select() used without including <sys/select.h>");
785# endif
786# endif
787#endif
788
789/* Wrap everything else to use libc file descriptors for sockets. */
790
791#if 0
792# if 0
793# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
794# undef socket
795# define socket rpl_socket
796# endif
797_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
798_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
799# else
800_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
801# endif
802_GL_CXXALIASWARN (socket);
803#elif 0
804# undef socket
805# define socket socket_used_without_requesting_gnulib_module_socket
806#elif defined GNULIB_POSIXCHECK
807# undef socket
808# if HAVE_RAW_DECL_SOCKET
809_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
810 "use gnulib module socket for portability");
811# endif
812#endif
813
814#if 0
815# if 0
816# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
817# undef connect
818# define connect rpl_connect
819# endif
820_GL_FUNCDECL_RPL (connect, int,
821 (int fd, const struct sockaddr *addr, socklen_t addrlen)
822 _GL_ARG_NONNULL ((2)));
823_GL_CXXALIAS_RPL (connect, int,
824 (int fd, const struct sockaddr *addr, socklen_t addrlen));
825# else
826/* Need to cast, because on NonStop Kernel, the third parameter is
827 size_t addrlen. */
828_GL_CXXALIAS_SYS_CAST (connect, int,
829 (int fd,
830 const struct sockaddr *addr, socklen_t addrlen));
831# endif
832_GL_CXXALIASWARN (connect);
833#elif 0
834# undef connect
835# define connect socket_used_without_requesting_gnulib_module_connect
836#elif defined GNULIB_POSIXCHECK
837# undef connect
838# if HAVE_RAW_DECL_CONNECT
839_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
840 "use gnulib module connect for portability");
841# endif
842#endif
843
844#if 0
845# if 0
846# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
847# undef accept
848# define accept rpl_accept
849# endif
850_GL_FUNCDECL_RPL (accept, int,
851 (int fd,
852 struct sockaddr *restrict addr,
853 socklen_t *restrict addrlen));
854_GL_CXXALIAS_RPL (accept, int,
855 (int fd,
856 struct sockaddr *restrict addr,
857 socklen_t *restrict addrlen));
858# else
859/* Need to cast, because on Solaris 10 systems, the third parameter is
860 void *addrlen. */
861_GL_CXXALIAS_SYS_CAST (accept, int,
862 (int fd,
863 struct sockaddr *restrict addr,
864 socklen_t *restrict addrlen));
865# endif
866_GL_CXXALIASWARN (accept);
867#elif 0
868# undef accept
869# define accept accept_used_without_requesting_gnulib_module_accept
870#elif defined GNULIB_POSIXCHECK
871# undef accept
872# if HAVE_RAW_DECL_ACCEPT
873_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
874 "use gnulib module accept for portability");
875# endif
876#endif
877
878#if 0
879# if 0
880# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
881# undef bind
882# define bind rpl_bind
883# endif
884_GL_FUNCDECL_RPL (bind, int,
885 (int fd, const struct sockaddr *addr, socklen_t addrlen)
886 _GL_ARG_NONNULL ((2)));
887_GL_CXXALIAS_RPL (bind, int,
888 (int fd, const struct sockaddr *addr, socklen_t addrlen));
889# else
890/* Need to cast, because on NonStop Kernel, the third parameter is
891 size_t addrlen. */
892_GL_CXXALIAS_SYS_CAST (bind, int,
893 (int fd,
894 const struct sockaddr *addr, socklen_t addrlen));
895# endif
896_GL_CXXALIASWARN (bind);
897#elif 0
898# undef bind
899# define bind bind_used_without_requesting_gnulib_module_bind
900#elif defined GNULIB_POSIXCHECK
901# undef bind
902# if HAVE_RAW_DECL_BIND
903_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
904 "use gnulib module bind for portability");
905# endif
906#endif
907
908#if 0
909# if 0
910# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
911# undef getpeername
912# define getpeername rpl_getpeername
913# endif
914_GL_FUNCDECL_RPL (getpeername, int,
915 (int fd, struct sockaddr *restrict addr,
916 socklen_t *restrict addrlen)
917 _GL_ARG_NONNULL ((2, 3)));
918_GL_CXXALIAS_RPL (getpeername, int,
919 (int fd, struct sockaddr *restrict addr,
920 socklen_t *restrict addrlen));
921# else
922/* Need to cast, because on Solaris 10 systems, the third parameter is
923 void *addrlen. */
924_GL_CXXALIAS_SYS_CAST (getpeername, int,
925 (int fd, struct sockaddr *restrict addr,
926 socklen_t *restrict addrlen));
927# endif
928_GL_CXXALIASWARN (getpeername);
929#elif 0
930# undef getpeername
931# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
932#elif defined GNULIB_POSIXCHECK
933# undef getpeername
934# if HAVE_RAW_DECL_GETPEERNAME
935_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
936 "use gnulib module getpeername for portability");
937# endif
938#endif
939
940#if 0
941# if 0
942# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
943# undef getsockname
944# define getsockname rpl_getsockname
945# endif
946_GL_FUNCDECL_RPL (getsockname, int,
947 (int fd, struct sockaddr *restrict addr,
948 socklen_t *restrict addrlen)
949 _GL_ARG_NONNULL ((2, 3)));
950_GL_CXXALIAS_RPL (getsockname, int,
951 (int fd, struct sockaddr *restrict addr,
952 socklen_t *restrict addrlen));
953# else
954/* Need to cast, because on Solaris 10 systems, the third parameter is
955 void *addrlen. */
956_GL_CXXALIAS_SYS_CAST (getsockname, int,
957 (int fd, struct sockaddr *restrict addr,
958 socklen_t *restrict addrlen));
959# endif
960_GL_CXXALIASWARN (getsockname);
961#elif 0
962# undef getsockname
963# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
964#elif defined GNULIB_POSIXCHECK
965# undef getsockname
966# if HAVE_RAW_DECL_GETSOCKNAME
967_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
968 "use gnulib module getsockname for portability");
969# endif
970#endif
971
972#if 0
973# if 0
974# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
975# undef getsockopt
976# define getsockopt rpl_getsockopt
977# endif
978_GL_FUNCDECL_RPL (getsockopt, int,
979 (int fd, int level, int optname,
980 void *restrict optval, socklen_t *restrict optlen)
981 _GL_ARG_NONNULL ((4, 5)));
982_GL_CXXALIAS_RPL (getsockopt, int,
983 (int fd, int level, int optname,
984 void *restrict optval, socklen_t *restrict optlen));
985# else
986/* Need to cast, because on Solaris 10 systems, the fifth parameter is
987 void *optlen. */
988_GL_CXXALIAS_SYS_CAST (getsockopt, int,
989 (int fd, int level, int optname,
990 void *restrict optval, socklen_t *restrict optlen));
991# endif
992_GL_CXXALIASWARN (getsockopt);
993#elif 0
994# undef getsockopt
995# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
996#elif defined GNULIB_POSIXCHECK
997# undef getsockopt
998# if HAVE_RAW_DECL_GETSOCKOPT
999_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
1000 "use gnulib module getsockopt for portability");
1001# endif
1002#endif
1003
1004#if 0
1005# if 0
1006# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# undef listen
1008# define listen rpl_listen
1009# endif
1010_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
1011_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
1012# else
1013_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
1014# endif
1015_GL_CXXALIASWARN (listen);
1016#elif 0
1017# undef listen
1018# define listen listen_used_without_requesting_gnulib_module_listen
1019#elif defined GNULIB_POSIXCHECK
1020# undef listen
1021# if HAVE_RAW_DECL_LISTEN
1022_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
1023 "use gnulib module listen for portability");
1024# endif
1025#endif
1026
1027#if 0
1028# if 0
1029# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1030# undef recv
1031# define recv rpl_recv
1032# endif
1033_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
1034 _GL_ARG_NONNULL ((2)));
1035_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
1036# else
1037/* Need to cast, because on HP-UX 11.31 the return type may be
1038 int,
1039 depending on compiler options. */
1040_GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
1041# endif
1042_GL_CXXALIASWARN (recv);
1043#elif 0
1044# undef recv
1045# define recv recv_used_without_requesting_gnulib_module_recv
1046#elif defined GNULIB_POSIXCHECK
1047# undef recv
1048# if HAVE_RAW_DECL_RECV
1049_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
1050 "use gnulib module recv for portability");
1051# endif
1052#endif
1053
1054#if 0
1055# if 0
1056# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1057# undef send
1058# define send rpl_send
1059# endif
1060_GL_FUNCDECL_RPL (send, ssize_t,
1061 (int fd, const void *buf, size_t len, int flags)
1062 _GL_ARG_NONNULL ((2)));
1063_GL_CXXALIAS_RPL (send, ssize_t,
1064 (int fd, const void *buf, size_t len, int flags));
1065# else
1066/* Need to cast, because on HP-UX 11.31 the return type may be
1067 int,
1068 depending on compiler options. */
1069_GL_CXXALIAS_SYS_CAST (send, ssize_t,
1070 (int fd, const void *buf, size_t len, int flags));
1071# endif
1072_GL_CXXALIASWARN (send);
1073#elif 0
1074# undef send
1075# define send send_used_without_requesting_gnulib_module_send
1076#elif defined GNULIB_POSIXCHECK
1077# undef send
1078# if HAVE_RAW_DECL_SEND
1079_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
1080 "use gnulib module send for portability");
1081# endif
1082#endif
1083
1084#if 0
1085# if 0
1086# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1087# undef recvfrom
1088# define recvfrom rpl_recvfrom
1089# endif
1090_GL_FUNCDECL_RPL (recvfrom, ssize_t,
1091 (int fd, void *restrict buf, size_t len, int flags,
1092 struct sockaddr *restrict from,
1093 socklen_t *restrict fromlen)
1094 _GL_ARG_NONNULL ((2)));
1095_GL_CXXALIAS_RPL (recvfrom, ssize_t,
1096 (int fd, void *restrict buf, size_t len, int flags,
1097 struct sockaddr *restrict from,
1098 socklen_t *restrict fromlen));
1099# else
1100/* Need to cast, because on Solaris 10 systems, the sixth parameter is
1101 void *fromlen. */
1102_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
1103 (int fd, void *restrict buf, size_t len, int flags,
1104 struct sockaddr *restrict from,
1105 socklen_t *restrict fromlen));
1106# endif
1107_GL_CXXALIASWARN (recvfrom);
1108#elif 0
1109# undef recvfrom
1110# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
1111#elif defined GNULIB_POSIXCHECK
1112# undef recvfrom
1113# if HAVE_RAW_DECL_RECVFROM
1114_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
1115 "use gnulib module recvfrom for portability");
1116# endif
1117#endif
1118
1119#if 0
1120# if 0
1121# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1122# undef sendto
1123# define sendto rpl_sendto
1124# endif
1125_GL_FUNCDECL_RPL (sendto, ssize_t,
1126 (int fd, const void *buf, size_t len, int flags,
1127 const struct sockaddr *to, socklen_t tolen)
1128 _GL_ARG_NONNULL ((2)));
1129_GL_CXXALIAS_RPL (sendto, ssize_t,
1130 (int fd, const void *buf, size_t len, int flags,
1131 const struct sockaddr *to, socklen_t tolen));
1132# else
1133/* Need to cast, because on NonStop Kernel, the sixth parameter is
1134 size_t tolen. */
1135_GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
1136 (int fd, const void *buf, size_t len, int flags,
1137 const struct sockaddr *to, socklen_t tolen));
1138# endif
1139_GL_CXXALIASWARN (sendto);
1140#elif 0
1141# undef sendto
1142# define sendto sendto_used_without_requesting_gnulib_module_sendto
1143#elif defined GNULIB_POSIXCHECK
1144# undef sendto
1145# if HAVE_RAW_DECL_SENDTO
1146_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
1147 "use gnulib module sendto for portability");
1148# endif
1149#endif
1150
1151#if 0
1152# if 0
1153# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1154# undef setsockopt
1155# define setsockopt rpl_setsockopt
1156# endif
1157_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
1158 const void * optval, socklen_t optlen)
1159 _GL_ARG_NONNULL ((4)));
1160_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
1161 const void * optval, socklen_t optlen));
1162# else
1163/* Need to cast, because on NonStop Kernel, the fifth parameter is
1164 size_t optlen. */
1165_GL_CXXALIAS_SYS_CAST (setsockopt, int,
1166 (int fd, int level, int optname,
1167 const void * optval, socklen_t optlen));
1168# endif
1169_GL_CXXALIASWARN (setsockopt);
1170#elif 0
1171# undef setsockopt
1172# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
1173#elif defined GNULIB_POSIXCHECK
1174# undef setsockopt
1175# if HAVE_RAW_DECL_SETSOCKOPT
1176_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
1177 "use gnulib module setsockopt for portability");
1178# endif
1179#endif
1180
1181#if 0
1182# if 0
1183# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1184# undef shutdown
1185# define shutdown rpl_shutdown
1186# endif
1187_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
1188_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
1189# else
1190_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
1191# endif
1192_GL_CXXALIASWARN (shutdown);
1193#elif 0
1194# undef shutdown
1195# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
1196#elif defined GNULIB_POSIXCHECK
1197# undef shutdown
1198# if HAVE_RAW_DECL_SHUTDOWN
1199_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
1200 "use gnulib module shutdown for portability");
1201# endif
1202#endif
1203
1204#if 0
1205/* Accept a connection on a socket, with specific opening flags.
1206 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1207 and O_TEXT, O_BINARY (defined in "binary-io.h").
1208 See also the Linux man page at
1209 <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
1210# if 1
1211# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1212# define accept4 rpl_accept4
1213# endif
1214_GL_FUNCDECL_RPL (accept4, int,
1215 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1216 int flags));
1217_GL_CXXALIAS_RPL (accept4, int,
1218 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1219 int flags));
1220# else
1221_GL_FUNCDECL_SYS (accept4, int,
1222 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1223 int flags));
1224_GL_CXXALIAS_SYS (accept4, int,
1225 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1226 int flags));
1227# endif
1228_GL_CXXALIASWARN (accept4);
1229#elif defined GNULIB_POSIXCHECK
1230# undef accept4
1231# if HAVE_RAW_DECL_ACCEPT4
1232_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
1233 "use gnulib module accept4 for portability");
1234# endif
1235#endif
1236
1237_GL_INLINE_HEADER_END
1238
1239#endif /* _GL_SYS_SOCKET_H */
1240#endif /* _GL_SYS_SOCKET_H */
1241#endif
diff --git a/gl/sys/stat.h b/gl/sys/stat.h
new file mode 100644
index 0000000..8120383
--- /dev/null
+++ b/gl/sys/stat.h
@@ -0,0 +1,1461 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Provide a more complete sys/stat.h header file.
3 Copyright (C) 2005-2022 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
19
20/* This file is supposed to be used on platforms where <sys/stat.h> is
21 incomplete. It is intended to provide definitions and prototypes
22 needed by an application. Start with what the system provides. */
23
24#if __GNUC__ >= 3
25#pragma GCC system_header
26#endif
27
28
29#if defined __need_system_sys_stat_h
30/* Special invocation convention. */
31
32#include_next <sys/stat.h>
33
34#else
35/* Normal invocation convention. */
36
37#ifndef _GL_SYS_STAT_H
38
39/* Get nlink_t.
40 May also define off_t to a 64-bit type on native Windows. */
41#include <sys/types.h>
42
43/* Get struct timespec. */
44#include <time.h>
45
46/* The include_next requires a split double-inclusion guard. */
47#include_next <sys/stat.h>
48
49#ifndef _GL_SYS_STAT_H
50#define _GL_SYS_STAT_H
51
52/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
53/* C++ compatible function declaration macros.
54 Copyright (C) 2010-2022 Free Software Foundation, Inc.
55
56 This program is free software: you can redistribute it and/or modify it
57 under the terms of the GNU Lesser General Public License as published
58 by the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60
61 This program is distributed in the hope that it will be useful,
62 but WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64 Lesser General Public License for more details.
65
66 You should have received a copy of the GNU Lesser General Public License
67 along with this program. If not, see <https://www.gnu.org/licenses/>. */
68
69#ifndef _GL_CXXDEFS_H
70#define _GL_CXXDEFS_H
71
72/* Begin/end the GNULIB_NAMESPACE namespace. */
73#if defined __cplusplus && defined GNULIB_NAMESPACE
74# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
75# define _GL_END_NAMESPACE }
76#else
77# define _GL_BEGIN_NAMESPACE
78# define _GL_END_NAMESPACE
79#endif
80
81/* The three most frequent use cases of these macros are:
82
83 * For providing a substitute for a function that is missing on some
84 platforms, but is declared and works fine on the platforms on which
85 it exists:
86
87 #if @GNULIB_FOO@
88 # if !@HAVE_FOO@
89 _GL_FUNCDECL_SYS (foo, ...);
90 # endif
91 _GL_CXXALIAS_SYS (foo, ...);
92 _GL_CXXALIASWARN (foo);
93 #elif defined GNULIB_POSIXCHECK
94 ...
95 #endif
96
97 * For providing a replacement for a function that exists on all platforms,
98 but is broken/insufficient and needs to be replaced on some platforms:
99
100 #if @GNULIB_FOO@
101 # if @REPLACE_FOO@
102 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 # undef foo
104 # define foo rpl_foo
105 # endif
106 _GL_FUNCDECL_RPL (foo, ...);
107 _GL_CXXALIAS_RPL (foo, ...);
108 # else
109 _GL_CXXALIAS_SYS (foo, ...);
110 # endif
111 _GL_CXXALIASWARN (foo);
112 #elif defined GNULIB_POSIXCHECK
113 ...
114 #endif
115
116 * For providing a replacement for a function that exists on some platforms
117 but is broken/insufficient and needs to be replaced on some of them and
118 is additionally either missing or undeclared on some other platforms:
119
120 #if @GNULIB_FOO@
121 # if @REPLACE_FOO@
122 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123 # undef foo
124 # define foo rpl_foo
125 # endif
126 _GL_FUNCDECL_RPL (foo, ...);
127 _GL_CXXALIAS_RPL (foo, ...);
128 # else
129 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
130 _GL_FUNCDECL_SYS (foo, ...);
131 # endif
132 _GL_CXXALIAS_SYS (foo, ...);
133 # endif
134 _GL_CXXALIASWARN (foo);
135 #elif defined GNULIB_POSIXCHECK
136 ...
137 #endif
138*/
139
140/* _GL_EXTERN_C declaration;
141 performs the declaration with C linkage. */
142#if defined __cplusplus
143# define _GL_EXTERN_C extern "C"
144#else
145# define _GL_EXTERN_C extern
146#endif
147
148/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
149 declares a replacement function, named rpl_func, with the given prototype,
150 consisting of return type, parameters, and attributes.
151 Example:
152 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
153 _GL_ARG_NONNULL ((1)));
154 */
155#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
156 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
157#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
158 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
159
160/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
161 declares the system function, named func, with the given prototype,
162 consisting of return type, parameters, and attributes.
163 Example:
164 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
165 _GL_ARG_NONNULL ((1)));
166 */
167#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
168 _GL_EXTERN_C rettype func parameters_and_attributes
169
170/* _GL_CXXALIAS_RPL (func, rettype, parameters);
171 declares a C++ alias called GNULIB_NAMESPACE::func
172 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
173 Example:
174 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175
176 Wrapping rpl_func in an object with an inline conversion operator
177 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
178 actually used in the program. */
179#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
180 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
181#if defined __cplusplus && defined GNULIB_NAMESPACE
182# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
183 namespace GNULIB_NAMESPACE \
184 { \
185 static const struct _gl_ ## func ## _wrapper \
186 { \
187 typedef rettype (*type) parameters; \
188 \
189 inline operator type () const \
190 { \
191 return ::rpl_func; \
192 } \
193 } func = {}; \
194 } \
195 _GL_EXTERN_C int _gl_cxxalias_dummy
196#else
197# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198 _GL_EXTERN_C int _gl_cxxalias_dummy
199#endif
200
201/* _GL_CXXALIAS_MDA (func, rettype, parameters);
202 is to be used when func is a Microsoft deprecated alias, on native Windows.
203 It declares a C++ alias called GNULIB_NAMESPACE::func
204 that redirects to _func, if GNULIB_NAMESPACE is defined.
205 Example:
206 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
207 */
208#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
209 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
210
211/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
212 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
213 except that the C function rpl_func may have a slightly different
214 declaration. A cast is used to silence the "invalid conversion" error
215 that would otherwise occur. */
216#if defined __cplusplus && defined GNULIB_NAMESPACE
217# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
218 namespace GNULIB_NAMESPACE \
219 { \
220 static const struct _gl_ ## func ## _wrapper \
221 { \
222 typedef rettype (*type) parameters; \
223 \
224 inline operator type () const \
225 { \
226 return reinterpret_cast<type>(::rpl_func); \
227 } \
228 } func = {}; \
229 } \
230 _GL_EXTERN_C int _gl_cxxalias_dummy
231#else
232# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
233 _GL_EXTERN_C int _gl_cxxalias_dummy
234#endif
235
236/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
237 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
238 except that the C function func may have a slightly different declaration.
239 A cast is used to silence the "invalid conversion" error that would
240 otherwise occur. */
241#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
242 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
243
244/* _GL_CXXALIAS_SYS (func, rettype, parameters);
245 declares a C++ alias called GNULIB_NAMESPACE::func
246 that redirects to the system provided function func, if GNULIB_NAMESPACE
247 is defined.
248 Example:
249 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
250
251 Wrapping func in an object with an inline conversion operator
252 avoids a reference to func unless GNULIB_NAMESPACE::func is
253 actually used in the program. */
254#if defined __cplusplus && defined GNULIB_NAMESPACE
255# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
256 namespace GNULIB_NAMESPACE \
257 { \
258 static const struct _gl_ ## func ## _wrapper \
259 { \
260 typedef rettype (*type) parameters; \
261 \
262 inline operator type () const \
263 { \
264 return ::func; \
265 } \
266 } func = {}; \
267 } \
268 _GL_EXTERN_C int _gl_cxxalias_dummy
269#else
270# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
271 _GL_EXTERN_C int _gl_cxxalias_dummy
272#endif
273
274/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
275 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
276 except that the C function func may have a slightly different declaration.
277 A cast is used to silence the "invalid conversion" error that would
278 otherwise occur. */
279#if defined __cplusplus && defined GNULIB_NAMESPACE
280# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
281 namespace GNULIB_NAMESPACE \
282 { \
283 static const struct _gl_ ## func ## _wrapper \
284 { \
285 typedef rettype (*type) parameters; \
286 \
287 inline operator type () const \
288 { \
289 return reinterpret_cast<type>(::func); \
290 } \
291 } func = {}; \
292 } \
293 _GL_EXTERN_C int _gl_cxxalias_dummy
294#else
295# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
296 _GL_EXTERN_C int _gl_cxxalias_dummy
297#endif
298
299/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
300 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
301 except that the C function is picked among a set of overloaded functions,
302 namely the one with rettype2 and parameters2. Two consecutive casts
303 are used to silence the "cannot find a match" and "invalid conversion"
304 errors that would otherwise occur. */
305#if defined __cplusplus && defined GNULIB_NAMESPACE
306 /* The outer cast must be a reinterpret_cast.
307 The inner cast: When the function is defined as a set of overloaded
308 functions, it works as a static_cast<>, choosing the designated variant.
309 When the function is defined as a single variant, it works as a
310 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
311# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
312 namespace GNULIB_NAMESPACE \
313 { \
314 static const struct _gl_ ## func ## _wrapper \
315 { \
316 typedef rettype (*type) parameters; \
317 \
318 inline operator type () const \
319 { \
320 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
321 } \
322 } func = {}; \
323 } \
324 _GL_EXTERN_C int _gl_cxxalias_dummy
325#else
326# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
327 _GL_EXTERN_C int _gl_cxxalias_dummy
328#endif
329
330/* _GL_CXXALIASWARN (func);
331 causes a warning to be emitted when ::func is used but not when
332 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
333 variants. */
334#if defined __cplusplus && defined GNULIB_NAMESPACE
335# define _GL_CXXALIASWARN(func) \
336 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
337# define _GL_CXXALIASWARN_1(func,namespace) \
338 _GL_CXXALIASWARN_2 (func, namespace)
339/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
340 we enable the warning only when not optimizing. */
341# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
342# define _GL_CXXALIASWARN_2(func,namespace) \
343 _GL_WARN_ON_USE (func, \
344 "The symbol ::" #func " refers to the system function. " \
345 "Use " #namespace "::" #func " instead.")
346# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
347# define _GL_CXXALIASWARN_2(func,namespace) \
348 extern __typeof__ (func) func
349# else
350# define _GL_CXXALIASWARN_2(func,namespace) \
351 _GL_EXTERN_C int _gl_cxxalias_dummy
352# endif
353#else
354# define _GL_CXXALIASWARN(func) \
355 _GL_EXTERN_C int _gl_cxxalias_dummy
356#endif
357
358/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
359 causes a warning to be emitted when the given overloaded variant of ::func
360 is used but not when GNULIB_NAMESPACE::func is used. */
361#if defined __cplusplus && defined GNULIB_NAMESPACE
362# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
363 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
364 GNULIB_NAMESPACE)
365# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
366 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
367/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
368 we enable the warning only when not optimizing. */
369# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
370# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
371 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
372 "The symbol ::" #func " refers to the system function. " \
373 "Use " #namespace "::" #func " instead.")
374# else
375# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
376 _GL_EXTERN_C int _gl_cxxalias_dummy
377# endif
378#else
379# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
380 _GL_EXTERN_C int _gl_cxxalias_dummy
381#endif
382
383#endif /* _GL_CXXDEFS_H */
384
385/* The definition of _GL_ARG_NONNULL is copied here. */
386/* A C macro for declaring that specific arguments must not be NULL.
387 Copyright (C) 2009-2022 Free Software Foundation, Inc.
388
389 This program is free software: you can redistribute it and/or modify it
390 under the terms of the GNU Lesser General Public License as published
391 by the Free Software Foundation; either version 2 of the License, or
392 (at your option) any later version.
393
394 This program is distributed in the hope that it will be useful,
395 but WITHOUT ANY WARRANTY; without even the implied warranty of
396 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
397 Lesser General Public License for more details.
398
399 You should have received a copy of the GNU Lesser General Public License
400 along with this program. If not, see <https://www.gnu.org/licenses/>. */
401
402/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
403 that the values passed as arguments n, ..., m must be non-NULL pointers.
404 n = 1 stands for the first argument, n = 2 for the second argument etc. */
405#ifndef _GL_ARG_NONNULL
406# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
407# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
408# else
409# define _GL_ARG_NONNULL(params)
410# endif
411#endif
412
413/* The definition of _GL_WARN_ON_USE is copied here. */
414/* A C macro for emitting warnings if a function is used.
415 Copyright (C) 2010-2022 Free Software Foundation, Inc.
416
417 This program is free software: you can redistribute it and/or modify it
418 under the terms of the GNU Lesser General Public License as published
419 by the Free Software Foundation; either version 2 of the License, or
420 (at your option) any later version.
421
422 This program is distributed in the hope that it will be useful,
423 but WITHOUT ANY WARRANTY; without even the implied warranty of
424 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
425 Lesser General Public License for more details.
426
427 You should have received a copy of the GNU Lesser General Public License
428 along with this program. If not, see <https://www.gnu.org/licenses/>. */
429
430/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
431 for FUNCTION which will then trigger a compiler warning containing
432 the text of "literal string" anywhere that function is called, if
433 supported by the compiler. If the compiler does not support this
434 feature, the macro expands to an unused extern declaration.
435
436 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
437 attribute used in _GL_WARN_ON_USE. If the compiler does not support
438 this feature, it expands to empty.
439
440 These macros are useful for marking a function as a potential
441 portability trap, with the intent that "literal string" include
442 instructions on the replacement function that should be used
443 instead.
444 _GL_WARN_ON_USE is for functions with 'extern' linkage.
445 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
446 linkage.
447
448 However, one of the reasons that a function is a portability trap is
449 if it has the wrong signature. Declaring FUNCTION with a different
450 signature in C is a compilation error, so this macro must use the
451 same type as any existing declaration so that programs that avoid
452 the problematic FUNCTION do not fail to compile merely because they
453 included a header that poisoned the function. But this implies that
454 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
455 have a declaration. Use of this macro implies that there must not
456 be any other macro hiding the declaration of FUNCTION; but
457 undefining FUNCTION first is part of the poisoning process anyway
458 (although for symbols that are provided only via a macro, the result
459 is a compilation error rather than a warning containing
460 "literal string"). Also note that in C++, it is only safe to use if
461 FUNCTION has no overloads.
462
463 For an example, it is possible to poison 'getline' by:
464 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
465 [getline]) in configure.ac, which potentially defines
466 HAVE_RAW_DECL_GETLINE
467 - adding this code to a header that wraps the system <stdio.h>:
468 #undef getline
469 #if HAVE_RAW_DECL_GETLINE
470 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
471 "not universally present; use the gnulib module getline");
472 #endif
473
474 It is not possible to directly poison global variables. But it is
475 possible to write a wrapper accessor function, and poison that
476 (less common usage, like &environ, will cause a compilation error
477 rather than issue the nice warning, but the end result of informing
478 the developer about their portability problem is still achieved):
479 #if HAVE_RAW_DECL_ENVIRON
480 static char ***
481 rpl_environ (void) { return &environ; }
482 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
483 # undef environ
484 # define environ (*rpl_environ ())
485 #endif
486 or better (avoiding contradictory use of 'static' and 'extern'):
487 #if HAVE_RAW_DECL_ENVIRON
488 static char ***
489 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
490 rpl_environ (void) { return &environ; }
491 # undef environ
492 # define environ (*rpl_environ ())
493 #endif
494 */
495#ifndef _GL_WARN_ON_USE
496
497# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
498/* A compiler attribute is available in gcc versions 4.3.0 and later. */
499# define _GL_WARN_ON_USE(function, message) \
500_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
501# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
502 __attribute__ ((__warning__ (message)))
503# elif __clang_major__ >= 4
504/* Another compiler attribute is available in clang. */
505# define _GL_WARN_ON_USE(function, message) \
506_GL_WARN_EXTERN_C __typeof__ (function) function \
507 __attribute__ ((__diagnose_if__ (1, message, "warning")))
508# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
509 __attribute__ ((__diagnose_if__ (1, message, "warning")))
510# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
511/* Verify the existence of the function. */
512# define _GL_WARN_ON_USE(function, message) \
513_GL_WARN_EXTERN_C __typeof__ (function) function
514# define _GL_WARN_ON_USE_ATTRIBUTE(message)
515# else /* Unsupported. */
516# define _GL_WARN_ON_USE(function, message) \
517_GL_WARN_EXTERN_C int _gl_warn_on_use
518# define _GL_WARN_ON_USE_ATTRIBUTE(message)
519# endif
520#endif
521
522/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
523 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
524 function is declared with the given prototype, consisting of return type,
525 parameters, and attributes.
526 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
527 not work in this case. */
528#ifndef _GL_WARN_ON_USE_CXX
529# if !defined __cplusplus
530# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
531 _GL_WARN_ON_USE (function, msg)
532# else
533# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
534/* A compiler attribute is available in gcc versions 4.3.0 and later. */
535# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
536extern rettype_gcc function parameters_and_attributes \
537 __attribute__ ((__warning__ (msg)))
538# elif __clang_major__ >= 4
539/* Another compiler attribute is available in clang. */
540# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
541extern rettype_clang function parameters_and_attributes \
542 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
543# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
544/* Verify the existence of the function. */
545# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
546extern rettype_gcc function parameters_and_attributes
547# else /* Unsupported. */
548# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
549_GL_WARN_EXTERN_C int _gl_warn_on_use
550# endif
551# endif
552#endif
553
554/* _GL_WARN_EXTERN_C declaration;
555 performs the declaration with C linkage. */
556#ifndef _GL_WARN_EXTERN_C
557# if defined __cplusplus
558# define _GL_WARN_EXTERN_C extern "C"
559# else
560# define _GL_WARN_EXTERN_C extern
561# endif
562#endif
563
564/* Before doing "#define mknod rpl_mknod" below, we need to include all
565 headers that may declare mknod(). OS/2 kLIBC declares mknod() in
566 <unistd.h>, not in <sys/stat.h>. */
567#ifdef __KLIBC__
568# include <unistd.h>
569#endif
570
571/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
572 headers that may declare mkdir(). Native Windows platforms declare mkdir
573 in <io.h> and/or <direct.h>, not in <sys/stat.h>. */
574#if defined _WIN32 && ! defined __CYGWIN__
575# include <io.h> /* mingw32, mingw64 */
576# include <direct.h> /* mingw64, MSVC 9 */
577#endif
578
579/* Native Windows platforms declare umask() in <io.h>. */
580#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
581# include <io.h>
582#endif
583
584/* Large File Support on native Windows. */
585#if 0
586# define stat _stati64
587#endif
588
589/* Optionally, override 'struct stat' on native Windows. */
590#if 0
591
592# undef stat
593# if 1
594# define stat rpl_stat
595# else
596 /* Provoke a clear link error if stat() is used as a function and
597 module 'stat' is not in use. */
598# define stat stat_used_without_requesting_gnulib_module_stat
599# endif
600
601# if !GNULIB_defined_struct_stat
602struct stat
603{
604 dev_t st_dev;
605 ino_t st_ino;
606 mode_t st_mode;
607 nlink_t st_nlink;
608# if 0
609 uid_t st_uid;
610# else /* uid_t is not defined by default on native Windows. */
611 short st_uid;
612# endif
613# if 0
614 gid_t st_gid;
615# else /* gid_t is not defined by default on native Windows. */
616 short st_gid;
617# endif
618 dev_t st_rdev;
619 off_t st_size;
620# if 0
621 blksize_t st_blksize;
622 blkcnt_t st_blocks;
623# endif
624
625# if 0
626 struct timespec st_atim;
627 struct timespec st_mtim;
628 struct timespec st_ctim;
629# else
630 time_t st_atime;
631 time_t st_mtime;
632 time_t st_ctime;
633# endif
634};
635# if 0
636# define st_atime st_atim.tv_sec
637# define st_mtime st_mtim.tv_sec
638# define st_ctime st_ctim.tv_sec
639 /* Indicator, for gnulib internal purposes. */
640# define _GL_WINDOWS_STAT_TIMESPEC 1
641# endif
642# define GNULIB_defined_struct_stat 1
643# endif
644
645/* Other possible values of st_mode. */
646# if 0
647# define _S_IFBLK 0x6000
648# endif
649# if 0
650# define _S_IFLNK 0xA000
651# endif
652# if 0
653# define _S_IFSOCK 0xC000
654# endif
655
656#endif
657
658#ifndef S_IFIFO
659# ifdef _S_IFIFO
660# define S_IFIFO _S_IFIFO
661# endif
662#endif
663
664#ifndef S_IFMT
665# define S_IFMT 0170000
666#endif
667
668#if STAT_MACROS_BROKEN
669# undef S_ISBLK
670# undef S_ISCHR
671# undef S_ISDIR
672# undef S_ISFIFO
673# undef S_ISLNK
674# undef S_ISNAM
675# undef S_ISMPB
676# undef S_ISMPC
677# undef S_ISNWK
678# undef S_ISREG
679# undef S_ISSOCK
680#endif
681
682#ifndef S_ISBLK
683# ifdef S_IFBLK
684# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
685# else
686# define S_ISBLK(m) 0
687# endif
688#endif
689
690#ifndef S_ISCHR
691# ifdef S_IFCHR
692# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
693# else
694# define S_ISCHR(m) 0
695# endif
696#endif
697
698#ifndef S_ISDIR
699# ifdef S_IFDIR
700# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
701# else
702# define S_ISDIR(m) 0
703# endif
704#endif
705
706#ifndef S_ISDOOR /* Solaris 2.5 and up */
707# define S_ISDOOR(m) 0
708#endif
709
710#ifndef S_ISFIFO
711# ifdef S_IFIFO
712# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
713# else
714# define S_ISFIFO(m) 0
715# endif
716#endif
717
718#ifndef S_ISLNK
719# ifdef S_IFLNK
720# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
721# else
722# define S_ISLNK(m) 0
723# endif
724#endif
725
726#ifndef S_ISMPB /* V7 */
727# ifdef S_IFMPB
728# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
729# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
730# else
731# define S_ISMPB(m) 0
732# define S_ISMPC(m) 0
733# endif
734#endif
735
736#ifndef S_ISMPX /* AIX */
737# define S_ISMPX(m) 0
738#endif
739
740#ifndef S_ISNAM /* Xenix */
741# ifdef S_IFNAM
742# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
743# else
744# define S_ISNAM(m) 0
745# endif
746#endif
747
748#ifndef S_ISNWK /* HP/UX */
749# ifdef S_IFNWK
750# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
751# else
752# define S_ISNWK(m) 0
753# endif
754#endif
755
756#ifndef S_ISPORT /* Solaris 10 and up */
757# define S_ISPORT(m) 0
758#endif
759
760#ifndef S_ISREG
761# ifdef S_IFREG
762# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
763# else
764# define S_ISREG(m) 0
765# endif
766#endif
767
768#ifndef S_ISSOCK
769# ifdef S_IFSOCK
770# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
771# else
772# define S_ISSOCK(m) 0
773# endif
774#endif
775
776
777#ifndef S_TYPEISMQ
778# define S_TYPEISMQ(p) 0
779#endif
780
781#ifndef S_TYPEISTMO
782# define S_TYPEISTMO(p) 0
783#endif
784
785
786#ifndef S_TYPEISSEM
787# ifdef S_INSEM
788# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
789# else
790# define S_TYPEISSEM(p) 0
791# endif
792#endif
793
794#ifndef S_TYPEISSHM
795# ifdef S_INSHD
796# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
797# else
798# define S_TYPEISSHM(p) 0
799# endif
800#endif
801
802/* high performance ("contiguous data") */
803#ifndef S_ISCTG
804# define S_ISCTG(p) 0
805#endif
806
807/* Cray DMF (data migration facility): off line, with data */
808#ifndef S_ISOFD
809# define S_ISOFD(p) 0
810#endif
811
812/* Cray DMF (data migration facility): off line, with no data */
813#ifndef S_ISOFL
814# define S_ISOFL(p) 0
815#endif
816
817/* 4.4BSD whiteout */
818#ifndef S_ISWHT
819# define S_ISWHT(m) 0
820#endif
821
822/* If any of the following are undefined,
823 define them to their de facto standard values. */
824#if !S_ISUID
825# define S_ISUID 04000
826#endif
827#if !S_ISGID
828# define S_ISGID 02000
829#endif
830
831/* S_ISVTX is a common extension to POSIX. */
832#ifndef S_ISVTX
833# define S_ISVTX 01000
834#endif
835
836#if !S_IRUSR && S_IREAD
837# define S_IRUSR S_IREAD
838#endif
839#if !S_IRUSR
840# define S_IRUSR 00400
841#endif
842#if !S_IRGRP
843# define S_IRGRP (S_IRUSR >> 3)
844#endif
845#if !S_IROTH
846# define S_IROTH (S_IRUSR >> 6)
847#endif
848
849#if !S_IWUSR && S_IWRITE
850# define S_IWUSR S_IWRITE
851#endif
852#if !S_IWUSR
853# define S_IWUSR 00200
854#endif
855#if !S_IWGRP
856# define S_IWGRP (S_IWUSR >> 3)
857#endif
858#if !S_IWOTH
859# define S_IWOTH (S_IWUSR >> 6)
860#endif
861
862#if !S_IXUSR && S_IEXEC
863# define S_IXUSR S_IEXEC
864#endif
865#if !S_IXUSR
866# define S_IXUSR 00100
867#endif
868#if !S_IXGRP
869# define S_IXGRP (S_IXUSR >> 3)
870#endif
871#if !S_IXOTH
872# define S_IXOTH (S_IXUSR >> 6)
873#endif
874
875#if !S_IRWXU
876# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
877#endif
878#if !S_IRWXG
879# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
880#endif
881#if !S_IRWXO
882# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
883#endif
884
885/* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
886 not implemented in GNU/Linux, some Gnulib-using apps use the macros. */
887#if !S_IXUGO
888# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
889#endif
890#ifndef S_IRWXUGO
891# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
892#endif
893
894/* Macros for futimens and utimensat. */
895#ifndef UTIME_NOW
896# define UTIME_NOW (-1)
897# define UTIME_OMIT (-2)
898#endif
899
900
901#if 0
902# if 0
903# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
904# undef chmod
905# define chmod rpl_chmod
906# endif
907_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
908 _GL_ARG_NONNULL ((1)));
909_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
910# elif defined _WIN32 && !defined __CYGWIN__
911# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
912# undef chmod
913# define chmod _chmod
914# endif
915/* Need to cast, because in mingw the last argument is 'int mode'. */
916_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
917# else
918_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
919# endif
920_GL_CXXALIASWARN (chmod);
921#elif defined GNULIB_POSIXCHECK
922# undef chmod
923# if HAVE_RAW_DECL_CHMOD
924_GL_WARN_ON_USE (chmod, "chmod has portability problems - "
925 "use gnulib module chmod for portability");
926# endif
927#elif 1
928/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
929 required. In C++ with GNULIB_NAMESPACE, avoid differences between
930 platforms by defining GNULIB_NAMESPACE::chmod always. */
931# if defined _WIN32 && !defined __CYGWIN__
932# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
933# undef chmod
934# define chmod _chmod
935# endif
936/* Need to cast, because in mingw the last argument is 'int mode'. */
937_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
938# else
939_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
940# endif
941_GL_CXXALIASWARN (chmod);
942#endif
943
944
945#if 0
946# if 0
947# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
948# undef fchmodat
949# define fchmodat rpl_fchmodat
950# endif
951_GL_FUNCDECL_RPL (fchmodat, int,
952 (int fd, char const *file, mode_t mode, int flag)
953 _GL_ARG_NONNULL ((2)));
954_GL_CXXALIAS_RPL (fchmodat, int,
955 (int fd, char const *file, mode_t mode, int flag));
956# else
957# if !1
958_GL_FUNCDECL_SYS (fchmodat, int,
959 (int fd, char const *file, mode_t mode, int flag)
960 _GL_ARG_NONNULL ((2)));
961# endif
962_GL_CXXALIAS_SYS (fchmodat, int,
963 (int fd, char const *file, mode_t mode, int flag));
964# endif
965_GL_CXXALIASWARN (fchmodat);
966#elif defined GNULIB_POSIXCHECK
967# undef fchmodat
968# if HAVE_RAW_DECL_FCHMODAT
969_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
970 "use gnulib module openat for portability");
971# endif
972#endif
973
974
975#if 1
976# if 0
977# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
978# undef fstat
979# define fstat rpl_fstat
980# endif
981_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
982_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
983# else
984_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
985# endif
986# if __GLIBC__ >= 2
987_GL_CXXALIASWARN (fstat);
988# endif
989#elif 0
990# undef fstat
991# define fstat fstat_used_without_requesting_gnulib_module_fstat
992#elif 0
993/* Above, we define stat to _stati64. */
994# define fstat _fstati64
995#elif defined GNULIB_POSIXCHECK
996# undef fstat
997# if HAVE_RAW_DECL_FSTAT
998_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
999 "use gnulib module fstat for portability");
1000# endif
1001#endif
1002
1003
1004#if 0
1005# if 0
1006# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# undef fstatat
1008# define fstatat rpl_fstatat
1009# endif
1010_GL_FUNCDECL_RPL (fstatat, int,
1011 (int fd, char const *restrict name, struct stat *restrict st,
1012 int flags)
1013 _GL_ARG_NONNULL ((2, 3)));
1014_GL_CXXALIAS_RPL (fstatat, int,
1015 (int fd, char const *restrict name, struct stat *restrict st,
1016 int flags));
1017# else
1018# if !1
1019_GL_FUNCDECL_SYS (fstatat, int,
1020 (int fd, char const *restrict name, struct stat *restrict st,
1021 int flags)
1022 _GL_ARG_NONNULL ((2, 3)));
1023# endif
1024_GL_CXXALIAS_SYS (fstatat, int,
1025 (int fd, char const *restrict name, struct stat *restrict st,
1026 int flags));
1027# endif
1028_GL_CXXALIASWARN (fstatat);
1029#elif 0
1030# undef fstatat
1031# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
1032#elif defined GNULIB_POSIXCHECK
1033# undef fstatat
1034# if HAVE_RAW_DECL_FSTATAT
1035_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
1036 "use gnulib module openat for portability");
1037# endif
1038#endif
1039
1040
1041#if 0
1042/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
1043 implementation relies on futimesat, which on Solaris 10 makes an invocation
1044 to futimens that is meant to invoke the libc's futimens(), not gnulib's
1045 futimens(). */
1046# if 0 || (!1 && defined __sun)
1047# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1048# undef futimens
1049# define futimens rpl_futimens
1050# endif
1051_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
1052_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
1053# else
1054# if !1
1055_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
1056# endif
1057_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
1058# endif
1059# if 1
1060_GL_CXXALIASWARN (futimens);
1061# endif
1062#elif defined GNULIB_POSIXCHECK
1063# undef futimens
1064# if HAVE_RAW_DECL_FUTIMENS
1065_GL_WARN_ON_USE (futimens, "futimens is not portable - "
1066 "use gnulib module futimens for portability");
1067# endif
1068#endif
1069
1070
1071#if 0
1072# if !1
1073_GL_FUNCDECL_SYS (getumask, mode_t, (void));
1074# endif
1075_GL_CXXALIAS_SYS (getumask, mode_t, (void));
1076# if 1
1077_GL_CXXALIASWARN (getumask);
1078# endif
1079#elif defined GNULIB_POSIXCHECK
1080# undef getumask
1081# if HAVE_RAW_DECL_GETUMASK
1082_GL_WARN_ON_USE (getumask, "getumask is not portable - "
1083 "use gnulib module getumask for portability");
1084# endif
1085#endif
1086
1087
1088#if 0
1089/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
1090 denotes a symbolic link. */
1091# if !1 || defined __hpux
1092_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
1093 _GL_ARG_NONNULL ((1)));
1094# endif
1095_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
1096_GL_CXXALIASWARN (lchmod);
1097#elif defined GNULIB_POSIXCHECK
1098# undef lchmod
1099# if HAVE_RAW_DECL_LCHMOD
1100_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
1101 "use gnulib module lchmod for portability");
1102# endif
1103#endif
1104
1105
1106#if 0
1107# if ! 1
1108/* mingw does not support symlinks, therefore it does not have lstat. But
1109 without links, stat does just fine. */
1110# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1111# define lstat stat
1112# endif
1113_GL_CXXALIAS_RPL_1 (lstat, stat, int,
1114 (const char *restrict name, struct stat *restrict buf));
1115# elif 0
1116# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1117# undef lstat
1118# define lstat rpl_lstat
1119# endif
1120_GL_FUNCDECL_RPL (lstat, int,
1121 (const char *restrict name, struct stat *restrict buf)
1122 _GL_ARG_NONNULL ((1, 2)));
1123_GL_CXXALIAS_RPL (lstat, int,
1124 (const char *restrict name, struct stat *restrict buf));
1125# else
1126_GL_CXXALIAS_SYS (lstat, int,
1127 (const char *restrict name, struct stat *restrict buf));
1128# endif
1129# if 1
1130_GL_CXXALIASWARN (lstat);
1131# endif
1132#elif 0
1133# undef lstat
1134# define lstat lstat_used_without_requesting_gnulib_module_lstat
1135#elif defined GNULIB_POSIXCHECK
1136# undef lstat
1137# if HAVE_RAW_DECL_LSTAT
1138_GL_WARN_ON_USE (lstat, "lstat is unportable - "
1139 "use gnulib module lstat for portability");
1140# endif
1141#endif
1142
1143
1144#if 0
1145# if 0
1146# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1147# undef mkdir
1148# define mkdir rpl_mkdir
1149# endif
1150_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
1151 _GL_ARG_NONNULL ((1)));
1152_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1153# elif defined _WIN32 && !defined __CYGWIN__
1154/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
1155 Additionally, it declares _mkdir (and depending on compile flags, an
1156 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
1157 which are included above. */
1158# if !GNULIB_defined_rpl_mkdir
1159static int
1160rpl_mkdir (char const *name, mode_t mode)
1161{
1162 return _mkdir (name);
1163}
1164# define GNULIB_defined_rpl_mkdir 1
1165# endif
1166# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1167# undef mkdir
1168# define mkdir rpl_mkdir
1169# endif
1170_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1171# else
1172_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1173# endif
1174_GL_CXXALIASWARN (mkdir);
1175#elif defined GNULIB_POSIXCHECK
1176# undef mkdir
1177# if HAVE_RAW_DECL_MKDIR
1178_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
1179 "use gnulib module mkdir for portability");
1180# endif
1181#elif 1
1182/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
1183 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1184 platforms by defining GNULIB_NAMESPACE::mkdir always. */
1185# if defined _WIN32 && !defined __CYGWIN__
1186# if !GNULIB_defined_rpl_mkdir
1187static int
1188rpl_mkdir (char const *name, mode_t mode)
1189{
1190 return _mkdir (name);
1191}
1192# define GNULIB_defined_rpl_mkdir 1
1193# endif
1194# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1195# undef mkdir
1196# define mkdir rpl_mkdir
1197# endif
1198_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1199# else
1200_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1201# endif
1202_GL_CXXALIASWARN (mkdir);
1203#endif
1204
1205
1206#if 0
1207# if !1
1208_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
1209 _GL_ARG_NONNULL ((2)));
1210# endif
1211_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
1212_GL_CXXALIASWARN (mkdirat);
1213#elif defined GNULIB_POSIXCHECK
1214# undef mkdirat
1215# if HAVE_RAW_DECL_MKDIRAT
1216_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
1217 "use gnulib module openat for portability");
1218# endif
1219#endif
1220
1221
1222#if 0
1223# if 0
1224# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1225# undef mkfifo
1226# define mkfifo rpl_mkfifo
1227# endif
1228_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
1229 _GL_ARG_NONNULL ((1)));
1230_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
1231# else
1232# if !1
1233_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
1234 _GL_ARG_NONNULL ((1)));
1235# endif
1236_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
1237# endif
1238_GL_CXXALIASWARN (mkfifo);
1239#elif defined GNULIB_POSIXCHECK
1240# undef mkfifo
1241# if HAVE_RAW_DECL_MKFIFO
1242_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
1243 "use gnulib module mkfifo for portability");
1244# endif
1245#endif
1246
1247
1248#if 0
1249# if 0
1250# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1251# undef mkfifoat
1252# define mkfifoat rpl_mkfifoat
1253# endif
1254_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
1255 _GL_ARG_NONNULL ((2)));
1256_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
1257# else
1258# if !1
1259_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
1260 _GL_ARG_NONNULL ((2)));
1261# endif
1262_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
1263# endif
1264_GL_CXXALIASWARN (mkfifoat);
1265#elif defined GNULIB_POSIXCHECK
1266# undef mkfifoat
1267# if HAVE_RAW_DECL_MKFIFOAT
1268_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
1269 "use gnulib module mkfifoat for portability");
1270# endif
1271#endif
1272
1273
1274#if 0
1275# if 0
1276# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1277# undef mknod
1278# define mknod rpl_mknod
1279# endif
1280_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
1281 _GL_ARG_NONNULL ((1)));
1282_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
1283# else
1284# if !1
1285_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
1286 _GL_ARG_NONNULL ((1)));
1287# endif
1288/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
1289_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
1290# endif
1291_GL_CXXALIASWARN (mknod);
1292#elif defined GNULIB_POSIXCHECK
1293# undef mknod
1294# if HAVE_RAW_DECL_MKNOD
1295_GL_WARN_ON_USE (mknod, "mknod is not portable - "
1296 "use gnulib module mknod for portability");
1297# endif
1298#endif
1299
1300
1301#if 0
1302# if 0
1303# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1304# undef mknodat
1305# define mknodat rpl_mknodat
1306# endif
1307_GL_FUNCDECL_RPL (mknodat, int,
1308 (int fd, char const *file, mode_t mode, dev_t dev)
1309 _GL_ARG_NONNULL ((2)));
1310_GL_CXXALIAS_RPL (mknodat, int,
1311 (int fd, char const *file, mode_t mode, dev_t dev));
1312# else
1313# if !1
1314_GL_FUNCDECL_SYS (mknodat, int,
1315 (int fd, char const *file, mode_t mode, dev_t dev)
1316 _GL_ARG_NONNULL ((2)));
1317# endif
1318_GL_CXXALIAS_SYS (mknodat, int,
1319 (int fd, char const *file, mode_t mode, dev_t dev));
1320# endif
1321_GL_CXXALIASWARN (mknodat);
1322#elif defined GNULIB_POSIXCHECK
1323# undef mknodat
1324# if HAVE_RAW_DECL_MKNODAT
1325_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
1326 "use gnulib module mkfifoat for portability");
1327# endif
1328#endif
1329
1330
1331#if 1
1332# if 0
1333# if !0
1334 /* We can't use the object-like #define stat rpl_stat, because of
1335 struct stat. This means that rpl_stat will not be used if the user
1336 does (stat)(a,b). Oh well. */
1337# if defined _AIX && defined stat && defined _LARGE_FILES
1338 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
1339 so we have to replace stat64() instead of stat(). */
1340# undef stat64
1341# define stat64(name, st) rpl_stat (name, st)
1342# elif 0
1343 /* Above, we define stat to _stati64. */
1344# if defined __MINGW32__ && defined _stati64
1345# ifndef _USE_32BIT_TIME_T
1346 /* The system headers define _stati64 to _stat64. */
1347# undef _stat64
1348# define _stat64(name, st) rpl_stat (name, st)
1349# endif
1350# elif defined _MSC_VER && defined _stati64
1351# ifdef _USE_32BIT_TIME_T
1352 /* The system headers define _stati64 to _stat32i64. */
1353# undef _stat32i64
1354# define _stat32i64(name, st) rpl_stat (name, st)
1355# else
1356 /* The system headers define _stati64 to _stat64. */
1357# undef _stat64
1358# define _stat64(name, st) rpl_stat (name, st)
1359# endif
1360# else
1361# undef _stati64
1362# define _stati64(name, st) rpl_stat (name, st)
1363# endif
1364# elif defined __MINGW32__ && defined stat
1365# ifdef _USE_32BIT_TIME_T
1366 /* The system headers define stat to _stat32i64. */
1367# undef _stat32i64
1368# define _stat32i64(name, st) rpl_stat (name, st)
1369# else
1370 /* The system headers define stat to _stat64. */
1371# undef _stat64
1372# define _stat64(name, st) rpl_stat (name, st)
1373# endif
1374# elif defined _MSC_VER && defined stat
1375# ifdef _USE_32BIT_TIME_T
1376 /* The system headers define stat to _stat32. */
1377# undef _stat32
1378# define _stat32(name, st) rpl_stat (name, st)
1379# else
1380 /* The system headers define stat to _stat64i32. */
1381# undef _stat64i32
1382# define _stat64i32(name, st) rpl_stat (name, st)
1383# endif
1384# else /* !(_AIX || __MINGW32__ || _MSC_VER) */
1385# undef stat
1386# define stat(name, st) rpl_stat (name, st)
1387# endif /* !_LARGE_FILES */
1388# endif /* !0 */
1389_GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
1390 _GL_ARG_NONNULL ((1, 2));
1391# endif
1392#elif 0
1393/* see above:
1394 #define stat stat_used_without_requesting_gnulib_module_stat
1395 */
1396#elif defined GNULIB_POSIXCHECK
1397# undef stat
1398# if HAVE_RAW_DECL_STAT
1399_GL_WARN_ON_USE (stat, "stat is unportable - "
1400 "use gnulib module stat for portability");
1401# endif
1402#endif
1403
1404
1405#if 1
1406/* On native Windows, map 'umask' to '_umask', so that -loldnames is not
1407 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1408 platforms by defining GNULIB_NAMESPACE::umask always. */
1409# if defined _WIN32 && !defined __CYGWIN__
1410# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1411# undef umask
1412# define umask _umask
1413# endif
1414/* Need to cast, because in mingw the last argument is 'int mode'. */
1415_GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
1416# else
1417_GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
1418# endif
1419_GL_CXXALIASWARN (umask);
1420#endif
1421
1422
1423#if 0
1424/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
1425 implementation relies on futimesat, which on Solaris 10 makes an invocation
1426 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
1427 utimensat(). */
1428# if 0 || (!1 && defined __sun)
1429# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1430# undef utimensat
1431# define utimensat rpl_utimensat
1432# endif
1433_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
1434 struct timespec const times[2], int flag)
1435 _GL_ARG_NONNULL ((2)));
1436_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
1437 struct timespec const times[2], int flag));
1438# else
1439# if !1
1440_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
1441 struct timespec const times[2], int flag)
1442 _GL_ARG_NONNULL ((2)));
1443# endif
1444_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
1445 struct timespec const times[2], int flag));
1446# endif
1447# if 1
1448_GL_CXXALIASWARN (utimensat);
1449# endif
1450#elif defined GNULIB_POSIXCHECK
1451# undef utimensat
1452# if HAVE_RAW_DECL_UTIMENSAT
1453_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
1454 "use gnulib module utimensat for portability");
1455# endif
1456#endif
1457
1458
1459#endif /* _GL_SYS_STAT_H */
1460#endif /* _GL_SYS_STAT_H */
1461#endif
diff --git a/gl/sys/types.h b/gl/sys/types.h
new file mode 100644
index 0000000..d720b9d
--- /dev/null
+++ b/gl/sys/types.h
@@ -0,0 +1,107 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Provide a more complete sys/types.h.
3
4 Copyright (C) 2011-2022 Free Software Foundation, Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19#if __GNUC__ >= 3
20#pragma GCC system_header
21#endif
22
23
24#if defined _WIN32 && !defined __CYGWIN__ \
25 && (defined __need_off_t || defined __need___off64_t \
26 || defined __need_ssize_t || defined __need_time_t)
27
28/* Special invocation convention inside mingw header files. */
29
30#include_next <sys/types.h>
31
32#else
33/* Normal invocation convention. */
34
35#ifndef _GL_SYS_TYPES_H
36
37/* The include_next requires a split double-inclusion guard. */
38# define _GL_INCLUDING_SYS_TYPES_H
39#include_next <sys/types.h>
40# undef _GL_INCLUDING_SYS_TYPES_H
41
42#ifndef _GL_SYS_TYPES_H
43#define _GL_SYS_TYPES_H
44
45/* Override off_t if Large File Support is requested on native Windows. */
46#if 0
47/* Same as int64_t in <stdint.h>. */
48# if defined _MSC_VER
49# define off_t __int64
50# else
51# define off_t long long int
52# endif
53/* Indicator, for gnulib internal purposes. */
54# define _GL_WINDOWS_64_BIT_OFF_T 1
55#endif
56
57/* Override dev_t and ino_t if distinguishable inodes support is requested
58 on native Windows. */
59#if 0
60
61# if 0 == 2
62/* Experimental, not useful in Windows 10. */
63
64/* Define dev_t to a 64-bit type. */
65# if !defined GNULIB_defined_dev_t
66typedef unsigned long long int rpl_dev_t;
67# undef dev_t
68# define dev_t rpl_dev_t
69# define GNULIB_defined_dev_t 1
70# endif
71
72/* Define ino_t to a 128-bit type. */
73# if !defined GNULIB_defined_ino_t
74/* MSVC does not have a 128-bit integer type.
75 GCC has a 128-bit integer type __int128, but only on 64-bit targets. */
76typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t;
77# undef ino_t
78# define ino_t rpl_ino_t
79# define GNULIB_defined_ino_t 1
80# endif
81
82# else /* 0 == 1 */
83
84/* Define ino_t to a 64-bit type. */
85# if !defined GNULIB_defined_ino_t
86typedef unsigned long long int rpl_ino_t;
87# undef ino_t
88# define ino_t rpl_ino_t
89# define GNULIB_defined_ino_t 1
90# endif
91
92# endif
93
94/* Indicator, for gnulib internal purposes. */
95# define _GL_WINDOWS_STAT_INODES 0
96
97#endif
98
99/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
100/* But avoid namespace pollution on glibc systems. */
101#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__
102# include <stddef.h>
103#endif
104
105#endif /* _GL_SYS_TYPES_H */
106#endif /* _GL_SYS_TYPES_H */
107#endif /* __need_XXX */
diff --git a/gl/sys/uio.h b/gl/sys/uio.h
new file mode 100644
index 0000000..21280cb
--- /dev/null
+++ b/gl/sys/uio.h
@@ -0,0 +1,64 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Substitute for <sys/uio.h>.
3 Copyright (C) 2011-2022 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18# if __GNUC__ >= 3
19#pragma GCC system_header
20# endif
21
22
23#ifndef _GL_SYS_UIO_H
24
25#if 1
26
27/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */
28# include <sys/types.h>
29
30/* The include_next requires a split double-inclusion guard. */
31# include_next <sys/uio.h>
32
33#endif
34
35#ifndef _GL_SYS_UIO_H
36#define _GL_SYS_UIO_H
37
38#if !1
39/* A platform that lacks <sys/uio.h>. */
40/* Get 'size_t' and 'ssize_t'. */
41# include <sys/types.h>
42
43# ifdef __cplusplus
44extern "C" {
45# endif
46
47# if !GNULIB_defined_struct_iovec
48/* All known platforms that lack <sys/uio.h> also lack any declaration
49 of struct iovec in any other header. */
50struct iovec {
51 void *iov_base;
52 size_t iov_len;
53};
54# define GNULIB_defined_struct_iovec 1
55# endif
56
57# ifdef __cplusplus
58}
59# endif
60
61#endif
62
63#endif /* _GL_SYS_UIO_H */
64#endif /* _GL_SYS_UIO_H */