annotate lib/unistd.in.h @ 17353:c332767f3c68

unistd: don't prevent Tru64 Unix from using gnulib strtod. * lib/unistd.in.h: be careful not to include un-needed system stdlib.h from here, because that prevents gnulib stdlib.h from defining rpl_strtod correctly. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
author Gary V. Vaughan <gary@gnu.org>
date Mon, 11 Mar 2013 12:48:58 +0700
parents 2c4826afb7aa
children 1f9070ef79b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Substitute for and wrapper around <unistd.h>.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 17174
diff changeset
2 Copyright (C) 2003-2013 Free Software Foundation, Inc.
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
16366
bb182ee4a09d maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 16284
diff changeset
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
17288
40135b67c0be unistd: port to recent mingw
Paul Eggert <eggert@cs.ucla.edu>
parents: 17277
diff changeset
17 #ifndef _@GUARD_PREFIX@_UNISTD_H
40135b67c0be unistd: port to recent mingw
Paul Eggert <eggert@cs.ucla.edu>
parents: 17277
diff changeset
18
13055
c7be8484e434 maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents: 13043
diff changeset
19 #if __GNUC__ >= 3
c7be8484e434 maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents: 13043
diff changeset
20 @PRAGMA_SYSTEM_HEADER@
c7be8484e434 maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents: 13043
diff changeset
21 #endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 13539
diff changeset
22 @PRAGMA_COLUMNS@
13055
c7be8484e434 maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents: 13043
diff changeset
23
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 /* The include_next requires a split double-inclusion guard. */
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #if @HAVE_UNISTD_H@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
13041
3c571b86f200 gethostname: fix build on mingw
Eric Blake <eblake@redhat.com>
parents: 13023
diff changeset
29 /* Get all possible declarations of gethostname(). */
13043
38940a410ec1 gethostname: further tweaks
Eric Blake <eblake@redhat.com>
parents: 13041
diff changeset
30 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
38940a410ec1 gethostname: further tweaks
Eric Blake <eblake@redhat.com>
parents: 13041
diff changeset
31 && !defined _GL_INCLUDING_WINSOCK2_H
13041
3c571b86f200 gethostname: fix build on mingw
Eric Blake <eblake@redhat.com>
parents: 13023
diff changeset
32 # define _GL_INCLUDING_WINSOCK2_H
3c571b86f200 gethostname: fix build on mingw
Eric Blake <eblake@redhat.com>
parents: 13023
diff changeset
33 # include <winsock2.h>
3c571b86f200 gethostname: fix build on mingw
Eric Blake <eblake@redhat.com>
parents: 13023
diff changeset
34 # undef _GL_INCLUDING_WINSOCK2_H
3c571b86f200 gethostname: fix build on mingw
Eric Blake <eblake@redhat.com>
parents: 13023
diff changeset
35 #endif
3c571b86f200 gethostname: fix build on mingw
Eric Blake <eblake@redhat.com>
parents: 13023
diff changeset
36
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14733
diff changeset
37 #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14733
diff changeset
38 #define _@GUARD_PREFIX@_UNISTD_H
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents: 11810
diff changeset
40 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents: 11810
diff changeset
41 #include <stddef.h>
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents: 11810
diff changeset
42
11049
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
43 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
12486
8d19393d7abe unistd: work around cygwin bug
Eric Blake <ebb9@byu.net>
parents: 12479
diff changeset
44 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
45 /* But avoid namespace pollution on glibc systems. */
12486
8d19393d7abe unistd: work around cygwin bug
Eric Blake <ebb9@byu.net>
parents: 12479
diff changeset
46 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
13828
54a5acffcb53 unistd: Refine workaround from 2009-12-23 against Cygwin bug.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
47 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
54a5acffcb53 unistd: Refine workaround from 2009-12-23 against Cygwin bug.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
48 && defined __CYGWIN__)) \
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
49 && ! defined __GLIBC__
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 # include <stdio.h>
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52
12486
8d19393d7abe unistd: work around cygwin bug
Eric Blake <ebb9@byu.net>
parents: 12479
diff changeset
53 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
54 /* But avoid namespace pollution on glibc systems. */
13828
54a5acffcb53 unistd: Refine workaround from 2009-12-23 against Cygwin bug.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
55 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
54a5acffcb53 unistd: Refine workaround from 2009-12-23 against Cygwin bug.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
56 && ! defined __GLIBC__
12486
8d19393d7abe unistd: work around cygwin bug
Eric Blake <ebb9@byu.net>
parents: 12479
diff changeset
57 # include <fcntl.h>
8d19393d7abe unistd: work around cygwin bug
Eric Blake <ebb9@byu.net>
parents: 12479
diff changeset
58 #endif
8d19393d7abe unistd: work around cygwin bug
Eric Blake <ebb9@byu.net>
parents: 12479
diff changeset
59
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 /* mingw fails to declare _exit in <unistd.h>. */
15639
6c1f469caade putenv: Support for MSVC.
Bruno Haible <bruno@clisp.org>
parents: 15627
diff changeset
61 /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
6c1f469caade putenv: Support for MSVC.
Bruno Haible <bruno@clisp.org>
parents: 15627
diff changeset
62 <unistd.h>. */
12479
3607500d4523 unistd: Ensure getcwd gets declared before being overridden.
Bruno Haible <bruno@clisp.org>
parents: 12477
diff changeset
63 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
17353
c332767f3c68 unistd: don't prevent Tru64 Unix from using gnulib strtod.
Gary V. Vaughan <gary@gnu.org>
parents: 17317
diff changeset
64 /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
c332767f3c68 unistd: don't prevent Tru64 Unix from using gnulib strtod.
Gary V. Vaughan <gary@gnu.org>
parents: 17317
diff changeset
65 included here. */
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
66 /* But avoid namespace pollution on glibc systems. */
17353
c332767f3c68 unistd: don't prevent Tru64 Unix from using gnulib strtod.
Gary V. Vaughan <gary@gnu.org>
parents: 17317
diff changeset
67 #if !defined __GLIBC__ && !defined __osf__
17277
b83fbc95abc4 stdlib: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
68 # define __need_system_stdlib_h
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
69 # include <stdlib.h>
17277
b83fbc95abc4 stdlib: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
70 # undef __need_system_stdlib_h
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
71 #endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72
15746
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
73 /* Native Windows platforms declare chdir, getcwd, rmdir in
16284
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
74 <io.h> and/or <direct.h>, not in <unistd.h>.
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
75 They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
76 lseek(), read(), unlink(), write() in <io.h>. */
15746
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
77 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
78 || defined GNULIB_POSIXCHECK) \
12488
9bd9b7a4b42b build: pull in conditional headers during GNULIB_POSIXCHECK
Eric Blake <ebb9@byu.net>
parents: 12486
diff changeset
79 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
15520
8d4beb5eae92 getcwd: fix compilation on mingw64
Eric Blake <eblake@redhat.com>
parents: 15355
diff changeset
80 # include <io.h> /* mingw32, mingw64 */
15744
fed0e9994e29 getcwd: Tweak for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15639
diff changeset
81 # include <direct.h> /* mingw64, MSVC 9 */
16284
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
82 #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
83 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
84 || defined GNULIB_POSIXCHECK) \
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
85 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
ab517781f037 Improve support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 16209
diff changeset
86 # include <io.h>
12479
3607500d4523 unistd: Ensure getcwd gets declared before being overridden.
Bruno Haible <bruno@clisp.org>
parents: 12477
diff changeset
87 #endif
3607500d4523 unistd: Ensure getcwd gets declared before being overridden.
Bruno Haible <bruno@clisp.org>
parents: 12477
diff changeset
88
14012
55491ce6972d gethostname: Ensure declaration on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 13999
diff changeset
89 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
55491ce6972d gethostname: Ensure declaration on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 13999
diff changeset
90 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
13911
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
91 /* But avoid namespace pollution on glibc systems. */
14012
55491ce6972d gethostname: Ensure declaration on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 13999
diff changeset
92 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
55491ce6972d gethostname: Ensure declaration on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 13999
diff changeset
93 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
13911
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
94 && !defined __GLIBC__
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
95 # include <netdb.h>
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
96 #endif
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
97
16795
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
98 /* MSVC defines off_t in <sys/types.h>.
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
99 May also define off_t to a 64-bit type on native Windows. */
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
100 #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
15627
4afad5701552 Support for MSVC compiler: Ensure off_t gets defined.
Bruno Haible <bruno@clisp.org>
parents: 15625
diff changeset
101 /* Get off_t. */
4afad5701552 Support for MSVC compiler: Ensure off_t gets defined.
Bruno Haible <bruno@clisp.org>
parents: 15625
diff changeset
102 # include <sys/types.h>
4afad5701552 Support for MSVC compiler: Ensure off_t gets defined.
Bruno Haible <bruno@clisp.org>
parents: 15625
diff changeset
103 #endif
4afad5701552 Support for MSVC compiler: Ensure off_t gets defined.
Bruno Haible <bruno@clisp.org>
parents: 15625
diff changeset
104
14583
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
105 #if (@GNULIB_READ@ || @GNULIB_WRITE@ \
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
106 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
13314
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
107 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
10484
b763245277c9 New module 'write'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
108 /* Get ssize_t. */
b763245277c9 New module 'write'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
109 # include <sys/types.h>
b763245277c9 New module 'write'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
110 #endif
b763245277c9 New module 'write'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
111
12491
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
112 /* Get getopt(), optarg, optind, opterr, optopt.
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
113 But avoid namespace pollution on glibc systems. */
ad883448fbdf Reduce namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 12488
diff changeset
114 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
17317
2c4826afb7aa unistd: avoid namespace pollution on non-glibc systems
Paul Eggert <eggert@cs.ucla.edu>
parents: 17288
diff changeset
115 # define __need_getopt
11810
d2c9dd185002 Ensure that getopt() gets declared by <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 11801
diff changeset
116 # include <getopt.h>
d2c9dd185002 Ensure that getopt() gets declared by <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 11801
diff changeset
117 #endif
d2c9dd185002 Ensure that getopt() gets declared by <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 11801
diff changeset
118
17174
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
119 _GL_INLINE_HEADER_BEGIN
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
120 #ifndef _GL_UNISTD_INLINE
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
121 # define _GL_UNISTD_INLINE _GL_INLINE
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
122 #endif
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
123
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
124 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
125
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
126 /* The definition of _GL_ARG_NONNULL is copied here. */
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
127
12725
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
128 /* The definition of _GL_WARN_ON_USE is copied here. */
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
129
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130
15355
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
131 /* Hide some function declarations from <winsock2.h>. */
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
132
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
133 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
134 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
135 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
136 # undef socket
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
137 # define socket socket_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
138 # undef connect
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
139 # define connect connect_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
140 # undef accept
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
141 # define accept accept_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
142 # undef bind
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
143 # define bind bind_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
144 # undef getpeername
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
145 # define getpeername getpeername_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
146 # undef getsockname
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
147 # define getsockname getsockname_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
148 # undef getsockopt
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
149 # define getsockopt getsockopt_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
150 # undef listen
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
151 # define listen listen_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
152 # undef recv
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
153 # define recv recv_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
154 # undef send
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
155 # define send send_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
156 # undef recvfrom
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
157 # define recvfrom recvfrom_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
158 # undef sendto
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
159 # define sendto sendto_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
160 # undef setsockopt
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
161 # define setsockopt setsockopt_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
162 # undef shutdown
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
163 # define shutdown shutdown_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
164 # else
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
165 _GL_WARN_ON_USE (socket,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
166 "socket() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
167 _GL_WARN_ON_USE (connect,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
168 "connect() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
169 _GL_WARN_ON_USE (accept,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
170 "accept() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
171 _GL_WARN_ON_USE (bind,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
172 "bind() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
173 _GL_WARN_ON_USE (getpeername,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
174 "getpeername() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
175 _GL_WARN_ON_USE (getsockname,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
176 "getsockname() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
177 _GL_WARN_ON_USE (getsockopt,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
178 "getsockopt() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
179 _GL_WARN_ON_USE (listen,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
180 "listen() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
181 _GL_WARN_ON_USE (recv,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
182 "recv() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
183 _GL_WARN_ON_USE (send,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
184 "send() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
185 _GL_WARN_ON_USE (recvfrom,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
186 "recvfrom() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
187 _GL_WARN_ON_USE (sendto,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
188 "sendto() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
189 _GL_WARN_ON_USE (setsockopt,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
190 "setsockopt() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
191 _GL_WARN_ON_USE (shutdown,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
192 "shutdown() used without including <sys/socket.h>");
13078
00334715e427 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
193 # endif
15355
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
194 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
195 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
196 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
197 # undef select
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
198 # define select select_used_without_including_sys_select_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
199 # else
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
200 _GL_WARN_ON_USE (select,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15281
diff changeset
201 "select() used without including <sys/select.h>");
13078
00334715e427 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
202 # endif
00334715e427 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
203 # endif
00334715e427 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
204 #endif
00334715e427 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
205
00334715e427 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
206
11049
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
207 /* OS/2 EMX lacks these macros. */
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
208 #ifndef STDIN_FILENO
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
209 # define STDIN_FILENO 0
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
210 #endif
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
211 #ifndef STDOUT_FILENO
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
212 # define STDOUT_FILENO 1
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
213 #endif
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
214 #ifndef STDERR_FILENO
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
215 # define STDERR_FILENO 2
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
216 #endif
8398d9f607b4 unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents: 11041
diff changeset
217
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
218 /* Ensure *_OK macros exist. */
11945
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
219 #ifndef F_OK
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
220 # define F_OK 0
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
221 # define X_OK 1
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
222 # define W_OK 2
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
223 # define R_OK 4
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
224 #endif
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
225
2cf208dc022b faccessat: new module
Eric Blake <ebb9@byu.net>
parents: 11942
diff changeset
226
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 /* Declare overridden functions. */
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229
12919
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
230 #if defined GNULIB_POSIXCHECK
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
231 /* The access() function is a security risk. */
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
232 _GL_WARN_ON_USE (access, "the access function is a security risk - "
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
233 "use the gnulib module faccessat instead");
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
234 #endif
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
235
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
236
15746
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
237 #if @GNULIB_CHDIR@
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
238 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
239 _GL_CXXALIASWARN (chdir);
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
240 #elif defined GNULIB_POSIXCHECK
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
241 # undef chdir
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
242 # if HAVE_RAW_DECL_CHDIR
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
243 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
244 "use gnulib module chdir for portability");
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
245 # endif
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
246 #endif
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
247
60062069d7ed New module 'chdir'.
Bruno Haible <bruno@clisp.org>
parents: 15745
diff changeset
248
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 #if @GNULIB_CHOWN@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251 to GID (if GID is not -1). Follow symbolic links.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
252 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
253 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
254 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
255 # if @REPLACE_CHOWN@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
257 # undef chown
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
258 # define chown rpl_chown
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
259 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
260 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
261 _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
262 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
263 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
264 # if !@HAVE_CHOWN@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
265 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
266 _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
267 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
268 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
270 _GL_CXXALIASWARN (chown);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 # undef chown
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
273 # if HAVE_RAW_DECL_CHOWN
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
274 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
275 "doesn't treat a uid or gid of -1 on some systems - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
276 "use gnulib module chown for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
277 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280
10609
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
281 #if @GNULIB_CLOSE@
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
282 # if @REPLACE_CLOSE@
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
283 /* Automatically included by modules that need a replacement for close. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
285 # undef close
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
286 # define close rpl_close
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
287 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
288 _GL_FUNCDECL_RPL (close, int, (int fd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
289 _GL_CXXALIAS_RPL (close, int, (int fd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
290 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
291 _GL_CXXALIAS_SYS (close, int, (int fd));
10609
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
292 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
293 _GL_CXXALIASWARN (close);
11801
a29d6bab4448 Make it possible to use module 'gethostname' without module 'close' or 'ioctl'.
Bruno Haible <bruno@clisp.org>
parents: 11729
diff changeset
294 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
10610
9202c6340cce Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10609
diff changeset
295 # undef close
9202c6340cce Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10609
diff changeset
296 # define close close_used_without_requesting_gnulib_module_close
9202c6340cce Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10609
diff changeset
297 #elif defined GNULIB_POSIXCHECK
9202c6340cce Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10609
diff changeset
298 # undef close
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
299 /* Assume close is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
300 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
301 "use gnulib module close for portability");
10609
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
302 #endif
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
303
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
304
15760
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
305 #if @GNULIB_DUP@
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
306 # if @REPLACE_DUP@
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
307 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
308 # define dup rpl_dup
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
309 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
310 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
311 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
15760
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
312 # else
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
313 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
15760
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
314 # endif
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
315 _GL_CXXALIASWARN (dup);
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
316 #elif defined GNULIB_POSIXCHECK
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
317 # undef dup
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
318 # if HAVE_RAW_DECL_DUP
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
319 _GL_WARN_ON_USE (dup, "dup is unportable - "
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
320 "use gnulib module dup for portability");
45b9be95a543 New module 'dup'.
Bruno Haible <bruno@clisp.org>
parents: 15746
diff changeset
321 # endif
11992
a1e0b2efc812 fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents: 11981
diff changeset
322 #endif
10609
5acc60c1ec66 New module 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents: 10582
diff changeset
323
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
324
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 #if @GNULIB_DUP2@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
11726
c694fa3f9d7d dup2: work around mingw and cygwin 1.5 bug
Eric Blake <ebb9@byu.net>
parents: 11426
diff changeset
328 Return newfd if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
329 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
330 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
331 # if @REPLACE_DUP2@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
332 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
333 # define dup2 rpl_dup2
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
334 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
335 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
336 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
337 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
338 # if !@HAVE_DUP2@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
339 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
340 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
341 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
343 _GL_CXXALIASWARN (dup2);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 # undef dup2
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
346 # if HAVE_RAW_DECL_DUP2
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
347 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
348 "use gnulib module dup2 for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
349 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352
11886
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
353 #if @GNULIB_DUP3@
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
354 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
355 specified flags.
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
356 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
357 and O_TEXT, O_BINARY (defined in "binary-io.h").
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
358 Close NEWFD first if it is open.
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
359 Return newfd if successful, otherwise -1 and errno set.
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
360 See the Linux man page at
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
361 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
11894
6b94c8deb683 Tolerate declared but missing dup3 syscall.
Bruno Haible <bruno@clisp.org>
parents: 11893
diff changeset
362 # if @HAVE_DUP3@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
363 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
364 # define dup3 rpl_dup3
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
365 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
366 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
367 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
368 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
369 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
370 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
11894
6b94c8deb683 Tolerate declared but missing dup3 syscall.
Bruno Haible <bruno@clisp.org>
parents: 11893
diff changeset
371 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
372 _GL_CXXALIASWARN (dup3);
11886
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
373 #elif defined GNULIB_POSIXCHECK
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
374 # undef dup3
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
375 # if HAVE_RAW_DECL_DUP3
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
376 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
377 "use gnulib module dup3 for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
378 # endif
11886
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
379 #endif
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
380
3ac76948db10 New module 'dup3'.
Bruno Haible <bruno@clisp.org>
parents: 11883
diff changeset
381
9721
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
382 #if @GNULIB_ENVIRON@
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
383 # if !@HAVE_DECL_ENVIRON@
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
384 /* Set of environment variables and values. An array of strings of the form
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
385 "VARIABLE=VALUE", terminated with a NULL. */
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
386 # if defined __APPLE__ && defined __MACH__
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
387 # include <crt_externs.h>
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
388 # define environ (*_NSGetEnviron ())
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
389 # else
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
390 # ifdef __cplusplus
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
391 extern "C" {
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
392 # endif
9721
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
393 extern char **environ;
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
394 # ifdef __cplusplus
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
395 }
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
396 # endif
9721
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
397 # endif
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
398 # endif
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
399 #elif defined GNULIB_POSIXCHECK
12725
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
400 # if HAVE_RAW_DECL_ENVIRON
17174
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
401 _GL_UNISTD_INLINE char ***
12725
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
402 rpl_environ (void)
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
403 {
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
404 return &environ;
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
405 }
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
406 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
407 "use gnulib module environ for portability");
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
408 # undef environ
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
409 # define environ (*rpl_environ ())
b6a49a4ae7d7 unistd: warn on use of environ without module
Eric Blake <ebb9@byu.net>
parents: 12613
diff changeset
410 # endif
9721
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
411 #endif
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
412
1d443a80afc4 New module 'environ'.
Bruno Haible <bruno@clisp.org>
parents: 9552
diff changeset
413
10662
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
414 #if @GNULIB_EUIDACCESS@
12142
cc3ba2052ea4 unistd: fix comment typo
Jim Meyering <meyering@redhat.com>
parents: 12123
diff changeset
415 /* Like access(), except that it uses the effective user id and group id of
10662
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
416 the current process. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
417 # if !@HAVE_EUIDACCESS@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
418 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
419 _GL_ARG_NONNULL ((1)));
10662
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
420 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
421 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
422 _GL_CXXALIASWARN (euidaccess);
12919
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
423 # if defined GNULIB_POSIXCHECK
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
424 /* Like access(), this function is a security risk. */
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
425 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
426 "use the gnulib module faccessat instead");
dc644566d7ab Clarify access, euidaccess, faccessat.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
427 # endif
10662
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
428 #elif defined GNULIB_POSIXCHECK
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
429 # undef euidaccess
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
430 # if HAVE_RAW_DECL_EUIDACCESS
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
431 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
432 "use gnulib module euidaccess for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
433 # endif
10662
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
434 #endif
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
435
ad36db29dad7 Move the euidaccess() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10661
diff changeset
436
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
437 #if @GNULIB_FACCESSAT@
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
438 # if !@HAVE_FACCESSAT@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
439 _GL_FUNCDECL_SYS (faccessat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
440 (int fd, char const *file, int mode, int flag)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
441 _GL_ARG_NONNULL ((2)));
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
442 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
443 _GL_CXXALIAS_SYS (faccessat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
444 (int fd, char const *file, int mode, int flag));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
445 _GL_CXXALIASWARN (faccessat);
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
446 #elif defined GNULIB_POSIXCHECK
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
447 # undef faccessat
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
448 # if HAVE_RAW_DECL_FACCESSAT
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
449 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
450 "use gnulib module faccessat for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
451 # endif
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
452 #endif
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
453
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
454
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
455 #if @GNULIB_FCHDIR@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
456 /* Change the process' current working directory to the directory on which
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
457 the given file descriptor is open.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
458 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
459 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
460 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
13125
e3ca987c9a94 fchdir: Fix regression introduced on 2010-03-08.
Bruno Haible <bruno@clisp.org>
parents: 13124
diff changeset
461 # if ! @HAVE_FCHDIR@
e3ca987c9a94 fchdir: Fix regression introduced on 2010-03-08.
Bruno Haible <bruno@clisp.org>
parents: 13124
diff changeset
462 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
463
11933
1ffad224c413 fchdir: use more consistent macro convention
Eric Blake <ebb9@byu.net>
parents: 11932
diff changeset
464 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
465 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
466 _GL_ARG_NONNULL ((2));
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
467 _GL_EXTERN_C void _gl_unregister_fd (int fd);
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
468 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
469 _GL_EXTERN_C const char *_gl_directory_name (int fd);
11933
1ffad224c413 fchdir: use more consistent macro convention
Eric Blake <ebb9@byu.net>
parents: 11932
diff changeset
470
13941
8a75c6738522 fchdir: Add missing declaration on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13926
diff changeset
471 # else
8a75c6738522 fchdir: Add missing declaration on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13926
diff changeset
472 # if !@HAVE_DECL_FCHDIR@
8a75c6738522 fchdir: Add missing declaration on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13926
diff changeset
473 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
8a75c6738522 fchdir: Add missing declaration on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13926
diff changeset
474 # endif
13125
e3ca987c9a94 fchdir: Fix regression introduced on 2010-03-08.
Bruno Haible <bruno@clisp.org>
parents: 13124
diff changeset
475 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
476 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
477 _GL_CXXALIASWARN (fchdir);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
478 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
479 # undef fchdir
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
480 # if HAVE_RAW_DECL_FCHDIR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
481 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
482 "use gnulib module fchdir for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
483 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
484 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
485
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
486
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
487 #if @GNULIB_FCHOWNAT@
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
488 # if @REPLACE_FCHOWNAT@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
489 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
490 # undef fchownat
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
491 # define fchownat rpl_fchownat
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
492 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
493 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
494 uid_t owner, gid_t group, int flag)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
495 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
496 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
497 uid_t owner, gid_t group, int flag));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
498 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
499 # if !@HAVE_FCHOWNAT@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
500 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
501 uid_t owner, gid_t group, int flag)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
502 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
503 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
504 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
505 uid_t owner, gid_t group, int flag));
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
506 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
507 _GL_CXXALIASWARN (fchownat);
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
508 #elif defined GNULIB_POSIXCHECK
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
509 # undef fchownat
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
510 # if HAVE_RAW_DECL_FCHOWNAT
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
511 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
512 "use gnulib module openat for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
513 # endif
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
514 #endif
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
515
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
516
15622
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
517 #if @GNULIB_FDATASYNC@
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
518 /* Synchronize changes to a file.
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
519 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
520 See POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
521 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
15625
eab059ee71cc fdatasync: port to MacOS X 10.7
Eric Blake <eblake@redhat.com>
parents: 15623
diff changeset
522 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
15622
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
523 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
524 # endif
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
525 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
526 _GL_CXXALIASWARN (fdatasync);
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
527 #elif defined GNULIB_POSIXCHECK
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
528 # undef fdatasync
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
529 # if HAVE_RAW_DECL_FDATASYNC
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
530 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
531 "use gnulib module fdatasync for portability");
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
532 # endif
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
533 #endif
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
534
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
535
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
536 #if @GNULIB_FSYNC@
15622
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents: 15520
diff changeset
537 /* Synchronize changes, including metadata, to a file.
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
538 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
539 See POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
540 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
541 # if !@HAVE_FSYNC@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
542 _GL_FUNCDECL_SYS (fsync, int, (int fd));
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
543 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
544 _GL_CXXALIAS_SYS (fsync, int, (int fd));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
545 _GL_CXXALIASWARN (fsync);
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
546 #elif defined GNULIB_POSIXCHECK
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
547 # undef fsync
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
548 # if HAVE_RAW_DECL_FSYNC
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
549 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
550 "use gnulib module fsync for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
551 # endif
10565
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
552 #endif
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
553
6dd4cb5e376f fsync: new module
Richard W.M. Jones <rjones@redhat.com>
parents: 10484
diff changeset
554
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
555 #if @GNULIB_FTRUNCATE@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
556 /* Change the size of the file to which FD is opened to become equal to LENGTH.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
557 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
558 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
559 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
16795
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
560 # if @REPLACE_FTRUNCATE@
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
561 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
562 # undef ftruncate
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
563 # define ftruncate rpl_ftruncate
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
564 # endif
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
565 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
566 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
567 # else
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
568 # if !@HAVE_FTRUNCATE@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
569 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
16795
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
570 # endif
6a9ea5d7b466 Large File Support for native Windows platforms.
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
571 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
572 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
573 _GL_CXXALIASWARN (ftruncate);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
574 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
575 # undef ftruncate
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
576 # if HAVE_RAW_DECL_FTRUNCATE
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
577 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
578 "use gnulib module ftruncate for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
579 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
580 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
581
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
582
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
583 #if @GNULIB_GETCWD@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
584 /* Get the name of the current working directory, and put it in SIZE bytes
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
585 of BUF.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
586 Return BUF if successful, or NULL if the directory couldn't be determined
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
587 or SIZE was too small.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
588 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
589 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
590 Additionally, the gnulib module 'getcwd' guarantees the following GNU
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
591 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
592 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
593 necessary. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
594 # if @REPLACE_GETCWD@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
595 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
596 # define getcwd rpl_getcwd
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
597 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
598 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
599 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
600 # else
13116
c640b8d7b6fc unistd: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13078
diff changeset
601 /* Need to cast, because on mingw, the second parameter is
c640b8d7b6fc unistd: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13078
diff changeset
602 int size. */
c640b8d7b6fc unistd: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13078
diff changeset
603 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
604 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
605 _GL_CXXALIASWARN (getcwd);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
606 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
607 # undef getcwd
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
608 # if HAVE_RAW_DECL_GETCWD
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
609 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
610 "use gnulib module getcwd for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
611 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
612 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
613
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
614
10661
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
615 #if @GNULIB_GETDOMAINNAME@
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
616 /* Return the NIS domain name of the machine.
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
617 WARNING! The NIS domain name is unrelated to the fully qualified host name
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
618 of the machine. It is also unrelated to email addresses.
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
619 WARNING! The NIS domain name is usually the empty string or "(none)" when
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
620 not using NIS.
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
621
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
622 Put up to LEN bytes of the NIS domain name into NAME.
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
623 Null terminate it if the name is shorter than LEN.
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
624 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
625 Return 0 if successful, otherwise set errno and return -1. */
13911
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
626 # if @REPLACE_GETDOMAINNAME@
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
627 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
628 # undef getdomainname
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
629 # define getdomainname rpl_getdomainname
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
630 # endif
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
631 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
632 _GL_ARG_NONNULL ((1)));
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
633 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
634 # else
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
635 # if !@HAVE_DECL_GETDOMAINNAME@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
636 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
637 _GL_ARG_NONNULL ((1)));
13911
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
638 # endif
e6744cae0421 getdomainname: Use the system function when possible.
Bruno Haible <bruno@clisp.org>
parents: 13828
diff changeset
639 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
10661
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
640 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
641 _GL_CXXALIASWARN (getdomainname);
10661
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
642 #elif defined GNULIB_POSIXCHECK
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
643 # undef getdomainname
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
644 # if HAVE_RAW_DECL_GETDOMAINNAME
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
645 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
646 "use gnulib module getdomainname for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
647 # endif
10661
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
648 #endif
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
649
65c9436dc0d3 Move the getdomainname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
650
10582
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
651 #if @GNULIB_GETDTABLESIZE@
11883
729b89da65db Fix getdtablesize() on mingw.
Bruno Haible <bruno@clisp.org>
parents: 11874
diff changeset
652 /* Return the maximum number of file descriptors in the current process.
729b89da65db Fix getdtablesize() on mingw.
Bruno Haible <bruno@clisp.org>
parents: 11874
diff changeset
653 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
654 # if !@HAVE_GETDTABLESIZE@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
655 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
10582
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
656 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
657 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
658 _GL_CXXALIASWARN (getdtablesize);
10582
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
659 #elif defined GNULIB_POSIXCHECK
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
660 # undef getdtablesize
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
661 # if HAVE_RAW_DECL_GETDTABLESIZE
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
662 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
663 "use gnulib module getdtablesize for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
664 # endif
10582
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
665 #endif
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
666
738187526552 New module 'getdtablesize'.
Bruno Haible <bruno@clisp.org>
parents: 10565
diff changeset
667
12279
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
668 #if @GNULIB_GETGROUPS@
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
669 /* Return the supplemental groups that the current process belongs to.
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
670 It is unspecified whether the effective group id is in the list.
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
671 If N is 0, return the group count; otherwise, N describes how many
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
672 entries are available in GROUPS. Return -1 and set errno if N is
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
673 not 0 and not large enough. Fails with ENOSYS on some systems. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
674 # if @REPLACE_GETGROUPS@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
676 # undef getgroups
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
677 # define getgroups rpl_getgroups
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
678 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
679 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
680 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
681 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
682 # if !@HAVE_GETGROUPS@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
683 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
684 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
685 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
12279
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
686 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
687 _GL_CXXALIASWARN (getgroups);
12279
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
688 #elif defined GNULIB_POSIXCHECK
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
689 # undef getgroups
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
690 # if HAVE_RAW_DECL_GETGROUPS
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
691 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
692 "use gnulib module getgroups for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
693 # endif
12279
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
694 #endif
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
695
6a41b8f5f874 getgroups, getugroups: provide stubs for mingw
Eric Blake <ebb9@byu.net>
parents: 12142
diff changeset
696
10692
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
697 #if @GNULIB_GETHOSTNAME@
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
698 /* Return the standard host name of the machine.
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
699 WARNING! The host name may or may not be fully qualified.
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
700
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
701 Put up to LEN bytes of the host name into NAME.
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
702 Null terminate it if the name is shorter than LEN.
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
703 If the host name is longer than LEN, set errno = EINVAL and return -1.
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
704 Return 0 if successful, otherwise set errno and return -1. */
10716
16c473421488 Override the gethostname() declaration on native Windows systems.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
705 # if @UNISTD_H_HAVE_WINSOCK2_H@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
706 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
707 # undef gethostname
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
708 # define gethostname rpl_gethostname
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
709 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
710 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
711 _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
712 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
713 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
714 # if !@HAVE_GETHOSTNAME@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
715 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
716 _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
717 # endif
13950
20b998294d8d Document some different function declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13941
diff changeset
718 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
20b998294d8d Document some different function declarations on OSF/1 5.1.
Bruno Haible <bruno@clisp.org>
parents: 13941
diff changeset
719 parameter is
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
720 int len. */
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
721 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
10716
16c473421488 Override the gethostname() declaration on native Windows systems.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
722 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
723 _GL_CXXALIASWARN (gethostname);
10716
16c473421488 Override the gethostname() declaration on native Windows systems.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
724 #elif @UNISTD_H_HAVE_WINSOCK2_H@
16c473421488 Override the gethostname() declaration on native Windows systems.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
725 # undef gethostname
16c473421488 Override the gethostname() declaration on native Windows systems.
Bruno Haible <bruno@clisp.org>
parents: 10714
diff changeset
726 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
10692
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
727 #elif defined GNULIB_POSIXCHECK
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
728 # undef gethostname
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
729 # if HAVE_RAW_DECL_GETHOSTNAME
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
730 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
731 "use gnulib module gethostname for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
732 # endif
10692
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
733 #endif
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
734
b867b19bccb3 Add gethostname() declaration to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10666
diff changeset
735
12613
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
736 #if @GNULIB_GETLOGIN@
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
737 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
738 returns NULL with errno set.
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
739
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
740 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
741
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
742 Most programs don't need to use this function, because the information is
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
743 available through environment variables:
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
744 ${LOGNAME-$USER} on Unix platforms,
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
745 $USERNAME on native Windows platforms.
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
746 */
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
747 # if !@HAVE_GETLOGIN@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
748 _GL_FUNCDECL_SYS (getlogin, char *, (void));
12613
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
749 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
750 _GL_CXXALIAS_SYS (getlogin, char *, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
751 _GL_CXXALIASWARN (getlogin);
12613
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
752 #elif defined GNULIB_POSIXCHECK
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
753 # undef getlogin
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
754 # if HAVE_RAW_DECL_GETLOGIN
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
755 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
756 "use gnulib module getlogin for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
757 # endif
12613
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
758 #endif
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
759
e61123383caf New module 'getlogin'.
Bruno Haible <bruno@clisp.org>
parents: 12610
diff changeset
760
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
761 #if @GNULIB_GETLOGIN_R@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
762 /* Copies the user's login name to NAME.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
763 The array pointed to by NAME has room for SIZE bytes.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
764
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
765 Returns 0 if successful. Upon error, an error number is returned, or -1 in
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
766 the case that the login name cannot be found but no specific error is
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
767 provided (this case is hopefully rare but is left open by the POSIX spec).
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
768
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
769 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
12610
80d708efef7d getlogin_r: Add comment.
Bruno Haible <bruno@clisp.org>
parents: 12584
diff changeset
770
80d708efef7d getlogin_r: Add comment.
Bruno Haible <bruno@clisp.org>
parents: 12584
diff changeset
771 Most programs don't need to use this function, because the information is
80d708efef7d getlogin_r: Add comment.
Bruno Haible <bruno@clisp.org>
parents: 12584
diff changeset
772 available through environment variables:
80d708efef7d getlogin_r: Add comment.
Bruno Haible <bruno@clisp.org>
parents: 12584
diff changeset
773 ${LOGNAME-$USER} on Unix platforms,
80d708efef7d getlogin_r: Add comment.
Bruno Haible <bruno@clisp.org>
parents: 12584
diff changeset
774 $USERNAME on native Windows platforms.
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
775 */
13999
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
776 # if @REPLACE_GETLOGIN_R@
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
777 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
778 # define getlogin_r rpl_getlogin_r
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
779 # endif
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
780 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
781 _GL_ARG_NONNULL ((1)));
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
782 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
783 # else
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
784 # if !@HAVE_DECL_GETLOGIN_R@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
785 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
786 _GL_ARG_NONNULL ((1)));
13999
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
787 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
788 /* Need to cast, because on Solaris 10 systems, the second argument is
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
789 int size. */
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
790 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
13999
f4f90f0b7167 getlogin_r: Work around portability problem on OSF/1.
Bruno Haible <bruno@clisp.org>
parents: 13967
diff changeset
791 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
792 _GL_CXXALIASWARN (getlogin_r);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
793 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
794 # undef getlogin_r
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
795 # if HAVE_RAW_DECL_GETLOGIN_R
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
796 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
797 "use gnulib module getlogin_r for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
798 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
799 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
800
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
801
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
802 #if @GNULIB_GETPAGESIZE@
9552
6632990b0812 Override getpagesize on mingw.
Martin Lambers <marlam@marlam.de>
parents: 9498
diff changeset
803 # if @REPLACE_GETPAGESIZE@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
804 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
805 # define getpagesize rpl_getpagesize
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
806 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
807 _GL_FUNCDECL_RPL (getpagesize, int, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
808 _GL_CXXALIAS_RPL (getpagesize, int, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
809 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
810 # if !@HAVE_GETPAGESIZE@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
811 # if !defined getpagesize
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
812 /* This is for POSIX systems. */
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
813 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
814 # if ! (defined __VMS && __VMS_VER < 70000000)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
815 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
816 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
817 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
818 /* This is for older VMS. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
819 # if !defined _gl_getpagesize && defined __VMS
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
820 # ifdef __ALPHA
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
821 # define _gl_getpagesize() 8192
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
822 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
823 # define _gl_getpagesize() 512
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
824 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
825 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
826 /* This is for BeOS. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
827 # if !defined _gl_getpagesize && @HAVE_OS_H@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
828 # include <OS.h>
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
829 # if defined B_PAGE_SIZE
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
830 # define _gl_getpagesize() B_PAGE_SIZE
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
831 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
832 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
833 /* This is for AmigaOS4.0. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
834 # if !defined _gl_getpagesize && defined __amigaos4__
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
835 # define _gl_getpagesize() 2048
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
836 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
837 /* This is for older Unix systems. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
838 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
839 # include <sys/param.h>
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
840 # ifdef EXEC_PAGESIZE
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
841 # define _gl_getpagesize() EXEC_PAGESIZE
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
842 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
843 # ifdef NBPG
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
844 # ifndef CLSIZE
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
845 # define CLSIZE 1
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
846 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
847 # define _gl_getpagesize() (NBPG * CLSIZE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
848 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
849 # ifdef NBPC
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
850 # define _gl_getpagesize() NBPC
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
851 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
852 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
853 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
854 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
855 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
856 # define getpagesize() _gl_getpagesize ()
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
857 # else
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
858 # if !GNULIB_defined_getpagesize_function
17174
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
859 _GL_UNISTD_INLINE int
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
860 getpagesize ()
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
861 {
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
862 return _gl_getpagesize ();
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
863 }
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
864 # define GNULIB_defined_getpagesize_function 1
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
865 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
866 # endif
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
867 # endif
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
868 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
869 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
870 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
871 # endif
13124
69f0d92b5794 getpagesize: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13116
diff changeset
872 # if @HAVE_DECL_GETPAGESIZE@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
873 _GL_CXXALIASWARN (getpagesize);
13124
69f0d92b5794 getpagesize: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13116
diff changeset
874 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
875 #elif defined GNULIB_POSIXCHECK
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
876 # undef getpagesize
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
877 # if HAVE_RAW_DECL_GETPAGESIZE
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
878 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
879 "use gnulib module getpagesize for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
880 # endif
9498
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
881 #endif
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
882
a2c450a3023c Move declaration of getpagesize() from getpagesize.h to unistd.h.
Bruno Haible <bruno@clisp.org>
parents: 9271
diff changeset
883
10666
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
884 #if @GNULIB_GETUSERSHELL@
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
885 /* Return the next valid login shell on the system, or NULL when the end of
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
886 the list has been reached. */
13010
23b6d428ea53 getusershell: Provide declaration, missing on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents: 12949
diff changeset
887 # if !@HAVE_DECL_GETUSERSHELL@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
888 _GL_FUNCDECL_SYS (getusershell, char *, (void));
10666
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
889 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
890 _GL_CXXALIAS_SYS (getusershell, char *, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
891 _GL_CXXALIASWARN (getusershell);
10666
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
892 #elif defined GNULIB_POSIXCHECK
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
893 # undef getusershell
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
894 # if HAVE_RAW_DECL_GETUSERSHELL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
895 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
896 "use gnulib module getusershell for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
897 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
898 #endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
899
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
900 #if @GNULIB_GETUSERSHELL@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
901 /* Rewind to pointer that is advanced at each getusershell() call. */
13010
23b6d428ea53 getusershell: Provide declaration, missing on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents: 12949
diff changeset
902 # if !@HAVE_DECL_GETUSERSHELL@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
903 _GL_FUNCDECL_SYS (setusershell, void, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
904 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
905 _GL_CXXALIAS_SYS (setusershell, void, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
906 _GL_CXXALIASWARN (setusershell);
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
907 #elif defined GNULIB_POSIXCHECK
10666
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
908 # undef setusershell
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
909 # if HAVE_RAW_DECL_SETUSERSHELL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
910 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
911 "use gnulib module getusershell for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
912 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
913 #endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
914
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
915 #if @GNULIB_GETUSERSHELL@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
916 /* Free the pointer that is advanced at each getusershell() call and
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
917 associated resources. */
13010
23b6d428ea53 getusershell: Provide declaration, missing on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents: 12949
diff changeset
918 # if !@HAVE_DECL_GETUSERSHELL@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
919 _GL_FUNCDECL_SYS (endusershell, void, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
920 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
921 _GL_CXXALIAS_SYS (endusershell, void, (void));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
922 _GL_CXXALIASWARN (endusershell);
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
923 #elif defined GNULIB_POSIXCHECK
10666
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
924 # undef endusershell
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
925 # if HAVE_RAW_DECL_ENDUSERSHELL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
926 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
927 "use gnulib module getusershell for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
928 # endif
10666
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
929 #endif
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
930
d162e4057aa8 Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 10662
diff changeset
931
14733
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
932 #if @GNULIB_GROUP_MEMBER@
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
933 /* Determine whether group id is in calling user's group list. */
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
934 # if !@HAVE_GROUP_MEMBER@
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
935 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
936 # endif
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
937 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
938 _GL_CXXALIASWARN (group_member);
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
939 #elif defined GNULIB_POSIXCHECK
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
940 # undef group_member
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
941 # if HAVE_RAW_DECL_GROUP_MEMBER
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
942 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
943 "use gnulib module group-member for portability");
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
944 # endif
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
945 #endif
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
946
8d8a6d8151f4 group-member: Declare function in <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents: 14583
diff changeset
947
16209
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
948 #if @GNULIB_ISATTY@
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
949 # if @REPLACE_ISATTY@
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
950 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
951 # undef isatty
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
952 # define isatty rpl_isatty
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
953 # endif
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
954 _GL_FUNCDECL_RPL (isatty, int, (int fd));
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
955 _GL_CXXALIAS_RPL (isatty, int, (int fd));
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
956 # else
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
957 _GL_CXXALIAS_SYS (isatty, int, (int fd));
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
958 # endif
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
959 _GL_CXXALIASWARN (isatty);
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
960 #elif defined GNULIB_POSIXCHECK
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
961 # undef isatty
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
962 # if HAVE_RAW_DECL_ISATTY
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
963 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
964 "use gnulib module isatty for portability");
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
965 # endif
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
966 #endif
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
967
93b0d3ad505e New module 'isatty'.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
968
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
969 #if @GNULIB_LCHOWN@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
970 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
971 to GID (if GID is not -1). Do not follow symbolic links.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
972 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
973 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
974 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
975 # if @REPLACE_LCHOWN@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
976 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
977 # undef lchown
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
978 # define lchown rpl_lchown
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
979 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
980 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
981 _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
982 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
983 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
984 # if !@HAVE_LCHOWN@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
985 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
986 _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
987 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
988 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
989 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
990 _GL_CXXALIASWARN (lchown);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
991 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
992 # undef lchown
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
993 # if HAVE_RAW_DECL_LCHOWN
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
994 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
995 "use gnulib module lchown for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
996 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
997 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
998
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
999
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1000 #if @GNULIB_LINK@
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1001 /* Create a new hard link for an existing file.
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1002 Return 0 if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1003 See POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1004 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1005 # if @REPLACE_LINK@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1006 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1007 # define link rpl_link
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1008 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1009 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1010 _GL_ARG_NONNULL ((1, 2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1011 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1012 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1013 # if !@HAVE_LINK@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1014 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1015 _GL_ARG_NONNULL ((1, 2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1016 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1017 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1018 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1019 _GL_CXXALIASWARN (link);
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1020 #elif defined GNULIB_POSIXCHECK
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1021 # undef link
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1022 # if HAVE_RAW_DECL_LINK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1023 _GL_WARN_ON_USE (link, "link is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1024 "use gnulib module link for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1025 # endif
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1026 #endif
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1027
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1028
12068
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1029 #if @GNULIB_LINKAT@
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1030 /* Create a new hard link for an existing file, relative to two
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1031 directories. FLAG controls whether symlinks are followed.
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1032 Return 0 if successful, otherwise -1 and errno set. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1033 # if @REPLACE_LINKAT@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1034 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1035 # undef linkat
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1036 # define linkat rpl_linkat
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1037 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1038 _GL_FUNCDECL_RPL (linkat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1039 (int fd1, const char *path1, int fd2, const char *path2,
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
1040 int flag)
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1041 _GL_ARG_NONNULL ((2, 4)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1042 _GL_CXXALIAS_RPL (linkat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1043 (int fd1, const char *path1, int fd2, const char *path2,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1044 int flag));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1045 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1046 # if !@HAVE_LINKAT@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1047 _GL_FUNCDECL_SYS (linkat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1048 (int fd1, const char *path1, int fd2, const char *path2,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1049 int flag)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1050 _GL_ARG_NONNULL ((2, 4)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1051 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1052 _GL_CXXALIAS_SYS (linkat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1053 (int fd1, const char *path1, int fd2, const char *path2,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1054 int flag));
12068
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1055 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1056 _GL_CXXALIASWARN (linkat);
12068
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1057 #elif defined GNULIB_POSIXCHECK
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1058 # undef linkat
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1059 # if HAVE_RAW_DECL_LINKAT
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1060 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1061 "use gnulib module linkat for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1062 # endif
12068
14cddb59cb05 linkat: new module
Eric Blake <ebb9@byu.net>
parents: 12058
diff changeset
1063 #endif
11041
894d336e6216 New module 'link'.
Martin Lambers <marlam@marlam.de>
parents: 10891
diff changeset
1064
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1065
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1066 #if @GNULIB_LSEEK@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1067 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1068 Return the new offset if successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1069 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1070 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1071 # if @REPLACE_LSEEK@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1072 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1073 # define lseek rpl_lseek
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1074 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1075 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1076 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1077 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1078 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1079 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1080 _GL_CXXALIASWARN (lseek);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1081 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1082 # undef lseek
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1083 # if HAVE_RAW_DECL_LSEEK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1084 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1085 "systems - use gnulib module lseek for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1086 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1087 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1088
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1089
13923
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1090 #if @GNULIB_PIPE@
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1091 /* Create a pipe, defaulting to O_BINARY mode.
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1092 Store the read-end as fd[0] and the write-end as fd[1].
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1093 Return 0 upon success, or -1 with errno set upon failure. */
13926
b4c4a43e95e4 Oops, fix mistake in last commit.
Bruno Haible <bruno@clisp.org>
parents: 13925
diff changeset
1094 # if !@HAVE_PIPE@
13925
29a686188651 pipe-posix: Make it work in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13923
diff changeset
1095 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
13926
b4c4a43e95e4 Oops, fix mistake in last commit.
Bruno Haible <bruno@clisp.org>
parents: 13925
diff changeset
1096 # endif
13925
29a686188651 pipe-posix: Make it work in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13923
diff changeset
1097 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
29a686188651 pipe-posix: Make it work in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13923
diff changeset
1098 _GL_CXXALIASWARN (pipe);
13923
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1099 #elif defined GNULIB_POSIXCHECK
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1100 # undef pipe
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1101 # if HAVE_RAW_DECL_PIPE
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1102 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
13925
29a686188651 pipe-posix: Make it work in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13923
diff changeset
1103 "use gnulib module pipe-posix for portability");
13923
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1104 # endif
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1105 #endif
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1106
ec0a7deeb2de pipe-posix: new module
Eric Blake <eblake@redhat.com>
parents: 13911
diff changeset
1107
11870
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1108 #if @GNULIB_PIPE2@
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1109 /* Create a pipe, applying the given flags when opening the read-end of the
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1110 pipe and the write-end of the pipe.
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1111 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1112 and O_TEXT, O_BINARY (defined in "binary-io.h").
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1113 Store the read-end as fd[0] and the write-end as fd[1].
11874
dc31add18818 Improve comment about pipe2.
Bruno Haible <bruno@clisp.org>
parents: 11870
diff changeset
1114 Return 0 upon success, or -1 with errno set upon failure.
dc31add18818 Improve comment about pipe2.
Bruno Haible <bruno@clisp.org>
parents: 11870
diff changeset
1115 See also the Linux man page at
dc31add18818 Improve comment about pipe2.
Bruno Haible <bruno@clisp.org>
parents: 11870
diff changeset
1116 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
11893
476cefda5290 Tolerate declared but missing pipe2 syscall.
Bruno Haible <bruno@clisp.org>
parents: 11886
diff changeset
1117 # if @HAVE_PIPE2@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1118 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1119 # define pipe2 rpl_pipe2
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1120 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1121 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1122 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1123 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1124 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1125 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
11893
476cefda5290 Tolerate declared but missing pipe2 syscall.
Bruno Haible <bruno@clisp.org>
parents: 11886
diff changeset
1126 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1127 _GL_CXXALIASWARN (pipe2);
11870
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1128 #elif defined GNULIB_POSIXCHECK
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1129 # undef pipe2
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1130 # if HAVE_RAW_DECL_PIPE2
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1131 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1132 "use gnulib module pipe2 for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1133 # endif
11870
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1134 #endif
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1135
ddd29d8cdded New module 'pipe2'.
Bruno Haible <bruno@clisp.org>
parents: 11832
diff changeset
1136
12355
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1137 #if @GNULIB_PREAD@
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1138 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1139 Return the number of bytes placed into BUF if successful, otherwise
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1140 set errno and return -1. 0 indicates EOF.
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1141 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1142 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1143 # if @REPLACE_PREAD@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1144 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
15281
7be11eb972c2 pread, pwrite: Avoid cc warning on AIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
1145 # undef pread
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1146 # define pread rpl_pread
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1147 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1148 _GL_FUNCDECL_RPL (pread, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1149 (int fd, void *buf, size_t bufsize, off_t offset)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1150 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1151 _GL_CXXALIAS_RPL (pread, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1152 (int fd, void *buf, size_t bufsize, off_t offset));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1153 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1154 # if !@HAVE_PREAD@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1155 _GL_FUNCDECL_SYS (pread, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1156 (int fd, void *buf, size_t bufsize, off_t offset)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1157 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1158 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1159 _GL_CXXALIAS_SYS (pread, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1160 (int fd, void *buf, size_t bufsize, off_t offset));
12355
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1161 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1162 _GL_CXXALIASWARN (pread);
12355
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1163 #elif defined GNULIB_POSIXCHECK
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1164 # undef pread
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1165 # if HAVE_RAW_DECL_PREAD
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1166 _GL_WARN_ON_USE (pread, "pread is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1167 "use gnulib module pread for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1168 # endif
12355
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1169 #endif
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1170
9961377da68e pread: new module
Jim Meyering <meyering@redhat.com>
parents: 12326
diff changeset
1171
13314
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1172 #if @GNULIB_PWRITE@
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1173 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1174 Return the number of bytes written if successful, otherwise
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1175 set errno and return -1. 0 indicates nothing written. See the
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1176 POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1177 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
13314
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1178 # if @REPLACE_PWRITE@
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1179 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
15281
7be11eb972c2 pread, pwrite: Avoid cc warning on AIX.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
1180 # undef pwrite
13314
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1181 # define pwrite rpl_pwrite
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1182 # endif
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1183 _GL_FUNCDECL_RPL (pwrite, ssize_t,
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1184 (int fd, const void *buf, size_t bufsize, off_t offset)
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1185 _GL_ARG_NONNULL ((2)));
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1186 _GL_CXXALIAS_RPL (pwrite, ssize_t,
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1187 (int fd, const void *buf, size_t bufsize, off_t offset));
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1188 # else
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1189 # if !@HAVE_PWRITE@
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1190 _GL_FUNCDECL_SYS (pwrite, ssize_t,
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1191 (int fd, const void *buf, size_t bufsize, off_t offset)
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1192 _GL_ARG_NONNULL ((2)));
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1193 # endif
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1194 _GL_CXXALIAS_SYS (pwrite, ssize_t,
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1195 (int fd, const void *buf, size_t bufsize, off_t offset));
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1196 # endif
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1197 _GL_CXXALIASWARN (pwrite);
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1198 #elif defined GNULIB_POSIXCHECK
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1199 # undef pwrite
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1200 # if HAVE_RAW_DECL_PWRITE
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1201 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1202 "use gnulib module pwrite for portability");
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1203 # endif
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1204 #endif
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1205
d44fde85189e New module pwrite.
Peter O'Gorman <pogma@thewrittenword.com>
parents: 13266
diff changeset
1206
14583
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1207 #if @GNULIB_READ@
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1208 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1209 at BUF. See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1210 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
15763
05e615abe919 read: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15760
diff changeset
1211 # if @REPLACE_READ@
14583
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1212 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1213 # undef read
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1214 # define read rpl_read
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1215 # endif
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1216 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1217 _GL_ARG_NONNULL ((2)));
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1218 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1219 # else
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1220 /* Need to cast, because on mingw, the third parameter is
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1221 unsigned int count
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1222 and the return type is 'int'. */
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1223 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1224 # endif
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1225 _GL_CXXALIASWARN (read);
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1226 #endif
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1227
8b22057e98d2 Support non-blocking pipe I/O in read() on native Windows.
Bruno Haible <bruno@clisp.org>
parents: 14578
diff changeset
1228
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1229 #if @GNULIB_READLINK@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1230 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1231 bytes of it into BUF. Return the number of bytes placed into BUF if
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1232 successful, otherwise -1 and errno set.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1233 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1234 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1235 # if @REPLACE_READLINK@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1236 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1237 # define readlink rpl_readlink
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1238 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1239 _GL_FUNCDECL_RPL (readlink, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1240 (const char *file, char *buf, size_t bufsize)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1241 _GL_ARG_NONNULL ((1, 2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1242 _GL_CXXALIAS_RPL (readlink, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1243 (const char *file, char *buf, size_t bufsize));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1244 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1245 # if !@HAVE_READLINK@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1246 _GL_FUNCDECL_SYS (readlink, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1247 (const char *file, char *buf, size_t bufsize)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1248 _GL_ARG_NONNULL ((1, 2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1249 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1250 _GL_CXXALIAS_SYS (readlink, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1251 (const char *file, char *buf, size_t bufsize));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1252 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1253 _GL_CXXALIASWARN (readlink);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1254 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1255 # undef readlink
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1256 # if HAVE_RAW_DECL_READLINK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1257 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1258 "use gnulib module readlink for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1259 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1260 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1261
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1262
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1263 #if @GNULIB_READLINKAT@
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1264 # if !@HAVE_READLINKAT@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1265 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1266 (int fd, char const *file, char *buf, size_t len)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1267 _GL_ARG_NONNULL ((2, 3)));
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1268 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1269 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1270 (int fd, char const *file, char *buf, size_t len));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1271 _GL_CXXALIASWARN (readlinkat);
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1272 #elif defined GNULIB_POSIXCHECK
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1273 # undef readlinkat
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1274 # if HAVE_RAW_DECL_READLINKAT
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1275 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
13539
56e31af9a41e readlinkat: split into its own module
Eric Blake <eblake@redhat.com>
parents: 13314
diff changeset
1276 "use gnulib module readlinkat for portability");
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1277 # endif
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1278 #endif
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1279
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1280
11993
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1281 #if @GNULIB_RMDIR@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1282 /* Remove the directory DIR. */
11993
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1283 # if @REPLACE_RMDIR@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1285 # define rmdir rpl_rmdir
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1286 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1287 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1288 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1289 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1290 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
11993
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1291 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1292 _GL_CXXALIASWARN (rmdir);
11993
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1293 #elif defined GNULIB_POSIXCHECK
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1294 # undef rmdir
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1295 # if HAVE_RAW_DECL_RMDIR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1296 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1297 "use gnulib module rmdir for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1298 # endif
11993
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1299 #endif
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1300
767d867147de rmdir: work around cygwin 1.5.x and mingw bugs
Eric Blake <ebb9@byu.net>
parents: 11992
diff changeset
1301
16147
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1302 #if @GNULIB_SETHOSTNAME@
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1303 /* Set the host name of the machine.
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1304 The host name may or may not be fully qualified.
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1305
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1306 Put LEN bytes of NAME into the host name.
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1307 Return 0 if successful, otherwise, set errno and return -1.
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1308
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1309 Platforms with no ability to set the hostname return -1 and set
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1310 errno = ENOSYS. */
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1311 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1312 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1313 _GL_ARG_NONNULL ((1)));
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1314 # endif
16935
498a2211d839 Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents: 16795
diff changeset
1315 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
16147
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1316 and FreeBSD 6.4 the second parameter is int. On Solaris 11
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1317 2011-10, the first parameter is not const. */
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1318 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1319 _GL_CXXALIASWARN (sethostname);
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1320 #elif defined GNULIB_POSIXCHECK
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1321 # undef sethostname
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1322 # if HAVE_RAW_DECL_SETHOSTNAME
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1323 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1324 "use gnulib module sethostname for portability");
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1325 # endif
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1326 #endif
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1327
9b09933df0d5 Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 16146
diff changeset
1328
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1329 #if @GNULIB_SLEEP@
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1330 /* Pause the execution of the current thread for N seconds.
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1331 Returns the number of seconds left to sleep.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1332 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1333 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1334 # if @REPLACE_SLEEP@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1335 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1336 # undef sleep
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1337 # define sleep rpl_sleep
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1338 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1339 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1340 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1341 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1342 # if !@HAVE_SLEEP@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1343 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1344 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1345 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1346 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1347 _GL_CXXALIASWARN (sleep);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1348 #elif defined GNULIB_POSIXCHECK
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1349 # undef sleep
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1350 # if HAVE_RAW_DECL_SLEEP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1351 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1352 "use gnulib module sleep for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1353 # endif
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1354 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1355
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1356
12056
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1357 #if @GNULIB_SYMLINK@
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1358 # if @REPLACE_SYMLINK@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1359 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1360 # undef symlink
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1361 # define symlink rpl_symlink
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1362 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1363 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1364 _GL_ARG_NONNULL ((1, 2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1365 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1366 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1367 # if !@HAVE_SYMLINK@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1368 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1369 _GL_ARG_NONNULL ((1, 2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1370 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1371 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
12056
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1372 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1373 _GL_CXXALIASWARN (symlink);
12056
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1374 #elif defined GNULIB_POSIXCHECK
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1375 # undef symlink
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1376 # if HAVE_RAW_DECL_SYMLINK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1377 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1378 "use gnulib module symlink for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1379 # endif
12056
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1380 #endif
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1381
e0c5d88f8c3b symlink: new module, for Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents: 12053
diff changeset
1382
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1383 #if @GNULIB_SYMLINKAT@
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1384 # if !@HAVE_SYMLINKAT@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1385 _GL_FUNCDECL_SYS (symlinkat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1386 (char const *contents, int fd, char const *file)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1387 _GL_ARG_NONNULL ((1, 3)));
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1388 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1389 _GL_CXXALIAS_SYS (symlinkat, int,
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1390 (char const *contents, int fd, char const *file));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1391 _GL_CXXALIASWARN (symlinkat);
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1392 #elif defined GNULIB_POSIXCHECK
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1393 # undef symlinkat
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1394 # if HAVE_RAW_DECL_SYMLINKAT
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1395 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1396 "use gnulib module symlinkat for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1397 # endif
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1398 #endif
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1399
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1400
13023
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1401 #if @GNULIB_TTYNAME_R@
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1402 /* Store at most BUFLEN characters of the pathname of the terminal FD is
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1403 open on in BUF. Return 0 on success, otherwise an error number. */
13266
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1404 # if @REPLACE_TTYNAME_R@
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1405 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1406 # undef ttyname_r
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1407 # define ttyname_r rpl_ttyname_r
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1408 # endif
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1409 _GL_FUNCDECL_RPL (ttyname_r, int,
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1410 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1411 _GL_CXXALIAS_RPL (ttyname_r, int,
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1412 (int fd, char *buf, size_t buflen));
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1413 # else
13967
c0afec342ca5 ttyname_r: Add missing declaration on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 13950
diff changeset
1414 # if !@HAVE_DECL_TTYNAME_R@
13023
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1415 _GL_FUNCDECL_SYS (ttyname_r, int,
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1416 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
13266
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1417 # endif
13023
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1418 _GL_CXXALIAS_SYS (ttyname_r, int,
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1419 (int fd, char *buf, size_t buflen));
13266
ddd7bebf854c ttyname_r: Make it work on MacOS X 10.4 and Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 13196
diff changeset
1420 # endif
13023
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1421 _GL_CXXALIASWARN (ttyname_r);
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1422 #elif defined GNULIB_POSIXCHECK
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1423 # undef ttyname_r
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1424 # if HAVE_RAW_DECL_TTYNAME_R
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1425 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1426 "use gnulib module ttyname_r for portability");
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1427 # endif
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1428 #endif
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1429
953c5d14818b New module 'ttyname_r'.
Bruno Haible <bruno@clisp.org>
parents: 13010
diff changeset
1430
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1431 #if @GNULIB_UNLINK@
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1432 # if @REPLACE_UNLINK@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1433 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1434 # undef unlink
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1435 # define unlink rpl_unlink
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1436 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1437 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1438 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1439 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1440 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1441 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1442 _GL_CXXALIASWARN (unlink);
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1443 #elif defined GNULIB_POSIXCHECK
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1444 # undef unlink
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1445 # if HAVE_RAW_DECL_UNLINK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1446 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1447 "use gnulib module unlink for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1448 # endif
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1449 #endif
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1450
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1451
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1452 #if @GNULIB_UNLINKAT@
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1453 # if @REPLACE_UNLINKAT@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1454 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1455 # undef unlinkat
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1456 # define unlinkat rpl_unlinkat
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1457 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1458 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1459 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1460 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1461 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1462 # if !@HAVE_UNLINKAT@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1463 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1464 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1465 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1466 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1467 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1468 _GL_CXXALIASWARN (unlinkat);
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1469 #elif defined GNULIB_POSIXCHECK
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1470 # undef unlinkat
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1471 # if HAVE_RAW_DECL_UNLINKAT
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1472 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1473 "use gnulib module openat for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1474 # endif
12053
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1475 #endif
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1476
c86af738f753 unistd: sort replacement declarations
Eric Blake <ebb9@byu.net>
parents: 12045
diff changeset
1477
12315
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1478 #if @GNULIB_USLEEP@
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1479 /* Pause the execution of the current thread for N microseconds.
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1480 Returns 0 on completion, or -1 on range error.
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1481 See the POSIX:2001 specification
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1482 <http://www.opengroup.org/susv3xsh/usleep.html>. */
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1483 # if @REPLACE_USLEEP@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1484 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1485 # undef usleep
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1486 # define usleep rpl_usleep
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1487 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1488 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1489 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1490 # else
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1491 # if !@HAVE_USLEEP@
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1492 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1493 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1494 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
12315
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1495 # endif
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1496 _GL_CXXALIASWARN (usleep);
12315
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1497 #elif defined GNULIB_POSIXCHECK
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1498 # undef usleep
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1499 # if HAVE_RAW_DECL_USLEEP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1500 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1501 "use gnulib module usleep for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12725
diff changeset
1502 # endif
12315
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1503 #endif
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1504
8cb02ee162a1 usleep: new module
Eric Blake <ebb9@byu.net>
parents: 12290
diff changeset
1505
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1506 #if @GNULIB_WRITE@
10484
b763245277c9 New module 'write'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
1507 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
15623
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1508 See the POSIX:2008 specification
1add0c3b0f4b unistd: update refs to newer POSIX
Eric Blake <eblake@redhat.com>
parents: 15622
diff changeset
1509 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
15769
8b34c7785c75 write: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15763
diff changeset
1510 # if @REPLACE_WRITE@
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1511 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1512 # undef write
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1513 # define write rpl_write
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1514 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1515 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1516 _GL_ARG_NONNULL ((2)));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1517 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1518 # else
13196
670e389ef70e write: Fix a C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13125
diff changeset
1519 /* Need to cast, because on mingw, the third parameter is
670e389ef70e write: Fix a C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13125
diff changeset
1520 unsigned int count
670e389ef70e write: Fix a C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13125
diff changeset
1521 and the return type is 'int'. */
670e389ef70e write: Fix a C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13125
diff changeset
1522 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
12949
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1523 # endif
a30dc7c28962 unistd: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12919
diff changeset
1524 _GL_CXXALIASWARN (write);
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1525 #endif
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1526
17174
263910906d80 unistd: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
1527 _GL_INLINE_HEADER_END
9271
56962d28d442 Rename unistd_.h to unistd.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1528
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14733
diff changeset
1529 #endif /* _@GUARD_PREFIX@_UNISTD_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14733
diff changeset
1530 #endif /* _@GUARD_PREFIX@_UNISTD_H */