diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/Makefile.am | 8 | ||||
-rw-r--r-- | sysdeps/common/Makefile.am | 4 | ||||
-rw-r--r-- | sysdeps/guile/Makefile.am | 9 | ||||
-rw-r--r-- | sysdeps/guile/guile.awk | 98 | ||||
-rw-r--r-- | sysdeps/guile/names/Makefile.am | 4 | ||||
-rw-r--r-- | sysdeps/guile/names/guile-names.awk | 9 | ||||
-rw-r--r-- | sysdeps/kernel/Makefile.am | 4 | ||||
-rw-r--r-- | sysdeps/linux/Makefile.am | 4 | ||||
-rw-r--r-- | sysdeps/names/Makefile.am | 9 | ||||
-rw-r--r-- | sysdeps/names/mountlist.c | 46 | ||||
-rw-r--r-- | sysdeps/osf1/Makefile.am | 4 | ||||
-rw-r--r-- | sysdeps/stub/Makefile.am | 4 | ||||
-rw-r--r-- | sysdeps/sun4/Makefile.am | 4 |
13 files changed, 120 insertions, 87 deletions
diff --git a/sysdeps/Makefile.am b/sysdeps/Makefile.am index d12f6d78..20e6c7c2 100644 --- a/sysdeps/Makefile.am +++ b/sysdeps/Makefile.am @@ -4,12 +4,6 @@ else guile_SUBDIRS = endif -if GLIBTOP_NAMES -names_SUBDIRS = names -else -names_SUBDIRS = -endif - -SUBDIRS = @sysdeps_dir@ common $(names_SUBDIRS) $(guile_SUBDIRS) +SUBDIRS = @sysdeps_dir@ common names $(guile_SUBDIRS) DIST_SUBDIRS = common guile linux kernel names osf1 stub sun4 diff --git a/sysdeps/common/Makefile.am b/sysdeps/common/Makefile.am index 924b5c09..34ff3782 100644 --- a/sysdeps/common/Makefile.am +++ b/sysdeps/common/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_common.la libgtop_suid_common.la diff --git a/sysdeps/guile/Makefile.am b/sysdeps/guile/Makefile.am index 26b742ae..c9f49f48 100644 --- a/sysdeps/guile/Makefile.am +++ b/sysdeps/guile/Makefile.am @@ -1,15 +1,7 @@ -if GLIBTOP_NAMES SUBDIRS = names -endif - -DIST_SUBDIRS = names LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_guile.la @@ -25,3 +17,4 @@ guile.c: guile.awk $(top_builddir)/config.h $(top_srcdir)/features.def EXTRA_DIST = guile.awk CLEANFILES = guile.c + diff --git a/sysdeps/guile/guile.awk b/sysdeps/guile/guile.awk index 3c99fab1..5d9c1118 100644 --- a/sysdeps/guile/guile.awk +++ b/sysdeps/guile/guile.awk @@ -16,32 +16,53 @@ BEGIN { convert["double"] = "gh_double2scm"; convert["str"] = "gh_str02scm "; convert["char"] = "gh_char2scm "; + + backconv["int"] = "gh_scm2long"; + backconv["pid_t"] = "gh_scm2ulong"; } -/^(\w+)/ { - features[$1] = $1; - if ($1 ~ /^proclist$/) { - output = "SCM\nglibtop_guile_get_proclist (void)\n{\n"; - output = output"\tglibtop_proclist proclist;\n\tunsigned i, *ptr;\n"; - output = output"\tSCM list;\n\n\tptr = glibtop_get_proclist (&proclist);\n\n"; - output = output"\tlist = gh_list (gh_ulong2scm ("$1".flags),\n\t\t\t"; - } else { - if ($1 ~ /^proc_/) { - output = "SCM\nglibtop_guile_get_"$1" (SCM pid)\n{\n"; - output = output"\tglibtop_"$1" "$1";\n\n"; - output = output"\tglibtop_get_"$1" (&"$1", (pid_t) gh_scm2long (pid));\n\n"; - } else if ($1 ~ /^fsusage$/) { - output = "SCM\nglibtop_guile_get_"$1" (SCM mountdir)\n{\n"; - output = output"\tglibtop_"$1" "$1";\n\n"; - output = output"\tglibtop_get_"$1" (&"$1", gh_scm2newstr (mountdir, NULL));\n\n"; - } else { - output = "SCM\nglibtop_guile_get_"$1" (void)\n{\n"; - output = output"\tglibtop_"$1" "$1";\n\n"; - output = output"\tglibtop_get_"$1" (&"$1");\n\n"; - } - output = output"\treturn gh_list (gh_ulong2scm ("$1".flags),\n\t\t\t"; - } - nr_elements = split ($2, elements, /:/); +function make_output(line) { + split (line, line_fields, /\|/); + retval = line_fields[1]; + element_def = line_fields[3]; + feature = line_fields[2]; + param_typ = line_fields[4]; + param = line_fields[5]; + param_size = line_fields[6]; + + sub(/^@/,"",feature); + features[feature] = feature; + + if (param == "") + output = "SCM\nglibtop_guile_get_"feature" (void)\n{\n"; + else + output = "SCM\nglibtop_guile_get_"feature" (SCM "param")\n{\n"; + + output = output"\tglibtop_"feature" "feature";\n"; + if (retval != "void") + output = output"\t"retval" retval;\n"; + if (feature ~ /^proclist$/) + output = output"\tunsigned i;\n"; + output = output"\tSCM list;\n\n"; + + if (retval != "void") + prefix="retval = "; + else + prefix=""; + + if (param_typ == "const char *") + param_conv = "gh_scm2newstr ("param", NULL)"; + else if (param_typ != "") + param_conv = backconv[param_typ]" ("param")"; + + if (param == "") + output = output"\t"prefix"glibtop_get_"feature" (&"feature");\n\n"; + else + output = output"\t"prefix"glibtop_get_"feature" (&"feature", "param_conv");\n\n"; + + output = output"\tlist = gh_list (gh_ulong2scm ("feature".flags),\n\t\t\t"; + + nr_elements = split (element_def, elements, /:/); for (element = 1; element <= nr_elements; element++) { list = elements[element]; type = elements[element]; @@ -49,30 +70,33 @@ BEGIN { sub(/^\w+\(/, "", list); sub(/\)$/, "", list); count = split (list, fields, /,/); for (field = 1; field <= count; field++) { - output = output""convert[type]" ("$1"."fields[field]"),\n\t\t\t"; + output = output""convert[type]" ("feature"."fields[field]"),\n\t\t\t"; } } - output = output"SCM_UNDEFINED);"; + output = output"SCM_UNDEFINED);\n"; + print output; - if ($1 ~ /^proclist$/) { + if (feature ~ /^proclist$/) { + print "\tif (retval == NULL)"; + print "\t\treturn list;"; print ""; - print "\tif (ptr) {"; - print "\t\tfor (i = 0; i < proclist.number; i++)"; - print "\t\t\tlist = scm_append"; - print "\t\t\t\t(gh_list (list,"; - print "\t\t\t\t\t gh_list (gh_ulong2scm ((unsigned long) ptr [i])),"; - print "\t\t\t\t\t SCM_UNDEFINED));"; - print "\t}"; + print "\tfor (i = 0; i < proclist.number; i++)"; + print "\t\tlist = scm_append"; + print "\t\t\t(gh_list (list,"; + print "\t\t\t\t gh_list (gh_ulong2scm ((unsigned long) retval [i])),"; + print "\t\t\t\t SCM_UNDEFINED));"; print ""; - print "\tglibtop_free (ptr);"; - print ""; - print "\treturn list;"; + print "\tglibtop_free (retval);\n"; } + + print "\treturn list;"; print "}"; print ""; } +/^[^#]/ { make_output($0) } + END { print "void"; print "glibtop_boot_guile (void)"; diff --git a/sysdeps/guile/names/Makefile.am b/sysdeps/guile/names/Makefile.am index bf6edbbf..9ca53ee0 100644 --- a/sysdeps/guile/names/Makefile.am +++ b/sysdeps/guile/names/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_guile_names.la diff --git a/sysdeps/guile/names/guile-names.awk b/sysdeps/guile/names/guile-names.awk index c76f3b60..3c062aaa 100644 --- a/sysdeps/guile/names/guile-names.awk +++ b/sysdeps/guile/names/guile-names.awk @@ -92,7 +92,14 @@ function output(feature) { print ""; } -/^(\w+)/ { features[$1] = $1 } +/^[^#]/ { + line = $0; + split (line, line_fields, /\|/); + feature = line_fields[2]; + sub(/^@/,"",feature); + + features[feature] = feature; +} END { for (feature in features) { diff --git a/sysdeps/kernel/Makefile.am b/sysdeps/kernel/Makefile.am index b5db2723..10318b8d 100644 --- a/sysdeps/kernel/Makefile.am +++ b/sysdeps/kernel/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_sysdeps.la diff --git a/sysdeps/linux/Makefile.am b/sysdeps/linux/Makefile.am index 996fd540..29b6fb89 100644 --- a/sysdeps/linux/Makefile.am +++ b/sysdeps/linux/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_sysdeps.la diff --git a/sysdeps/names/Makefile.am b/sysdeps/names/Makefile.am index ff530ad7..3eb11bf3 100644 --- a/sysdeps/names/Makefile.am +++ b/sysdeps/names/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_names.la @@ -11,5 +7,6 @@ lib_LTLIBRARIES = libgtop_names.la libgtop_names_la_SOURCES = cpu.c mem.c swap.c uptime.c loadavg.c \ shm_limits.c msg_limits.c sem_limits.c \ proclist.c sysdeps.c procstate.c procuid.c \ - proctime.c procmem.c procsignal.c prockernel.c \ - procsegment.c fsusage.c + proctime.c procmem.c procsignal.c \ + prockernel.c procsegment.c fsusage.c \ + mountlist.c diff --git a/sysdeps/names/mountlist.c b/sysdeps/names/mountlist.c new file mode 100644 index 00000000..816f0453 --- /dev/null +++ b/sysdeps/names/mountlist.c @@ -0,0 +1,46 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <glibtop/mountlist.h> + +const char *glibtop_names_mountlist [GLIBTOP_MAX_MOUNTLIST] = +{ + "number", "total", "size" +}; + +const unsigned glibtop_types_mountlist [GLIBTOP_MAX_MOUNTLIST] = +{ + GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG +}; + +const char *glibtop_labels_mountlist [GLIBTOP_MAX_MOUNTLIST] = +{ + N_("Number of list elements"), + N_("Total size of list"), + N_("Size of a single list element") +}; + +const char *glibtop_descriptions_mountlist [GLIBTOP_MAX_MOUNTLIST] = +{ + N_("Number of list elements"), + N_("Total size of list"), + N_("Size of a single list element") +}; diff --git a/sysdeps/osf1/Makefile.am b/sysdeps/osf1/Makefile.am index 0092b03d..f95a71b2 100644 --- a/sysdeps/osf1/Makefile.am +++ b/sysdeps/osf1/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la diff --git a/sysdeps/stub/Makefile.am b/sysdeps/stub/Makefile.am index 63a02d25..07b25c66 100644 --- a/sysdeps/stub/Makefile.am +++ b/sysdeps/stub/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_sysdeps.la diff --git a/sysdeps/sun4/Makefile.am b/sysdeps/sun4/Makefile.am index 7cb1ecd2..4d93f62d 100644 --- a/sysdeps/sun4/Makefile.am +++ b/sysdeps/sun4/Makefile.am @@ -1,9 +1,5 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \ - -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \ - -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE - CFLAGS = -Wall -W @CFLAGS@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la |