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.
This commit is contained in:
Benoît Dejean
2004-05-25 17:12:39 +00:00
parent 74453855aa
commit dc3027c438
10 changed files with 31 additions and 13 deletions

View File

@@ -1,3 +1,11 @@
2004-05-25 Benoît Dejean <tazforever@dlfp.org>
* 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 <hadess@hadess.net> 2004-03-09 Bastien Nocera <hadess@hadess.net>
* proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux * proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux

View File

@@ -41,7 +41,7 @@ union semun
}; };
#endif #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_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) +
(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) + (1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) +
(1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) + (1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) +

View File

@@ -26,7 +26,7 @@
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
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_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) +
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) + (1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) +
(1 << GLIBTOP_IPC_SHMALL); (1 << GLIBTOP_IPC_SHMALL);

View File

@@ -27,7 +27,7 @@
#include "kernel.h" #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_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) + (1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
(1 << GLIBTOP_SWAP_PAGEOUT); (1 << GLIBTOP_SWAP_PAGEOUT);

View File

@@ -25,9 +25,11 @@
#include <glibtop/error.h> #include <glibtop/error.h>
#include <glibtop/uptime.h> #include <glibtop/uptime.h>
#include <time.h>
#include "kernel.h" #include "kernel.h"
static unsigned long _glibtop_sysdeps_uptime = static const unsigned long _glibtop_sysdeps_uptime =
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); (1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
/* Init function. */ /* Init function. */
@@ -61,4 +63,5 @@ glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
buf->uptime = (double) tbl.uptime.uptime / HZ; buf->uptime = (double) tbl.uptime.uptime / HZ;
buf->idletime = (double) tbl.uptime.idle / HZ; buf->idletime = (double) tbl.uptime.idle / HZ;
buf->boot_time = (guint64) time(NULL) - (tbl.uptime.uptime / HZ);
} }

View File

@@ -1,3 +1,11 @@
2004-05-25 Benoît Dejean <tazforever@dlfp.org>
* 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 <hadess@hadess.net> 2003-10-21 Bastien Nocera <hadess@hadess.net>
* Makefile.am: install only one library, libgtop-2.0 * Makefile.am: install only one library, libgtop-2.0

View File

@@ -25,7 +25,7 @@
#include <glibtop/error.h> #include <glibtop/error.h>
#include <glibtop/sem_limits.h> #include <glibtop/sem_limits.h>
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_SEMMNI) + (1L << GLIBTOP_IPC_SEMMSL) +
(1L << GLIBTOP_IPC_SEMOPM) + (1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMOPM) + (1L << GLIBTOP_IPC_SEMVMX) +
(1L << GLIBTOP_IPC_SEMAEM); (1L << GLIBTOP_IPC_SEMAEM);

View File

@@ -25,7 +25,7 @@
#include <glibtop/error.h> #include <glibtop/error.h>
#include <glibtop/shm_limits.h> #include <glibtop/shm_limits.h>
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_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG); (1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG);

View File

@@ -25,7 +25,7 @@
#include <glibtop/error.h> #include <glibtop/error.h>
#include <glibtop/swap.h> #include <glibtop/swap.h>
static unsigned long _glibtop_sysdeps_swap = static const unsigned long _glibtop_sysdeps_swap =
(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) + (1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) +
(1L << GLIBTOP_SWAP_FREE); (1L << GLIBTOP_SWAP_FREE);

View File

@@ -27,7 +27,7 @@
#include <time.h> #include <time.h>
static unsigned long _glibtop_sysdeps_uptime = static const unsigned long _glibtop_sysdeps_uptime =
(1L << GLIBTOP_UPTIME_UPTIME); (1L << GLIBTOP_UPTIME_UPTIME);
/* Init function. */ /* Init function. */
@@ -44,18 +44,17 @@ void
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
{ {
struct tbl_sysinfo sysinfo; struct tbl_sysinfo sysinfo;
int ret;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0); glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
memset (buf, 0, sizeof (glibtop_uptime)); memset (buf, 0, sizeof (glibtop_uptime));
ret = table (TBL_SYSINFO, 0, (char *) &sysinfo, 1, if(table (TBL_SYSINFO, 0, (char *) &sysinfo, 1,
sizeof (struct tbl_sysinfo)); sizeof (struct tbl_sysinfo)) != 1)
return;
if (ret != 1) return;
buf->uptime = (double) (time (NULL) - sysinfo.si_boottime); buf->uptime = (double) (time (NULL) - sysinfo.si_boottime);
buf->boot_time = sysinfo.si_boottime;
buf->flags = _glibtop_sysdeps_uptime; buf->flags = _glibtop_sysdeps_uptime;
} }