**** Merged from HEAD ****

Use `(1L << feature)' instead of `(1 << feature)' to avoid problems
with integer overflows when we add more fields.
This commit is contained in:
Martin Baulig
1999-05-27 14:04:16 +00:00
parent 931b8f065e
commit a5bd38fc19
21 changed files with 106 additions and 106 deletions

View File

@@ -28,9 +28,9 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_cpu = static const unsigned long _glibtop_sysdeps_cpu =
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) + (1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY); (1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY);
/* nlist structure for kernel access */ /* nlist structure for kernel access */
static struct nlist nlst [] = { static struct nlist nlst [] = {
@@ -70,7 +70,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
struct clockinfo ci; struct clockinfo ci;
size_t length; size_t length;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
memset (buf, 0, sizeof (glibtop_cpu)); memset (buf, 0, sizeof (glibtop_cpu));

View File

@@ -28,7 +28,7 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_loadavg = static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG); (1L << GLIBTOP_LOADAVG_LOADAVG);
/* Init function. */ /* Init function. */
@@ -46,7 +46,7 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
double ldavg[3]; double ldavg[3];
int i; int i;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_LOADAVG), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0);
memset (buf, 0, sizeof (glibtop_loadavg)); memset (buf, 0, sizeof (glibtop_loadavg));

View File

@@ -32,14 +32,14 @@
#include <vm/vm_param.h> #include <vm/vm_param.h>
static const unsigned long _glibtop_sysdeps_mem = static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) + (1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_FREE) +
(1 << GLIBTOP_MEM_SHARED) + (1L << GLIBTOP_MEM_SHARED) +
(1 << GLIBTOP_MEM_BUFFER) + (1L << GLIBTOP_MEM_BUFFER) +
#ifdef __FreeBSD__ #ifdef __FreeBSD__
(1 << GLIBTOP_MEM_CACHED) + (1L << GLIBTOP_MEM_CACHED) +
#endif #endif
(1 << GLIBTOP_MEM_USER) + (1 << GLIBTOP_MEM_LOCKED); (1L << GLIBTOP_MEM_USER) + (1L << GLIBTOP_MEM_LOCKED);
#ifndef LOG1024 #ifndef LOG1024
#define LOG1024 10 #define LOG1024 10
@@ -109,7 +109,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
u_int v_total_count; u_int v_total_count;
int bufspace; int bufspace;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0);
memset (buf, 0, sizeof (glibtop_mem)); memset (buf, 0, sizeof (glibtop_mem));

View File

@@ -37,7 +37,7 @@ glibtop_init_msg_limits_p (glibtop *server)
void void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits)); memset (buf, 0, sizeof (glibtop_msg_limits));
} }
@@ -56,9 +56,9 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
#include <sys/msg.h> #include <sys/msg.h>
static const unsigned long _glibtop_sysdeps_msg_limits = static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNI) + (1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNI) +
(1 << GLIBTOP_IPC_MSGMNB) + (1 << GLIBTOP_IPC_MSGTQL) + (1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGTQL) +
(1 << GLIBTOP_IPC_MSGSSZ); (1L << GLIBTOP_IPC_MSGSSZ);
/* The values in this structure never change at runtime, so we only /* The values in this structure never change at runtime, so we only
* read it once during initialization. We have to use the name `_msginfo' * read it once during initialization. We have to use the name `_msginfo'
@@ -95,7 +95,7 @@ glibtop_init_msg_limits_p (glibtop *server)
void void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits)); memset (buf, 0, sizeof (glibtop_msg_limits));

View File

@@ -39,20 +39,20 @@
#include <netinet/in_var.h> #include <netinet/in_var.h>
static const unsigned long _glibtop_sysdeps_netload = static const unsigned long _glibtop_sysdeps_netload =
(1 << GLIBTOP_NETLOAD_IF_FLAGS) + (1L << GLIBTOP_NETLOAD_IF_FLAGS) +
(1 << GLIBTOP_NETLOAD_MTU) + (1L << GLIBTOP_NETLOAD_MTU) +
(1 << GLIBTOP_NETLOAD_SUBNET) + (1L << GLIBTOP_NETLOAD_SUBNET) +
(1 << GLIBTOP_NETLOAD_ADDRESS) + (1L << GLIBTOP_NETLOAD_ADDRESS) +
(1 << GLIBTOP_NETLOAD_PACKETS_IN) + (1L << GLIBTOP_NETLOAD_PACKETS_IN) +
(1 << GLIBTOP_NETLOAD_PACKETS_OUT) + (1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) + (1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1 << GLIBTOP_NETLOAD_BYTES_IN) + (1L << GLIBTOP_NETLOAD_BYTES_IN) +
(1 << GLIBTOP_NETLOAD_BYTES_OUT) + (1L << GLIBTOP_NETLOAD_BYTES_OUT) +
(1 << GLIBTOP_NETLOAD_BYTES_TOTAL) + (1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1 << GLIBTOP_NETLOAD_ERRORS_IN) + (1L << GLIBTOP_NETLOAD_ERRORS_IN) +
(1 << GLIBTOP_NETLOAD_ERRORS_OUT) + (1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
(1 << GLIBTOP_NETLOAD_ERRORS_TOTAL) + (1L << GLIBTOP_NETLOAD_ERRORS_TOTAL) +
(1 << GLIBTOP_NETLOAD_COLLISIONS); (1L << GLIBTOP_NETLOAD_COLLISIONS);
/* nlist structure for kernel access */ /* nlist structure for kernel access */
static struct nlist nlst [] = { static struct nlist nlst [] = {
@@ -87,7 +87,7 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
struct in_ifaddr in; struct in_ifaddr in;
} ifaddr; } ifaddr;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_NETLOAD), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_NETLOAD), 0);
memset (buf, 0, sizeof (glibtop_netload)); memset (buf, 0, sizeof (glibtop_netload));

