* lib/get_ppid_of.c: Replace use of __GNU__ with __gnu_hurd__.
* lib/get_progname_of.c: Likewise.
* lib/sigsegv.c: Likewise.
* lib/sigsegv.in.h: Likewise.
* lib/vma-iter.c: Likewise.
* lib/vma-iter.h: Likewise.
* tests/test-ptsname.c: Likewise.
* tests/test-ptsname_r.c: Likewise.
* tests/test-sigsegv-catch-stackoverflow1.c: Likewise.
* tests/test-sigsegv-catch-stackoverflow2.c: Likewise.
* lib/getloadavg.c: Likewise. Adjust conditions and comments to account
for the fact that NeXT defines __GNU__ and not __gnu_hurd__.
2025-03-18 Collin Funk <collin.funk1@gmail.com>
+ Prefer the __gnu_hurd__ macro over __GNU__.
+ * lib/get_ppid_of.c: Replace use of __GNU__ with __gnu_hurd__.
+ * lib/get_progname_of.c: Likewise.
+ * lib/sigsegv.c: Likewise.
+ * lib/sigsegv.in.h: Likewise.
+ * lib/vma-iter.c: Likewise.
+ * lib/vma-iter.h: Likewise.
+ * tests/test-ptsname.c: Likewise.
+ * tests/test-ptsname_r.c: Likewise.
+ * tests/test-sigsegv-catch-stackoverflow1.c: Likewise.
+ * tests/test-sigsegv-catch-stackoverflow2.c: Likewise.
+ * lib/getloadavg.c: Likewise. Adjust conditions and comments to account
+ for the fact that NeXT defines __GNU__ and not __gnu_hurd__.
+
utimensat: Make sure exit status in configure check doesn't exceed 127.
Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-03/msg00061.html>.
#include <stdio.h>
#include <string.h>
-#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix || defined __sun /* Linux, GNU/kFreeBSD, GNU/Hurd, FreeBSD, NetBSD, Minix, Solaris */
+#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix || defined __sun /* Linux, GNU/kFreeBSD, GNU/Hurd, FreeBSD, NetBSD, Minix, Solaris */
# include <fcntl.h>
# include <unistd.h>
#endif
pid_t
get_ppid_of (pid_t pid)
{
-#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ /* Linux, GNU/kFreeBSD, GNU/Hurd */
+#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ /* Linux, GNU/kFreeBSD, GNU/Hurd */
/* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc
file system. */
#include <stdlib.h>
#include <string.h>
-#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ || defined __NetBSD__ || defined __FreeBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD, FreeBSD */
+#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ || defined __NetBSD__ || defined __FreeBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD, FreeBSD */
# include <unistd.h>
# if defined __ANDROID__
# include <fcntl.h>
char *
get_progname_of (pid_t pid)
{
-#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ || defined __NetBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD */
+#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ || defined __NetBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD */
/* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc
file system. */
# endif
/* Same issues as for NeXT apply to the HURD-based GNU system. */
-# ifdef __GNU__
+# if defined __gnu_hurd__ || defined NeXT
# undef BSD
# undef FSCALE
-# endif /* __GNU__ */
+# endif /* __gnu_hurd__ || NeXT */
/* Set values that are different from the defaults, which are
set a little farther down with #ifndef. */
# endif
# endif
-# if defined (__GNU__) && !defined (NeXT)
-/* Note that NeXT Openstep defines __GNU__ even though it should not. */
+# if defined __gnu_hurd__ && !defined NeXT
/* GNU system acts much like NeXT, for load average purposes,
but not exactly. */
# define NeXT
#endif
-#if defined __GNU__ /* Hurd */
+#if defined __gnu_hurd__ /* Hurd */
# define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, long code, struct sigcontext *scp
# define SIGSEGV_FAULT_ADDRESS (unsigned long) code
/* List of signals that are sent when an invalid virtual memory address
is accessed, or when the stack overflows. */
-#if defined __GNU__ \
+#if defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \
|| defined __NetBSD__ || defined __OpenBSD__ \
|| (defined __APPLE__ && defined __MACH__)
/* -------------------------- leave-sigaltstack.c -------------------------- */
-# if defined __GNU__ \
+# if defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \
|| defined __NetBSD__ || defined __OpenBSD__
/* HAVE_SIGSEGV_RECOVERY
is defined if the system supports catching SIGSEGV. */
-#if defined __linux__ || defined __ANDROID__ || defined __GNU__ \
+#if defined __linux__ || defined __ANDROID__ || defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \
|| defined __NetBSD__ \
|| defined __OpenBSD__ \
/* HAVE_STACK_OVERFLOW_RECOVERY
is defined if stack overflow can be caught. */
-#if defined __linux__ || defined __ANDROID__ || defined __GNU__ \
+#if defined __linux__ || defined __ANDROID__ || defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \
|| (defined __NetBSD__ && !(defined __sparc__ || defined __sparc64__)) \
|| defined __OpenBSD__ \
|| defined _AIX || defined __sun \
|| defined __CYGWIN__ || defined __HAIKU__
typedef ucontext_t *stackoverflow_context_t;
-# elif defined __GNU__ \
+# elif defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \
|| defined __OpenBSD__ || defined __sgi
typedef struct sigcontext *stackoverflow_context_t;
# include <mach/mach.h>
#endif
-#if defined __GNU__ /* GNU/Hurd */
+#if defined __gnu_hurd__ /* GNU/Hurd */
# include <mach/mach.h>
#endif
}
return 0;
-#elif defined __GNU__ /* GNU/Hurd */
+#elif defined __gnu_hurd__ /* GNU/Hurd */
/* The Hurd has a /proc/self/maps that looks like the Linux one, but it
lacks the VMAs created through anonymous mmap. Therefore use the Mach
this platform.
Note that even when this macro is defined, vma_iterate() may still fail to
find any virtual memory area, for example if /proc is not mounted. */
-#if defined __linux__ || defined __ANDROID__ || defined __GNU__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY
+#if defined __linux__ || defined __ANDROID__ || defined __gnu_hurd__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY
# define VMA_ITERATE_SUPPORTED 1
#endif
close (fd);
}
-#elif defined __GNU__ /* Hurd */
+#elif defined __gnu_hurd__ /* Hurd */
/* Try various master names of Hurd: /dev/pty[p-q][0-9a-v] */
{
close (fd);
}
-#elif defined __GNU__ /* Hurd */
+#elif defined __gnu_hurd__ /* Hurd */
/* Try various master names of Hurd: /dev/pty[p-q][0-9a-v] */
{
/* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error
"*** longjmp causes uninitialized stack frame ***: terminated".
Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=32522> */
-#ifdef __GNU__
+#ifdef __gnu_hurd__
# undef _FORTIFY_SOURCE
# undef __USE_FORTIFY_LEVEL
#endif
/* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error
"*** longjmp causes uninitialized stack frame ***: terminated".
Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=32522> */
-#ifdef __GNU__
+#ifdef __gnu_hurd__
# undef _FORTIFY_SOURCE
# undef __USE_FORTIFY_LEVEL
#endif