Added `all_fs' parameter.

1998-07-24  Martin Baulig  <martin@home-of-linux.org>

	* sysdeps/common/mountlist.c (glibtop_get_mountlist_s):
	Added `all_fs' parameter.
This commit is contained in:
Martin Baulig
1998-07-24 14:43:16 +00:00
committed by Martin Baulig
parent f3f051ecba
commit aa6d16e47b
7 changed files with 23 additions and 11 deletions

View File

@@ -1,5 +1,8 @@
1998-07-24 Martin Baulig <martin@home-of-linux.org>
* sysdeps/common/mountlist.c (glibtop_get_mountlist_s):
Added `all_fs' parameter.
* sysdeps/{kernel, linux}/*.c: Replaced `glibtop_init_r' with
`glibtop_init_s'.

View File

@@ -69,14 +69,14 @@ main (int argc, char *argv [])
printf ("sbrk (0) = %p\n\n", sbrk (0));
for (c = 0; c < PROFILE_COUNT; c++) {
mount_entries = glibtop_get_mountlist (&mount_list);
mount_entries = glibtop_get_mountlist (&mount_list, 1);
glibtop_free (mount_entries);
}
printf ("sbrk (0) = %p\n\n", sbrk (0));
mount_entries = glibtop_get_mountlist (&mount_list);
mount_entries = glibtop_get_mountlist (&mount_list, 1);
if (mount_entries == NULL)
_exit (1);

View File

@@ -6,4 +6,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
procmem.h procuid.h swap.h write.h error.h open.h \
procsegment.h read.h sysdeps.h xmalloc.h global.h \
output.h procsignal.h read_data.h union.h types.h \
parameter.h
parameter.h mountlist.h fsusage.h

View File

@@ -55,13 +55,13 @@ struct _glibtop_mountlist
size; /* GLIBTOP_MOUNTLIST_SIZE */
};
#define glibtop_get_mountlist(mountlist) glibtop_get_mountlist_l(glibtop_global_server, mountlist)
#define glibtop_get_mountlist(mountlist,all_fs) glibtop_get_mountlist_l(glibtop_global_server, mountlist, all_fs)
#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_l __P((glibtop *, glibtop_mountlist *, int));
extern glibtop_mountentry *glibtop_get_mountlist_s __P((glibtop *, glibtop_mountlist *));
extern glibtop_mountentry *glibtop_get_mountlist_s __P((glibtop *, glibtop_mountlist *, int));
__END_DECLS

View File

@@ -28,6 +28,8 @@ function output(feature) {
param = ", pid_t pid";
} else if (feature ~ /^fsusage$/) {
param = ", const char *mountdir";
} else if (feature ~ /^mountlist$/) {
param = ", int all_fs";
} else {
param = "";
}
@@ -58,7 +60,8 @@ function output(feature) {
} else {
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 sizeof (all_fs), &all_fs,";
print "\t\t\t\t sizeof (glibtop_mountlist),";
print "\t\t\t\t buf);";
} else if (feature ~ /^proclist$/) {
print "\t\treturn glibtop_call_l (server, GLIBTOP_CMND_PROCLIST,";
@@ -70,7 +73,11 @@ function output(feature) {
}
print "\t} else {";
if (orig ~ /^@/) {
if (feature ~ /^mountlist$/) {
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf, all_fs);";
} else {
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);";

View File

@@ -29,6 +29,7 @@ handle_parent_connection (int s)
glibtop_command _cmnd, *cmnd = &_cmnd;
glibtop_mountentry *mount_list;
char parameter [BUFSIZ];
int all_fs;
pid_t pid;
void *ptr;
@@ -160,8 +161,9 @@ handle_parent_connection (int s)
do_output (s, resp, _offset_data (proc_segment), 0, NULL);
break;
case GLIBTOP_CMND_MOUNTLIST:
memcpy (&all_fs, parameter, sizeof (all_fs));
mount_list = glibtop_get_mountlist_l
(server, &resp->u.data.mountlist);
(server, &resp->u.data.mountlist, all_fs);
do_output (s, resp, _offset_data (mountlist),
resp->u.data.mountlist.total, mount_list);
glibtop_free_r (server, mount_list);

View File

@@ -589,7 +589,7 @@ read_filesystem_list (need_fs_type, all_fs)
}
glibtop_mountentry *
glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf)
glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
{
struct mount_entry *me, *tmp, *next;
glibtop_mountentry *mount_list;
@@ -601,7 +601,7 @@ glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf)
/* Read filesystem list. */
me = read_filesystem_list (1, 0);
me = read_filesystem_list (1, all_fs);
if (me == NULL)
return NULL;