View File

@@ -51,11 +51,11 @@
#endif #endif
static const unsigned long _glibtop_sysdeps_ppp = static const unsigned long _glibtop_sysdeps_ppp =
(1 << GLIBTOP_PPP_STATE); (1L << GLIBTOP_PPP_STATE);
#ifdef HAVE_I4B_ACCT #ifdef HAVE_I4B_ACCT
static const unsigned long _glibtop_sysdeps_ppp_acct = static const unsigned long _glibtop_sysdeps_ppp_acct =
(1 << GLIBTOP_PPP_BYTES_IN) + (1 << GLIBTOP_PPP_BYTES_OUT); (1L << GLIBTOP_PPP_BYTES_IN) + (1L << GLIBTOP_PPP_BYTES_OUT);
#endif #endif
#endif /* HAVE_I4B */ #endif /* HAVE_I4B */
@@ -99,7 +99,7 @@ glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
#endif #endif
int phase; int phase;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PPP), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PPP), 0);
memset (buf, 0, sizeof (glibtop_ppp)); memset (buf, 0, sizeof (glibtop_ppp));

View File

@@ -33,7 +33,7 @@
#include <sys/proc.h> #include <sys/proc.h>
static const unsigned long _glibtop_sysdeps_proc_args = static const unsigned long _glibtop_sysdeps_proc_args =
(1 << GLIBTOP_PROC_ARGS_SIZE); (1L << GLIBTOP_PROC_ARGS_SIZE);
/* Init function. */ /* Init function. */
@@ -59,7 +59,7 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
struct stat statb; struct stat statb;
#endif #endif
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_ARGS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
memset (buf, 0, sizeof (glibtop_proc_args)); memset (buf, 0, sizeof (glibtop_proc_args));

View File

@@ -28,7 +28,7 @@
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) #define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
#define BIT_SHIFT(x) (1 << (x % 32)) #define BIT_SHIFT(x) (1L << (x % 64))
static const unsigned long _glibtop_sysdeps_procdata_0 = static const unsigned long _glibtop_sysdeps_procdata_0 =
BIT_SHIFT(GLIBTOP_PROCDATA_CMD) + BIT_SHIFT(GLIBTOP_PROCDATA_CMD) +

View File

