[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] changes for getloadavg.c
From: |
Dave Love |
Subject: |
[Bug-gnulib] changes for getloadavg.c |
Date: |
Thu, 05 Jun 2003 17:26:09 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) |
2003-06-05 Dave Love <address@hidden>
[From Emacs.]
* getloadavg.c: Check `__unix' as well as `unix'. Use #ifdef, not
#if. Check HAVE_LIBKSTAT as well as LOAD_AVE_TYPE. Check
F_SETFD, not FD_SETFD. Use HAVE_STRUCT_NLIST_N_UN_N_NAME, not
obsolete NLIST_NAME_UNION.
[__GNU__]: Undef BSD and FSCALE.
[!NLIST_STRUCT]: Remove conditional definition of NLIST_STRUCT.
*** getloadavg.c.~1.16.~ Mon Jun 19 08:25:01 2000
--- getloadavg.c Thu Jun 5 17:19:30 2003
***************
*** 1,7 ****
/* Get the system load averages.
! Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995, 1997
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
--- 1,10 ----
/* Get the system load averages.
! Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995, 1997, 2003
Free Software Foundation, Inc.
+ NOTE: The canonical source of this file is maintained with gnulib.
+ Bugs can be reported to address@hidden
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
***************
*** 35,46 ****
LOAD_AVE_TYPE Type of the load average array in the kernel.
Must be defined unless one of
apollo, DGUX, NeXT, or UMAX is defined;
otherwise, no load average is available.
NLIST_STRUCT Include nlist.h, not a.out.h, and
the nlist n_name element is a pointer,
not an array.
! NLIST_NAME_UNION struct nlist has an n_un member, not n_name.
LINUX_LDAV_FILE [__linux__]: File containing load averages.
Specific system predefines this file uses, aside from setting
default values if not emacs:
--- 38,54 ----
LOAD_AVE_TYPE Type of the load average array in the kernel.
Must be defined unless one of
apollo, DGUX, NeXT, or UMAX is defined;
+ or we have libkstat;
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,
not an array.
! HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
LINUX_LDAV_FILE [__linux__]: File containing load averages.
+ HAVE_LOCALE_H locale.h is available.
+ HAVE_SETLOCALE The `setlocale' function is available.
Specific system predefines this file uses, aside from setting
default values if not emacs:
***************
*** 81,87 ****
/* Both the Emacs and non-Emacs sections want this. Some
configuration files' definitions for the LOAD_AVE_CVT macro (like
sparc.h's) use macros like FSCALE, defined here. */
! #ifdef unix
# include <sys/param.h>
#endif
--- 89,95 ----
/* Both the Emacs and non-Emacs sections want this. Some
configuration files' definitions for the LOAD_AVE_CVT macro (like
sparc.h's) use macros like FSCALE, defined here. */
! #if defined (unix) || defined (__unix)
# include <sys/param.h>
#endif
***************
*** 98,107 ****
extern int errno;
#endif
! #if HAVE_LOCALE_H
# include <locale.h>
#endif
! #if !HAVE_SETLOCALE
# define setlocale(Category, Locale) /* empty */
#endif
--- 106,115 ----
extern int errno;
#endif
! #ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
! #ifndef HAVE_SETLOCALE
# define setlocale(Category, Locale) /* empty */
#endif
***************
*** 137,142 ****
--- 145,156 ----
# undef FSCALE
# endif
+ /* Same issues as for NeXT apply to the HURD-based GNU system. */
+ # ifdef __GNU__
+ # undef BSD
+ # undef FSCALE
+ # endif /* __GNU__ */
+
/* Set values that are different from the defaults, which are
set a little farther down with #ifndef. */
***************
*** 314,381 ****
# endif
# endif
- /* VAX C can't handle multi-line #ifs, or lines longer that 256 characters.
*/
- # ifndef NLIST_STRUCT
-
- # ifdef MORE_BSD
- # define NLIST_STRUCT
- # endif
-
- # ifdef sun
- # define NLIST_STRUCT
- # endif
-
- # ifdef decstation
- # define NLIST_STRUCT
- # endif
-
- # ifdef hpux
- # define NLIST_STRUCT
- # endif
-
- # if defined (_SEQUENT_) || defined (sequent)
- # define NLIST_STRUCT
- # endif
-
- # ifdef sgi
- # define NLIST_STRUCT
- # endif
-
- # ifdef SVR4
- # define NLIST_STRUCT
- # endif
-
- # ifdef sony_news
- # define NLIST_STRUCT
- # endif
-
- # ifdef OSF_ALPHA
- # define NLIST_STRUCT
- # endif
-
- # if defined (ardent) && defined (titan)
- # define NLIST_STRUCT
- # endif
-
- # ifdef tek4300
- # define NLIST_STRUCT
- # endif
-
- # ifdef butterfly
- # define NLIST_STRUCT
- # endif
-
- # if defined(alliant) && defined(i860) /* Alliant FX/2800 */
- # define NLIST_STRUCT
- # endif
-
- # ifdef _AIX
- # define NLIST_STRUCT
- # endif
-
- # endif /* defined (NLIST_STRUCT) */
-
-
# if defined(sgi) || (defined(mips) && !defined(BSD))
# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
# endif
--- 328,333 ----
***************
*** 528,534 ****
static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
# endif /* DGUX */
! # ifdef LOAD_AVE_TYPE
/* File descriptor open to /dev/kmem or VMS load ave driver. */
static int channel;
/* Nonzero iff channel is valid. */
--- 480,486 ----
static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
# endif /* DGUX */
! #if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE)
/* File descriptor open to /dev/kmem or VMS load ave driver. */
static int channel;
/* Nonzero iff channel is valid. */
***************
*** 544,550 ****
static kvm_t *kd;
# endif /* SUNOS_5 */
! # endif /* LOAD_AVE_TYPE */
/* Put the 1 minute, 5 minute and 15 minute load averages
into the first NELEM elements of LOADAVG.
--- 496,502 ----
static kvm_t *kd;
# endif /* SUNOS_5 */
! #endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
/* Put the 1 minute, 5 minute and 15 minute load averages
into the first NELEM elements of LOADAVG.
***************
*** 930,942 ****
strcpy (nl[0].n_name, LDAV_SYMBOL);
strcpy (nl[1].n_name, "");
# else /* NLIST_STRUCT */
! # ifdef NLIST_NAME_UNION
nl[0].n_un.n_name = LDAV_SYMBOL;
nl[1].n_un.n_name = 0;
! # else /* not NLIST_NAME_UNION */
nl[0].n_name = LDAV_SYMBOL;
nl[1].n_name = 0;
! # endif /* not NLIST_NAME_UNION */
# endif /* NLIST_STRUCT */
# ifndef SUNOS_5
--- 882,894 ----
strcpy (nl[0].n_name, LDAV_SYMBOL);
strcpy (nl[1].n_name, "");
# else /* NLIST_STRUCT */
! # ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
nl[0].n_un.n_name = LDAV_SYMBOL;
nl[1].n_un.n_name = 0;
! # else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
nl[0].n_name = LDAV_SYMBOL;
nl[1].n_name = 0;
! # endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
# endif /* NLIST_STRUCT */
# ifndef SUNOS_5
***************
*** 973,979 ****
{
/* Set the channel to close on exec, so it does not
litter any child's descriptor table. */
! # ifdef FD_SETFD
# ifndef FD_CLOEXEC
# define FD_CLOEXEC 1
# endif
--- 925,931 ----
{
/* Set the channel to close on exec, so it does not
litter any child's descriptor table. */
! # ifdef F_SETFD
# ifndef FD_CLOEXEC
# define FD_CLOEXEC 1
# endif
- [Bug-gnulib] changes for getloadavg.c,
Dave Love <=