From d50e4efe42a1d7f9ee8c8f2f7679deb9ca8b5c16 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 14 Dec 2005 02:56:13 +0000 Subject: [PATCH] add dir_usage, recursive version of dir_stat --- include/sigar_fileinfo.h | 6 ++++++ src/sigar_fileinfo.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/include/sigar_fileinfo.h b/include/sigar_fileinfo.h index 4356b8ce..36623549 100644 --- a/include/sigar_fileinfo.h +++ b/include/sigar_fileinfo.h @@ -113,6 +113,8 @@ typedef struct { sigar_uint64_t disk_usage; } sigar_dir_stat_t; +typedef sigar_dir_stat_t sigar_dir_usage_t; + SIGAR_DECLARE(const char *) sigar_file_attrs_type_string_get(sigar_file_type_e type); @@ -133,3 +135,7 @@ sigar_file_attrs_permissions_string_get(sigar_uint64_t permissions, SIGAR_DECLARE(int) sigar_dir_stat_get(sigar_t *sigar, const char *dir, sigar_dir_stat_t *dirstats); + +SIGAR_DECLARE(int) sigar_dir_usage_get(sigar_t *sigar, + const char *dir, + sigar_dir_usage_t *dirusage); diff --git a/src/sigar_fileinfo.c b/src/sigar_fileinfo.c index b5e50a6c..b9934863 100644 --- a/src/sigar_fileinfo.c +++ b/src/sigar_fileinfo.c @@ -711,3 +711,11 @@ SIGAR_DECLARE(int) sigar_dir_stat_get(sigar_t *sigar, SIGAR_ZERO(dirstats); return dir_stat_get(sigar, dir, dirstats, 0); } + +SIGAR_DECLARE(int) sigar_dir_usage_get(sigar_t *sigar, + const char *dir, + sigar_dir_usage_t *dirusage) +{ + SIGAR_ZERO(dirusage); + return dir_stat_get(sigar, dir, dirusage, 1); +}