summaryrefslogtreecommitdiff
path: root/lib/getloadavg.c
Commit message (Collapse)AuthorAgeFilesLines
* getloadavg: Add comments about platforms.Bruno Haible2011-02-181-6/+10
| | | | | * m4/getloadavg.m4: Add comment. * lib/getloadavg.c: Likewise.
* * lib/getloadavg.c (getloadavg) [sgi]: Make ldav_off of type ptrdiff_t.Paul Eggert2011-02-171-3/+1
| | | | | | It was 'int', but this doesn't match the IRIX 6.5 manual. Suggested by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00207.html>.
* getloadavg: set errnoPaul Eggert2011-02-151-59/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/getloadavg.c: Set errno when returning -1. If no other error number looks appropriate, set it to ENOSYS if the getloadavg looks like it can't possibly ever work, ENOTSUP otherwise. Suggested by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00187.html>. getloadavg: trim unused parts and speed up 'configure' * NEWS: Document this. * lib/getloadavg.c: Ignore HAVE_GETLOADAVG; this file is now always compiled if getloadavg is absent. Move test code to ... * tests/test-getloadavg.c: New file, containing previous contents of test from lib/getloadavg.c. It also contains suggestions by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00186.html>. * modules/getloadavg-tests: New file. * m4/getloadavg.m4 (gl_GETLOADAVG): Do not check for getloadavg twice. Do tests in the same order as they're needed for getloadavg.c. Omit setgid-related tests that generate symbols KMEM_GROUP, NEET_SETGID, GETLOADAVG_PRIVILEGED; nobody seems to use those any more. Do only the tests that are needed to see whether the system has getloadavg, moving the other tests into ... (gl_PREREQ_GETLOADAVG): ... here. Do not define obsolete symbol NLIST_NAME_UNION; nobody should be using it. Do not define symbols C_GETLOADAVG and HAVE_GETLOADAVG; they're no longer relevant, as the user of this module shouldn't care how getloadavg is implemented.
* getloadavg: omit unused varPaul Eggert2011-02-151-1/+0
| | | | * lib/getloadavg.c (getloadavg): Omit unused local variable.
* getloadavg: don't depend on c-strtod, cloexec, fcntl-saferPaul Eggert2011-02-081-17/+42
| | | | | | | | | | | | | | | | | See the thread rooted at <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00090.html>. * lib/getloadavg.c: Do not include c-strtod.h, cloexec.h, or fcntl--.h. Include <fcntl.h> only if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5 || (defined LOAD_AVE_TYPE && ! defined __VMS)); previously it was always included (via fcntl--.h). (getloadavg): Do not use c_strtod. Instead, approximate it by hand; this is good enough for load averages. Also, do not use set_cloexec_flag; instead, use the O_CLOEXEC and F_DUPFD_CLOEXEC flags directly if available and don't bother otherwise. (Packages that need the extra reliability should use the modules that define these flags on older platforms that lack them.) * modules/getloadavg (Depends-on): Remove c-strtod, cloexec, fcntl-safer.
* getloadavg: merge minor changes from EmacsPaul Eggert2011-02-061-16/+16
| | | | | | | | | * lib/getloadavg.c (getloadavg_initialized): More-accurate comment. (getloadavg): Use memset, not bzero. 2008-07-25 Chong Yidong <cyd@stupidchicken.com> * lib/getloadavg.c (nl): Rename to name_list to avoid ncurses.h clash (bug#86).
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* maint: remove useless inclusions of "alloca.h"Jim Meyering2010-01-051-1/+0
| | | | | | | | | * lib/getloadavg.c: Remove useless inclusion of "alloca.h". * lib/readtokens.c: Likewise. * lib/same.c: Likewise. * modules/getloadavg (Depends-on): Remove xalloc. * modules/readtokens: Likewise. * modules/same: Likewise.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-3/+2
| | | | | | | | | | | | | | | | | | The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-125/+125
|
* getloadavg: fix symbol name in commentJim Meyering2009-07-311-1/+1
| | | | | | * lib/getloadavg.c: Correct a typo I introduced when adding comments to Matt's change: s/NLIST_POINTER/N_NAME_POINTER/. Matt Kraai spotted the problem.
* getloadavg: check whether n_name is a pointer, for QNX 6.4.1Matt Kraai2009-07-311-3/+3
| | | | | | | | * 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.
* Improve error checking of c_strtod call.Bruno Haible2009-01-211-4/+7
|
* getloadavg: avoid compile failure on AIX 6.1Jeremy Olexa2009-01-061-0/+1
| | | | | * lib/getloadavg.c [HAVE_LIBPERFSTAT]: Include <sys/protosw.h>. Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15465
* Add a getloadavg() declaration to <stdlib.h>.Bruno Haible2008-10-191-2/+4
|
* getloadavg: use libperfstat on AIX5Peter O'Gorman2008-02-051-3/+29
| | | | * lib/getloadavg.c, m4/getloadavg.m4 [aix]: Use libperfstat
* Fix getloadavg.c on Tru64 4.0D.Ralf Wildenhues2007-10-221-1/+3
| | | | | | * lib/getloadavg.c [defined (__osf__) && (defined (__alpha) || defined (__alpha__)]: Undef `sys' after including sys/table.h, for Tru64 4.0D.
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-6/+4
|
* * _fpending.c: Include <config.h> unconditionally, since we noPaul Eggert2006-09-131-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
* * lib/getloadavg.c: Use CONFIGURING_GETLOADAVG, not gl_GETLOADAVG.Paul Eggert2006-09-011-4/+4
| | | | | | | | | | | Problem reported by Ralf Wildenhues in <http://lists.gnu.org/archive/html/bug-gnulib/2006-09/msg00000.html>. * m4/getloadavg.m4 (gl_GETLOADAVG): Use CONFIGURING_GETLOADAVG, not gl_GETLOADAVG. Omit unneeded semicolons. Problems reported by Ralf Wildenhues in <http://lists.gnu.org/archive/html/bug-gnulib/2006-09/msg00000.html>. (gl_PREREQ_GETLOADAVG): Use AC_DEFUN, not m4_define. Put at the end, which is the usual gnulib style.
* * modules/getloadavg (Files): Add m4/getloadavg.m4.Paul Eggert2006-08-311-4/+12
| | | | | | | | | | | (configure.ac): AC_FUNC_GETLOADAVG -> gl_GETLOADAVG, as the former is now obsolescent. * lib/getloadavg.c [defined gl_GETLOADAVG]: Don't include config.h or stdbool.h, because they might not exist while configuring. * m4/fnmatch.m4: Add comment that Autoconf AC_FUNC_FNMATCH is obsolescent, and programs should use gnulib instead. * m4/getloadavg.m4: New file, with contents taken from Autoconf but with prefixes changed.
* White space fix from coreutils.Paul Eggert2006-07-111-1/+1
|
* * lib/getloadavg.c: Use __VMS, not VMS.Paul Eggert2006-07-061-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/getopt.c: Likewise. * lib/getpagesize.h: Likewise. * lib/glob.c: Remove most VMS cruft; it hasn't been tested for a while and probably does not work. * lib/backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't worry about this obsolete case any more. (HAVE_DIR): Remove. All uses removed; we now assume you can read directories. * lib/dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't worry about this obsolete case any more. * lib/fts.c: Likewise. * lib/getcwd.c: Likewise. * lib/glob.h: Likewise. * lib/savedir.c: Likewise. * m4/backupfile.m4 (gl_BACKUPFILE): Check for dirent.h, instead of invoking obsolescent AC_HEADER_DIRENT macro. * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise. * m4/d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Likewise. * m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise. * m4/fts.m4 (gl_FUNC_FTS_CORE): Likewise. * m4/getcwd.m4 (gl_PREREQ_GETCWD): Likewise. * m4/glob.m4 (gl_PREREQ_GLOB): Likewise. * m4/savedir.m4 (gl_SAVEDIR): Likewise. * m4/readdir.m4: Remove; no longer needed.
* * getloadavg.c: Include fcntl--.h rather than fcntl.h.Paul Eggert2005-09-221-15/+12
| | | | | | | | | | | | | Do not include unistd-safer.h. (getloadavg): Don't call fd_safer; no longer needed now that we include fcntl--.h. * getloadavg.c: Assume HAVE_UNISTD_H, i.e., include <unistd.h> unconditionally. Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally, and don't include <sys/file.h>). * getloadavg.c (getloadavg) [__CYGWIN__]: Port to cygwin. [__linux__]: Allocate a big enough buffer for /proc/loadavg. [!LDAV_DONE]: Avoid unused variable warning.
* Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally,Jim Meyering2005-07-021-5/+1
| | | | and don't include <sys/file.h>).
* Sync from coreutils.Paul Eggert2005-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "file name" when talking about file names, instead of "filename" or "path", as per the GNU coding standards. * MODULES.html.sh: mkdir-p renamed from makepath. filenamecat renamed from path-concat. * modules/filenamecat: Renamed from modules/path-concat. (Files): filenamecat.h and filenamecat.c renamed from path-concat.h and path-concat.c. (configure.ac): gl_FILE_NAME_CONCAT, not gl_PATH_CONCAT. (Include): filenamecat.h, not path-concat.h. * modules/mkdir-p: Renamed from modules/makepath. (Files): mkdir-p.h and mkdir-p.c renamed from makepath.h and makepath.c. (configure.ac): gl_MKDIR_PARENTS, not gl_MAKEPATH. (Include): mkdir-p.h, not makepath.h. * lib/mkdir-p.c: Renamed from makepath.c. (make_dir_parents): Renamed from make_path. All callers changed. * lib/mkdir-p.h: Likewise. All includers changed. * lib/filenamecat.c: Renamed from path-concat.c. (file_name_concat): Renamed from path_concat. All callers changed. [TEST_FILE_NAME_CONCAT]: Renamed from TEST_PATH_CONCAT. * lib/filenamecat.h: Likewise. All includers changed. * lib/acl.c: Don't use "path" or "filename" to mean "file name" in comments or local variable names. * lib/basename.c: Likewise. * lib/canonicalize.c, canonicalize.h: Likewise. * lib/dirname.c, dirname.h: Likewise. * lib/euidaccess.c: Likewise. * lib/exclude.c: Likewise * lib/fnmatch_.h, fnmatch_loop.c: Likewise. * lib/fsusage.c, fsuage.h: Likewise. * lib/fts.c, fts_.h: Likewise. * lib/getcwd.c: Likewise. * lib/getloadavg.c: Likewise. * lib/mkstemp.c: Likewise. * lib/mountlist.c, mountlist.h: Likewise. * lib/openat.c, openat.h: Likewise. * lib/readlink-stub.c: Likewise. * lib/readutmp.c, readutmp.h: Likewise. * lib/rename.c: Likewise. * lib/rmdir.c: Likewise. * lib/same.c: Likewise. * lib/savedir.c: Likewise. * lib/stripslash.c: Likewise. * lib/tempname.c: Likewise. * lib/xreadlink.c: Likewise. * lib/exclude.c (excluded_file_name): Renamed from excluded_filename. All uses changed. * lib/exclude.h: Likewise. * m4/mkdir-p.m4: Renamed from makepath.m4. (gl_MKDIR_PARENTS): Renamed from gl_MAKEPATH. All uses changed. Rename files from makepath.c to mkdir-p.c, and from makepath.h to mkdir-p.h. * m4/filenamecat.m4: Renamed from path-concat.m4. (gl_FILE_NAME_CONCAT): Renamed from gl_PATH_CONCAT. All uses changed. Rename files from path-concat.c to filenamecat.c, and from path-concat.h to filenamecat.h. * m4/getcwd-path-max.m4: Don't use "path" or "filename" to mean "file name" in local variables or comments. * rename.m4: Likewise. * lib/euidaccess.c (getuid, getgid, getuid, getegid) [!defined _POSIX_VERSION]: Remove decls; not needed these days. * lib/idcache.c (getpwuid, getpwnam, getgrgid, getgrnam) [!defined _POSIX_VERSION]: Remove decls; not needed these days. * lib/pathmax.h: Include <limits.h> unconditionally, since other files have been getting away with it for years (MORE/BSD 4.3 is extinct now). * lib/userspec.c (getpwnam, getgrnam, getgrgid) [!defined _POSIX_VERSION]: Remove decls; not needed these days. * lib/pathmax.h (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]: Define to 256, not 255, as per modern POSIX.
* *** empty log message ***Paul Eggert2005-05-141-1/+1
|
* Merge from coreutils.Paul Eggert2005-05-021-1/+3
|
* Factor int-properties macros into a single file, except forPaul Eggert2005-03-091-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc-related files. * lib/intprops.h: New file. * lib/getloadavg.c: Include it instead of limits.h. (INT_STRLEN_BOUND): Remove. * lib/human.c: Include intprops.h. (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself. * lib/human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000. * lib/inttostr.h: Include intprops.h instead of limits.h. (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove. * lib/mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros, for consistency with intprops.h. (time_t_is_integer, twos_complement_arithmetic): Use them. * lib/sig2str.h: Include <signal.h>, intprops.h. (INT_STRLEN_BOUND): Remove. * lib/strftime.c (TYPE_SIGNED): Remove. (INT_STRLEN_BOUND): Switch to same implementation as intprops.h. * lib/strtol.c: Adjust comments to match intprops.h. * lib/userspec.c: Include intprops.h. (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove. * lib/utimecmp.c, lib/xnanosleep.c, lib/xstrtol.c: Likewise. * lib/utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT instead of rolling our own expressions. * lib/xstrtol.c: Include xstrtol.h first, to test interface. * modules/getloadavg (Files): Add lib/intprops.h. * modules/human (Files): Likewise. * modules/inttostr (Files): Likewise. * modules/sig2str (Files): Likewise. * modules/userspec (Files): Likewise. * modules/utimecmp (Files): Likewise. * modules/xnanosleep (Files): Likewise. * modules/xstrtol (Files): Likewise.
* Merge from coreutils.Paul Eggert2004-08-071-68/+58
|
* (getloadavg): Don't assume setlocale returns nonnull.Paul Eggert2004-03-301-1/+3
|
* Merge changes to getloadavg.c from coreutils and Emacs; thisPaul Eggert2004-03-291-9/+10
| | | | adds a new module cloexec.
* Correct cpp indentation.Jim Meyering2003-09-131-2/+2
|
* (getloadavg, main): Define via prototypes.Paul Eggert2003-09-091-7/+3
|
* Change copyright notice and spacing to conform to GNU coding style.Paul Eggert2003-08-041-28/+29
|
* Sync with Emacs. From Dave Love.Paul Eggert2003-08-041-73/+25
|
* [HAVE_NLIST_H] (NLIST_STRUCT): Define.Jim Meyering2000-06-191-0/+6
|
* revert last changeJim Meyering2000-06-191-6/+71
|
* s/NLIST_STRUCT/HAVE_NLIST_H/. Remove bigJim Meyering2000-06-181-71/+6
| | | | multi-platform `#ifndef NLIST_STRUCT' block.
* Include locale.h.Jim Meyering1999-01-311-1/+10
| | | | | | [!HAVE_SETLOCALE]: Define-away setlocale. (getloadavg): Ensure the sscanf of /proc/getloadavg data uses the `C' numeric locale. Restore afterwards.
* correct cpp-indentationJim Meyering1997-07-151-2/+2
|
* Merge with FSF.Jim Meyering1997-07-151-7/+18
|
* Add comment re HAVE_PSTAT_GETDYNAMIC.Jim Meyering1997-01-181-0/+8
|
* Fix up indentation a little.Jim Meyering1997-01-151-9/+12
|
* Indent cpp-directives to reflect nesting.Jim Meyering1997-01-151-374/+395
|
* [__SVR4]: Define SVR4.SH-UTILS-1_12rJim Meyering1996-12-071-1/+5
| | | | | Remove duplicate `|| defined(SVR4)' disjunct guarding the #define KERNEL_FILE "/unix" definiton.
* [__linux__]: Don't bother with a.out/nlist/kernelSH-UTILS-1_12pJim Meyering1996-10-221-1/+3
| | | | defines or includes -- Linux systems simply read /proc/loadavg.
* [__sun]: Define sun. Reported by Kaveh Ghazi.Jim Meyering1996-10-101-0/+4
|
* [__hpux]: Define hpux. From Eric Backus.Jim Meyering1996-10-081-1/+5
|