[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/getloadavg.c
From: |
Dave Love |
Subject: |
[Emacs-diffs] Changes to emacs/src/getloadavg.c |
Date: |
Thu, 05 Jun 2003 12:24:51 -0400 |
Index: emacs/src/getloadavg.c
diff -c emacs/src/getloadavg.c:1.45 emacs/src/getloadavg.c:1.46
*** emacs/src/getloadavg.c:1.45 Tue Jun 20 09:17:40 2000
--- emacs/src/getloadavg.c Thu Jun 5 12:24:51 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)
***************
*** 37,47 ****
apollo, DGUX, NeXT, or UMAX is defined;
or we have libkstat;
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:
--- 40,54 ----
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:
***************
*** 99,106 ****
extern int errno;
#endif
! #ifndef HAVE_GETLOADAVG
/* The existing Emacs configuration files define a macro called
LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
--- 106,119 ----
extern int errno;
#endif
! #ifdef HAVE_LOCALE_H
! # include <locale.h>
! #endif
! #ifndef HAVE_SETLOCALE
! # define setlocale(Category, Locale) /* empty */
! #endif
+ #ifndef HAVE_GETLOADAVG
/* The existing Emacs configuration files define a macro called
LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
***************
*** 288,294 ****
/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
above under #ifdef MIPS. But we want the sgi value. */
# undef FSCALE
! # define FSCALE 1000.0
# endif
# if defined (ardent) && defined (titan)
--- 301,307 ----
/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
above under #ifdef MIPS. But we want the sgi value. */
# undef FSCALE
! # define FSCALE 1000.0
# endif
# if defined (ardent) && defined (titan)
***************
*** 306,314 ****
# endif /* Not FSCALE. */
# if !defined (LDAV_CVT) && defined (FSCALE)
! # define LDAV_CVT(n) (((double) (n)) / FSCALE)
# endif
# if defined(sgi) || (defined(mips) && !defined(BSD))
# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
--- 319,332 ----
# endif /* Not FSCALE. */
# if !defined (LDAV_CVT) && defined (FSCALE)
! # define LDAV_CVT(n) (((double) (n)) / FSCALE)
# endif
+ # ifndef NLIST_STRUCT
+ # if HAVE_NLIST_H
+ # define NLIST_STRUCT
+ # endif
+ # endif
# if defined(sgi) || (defined(mips) && !defined(BSD))
# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
***************
*** 446,452 ****
# include <sys/file.h>
# endif
-
/* Avoid static vars inside a function since in HPUX they dump as pure. */
# ifdef NeXT
--- 464,469 ----
***************
*** 471,483 ****
/* Offset in kmem to seek to read load average, or 0 means invalid. */
static long offset;
! #if !defined(VMS) && !defined(sgi) && !defined(__linux__)
static struct nlist nl[2];
! #endif /* Not VMS or sgi */
! #ifdef SUNOS_5
static kvm_t *kd;
! #endif /* SUNOS_5 */
#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
--- 488,500 ----
/* Offset in kmem to seek to read load average, or 0 means invalid. */
static long offset;
! # if !defined(VMS) && !defined(sgi) && !defined(__linux__)
static struct nlist nl[2];
! # endif /* Not VMS or sgi */
! # ifdef SUNOS_5
static kvm_t *kd;
! # endif /* SUNOS_5 */
#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
***************
*** 585,592 ****
--- 602,612 ----
if (count <= 0)
return -1;
+ /* The following sscanf must use the C locale. */
+ setlocale (LC_NUMERIC, "C");
count = sscanf (ldavgbuf, "%lf %lf %lf",
&load_ave[0], &load_ave[1], &load_ave[2]);
+ setlocale (LC_NUMERIC, "");
if (count < 1)
return -1;
***************
*** 862,874 ****
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
***************
*** 977,983 ****
#endif /* ! HAVE_GETLOADAVG */
#ifdef TEST
! int
main (argc, argv)
int argc;
char **argv;
--- 997,1003 ----
#endif /* ! HAVE_GETLOADAVG */
#ifdef TEST
! void
main (argc, argv)
int argc;
char **argv;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/src/getloadavg.c,
Dave Love <=