summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <baulig@suse.de>2000-11-20 16:52:30 +0000
committerMartin Baulig <martin@src.gnome.org>2000-11-20 16:52:30 +0000
commitc15ff3f342e7f5eb74a5f5867ebe87c89d9a5cb0 (patch)
treea4503fc843e3130ea2cd553338e4771bacc7828e
parent7a7e7d1bc3064a8ec605536be7f68aac5e5cf11f (diff)
downloadlibgtop-c15ff3f342e7f5eb74a5f5867ebe87c89d9a5cb0.tar.gz
New type. (glibtop): Added `glibtop_server_info *info', moved `ncpu',
2000-11-20 Martin Baulig <baulig@suse.de> * glibtop.h (glibtop_server_info): New type. (glibtop): Added `glibtop_server_info *info', moved `ncpu', `features', `sysdeps', `required' and `wanted' info glibtop_server_info.
-rw-r--r--ChangeLog7
-rw-r--r--backends/sysdeps/backend-sysdeps.c2
-rw-r--r--glibtop.h16
-rw-r--r--lib/init.c8
-rwxr-xr-xlib/lib.pl4
-rw-r--r--lib/open.c2
-rw-r--r--lib/sysdeps.c2
-rw-r--r--sysdeps/stub/cpu.c2
-rw-r--r--sysdeps/stub/interfaces.c2
-rw-r--r--sysdeps/stub/loadavg.c2
-rw-r--r--sysdeps/stub/mem.c2
-rw-r--r--sysdeps/stub/msg_limits.c2
-rw-r--r--sysdeps/stub/netload.c2
-rw-r--r--sysdeps/stub/ppp.c2
-rw-r--r--sysdeps/stub/procargs.c2
-rw-r--r--sysdeps/stub/proccwd.c2
-rw-r--r--sysdeps/stub/prockernel.c2
-rw-r--r--sysdeps/stub/proclist.c2
-rw-r--r--sysdeps/stub/procmap.c2
-rw-r--r--sysdeps/stub/procmem.c2
-rw-r--r--sysdeps/stub/procsegment.c2
-rw-r--r--sysdeps/stub/procsignal.c2
-rw-r--r--sysdeps/stub/procstate.c2
-rw-r--r--sysdeps/stub/proctime.c2
-rw-r--r--sysdeps/stub/procuid.c2
-rw-r--r--sysdeps/stub/sem_limits.c2
-rw-r--r--sysdeps/stub/shm_limits.c2
-rw-r--r--sysdeps/stub/swap.c2
-rw-r--r--sysdeps/stub/uptime.c2
29 files changed, 51 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index f82871f9..80e225af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2000-11-20 Martin Baulig <baulig@suse.de>
+ * glibtop.h (glibtop_server_info): New type.
+ (glibtop): Added `glibtop_server_info *info', moved
+ `ncpu', `features', `sysdeps', `required' and `wanted'
+ info glibtop_server_info.
+
+2000-11-20 Martin Baulig <baulig@suse.de>
+
* autogen.sh: Use gnome-common.
* configure.in: Require glib HEAD.
diff --git a/backends/sysdeps/backend-sysdeps.c b/backends/sysdeps/backend-sysdeps.c
index 24878e24..69217cbb 100644
--- a/backends/sysdeps/backend-sysdeps.c
+++ b/backends/sysdeps/backend-sysdeps.c
@@ -68,7 +68,7 @@ _open_sysdeps (glibtop *server, glibtop_backend *backend,
for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++)
(*init_fkt) (server);
- server->sysdeps.pointer_size = sizeof (void*)*8;
+ server->info->sysdeps.pointer_size = sizeof (void*)*8;
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
}
diff --git a/glibtop.h b/glibtop.h
index 5c3c7a4c..eb6af6f0 100644
--- a/glibtop.h
+++ b/glibtop.h
@@ -40,6 +40,7 @@ BEGIN_LIBGTOP_DECLS
typedef struct _glibtop glibtop;
typedef struct _glibtop_server_private glibtop_server_private;
+typedef struct _glibtop_server_info glibtop_server_info;
#include <glibtop/sysdeps.h>
#include <glibtop/errors.h>
@@ -50,20 +51,25 @@ typedef struct _glibtop_server_private glibtop_server_private;
#include <glibtop-server-private.h>
#endif
+struct _glibtop_server_info
+{
+ int ncpu; /* Number of CPUs, zero if single-processor */
+ unsigned long features; /* Server is required for this features */
+ glibtop_sysdeps sysdeps; /* Detailed feature list */
+ glibtop_sysdeps required; /* Required feature list */
+ glibtop_sysdeps wanted; /* We only want this features */
+};
+
struct _glibtop
{
int refcount; /* Reference count */
unsigned flags;
- int ncpu; /* Number of CPUs, zero if single-processor */
unsigned long os_version_code; /* Version code of the operating system */
const char *name; /* Program name for error messages */
- unsigned long features; /* Server is required for this features */
unsigned long server_port; /* Port on which daemon is listening */
- glibtop_sysdeps sysdeps; /* Detailed feature list */
- glibtop_sysdeps required; /* Required feature list */
- glibtop_sysdeps wanted; /* We only want this features */
glibtop_parameter _param; /* Server parameter */
glibtop_server_private *_priv; /* Private data */
+ glibtop_server_info *info; /* Server Info */
unsigned glibtop_errno;
};
diff --git a/lib/init.c b/lib/init.c
index 32a0a4cc..90a4a32c 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -77,6 +77,10 @@ glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
if (flags & GLIBTOP_INIT_NO_INIT)
return server;
+ if (!server->info) {
+ server->info = g_new0 (glibtop_server_info, 1);
+ }
+
/* Do the initialization, but only if not already initialized. */
if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
@@ -90,7 +94,7 @@ glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
features = 0;
}
- server->features = features;
+ server->info->features = features;
server->flags |= _GLIBTOP_INIT_STATE_INIT;
}
@@ -128,7 +132,7 @@ glibtop_init_s (glibtop **server_ptr, unsigned long features, unsigned flags)
return server;
if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
- server->sysdeps.pointer_size = sizeof (void*)*8;
+ server->info->sysdeps.pointer_size = sizeof (void*)*8;
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
}
diff --git a/lib/lib.pl b/lib/lib.pl
index 64d46293..c8a2a147 100755
--- a/lib/lib.pl
+++ b/lib/lib.pl
@@ -222,9 +222,9 @@ sub output {
$check_code = "check_missing:\n";
$check_code .= "\t/* Make sure that all required fields are present. */\n";
if (!(($line_fields[3] eq '') or ($line_fields[3] eq 'array'))) {
- $check_code .= "\tif (buf->flags & server->required." . $feature . ")\n";
+ $check_code .= "\tif (buf->flags & server->info->required." . $feature . ")\n";
$check_code .= "\t\t_glibtop_missing_feature (server, \"" . $feature .
- "\", buf->flags,\n\t\t\t\t\t &server->required." . $feature . ");\n";
+ "\", buf->flags,\n\t\t\t\t\t &server->info->required." . $feature . ");\n";
}
$total_code .= $check_code."\tgoto do_return;\n\n";
diff --git a/lib/open.c b/lib/open.c
index d77e2c3e..96128b02 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -36,7 +36,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
_glibtop_open_sysdeps (server, "glibtop", features, flags);
- server->_param.ncpu = server->ncpu;
+ server->_param.ncpu = server->info->ncpu;
server->_param.os_version_code = server->os_version_code;
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
diff --git a/lib/sysdeps.c b/lib/sysdeps.c
index 686663e8..6725eed7 100644
--- a/lib/sysdeps.c
+++ b/lib/sysdeps.c
@@ -52,5 +52,5 @@ GLIBTOP_SUID_PPP;
void
glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf)
{
- memcpy (buf, &server->sysdeps, sizeof (glibtop_sysdeps));
+ memcpy (buf, &server->info->sysdeps, sizeof (glibtop_sysdeps));
}
diff --git a/sysdeps/stub/cpu.c b/sysdeps/stub/cpu.c
index 2eefe798..c6b2dee9 100644
--- a/sysdeps/stub/cpu.c
+++ b/sysdeps/stub/cpu.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_cpu = 0;
int
glibtop_init_cpu_s (glibtop *server)
{
- server->sysdeps.cpu = _glibtop_sysdeps_cpu;
+ server->info->sysdeps.cpu = _glibtop_sysdeps_cpu;
return 0;
}
diff --git a/sysdeps/stub/interfaces.c b/sysdeps/stub/interfaces.c
index 1c2035ba..319f4ee6 100644
--- a/sysdeps/stub/interfaces.c
+++ b/sysdeps/stub/interfaces.c
@@ -36,7 +36,7 @@ static const unsigned long _glibtop_sysdeps_interface_names =
int
glibtop_init_interface_names_s (glibtop *server)
{
- server->sysdeps.interface_names = _glibtop_sysdeps_interface_names;
+ server->info->sysdeps.interface_names = _glibtop_sysdeps_interface_names;
return 0;
}
diff --git a/sysdeps/stub/loadavg.c b/sysdeps/stub/loadavg.c
index ca6ca730..c666d2ca 100644
--- a/sysdeps/stub/loadavg.c
+++ b/sysdeps/stub/loadavg.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_loadavg = 0;
int
glibtop_init_loadavg_s (glibtop *server)
{
- server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
+ server->info->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
return 0;
}
diff --git a/sysdeps/stub/mem.c b/sysdeps/stub/mem.c
index 256b057b..3b16c0a9 100644
--- a/sysdeps/stub/mem.c
+++ b/sysdeps/stub/mem.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_mem = 0;
int
glibtop_init_mem_s (glibtop *server)
{
- server->sysdeps.mem = _glibtop_sysdeps_mem;
+ server->info->sysdeps.mem = _glibtop_sysdeps_mem;
return 0;
}
diff --git a/sysdeps/stub/msg_limits.c b/sysdeps/stub/msg_limits.c
index 7a2e30da..f917678c 100644
--- a/sysdeps/stub/msg_limits.c
+++ b/sysdeps/stub/msg_limits.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_msg_limits = 0;
int
glibtop_init_msg_limits_s (glibtop *server)
{
- server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
+ server->info->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
return 0;
}
diff --git a/sysdeps/stub/netload.c b/sysdeps/stub/netload.c
index 8f34d41b..e0f974b1 100644
--- a/sysdeps/stub/netload.c
+++ b/sysdeps/stub/netload.c
@@ -34,7 +34,7 @@ static const unsigned long _glibtop_sysdeps_netload = 0;
int
glibtop_init_netload_s (glibtop *server)
{
- server->sysdeps.netload = _glibtop_sysdeps_netload;
+ server->info->sysdeps.netload = _glibtop_sysdeps_netload;
return 0;
}
diff --git a/sysdeps/stub/ppp.c b/sysdeps/stub/ppp.c
index a5cd1e0a..0b177842 100644
--- a/sysdeps/stub/ppp.c
+++ b/sysdeps/stub/ppp.c
@@ -34,7 +34,7 @@ static const unsigned long _glibtop_sysdeps_ppp = 0;
int
glibtop_init_ppp_s (glibtop *server)
{
- server->sysdeps.ppp = _glibtop_sysdeps_ppp;
+ server->info->sysdeps.ppp = _glibtop_sysdeps_ppp;
return 0;
}
diff --git a/sysdeps/stub/procargs.c b/sysdeps/stub/procargs.c
index 19cd9149..15d2a749 100644
--- a/sysdeps/stub/procargs.c
+++ b/sysdeps/stub/procargs.c
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proc_args = 0;
int
glibtop_init_proc_args_s (glibtop *server)
{
- server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
+ server->info->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
return 0;
}
diff --git a/sysdeps/stub/proccwd.c b/sysdeps/stub/proccwd.c
index 8e2dd71c..daca2964 100644
--- a/sysdeps/stub/proccwd.c
+++ b/sysdeps/stub/proccwd.c
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proc_cwd = 0;
int
glibtop_init_proc_cwd_s (glibtop *server)
{
- server->sysdeps.proc_cwd = _glibtop_sysdeps_proc_cwd;
+ server->info->sysdeps.proc_cwd = _glibtop_sysdeps_proc_cwd;
return 0;
}
diff --git a/sysdeps/stub/prockernel.c b/sysdeps/stub/prockernel.c
index c596a532..90ea5d82 100644
--- a/sysdeps/stub/prockernel.c
+++ b/sysdeps/stub/prockernel.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
int
glibtop_init_proc_kernel_s (glibtop *server)
{
- server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
+ server->info->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
return 0;
}
diff --git a/sysdeps/stub/proclist.c b/sysdeps/stub/proclist.c
index 49ecd987..0cfd699d 100644
--- a/sysdeps/stub/proclist.c
+++ b/sysdeps/stub/proclist.c
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proclist = 0;
int
glibtop_init_proclist_s (glibtop *server)
{
- server->sysdeps.proclist = _glibtop_sysdeps_proclist;
+ server->info->sysdeps.proclist = _glibtop_sysdeps_proclist;
return 0;
}
diff --git a/sysdeps/stub/procmap.c b/sysdeps/stub/procmap.c
index 39968d0f..b8c60491 100644
--- a/sysdeps/stub/procmap.c
+++ b/sysdeps/stub/procmap.c
@@ -36,7 +36,7 @@ static const unsigned long _glibtop_sysdeps_proc_map = 0;
int
glibtop_init_proc_map_s (glibtop *server)
{
- server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
+ server->info->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
return 0;
}
diff --git a/sysdeps/stub/procmem.c b/sysdeps/stub/procmem.c
index de2beaa7..51b2df11 100644
--- a/sysdeps/stub/procmem.c
+++ b/sysdeps/stub/procmem.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_mem = 0;
int
glibtop_init_proc_mem_s (glibtop *server)
{
- server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
+ server->info->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
return 0;
}
diff --git a/sysdeps/stub/procsegment.c b/sysdeps/stub/procsegment.c
index aab29e9e..7f20dd9c 100644
--- a/sysdeps/stub/procsegment.c
+++ b/sysdeps/stub/procsegment.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_segment = 0;
int
glibtop_init_proc_segment_s (glibtop *server)
{
- server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
+ server->info->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
return 0;
}
diff --git a/sysdeps/stub/procsignal.c b/sysdeps/stub/procsignal.c
index 48cd54a1..e6fdd529 100644
--- a/sysdeps/stub/procsignal.c
+++ b/sysdeps/stub/procsignal.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_signal = 0;
int
glibtop_init_proc_signal_s (glibtop *server)
{
- server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
+ server->info->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
return 0;
}
diff --git a/sysdeps/stub/procstate.c b/sysdeps/stub/procstate.c
index c084017a..008517b6 100644
--- a/sysdeps/stub/procstate.c
+++ b/sysdeps/stub/procstate.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_state = 0;
int
glibtop_init_proc_state_s (glibtop *server)
{
- server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
+ server->info->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
return 0;
}
diff --git a/sysdeps/stub/proctime.c b/sysdeps/stub/proctime.c
index 9e9cad05..470c8be4 100644
--- a/sysdeps/stub/proctime.c
+++ b/sysdeps/stub/proctime.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_time = 0;
int
glibtop_init_proc_time_s (glibtop *server)
{
- server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
+ server->info->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
return 0;
}
diff --git a/sysdeps/stub/procuid.c b/sysdeps/stub/procuid.c
index 50224d3a..652b1be8 100644
--- a/sysdeps/stub/procuid.c
+++ b/sysdeps/stub/procuid.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_uid = 0;
int
glibtop_init_proc_uid_s (glibtop *server)
{
- server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
+ server->info->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
return 0;
}
diff --git a/sysdeps/stub/sem_limits.c b/sysdeps/stub/sem_limits.c
index 74d34345..f1265180 100644
--- a/sysdeps/stub/sem_limits.c
+++ b/sysdeps/stub/sem_limits.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_sem_limits = 0;
int
glibtop_init_sem_limits_s (glibtop *server)
{
- server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
+ server->info->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
return 0;
}
diff --git a/sysdeps/stub/shm_limits.c b/sysdeps/stub/shm_limits.c
index 2bd2b8d6..7807faef 100644
--- a/sysdeps/stub/shm_limits.c
+++ b/sysdeps/stub/shm_limits.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_shm_limits = 0;
int
glibtop_init_shm_limits_s (glibtop *server)
{
- server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
+ server->info->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
return 0;
}
diff --git a/sysdeps/stub/swap.c b/sysdeps/stub/swap.c
index 0d1b5b36..b3451b67 100644
--- a/sysdeps/stub/swap.c
+++ b/sysdeps/stub/swap.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_swap = 0;
int
glibtop_init_swap_s (glibtop *server)
{
- server->sysdeps.swap = _glibtop_sysdeps_swap;
+ server->info->sysdeps.swap = _glibtop_sysdeps_swap;
return 0;
}
diff --git a/sysdeps/stub/uptime.c b/sysdeps/stub/uptime.c
index d22ab49f..5829f700 100644
--- a/sysdeps/stub/uptime.c
+++ b/sysdeps/stub/uptime.c
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_uptime = 0;
int
glibtop_init_uptime_s (glibtop *server)
{
- server->sysdeps.uptime = _glibtop_sysdeps_uptime;
+ server->info->sysdeps.uptime = _glibtop_sysdeps_uptime;
return 0;
}