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); +}