unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* importing getloadavg from gnulib
@ 2011-02-08  7:22 Paul Eggert
  2011-02-08  8:31 ` Dan Nicolaescu
  2011-02-08  9:02 ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Paul Eggert @ 2011-02-08  7:22 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 4064 bytes --]

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  <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.
	* 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 #2: getloadavg-patch.txt.gz --]
[-- Type: application/x-gzip, Size: 52100 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-02-16 18:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-08  7:22 importing getloadavg from gnulib Paul Eggert
2011-02-08  8:31 ` Dan Nicolaescu
2011-02-08  9:01   ` Andreas Schwab
2011-02-10  7:54     ` Paul Eggert
2011-02-15  6:49       ` Paul Eggert
2011-02-15 18:13         ` Eli Zaretskii
2011-02-15 18:55           ` Paul Eggert
2011-02-15 19:21             ` Eli Zaretskii
2011-02-15 20:41               ` Paul Eggert
2011-02-16  0:38                 ` Paul Eggert
2011-02-16 18:50             ` Eli Zaretskii
2011-02-08  9:02 ` Eli Zaretskii
2011-02-08  9:28   ` Paul Eggert
2011-02-08 10:28     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).