aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-02-15 16:33:44 -0800
committerPaul Eggert2011-02-15 16:33:44 -0800
commit1f5d53eb532df40b6c41d25a8b1eaf4ccf69d518 (patch)
tree344ee816d4cbc354fb53a4d4a31bfad28f2e1bff
parent7127b760aed65cd08fbba67b8ad14f1840532b45 (diff)
downloademacs-1f5d53eb532df40b6c41d25a8b1eaf4ccf69d518.tar.gz
emacs-1f5d53eb532df40b6c41d25a8b1eaf4ccf69d518.zip
Import getloadavg module from gnulib.
-rw-r--r--ChangeLog21
-rw-r--r--Makefile.in2
-rw-r--r--aclocal.m42
-rw-r--r--admin/CPP-DEFINES6
-rw-r--r--admin/ChangeLog6
-rw-r--r--admin/notes/copyright1
-rwxr-xr-xconfigure1224
-rw-r--r--configure.in8
-rw-r--r--lib/Makefile.in175
-rw-r--r--lib/getloadavg.c (renamed from src/getloadavg.c)541
-rw-r--r--lib/gnulib.mk96
-rw-r--r--lib/stdlib.in.h729
-rw-r--r--m4/getloadavg.m4156
-rw-r--r--m4/gl-comp.m411
-rw-r--r--m4/stdlib_h.m4101
-rw-r--r--src/ChangeLog28
-rw-r--r--src/config.in23
-rw-r--r--src/deps.mk1
-rw-r--r--src/lisp.h5
-rw-r--r--src/m/alpha.h7
-rw-r--r--src/m/amdx86-64.h7
-rw-r--r--src/m/ia64.h7
-rw-r--r--src/m/ibms390.h7
-rw-r--r--src/m/macppc.h7
-rw-r--r--src/m/sparc.h7
-rw-r--r--src/m/template.h7
-rw-r--r--src/m/vax.h10
-rw-r--r--src/s/aix4-2.h7
-rw-r--r--src/s/bsd-common.h11
-rw-r--r--src/s/freebsd.h2
-rw-r--r--src/s/hpux10-20.h21
-rw-r--r--src/s/netbsd.h3
-rw-r--r--src/s/unixware.h10
-rw-r--r--src/s/usg5-4-common.h7
34 files changed, 2311 insertions, 945 deletions
diff --git a/ChangeLog b/ChangeLog
index 60c7b92a18e..7a9252cb9f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
12011-02-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Import getloadavg module from gnulib.
4 * .bzrignore: Add lib/stdlib.h.
5 * Makefile.in (GNULIB_MODULES): Add getloadavg.
6 * admin/notes/copyright: Remove src/getloadavg.c as a special case.
7 * configure.in (LIBS_SYSTEM): Omit -lkstat on sol2*; gnulib does this.
8 (AC_CONFIG_LIBOBJ_DIR, AC_FUNC_GETLOADAVG, GETLOADAVG_FILES):
9 Remove; gnulib does this now.
10 * lib/getloadavg.c: Rename from src/getloadavg.c, and sync
11 from gnulib. This adds support for several other systems, such
12 as Tru64 4.0D, QNX, AIX perfstat, etc. It also fixes a potential
13 buffer overrun on Linux hosts under very high load, and on hosts
14 that maintain a channel to the load average file it makes sure
15 the file descriptor is close-on-exec (on hosts that support this)
16 and is not stdin, stdout, or stderr.
17 * lib/stdlib.in.h, m4/getloadavg.m4, m4/stdlib_h.m4: New files,
18 from gnulib.
19 * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
20 * src/config.in: Regenerate.
21
12011-02-15 Paul Eggert <eggert@cs.ucla.edu> 222011-02-15 Paul Eggert <eggert@cs.ucla.edu>
2 23
3 Merge from gnulib. 24 Merge from gnulib.
diff --git a/Makefile.in b/Makefile.in
index e8206a6f012..126304cc4e5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -330,7 +330,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4
330# Update modules from gnulib, for maintainers, who should have it in 330# Update modules from gnulib, for maintainers, who should have it in
331# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools 331# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
332# as per $(gnulib_srcdir)/DEPENDENCIES. 332# as per $(gnulib_srcdir)/DEPENDENCIES.
333GNULIB_MODULES = dtoastr getopt-gnu ignore-value mktime strftime 333GNULIB_MODULES = dtoastr getloadavg getopt-gnu ignore-value mktime strftime
334GNULIB_TOOL_FLAGS = \ 334GNULIB_TOOL_FLAGS = \
335 --import --no-changelog --no-vc-files --makefile-name=gnulib.mk 335 --import --no-changelog --no-vc-files --makefile-name=gnulib.mk
336sync-from-gnulib: $(gnulib_srcdir) 336sync-from-gnulib: $(gnulib_srcdir)
diff --git a/aclocal.m4 b/aclocal.m4
index 62d57bb59fd..f299e4ab11e 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -987,6 +987,7 @@ AC_SUBST([am__untar])
987m4_include([m4/00gnulib.m4]) 987m4_include([m4/00gnulib.m4])
988m4_include([m4/c-strtod.m4]) 988m4_include([m4/c-strtod.m4])
989m4_include([m4/extensions.m4]) 989m4_include([m4/extensions.m4])
990m4_include([m4/getloadavg.m4])
990m4_include([m4/getopt.m4]) 991m4_include([m4/getopt.m4])
991m4_include([m4/gl-comp.m4]) 992m4_include([m4/gl-comp.m4])
992m4_include([m4/gnulib-common.m4]) 993m4_include([m4/gnulib-common.m4])
@@ -995,6 +996,7 @@ m4_include([m4/mktime.m4])
995m4_include([m4/multiarch.m4]) 996m4_include([m4/multiarch.m4])
996m4_include([m4/stdbool.m4]) 997m4_include([m4/stdbool.m4])
997m4_include([m4/stddef_h.m4]) 998m4_include([m4/stddef_h.m4])
999m4_include([m4/stdlib_h.m4])
998m4_include([m4/strftime.m4]) 1000m4_include([m4/strftime.m4])
999m4_include([m4/time_h.m4]) 1001m4_include([m4/time_h.m4])
1000m4_include([m4/time_r.m4]) 1002m4_include([m4/time_r.m4])
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 7febc93bb33..dae6202b4e4 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -62,8 +62,6 @@ SIGTYPE
62SYSTEM_TYPE 62SYSTEM_TYPE
63 63
64** Machine specific macros, decribed in detail in src/m/template.h 64** Machine specific macros, decribed in detail in src/m/template.h
65LOAD_AVE_CVT
66LOAD_AVE_TYPE
67VIRT_ADDR_VARIES 65VIRT_ADDR_VARIES
68 66
69** Misc macros 67** Misc macros
@@ -111,7 +109,6 @@ EMACS_INT
111EMACS_UINT 109EMACS_UINT
112FILE_SYSTEM_CASE 110FILE_SYSTEM_CASE
113FLOAT_CHECK_DOMAIN 111FLOAT_CHECK_DOMAIN
114FSCALE
115GC_LISP_OBJECT_ALIGNMENT 112GC_LISP_OBJECT_ALIGNMENT
116GC_MARK_SECONDARY_STACK 113GC_MARK_SECONDARY_STACK
117GC_MARK_STACK 114GC_MARK_STACK
@@ -193,8 +190,6 @@ HPUX
193INTERNAL_TERMINAL 190INTERNAL_TERMINAL
194IS_ANY_SEP 191IS_ANY_SEP
195IS_DIRECTORY_SEP 192IS_DIRECTORY_SEP
196KERNEL_FILE
197LDAV_SYMBOL
198LINKER 193LINKER
199LINUX_VERSION_CODE 194LINUX_VERSION_CODE
200LISP_FLOAT_TYPE 195LISP_FLOAT_TYPE
@@ -381,4 +376,3 @@ vfork
381wait 376wait
382write 377write
383xfree 378xfree
384
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 5f4dd11ec0f..64d6de69d10 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,9 @@
12011-02-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Remove no-longer needed getloadavg symbols.
4 * CPP-DEFINES (LOAD_AVE_CVT, LOAD_AVE_TYPE, FSCALE, KERNEL_FILE):
5 (LDAV_SYMBOL): Remove.
6
12011-02-12 Glenn Morris <rgm@gnu.org> 72011-02-12 Glenn Morris <rgm@gnu.org>
2 8
3 * bzrmerge.el (bzrmerge-resolve): Fix bzr revert call. 9 * bzrmerge.el (bzrmerge-resolve): Fix bzr revert call.
diff --git a/admin/notes/copyright b/admin/notes/copyright
index e4077caf77b..32a096c928d 100644
--- a/admin/notes/copyright
+++ b/admin/notes/copyright
@@ -631,7 +631,6 @@ alone (may import them from Gnulib again). These are:
631 warn-on-use.h 631 warn-on-use.h
632 lib/*.[ch] 632 lib/*.[ch]
633 lib/gnulib.mk 633 lib/gnulib.mk
634 src/getloadavg.c
635 src/gmalloc.c 634 src/gmalloc.c
636 src/md5.c 635 src/md5.c
637 src/md5.h 636 src/md5.h
diff --git a/configure b/configure
index 0cca2af9508..df3d1f72eda 100755
--- a/configure
+++ b/configure
@@ -599,7 +599,6 @@ ac_includes_default="\
599# include <unistd.h> 599# include <unistd.h>
600#endif" 600#endif"
601 601
602ac_config_libobj_dir=src
603ac_header_list= 602ac_header_list=
604gl_getopt_required=POSIX 603gl_getopt_required=POSIX
605gl_getopt_required=POSIX 604gl_getopt_required=POSIX
@@ -611,6 +610,7 @@ gl_LIBOBJS
611am__EXEEXT_FALSE 610am__EXEEXT_FALSE
612am__EXEEXT_TRUE 611am__EXEEXT_TRUE
613LTLIBOBJS 612LTLIBOBJS
613LIBOBJS
614WINDOW_SUPPORT 614WINDOW_SUPPORT
615TOOLTIP_SUPPORT 615TOOLTIP_SUPPORT
616MOUSE_SUPPORT 616MOUSE_SUPPORT
@@ -677,6 +677,8 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
677TIME_H_DEFINES_STRUCT_TIMESPEC 677TIME_H_DEFINES_STRUCT_TIMESPEC
678NEXT_AS_FIRST_DIRECTIVE_TIME_H 678NEXT_AS_FIRST_DIRECTIVE_TIME_H
679NEXT_TIME_H 679NEXT_TIME_H
680NEXT_AS_FIRST_DIRECTIVE_STDLIB_H
681NEXT_STDLIB_H
680NEXT_AS_FIRST_DIRECTIVE_STDDEF_H 682NEXT_AS_FIRST_DIRECTIVE_STDDEF_H
681NEXT_STDDEF_H 683NEXT_STDDEF_H
682STDDEF_H 684STDDEF_H
@@ -813,12 +815,70 @@ GNULIB_DUP3
813GNULIB_DUP2 815GNULIB_DUP2
814GNULIB_CLOSE 816GNULIB_CLOSE
815GNULIB_CHOWN 817GNULIB_CHOWN
818GETLOADAVG_LIBS
819REPLACE_UNSETENV
820REPLACE_STRTOD
821REPLACE_SETENV
822REPLACE_REALPATH
823REPLACE_REALLOC
824REPLACE_PUTENV
825REPLACE_MKSTEMP
826REPLACE_MALLOC
827REPLACE_CANONICALIZE_FILE_NAME
828REPLACE_CALLOC
829HAVE_DECL_UNSETENV
830HAVE_UNLOCKPT
831HAVE_SYS_LOADAVG_H
832HAVE_STRUCT_RANDOM_DATA
833HAVE_STRTOULL
834HAVE_STRTOLL
835HAVE_STRTOD
836HAVE_DECL_SETENV
837HAVE_SETENV
838HAVE_RPMATCH
839HAVE_REALPATH
840HAVE_RANDOM_R
841HAVE_RANDOM_H
842HAVE_PTSNAME
843HAVE_MKSTEMPS
844HAVE_MKSTEMP
845HAVE_MKOSTEMPS
846HAVE_MKOSTEMP
847HAVE_MKDTEMP
848HAVE_GRANTPT
849HAVE_GETSUBOPT
850HAVE_DECL_GETLOADAVG
851HAVE_CANONICALIZE_FILE_NAME
852HAVE_ATOLL
853HAVE__EXIT
854GNULIB_UNSETENV
855GNULIB_UNLOCKPT
856GNULIB_SYSTEM_POSIX
857GNULIB_STRTOULL
858GNULIB_STRTOLL
859GNULIB_STRTOD
860GNULIB_SETENV
861GNULIB_RPMATCH
862GNULIB_REALPATH
863GNULIB_REALLOC_POSIX
864GNULIB_RANDOM_R
865GNULIB_PUTENV
866GNULIB_PTSNAME
867GNULIB_MKSTEMPS
868GNULIB_MKSTEMP
869GNULIB_MKOSTEMPS
870GNULIB_MKOSTEMP
871GNULIB_MKDTEMP
872GNULIB_MALLOC_POSIX
873GNULIB_GRANTPT
874GNULIB_GETSUBOPT
875GNULIB_GETLOADAVG
876GNULIB_CANONICALIZE_FILE_NAME
877GNULIB_CALLOC_POSIX
878GNULIB_ATOLL
879GNULIB__EXIT
816GL_COND_LIBTOOL_FALSE 880GL_COND_LIBTOOL_FALSE
817GL_COND_LIBTOOL_TRUE 881GL_COND_LIBTOOL_TRUE
818GETLOADAVG_LIBS
819KMEM_GROUP
820NEED_SETGID
821LIBOBJS
822BLESSMAIL_TARGET 882BLESSMAIL_TARGET
823LIBS_MAIL 883LIBS_MAIL
824liblockfile 884liblockfile
@@ -1043,6 +1103,9 @@ LDFLAGS
1043LIBS 1103LIBS
1044CPPFLAGS 1104CPPFLAGS
1045CPP 1105CPP
1106CPPFLAGS
1107CPP
1108CPPFLAGS
1046XMKMF' 1109XMKMF'
1047 1110
1048 1111
@@ -5821,6 +5884,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
5821 # Code from module dtoastr: 5884 # Code from module dtoastr:
5822 # Code from module extensions: 5885 # Code from module extensions:
5823 5886
5887 # Code from module getloadavg:
5824 # Code from module getopt-gnu: 5888 # Code from module getopt-gnu:
5825 # Code from module getopt-posix: 5889 # Code from module getopt-posix:
5826 # Code from module gettext-h: 5890 # Code from module gettext-h:
@@ -5831,6 +5895,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
5831 # Code from module multiarch: 5895 # Code from module multiarch:
5832 # Code from module stdbool: 5896 # Code from module stdbool:
5833 # Code from module stddef: 5897 # Code from module stddef:
5898 # Code from module stdlib:
5834 # Code from module strftime: 5899 # Code from module strftime:
5835 # Code from module time: 5900 # Code from module time:
5836 # Code from module time_r: 5901 # Code from module time_r:
@@ -6703,7 +6768,7 @@ case "$opsys" in
6703 6768
6704 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; 6769 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
6705 6770
6706 sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;; 6771 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
6707 6772
6708 ## Motif needs -lgen. 6773 ## Motif needs -lgen.
6709 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;; 6774 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
@@ -6719,8 +6784,6 @@ else
6719 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS" 6784 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
6720fi 6785fi
6721 6786
6722
6723
6724# Check whether --enable-largefile was given. 6787# Check whether --enable-largefile was given.
6725if test "${enable_largefile+set}" = set; then : 6788if test "${enable_largefile+set}" = set; then :
6726 enableval=$enable_largefile; 6789 enableval=$enable_largefile;
@@ -13020,500 +13083,6 @@ fi
13020done 13083done
13021 13084
13022 13085
13023ac_have_func=no # yes means we've found a way to get the load average.
13024
13025# Make sure getloadavg.c is where it belongs, at configure-time.
13026test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" ||
13027 as_fn_error $? "$srcdir/$ac_config_libobj_dir/getloadavg.c is missing" "$LINENO" 5
13028
13029ac_save_LIBS=$LIBS
13030
13031# Check for getloadavg, but be sure not to touch the cache variable.
13032(ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
13033if test "x$ac_cv_func_getloadavg" = xyes; then :
13034 exit 0
13035else
13036 exit 1
13037fi
13038) && ac_have_func=yes
13039
13040# On HPUX9, an unprivileged user can get load averages through this function.
13041for ac_func in pstat_getdynamic
13042do :
13043 ac_fn_c_check_func "$LINENO" "pstat_getdynamic" "ac_cv_func_pstat_getdynamic"
13044if test "x$ac_cv_func_pstat_getdynamic" = xyes; then :
13045 cat >>confdefs.h <<_ACEOF
13046#define HAVE_PSTAT_GETDYNAMIC 1
13047_ACEOF
13048
13049fi
13050done
13051
13052
13053# Solaris has libkstat which does not require root.
13054{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5
13055$as_echo_n "checking for kstat_open in -lkstat... " >&6; }
13056if ${ac_cv_lib_kstat_kstat_open+:} false; then :
13057 $as_echo_n "(cached) " >&6
13058else
13059 ac_check_lib_save_LIBS=$LIBS
13060LIBS="-lkstat $LIBS"
13061cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13062/* end confdefs.h. */
13063
13064/* Override any GCC internal prototype to avoid an error.
13065 Use char because int might match the return type of a GCC
13066 builtin and then its argument prototype would still apply. */
13067#ifdef __cplusplus
13068extern "C"
13069#endif
13070char kstat_open ();
13071int
13072main ()
13073{
13074return kstat_open ();
13075 ;
13076 return 0;
13077}
13078_ACEOF
13079if ac_fn_c_try_link "$LINENO"; then :
13080 ac_cv_lib_kstat_kstat_open=yes
13081else
13082 ac_cv_lib_kstat_kstat_open=no
13083fi
13084rm -f core conftest.err conftest.$ac_objext \
13085 conftest$ac_exeext conftest.$ac_ext
13086LIBS=$ac_check_lib_save_LIBS
13087fi
13088{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5
13089$as_echo "$ac_cv_lib_kstat_kstat_open" >&6; }
13090if test "x$ac_cv_lib_kstat_kstat_open" = xyes; then :
13091 cat >>confdefs.h <<_ACEOF
13092#define HAVE_LIBKSTAT 1
13093_ACEOF
13094
13095 LIBS="-lkstat $LIBS"
13096
13097fi
13098
13099test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
13100
13101# Some systems with -lutil have (and need) -lkvm as well, some do not.
13102# On Solaris, -lkvm requires nlist from -lelf, so check that first
13103# to get the right answer into the cache.
13104# For kstat on solaris, we need libelf to force the definition of SVR4 below.
13105if test $ac_have_func = no; then
13106 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for elf_begin in -lelf" >&5
13107$as_echo_n "checking for elf_begin in -lelf... " >&6; }
13108if ${ac_cv_lib_elf_elf_begin+:} false; then :
13109 $as_echo_n "(cached) " >&6
13110else
13111 ac_check_lib_save_LIBS=$LIBS
13112LIBS="-lelf $LIBS"
13113cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13114/* end confdefs.h. */
13115
13116/* Override any GCC internal prototype to avoid an error.
13117 Use char because int might match the return type of a GCC
13118 builtin and then its argument prototype would still apply. */
13119#ifdef __cplusplus
13120extern "C"
13121#endif
13122char elf_begin ();
13123int
13124main ()
13125{
13126return elf_begin ();
13127 ;
13128 return 0;
13129}
13130_ACEOF
13131if ac_fn_c_try_link "$LINENO"; then :
13132 ac_cv_lib_elf_elf_begin=yes
13133else
13134 ac_cv_lib_elf_elf_begin=no
13135fi
13136rm -f core conftest.err conftest.$ac_objext \
13137 conftest$ac_exeext conftest.$ac_ext
13138LIBS=$ac_check_lib_save_LIBS
13139fi
13140{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_elf_elf_begin" >&5
13141$as_echo "$ac_cv_lib_elf_elf_begin" >&6; }
13142if test "x$ac_cv_lib_elf_elf_begin" = xyes; then :
13143 LIBS="-lelf $LIBS"
13144fi
13145
13146fi
13147if test $ac_have_func = no; then
13148 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5
13149$as_echo_n "checking for kvm_open in -lkvm... " >&6; }
13150if ${ac_cv_lib_kvm_kvm_open+:} false; then :
13151 $as_echo_n "(cached) " >&6
13152else
13153 ac_check_lib_save_LIBS=$LIBS
13154LIBS="-lkvm $LIBS"
13155cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13156/* end confdefs.h. */
13157
13158/* Override any GCC internal prototype to avoid an error.
13159 Use char because int might match the return type of a GCC
13160 builtin and then its argument prototype would still apply. */
13161#ifdef __cplusplus
13162extern "C"
13163#endif
13164char kvm_open ();
13165int
13166main ()
13167{
13168return kvm_open ();
13169 ;
13170 return 0;
13171}
13172_ACEOF
13173if ac_fn_c_try_link "$LINENO"; then :
13174 ac_cv_lib_kvm_kvm_open=yes
13175else
13176 ac_cv_lib_kvm_kvm_open=no
13177fi
13178rm -f core conftest.err conftest.$ac_objext \
13179 conftest$ac_exeext conftest.$ac_ext
13180LIBS=$ac_check_lib_save_LIBS
13181fi
13182{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5
13183$as_echo "$ac_cv_lib_kvm_kvm_open" >&6; }
13184if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then :
13185 LIBS="-lkvm $LIBS"
13186fi
13187
13188 # Check for the 4.4BSD definition of getloadavg.
13189 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lutil" >&5
13190$as_echo_n "checking for getloadavg in -lutil... " >&6; }
13191if ${ac_cv_lib_util_getloadavg+:} false; then :
13192 $as_echo_n "(cached) " >&6
13193else
13194 ac_check_lib_save_LIBS=$LIBS
13195LIBS="-lutil $LIBS"
13196cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13197/* end confdefs.h. */
13198
13199/* Override any GCC internal prototype to avoid an error.
13200 Use char because int might match the return type of a GCC
13201 builtin and then its argument prototype would still apply. */
13202#ifdef __cplusplus
13203extern "C"
13204#endif
13205char getloadavg ();
13206int
13207main ()
13208{
13209return getloadavg ();
13210 ;
13211 return 0;
13212}
13213_ACEOF
13214if ac_fn_c_try_link "$LINENO"; then :
13215 ac_cv_lib_util_getloadavg=yes
13216else
13217 ac_cv_lib_util_getloadavg=no
13218fi
13219rm -f core conftest.err conftest.$ac_objext \
13220 conftest$ac_exeext conftest.$ac_ext
13221LIBS=$ac_check_lib_save_LIBS
13222fi
13223{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_getloadavg" >&5
13224$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
13225if test "x$ac_cv_lib_util_getloadavg" = xyes; then :
13226 LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes
13227fi
13228
13229fi
13230
13231if test $ac_have_func = no; then
13232 # There is a commonly available library for RS/6000 AIX.
13233 # Since it is not a standard part of AIX, it might be installed locally.
13234 ac_getloadavg_LIBS=$LIBS
13235 LIBS="-L/usr/local/lib $LIBS"
13236 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lgetloadavg" >&5
13237$as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
13238if ${ac_cv_lib_getloadavg_getloadavg+:} false; then :
13239 $as_echo_n "(cached) " >&6
13240else
13241 ac_check_lib_save_LIBS=$LIBS
13242LIBS="-lgetloadavg $LIBS"
13243cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13244/* end confdefs.h. */
13245
13246/* Override any GCC internal prototype to avoid an error.
13247 Use char because int might match the return type of a GCC
13248 builtin and then its argument prototype would still apply. */
13249#ifdef __cplusplus
13250extern "C"
13251#endif
13252char getloadavg ();
13253int
13254main ()
13255{
13256return getloadavg ();
13257 ;
13258 return 0;
13259}
13260_ACEOF
13261if ac_fn_c_try_link "$LINENO"; then :
13262 ac_cv_lib_getloadavg_getloadavg=yes
13263else
13264 ac_cv_lib_getloadavg_getloadavg=no
13265fi
13266rm -f core conftest.err conftest.$ac_objext \
13267 conftest$ac_exeext conftest.$ac_ext
13268LIBS=$ac_check_lib_save_LIBS
13269fi
13270{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getloadavg_getloadavg" >&5
13271$as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; }
13272if test "x$ac_cv_lib_getloadavg_getloadavg" = xyes; then :
13273 LIBS="-lgetloadavg $LIBS"
13274else
13275 LIBS=$ac_getloadavg_LIBS
13276fi
13277
13278fi
13279
13280# Make sure it is really in the library, if we think we found it,
13281# otherwise set up the replacement function.
13282for ac_func in getloadavg
13283do :
13284 ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
13285if test "x$ac_cv_func_getloadavg" = xyes; then :
13286 cat >>confdefs.h <<_ACEOF
13287#define HAVE_GETLOADAVG 1
13288_ACEOF
13289
13290else
13291 case " $LIBOBJS " in
13292 *" getloadavg.$ac_objext "* ) ;;
13293 *) LIBOBJS="$LIBOBJS getloadavg.$ac_objext"
13294 ;;
13295esac
13296
13297
13298$as_echo "#define C_GETLOADAVG 1" >>confdefs.h
13299
13300# Figure out what our getloadavg.c needs.
13301ac_have_func=no
13302ac_fn_c_check_header_mongrel "$LINENO" "sys/dg_sys_info.h" "ac_cv_header_sys_dg_sys_info_h" "$ac_includes_default"
13303if test "x$ac_cv_header_sys_dg_sys_info_h" = xyes; then :
13304 ac_have_func=yes
13305
13306$as_echo "#define DGUX 1" >>confdefs.h
13307
13308 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dg_sys_info in -ldgc" >&5
13309$as_echo_n "checking for dg_sys_info in -ldgc... " >&6; }
13310if ${ac_cv_lib_dgc_dg_sys_info+:} false; then :
13311 $as_echo_n "(cached) " >&6
13312else
13313 ac_check_lib_save_LIBS=$LIBS
13314LIBS="-ldgc $LIBS"
13315cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13316/* end confdefs.h. */
13317
13318/* Override any GCC internal prototype to avoid an error.
13319 Use char because int might match the return type of a GCC
13320 builtin and then its argument prototype would still apply. */
13321#ifdef __cplusplus
13322extern "C"
13323#endif
13324char dg_sys_info ();
13325int
13326main ()
13327{
13328return dg_sys_info ();
13329 ;
13330 return 0;
13331}
13332_ACEOF
13333if ac_fn_c_try_link "$LINENO"; then :
13334 ac_cv_lib_dgc_dg_sys_info=yes
13335else
13336 ac_cv_lib_dgc_dg_sys_info=no
13337fi
13338rm -f core conftest.err conftest.$ac_objext \
13339 conftest$ac_exeext conftest.$ac_ext
13340LIBS=$ac_check_lib_save_LIBS
13341fi
13342{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dgc_dg_sys_info" >&5
13343$as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; }
13344if test "x$ac_cv_lib_dgc_dg_sys_info" = xyes; then :
13345 cat >>confdefs.h <<_ACEOF
13346#define HAVE_LIBDGC 1
13347_ACEOF
13348
13349 LIBS="-ldgc $LIBS"
13350
13351fi
13352
13353fi
13354
13355
13356
13357ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
13358if test "x$ac_cv_header_locale_h" = xyes; then :
13359
13360fi
13361
13362
13363for ac_func in setlocale
13364do :
13365 ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
13366if test "x$ac_cv_func_setlocale" = xyes; then :
13367 cat >>confdefs.h <<_ACEOF
13368#define HAVE_SETLOCALE 1
13369_ACEOF
13370
13371fi
13372done
13373
13374
13375# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
13376# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
13377# Irix 4.0.5F has the header but not the library.
13378if test $ac_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes \
13379 && test "$ac_cv_lib_kvm_kvm_open" = yes; then
13380 ac_have_func=yes
13381
13382$as_echo "#define SVR4 1" >>confdefs.h
13383
13384fi
13385
13386if test $ac_have_func = no; then
13387 ac_fn_c_check_header_mongrel "$LINENO" "inq_stats/cpustats.h" "ac_cv_header_inq_stats_cpustats_h" "$ac_includes_default"
13388if test "x$ac_cv_header_inq_stats_cpustats_h" = xyes; then :
13389 ac_have_func=yes
13390
13391$as_echo "#define UMAX 1" >>confdefs.h
13392
13393
13394$as_echo "#define UMAX4_3 1" >>confdefs.h
13395
13396fi
13397
13398
13399fi
13400
13401if test $ac_have_func = no; then
13402 ac_fn_c_check_header_mongrel "$LINENO" "sys/cpustats.h" "ac_cv_header_sys_cpustats_h" "$ac_includes_default"
13403if test "x$ac_cv_header_sys_cpustats_h" = xyes; then :
13404 ac_have_func=yes; $as_echo "#define UMAX 1" >>confdefs.h
13405
13406fi
13407
13408
13409fi
13410
13411if test $ac_have_func = no; then
13412 for ac_header in mach/mach.h
13413do :
13414 ac_fn_c_check_header_mongrel "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default"
13415if test "x$ac_cv_header_mach_mach_h" = xyes; then :
13416 cat >>confdefs.h <<_ACEOF
13417#define HAVE_MACH_MACH_H 1
13418_ACEOF
13419
13420fi
13421
13422done
13423
13424fi
13425
13426for ac_header in nlist.h
13427do :
13428 ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" "$ac_includes_default"
13429if test "x$ac_cv_header_nlist_h" = xyes; then :
13430 cat >>confdefs.h <<_ACEOF
13431#define HAVE_NLIST_H 1
13432_ACEOF
13433 ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" "ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
13434"
13435if test "x$ac_cv_member_struct_nlist_n_un_n_name" = xyes; then :
13436
13437cat >>confdefs.h <<_ACEOF
13438#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
13439_ACEOF
13440
13441
13442$as_echo "#define NLIST_NAME_UNION 1" >>confdefs.h
13443
13444fi
13445
13446
13447fi
13448
13449done
13450
13451fi
13452done
13453
13454
13455# Some definitions of getloadavg require that the program be installed setgid.
13456{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getloadavg requires setgid" >&5
13457$as_echo_n "checking whether getloadavg requires setgid... " >&6; }
13458if ${ac_cv_func_getloadavg_setgid+:} false; then :
13459 $as_echo_n "(cached) " >&6
13460else
13461 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13462/* end confdefs.h. */
13463#include "$srcdir/$ac_config_libobj_dir/getloadavg.c"
13464#ifdef LDAV_PRIVILEGED
13465Yowza Am I SETGID yet
13466#endif
13467_ACEOF
13468if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
13469 $EGREP "Yowza Am I SETGID yet" >/dev/null 2>&1; then :
13470 ac_cv_func_getloadavg_setgid=yes
13471else
13472 ac_cv_func_getloadavg_setgid=no
13473fi
13474rm -f conftest*
13475
13476fi
13477{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getloadavg_setgid" >&5
13478$as_echo "$ac_cv_func_getloadavg_setgid" >&6; }
13479if test $ac_cv_func_getloadavg_setgid = yes; then
13480 NEED_SETGID=true
13481
13482$as_echo "#define GETLOADAVG_PRIVILEGED 1" >>confdefs.h
13483
13484else
13485 NEED_SETGID=false
13486fi
13487
13488if test $ac_cv_func_getloadavg_setgid = yes; then
13489 { $as_echo "$as_me:${as_lineno-$LINENO}: checking group of /dev/kmem" >&5
13490$as_echo_n "checking group of /dev/kmem... " >&6; }
13491if ${ac_cv_group_kmem+:} false; then :
13492 $as_echo_n "(cached) " >&6
13493else
13494 # On Solaris, /dev/kmem is a symlink. Get info on the real file.
13495 ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
13496 # If we got an error (system does not support symlinks), try without -L.
13497 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
13498 ac_cv_group_kmem=`$as_echo "$ac_ls_output" \
13499 | sed -ne 's/[ ][ ]*/ /g;
13500 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/;
13501 / /s/.* //;p;'`
13502
13503fi
13504{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_group_kmem" >&5
13505$as_echo "$ac_cv_group_kmem" >&6; }
13506 KMEM_GROUP=$ac_cv_group_kmem
13507fi
13508if test "x$ac_save_LIBS" = x; then
13509 GETLOADAVG_LIBS=$LIBS
13510else
13511 GETLOADAVG_LIBS=`$as_echo "$LIBS" | sed "s|$ac_save_LIBS||"`
13512fi
13513LIBS=$ac_save_LIBS
13514
13515
13516
13517{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 13086{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
13518$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } 13087$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
13519if ${ac_cv_sys_largefile_source+:} false; then : 13088if ${ac_cv_sys_largefile_source+:} false; then :
@@ -13676,6 +13245,69 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
13676 fi 13245 fi
13677 13246
13678 13247
13248 GNULIB__EXIT=0;
13249 GNULIB_ATOLL=0;
13250 GNULIB_CALLOC_POSIX=0;
13251 GNULIB_CANONICALIZE_FILE_NAME=0;
13252 GNULIB_GETLOADAVG=0;
13253 GNULIB_GETSUBOPT=0;
13254 GNULIB_GRANTPT=0;
13255 GNULIB_MALLOC_POSIX=0;
13256 GNULIB_MKDTEMP=0;
13257 GNULIB_MKOSTEMP=0;
13258 GNULIB_MKOSTEMPS=0;
13259 GNULIB_MKSTEMP=0;
13260 GNULIB_MKSTEMPS=0;
13261 GNULIB_PTSNAME=0;
13262 GNULIB_PUTENV=0;
13263 GNULIB_RANDOM_R=0;
13264 GNULIB_REALLOC_POSIX=0;
13265 GNULIB_REALPATH=0;
13266 GNULIB_RPMATCH=0;
13267 GNULIB_SETENV=0;
13268 GNULIB_STRTOD=0;
13269 GNULIB_STRTOLL=0;
13270 GNULIB_STRTOULL=0;
13271 GNULIB_SYSTEM_POSIX=0;
13272 GNULIB_UNLOCKPT=0;
13273 GNULIB_UNSETENV=0;
13274 HAVE__EXIT=1;
13275 HAVE_ATOLL=1;
13276 HAVE_CANONICALIZE_FILE_NAME=1;
13277 HAVE_DECL_GETLOADAVG=1;
13278 HAVE_GETSUBOPT=1;
13279 HAVE_GRANTPT=1;
13280 HAVE_MKDTEMP=1;
13281 HAVE_MKOSTEMP=1;
13282 HAVE_MKOSTEMPS=1;
13283 HAVE_MKSTEMP=1;
13284 HAVE_MKSTEMPS=1;
13285 HAVE_PTSNAME=1;
13286 HAVE_RANDOM_H=1;
13287 HAVE_RANDOM_R=1;
13288 HAVE_REALPATH=1;
13289 HAVE_RPMATCH=1;
13290 HAVE_SETENV=1;
13291 HAVE_DECL_SETENV=1;
13292 HAVE_STRTOD=1;
13293 HAVE_STRTOLL=1;
13294 HAVE_STRTOULL=1;
13295 HAVE_STRUCT_RANDOM_DATA=1;
13296 HAVE_SYS_LOADAVG_H=0;
13297 HAVE_UNLOCKPT=1;
13298 HAVE_DECL_UNSETENV=1;
13299 REPLACE_CALLOC=0;
13300 REPLACE_CANONICALIZE_FILE_NAME=0;
13301 REPLACE_MALLOC=0;
13302 REPLACE_MKSTEMP=0;
13303 REPLACE_PUTENV=0;
13304 REPLACE_REALLOC=0;
13305 REPLACE_REALPATH=0;
13306 REPLACE_SETENV=0;
13307 REPLACE_STRTOD=0;
13308 REPLACE_UNSETENV=0;
13309
13310
13679 GNULIB_CHOWN=0; 13311 GNULIB_CHOWN=0;
13680 GNULIB_CLOSE=0; 13312 GNULIB_CLOSE=0;
13681 GNULIB_DUP2=0; 13313 GNULIB_DUP2=0;
@@ -14831,6 +14463,534 @@ fi
14831 # Code from module dtoastr: 14463 # Code from module dtoastr:
14832 14464
14833 # Code from module extensions: 14465 # Code from module extensions:
14466 # Code from module getloadavg:
14467
14468
14469# Persuade glibc <stdlib.h> to declare getloadavg().
14470
14471
14472# Make sure getloadavg.c is where it belongs, at configure-time.
14473test -f "$srcdir/$gl_source_base/getloadavg.c" ||
14474 as_fn_error $? "$srcdir/$gl_source_base/getloadavg.c is missing" "$LINENO" 5
14475
14476gl_save_LIBS=$LIBS
14477
14478ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
14479if test "x$ac_cv_func_getloadavg" = xyes; then :
14480
14481else
14482 gl_have_func=no
14483
14484 # Some systems with -lutil have (and need) -lkvm as well, some do not.
14485 # On Solaris, -lkvm requires nlist from -lelf, so check that first
14486 # to get the right answer into the cache.
14487 # For kstat on solaris, we need to test for libelf and libkvm to force the
14488 # definition of SVR4 below.
14489 if test $gl_have_func = no; then
14490 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for elf_begin in -lelf" >&5
14491$as_echo_n "checking for elf_begin in -lelf... " >&6; }
14492if ${ac_cv_lib_elf_elf_begin+:} false; then :
14493 $as_echo_n "(cached) " >&6
14494else
14495 ac_check_lib_save_LIBS=$LIBS
14496LIBS="-lelf $LIBS"
14497cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14498/* end confdefs.h. */
14499
14500/* Override any GCC internal prototype to avoid an error.
14501 Use char because int might match the return type of a GCC
14502 builtin and then its argument prototype would still apply. */
14503#ifdef __cplusplus
14504extern "C"
14505#endif
14506char elf_begin ();
14507int
14508main ()
14509{
14510return elf_begin ();
14511 ;
14512 return 0;
14513}
14514_ACEOF
14515if ac_fn_c_try_link "$LINENO"; then :
14516 ac_cv_lib_elf_elf_begin=yes
14517else
14518 ac_cv_lib_elf_elf_begin=no
14519fi
14520rm -f core conftest.err conftest.$ac_objext \
14521 conftest$ac_exeext conftest.$ac_ext
14522LIBS=$ac_check_lib_save_LIBS
14523fi
14524{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_elf_elf_begin" >&5
14525$as_echo "$ac_cv_lib_elf_elf_begin" >&6; }
14526if test "x$ac_cv_lib_elf_elf_begin" = xyes; then :
14527 LIBS="-lelf $LIBS"
14528fi
14529
14530 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5
14531$as_echo_n "checking for kvm_open in -lkvm... " >&6; }
14532if ${ac_cv_lib_kvm_kvm_open+:} false; then :
14533 $as_echo_n "(cached) " >&6
14534else
14535 ac_check_lib_save_LIBS=$LIBS
14536LIBS="-lkvm $LIBS"
14537cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14538/* end confdefs.h. */
14539
14540/* Override any GCC internal prototype to avoid an error.
14541 Use char because int might match the return type of a GCC
14542 builtin and then its argument prototype would still apply. */
14543#ifdef __cplusplus
14544extern "C"
14545#endif
14546char kvm_open ();
14547int
14548main ()
14549{
14550return kvm_open ();
14551 ;
14552 return 0;
14553}
14554_ACEOF
14555if ac_fn_c_try_link "$LINENO"; then :
14556 ac_cv_lib_kvm_kvm_open=yes
14557else
14558 ac_cv_lib_kvm_kvm_open=no
14559fi
14560rm -f core conftest.err conftest.$ac_objext \
14561 conftest$ac_exeext conftest.$ac_ext
14562LIBS=$ac_check_lib_save_LIBS
14563fi
14564{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5
14565$as_echo "$ac_cv_lib_kvm_kvm_open" >&6; }
14566if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then :
14567 LIBS="-lkvm $LIBS"
14568fi
14569
14570 # Check for the 4.4BSD definition of getloadavg.
14571 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lutil" >&5
14572$as_echo_n "checking for getloadavg in -lutil... " >&6; }
14573if ${ac_cv_lib_util_getloadavg+:} false; then :
14574 $as_echo_n "(cached) " >&6
14575else
14576 ac_check_lib_save_LIBS=$LIBS
14577LIBS="-lutil $LIBS"
14578cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14579/* end confdefs.h. */
14580
14581/* Override any GCC internal prototype to avoid an error.
14582 Use char because int might match the return type of a GCC
14583 builtin and then its argument prototype would still apply. */
14584#ifdef __cplusplus
14585extern "C"
14586#endif
14587char getloadavg ();
14588int
14589main ()
14590{
14591return getloadavg ();
14592 ;
14593 return 0;
14594}
14595_ACEOF
14596if ac_fn_c_try_link "$LINENO"; then :
14597 ac_cv_lib_util_getloadavg=yes
14598else
14599 ac_cv_lib_util_getloadavg=no
14600fi
14601rm -f core conftest.err conftest.$ac_objext \
14602 conftest$ac_exeext conftest.$ac_ext
14603LIBS=$ac_check_lib_save_LIBS
14604fi
14605{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_getloadavg" >&5
14606$as_echo "$ac_cv_lib_util_getloadavg" >&6; }
14607if test "x$ac_cv_lib_util_getloadavg" = xyes; then :
14608 LIBS="-lutil $LIBS" gl_have_func=yes
14609fi
14610
14611 fi
14612
14613 if test $gl_have_func = no; then
14614 # There is a commonly available library for RS/6000 AIX.
14615 # Since it is not a standard part of AIX, it might be installed locally.
14616 gl_getloadavg_LIBS=$LIBS
14617 LIBS="-L/usr/local/lib $LIBS"
14618 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lgetloadavg" >&5
14619$as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
14620if ${ac_cv_lib_getloadavg_getloadavg+:} false; then :
14621 $as_echo_n "(cached) " >&6
14622else
14623 ac_check_lib_save_LIBS=$LIBS
14624LIBS="-lgetloadavg $LIBS"
14625cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14626/* end confdefs.h. */
14627
14628/* Override any GCC internal prototype to avoid an error.
14629 Use char because int might match the return type of a GCC
14630 builtin and then its argument prototype would still apply. */
14631#ifdef __cplusplus
14632extern "C"
14633#endif
14634char getloadavg ();
14635int
14636main ()
14637{
14638return getloadavg ();
14639 ;
14640 return 0;
14641}
14642_ACEOF
14643if ac_fn_c_try_link "$LINENO"; then :
14644 ac_cv_lib_getloadavg_getloadavg=yes
14645else
14646 ac_cv_lib_getloadavg_getloadavg=no
14647fi
14648rm -f core conftest.err conftest.$ac_objext \
14649 conftest$ac_exeext conftest.$ac_ext
14650LIBS=$ac_check_lib_save_LIBS
14651fi
14652{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getloadavg_getloadavg" >&5
14653$as_echo "$ac_cv_lib_getloadavg_getloadavg" >&6; }
14654if test "x$ac_cv_lib_getloadavg_getloadavg" = xyes; then :
14655 LIBS="-lgetloadavg $LIBS" gl_have_func=yes
14656else
14657 LIBS=$gl_getloadavg_LIBS
14658fi
14659
14660 fi
14661
14662 # Set up the replacement function if necessary.
14663 if test $gl_have_func = no; then
14664
14665
14666
14667
14668
14669
14670
14671
14672 gl_LIBOBJS="$gl_LIBOBJS getloadavg.$ac_objext"
14673
14674
14675# Figure out what our getloadavg.c needs.
14676
14677# Solaris has libkstat which does not require root.
14678{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5
14679$as_echo_n "checking for kstat_open in -lkstat... " >&6; }
14680if ${ac_cv_lib_kstat_kstat_open+:} false; then :
14681 $as_echo_n "(cached) " >&6
14682else
14683 ac_check_lib_save_LIBS=$LIBS
14684LIBS="-lkstat $LIBS"
14685cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14686/* end confdefs.h. */
14687
14688/* Override any GCC internal prototype to avoid an error.
14689 Use char because int might match the return type of a GCC
14690 builtin and then its argument prototype would still apply. */
14691#ifdef __cplusplus
14692extern "C"
14693#endif
14694char kstat_open ();
14695int
14696main ()
14697{
14698return kstat_open ();
14699 ;
14700 return 0;
14701}
14702_ACEOF
14703if ac_fn_c_try_link "$LINENO"; then :
14704 ac_cv_lib_kstat_kstat_open=yes
14705else
14706 ac_cv_lib_kstat_kstat_open=no
14707fi
14708rm -f core conftest.err conftest.$ac_objext \
14709 conftest$ac_exeext conftest.$ac_ext
14710LIBS=$ac_check_lib_save_LIBS
14711fi
14712{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5
14713$as_echo "$ac_cv_lib_kstat_kstat_open" >&6; }
14714if test "x$ac_cv_lib_kstat_kstat_open" = xyes; then :
14715 cat >>confdefs.h <<_ACEOF
14716#define HAVE_LIBKSTAT 1
14717_ACEOF
14718
14719 LIBS="-lkstat $LIBS"
14720
14721fi
14722
14723test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
14724
14725# On HPUX9, an unprivileged user can get load averages this way.
14726if test $gl_have_func = no; then
14727 for ac_func in pstat_getdynamic
14728do :
14729 ac_fn_c_check_func "$LINENO" "pstat_getdynamic" "ac_cv_func_pstat_getdynamic"
14730if test "x$ac_cv_func_pstat_getdynamic" = xyes; then :
14731 cat >>confdefs.h <<_ACEOF
14732#define HAVE_PSTAT_GETDYNAMIC 1
14733_ACEOF
14734 gl_have_func=yes
14735fi
14736done
14737
14738fi
14739
14740# AIX has libperfstat which does not require root
14741if test $gl_have_func = no; then
14742 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perfstat_cpu_total in -lperfstat" >&5
14743$as_echo_n "checking for perfstat_cpu_total in -lperfstat... " >&6; }
14744if ${ac_cv_lib_perfstat_perfstat_cpu_total+:} false; then :
14745 $as_echo_n "(cached) " >&6
14746else
14747 ac_check_lib_save_LIBS=$LIBS
14748LIBS="-lperfstat $LIBS"
14749cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14750/* end confdefs.h. */
14751
14752/* Override any GCC internal prototype to avoid an error.
14753 Use char because int might match the return type of a GCC
14754 builtin and then its argument prototype would still apply. */
14755#ifdef __cplusplus
14756extern "C"
14757#endif
14758char perfstat_cpu_total ();
14759int
14760main ()
14761{
14762return perfstat_cpu_total ();
14763 ;
14764 return 0;
14765}
14766_ACEOF
14767if ac_fn_c_try_link "$LINENO"; then :
14768 ac_cv_lib_perfstat_perfstat_cpu_total=yes
14769else
14770 ac_cv_lib_perfstat_perfstat_cpu_total=no
14771fi
14772rm -f core conftest.err conftest.$ac_objext \
14773 conftest$ac_exeext conftest.$ac_ext
14774LIBS=$ac_check_lib_save_LIBS
14775fi
14776{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_perfstat_perfstat_cpu_total" >&5
14777$as_echo "$ac_cv_lib_perfstat_perfstat_cpu_total" >&6; }
14778if test "x$ac_cv_lib_perfstat_perfstat_cpu_total" = xyes; then :
14779 cat >>confdefs.h <<_ACEOF
14780#define HAVE_LIBPERFSTAT 1
14781_ACEOF
14782
14783 LIBS="-lperfstat $LIBS"
14784
14785fi
14786
14787 test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
14788fi
14789
14790if test $gl_have_func = no; then
14791 ac_fn_c_check_header_mongrel "$LINENO" "sys/dg_sys_info.h" "ac_cv_header_sys_dg_sys_info_h" "$ac_includes_default"
14792if test "x$ac_cv_header_sys_dg_sys_info_h" = xyes; then :
14793 gl_have_func=yes
14794
14795$as_echo "#define DGUX 1" >>confdefs.h
14796
14797 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dg_sys_info in -ldgc" >&5
14798$as_echo_n "checking for dg_sys_info in -ldgc... " >&6; }
14799if ${ac_cv_lib_dgc_dg_sys_info+:} false; then :
14800 $as_echo_n "(cached) " >&6
14801else
14802 ac_check_lib_save_LIBS=$LIBS
14803LIBS="-ldgc $LIBS"
14804cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14805/* end confdefs.h. */
14806
14807/* Override any GCC internal prototype to avoid an error.
14808 Use char because int might match the return type of a GCC
14809 builtin and then its argument prototype would still apply. */
14810#ifdef __cplusplus
14811extern "C"
14812#endif
14813char dg_sys_info ();
14814int
14815main ()
14816{
14817return dg_sys_info ();
14818 ;
14819 return 0;
14820}
14821_ACEOF
14822if ac_fn_c_try_link "$LINENO"; then :
14823 ac_cv_lib_dgc_dg_sys_info=yes
14824else
14825 ac_cv_lib_dgc_dg_sys_info=no
14826fi
14827rm -f core conftest.err conftest.$ac_objext \
14828 conftest$ac_exeext conftest.$ac_ext
14829LIBS=$ac_check_lib_save_LIBS
14830fi
14831{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dgc_dg_sys_info" >&5
14832$as_echo "$ac_cv_lib_dgc_dg_sys_info" >&6; }
14833if test "x$ac_cv_lib_dgc_dg_sys_info" = xyes; then :
14834 cat >>confdefs.h <<_ACEOF
14835#define HAVE_LIBDGC 1
14836_ACEOF
14837
14838 LIBS="-ldgc $LIBS"
14839
14840fi
14841
14842fi
14843
14844
14845fi
14846
14847# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
14848# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
14849# Irix 4.0.5F has the header but not the library.
14850if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes \
14851 && test "$ac_cv_lib_kvm_kvm_open" = yes; then
14852 gl_have_func=yes
14853
14854$as_echo "#define SVR4 1" >>confdefs.h
14855
14856fi
14857
14858if test $gl_have_func = no; then
14859 ac_fn_c_check_header_mongrel "$LINENO" "inq_stats/cpustats.h" "ac_cv_header_inq_stats_cpustats_h" "$ac_includes_default"
14860if test "x$ac_cv_header_inq_stats_cpustats_h" = xyes; then :
14861 gl_have_func=yes
14862
14863$as_echo "#define UMAX 1" >>confdefs.h
14864
14865
14866$as_echo "#define UMAX4_3 1" >>confdefs.h
14867
14868fi
14869
14870
14871fi
14872
14873if test $gl_have_func = no; then
14874 ac_fn_c_check_header_mongrel "$LINENO" "sys/cpustats.h" "ac_cv_header_sys_cpustats_h" "$ac_includes_default"
14875if test "x$ac_cv_header_sys_cpustats_h" = xyes; then :
14876 gl_have_func=yes; $as_echo "#define UMAX 1" >>confdefs.h
14877
14878fi
14879
14880
14881fi
14882
14883if test $gl_have_func = no; then
14884 for ac_header in mach/mach.h
14885do :
14886 ac_fn_c_check_header_mongrel "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default"
14887if test "x$ac_cv_header_mach_mach_h" = xyes; then :
14888 cat >>confdefs.h <<_ACEOF
14889#define HAVE_MACH_MACH_H 1
14890_ACEOF
14891
14892fi
14893
14894done
14895
14896fi
14897
14898for ac_header in nlist.h
14899do :
14900 ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" "$ac_includes_default"
14901if test "x$ac_cv_header_nlist_h" = xyes; then :
14902 cat >>confdefs.h <<_ACEOF
14903#define HAVE_NLIST_H 1
14904_ACEOF
14905 ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" "ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
14906"
14907if test "x$ac_cv_member_struct_nlist_n_un_n_name" = xyes; then :
14908
14909cat >>confdefs.h <<_ACEOF
14910#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
14911_ACEOF
14912
14913
14914fi
14915
14916 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14917/* end confdefs.h. */
14918#include <nlist.h>
14919int
14920main ()
14921{
14922struct nlist x;
14923 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
14924 x.n_un.n_name = "";
14925 #else
14926 x.n_name = "";
14927 #endif
14928 ;
14929 return 0;
14930}
14931_ACEOF
14932if ac_fn_c_try_link "$LINENO"; then :
14933
14934$as_echo "#define N_NAME_POINTER 1" >>confdefs.h
14935
14936fi
14937rm -f core conftest.err conftest.$ac_objext \
14938 conftest$ac_exeext conftest.$ac_ext
14939
14940fi
14941
14942done
14943
14944 fi
14945fi
14946
14947
14948if test "x$gl_save_LIBS" = x; then
14949 GETLOADAVG_LIBS=$LIBS
14950else
14951 GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
14952fi
14953LIBS=$gl_save_LIBS
14954
14955
14956# Test whether the system declares getloadavg. Solaris has the function
14957# but declares it in <sys/loadavg.h>, not <stdlib.h>.
14958for ac_header in sys/loadavg.h
14959do :
14960 ac_fn_c_check_header_mongrel "$LINENO" "sys/loadavg.h" "ac_cv_header_sys_loadavg_h" "$ac_includes_default"
14961if test "x$ac_cv_header_sys_loadavg_h" = xyes; then :
14962 cat >>confdefs.h <<_ACEOF
14963#define HAVE_SYS_LOADAVG_H 1
14964_ACEOF
14965
14966fi
14967
14968done
14969
14970if test $ac_cv_header_sys_loadavg_h = yes; then
14971 HAVE_SYS_LOADAVG_H=1
14972else
14973 HAVE_SYS_LOADAVG_H=0
14974fi
14975ac_fn_c_check_decl "$LINENO" "getloadavg" "ac_cv_have_decl_getloadavg" "#if HAVE_SYS_LOADAVG_H
14976 # include <sys/loadavg.h>
14977 #endif
14978 #include <stdlib.h>
14979"
14980if test "x$ac_cv_have_decl_getloadavg" = xyes; then :
14981
14982else
14983 HAVE_DECL_GETLOADAVG=0
14984fi
14985
14986
14987
14988
14989
14990 GNULIB_GETLOADAVG=1
14991
14992
14993
14834 # Code from module getopt-gnu: 14994 # Code from module getopt-gnu:
14835 14995
14836 14996
@@ -15262,6 +15422,65 @@ $as_echo "$gl_cv_next_stddef_h" >&6; }
15262 15422
15263 fi 15423 fi
15264 15424
15425 # Code from module stdlib:
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436 if test $gl_cv_have_include_next = yes; then
15437 gl_cv_next_stdlib_h='<'stdlib.h'>'
15438 else
15439 { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <stdlib.h>" >&5
15440$as_echo_n "checking absolute name of <stdlib.h>... " >&6; }
15441if ${gl_cv_next_stdlib_h+:} false; then :
15442 $as_echo_n "(cached) " >&6
15443else
15444
15445 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15446/* end confdefs.h. */
15447#include <stdlib.h>
15448
15449_ACEOF
15450 case "$host_os" in
15451 aix*) gl_absname_cpp="$ac_cpp -C" ;;
15452 *) gl_absname_cpp="$ac_cpp" ;;
15453 esac
15454 gl_cv_next_stdlib_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
15455 sed -n '\#/stdlib.h#{
15456 s#.*"\(.*/stdlib.h\)".*#\1#
15457 s#^/[^/]#//&#
15458 p
15459 q
15460 }'`'"'
15461
15462
15463fi
15464{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdlib_h" >&5
15465$as_echo "$gl_cv_next_stdlib_h" >&6; }
15466 fi
15467 NEXT_STDLIB_H=$gl_cv_next_stdlib_h
15468
15469 if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
15470 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
15471 gl_next_as_first_directive='<'stdlib.h'>'
15472 else
15473 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
15474 gl_next_as_first_directive=$gl_cv_next_stdlib_h
15475 fi
15476 NEXT_AS_FIRST_DIRECTIVE_STDLIB_H=$gl_next_as_first_directive
15477
15478
15479
15480
15481
15482
15483
15265 # Code from module strftime: 15484 # Code from module strftime:
15266 15485
15267 15486
@@ -17079,7 +17298,6 @@ S_FILE="\$(srcdir)/${opsysfile}"
17079 17298
17080 17299
17081 17300
17082
17083cat >>confdefs.h <<_ACEOF 17301cat >>confdefs.h <<_ACEOF
17084#define EMACS_CONFIGURATION "${canonical}" 17302#define EMACS_CONFIGURATION "${canonical}"
17085_ACEOF 17303_ACEOF
diff --git a/configure.in b/configure.in
index a3d643e682b..ed25373a12d 100644
--- a/configure.in
+++ b/configure.in
@@ -984,7 +984,7 @@ case "$opsys" in
984 984
985 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; 985 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
986 986
987 sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;; 987 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
988 988
989 ## Motif needs -lgen. 989 ## Motif needs -lgen.
990 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;; 990 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
@@ -1000,9 +1000,6 @@ else
1000 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS" 1000 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
1001fi 1001fi
1002 1002
1003dnl For AC_FUNC_GETLOADAVG, at least:
1004AC_CONFIG_LIBOBJ_DIR(src)
1005
1006dnl Do this early because it can frob feature test macros for Unix-98 &c. 1003dnl Do this early because it can frob feature test macros for Unix-98 &c.
1007AC_SYS_LARGEFILE 1004AC_SYS_LARGEFILE
1008 1005
@@ -2668,8 +2665,6 @@ fi
2668 2665
2669AC_CHECK_HEADERS(sys/un.h) 2666AC_CHECK_HEADERS(sys/un.h)
2670 2667
2671AC_FUNC_GETLOADAVG
2672
2673AC_FUNC_FSEEKO 2668AC_FUNC_FSEEKO
2674 2669
2675AC_FUNC_GETPGRP 2670AC_FUNC_GETPGRP
@@ -3118,7 +3113,6 @@ fi
3118S_FILE="\$(srcdir)/${opsysfile}" 3113S_FILE="\$(srcdir)/${opsysfile}"
3119AC_SUBST(M_FILE) 3114AC_SUBST(M_FILE)
3120AC_SUBST(S_FILE) 3115AC_SUBST(S_FILE)
3121AC_SUBST(GETLOADAVG_LIBS)
3122AC_SUBST(ns_appdir) 3116AC_SUBST(ns_appdir)
3123AC_SUBST(ns_appbindir) 3117AC_SUBST(ns_appbindir)
3124AC_SUBST(ns_appresdir) 3118AC_SUBST(ns_appresdir)
diff --git a/lib/Makefile.in b/lib/Makefile.in
index fa2de9192a2..82e23967865 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -24,7 +24,7 @@
24# the same distribution terms as the rest of that program. 24# the same distribution terms as the rest of that program.
25# 25#
26# Generated by gnulib-tool. 26# Generated by gnulib-tool.
27# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu ignore-value mktime strftime 27# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getloadavg getopt-gnu ignore-value mktime strftime
28 28
29VPATH = @srcdir@ 29VPATH = @srcdir@
30pkgdatadir = $(datadir)/@PACKAGE@ 30pkgdatadir = $(datadir)/@PACKAGE@
@@ -51,14 +51,15 @@ subdir = lib
51ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 51ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
52am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ 52am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
53 $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ 53 $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \
54 $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \ 54 $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \
55 $(top_srcdir)/m4/gnulib-common.m4 \ 55 $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \
56 $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/mktime.m4 \ 56 $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/mktime.m4 \
57 $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ 57 $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \
58 $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/strftime.m4 \ 58 $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
59 $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ 59 $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/time_h.m4 \
60 $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ 60 $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
61 $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in 61 $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
62 $(top_srcdir)/configure.in
62am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 63am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
63 $(ACLOCAL_M4) 64 $(ACLOCAL_M4)
64mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 65mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -134,6 +135,9 @@ GCONF_LIBS = @GCONF_LIBS@
134GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ 135GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
135GETOPT_H = @GETOPT_H@ 136GETOPT_H = @GETOPT_H@
136GMALLOC_OBJ = @GMALLOC_OBJ@ 137GMALLOC_OBJ = @GMALLOC_OBJ@
138GNULIB_ATOLL = @GNULIB_ATOLL@
139GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
140GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@
137GNULIB_CHOWN = @GNULIB_CHOWN@ 141GNULIB_CHOWN = @GNULIB_CHOWN@
138GNULIB_CLOSE = @GNULIB_CLOSE@ 142GNULIB_CLOSE = @GNULIB_CLOSE@
139GNULIB_DUP2 = @GNULIB_DUP2@ 143GNULIB_DUP2 = @GNULIB_DUP2@
@@ -150,27 +154,47 @@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@
150GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ 154GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
151GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ 155GNULIB_GETGROUPS = @GNULIB_GETGROUPS@
152GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ 156GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@
157GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@
153GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ 158GNULIB_GETLOGIN = @GNULIB_GETLOGIN@
154GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ 159GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
155GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ 160GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
161GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
156GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ 162GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
163GNULIB_GRANTPT = @GNULIB_GRANTPT@
157GNULIB_LCHOWN = @GNULIB_LCHOWN@ 164GNULIB_LCHOWN = @GNULIB_LCHOWN@
158GNULIB_LINK = @GNULIB_LINK@ 165GNULIB_LINK = @GNULIB_LINK@
159GNULIB_LINKAT = @GNULIB_LINKAT@ 166GNULIB_LINKAT = @GNULIB_LINKAT@
160GNULIB_LSEEK = @GNULIB_LSEEK@ 167GNULIB_LSEEK = @GNULIB_LSEEK@
168GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
169GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
170GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@
171GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@
172GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
173GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@
161GNULIB_MKTIME = @GNULIB_MKTIME@ 174GNULIB_MKTIME = @GNULIB_MKTIME@
162GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@ 175GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@
163GNULIB_PIPE = @GNULIB_PIPE@ 176GNULIB_PIPE = @GNULIB_PIPE@
164GNULIB_PIPE2 = @GNULIB_PIPE2@ 177GNULIB_PIPE2 = @GNULIB_PIPE2@
165GNULIB_PREAD = @GNULIB_PREAD@ 178GNULIB_PREAD = @GNULIB_PREAD@
179GNULIB_PTSNAME = @GNULIB_PTSNAME@
180GNULIB_PUTENV = @GNULIB_PUTENV@
166GNULIB_PWRITE = @GNULIB_PWRITE@ 181GNULIB_PWRITE = @GNULIB_PWRITE@
182GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
167GNULIB_READLINK = @GNULIB_READLINK@ 183GNULIB_READLINK = @GNULIB_READLINK@
168GNULIB_READLINKAT = @GNULIB_READLINKAT@ 184GNULIB_READLINKAT = @GNULIB_READLINKAT@
185GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
186GNULIB_REALPATH = @GNULIB_REALPATH@
169GNULIB_RMDIR = @GNULIB_RMDIR@ 187GNULIB_RMDIR = @GNULIB_RMDIR@
188GNULIB_RPMATCH = @GNULIB_RPMATCH@
189GNULIB_SETENV = @GNULIB_SETENV@
170GNULIB_SLEEP = @GNULIB_SLEEP@ 190GNULIB_SLEEP = @GNULIB_SLEEP@
171GNULIB_STRPTIME = @GNULIB_STRPTIME@ 191GNULIB_STRPTIME = @GNULIB_STRPTIME@
192GNULIB_STRTOD = @GNULIB_STRTOD@
193GNULIB_STRTOLL = @GNULIB_STRTOLL@
194GNULIB_STRTOULL = @GNULIB_STRTOULL@
172GNULIB_SYMLINK = @GNULIB_SYMLINK@ 195GNULIB_SYMLINK = @GNULIB_SYMLINK@
173GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ 196GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@
197GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@
174GNULIB_TIMEGM = @GNULIB_TIMEGM@ 198GNULIB_TIMEGM = @GNULIB_TIMEGM@
175GNULIB_TIME_R = @GNULIB_TIME_R@ 199GNULIB_TIME_R = @GNULIB_TIME_R@
176GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ 200GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@
@@ -178,8 +202,11 @@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@
178GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ 202GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
179GNULIB_UNLINK = @GNULIB_UNLINK@ 203GNULIB_UNLINK = @GNULIB_UNLINK@
180GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ 204GNULIB_UNLINKAT = @GNULIB_UNLINKAT@
205GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@
206GNULIB_UNSETENV = @GNULIB_UNSETENV@
181GNULIB_USLEEP = @GNULIB_USLEEP@ 207GNULIB_USLEEP = @GNULIB_USLEEP@
182GNULIB_WRITE = @GNULIB_WRITE@ 208GNULIB_WRITE = @GNULIB_WRITE@
209GNULIB__EXIT = @GNULIB__EXIT@
183GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ 210GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@
184GREP = @GREP@ 211GREP = @GREP@
185GTK_CFLAGS = @GTK_CFLAGS@ 212GTK_CFLAGS = @GTK_CFLAGS@
@@ -187,15 +214,20 @@ GTK_LIBS = @GTK_LIBS@
187GTK_OBJ = @GTK_OBJ@ 214GTK_OBJ = @GTK_OBJ@
188GZIP_INFO = @GZIP_INFO@ 215GZIP_INFO = @GZIP_INFO@
189GZIP_PROG = @GZIP_PROG@ 216GZIP_PROG = @GZIP_PROG@
217HAVE_ATOLL = @HAVE_ATOLL@
218HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
190HAVE_CHOWN = @HAVE_CHOWN@ 219HAVE_CHOWN = @HAVE_CHOWN@
191HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ 220HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
192HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ 221HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
193HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ 222HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
223HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
194HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ 224HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
195HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ 225HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@
196HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ 226HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@
197HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ 227HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
228HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
198HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ 229HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
230HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
199HAVE_DUP2 = @HAVE_DUP2@ 231HAVE_DUP2 = @HAVE_DUP2@
200HAVE_DUP3 = @HAVE_DUP3@ 232HAVE_DUP3 = @HAVE_DUP3@
201HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ 233HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
@@ -210,30 +242,50 @@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
210HAVE_GETLOGIN = @HAVE_GETLOGIN@ 242HAVE_GETLOGIN = @HAVE_GETLOGIN@
211HAVE_GETOPT_H = @HAVE_GETOPT_H@ 243HAVE_GETOPT_H = @HAVE_GETOPT_H@
212HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ 244HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
245HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
246HAVE_GRANTPT = @HAVE_GRANTPT@
213HAVE_LCHOWN = @HAVE_LCHOWN@ 247HAVE_LCHOWN = @HAVE_LCHOWN@
214HAVE_LINK = @HAVE_LINK@ 248HAVE_LINK = @HAVE_LINK@
215HAVE_LINKAT = @HAVE_LINKAT@ 249HAVE_LINKAT = @HAVE_LINKAT@
216HAVE_MAKEINFO = @HAVE_MAKEINFO@ 250HAVE_MAKEINFO = @HAVE_MAKEINFO@
251HAVE_MKDTEMP = @HAVE_MKDTEMP@
252HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
253HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
254HAVE_MKSTEMP = @HAVE_MKSTEMP@
255HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
217HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ 256HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
218HAVE_OS_H = @HAVE_OS_H@ 257HAVE_OS_H = @HAVE_OS_H@
219HAVE_PIPE = @HAVE_PIPE@ 258HAVE_PIPE = @HAVE_PIPE@
220HAVE_PIPE2 = @HAVE_PIPE2@ 259HAVE_PIPE2 = @HAVE_PIPE2@
221HAVE_PREAD = @HAVE_PREAD@ 260HAVE_PREAD = @HAVE_PREAD@
261HAVE_PTSNAME = @HAVE_PTSNAME@
222HAVE_PWRITE = @HAVE_PWRITE@ 262HAVE_PWRITE = @HAVE_PWRITE@
263HAVE_RANDOM_H = @HAVE_RANDOM_H@
264HAVE_RANDOM_R = @HAVE_RANDOM_R@
223HAVE_READLINK = @HAVE_READLINK@ 265HAVE_READLINK = @HAVE_READLINK@
224HAVE_READLINKAT = @HAVE_READLINKAT@ 266HAVE_READLINKAT = @HAVE_READLINKAT@
267HAVE_REALPATH = @HAVE_REALPATH@
268HAVE_RPMATCH = @HAVE_RPMATCH@
269HAVE_SETENV = @HAVE_SETENV@
225HAVE_SLEEP = @HAVE_SLEEP@ 270HAVE_SLEEP = @HAVE_SLEEP@
226HAVE_STRPTIME = @HAVE_STRPTIME@ 271HAVE_STRPTIME = @HAVE_STRPTIME@
272HAVE_STRTOD = @HAVE_STRTOD@
273HAVE_STRTOLL = @HAVE_STRTOLL@
274HAVE_STRTOULL = @HAVE_STRTOULL@
275HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
227HAVE_SYMLINK = @HAVE_SYMLINK@ 276HAVE_SYMLINK = @HAVE_SYMLINK@
228HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ 277HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
278HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
229HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ 279HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
230HAVE_TIMEGM = @HAVE_TIMEGM@ 280HAVE_TIMEGM = @HAVE_TIMEGM@
231HAVE_UNISTD_H = @HAVE_UNISTD_H@ 281HAVE_UNISTD_H = @HAVE_UNISTD_H@
232HAVE_UNLINKAT = @HAVE_UNLINKAT@ 282HAVE_UNLINKAT = @HAVE_UNLINKAT@
283HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
233HAVE_USLEEP = @HAVE_USLEEP@ 284HAVE_USLEEP = @HAVE_USLEEP@
234HAVE_WCHAR_T = @HAVE_WCHAR_T@ 285HAVE_WCHAR_T = @HAVE_WCHAR_T@
235HAVE_XSERVER = @HAVE_XSERVER@ 286HAVE_XSERVER = @HAVE_XSERVER@
236HAVE__BOOL = @HAVE__BOOL@ 287HAVE__BOOL = @HAVE__BOOL@
288HAVE__EXIT = @HAVE__EXIT@
237IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@ 289IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@
238IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@ 290IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@
239INCLUDE_NEXT = @INCLUDE_NEXT@ 291INCLUDE_NEXT = @INCLUDE_NEXT@
@@ -244,7 +296,6 @@ INSTALL_INFO = @INSTALL_INFO@
244INSTALL_PROGRAM = @INSTALL_PROGRAM@ 296INSTALL_PROGRAM = @INSTALL_PROGRAM@
245INSTALL_SCRIPT = @INSTALL_SCRIPT@ 297INSTALL_SCRIPT = @INSTALL_SCRIPT@
246INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 298INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
247KMEM_GROUP = @KMEM_GROUP@
248KRB4LIB = @KRB4LIB@ 299KRB4LIB = @KRB4LIB@
249KRB5LIB = @KRB5LIB@ 300KRB5LIB = @KRB5LIB@
250LDFLAGS = @LDFLAGS@ 301LDFLAGS = @LDFLAGS@
@@ -297,13 +348,14 @@ MKDEPDIR = @MKDEPDIR@
297MKDIR_P = @MKDIR_P@ 348MKDIR_P = @MKDIR_P@
298MOUSE_SUPPORT = @MOUSE_SUPPORT@ 349MOUSE_SUPPORT = @MOUSE_SUPPORT@
299M_FILE = @M_FILE@ 350M_FILE = @M_FILE@
300NEED_SETGID = @NEED_SETGID@
301NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ 351NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
302NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ 352NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
353NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
303NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ 354NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
304NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ 355NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
305NEXT_GETOPT_H = @NEXT_GETOPT_H@ 356NEXT_GETOPT_H = @NEXT_GETOPT_H@
306NEXT_STDDEF_H = @NEXT_STDDEF_H@ 357NEXT_STDDEF_H = @NEXT_STDDEF_H@
358NEXT_STDLIB_H = @NEXT_STDLIB_H@
307NEXT_TIME_H = @NEXT_TIME_H@ 359NEXT_TIME_H = @NEXT_TIME_H@
308NEXT_UNISTD_H = @NEXT_UNISTD_H@ 360NEXT_UNISTD_H = @NEXT_UNISTD_H@
309NS_OBJ = @NS_OBJ@ 361NS_OBJ = @NS_OBJ@
@@ -331,6 +383,8 @@ PROFILING_CFLAGS = @PROFILING_CFLAGS@
331PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ 383PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
332RALLOC_OBJ = @RALLOC_OBJ@ 384RALLOC_OBJ = @RALLOC_OBJ@
333RANLIB = @RANLIB@ 385RANLIB = @RANLIB@
386REPLACE_CALLOC = @REPLACE_CALLOC@
387REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
334REPLACE_CHOWN = @REPLACE_CHOWN@ 388REPLACE_CHOWN = @REPLACE_CHOWN@
335REPLACE_CLOSE = @REPLACE_CLOSE@ 389REPLACE_CLOSE = @REPLACE_CLOSE@
336REPLACE_DUP = @REPLACE_DUP@ 390REPLACE_DUP = @REPLACE_DUP@
@@ -346,19 +400,27 @@ REPLACE_LINK = @REPLACE_LINK@
346REPLACE_LINKAT = @REPLACE_LINKAT@ 400REPLACE_LINKAT = @REPLACE_LINKAT@
347REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ 401REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
348REPLACE_LSEEK = @REPLACE_LSEEK@ 402REPLACE_LSEEK = @REPLACE_LSEEK@
403REPLACE_MALLOC = @REPLACE_MALLOC@
404REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
349REPLACE_MKTIME = @REPLACE_MKTIME@ 405REPLACE_MKTIME = @REPLACE_MKTIME@
350REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ 406REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
351REPLACE_NULL = @REPLACE_NULL@ 407REPLACE_NULL = @REPLACE_NULL@
352REPLACE_PREAD = @REPLACE_PREAD@ 408REPLACE_PREAD = @REPLACE_PREAD@
409REPLACE_PUTENV = @REPLACE_PUTENV@
353REPLACE_PWRITE = @REPLACE_PWRITE@ 410REPLACE_PWRITE = @REPLACE_PWRITE@
354REPLACE_READLINK = @REPLACE_READLINK@ 411REPLACE_READLINK = @REPLACE_READLINK@
412REPLACE_REALLOC = @REPLACE_REALLOC@
413REPLACE_REALPATH = @REPLACE_REALPATH@
355REPLACE_RMDIR = @REPLACE_RMDIR@ 414REPLACE_RMDIR = @REPLACE_RMDIR@
415REPLACE_SETENV = @REPLACE_SETENV@
356REPLACE_SLEEP = @REPLACE_SLEEP@ 416REPLACE_SLEEP = @REPLACE_SLEEP@
417REPLACE_STRTOD = @REPLACE_STRTOD@
357REPLACE_SYMLINK = @REPLACE_SYMLINK@ 418REPLACE_SYMLINK = @REPLACE_SYMLINK@
358REPLACE_TIMEGM = @REPLACE_TIMEGM@ 419REPLACE_TIMEGM = @REPLACE_TIMEGM@
359REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ 420REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
360REPLACE_UNLINK = @REPLACE_UNLINK@ 421REPLACE_UNLINK = @REPLACE_UNLINK@
361REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ 422REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
423REPLACE_UNSETENV = @REPLACE_UNSETENV@
362REPLACE_USLEEP = @REPLACE_USLEEP@ 424REPLACE_USLEEP = @REPLACE_USLEEP@
363REPLACE_WRITE = @REPLACE_WRITE@ 425REPLACE_WRITE = @REPLACE_WRITE@
364RSVG_CFLAGS = @RSVG_CFLAGS@ 426RSVG_CFLAGS = @RSVG_CFLAGS@
@@ -472,23 +534,23 @@ x_default_search_path = @x_default_search_path@
472# present in all Makefile.am that need it. This is ensured by the applicability 534# present in all Makefile.am that need it. This is ensured by the applicability
473# 'all' defined above. 535# 'all' defined above.
474BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ 536BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \
475 $(STDDEF_H) time.h unistd.h warn-on-use.h 537 $(STDDEF_H) stdlib.h time.h unistd.h warn-on-use.h
476EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ 538EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \
477 ftoastr.c ftoastr.h getopt.c getopt.in.h getopt1.c \ 539 ftoastr.c ftoastr.h getloadavg.c getopt.c getopt.in.h \
478 getopt_int.h intprops.h mktime-internal.h mktime.c \ 540 getopt1.c getopt_int.h intprops.h mktime-internal.h mktime.c \
479 stdbool.in.h stddef.in.h strftime.c strftime.h time.in.h \ 541 stdbool.in.h stddef.in.h stdlib.in.h strftime.c strftime.h \
480 time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h 542 time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
481MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ 543MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
482 c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ 544 c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \
483 stdbool.h-t stddef.h stddef.h-t time.h time.h-t unistd.h \ 545 stdbool.h-t stddef.h stddef.h-t stdlib.h stdlib.h-t time.h \
484 unistd.h-t warn-on-use.h warn-on-use.h-t 546 time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t
485noinst_LIBRARIES = libgnu.a 547noinst_LIBRARIES = libgnu.a
486DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src 548DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
487libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h 549libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h
488libgnu_a_LIBADD = $(gl_LIBOBJS) 550libgnu_a_LIBADD = $(gl_LIBOBJS)
489libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) 551libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
490EXTRA_libgnu_a_SOURCES = ftoastr.c getopt.c getopt1.c mktime.c \ 552EXTRA_libgnu_a_SOURCES = ftoastr.c getloadavg.c getopt.c getopt1.c \
491 strftime.c time_r.c 553 mktime.c strftime.c time_r.c
492ARG_NONNULL_H = arg-nonnull.h 554ARG_NONNULL_H = arg-nonnull.h
493CXXDEFS_H = c++defs.h 555CXXDEFS_H = c++defs.h
494WARN_ON_USE_H = warn-on-use.h 556WARN_ON_USE_H = warn-on-use.h
@@ -543,6 +605,7 @@ distclean-compile:
543 605
544@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ 606@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@
545@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@ 607@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@
608@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
546@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ 609@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
547@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ 610@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
548@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@ 611@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@
@@ -819,6 +882,82 @@ stddef.h: stddef.in.h
819 } > $@-t && \ 882 } > $@-t && \
820 mv $@-t $@ 883 mv $@-t $@
821 884
885# We need the following in order to create <stdlib.h> when the system
886# doesn't have one that works with the given compiler.
887stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
888 $(AM_V_GEN)rm -f $@-t $@ && \
889 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
890 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
891 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
892 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
893 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
894 -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
895 -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
896 -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
897 -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
898 -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
899 -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
900 -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
901 -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
902 -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
903 -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
904 -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
905 -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
906 -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
907 -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
908 -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
909 -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
910 -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
911 -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
912 -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
913 -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
914 -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
915 -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
916 -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
917 -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
918 -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
919 -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
920 < $(srcdir)/stdlib.in.h | \
921 sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
922 -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
923 -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
924 -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
925 -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
926 -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
927 -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
928 -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
929 -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
930 -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
931 -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
932 -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
933 -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
934 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
935 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
936 -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
937 -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
938 -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
939 -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
940 -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
941 -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
942 -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
943 -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
944 -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
945 -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
946 -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
947 -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
948 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
949 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
950 -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
951 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
952 -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
953 -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
954 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
955 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
956 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
957 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
958 } > $@-t && \
959 mv $@-t $@
960
822# We need the following in order to create <time.h> when the system 961# We need the following in order to create <time.h> when the system
823# doesn't have one that works with the given compiler. 962# doesn't have one that works with the given compiler.
824time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) 963time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
diff --git a/src/getloadavg.c b/lib/getloadavg.c
index d9c24717b79..28e2ea0164b 100644
--- a/src/getloadavg.c
+++ b/lib/getloadavg.c
@@ -1,15 +1,15 @@
1/* Get the system load averages. 1/* Get the system load averages.
2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 2
3 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 3 Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2011 Free Software
4 Free Software Foundation, Inc. 4 Foundation, Inc.
5 5
6 NOTE: The canonical source of this file is maintained with gnulib. 6 NOTE: The canonical source of this file is maintained with gnulib.
7 Bugs can be reported to bug-gnulib@gnu.org. 7 Bugs can be reported to bug-gnulib@gnu.org.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option) 11 the Free Software Foundation; either version 3 of the License, or
12 any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,62 +17,62 @@
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 USA. */
23 21
24/* Compile-time symbols that this file uses: 22/* Compile-time symbols that this file uses:
25 23
26 HAVE_PSTAT_GETDYNAMIC Define this if your system has the 24 HAVE_PSTAT_GETDYNAMIC Define this if your system has the
27 pstat_getdynamic function. I think it 25 pstat_getdynamic function. I think it
28 is unique to HPUX9. The best way to get the 26 is unique to HPUX9. The best way to get the
29 definition is through the AC_FUNC_GETLOADAVG 27 definition is through the AC_FUNC_GETLOADAVG
30 macro that comes with autoconf 2.13 or newer. 28 macro that comes with autoconf 2.13 or newer.
31 If that isn't an option, then just put 29 If that isn't an option, then just put
32 AC_CHECK_FUNCS(pstat_getdynamic) in your 30 AC_CHECK_FUNCS(pstat_getdynamic) in your
33 configure.in file. 31 configure.in file.
34 FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist. 32 HAVE_LIBPERFSTAT Define this if your system has the
35 KERNEL_FILE Pathname of the kernel to nlist. 33 perfstat_cpu_total function in libperfstat (AIX).
36 LDAV_CVT() Scale the load average from the kernel. 34 FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist.
37 Returns a double. 35 KERNEL_FILE Name of the kernel file to nlist.
38 LDAV_SYMBOL Name of kernel symbol giving load average. 36 LDAV_CVT() Scale the load average from the kernel.
39 LOAD_AVE_TYPE Type of the load average array in the kernel. 37 Returns a double.
40 Must be defined unless one of 38 LDAV_SYMBOL Name of kernel symbol giving load average.
41 apollo, DGUX, NeXT, or UMAX is defined; 39 LOAD_AVE_TYPE Type of the load average array in the kernel.
40 Must be defined unless one of
41 apollo, DGUX, NeXT, or UMAX is defined;
42 or we have libkstat; 42 or we have libkstat;
43 otherwise, no load average is available. 43 otherwise, no load average is available.
44 HAVE_NLIST_H nlist.h is available. NLIST_STRUCT defaults 44 HAVE_NLIST_H nlist.h is available. NLIST_STRUCT defaults
45 to this. 45 to this.
46 NLIST_STRUCT Include nlist.h, not a.out.h, and 46 NLIST_STRUCT Include nlist.h, not a.out.h.
47 the nlist n_name element is a pointer, 47 N_NAME_POINTER The nlist n_name element is a pointer,
48 not an array. 48 not an array.
49 HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'. 49 HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
50 LINUX_LDAV_FILE [__linux__]: File containing load averages. 50 LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing
51 HAVE_LOCALE_H locale.h is available. 51 load averages.
52 HAVE_SETLOCALE The `setlocale' function is available.
53 52
54 Specific system predefines this file uses, aside from setting 53 Specific system predefines this file uses, aside from setting
55 default values if not emacs: 54 default values if not emacs:
56 55
57 apollo 56 apollo
58 BSD Real BSD, not just BSD-like. 57 BSD Real BSD, not just BSD-like.
59 convex 58 convex
60 DGUX 59 DGUX
61 eunice UNIX emulator under VMS. 60 eunice UNIX emulator under VMS.
62 hpux 61 hpux
63 __MSDOS__ No-op for MSDOS. 62 __MSDOS__ No-op for MSDOS.
64 NeXT 63 NeXT
65 sgi 64 sgi
66 sequent Sequent Dynix 3.x.x (BSD) 65 sequent Sequent Dynix 3.x.x (BSD)
67 _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV) 66 _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV)
68 sony_news NEWS-OS (works at least for 4.1C) 67 sony_news NEWS-OS (works at least for 4.1C)
69 UMAX 68 UMAX
70 UMAX4_3 69 UMAX4_3
71 VMS 70 VMS
72 WINDOWS32 No-op for Windows95/NT. 71 WINDOWS32 No-op for Windows95/NT.
73 __linux__ Linux: assumes /proc filesystem mounted. 72 __linux__ Linux: assumes /proc file system mounted.
74 Support from Michael K. Johnson. 73 Support from Michael K. Johnson.
75 __NetBSD__ NetBSD: assumes /kern filesystem mounted. 74 __CYGWIN__ Cygwin emulates linux /proc/loadavg.
75 __NetBSD__ NetBSD: assumes /kern file system mounted.
76 76
77 In addition, to avoid nesting many #ifdefs, we internally set 77 In addition, to avoid nesting many #ifdefs, we internally set
78 LDAV_DONE to indicate that the load average has been computed. 78 LDAV_DONE to indicate that the load average has been computed.
@@ -80,41 +80,30 @@
80 We also #define LDAV_PRIVILEGED if a program will require 80 We also #define LDAV_PRIVILEGED if a program will require
81 special installation to be able to call getloadavg. */ 81 special installation to be able to call getloadavg. */
82 82
83/* This should always be first. */ 83/* "configure" defines CONFIGURING_GETLOADAVG to sidestep problems
84#ifdef HAVE_CONFIG_H 84 with partially-configured source directories. */
85# include <config.h>
86#endif
87 85
88#include <sys/types.h> 86#ifndef CONFIGURING_GETLOADAVG
89 87# include <config.h>
90/* Both the Emacs and non-Emacs sections want this. Some 88# include <stdbool.h>
91 configuration files' definitions for the LOAD_AVE_CVT macro (like
92 sparc.h's) use macros like FSCALE, defined here. */
93#if defined (unix) || defined (__unix)
94# include <sys/param.h>
95#endif 89#endif
96 90
97 91/* Specification. */
98/* Exclude all the code except the test program at the end 92#include <stdlib.h>
99 if the system has its own `getloadavg' function.
100
101 The declaration of `errno' is needed by the test program
102 as well as the function itself, so it comes first. */
103 93
104#include <errno.h> 94#include <errno.h>
95#include <stdio.h>
105 96
106#ifndef errno 97# include <sys/types.h>
107extern int errno;
108#endif
109 98
110#ifdef HAVE_LOCALE_H 99/* Both the Emacs and non-Emacs sections want this. Some
111# include <locale.h> 100 configuration files' definitions for the LOAD_AVE_CVT macro (like
112#endif 101 sparc.h's) use macros like FSCALE, defined here. */
113#ifndef HAVE_SETLOCALE 102# if defined (unix) || defined (__unix)
114# define setlocale(Category, Locale) /* empty */ 103# include <sys/param.h>
115#endif 104# endif
116 105
117#ifndef HAVE_GETLOADAVG 106# include "intprops.h"
118 107
119/* The existing Emacs configuration files define a macro called 108/* The existing Emacs configuration files define a macro called
120 LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and 109 LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
@@ -126,7 +115,7 @@ extern int errno;
126 LOAD_AVE_CVT, but future machine config files should just define 115 LOAD_AVE_CVT, but future machine config files should just define
127 LDAV_CVT directly. */ 116 LDAV_CVT directly. */
128 117
129# if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT) 118# if !defined (LDAV_CVT) && defined (LOAD_AVE_CVT)
130# define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0) 119# define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
131# endif 120# endif
132 121
@@ -170,11 +159,11 @@ extern int errno;
170# define sun 159# define sun
171# endif 160# endif
172 161
173# if defined(hp300) && !defined(hpux) 162# if defined (hp300) && !defined (hpux)
174# define MORE_BSD 163# define MORE_BSD
175# endif 164# endif
176 165
177# if defined(ultrix) && defined(mips) 166# if defined (ultrix) && defined (mips)
178# define decstation 167# define decstation
179# endif 168# endif
180 169
@@ -182,7 +171,7 @@ extern int errno;
182# define SVR4 171# define SVR4
183# endif 172# endif
184 173
185# if (defined(sun) && defined(SVR4)) || defined (SOLARIS2) 174# if (defined (sun) && defined (SVR4)) || defined (SOLARIS2)
186# define SUNOS_5 175# define SUNOS_5
187# endif 176# endif
188 177
@@ -192,6 +181,8 @@ extern int errno;
192# include <sys/socket.h> 181# include <sys/socket.h>
193# include <net/route.h> 182# include <net/route.h>
194# include <sys/table.h> 183# include <sys/table.h>
184/* Tru64 4.0D's table.h redefines sys */
185# undef sys
195# endif 186# endif
196 187
197# if defined (__osf__) && (defined (mips) || defined (__mips__)) 188# if defined (__osf__) && (defined (mips) || defined (__mips__))
@@ -203,7 +194,7 @@ extern int errno;
203 default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine 194 default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine
204 that with a couple of other things and we'll have a unique match. */ 195 that with a couple of other things and we'll have a unique match. */
205# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES) 196# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
206# define tek4300 /* Define by emacs, but not by other users. */ 197# define tek4300 /* Define by emacs, but not by other users. */
207# endif 198# endif
208 199
209 200
@@ -254,11 +245,11 @@ extern int errno;
254# define LOAD_AVE_TYPE long 245# define LOAD_AVE_TYPE long
255# endif 246# endif
256 247
257# if defined(alliant) && defined(i860) /* Alliant FX/2800 */ 248# if defined (alliant) && defined (i860) /* Alliant FX/2800 */
258# define LOAD_AVE_TYPE long 249# define LOAD_AVE_TYPE long
259# endif 250# endif
260 251
261# ifdef _AIX 252# if defined _AIX && ! defined HAVE_LIBPERFSTAT
262# define LOAD_AVE_TYPE long 253# define LOAD_AVE_TYPE long
263# endif 254# endif
264 255
@@ -278,7 +269,7 @@ extern int errno;
278# define FSCALE 1024.0 269# define FSCALE 1024.0
279# endif 270# endif
280 271
281# if defined(alliant) && defined(i860) /* Alliant FX/2800 */ 272# if defined (alliant) && defined (i860) /* Alliant FX/2800 */
282/* <sys/param.h> defines an incorrect value for FSCALE on an 273/* <sys/param.h> defines an incorrect value for FSCALE on an
283 Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */ 274 Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */
284# undef FSCALE 275# undef FSCALE
@@ -286,7 +277,7 @@ extern int errno;
286# endif 277# endif
287 278
288 279
289# ifndef FSCALE 280# ifndef FSCALE
290 281
291/* SunOS and some others define FSCALE in sys/param.h. */ 282/* SunOS and some others define FSCALE in sys/param.h. */
292 283
@@ -294,7 +285,7 @@ extern int errno;
294# define FSCALE 2048.0 285# define FSCALE 2048.0
295# endif 286# endif
296 287
297# if defined(MIPS) || defined(SVR4) || defined(decstation) 288# if defined (MIPS) || defined (SVR4) || defined (decstation)
298# define FSCALE 256 289# define FSCALE 256
299# endif 290# endif
300 291
@@ -313,11 +304,11 @@ extern int errno;
313# define FSCALE 100.0 304# define FSCALE 100.0
314# endif 305# endif
315 306
316# ifdef _AIX 307# if defined _AIX && !defined HAVE_LIBPERFSTAT
317# define FSCALE 65536.0 308# define FSCALE 65536.0
318# endif 309# endif
319 310
320# endif /* Not FSCALE. */ 311# endif /* Not FSCALE. */
321 312
322# if !defined (LDAV_CVT) && defined (FSCALE) 313# if !defined (LDAV_CVT) && defined (FSCALE)
323# define LDAV_CVT(n) (((double) (n)) / FSCALE) 314# define LDAV_CVT(n) (((double) (n)) / FSCALE)
@@ -329,7 +320,7 @@ extern int errno;
329# endif 320# endif
330# endif 321# endif
331 322
332# if defined(sgi) || (defined(mips) && !defined(BSD)) 323# if defined (sgi) || (defined (mips) && !defined (BSD))
333# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31)) 324# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
334# endif 325# endif
335 326
@@ -342,7 +333,7 @@ extern int errno;
342# define KERNEL_FILE "/hp-ux" 333# define KERNEL_FILE "/hp-ux"
343# endif 334# endif
344 335
345# if !defined(KERNEL_FILE) && (defined(_SEQUENT_) || defined(MIPS) || defined(SVR4) || defined(ISC) || defined (sgi) || (defined (ardent) && defined (titan))) 336# if !defined (KERNEL_FILE) && (defined (_SEQUENT_) || defined (MIPS) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && defined (titan)))
346# define KERNEL_FILE "/unix" 337# define KERNEL_FILE "/unix"
347# endif 338# endif
348 339
@@ -351,22 +342,21 @@ extern int errno;
351# define LDAV_SYMBOL "_Loadavg" 342# define LDAV_SYMBOL "_Loadavg"
352# endif 343# endif
353 344
354# if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined (ardent) && defined (titan)) || defined (_AIX)) 345# if !defined (LDAV_SYMBOL) && ((defined (hpux) && !defined (hp9000s300)) || defined (_SEQUENT_) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && defined (titan)) || (defined (_AIX) && !defined(HAVE_LIBPERFSTAT)))
355# define LDAV_SYMBOL "avenrun" 346# define LDAV_SYMBOL "avenrun"
356# endif 347# endif
357 348
358# include <unistd.h> 349# include <unistd.h>
359# include <stdio.h>
360 350
361/* LOAD_AVE_TYPE should only get defined if we're going to use the 351/* LOAD_AVE_TYPE should only get defined if we're going to use the
362 nlist method. */ 352 nlist method. */
363# if !defined(LOAD_AVE_TYPE) && (defined(BSD) || defined(LDAV_CVT) || defined(KERNEL_FILE) || defined(LDAV_SYMBOL)) 353# if !defined (LOAD_AVE_TYPE) && (defined (BSD) || defined (LDAV_CVT) || defined (KERNEL_FILE) || defined (LDAV_SYMBOL))
364# define LOAD_AVE_TYPE double 354# define LOAD_AVE_TYPE double
365# endif 355# endif
366 356
367# ifdef LOAD_AVE_TYPE 357# ifdef LOAD_AVE_TYPE
368 358
369# ifndef VMS 359# ifndef __VMS
370# ifndef __linux__ 360# ifndef __linux__
371# ifndef NLIST_STRUCT 361# ifndef NLIST_STRUCT
372# include <a.out.h> 362# include <a.out.h>
@@ -375,7 +365,6 @@ extern int errno;
375# endif /* NLIST_STRUCT */ 365# endif /* NLIST_STRUCT */
376 366
377# ifdef SUNOS_5 367# ifdef SUNOS_5
378# include <fcntl.h>
379# include <kvm.h> 368# include <kvm.h>
380# include <kstat.h> 369# include <kstat.h>
381# endif 370# endif
@@ -393,7 +382,7 @@ extern int errno;
393# endif /* LDAV_SYMBOL */ 382# endif /* LDAV_SYMBOL */
394# endif /* __linux__ */ 383# endif /* __linux__ */
395 384
396# else /* VMS */ 385# else /* __VMS */
397 386
398# ifndef eunice 387# ifndef eunice
399# include <iodef.h> 388# include <iodef.h>
@@ -401,7 +390,7 @@ extern int errno;
401# else /* eunice */ 390# else /* eunice */
402# include <vms/iodef.h> 391# include <vms/iodef.h>
403# endif /* eunice */ 392# endif /* eunice */
404# endif /* VMS */ 393# endif /* __VMS */
405 394
406# ifndef LDAV_CVT 395# ifndef LDAV_CVT
407# define LDAV_CVT(n) ((double) (n)) 396# define LDAV_CVT(n) ((double) (n))
@@ -409,7 +398,16 @@ extern int errno;
409 398
410# endif /* LOAD_AVE_TYPE */ 399# endif /* LOAD_AVE_TYPE */
411 400
412# if defined(__GNU__) && !defined (NeXT) 401# if defined HAVE_LIBPERFSTAT
402# include <sys/protosw.h>
403# include <libperfstat.h>
404# include <sys/proc.h>
405# ifndef SBITS
406# define SBITS 16
407# endif
408# endif
409
410# if defined (__GNU__) && !defined (NeXT)
413/* Note that NeXT Openstep defines __GNU__ even though it should not. */ 411/* Note that NeXT Openstep defines __GNU__ even though it should not. */
414/* GNU system acts much like NeXT, for load average purposes, 412/* GNU system acts much like NeXT, for load average purposes,
415 but not exactly. */ 413 but not exactly. */
@@ -430,7 +428,6 @@ extern int errno;
430# endif /* sgi */ 428# endif /* sgi */
431 429
432# ifdef UMAX 430# ifdef UMAX
433# include <stdio.h>
434# include <signal.h> 431# include <signal.h>
435# include <sys/time.h> 432# include <sys/time.h>
436# include <sys/wait.h> 433# include <sys/wait.h>
@@ -456,17 +453,16 @@ extern int errno;
456# include <sys/dg_sys_info.h> 453# include <sys/dg_sys_info.h>
457# endif 454# endif
458 455
459# if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION) 456# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5 \
457 || (defined LOAD_AVE_TYPE && ! defined __VMS))
460# include <fcntl.h> 458# include <fcntl.h>
461# else
462# include <sys/file.h>
463# endif 459# endif
464 460
465/* Avoid static vars inside a function since in HPUX they dump as pure. */ 461/* Avoid static vars inside a function since in HPUX they dump as pure. */
466 462
467# ifdef NeXT 463# ifdef NeXT
468static processor_set_t default_set; 464static processor_set_t default_set;
469static int getloadavg_initialized; 465static bool getloadavg_initialized;
470# endif /* NeXT */ 466# endif /* NeXT */
471 467
472# ifdef UMAX 468# ifdef UMAX
@@ -475,44 +471,40 @@ static unsigned int samples;
475# endif /* UMAX */ 471# endif /* UMAX */
476 472
477# ifdef DGUX 473# ifdef DGUX
478static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */ 474static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
479# endif /* DGUX */ 475# endif /* DGUX */
480 476
481#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE) 477# if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE)
482/* File descriptor open to /dev/kmem or VMS load ave driver. */ 478/* File descriptor open to /dev/kmem or VMS load ave driver. */
483static int channel; 479static int channel;
484/* Nonzero if channel is valid. */ 480/* True if channel is valid. */
485static int getloadavg_initialized; 481static bool getloadavg_initialized;
486/* Offset in kmem to seek to read load average, or 0 means invalid. */ 482/* Offset in kmem to seek to read load average, or 0 means invalid. */
487static long offset; 483static long offset;
488 484
489# if !defined(VMS) && !defined(sgi) && !defined(__linux__) 485# if ! defined __VMS && ! defined sgi && ! defined __linux__
490static struct nlist name_list[2]; 486static struct nlist name_list[2];
491# endif /* Not VMS or sgi */ 487# endif
492 488
493# ifdef SUNOS_5 489# ifdef SUNOS_5
494static kvm_t *kd; 490static kvm_t *kd;
495# endif /* SUNOS_5 */ 491# endif /* SUNOS_5 */
496 492
497#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */ 493# endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
498 494
499/* Put the 1 minute, 5 minute and 15 minute load averages 495/* Put the 1 minute, 5 minute and 15 minute load averages
500 into the first NELEM elements of LOADAVG. 496 into the first NELEM elements of LOADAVG.
501 Return the number written (never more than 3, but may be less than NELEM), 497 Return the number written (never more than 3, but may be less than NELEM),
502 or -1 if an error occurred. */ 498 or -1 (setting errno) if an error occurred. */
503 499
504int 500int
505getloadavg (loadavg, nelem) 501getloadavg (double loadavg[], int nelem)
506 double loadavg[];
507 int nelem;
508{ 502{
509 int elem = 0; /* Return value. */ 503 int elem = 0; /* Return value. */
510 504
511# ifdef NO_GET_LOAD_AVG 505# ifdef NO_GET_LOAD_AVG
512# define LDAV_DONE 506# define LDAV_DONE
513 /* Set errno to zero to indicate that there was no particular error; 507 errno = ENOSYS;
514 this function just can't work at all on this system. */
515 errno = 0;
516 elem = -1; 508 elem = -1;
517# endif 509# endif
518 510
@@ -522,12 +514,13 @@ getloadavg (loadavg, nelem)
522 kstat_ctl_t *kc; 514 kstat_ctl_t *kc;
523 kstat_t *ksp; 515 kstat_t *ksp;
524 kstat_named_t *kn; 516 kstat_named_t *kn;
517 int saved_errno;
525 518
526 kc = kstat_open (); 519 kc = kstat_open ();
527 if (kc == 0) 520 if (kc == 0)
528 return -1; 521 return -1;
529 ksp = kstat_lookup (kc, "unix", 0, "system_misc"); 522 ksp = kstat_lookup (kc, "unix", 0, "system_misc");
530 if (ksp == 0 ) 523 if (ksp == 0)
531 return -1; 524 return -1;
532 if (kstat_read (kc, ksp, 0) == -1) 525 if (kstat_read (kc, ksp, 0) == -1)
533 return -1; 526 return -1;
@@ -542,25 +535,27 @@ getloadavg (loadavg, nelem)
542 } 535 }
543 536
544 if (nelem >= 1) 537 if (nelem >= 1)
545 loadavg[elem++] = (double) kn->value.ul/FSCALE; 538 loadavg[elem++] = (double) kn->value.ul / FSCALE;
546 539
547 if (nelem >= 2) 540 if (nelem >= 2)
548 { 541 {
549 kn = kstat_data_lookup (ksp, "avenrun_5min"); 542 kn = kstat_data_lookup (ksp, "avenrun_5min");
550 if (kn != 0) 543 if (kn != 0)
551 { 544 {
552 loadavg[elem++] = (double) kn->value.ul/FSCALE; 545 loadavg[elem++] = (double) kn->value.ul / FSCALE;
553 546
554 if (nelem >= 3) 547 if (nelem >= 3)
555 { 548 {
556 kn = kstat_data_lookup (ksp, "avenrun_15min"); 549 kn = kstat_data_lookup (ksp, "avenrun_15min");
557 if (kn != 0) 550 if (kn != 0)
558 loadavg[elem++] = (double) kn->value.ul/FSCALE; 551 loadavg[elem++] = (double) kn->value.ul / FSCALE;
559 } 552 }
560 } 553 }
561 } 554 }
562 555
556 saved_errno = errno;
563 kstat_close (kc); 557 kstat_close (kc);
558 errno = saved_errno;
564# endif /* HAVE_LIBKSTAT */ 559# endif /* HAVE_LIBKSTAT */
565 560
566# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC) 561# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
@@ -580,7 +575,23 @@ getloadavg (loadavg, nelem)
580 575
581# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */ 576# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
582 577
583# if !defined (LDAV_DONE) && defined (__linux__) 578# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT
579# define LDAV_DONE
580# undef LOAD_AVE_TYPE
581/* Use perfstat_cpu_total because we don't have to be root. */
582 {
583 perfstat_cpu_total_t cpu_stats;
584 int result = perfstat_cpu_total (NULL, &cpu_stats, sizeof cpu_stats, 1);
585 if (result == -1)
586 return result;
587 loadavg[0] = cpu_stats.loadavg[0] / (double)(1 << SBITS);
588 loadavg[1] = cpu_stats.loadavg[1] / (double)(1 << SBITS);
589 loadavg[2] = cpu_stats.loadavg[2] / (double)(1 << SBITS);
590 elem = 3;
591 }
592# endif
593
594# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
584# define LDAV_DONE 595# define LDAV_DONE
585# undef LOAD_AVE_TYPE 596# undef LOAD_AVE_TYPE
586 597
@@ -588,32 +599,54 @@ getloadavg (loadavg, nelem)
588# define LINUX_LDAV_FILE "/proc/loadavg" 599# define LINUX_LDAV_FILE "/proc/loadavg"
589# endif 600# endif
590 601
591 char ldavgbuf[40]; 602 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
592 double load_ave[3]; 603 char const *ptr = ldavgbuf;
593 int fd, count; 604 int fd, count, saved_errno;
594 605
595 fd = open (LINUX_LDAV_FILE, O_RDONLY); 606 fd = open (LINUX_LDAV_FILE, O_RDONLY);
596 if (fd == -1) 607 if (fd == -1)
597 return -1; 608 return -1;
598 count = read (fd, ldavgbuf, 40); 609 count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
610 saved_errno = errno;
599 (void) close (fd); 611 (void) close (fd);
612 errno = saved_errno;
600 if (count <= 0) 613 if (count <= 0)
601 return -1; 614 return -1;
615 ldavgbuf[count] = '\0';
602 616
603 /* The following sscanf must use the C locale. */ 617 for (elem = 0; elem < nelem; elem++)
604 setlocale (LC_NUMERIC, "C"); 618 {
605 count = sscanf (ldavgbuf, "%lf %lf %lf", 619 double numerator = 0;
606 &load_ave[0], &load_ave[1], &load_ave[2]); 620 double denominator = 1;
607 setlocale (LC_NUMERIC, ""); 621
608 if (count < 1) 622 while (*ptr == ' ')
609 return -1; 623 ptr++;
610 624
611 for (elem = 0; elem < nelem && elem < count; elem++) 625 /* Finish if this number is missing, and report an error if all
612 loadavg[elem] = load_ave[elem]; 626 were missing. */
627 if (! ('0' <= *ptr && *ptr <= '9'))
628 {
629 if (elem == 0)
630 {
631 errno = ENOTSUP;
632 return -1;
633 }
634 break;
635 }
636
637 while ('0' <= *ptr && *ptr <= '9')
638 numerator = 10 * numerator + (*ptr++ - '0');
639
640 if (*ptr == '.')
641 for (ptr++; '0' <= *ptr && *ptr <= '9'; ptr++)
642 numerator = 10 * numerator + (*ptr - '0'), denominator *= 10;
643
644 loadavg[elem++] = numerator / denominator;
645 }
613 646
614 return elem; 647 return elem;
615 648
616# endif /* __linux__ */ 649# endif /* __linux__ || __CYGWIN__ */
617 650
618# if !defined (LDAV_DONE) && defined (__NetBSD__) 651# if !defined (LDAV_DONE) && defined (__NetBSD__)
619# define LDAV_DONE 652# define LDAV_DONE
@@ -631,11 +664,14 @@ getloadavg (loadavg, nelem)
631 if (fp == NULL) 664 if (fp == NULL)
632 return -1; 665 return -1;
633 count = fscanf (fp, "%lu %lu %lu %lu\n", 666 count = fscanf (fp, "%lu %lu %lu %lu\n",
634 &load_ave[0], &load_ave[1], &load_ave[2], 667 &load_ave[0], &load_ave[1], &load_ave[2],
635 &scale); 668 &scale);
636 (void) fclose (fp); 669 (void) fclose (fp);
637 if (count != 4) 670 if (count != 4)
638 return -1; 671 {
672 errno = ENOTSUP;
673 return -1;
674 }
639 675
640 for (elem = 0; elem < nelem; elem++) 676 for (elem = 0; elem < nelem; elem++)
641 loadavg[elem] = (double) load_ave[elem] / (double) scale; 677 loadavg[elem] = (double) load_ave[elem] / (double) scale;
@@ -650,7 +686,7 @@ getloadavg (loadavg, nelem)
650 686
651 host_t host; 687 host_t host;
652 struct processor_set_basic_info info; 688 struct processor_set_basic_info info;
653 unsigned info_count; 689 unsigned int info_count;
654 690
655 /* We only know how to get the 1-minute average for this system, 691 /* We only know how to get the 1-minute average for this system,
656 so even if the caller asks for more than 1, we only return 1. */ 692 so even if the caller asks for more than 1, we only return 1. */
@@ -658,25 +694,28 @@ getloadavg (loadavg, nelem)
658 if (!getloadavg_initialized) 694 if (!getloadavg_initialized)
659 { 695 {
660 if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS) 696 if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
661 getloadavg_initialized = 1; 697 getloadavg_initialized = true;
662 } 698 }
663 699
664 if (getloadavg_initialized) 700 if (getloadavg_initialized)
665 { 701 {
666 info_count = PROCESSOR_SET_BASIC_INFO_COUNT; 702 info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
667 if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host, 703 if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
668 (processor_set_info_t) &info, &info_count) 704 (processor_set_info_t) &info, &info_count)
669 != KERN_SUCCESS) 705 != KERN_SUCCESS)
670 getloadavg_initialized = 0; 706 getloadavg_initialized = false;
671 else 707 else
672 { 708 {
673 if (nelem > 0) 709 if (nelem > 0)
674 loadavg[elem++] = (double) info.load_average / LOAD_SCALE; 710 loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
675 } 711 }
676 } 712 }
677 713
678 if (!getloadavg_initialized) 714 if (!getloadavg_initialized)
679 return -1; 715 {
716 errno = ENOTSUP;
717 return -1;
718 }
680# endif /* NeXT */ 719# endif /* NeXT */
681 720
682# if !defined (LDAV_DONE) && defined (UMAX) 721# if !defined (LDAV_DONE) && defined (UMAX)
@@ -704,24 +743,24 @@ getloadavg (loadavg, nelem)
704 desc.sd_size = sizeof conf; 743 desc.sd_size = sizeof conf;
705 744
706 if (inq_stats (1, &desc)) 745 if (inq_stats (1, &desc))
707 return -1; 746 return -1;
708 747
709 c = 0; 748 c = 0;
710 for (i = 0; i < conf.config_maxclass; ++i) 749 for (i = 0; i < conf.config_maxclass; ++i)
711 { 750 {
712 struct class_stats stats; 751 struct class_stats stats;
713 memset (&stats, 0, sizeof stats); 752 memset (&stats, 0, sizeof stats);
714 753
715 desc.sd_type = CPUTYPE_CLASS; 754 desc.sd_type = CPUTYPE_CLASS;
716 desc.sd_objid = i; 755 desc.sd_objid = i;
717 desc.sd_addr = (char *) &stats; 756 desc.sd_addr = (char *) &stats;
718 desc.sd_size = sizeof stats; 757 desc.sd_size = sizeof stats;
719 758
720 if (inq_stats (1, &desc)) 759 if (inq_stats (1, &desc))
721 return -1; 760 return -1;
722 761
723 c += stats.class_numcpus; 762 c += stats.class_numcpus;
724 } 763 }
725 cpus = c; 764 cpus = c;
726 samples = cpus < 2 ? 3 : (2 * cpus / 3); 765 samples = cpus < 2 ? 3 : (2 * cpus / 3);
727 } 766 }
@@ -742,7 +781,7 @@ getloadavg (loadavg, nelem)
742 { 781 {
743 load += proc_sum_data.ps_nrun[j]; 782 load += proc_sum_data.ps_nrun[j];
744 if (j++ == PS_NRUNSIZE) 783 if (j++ == PS_NRUNSIZE)
745 j = 0; 784 j = 0;
746 } 785 }
747 786
748 if (nelem > 0) 787 if (nelem > 0)
@@ -755,8 +794,8 @@ getloadavg (loadavg, nelem)
755 it's not supposed to fail. The first argument is for no 794 it's not supposed to fail. The first argument is for no
756 apparent reason of type `long int *'. */ 795 apparent reason of type `long int *'. */
757 dg_sys_info ((long int *) &load_info, 796 dg_sys_info ((long int *) &load_info,
758 DG_SYS_INFO_LOAD_INFO_TYPE, 797 DG_SYS_INFO_LOAD_INFO_TYPE,
759 DG_SYS_INFO_LOAD_VERSION_0); 798 DG_SYS_INFO_LOAD_VERSION_0);
760 799
761 if (nelem > 0) 800 if (nelem > 0)
762 loadavg[elem++] = load_info.one_minute; 801 loadavg[elem++] = load_info.one_minute;
@@ -800,7 +839,7 @@ getloadavg (loadavg, nelem)
800 = (load_ave.tl_lscale == 0 839 = (load_ave.tl_lscale == 0
801 ? load_ave.tl_avenrun.d[0] 840 ? load_ave.tl_avenrun.d[0]
802 : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale)); 841 : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
803# endif /* OSF_MIPS */ 842# endif /* OSF_MIPS */
804 843
805# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32)) 844# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
806# define LDAV_DONE 845# define LDAV_DONE
@@ -820,15 +859,15 @@ getloadavg (loadavg, nelem)
820 for (elem = 0; elem < nelem; elem++) 859 for (elem = 0; elem < nelem; elem++)
821 loadavg[elem] 860 loadavg[elem]
822 = (load_ave.tl_lscale == 0 861 = (load_ave.tl_lscale == 0
823 ? load_ave.tl_avenrun.d[elem] 862 ? load_ave.tl_avenrun.d[elem]
824 : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale)); 863 : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
825# endif /* OSF_ALPHA */ 864# endif /* OSF_ALPHA */
826 865
827# if !defined (LDAV_DONE) && defined (VMS) 866# if ! defined LDAV_DONE && defined __VMS
828 /* VMS specific code -- read from the Load Ave driver. */ 867 /* VMS specific code -- read from the Load Ave driver. */
829 868
830 LOAD_AVE_TYPE load_ave[3]; 869 LOAD_AVE_TYPE load_ave[3];
831 static int getloadavg_initialized = 0; 870 static bool getloadavg_initialized;
832# ifdef eunice 871# ifdef eunice
833 struct 872 struct
834 { 873 {
@@ -848,27 +887,30 @@ getloadavg (loadavg, nelem)
848 $DESCRIPTOR (descriptor, "LAV0:"); 887 $DESCRIPTOR (descriptor, "LAV0:");
849# endif 888# endif
850 if (sys$assign (&descriptor, &channel, 0, 0) & 1) 889 if (sys$assign (&descriptor, &channel, 0, 0) & 1)
851 getloadavg_initialized = 1; 890 getloadavg_initialized = true;
852 } 891 }
853 892
854 /* Read the load average vector. */ 893 /* Read the load average vector. */
855 if (getloadavg_initialized 894 if (getloadavg_initialized
856 && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0, 895 && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
857 load_ave, 12, 0, 0, 0, 0) & 1)) 896 load_ave, 12, 0, 0, 0, 0) & 1))
858 { 897 {
859 sys$dassgn (channel); 898 sys$dassgn (channel);
860 getloadavg_initialized = 0; 899 getloadavg_initialized = false;
861 } 900 }
862 901
863 if (!getloadavg_initialized) 902 if (!getloadavg_initialized)
864 return -1; 903 {
865# endif /* VMS */ 904 errno = ENOTSUP;
905 return -1;
906 }
907# endif /* ! defined LDAV_DONE && defined __VMS */
866 908
867# if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS) 909# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
868 910
869 /* UNIX-specific code -- read the average from /dev/kmem. */ 911 /* UNIX-specific code -- read the average from /dev/kmem. */
870 912
871# define LDAV_PRIVILEGED /* This code requires special installation. */ 913# define LDAV_PRIVILEGED /* This code requires special installation. */
872 914
873 LOAD_AVE_TYPE load_ave[3]; 915 LOAD_AVE_TYPE load_ave[3];
874 916
@@ -876,7 +918,7 @@ getloadavg (loadavg, nelem)
876 if (offset == 0) 918 if (offset == 0)
877 { 919 {
878# ifndef sgi 920# ifndef sgi
879# ifndef NLIST_STRUCT 921# if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
880 strcpy (name_list[0].n_name, LDAV_SYMBOL); 922 strcpy (name_list[0].n_name, LDAV_SYMBOL);
881 strcpy (name_list[1].n_name, ""); 923 strcpy (name_list[1].n_name, "");
882# else /* NLIST_STRUCT */ 924# else /* NLIST_STRUCT */
@@ -892,25 +934,25 @@ getloadavg (loadavg, nelem)
892# ifndef SUNOS_5 934# ifndef SUNOS_5
893 if ( 935 if (
894# if !(defined (_AIX) && !defined (ps2)) 936# if !(defined (_AIX) && !defined (ps2))
895 nlist (KERNEL_FILE, name_list) 937 nlist (KERNEL_FILE, name_list)
896# else /* _AIX */ 938# else /* _AIX */
897 knlist (name_list, 1, sizeof (name_list[0])) 939 knlist (name_list, 1, sizeof (name_list[0]))
898# endif 940# endif
899 >= 0) 941 >= 0)
900 /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */ 942 /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */
901 { 943 {
902# ifdef FIXUP_KERNEL_SYMBOL_ADDR 944# ifdef FIXUP_KERNEL_SYMBOL_ADDR
903 FIXUP_KERNEL_SYMBOL_ADDR (name_list); 945 FIXUP_KERNEL_SYMBOL_ADDR (name_list);
904# endif 946# endif
905 offset = name_list[0].n_value; 947 offset = name_list[0].n_value;
906 } 948 }
907# endif /* !SUNOS_5 */ 949# endif /* !SUNOS_5 */
908# else /* sgi */ 950# else /* sgi */
909 int ldav_off; 951 int ldav_off;
910 952
911 ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN); 953 ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
912 if (ldav_off != -1) 954 if (ldav_off != -1)
913 offset = (long) ldav_off & 0x7fffffff; 955 offset = (long int) ldav_off & 0x7fffffff;
914# endif /* sgi */ 956# endif /* sgi */
915 } 957 }
916 958
@@ -918,30 +960,39 @@ getloadavg (loadavg, nelem)
918 if (!getloadavg_initialized) 960 if (!getloadavg_initialized)
919 { 961 {
920# ifndef SUNOS_5 962# ifndef SUNOS_5
921 channel = open ("/dev/kmem", 0); 963 /* Set the channel to close on exec, so it does not
922 if (channel >= 0) 964 litter any child's descriptor table. */
923 { 965# ifndef O_CLOEXEC
924 /* Set the channel to close on exec, so it does not 966# define O_CLOEXEC 0
925 litter any child's descriptor table. */
926# ifdef F_SETFD
927# ifndef FD_CLOEXEC
928# define FD_CLOEXEC 1
929# endif
930 (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
931# endif 967# endif
932 getloadavg_initialized = 1; 968 int fd = open ("/dev/kmem", O_RDONLY | O_CLOEXEC);
933 } 969 if (0 <= fd)
970 {
971# if F_DUPFD_CLOEXEC
972 if (fd <= STDERR_FILENO)
973 {
974 int fd1 = fcntl (fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
975 close (fd);
976 fd = fd1;
977 }
978# endif
979 if (0 <= fd)
980 {
981 channel = fd;
982 getloadavg_initialized = true;
983 }
984 }
934# else /* SUNOS_5 */ 985# else /* SUNOS_5 */
935 /* We pass 0 for the kernel, corefile, and swapfile names 986 /* We pass 0 for the kernel, corefile, and swapfile names
936 to use the currently running kernel. */ 987 to use the currently running kernel. */
937 kd = kvm_open (0, 0, 0, O_RDONLY, 0); 988 kd = kvm_open (0, 0, 0, O_RDONLY, 0);
938 if (kd != 0) 989 if (kd != 0)
939 { 990 {
940 /* nlist the currently running kernel. */ 991 /* nlist the currently running kernel. */
941 kvm_nlist (kd, name_list); 992 kvm_nlist (kd, name_list);
942 offset = name_list[0].n_value; 993 offset = name_list[0].n_value;
943 getloadavg_initialized = 1; 994 getloadavg_initialized = true;
944 } 995 }
945# endif /* SUNOS_5 */ 996# endif /* SUNOS_5 */
946 } 997 }
947 998
@@ -951,25 +1002,28 @@ getloadavg (loadavg, nelem)
951 /* Try to read the load. */ 1002 /* Try to read the load. */
952# ifndef SUNOS_5 1003# ifndef SUNOS_5
953 if (lseek (channel, offset, 0) == -1L 1004 if (lseek (channel, offset, 0) == -1L
954 || read (channel, (char *) load_ave, sizeof (load_ave)) 1005 || read (channel, (char *) load_ave, sizeof (load_ave))
955 != sizeof (load_ave)) 1006 != sizeof (load_ave))
956 { 1007 {
957 close (channel); 1008 close (channel);
958 getloadavg_initialized = 0; 1009 getloadavg_initialized = false;
959 } 1010 }
960# else /* SUNOS_5 */ 1011# else /* SUNOS_5 */
961 if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave)) 1012 if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
962 != sizeof (load_ave)) 1013 != sizeof (load_ave))
963 { 1014 {
964 kvm_close (kd); 1015 kvm_close (kd);
965 getloadavg_initialized = 0; 1016 getloadavg_initialized = false;
966 } 1017 }
967# endif /* SUNOS_5 */ 1018# endif /* SUNOS_5 */
968 } 1019 }
969 1020
970 if (offset == 0 || !getloadavg_initialized) 1021 if (offset == 0 || !getloadavg_initialized)
971 return -1; 1022 {
972# endif /* LOAD_AVE_TYPE and not VMS */ 1023 errno = ENOTSUP;
1024 return -1;
1025 }
1026# endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */
973 1027
974# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */ 1028# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */
975 if (nelem > 0) 1029 if (nelem > 0)
@@ -982,56 +1036,9 @@ getloadavg (loadavg, nelem)
982# define LDAV_DONE 1036# define LDAV_DONE
983# endif /* !LDAV_DONE && LOAD_AVE_TYPE */ 1037# endif /* !LDAV_DONE && LOAD_AVE_TYPE */
984 1038
985# ifdef LDAV_DONE 1039# if !defined LDAV_DONE
986 return elem; 1040 errno = ENOSYS;
987# else 1041 elem = -1;
988 /* Set errno to zero to indicate that there was no particular error;
989 this function just can't work at all on this system. */
990 errno = 0;
991 return -1;
992# endif 1042# endif
1043 return elem;
993} 1044}
994
995#endif /* ! HAVE_GETLOADAVG */
996
997#ifdef TEST
998void
999main (argc, argv)
1000 int argc;
1001 char **argv;
1002{
1003 int naptime = 0;
1004
1005 if (argc > 1)
1006 naptime = atoi (argv[1]);
1007
1008 while (1)
1009 {
1010 double avg[3];
1011 int loads;
1012
1013 errno = 0; /* Don't be misled if it doesn't set errno. */
1014 loads = getloadavg (avg, 3);
1015 if (loads == -1)
1016 {
1017 perror ("Error getting load average");
1018 exit (1);
1019 }
1020 if (loads > 0)
1021 printf ("1-minute: %f ", avg[0]);
1022 if (loads > 1)
1023 printf ("5-minute: %f ", avg[1]);
1024 if (loads > 2)
1025 printf ("15-minute: %f ", avg[2]);
1026 if (loads > 0)
1027 putchar ('\n');
1028
1029 if (naptime == 0)
1030 break;
1031 sleep (naptime);
1032 }
1033
1034 exit (0);
1035}
1036#endif /* TEST */
1037
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index ad4de074c58..0e7263a002b 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu ignore-value mktime strftime 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getloadavg getopt-gnu ignore-value mktime strftime
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
@@ -79,6 +79,15 @@ EXTRA_libgnu_a_SOURCES += ftoastr.c
79 79
80## end gnulib module dtoastr 80## end gnulib module dtoastr
81 81
82## begin gnulib module getloadavg
83
84
85EXTRA_DIST += getloadavg.c
86
87EXTRA_libgnu_a_SOURCES += getloadavg.c
88
89## end gnulib module getloadavg
90
82## begin gnulib module getopt-posix 91## begin gnulib module getopt-posix
83 92
84BUILT_SOURCES += $(GETOPT_H) 93BUILT_SOURCES += $(GETOPT_H)
@@ -175,6 +184,91 @@ EXTRA_DIST += stddef.in.h
175 184
176## end gnulib module stddef 185## end gnulib module stddef
177 186
187## begin gnulib module stdlib
188
189BUILT_SOURCES += stdlib.h
190
191# We need the following in order to create <stdlib.h> when the system
192# doesn't have one that works with the given compiler.
193stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
194 $(AM_V_GEN)rm -f $@-t $@ && \
195 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
196 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
197 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
198 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
199 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
200 -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
201 -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
202 -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
203 -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
204 -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
205 -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
206 -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
207 -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
208 -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
209 -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
210 -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
211 -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
212 -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
213 -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
214 -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
215 -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
216 -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
217 -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
218 -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
219 -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
220 -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
221 -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
222 -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
223 -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
224 -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
225 -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
226 < $(srcdir)/stdlib.in.h | \
227 sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
228 -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
229 -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
230 -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
231 -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
232 -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
233 -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
234 -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
235 -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
236 -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
237 -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
238 -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
239 -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
240 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
241 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
242 -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
243 -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
244 -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
245 -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
246 -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
247 -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
248 -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
249 -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
250 -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
251 -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
252 -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
253 -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
254 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
255 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
256 -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
257 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
258 -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
259 -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
260 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
261 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
262 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
263 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
264 } > $@-t && \
265 mv $@-t $@
266MOSTLYCLEANFILES += stdlib.h stdlib.h-t
267
268EXTRA_DIST += stdlib.in.h
269
270## end gnulib module stdlib
271
178## begin gnulib module strftime 272## begin gnulib module strftime
179 273
180 274
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
new file mode 100644
index 00000000000..62d18c62811
--- /dev/null
+++ b/lib/stdlib.in.h
@@ -0,0 +1,729 @@
1/* A GNU-like <stdlib.h>.
2
3 Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@
20#endif
21@PRAGMA_COLUMNS@
22
23#if defined __need_malloc_and_calloc
24/* Special invocation convention inside glibc header files. */
25
26#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
27
28#else
29/* Normal invocation convention. */
30
31#ifndef _GL_STDLIB_H
32
33/* The include_next requires a split double-inclusion guard. */
34#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
35
36#ifndef _GL_STDLIB_H
37#define _GL_STDLIB_H
38
39/* NetBSD 5.0 mis-defines NULL. */
40#include <stddef.h>
41
42/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
43#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
44# include <sys/wait.h>
45#endif
46
47/* Solaris declares getloadavg() in <sys/loadavg.h>. */
48#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
49# include <sys/loadavg.h>
50#endif
51
52#if @GNULIB_RANDOM_R@
53
54/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
55 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
56 'struct random_data'. */
57# if @HAVE_RANDOM_H@
58# include <random.h>
59# endif
60
61# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
62# include <stdint.h>
63# endif
64
65# if !@HAVE_STRUCT_RANDOM_DATA@
66/* Define 'struct random_data'.
67 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
68# if !GNULIB_defined_struct_random_data
69struct random_data
70{
71 int32_t *fptr; /* Front pointer. */
72 int32_t *rptr; /* Rear pointer. */
73 int32_t *state; /* Array of state values. */
74 int rand_type; /* Type of random number generator. */
75 int rand_deg; /* Degree of random number generator. */
76 int rand_sep; /* Distance between front and rear. */
77 int32_t *end_ptr; /* Pointer behind state table. */
78};
79# define GNULIB_defined_struct_random_data 1
80# endif
81# endif
82#endif
83
84#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
85/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
86/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
87/* But avoid namespace pollution on glibc systems and native Windows. */
88# include <unistd.h>
89#endif
90
91#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
92# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
93#else
94# define _GL_ATTRIBUTE_NORETURN
95#endif
96
97/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
98
99/* The definition of _GL_ARG_NONNULL is copied here. */
100
101/* The definition of _GL_WARN_ON_USE is copied here. */
102
103
104/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
105#ifndef EXIT_SUCCESS
106# define EXIT_SUCCESS 0
107#endif
108/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
109 with proper operation of xargs. */
110#ifndef EXIT_FAILURE
111# define EXIT_FAILURE 1
112#elif EXIT_FAILURE != 1
113# undef EXIT_FAILURE
114# define EXIT_FAILURE 1
115#endif
116
117
118#if @GNULIB__EXIT@
119/* Terminate the current process with the given return code, without running
120 the 'atexit' handlers. */
121# if !@HAVE__EXIT@
122_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
123# endif
124_GL_CXXALIAS_SYS (_Exit, void, (int status));
125_GL_CXXALIASWARN (_Exit);
126#elif defined GNULIB_POSIXCHECK
127# undef _Exit
128# if HAVE_RAW_DECL__EXIT
129_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
130 "use gnulib module _Exit for portability");
131# endif
132#endif
133
134
135#if @GNULIB_ATOLL@
136/* Parse a signed decimal integer.
137 Returns the value of the integer. Errors are not detected. */
138# if !@HAVE_ATOLL@
139_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
140# endif
141_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
142_GL_CXXALIASWARN (atoll);
143#elif defined GNULIB_POSIXCHECK
144# undef atoll
145# if HAVE_RAW_DECL_ATOLL
146_GL_WARN_ON_USE (atoll, "atoll is unportable - "
147 "use gnulib module atoll for portability");
148# endif
149#endif
150
151#if @GNULIB_CALLOC_POSIX@
152# if @REPLACE_CALLOC@
153# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
154# undef calloc
155# define calloc rpl_calloc
156# endif
157_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
158_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
159# else
160_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
161# endif
162_GL_CXXALIASWARN (calloc);
163#elif defined GNULIB_POSIXCHECK
164# undef calloc
165/* Assume calloc is always declared. */
166_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
167 "use gnulib module calloc-posix for portability");
168#endif
169
170#if @GNULIB_CANONICALIZE_FILE_NAME@
171# if @REPLACE_CANONICALIZE_FILE_NAME@
172# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
173# define canonicalize_file_name rpl_canonicalize_file_name
174# endif
175_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
176 _GL_ARG_NONNULL ((1)));
177_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
178# else
179# if !@HAVE_CANONICALIZE_FILE_NAME@
180_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
181 _GL_ARG_NONNULL ((1)));
182# endif
183_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
184# endif
185_GL_CXXALIASWARN (canonicalize_file_name);
186#elif defined GNULIB_POSIXCHECK
187# undef canonicalize_file_name
188# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
189_GL_WARN_ON_USE (canonicalize_file_name,
190 "canonicalize_file_name is unportable - "
191 "use gnulib module canonicalize-lgpl for portability");
192# endif
193#endif
194
195#if @GNULIB_GETLOADAVG@
196/* Store max(NELEM,3) load average numbers in LOADAVG[].
197 The three numbers are the load average of the last 1 minute, the last 5
198 minutes, and the last 15 minutes, respectively.
199 LOADAVG is an array of NELEM numbers. */
200# if !@HAVE_DECL_GETLOADAVG@
201_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
202 _GL_ARG_NONNULL ((1)));
203# endif
204_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
205_GL_CXXALIASWARN (getloadavg);
206#elif defined GNULIB_POSIXCHECK
207# undef getloadavg
208# if HAVE_RAW_DECL_GETLOADAVG
209_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
210 "use gnulib module getloadavg for portability");
211# endif
212#endif
213
214#if @GNULIB_GETSUBOPT@
215/* Assuming *OPTIONP is a comma separated list of elements of the form
216 "token" or "token=value", getsubopt parses the first of these elements.
217 If the first element refers to a "token" that is member of the given
218 NULL-terminated array of tokens:
219 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
220 the first option and the comma, sets *VALUEP to the value of the
221 element (or NULL if it doesn't contain an "=" sign),
222 - It returns the index of the "token" in the given array of tokens.
223 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
224 For more details see the POSIX:2001 specification.
225 http://www.opengroup.org/susv3xsh/getsubopt.html */
226# if !@HAVE_GETSUBOPT@
227_GL_FUNCDECL_SYS (getsubopt, int,
228 (char **optionp, char *const *tokens, char **valuep)
229 _GL_ARG_NONNULL ((1, 2, 3)));
230# endif
231_GL_CXXALIAS_SYS (getsubopt, int,
232 (char **optionp, char *const *tokens, char **valuep));
233_GL_CXXALIASWARN (getsubopt);
234#elif defined GNULIB_POSIXCHECK
235# undef getsubopt
236# if HAVE_RAW_DECL_GETSUBOPT
237_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
238 "use gnulib module getsubopt for portability");
239# endif
240#endif
241
242#if @GNULIB_GRANTPT@
243/* Change the ownership and access permission of the slave side of the
244 pseudo-terminal whose master side is specified by FD. */
245# if !@HAVE_GRANTPT@
246_GL_FUNCDECL_SYS (grantpt, int, (int fd));
247# endif
248_GL_CXXALIAS_SYS (grantpt, int, (int fd));
249_GL_CXXALIASWARN (grantpt);
250#elif defined GNULIB_POSIXCHECK
251# undef grantpt
252# if HAVE_RAW_DECL_GRANTPT
253_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
254 "use gnulib module grantpt for portability");
255# endif
256#endif
257
258#if @GNULIB_MALLOC_POSIX@
259# if @REPLACE_MALLOC@
260# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
261# undef malloc
262# define malloc rpl_malloc
263# endif
264_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
265_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
266# else
267_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
268# endif
269_GL_CXXALIASWARN (malloc);
270#elif defined GNULIB_POSIXCHECK
271# undef malloc
272/* Assume malloc is always declared. */
273_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
274 "use gnulib module malloc-posix for portability");
275#endif
276
277#if @GNULIB_MKDTEMP@
278/* Create a unique temporary directory from TEMPLATE.
279 The last six characters of TEMPLATE must be "XXXXXX";
280 they are replaced with a string that makes the directory name unique.
281 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
282 The directory is created mode 700. */
283# if !@HAVE_MKDTEMP@
284_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
285# endif
286_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
287_GL_CXXALIASWARN (mkdtemp);
288#elif defined GNULIB_POSIXCHECK
289# undef mkdtemp
290# if HAVE_RAW_DECL_MKDTEMP
291_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
292 "use gnulib module mkdtemp for portability");
293# endif
294#endif
295
296#if @GNULIB_MKOSTEMP@
297/* Create a unique temporary file from TEMPLATE.
298 The last six characters of TEMPLATE must be "XXXXXX";
299 they are replaced with a string that makes the file name unique.
300 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
301 and O_TEXT, O_BINARY (defined in "binary-io.h").
302 The file is then created, with the specified flags, ensuring it didn't exist
303 before.
304 The file is created read-write (mask at least 0600 & ~umask), but it may be
305 world-readable and world-writable (mask 0666 & ~umask), depending on the
306 implementation.
307 Returns the open file descriptor if successful, otherwise -1 and errno
308 set. */
309# if !@HAVE_MKOSTEMP@
310_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
311 _GL_ARG_NONNULL ((1)));
312# endif
313_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
314_GL_CXXALIASWARN (mkostemp);
315#elif defined GNULIB_POSIXCHECK
316# undef mkostemp
317# if HAVE_RAW_DECL_MKOSTEMP
318_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
319 "use gnulib module mkostemp for portability");
320# endif
321#endif
322
323#if @GNULIB_MKOSTEMPS@
324/* Create a unique temporary file from TEMPLATE.
325 The last six characters of TEMPLATE before a suffix of length
326 SUFFIXLEN must be "XXXXXX";
327 they are replaced with a string that makes the file name unique.
328 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
329 and O_TEXT, O_BINARY (defined in "binary-io.h").
330 The file is then created, with the specified flags, ensuring it didn't exist
331 before.
332 The file is created read-write (mask at least 0600 & ~umask), but it may be
333 world-readable and world-writable (mask 0666 & ~umask), depending on the
334 implementation.
335 Returns the open file descriptor if successful, otherwise -1 and errno
336 set. */
337# if !@HAVE_MKOSTEMPS@
338_GL_FUNCDECL_SYS (mkostemps, int,
339 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
340 _GL_ARG_NONNULL ((1)));
341# endif
342_GL_CXXALIAS_SYS (mkostemps, int,
343 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
344_GL_CXXALIASWARN (mkostemps);
345#elif defined GNULIB_POSIXCHECK
346# undef mkostemps
347# if HAVE_RAW_DECL_MKOSTEMPS
348_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
349 "use gnulib module mkostemps for portability");
350# endif
351#endif
352
353#if @GNULIB_MKSTEMP@
354/* Create a unique temporary file from TEMPLATE.
355 The last six characters of TEMPLATE must be "XXXXXX";
356 they are replaced with a string that makes the file name unique.
357 The file is then created, ensuring it didn't exist before.
358 The file is created read-write (mask at least 0600 & ~umask), but it may be
359 world-readable and world-writable (mask 0666 & ~umask), depending on the
360 implementation.
361 Returns the open file descriptor if successful, otherwise -1 and errno
362 set. */
363# if @REPLACE_MKSTEMP@
364# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
365# define mkstemp rpl_mkstemp
366# endif
367_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
368_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
369# else
370# if ! @HAVE_MKSTEMP@
371_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
372# endif
373_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
374# endif
375_GL_CXXALIASWARN (mkstemp);
376#elif defined GNULIB_POSIXCHECK
377# undef mkstemp
378# if HAVE_RAW_DECL_MKSTEMP
379_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
380 "use gnulib module mkstemp for portability");
381# endif
382#endif
383
384#if @GNULIB_MKSTEMPS@
385/* Create a unique temporary file from TEMPLATE.
386 The last six characters of TEMPLATE prior to a suffix of length
387 SUFFIXLEN must be "XXXXXX";
388 they are replaced with a string that makes the file name unique.
389 The file is then created, ensuring it didn't exist before.
390 The file is created read-write (mask at least 0600 & ~umask), but it may be
391 world-readable and world-writable (mask 0666 & ~umask), depending on the
392 implementation.
393 Returns the open file descriptor if successful, otherwise -1 and errno
394 set. */
395# if !@HAVE_MKSTEMPS@
396_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
397 _GL_ARG_NONNULL ((1)));
398# endif
399_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
400_GL_CXXALIASWARN (mkstemps);
401#elif defined GNULIB_POSIXCHECK
402# undef mkstemps
403# if HAVE_RAW_DECL_MKSTEMPS
404_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
405 "use gnulib module mkstemps for portability");
406# endif
407#endif
408
409#if @GNULIB_PTSNAME@
410/* Return the pathname of the pseudo-terminal slave associated with
411 the master FD is open on, or NULL on errors. */
412# if !@HAVE_PTSNAME@
413_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
414# endif
415_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
416_GL_CXXALIASWARN (ptsname);
417#elif defined GNULIB_POSIXCHECK
418# undef ptsname
419# if HAVE_RAW_DECL_PTSNAME
420_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
421 "use gnulib module ptsname for portability");
422# endif
423#endif
424
425#if @GNULIB_PUTENV@
426# if @REPLACE_PUTENV@
427# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
428# undef putenv
429# define putenv rpl_putenv
430# endif
431_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
432_GL_CXXALIAS_RPL (putenv, int, (char *string));
433# else
434_GL_CXXALIAS_SYS (putenv, int, (char *string));
435# endif
436_GL_CXXALIASWARN (putenv);
437#endif
438
439
440#if @GNULIB_RANDOM_R@
441# if !@HAVE_RANDOM_R@
442# ifndef RAND_MAX
443# define RAND_MAX 2147483647
444# endif
445# endif
446#endif
447
448#if @GNULIB_RANDOM_R@
449# if !@HAVE_RANDOM_R@
450_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
451 _GL_ARG_NONNULL ((1, 2)));
452# endif
453_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
454_GL_CXXALIASWARN (random_r);
455#elif defined GNULIB_POSIXCHECK
456# undef random_r
457# if HAVE_RAW_DECL_RANDOM_R
458_GL_WARN_ON_USE (random_r, "random_r is unportable - "
459 "use gnulib module random_r for portability");
460# endif
461#endif
462
463#if @GNULIB_RANDOM_R@
464# if !@HAVE_RANDOM_R@
465_GL_FUNCDECL_SYS (srandom_r, int,
466 (unsigned int seed, struct random_data *rand_state)
467 _GL_ARG_NONNULL ((2)));
468# endif
469_GL_CXXALIAS_SYS (srandom_r, int,
470 (unsigned int seed, struct random_data *rand_state));
471_GL_CXXALIASWARN (srandom_r);
472#elif defined GNULIB_POSIXCHECK
473# undef srandom_r
474# if HAVE_RAW_DECL_SRANDOM_R
475_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
476 "use gnulib module random_r for portability");
477# endif
478#endif
479
480#if @GNULIB_RANDOM_R@
481# if !@HAVE_RANDOM_R@
482_GL_FUNCDECL_SYS (initstate_r, int,
483 (unsigned int seed, char *buf, size_t buf_size,
484 struct random_data *rand_state)
485 _GL_ARG_NONNULL ((2, 4)));
486# endif
487_GL_CXXALIAS_SYS (initstate_r, int,
488 (unsigned int seed, char *buf, size_t buf_size,
489 struct random_data *rand_state));
490_GL_CXXALIASWARN (initstate_r);
491#elif defined GNULIB_POSIXCHECK
492# undef initstate_r
493# if HAVE_RAW_DECL_INITSTATE_R
494_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
495 "use gnulib module random_r for portability");
496# endif
497#endif
498
499#if @GNULIB_RANDOM_R@
500# if !@HAVE_RANDOM_R@
501_GL_FUNCDECL_SYS (setstate_r, int,
502 (char *arg_state, struct random_data *rand_state)
503 _GL_ARG_NONNULL ((1, 2)));
504# endif
505_GL_CXXALIAS_SYS (setstate_r, int,
506 (char *arg_state, struct random_data *rand_state));
507_GL_CXXALIASWARN (setstate_r);
508#elif defined GNULIB_POSIXCHECK
509# undef setstate_r
510# if HAVE_RAW_DECL_SETSTATE_R
511_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
512 "use gnulib module random_r for portability");
513# endif
514#endif
515
516
517#if @GNULIB_REALLOC_POSIX@
518# if @REPLACE_REALLOC@
519# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
520# undef realloc
521# define realloc rpl_realloc
522# endif
523_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
524_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
525# else
526_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
527# endif
528_GL_CXXALIASWARN (realloc);
529#elif defined GNULIB_POSIXCHECK
530# undef realloc
531/* Assume realloc is always declared. */
532_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
533 "use gnulib module realloc-posix for portability");
534#endif
535
536#if @GNULIB_REALPATH@
537# if @REPLACE_REALPATH@
538# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
539# define realpath rpl_realpath
540# endif
541_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
542 _GL_ARG_NONNULL ((1)));
543_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
544# else
545# if !@HAVE_REALPATH@
546_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
547 _GL_ARG_NONNULL ((1)));
548# endif
549_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
550# endif
551_GL_CXXALIASWARN (realpath);
552#elif defined GNULIB_POSIXCHECK
553# undef realpath
554# if HAVE_RAW_DECL_REALPATH
555_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
556 "canonicalize or canonicalize-lgpl for portability");
557# endif
558#endif
559
560#if @GNULIB_RPMATCH@
561/* Test a user response to a question.
562 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
563# if !@HAVE_RPMATCH@
564_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
565# endif
566_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
567_GL_CXXALIASWARN (rpmatch);
568#elif defined GNULIB_POSIXCHECK
569# undef rpmatch
570# if HAVE_RAW_DECL_RPMATCH
571_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
572 "use gnulib module rpmatch for portability");
573# endif
574#endif
575
576#if @GNULIB_SETENV@
577/* Set NAME to VALUE in the environment.
578 If REPLACE is nonzero, overwrite an existing value. */
579# if @REPLACE_SETENV@
580# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
581# undef setenv
582# define setenv rpl_setenv
583# endif
584_GL_FUNCDECL_RPL (setenv, int,
585 (const char *name, const char *value, int replace)
586 _GL_ARG_NONNULL ((1)));
587_GL_CXXALIAS_RPL (setenv, int,
588 (const char *name, const char *value, int replace));
589# else
590# if !@HAVE_DECL_SETENV@
591_GL_FUNCDECL_SYS (setenv, int,
592 (const char *name, const char *value, int replace)
593 _GL_ARG_NONNULL ((1)));
594# endif
595_GL_CXXALIAS_SYS (setenv, int,
596 (const char *name, const char *value, int replace));
597# endif
598# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
599_GL_CXXALIASWARN (setenv);
600# endif
601#elif defined GNULIB_POSIXCHECK
602# undef setenv
603# if HAVE_RAW_DECL_SETENV
604_GL_WARN_ON_USE (setenv, "setenv is unportable - "
605 "use gnulib module setenv for portability");
606# endif
607#endif
608
609#if @GNULIB_STRTOD@
610 /* Parse a double from STRING, updating ENDP if appropriate. */
611# if @REPLACE_STRTOD@
612# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
613# define strtod rpl_strtod
614# endif
615_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
616 _GL_ARG_NONNULL ((1)));
617_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
618# else
619# if !@HAVE_STRTOD@
620_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
621 _GL_ARG_NONNULL ((1)));
622# endif
623_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
624# endif
625_GL_CXXALIASWARN (strtod);
626#elif defined GNULIB_POSIXCHECK
627# undef strtod
628# if HAVE_RAW_DECL_STRTOD
629_GL_WARN_ON_USE (strtod, "strtod is unportable - "
630 "use gnulib module strtod for portability");
631# endif
632#endif
633
634#if @GNULIB_STRTOLL@
635/* Parse a signed integer whose textual representation starts at STRING.
636 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
637 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
638 "0x").
639 If ENDPTR is not NULL, the address of the first byte after the integer is
640 stored in *ENDPTR.
641 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
642 to ERANGE. */
643# if !@HAVE_STRTOLL@
644_GL_FUNCDECL_SYS (strtoll, long long,
645 (const char *string, char **endptr, int base)
646 _GL_ARG_NONNULL ((1)));
647# endif
648_GL_CXXALIAS_SYS (strtoll, long long,
649 (const char *string, char **endptr, int base));
650_GL_CXXALIASWARN (strtoll);
651#elif defined GNULIB_POSIXCHECK
652# undef strtoll
653# if HAVE_RAW_DECL_STRTOLL
654_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
655 "use gnulib module strtoll for portability");
656# endif
657#endif
658
659#if @GNULIB_STRTOULL@
660/* Parse an unsigned integer whose textual representation starts at STRING.
661 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
662 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
663 "0x").
664 If ENDPTR is not NULL, the address of the first byte after the integer is
665 stored in *ENDPTR.
666 Upon overflow, the return value is ULLONG_MAX, and errno is set to
667 ERANGE. */
668# if !@HAVE_STRTOULL@
669_GL_FUNCDECL_SYS (strtoull, unsigned long long,
670 (const char *string, char **endptr, int base)
671 _GL_ARG_NONNULL ((1)));
672# endif
673_GL_CXXALIAS_SYS (strtoull, unsigned long long,
674 (const char *string, char **endptr, int base));
675_GL_CXXALIASWARN (strtoull);
676#elif defined GNULIB_POSIXCHECK
677# undef strtoull
678# if HAVE_RAW_DECL_STRTOULL
679_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
680 "use gnulib module strtoull for portability");
681# endif
682#endif
683
684#if @GNULIB_UNLOCKPT@
685/* Unlock the slave side of the pseudo-terminal whose master side is specified
686 by FD, so that it can be opened. */
687# if !@HAVE_UNLOCKPT@
688_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
689# endif
690_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
691_GL_CXXALIASWARN (unlockpt);
692#elif defined GNULIB_POSIXCHECK
693# undef unlockpt
694# if HAVE_RAW_DECL_UNLOCKPT
695_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
696 "use gnulib module unlockpt for portability");
697# endif
698#endif
699
700#if @GNULIB_UNSETENV@
701/* Remove the variable NAME from the environment. */
702# if @REPLACE_UNSETENV@
703# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
704# undef unsetenv
705# define unsetenv rpl_unsetenv
706# endif
707_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
708_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
709# else
710# if !@HAVE_DECL_UNSETENV@
711_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
712# endif
713_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
714# endif
715# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
716_GL_CXXALIASWARN (unsetenv);
717# endif
718#elif defined GNULIB_POSIXCHECK
719# undef unsetenv
720# if HAVE_RAW_DECL_UNSETENV
721_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
722 "use gnulib module unsetenv for portability");
723# endif
724#endif
725
726
727#endif /* _GL_STDLIB_H */
728#endif /* _GL_STDLIB_H */
729#endif
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
new file mode 100644
index 00000000000..4aae158e963
--- /dev/null
+++ b/m4/getloadavg.m4
@@ -0,0 +1,156 @@
1# Check for getloadavg.
2
3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2011 Free Software
4# Foundation, Inc.
5
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10#serial 2
11
12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
13# New applications should use gl_GETLOADAVG instead.
14
15# gl_GETLOADAVG(LIBOBJDIR)
16# ------------------------
17AC_DEFUN([gl_GETLOADAVG],
18[AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
19
20# Persuade glibc <stdlib.h> to declare getloadavg().
21AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
22
23# Make sure getloadavg.c is where it belongs, at configure-time.
24test -f "$srcdir/$1/getloadavg.c" ||
25 AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
26
27gl_save_LIBS=$LIBS
28
29AC_CHECK_FUNC([getloadavg], [],
30 [gl_have_func=no
31
32 # Some systems with -lutil have (and need) -lkvm as well, some do not.
33 # On Solaris, -lkvm requires nlist from -lelf, so check that first
34 # to get the right answer into the cache.
35 # For kstat on solaris, we need to test for libelf and libkvm to force the
36 # definition of SVR4 below.
37 if test $gl_have_func = no; then
38 AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
39 AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"])
40 # Check for the 4.4BSD definition of getloadavg.
41 AC_CHECK_LIB([util], [getloadavg],
42 [LIBS="-lutil $LIBS" gl_have_func=yes])
43 fi
44
45 if test $gl_have_func = no; then
46 # There is a commonly available library for RS/6000 AIX.
47 # Since it is not a standard part of AIX, it might be installed locally.
48 gl_getloadavg_LIBS=$LIBS
49 LIBS="-L/usr/local/lib $LIBS"
50 AC_CHECK_LIB([getloadavg], [getloadavg],
51 [LIBS="-lgetloadavg $LIBS" gl_have_func=yes],
52 [LIBS=$gl_getloadavg_LIBS])
53 fi
54
55 # Set up the replacement function if necessary.
56 if test $gl_have_func = no; then
57 AC_LIBOBJ([getloadavg])
58 gl_PREREQ_GETLOADAVG
59 fi])
60
61if test "x$gl_save_LIBS" = x; then
62 GETLOADAVG_LIBS=$LIBS
63else
64 GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
65fi
66LIBS=$gl_save_LIBS
67
68AC_SUBST([GETLOADAVG_LIBS])dnl
69
70# Test whether the system declares getloadavg. Solaris has the function
71# but declares it in <sys/loadavg.h>, not <stdlib.h>.
72AC_CHECK_HEADERS([sys/loadavg.h])
73if test $ac_cv_header_sys_loadavg_h = yes; then
74 HAVE_SYS_LOADAVG_H=1
75else
76 HAVE_SYS_LOADAVG_H=0
77fi
78AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
79 [#if HAVE_SYS_LOADAVG_H
80 # include <sys/loadavg.h>
81 #endif
82 #include <stdlib.h>])
83])# gl_GETLOADAVG
84
85
86# gl_PREREQ_GETLOADAVG
87# --------------------
88# Set up the AC_LIBOBJ replacement of `getloadavg'.
89AC_DEFUN([gl_PREREQ_GETLOADAVG],
90[
91# Figure out what our getloadavg.c needs.
92
93# Solaris has libkstat which does not require root.
94AC_CHECK_LIB([kstat], [kstat_open])
95test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
96
97# On HPUX9, an unprivileged user can get load averages this way.
98if test $gl_have_func = no; then
99 AC_CHECK_FUNCS([pstat_getdynamic], [gl_have_func=yes])
100fi
101
102# AIX has libperfstat which does not require root
103if test $gl_have_func = no; then
104 AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
105 test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
106fi
107
108if test $gl_have_func = no; then
109 AC_CHECK_HEADER([sys/dg_sys_info.h],
110 [gl_have_func=yes
111 AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
112 AC_CHECK_LIB([dgc], [dg_sys_info])])
113fi
114
115# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
116# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
117# Irix 4.0.5F has the header but not the library.
118if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes \
119 && test "$ac_cv_lib_kvm_kvm_open" = yes; then
120 gl_have_func=yes
121 AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.])
122fi
123
124if test $gl_have_func = no; then
125 AC_CHECK_HEADER([inq_stats/cpustats.h],
126 [gl_have_func=yes
127 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
128 AC_DEFINE([UMAX4_3], [1],
129 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
130 instead of <sys/cpustats.h>.])])
131fi
132
133if test $gl_have_func = no; then
134 AC_CHECK_HEADER([sys/cpustats.h],
135 [gl_have_func=yes; AC_DEFINE([UMAX])])
136fi
137
138if test $gl_have_func = no; then
139 AC_CHECK_HEADERS([mach/mach.h])
140fi
141
142AC_CHECK_HEADERS([nlist.h],
143[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
144 [], [],
145 [@%:@include <nlist.h>])
146 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
147 [[struct nlist x;
148 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
149 x.n_un.n_name = "";
150 #else
151 x.n_name = "";
152 #endif]])],
153 [AC_DEFINE([N_NAME_POINTER], [1],
154 [Define to 1 if the nlist n_name member is a pointer])])
155])dnl
156])# gl_PREREQ_GETLOADAVG
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4
index 4bd213cdbd5..036b67452c8 100644
--- a/m4/gl-comp.m4
+++ b/m4/gl-comp.m4
@@ -31,6 +31,7 @@ AC_DEFUN([gl_EARLY],
31 # Code from module dtoastr: 31 # Code from module dtoastr:
32 # Code from module extensions: 32 # Code from module extensions:
33 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 33 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
34 # Code from module getloadavg:
34 # Code from module getopt-gnu: 35 # Code from module getopt-gnu:
35 # Code from module getopt-posix: 36 # Code from module getopt-posix:
36 # Code from module gettext-h: 37 # Code from module gettext-h:
@@ -41,6 +42,7 @@ AC_DEFUN([gl_EARLY],
41 # Code from module multiarch: 42 # Code from module multiarch:
42 # Code from module stdbool: 43 # Code from module stdbool:
43 # Code from module stddef: 44 # Code from module stddef:
45 # Code from module stdlib:
44 # Code from module strftime: 46 # Code from module strftime:
45 # Code from module time: 47 # Code from module time:
46 # Code from module time_r: 48 # Code from module time_r:
@@ -69,6 +71,9 @@ AC_DEFUN([gl_INIT],
69 # Code from module dtoastr: 71 # Code from module dtoastr:
70 AC_REQUIRE([gl_C99_STRTOLD]) 72 AC_REQUIRE([gl_C99_STRTOLD])
71 # Code from module extensions: 73 # Code from module extensions:
74 # Code from module getloadavg:
75 gl_GETLOADAVG([$gl_source_base])
76 gl_STDLIB_MODULE_INDICATOR([getloadavg])
72 # Code from module getopt-gnu: 77 # Code from module getopt-gnu:
73 gl_FUNC_GETOPT_GNU 78 gl_FUNC_GETOPT_GNU
74 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) 79 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
@@ -90,6 +95,8 @@ AC_DEFUN([gl_INIT],
90 AM_STDBOOL_H 95 AM_STDBOOL_H
91 # Code from module stddef: 96 # Code from module stddef:
92 gl_STDDEF_H 97 gl_STDDEF_H
98 # Code from module stdlib:
99 gl_STDLIB_H
93 # Code from module strftime: 100 # Code from module strftime:
94 gl_FUNC_GNU_STRFTIME 101 gl_FUNC_GNU_STRFTIME
95 # Code from module time: 102 # Code from module time:
@@ -246,6 +253,7 @@ AC_DEFUN([gl_FILE_LIST], [
246 lib/dtoastr.c 253 lib/dtoastr.c
247 lib/ftoastr.c 254 lib/ftoastr.c
248 lib/ftoastr.h 255 lib/ftoastr.h
256 lib/getloadavg.c
249 lib/getopt.c 257 lib/getopt.c
250 lib/getopt.in.h 258 lib/getopt.in.h
251 lib/getopt1.c 259 lib/getopt1.c
@@ -257,6 +265,7 @@ AC_DEFUN([gl_FILE_LIST], [
257 lib/mktime.c 265 lib/mktime.c
258 lib/stdbool.in.h 266 lib/stdbool.in.h
259 lib/stddef.in.h 267 lib/stddef.in.h
268 lib/stdlib.in.h
260 lib/strftime.c 269 lib/strftime.c
261 lib/strftime.h 270 lib/strftime.h
262 lib/time.in.h 271 lib/time.in.h
@@ -265,6 +274,7 @@ AC_DEFUN([gl_FILE_LIST], [
265 m4/00gnulib.m4 274 m4/00gnulib.m4
266 m4/c-strtod.m4 275 m4/c-strtod.m4
267 m4/extensions.m4 276 m4/extensions.m4
277 m4/getloadavg.m4
268 m4/getopt.m4 278 m4/getopt.m4
269 m4/gnulib-common.m4 279 m4/gnulib-common.m4
270 m4/include_next.m4 280 m4/include_next.m4
@@ -272,6 +282,7 @@ AC_DEFUN([gl_FILE_LIST], [
272 m4/multiarch.m4 282 m4/multiarch.m4
273 m4/stdbool.m4 283 m4/stdbool.m4
274 m4/stddef_h.m4 284 m4/stddef_h.m4
285 m4/stdlib_h.m4
275 m4/strftime.m4 286 m4/strftime.m4
276 m4/time_h.m4 287 m4/time_h.m4
277 m4/time_r.m4 288 m4/time_r.m4
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
new file mode 100644
index 00000000000..d28b552e905
--- /dev/null
+++ b/m4/stdlib_h.m4
@@ -0,0 +1,101 @@
1# stdlib_h.m4 serial 36
2dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_STDLIB_H],
8[
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10 gl_NEXT_HEADERS([stdlib.h])
11
12 dnl Check for declarations of anything we want to poison if the
13 dnl corresponding gnulib module is not in use, and which is not
14 dnl guaranteed by C89.
15 gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
16#if HAVE_SYS_LOADAVG_H
17# include <sys/loadavg.h>
18#endif
19#if HAVE_RANDOM_H
20# include <random.h>
21#endif
22 ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
23 mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
24 setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
25 unsetenv])
26])
27
28AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
29[
30 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
31 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
32 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
33 dnl Define it also as a C macro, for the benefit of the unit tests.
34 gl_MODULE_INDICATOR_FOR_TESTS([$1])
35])
36
37AC_DEFUN([gl_STDLIB_H_DEFAULTS],
38[
39 GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT])
40 GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
41 GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
42 GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
43 GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG])
44 GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
45 GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT])
46 GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
47 GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
48 GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP])
49 GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
50 GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
51 GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
52 GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
53 GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
54 GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
55 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
56 GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
57 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
58 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
59 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
60 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
61 GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
62 GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
63 GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
64 GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
65 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
67 HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
68 HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
69 HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
70 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
71 HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
72 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
73 HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
74 HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
75 HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
76 HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
77 HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
78 HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
79 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
80 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
81 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
82 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
83 HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
84 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
85 HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL])
86 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
87 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
88 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
89 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
90 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
91 REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
92 REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
93 REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
94 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
95 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
96 REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
97 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
98 REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
99 REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
100 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
101])
diff --git a/src/ChangeLog b/src/ChangeLog
index c9ae55a30c1..aae583094f2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
12011-02-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Remove no-longer needed getloadavg symbols.
4 * m/alpha.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
5 * m/amdx86-64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
6 * m/ia64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
7 * m/ibms390.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
8 * m/macppc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
9 * m/sparc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
10 * m/template.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
11 * m/vax.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
12 * s/aix4-2.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
13 * s/bsd-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove #undef.
14 * s/hpux10-20.h (KERNEL_FILE, LOAD_AVE_TYPE, LOAD_AVE_CVT):
15 (LDAV_SYMBOL): Remove.
16 * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Remove.
17 * s/usg5-4-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
18
19 Import getloadavg module from gnulib.
20 * deps.mk (getloadavg.o): Remove; gnulib now does this.
21 * lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib
22 now does this.
23 * src/s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this.
24 * src/s/netbsd.h (HAVE_GETLOADAVG): Likewise.
25 * config.in: Regenerate.
26
12011-02-15 Eli Zaretskii <eliz@gnu.org> 272011-02-15 Eli Zaretskii <eliz@gnu.org>
2 28
3 * nsfns.m (ns_set_name_as_filename, Fns_read_file_name): Use B_. 29 * nsfns.m (ns_set_name_as_filename, Fns_read_file_name): Use B_.
@@ -9,7 +35,7 @@
9 35
102011-02-14 Eli Zaretskii <eliz@gnu.org> 362011-02-14 Eli Zaretskii <eliz@gnu.org>
11 37
12 * msdos.c (IT_frame_up_to_date): 38 * msdos.c (IT_frame_up_to_date):
13 * s/msdos.h (MODE_LINE_BINARY_TEXT): Use B_ for the MS-DOS build. 39 * s/msdos.h (MODE_LINE_BINARY_TEXT): Use B_ for the MS-DOS build.
14 40
15 * dired.c (directory_files_internal): 41 * dired.c (directory_files_internal):
diff --git a/src/config.in b/src/config.in
index 729c598a445..637287a024c 100644
--- a/src/config.in
+++ b/src/config.in
@@ -42,9 +42,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42/* Define to 1 if using `alloca.c'. */ 42/* Define to 1 if using `alloca.c'. */
43#undef C_ALLOCA 43#undef C_ALLOCA
44 44
45/* Define to 1 if using `getloadavg.c'. */
46#undef C_GETLOADAVG
47
48/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */ 45/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
49#undef DGUX 46#undef DGUX
50 47
@@ -74,10 +71,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
74/* Define this to check for short string overrun. */ 71/* Define this to check for short string overrun. */
75#undef GC_CHECK_STRING_OVERRUN 72#undef GC_CHECK_STRING_OVERRUN
76 73
77/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid.
78 */
79#undef GETLOADAVG_PRIVILEGED
80
81/* Define to 1 if the `getpgrp' function requires zero arguments. */ 74/* Define to 1 if the `getpgrp' function requires zero arguments. */
82#undef GETPGRP_VOID 75#undef GETPGRP_VOID
83 76
@@ -225,9 +218,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
225/* Define to 1 if you have the `getline' function. */ 218/* Define to 1 if you have the `getline' function. */
226#undef HAVE_GETLINE 219#undef HAVE_GETLINE
227 220
228/* Define to 1 if you have the `getloadavg' function. */
229#undef HAVE_GETLOADAVG
230
231/* Define to 1 if you have the <getopt.h> header file. */ 221/* Define to 1 if you have the <getopt.h> header file. */
232#undef HAVE_GETOPT_H 222#undef HAVE_GETOPT_H
233 223
@@ -408,6 +398,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
408/* Define to 1 if using libotf. */ 398/* Define to 1 if using libotf. */
409#undef HAVE_LIBOTF 399#undef HAVE_LIBOTF
410 400
401/* Define to 1 if you have the `perfstat' library (-lperfstat). */
402#undef HAVE_LIBPERFSTAT
403
411/* Define to 1 if you have the <libpng/png.h> header file. */ 404/* Define to 1 if you have the <libpng/png.h> header file. */
412#undef HAVE_LIBPNG_PNG_H 405#undef HAVE_LIBPNG_PNG_H
413 406
@@ -672,6 +665,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
672/* Define to 1 if you have the `sysinfo' function. */ 665/* Define to 1 if you have the `sysinfo' function. */
673#undef HAVE_SYSINFO 666#undef HAVE_SYSINFO
674 667
668/* Define to 1 if you have the <sys/loadavg.h> header file. */
669#undef HAVE_SYS_LOADAVG_H
670
675/* Define to 1 if you have the <sys/mman.h> header file. */ 671/* Define to 1 if you have the <sys/mman.h> header file. */
676#undef HAVE_SYS_MMAN_H 672#undef HAVE_SYS_MMAN_H
677 673
@@ -870,10 +866,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
870/* Define to support POP mail retrieval. */ 866/* Define to support POP mail retrieval. */
871#undef MAIL_USE_POP 867#undef MAIL_USE_POP
872 868
873/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
874 on `HAVE_STRUCT_NLIST_N_UN_N_NAME */
875#undef NLIST_NAME_UNION
876
877/* Define to 1 if you don't have struct exception in math.h. */ 869/* Define to 1 if you don't have struct exception in math.h. */
878#undef NO_MATHERR 870#undef NO_MATHERR
879 871
@@ -889,6 +881,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
889/* Define to 1 if you are using NS windowing under GNUstep. */ 881/* Define to 1 if you are using NS windowing under GNUstep. */
890#undef NS_IMPL_GNUSTEP 882#undef NS_IMPL_GNUSTEP
891 883
884/* Define to 1 if the nlist n_name member is a pointer */
885#undef N_NAME_POINTER
886
892/* Define if the C compiler is the linker. */ 887/* Define if the C compiler is the linker. */
893#undef ORDINARY_LINK 888#undef ORDINARY_LINK
894 889
diff --git a/src/deps.mk b/src/deps.mk
index e8ff3dd592e..3cb69bab2d8 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -115,7 +115,6 @@ fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
115ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \ 115ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \
116 font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \ 116 font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \
117 fontset.h ccl.h ftfont.h globals.h 117 fontset.h ccl.h ftfont.h globals.h
118getloadavg.o: getloadavg.c $(config_h)
119gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \ 118gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \
120 lisp.h globals.h $(config_h) 119 lisp.h globals.h $(config_h)
121gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \ 120gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
diff --git a/src/lisp.h b/src/lisp.h
index 5ab8c71ecfd..0efadd675b0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3407,11 +3407,6 @@ EXFUN (Fclear_face_cache, 1);
3407EXFUN (Fx_load_color_file, 1); 3407EXFUN (Fx_load_color_file, 1);
3408extern void syms_of_xfaces (void); 3408extern void syms_of_xfaces (void);
3409 3409
3410#ifndef HAVE_GETLOADAVG
3411/* Defined in getloadavg.c */
3412extern int getloadavg (double *, int);
3413#endif
3414
3415#ifdef HAVE_X_WINDOWS 3410#ifdef HAVE_X_WINDOWS
3416/* Defined in xfns.c */ 3411/* Defined in xfns.c */
3417extern void syms_of_xfns (void); 3412extern void syms_of_xfns (void);
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 9ae089bfc5b..3a27cfd65d9 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -29,12 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29/* __alpha defined automatically */ 29/* __alpha defined automatically */
30 30
31 31
32/* Data type of load average, as read out of kmem. */
33#define LOAD_AVE_TYPE long
34
35/* Convert that into an integer that is 100 for a load average of 1.0 */
36#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
37
38#ifdef __ELF__ 32#ifdef __ELF__
39 33
40#if !defined(GNU_LINUX) && !defined(__NetBSD__) 34#if !defined(GNU_LINUX) && !defined(__NetBSD__)
@@ -57,4 +51,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
57 Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN: 51 Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN:
58 this avoids the assembler bug. */ 52 this avoids the assembler bug. */
59#define DBL_MIN_REPLACEMENT 2.2250738585072019e-308 53#define DBL_MIN_REPLACEMENT 2.2250738585072019e-308
60
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index 2ae5d07390f..441f41b4444 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -30,12 +30,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define EMACS_UINT unsigned long 31#define EMACS_UINT unsigned long
32 32
33/* Data type of load average, as read out of kmem. */
34#define LOAD_AVE_TYPE long
35
36/* Convert that into an integer that is 100 for a load average of 1.0 */
37#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
38
39/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ 33/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
40#undef DATA_SEG_BITS 34#undef DATA_SEG_BITS
41
diff --git a/src/m/ia64.h b/src/m/ia64.h
index 48ba3005cd6..101d56e648b 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define EMACS_UINT unsigned long 31#define EMACS_UINT unsigned long
32 32
33/* Data type of load average, as read out of kmem. */
34#define LOAD_AVE_TYPE long
35
36/* Convert that into an integer that is 100 for a load average of 1.0 */
37#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
38
39#ifdef REL_ALLOC 33#ifdef REL_ALLOC
40#ifndef _MALLOC_INTERNAL 34#ifndef _MALLOC_INTERNAL
41/* "char *" because ralloc.c defines it that way. gmalloc.c thinks it 35/* "char *" because ralloc.c defines it that way. gmalloc.c thinks it
@@ -45,4 +39,3 @@ extern char *r_alloc (), *r_re_alloc ();
45extern void r_alloc_free (); 39extern void r_alloc_free ();
46#endif /* not _MALLOC_INTERNAL */ 40#endif /* not _MALLOC_INTERNAL */
47#endif /* REL_ALLOC */ 41#endif /* REL_ALLOC */
48
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index f2aef1ba513..c309035dc5c 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -18,12 +18,6 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 20
21/* Data type of load average, as read out of kmem. */
22#define LOAD_AVE_TYPE long
23
24/* Convert that into an integer that is 100 for a load average of 1.0 */
25#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
26
27/* Define VIRT_ADDR_VARIES if the virtual addresses of 21/* Define VIRT_ADDR_VARIES if the virtual addresses of
28 pure and impure space as loaded can vary, and even their 22 pure and impure space as loaded can vary, and even their
29 relative order cannot be relied on. 23 relative order cannot be relied on.
@@ -31,4 +25,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31 Otherwise Emacs assumes that text space precedes data space, 25 Otherwise Emacs assumes that text space precedes data space,
32 numerically. */ 26 numerically. */
33#define VIRT_ADDR_VARIES 27#define VIRT_ADDR_VARIES
34
diff --git a/src/m/macppc.h b/src/m/macppc.h
index 5d78e39bdba..aef781e2c39 100644
--- a/src/m/macppc.h
+++ b/src/m/macppc.h
@@ -17,15 +17,8 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20/* Data type of load average, as read out of kmem. */
21#define LOAD_AVE_TYPE long
22
23/* Convert that into an integer that is 100 for a load average of 1.0 */
24#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
25
26#ifdef _ARCH_PPC64 20#ifdef _ARCH_PPC64
27#ifndef _LP64 21#ifndef _LP64
28#define _LP64 22#define _LP64
29#endif 23#endif
30#endif 24#endif
31
diff --git a/src/m/sparc.h b/src/m/sparc.h
index 50e56f0f3dc..99668043f30 100644
--- a/src/m/sparc.h
+++ b/src/m/sparc.h
@@ -19,12 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20/* __sparc__ is defined by the compiler by default. */ 20/* __sparc__ is defined by the compiler by default. */
21 21
22/* Data type of load average, as read out of kmem. */
23#define LOAD_AVE_TYPE long
24
25/* Convert that into an integer that is 100 for a load average of 1.0 */
26#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
27
28#ifdef __arch64__ /* GCC, 64-bit ABI. */ 22#ifdef __arch64__ /* GCC, 64-bit ABI. */
29 23
30#define BITS_PER_LONG 64 24#define BITS_PER_LONG 64
@@ -34,4 +28,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34#endif 28#endif
35 29
36#endif /* __arch64__ */ 30#endif /* __arch64__ */
37
diff --git a/src/m/template.h b/src/m/template.h
index f06f62b6cda..54fb0da9521 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -21,12 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 does not define it automatically. 21 does not define it automatically.
22 Ones defined so far include m68k and many others */ 22 Ones defined so far include m68k and many others */
23 23
24/* Data type of load average, as read out of kmem. */
25#define LOAD_AVE_TYPE long
26
27/* Convert that into an integer that is 100 for a load average of 1.0 */
28#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
29
30/* Define VIRT_ADDR_VARIES if the virtual addresses of 24/* Define VIRT_ADDR_VARIES if the virtual addresses of
31 pure and impure space as loaded can vary, and even their 25 pure and impure space as loaded can vary, and even their
32 relative order cannot be relied on. 26 relative order cannot be relied on.
@@ -46,4 +40,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46 If you've just fixed a problem in an existing configuration file, 40 If you've just fixed a problem in an existing configuration file,
47 you should also check `etc/MACHINES' to make sure its descriptions 41 you should also check `etc/MACHINES' to make sure its descriptions
48 of known problems in that configuration should be updated. */ 42 of known problems in that configuration should be updated. */
49
diff --git a/src/m/vax.h b/src/m/vax.h
index 2fecf17ca84..a375600cead 100644
--- a/src/m/vax.h
+++ b/src/m/vax.h
@@ -20,14 +20,4 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21/* #define vax -- appears to be done automatically */ 21/* #define vax -- appears to be done automatically */
22 22
23/* USG systems I know of running on Vaxes do not actually
24 support the load average, so disable it for them. */
25
26/* Data type of load average, as read out of kmem. */
27#define LOAD_AVE_TYPE double
28
29/* Convert that into an integer that is 100 for a load average of 1.0 */
30#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
31
32#define HAVE_FTIME 23#define HAVE_FTIME
33
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index c62aee249c5..443fc034570 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -41,12 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41 41
42/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ 42/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
43#define HAVE_SOCKETS 43#define HAVE_SOCKETS
44
45/* The file containing the kernel's symbol table is called /unix. */
46#define KERNEL_FILE "/unix"
47
48/* The kernel symbol where the load average is found is named avenrun. */
49#define LDAV_SYMBOL "avenrun"
50 44
51/* Special items needed to make Emacs run on this system. */ 45/* Special items needed to make Emacs run on this system. */
52 46
@@ -86,4 +80,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
86 Emacs currently calls xrealloc on the results of get_current_dir name, 80 Emacs currently calls xrealloc on the results of get_current_dir name,
87 to avoid a crash just use the Emacs implementation for that function. */ 81 to avoid a crash just use the Emacs implementation for that function. */
88#define BROKEN_GET_CURRENT_DIR_NAME 1 82#define BROKEN_GET_CURRENT_DIR_NAME 1
89
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index 7d472c83ed1..0cca005b423 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -37,10 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#define TABDLY OXTABS 37#define TABDLY OXTABS
38#define TAB3 OXTABS 38#define TAB3 OXTABS
39 39
40/* These aren't needed, since we have getloadavg. */
41#undef KERNEL_FILE
42#undef LDAV_SYMBOL
43
44#define NO_TERMIO 40#define NO_TERMIO
45 41
46/* If the system's imake configuration file defines `NeedWidePrototypes' 42/* If the system's imake configuration file defines `NeedWidePrototypes'
@@ -72,12 +68,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
72 a file that someone else has modified in his Emacs. */ 68 a file that someone else has modified in his Emacs. */
73#define CLASH_DETECTION 69#define CLASH_DETECTION
74 70
75/* The file containing the kernel's symbol table is called /vmunix. */
76#define KERNEL_FILE "/vmunix"
77
78/* The kernel symbol where the load average is found is named _avenrun. */
79#define LDAV_SYMBOL "_avenrun"
80
81/* Send signals to subprocesses by "typing" special chars at them. */ 71/* Send signals to subprocesses by "typing" special chars at them. */
82#define SIGNALS_VIA_CHARACTERS 72#define SIGNALS_VIA_CHARACTERS
83
diff --git a/src/s/freebsd.h b/src/s/freebsd.h
index 222ebc91c4a..24b34e02f69 100644
--- a/src/s/freebsd.h
+++ b/src/s/freebsd.h
@@ -25,8 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 26#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
27 27
28#define HAVE_GETLOADAVG 1
29
30/* This silences a few compilation warnings. */ 28/* This silences a few compilation warnings. */
31#undef BSD_SYSTEM 29#undef BSD_SYSTEM
32#if __FreeBSD__ == 1 30#if __FreeBSD__ == 1
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index d745f8d09c4..1cd91a41b55 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -47,9 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
47 a file that someone else has modified in his Emacs. */ 47 a file that someone else has modified in his Emacs. */
48#define CLASH_DETECTION 48#define CLASH_DETECTION
49 49
50/* The symbol in the kernel where the load average is found
51 depends on the cpu type, so we let the m- files define LDAV_SYMBOL. */
52
53/* Special hacks needed to make Emacs run on this system. */ 50/* Special hacks needed to make Emacs run on this system. */
54 51
55/* In hpux, the symbol SIGIO is defined, but the feature 52/* In hpux, the symbol SIGIO is defined, but the feature
@@ -91,9 +88,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
91#undef random 88#undef random
92#undef HAVE_RANDOM 89#undef HAVE_RANDOM
93 90
94/* AlainF 20-Jul-1996 says this is right. */
95#define KERNEL_FILE "/stand/vmunix"
96
97 91
98/* Rainer Malzbender <rainer@displaytech.com> says definining 92/* Rainer Malzbender <rainer@displaytech.com> says definining
99 HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */ 93 HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */
@@ -119,18 +113,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
119#define DATA_SEG_BITS 0x40000000 113#define DATA_SEG_BITS 0x40000000
120 114
121#define DATA_START 0x40000000 115#define DATA_START 0x40000000
122
123/* Data type of load average, as read out of kmem. */
124#define LOAD_AVE_TYPE double
125
126/* Convert that into an integer that is 100 for a load average of 1.0 */
127#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
128
129/* The kernel symbol where the load average is found is named _avenrun.
130 At this time there are two major flavors of hp-ux (there is the s800
131 and s300 (s200) flavors). The differences are thusly moved to the
132 corresponding machine description file. */
133
134/* No underscore please. */
135#define LDAV_SYMBOL "avenrun"
136
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
index 8a639b93c84..52cda717a2d 100644
--- a/src/s/netbsd.h
+++ b/src/s/netbsd.h
@@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21/* Get most of the stuff from bsd-common. */ 21/* Get most of the stuff from bsd-common. */
22#include "bsd-common.h" 22#include "bsd-common.h"
23 23
24#define HAVE_GETLOADAVG 1
25
26#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 24#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
27 25
28#define DEFAULT_SOUND_DEVICE "/dev/audio" 26#define DEFAULT_SOUND_DEVICE "/dev/audio"
@@ -43,4 +41,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43 41
44/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */ 42/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */
45#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 43#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
46
diff --git a/src/s/unixware.h b/src/s/unixware.h
index c6130669a9a..407282ff78c 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -49,14 +49,4 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
49 pty_name[sizeof(pty_name) - 1] = 0; \ 49 pty_name[sizeof(pty_name) - 1] = 0; \
50 } 50 }
51 51
52/* Data type of load average, as read out of kmem. */
53#define LOAD_AVE_TYPE long
54
55/* Convert that into an integer that is 100 for a load average of 1.0 */
56/* This is totally uncalibrated. */
57#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
58#define FSCALE 256.0
59
60
61#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base) 52#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
62
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 12f73c1b3b5..aeedd7f4b15 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30 It sets the Lisp variable system-type. */ 30 It sets the Lisp variable system-type. */
31#define SYSTEM_TYPE "usg-unix-v" 31#define SYSTEM_TYPE "usg-unix-v"
32 32
33/* The file containing the kernel's symbol table is called /unix. */
34#define KERNEL_FILE "/unix"
35
36/* The kernel symbol where the load average is found is named avenrun. */
37#define LDAV_SYMBOL "avenrun"
38
39/* setjmp and longjmp can safely replace _setjmp and _longjmp, 33/* setjmp and longjmp can safely replace _setjmp and _longjmp,
40 but they will run slower. */ 34 but they will run slower. */
41#define _setjmp setjmp 35#define _setjmp setjmp
@@ -105,4 +99,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
105 99
106/* This definition was suggested for next release. So give it a try. */ 100/* This definition was suggested for next release. So give it a try. */
107#define HAVE_SOCKETS 101#define HAVE_SOCKETS
108