diff options
author | Martin Baulig <martin@src.gnome.org> | 1999-05-06 21:35:36 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1999-05-06 21:35:36 +0000 |
commit | 6120c5e4a8ce2b53d19650e0d545d5ee49676ada (patch) | |
tree | 930bf82bf67a870d1507e5a0b68621bbb2ccb8e7 /sysdeps/sun4 | |
parent | b252a80b7ed8954beeb28c0be3df20bdd83015e5 (diff) | |
download | libgtop-6120c5e4a8ce2b53d19650e0d545d5ee49676ada.tar.gz |
Use `(1L << feature)' instead of `(1 << feature)' to avoid problems
with integer overflows when we add more fields.
Diffstat (limited to 'sysdeps/sun4')
-rw-r--r-- | sysdeps/sun4/cpu.c | 8 | ||||
-rw-r--r-- | sysdeps/sun4/loadavg.c | 4 | ||||
-rw-r--r-- | sysdeps/sun4/mem.c | 6 | ||||
-rw-r--r-- | sysdeps/sun4/msg_limits.c | 8 | ||||
-rw-r--r-- | sysdeps/sun4/prockernel.c | 4 | ||||
-rw-r--r-- | sysdeps/sun4/proclist.c | 6 | ||||
-rw-r--r-- | sysdeps/sun4/procmem.c | 6 | ||||
-rw-r--r-- | sysdeps/sun4/procsegment.c | 6 | ||||
-rw-r--r-- | sysdeps/sun4/procsignal.c | 6 | ||||
-rw-r--r-- | sysdeps/sun4/procstate.c | 4 | ||||
-rw-r--r-- | sysdeps/sun4/proctime.c | 4 | ||||
-rw-r--r-- | sysdeps/sun4/procuid.c | 12 | ||||
-rw-r--r-- | sysdeps/sun4/sem_limits.c | 12 | ||||
-rw-r--r-- | sysdeps/sun4/shm_limits.c | 8 | ||||
-rw-r--r-- | sysdeps/sun4/swap.c | 2 | ||||
-rw-r--r-- | sysdeps/sun4/uptime.c | 10 |
16 files changed, 53 insertions, 53 deletions
diff --git a/sysdeps/sun4/cpu.c b/sysdeps/sun4/cpu.c index 9c27e538..a0f40b1e 100644 --- a/sysdeps/sun4/cpu.c +++ b/sysdeps/sun4/cpu.c @@ -27,9 +27,9 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_cpu = -(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) + -(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) + -(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY); +(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) + +(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) + +(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY); /* Provides information about cpu usage. */ @@ -39,7 +39,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) long cp_time [CPUSTATES], mp_time [NCPU][CPUSTATES]; int i; - glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0); + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0); memset (buf, 0, sizeof (glibtop_cpu)); diff --git a/sysdeps/sun4/loadavg.c b/sysdeps/sun4/loadavg.c index 530efb9a..6b36e9eb 100644 --- a/sysdeps/sun4/loadavg.c +++ b/sysdeps/sun4/loadavg.c @@ -27,7 +27,7 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_loadavg = -(1 << GLIBTOP_LOADAVG_LOADAVG); +(1L << GLIBTOP_LOADAVG_LOADAVG); /* Provides load averange. */ @@ -37,7 +37,7 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf) load_avg avenrun [3]; 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)); diff --git a/sysdeps/sun4/mem.c b/sysdeps/sun4/mem.c index 6bbac96b..b83b8200 100644 --- a/sysdeps/sun4/mem.c +++ b/sysdeps/sun4/mem.c @@ -27,8 +27,8 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_mem = -(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) + -(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_LOCKED); +(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) + +(1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_LOCKED); /* define pagetok in terms of pageshift */ @@ -39,7 +39,7 @@ static const unsigned long _glibtop_sysdeps_mem = void glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) { - glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0); + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0); memset (buf, 0, sizeof (glibtop_mem)); diff --git a/sysdeps/sun4/msg_limits.c b/sysdeps/sun4/msg_limits.c index 7a01740c..6af95b6b 100644 --- a/sysdeps/sun4/msg_limits.c +++ b/sysdeps/sun4/msg_limits.c @@ -34,9 +34,9 @@ #include <sys/msg.h> static const unsigned long _glibtop_sysdeps_msg_limits = -(1 << GLIBTOP_IPC_MSGMAP) + (1 << GLIBTOP_IPC_MSGMAX) + -(1 << GLIBTOP_IPC_MSGMNB) + (1 << GLIBTOP_IPC_MSGMNI) + -(1 << GLIBTOP_IPC_MSGSSZ) + (1 << GLIBTOP_IPC_MSGTQL); +(1L << GLIBTOP_IPC_MSGMAP) + (1L << GLIBTOP_IPC_MSGMAX) + +(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) + +(1L << GLIBTOP_IPC_MSGSSZ) + (1L << GLIBTOP_IPC_MSGTQL); /* Provides information about sysv ipc limits. */ @@ -45,7 +45,7 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) { struct msginfo msginfo; - 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)); diff --git a/sysdeps/sun4/prockernel.c b/sysdeps/sun4/prockernel.c index 603e881b..1b350d8a 100644 --- a/sysdeps/sun4/prockernel.c +++ b/sysdeps/sun4/prockernel.c @@ -27,7 +27,7 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_kernel = -(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_WCHAN); +(1L << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1L << GLIBTOP_PROC_KERNEL_WCHAN); /* Provides detailed information about a process. */ @@ -37,7 +37,7 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/proclist.c b/sysdeps/sun4/proclist.c index 4b6fc42e..cca310ec 100644 --- a/sysdeps/sun4/proclist.c +++ b/sysdeps/sun4/proclist.c @@ -28,8 +28,8 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proclist = -(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) + -(1 << GLIBTOP_PROCLIST_SIZE); +(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) + +(1L << GLIBTOP_PROCLIST_SIZE); /* Fetch list of currently running processes. * @@ -47,7 +47,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, unsigned *proc_list = NULL; size_t proc_size; - glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROCLIST), 0); + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0); memset (buf, 0, sizeof (glibtop_proclist)); diff --git a/sysdeps/sun4/procmem.c b/sysdeps/sun4/procmem.c index 979fc7af..d9fa2233 100644 --- a/sysdeps/sun4/procmem.c +++ b/sysdeps/sun4/procmem.c @@ -27,8 +27,8 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_mem = -(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_RSS) + -(1 << GLIBTOP_PROC_MEM_RSS_RLIM); +(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RSS) + +(1L << GLIBTOP_PROC_MEM_RSS_RLIM); /* Provides detailed information about a process. */ @@ -38,7 +38,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/procsegment.c b/sysdeps/sun4/procsegment.c index 8dd64bea..a0a91c6d 100644 --- a/sysdeps/sun4/procsegment.c +++ b/sysdeps/sun4/procsegment.c @@ -27,8 +27,8 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_segment = -(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + -(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS); +(1L << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + +(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS); /* Provides detailed information about a process. */ @@ -38,7 +38,7 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/procsignal.c b/sysdeps/sun4/procsignal.c index 66a5a2bc..3aa48cc2 100644 --- a/sysdeps/sun4/procsignal.c +++ b/sysdeps/sun4/procsignal.c @@ -27,8 +27,8 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_signal = -(1 << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 << GLIBTOP_PROC_SIGNAL_BLOCKED) + -(1 << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 << GLIBTOP_PROC_SIGNAL_SIGCATCH); +(1L << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1L << GLIBTOP_PROC_SIGNAL_BLOCKED) + +(1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1L << GLIBTOP_PROC_SIGNAL_SIGCATCH); /* Provides detailed information about a process. */ @@ -38,7 +38,7 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/procstate.c b/sysdeps/sun4/procstate.c index 4ce3734d..5e8bcdaa 100644 --- a/sysdeps/sun4/procstate.c +++ b/sysdeps/sun4/procstate.c @@ -27,7 +27,7 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_state = -(1 << GLIBTOP_PROC_STATE_STATE) + (1 << GLIBTOP_PROC_STATE_UID); +(1L << GLIBTOP_PROC_STATE_STATE) + (1L << GLIBTOP_PROC_STATE_UID); /* Provides detailed information about a process. */ @@ -37,7 +37,7 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/proctime.c b/sysdeps/sun4/proctime.c index 9541f948..e2a77689 100644 --- a/sysdeps/sun4/proctime.c +++ b/sysdeps/sun4/proctime.c @@ -27,7 +27,7 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_time = -(1 << GLIBTOP_PROC_TIME_START_TIME) + (1 << GLIBTOP_PROC_TIME_UTIME); +(1L << GLIBTOP_PROC_TIME_START_TIME) + (1L << GLIBTOP_PROC_TIME_UTIME); /* Provides detailed information about a process. */ @@ -37,7 +37,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/procuid.c b/sysdeps/sun4/procuid.c index 5ff0e5bf..fd0e3af7 100644 --- a/sysdeps/sun4/procuid.c +++ b/sysdeps/sun4/procuid.c @@ -27,11 +27,11 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_proc_uid = -(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) + -(1 << GLIBTOP_PROC_UID_EGID) + (1 << GLIBTOP_PROC_UID_PID) + -(1 << GLIBTOP_PROC_UID_PPID) + (1 << GLIBTOP_PROC_UID_PGRP) + -(1 << GLIBTOP_PROC_UID_TPGID) + (1 << GLIBTOP_PROC_UID_PRIORITY) + -(1 << GLIBTOP_PROC_UID_NICE); +(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) + +(1L << GLIBTOP_PROC_UID_EGID) + (1L << GLIBTOP_PROC_UID_PID) + +(1L << GLIBTOP_PROC_UID_PPID) + (1L << GLIBTOP_PROC_UID_PGRP) + +(1L << GLIBTOP_PROC_UID_TPGID) + (1L << GLIBTOP_PROC_UID_PRIORITY) + +(1L << GLIBTOP_PROC_UID_NICE); /* Provides detailed information about a process. */ @@ -41,7 +41,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, { struct proc *pp; - 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)); diff --git a/sysdeps/sun4/sem_limits.c b/sysdeps/sun4/sem_limits.c index e6f07c6c..7c4825c6 100644 --- a/sysdeps/sun4/sem_limits.c +++ b/sysdeps/sun4/sem_limits.c @@ -34,11 +34,11 @@ #include <sys/sem.h> static unsigned long _glibtop_sysdeps_sem_limits = -(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) + -(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) + -(1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) + -(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) + -(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM); +(1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) + +(1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) + +(1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) + +(1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) + +(1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM); /* Provides information about sysv sem limits. */ @@ -47,7 +47,7 @@ glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) { struct seminfo seminfo; - 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)); diff --git a/sysdeps/sun4/shm_limits.c b/sysdeps/sun4/shm_limits.c index a5f638f2..fe622242 100644 --- a/sysdeps/sun4/shm_limits.c +++ b/sysdeps/sun4/shm_limits.c @@ -34,9 +34,9 @@ #include <sys/shm.h> static unsigned long _glibtop_sysdeps_shm_limits = -(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) + -(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) + -(1 << GLIBTOP_IPC_SHMALL); +(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) + +(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG) + +(1L << GLIBTOP_IPC_SHMALL); /* Provides information about sysv ipc limits. */ @@ -45,7 +45,7 @@ glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) { struct shminfo shminfo; - 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)); diff --git a/sysdeps/sun4/swap.c b/sysdeps/sun4/swap.c index 3c93e3a7..fd90ad15 100644 --- a/sysdeps/sun4/swap.c +++ b/sysdeps/sun4/swap.c @@ -31,7 +31,7 @@ void glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) { - glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0); + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SWAP), 0); memset (buf, 0, sizeof (glibtop_swap)); } diff --git a/sysdeps/sun4/uptime.c b/sysdeps/sun4/uptime.c index 023cf3f3..2b89afcc 100644 --- a/sysdeps/sun4/uptime.c +++ b/sysdeps/sun4/uptime.c @@ -28,7 +28,7 @@ #include <glibtop_suid.h> static const unsigned long _glibtop_sysdeps_uptime = -(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); +(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME); /* Provides uptime and idle time. */ @@ -37,7 +37,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) { glibtop_cpu cpu; - glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_UPTIME), 0); + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0); /* Get currect cpu usage. */ @@ -45,9 +45,9 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) /* Make sure all required fields are present. */ - if (((cpu.flags & (1 << GLIBTOP_CPU_TOTAL)) == 0) || - ((cpu.flags & (1 << GLIBTOP_CPU_IDLE)) == 0) || - ((cpu.flags & (1 << GLIBTOP_CPU_FREQUENCY)) == 0) || + if (((cpu.flags & (1L << GLIBTOP_CPU_TOTAL)) == 0) || + ((cpu.flags & (1L << GLIBTOP_CPU_IDLE)) == 0) || + ((cpu.flags & (1L << GLIBTOP_CPU_FREQUENCY)) == 0) || (cpu.frequency == 0)) return; |