gkrelltop-2.2.13.orig/0002700000000000000000000000000011232241323011410 5ustar gkrelltop-2.2.13.orig/gkrelltop.h0000600000000000000000000000305511230274354013577 0ustar #ifndef GRELLTOP_H #define GRELLTOP_H #define GKRELLTOP_VERSION_MAJOR 2 #define GKRELLTOP_VERSION_MINOR 2 #define GKRELLTOP_VERSION_REV 1 #define STYLE_NAME "gkrelltop" #define GKRELLTOP_SERVE_NAME STYLE_NAME #define MAXITEMS 3 /* items to show on the krell (3) */ #define CPU_THRESHHOLD 1 /* threshhold for the cpu diff to appear */ #include #include #include #include #include #include #include #include #include #include #include #include #if defined(PARANOID) #include #endif /* defined(PARANOID) */ #include #include #include #include #include #include #include /* process structure for use by gkrellm * store processes in a linked list */ struct process { struct process *next; struct process *previous; pid_t pid; char *name; float amount; int user_time; int kernel_time; int previous_user_time; int previous_kernel_time; int vsize; int rss; int time_stamp; int include; int changed; #if defined(LINUX) int io_read; int io_write; int previous_io_read; int previous_io_write; #endif /* defined(PARANOID) */ }; enum modes {cpu, mem, io}; enum { KIL = 1<<10, MEG = 1<<20 }; /* functions defined */ int gkrelltop_process_find_top_three(struct process **); #endif gkrelltop-2.2.13.orig/gkrelltopd.c0000600000000000000000000000431111227511576013740 0ustar /* gkrelltopd.c - requires GKrellM 2.2.0 or better */ #include #include "gkrelltop.h" /* Duplicate the local data collection that is in gkrelltop.c */ static struct process best[MAXITEMS]; static gint ntop; static void gkrelltopd_update(GkrellmdMonitor *mon, gboolean first_update) { struct process *curbest[MAXITEMS] = { 0, 0, 0 }; int n, i; gboolean any_changed; if (!GK.second_tick && !first_update) return; if ((n = gkrelltop_process_find_top_three(curbest)) <= 0) return; any_changed = FALSE; for (i = 0; i < n; ++i) { best[i].changed = gkrellmd_dup_string(&best[i].name, curbest[i]->name); any_changed |= best[i].changed; if ( best[i].amount != curbest[i]->amount || best[i].pid != curbest[i]->pid ) { best[i].amount = curbest[i]->amount; best[i].pid = curbest[i]->pid; best[i].changed = TRUE; any_changed = TRUE; } } if (n != ntop) any_changed = TRUE; ntop = n; if (any_changed) gkrellmd_need_serve(mon); } /* This function is called to collect data to be sent to clients. | Send all data when first_serve is true, and only changed data at | other times. */ static void gkrelltopd_serve_data(GkrellmdMonitor *mon, gboolean first_serve) { gchar buf[128]; gint i; gkrellmd_set_serve_name(mon, GKRELLTOP_SERVE_NAME); for (i = 0; i < ntop; ++i) { if (!best[i].changed && !first_serve) continue; snprintf(buf, sizeof(buf), "best %d %s %d %3.1f\n", i, best[i].name, best[i].pid, best[i].amount); gkrellmd_serve_data(mon, buf); } /* Just always send ntop. */ snprintf(buf, sizeof(buf), "ntop %d\n", ntop); gkrellmd_serve_data(mon, buf); } static void gkrelltopd_serve_setup(GkrellmdMonitor *mon) { gchar buf[32]; /* Just in case a future gkrelltop version will need to know... */ snprintf(buf, sizeof(buf), "version %d %d %d", GKRELLTOP_VERSION_MAJOR, GKRELLTOP_VERSION_MINOR, GKRELLTOP_VERSION_REV); gkrellmd_plugin_serve_setup(mon, GKRELLTOP_SERVE_NAME, buf); } static GkrellmdMonitor gkrelltop_monitor = { GKRELLTOP_SERVE_NAME, gkrelltopd_update, gkrelltopd_serve_data, gkrelltopd_serve_setup, }; GkrellmdMonitor * gkrellmd_init_plugin(void) { return &gkrelltop_monitor; } gkrelltop-2.2.13.orig/ttest.c0000400000000000000000000000731611231241020012715 0ustar /* test the top_three functionality * will print in the cmdline every second a list of * three best processes */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "gkrelltop.h" #include //gettimeofday #define SLEEPLENGTH 700000 void onexit_cleanup(void); void onexit(int sig) { perror("\nAttempting to cleanup\n"); onexit_cleanup(); exit(0); } int show_nice_processes; extern int pluginMode; struct process *best[3] = { 0, 0, 0 }; int main (int argc, char ** argv) { int n = 0; int i; char str [256]; if(argc > 1) { if(strncmp(argv[1], "mem", 2) == 0) pluginMode = mem; else if(strncmp(argv[1], "io", 2) == 0) pluginMode = io; } /* catch when user presses ctrl-c SIGINT and perform cleanup */ if(signal(SIGINT, onexit) == SIG_ERR) { perror("\nSignal not divertible; no cleanup upon exit\n"); } show_nice_processes = 1; printf("start of the program, show_nice_processes=%d (%p)\n", show_nice_processes, &show_nice_processes); int u_secs1 = 0; int u_secs2 = 0; while (1) //sorry { /* * Find the top three! */ //find the delays of the times, and see which method is better, //if needed, call multiple times in a loop int i; struct timeval start; gettimeofday(&start, 0); //for(i=0;i<20;i++) { best[0] = best[1] = best[2] = NULL; //freeing occurrs in top_three.c n = gkrelltop_process_find_top_three(best); //} struct timeval end; gettimeofday(&end, 0); u_secs1 += (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec); start = end; //for(i=0;i<20;i++) { best[0] = best[1] = best[2] = NULL; //freeing occurrs in top_three.c n = working_gkrelltop_process_find_top_three(best); //} gettimeofday(&end, 0); u_secs2 += (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec); printf("u_secs1 = %d u_secs2 = %d\n", u_secs1, u_secs2); if (n > 3) { /* cant have more than 3, some error occured */ return 0; } if(n > 0) { printf("N(%d): ", n); for (i = 0; i < n; i++) { if(pluginMode == cpu) snprintf(str, sizeof(str), "[%-5.10s(%4.2f%c %5d)]", best[i]->name, best[i]->amount, '%', best[i]->pid); else if(pluginMode == mem) snprintf(str, sizeof(str), "[%-5.10s(%.2f%c %dM %5d)]", best[i]->name, best[i]->amount, '%', best[i]->rss/MEG, best[i]->pid); else if(pluginMode == io) snprintf(str, sizeof(str), "[%-5.10s(%.0f %.0fK %.0fK %5d)]", best[i]->name, best[i]->amount, (float)(best[i]->io_read - best[i]->previous_io_read)/KIL, (float)(best[i]->io_write - best[i]->previous_io_write)/KIL, best[i]->pid); printf("%s ",str); } for(; i < 3; i++) { if (best[i]) { printf("WARNING: SHOULD NEVER GET HERE!!\n"); snprintf(str, sizeof(str), "%d - %-10.10s(%c %.2f %5d)", i+1, best[i]->name,'%',best[i]->amount,best[i]->pid); printf("%s\t",str); } } printf("\n"); //15 CR, 12 linefeed } usleep(SLEEPLENGTH); /* microsleep in microseeconds */ } return 0; } gkrelltop-2.2.13.orig/Makefile0000600000000000000000000000740111232241023013047 0ustar # Makefile for gkrelltop # # tries to autodetect for gtk+-2.0 to compile for # gkrellm 2 or if it is lacking it tries to compile # for gkrellm 1. # If it fails to build, then maybe you dont have the # gtk+-2.0 or gtk+-1.2 development tools (which you need # to have installed) to compile this package. # # for linux need the -DLINUX as a CFLAGS parameter # to compile for FREEBSD the CFLAGS parameter # needs to be -DFREEBSD # and as David Gardner pointed out, FreeBSD users need to use # the GNU make utility (gmake) instead of the BSD make # utility (make) in order for it to compile. # # I have attempted to detect the os by the OSFLAG variable # NOTE that it will work only for LINUX or FREEBSD # # if you think it should work for your os than substituting # your $(OSFLAG) will not quite do the trick because the wmtop code # (the three_top.c file) only recognises those two (LINUX and FREEBSD) # parameters. Let me know if the more recent versions of wmtop # support more OS. OSFLAG = $(shell uname | tr '[:lower:]' '[:upper:]') SHELL=/bin/sh GKRELL1FLAG=1 #find out if we have gkrellm 2 or 1 (from the gtk+ version) GKRELL1FLAG=$(shell bash -c 'pkg-config gtk+-2.0 --cflags &>/dev/null && echo 0') GKRELLTOP = gkrelltop.so OBJ = top_three.o gkrelltop.o EXTRA = krell_panel1.xpm INSTALLDIR ?= $(PREFIX)/$(DESTDIR) ifeq ($(INSTALLDIR),) INSTALLDIR=/usr/lib/gkrellm2/plugins/ endif ifeq ($(GKRELL1FLAG),0) # Parameters for gkrellm version 2.* CFLAGS2 = -g -D$(OSFLAG) -DGKRELLM2 -fPIC -Wall `pkg-config gtk+-2.0 --cflags` LIBS = CC=/usr/bin/gcc $(CFLAGS2) else # Parameters for gkrellm version 1.* CC=/usr/bin/cc CFLAGS = -D$(OSFLAG) -Wall -fPIC `gtk-config --cflags` `imlib-config --cflags-gdk` LIBS= endif # Parameters for the gkrelltopd server plugin ifeq ($(glib12),yes) WANT_GLIB12 = yes endif ifeq ($(glib12),1) WANT_GLIB12 = yes endif ifeq ($(WANT_GLIB12),yes) CFLAGSD = -I/usr/X11R6/include -D$(OSFLAG) -fPIC -Wall `glib-config --cflags` LIBSD = `glib-config --libs` LIBSD = CONFIGURE_ARGS += --with-glib12 else CFLAGSD = -D$(OSFLAG) -fPIC -Wall `pkg-config glib-2.0 --cflags` LIBSD = `pkg-config glib-2.0 --libs` LIBSD = endif INSTALLDIRD ?= $(PREFIXD)/$(DESTDIR) ifeq ($(INSTALLDIRD),) INSTALLDIRD=$(HOME)/.gkrellm2/plugins-gkrellmd endif CCD=/usr/bin/gcc $(CFLAGSD) OBJD = gkrelltopd.o top_three.o DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS)) HAVE_GKRELLMD = $(shell grep -c HAVE_GKRELLMD configure.h) ifneq ($(HAVE_GKRELLMD),1) WARN = $(warning Note: cannot compile server plugin. See configure.log.) endif ifeq ($(HAVE_GKRELLMD),1) GKRELLTOPD = gkrelltopd.so endif # By default do the compilation for gkrellm 2.* all: $(GKRELLTOP) $(GKRELLTOPD) warn: ; $(WARN) $(GKRELLTOP): $(OBJ) warn $(CC) -shared $(OBJ) -o $(GKRELLTOP) # Compile gkrelltopd.so server plugin server: $(GKRELLTOPD) warn @echo "" $(GKRELLTOPD): $(OBJD) $(CCD) $(LIBSD) -shared $(OBJD) -o $(GKRELLTOPD) gkrelltop.o: gkrelltop.c $(CC) -c gkrelltop.c -o gkrelltop.o top_three.o: top_three.c $(CC) -c top_three.c -o top_three.o gkrelltopd.o: gkrelltopd.c $(CCD) -c gkrelltopd.c -o gkrelltopd.o install: $(GKRELLTOP) install -c -m 644 $(GKRELLTOP) $(INSTALLDIR) install-server: $(GKRELLTOPD) install -c -m 644 $(GKRELLTOPD) $(INSTALLDIRD) ttest: top_three.o ttest.o $(CC) top_three.o ttest.o -o ttest view: $(GKRELLTOP) gkrellm -p $(GKRELLTOP) deb: fakeroot debian/rules binary orig: echo `pwd` | grep 'orig' || (mkdir `pwd`.orig; cp -p Makefile README config.guess config.sub configure gkrelltop.c gkrelltop.h gkrelltopd.c krell_image.xpm support.h ttest.c top_three.c `pwd`.orig/ ) package: orig #old: #@dpkg-buildpackage -rfakeroot -uc -us #debsign ../gkrelltop*.changes debuild -b && debuild -S clean: @rm -f *.o *.so configure.h configure.log ttest distclean: clean gkrelltop-2.2.13.orig/support.h0000600000000000000000000001146210562553451013316 0ustar /* support for both versions */ #ifdef GKRELLM2 /* use the new GTK2 API */ # include # define VERSION_MAJOR GKRELLM_VERSION_MAJOR # define VERSION_MINOR GKRELLM_VERSION_MINOR # define VERSION_REV GKRELLM_VERSION_REV # define DEFAULT_STYLE DEFAULT_STYLE_ID # define LABEL_MAX GKRELLM_LABEL_MAX # define init_plugin gkrellm_init_plugin # define Monitor GkrellmMonitor # define TextStyle GkrellmTextstyle # define Decal GkrellmDecal # define Label GkrellmLabel # define Margin GkrellmMargin # define Style GkrellmStyle # define Krell GkrellmKrell # define Panel GkrellmPanel # define ChartConfig GkrellmChartconfig # define ChartLayer GkrellmChartlayer # define Chart GkrellmChart # define ChartData GkrellmChartdata # define DecalButton GkrellmDecalbutton # define Launcher GkrellmLauncher # define AlertDecal GkrellmAlertdecal # define Alert GkrellmAlert # define gkrellm_system(c) g_spawn_command_line_async(c, NULL) # define gkrellm_configure_panel gkrellm_panel_configure # define gkrellm_destroy_panel gkrellm_panel_destroy # define gkrellm_draw_layers gkrellm_draw_panel_layers # define gkrellm_draw_layers_force gkrellm_draw_panel_layers_force # define gkrellm_render_to_pixmap gkrellm_scale_piximage_to_pixmap # define gdk_imlib_set_image_border gkrellm_set_piximage_border # define gdk_imlib_create_image_from_xpm_data gkrellm_piximage_new_from_xpm_data # define gdk_imlib_load_image gkrellm_piximage_new_from_file # define gdk_imlib_kill_image gkrellm_destroy_piximage # define gdk_imlib_destroy_image gkrellm_destroy_piximage # define gdk_imlib_paste_image gkrellm_paste_piximage # define GdkImlibBorder GkrellmBorder # define GdkImlibImage GkrellmPiximage # define gkrellm_chart_bg_image_override gkrellm_chart_bg_piximage_override # define gkrellm_panel_bg_image_override gkrellm_panel_bg_piximage_override # define gkrellm_load_image gkrellm_load_piximage # define gkrellm_set_image_border gkrellm_set_gkrellmrc_piximage_border # define gkrellm_get_gkrellmrc_image_border gkrellm_get_gkrellmrc_piximage_border # define gkrellm_bg_chart_image gkrellm_bg_chart_piximage # define gkrellm_bg_grid_image gkrellm_bg_grid_piximage # define gkrellm_bg_panel_image gkrellm_bg_panel_piximage # define gkrellm_bg_meter_image gkrellm_bg_meter_piximage # define gkrellm_krell_panel_image gkrellm_krell_panel_piximage # define gkrellm_krell_meter_image gkrellm_krell_meter_piximage # define gkrellm_krell_slider_image gkrellm_krell_slider_piximage # define gkrellm_krell_mini_image gkrellm_krell_mini_piximage # define gkrellm_get_decal_alarm_image gkrellm_get_decal_alarm_piximage # define gkrellm_get_decal_warn_image gkrellm_get_decal_warn_piximage # define gkrellm_create_tab gkrellm_gtk_notebook_page # define gkrellm_create_framed_tab gkrellm_gtk_framed_notebook_page # define gkrellm_launcher_table_new gkrellm_gtk_launcher_table_new # define gkrellm_entry_get_text gkrellm_gtk_entry_get_text # define gkrellm_spin_button gkrellm_gtk_spin_button # define gkrellm_check_button gkrellm_gtk_check_button # define gkrellm_check_button_connected gkrellm_gtk_check_button_connected # define gkrellm_button_connected gkrellm_gtk_button_connected # define gkrellm_scrolled_vbox gkrellm_gtk_scrolled_vbox # define gkrellm_framed_vbox gkrellm_gtk_framed_vbox # define gkrellm_framed_vbox_end gkrellm_gtk_framed_vbox_end # define gkrellm_scrolled_text gkrellm_gtk_scrolled_text_view # define gkrellm_add_info_text gkrellm_gtk_text_view_append_strings # define gkrellm_add_info_text_string gkrellm_gtk_text_view_append # define gkrellm_config_launcher gkrellm_gtk_config_launcher # define gkrellm_remove_and_destroy_decal(p,d) gkrellm_destroy_decal(d) # define gkrellm_remove_and_destroy_krell(p,d) gkrellm_destroy_krell(d) # define gkrellm_message_window(title, message, widget) gkrellm_message_dialog(title, message) # define gkrellm_config_message_window(title, message, widget) gkrellm_config_message_dialog(title, message) #else /* use the original API */ # include #endif /* end ifdef GKRELLM2 */ gkrelltop-2.2.13.orig/config.guess0000700000000000000000000012753411232241204013740 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gkrelltop-2.2.13.orig/README0000600000000000000000000001671511231761475012320 0ustar Description ----------- gkrelltop is a plugin for gkrellm. It monitors and shows the top three cpu, memory, and IO consuming processes. The process name is shown on the main krell along with a bar visually marking the percentage used by that process. Uses of this plugin can be various from monitoring enthusiasts that want to know at all times what their system is doing, to simple laptop users which may not want the cpu to be at 100% at all times for battery or heat related issues. Moving the mouse over the krell panel causes a tooltip to appear, showing more info such as the PID and processor usage percentage. The refresh of the top three will be suspended for about 2 seconds, when mouse first moves over. Upon clicking, the krell will rotate between CPU, Memory, and IO monitoring of the processes. Upon rightclicking, the config panel will come up. Upon Ctrl-MiddleClick or Double-MiddleClick on one of the process names in the krell, you will be asked if you want to kill (signal -9) that process. This way if a program is going crazy, you can not only see it clearly, but also kill it right there if necessary. Remember to enable 'Show nice processes' from the configuration as well, otherwise niced processes will not appear. It works for gkrellm 1.* and 2.* by trying to autodetect if there is a gtk+2.0 installed. But if you have problems, please let me know. It works for linux and freebsd. For the makefile parameters, read below. With the release of gkrellm 2.2.0 the gkrellmd server can have plugins. Thanks to Bill Willson, gkrelltop now has server plugin capability, which I hope will make a more useful plugin. Note that gkrellm 2.2.0 will need to be installed in order to compile the gkrelltopd server plugin. You will need the libgtk package (ex. libgtk2.0-dev in debian) to compile these sources. To compile for gkrellm 1 or 2 simply do: ------------------------------------ make or make all, or make gkrelltop and it will produce gkrelltop.so in the directory. To try it out do: gkrellm -p gkrelltop.so To copy this in your plugin directory, for gkrellm do: make install To make the gkrelltopd server plugin using glib 1.2: make glib12=yes To make and install the server plugin only (you may optionally do glib12=yes): make server make install-server After the gkrelltopd server plugin is installed, it must be enabled by adding a line to a gkrellmd.conf file: plugin-enable gkrelltopd To check that it installs properly, do a test run of gkrellmd like so: gkrellmd -plog To make the debian sources package do: make deb To make a debian .deb package do: fakeroot debian/rules binary If make fails then compile the modules manually (look at the Makefile to find out what is needed). To only test the top_three.c functionality from a commandline example tool, you can do: make ttest and then run ./ttest which will constantly dump the 3 most active processes on the terminal. Notes ----- Notice to FreeBSD 5.x users: in the more recent versions of FreeBSD (ex. 5.x) /proc is not mounted by default (at least some people have reported this), so in order for this plugin to work correctly, you need to make sure /proc is mounded. Notes from the Makefile: For linux need the -DLINUX as a CFLAGS parameter to compile for FREEBSD the CFLAGS parameter needs to be -DFREEBSD I have attempted to detect the os by the OSFLAG variable NOTE that it will work only for LINUX or FREEBSD if you think it should work for your os than substituting your $(OSFLAG) will not quite do the trick because the wmtop code (the three_top.c file) only recognises those two (LINUX and FREEBSD) parameters. Let me know if the more recent versions of wmtop support more OS. Testing gkrellm 2.2.0: ---------------------- To test for gkrellm 2.2.0 and gkrellmd 2.2.0 (which should be installed) follow the steps below. Run gkrellmd with gkrelltopd.so: $ gkrellmd -p gkrelltopd.so -plog Then on the same machine, run: $ gkrellm -s localhost -p gkrelltop.so And it should be displaying data from the gkrellmd server. To verify that gkrellmd is sending gkrelltop data, for about 10 seconds run: $ gkrellm -s localhost -p gkrelltop.so -d 0x1000 > somelog then quit gkrellm and search in the somelog file for gkrelltop lines. Credits: -------- - written by Adi Zaimi adizaimi-at-users.sourceforge.net - based on Wmtop -- WindowMaker process view dock app - Thanks to Bill Wilson for adding gkrellmd support - Licensed under GNU GPL Changelog: ---------- Version 2.2.13 20090721 Added temporary delay to refresh when mouseover so user has a chance to double click. Refactored code to speed up reading /proc and to find processes in list Version 2.2.12 20090709 Fixed bug that showed a process twice, if thresholding was on and it was the only process to exceed the threshold. Added support to show top processes consuming IO, which works with linux > 2.6.20 Version 2.2.11 20071225 Fixed exclusions problem when a process which was previously set to be excluded, would not reappear after removing it from the exclusion list. Thanks to Kan Sasaki for providing a patch to fix the above. Version 2.2.10 20070721 Fixed bug which caused crash with floating point exception error in calculating master_modulus. Thanks to Ethan Romander for finding this bug and providing a patch. Fixed Makefile to have all parts compile with -fPIC because it failed to compile on some environments. Thanks to Kurt Roeckx for pointing the error, and to Julien Cristau for fixing it in the Debian repository. Version 2.2.9 20070213 Fixed bug with process displaying twice when there was a threshold. Thanks to Jerome UZEL for spotting the bug. Put back the standard panel since people want skins to apply. Version 2.2.8 20070207 Added the sort by memory utilization capability. Clicking on the plugin will switch between displaying memory utilization and cpu utilization. Send kill signal to process on double-middleclick. Made a debian proper configuration. Version 2.2.7 20070120 Made the krells into panels so now i can display between 1 and 3 panels with the top processes. Version 2.2.6 20040703 Tooltips show all the necessary process information for which there's no room in the main view. Version 2.2.5 20040617 Added graphical representations for the percent processor usage Added support for a regexp exclusion of process names Version 2.2.4 20040529 Fixed the show-nice-processes capability Version 2.2.3 20040527 Made functional the configuration tabs: Now one can show only processes above a certain threshold. One can have the update frequency from once in 5 seconds to the gkrell_update value. One can disable/enable displaying the nice processes in the list. Change Makefile so now *only* produces gkrelltop.so: No more differentiating between gkrelltop2.so and the older gkrellm 1.* version. If there are people that use the 1.* version, they can still use this program (i hope). Version 2.2.2 20040520 Added gkrellmd support (Bill Wilson) Added debian support. Now running 'dpkg-buildpackage -rfakeroot -uc -us' or 'make deb' will create a debian package. Versions 2.2.1 and earlier Ported it to gkrellm 2.0 gkrelltop-2.2.13.orig/gkrelltop.c0000600000000000000000000006650111231762517013603 0ustar /* gkrelltop.c - requires GKrellM 1.2.0 or better * * gcc -fPIC `gtk-config --cflags` `imlib-config --cflags-gdk` -c gkrelltop.c * gcc -shared -Wl -o gkrelltop.so gkrelltop.o * gkrellm -p gkrelltop.so * * * gkrelltop is a monitor to see the three most cpu or memory * intensive processes. It shows the percentage cpu (memory) * and the pid of the most active one on mouse over as a tooltip. * If there is a program that is hoging the CPU or memory * you can identify it in moment. * Double-Middleclicking a program name will send * a signal (kill -9) to that program. * Clicking will switch between cpu mode and memory mode. * * to test it out try * gkrellm -p gkrelltop.so * * Uses sources from wmtop -- a WindowMaker process view dock app * * Written by Adi Zaimi adizaimi@users.sourceforge.net * * This software is licensed through the GNU General Public License. */ /* * * this part of the code is borrowed from the gkrellm demos */ #include "gkrelltop.h" #include "support.h" #include "krell_image.xpm" #define PLUGIN_CONFIG_KEYWORD "gkrelltop" #define CONFIG_NAME "gkrelltop" #define UPDATE_TAU 5 /* seconds */ #define MAX_UPDATES_PER_TAU 15 /* HZ */ #define TOOLTIP_DELAY 300 /* ms */ #define MSGLEN 256 /* characters */ /* variables */ static Monitor * monitor; static GtkWidget * gtk_numproc = NULL; static GtkWidget * gtk_threshold = NULL; static GtkWidget * gtk_updates = NULL; static GtkWidget * gtk_exclusions = NULL; static GtkWidget * gtk_show_nice = NULL; static GtkWidget * gtk_show_percent = NULL; struct entries { Panel *panel; Decal *decal_text; GkrellmKrell *krell_meter; } entry[MAXITEMS]; struct process *best[MAXITEMS]; /* variables */ static GtkTooltips *panel_tooltip = NULL; static gint g_style_id; static gint g_mouseIn = -1; static gint mouseInDelay = 0; static gint g_display_tooltip = FALSE; static gint g_threshold = 0; static gint g_numproc = 2; /* start with 2 procesess */ static gint g_local_updates = MAX_UPDATES_PER_TAU; static gint g_master_modulus = MAX_UPDATES_PER_TAU; static gint g_update_HZ = 0; static gint g_show_percent = 0; #ifdef GKRELLM2 static GkrellmTicks *GKp; #endif /* global exclusion_expression variable */ extern regex_t *exclusion_expression; extern gint exclusionchanged; static gchar s_exclusion [MSGLEN]; //string to exclude rexexp from proc list /* global show_nice_processes variable */ extern int show_nice_processes; extern enum modes pluginMode; static char *g_pluginModeText[] = {"CPU: \n", "MEM: \n", "IO: \n"}; static gchar g_tooltip_text[MSGLEN]; //will hold the tooltip onmouseover pid_t g_tokill_pid; static int (*find_top_three)(struct process **best); #ifdef GKRELLM_HAVE_CLIENT_MODE_PLUGINS /* ---------------- gkrelltop client mode interface -------------- */ static struct process cache_best[MAXITEMS]; static gint cache_ntop; static gboolean gkrelltop_server_available; static gint gkrelltopd_version_major; static gint gkrelltopd_version_minor; static gint gkrelltopd_version_rev; static void top_client_setup(gchar *line) { fprintf(stderr,"line %s", line); if (!strcmp(line, "available")) gkrelltop_server_available = TRUE; else if (!strncmp(line, "version ", 8)) sscanf(line, "%*s %d %d %d", &gkrelltopd_version_major, &gkrelltopd_version_minor, &gkrelltopd_version_rev); } /* show numproc panels and hide the rest of the panels */ static void check_numproc() { gint i = 0; while(i < MAXITEMS) { if(i < g_numproc) gkrellm_panel_show( entry[i].panel ); else gkrellm_panel_hide( entry[i].panel ); i++; } } static void top_client_data_from_server(gchar *line) { gfloat amount; gchar which[32], item[128], name[128]; gint pid, n; if (sscanf(line, "%31s %127[^\n]", which, item) != 2) return; if (!strcmp(which, "ntop")) { cache_ntop = atoi(item); if (cache_ntop < 0 || cache_ntop > MAXITEMS) cache_ntop = 0; for (n = cache_ntop; n < MAXITEMS; ++n) { gkrellm_dup_string(&cache_best[n].name, ""); cache_best[n].amount = 0; cache_best[n].pid = 0; } } else if( !strcmp(which, "best") && sscanf(item, "%d %127s %d %f", &n, name, &pid, &amount) == 4 && n >= 0 && n < MAXITEMS) { gkrellm_dup_string(&cache_best[n].name, name); cache_best[n].pid = pid; cache_best[n].amount = amount; } } static gint gkrelltop_client_process_find_top_three(struct process **best) { gint i; for (i = 0; i < g_numproc; ++i) best[i] = &cache_best[i]; return cache_ntop; } /* ----------------- end of client mode interface ---------------- */ #endif /* gets called everytime the panel gets refreshed if it was covered */ static gint top_expose_event(GtkWidget * widget, GdkEventExpose * ev, Panel *panel) { gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], panel->pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height); return FALSE; } /* upon signal enter_notify_event */ static void top_enter_notify_event(GtkWidget * widget, GdkEventCrossing * event, gpointer user_data) { g_mouseIn = GPOINTER_TO_INT(user_data); /* mark where mouse moved into */ mouseInDelay = 2; /* delay by two cycles repainting -- configurable? */ g_display_tooltip = TRUE; /* redisplay */ /* immediately display the tooltip instead of waiting for update */ gtk_tooltips_set_tip(panel_tooltip, widget, g_tooltip_text, ""); } /* upon signal motion_notify_event */ static void top_motion_notify_event(GtkWidget * widget, GdkEventCrossing * event, gpointer user_data) { g_display_tooltip = TRUE; /* redisplay */ } /* upon signal leave_notify_event */ static void top_leave_notify_event(GtkWidget * widget, GdkEventCrossing * event, gpointer user_data) { g_mouseIn = -1; /* change status; mouse is outside */ } static void top_ok_dialog(GtkWidget *widget, GtkWidget *dialog) { /* at this point send the signal to g_tokill_pid even though * it might be a better idea to copy it in the framebuffer and the * user kills it from a terminal. */ kill(g_tokill_pid, 9); gtk_widget_destroy(dialog); } static void top_close_dialog(GtkWidget *widget, GtkWidget *dialog) { gtk_widget_destroy(dialog); } static void top_message_dialog(const char * name, pid_t pid) { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *hbox, *button; GtkWidget *label; gchar message[MSGLEN]; g_tokill_pid = pid; snprintf(message, sizeof(message), "Kill process %s with pid %d?",name,pid); dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(dialog), "Kill process"); gtk_window_set_wmclass(GTK_WINDOW(dialog), "Gkrellm_dialog", "Gkrellm"); vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); gtk_container_add(GTK_CONTAINER(dialog), vbox); label = gtk_label_new(message); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); /* pack the label with the message */ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); hbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 2); button = gtk_button_new_from_stock(GTK_STOCK_OK); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(top_ok_dialog), dialog); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(top_close_dialog), dialog); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show_all(dialog); } /* upon signal button_press_event */ static void top_click_event(GtkWidget * widget, GdkEventButton * ev, gpointer user_data) { if (ev->button == 3) { /* show the setup window on rightclick */ gkrellm_open_config_window(monitor); } else if (ev->button==2 && (ev->state & GDK_CONTROL_MASK || ev->type == GDK_2BUTTON_PRESS)) { /* user_data has the number of the panel clicked */ gint i=GPOINTER_TO_INT(user_data); if(best[i]) top_message_dialog(best[i]->name, best[i]->pid); } else { /* left click: rotate between cpu/mem/io views */ #if defined(LINUX) pluginMode++; if(pluginMode > io) pluginMode = cpu; #endif } } /* do the actual update of the plugin, separate if needed to be called * by some other function besides update_plugin() */ static void top_update_panels() { if(mouseInDelay-- > 0) return; gchar display_text[64]; bzero(display_text,sizeof(display_text)); gint n = 0; gint i = 0; g_tooltip_text[0] = '\0'; for (i = 0; i < MAXITEMS; i++) { best[i]=0; } #ifdef GKRELLM_HAVE_CLIENT_MODE_PLUGINS /* If user is running a gkrelltop version that can get server data but | isn't, make sure user can know displayed data is from local host. */ if (!gkrelltop_server_available && gkrellm_client_mode()) snprintf(g_tooltip_text, sizeof(g_tooltip_text), "Localhost: %s\n\n", gkrellm_get_hostname()); #endif /* every tick update the process lists, and get data from either * a gkrellmd server or locally via top_three.c */ n = (*find_top_three)(best); /* Find the top three processes */ /* cant have more than MAXITEMS, some error occured */ if (n > MAXITEMS) { return; } if(g_display_tooltip) strncat(g_tooltip_text,g_pluginModeText[pluginMode], sizeof(g_tooltip_text)-strlen(g_tooltip_text)); for (i = 0; i < n; i++) { if(best[i]->amount < g_threshold ) break; //the next for will fill in with blanks if(g_show_percent) snprintf(display_text, sizeof(display_text), "%.0f%c %s", best[i]->amount,'%',best[i]->name); else snprintf(display_text, sizeof(display_text)," %s", best[i]->name); if(g_display_tooltip) /* append at the end of g_tooltip_text */ { gchar tmp[MSGLEN]; gchar ch = (i < n-1) ? '\n' : ' ' ; /* prnt \n only for 1 and 2*/ if(pluginMode == cpu) snprintf(tmp,sizeof(tmp), "%d: %4.1f%c %6.2d %.30s%c", i+1, best[i]->amount, '%', best[i]->pid, best[i]->name, ch); else if(pluginMode == mem) snprintf(tmp,sizeof(tmp), "%d: %4.1f%c %6.2dMB %6.2d %.30s%c", i+1, best[i]->amount, '%', best[i]->rss/MEG, best[i]->pid, best[i]->name, ch); else if(pluginMode == io) snprintf(tmp,sizeof(tmp), "%d: %4.1f%c R:%6.0fKB W:%6.0fKB %6.2d %.30s%c", i+1, best[i]->amount, '%', (float)(best[i]->io_read - best[i]->previous_io_read)/KIL, (float)(best[i]->io_write - best[i]->previous_io_write)/KIL, best[i]->pid, best[i]->name, ch); strncat(g_tooltip_text,tmp,sizeof(g_tooltip_text)-strlen(g_tooltip_text)); } /* set the panels with the top three processes */ gkrellm_draw_decal_text(entry[i].panel, entry[i].decal_text,display_text, 0); /* best[i]->amount determines the ofset in the pixmap */ gkrellm_update_krell(entry[i].panel, entry[i].krell_meter, best[i]->amount ); } // end for for(; i< g_numproc; i++) { //take care of the rest of the entries, //i set in the previous for loop /* set the panels with the top three processes, or with blank */ gkrellm_draw_decal_text(entry[i].panel, entry[i].decal_text,"", 0); gkrellm_update_krell(entry[i].panel, entry[i].krell_meter, 0); } //end for /* update the tooltip with the recent proceses in the list */ if (g_mouseIn >= 0 && g_display_tooltip) { /* display tooltip */ gtk_tooltips_set_tip(panel_tooltip, entry[g_mouseIn].panel->drawing_area, g_tooltip_text, g_tooltip_text); } //draw the newly updated pannel for (i=0; i < g_numproc; i++) { gkrellm_draw_panel_layers(entry[i].panel); } } /* recompute modulus value for the updated parameters */ static void recompute_modulus() { static gint old_local_updates=0; gint itmp=gkrellm_update_HZ(); /* only recompute the modulus if the value for g_update_HZ has changed * or the value for the local_updates has changed */ if(g_update_HZ != itmp || old_local_updates != g_local_updates) { old_local_updates = g_local_updates; if(itmp > 0 && itmp < MAX_UPDATES_PER_TAU) g_update_HZ = itmp; else g_update_HZ = MAX_UPDATES_PER_TAU; g_master_modulus=(gint)(g_update_HZ*UPDATE_TAU/g_local_updates); if(g_master_modulus < 1) g_master_modulus = 1; } } /* the update_plugin function is called every timer_tick * which is determined by the g_update_HZ() function */ static void top_update_plugin() { #ifdef GKRELLM2 if (GKp->five_second_tick) { /* set the global update_HZ variable every five second ticks * so if user changed the g_update_HZ, we will have * the latest value * */ recompute_modulus(); } /* timer_ticks is a counter which is updated gkrellm_update_HZ() times a second * gkrellm_update_HZ() is determined by the 'Krell and LED updates per second' * from the general options tab of gkrellmwith a range between 2-20 hertz */ if ( (GKp->timer_ticks % g_master_modulus) == 0 ) { top_update_panels(); /* update the panels */ } #else if (GK.five_second_tick) { /* set the global update_HZ variable every five second ticks * so if user changed the g_update_HZ, we will have * the latest value * */ g_update_HZ = gkrellm_update_HZ(); if(g_update_HZ <= 0 || g_update_HZ > 10) g_update_HZ=5; } if ((GK.timer_ticks % (gint)(g_update_HZ*UPDATE_TAU)) == g_local_updates) { top_update_panels(); /* update the panels */ } #endif } static void top_create_plugin(GtkWidget * vbox, gint first_create) { Style *style; TextStyle *ts; gint y; gint i; /* assign the timer pointer to GKp global variable */ GKp = gkrellm_ticks(); /* See comments about first create in demo2.c */ if (first_create) { for (i=0; ifont=gkrellm_default_font(0); //set to small_font GkrellmPiximage *image = NULL; gkrellm_load_piximage("krell_image", krell_image_xpm, &image, STYLE_NAME); gkrellm_set_style_krell_values_default(style, 0, // -3 justifies to bottom margin. gdk_pixbuf_get_height(image->pixbuf)/3, //img_hight/strip_hight 59, // shift in x (xhot) KRELL_EXPAND_LEFT, 1, //expansion type and movement steping 0, 0); //left and right margins, should be close to 0 for (i=0; iy + entry[i].decal_text->h - 3; /* offset the krell image under the text decal */ gkrellm_move_krell_yoff(entry[i].panel, entry[i].krell_meter, y); /* needed if the krell goes on top of the text */ gkrellm_decal_on_top_layer(entry[i].decal_text, TRUE); } for (i=0; idrawing_area), "expose_event", (GtkSignalFunc) top_expose_event, entry[i].panel); gtk_signal_connect(GTK_OBJECT(entry[i].panel->drawing_area), "enter_notify_event", (GtkSignalFunc) top_enter_notify_event, GINT_TO_POINTER(i)); gtk_signal_connect(GTK_OBJECT(entry[i].panel->drawing_area), "leave_notify_event", (GtkSignalFunc) top_leave_notify_event, NULL); gtk_signal_connect(GTK_OBJECT(entry[i].panel->drawing_area), "motion_notify_event" ,(GtkSignalFunc) top_motion_notify_event, NULL); gtk_signal_connect(GTK_OBJECT(entry[i].panel->drawing_area), "button_press_event", (GtkSignalFunc) top_click_event, GINT_TO_POINTER(i)); } panel_tooltip = gtk_tooltips_new(); } for (i=0; idrawing_area," \n \n ", ""); gtk_tooltips_set_delay(panel_tooltip, TOOLTIP_DELAY); gtk_tooltips_enable(panel_tooltip); // draw the panel gkrellm_draw_panel_layers(entry[i].panel); } /* set the local_updates after reading from the config */ if(g_local_updates > MAX_UPDATES_PER_TAU) g_local_updates = MAX_UPDATES_PER_TAU; else if(g_local_updates <= 0) g_local_updates = 1; recompute_modulus(); check_numproc(); return; } static void top_create_plugin_tab(GtkWidget *tab_vbox) { GtkWidget *tabs; //GtkWidget *table; GtkWidget *vbox, *vbox1, *hbox; //GtkWidget *button; GtkWidget *label; GtkWidget *text; //GSList *group; gchar *about_text; //gint i; tabs = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs), GTK_POS_TOP); gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0); /* -- setup -- */ vbox = gkrellm_create_framed_tab(tabs, _("Setup")); vbox1 = gkrellm_framed_vbox(vbox, _("Visualisation Options"), 4,FALSE,0,2); /* How many processes to show */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Number of top processes to show (max 3):")); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); gkrellm_spin_button(hbox, >k_numproc, (gfloat) g_numproc, 1.0, MAXITEMS, 1.0, 5.0, 0, 60, NULL, NULL, FALSE, _("")); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Show only processes above (in %):")); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); gkrellm_spin_button(hbox, >k_threshold, (gfloat) g_threshold, 0.0, 100.0, 1.0, 5.0, 0, 60, NULL, NULL, FALSE, _("")); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Frequency of updates (in 5 seconds):")); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); gkrellm_spin_button(hbox, >k_updates, (gfloat) g_local_updates, 1.0, MAX_UPDATES_PER_TAU, 1.0, 5.0, 0, 60, NULL, NULL, FALSE, _("")); /* exclusions stuff */ hbox = gtk_hbox_new(FALSE, 0); label = gtk_label_new(_("Exclusions (as regular expression ex: ^idle) : ")); gtk_box_pack_start(GTK_BOX(hbox),label,TRUE,TRUE,0); gtk_exclusions = gtk_entry_new(); if (strlen(s_exclusion) > 0) gtk_entry_set_text((GtkEntry*)gtk_exclusions, s_exclusion); gtk_box_pack_start(GTK_BOX(hbox),gtk_exclusions,TRUE,TRUE,8); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), gtk_hseparator_new(), FALSE, FALSE, 8); /* nice processes */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); gkrellm_check_button(hbox, >k_show_nice, show_nice_processes, TRUE, 0, _("Show nice processes")); /* percentage in front of process name */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); gkrellm_check_button(hbox, >k_show_percent, g_show_percent, TRUE, 0, _("Show percentage in front of process names")); /* could have process activity as chart but many processes are ephemeral * also doubleclicking on a panel could kill (send a signal) to the process * and sorting by memory which is available in the top-three */ /* -- About -- */ about_text = g_strdup_printf( "gkrelltop version 2.2.13\n" "gkrellm top plugin\n" "Copyright (c) 2007-9 Adi Zaimi\n" "adizaimi@users.sourceforge.net\n" "http://gkrelltop.sourceforge.net\n\n" "Released under the GNU Public License"); text = gtk_label_new(about_text); label = gtk_label_new("About"); gtk_notebook_append_page(GTK_NOTEBOOK(tabs),text,label); g_free(about_text); return; } static void top_apply_exclusion() { if( strlen(s_exclusion) > 0 ) { static regex_t reg; exclusion_expression = ® regcomp(exclusion_expression, s_exclusion, REG_EXTENDED); exclusionchanged=1; } else if(exclusion_expression){ exclusion_expression=0; exclusionchanged=1; } } static void top_apply_config() { GtkSpinButton *spin; spin = GTK_SPIN_BUTTON(gtk_numproc); //set the numproc g_numproc=gtk_spin_button_get_value_as_int(spin); check_numproc(); spin = GTK_SPIN_BUTTON(gtk_threshold); //set the threshold g_threshold = gtk_spin_button_get_value_as_int(spin); //set the show_nice_processes variable from the checkbox show_nice_processes = GTK_TOGGLE_BUTTON(gtk_show_nice)->active; g_show_percent = GTK_TOGGLE_BUTTON(gtk_show_percent)->active; spin = GTK_SPIN_BUTTON(gtk_updates); //set how often to update the top list g_local_updates = gtk_spin_button_get_value_as_int(spin); //if the exclusions is set, build the exclusion_expression variable if (gtk_exclusions ) { g_strlcpy(s_exclusion, gtk_entry_get_text((GtkEntry *) gtk_exclusions), sizeof(s_exclusion) ); top_apply_exclusion(); } else if (exclusion_expression) { exclusion_expression=0; } /* safety check */ if(g_local_updates > MAX_UPDATES_PER_TAU) g_local_updates = MAX_UPDATES_PER_TAU; else if(g_local_updates <= 0) g_local_updates = 1; recompute_modulus(); return; } static void top_save_config(FILE *f) { /* Save any configuration data we have in config lines in the format: PLUGIN_CONFIG_KEYWORD config_keyword data */ fprintf(f, "%s numproc %d\n", PLUGIN_CONFIG_KEYWORD, g_numproc); fprintf(f, "%s threshold %d\n", PLUGIN_CONFIG_KEYWORD, g_threshold); fprintf(f, "%s show_nice_processes %d\n", PLUGIN_CONFIG_KEYWORD, show_nice_processes); fprintf(f, "%s show_percent %d\n", PLUGIN_CONFIG_KEYWORD, g_show_percent); fprintf(f, "%s local_updates %d\n", PLUGIN_CONFIG_KEYWORD, g_local_updates); fprintf(f, "%s exclusion_expression %s\n", PLUGIN_CONFIG_KEYWORD, s_exclusion); return; } static void top_load_config(gchar *config_line) { gchar config_keyword[32], config_data[CFG_BUFSIZE]; gint n; if ((n = sscanf(config_line,"%31s %[^\n]",config_keyword,config_data)) != 2) { return; } if ( strcmp(config_keyword, "numproc")==0 ) { sscanf(config_data, "%d", &g_numproc); } else if ( strcmp(config_keyword, "threshold")==0 ) { sscanf(config_data, "%d", &g_threshold); } else if (strcmp(config_keyword, "show_nice_processes")==0) { sscanf(config_data, "%d", &show_nice_processes); } else if (strcmp(config_keyword, "show_percent")==0) { sscanf(config_data, "%d", &g_show_percent); } else if (strcmp(config_keyword, "local_updates")==0) { sscanf(config_data, "%d", &g_local_updates); } else if (strcmp(config_keyword, "exclusion_expression")==0) { sscanf(config_data, "%s", s_exclusion); top_apply_exclusion(); } return; } /* The monitor structure tells GKrellM how to call the plugin routines. */ static Monitor top_plugin_mon = { CONFIG_NAME, /* Name, for config tab. */ 0, /* Id, 0 if a plugin */ top_create_plugin, /* The create function */ top_update_plugin, /* The update function */ top_create_plugin_tab, /* The config tab create function */ top_apply_config, /* Apply the config function */ top_save_config, /* Save user config */ top_load_config, /* Load user config */ PLUGIN_CONFIG_KEYWORD, /* config keyword */ NULL, /* Undefined 2 */ NULL, /* Undefined 1 */ NULL, /* private */ MON_CPU | MON_INSERT_AFTER, /* Insert plugin after this monitor */ NULL, /* Handle if a plugin, filled in by GKrellM */ NULL /* path if a plugin, filled in by GKrellM */ }; /* initialise plugin -- required */ Monitor *init_plugin() { g_style_id = gkrellm_add_meter_style(&top_plugin_mon, STYLE_NAME); #ifdef GKRELLM_HAVE_CLIENT_MODE_PLUGINS gkrellm_client_plugin_get_setup(GKRELLTOP_SERVE_NAME, top_client_setup); fprintf(stderr,"available %d", gkrelltop_server_available); if (gkrelltop_server_available) { find_top_three = gkrelltop_client_process_find_top_three; gkrellm_client_plugin_serve_data_connect(&top_plugin_mon, GKRELLTOP_SERVE_NAME, top_client_data_from_server); } else find_top_three = gkrelltop_process_find_top_three; #else find_top_three = gkrelltop_process_find_top_three; #endif monitor = &top_plugin_mon; return &top_plugin_mon; } gkrelltop-2.2.13.orig/krell_image.xpm0000600000000000000000000004423410565724042014434 0ustar /* XPM */ static char * krell_image_xpm[] = { "60 100 383 2", " c None", ". c #84EC00", "+ c #8BE900", "@ c #86EB00", "# c #94E600", "$ c #9BE500", "% c #98E500", "& c #9FE300", "* c #8EE800", "= c #9CE400", "- c #A2E200", "; c #A0E300", "> c #A5E200", ", c #9EE400", "' c #A3E200", ") c #A8E100", "! c #A0E200", "~ c #A5E100", "{ c #ABE000", "] c #88EA00", "^ c #A4E200", "/ c #A9E100", "( c #AEDF00", "_ c #91E700", ": c #9DE400", "< c #A2E300", "[ c #A7E100", "} c #ACDF00", "| c #B1DE00", "1 c #A9E000", "2 c #AFDE00", "3 c #B4DD00", "4 c #ADDF00", "5 c #B3DD00", "6 c #B7DC00", "7 c #9CE500", "8 c #A1E300", "9 c #ABDF00", "0 c #B0DE00", "a c #B5DC00", "b c #BADB00", "c c #9FE400", "d c #B3DC00", "e c #B8DB00", "f c #BEDA00", "g c #B6DC00", "h c #BBDA00", "i c #C0D900", "j c #8BEA00", "k c #AAE000", "l c #B4DC00", "m c #BED900", "n c #C2D800", "o c #A8E000", "p c #B2DD00", "q c #BCDA00", "r c #C1D800", "s c #C6D700", "t c #9BE400", "u c #A6E200", "v c #BFD900", "w c #C4D800", "x c #C9D600", "y c #A4E100", "z c #BEDB00", "A c #C7D600", "B c #CCD500", "C c #BBDB00", "D c #C5D700", "E c #CAD600", "F c #D0D400", "G c #98E400", "H c #B9DB00", "I c #C3D800", "J c #C8D600", "K c #CED500", "L c #D3D300", "M c #9EE300", "N c #B8DC00", "O c #CBD500", "P c #D6D200", "Q c #A6E100", "R c #C4D700", "S c #CFD400", "T c #D3D200", "U c #D9D100", "V c #BDDA00", "W c #C7D700", "X c #D1D400", "Y c #DBD000", "Z c #91E800", "` c #A7E000", " . c #C5D800", ".. c #D4D200", "+. c #DAD200", "@. c #DED000", "#. c #CDD500", "$. c #D2D300", "%. c #D7D100", "&. c #DCD000", "*. c #E2CE00", "=. c #A3E300", "-. c #C1D900", ";. c #DBD100", ">. c #DFCF00", ",. c #E5CD00", "'. c #CFD500", "). c #D4D300", "!. c #DDD000", "~. c #E8CD00", "{. c #AEDE00", "]. c #D7D200", "^. c #E1D000", "/. c #EBCC00", "(. c #A1E200", "_. c #CAD500", ":. c #D5D200", "<. c #D9D200", "[. c #DECF00", "}. c #E3CE00", "|. c #E8CC00", "1. c #EECA00", "2. c #A0E400", "3. c #E7CD00", "4. c #ECCB00", "5. c #F1C900", "6. c #EACC00", "7. c #EFCB00", "8. c #F4C900", "9. c #C9D700", "0. c #D8D100", "a. c #E7CC00", "b. c #ECCC00", "c. c #F2CA00", "d. c #F7C800", "e. c #C2D900", "f. c #D2D400", "g. c #E1CF00", "h. c #E6CD00", "i. c #F0CA00", "j. c #F5C800", "k. c #FAC700", "l. c #DAD100", "m. c #E4CE00", "n. c #E9CC00", "o. c #EECB00", "p. c #F3C900", "q. c #F8C800", "r. c #FDC600", "s. c #C8D700", "t. c #F1CA00", "u. c #F6C800", "v. c #FBC700", "w. c #FFC400", "x. c #E4CD00", "y. c #EFCA00", "z. c #F9C700", "A. c #FEC600", "B. c #FFC000", "C. c #ACE000", "D. c #BFDA00", "E. c #F2C900", "F. c #FCC600", "G. c #FFC300", "H. c #FFBD00", "I. c #E6CE00", "J. c #EBCB00", "K. c #F0C900", "L. c #FFC500", "M. c #FFBF00", "N. c #FFBA00", "O. c #B6DD00", "P. c #FFC200", "Q. c #FFBC00", "R. c #FFB700", "S. c #CED400", "T. c #D8D200", "U. c #FFB900", "V. c #FFB400", "W. c #CBD600", "X. c #E0CF00", "Y. c #E5CE00", "Z. c #FFC100", "`. c #FFBB00", " + c #FFB600", ".+ c #FFB000", "++ c #EDCB00", "@+ c #FFB800", "#+ c #FFB200", "$+ c #FFAD00", "%+ c #D1D300", "&+ c #F5C900", "*+ c #FFB500", "=+ c #FFAF00", "-+ c #FFA900", ";+ c #B1DD00", ">+ c #F8C700", ",+ c #FFB100", "'+ c #FFAC00", ")+ c #FFA600", "!+ c #FBC600", "~+ c #FFBE00", "{+ c #FFAE00", "]+ c #FFA300", "^+ c #FFAB00", "/+ c #FFA500", "(+ c #FF9F00", "_+ c #EDCA00", ":+ c #FFA700", "<+ c #FFA200", "[+ c #FF9C00", "}+ c #FFAA00", "|+ c #FFA400", "1+ c #FF9900", "2+ c #D5D300", "3+ c #FFA100", "4+ c #FF9B00", "5+ c #FF9600", "6+ c #E2CF00", "7+ c #FFB300", "8+ c #FFA800", "9+ c #FF9E00", "0+ c #FF9800", "a+ c #FF9200", "b+ c #94E700", "c+ c #DFD000", "d+ c #FF9A00", "e+ c #FF9500", "f+ c #FF8F00", "g+ c #A6E000", "h+ c #FF9700", "i+ c #FF8C00", "j+ c #FF9400", "k+ c #FF8E00", "l+ c #FF8900", "m+ c #B2DE00", "n+ c #D0D300", "o+ c #FF9000", "p+ c #FF8A00", "q+ c #FF8500", "r+ c #DCD100", "s+ c #FF9300", "t+ c #FF8D00", "u+ c #FF8800", "v+ c #FF8200", "w+ c #FF8400", "x+ c #FF7F00", "y+ c #FF8600", "z+ c #FF8100", "A+ c #FF7B00", "B+ c #FF8300", "C+ c #FF7E00", "D+ c #FF7900", "E+ c #9DE500", "F+ c #FF9100", "G+ c #FF8B00", "H+ c #FF7500", "I+ c #C3D900", "J+ c #E1CE00", "K+ c #FF7C00", "L+ c #FF7800", "M+ c #FF7200", "N+ c #BCDB00", "O+ c #CCD600", "P+ c #D6D100", "Q+ c #FFA000", "R+ c #FF7A00", "S+ c #FF7400", "T+ c #FF6E00", "U+ c #FF9D00", "V+ c #FF7600", "W+ c #FF7000", "X+ c #FF6B00", "Y+ c #F6C900", "Z+ c #FF7300", "`+ c #FF6D00", " @ c #FF6700", ".@ c #FF8000", "+@ c #FF6F00", "@@ c #FF6A00", "#@ c #FF6400", "$@ c #FF7700", "%@ c #FF6C00", "&@ c #FF6100", "*@ c #EACB00", "=@ c #FF6900", "-@ c #FF5E00", ";@ c #FF6600", ">@ c #FF6000", ",@ c #FF5B00", "'@ c #FF6800", ")@ c #FF6300", "!@ c #FF5D00", "~@ c #FF5700", "{@ c #C6D800", "]@ c #E9CD00", "^@ c #F3C800", "/@ c #FF6500", "(@ c #FF5A00", "_@ c #FF5400", ":@ c #AADF00", "<@ c #B5DD00", "[@ c #FF5C00", "}@ c #FF5100", "|@ c #9DE300", "1@ c #ADDE00", "2@ c #FF5800", "3@ c #FF5300", "4@ c #FF4D00", "5@ c #C9D500", "6@ c #FF7100", "7@ c #FF5500", "8@ c #FF5000", "9@ c #FF4A00", "0@ c #FF6200", "a@ c #FF5200", "b@ c #FF4C00", "c@ c #FF4700", "d@ c #FF5F00", "e@ c #FF4F00", "f@ c #FF4900", "g@ c #FF4300", "h@ c #FF7D00", "i@ c #FF4600", "j@ c #FF4000", "k@ c #FF4E00", "l@ c #FF4800", "m@ c #FF4200", "n@ c #FF3D00", "o@ c #FF4500", "p@ c #FF3F00", "q@ c #FF3900", "r@ c #FF3C00", "s@ c #FF3600", "t@ c #FF3E00", "u@ c #FF3800", "v@ c #FF3300", "w@ c #FF5600", "x@ c #FF4B00", "y@ c #FF3B00", "z@ c #FF3500", "A@ c #FF3000", "B@ c #E0D000", "C@ c #F4C800", "D@ c #FF3700", "E@ c #FF3200", "F@ c #FF2D00", "G@ c #FF4400", "H@ c #FF3400", "I@ c #FF2E00", "J@ c #FF2900", "K@ c #FF4100", "L@ c #FF3100", "M@ c #FF2B00", "N@ c #FF2600", "O@ c #FF5900", "P@ c #FF2800", "Q@ c #FF2300", "R@ c #FCC700", "S@ c #FF8700", "T@ c #FF2F00", "U@ c #FF2A00", "V@ c #FF2500", "W@ c #FF1F00", "X@ c #FF2C00", "Y@ c #FF2700", "Z@ c #FF2200", "`@ c #FF1C00", " # c #FF2400", ".# c #FF1E00", "+# c #FF1900", "@# c #FF2100", "## c #FF1B00", "$# c #FF1500", "%# c #FF1D00", "&# c #FF1800", "*# c #FF1200", "=# c #C3D700", "-# c #FF1400", ";# c #FF0F00", "># c #FF1600", ",# c #FF1100", "'# c #FF0C00", " ", " ", " ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + $ ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ % & ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = - ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + $ ; > ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # , ' ) ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = ! ~ { ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] % & ^ / ( ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : < [ } | ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + $ ; > 1 2 3 ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # , ' ) 4 5 6 ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * 7 8 > 9 0 a b ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] % c ^ 1 2 d e f ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : 8 [ 4 | g h i ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j % ; > k 2 l b m n ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # , ' o 4 p 6 q r s ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * t 8 u { 0 a b v w x ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] # & y 1 ( 5 e z n A B ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ = - [ 4 | 6 C i D E F ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + G ; > k 2 3 H m I J K L ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # M ' ) 4 p N q r s O F P ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = ! Q 9 0 a b v R x S T U ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ % c ^ 1 ( 5 N V n W B X P Y ", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Z : - ` } | g C i .E F ..+.@.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + $ & ~ k 2 3 H m I J #.$.%.&.*.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ Z , =.o 4 5 6 q -.s O F P ;.>.,.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = 8 u 9 0 g b v R x '.).U !.*.~.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] % & ^ 1 {.5 e V n A #.$.].Y ^.,./.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ = (.` } | g C i ._.F :.<.[.}.|.1.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + t 2.~ k 2 3 H m I J K $.%.&.*.3.4.5.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ _ M ' ) 4 p 6 q r s B X :.;.>.,.6.7.8.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = ; ~ { 0 a b v R 9.S ).0.@.*.a.b.c.d.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] # M ^ 1 ( 5 H V e.W #.f.].Y g.h.6.i.j.k.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : - ` } | g h i D E S ).l.>.m.n.o.p.q.r.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] $ ; ~ k 2 3 b m I s.#.$.].!.*.3.4.t.u.v.w.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # , =.) 4 p 6 q r s B X P ;.>.x.6.y.8.z.A.B.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = (.u C.| a b D.R x K ).U @.}.a.4.E.d.F.G.H.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] % & y 1 ( 3 e V e.A B X ].&.g.I.J.K.j.k.L.M.N.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : (.` } | O.C i D O F ).l.>.}.|.o.p.q.r.P.Q.R.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + G & > k 0 3 H f I s.S.$.T.!.*.3.4.t.u.v.w.M.U.V.", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # , ' ) 4 p 6 q -.s W.X :.;.X.Y.6.7.8.z.A.Z.`. +.+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + 7 8 Q { 0 a b v R x K L 0.@.}.~.++c.d.F.G.H.@+#+$+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] % & ^ 1 ( 5 e V n W B %+P Y g.,./.i.&+k.L.B.N.*+=+-+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : - [ 4 ;+6 h i .E F ..l.>.m.~.o.p.>+r.Z.Q.R.,+'+)+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + G ; > k 2 l H D.I J K L T.!.*.h./.5.u.!+w.~+U.V.{+-+]+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # , ' o 4 p 6 q e.s W.X P ;.X.,.n.y.8.z.A.B.`.*+.+^+/+(+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * t ; Q { 0 a b v w _.K ).U @.}.a._+c.d.F.P.H.R.,+$+:+<+[+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ] % c ^ k {.5 e V n W #.f.].Y g.I./.i.&+k.L.M.N.V.=+}+|+(+1+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Z : < [ 4 ;+g C i D O F 2+U [.m.n.7.8.q.r.P.Q.R.,+'+)+3+4+5+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % ; ~ k 2 l H f I s.#.$.].!.6+3.4.t.u.v.w.M.U.7+{+8+]+9+0+a+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . @ b+, ' / ( p 6 q -.s B F :.l.c+Y.6.y.8.z.A.B.`.*+.+^+/+(+d+e+f+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . . * = 8 g+{ 0 a b v R _.S L 0.@.}.|._+c.d.F.G.H.@+#+$+:+<+[+h+a+i+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . ] % & y 1 {.d e V n J B X ].&.g.h./.i.&+k.L.B.N.*+=+}+|+(+d+j+k+l+", ". . . . . . . . . . . . . . . . . . . . . . . . . . . _ = - ` } m+g C i .W.n+2+U >.m.n.o.p.q.r.P.Q.R.,+^+)+3+[+5+o+p+q+", ". . . . . . . . . . . . . . . . . . . . . . . . . . + t & ~ k 2 3 H f I 9.#.L T.r+*.3.4.t.u.v.w.~+N.V.{+-+]+9+0+s+t+u+v+", ". . . . . . . . . . . . . . . . . . . . . . . . . @ # M ' o 4 p 6 q r s O F P ;.X.,.6.y.8.z.A.B.`. +.+^+/+(+d+e+o+p+w+x+", ". . . . . . . . . . . . . . . . . . . . . . . . . * 7 (.Q { 0 a b v R x K ).U @.}.|.++c.d.F.G.H.@+#+$+:+<+[+h+a+i+y+z+A+", ". . . . . . . . . . . . . . . . . . . . . . . . ] % & y 1 ( 5 e f n W B %+P &.X.h./.i.&+k.L.B.N.V.=+-+|+(+1+j+k+l+B+C+D+", ". . . . . . . . . . . . . . . . . . . . . . . . Z E+- [ } | g h -.D E S ).l.>.}.|.o.p.q.r.Z.Q.R.,+^+)+3+[+5+F+G+q+x+A+H+", ". . . . . . . . . . . . . . . . . . . . . . . + $ c ~ k 2 l b m I+9.#.$.%.&.J+h.b.t.u.v.w.~+N.V.{+8+]+9+0+s+t+u+v+K+L+M+", ". . . . . . . . . . . . . . . . . . . . . . . # M ' ) 4 5 N N+-.W O+X P+l.X.x.6.y.8.z.A.B.`. +.+}+/+Q+d+e+f+l+w+C+R+S+T+", ". . . . . . . . . . . . . . . . . . . . . . + = ! Q { 0 a b v w E S ).U @.}.a.++p.d.F.G.H.@+#+$+:+<+U+h+a+i+y+z+A+V+W+X+", ". . . . . . . . . . . . . . . . . . . . . ] # & y 1 ( 5 e V n J #.$.].&.X.h.J.i.Y+k.L.M.N.V.{+}+|+(+1+j+k+l+B+C+L+Z+`+ @", ". . . . . . . . . . . . . . . . . . . . . _ : - [ } | 6 q i D W.F 2+l.>.}.|.1.p.q.r.Z.Q.R.,+'+)+3+4+5+o+p+q+.@R+H++@@@#@", ". . . . . . . . . . . . . . . . . . . . j t & ~ k 2 3 H m I x K L T.!.6+h.b.t.u.v.w.~+N.V.{+-+]+9+0+s+t+u+v+K+$@M+%@ @&@", ". . . . . . . . . . . . . . . . . . . @ Z , ' ) 4 p N q r W O F P l.X.,.*@y.8.z.A.Z.`. +.+^+/+(+d+e+f+p+q+C+D+S++@=@#@-@", ". . . . . . . . . . . . . . . . . . . * 7 ; Q { 0 g C v w E K ).0.!.}.~._+c.d.F.G.H.@+#+$+:+3+[+h+F+G+y+.@A+V+W+X+;@>@,@", ". . . . . . . . . . . . . . . . . . ] % & ^ 1 ( 5 e f I+W B f.].Y X.,./.i.&+k.L.M.N.V.=+}+|+(+1+s+k+l+B+C+L+Z+`+'@)@!@~@", ". . . . . . . . . . . . . . . . . . _ : - [ } | 6 h i {@W.F ).U c+m.]@o.^@>+r.Z.Q. +,+'+)+3+4+5+o+G+q+x+R+H+W+@@/@-@(@_@", ". . . . . . . . . . . . . . . . . + t ; > :@2 <@b m I 9.K L T.!.J+3.b.t.u.!+w.~+U.7+{+-+]+9+0+s+t+u+v+K+$@M+`+ @&@[@~@}@", ". . . . . . . . . . . . . . . . @ # |@' o 1@p 6 q r s W.X :.l.X.x.6.7.8.z.A.Z.`.*+.+}+)+Q+d+e+f+p+q+x+D+S++@=@)@-@2@3@4@", ". . . . . . . . . . . . . . . . * = 8 Q } | a b v w 5@K ).U @.}.|.++c.d.F.G.H.R.#+$+:+3+[+5+F+i+y+z+A+V+6@X+/@>@,@7@8@9@", ". . . . . . . . . . . . . . . @ % c > 1 ( 5 e V n s.#.f.].Y g.h./.i.&+k.L.M.N.V.=+-+|+(+1+s+k+l+B+C+L+Z+T+'@0@!@2@a@b@c@", ". . . . . . . . . . . . . . . _ : - [ } | 6 h i s W.F :.l.[.m.n.o.p.q.r.Z.Q. +,+'+)+3+4+5+o+G+q+.@R+H++@@@/@d@(@_@e@f@g@", ". . . . . . . . . . . . . . + t c > k 2 3 H m I+x K L T.!.*.3.4.5.u.v.w.M.U.7+{+8+]+9+0+s+t+u+v+h@$@M+%@;@&@[@~@}@b@i@j@", ". . . . . . . . . . . . . . # , ' o 4 p 6 q r W B %+P ;.X.,.6.7.8.z.A.Z.`.*+.+^+/+Q+d+e+f+p+w+x+R+S+T+=@#@!@2@3@k@l@m@n@", ". . . . . . . . . . . . . * = 8 Q 9 0 a b v .E '.L U @.}.~.++c.d.F.G.H.R.#+'+:+3+[+h+F+G+y+z+A+V+6@X+/@>@,@7@8@9@o@p@q@", ". . . . . . . . . . . . ] % c ^ 1 ( 5 e V n s.B %+P Y g.h./.i.&+k.L.B.N.V.=+}+|+9+1+j+k+l+B+C+D+Z+`+'@0@[@2@a@b@c@m@r@s@", ". . . . . . . . . . . . Z : < [ } | g C i s O F 2+l.>.m.n.o.p.q.r.P.Q.R.,+^+)+Q+4+5+o+p+q+.@R+H++@=@#@d@(@_@e@f@g@t@u@v@", ". . . . . . . . . . . + t (.~ k 2 <@H f w x K L T.!.*.a.4.t.u.v.w.M.U.7+$+8+]+U+0+a+i+u+v+K+$@M+%@;@&@,@w@}@x@o@j@y@z@A@", ". . . . . . . . . . @ # , ' o ( 5 6 N+-.s O+X :.;.B@,.*@y.C@z.A.Z.`. +.+}+/+Q+d+e+f+p+q+C+D+Z+T+'@)@-@2@3@k@l@m@n@D@E@F@", ". . . . . . . . . . * 7 8 [ { 0 a b D.D 5@'.).U @.}.|._+c.d.F.G.~+@+,+'+8+<+[+h+F+i+y+z+A+V+6@X+/@>@(@7@8@9@G@p@q@H@I@J@", ". . . . . . . . . ] # & ^ 1 ( 5 e V e.W #.f.P &.g.I./.i.j.k.L.M.N.V.{+-+|+(+1+j+k+u+B+C+D+Z+`+'@0@!@2@a@4@c@K@r@s@L@M@N@", ". . . . . . . . . _ : - [ } | g h i {@E F 2+U >.m.n.o.^@q.r.P.Q. +,+'+:+3+4+5+o+G+q+.@R+H++@@@/@d@O@_@e@f@g@t@u@v@F@P@Q@", ". . . . . . . . + t ; > 9 2 3 H f w x K L T.&.J+a.4.t.u.R@w.~+@+7+{+8+]+U+0+a+t+S@v+h@$@M+%@ @&@[@~@}@x@i@j@y@z@T@U@V@W@", ". . . . . . . @ # , ' o 1@p 6 q r s W.X P l.>.,.6.7.8.z.A.B.`.*+.+}+/+Q+d+e+f+l+w+x+D+S+T+=@#@-@2@3@4@l@g@n@u@E@X@Y@Z@`@", ". . . . . . . * = 8 Q 9 | a b v .x S ).U !.}.~.++E.q.F.G.H.R.#+$+:+<+[+h+F+i+y+z+K+V+6@X+/@>@(@7@8@9@o@p@q@H@I@J@ #.#+#", ". . . . . . ] % & y 1 ( 5 H V I s.B %+P &.X.h.J.i.&+k.L.M.N.V.=+-+|+(+1+j+k+l+B+C+D+Z+`+'@0@!@~@a@4@c@K@r@s@L@M@Y@@###$#", ". . . . . . _ : - [ } ;+g h i s W.F ).U [.}.n.7.^@q.r.P.Q. +,+^+)+3+4+5+o+p+y+.@R+H++@@@#@d@(@_@e@f@G@t@u@v@I@P@Q@%#&#*#", ". . . . . j t (.~ k 2 3 H m =#9.K L T.!.J+a.4.t.u.!+w.~+@+7+{+8+]+U+0+a+t+S@v+K+$@M+X+ @&@[@w@}@x@o@j@y@s@A@U@V@W@+#-#;#", ". . . . @ # M ' o {.5 N q r A B X :.l.>.Y.6.7.8.z.A.Z.`.*+.+^+/+Q+d+j+f+l+w+x+D+S+T+=@)@!@2@3@4@l@m@n@u@E@F@Y@Z@`@>#,#'#"}; gkrelltop-2.2.13.orig/top_three.c0000600000000000000000000004235311232230055013554 0ustar /* * top_three.c a slightly modified wmtop.c -- copied from the WindowMaker * process view dock app which is: * * Modified by Adi Zaimi * * Derived by Dan Piponi dan@tanelorn.demon.co.uk * http://www.tanelorn.demon.co.uk * http://wmtop.sourceforge.net * from code originally contained in wmsysmon by Dave Clark (clarkd@skynet.ca) * This software is licensed through the GNU General Public License. */ /* * Ensure there's an operating system defined. There is *no* default * because every OS has it's own way of revealing CPU/memory usage. * compile with gcc -DOS ... */ #if defined(FREEBSD) #define OS_DEFINED #endif /* defined(FREEBSD) */ #if defined(LINUX) #define OS_DEFINED #endif /* defined(LINUX) */ #if !defined(OS_DEFINED) #error No operating system selected #endif /* !defined(OS_DEFINED) */ /******************************************/ /* Includes */ /******************************************/ #include "gkrelltop.h" /******************************************/ /* Defines */ /******************************************/ /* * XXX: I shouldn't really use this BUFFER_LEN variable but scanf is so * lame and it'll take me a while to write a replacement. */ #define BUFFER_LEN 1024 #if defined(LINUX) #define PROCFS_TEMPLATE "/proc/%d/stat" #define PROCFS_CMDLINE_TEMPLATE "/proc/%d/cmdline" #define PROCFS_IO_TEMPLATE "/proc/%d/io" #endif /* defined(LINUX) */ #if defined(FREEBSD) #define PROCFS_TEMPLATE "/proc/%d/status" #endif /* defined(FREEBSD) */ /******************************************/ /* Globals */ /******************************************/ regex_t *exclusion_expression = 0; int show_nice_processes = 0; int exclusionchanged = 0; enum modes pluginMode = cpu; static int previous_total = 0; static int memory_total = 0; /******************************************/ /* Debug */ /******************************************/ #if defined(DEBUG) /* * Memory handler */ static int g_malloced = 0; static void *gktop_malloc(int n) { int *p = (int *) malloc(sizeof(int) + n); p[0] = n; g_malloced += n; return (void *) (p + 1); } static void gktop_free(void *n) { int *p = (int *) n; g_malloced -= p[-1]; free(p - 1); } static void show_memory() { fprintf(stderr, "%d bytes allocated\n", g_malloced); } #else /* defined(DEBUG) */ #define gktop_malloc malloc #define gktop_free free #endif /* defined(DEBUG) */ static char *gktop_strdup(const char *s) { return strcpy((char *) gktop_malloc(strlen(s) + 1), s); } /******************************************/ /* Process class */ /******************************************/ /* * Pointer to head of process list */ static struct process *first_process = 0; /* find the process with the given pid by performing * a sequential search in the list. * It could be slow if there are many processes in the list; * may be better to use a hash table or a map from glib instead of a list */ static inline struct process *find_process(struct process *p, pid_t pid) { while (p && p->pid != pid) p = p->next; return p; } void print_process(struct process *p) { printf("pid = %d; name = %s \n",p->pid, p->name); } static inline void delete_list(struct process *p) { while (p) { struct process * curr = p; if (p->name) gktop_free(p->name); p = p->next; gktop_free(curr); } } /* Remove process p from list. list is passed as &list to save loc */ static void remove_from_list(struct process **list, struct process *p) { if (p->next) p->next->previous = p->previous; //null at worse if (p->previous) p->previous->next = p->next; //null at worse else if(p == *list) *list = p->next; //*list will at the end point to null else printf("p->next is null and it should not be " "-- not part of the list? %d \n " , p->pid); p->next = 0; p->previous = 0; } /* insert process p at the end (tail) of the list */ static inline void insert_in_list(struct process **lhead, struct process **ltail, struct process *p) { if(*ltail) { (*ltail)->next = p; p->previous = *ltail; } else *lhead = p; /* insert at the end */ *ltail = p; } /* * Create a new process object and return it */ static struct process *new_process(int pid) { struct process *process; process = gktop_malloc(sizeof(struct process)); /* * Do stitching necessary for doubly linked list */ process->name = 0; process->previous = 0; process->next = 0; process->pid = pid; process->previous_user_time = INT_MAX; process->previous_kernel_time = INT_MAX; process->include = 1; return process; } /******************************************/ /* Functions */ /******************************************/ static int process_parse_procfs(struct process *); static int update_process_table(void); static int calculate_cpu(struct process *); static int calc_cpu_total(void); #if defined(LINUX) static int calc_mem_total(void); static void calc_mem_each(void); static void calc_io_each(void); #endif /******************************************/ /* Extract information from /proc */ /******************************************/ /* * These are the guts that extract information out of /proc. * Anyone hoping to port wmtop should look here first. */ static int process_parse_procfs(struct process *process) { char line[BUFFER_LEN] = {0}; char filename[BUFFER_LEN] = {0}; char procname[BUFFER_LEN] = {0}; int user_time = 0; int kernel_time = 0; #if defined(LINUX) int nice_val = 0; #endif /* defined(LINUX) */ #if defined(FREEBSD) int us = 0; int um = 0; int ks = 0; int km = 0; #endif /* defined(FREEBSD) */ snprintf(filename, sizeof(filename), PROCFS_TEMPLATE, process->pid); int ps = open(filename, O_RDONLY); if (ps < 0) /* The process must have finished in the last few jiffies! */ return 1; int rc = read(ps, line, sizeof(line)); close(ps); if (rc < 0) return 1; #if defined(LINUX) /* Extract cpu times from data in /proc filesystem */ rc = sscanf(line, "%*s %s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d %d %*s %*s %*s %d %*s %*s %*s %d %d", procname, &user_time, &kernel_time,&nice_val, &process->vsize, &process->rss); if (rc < 5) return 1; /* don't read the process name if we have done once already */ if (!process->name) { char *r, *q; char deparenthesised_name[BUFFER_LEN] = {0}; int endl = 0; /* Remove parentheses from the process name * stored in /proc/ under Linux... */ r = procname + 1; /* remove any "kdeinit: " */ if (r == strstr(r, "kdeinit")) { snprintf(filename, sizeof(filename), PROCFS_CMDLINE_TEMPLATE, process->pid); ps = open(filename, O_RDONLY); if (ps < 0) /* * The process must have finished in the last few jiffies! */ return 1; endl = read(ps, line, sizeof(line)); close(ps); /* null terminate the input */ line[endl] = 0; /* account for "kdeinit: " */ if ((char *) line == strstr(line, "kdeinit: ")) r = ((char *) line) + 9; else r = (char *) line; q = deparenthesised_name; /* stop at space */ while (*r && *r != ' ') *q++ = *r++; *q = 0; } else { q = deparenthesised_name; while (*r && *r != ')') *q++ = *r++; *q = 0; } process->name = gktop_strdup(deparenthesised_name); } process->rss *= getpagesize(); #endif /* defined(LINUX) */ #if defined(FREEBSD) /* * Extract cpu times from data in /proc//stat * XXX: Process name extractor for FreeBSD is untested right now. */ rc = sscanf(line, "%s %*s %*s %*s %*s %*s %*s %*s %d,%d %d,%d", procname, &us, &um, &ks, &km); if (rc < 5) return 1; if (!process->name) process->name = gktop_strdup(procname); user_time = us * 1000 + um / 1000; kernel_time = ks * 1000 + km / 1000; #endif /* defined(FREEBSD) */ /* store only the difference of the user_time */ process->user_time = (process->previous_user_time == INT_MAX) ? 0 : user_time - process->previous_user_time; process->kernel_time = (process->previous_kernel_time == INT_MAX) ? 0 : kernel_time - process->previous_kernel_time; process->amount = process->user_time + process->kernel_time; /* backup the full values of these two for next cycle */ process->previous_user_time = user_time; process->previous_kernel_time = kernel_time; #if defined(LINUX) // if i knew how to get the nice value // from freebsd for a process...i hope sb. tell me /* set it to zero for niced processes */ if(show_nice_processes == 0 && nice_val > 1) { process->user_time = 0; process->kernel_time = 0; } #endif return 0; } /******************************************/ /* Update process table */ /******************************************/ static int update_process_table() { DIR *dir; struct dirent *entry; if (!(dir = opendir("/proc"))) return 1; struct process * visited_list_head = 0; struct process * visited_list_tail = 0; /* Get list of processes from /proc directory */ while ((entry = readdir(dir))) { if (!entry) { /* Problem reading list of processes */ closedir(dir); return 1; } pid_t pid; if (sscanf(entry->d_name, "%d", &pid) > 0) { struct process *p; p = find_process(first_process, pid); if(p) { remove_from_list(&first_process, p); } else if (!p) { p = new_process(pid); } /* compute each process cpu usage */ calculate_cpu(p); insert_in_list(&visited_list_head, &visited_list_tail, p); } } closedir(dir); //delete the items remaining in first_list--exited processes delete_list(first_process); first_process = visited_list_head; return 0; } /******************************************/ /* Get process structure for process pid */ /******************************************/ static int calculate_cpu(struct process *process) { int rc; /* compute each process cpu usage by reading /proc//stat */ rc = process_parse_procfs(process); if (rc) return 1; /* Check name against the exclusion list */ if (process->include && exclusion_expression && !regexec(exclusion_expression, process->name, 0, 0, 0)) { process->include = 0; /* if match, don't include it */ } else if(exclusionchanged) { /* this ensures that the process will reapear after you remove * the exclusion expression... */ process->include = 1; exclusionchanged=0; } if (!exclusion_expression) { process->include = 1; } return 0; } /******************************************/ /* Calculate cpu total */ /******************************************/ static int calc_cpu_total() { int total; #if defined(LINUX) char line[BUFFER_LEN] = { '\0' }; int cpu = 0; int nice = 0; int system = 0; int idle = 0; int ps = open("/proc/stat", O_RDONLY); int rc = read(ps, line, sizeof(line)); close(ps); if (rc < 0) return 0; sscanf(line, "%*s %d %d %d %d", &cpu, &nice, &system, &idle); total = cpu + nice + system + idle; #endif /* defined(LINUX) */ #if defined(FREEBSD) struct timeval tv; gettimeofday(&tv, 0); total = tv.tv_sec * 1000 + tv.tv_usec / 1000; #endif /* defined(FREEBSD) */ int dt = total - previous_total; previous_total = total; if (dt < 0) dt = 0; return dt; } #if defined(LINUX) /******************************************/ /* Calculate total memory */ /* This should be done only once because */ /* memory does not change all of a sudden */ /******************************************/ static int calc_mem_total() { int ps; char line[512]; char *total; char *free; int rc; ps = open("/proc/meminfo", O_RDONLY); rc = read(ps, line, sizeof(line)); close(ps); if (rc < 0 || (total = strstr(line, "MemTotal:")) == NULL || (free = strstr(line, "MemFree:")) == NULL) { return 0; } else { return atoi(total+9)-atoi(free+9); } } /******************************************/ /* Calculate each processes memory */ /******************************************/ static void calc_mem_each() { struct process *p = first_process; while (p) { p->amount = (float)p->rss; /* total is in kb */ p = p->next; } } /****************************************** * Calculate each processes io stats * io stats look as follows: * rchar: 44445340 * wchar: 3348787 * syscr: 28815 * syscw: 9780 * read_bytes: 27828224 * write_bytes: 0 * * the first two deal with bytes r/w from the vfs * the nexst two deal with read() and write() syscalls * and the last two deal with actual bytes r/w to disk * * The last two are what we need i think. * ******************************************/ static void calc_io_each() { char line[BUFFER_LEN], filename[BUFFER_LEN]; int ps; int rc; struct process *p = first_process; while (p) { snprintf(filename,sizeof(filename), PROCFS_IO_TEMPLATE, p->pid); ps = open(filename, O_RDONLY); if (ps < 0) /*The process must have finished in the last few jiffies! */ { p->amount = 0; continue; } p->previous_io_read = p->io_read; p->previous_io_write = p->io_write; /* the file gets read in one line */ rc = read(ps, line, sizeof(line)); /* scanf into variables only the last two r/w entries */ sscanf(line,"%*s %*d %*s %*d %*s %*d %*s %*d %*s %d %*s %d ", &p->io_read, &p->io_write) ; close(ps); p->amount = (p->io_read - p->previous_io_read ) + (p->io_write - p->previous_io_write); p = p->next; } } /******************************************/ /* Calculate total io */ /* will get info by summing all the */ /* other disk activity for all processes */ /* this will miss activity from processes */ /* that dissapeared within the interval */ /* but it is only the relative scaling */ /* that really matters not the accurate % */ /******************************************/ static int calc_io_total() { int total = 1; struct process *p = first_process; while (p) { total += p->amount; p = p->next; } return total; } #endif /* defined(LINUX) */ /******************************************/ /* Find the top three processes */ /******************************************/ /* * Result is stored in decreasing order in best[0-2]. */ int gkrelltop_process_find_top_three(struct process **best) { int n = 0; float coeficient = 0; update_process_table(); /* update the table with process list */ if(pluginMode == cpu) { int total = calc_cpu_total(); /* calculate the total of the processor */ if(total == 0) return 0; coeficient = 100.0 / (float) total; } #if defined(LINUX) else if(pluginMode == mem) { if(memory_total == 0) memory_total = calc_mem_total(); coeficient = 100.0 / ((float) memory_total * 1000); calc_mem_each(); } else if(pluginMode == io) { calc_io_each(); int total = calc_io_total(); if(total <= 1) return 0; coeficient = 100.0 / (float) total; } #endif /* defined(LINUX) */ /* * Insertion sort approach to skim top 3 * can this be made more efficient? */ struct process *p = first_process; while (p) { if (p->include && p->amount > 0) { if (!best[0] || p->amount > best[0]->amount) { best[2] = best[1]; best[1] = best[0]; best[0] = p; ++n; } else if (!best[1] || p->amount > best[1]->amount) { best[2] = best[1]; best[1] = p; ++n; } else if (!best[2] || p->amount > best[2]->amount) { ++n; best[2] = p; } } p = p->next; } /* n can be greater than 3 so need to constrain value before returning */ n = n > 3 ? 3 : n; int i = 0; for(i = 0; i < n; i++) best[i]->amount *= coeficient; //to turn it to percentage return n; } void onexit_cleanup(void) { delete_list(first_process); } gkrelltop-2.2.13.orig/config.sub0000700000000000000000000010115311232241204013370 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gkrelltop-2.2.13.orig/configure0000700000000000000000000000270510562553451013336 0ustar #!/bin/sh # Check to see if gkrellmd development headers are installed. # There is no need to run this configure before doing a make. # GLIB_INCLUDE=`pkg-config --cflags glib-2.0` GLIB_LIBS=`pkg-config --libs glib-2.0` for i do if [ "$i" = "--with-glib12" ] then GLIB_INCLUDE=`glib-config --cflags` GLIB_LIBS=`glib-config --libs` fi done PKG_INCLUDE=`pkg-config gkrellm --cflags --silence-errors` PKG_LIBS=`pkg-config gkrellm --libs --silence-errors` if [ "$PKG_INCLUDE" = "" ] then PKG_INCLUDE=$GLIB_INCLUDE fi if [ "$PKG_LIBS" = "" ] then PKG_LIBS=$GLIB_LIBS fi rm -f configure.h configure.log test test.o test.c touch configure.h CC=${CC-gcc} exec 5>./configure.log # ---------------------- gkrellmd check ---------------------- echo "Checking for gkrellmd... " 1>& 5 cat << EOF > test.c #include int main() { #if defined(GKRELLMD_VERSION_MAJOR) return 0; #else return 1; #endif } EOF # echo $CC ${PKG_INCLUDE} -c test.c -o test.o $CC ${PKG_INCLUDE} -c test.c -o test.o 2>& 5 $CC test.o -o test ${PKG_LIBS} 2>& 5 if [ -e ./test ] && ./test then echo "OK, defining HAVE_GKRELLMD" 1>& 5 echo "" 1>& 5 echo "#define HAVE_GKRELLMD 1" >> configure.h else echo "gkrellmd server support not included. Can't find gkrellmd.h?" 1>& 5 echo "" 1>& 5 fi # --------------- end of gkrellmd check ------------------------ #------------------------------------------------------------------- rm -f test test.o test.c exit 0