bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getloadavg.c fails to compile on QNX 6.4.1


From: Jim Meyering
Subject: Re: getloadavg.c fails to compile on QNX 6.4.1
Date: Fri, 31 Jul 2009 10:22:44 +0200

address@hidden wrote:
> How about this?
...

Thank you!

I always feel slightly dirty when changing getloadvg-related
files, but this time it wasn't as bad ;-)
I added a log entry, adjusted comments, and pushed this:
(also pushed the ChangeLog-entry addition)

>From 4feca6e66c4ac183f4cd4740204835b6bdc4c403 Mon Sep 17 00:00:00 2001
From: Matt Kraai <address@hidden>
Date: Wed, 29 Jul 2009 08:33:59 -0700
Subject: [PATCH] getloadavg: check whether n_name is a pointer, for QNX 6.4.1

* lib/getloadavg.c (getloadavg): Use the strcpy-into-nlist.n_name
code also if ! defined N_NAME_POINTER.
* m4/getloadavg.m4 (gl_GETLOADAVG): Add a link-test for N_NAME_POINTER.
This is required on QNX 6.4.1, where /usr/include/nlist.h exists,
but the n_name member is a 12-byte array.
---
 lib/getloadavg.c |    6 +++---
 m4/getloadavg.m4 |    9 +++++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 5a4005c..d968e5b 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -44,8 +44,8 @@
                                otherwise, no load average is available.
    HAVE_NLIST_H                 nlist.h is available.  NLIST_STRUCT defaults
                                 to this.
-   NLIST_STRUCT                        Include nlist.h, not a.out.h, and
-                               the nlist n_name element is a pointer,
+   NLIST_STRUCT                        Include nlist.h, not a.out.h.
+   NLIST_POINTER               The nlist n_name element is a pointer,
                                not an array.
    HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
    LINUX_LDAV_FILE             [__linux__, __CYGWIN__]: File containing
@@ -900,7 +900,7 @@ getloadavg (double loadavg[], int nelem)
   if (offset == 0)
     {
 #  ifndef sgi
-#   ifndef NLIST_STRUCT
+#   if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
       strcpy (nl[0].n_name, LDAV_SYMBOL);
       strcpy (nl[1].n_name, "");
 #   else /* NLIST_STRUCT */
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 015bcac..28237d7 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -174,5 +174,14 @@ AC_CHECK_HEADERS([nlist.h],
                              `n_un' member.  Obsolete, depend on
                              `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
                  address@hidden:@include <nlist.h>])
+ AC_TRY_LINK([#include <nlist.h>],
+             [struct nlist x;
+              #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+              x.n_un.n_name = "";
+              #else
+              x.n_name = "";
+              #endif],
+             [AC_DEFINE([N_NAME_POINTER], [1],
+                        [Define to 1 if the nlist n_name member is a 
pointer])])
 ])dnl
 ])# gl_PREREQ_GETLOADAVG
--
1.6.4.212.g4719




reply via email to

[Prev in Thread] Current Thread [Next in Thread]