@@ -49,18 +49,18 @@
#endif #endif
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats = static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
(1 << GLIBTOP_PROC_KERNEL_MIN_FLT) + (1L << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) +
(1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) + (1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT); (1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT);
static const unsigned long _glibtop_sysdeps_proc_kernel_pcb = static const unsigned long _glibtop_sysdeps_proc_kernel_pcb =
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1L << GLIBTOP_PROC_KERNEL_KSTK_EIP) +
(1 << GLIBTOP_PROC_KERNEL_KSTK_ESP); (1L << GLIBTOP_PROC_KERNEL_KSTK_ESP);
static const unsigned long _glibtop_sysdeps_proc_kernel_wchan = static const unsigned long _glibtop_sysdeps_proc_kernel_wchan =
(1 << GLIBTOP_PROC_KERNEL_NWCHAN) + (1L << GLIBTOP_PROC_KERNEL_NWCHAN) +
(1 << GLIBTOP_PROC_KERNEL_WCHAN); (1L << GLIBTOP_PROC_KERNEL_WCHAN);
/* Init function. */ /* Init function. */
@@ -86,7 +86,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
char filename [BUFSIZ]; char filename [BUFSIZ];
struct stat statb; struct stat statb;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_KERNEL), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
memset (buf, 0, sizeof (glibtop_proc_kernel)); memset (buf, 0, sizeof (glibtop_proc_kernel));
@@ -102,13 +102,13 @@ glibtop_get_proc_kernel_p (glibtop *server,
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE; buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
buf->flags |= (1 << GLIBTOP_PROC_KERNEL_NWCHAN); buf->flags |= (1L << GLIBTOP_PROC_KERNEL_NWCHAN);
if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) { if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) {
strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg, strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg,
sizeof (buf->wchan) - 1); sizeof (buf->wchan) - 1);
buf->wchan [sizeof (buf->wchan) - 1] = 0; buf->wchan [sizeof (buf->wchan) - 1] = 0;
buf->flags |= (1 << GLIBTOP_PROC_KERNEL_WCHAN); buf->flags |= (1L << GLIBTOP_PROC_KERNEL_WCHAN);
} else { } else {
buf->wchan [0] = 0; buf->wchan [0] = 0;
} }

View File

@@ -29,8 +29,8 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proclist = static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) + (1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
(1 << GLIBTOP_PROCLIST_SIZE); (1L << GLIBTOP_PROCLIST_SIZE);
/* Fetch list of currently running processes. /* Fetch list of currently running processes.
* The interface of this function is a little bit different from the others: * The interface of this function is a little bit different from the others:
@@ -67,7 +67,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
int which, count; int which, count;
int i,j; int i,j;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROCLIST), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0);
memset (buf, 0, sizeof (glibtop_proclist)); memset (buf, 0, sizeof (glibtop_proclist));

View File

@@ -49,13 +49,13 @@
#include <vm/vm.h> #include <vm/vm.h>
static const unsigned long _glibtop_sysdeps_proc_map = static const unsigned long _glibtop_sysdeps_proc_map =
(1 << GLIBTOP_PROC_MAP_TOTAL) + (1 << GLIBTOP_PROC_MAP_NUMBER) + (1L << GLIBTOP_PROC_MAP_TOTAL) + (1L << GLIBTOP_PROC_MAP_NUMBER) +
(1 << GLIBTOP_PROC_MAP_SIZE); (1L << GLIBTOP_PROC_MAP_SIZE);
static const unsigned long _glibtop_sysdeps_map_entry = static const unsigned long _glibtop_sysdeps_map_entry =
(1 << GLIBTOP_MAP_ENTRY_START) + (1 << GLIBTOP_MAP_ENTRY_END) + (1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) +
(1 << GLIBTOP_MAP_ENTRY_OFFSET) + (1 << GLIBTOP_MAP_ENTRY_PERM) + (1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM) +
(1 << GLIBTOP_MAP_ENTRY_INODE) + (1 << GLIBTOP_MAP_ENTRY_DEVICE); (1L << GLIBTOP_MAP_ENTRY_INODE) + (1L << GLIBTOP_MAP_ENTRY_DEVICE);
/* Init function. */ /* Init function. */
@@ -82,7 +82,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
int count, i = 0; int count, i = 0;
int update = 0; int update = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MAP), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MAP), 0);
memset (buf, 0, sizeof (glibtop_proc_map)); memset (buf, 0, sizeof (glibtop_proc_map));

View File

@@ -46,12 +46,12 @@
#include <vm/vm.h> #include <vm/vm.h>
static const unsigned long _glibtop_sysdeps_proc_mem = static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_SIZE) +
(1 << GLIBTOP_PROC_MEM_VSIZE) + (1L << GLIBTOP_PROC_MEM_VSIZE) +
(1 << GLIBTOP_PROC_MEM_SHARE) + (1L << GLIBTOP_PROC_MEM_SHARE) +
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1 << GLIBTOP_PROC_MEM_RSS) + (1L << GLIBTOP_PROC_MEM_RSS) +
(1 << GLIBTOP_PROC_MEM_RSS_RLIM); (1L << GLIBTOP_PROC_MEM_RSS_RLIM);
#ifndef LOG1024 #ifndef LOG1024
#define LOG1024 10 #define LOG1024 10
@@ -98,7 +98,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
struct plimit plimit; struct plimit plimit;
int count; int count;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MEM), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
memset (buf, 0, sizeof (glibtop_proc_mem)); memset (buf, 0, sizeof (glibtop_proc_mem));

