all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: emacs-devel@gnu.org
Subject: importing getloadavg from gnulib
Date: Mon, 07 Feb 2011 23:22:07 -0800	[thread overview]
Message-ID: <4D50EF1F.60200@cs.ucla.edu> (raw)

[-- 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 --]

             reply	other threads:[~2011-02-08  7:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08  7:22 Paul Eggert [this message]
2011-02-08  8:31 ` importing getloadavg from gnulib 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D50EF1F.60200@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.