|
|
d41074 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Peter Jones <pjones@redhat.com>
|
|
|
a85e8e |
Date: Wed, 3 Sep 2014 10:01:03 -0400
|
|
|
d41074 |
Subject: [PATCH] Add grub_util_readlink()
|
|
|
a85e8e |
|
|
|
a85e8e |
Add grub_util_readlink(). This requires pulling in stat and readlink from
|
|
|
a85e8e |
gnulib, which pulls in stat and related headers, but after that the
|
|
|
a85e8e |
implementation is straightforward.
|
|
|
a85e8e |
|
|
|
a85e8e |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
a85e8e |
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
|
|
a85e8e |
---
|
|
|
a85e8e |
grub-core/gnulib/gettimeofday.c | 154 +++++++
|
|
|
a85e8e |
grub-core/gnulib/readlink.c | 74 ++++
|
|
|
a85e8e |
grub-core/gnulib/stat.c | 138 +++++++
|
|
|
d41074 |
grub-core/osdep/windows/hostdisk.c | 6 +
|
|
|
d41074 |
grub-core/gnulib/pathmax.h | 83 ++++
|
|
|
a85e8e |
grub-core/gnulib/sys_stat.in.h | 732 ++++++++++++++++++++++++++++++++++
|
|
|
a85e8e |
grub-core/gnulib/sys_time.in.h | 213 ++++++++++
|
|
|
a85e8e |
grub-core/gnulib/sys_types.in.h | 2 +
|
|
|
a85e8e |
grub-core/gnulib/time.h | 586 +++++++++++++++++++++++++++
|
|
|
a85e8e |
grub-core/gnulib/time.in.h | 274 +++++++++++++
|
|
|
a85e8e |
include/grub/osdep/hostfile_aros.h | 6 +
|
|
|
a85e8e |
include/grub/osdep/hostfile_unix.h | 6 +
|
|
|
a85e8e |
include/grub/osdep/hostfile_windows.h | 2 +
|
|
|
d41074 |
grub-core/gnulib/Makefile.am | 177 +++++++-
|
|
|
a85e8e |
m4/gettimeofday.m4 | 138 +++++++
|
|
|
a85e8e |
m4/gnulib-cache.m4 | 3 +-
|
|
|
a85e8e |
m4/gnulib-comp.m4 | 49 +++
|
|
|
a85e8e |
m4/largefile.m4 | 146 +++++++
|
|
|
a85e8e |
m4/pathmax.m4 | 42 ++
|
|
|
a85e8e |
m4/readlink.m4 | 71 ++++
|
|
|
a85e8e |
m4/stat.m4 | 71 ++++
|
|
|
a85e8e |
m4/sys_stat_h.m4 | 96 +++++
|
|
|
a85e8e |
m4/sys_time_h.m4 | 110 +++++
|
|
|
a85e8e |
m4/time_h.m4 | 118 ++++++
|
|
|
a85e8e |
24 files changed, 3295 insertions(+), 2 deletions(-)
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/gettimeofday.c
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/readlink.c
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/stat.c
|
|
|
d41074 |
create mode 100644 grub-core/gnulib/pathmax.h
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/sys_stat.in.h
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/sys_time.in.h
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/time.h
|
|
|
a85e8e |
create mode 100644 grub-core/gnulib/time.in.h
|
|
|
a85e8e |
create mode 100644 m4/gettimeofday.m4
|
|
|
a85e8e |
create mode 100644 m4/largefile.m4
|
|
|
a85e8e |
create mode 100644 m4/pathmax.m4
|
|
|
a85e8e |
create mode 100644 m4/readlink.m4
|
|
|
a85e8e |
create mode 100644 m4/stat.m4
|
|
|
a85e8e |
create mode 100644 m4/sys_stat_h.m4
|
|
|
a85e8e |
create mode 100644 m4/sys_time_h.m4
|
|
|
a85e8e |
create mode 100644 m4/time_h.m4
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/gettimeofday.c b/grub-core/gnulib/gettimeofday.c
|
|
|
a85e8e |
new file mode 100644
|
|
|
d41074 |
index 00000000000..8b2058e8c87
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/grub-core/gnulib/gettimeofday.c
|
|
|
a85e8e |
@@ -0,0 +1,154 @@
|
|
|
a85e8e |
+/* Provide gettimeofday for systems that don't have it or for which it's broken.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is free software; you can redistribute it and/or modify
|
|
|
a85e8e |
+ it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+ the Free Software Foundation; either version 3, or (at your option)
|
|
|
a85e8e |
+ any later version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+ GNU General Public License for more details.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* written by Jim Meyering */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#include <config.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Specification. */
|
|
|
a85e8e |
+#include <sys/time.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#include <time.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if HAVE_SYS_TIMEB_H
|
|
|
a85e8e |
+# include <sys/timeb.h>
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Work around the bug in some systems whereby gettimeofday clobbers
|
|
|
a85e8e |
+ the static buffer that localtime uses for its return value. The
|
|
|
a85e8e |
+ gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
|
|
|
a85e8e |
+ this problem. The tzset replacement is necessary for at least
|
|
|
a85e8e |
+ Solaris 2.5, 2.5.1, and 2.6. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+static struct tm tm_zero_buffer;
|
|
|
a85e8e |
+static struct tm *localtime_buffer_addr = &tm_zero_buffer;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# undef localtime
|
|
|
a85e8e |
+extern struct tm *localtime (time_t const *);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# undef gmtime
|
|
|
a85e8e |
+extern struct tm *gmtime (time_t const *);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* This is a wrapper for localtime. It is used only on systems for which
|
|
|
a85e8e |
+ gettimeofday clobbers the static buffer used for localtime's result.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ On the first call, record the address of the static buffer that
|
|
|
a85e8e |
+ localtime uses for its result. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+struct tm *
|
|
|
a85e8e |
+rpl_localtime (time_t const *timep)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ struct tm *tm = localtime (timep);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ if (localtime_buffer_addr == &tm_zero_buffer)
|
|
|
a85e8e |
+ localtime_buffer_addr = tm;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ return tm;
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Same as above, since gmtime and localtime use the same buffer. */
|
|
|
a85e8e |
+struct tm *
|
|
|
a85e8e |
+rpl_gmtime (time_t const *timep)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ struct tm *tm = gmtime (timep);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ if (localtime_buffer_addr == &tm_zero_buffer)
|
|
|
a85e8e |
+ localtime_buffer_addr = tm;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ return tm;
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if TZSET_CLOBBERS_LOCALTIME
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# undef tzset
|
|
|
a85e8e |
+extern void tzset (void);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* This is a wrapper for tzset, for systems on which tzset may clobber
|
|
|
a85e8e |
+ the static buffer used for localtime's result. */
|
|
|
a85e8e |
+void
|
|
|
a85e8e |
+rpl_tzset (void)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ /* Save and restore the contents of the buffer used for localtime's
|
|
|
a85e8e |
+ result around the call to tzset. */
|
|
|
a85e8e |
+ struct tm save = *localtime_buffer_addr;
|
|
|
a85e8e |
+ tzset ();
|
|
|
a85e8e |
+ *localtime_buffer_addr = save;
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* This is a wrapper for gettimeofday. It is used only on systems
|
|
|
a85e8e |
+ that lack this function, or whose implementation of this function
|
|
|
a85e8e |
+ causes problems. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+int
|
|
|
a85e8e |
+gettimeofday (struct timeval *restrict tv, void *restrict tz)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+#undef gettimeofday
|
|
|
a85e8e |
+#if HAVE_GETTIMEOFDAY
|
|
|
a85e8e |
+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
|
|
|
a85e8e |
+ /* Save and restore the contents of the buffer used for localtime's
|
|
|
a85e8e |
+ result around the call to gettimeofday. */
|
|
|
a85e8e |
+ struct tm save = *localtime_buffer_addr;
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if defined timeval /* 'struct timeval' overridden by gnulib? */
|
|
|
a85e8e |
+# undef timeval
|
|
|
a85e8e |
+ struct timeval otv;
|
|
|
a85e8e |
+ int result = gettimeofday (&otv, (struct timezone *) tz);
|
|
|
a85e8e |
+ if (result == 0)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ tv->tv_sec = otv.tv_sec;
|
|
|
a85e8e |
+ tv->tv_usec = otv.tv_usec;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ int result = gettimeofday (tv, (struct timezone *) tz);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
|
|
|
a85e8e |
+ *localtime_buffer_addr = save;
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ return result;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if HAVE__FTIME
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ struct _timeb timebuf;
|
|
|
a85e8e |
+ _ftime (&timebuf);
|
|
|
a85e8e |
+ tv->tv_sec = timebuf.time;
|
|
|
a85e8e |
+ tv->tv_usec = timebuf.millitm * 1000;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if !defined OK_TO_USE_1S_CLOCK
|
|
|
a85e8e |
+# error "Only 1-second nominal clock resolution found. Is that intended?" \
|
|
|
a85e8e |
+ "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+ tv->tv_sec = time (NULL);
|
|
|
a85e8e |
+ tv->tv_usec = 0;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ return 0;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/readlink.c b/grub-core/gnulib/readlink.c
|
|
|
a85e8e |
new file mode 100644
|
|
|
d41074 |
index 00000000000..4c496395176
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/grub-core/gnulib/readlink.c
|
|
|
a85e8e |
@@ -0,0 +1,74 @@
|
|
|
a85e8e |
+/* Stub for readlink().
|
|
|
a85e8e |
+ Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is free software: you can redistribute it and/or modify
|
|
|
a85e8e |
+ it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
a85e8e |
+ (at your option) any later version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+ GNU General Public License for more details.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#include <config.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Specification. */
|
|
|
a85e8e |
+#include <unistd.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#include <errno.h>
|
|
|
a85e8e |
+#include <string.h>
|
|
|
a85e8e |
+#include <sys/stat.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if !HAVE_READLINK
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* readlink() substitute for systems that don't have a readlink() function,
|
|
|
a85e8e |
+ such as DJGPP 2.03 and mingw32. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ssize_t
|
|
|
a85e8e |
+readlink (const char *name, char *buf _GL_UNUSED,
|
|
|
a85e8e |
+ size_t bufsize _GL_UNUSED)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ struct stat statbuf;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ /* In general we should use lstat() here, not stat(). But on platforms
|
|
|
a85e8e |
+ without symbolic links, lstat() - if it exists - would be equivalent to
|
|
|
a85e8e |
+ stat(), therefore we can use stat(). This saves us a configure check. */
|
|
|
a85e8e |
+ if (stat (name, &statbuf) >= 0)
|
|
|
a85e8e |
+ errno = EINVAL;
|
|
|
a85e8e |
+ return -1;
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#else /* HAVE_READLINK */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# undef readlink
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* readlink() wrapper that uses correct types, for systems like cygwin
|
|
|
a85e8e |
+ 1.5.x where readlink returns int, and which rejects trailing slash,
|
|
|
a85e8e |
+ for Solaris 9. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ssize_t
|
|
|
a85e8e |
+rpl_readlink (const char *name, char *buf, size_t bufsize)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+# if READLINK_TRAILING_SLASH_BUG
|
|
|
a85e8e |
+ size_t len = strlen (name);
|
|
|
a85e8e |
+ if (len && name[len - 1] == '/')
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ /* Even if name without the slash is a symlink to a directory,
|
|
|
a85e8e |
+ both lstat() and stat() must resolve the trailing slash to
|
|
|
a85e8e |
+ the directory rather than the symlink. We can therefore
|
|
|
a85e8e |
+ safely use stat() to distinguish between EINVAL and
|
|
|
a85e8e |
+ ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */
|
|
|
a85e8e |
+ struct stat st;
|
|
|
a85e8e |
+ if (stat (name, &st) == 0)
|
|
|
a85e8e |
+ errno = EINVAL;
|
|
|
a85e8e |
+ return -1;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+# endif /* READLINK_TRAILING_SLASH_BUG */
|
|
|
a85e8e |
+ return readlink (name, buf, bufsize);
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif /* HAVE_READLINK */
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/stat.c b/grub-core/gnulib/stat.c
|
|
|
a85e8e |
new file mode 100644
|
|
|
d41074 |
index 00000000000..35f4b0b1a51
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/grub-core/gnulib/stat.c
|
|
|
a85e8e |
@@ -0,0 +1,138 @@
|
|
|
a85e8e |
+/* Work around platform bugs in stat.
|
|
|
a85e8e |
+ Copyright (C) 2009-2014 Free Software Foundation, Inc.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is free software: you can redistribute it and/or modify
|
|
|
a85e8e |
+ it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
a85e8e |
+ (at your option) any later version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+ GNU General Public License for more details.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* written by Eric Blake */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
|
|
|
a85e8e |
+ the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
|
|
|
a85e8e |
+ rpl_stat. */
|
|
|
a85e8e |
+#define __need_system_sys_stat_h
|
|
|
a85e8e |
+#include <config.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Get the original definition of stat. It might be defined as a macro. */
|
|
|
a85e8e |
+#include <sys/types.h>
|
|
|
a85e8e |
+#include <sys/stat.h>
|
|
|
a85e8e |
+#undef __need_system_sys_stat_h
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
|
|
a85e8e |
+# if _GL_WINDOWS_64_BIT_ST_SIZE
|
|
|
a85e8e |
+# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
|
|
|
a85e8e |
+# define stat _stati64
|
|
|
a85e8e |
+# define REPLACE_FUNC_STAT_DIR 1
|
|
|
a85e8e |
+# undef REPLACE_FUNC_STAT_FILE
|
|
|
a85e8e |
+# elif REPLACE_FUNC_STAT_FILE
|
|
|
a85e8e |
+/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
|
|
|
a85e8e |
+ Bypass it. */
|
|
|
a85e8e |
+# define stat _stat
|
|
|
a85e8e |
+# define REPLACE_FUNC_STAT_DIR 1
|
|
|
a85e8e |
+# undef REPLACE_FUNC_STAT_FILE
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+static int
|
|
|
a85e8e |
+orig_stat (const char *filename, struct stat *buf)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ return stat (filename, buf);
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Specification. */
|
|
|
a85e8e |
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
|
|
|
a85e8e |
+ eliminates this include because of the preliminary #include <sys/stat.h>
|
|
|
a85e8e |
+ above. */
|
|
|
a85e8e |
+#include "sys/stat.h"
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#include <errno.h>
|
|
|
a85e8e |
+#include <limits.h>
|
|
|
a85e8e |
+#include <stdbool.h>
|
|
|
a85e8e |
+#include <string.h>
|
|
|
a85e8e |
+#include "dosname.h"
|
|
|
a85e8e |
+#include "verify.h"
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if REPLACE_FUNC_STAT_DIR
|
|
|
a85e8e |
+# include "pathmax.h"
|
|
|
a85e8e |
+ /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
|
|
|
a85e8e |
+ have a constant PATH_MAX. */
|
|
|
a85e8e |
+# ifndef PATH_MAX
|
|
|
a85e8e |
+# error "Please port this replacement to your platform"
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Store information about NAME into ST. Work around bugs with
|
|
|
a85e8e |
+ trailing slashes. Mingw has other bugs (such as st_ino always
|
|
|
a85e8e |
+ being 0 on success) which this wrapper does not work around. But
|
|
|
a85e8e |
+ at least this implementation provides the ability to emulate fchdir
|
|
|
a85e8e |
+ correctly. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+int
|
|
|
a85e8e |
+rpl_stat (char const *name, struct stat *st)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ int result = orig_stat (name, st);
|
|
|
a85e8e |
+#if REPLACE_FUNC_STAT_FILE
|
|
|
a85e8e |
+ /* Solaris 9 mistakenly succeeds when given a non-directory with a
|
|
|
a85e8e |
+ trailing slash. */
|
|
|
a85e8e |
+ if (result == 0 && !S_ISDIR (st->st_mode))
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ size_t len = strlen (name);
|
|
|
a85e8e |
+ if (ISSLASH (name[len - 1]))
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ errno = ENOTDIR;
|
|
|
a85e8e |
+ return -1;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+#endif /* REPLACE_FUNC_STAT_FILE */
|
|
|
a85e8e |
+#if REPLACE_FUNC_STAT_DIR
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ if (result == -1 && errno == ENOENT)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ /* Due to mingw's oddities, there are some directories (like
|
|
|
a85e8e |
+ c:\) where stat() only succeeds with a trailing slash, and
|
|
|
a85e8e |
+ other directories (like c:\windows) where stat() only
|
|
|
a85e8e |
+ succeeds without a trailing slash. But we want the two to be
|
|
|
a85e8e |
+ synonymous, since chdir() manages either style. Likewise, Mingw also
|
|
|
a85e8e |
+ reports ENOENT for names longer than PATH_MAX, when we want
|
|
|
a85e8e |
+ ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR.
|
|
|
a85e8e |
+ Fortunately, mingw PATH_MAX is small enough for stack
|
|
|
a85e8e |
+ allocation. */
|
|
|
a85e8e |
+ char fixed_name[PATH_MAX + 1] = {0};
|
|
|
a85e8e |
+ size_t len = strlen (name);
|
|
|
a85e8e |
+ bool check_dir = false;
|
|
|
a85e8e |
+ verify (PATH_MAX <= 4096);
|
|
|
a85e8e |
+ if (PATH_MAX <= len)
|
|
|
a85e8e |
+ errno = ENAMETOOLONG;
|
|
|
a85e8e |
+ else if (len)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ strcpy (fixed_name, name);
|
|
|
a85e8e |
+ if (ISSLASH (fixed_name[len - 1]))
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ check_dir = true;
|
|
|
a85e8e |
+ while (len && ISSLASH (fixed_name[len - 1]))
|
|
|
a85e8e |
+ fixed_name[--len] = '\0';
|
|
|
a85e8e |
+ if (!len)
|
|
|
a85e8e |
+ fixed_name[0] = '/';
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ else
|
|
|
a85e8e |
+ fixed_name[len++] = '/';
|
|
|
a85e8e |
+ result = orig_stat (fixed_name, st);
|
|
|
a85e8e |
+ if (result == 0 && check_dir && !S_ISDIR (st->st_mode))
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ result = -1;
|
|
|
a85e8e |
+ errno = ENOTDIR;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+#endif /* REPLACE_FUNC_STAT_DIR */
|
|
|
a85e8e |
+ return result;
|
|
|
a85e8e |
+}
|
|
|
d41074 |
diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c
|
|
|
d41074 |
index d390b25fcbe..9127e9263b1 100644
|
|
|
d41074 |
--- a/grub-core/osdep/windows/hostdisk.c
|
|
|
d41074 |
+++ b/grub-core/osdep/windows/hostdisk.c
|
|
|
d41074 |
@@ -353,6 +353,12 @@ grub_util_mkdir (const char *dir)
|
|
|
d41074 |
free (windows_name);
|
|
|
d41074 |
}
|
|
|
d41074 |
|
|
|
d41074 |
+ssize_t
|
|
|
d41074 |
+grub_util_readlink (const char *name, char *buf, size_t bufsize)
|
|
|
d41074 |
+{
|
|
|
d41074 |
+ return readlink(name, buf, bufsize);
|
|
|
d41074 |
+}
|
|
|
d41074 |
+
|
|
|
d41074 |
int
|
|
|
d41074 |
grub_util_rename (const char *from, const char *to)
|
|
|
d41074 |
{
|
|
|
d41074 |
diff --git a/grub-core/gnulib/pathmax.h b/grub-core/gnulib/pathmax.h
|
|
|
d41074 |
new file mode 100644
|
|
|
d41074 |
index 00000000000..33fc3553d75
|
|
|
d41074 |
--- /dev/null
|
|
|
d41074 |
+++ b/grub-core/gnulib/pathmax.h
|
|
|
d41074 |
@@ -0,0 +1,83 @@
|
|
|
d41074 |
+/* Define PATH_MAX somehow. Requires sys/types.h.
|
|
|
d41074 |
+ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
|
|
|
d41074 |
+ Foundation, Inc.
|
|
|
d41074 |
+
|
|
|
d41074 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
d41074 |
+ it under the terms of the GNU General Public License as published by
|
|
|
d41074 |
+ the Free Software Foundation; either version 3, or (at your option)
|
|
|
d41074 |
+ any later version.
|
|
|
d41074 |
+
|
|
|
d41074 |
+ This program is distributed in the hope that it will be useful,
|
|
|
d41074 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d41074 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
d41074 |
+ GNU General Public License for more details.
|
|
|
d41074 |
+
|
|
|
d41074 |
+ You should have received a copy of the GNU General Public License
|
|
|
d41074 |
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
|
|
d41074 |
+
|
|
|
d41074 |
+#ifndef _PATHMAX_H
|
|
|
d41074 |
+# define _PATHMAX_H
|
|
|
d41074 |
+
|
|
|
d41074 |
+/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename,
|
|
|
d41074 |
+ including the terminating NUL byte.
|
|
|
d41074 |
+ <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
|
|
|
d41074 |
+ PATH_MAX is not defined on systems which have no limit on filename length,
|
|
|
d41074 |
+ such as GNU/Hurd.
|
|
|
d41074 |
+
|
|
|
d41074 |
+ This file does *not* define PATH_MAX always. Programs that use this file
|
|
|
d41074 |
+ can handle the GNU/Hurd case in several ways:
|
|
|
d41074 |
+ - Either with a package-wide handling, or with a per-file handling,
|
|
|
d41074 |
+ - Either through a
|
|
|
d41074 |
+ #ifdef PATH_MAX
|
|
|
d41074 |
+ or through a fallback like
|
|
|
d41074 |
+ #ifndef PATH_MAX
|
|
|
d41074 |
+ # define PATH_MAX 8192
|
|
|
d41074 |
+ #endif
|
|
|
d41074 |
+ or through a fallback like
|
|
|
d41074 |
+ #ifndef PATH_MAX
|
|
|
d41074 |
+ # define PATH_MAX pathconf ("/", _PC_PATH_MAX)
|
|
|
d41074 |
+ #endif
|
|
|
d41074 |
+ */
|
|
|
d41074 |
+
|
|
|
d41074 |
+# include <unistd.h>
|
|
|
d41074 |
+
|
|
|
d41074 |
+# include <limits.h>
|
|
|
d41074 |
+
|
|
|
d41074 |
+# ifndef _POSIX_PATH_MAX
|
|
|
d41074 |
+# define _POSIX_PATH_MAX 256
|
|
|
d41074 |
+# endif
|
|
|
d41074 |
+
|
|
|
d41074 |
+/* Don't include sys/param.h if it already has been. */
|
|
|
d41074 |
+# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
|
|
|
d41074 |
+# include <sys/param.h>
|
|
|
d41074 |
+# endif
|
|
|
d41074 |
+
|
|
|
d41074 |
+# if !defined PATH_MAX && defined MAXPATHLEN
|
|
|
d41074 |
+# define PATH_MAX MAXPATHLEN
|
|
|
d41074 |
+# endif
|
|
|
d41074 |
+
|
|
|
d41074 |
+# ifdef __hpux
|
|
|
d41074 |
+/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
|
|
|
d41074 |
+ *not* including the terminating NUL byte, and is set to 1023.
|
|
|
d41074 |
+ Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is
|
|
|
d41074 |
+ not defined at all any more. */
|
|
|
d41074 |
+# undef PATH_MAX
|
|
|
d41074 |
+# define PATH_MAX 1024
|
|
|
d41074 |
+# endif
|
|
|
d41074 |
+
|
|
|
d41074 |
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
|
|
d41074 |
+/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
|
|
|
d41074 |
+ section "Maximum Path Length Limitation",
|
|
|
d41074 |
+ <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath>
|
|
|
d41074 |
+ explains that the maximum size of a filename, including the terminating
|
|
|
d41074 |
+ NUL byte, is 260 = 3 + 256 + 1.
|
|
|
d41074 |
+ This is the same value as
|
|
|
d41074 |
+ - FILENAME_MAX in <stdio.h>,
|
|
|
d41074 |
+ - _MAX_PATH in <stdlib.h>,
|
|
|
d41074 |
+ - MAX_PATH in <windef.h>.
|
|
|
d41074 |
+ Undefine the original value, because mingw's <limits.h> gets it wrong. */
|
|
|
d41074 |
+# undef PATH_MAX
|
|
|
d41074 |
+# define PATH_MAX 260
|
|
|
d41074 |
+# endif
|
|
|
d41074 |
+
|
|
|
d41074 |
+#endif /* _PATHMAX_H */
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/sys_stat.in.h b/grub-core/gnulib/sys_stat.in.h
|
|
|
a85e8e |
new file mode 100644
|
|
|
d41074 |
index 00000000000..b47a7ff0ae7
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/grub-core/gnulib/sys_stat.in.h
|
|
|
a85e8e |
@@ -0,0 +1,732 @@
|
|
|
a85e8e |
+/* Provide a more complete sys/stat header file.
|
|
|
a85e8e |
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is free software; you can redistribute it and/or modify
|
|
|
a85e8e |
+ it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+ the Free Software Foundation; either version 3, or (at your option)
|
|
|
a85e8e |
+ any later version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+ GNU General Public License for more details.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* This file is supposed to be used on platforms where <sys/stat.h> is
|
|
|
a85e8e |
+ incomplete. It is intended to provide definitions and prototypes
|
|
|
a85e8e |
+ needed by an application. Start with what the system provides. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if __GNUC__ >= 3
|
|
|
a85e8e |
+@PRAGMA_SYSTEM_HEADER@
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+@PRAGMA_COLUMNS@
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if defined __need_system_sys_stat_h
|
|
|
a85e8e |
+/* Special invocation convention. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+/* Normal invocation convention. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Get nlink_t.
|
|
|
a85e8e |
+ May also define off_t to a 64-bit type on native Windows. */
|
|
|
a85e8e |
+#include <sys/types.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Get struct timespec. */
|
|
|
a85e8e |
+#include <time.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The include_next requires a split double-inclusion guard. */
|
|
|
a85e8e |
+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
|
|
|
a85e8e |
+#define _@GUARD_PREFIX@_SYS_STAT_H
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definition of _GL_ARG_NONNULL is copied here. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definition of _GL_WARN_ON_USE is copied here. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
|
|
|
a85e8e |
+ headers that may declare mkdir(). Native Windows platforms declare mkdir
|
|
|
a85e8e |
+ in <io.h> and/or <direct.h>, not in <unistd.h>. */
|
|
|
a85e8e |
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
|
|
a85e8e |
+# include <io.h> /* mingw32, mingw64 */
|
|
|
a85e8e |
+# include <direct.h> /* mingw64, MSVC 9 */
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Native Windows platforms declare umask() in <io.h>. */
|
|
|
a85e8e |
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
|
|
|
a85e8e |
+# include <io.h>
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Large File Support on native Windows. */
|
|
|
a85e8e |
+#if @WINDOWS_64_BIT_ST_SIZE@
|
|
|
a85e8e |
+# define stat _stati64
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_IFIFO
|
|
|
a85e8e |
+# ifdef _S_IFIFO
|
|
|
a85e8e |
+# define S_IFIFO _S_IFIFO
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_IFMT
|
|
|
a85e8e |
+# define S_IFMT 0170000
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if STAT_MACROS_BROKEN
|
|
|
a85e8e |
+# undef S_ISBLK
|
|
|
a85e8e |
+# undef S_ISCHR
|
|
|
a85e8e |
+# undef S_ISDIR
|
|
|
a85e8e |
+# undef S_ISFIFO
|
|
|
a85e8e |
+# undef S_ISLNK
|
|
|
a85e8e |
+# undef S_ISNAM
|
|
|
a85e8e |
+# undef S_ISMPB
|
|
|
a85e8e |
+# undef S_ISMPC
|
|
|
a85e8e |
+# undef S_ISNWK
|
|
|
a85e8e |
+# undef S_ISREG
|
|
|
a85e8e |
+# undef S_ISSOCK
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISBLK
|
|
|
a85e8e |
+# ifdef S_IFBLK
|
|
|
a85e8e |
+# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISBLK(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISCHR
|
|
|
a85e8e |
+# ifdef S_IFCHR
|
|
|
a85e8e |
+# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISCHR(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISDIR
|
|
|
a85e8e |
+# ifdef S_IFDIR
|
|
|
a85e8e |
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISDIR(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISDOOR /* Solaris 2.5 and up */
|
|
|
a85e8e |
+# define S_ISDOOR(m) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISFIFO
|
|
|
a85e8e |
+# ifdef S_IFIFO
|
|
|
a85e8e |
+# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISFIFO(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISLNK
|
|
|
a85e8e |
+# ifdef S_IFLNK
|
|
|
a85e8e |
+# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISLNK(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISMPB /* V7 */
|
|
|
a85e8e |
+# ifdef S_IFMPB
|
|
|
a85e8e |
+# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
|
|
|
a85e8e |
+# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISMPB(m) 0
|
|
|
a85e8e |
+# define S_ISMPC(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISMPX /* AIX */
|
|
|
a85e8e |
+# define S_ISMPX(m) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISNAM /* Xenix */
|
|
|
a85e8e |
+# ifdef S_IFNAM
|
|
|
a85e8e |
+# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISNAM(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISNWK /* HP/UX */
|
|
|
a85e8e |
+# ifdef S_IFNWK
|
|
|
a85e8e |
+# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISNWK(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISPORT /* Solaris 10 and up */
|
|
|
a85e8e |
+# define S_ISPORT(m) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISREG
|
|
|
a85e8e |
+# ifdef S_IFREG
|
|
|
a85e8e |
+# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISREG(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_ISSOCK
|
|
|
a85e8e |
+# ifdef S_IFSOCK
|
|
|
a85e8e |
+# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_ISSOCK(m) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_TYPEISMQ
|
|
|
a85e8e |
+# define S_TYPEISMQ(p) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_TYPEISTMO
|
|
|
a85e8e |
+# define S_TYPEISTMO(p) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_TYPEISSEM
|
|
|
a85e8e |
+# ifdef S_INSEM
|
|
|
a85e8e |
+# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_TYPEISSEM(p) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_TYPEISSHM
|
|
|
a85e8e |
+# ifdef S_INSHD
|
|
|
a85e8e |
+# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define S_TYPEISSHM(p) 0
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* high performance ("contiguous data") */
|
|
|
a85e8e |
+#ifndef S_ISCTG
|
|
|
a85e8e |
+# define S_ISCTG(p) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Cray DMF (data migration facility): off line, with data */
|
|
|
a85e8e |
+#ifndef S_ISOFD
|
|
|
a85e8e |
+# define S_ISOFD(p) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Cray DMF (data migration facility): off line, with no data */
|
|
|
a85e8e |
+#ifndef S_ISOFL
|
|
|
a85e8e |
+# define S_ISOFL(p) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* 4.4BSD whiteout */
|
|
|
a85e8e |
+#ifndef S_ISWHT
|
|
|
a85e8e |
+# define S_ISWHT(m) 0
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* If any of the following are undefined,
|
|
|
a85e8e |
+ define them to their de facto standard values. */
|
|
|
a85e8e |
+#if !S_ISUID
|
|
|
a85e8e |
+# define S_ISUID 04000
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_ISGID
|
|
|
a85e8e |
+# define S_ISGID 02000
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* S_ISVTX is a common extension to POSIX. */
|
|
|
a85e8e |
+#ifndef S_ISVTX
|
|
|
a85e8e |
+# define S_ISVTX 01000
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if !S_IRUSR && S_IREAD
|
|
|
a85e8e |
+# define S_IRUSR S_IREAD
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IRUSR
|
|
|
a85e8e |
+# define S_IRUSR 00400
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IRGRP
|
|
|
a85e8e |
+# define S_IRGRP (S_IRUSR >> 3)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IROTH
|
|
|
a85e8e |
+# define S_IROTH (S_IRUSR >> 6)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if !S_IWUSR && S_IWRITE
|
|
|
a85e8e |
+# define S_IWUSR S_IWRITE
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IWUSR
|
|
|
a85e8e |
+# define S_IWUSR 00200
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IWGRP
|
|
|
a85e8e |
+# define S_IWGRP (S_IWUSR >> 3)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IWOTH
|
|
|
a85e8e |
+# define S_IWOTH (S_IWUSR >> 6)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if !S_IXUSR && S_IEXEC
|
|
|
a85e8e |
+# define S_IXUSR S_IEXEC
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IXUSR
|
|
|
a85e8e |
+# define S_IXUSR 00100
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IXGRP
|
|
|
a85e8e |
+# define S_IXGRP (S_IXUSR >> 3)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IXOTH
|
|
|
a85e8e |
+# define S_IXOTH (S_IXUSR >> 6)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if !S_IRWXU
|
|
|
a85e8e |
+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IRWXG
|
|
|
a85e8e |
+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+#if !S_IRWXO
|
|
|
a85e8e |
+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* S_IXUGO is a common extension to POSIX. */
|
|
|
a85e8e |
+#if !S_IXUGO
|
|
|
a85e8e |
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef S_IRWXUGO
|
|
|
a85e8e |
+# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Macros for futimens and utimensat. */
|
|
|
a85e8e |
+#ifndef UTIME_NOW
|
|
|
a85e8e |
+# define UTIME_NOW (-1)
|
|
|
a85e8e |
+# define UTIME_OMIT (-2)
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_FCHMODAT@
|
|
|
a85e8e |
+# if !@HAVE_FCHMODAT@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (fchmodat, int,
|
|
|
a85e8e |
+ (int fd, char const *file, mode_t mode, int flag)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (fchmodat, int,
|
|
|
a85e8e |
+ (int fd, char const *file, mode_t mode, int flag));
|
|
|
a85e8e |
+_GL_CXXALIASWARN (fchmodat);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef fchmodat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_FCHMODAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
|
|
|
a85e8e |
+ "use gnulib module openat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_FSTAT@
|
|
|
a85e8e |
+# if @REPLACE_FSTAT@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef fstat
|
|
|
a85e8e |
+# define fstat rpl_fstat
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (fstat);
|
|
|
a85e8e |
+#elif @WINDOWS_64_BIT_ST_SIZE@
|
|
|
a85e8e |
+/* Above, we define stat to _stati64. */
|
|
|
a85e8e |
+# define fstat _fstati64
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef fstat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_FSTAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
|
|
|
a85e8e |
+ "use gnulib module fstat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_FSTATAT@
|
|
|
a85e8e |
+# if @REPLACE_FSTATAT@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef fstatat
|
|
|
a85e8e |
+# define fstatat rpl_fstatat
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (fstatat, int,
|
|
|
a85e8e |
+ (int fd, char const *name, struct stat *st, int flags)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2, 3)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (fstatat, int,
|
|
|
a85e8e |
+ (int fd, char const *name, struct stat *st, int flags));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if !@HAVE_FSTATAT@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (fstatat, int,
|
|
|
a85e8e |
+ (int fd, char const *name, struct stat *st, int flags)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2, 3)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (fstatat, int,
|
|
|
a85e8e |
+ (int fd, char const *name, struct stat *st, int flags));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (fstatat);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef fstatat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_FSTATAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
|
|
|
a85e8e |
+ "use gnulib module openat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_FUTIMENS@
|
|
|
a85e8e |
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
|
|
|
a85e8e |
+ implementation relies on futimesat, which on Solaris 10 makes an invocation
|
|
|
a85e8e |
+ to futimens that is meant to invoke the libc's futimens(), not gnulib's
|
|
|
a85e8e |
+ futimens(). */
|
|
|
a85e8e |
+# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef futimens
|
|
|
a85e8e |
+# define futimens rpl_futimens
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if !@HAVE_FUTIMENS@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if @HAVE_FUTIMENS@
|
|
|
a85e8e |
+_GL_CXXALIASWARN (futimens);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef futimens
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_FUTIMENS
|
|
|
a85e8e |
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
|
|
|
a85e8e |
+ "use gnulib module futimens for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_LCHMOD@
|
|
|
a85e8e |
+/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
|
|
|
a85e8e |
+ denotes a symbolic link. */
|
|
|
a85e8e |
+# if !@HAVE_LCHMOD@
|
|
|
a85e8e |
+/* The lchmod replacement follows symbolic links. Callers should take
|
|
|
a85e8e |
+ this into account; lchmod should be applied only to arguments that
|
|
|
a85e8e |
+ are known to not be symbolic links. On hosts that lack lchmod,
|
|
|
a85e8e |
+ this can lead to race conditions between the check and the
|
|
|
a85e8e |
+ invocation of lchmod, but we know of no workarounds that are
|
|
|
a85e8e |
+ reliable in general. You might try requesting support for lchmod
|
|
|
a85e8e |
+ from your operating system supplier. */
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define lchmod chmod
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+/* Need to cast, because on mingw, the second parameter of chmod is
|
|
|
a85e8e |
+ int mode. */
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
|
|
|
a85e8e |
+ (const char *filename, mode_t mode));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if 0 /* assume already declared */
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if @HAVE_LCHMOD@
|
|
|
a85e8e |
+_GL_CXXALIASWARN (lchmod);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef lchmod
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_LCHMOD
|
|
|
a85e8e |
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
|
|
|
a85e8e |
+ "use gnulib module lchmod for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_LSTAT@
|
|
|
a85e8e |
+# if ! @HAVE_LSTAT@
|
|
|
a85e8e |
+/* mingw does not support symlinks, therefore it does not have lstat. But
|
|
|
a85e8e |
+ without links, stat does just fine. */
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define lstat stat
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
|
|
|
a85e8e |
+# elif @REPLACE_LSTAT@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef lstat
|
|
|
a85e8e |
+# define lstat rpl_lstat
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1, 2)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if @HAVE_LSTAT@
|
|
|
a85e8e |
+_GL_CXXALIASWARN (lstat);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef lstat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_LSTAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
|
|
|
a85e8e |
+ "use gnulib module lstat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @REPLACE_MKDIR@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef mkdir
|
|
|
a85e8e |
+# define mkdir rpl_mkdir
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
|
|
|
a85e8e |
+ Additionally, it declares _mkdir (and depending on compile flags, an
|
|
|
a85e8e |
+ alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
|
|
|
a85e8e |
+ which are included above. */
|
|
|
a85e8e |
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if !GNULIB_defined_rpl_mkdir
|
|
|
a85e8e |
+static int
|
|
|
a85e8e |
+rpl_mkdir (char const *name, mode_t mode)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ return _mkdir (name);
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+# define GNULIB_defined_rpl_mkdir 1
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define mkdir rpl_mkdir
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mkdir);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_MKDIRAT@
|
|
|
a85e8e |
+# if !@HAVE_MKDIRAT@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mkdirat);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef mkdirat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_MKDIRAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
|
|
|
a85e8e |
+ "use gnulib module openat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_MKFIFO@
|
|
|
a85e8e |
+# if @REPLACE_MKFIFO@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef mkfifo
|
|
|
a85e8e |
+# define mkfifo rpl_mkfifo
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if !@HAVE_MKFIFO@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mkfifo);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef mkfifo
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_MKFIFO
|
|
|
a85e8e |
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
|
|
|
a85e8e |
+ "use gnulib module mkfifo for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_MKFIFOAT@
|
|
|
a85e8e |
+# if !@HAVE_MKFIFOAT@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mkfifoat);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef mkfifoat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_MKFIFOAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
|
|
|
a85e8e |
+ "use gnulib module mkfifoat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_MKNOD@
|
|
|
a85e8e |
+# if @REPLACE_MKNOD@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef mknod
|
|
|
a85e8e |
+# define mknod rpl_mknod
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if !@HAVE_MKNOD@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mknod);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef mknod
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_MKNOD
|
|
|
a85e8e |
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
|
|
|
a85e8e |
+ "use gnulib module mknod for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_MKNODAT@
|
|
|
a85e8e |
+# if !@HAVE_MKNODAT@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (mknodat, int,
|
|
|
a85e8e |
+ (int fd, char const *file, mode_t mode, dev_t dev)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (mknodat, int,
|
|
|
a85e8e |
+ (int fd, char const *file, mode_t mode, dev_t dev));
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mknodat);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef mknodat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_MKNODAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
|
|
|
a85e8e |
+ "use gnulib module mkfifoat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_STAT@
|
|
|
a85e8e |
+# if @REPLACE_STAT@
|
|
|
a85e8e |
+/* We can't use the object-like #define stat rpl_stat, because of
|
|
|
a85e8e |
+ struct stat. This means that rpl_stat will not be used if the user
|
|
|
a85e8e |
+ does (stat)(a,b). Oh well. */
|
|
|
a85e8e |
+# if defined _AIX && defined stat && defined _LARGE_FILES
|
|
|
a85e8e |
+ /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
|
|
|
a85e8e |
+ so we have to replace stat64() instead of stat(). */
|
|
|
a85e8e |
+# undef stat64
|
|
|
a85e8e |
+# define stat64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# elif @WINDOWS_64_BIT_ST_SIZE@
|
|
|
a85e8e |
+ /* Above, we define stat to _stati64. */
|
|
|
a85e8e |
+# if defined __MINGW32__ && defined _stati64
|
|
|
a85e8e |
+# ifndef _USE_32BIT_TIME_T
|
|
|
a85e8e |
+ /* The system headers define _stati64 to _stat64. */
|
|
|
a85e8e |
+# undef _stat64
|
|
|
a85e8e |
+# define _stat64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# elif defined _MSC_VER && defined _stati64
|
|
|
a85e8e |
+# ifdef _USE_32BIT_TIME_T
|
|
|
a85e8e |
+ /* The system headers define _stati64 to _stat32i64. */
|
|
|
a85e8e |
+# undef _stat32i64
|
|
|
a85e8e |
+# define _stat32i64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ /* The system headers define _stati64 to _stat64. */
|
|
|
a85e8e |
+# undef _stat64
|
|
|
a85e8e |
+# define _stat64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# undef _stati64
|
|
|
a85e8e |
+# define _stati64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# elif defined __MINGW32__ && defined stat
|
|
|
a85e8e |
+# ifdef _USE_32BIT_TIME_T
|
|
|
a85e8e |
+ /* The system headers define stat to _stat32i64. */
|
|
|
a85e8e |
+# undef _stat32i64
|
|
|
a85e8e |
+# define _stat32i64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ /* The system headers define stat to _stat64. */
|
|
|
a85e8e |
+# undef _stat64
|
|
|
a85e8e |
+# define _stat64(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# elif defined _MSC_VER && defined stat
|
|
|
a85e8e |
+# ifdef _USE_32BIT_TIME_T
|
|
|
a85e8e |
+ /* The system headers define stat to _stat32. */
|
|
|
a85e8e |
+# undef _stat32
|
|
|
a85e8e |
+# define _stat32(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ /* The system headers define stat to _stat64i32. */
|
|
|
a85e8e |
+# undef _stat64i32
|
|
|
a85e8e |
+# define _stat64i32(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
|
|
|
a85e8e |
+# undef stat
|
|
|
a85e8e |
+# define stat(name, st) rpl_stat (name, st)
|
|
|
a85e8e |
+# endif /* !_LARGE_FILES */
|
|
|
a85e8e |
+_GL_EXTERN_C int stat (const char *name, struct stat *buf)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1, 2));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef stat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_STAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (stat, "stat is unportable - "
|
|
|
a85e8e |
+ "use gnulib module stat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_UTIMENSAT@
|
|
|
a85e8e |
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
|
|
|
a85e8e |
+ implementation relies on futimesat, which on Solaris 10 makes an invocation
|
|
|
a85e8e |
+ to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
|
|
|
a85e8e |
+ utimensat(). */
|
|
|
a85e8e |
+# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef utimensat
|
|
|
a85e8e |
+# define utimensat rpl_utimensat
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
|
|
|
a85e8e |
+ struct timespec const times[2], int flag)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
|
|
|
a85e8e |
+ struct timespec const times[2], int flag));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if !@HAVE_UTIMENSAT@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
|
|
|
a85e8e |
+ struct timespec const times[2], int flag)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
|
|
|
a85e8e |
+ struct timespec const times[2], int flag));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if @HAVE_UTIMENSAT@
|
|
|
a85e8e |
+_GL_CXXALIASWARN (utimensat);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef utimensat
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_UTIMENSAT
|
|
|
a85e8e |
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
|
|
|
a85e8e |
+ "use gnulib module utimensat for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
|
|
|
a85e8e |
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/sys_time.in.h b/grub-core/gnulib/sys_time.in.h
|
|
|
a85e8e |
new file mode 100644
|
|
|
d41074 |
index 00000000000..30057ad49fd
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/grub-core/gnulib/sys_time.in.h
|
|
|
a85e8e |
@@ -0,0 +1,213 @@
|
|
|
a85e8e |
+/* Provide a more complete sys/time.h.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ Copyright (C) 2007-2014 Free Software Foundation, Inc.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is free software; you can redistribute it and/or modify
|
|
|
a85e8e |
+ it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+ the Free Software Foundation; either version 3, or (at your option)
|
|
|
a85e8e |
+ any later version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+ GNU General Public License for more details.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Written by Paul Eggert. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef _@GUARD_PREFIX@_SYS_TIME_H
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if __GNUC__ >= 3
|
|
|
a85e8e |
+@PRAGMA_SYSTEM_HEADER@
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+@PRAGMA_COLUMNS@
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
|
|
|
a85e8e |
+ recursively via <sys/select.h>.
|
|
|
a85e8e |
+ Simply delegate to the system's header in this case; it is a no-op.
|
|
|
a85e8e |
+ Without this extra ifdef, the C++ gettimeofday declaration below
|
|
|
a85e8e |
+ would be a forward declaration in gnulib's nested <sys/time.h>. */
|
|
|
a85e8e |
+#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
|
|
|
a85e8e |
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The include_next requires a split double-inclusion guard. */
|
|
|
a85e8e |
+#if @HAVE_SYS_TIME_H@
|
|
|
a85e8e |
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifndef _@GUARD_PREFIX@_SYS_TIME_H
|
|
|
a85e8e |
+#define _@GUARD_PREFIX@_SYS_TIME_H
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if ! @HAVE_SYS_TIME_H@
|
|
|
a85e8e |
+# include <time.h>
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* On native Windows with MSVC, get the 'struct timeval' type.
|
|
|
a85e8e |
+ Also, on native Windows with a 64-bit time_t, where we are overriding the
|
|
|
a85e8e |
+ 'struct timeval' type, get all declarations of system functions whose
|
|
|
a85e8e |
+ signature contains 'struct timeval'. */
|
|
|
a85e8e |
+#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
|
|
|
a85e8e |
+# define _GL_INCLUDING_WINSOCK2_H
|
|
|
a85e8e |
+# include <winsock2.h>
|
|
|
a85e8e |
+# undef _GL_INCLUDING_WINSOCK2_H
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definition of _GL_ARG_NONNULL is copied here. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definition of _GL_WARN_ON_USE is copied here. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifdef __cplusplus
|
|
|
a85e8e |
+extern "C" {
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if @REPLACE_STRUCT_TIMEVAL@
|
|
|
a85e8e |
+# define timeval rpl_timeval
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if !GNULIB_defined_struct_timeval
|
|
|
a85e8e |
+struct timeval
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ time_t tv_sec;
|
|
|
a85e8e |
+ long int tv_usec;
|
|
|
a85e8e |
+};
|
|
|
a85e8e |
+# define GNULIB_defined_struct_timeval 1
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#ifdef __cplusplus
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if @GNULIB_GETTIMEOFDAY@
|
|
|
a85e8e |
+# if @REPLACE_GETTIMEOFDAY@
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef gettimeofday
|
|
|
a85e8e |
+# define gettimeofday rpl_gettimeofday
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (gettimeofday, int,
|
|
|
a85e8e |
+ (struct timeval *restrict, void *restrict)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (gettimeofday, int,
|
|
|
a85e8e |
+ (struct timeval *restrict, void *restrict));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if !@HAVE_GETTIMEOFDAY@
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (gettimeofday, int,
|
|
|
a85e8e |
+ (struct timeval *restrict, void *restrict)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+/* Need to cast, because on glibc systems, by default, the second argument is
|
|
|
a85e8e |
+ struct timezone *. */
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
|
|
|
a85e8e |
+ (struct timeval *restrict, void *restrict));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (gettimeofday);
|
|
|
a85e8e |
+#elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+# undef gettimeofday
|
|
|
a85e8e |
+# if HAVE_RAW_DECL_GETTIMEOFDAY
|
|
|
a85e8e |
+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
|
|
|
a85e8e |
+ "use gnulib module gettimeofday for portability");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Hide some function declarations from <winsock2.h>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if defined _MSC_VER && @HAVE_WINSOCK2_H@
|
|
|
a85e8e |
+# if !defined _@GUARD_PREFIX@_UNISTD_H
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef close
|
|
|
a85e8e |
+# define close close_used_without_including_unistd_h
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (close,
|
|
|
a85e8e |
+ "close() used without including <unistd.h>");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef gethostname
|
|
|
a85e8e |
+# define gethostname gethostname_used_without_including_unistd_h
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (gethostname,
|
|
|
a85e8e |
+ "gethostname() used without including <unistd.h>");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef socket
|
|
|
a85e8e |
+# define socket socket_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef connect
|
|
|
a85e8e |
+# define connect connect_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef accept
|
|
|
a85e8e |
+# define accept accept_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef bind
|
|
|
a85e8e |
+# define bind bind_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef getpeername
|
|
|
a85e8e |
+# define getpeername getpeername_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef getsockname
|
|
|
a85e8e |
+# define getsockname getsockname_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef getsockopt
|
|
|
a85e8e |
+# define getsockopt getsockopt_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef listen
|
|
|
a85e8e |
+# define listen listen_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef recv
|
|
|
a85e8e |
+# define recv recv_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef send
|
|
|
a85e8e |
+# define send send_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef recvfrom
|
|
|
a85e8e |
+# define recvfrom recvfrom_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef sendto
|
|
|
a85e8e |
+# define sendto sendto_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef setsockopt
|
|
|
a85e8e |
+# define setsockopt setsockopt_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# undef shutdown
|
|
|
a85e8e |
+# define shutdown shutdown_used_without_including_sys_socket_h
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (socket,
|
|
|
a85e8e |
+ "socket() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (connect,
|
|
|
a85e8e |
+ "connect() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (accept,
|
|
|
a85e8e |
+ "accept() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (bind,
|
|
|
a85e8e |
+ "bind() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (getpeername,
|
|
|
a85e8e |
+ "getpeername() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (getsockname,
|
|
|
a85e8e |
+ "getsockname() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (getsockopt,
|
|
|
a85e8e |
+ "getsockopt() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (listen,
|
|
|
a85e8e |
+ "listen() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (recv,
|
|
|
a85e8e |
+ "recv() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (send,
|
|
|
a85e8e |
+ "send() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (recvfrom,
|
|
|
a85e8e |
+ "recvfrom() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (sendto,
|
|
|
a85e8e |
+ "sendto() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (setsockopt,
|
|
|
a85e8e |
+ "setsockopt() used without including <sys/socket.h>");
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (shutdown,
|
|
|
a85e8e |
+ "shutdown() used without including <sys/socket.h>");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef select
|
|
|
a85e8e |
+# define select select_used_without_including_sys_select_h
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (select,
|
|
|
a85e8e |
+ "select() used without including <sys/select.h>");
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
|
|
|
a85e8e |
+#endif /* _CYGWIN_SYS_TIME_H */
|
|
|
a85e8e |
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/sys_types.in.h b/grub-core/gnulib/sys_types.in.h
|
|
|
d41074 |
index d7da35623b1..9520c09030c 100644
|
|
|
a85e8e |
--- a/grub-core/gnulib/sys_types.in.h
|
|
|
a85e8e |
+++ b/grub-core/gnulib/sys_types.in.h
|
|
|
a85e8e |
@@ -23,7 +23,9 @@
|
|
|
a85e8e |
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
|
|
|
a85e8e |
|
|
|
a85e8e |
/* The include_next requires a split double-inclusion guard. */
|
|
|
a85e8e |
+# define _GL_INCLUDING_SYS_TYPES_H
|
|
|
a85e8e |
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
|
|
|
a85e8e |
+# undef _GL_INCLUDING_SYS_TYPES_H
|
|
|
a85e8e |
|
|
|
a85e8e |
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
|
|
|
a85e8e |
#define _@GUARD_PREFIX@_SYS_TYPES_H
|
|
|
a85e8e |
diff --git a/grub-core/gnulib/time.h b/grub-core/gnulib/time.h
|
|
|
a85e8e |
new file mode 100644
|
|
|
d41074 |
index 00000000000..b9203d5569a
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/grub-core/gnulib/time.h
|
|
|
a85e8e |
@@ -0,0 +1,586 @@
|
|
|
a85e8e |
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
|
|
|
a85e8e |
+/* A more-standard <time.h>.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ Copyright (C) 2007-2014 Free Software Foundation, Inc.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is free software; you can redistribute it and/or modify
|
|
|
a85e8e |
+ it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+ the Free Software Foundation; either version 3, or (at your option)
|
|
|
a85e8e |
+ any later version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ This program is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+ GNU General Public License for more details.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#if __GNUC__ >= 3
|
|
|
a85e8e |
+#pragma GCC system_header
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Don't get in the way of glibc when it includes time.h merely to
|
|
|
a85e8e |
+ declare a few standard symbols, rather than to declare all the
|
|
|
a85e8e |
+ symbols. Also, Solaris 8 <time.h> eventually includes itself
|
|
|
a85e8e |
+ recursively; if that is happening, just include the system <time.h>
|
|
|
a85e8e |
+ without adding our own declarations. */
|
|
|
a85e8e |
+#if (defined __need_time_t || defined __need_clock_t \
|
|
|
a85e8e |
+ || defined __need_timespec \
|
|
|
a85e8e |
+ || defined _GL_TIME_H)
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# include_next <time.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# define _GL_TIME_H
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# include_next <time.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* NetBSD 5.0 mis-defines NULL. */
|
|
|
a85e8e |
+# include <stddef.h>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
|
a85e8e |
+#ifndef _GL_CXXDEFS_H
|
|
|
a85e8e |
+#define _GL_CXXDEFS_H
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The three most frequent use cases of these macros are:
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ * For providing a substitute for a function that is missing on some
|
|
|
a85e8e |
+ platforms, but is declared and works fine on the platforms on which
|
|
|
a85e8e |
+ it exists:
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ #if @GNULIB_FOO@
|
|
|
a85e8e |
+ # if !@HAVE_FOO@
|
|
|
a85e8e |
+ _GL_FUNCDECL_SYS (foo, ...);
|
|
|
a85e8e |
+ # endif
|
|
|
a85e8e |
+ _GL_CXXALIAS_SYS (foo, ...);
|
|
|
a85e8e |
+ _GL_CXXALIASWARN (foo);
|
|
|
a85e8e |
+ #elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+ ...
|
|
|
a85e8e |
+ #endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ * For providing a replacement for a function that exists on all platforms,
|
|
|
a85e8e |
+ but is broken/insufficient and needs to be replaced on some platforms:
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ #if @GNULIB_FOO@
|
|
|
a85e8e |
+ # if @REPLACE_FOO@
|
|
|
a85e8e |
+ # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+ # undef foo
|
|
|
a85e8e |
+ # define foo rpl_foo
|
|
|
a85e8e |
+ # endif
|
|
|
a85e8e |
+ _GL_FUNCDECL_RPL (foo, ...);
|
|
|
a85e8e |
+ _GL_CXXALIAS_RPL (foo, ...);
|
|
|
a85e8e |
+ # else
|
|
|
a85e8e |
+ _GL_CXXALIAS_SYS (foo, ...);
|
|
|
a85e8e |
+ # endif
|
|
|
a85e8e |
+ _GL_CXXALIASWARN (foo);
|
|
|
a85e8e |
+ #elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+ ...
|
|
|
a85e8e |
+ #endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ * For providing a replacement for a function that exists on some platforms
|
|
|
a85e8e |
+ but is broken/insufficient and needs to be replaced on some of them and
|
|
|
a85e8e |
+ is additionally either missing or undeclared on some other platforms:
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ #if @GNULIB_FOO@
|
|
|
a85e8e |
+ # if @REPLACE_FOO@
|
|
|
a85e8e |
+ # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+ # undef foo
|
|
|
a85e8e |
+ # define foo rpl_foo
|
|
|
a85e8e |
+ # endif
|
|
|
a85e8e |
+ _GL_FUNCDECL_RPL (foo, ...);
|
|
|
a85e8e |
+ _GL_CXXALIAS_RPL (foo, ...);
|
|
|
a85e8e |
+ # else
|
|
|
a85e8e |
+ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
|
|
|
a85e8e |
+ _GL_FUNCDECL_SYS (foo, ...);
|
|
|
a85e8e |
+ # endif
|
|
|
a85e8e |
+ _GL_CXXALIAS_SYS (foo, ...);
|
|
|
a85e8e |
+ # endif
|
|
|
a85e8e |
+ _GL_CXXALIASWARN (foo);
|
|
|
a85e8e |
+ #elif defined GNULIB_POSIXCHECK
|
|
|
a85e8e |
+ ...
|
|
|
a85e8e |
+ #endif
|
|
|
a85e8e |
+*/
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_EXTERN_C declaration;
|
|
|
a85e8e |
+ performs the declaration with C linkage. */
|
|
|
a85e8e |
+#if defined __cplusplus
|
|
|
a85e8e |
+# define _GL_EXTERN_C extern "C"
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_EXTERN_C extern
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
|
|
|
a85e8e |
+ declares a replacement function, named rpl_func, with the given prototype,
|
|
|
a85e8e |
+ consisting of return type, parameters, and attributes.
|
|
|
a85e8e |
+ Example:
|
|
|
a85e8e |
+ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+ */
|
|
|
a85e8e |
+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
|
|
|
a85e8e |
+ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
|
|
|
a85e8e |
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
|
|
|
a85e8e |
+ _GL_EXTERN_C rettype rpl_func parameters_and_attributes
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
|
|
|
a85e8e |
+ declares the system function, named func, with the given prototype,
|
|
|
a85e8e |
+ consisting of return type, parameters, and attributes.
|
|
|
a85e8e |
+ Example:
|
|
|
a85e8e |
+ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+ */
|
|
|
a85e8e |
+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
|
|
|
a85e8e |
+ _GL_EXTERN_C rettype func parameters_and_attributes
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIAS_RPL (func, rettype, parameters);
|
|
|
a85e8e |
+ declares a C++ alias called GNULIB_NAMESPACE::func
|
|
|
a85e8e |
+ that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
|
|
|
a85e8e |
+ Example:
|
|
|
a85e8e |
+ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
|
|
|
a85e8e |
+ */
|
|
|
a85e8e |
+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
|
|
|
a85e8e |
+ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
|
|
a85e8e |
+ namespace GNULIB_NAMESPACE \
|
|
|
a85e8e |
+ { \
|
|
|
a85e8e |
+ rettype (*const func) parameters = ::rpl_func; \
|
|
|
a85e8e |
+ } \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
|
|
|
a85e8e |
+ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
|
|
|
a85e8e |
+ except that the C function rpl_func may have a slightly different
|
|
|
a85e8e |
+ declaration. A cast is used to silence the "invalid conversion" error
|
|
|
a85e8e |
+ that would otherwise occur. */
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
|
|
a85e8e |
+ namespace GNULIB_NAMESPACE \
|
|
|
a85e8e |
+ { \
|
|
|
a85e8e |
+ rettype (*const func) parameters = \
|
|
|
a85e8e |
+ reinterpret_cast<rettype(*)parameters>(::rpl_func); \
|
|
|
a85e8e |
+ } \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIAS_SYS (func, rettype, parameters);
|
|
|
a85e8e |
+ declares a C++ alias called GNULIB_NAMESPACE::func
|
|
|
a85e8e |
+ that redirects to the system provided function func, if GNULIB_NAMESPACE
|
|
|
a85e8e |
+ is defined.
|
|
|
a85e8e |
+ Example:
|
|
|
a85e8e |
+ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
|
|
|
a85e8e |
+ */
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+ /* If we were to write
|
|
|
a85e8e |
+ rettype (*const func) parameters = ::func;
|
|
|
a85e8e |
+ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
|
|
|
a85e8e |
+ better (remove an indirection through a 'static' pointer variable),
|
|
|
a85e8e |
+ but then the _GL_CXXALIASWARN macro below would cause a warning not only
|
|
|
a85e8e |
+ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
|
|
|
a85e8e |
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
|
|
a85e8e |
+ namespace GNULIB_NAMESPACE \
|
|
|
a85e8e |
+ { \
|
|
|
a85e8e |
+ static rettype (*func) parameters = ::func; \
|
|
|
a85e8e |
+ } \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
|
|
|
a85e8e |
+ is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
|
|
a85e8e |
+ except that the C function func may have a slightly different declaration.
|
|
|
a85e8e |
+ A cast is used to silence the "invalid conversion" error that would
|
|
|
a85e8e |
+ otherwise occur. */
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
|
|
a85e8e |
+ namespace GNULIB_NAMESPACE \
|
|
|
a85e8e |
+ { \
|
|
|
a85e8e |
+ static rettype (*func) parameters = \
|
|
|
a85e8e |
+ reinterpret_cast<rettype(*)parameters>(::func); \
|
|
|
a85e8e |
+ } \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
|
|
|
a85e8e |
+ is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
|
|
a85e8e |
+ except that the C function is picked among a set of overloaded functions,
|
|
|
a85e8e |
+ namely the one with rettype2 and parameters2. Two consecutive casts
|
|
|
a85e8e |
+ are used to silence the "cannot find a match" and "invalid conversion"
|
|
|
a85e8e |
+ errors that would otherwise occur. */
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+ /* The outer cast must be a reinterpret_cast.
|
|
|
a85e8e |
+ The inner cast: When the function is defined as a set of overloaded
|
|
|
a85e8e |
+ functions, it works as a static_cast<>, choosing the designated variant.
|
|
|
a85e8e |
+ When the function is defined as a single variant, it works as a
|
|
|
a85e8e |
+ reinterpret_cast<>. The parenthesized cast syntax works both ways. */
|
|
|
a85e8e |
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
|
|
a85e8e |
+ namespace GNULIB_NAMESPACE \
|
|
|
a85e8e |
+ { \
|
|
|
a85e8e |
+ static rettype (*func) parameters = \
|
|
|
a85e8e |
+ reinterpret_cast<rettype(*)parameters>( \
|
|
|
a85e8e |
+ (rettype2(*)parameters2)(::func)); \
|
|
|
a85e8e |
+ } \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIASWARN (func);
|
|
|
a85e8e |
+ causes a warning to be emitted when ::func is used but not when
|
|
|
a85e8e |
+ GNULIB_NAMESPACE::func is used. func must be defined without overloaded
|
|
|
a85e8e |
+ variants. */
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN(func) \
|
|
|
a85e8e |
+ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN_1(func,namespace) \
|
|
|
a85e8e |
+ _GL_CXXALIASWARN_2 (func, namespace)
|
|
|
a85e8e |
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
|
|
a85e8e |
+ we enable the warning only when not optimizing. */
|
|
|
a85e8e |
+# if !__OPTIMIZE__
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN_2(func,namespace) \
|
|
|
a85e8e |
+ _GL_WARN_ON_USE (func, \
|
|
|
a85e8e |
+ "The symbol ::" #func " refers to the system function. " \
|
|
|
a85e8e |
+ "Use " #namespace "::" #func " instead.")
|
|
|
a85e8e |
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN_2(func,namespace) \
|
|
|
a85e8e |
+ extern __typeof__ (func) func
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN_2(func,namespace) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN(func) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
|
|
|
a85e8e |
+ causes a warning to be emitted when the given overloaded variant of ::func
|
|
|
a85e8e |
+ is used but not when GNULIB_NAMESPACE::func is used. */
|
|
|
a85e8e |
+#if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
|
|
a85e8e |
+ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
|
|
|
a85e8e |
+ GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
|
|
|
a85e8e |
+ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
|
|
|
a85e8e |
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
|
|
a85e8e |
+ we enable the warning only when not optimizing. */
|
|
|
a85e8e |
+# if !__OPTIMIZE__
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
|
|
a85e8e |
+ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
|
|
|
a85e8e |
+ "The symbol ::" #func " refers to the system function. " \
|
|
|
a85e8e |
+ "Use " #namespace "::" #func " instead.")
|
|
|
a85e8e |
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
|
|
a85e8e |
+ extern __typeof__ (func) func
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#else
|
|
|
a85e8e |
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
|
|
a85e8e |
+ _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#endif /* _GL_CXXDEFS_H */
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definition of _GL_ARG_NONNULL is copied here. */
|
|
|
a85e8e |
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
|
|
a85e8e |
+ that the values passed as arguments n, ..., m must be non-NULL pointers.
|
|
|
a85e8e |
+ n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
|
|
a85e8e |
+#ifndef _GL_ARG_NONNULL
|
|
|
a85e8e |
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
|
|
a85e8e |
+# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define _GL_ARG_NONNULL(params)
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* The definition of _GL_WARN_ON_USE is copied here. */
|
|
|
a85e8e |
+#ifndef _GL_WARN_ON_USE
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
|
|
a85e8e |
+/* A compiler attribute is available in gcc versions 4.3.0 and later. */
|
|
|
a85e8e |
+# define _GL_WARN_ON_USE(function, message) \
|
|
|
a85e8e |
+extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
|
|
|
a85e8e |
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
|
a85e8e |
+/* Verify the existence of the function. */
|
|
|
a85e8e |
+# define _GL_WARN_ON_USE(function, message) \
|
|
|
a85e8e |
+extern __typeof__ (function) function
|
|
|
a85e8e |
+# else /* Unsupported. */
|
|
|
a85e8e |
+# define _GL_WARN_ON_USE(function, message) \
|
|
|
a85e8e |
+_GL_WARN_EXTERN_C int _gl_warn_on_use
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
|
|
|
a85e8e |
+ is like _GL_WARN_ON_USE (function, "string"), except that the function is
|
|
|
a85e8e |
+ declared with the given prototype, consisting of return type, parameters,
|
|
|
a85e8e |
+ and attributes.
|
|
|
a85e8e |
+ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
|
|
|
a85e8e |
+ not work in this case. */
|
|
|
a85e8e |
+#ifndef _GL_WARN_ON_USE_CXX
|
|
|
a85e8e |
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
|
|
a85e8e |
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
|
|
a85e8e |
+extern rettype function parameters_and_attributes \
|
|
|
a85e8e |
+ __attribute__ ((__warning__ (msg)))
|
|
|
a85e8e |
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
|
a85e8e |
+/* Verify the existence of the function. */
|
|
|
a85e8e |
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
|
|
a85e8e |
+extern rettype function parameters_and_attributes
|
|
|
a85e8e |
+# else /* Unsupported. */
|
|
|
a85e8e |
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
|
|
a85e8e |
+_GL_WARN_EXTERN_C int _gl_warn_on_use
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* _GL_WARN_EXTERN_C declaration;
|
|
|
a85e8e |
+ performs the declaration with C linkage. */
|
|
|
a85e8e |
+#ifndef _GL_WARN_EXTERN_C
|
|
|
a85e8e |
+# if defined __cplusplus
|
|
|
a85e8e |
+# define _GL_WARN_EXTERN_C extern "C"
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# define _GL_WARN_EXTERN_C extern
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+#endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
|
|
|
a85e8e |
+ Or they define it with the wrong member names or define it in <sys/time.h>
|
|
|
a85e8e |
+ (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it,
|
|
|
a85e8e |
+ but the pthreads-win32 library defines it in <pthread.h>. */
|
|
|
a85e8e |
+# if ! 1
|
|
|
a85e8e |
+# if 0
|
|
|
a85e8e |
+# include <sys/time.h>
|
|
|
a85e8e |
+# elif 0
|
|
|
a85e8e |
+# include <pthread.h>
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# ifdef __cplusplus
|
|
|
a85e8e |
+extern "C" {
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if !GNULIB_defined_struct_timespec
|
|
|
a85e8e |
+# undef timespec
|
|
|
a85e8e |
+# define timespec rpl_timespec
|
|
|
a85e8e |
+struct timespec
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ time_t tv_sec;
|
|
|
a85e8e |
+ long int tv_nsec;
|
|
|
a85e8e |
+};
|
|
|
a85e8e |
+# define GNULIB_defined_struct_timespec 1
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# ifdef __cplusplus
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# if !GNULIB_defined_struct_time_t_must_be_integral
|
|
|
a85e8e |
+/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
|
|
|
a85e8e |
+ time_t to be an integer type, even though C99 permits floating
|
|
|
a85e8e |
+ point. We don't know of any implementation that uses floating
|
|
|
a85e8e |
+ point, and it is much easier to write code that doesn't have to
|
|
|
a85e8e |
+ worry about that corner case, so we force the issue. */
|
|
|
a85e8e |
+struct __time_t_must_be_integral {
|
|
|
a85e8e |
+ unsigned int __floating_time_t_unsupported : (time_t) 1;
|
|
|
a85e8e |
+};
|
|
|
a85e8e |
+# define GNULIB_defined_struct_time_t_must_be_integral 1
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
|
|
|
a85e8e |
+ return -1 and store the remaining time into RMTP. See
|
|
|
a85e8e |
+ <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
|
|
|
a85e8e |
+# if 0
|
|
|
a85e8e |
+# if GNULIB_PORTCHECK
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define nanosleep rpl_nanosleep
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (nanosleep, int,
|
|
|
a85e8e |
+ (struct timespec const *__rqtp, struct timespec *__rmtp)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (nanosleep, int,
|
|
|
a85e8e |
+ (struct timespec const *__rqtp, struct timespec *__rmtp));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if ! 1
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (nanosleep, int,
|
|
|
a85e8e |
+ (struct timespec const *__rqtp, struct timespec *__rmtp)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (nanosleep, int,
|
|
|
a85e8e |
+ (struct timespec const *__rqtp, struct timespec *__rmtp));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (nanosleep);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Return the 'time_t' representation of TP and normalize TP. */
|
|
|
a85e8e |
+# if 0
|
|
|
a85e8e |
+# if GNULIB_PORTCHECK
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# define mktime rpl_mktime
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (mktime);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
|
|
|
a85e8e |
+ <http://www.opengroup.org/susv3xsh/localtime_r.html> and
|
|
|
a85e8e |
+ <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
|
|
|
a85e8e |
+# if 0
|
|
|
a85e8e |
+# if GNULIB_PORTCHECK
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef localtime_r
|
|
|
a85e8e |
+# define localtime_r rpl_localtime_r
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1, 2)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if ! 1
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1, 2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if 1
|
|
|
a85e8e |
+_GL_CXXALIASWARN (localtime_r);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if GNULIB_PORTCHECK
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef gmtime_r
|
|
|
a85e8e |
+# define gmtime_r rpl_gmtime_r
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1, 2)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+# if ! 1
|
|
|
a85e8e |
+_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1, 2)));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
|
a85e8e |
+ struct tm *restrict __result));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# if 1
|
|
|
a85e8e |
+_GL_CXXALIASWARN (gmtime_r);
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
|
|
|
a85e8e |
+ <http://www.opengroup.org/susv3xsh/localtime.html> and
|
|
|
a85e8e |
+ <http://www.opengroup.org/susv3xsh/gmtime.html>. */
|
|
|
a85e8e |
+# if 1
|
|
|
a85e8e |
+# if 0
|
|
|
a85e8e |
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
|
a85e8e |
+# undef localtime
|
|
|
a85e8e |
+# define localtime rpl_localtime
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
|
|
|
a85e8e |
+ _GL_ARG_NONNULL ((1)));
|
|
|
a85e8e |
+_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
|
|
|
a85e8e |
+# else
|
|
|
a85e8e |
+_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
|
|
|
a85e8e |
+# endif
|
|
|
a85e8e |
+_GL_CXXALIASWARN (localtime);
|
|
|
|