This is a very big an possibly breaking commit.
It changes the return values of all sysdeps functions which were previosly returning void to int. This is the first step to implement better error handling in LibGTop. Martin 1999-10-24 Martin Baulig <martin@home-of-linux.org> * include/glibtop/*.h (glibtop_get_*, glibtop_init*): Changed the return value of all `glibtop_get_<feature>_* ()' and all `glibtop_init_<feature>_* ()' functions from void to int. * features.def: Reflect changes of the return values. * sysdeps/*/*.c: Reflect changes of the return values.
This commit is contained in:
committed by
Martin Baulig
parent
eae892c9b1
commit
a5dd7e9063
@@ -48,7 +48,7 @@ static int mib [] = { CTL_KERN, KERN_CLOCKRATE };
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_cpu_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine.kd, nlst) != 0) {
|
||||
@@ -62,7 +62,7 @@ glibtop_init_cpu_p (glibtop *server)
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
long cpts [CPUSTATES];
|
||||
|
||||
@@ -32,7 +32,7 @@ static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_loadavg_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
@@ -40,7 +40,7 @@ glibtop_init_loadavg_p (glibtop *server)
|
||||
|
||||
/* Provides load averange. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
double ldavg[3];
|
||||
|
||||
@@ -87,7 +87,7 @@ static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_mem_p (glibtop *server)
|
||||
{
|
||||
register int pagesize;
|
||||
@@ -112,7 +112,7 @@ glibtop_init_mem_p (glibtop *server)
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
struct vmtotal vmt;
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#if (defined __bsdi__) && (_BSDI_VERSION < 199700)
|
||||
/* Older versions of BSDI don't seem to have this. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_msg_limits_p (glibtop *server)
|
||||
{ }
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
@@ -73,7 +73,7 @@ static struct nlist nlst [] = {
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_msg_limits_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine.kd, nlst) != 0) {
|
||||
@@ -92,7 +92,7 @@ glibtop_init_msg_limits_p (glibtop *server)
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
|
||||
@@ -62,7 +62,7 @@ static struct nlist nlst [] = {
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_netload_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
@@ -73,7 +73,7 @@ glibtop_init_netload_p (glibtop *server)
|
||||
|
||||
/* Provides Network statistics. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
||||
const char *interface)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ static struct nlist nlst [] = {
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_ppp_p (glibtop *server)
|
||||
{
|
||||
#ifdef HAVE_I4B
|
||||
@@ -88,7 +88,7 @@ glibtop_init_ppp_p (glibtop *server)
|
||||
|
||||
/* Provides information about ppp usage. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
#ifdef HAVE_I4B
|
||||
|
||||
@@ -37,7 +37,7 @@ static const unsigned long _glibtop_sysdeps_proc_args =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_args_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
|
||||
@@ -64,7 +64,7 @@ static const unsigned long _glibtop_sysdeps_proc_kernel_wchan =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_kernel_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel_pstats |
|
||||
@@ -72,7 +72,7 @@ glibtop_init_proc_kernel_p (glibtop *server)
|
||||
_glibtop_sysdeps_proc_kernel_wchan;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_kernel_p (glibtop *server,
|
||||
glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
|
||||
@@ -52,7 +52,7 @@ static const unsigned long _glibtop_sysdeps_proclist =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proclist_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
|
||||
@@ -67,7 +67,7 @@ static const unsigned long _glibtop_sysdeps_map_entry =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_map_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||
|
||||
@@ -81,7 +81,7 @@ static int pageshift; /* log base 2 of the pagesize */
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_mem_p (glibtop *server)
|
||||
{
|
||||
register int pagesize;
|
||||
@@ -104,7 +104,7 @@ glibtop_init_proc_mem_p (glibtop *server)
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proc_segment = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_segment_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
@@ -43,7 +43,7 @@ glibtop_init_proc_segment_p (glibtop *server)
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_segment_p (glibtop *server,
|
||||
glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
|
||||
@@ -39,13 +39,13 @@ static const unsigned long _glibtop_sysdeps_proc_signal =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_signal_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_signal_p (glibtop *server,
|
||||
glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
|
||||
@@ -45,7 +45,7 @@ static const unsigned long _glibtop_sysdeps_proc_state_new =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_state_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state |
|
||||
@@ -54,7 +54,7 @@ glibtop_init_proc_state_p (glibtop *server)
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_state_p (glibtop *server,
|
||||
glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
|
||||
@@ -43,7 +43,7 @@ static const unsigned long _glibtop_sysdeps_proc_time_user =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_time_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time |
|
||||
@@ -119,7 +119,7 @@ calcru(p, up, sp, ip)
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ static const unsigned long _glibtop_sysdeps_proc_uid_groups =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_proc_uid_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid |
|
||||
@@ -56,7 +56,7 @@ glibtop_init_proc_uid_p (glibtop *server)
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#if defined(__bsdi__) && (_BSDI_VERSION < 199700)
|
||||
/* Older versions of BSDI don't seem to have this. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_sem_limits_p (glibtop *server)
|
||||
{ }
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
@@ -75,7 +75,7 @@ static struct nlist nlst [] = {
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_sem_limits_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine.kd, nlst) != 0) {
|
||||
@@ -94,7 +94,7 @@ glibtop_init_sem_limits_p (glibtop *server)
|
||||
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#if defined(__bsdi__) && (_BSDI_VERSION < 199700)
|
||||
/* Older versions of BSDI don't seem to have this. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_shm_limits_p (glibtop *server)
|
||||
{ }
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
@@ -73,7 +73,7 @@ static struct nlist nlst [] = {
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
if (kvm_nlist (server->machine.kd, nlst) != 0) {
|
||||
@@ -92,7 +92,7 @@ glibtop_init_shm_limits_p (glibtop *server)
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
|
||||
@@ -92,7 +92,7 @@ static struct nlist nlst2 [] = {
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_swap_p (glibtop *server)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__bsdi__)
|
||||
@@ -128,7 +128,7 @@ glibtop_init_swap_p (glibtop *server)
|
||||
* by Kevin Lahey <kml@rokkaku.atl.ga.us>.
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
|
||||
@@ -38,7 +38,7 @@ static const unsigned long _required_cpu_flags =
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_init_uptime_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
@@ -46,7 +46,7 @@ glibtop_init_uptime_p (glibtop *server)
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
int
|
||||
glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_cpu cpu;
|
||||
|
||||
Reference in New Issue
Block a user