emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

importing getloadavg from gnulib


From: Paul Eggert
Subject: importing getloadavg from gnulib
Date: Mon, 07 Feb 2011 23:22:07 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

Attached is a patch to have Emacs import getloadavg from gnulib
instead of maintining its own special version.  This has some
porting and bugfix advantages (see ChangeLog entry below).  I have
not installed this yet, to give the Windows porters a heads-up.

After the ChangeLog entry below I have listed the most important
changes in the patch.  (Most of the full patch file is bzr overhead
or autogenerated files.)  If Windows ports are compiling getloadavg.c,
they'll need to do so in the lib directory, not the src directory.
I don't expect any of the new symbols in config.in need to be
configured on Windows.

2011-02-08  Paul Eggert  <address@hidden>

        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.
        * src/deps.mk (getloadavg.o): Remove; gnulib now does this.
        * src/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.
        * src/config.in: Regenerate.

=== modified file 'configure.in'
--- configure.in        2011-02-05 22:30:14 +0000
+++ configure.in        2011-02-08 07:05:03 +0000
@@ -984,7 +984,7 @@
 
   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 @@
   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 @@
 
 AC_CHECK_HEADERS(sys/un.h)
 
-AC_FUNC_GETLOADAVG
-
 AC_FUNC_FSEEKO
 
 AC_FUNC_GETPGRP
@@ -3115,7 +3110,6 @@
 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)

=== renamed file 'src/getloadavg.c' => 'lib/getloadavg.c'
[diffs omitted here; see full patch]
=== added file 'lib/stdlib.in.h'
[contents omitted here; see full patch.  stdlib.h declares getloadavg.
 On Windows the declaration may not be needed, and if so, Windows
 should not need to worry about this file.]
=== modified file 'src/deps.mk'
--- src/deps.mk 2011-02-04 12:01:34 +0000
+++ src/deps.mk 2011-02-08 07:05:03 +0000
@@ -115,7 +115,6 @@
 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) \

=== modified file 'src/lisp.h'
--- src/lisp.h  2011-02-07 02:18:35 +0000
+++ src/lisp.h  2011-02-08 07:05:03 +0000
@@ -3407,11 +3407,6 @@
 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);

Attachment: getloadavg-patch.txt.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]