fix possible overflow
This commit is contained in:
parent
08d212ecf9
commit
1c8433cd7d
|
@ -114,7 +114,7 @@
|
||||||
((sigar_uint64_t)(s) * (sigar_uint64_t)SIGAR_NSEC)
|
((sigar_uint64_t)(s) * (sigar_uint64_t)SIGAR_NSEC)
|
||||||
|
|
||||||
/* cpu ticks to milliseconds */
|
/* cpu ticks to milliseconds */
|
||||||
#define SIGAR_TICK2MSEC(s) ((s) * (SIGAR_MSEC / sigar->ticks))
|
#define SIGAR_TICK2MSEC(s) ((sigar_uint64_t)(s) * ((sigar_uint64_t)SIGAR_MSEC / sigar->ticks))
|
||||||
#define SIGAR_TICK2NSEC(s) ((sigar_uint64_t)(s) * ((sigar_uint64_t)SIGAR_NSEC / sigar->ticks))
|
#define SIGAR_TICK2NSEC(s) ((sigar_uint64_t)(s) * ((sigar_uint64_t)SIGAR_NSEC / sigar->ticks))
|
||||||
|
|
||||||
#define IFTYPE_LO 2
|
#define IFTYPE_LO 2
|
||||||
|
|
|
@ -499,7 +499,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
int status;
|
int status;
|
||||||
long cp_time[CPUSTATES];
|
unsigned long cp_time[CPUSTATES];
|
||||||
size_t size = sizeof(cp_time);
|
size_t size = sizeof(cp_time);
|
||||||
|
|
||||||
/* try sysctl first, does not require /dev/kmem perms */
|
/* try sysctl first, does not require /dev/kmem perms */
|
||||||
|
|
Loading…
Reference in New Issue