View File

@@ -48,7 +48,7 @@ glibtop_get_proc_segment_p (glibtop *server,
glibtop_proc_segment *buf, glibtop_proc_segment *buf,
pid_t pid) pid_t pid)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
memset (buf, 0, sizeof (glibtop_proc_segment)); memset (buf, 0, sizeof (glibtop_proc_segment));

View File

@@ -28,10 +28,10 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_signal = static const unsigned long _glibtop_sysdeps_proc_signal =
(1 << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1L << GLIBTOP_PROC_SIGNAL_SIGNAL) +
(1 << GLIBTOP_PROC_SIGNAL_BLOCKED) + (1L << GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1 << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) +
(1 << GLIBTOP_PROC_SIGNAL_SIGCATCH); (1L << GLIBTOP_PROC_SIGNAL_SIGCATCH);
/* Init function. */ /* Init function. */
@@ -49,7 +49,7 @@ glibtop_get_proc_signal_p (glibtop *server,
struct kinfo_proc *pinfo; struct kinfo_proc *pinfo;
int count = 0; int count = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
memset (buf, 0, sizeof (glibtop_proc_signal)); memset (buf, 0, sizeof (glibtop_proc_signal));

View File

@@ -33,8 +33,8 @@
#endif #endif
static const unsigned long _glibtop_sysdeps_proc_state = static const unsigned long _glibtop_sysdeps_proc_state =
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_UID) +
(1 << GLIBTOP_PROC_STATE_GID); (1L << GLIBTOP_PROC_STATE_GID);
/* Init function. */ /* Init function. */
@@ -54,7 +54,7 @@ glibtop_get_proc_state_p (glibtop *server,
struct kinfo_proc *pinfo; struct kinfo_proc *pinfo;
int count = 0; int count = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_STATE), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
memset (buf, 0, sizeof (glibtop_proc_state)); memset (buf, 0, sizeof (glibtop_proc_state));
@@ -97,5 +97,5 @@ glibtop_get_proc_state_p (glibtop *server,
return; return;
} }
buf->flags |= (1 << GLIBTOP_PROC_STATE_STATE); buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE);
} }

View File

@@ -32,11 +32,11 @@
#endif #endif
static const unsigned long _glibtop_sysdeps_proc_time = static const unsigned long _glibtop_sysdeps_proc_time =
(1 << GLIBTOP_PROC_TIME_RTIME) + (1 << GLIBTOP_PROC_TIME_FREQUENCY); (1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY);
static const unsigned long _glibtop_sysdeps_proc_time_user = static const unsigned long _glibtop_sysdeps_proc_time_user =
(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_STIME) + (1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_STIME) +
(1 << GLIBTOP_PROC_TIME_CUTIME) + (1 << GLIBTOP_PROC_TIME_CSTIME); (1L << GLIBTOP_PROC_TIME_CUTIME) + (1L << GLIBTOP_PROC_TIME_CSTIME);
#define tv2sec(tv) (((u_int64_t) tv.tv_sec * 1000000) + (u_int64_t) tv.tv_usec) #define tv2sec(tv) (((u_int64_t) tv.tv_sec * 1000000) + (u_int64_t) tv.tv_usec)
@@ -130,7 +130,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
char filename [BUFSIZ]; char filename [BUFSIZ];
struct stat statb; struct stat statb;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_TIME), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
memset (buf, 0, sizeof (glibtop_proc_time)); memset (buf, 0, sizeof (glibtop_proc_time));

View File

