New file.
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'.
This commit is contained in:
committed by
Martin Baulig
parent
dd5c4a716b
commit
6bf243c901
@@ -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]'.
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
||||
|
68
include/glibtop/mountlist.h
Normal file
68
include/glibtop/mountlist.h
Normal file
@@ -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
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
20
lib/lib.awk
20
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 {";
|
||||
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 "\t}";
|
||||
print "}";
|
||||
print "";
|
||||
}
|
||||
|
||||
/^@(\w+)/ { output($1) }
|
||||
|
||||
/^(\w+)/ { output($1) }
|
||||
|
||||
|
||||
|
11
lib/open.c
11
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) {
|
||||
|
236
po/POTFILES.in
236
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/mem.h
|
||||
include/glibtop/open.h
|
||||
include/glibtop/sysdeps.h
|
||||
include/glibtop/union.h
|
||||
include/glibtop/read.h
|
||||
include/glibtop/swap.h
|
||||
include/glibtop/loadavg.h
|
||||
include/glibtop/mem.h
|
||||
include/glibtop/msg_limits.h
|
||||
include/glibtop/open.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/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/mem.c
|
||||
sysdeps/linux/open.c
|
||||
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/mem.c
|
||||
sysdeps/linux/procdata.c
|
||||
sysdeps/linux/open.c
|
||||
sysdeps/linux/prockernel.c
|
||||
sysdeps/linux/proclist.c
|
||||
sysdeps/stub/proclist.c
|
||||
sysdeps/stub/close.c
|
||||
sysdeps/stub/cpu.c
|
||||
sysdeps/stub/mem.c
|
||||
sysdeps/stub/open.c
|
||||
sysdeps/stub/swap.c
|
||||
sysdeps/stub/loadavg.c
|
||||
sysdeps/stub/uptime.c
|
||||
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/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/uptime.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/shm_limits.c
|
||||
sysdeps/names/msg_limits.c
|
||||
sysdeps/names/sem_limits.c
|
||||
sysdeps/names/proclist.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/glibtop_server.h
|
||||
sysdeps/stub/shm_limits.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
|
||||
|
@@ -1,4 +1,5 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
gnuserv
|
||||
libgtop_daemon
|
||||
server_config.h
|
||||
server.conf
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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"),
|
||||
};
|
||||
|
Reference in New Issue
Block a user