From dff497d2fa2168bdc1f02db5436ca28eba741cd5 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Thu, 27 May 1999 19:30:30 +0000 Subject: [PATCH] **** Merged from HEAD **** Use `(1L << feature)' instead of `(1 << feature)' to avoid problems with integer overflows when we add more fields. --- sysdeps/linux/cpu.c | 12 ++--- sysdeps/linux/loadavg.c | 8 ++-- sysdeps/linux/mem.c | 8 ++-- sysdeps/linux/msg_limits.c | 8 ++-- sysdeps/linux/netload.c | 72 +++++++++++++++--------------- sysdeps/linux/ppp.c | 10 ++--- sysdeps/linux/procargs.c | 2 +- sysdeps/linux/prockernel.c | 8 ++-- sysdeps/linux/proclist.c | 18 ++++---- sysdeps/linux/procmap.c | 12 ++--- sysdeps/linux/procmem.c | 8 ++-- sysdeps/linux/procsegment.c | 14 +++--- sysdeps/linux/procsignal.c | 4 +- sysdeps/linux/procstate.c | 4 +- sysdeps/linux/proctime.c | 12 ++--- sysdeps/linux/procuid.c | 12 ++--- sysdeps/linux/sem_limits.c | 10 ++--- sysdeps/linux/shm_limits.c | 6 +-- sysdeps/linux/swap.c | 6 +-- sysdeps/linux/sysinfo.c | 2 +- sysdeps/linux/uptime.c | 2 +- sysdeps/osf1/ChangeLog | 5 +++ sysdeps/osf1/cpu.c | 6 +-- sysdeps/osf1/loadavg.c | 2 +- sysdeps/osf1/mem.c | 4 +- sysdeps/osf1/msg_limits.c | 14 +++--- sysdeps/osf1/procdata.c | 2 +- sysdeps/osf1/proclist.c | 4 +- sysdeps/osf1/procmem.c | 8 ++-- sysdeps/osf1/procsegment.c | 10 ++--- sysdeps/osf1/procsignal.c | 4 +- sysdeps/osf1/procstate.c | 89 ++++++++++++++++++++++++++++++++++--- sysdeps/osf1/proctime.c | 6 +-- sysdeps/osf1/procuid.c | 14 +++--- sysdeps/osf1/sem_limits.c | 18 ++++---- sysdeps/osf1/shm_limits.c | 12 ++--- sysdeps/osf1/swap.c | 4 +- sysdeps/osf1/uptime.c | 2 +- 38 files changed, 262 insertions(+), 180 deletions(-) diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c index 63ae5085..a362dc0f 100644 --- a/sysdeps/linux/cpu.c +++ b/sysdeps/linux/cpu.c @@ -26,14 +26,14 @@ #include 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); static const unsigned long _glibtop_sysdeps_cpu_smp = -(1 << GLIBTOP_XCPU_TOTAL) + (1 << GLIBTOP_XCPU_USER) + -(1 << GLIBTOP_XCPU_NICE) + (1 << GLIBTOP_XCPU_SYS) + -(1 << GLIBTOP_XCPU_IDLE); +(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) + +(1L << GLIBTOP_XCPU_NICE) + (1L << GLIBTOP_XCPU_SYS) + +(1L << GLIBTOP_XCPU_IDLE); /* Init function. */ diff --git a/sysdeps/linux/loadavg.c b/sysdeps/linux/loadavg.c index 30ab8c75..aedff8ca 100644 --- a/sysdeps/linux/loadavg.c +++ b/sysdeps/linux/loadavg.c @@ -26,12 +26,12 @@ #include static const unsigned long _glibtop_sysdeps_loadavg = -(1 << GLIBTOP_LOADAVG_LOADAVG); +(1L << GLIBTOP_LOADAVG_LOADAVG); static const unsigned long _glibtop_sysdeps_loadavg_tasks = -(1 << GLIBTOP_LOADAVG_NR_RUNNING) + -(1 << GLIBTOP_LOADAVG_NR_TASKS) + -(1 << GLIBTOP_LOADAVG_LAST_PID); +(1L << GLIBTOP_LOADAVG_NR_RUNNING) + +(1L << GLIBTOP_LOADAVG_NR_TASKS) + +(1L << GLIBTOP_LOADAVG_LAST_PID); /* Init function. */ diff --git a/sysdeps/linux/mem.c b/sysdeps/linux/mem.c index 7ed10f4a..732dbe51 100644 --- a/sysdeps/linux/mem.c +++ b/sysdeps/linux/mem.c @@ -26,10 +26,10 @@ #include static const unsigned long _glibtop_sysdeps_mem = -(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) + -(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_SHARED) + -(1 << GLIBTOP_MEM_BUFFER) + (1 << GLIBTOP_MEM_CACHED) + -(1 << GLIBTOP_MEM_USER); +(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) + +(1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_SHARED) + +(1L << GLIBTOP_MEM_BUFFER) + (1L << GLIBTOP_MEM_CACHED) + +(1L << GLIBTOP_MEM_USER); /* Init function. */ diff --git a/sysdeps/linux/msg_limits.c b/sysdeps/linux/msg_limits.c index 2ebd1b05..81d19c1f 100644 --- a/sysdeps/linux/msg_limits.c +++ b/sysdeps/linux/msg_limits.c @@ -27,10 +27,10 @@ #include static const unsigned long _glibtop_sysdeps_msg_limits = -(1 << GLIBTOP_IPC_MSGPOOL) + (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_MSGPOOL) + (1L << GLIBTOP_IPC_MSGMAP) + +(1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNB) + +(1L << GLIBTOP_IPC_MSGMNI) + (1L << GLIBTOP_IPC_MSGSSZ) + +(1L << GLIBTOP_IPC_MSGTQL); /* Init function. */ diff --git a/sysdeps/linux/netload.c b/sysdeps/linux/netload.c index b5b2fbdd..feff1815 100644 --- a/sysdeps/linux/netload.c +++ b/sysdeps/linux/netload.c @@ -51,40 +51,40 @@ #define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing packets only. */ static const unsigned long _glibtop_sysdeps_netload = -(1 << GLIBTOP_NETLOAD_ERRORS_IN) + -(1 << GLIBTOP_NETLOAD_ERRORS_OUT) + -(1 << GLIBTOP_NETLOAD_COLLISIONS); +(1L << GLIBTOP_NETLOAD_ERRORS_IN) + +(1L << GLIBTOP_NETLOAD_ERRORS_OUT) + +(1L << GLIBTOP_NETLOAD_COLLISIONS); static const unsigned long _glibtop_sysdeps_netload_data = -(1 << GLIBTOP_NETLOAD_ADDRESS) + -(1 << GLIBTOP_NETLOAD_SUBNET) + -(1 << GLIBTOP_NETLOAD_MTU); +(1L << GLIBTOP_NETLOAD_ADDRESS) + +(1L << GLIBTOP_NETLOAD_SUBNET) + +(1L << GLIBTOP_NETLOAD_MTU); static const unsigned long _glibtop_sysdeps_netload_bytes = -(1 << GLIBTOP_NETLOAD_BYTES_IN) + -(1 << GLIBTOP_NETLOAD_BYTES_OUT) + -(1 << GLIBTOP_NETLOAD_BYTES_TOTAL); +(1L << GLIBTOP_NETLOAD_BYTES_IN) + +(1L << GLIBTOP_NETLOAD_BYTES_OUT) + +(1L << GLIBTOP_NETLOAD_BYTES_TOTAL); static const unsigned long _glibtop_sysdeps_netload_packets = -(1 << GLIBTOP_NETLOAD_PACKETS_IN) + -(1 << GLIBTOP_NETLOAD_PACKETS_OUT) + -(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL); +(1L << GLIBTOP_NETLOAD_PACKETS_IN) + +(1L << GLIBTOP_NETLOAD_PACKETS_OUT) + +(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL); static const unsigned long _glibtop_sysdeps_netload_total = -(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) + -(1 << GLIBTOP_NETLOAD_BYTES_TOTAL); +(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + +(1L << GLIBTOP_NETLOAD_BYTES_TOTAL); static const unsigned long _glibtop_sysdeps_netload_in = -(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) + -(1 << GLIBTOP_NETLOAD_BYTES_TOTAL) + -(1 << GLIBTOP_NETLOAD_PACKETS_IN) + -(1 << GLIBTOP_NETLOAD_BYTES_IN); +(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + +(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) + +(1L << GLIBTOP_NETLOAD_PACKETS_IN) + +(1L << GLIBTOP_NETLOAD_BYTES_IN); static const unsigned long _glibtop_sysdeps_netload_out = -(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) + -(1 << GLIBTOP_NETLOAD_BYTES_TOTAL) + -(1 << GLIBTOP_NETLOAD_PACKETS_OUT) + -(1 << GLIBTOP_NETLOAD_BYTES_OUT); +(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + +(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) + +(1L << GLIBTOP_NETLOAD_PACKETS_OUT) + +(1L << GLIBTOP_NETLOAD_BYTES_OUT); /* Init function. */ @@ -118,47 +118,47 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, strcpy (ifr.ifr_name, interface); if (!ioctl (skfd, SIOCGIFFLAGS, &ifr)) { - buf->flags |= (1 << GLIBTOP_NETLOAD_IF_FLAGS); + buf->flags |= (1L << GLIBTOP_NETLOAD_IF_FLAGS); flags = ifr.ifr_flags; } else flags = 0; if (flags & IFF_UP) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_UP); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP); if (flags & IFF_BROADCAST) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_BROADCAST); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST); if (flags & IFF_DEBUG) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_DEBUG); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG); if (flags & IFF_LOOPBACK) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LOOPBACK); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK); if (flags & IFF_POINTOPOINT) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_POINTOPOINT); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT); if (flags & IFF_RUNNING) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_RUNNING); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING); if (flags & IFF_NOARP) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_NOARP); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP); if (flags & IFF_PROMISC) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_PROMISC); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC); if (flags & IFF_ALLMULTI) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_ALLMULTI); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI); if (flags & IFF_MULTICAST) - buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_MULTICAST); + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST); strcpy (ifr.ifr_name, interface); if (!ioctl (skfd, SIOCGIFADDR, &ifr)) { struct sockaddr_in addr = *(struct sockaddr_in *) &ifr.ifr_addr; buf->address = addr.sin_addr.s_addr; - buf->flags |= (1 << GLIBTOP_NETLOAD_ADDRESS); + buf->flags |= (1L << GLIBTOP_NETLOAD_ADDRESS); } strcpy (ifr.ifr_name, interface); @@ -166,13 +166,13 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, struct sockaddr_in addr = *(struct sockaddr_in *) &ifr.ifr_addr; buf->subnet = addr.sin_addr.s_addr; - buf->flags |= (1 << GLIBTOP_NETLOAD_SUBNET); + buf->flags |= (1L << GLIBTOP_NETLOAD_SUBNET); } strcpy (ifr.ifr_name, interface); if (!ioctl (skfd, SIOCGIFMTU, &ifr)) { buf->mtu = ifr.ifr_mtu; - buf->flags |= (1 << GLIBTOP_NETLOAD_MTU); + buf->flags |= (1L << GLIBTOP_NETLOAD_MTU); } close (skfd); diff --git a/sysdeps/linux/ppp.c b/sysdeps/linux/ppp.c index 145d163f..f450b281 100644 --- a/sysdeps/linux/ppp.c +++ b/sysdeps/linux/ppp.c @@ -34,8 +34,8 @@ #include static const unsigned long _glibtop_sysdeps_ppp = -(1 << GLIBTOP_PPP_STATE) + (1 << GLIBTOP_PPP_BYTES_IN) + -(1 << GLIBTOP_PPP_BYTES_OUT); +(1L << GLIBTOP_PPP_STATE) + (1L << GLIBTOP_PPP_BYTES_IN) + +(1L << GLIBTOP_PPP_BYTES_OUT); /* Init function. */ @@ -187,13 +187,13 @@ glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device) if (is_ISDN_on (server, &online)) { buf->state = online ? GLIBTOP_PPP_STATE_ONLINE : GLIBTOP_PPP_STATE_HANGUP; - buf->flags |= (1 << GLIBTOP_PPP_STATE); + buf->flags |= (1L << GLIBTOP_PPP_STATE); } if (get_ISDN_stats (server, &in, &out)) { buf->bytes_in = in; buf->bytes_out = out; - buf->flags |= (1 << GLIBTOP_PPP_BYTES_IN) | - (1 << GLIBTOP_PPP_BYTES_OUT); + buf->flags |= (1L << GLIBTOP_PPP_BYTES_IN) | + (1L << GLIBTOP_PPP_BYTES_OUT); } } diff --git a/sysdeps/linux/procargs.c b/sysdeps/linux/procargs.c index b8b18892..6924aee8 100644 --- a/sysdeps/linux/procargs.c +++ b/sysdeps/linux/procargs.c @@ -27,7 +27,7 @@ #include static const unsigned long _glibtop_sysdeps_proc_args = -(1 << GLIBTOP_PROC_ARGS_SIZE); +(1L << GLIBTOP_PROC_ARGS_SIZE); /* Init function. */ diff --git a/sysdeps/linux/prockernel.c b/sysdeps/linux/prockernel.c index 4e4a9d7b..46a82ec6 100644 --- a/sysdeps/linux/prockernel.c +++ b/sysdeps/linux/prockernel.c @@ -26,10 +26,10 @@ #include static const unsigned long _glibtop_sysdeps_proc_kernel = -(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_MIN_FLT) + -(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) + -(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) + -(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_WCHAN); +(1L << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1L << GLIBTOP_PROC_KERNEL_MIN_FLT) + +(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) + +(1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1L << GLIBTOP_PROC_KERNEL_KSTK_ESP) + +(1L << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1L << GLIBTOP_PROC_KERNEL_WCHAN); /* Init function. */ diff --git a/sysdeps/linux/proclist.c b/sysdeps/linux/proclist.c index 4e049d00..cb6a664d 100644 --- a/sysdeps/linux/proclist.c +++ b/sysdeps/linux/proclist.c @@ -34,8 +34,8 @@ #include 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); /* Init function. */ @@ -122,28 +122,28 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf, case GLIBTOP_KERN_PROC_PGRP: /* Do you really, really need this ? */ glibtop_get_proc_uid_s (server, &procuid, pid); - if (procuid.flags & (1 << GLIBTOP_PROC_UID_PGRP)) + if (procuid.flags & (1L << GLIBTOP_PROC_UID_PGRP)) if ((int) arg != procuid.pgrp) continue; break; case GLIBTOP_KERN_PROC_SESSION: /* Do you really, really need this ? */ glibtop_get_proc_uid_s (server, &procuid, pid); - if (procuid.flags & (1 << GLIBTOP_PROC_UID_SESSION)) + if (procuid.flags & (1L << GLIBTOP_PROC_UID_SESSION)) if ((int) arg != procuid.session) continue; break; case GLIBTOP_KERN_PROC_TTY: /* Do you really, really need this ? */ glibtop_get_proc_uid_s (server, &procuid, pid); - if (procuid.flags & (1 << GLIBTOP_PROC_UID_TTY)) + if (procuid.flags & (1L << GLIBTOP_PROC_UID_TTY)) if ((int) arg != procuid.tty) continue; break; case GLIBTOP_KERN_PROC_RUID: /* Do you really, really need this ? */ glibtop_get_proc_uid_s (server, &procuid, pid); - if (procuid.flags & (1 << GLIBTOP_PROC_UID_EUID)) + if (procuid.flags & (1L << GLIBTOP_PROC_UID_EUID)) if ((int) arg != procuid.euid) continue; break; @@ -151,19 +151,19 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf, if (which & GLIBTOP_EXCLUDE_NOTTY) { glibtop_get_proc_uid_s (server, &procuid, pid); - if (procuid.flags & (1 << GLIBTOP_PROC_UID_TTY)) + if (procuid.flags & (1L << GLIBTOP_PROC_UID_TTY)) if (procuid.tty == -1) continue; } if (which & GLIBTOP_EXCLUDE_IDLE) { glibtop_get_proc_state_s (server, &procstate, pid); - if (procstate.flags & (1 << GLIBTOP_PROC_STATE_STATE)) + if (procstate.flags & (1L << GLIBTOP_PROC_STATE_STATE)) if (procstate.state != 'R') continue; } if (which & GLIBTOP_EXCLUDE_SYSTEM) { glibtop_get_proc_uid_s (server, &procuid, pid); - if (procuid.flags & (1 << GLIBTOP_PROC_UID_UID)) + if (procuid.flags & (1L << GLIBTOP_PROC_UID_UID)) if (procuid.uid == 0) continue; } diff --git a/sysdeps/linux/procmap.c b/sysdeps/linux/procmap.c index d77dd912..9052c84a 100644 --- a/sysdeps/linux/procmap.c +++ b/sysdeps/linux/procmap.c @@ -27,14 +27,14 @@ #include static const unsigned long _glibtop_sysdeps_proc_map = -(1 << GLIBTOP_PROC_MAP_NUMBER) + (1 << GLIBTOP_PROC_MAP_TOTAL) + -(1 << GLIBTOP_PROC_MAP_SIZE); +(1L << GLIBTOP_PROC_MAP_NUMBER) + (1L << GLIBTOP_PROC_MAP_TOTAL) + +(1L << GLIBTOP_PROC_MAP_SIZE); static const unsigned long _glibtop_sysdeps_map_entry = -(1 << GLIBTOP_MAP_ENTRY_START) + (1 << GLIBTOP_MAP_ENTRY_END) + -(1 << GLIBTOP_MAP_ENTRY_OFFSET) + (1 << GLIBTOP_MAP_ENTRY_PERM) + -(1 << GLIBTOP_MAP_ENTRY_INODE) + (1 << GLIBTOP_MAP_ENTRY_DEVICE) + -(1 << GLIBTOP_MAP_ENTRY_FILENAME); +(1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) + +(1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM) + +(1L << GLIBTOP_MAP_ENTRY_INODE) + (1L << GLIBTOP_MAP_ENTRY_DEVICE) + +(1L << GLIBTOP_MAP_ENTRY_FILENAME); /* Init function. */ diff --git a/sysdeps/linux/procmem.c b/sysdeps/linux/procmem.c index baf34323..3e868ee8 100644 --- a/sysdeps/linux/procmem.c +++ b/sysdeps/linux/procmem.c @@ -26,12 +26,12 @@ #include static const unsigned long _glibtop_sysdeps_proc_mem = -(1 << GLIBTOP_PROC_MEM_VSIZE) + (1 << GLIBTOP_PROC_MEM_RSS) + -(1 << GLIBTOP_PROC_MEM_RSS_RLIM); +(1L << GLIBTOP_PROC_MEM_VSIZE) + (1L << GLIBTOP_PROC_MEM_RSS) + +(1L << GLIBTOP_PROC_MEM_RSS_RLIM); static const unsigned long _glibtop_sysdeps_proc_mem_statm = -(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_RESIDENT) + -(1 << GLIBTOP_PROC_MEM_SHARE); +(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) + +(1L << GLIBTOP_PROC_MEM_SHARE); #ifndef LOG1024 #define LOG1024 10 diff --git a/sysdeps/linux/procsegment.c b/sysdeps/linux/procsegment.c index 0a698ad0..3179ae40 100644 --- a/sysdeps/linux/procsegment.c +++ b/sysdeps/linux/procsegment.c @@ -26,16 +26,16 @@ #include static const unsigned long _glibtop_sysdeps_proc_segment = -(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + -(1 << GLIBTOP_PROC_SEGMENT_END_CODE) + -(1 << GLIBTOP_PROC_SEGMENT_START_STACK); +(1L << GLIBTOP_PROC_SEGMENT_START_CODE) + +(1L << GLIBTOP_PROC_SEGMENT_END_CODE) + +(1L << GLIBTOP_PROC_SEGMENT_START_STACK); static const unsigned long _glibtop_sysdeps_proc_segment_statm = -(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + +(1L << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + /* Disabled due to bug in the Linux Kernel. */ -/* (1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) + */ -(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) + -(1 << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE); +/* (1L << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) + */ +(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) + +(1L << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE); #ifndef LOG1024 #define LOG1024 10 diff --git a/sysdeps/linux/procsignal.c b/sysdeps/linux/procsignal.c index 96b24417..7d8fa56c 100644 --- a/sysdeps/linux/procsignal.c +++ b/sysdeps/linux/procsignal.c @@ -26,8 +26,8 @@ #include 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); /* Init function. */ diff --git a/sysdeps/linux/procstate.c b/sysdeps/linux/procstate.c index 32924748..6bb8e5ae 100644 --- a/sysdeps/linux/procstate.c +++ b/sysdeps/linux/procstate.c @@ -28,10 +28,10 @@ #include static const unsigned long _glibtop_sysdeps_proc_state = -(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE); +(1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_STATE); static const unsigned long _glibtop_sysdeps_proc_state_uid = -(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID); +(1L << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_GID); /* Init function. */ diff --git a/sysdeps/linux/proctime.c b/sysdeps/linux/proctime.c index 1ccbbca1..10d1e3b5 100644 --- a/sysdeps/linux/proctime.c +++ b/sysdeps/linux/proctime.c @@ -26,14 +26,14 @@ #include static const unsigned long _glibtop_sysdeps_proc_time = -(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_CUTIME) + -(1 << GLIBTOP_PROC_TIME_STIME) + (1 << GLIBTOP_PROC_TIME_CSTIME) + -(1 << GLIBTOP_PROC_TIME_RTIME) + (1 << GLIBTOP_PROC_TIME_FREQUENCY) + -(1 << GLIBTOP_PROC_TIME_TIMEOUT) + (1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE) + -(1 << GLIBTOP_PROC_TIME_START_TIME); +(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_CUTIME) + +(1L << GLIBTOP_PROC_TIME_STIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) + +(1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY) + +(1L << GLIBTOP_PROC_TIME_TIMEOUT) + (1L << GLIBTOP_PROC_TIME_IT_REAL_VALUE) + +(1L << GLIBTOP_PROC_TIME_START_TIME); static const unsigned long _glibtop_sysdeps_proc_time_smp = -(1 << GLIBTOP_PROC_TIME_XCPU_UTIME) + (1 << GLIBTOP_PROC_TIME_XCPU_STIME); +(1L << GLIBTOP_PROC_TIME_XCPU_UTIME) + (1L << GLIBTOP_PROC_TIME_XCPU_STIME); /* Init function. */ diff --git a/sysdeps/linux/procuid.c b/sysdeps/linux/procuid.c index a9cb7179..a7585dcc 100644 --- a/sysdeps/linux/procuid.c +++ b/sysdeps/linux/procuid.c @@ -26,14 +26,14 @@ #include static const unsigned long _glibtop_sysdeps_proc_uid = -(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) + -(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID); +(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) + +(1L << GLIBTOP_PROC_UID_GID) + (1L << GLIBTOP_PROC_UID_EGID); static const unsigned long _glibtop_sysdeps_proc_uid_stat = -(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) + -(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) + -(1 << GLIBTOP_PROC_UID_TTY) + (1 << GLIBTOP_PROC_UID_TPGID) + -(1 << GLIBTOP_PROC_UID_PRIORITY) + (1 << GLIBTOP_PROC_UID_NICE); +(1L << GLIBTOP_PROC_UID_PID) + (1L << GLIBTOP_PROC_UID_PPID) + +(1L << GLIBTOP_PROC_UID_PGRP) + (1L << GLIBTOP_PROC_UID_SESSION) + +(1L << GLIBTOP_PROC_UID_TTY) + (1L << GLIBTOP_PROC_UID_TPGID) + +(1L << GLIBTOP_PROC_UID_PRIORITY) + (1L << GLIBTOP_PROC_UID_NICE); #define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) diff --git a/sysdeps/linux/sem_limits.c b/sysdeps/linux/sem_limits.c index bdb566d4..531b5f17 100644 --- a/sysdeps/linux/sem_limits.c +++ b/sysdeps/linux/sem_limits.c @@ -42,11 +42,11 @@ union semun #endif 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); /* Init function. */ diff --git a/sysdeps/linux/shm_limits.c b/sysdeps/linux/shm_limits.c index da6ec92d..859160f1 100644 --- a/sysdeps/linux/shm_limits.c +++ b/sysdeps/linux/shm_limits.c @@ -27,9 +27,9 @@ #include 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); /* Init function. */ diff --git a/sysdeps/linux/swap.c b/sysdeps/linux/swap.c index 47637832..2a7d639b 100644 --- a/sysdeps/linux/swap.c +++ b/sysdeps/linux/swap.c @@ -28,11 +28,11 @@ #include static unsigned long _glibtop_sysdeps_swap = -(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) + -(1 << GLIBTOP_SWAP_FREE); +(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) + +(1L << GLIBTOP_SWAP_FREE); static unsigned long _glibtop_sysdeps_swap_paging = -(1 << GLIBTOP_SWAP_PAGEIN) + (1 << GLIBTOP_SWAP_PAGEOUT); +(1L << GLIBTOP_SWAP_PAGEIN) + (1L << GLIBTOP_SWAP_PAGEOUT); /* Init function. */ diff --git a/sysdeps/linux/sysinfo.c b/sysdeps/linux/sysinfo.c index 49f374c4..d4a19bf3 100644 --- a/sysdeps/linux/sysinfo.c +++ b/sysdeps/linux/sysinfo.c @@ -26,7 +26,7 @@ #include static const unsigned long _glibtop_sysdeps_sysinfo = -(1 << GLIBTOP_SYSINFO_CPUINFO); +(1L << GLIBTOP_SYSINFO_CPUINFO); static glibtop_sysinfo sysinfo; diff --git a/sysdeps/linux/uptime.c b/sysdeps/linux/uptime.c index eab840ae..e347a74e 100644 --- a/sysdeps/linux/uptime.c +++ b/sysdeps/linux/uptime.c @@ -26,7 +26,7 @@ #include static unsigned long _glibtop_sysdeps_uptime = -(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); +(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME); /* Init function. */ diff --git a/sysdeps/osf1/ChangeLog b/sysdeps/osf1/ChangeLog index 8a2b0dd8..97619244 100644 --- a/sysdeps/osf1/ChangeLog +++ b/sysdeps/osf1/ChangeLog @@ -1,3 +1,8 @@ +1999-05-11 Martin Baulig + + * procstate.c: Fixed implementation of the `state' field; added + `ruid' and `rgid' fields. + 1999-02-19 Martin Baulig * procmap.c, procargs.c, netload.c: Copied from stub_suid. diff --git a/sysdeps/osf1/cpu.c b/sysdeps/osf1/cpu.c index bb1dacf1..680c11f8 100644 --- a/sysdeps/osf1/cpu.c +++ b/sysdeps/osf1/cpu.c @@ -26,9 +26,9 @@ #include 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); /* Init function. */ diff --git a/sysdeps/osf1/loadavg.c b/sysdeps/osf1/loadavg.c index 5dd7f56f..abf88ec7 100644 --- a/sysdeps/osf1/loadavg.c +++ b/sysdeps/osf1/loadavg.c @@ -26,7 +26,7 @@ #include static const unsigned long _glibtop_sysdeps_loadavg = -(1 << GLIBTOP_LOADAVG_LOADAVG); +(1L << GLIBTOP_LOADAVG_LOADAVG); /* Init function. */ diff --git a/sysdeps/osf1/mem.c b/sysdeps/osf1/mem.c index 156f0b60..d76e595c 100644 --- a/sysdeps/osf1/mem.c +++ b/sysdeps/osf1/mem.c @@ -32,8 +32,8 @@ #include static const unsigned long _glibtop_sysdeps_mem = -(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) + -(1 << GLIBTOP_MEM_FREE); +(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) + +(1L << GLIBTOP_MEM_FREE); /* Init function. */ diff --git a/sysdeps/osf1/msg_limits.c b/sysdeps/osf1/msg_limits.c index da2ab511..2b198963 100644 --- a/sysdeps/osf1/msg_limits.c +++ b/sysdeps/osf1/msg_limits.c @@ -26,9 +26,9 @@ #include 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_MSGTQL); +(1L << GLIBTOP_IPC_MSGMAP) + (1L << GLIBTOP_IPC_MSGMAX) + +(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) + +(1L << GLIBTOP_IPC_MSGTQL); /* Init function. */ @@ -54,7 +54,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_MSGMAX); + buf->flags += (1L << GLIBTOP_IPC_MSGMAX); buf->msgmax = value; @@ -63,7 +63,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_MSGMNB); + buf->flags += (1L << GLIBTOP_IPC_MSGMNB); buf->msgmnb = value; @@ -72,7 +72,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_MSGMNI); + buf->flags += (1L << GLIBTOP_IPC_MSGMNI); buf->msgmni = value; @@ -81,7 +81,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_MSGTQL); + buf->flags += (1L << GLIBTOP_IPC_MSGTQL); buf->msgtql = value; } diff --git a/sysdeps/osf1/procdata.c b/sysdeps/osf1/procdata.c index 24fc2ae5..96bb1430 100644 --- a/sysdeps/osf1/procdata.c +++ b/sysdeps/osf1/procdata.c @@ -34,7 +34,7 @@ /* Provides detailed information about a process. */ -#define BIT_SHIFT(x) (1 << (x % 32)) +#define BIT_SHIFT(x) (1L << (x % 64)) static const unsigned long _glibtop_sysdeps_procdata_0 = BIT_SHIFT(GLIBTOP_PROCDATA_CMD) + diff --git a/sysdeps/osf1/proclist.c b/sysdeps/osf1/proclist.c index 98c217db..607aeeae 100644 --- a/sysdeps/osf1/proclist.c +++ b/sysdeps/osf1/proclist.c @@ -29,8 +29,8 @@ #include 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); /* Init function. */ diff --git a/sysdeps/osf1/procmem.c b/sysdeps/osf1/procmem.c index d36d1032..05038c5b 100644 --- a/sysdeps/osf1/procmem.c +++ b/sysdeps/osf1/procmem.c @@ -36,8 +36,8 @@ #include static const unsigned long _glibtop_sysdeps_proc_mem = -(1 << GLIBTOP_PROC_MEM_VSIZE) + (1 << GLIBTOP_PROC_MEM_RESIDENT) + -(1 << GLIBTOP_PROC_MEM_RSS); +(1L << GLIBTOP_PROC_MEM_VSIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) + +(1L << GLIBTOP_PROC_MEM_RSS); /* Init function. */ @@ -98,6 +98,6 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, buf->share = u.u_ru.ru_ixrss; - buf->flags |= (1 << GLIBTOP_PROC_MEM_RSS_RLIM) | - (1 << GLIBTOP_PROC_MEM_SHARE); + buf->flags |= (1L << GLIBTOP_PROC_MEM_RSS_RLIM) | + (1L << GLIBTOP_PROC_MEM_SHARE); } diff --git a/sysdeps/osf1/procsegment.c b/sysdeps/osf1/procsegment.c index 0aeeaa97..935a1b0b 100644 --- a/sysdeps/osf1/procsegment.c +++ b/sysdeps/osf1/procsegment.c @@ -29,11 +29,11 @@ #include static const unsigned long _glibtop_sysdeps_proc_segment = -(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + -(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) + -(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + -(1 << GLIBTOP_PROC_SEGMENT_END_CODE) + -(1 << GLIBTOP_PROC_SEGMENT_START_STACK); +(1L << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + +(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) + +(1L << GLIBTOP_PROC_SEGMENT_START_CODE) + +(1L << GLIBTOP_PROC_SEGMENT_END_CODE) + +(1L << GLIBTOP_PROC_SEGMENT_START_STACK); /* Init function. */ diff --git a/sysdeps/osf1/procsignal.c b/sysdeps/osf1/procsignal.c index 3c6cc8a6..36e1e2b9 100644 --- a/sysdeps/osf1/procsignal.c +++ b/sysdeps/osf1/procsignal.c @@ -28,8 +28,8 @@ #include 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); /* Init function. */ diff --git a/sysdeps/osf1/procstate.c b/sysdeps/osf1/procstate.c index 72e0f8ed..108291c7 100644 --- a/sysdeps/osf1/procstate.c +++ b/sysdeps/osf1/procstate.c @@ -27,9 +27,14 @@ #include +#include +#include +#include + static const unsigned long _glibtop_sysdeps_proc_state = -(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE) + -(1 << GLIBTOP_PROC_STATE_UID); +(1L << GLIBTOP_PROC_STATE_CMD) + +(1L << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_GID) + +(1L << GLIBTOP_PROC_STATE_RUID) + (1L << GLIBTOP_PROC_STATE_RGID); /* Init function. */ @@ -46,7 +51,8 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, pid_t pid) { struct tbl_procinfo procinfo; - int ret; + int minim_state = 99, ret; + task_t thistask; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_STATE, 0); @@ -65,14 +71,85 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, if (ret != 1) return; + /* Check whether the process actually exists. */ + if (procinfo.pi_status == PI_EMPTY) return; + + /* Check whether it is not a zombie. */ + if (procinfo.pi_status == PI_ZOMBIE) { + buf->state = GLIBTOP_PROCESS_ZOMBIE; + buf->flags = (1L << GLIBTOP_PROC_STATE_STATE); + return; + } + strncpy (buf->cmd, procinfo.pi_comm, sizeof (buf->cmd)-1); buf->cmd [sizeof (buf->cmd)-1] = 0; - buf->state = procinfo.pi_status; - - buf->uid = procinfo.pi_uid; + buf->uid = procinfo.pi_svuid; buf->gid = procinfo.pi_svgid; + buf->ruid = procinfo.pi_ruid; + buf->rgid = procinfo.pi_rgid; buf->flags = _glibtop_sysdeps_proc_state; + + /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ + + glibtop_suid_enter (server); + + /* Get task structure. */ + ret = task_by_unix_pid (task_self(), procinfo.pi_pid, &thistask); + + if (ret == KERN_SUCCESS) { + thread_array_t threadarr; + unsigned int threadarr_l; + thread_basic_info_t threadinfo; + thread_basic_info_data_t threadinfodata; + int j; + + /* Get thread array. */ + (void) task_threads (thistask, &threadarr, &threadarr_l); + + threadinfo = &threadinfodata; + for (j = 0; j < threadarr_l; j++) { + unsigned int threadinfo_l = THREAD_BASIC_INFO_COUNT; + int tret; + + tret = thread_info (threadarr [j], THREAD_BASIC_INFO, + (thread_info_t) threadinfo, &threadinfo_l); + + if (tret == KERN_SUCCESS) { + if (minim_state > threadinfo->run_state) + minim_state=threadinfo->run_state; + } + } + } + + glibtop_suid_leave (server); + + /* !!! END OF SUID ROOT PART !!! */ + + if (ret != KERN_SUCCESS) return; + + switch (minim_state) { + case TH_STATE_RUNNING: + buf->state = GLIBTOP_PROCESS_RUNNING; + break; + case TH_STATE_UNINTERRUPTIBLE: + buf->state = GLIBTOP_PROCESS_UNINTERRUPTIBLE; + break; + case TH_STATE_WAITING: + buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE; + break; + case TH_STATE_STOPPED: + case TH_STATE_HALTED: + buf->state = GLIBTOP_PROCESS_STOPPED; + break; + default: + if (ret != KERN_SUCCESS) + buf->state = GLIBTOP_PROCESS_ZOMBIE; + break; + } + + if (buf->state) + buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE); } diff --git a/sysdeps/osf1/proctime.c b/sysdeps/osf1/proctime.c index 86f46def..dc06da42 100644 --- a/sysdeps/osf1/proctime.c +++ b/sysdeps/osf1/proctime.c @@ -30,9 +30,9 @@ #include static const unsigned long _glibtop_sysdeps_proc_time = -(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_CUTIME) + -(1 << GLIBTOP_PROC_TIME_STIME) + (1 << GLIBTOP_PROC_TIME_CSTIME) + -(1 << GLIBTOP_PROC_TIME_START_TIME); +(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_CUTIME) + +(1L << GLIBTOP_PROC_TIME_STIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) + +(1L << GLIBTOP_PROC_TIME_START_TIME); /* Init function. */ diff --git a/sysdeps/osf1/procuid.c b/sysdeps/osf1/procuid.c index 4a494b61..f5ca4636 100644 --- a/sysdeps/osf1/procuid.c +++ b/sysdeps/osf1/procuid.c @@ -36,11 +36,11 @@ /* Provides detailed information about a process. */ static const unsigned long _glibtop_sysdeps_proc_uid = -(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) + -(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID) + -(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) + -(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) + -(1 << GLIBTOP_PROC_UID_TTY) + (1 << GLIBTOP_PROC_UID_TPGID); +(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) + +(1L << GLIBTOP_PROC_UID_GID) + (1L << GLIBTOP_PROC_UID_EGID) + +(1L << GLIBTOP_PROC_UID_PID) + (1L << GLIBTOP_PROC_UID_PPID) + +(1L << GLIBTOP_PROC_UID_PGRP) + (1L << GLIBTOP_PROC_UID_SESSION) + +(1L << GLIBTOP_PROC_UID_TTY) + (1L << GLIBTOP_PROC_UID_TPGID); /* Init function. */ @@ -118,7 +118,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, buf->priority = taskinfo.base_priority; - buf->flags += (1 << GLIBTOP_PROC_UID_PRIORITY); + buf->flags += (1L << GLIBTOP_PROC_UID_PRIORITY); errno = 0; @@ -128,5 +128,5 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, buf->nice = ret; - buf->flags += (1 << GLIBTOP_PROC_UID_NICE); + buf->flags += (1L << GLIBTOP_PROC_UID_NICE); } diff --git a/sysdeps/osf1/sem_limits.c b/sysdeps/osf1/sem_limits.c index 69bb170f..c054c3c2 100644 --- a/sysdeps/osf1/sem_limits.c +++ b/sysdeps/osf1/sem_limits.c @@ -26,9 +26,9 @@ #include static unsigned long _glibtop_sysdeps_sem_limits = -(1 << GLIBTOP_IPC_SEMMNI) + (1 << GLIBTOP_IPC_SEMMSL) + -(1 << GLIBTOP_IPC_SEMOPM) + (1 << GLIBTOP_IPC_SEMVMX) + -(1 << GLIBTOP_IPC_SEMAEM); +(1L << GLIBTOP_IPC_SEMMNI) + (1L << GLIBTOP_IPC_SEMMSL) + +(1L << GLIBTOP_IPC_SEMOPM) + (1L << GLIBTOP_IPC_SEMVMX) + +(1L << GLIBTOP_IPC_SEMAEM); /* Init function. */ @@ -54,7 +54,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SEMMNI); + buf->flags += (1L << GLIBTOP_IPC_SEMMNI); buf->semmni = value; @@ -64,7 +64,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SEMMSL); + buf->flags += (1L << GLIBTOP_IPC_SEMMSL); buf->semmsl = value; @@ -74,7 +74,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SEMOPM); + buf->flags += (1L << GLIBTOP_IPC_SEMOPM); buf->semopm = value; @@ -84,7 +84,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SEMUME); + buf->flags += (1L << GLIBTOP_IPC_SEMUME); buf->semume = value; @@ -94,7 +94,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SEMVMX); + buf->flags += (1L << GLIBTOP_IPC_SEMVMX); buf->semvmx = value; @@ -104,7 +104,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SEMAEM); + buf->flags += (1L << GLIBTOP_IPC_SEMAEM); buf->semaem = value; } diff --git a/sysdeps/osf1/shm_limits.c b/sysdeps/osf1/shm_limits.c index a183c9ea..03069205 100644 --- a/sysdeps/osf1/shm_limits.c +++ b/sysdeps/osf1/shm_limits.c @@ -26,8 +26,8 @@ #include static unsigned long _glibtop_sysdeps_shm_limits = -(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) + -(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG); +(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) + +(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG); /* Init function. */ @@ -53,7 +53,7 @@ glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SHMMAX); + buf->flags += (1L << GLIBTOP_IPC_SHMMAX); buf->shmmax = value; @@ -63,7 +63,7 @@ glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SHMMIN); + buf->flags += (1L << GLIBTOP_IPC_SHMMIN); buf->shmmin = value; @@ -73,7 +73,7 @@ glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SHMMNI); + buf->flags += (1L << GLIBTOP_IPC_SHMMNI); buf->shmmni = value; @@ -83,7 +83,7 @@ glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) if (ret != 1) return; - buf->flags += (1 << GLIBTOP_IPC_SHMSEG); + buf->flags += (1L << GLIBTOP_IPC_SHMSEG); buf->shmseg = value; } diff --git a/sysdeps/osf1/swap.c b/sysdeps/osf1/swap.c index 66f15c82..db322413 100644 --- a/sysdeps/osf1/swap.c +++ b/sysdeps/osf1/swap.c @@ -26,8 +26,8 @@ #include static unsigned long _glibtop_sysdeps_swap = -(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) + -(1 << GLIBTOP_SWAP_FREE); +(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) + +(1L << GLIBTOP_SWAP_FREE); /* Init function. */ diff --git a/sysdeps/osf1/uptime.c b/sysdeps/osf1/uptime.c index 911acaf9..4e968a1b 100644 --- a/sysdeps/osf1/uptime.c +++ b/sysdeps/osf1/uptime.c @@ -28,7 +28,7 @@ #include static unsigned long _glibtop_sysdeps_uptime = -(1 << GLIBTOP_UPTIME_UPTIME); +(1L << GLIBTOP_UPTIME_UPTIME); /* Init function. */