summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--features.def1
-rw-r--r--include/glibtop/command.h4
-rw-r--r--include/glibtop/mountlist.h68
-rw-r--r--include/glibtop/open.h3
-rw-r--r--include/glibtop/sysdeps.h6
-rw-r--r--include/glibtop/union.h3
-rw-r--r--lib/Makefile.am5
-rw-r--r--lib/lib.awk32
-rw-r--r--lib/open.c11
-rw-r--r--lib/sysdeps.c (renamed from sysdeps/common/sysdeps.c)0
-rw-r--r--po/POTFILES.in222
-rw-r--r--src/daemon/.cvsignore3
-rw-r--r--src/daemon/main.c8
-rw-r--r--sysdeps/common/Makefile.am2
-rw-r--r--sysdeps/common/mountlist.c63
-rw-r--r--sysdeps/common/mountlist.h5
-rw-r--r--sysdeps/names/sysdeps.c10
18 files changed, 385 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog
index b05710db..ce2decfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
1998-07-22 Martin Baulig <martin@home-of-linux.org>
+ * include/glibtop/mountlist.h: New file.
+
+ * features.def: Added new feature `mountlist'.
+
+ * sysdeps/common/mountlist.c (glibtop_get_mountlist_s): New function.
+ (read_filesystem_list): Declared as `static'.
+
* sysdeps/common/Makefile.am (libgtop_common_la_SOURCES):
Added `fsusage.[ch]' and `mountlist.[ch]'.
diff --git a/features.def b/features.def
index ea83e9b3..99bfb34a 100644
--- a/features.def
+++ b/features.def
@@ -14,3 +14,4 @@ proc_time long(start_time,utime,stime,cutime,cstime,timeout,it_real_value)
proc_signal ulong(signal,blocked,sigignore,sigcatch)
proc_kernel ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,wchan)
proc_segment long(trs,lrs,drs,dt):ulong(start_code,end_code,start_stack)
+@mountlist ulong(number,size,total)
diff --git a/include/glibtop/command.h b/include/glibtop/command.h
index c76ed0ed..1b7acd7a 100644
--- a/include/glibtop/command.h
+++ b/include/glibtop/command.h
@@ -48,7 +48,9 @@ __BEGIN_DECLS
#define GLIBTOP_CMND_PROC_KERNEL 16
#define GLIBTOP_CMND_PROC_SEGMENT 17
-#define GLIBTOP_MAX_CMND 18
+#define GLIBTOP_CMND_MOUNTLIST 18
+
+#define GLIBTOP_MAX_CMND 19
#define _GLIBTOP_PARAM_SIZE 16
diff --git a/include/glibtop/mountlist.h b/include/glibtop/mountlist.h
new file mode 100644
index 00000000..ddd7a632
--- /dev/null
+++ b/include/glibtop/mountlist.h
@@ -0,0 +1,68 @@
+/* $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. */
+
+#ifndef __GLIBTOP_MOUNTLIST_H__
+#define __GLIBTOP_MOUNTLIST_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_MOUNTLIST_NUMBER 0
+#define GLIBTOP_MOUNTLIST_TOTAL 1
+#define GLIBTOP_MOUNTLIST_SIZE 2
+
+#define GLIBTOP_MAX_MOUNTLIST 3
+
+#define GLIBTOP_MOUNTENTRY_LEN 80
+
+typedef struct _glibtop_mountentry glibtop_mountentry;
+
+typedef struct _glibtop_mountlist glibtop_mountlist;
+
+struct _glibtop_mountentry
+{
+ char devname [GLIBTOP_MOUNTENTRY_LEN+1];
+ char mountdir [GLIBTOP_MOUNTENTRY_LEN+1];
+ char type [GLIBTOP_MOUNTENTRY_LEN+1];
+ dev_t dev;
+};
+
+struct _glibtop_mountlist
+{
+ unsigned long flags,
+ number, /* GLIBTOP_MOUNTLIST_NUMBER */
+ total, /* GLIBTOP_MOUNTLIST_TOTAL */
+ size; /* GLIBTOP_MOUNTLIST_SIZE */
+};
+
+#define glibtop_get_mountlist(mountlist) glibtop_get_mountlist_l(glibtop_global_server, mountlist)
+
+#define glibtop_get_mountlist_r glibtop_get_mountlist_s
+
+extern glibtop_mountentry *glibtop_get_mountlist_l __P((glibtop *, glibtop_mountlist *));
+
+extern glibtop_mountentry *glibtop_get_mountlist_s __P((glibtop *, glibtop_mountlist *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/open.h b/include/glibtop/open.h
index e4b3b4f5..ff7b6125 100644
--- a/include/glibtop/open.h
+++ b/include/glibtop/open.h
@@ -33,7 +33,8 @@ __BEGIN_DECLS
#define GLIBTOP_INIT_NO_OPEN 1
#define GLIBTOP_INIT_NO_INIT 2
-#define GLIBTOP_OPEN_NO_OVERRIDE 1
+#define GLIBTOP_FEATURES_NO_SERVER 4
+#define GLIBTOP_FEATURES_EXCEPT 8
#define GLIBTOP_METHOD_DIRECT 1
#define GLIBTOP_METHOD_PIPE 2
diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h
index 8436a81c..263245d3 100644
--- a/include/glibtop/sysdeps.h
+++ b/include/glibtop/sysdeps.h
@@ -44,8 +44,9 @@ __BEGIN_DECLS
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14
#define GLIBTOP_SYSDEPS_PROC_KERNEL 15
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16
+#define GLIBTOP_SYSDEPS_MOUNTLIST 17
-#define GLIBTOP_MAX_SYSDEPS 17
+#define GLIBTOP_MAX_SYSDEPS 18
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
@@ -70,7 +71,8 @@ struct _glibtop_sysdeps
proc_time, /* glibtop_proc_time */
proc_signal, /* glibtop_proc_signal */
proc_kernel, /* glibtop_proc_kernel */
- proc_segment; /* glibtop_proc_segment */
+ proc_segment, /* glibtop_proc_segment */
+ mountlist; /* glibtop_mountlist */
};
#define glibtop_get_sysdeps(sysdeps) glibtop_get_sysdeps_r(glibtop_global_server,sysdeps)
diff --git a/include/glibtop/union.h b/include/glibtop/union.h
index fb3b6aff..c8a983f7 100644
--- a/include/glibtop/union.h
+++ b/include/glibtop/union.h
@@ -40,6 +40,8 @@
#include <glibtop/prockernel.h>
#include <glibtop/procsegment.h>
+#include <glibtop/mountlist.h>
+
__BEGIN_DECLS
typedef union _glibtop_union glibtop_union;
@@ -62,6 +64,7 @@ union _glibtop_union
glibtop_proc_signal proc_signal;
glibtop_proc_kernel proc_kernel;
glibtop_proc_segment proc_segment;
+ glibtop_mountlist mountlist;
};
__END_DECLS
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 23e211e1..3e0666e6 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -8,8 +8,9 @@ CFLAGS = -Wall -W @CFLAGS@ -DGTOP_SERVER=\""@LIBGTOP_SERVER@"\"
lib_LTLIBRARIES = libgtop.la
-libgtop_la_SOURCES = init.c open.c close.c command.c read.c read_data.c \
- write.c lib.c parameter.c
+libgtop_la_SOURCES = init.c open.c close.c command.c read.c \
+ read_data.c write.c lib.c parameter.c \
+ sysdeps.c
BUILT_SOURCES = lib.c
diff --git a/lib/lib.awk b/lib/lib.awk
index 3dc1bbba..ee91d7d8 100644
--- a/lib/lib.awk
+++ b/lib/lib.awk
@@ -12,9 +12,14 @@ BEGIN {
}
function output(feature) {
+ orig = feature;
+ sub(/@/,"",feature);
if (feature ~ /^proclist$/) {
print "unsigned *";
prefix = "return ";
+ } else if (feature ~ /^mountlist$/) {
+ print "glibtop_mountentry *";
+ prefix = "return ";
} else {
prefix = "";
print "void";
@@ -42,7 +47,11 @@ function output(feature) {
print "#if (!GLIBTOP_SUID_"toupper(feature)")";
print "\t\tglibtop_get_"feature"_r (server, buf, pid);";
} else {
- if (feature ~ /^proclist$/) {
+ if (feature ~ /^mountlist$/) {
+ print "\t\treturn glibtop_call_l (server, GLIBTOP_CMND_MOUNTLIST,";
+ print "\t\t\t\t 0, NULL, sizeof (glibtop_mountlist),";
+ print "\t\t\t\t buf);";
+ } else if (feature ~ /^proclist$/) {
print "\t\treturn glibtop_call_l (server, GLIBTOP_CMND_PROCLIST,";
print "\t\t\t\t 0, NULL, sizeof (glibtop_proclist),";
print "\t\t\t\t buf);";
@@ -51,18 +60,25 @@ function output(feature) {
print "\t\t\t\tsizeof (glibtop_"feature"), buf);";
}
print "\t} else {";
- print "#if (!GLIBTOP_SUID_"toupper(feature)")";
- print "\t\t"prefix"glibtop_get_"feature"_r (server, buf);";
+ if (orig ~ /^@/) {
+ print "\t\t"prefix"glibtop_get_"feature"_s (server, buf);";
+ } else {
+ print "#if (!GLIBTOP_SUID_"toupper(feature)")";
+ print "\t\t"prefix"glibtop_get_"feature"_r (server, buf);";
+ }
+ }
+ if (!(orig ~ /^@/)) {
+ print "#else";
+ print "\t\terrno = ENOSYS;";
+ print "\t\tglibtop_error_io_r (server, \"glibtop_get_"feature"\");";
+ print "#endif";
}
- print "#else";
- print "\t\terrno = ENOSYS;";
- print "\t\tglibtop_error_io_r (server, \"glibtop_get_"feature"\");";
- print "#endif";
print "\t}";
print "}";
print "";
}
-/^(\w+)/ { output($1) }
+/^@(\w+)/ { output($1) }
+/^(\w+)/ { output($1) }
diff --git a/lib/open.c b/lib/open.c
index 30477691..9b367cc1 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -44,6 +44,17 @@ glibtop_open_l (glibtop *server, const char *program_name,
server->flags |= _GLIBTOP_INIT_STATE_OPEN;
+ if (flags & GLIBTOP_FEATURES_EXCEPT)
+ features = ~features & GLIBTOP_SYSDEPS_ALL;
+
+ if (features == 0)
+ features = GLIBTOP_SYSDEPS_ALL;
+
+ if (flags & GLIBTOP_FEATURES_NO_SERVER) {
+ server->method = GLIBTOP_METHOD_DIRECT;
+ features = 0;
+ }
+
server->features = features;
switch (server->method) {
diff --git a/sysdeps/common/sysdeps.c b/lib/sysdeps.c
index dce28c11..dce28c11 100644
--- a/sysdeps/common/sysdeps.c
+++ b/lib/sysdeps.c
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b0b5df47..b4c54696 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,68 +1,206 @@
-lib/close.c
lib/command.c
+lib/close.c
+lib/init.c
+lib/sysdeps.c
lib/open.c
lib/read.c
-lib/write.c
lib/read_data.c
-acconfig.h
-glibtop.h
-include/glibtop/command.h
+lib/parameter.c
+lib/write.c
+examples/mountlist.c
+examples/first.c
+examples/second.c
+examples/third.c
include/glibtop/close.h
-include/glibtop/global.h
+include/glibtop/signal.h
+include/glibtop/command.h
include/glibtop/cpu.h
+include/glibtop/global.h
include/glibtop/error.h
-include/glibtop/shm_limits.h
-include/glibtop/uptime.h
-include/glibtop/output.h
+include/glibtop/loadavg.h
include/glibtop/mem.h
+include/glibtop/msg_limits.h
include/glibtop/open.h
-include/glibtop/sysdeps.h
-include/glibtop/union.h
+include/glibtop/output.h
+include/glibtop/prockernel.h
+include/glibtop/proclist.h
+include/glibtop/procmem.h
+include/glibtop/procsegment.h
+include/glibtop/procsignal.h
+include/glibtop/procstate.h
+include/glibtop/proctime.h
+include/glibtop/procuid.h
include/glibtop/read.h
+include/glibtop/read_data.h
+include/glibtop/sem_limits.h
+include/glibtop/shm_limits.h
include/glibtop/swap.h
-include/glibtop/loadavg.h
+include/glibtop/sysdeps.h
+include/glibtop/types.h
+include/glibtop/union.h
+include/glibtop/uptime.h
include/glibtop/version.h
include/glibtop/write.h
+include/glibtop/parameter.h
+include/glibtop/gnuserv.h
+include/glibtop/mountlist.h
include/glibtop/xmalloc.h
-include/glibtop/msg_limits.h
-include/glibtop/proclist.h
-include/glibtop/sem_limits.h
-include/glibtop/read_data.h
-src/server/main.c
-src/server/output.c
-src/server/version.c
+src/daemon/main.c
+src/daemon/slave.c
+src/daemon/io.c
+src/daemon/server_config.h
+src/daemon/daemon.h
+src/daemon/gnuserv.c
+sysdeps/common/gnuslib.c
+sysdeps/common/fsusage.c
+sysdeps/common/fsusage.h
+sysdeps/common/mountlist.c
+sysdeps/common/mountlist.h
+sysdeps/linux/loadavg.c
sysdeps/linux/close.c
sysdeps/linux/cpu.c
+sysdeps/linux/msg_limits.c
sysdeps/linux/mem.c
+sysdeps/linux/procdata.c
sysdeps/linux/open.c
+sysdeps/linux/prockernel.c
+sysdeps/linux/proclist.c
+sysdeps/linux/procmem.c
+sysdeps/linux/procsegment.c
+sysdeps/linux/procsignal.c
+sysdeps/linux/procstate.c
+sysdeps/linux/proctime.c
+sysdeps/linux/procuid.c
+sysdeps/linux/sem_limits.c
+sysdeps/linux/siglist.c
+sysdeps/linux/glibtop_server.h
sysdeps/linux/swap.c
-sysdeps/linux/shm_limits.c
-sysdeps/linux/msg_limits.c
sysdeps/linux/uptime.c
-sysdeps/linux/loadavg.c
-sysdeps/linux/sem_limits.c
-sysdeps/linux/proclist.c
-sysdeps/stub/proclist.c
+sysdeps/linux/glibtop_machine.h
+sysdeps/linux/shm_limits.c
+sysdeps/names/loadavg.c
+sysdeps/names/cpu.c
+sysdeps/names/msg_limits.c
+sysdeps/names/mem.c
+sysdeps/names/prockernel.c
+sysdeps/names/proclist.c
+sysdeps/names/procmem.c
+sysdeps/names/procsegment.c
+sysdeps/names/procsignal.c
+sysdeps/names/procstate.c
+sysdeps/names/proctime.c
+sysdeps/names/procuid.c
+sysdeps/names/sem_limits.c
+sysdeps/names/shm_limits.c
+sysdeps/names/swap.c
+sysdeps/names/uptime.c
+sysdeps/names/sysdeps.c
+sysdeps/osf1/close.c
+sysdeps/osf1/glibtop_machine.h
+sysdeps/osf1/loadavg.c
+sysdeps/osf1/cpu.c
+sysdeps/osf1/msg_limits.c
+sysdeps/osf1/mem.c
+sysdeps/osf1/procdata.c
+sysdeps/osf1/open.c
+sysdeps/osf1/sem_limits.c
+sysdeps/osf1/shm_limits.c
+sysdeps/osf1/glibtop_server.h
+sysdeps/osf1/siglist.c
+sysdeps/osf1/swap.c
+sysdeps/osf1/uptime.c
+sysdeps/stub/loadavg.c
sysdeps/stub/close.c
sysdeps/stub/cpu.c
+sysdeps/stub/msg_limits.c
sysdeps/stub/mem.c
+sysdeps/stub/prockernel.c
sysdeps/stub/open.c
+sysdeps/stub/proclist.c
+sysdeps/stub/procmem.c
+sysdeps/stub/procsegment.c
+sysdeps/stub/procsignal.c
+sysdeps/stub/procstate.c
+sysdeps/stub/proctime.c
+sysdeps/stub/procuid.c
+sysdeps/stub/sem_limits.c
sysdeps/stub/swap.c
-sysdeps/stub/loadavg.c
-sysdeps/stub/uptime.c
+sysdeps/stub/glibtop_server.h
sysdeps/stub/shm_limits.c
-sysdeps/stub/msg_limits.c
-sysdeps/stub/sem_limits.c
-sysdeps/common/sysdeps.c
-sysdeps/common/xmalloc.c
-sysdeps/common/error.c
-sysdeps/names/sysdeps.c
-sysdeps/names/cpu.c
-sysdeps/names/loadavg.c
-sysdeps/names/mem.c
-sysdeps/names/swap.c
-sysdeps/names/uptime.c
-sysdeps/names/shm_limits.c
-sysdeps/names/msg_limits.c
-sysdeps/names/sem_limits.c
-sysdeps/names/proclist.c
+sysdeps/stub/siglist.c
+sysdeps/stub/uptime.c
+sysdeps/kernel/loadavg.c
+sysdeps/kernel/close.c
+sysdeps/kernel/cpu.c
+sysdeps/kernel/msg_limits.c
+sysdeps/kernel/mem.c
+sysdeps/kernel/procdata.c
+sysdeps/kernel/open.c
+sysdeps/kernel/prockernel.c
+sysdeps/kernel/proclist.c
+sysdeps/kernel/procmem.c
+sysdeps/kernel/procsegment.c
+sysdeps/kernel/procsignal.c
+sysdeps/kernel/procstate.c
+sysdeps/kernel/proctime.c
+sysdeps/kernel/procuid.c
+sysdeps/kernel/sem_limits.c
+sysdeps/kernel/kernel.h
+sysdeps/kernel/glibtop_server.h
+sysdeps/kernel/swap.c
+sysdeps/kernel/uptime.c
+sysdeps/kernel/shm_limits.c
+sysdeps/kernel/siglist.c
+intl/bindtextdom.c
+intl/cat-compat.c
+intl/dcgettext.c
+intl/dgettext.c
+intl/explodename.c
+intl/gettext.h
+intl/gettextP.h
+intl/hash-string.h
+intl/finddomain.c
+intl/gettext.c
+intl/libgettext.h
+intl/loadinfo.h
+intl/intl-compat.c
+intl/l10nflist.c
+intl/loadmsgcat.c
+intl/localealias.c
+intl/textdomain.c
+support/argp-ba.c
+support/argp-eexst.c
+support/argp-fmtstream.c
+support/argp-fmtstream.h
+support/argp-fs-xinl.c
+support/argp-help.c
+support/argp-namefrob.h
+support/argp-parse.c
+support/argp-pv.c
+support/argp-pvh.c
+support/argp-test.c
+support/argp-xinl.c
+support/argp.h
+support/easy-vsnprintf.c
+support/getopt.c
+support/getopt.h
+support/getopt1.c
+support/gnome-argp.c
+support/gnome-argp.h
+support/long-options.c
+support/long-options.h
+support/scandir.c
+support/strcasecmp.c
+support/strerror.c
+support/strndup.c
+support/strnlen.c
+support/strtok_r.c
+support/vasprintf.c
+support/vsnprintf.c
+support/strtod.c
+support/memmove.c
+support/gnomesupport.h
+support/mkstemp.c
+support/strtol.c
+support/strtoul.c
+glibtop.h
diff --git a/src/daemon/.cvsignore b/src/daemon/.cvsignore
index 7ebf5f4a..abee0aa8 100644
--- a/src/daemon/.cvsignore
+++ b/src/daemon/.cvsignore
@@ -1,4 +1,5 @@
Makefile.in
Makefile
-gnuserv
+libgtop_daemon
server_config.h
+server.conf
diff --git a/src/daemon/main.c b/src/daemon/main.c
index ff58c80f..20e3e889 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -27,6 +27,7 @@ handle_parent_connection (int s)
glibtop *server = glibtop_global_server;
glibtop_response _resp, *resp = &_resp;
glibtop_command _cmnd, *cmnd = &_cmnd;
+ glibtop_mountentry *mount_list;
char parameter [BUFSIZ];
pid_t pid;
void *ptr;
@@ -158,6 +159,13 @@ handle_parent_connection (int s)
(server, &resp->u.data.proc_segment, pid);
do_output (s, resp, _offset_data (proc_segment), 0, NULL);
break;
+ case GLIBTOP_CMND_MOUNTLIST:
+ mount_list = glibtop_get_mountlist_l
+ (server, &resp->u.data.mountlist);
+ do_output (s, resp, _offset_data (mountlist),
+ resp->u.data.mountlist.total, mount_list);
+ glibtop_free_r (server, mount_list);
+ break;
default:
glibtop_warn ("Parent received unknown command %u",
cmnd->command);
diff --git a/sysdeps/common/Makefile.am b/sysdeps/common/Makefile.am
index dc9a8f1a..924b5c09 100644
--- a/sysdeps/common/Makefile.am
+++ b/sysdeps/common/Makefile.am
@@ -8,7 +8,7 @@ CFLAGS = -Wall -W @CFLAGS@
lib_LTLIBRARIES = libgtop_common.la libgtop_suid_common.la
-libgtop_common_la_SOURCES = sysdeps.c xmalloc.c error.c gnuslib.c \
+libgtop_common_la_SOURCES = xmalloc.c error.c gnuslib.c \
fsusage.c fsusage.h mountlist.c mountlist.h
libgtop_suid_common_la_SOURCES = xmalloc.c error.c
diff --git a/sysdeps/common/mountlist.c b/sysdeps/common/mountlist.c
index 69768d10..b5f893fd 100644
--- a/sysdeps/common/mountlist.c
+++ b/sysdeps/common/mountlist.c
@@ -23,6 +23,8 @@
#include <sys/types.h>
#include "mountlist.h"
+static struct mount_entry *read_filesystem_list __P((int, int));
+
#ifdef STDC_HEADERS
#include <stdlib.h>
#else
@@ -36,6 +38,7 @@ void free ();
#include <glibtop.h>
#include <glibtop/xmalloc.h>
+#include <glibtop/mountlist.h>
#undef xmalloc
#undef xrealloc
@@ -255,7 +258,7 @@ fstype_to_string (t)
If ALL_FS is zero, do not return entries for filesystems that
are automounter (dummy) entries. */
-struct mount_entry *
+static struct mount_entry *
read_filesystem_list (need_fs_type, all_fs)
int need_fs_type, all_fs;
{
@@ -584,3 +587,61 @@ read_filesystem_list (need_fs_type, all_fs)
free (me);
return mount_list;
}
+
+glibtop_mountentry *
+glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf)
+{
+ struct mount_entry *me, *tmp, *next;
+ glibtop_mountentry *mount_list;
+ int count;
+
+ glibtop_init_r (&server, 0, 0);
+
+ memset (buf, 0, sizeof (glibtop_mountlist));
+
+ /* Read filesystem list. */
+
+ me = read_filesystem_list (1, 0);
+
+ if (me == NULL)
+ return NULL;
+
+ /* Count entries. */
+
+ for (count = 0, tmp = me; tmp; count++, tmp = tmp->me_next)
+ ;
+
+ buf->size = sizeof (glibtop_mountentry);
+ buf->number = count;
+
+ buf->total = buf->number * buf->size;
+
+ mount_list = glibtop_malloc_r (server, buf->total);
+
+ /* Write data into mount_list. */
+
+ for (count = 0, tmp = me; tmp; count++, tmp = tmp->me_next) {
+ strncpy (mount_list [count].devname, tmp->me_devname,
+ GLIBTOP_MOUNTENTRY_LEN);
+ strncpy (mount_list [count].mountdir, tmp->me_mountdir,
+ GLIBTOP_MOUNTENTRY_LEN);
+ strncpy (mount_list [count].type, tmp->me_type,
+ GLIBTOP_MOUNTENTRY_LEN);
+ mount_list [count].devname [GLIBTOP_MOUNTENTRY_LEN] = 0;
+ mount_list [count].mountdir [GLIBTOP_MOUNTENTRY_LEN] = 0;
+ mount_list [count].type [GLIBTOP_MOUNTENTRY_LEN] = 0;
+ mount_list [count].dev = tmp->me_dev;
+ }
+
+ /* Free memory. */
+
+ for (count = 0, tmp = me; tmp; count++, tmp = next) {
+ next = tmp->me_next;
+ xfree (tmp->me_devname);
+ xfree (tmp->me_mountdir);
+ xfree (tmp->me_type);
+ xfree (tmp);
+ }
+
+ return mount_list;
+}
diff --git a/sysdeps/common/mountlist.h b/sysdeps/common/mountlist.h
index 0a6e6d8b..8bc38f6a 100644
--- a/sysdeps/common/mountlist.h
+++ b/sysdeps/common/mountlist.h
@@ -25,8 +25,3 @@ struct mount_entry
struct mount_entry *me_next;
};
-#if __STDC__
-struct mount_entry *read_filesystem_list (int need_fs_type, int all_fs);
-#else
-struct mount_entry *read_filesystem_list ();
-#endif
diff --git a/sysdeps/names/sysdeps.c b/sysdeps/names/sysdeps.c
index cfd672b3..29c55c7a 100644
--- a/sysdeps/names/sysdeps.c
+++ b/sysdeps/names/sysdeps.c
@@ -26,7 +26,7 @@ const char *glibtop_names_sysdeps [GLIBTOP_MAX_SYSDEPS] =
"features", "cpu", "mem", "swap", "uptime", "loadavg",
"shm_limits", "msg_limits", "sem_limits", "proclist",
"proc_state", "proc_uid", "proc_mem", "proc_time",
- "proc_signal", "proc_kernel", "proc_segment"
+ "proc_signal", "proc_kernel", "proc_segment", "mountlist"
};
const unsigned glibtop_types_sysdeps [GLIBTOP_MAX_SYSDEPS] =
@@ -36,7 +36,7 @@ const unsigned glibtop_types_sysdeps [GLIBTOP_MAX_SYSDEPS] =
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
- GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
+ GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_sysdeps [GLIBTOP_MAX_SYSDEPS] =
@@ -57,7 +57,8 @@ const char *glibtop_labels_sysdeps [GLIBTOP_MAX_SYSDEPS] =
N_("Process Time information"),
N_("Process Signal information"),
N_("Process Kernel Data information"),
- N_("Process Segment information")
+ N_("Process Segment information"),
+ N_("Mount List")
};
const char *glibtop_descriptions_sysdeps [GLIBTOP_MAX_SYSDEPS] =
@@ -78,5 +79,6 @@ const char *glibtop_descriptions_sysdeps [GLIBTOP_MAX_SYSDEPS] =
N_("Process Time information"),
N_("Process Signal information"),
N_("Process Kernel Data information"),
- N_("Process Segment information")
+ N_("Process Segment information"),
+ N_("List of currently mounted filesystems"),
};