New static variable. (glibtop_get_fsusage_s): Return -1 on error;
1999-10-24 Martin Baulig <martin@home-of-linux.org> * fsusage.c (_glibtop_sysdeps_fsusage): New static variable. (glibtop_get_fsusage_s): Return -1 on error; otherwise set the features and return 0.
This commit is contained in:
committed by
Martin Baulig
parent
a5dd7e9063
commit
2dc529b19f
@@ -1,5 +1,9 @@
|
||||
1999-10-24 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* fsusage.c (_glibtop_sysdeps_fsusage): New static variable.
|
||||
(glibtop_get_fsusage_s): Return -1 on error; otherwise set the
|
||||
features and return 0.
|
||||
|
||||
* xmalloc.c: Use glib's malloc functions when compiled
|
||||
with LIBGTOP_USE_GLIB_MALLOC.
|
||||
|
||||
|
@@ -66,6 +66,11 @@ int statvfs ();
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/fsusage.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_fsusage =
|
||||
(1L << GLIBTOP_FSUSAGE_BLOCKS) + (1L << GLIBTOP_FSUSAGE_BFREE) +
|
||||
(1L << GLIBTOP_FSUSAGE_BAVAIL) + (1L << GLIBTOP_FSUSAGE_FILES) +
|
||||
(1L << GLIBTOP_FSUSAGE_FFREE);
|
||||
|
||||
static int
|
||||
get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp);
|
||||
|
||||
@@ -291,11 +296,15 @@ glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
|
||||
memset (buf, 0, sizeof (glibtop_fsusage));
|
||||
|
||||
if (get_fs_usage (disk, disk, &fsp))
|
||||
return;
|
||||
return -1;
|
||||
|
||||
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;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_fsusage;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user