diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2008-03-05 09:46:47 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2008-03-05 09:46:47 +0000 |
commit | 4df76d127b9cf830a15244da75976efb43752c6b (patch) | |
tree | 79074341a3cd73003186d0290ecad71cb9bed623 | |
parent | 5ed2b85c847995da3f4dc01c4d2790358adeb03d (diff) |
Embed PLPA (Portable Linux Processor Affinity) in order to support
conflicting affinity API of different Linux kernel versions.
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | Process.c | 6 | ||||
-rw-r--r-- | Process.h | 2 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | plpa-1.1/AUTHORS | 13 | ||||
-rw-r--r-- | plpa-1.1/LICENSE | 57 | ||||
-rw-r--r-- | plpa-1.1/Makefile.am | 17 | ||||
-rw-r--r-- | plpa-1.1/Makefile.in | 499 | ||||
-rw-r--r-- | plpa-1.1/README | 29 | ||||
-rw-r--r-- | plpa-1.1/VERSION | 36 | ||||
-rw-r--r-- | plpa-1.1/plpa.m4 | 267 | ||||
-rw-r--r-- | plpa-1.1/src/Makefile.am | 49 | ||||
-rw-r--r-- | plpa-1.1/src/Makefile.in | 579 | ||||
-rw-r--r-- | plpa-1.1/src/plpa.h.in | 214 | ||||
-rw-r--r-- | plpa-1.1/src/plpa_api_probe.c | 90 | ||||
-rw-r--r-- | plpa-1.1/src/plpa_config.h.in | 112 | ||||
-rw-r--r-- | plpa-1.1/src/plpa_dispatch.c | 201 | ||||
-rw-r--r-- | plpa-1.1/src/plpa_internal.h | 36 | ||||
-rw-r--r-- | plpa-1.1/src/plpa_map.c | 602 | ||||
-rw-r--r-- | plpa-1.1/src/plpa_runtime.c | 73 |
20 files changed, 2897 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index d1ef6e38..26b18aa7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ +SUBDIRS = plpa-1.1 + bin_PROGRAMS = htop dist_man_MANS = htop.1 EXTRA_DIST = $(dist_man_MANS) htop.desktop htop.png scripts/MakeHeader.py \ @@ -8,7 +10,7 @@ applications_DATA = htop.desktop pixmapdir = $(datadir)/pixmaps pixmap_DATA = htop.png -AM_CFLAGS = -pedantic -Wall -std=c99 +htop_CFLAGS = -pedantic -Wall -std=c99 AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" myhtopsources = AvailableMetersPanel.c CategoriesPanel.c CheckItem.c \ @@ -32,6 +34,7 @@ SUFFIXES = .h BUILT_SOURCES = $(myhtopheaders) htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h debug.h +htop_LDADD = $(top_builddir)/plpa-1.1/src/libplpa_included.la profile: $(MAKE) all CFLAGS="-pg -O2" @@ -27,6 +27,8 @@ in the source distribution for its full text. #include <pwd.h> #include <sched.h> +#include <plpa.h> + // This works only with glibc 2.1+. On earlier versions // the behavior is similar to have a hardcoded page size. #ifndef PAGE_SIZE @@ -198,12 +200,12 @@ bool Process_setPriority(Process* this, int priority) { unsigned long Process_getAffinity(Process* this) { unsigned long mask = 0; - sched_getaffinity(this->pid, sizeof(unsigned long), (cpu_set_t*) &mask); + plpa_sched_getaffinity(this->pid, sizeof(unsigned long), (plpa_cpu_set_t*) &mask); return mask; } bool Process_setAffinity(Process* this, unsigned long mask) { - return (sched_setaffinity(this->pid, sizeof(unsigned long), (cpu_set_t*) &mask) == 0); + return (plpa_sched_setaffinity(this->pid, sizeof(unsigned long), (plpa_cpu_set_t*) &mask) == 0); } void Process_sendSignal(Process* this, int signal) { @@ -30,6 +30,8 @@ in the source distribution for its full text. #include <pwd.h> #include <sched.h> +#include <plpa.h> + // This works only with glibc 2.1+. On earlier versions // the behavior is similar to have a hardcoded page size. #ifndef PAGE_SIZE diff --git a/configure.ac b/configure.ac index 2e3a581c..f54310fc 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,11 @@ AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC +AM_PROG_CC_C_O + +AM_DISABLE_SHARED +AM_ENABLE_STATIC +AC_PROG_LIBTOOL # Checks for libraries. AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"]) @@ -43,11 +48,13 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_CHECK_FUNCS([memmove strncasecmp strstr strdup]) +save_cflags="${CFLAGS}" CFLAGS="${CFLAGS} -std=c99" AC_MSG_CHECKING([whether gcc -std=c99 option works]) AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [char *a; a = strdup("foo"); int i = 0; i++; // C99], AC_MSG_RESULT([yes]), AC_MSG_ERROR([htop is written in C99. A newer version of gcc is required.])) +CFLAGS="$save_cflags" PROCDIR=/proc AC_ARG_WITH(proc, [ --with-proc=DIR Location of a Linux-compatible proc filesystem (default=/proc).], @@ -66,5 +73,11 @@ fi AC_CHECK_FILE($PROCDIR/stat,,AC_MSG_ERROR(Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.)) AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find /proc/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.)) +PLPA_INCLUDED(plpa-1.1) +PLPA_INIT(plpa_happy=yes, plpa_happy=no) +if test "x$plpa_happy" = xno; then + AC_MSG_ERROR([Failed to initialize PLPA.]) +fi + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/plpa-1.1/AUTHORS b/plpa-1.1/AUTHORS new file mode 100644 index 00000000..4be028b6 --- /dev/null +++ b/plpa-1.1/AUTHORS @@ -0,0 +1,13 @@ +PLPA Authors +============ + +The IDs in parenthesis are those used in Subversion commit notices. + +Current Authors +--------------- + +Indiana University: +- Jeff Squyres (jsquyres) + +Lawrence Berkeley National Lab: +- Paul Hargrove (phargrov) diff --git a/plpa-1.1/LICENSE b/plpa-1.1/LICENSE new file mode 100644 index 00000000..9fbff8df --- /dev/null +++ b/plpa-1.1/LICENSE @@ -0,0 +1,57 @@ +Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + University Research and Technology + Corporation. All rights reserved. +Copyright (c) 2004-2005 The Regents of the University of California. + All rights reserved. +Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. + +Portions copyright: + +Copyright (c) 2004-2005 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. +Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + University of Stuttgart. All rights reserved. +Copyright (c) 2006, 2007 Advanced Micro Devices, Inc. + All rights reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +The copyright holders provide no reassurances that the source code +provided does not infringe any patent, copyright, or any other +intellectual property rights of third parties. The copyright holders +disclaim any liability to any recipient for claims brought against +recipient by any third party for infringement of that parties +intellectual property rights. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/plpa-1.1/Makefile.am b/plpa-1.1/Makefile.am new file mode 100644 index 00000000..43f69a02 --- /dev/null +++ b/plpa-1.1/Makefile.am @@ -0,0 +1,17 @@ +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +SUBDIRS = src +DIST_SUBDIRS = $(SUBDIRS) +EXTRA_DIST = README VERSION LICENSE AUTHORS plpa.m4 diff --git a/plpa-1.1/Makefile.in b/plpa-1.1/Makefile.in new file mode 100644 index 00000000..31dae872 --- /dev/null +++ b/plpa-1.1/Makefile.in @@ -0,0 +1,499 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plpa-1.1 +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + AUTHORS +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/plpa-1.1/plpa.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/plpa-1.1/src/plpa_config.h \ + $(top_builddir)/plpa-1.1/src/plpa.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src +DIST_SUBDIRS = $(SUBDIRS) +EXTRA_DIST = README VERSION LICENSE AUTHORS plpa.m4 +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plpa-1.1/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu plpa-1.1/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plpa-1.1/README b/plpa-1.1/README new file mode 100644 index 00000000..4659e248 --- /dev/null +++ b/plpa-1.1/README @@ -0,0 +1,29 @@ +This is a stripped-down version of the PLPA 1.1 package, adapted to +be embedded in the htop code base. For the full PLPA package, go to +http://www.open-mpi.org/projects/plpa/. Copyright notice for PLPA +follows below. + + -- Hisham Muhammad, htop author. March 2008. + +=========================================================================== + +This is the Portable Linux Processor Affinity (PLPA) package +(pronounced "pli-pa"). It is intended for developers who wish to use +Linux processor affinity via the sched_setaffinity() and +sched_getaffinity() library calls, but don't want to wade through the +morass of 3 different APIs that have been offered through the life of +these calls in various Linux distributions and glibc versions. + +Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + University Research and Technology + Corporation. All rights reserved. +Copyright (c) 2004-2005 The Regents of the University of California. + All rights reserved. +Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. +$COPYRIGHT$ + +See LICENSE file for a rollup of all copyright notices. + +$HEADER$ + +=========================================================================== diff --git a/plpa-1.1/VERSION b/plpa-1.1/VERSION new file mode 100644 index 00000000..4b49c930 --- /dev/null +++ b/plpa-1.1/VERSION @@ -0,0 +1,36 @@ +# This is the VERSION file for PLPA, describing the precise version of +# PLPA in this distribution. The various components of the version +# number below are combined to form a single version number string. + +# major, minor, and release are generally combined in the form +# <major>.<minor>.<release>. If release is zero, then it is omitted. + +major=1 +minor=1 +release=0 + +# greek is used for alpha or beta release tags. If it is non-empty, +# it will be appended to the version number. It does not have to be +# numeric. Common examples include a1 (alpha release 1), b1 (beta +# release 1), sc2005 (Super Computing 2005 release). The only +# requirement is that it must be entirely printable ASCII characters +# and have no white space. + +greek= + +# If want_svn=1, then the SVN r number will be included in the overall +# PLPA version number in some form. + +want_svn=0 + +# If svn_r=-1, then the SVN r numbere will be obtained dynamically at +# run time, either 1) via the "svnversion" command (if this is a +# Subversion checkout) in the form "r<svn_r>", or b) with the date (if +# this is not a Subversion checkout, and the svnversion command cannot +# be used) in the form of "svn<date>". Alternatively, if svn_r is not +# -1, the value of svn_r will be directly appended to the version +# string. This happens during "make dist", for example: if the +# distribution tarball is being made from an SVN checkout, the value +# of svn_r in this file is replaced with the output of "svnversion". + +svn_r=r147:149 diff --git a/plpa-1.1/plpa.m4 b/plpa-1.1/plpa.m4 new file mode 100644 index 00000000..68e173e8 --- /dev/null +++ b/plpa-1.1/plpa.m4 @@ -0,0 +1,267 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Main PLPA m4 macro, to be invoked by the user +# +# Expects two paramters: +# 1. What to do upon success +# 2. What to do upon failure +# +AC_DEFUN([PLPA_INIT],[ + AC_REQUIRE([_PLPA_INTERNAL_SETUP]) + AC_REQUIRE([AC_PROG_CC]) + + # Check for syscall() + AC_CHECK_FUNC([syscall], [happy=1], [happy=0]) + + # Look for syscall.h + if test "$happy" = 1; then + AC_CHECK_HEADER([sys/syscall.h], [happy=1], [happy=0]) + fi + + # Look for unistd.h + if test "$happy" = 1; then + AC_CHECK_HEADER([unistd.h], [happy=1], [happy=0]) + fi + + # Check for __NR_sched_setaffinity + if test "$happy" = 1; then + AC_MSG_CHECKING([for __NR_sched_setaffinity]) + if test "$plpa_emulate" = "yes"; then + AC_MSG_RESULT([emulated]) + AC_DEFINE([__NR_sched_setaffinity], [0], [Emulated value]) + else + AC_TRY_COMPILE([#include <syscall.h> +#include <unistd.h>], [#ifndef __NR_sched_setaffinity +#error __NR_sched_setaffinity_not found! +#endif +int i = 1;], + [AC_MSG_RESULT([yes]) + happy=1], + [AC_MSG_RESULT([no]) + happy=0]) + fi + fi + + # Check for __NR_sched_getaffinity (probably overkill, but what + # the heck?) + if test "$happy" = 1; then + AC_MSG_CHECKING([for __NR_sched_getaffinity]) + if test "$plpa_emulate" = "yes"; then + AC_MSG_RESULT([emulated]) + AC_DEFINE([__NR_sched_getaffinity], [0], [Emulated value]) + else + AC_TRY_COMPILE([#include <syscall.h> +#include <unistd.h>], [#ifndef __NR_sched_getaffinity +#error __NR_sched_getaffinity_not found! +#endif +int i = 1;], + [AC_MSG_RESULT([yes]) + happy=1], + [AC_MSG_RESULT([no]) + happy=0]) + fi + fi + + # If all was good, do the real init + AS_IF([test "$happy" = "1"], + [_PLPA_INIT($1, $2)], + [$2]) + PLPA_DO_AM_CONDITIONALS + + AC_CONFIG_FILES( + plpa_config_prefix[/Makefile] + plpa_config_prefix[/src/Makefile] + ) + + # Cleanup + unset happy +])dnl + +#----------------------------------------------------------------------- + +# Build PLPA as a standalone package +AC_DEFUN([PLPA_STANDALONE],[ + m4_define([plpa_config_prefix],[.]) + AC_REQUIRE([_PLPA_INTERNAL_SETUP]) + plpa_mode=standalone +])dnl + +#----------------------------------------------------------------------- + +# Build PLPA as an included package +AC_DEFUN([PLPA_INCLUDED],[ + m4_define([plpa_config_prefix],[$1]) + AC_REQUIRE([_PLPA_INTERNAL_SETUP]) + plpa_mode=included + PLPA_DISABLE_EXECUTABLES +])dnl + +#----------------------------------------------------------------------- + +dnl JMS: No fortran bindings yet +dnl # Set whether the fortran bindings will be built or not +dnl AC_DEFUN([PLPA_FORTRAN],[ +dnl AC_REQUIRE([_PLPA_INTERNAL_SETUP]) +dnl +dnl # Need [] around entire following line to escape m4 properly +dnl [plpa_tmp=`echo $1 | tr '[:upper:]' '[:lower:]'`] +dnl if test "$1" = "0" -o "$1" = "n"; then +dnl plpa_fortran=no +dnl elif test "$1" = "1" -o "$1" = "y"; then +dnl plpa_fortra |