if (SYSINFO_RET_OK != get_fs_size_stat(fsname.mpoint, &total, ¬_used, &used, &pfree, &pused,&error))
static int get_fs_size_stat(const char *fs, zbx_uint64_t *total, zbx_uint64_t *free,
zbx_uint64_t *used, double *pfree, double *pused, char **error)
#ifdef HAVE_SYS_STATVFS_H
# ifdef HAVE_SYS_STATVFS64
# define ZBX_STATFS statvfs64
# define ZBX_STATFS statvfs
# define ZBX_BSIZE f_frsize
# define ZBX_STATFS statfs
# define ZBX_BSIZE f_bsize
if (0 != ZBX_STATFS(fs, &s))
*error = zbx_dsprintf(NULL, "Cannot obtain filesystem information: %s", zbx_strerror(errno));
zabbix_log(LOG_LEVEL_DEBUG,"%s failed with error: %s",__func__, *error);
if (0 != ZBX_IS_TOP_BIT_SET(s.f_bavail))
*total = (zbx_uint64_t)s.f_blocks * s.ZBX_BSIZE;
*free = (zbx_uint64_t)s.f_bavail * s.ZBX_BSIZE;
*used = (zbx_uint64_t)(s.f_blocks - s.f_bfree) * s.ZBX_BSIZE;
if (0 != s.f_blocks - s.f_bfree + s.f_bavail)
*pfree = (double)(100.0 * s.f_bavail) / (s.f_blocks - s.f_bfree + s.f_bavail);
if (0 != s.f_blocks - s.f_bfree + s.f_bavail)
*pused = 100.0 - (double)(100.0 * s.f_bavail) / (s.f_blocks - s.f_bfree + s.f_bavail);
static int vfs_fs_used(const char *fs, AGENT_RESULT *result)
if (SYSINFO_RET_OK != get_fs_size_stat(fs, NULL, NULL, &value, NULL, NULL, &error))
SET_MSG_RESULT(result, error);