@@ -28,11 +28,11 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_uid = static const unsigned long _glibtop_sysdeps_proc_uid =
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) + (1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
(1 << GLIBTOP_PROC_UID_EGID) + (1 << GLIBTOP_PROC_UID_PID) + (1L << GLIBTOP_PROC_UID_EGID) + (1L << GLIBTOP_PROC_UID_PID) +
(1 << GLIBTOP_PROC_UID_PPID) + (1 << GLIBTOP_PROC_UID_PGRP) + (1L << GLIBTOP_PROC_UID_PPID) + (1L << GLIBTOP_PROC_UID_PGRP) +
(1 << GLIBTOP_PROC_UID_TPGID) + (1 << GLIBTOP_PROC_UID_PRIORITY) + (1L << GLIBTOP_PROC_UID_TPGID) + (1L << GLIBTOP_PROC_UID_PRIORITY) +
(1 << GLIBTOP_PROC_UID_NICE); (1L << GLIBTOP_PROC_UID_NICE);
/* Init function. */ /* Init function. */
@@ -51,7 +51,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
struct kinfo_proc *pinfo; struct kinfo_proc *pinfo;
int count = 0; int count = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_UID), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0);
memset (buf, 0, sizeof (glibtop_proc_uid)); memset (buf, 0, sizeof (glibtop_proc_uid));

View File

@@ -37,7 +37,7 @@ glibtop_init_sem_limits_p (glibtop *server)
void void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits)); memset (buf, 0, sizeof (glibtop_sem_limits));
} }
@@ -56,11 +56,11 @@ glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
#include <sys/sem.h> #include <sys/sem.h>
static unsigned long _glibtop_sysdeps_sem_limits = static unsigned long _glibtop_sysdeps_sem_limits =
(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) + (1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) +
(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) + (1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) +
(1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) + (1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) +
(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) + (1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) +
(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM); (1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM);
/* The values in this structure never change at runtime, so we only /* The values in this structure never change at runtime, so we only
* read it once during initialization. We have to use the name `_seminfo' * read it once during initialization. We have to use the name `_seminfo'
@@ -97,7 +97,7 @@ glibtop_init_sem_limits_p (glibtop *server)
void void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits)); memset (buf, 0, sizeof (glibtop_sem_limits));

View File

@@ -37,7 +37,7 @@ glibtop_init_shm_limits_p (glibtop *server)
void void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SHM_LIMITS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_shm_limits)); memset (buf, 0, sizeof (glibtop_shm_limits));
} }
@@ -56,9 +56,9 @@ glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
#include <sys/shm.h> #include <sys/shm.h>
static unsigned long _glibtop_sysdeps_shm_limits = static unsigned long _glibtop_sysdeps_shm_limits =
(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) + (1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) + (1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG) +
(1 << GLIBTOP_IPC_SHMALL); (1L << GLIBTOP_IPC_SHMALL);
/* The values in this structure never change at runtime, so we only /* The values in this structure never change at runtime, so we only
* read it once during initialization. We have to use the name `_shminfo' * read it once during initialization. We have to use the name `_shminfo'
@@ -95,7 +95,7 @@ glibtop_init_shm_limits_p (glibtop *server)
void void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
{ {
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SHM_LIMITS), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_shm_limits)); memset (buf, 0, sizeof (glibtop_shm_limits));

View File

@@ -30,9 +30,9 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_swap = static const unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) + (1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) + (1L << GLIBTOP_SWAP_FREE) + (1L << GLIBTOP_SWAP_PAGEIN) +
(1 << GLIBTOP_SWAP_PAGEOUT); (1L << GLIBTOP_SWAP_PAGEOUT);
#if defined(__FreeBSD__) || defined(__bsdi__) #if defined(__FreeBSD__) || defined(__bsdi__)
@@ -150,7 +150,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
static int swappgsin = -1; static int swappgsin = -1;
static int swappgsout = -1; static int swappgsout = -1;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SWAP), 0);
memset (buf, 0, sizeof (glibtop_swap)); memset (buf, 0, sizeof (glibtop_swap));

View File

@@ -30,11 +30,11 @@
#include <glibtop_suid.h> #include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_uptime = static const unsigned long _glibtop_sysdeps_uptime =
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); (1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME);
static const unsigned long _required_cpu_flags = static const unsigned long _required_cpu_flags =
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_IDLE) +
(1 << GLIBTOP_CPU_FREQUENCY); (1L << GLIBTOP_CPU_FREQUENCY);
/* Init function. */ /* Init function. */
@@ -51,7 +51,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
{ {
glibtop_cpu cpu; glibtop_cpu cpu;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_UPTIME), 0); glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
memset (buf, 0, sizeof (glibtop_uptime)); memset (buf, 0, sizeof (glibtop_uptime));