Commit 79ab4b7f authored by Paul Eggert's avatar Paul Eggert

Import getloadavg module from gnulib.

parent 226590f8
2011-02-08 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-06 Paul Eggert <eggert@cs.ucla.edu>
gnulib: allow multiple gnulib generated replacements to coexist
......
......@@ -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])
......
......@@ -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
......@@ -2665,8 +2662,6 @@ fi
AC_CHECK_HEADERS(sys/un.h)
AC_FUNC_GETLOADAVG
AC_FUNC_FSEEKO
AC_FUNC_GETPGRP
......@@ -3115,7 +3110,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' \
-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)' \
< $(srcdir)/stdlib.in.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.
2011-02-08 Paul Eggert <eggert@cs.ucla.edu>
Import getloadavg module from gnulib.
* deps.mk (getloadavg.o): Remove; gnulib now does this.
* lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib
now does this.
* src/s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this.
* src/s/netbsd.h (HAVE_GETLOADAVG): Likewise.
* config.in: Regenerate.
2011-02-07 Paul Eggert <eggert@cs.ucla.edu>
conform to C89 pointer rules
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) \
......
This diff is collapsed.
......@@ -25,8 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
#define HAVE_GETLOADAVG 1
/* This silences a few compilation warnings. */
#undef BSD_SYSTEM
#if __FreeBSD__ == 1
......
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