aboutsummaryrefslogtreecommitdiff
path: root/soong/linux_glibc/unistd.h
diff options
context:
space:
mode:
Diffstat (limited to 'soong/linux_glibc/unistd.h')
-rw-r--r--soong/linux_glibc/unistd.h1105
1 files changed, 984 insertions, 121 deletions
diff --git a/soong/linux_glibc/unistd.h b/soong/linux_glibc/unistd.h
index a654b30..1b60a27 100644
--- a/soong/linux_glibc/unistd.h
+++ b/soong/linux_glibc/unistd.h
@@ -1,6 +1,6 @@
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Substitute for and wrapper around <unistd.h>.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
#ifndef _GL_M4_UNISTD_H
@@ -22,7 +22,7 @@
#endif
-#ifdef _GL_INCLUDING_UNISTD_H
+#if 1 && defined _GL_INCLUDING_UNISTD_H
/* Special invocation convention:
- On Mac OS X 10.3.9 we have a sequence of nested includes
<unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h>
@@ -53,7 +53,10 @@
#define _GL_M4_UNISTD_H
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
-#include <stddef.h>
+/* But avoid namespace pollution on glibc systems. */
+#ifndef __GLIBC__
+# include <stddef.h>
+#endif
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
/* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include
@@ -62,16 +65,18 @@
/* But avoid namespace pollution on glibc systems. */
#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
|| ((0 || defined GNULIB_POSIXCHECK) \
- && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) \
+ && (defined _WIN32 && ! defined __CYGWIN__)) \
|| ((0 || defined GNULIB_POSIXCHECK) \
&& defined __CYGWIN__)) \
&& ! defined __GLIBC__
# include <stdio.h>
#endif
-/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
+/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
+ <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
-#if (0 || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
+#if (0 || defined GNULIB_POSIXCHECK) \
+ && (defined __CYGWIN__ || defined __ANDROID__) \
&& ! defined __GLIBC__
# include <fcntl.h>
#endif
@@ -89,20 +94,18 @@
# undef __need_system_stdlib_h
#endif
-/* Native Windows platforms declare chdir, getcwd, rmdir in
+/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
<io.h> and/or <direct.h>, not in <unistd.h>.
- They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
- lseek(), read(), unlink(), write() in <io.h>. */
-#if ((1 || IN_M4_GNULIB_TESTS || 1 \
- || defined GNULIB_POSIXCHECK) \
- && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-# include <io.h> /* mingw32, mingw64 */
-# include <direct.h> /* mingw64, MSVC 9 */
-#elif (1 || IN_M4_GNULIB_TESTS || 1 || 0 \
- || 1 || 0 || 0 || IN_M4_GNULIB_TESTS \
- || defined GNULIB_POSIXCHECK) \
- && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+ They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
+ _lseek(), _read(), _unlink(), _write() in <io.h>. */
+#if defined _WIN32 && !defined __CYGWIN__
# include <io.h>
+# include <direct.h>
+#endif
+
+/* Native Windows platforms declare _execl*, _execv* in <process.h>. */
+#if defined _WIN32 && !defined __CYGWIN__
+# include <process.h>
#endif
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
@@ -114,36 +117,46 @@
# include <netdb.h>
#endif
-/* MSVC defines off_t in <sys/types.h>.
- May also define off_t to a 64-bit type on native Windows. */
-#if !1 || 0
-/* Get off_t. */
-# include <sys/types.h>
-#endif
-
-#if (0 || IN_M4_GNULIB_TESTS \
- || 1 || 0 \
- || 0 || 0 || defined GNULIB_POSIXCHECK)
-/* Get ssize_t. */
-# include <sys/types.h>
+/* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
+ <sys/random.h>, not in <unistd.h>. */
+/* But avoid namespace pollution on glibc systems. */
+#if (0 || defined GNULIB_POSIXCHECK) \
+ && ((defined __APPLE__ && defined __MACH__) || defined __sun \
+ || defined __ANDROID__) \
+ && 0 \
+ && !defined __GLIBC__
+# include <sys/random.h>
#endif
-/* Get getopt(), optarg, optind, opterr, optopt.
- But avoid namespace pollution on glibc systems. */
-#if 0 && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
-# define __need_getopt
-# include <getopt.h>
+/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
+/* But avoid namespace pollution on glibc systems. */
+#if (0 || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+ && !defined __GLIBC__
+# include <sys/stat.h>
#endif
-#ifndef _GL_INLINE_HEADER_BEGIN
- #error "Please include config.h first."
-#endif
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_UNISTD_INLINE
-# define _GL_UNISTD_INLINE _GL_INLINE
-#endif
+/* MSVC defines off_t in <sys/types.h>.
+ May also define off_t to a 64-bit type on native Windows. */
+/* Get off_t, ssize_t, mode_t. */
+#include <sys/types.h>
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+/* C++ compatible function declaration macros.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
#ifndef _GL_CXXDEFS_H
#define _GL_CXXDEFS_H
@@ -276,6 +289,16 @@ _GL_INLINE_HEADER_BEGIN
_GL_EXTERN_C int _gl_cxxalias_dummy
#endif
+/* _GL_CXXALIAS_MDA (func, rettype, parameters);
+ is to be used when func is a Microsoft deprecated alias, on native Windows.
+ It declares a C++ alias called GNULIB_NAMESPACE::func
+ that redirects to _func, if GNULIB_NAMESPACE is defined.
+ Example:
+ _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
+ _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
+
/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
except that the C function rpl_func may have a slightly different
@@ -301,6 +324,14 @@ _GL_INLINE_HEADER_BEGIN
_GL_EXTERN_C int _gl_cxxalias_dummy
#endif
+/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
+ is like _GL_CXXALIAS_MDA (func, rettype, parameters);
+ except that the C function func may have a slightly different declaration.
+ A cast is used to silence the "invalid conversion" error that would
+ otherwise occur. */
+#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
+ _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
+
/* _GL_CXXALIAS_SYS (func, rettype, parameters);
declares a C++ alias called GNULIB_NAMESPACE::func
that redirects to the system provided function func, if GNULIB_NAMESPACE
@@ -396,9 +427,9 @@ _GL_INLINE_HEADER_BEGIN
_GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
# define _GL_CXXALIASWARN_1(func,namespace) \
_GL_CXXALIASWARN_2 (func, namespace)
-/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
we enable the warning only when not optimizing. */
-# if !__OPTIMIZE__
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
# define _GL_CXXALIASWARN_2(func,namespace) \
_GL_WARN_ON_USE (func, \
"The symbol ::" #func " refers to the system function. " \
@@ -424,16 +455,13 @@ _GL_INLINE_HEADER_BEGIN
GNULIB_NAMESPACE)
# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
_GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
-/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
we enable the warning only when not optimizing. */
-# if !__OPTIMIZE__
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
- _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
+ _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
"The symbol ::" #func " refers to the system function. " \
"Use " #namespace "::" #func " instead.")
-# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
-# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
- extern __typeof__ (func) func
# else
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
_GL_EXTERN_C int _gl_cxxalias_dummy
@@ -446,11 +474,27 @@ _GL_INLINE_HEADER_BEGIN
#endif /* _GL_CXXDEFS_H */
/* The definition of _GL_ARG_NONNULL is copied here. */
+/* A C macro for declaring that specific arguments must not be NULL.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
that the values passed as arguments n, ..., m must be non-NULL pointers.
n = 1 stands for the first argument, n = 2 for the second argument etc. */
#ifndef _GL_ARG_NONNULL
-# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
# else
# define _GL_ARG_NONNULL(params)
@@ -458,40 +502,143 @@ _GL_INLINE_HEADER_BEGIN
#endif
/* The definition of _GL_WARN_ON_USE is copied here. */
+/* A C macro for emitting warnings if a function is used.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
+ for FUNCTION which will then trigger a compiler warning containing
+ the text of "literal string" anywhere that function is called, if
+ supported by the compiler. If the compiler does not support this
+ feature, the macro expands to an unused extern declaration.
+
+ _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
+ attribute used in _GL_WARN_ON_USE. If the compiler does not support
+ this feature, it expands to empty.
+
+ These macros are useful for marking a function as a potential
+ portability trap, with the intent that "literal string" include
+ instructions on the replacement function that should be used
+ instead.
+ _GL_WARN_ON_USE is for functions with 'extern' linkage.
+ _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
+ linkage.
+
+ However, one of the reasons that a function is a portability trap is
+ if it has the wrong signature. Declaring FUNCTION with a different
+ signature in C is a compilation error, so this macro must use the
+ same type as any existing declaration so that programs that avoid
+ the problematic FUNCTION do not fail to compile merely because they
+ included a header that poisoned the function. But this implies that
+ _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
+ have a declaration. Use of this macro implies that there must not
+ be any other macro hiding the declaration of FUNCTION; but
+ undefining FUNCTION first is part of the poisoning process anyway
+ (although for symbols that are provided only via a macro, the result
+ is a compilation error rather than a warning containing
+ "literal string"). Also note that in C++, it is only safe to use if
+ FUNCTION has no overloads.
+
+ For an example, it is possible to poison 'getline' by:
+ - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+ [getline]) in configure.ac, which potentially defines
+ HAVE_RAW_DECL_GETLINE
+ - adding this code to a header that wraps the system <stdio.h>:
+ #undef getline
+ #if HAVE_RAW_DECL_GETLINE
+ _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+ "not universally present; use the gnulib module getline");
+ #endif
+
+ It is not possible to directly poison global variables. But it is
+ possible to write a wrapper accessor function, and poison that
+ (less common usage, like &environ, will cause a compilation error
+ rather than issue the nice warning, but the end result of informing
+ the developer about their portability problem is still achieved):
+ #if HAVE_RAW_DECL_ENVIRON
+ static char ***
+ rpl_environ (void) { return &environ; }
+ _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+ # undef environ
+ # define environ (*rpl_environ ())
+ #endif
+ or better (avoiding contradictory use of 'static' and 'extern'):
+ #if HAVE_RAW_DECL_ENVIRON
+ static char ***
+ _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
+ rpl_environ (void) { return &environ; }
+ # undef environ
+ # define environ (*rpl_environ ())
+ #endif
+ */
#ifndef _GL_WARN_ON_USE
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
/* A compiler attribute is available in gcc versions 4.3.0 and later. */
# define _GL_WARN_ON_USE(function, message) \
extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
+# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
+ __attribute__ ((__warning__ (message)))
+# elif __clang_major__ >= 4
+/* Another compiler attribute is available in clang. */
+# define _GL_WARN_ON_USE(function, message) \
+extern __typeof__ (function) function \
+ __attribute__ ((__diagnose_if__ (1, message, "warning")))
+# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
+ __attribute__ ((__diagnose_if__ (1, message, "warning")))
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
/* Verify the existence of the function. */
# define _GL_WARN_ON_USE(function, message) \
extern __typeof__ (function) function
+# define _GL_WARN_ON_USE_ATTRIBUTE(message)
# else /* Unsupported. */
# define _GL_WARN_ON_USE(function, message) \
_GL_WARN_EXTERN_C int _gl_warn_on_use
+# define _GL_WARN_ON_USE_ATTRIBUTE(message)
# endif
#endif
-/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
- is like _GL_WARN_ON_USE (function, "string"), except that the function is
- declared with the given prototype, consisting of return type, parameters,
- and attributes.
+/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
+ is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
+ function is declared with the given prototype, consisting of return type,
+ parameters, and attributes.
This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
not work in this case. */
#ifndef _GL_WARN_ON_USE_CXX
-# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
-# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
-extern rettype function parameters_and_attributes \
- __attribute__ ((__warning__ (msg)))
-# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+# if !defined __cplusplus
+# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+ _GL_WARN_ON_USE (function, msg)
+# else
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later. */
+# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_gcc function parameters_and_attributes \
+ __attribute__ ((__warning__ (msg)))
+# elif __clang_major__ >= 4
+/* Another compiler attribute is available in clang. */
+# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_clang function parameters_and_attributes \
+ __attribute__ ((__diagnose_if__ (1, msg, "warning")))
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
/* Verify the existence of the function. */
-# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
-extern rettype function parameters_and_attributes
-# else /* Unsupported. */
-# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_gcc function parameters_and_attributes
+# else /* Unsupported. */
+# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
_GL_WARN_EXTERN_C int _gl_warn_on_use
+# endif
# endif
#endif
@@ -506,6 +653,20 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
#endif
+/* Get getopt(), optarg, optind, opterr, optopt. */
+#if 1 && 0 && !defined _GL_SYSTEM_GETOPT
+# include <getopt-cdefs.h>
+# include <getopt-pfx-core.h>
+#endif
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_UNISTD_INLINE
+# define _GL_UNISTD_INLINE _GL_INLINE
+#endif
+
/* Hide some function declarations from <winsock2.h>. */
#if 0 && 0
@@ -605,15 +766,61 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
/* Declare overridden functions. */
-#if defined GNULIB_POSIXCHECK
+#if 1
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef access
+# define access rpl_access
+# endif
+_GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef access
+# define access _access
+# endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
+# else
+_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
+# endif
+_GL_CXXALIASWARN (access);
+#elif defined GNULIB_POSIXCHECK
+# undef access
+# if HAVE_RAW_DECL_ACCESS
/* The access() function is a security risk. */
-_GL_WARN_ON_USE (access, "the access function is a security risk - "
+_GL_WARN_ON_USE (access, "access does not always support X_OK - "
+ "use gnulib module access for portability; "
+ "also, this function is a security risk - "
"use the gnulib module faccessat instead");
+# endif
+#elif 1
+/* On native Windows, map 'access' to '_access', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::access always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef access
+# define access _access
+# endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
+# else
+_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
+# endif
+_GL_CXXALIASWARN (access);
#endif
#if 1
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef chdir
+# define chdir _chdir
+# endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
_GL_CXXALIASWARN (chdir);
#elif defined GNULIB_POSIXCHECK
# undef chdir
@@ -621,6 +828,20 @@ _GL_CXXALIASWARN (chdir);
_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
"use gnulib module chdir for portability");
# endif
+#elif 1
+/* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::chdir always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef chdir
+# define chdir _chdir
+# endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
+_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIASWARN (chdir);
#endif
@@ -629,7 +850,7 @@ _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
to GID (if GID is not -1). Follow symbolic links.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef chown
@@ -665,6 +886,12 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
# endif
_GL_FUNCDECL_RPL (close, int, (int fd));
_GL_CXXALIAS_RPL (close, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef close
+# define close _close
+# endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
# else
_GL_CXXALIAS_SYS (close, int, (int fd));
# endif
@@ -677,16 +904,55 @@ _GL_CXXALIASWARN (close);
/* Assume close is always declared. */
_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
"use gnulib module close for portability");
+#elif 1
+/* On native Windows, map 'close' to '_close', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::close always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef close
+# define close _close
+# endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (close, int, (int fd));
+# endif
+_GL_CXXALIASWARN (close);
#endif
-#if IN_M4_GNULIB_TESTS
+#if 0
+# if !1
+_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
+ int ofd, off_t *opos,
+ size_t len, unsigned flags));
+_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
+ int ofd, off_t *opos,
+ size_t len, unsigned flags));
+# endif
+_GL_CXXALIASWARN (copy_file_range);
+#elif defined GNULIB_POSIXCHECK
+# if HAVE_RAW_DECL_COPY_FILE_RANGE
+_GL_WARN_ON_USE (copy_file_range,
+ "copy_file_range is unportable - "
+ "use gnulib module copy_file_range for portability");
+# endif
+#endif
+
+
+#if 1
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dup rpl_dup
# endif
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef dup
+# define dup _dup
+# endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
# else
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
# endif
@@ -697,6 +963,20 @@ _GL_CXXALIASWARN (dup);
_GL_WARN_ON_USE (dup, "dup is unportable - "
"use gnulib module dup for portability");
# endif
+#elif 1
+/* On native Windows, map 'dup' to '_dup', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::dup always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef dup
+# define dup _dup
+# endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
+# else
+_GL_CXXALIAS_SYS (dup, int, (int oldfd));
+# endif
+_GL_CXXALIASWARN (dup);
#endif
@@ -705,17 +985,20 @@ _GL_WARN_ON_USE (dup, "dup is unportable - "
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
Return newfd if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dup2 rpl_dup2
# endif
_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
-# else
-# if !1
-_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef dup2
+# define dup2 _dup2
# endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
+# else
_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
# endif
_GL_CXXALIASWARN (dup2);
@@ -725,6 +1008,20 @@ _GL_CXXALIASWARN (dup2);
_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
"use gnulib module dup2 for portability");
# endif
+#elif 1
+/* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::dup2 always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef dup2
+# define dup2 _dup2
+# endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
+# else
+_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
+# endif
+_GL_CXXALIASWARN (dup2);
#endif
@@ -736,7 +1033,7 @@ _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
Close NEWFD first if it is open.
Return newfd if successful, otherwise -1 and errno set.
See the Linux man page at
- <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
+ <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
# if 1
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dup3 rpl_dup3
@@ -758,6 +1055,13 @@ _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
#if 1
+# if defined __CYGWIN__ && !defined __i386__
+/* The 'environ' variable is defined in a DLL. Therefore its declaration needs
+ the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
+ This leads to a link error on 64-bit Cygwin when the option
+ -Wl,--disable-auto-import is in use. */
+_GL_EXTERN_C __declspec(dllimport) char **environ;
+# endif
# if !1
/* Set of environment variables and values. An array of strings of the form
"VARIABLE=VALUE", terminated with a NULL. */
@@ -783,12 +1087,12 @@ extern char **environ;
#elif defined GNULIB_POSIXCHECK
# if HAVE_RAW_DECL_ENVIRON
_GL_UNISTD_INLINE char ***
+_GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
+ "use gnulib module environ for portability")
rpl_environ (void)
{
return &environ;
}
-_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
- "use gnulib module environ for portability");
# undef environ
# define environ (*rpl_environ ())
# endif
@@ -819,13 +1123,301 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
#if 0
-# if !1
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execl
+# define execl rpl_execl
+# endif
+_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execl);
+#elif defined GNULIB_POSIXCHECK
+# undef execl
+# if HAVE_RAW_DECL_EXECL
+_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
+ "use gnulib module execl for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execl' to '_execl', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execl always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execl
+# define execl _execl
+# endif
+_GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execl);
+#endif
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execle
+# define execle rpl_execle
+# endif
+_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execle);
+#elif defined GNULIB_POSIXCHECK
+# undef execle
+# if HAVE_RAW_DECL_EXECLE
+_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
+ "use gnulib module execle for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execle' to '_execle', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execle always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execle
+# define execle _execle
+# endif
+_GL_CXXALIAS_MDA (execle, intptr_t,
+ (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execle);
+#endif
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execlp
+# define execlp rpl_execlp
+# endif
+_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execlp);
+#elif defined GNULIB_POSIXCHECK
+# undef execlp
+# if HAVE_RAW_DECL_EXECLP
+_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
+ "use gnulib module execlp for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execlp always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execlp
+# define execlp _execlp
+# endif
+_GL_CXXALIAS_MDA (execlp, intptr_t,
+ (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execlp);
+#endif
+
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execv
+# define execv rpl_execv
+# endif
+_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execv);
+#elif defined GNULIB_POSIXCHECK
+# undef execv
+# if HAVE_RAW_DECL_EXECV
+_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
+ "use gnulib module execv for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execv' to '_execv', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execv always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execv
+# define execv _execv
+# endif
+_GL_CXXALIAS_MDA_CAST (execv, intptr_t,
+ (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execv);
+#endif
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execve
+# define execve rpl_execve
+# endif
+_GL_FUNCDECL_RPL (execve, int,
+ (const char *program, char * const *argv, char * const *env)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execve, int,
+ (const char *program, char * const *argv, char * const *env));
+# else
+_GL_CXXALIAS_SYS (execve, int,
+ (const char *program, char * const *argv, char * const *env));
+# endif
+_GL_CXXALIASWARN (execve);
+#elif defined GNULIB_POSIXCHECK
+# undef execve
+# if HAVE_RAW_DECL_EXECVE
+_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
+ "use gnulib module execve for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execve' to '_execve', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execve always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execve
+# define execve _execve
+# endif
+_GL_CXXALIAS_MDA_CAST (execve, intptr_t,
+ (const char *program, char * const *argv,
+ char * const *env));
+# else
+_GL_CXXALIAS_SYS (execve, int,
+ (const char *program, char * const *argv, char * const *env));
+# endif
+_GL_CXXALIASWARN (execve);
+#endif
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execvp
+# define execvp rpl_execvp
+# endif
+_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execvp);
+#elif defined GNULIB_POSIXCHECK
+# undef execvp
+# if HAVE_RAW_DECL_EXECVP
+_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
+ "use gnulib module execvp for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execvp always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execvp
+# define execvp _execvp
+# endif
+_GL_CXXALIAS_MDA_CAST (execvp, intptr_t,
+ (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execvp);
+#endif
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execvpe
+# define execvpe rpl_execvpe
+# endif
+_GL_FUNCDECL_RPL (execvpe, int,
+ (const char *program, char * const *argv, char * const *env)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execvpe, int,
+ (const char *program, char * const *argv, char * const *env));
+# else
+# if !1
+_GL_FUNCDECL_SYS (execvpe, int,
+ (const char *program, char * const *argv, char * const *env)
+ _GL_ARG_NONNULL ((1, 2)));
+# endif
+_GL_CXXALIAS_SYS (execvpe, int,
+ (const char *program, char * const *argv, char * const *env));
+# endif
+_GL_CXXALIASWARN (execvpe);
+#elif defined GNULIB_POSIXCHECK
+# undef execvpe
+# if HAVE_RAW_DECL_EXECVPE
+_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
+ "use gnulib module execvpe for portability");
+# endif
+#elif 1
+/* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
+ it. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef execvpe
+# define execvpe _execvpe
+# endif
+_GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
+ (const char *program, char * const *argv,
+ char * const *env));
+# elif 1
+# if !1
+_GL_FUNCDECL_SYS (execvpe, int,
+ (const char *program, char * const *argv, char * const *env)
+ _GL_ARG_NONNULL ((1, 2)));
+# endif
+_GL_CXXALIAS_SYS (execvpe, int,
+ (const char *program, char * const *argv, char * const *env));
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || 1
+_GL_CXXALIASWARN (execvpe);
+# endif
+#endif
+
+
+#if 0
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef faccessat
+# define faccessat rpl_faccessat
+# endif
+_GL_FUNCDECL_RPL (faccessat, int,
+ (int fd, char const *name, int mode, int flag)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (faccessat, int,
+ (int fd, char const *name, int mode, int flag));
+# else
+# if !1
_GL_FUNCDECL_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag)
_GL_ARG_NONNULL ((2)));
-# endif
+# endif
_GL_CXXALIAS_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag));
+# endif
_GL_CXXALIASWARN (faccessat);
#elif defined GNULIB_POSIXCHECK
# undef faccessat
@@ -836,12 +1428,12 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
#endif
-#if 0
+#if 1
/* Change the process' current working directory to the directory on which
the given file descriptor is open.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
# if ! 1
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
@@ -893,7 +1485,7 @@ _GL_CXXALIASWARN (fchownat);
# undef fchownat
# if HAVE_RAW_DECL_FCHOWNAT
_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
- "use gnulib module openat for portability");
+ "use gnulib module fchownat for portability");
# endif
#endif
@@ -902,7 +1494,7 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
/* Synchronize changes to a file.
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
# if !1 || !1
_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
# endif
@@ -921,7 +1513,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
/* Synchronize changes, including metadata, to a file.
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
# if !1
_GL_FUNCDECL_SYS (fsync, int, (int fd));
# endif
@@ -936,11 +1528,11 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
#endif
-#if 0
+#if IN_M4_GNULIB_TESTS
/* Change the size of the file to which FD is opened to become equal to LENGTH.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef ftruncate
@@ -964,13 +1556,13 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
#endif
-#if IN_M4_GNULIB_TESTS
+#if 1
/* Get the name of the current working directory, and put it in SIZE bytes
of BUF.
Return BUF if successful, or NULL if the directory couldn't be determined
or SIZE was too small.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
Additionally, the gnulib module 'getcwd' guarantees the following GNU
extension: If BUF is NULL, an array is allocated with 'malloc'; the array
is SIZE bytes long, unless SIZE == 0, in which case it is as big as
@@ -981,6 +1573,12 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
# endif
_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getcwd
+# define getcwd _getcwd
+# endif
+_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
# else
/* Need to cast, because on mingw, the second parameter is
int size. */
@@ -993,6 +1591,22 @@ _GL_CXXALIASWARN (getcwd);
_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
"use gnulib module getcwd for portability");
# endif
+#elif 1
+/* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::getcwd always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getcwd
+# define getcwd _getcwd
+# endif
+/* Need to cast, because on mingw, the second parameter is either
+ 'int size' or 'size_t size'. */
+_GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
+# else
+_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
+# endif
+_GL_CXXALIASWARN (getcwd);
#endif
@@ -1046,7 +1660,9 @@ _GL_CXXALIAS_RPL (getdtablesize, int, (void));
# if !1
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
# endif
-_GL_CXXALIAS_SYS (getdtablesize, int, (void));
+/* Need to cast, because on AIX, the parameter list is
+ (...). */
+_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
# endif
_GL_CXXALIASWARN (getdtablesize);
#elif defined GNULIB_POSIXCHECK
@@ -1059,6 +1675,22 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
#if 0
+/* Fill a buffer with random bytes. */
+# if !1
+_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
+# endif
+_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
+_GL_CXXALIASWARN (getentropy);
+#elif defined GNULIB_POSIXCHECK
+# undef getentropy
+# if HAVE_RAW_DECL_GETENTROPY
+_GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
+ "use gnulib module getentropy for portability");
+# endif
+#endif
+
+
+#if 0
/* Return the supplemental groups that the current process belongs to.
It is unspecified whether the effective group id is in the list.
If N is 0, return the group count; otherwise, N describes how many
@@ -1130,7 +1762,7 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
/* Returns the user's login name, or NULL if it cannot be found. Upon error,
returns NULL with errno set.
- See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+ See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
Most programs don't need to use this function, because the information is
available through environment variables:
@@ -1159,7 +1791,7 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
the case that the login name cannot be found but no specific error is
provided (this case is hopefully rare but is left open by the POSIX spec).
- See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+ See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
Most programs don't need to use this function, because the information is
available through environment variables:
@@ -1192,7 +1824,7 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
#endif
-#if IN_M4_GNULIB_TESTS
+#if 1
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define getpagesize rpl_getpagesize
@@ -1200,6 +1832,11 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
_GL_FUNCDECL_RPL (getpagesize, int, (void));
_GL_CXXALIAS_RPL (getpagesize, int, (void));
# else
+/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
+ the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
+# if defined __hpux
+_GL_FUNCDECL_SYS (getpagesize, int, (void));
+# endif
# if !1
# if !defined getpagesize
/* This is for POSIX systems. */
@@ -1275,6 +1912,53 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
#if 0
+/* Function getpass() from module 'getpass':
+ Read a password from /dev/tty or stdin.
+ Function getpass() from module 'getpass-gnu':
+ Read a password of arbitrary length from /dev/tty or stdin. */
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getpass
+# define getpass rpl_getpass
+# endif
+_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
+# else
+# if !1
+_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
+ _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
+# endif
+_GL_CXXALIASWARN (getpass);
+#elif defined GNULIB_POSIXCHECK
+# undef getpass
+# if HAVE_RAW_DECL_GETPASS
+_GL_WARN_ON_USE (getpass, "getpass is unportable - "
+ "use gnulib module getpass or getpass-gnu for portability");
+# endif
+#endif
+
+
+#if 1
+/* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::getpid always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getpid
+# define getpid _getpid
+# endif
+_GL_CXXALIAS_MDA (getpid, int, (void));
+# else
+_GL_CXXALIAS_SYS (getpid, pid_t, (void));
+# endif
+_GL_CXXALIASWARN (getpid);
+#endif
+
+
+#if 0
/* Return the next valid login shell on the system, or NULL when the end of
the list has been reached. */
# if !1
@@ -1346,6 +2030,12 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
# endif
_GL_FUNCDECL_RPL (isatty, int, (int fd));
_GL_CXXALIAS_RPL (isatty, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef isatty
+# define isatty _isatty
+# endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
# else
_GL_CXXALIAS_SYS (isatty, int, (int fd));
# endif
@@ -1356,6 +2046,20 @@ _GL_CXXALIASWARN (isatty);
_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
"use gnulib module isatty for portability");
# endif
+#elif 1
+/* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::isatty always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef isatty
+# define isatty _isatty
+# endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
#endif
@@ -1364,7 +2068,7 @@ _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
to GID (if GID is not -1). Do not follow symbolic links.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef lchown
@@ -1394,7 +2098,7 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
/* Create a new hard link for an existing file.
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define link rpl_link
@@ -1460,13 +2164,19 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
Return the new offset if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lseek rpl_lseek
# endif
_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef lseek
+# define lseek _lseek
+# endif
+_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
# else
_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
# endif
@@ -1477,10 +2187,24 @@ _GL_CXXALIASWARN (lseek);
_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
"systems - use gnulib module lseek for portability");
# endif
+#elif 1
+/* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::lseek always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef lseek
+# define lseek _lseek
+# endif
+_GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
+# else
+_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (lseek);
#endif
-#if 0
+#if 1
/* Create a pipe, defaulting to O_BINARY mode.
Store the read-end as fd[0] and the write-end as fd[1].
Return 0 upon success, or -1 with errno set upon failure. */
@@ -1506,7 +2230,7 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
Store the read-end as fd[0] and the write-end as fd[1].
Return 0 upon success, or -1 with errno set upon failure.
See also the Linux man page at
- <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
+ <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
# if 1
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define pipe2 rpl_pipe2
@@ -1532,7 +2256,7 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
Return the number of bytes placed into BUF if successful, otherwise
set errno and return -1. 0 indicates EOF.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef pread
@@ -1567,7 +2291,7 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
Return the number of bytes written if successful, otherwise
set errno and return -1. 0 indicates nothing written. See the
POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef pwrite
@@ -1600,7 +2324,7 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
#if 0
/* Read up to COUNT bytes from file descriptor FD into the buffer starting
at BUF. See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef read
@@ -1609,11 +2333,32 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef read
+# define read _read
+# endif
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
# else
-/* Need to cast, because on mingw, the third parameter is
- unsigned int count
- and the return type is 'int'. */
-_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#elif 1
+/* On native Windows, map 'read' to '_read', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::read always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef read
+# define read _read
+# endif
+# ifdef __MINGW32__
+_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
+# else
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
+# endif
+# else
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
# endif
_GL_CXXALIASWARN (read);
#endif
@@ -1624,24 +2369,28 @@ _GL_CXXALIASWARN (read);
bytes of it into BUF. Return the number of bytes placed into BUF if
successful, otherwise -1 and errno set.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define readlink rpl_readlink
# endif
_GL_FUNCDECL_RPL (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize)
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize));
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize));
# else
# if !1
_GL_FUNCDECL_SYS (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize)
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize));
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize));
# endif
_GL_CXXALIASWARN (readlink);
#elif defined GNULIB_POSIXCHECK
@@ -1659,18 +2408,22 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
# define readlinkat rpl_readlinkat
# endif
_GL_FUNCDECL_RPL (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len)
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len));
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len));
# else
# if !1
_GL_FUNCDECL_SYS (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len)
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len)
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len));
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len));
# endif
_GL_CXXALIASWARN (readlinkat);
#elif defined GNULIB_POSIXCHECK
@@ -1690,6 +2443,12 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
# endif
_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef rmdir
+# define rmdir _rmdir
+# endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
# else
_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
# endif
@@ -1700,6 +2459,20 @@ _GL_CXXALIASWARN (rmdir);
_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
"use gnulib module rmdir for portability");
# endif
+#elif 1
+/* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::rmdir always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef rmdir
+# define rmdir _rmdir
+# endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
+# else
+_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
+# endif
+_GL_CXXALIASWARN (rmdir);
#endif
@@ -1734,7 +2507,7 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
/* Pause the execution of the current thread for N seconds.
Returns the number of seconds left to sleep.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef sleep
@@ -1758,6 +2531,23 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
#endif
+#if 1
+/* On native Windows, map 'swab' to '_swab', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::creat always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef swab
+# define swab _swab
+# endif
+_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
+# else
+_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
+# endif
+_GL_CXXALIASWARN (swab);
+#endif
+
+
#if IN_M4_GNULIB_TESTS
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1815,6 +2605,36 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
#if 0
+/* Change the size of the file designated by FILENAME to become equal to LENGTH.
+ Return 0 if successful, otherwise -1 and errno set.
+ See the POSIX:2008 specification
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
+# if 0
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef truncate
+# define truncate rpl_truncate
+# endif
+_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
+# else
+# if !1
+_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
+ _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
+# endif
+_GL_CXXALIASWARN (truncate);
+#elif defined GNULIB_POSIXCHECK
+# undef truncate
+# if HAVE_RAW_DECL_TRUNCATE
+_GL_WARN_ON_USE (truncate, "truncate is unportable - "
+ "use gnulib module truncate for portability");
+# endif
+#endif
+
+
+#if 0
/* Store at most BUFLEN characters of the pathname of the terminal FD is
open on in BUF. Return 0 on success, otherwise an error number. */
# if 0
@@ -1852,6 +2672,12 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
# endif
_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (unlink, int, (char const *file));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef unlink
+# define unlink _unlink
+# endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
# else
_GL_CXXALIAS_SYS (unlink, int, (char const *file));
# endif
@@ -1862,6 +2688,20 @@ _GL_CXXALIASWARN (unlink);
_GL_WARN_ON_USE (unlink, "unlink is not portable - "
"use gnulib module unlink for portability");
# endif
+#elif 1
+/* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::unlink always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef unlink
+# define unlink _unlink
+# endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
+# else
+_GL_CXXALIAS_SYS (unlink, int, (char const *file));
+# endif
+_GL_CXXALIASWARN (unlink);
#endif
@@ -1886,7 +2726,7 @@ _GL_CXXALIASWARN (unlinkat);
# undef unlinkat
# if HAVE_RAW_DECL_UNLINKAT
_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
- "use gnulib module openat for portability");
+ "use gnulib module unlinkat for portability");
# endif
#endif
@@ -1895,7 +2735,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
/* Pause the execution of the current thread for N microseconds.
Returns 0 on completion, or -1 on range error.
See the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/usleep.html>. */
+ <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef usleep
@@ -1907,7 +2747,9 @@ _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
# if !1
_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
# endif
-_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
+/* Need to cast, because on Haiku, the first parameter is
+ unsigned int n. */
+_GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
# endif
_GL_CXXALIASWARN (usleep);
#elif defined GNULIB_POSIXCHECK
@@ -1922,7 +2764,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
#if IN_M4_GNULIB_TESTS
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
See the POSIX:2008 specification
- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
+ <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef write
@@ -1931,11 +2773,32 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef write
+# define write _write
+# endif
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
+# else
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (write);
+#elif 1
+/* On native Windows, map 'write' to '_write', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::write always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef write
+# define write _write
+# endif
+# ifdef __MINGW32__
+_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
+# else
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
+# endif
# else
-/* Need to cast, because on mingw, the third parameter is
- unsigned int count
- and the return type is 'int'. */
-_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
# endif
_GL_CXXALIASWARN (write);
#endif