New file.
1998-07-22 Martin Baulig <martin@home-of-linux.org> * include/glibtop/fsusage.h: New file. * features.def: Added new feature `fsusage'. * sysdeps/common/fsusage.c (glibtop_get_fsusage_s): New function. (get_fs_usage): Declared as `static'. * sysdeps/names/fsusage.c: New file.
This commit is contained in:
committed by
Martin Baulig
parent
a90bffbbf6
commit
954a78f200
@@ -62,6 +62,13 @@ int statfs ();
|
||||
int statvfs ();
|
||||
#endif
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/fsusage.h>
|
||||
|
||||
static int get_fs_usage __P ((const char *, const char *,
|
||||
struct fs_usage *));
|
||||
|
||||
int safe_read ();
|
||||
|
||||
/* Return the number of TOSIZE-byte blocks used by
|
||||
@@ -93,7 +100,7 @@ adjust_blocks (blocks, fromsize, tosize)
|
||||
Return 0 if successful, -1 if not. When returning -1, ensure that
|
||||
ERRNO is either a system error value, or zero if DISK is NULL
|
||||
on a system that requires a non-NULL value. */
|
||||
int
|
||||
static int
|
||||
get_fs_usage (path, disk, fsp)
|
||||
const char *path;
|
||||
const char *disk;
|
||||
@@ -272,3 +279,23 @@ statfs (path, fsb)
|
||||
}
|
||||
|
||||
#endif /* _AIX && _I386 */
|
||||
|
||||
void
|
||||
glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
|
||||
const char *disk)
|
||||
{
|
||||
struct fs_usage fsp;
|
||||
|
||||
glibtop_init_r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_fsusage));
|
||||
|
||||
if (get_fs_usage (disk, disk, &fsp))
|
||||
return;
|
||||
|
||||
buf->blocks = fsp.fsu_blocks;
|
||||
buf->bfree = fsp.fsu_bfree;
|
||||
buf->bavail = fsp.fsu_bavail;
|
||||
buf->files = fsp.fsu_files;
|
||||
buf->ffree = fsp.fsu_ffree;
|
||||
}
|
||||
|
@@ -25,13 +25,3 @@ struct fs_usage
|
||||
long fsu_ffree; /* Free file nodes. */
|
||||
};
|
||||
|
||||
#ifndef __P
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
#define __P(args) args
|
||||
#else
|
||||
#define __P(args) ()
|
||||
#endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
|
||||
int get_fs_usage __P ((const char *path, const char *disk,
|
||||
struct fs_usage *fsp));
|
||||
|
@@ -30,6 +30,10 @@ BEGIN {
|
||||
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";
|
||||
@@ -77,6 +81,8 @@ END {
|
||||
for (feature in features) {
|
||||
if (feature ~ /^proc_/) {
|
||||
print "\tgh_new_procedure1_0";
|
||||
} else if (feature ~ /^fsusage$/) {
|
||||
print "\tgh_new_procedure1_0";
|
||||
} else {
|
||||
print "\tgh_new_procedure0_0";
|
||||
}
|
||||
|
@@ -12,5 +12,4 @@ 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
|
||||
|
||||
procsegment.c fsusage.c
|
||||
|
51
sysdeps/names/fsusage.c
Normal file
51
sysdeps/names/fsusage.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/* $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/fsusage.h>
|
||||
|
||||
const char *glibtop_names_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
||||
{
|
||||
"blocks", "bfree", "bavail", "files", "ffree"
|
||||
};
|
||||
|
||||
const unsigned glibtop_types_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
||||
{
|
||||
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
|
||||
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
|
||||
};
|
||||
|
||||
const char *glibtop_labels_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
||||
{
|
||||
N_("Total blocks"),
|
||||
N_("Free blocks"),
|
||||
N_("Available blocks"),
|
||||
N_("Total file nodes"),
|
||||
N_("Free file nodes")
|
||||
};
|
||||
|
||||
const char *glibtop_descriptions_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
||||
{
|
||||
N_("Total blocks"),
|
||||
N_("Free blocks available to the superuser"),
|
||||
N_("Free blocks available to non-superusers"),
|
||||
N_("Total file nodes"),
|
||||
N_("Free file nodes")
|
||||
};
|
@@ -26,7 +26,8 @@ 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", "mountlist"
|
||||
"proc_signal", "proc_kernel", "proc_segment", "mountlist",
|
||||
"fsusage"
|
||||
};
|
||||
|
||||
const unsigned glibtop_types_sysdeps [GLIBTOP_MAX_SYSDEPS] =
|
||||
@@ -36,7 +37,8 @@ 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, GLIBTOP_TYPE_ULONG,
|
||||
GLIBTOP_TYPE_ULONG
|
||||
};
|
||||
|
||||
const char *glibtop_labels_sysdeps [GLIBTOP_MAX_SYSDEPS] =
|
||||
@@ -58,7 +60,8 @@ const char *glibtop_labels_sysdeps [GLIBTOP_MAX_SYSDEPS] =
|
||||
N_("Process Signal information"),
|
||||
N_("Process Kernel Data information"),
|
||||
N_("Process Segment information"),
|
||||
N_("Mount List")
|
||||
N_("Mount List"),
|
||||
N_("File System Usage"),
|
||||
};
|
||||
|
||||
const char *glibtop_descriptions_sysdeps [GLIBTOP_MAX_SYSDEPS] =
|
||||
@@ -81,4 +84,5 @@ const char *glibtop_descriptions_sysdeps [GLIBTOP_MAX_SYSDEPS] =
|
||||
N_("Process Kernel Data information"),
|
||||
N_("Process Segment information"),
|
||||
N_("List of currently mounted filesystems"),
|
||||
N_("File System Usage"),
|
||||
};
|
||||
|
Reference in New Issue
Block a user