Commit 1f5d53eb authored by Paul Eggert's avatar Paul Eggert

Import getloadavg module from gnulib.

parent 7127b760
2011-02-16 Paul Eggert <eggert@cs.ucla.edu>
Import getloadavg module from gnulib.
* .bzrignore: Add lib/stdlib.h.
* Makefile.in (GNULIB_MODULES): Add getloadavg.
* admin/notes/copyright: Remove src/getloadavg.c as a special case.
* configure.in (LIBS_SYSTEM): Omit -lkstat on sol2*; gnulib does this.
(AC_CONFIG_LIBOBJ_DIR, AC_FUNC_GETLOADAVG, GETLOADAVG_FILES):
Remove; gnulib does this now.
* lib/getloadavg.c: Rename from src/getloadavg.c, and sync
from gnulib. This adds support for several other systems, such
as Tru64 4.0D, QNX, AIX perfstat, etc. It also fixes a potential
buffer overrun on Linux hosts under very high load, and on hosts
that maintain a channel to the load average file it makes sure
the file descriptor is close-on-exec (on hosts that support this)
and is not stdin, stdout, or stderr.
* lib/stdlib.in.h, m4/getloadavg.m4, m4/stdlib_h.m4: New files,
from gnulib.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4:
* src/config.in: Regenerate.
2011-02-15 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib.
......
......@@ -330,7 +330,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4
# Update modules from gnulib, for maintainers, who should have it in
# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
# as per $(gnulib_srcdir)/DEPENDENCIES.
GNULIB_MODULES = dtoastr getopt-gnu ignore-value mktime strftime
GNULIB_MODULES = dtoastr getloadavg getopt-gnu ignore-value mktime strftime
GNULIB_TOOL_FLAGS = \
--import --no-changelog --no-vc-files --makefile-name=gnulib.mk
sync-from-gnulib: $(gnulib_srcdir)
......
......@@ -987,6 +987,7 @@ AC_SUBST([am__untar])
m4_include([m4/00gnulib.m4])
m4_include([m4/c-strtod.m4])
m4_include([m4/extensions.m4])
m4_include([m4/getloadavg.m4])
m4_include([m4/getopt.m4])
m4_include([m4/gl-comp.m4])
m4_include([m4/gnulib-common.m4])
......@@ -995,6 +996,7 @@ m4_include([m4/mktime.m4])
m4_include([m4/multiarch.m4])
m4_include([m4/stdbool.m4])
m4_include([m4/stddef_h.m4])
m4_include([m4/stdlib_h.m4])
m4_include([m4/strftime.m4])
m4_include([m4/time_h.m4])
m4_include([m4/time_r.m4])
......
......@@ -62,8 +62,6 @@ SIGTYPE
SYSTEM_TYPE
** Machine specific macros, decribed in detail in src/m/template.h
LOAD_AVE_CVT
LOAD_AVE_TYPE
VIRT_ADDR_VARIES
** Misc macros
......@@ -111,7 +109,6 @@ EMACS_INT
EMACS_UINT
FILE_SYSTEM_CASE
FLOAT_CHECK_DOMAIN
FSCALE
GC_LISP_OBJECT_ALIGNMENT
GC_MARK_SECONDARY_STACK
GC_MARK_STACK
......@@ -193,8 +190,6 @@ HPUX
INTERNAL_TERMINAL
IS_ANY_SEP
IS_DIRECTORY_SEP
KERNEL_FILE
LDAV_SYMBOL
LINKER
LINUX_VERSION_CODE
LISP_FLOAT_TYPE
......@@ -381,4 +376,3 @@ vfork
wait
write
xfree
2011-02-16 Paul Eggert <eggert@cs.ucla.edu>
Remove no-longer needed getloadavg symbols.
* CPP-DEFINES (LOAD_AVE_CVT, LOAD_AVE_TYPE, FSCALE, KERNEL_FILE):
(LDAV_SYMBOL): Remove.
2011-02-12 Glenn Morris <rgm@gnu.org>
* bzrmerge.el (bzrmerge-resolve): Fix bzr revert call.
......
......@@ -631,7 +631,6 @@ alone (may import them from Gnulib again). These are:
warn-on-use.h
lib/*.[ch]
lib/gnulib.mk
src/getloadavg.c
src/gmalloc.c
src/md5.c
src/md5.h
......
This diff is collapsed.
......@@ -984,7 +984,7 @@ case "$opsys" in
hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
## Motif needs -lgen.
unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
......@@ -1000,9 +1000,6 @@ else
CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
fi
dnl For AC_FUNC_GETLOADAVG, at least:
AC_CONFIG_LIBOBJ_DIR(src)
dnl Do this early because it can frob feature test macros for Unix-98 &c.
AC_SYS_LARGEFILE
......@@ -2668,8 +2665,6 @@ fi
AC_CHECK_HEADERS(sys/un.h)
AC_FUNC_GETLOADAVG
AC_FUNC_FSEEKO
AC_FUNC_GETPGRP
......@@ -3118,7 +3113,6 @@ fi
S_FILE="\$(srcdir)/${opsysfile}"
AC_SUBST(M_FILE)
AC_SUBST(S_FILE)
AC_SUBST(GETLOADAVG_LIBS)
AC_SUBST(ns_appdir)
AC_SUBST(ns_appbindir)
AC_SUBST(ns_appresdir)
......
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# 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
# 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
MOSTLYCLEANFILES += core *.stackdump
......@@ -79,6 +79,15 @@ EXTRA_libgnu_a_SOURCES += ftoastr.c
## end gnulib module dtoastr
## begin gnulib module getloadavg
EXTRA_DIST += getloadavg.c
EXTRA_libgnu_a_SOURCES += getloadavg.c
## end gnulib module getloadavg
## begin gnulib module getopt-posix
BUILT_SOURCES += $(GETOPT_H)
......@@ -175,6 +184,91 @@ EXTRA_DIST += stddef.in.h
## end gnulib module stddef
## begin gnulib module stdlib
BUILT_SOURCES += stdlib.h
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
-e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \
-e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
-e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
-e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
-e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
-e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \
-e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
-e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
-e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \
-e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \
-e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
-e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
-e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
-e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \
-e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
-e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
-e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
-e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
-e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
-e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
< $(srcdir)/stdlib.in.h | \
sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
-e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
-e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
-e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
-e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
-e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
-e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
-e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
-e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
-e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
EXTRA_DIST += stdlib.in.h
## end gnulib module stdlib
## begin gnulib module strftime
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -115,7 +115,6 @@ fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \
font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \
fontset.h ccl.h ftfont.h globals.h
getloadavg.o: getloadavg.c $(config_h)
gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \
lisp.h globals.h $(config_h)
gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
......
......@@ -3407,11 +3407,6 @@ EXFUN (Fclear_face_cache, 1);
EXFUN (Fx_load_color_file, 1);
extern void syms_of_xfaces (void);
#ifndef HAVE_GETLOADAVG
/* Defined in getloadavg.c */
extern int getloadavg (double *, int);
#endif
#ifdef HAVE_X_WINDOWS
/* Defined in xfns.c */
extern void syms_of_xfns (void);
......
This diff is collapsed.
......@@ -30,12 +30,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define EMACS_INT long
#define EMACS_UINT unsigned long
/* Data type of load average, as read out of kmem. */
#define LOAD_AVE_TYPE long
/* Convert that into an integer that is 100 for a load average of 1.0 */
#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
#undef DATA_SEG_BITS
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment