From dc3027c438825820436f966fe50b68d9c4342e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Tue, 25 May 2004 17:12:39 +0000 Subject: [PATCH] Added missing const qualifiers. * sem_limits.c: * shm_limits.c: * swap.c: Added missing const qualifiers. * uptime.c: (glibtop_get_uptime_s): Cleaned up. Added boot_time. --- sysdeps/kernel/ChangeLog | 8 ++++++++ sysdeps/kernel/sem_limits.c | 2 +- sysdeps/kernel/shm_limits.c | 2 +- sysdeps/kernel/swap.c | 2 +- sysdeps/kernel/uptime.c | 5 ++++- sysdeps/osf1/ChangeLog | 8 ++++++++ sysdeps/osf1/sem_limits.c | 2 +- sysdeps/osf1/shm_limits.c | 2 +- sysdeps/osf1/swap.c | 2 +- sysdeps/osf1/uptime.c | 11 +++++------ 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/sysdeps/kernel/ChangeLog b/sysdeps/kernel/ChangeLog index 81ae0975..f6e0fdb0 100644 --- a/sysdeps/kernel/ChangeLog +++ b/sysdeps/kernel/ChangeLog @@ -1,3 +1,11 @@ +2004-05-25 Benoît Dejean + + * sem_limits.c: + * shm_limits.c: + * swap.c: Added missing const qualifiers. + + * uptime.c: (glibtop_get_uptime_s): Cleaned up. Added boot_time. + 2004-03-09 Bastien Nocera * proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux diff --git a/sysdeps/kernel/sem_limits.c b/sysdeps/kernel/sem_limits.c index bdb566d4..f7402d29 100644 --- a/sysdeps/kernel/sem_limits.c +++ b/sysdeps/kernel/sem_limits.c @@ -41,7 +41,7 @@ union semun }; #endif -static unsigned long _glibtop_sysdeps_sem_limits = +static const 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) + diff --git a/sysdeps/kernel/shm_limits.c b/sysdeps/kernel/shm_limits.c index da6ec92d..d985217b 100644 --- a/sysdeps/kernel/shm_limits.c +++ b/sysdeps/kernel/shm_limits.c @@ -26,7 +26,7 @@ #include #include -static unsigned long _glibtop_sysdeps_shm_limits = +static const 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); diff --git a/sysdeps/kernel/swap.c b/sysdeps/kernel/swap.c index 81f13aa0..34455327 100644 --- a/sysdeps/kernel/swap.c +++ b/sysdeps/kernel/swap.c @@ -27,7 +27,7 @@ #include "kernel.h" -static unsigned long _glibtop_sysdeps_swap = +static const unsigned long _glibtop_sysdeps_swap = (1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) + (1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) + (1 << GLIBTOP_SWAP_PAGEOUT); diff --git a/sysdeps/kernel/uptime.c b/sysdeps/kernel/uptime.c index 844dfb5e..b76a1e95 100644 --- a/sysdeps/kernel/uptime.c +++ b/sysdeps/kernel/uptime.c @@ -25,9 +25,11 @@ #include #include +#include + #include "kernel.h" -static unsigned long _glibtop_sysdeps_uptime = +static const unsigned long _glibtop_sysdeps_uptime = (1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); /* Init function. */ @@ -61,4 +63,5 @@ glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) buf->uptime = (double) tbl.uptime.uptime / HZ; buf->idletime = (double) tbl.uptime.idle / HZ; + buf->boot_time = (guint64) time(NULL) - (tbl.uptime.uptime / HZ); } diff --git a/sysdeps/osf1/ChangeLog b/sysdeps/osf1/ChangeLog index e0d7aea9..bc503fa5 100644 --- a/sysdeps/osf1/ChangeLog +++ b/sysdeps/osf1/ChangeLog @@ -1,3 +1,11 @@ +2004-05-25 Benoît Dejean + + * sem_limits.c: + * shm_limits.c: + * swap.c: Added missing const qualifiers. + + * uptime.c: (glibtop_get_uptime_s): Cleaned up. Added boot_time. + 2003-10-21 Bastien Nocera * Makefile.am: install only one library, libgtop-2.0 diff --git a/sysdeps/osf1/sem_limits.c b/sysdeps/osf1/sem_limits.c index c054c3c2..58512f0e 100644 --- a/sysdeps/osf1/sem_limits.c +++ b/sysdeps/osf1/sem_limits.c @@ -25,7 +25,7 @@ #include #include -static unsigned long _glibtop_sysdeps_sem_limits = +static const unsigned long _glibtop_sysdeps_sem_limits = (1L << GLIBTOP_IPC_SEMMNI) + (1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) + (1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM); diff --git a/sysdeps/osf1/shm_limits.c b/sysdeps/osf1/shm_limits.c index 03069205..63689d31 100644 --- a/sysdeps/osf1/shm_limits.c +++ b/sysdeps/osf1/shm_limits.c @@ -25,7 +25,7 @@ #include #include -static unsigned long _glibtop_sysdeps_shm_limits = +static const unsigned long _glibtop_sysdeps_shm_limits = (1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) + (1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG); diff --git a/sysdeps/osf1/swap.c b/sysdeps/osf1/swap.c index db322413..e1bdad08 100644 --- a/sysdeps/osf1/swap.c +++ b/sysdeps/osf1/swap.c @@ -25,7 +25,7 @@ #include #include -static unsigned long _glibtop_sysdeps_swap = +static const unsigned long _glibtop_sysdeps_swap = (1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) + (1L << GLIBTOP_SWAP_FREE); diff --git a/sysdeps/osf1/uptime.c b/sysdeps/osf1/uptime.c index 4e968a1b..d77bfb5d 100644 --- a/sysdeps/osf1/uptime.c +++ b/sysdeps/osf1/uptime.c @@ -27,7 +27,7 @@ #include -static unsigned long _glibtop_sysdeps_uptime = +static const unsigned long _glibtop_sysdeps_uptime = (1L << GLIBTOP_UPTIME_UPTIME); /* Init function. */ @@ -44,18 +44,17 @@ void glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) { struct tbl_sysinfo sysinfo; - int ret; glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0); memset (buf, 0, sizeof (glibtop_uptime)); - ret = table (TBL_SYSINFO, 0, (char *) &sysinfo, 1, - sizeof (struct tbl_sysinfo)); - - if (ret != 1) return; + if(table (TBL_SYSINFO, 0, (char *) &sysinfo, 1, + sizeof (struct tbl_sysinfo)) != 1) + return; buf->uptime = (double) (time (NULL) - sysinfo.si_boottime); + buf->boot_time = sysinfo.si_boottime; buf->flags = _glibtop_sysdeps_uptime; }