cast to prevent possible integer overflow in filesystem_usage

This commit is contained in:
Doug MacEachern 2006-05-31 00:59:14 +00:00
parent d1f6bb4ae5
commit 8355e44d8c
6 changed files with 6 additions and 6 deletions

View File

@ -1574,7 +1574,7 @@ int sigar_file_system_list_get(sigar_t *sigar,
/* XXX this is exactly the same as linux and hpux, solaris is darn close */ /* XXX this is exactly the same as linux and hpux, solaris is darn close */
#define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \ #define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \
((buf.f * (buf.f_bsize / 512)) >> 1) (((sigar_uint64_t)buf.f * (buf.f_bsize / 512)) >> 1)
#define LSPV_CMD "/usr/sbin/lspv" #define LSPV_CMD "/usr/sbin/lspv"

View File

@ -288,7 +288,7 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
} }
#define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \ #define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \
((buf.f * (buf.f_bsize / 512)) >> 1) (((sigar_uint64_t)buf.f * (buf.f_bsize / 512)) >> 1)
#define VM_DIR "/private/var/vm" #define VM_DIR "/private/var/vm"
#define SWAPFILE "swapfile" #define SWAPFILE "swapfile"

View File

@ -523,7 +523,7 @@ int sigar_file_system_list_get(sigar_t *sigar,
#include <sys/vfs.h> #include <sys/vfs.h>
#define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \ #define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \
((buf.f * (buf.f_bsize / 512)) >> 1) (((sigar_uint64_t)buf.f * (buf.f_bsize / 512)) >> 1)
#define FSDEV_ID(sb) (sb.st_ino + sb.st_dev) #define FSDEV_ID(sb) (sb.st_ino + sb.st_dev)

View File

@ -1343,7 +1343,7 @@ static int get_iostat_procp(sigar_t *sigar,
#include <sys/vfs.h> #include <sys/vfs.h>
#define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \ #define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \
((buf.f * (buf.f_bsize / 512)) >> 1) (((sigar_uint64_t)buf.f * (buf.f_bsize / 512)) >> 1)
int sigar_file_system_usage_get(sigar_t *sigar, int sigar_file_system_usage_get(sigar_t *sigar,
const char *dirname, const char *dirname,

View File

@ -446,7 +446,7 @@ int sigar_file_system_list_get(sigar_t *sigar,
} }
#define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \ #define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \
((buf.f * (buf.f_bsize / 512)) >> 1) (((sigar_uint64_t)buf.f * (buf.f_bsize / 512)) >> 1)
int sigar_file_system_usage_get(sigar_t *sigar, int sigar_file_system_usage_get(sigar_t *sigar,
const char *dirname, const char *dirname,

View File

@ -1241,7 +1241,7 @@ int sigar_file_system_list_get(sigar_t *sigar,
#include <sys/statvfs.h> #include <sys/statvfs.h>
#define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \ #define SIGAR_FS_BLOCKS_TO_BYTES(buf, f) \
((buf.f * (buf.f_frsize / 512)) >> 1) (((sigar_uint64_t)buf.f * (buf.f_frsize / 512)) >> 1)
typedef struct { typedef struct {
char device[PATH_MAX]; char device[PATH_MAX];