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.
This commit is contained in:
committed by
Martin Baulig
parent
7a7e7d1bc3
commit
c15ff3f342
@@ -1,3 +1,10 @@
|
|||||||
|
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>
|
2000-11-20 Martin Baulig <baulig@suse.de>
|
||||||
|
|
||||||
* autogen.sh: Use gnome-common.
|
* autogen.sh: Use gnome-common.
|
||||||
|
@@ -68,7 +68,7 @@ _open_sysdeps (glibtop *server, glibtop_backend *backend,
|
|||||||
for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++)
|
for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++)
|
||||||
(*init_fkt) (server);
|
(*init_fkt) (server);
|
||||||
|
|
||||||
server->sysdeps.pointer_size = sizeof (void*)*8;
|
server->info->sysdeps.pointer_size = sizeof (void*)*8;
|
||||||
|
|
||||||
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
||||||
}
|
}
|
||||||
|
16
glibtop.h
16
glibtop.h
@@ -40,6 +40,7 @@ BEGIN_LIBGTOP_DECLS
|
|||||||
|
|
||||||
typedef struct _glibtop glibtop;
|
typedef struct _glibtop glibtop;
|
||||||
typedef struct _glibtop_server_private glibtop_server_private;
|
typedef struct _glibtop_server_private glibtop_server_private;
|
||||||
|
typedef struct _glibtop_server_info glibtop_server_info;
|
||||||
|
|
||||||
#include <glibtop/sysdeps.h>
|
#include <glibtop/sysdeps.h>
|
||||||
#include <glibtop/errors.h>
|
#include <glibtop/errors.h>
|
||||||
@@ -50,20 +51,25 @@ typedef struct _glibtop_server_private glibtop_server_private;
|
|||||||
#include <glibtop-server-private.h>
|
#include <glibtop-server-private.h>
|
||||||
#endif
|
#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
|
struct _glibtop
|
||||||
{
|
{
|
||||||
int refcount; /* Reference count */
|
int refcount; /* Reference count */
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
int ncpu; /* Number of CPUs, zero if single-processor */
|
|
||||||
unsigned long os_version_code; /* Version code of the operating system */
|
unsigned long os_version_code; /* Version code of the operating system */
|
||||||
const char *name; /* Program name for error messages */
|
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 */
|
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_parameter _param; /* Server parameter */
|
||||||
glibtop_server_private *_priv; /* Private data */
|
glibtop_server_private *_priv; /* Private data */
|
||||||
|
glibtop_server_info *info; /* Server Info */
|
||||||
unsigned glibtop_errno;
|
unsigned glibtop_errno;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -77,6 +77,10 @@ glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
|
|||||||
if (flags & GLIBTOP_INIT_NO_INIT)
|
if (flags & GLIBTOP_INIT_NO_INIT)
|
||||||
return server;
|
return server;
|
||||||
|
|
||||||
|
if (!server->info) {
|
||||||
|
server->info = g_new0 (glibtop_server_info, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Do the initialization, but only if not already initialized. */
|
/* Do the initialization, but only if not already initialized. */
|
||||||
|
|
||||||
if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
|
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;
|
features = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
server->features = features;
|
server->info->features = features;
|
||||||
|
|
||||||
server->flags |= _GLIBTOP_INIT_STATE_INIT;
|
server->flags |= _GLIBTOP_INIT_STATE_INIT;
|
||||||
}
|
}
|
||||||
@@ -128,7 +132,7 @@ glibtop_init_s (glibtop **server_ptr, unsigned long features, unsigned flags)
|
|||||||
return server;
|
return server;
|
||||||
|
|
||||||
if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
|
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;
|
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
||||||
}
|
}
|
||||||
|
@@ -222,9 +222,9 @@ sub output {
|
|||||||
$check_code = "check_missing:\n";
|
$check_code = "check_missing:\n";
|
||||||
$check_code .= "\t/* Make sure that all required fields are present. */\n";
|
$check_code .= "\t/* Make sure that all required fields are present. */\n";
|
||||||
if (!(($line_fields[3] eq '') or ($line_fields[3] eq 'array'))) {
|
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 .
|
$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";
|
$total_code .= $check_code."\tgoto do_return;\n\n";
|
||||||
|
@@ -36,7 +36,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
|
|
||||||
_glibtop_open_sysdeps (server, "glibtop", features, flags);
|
_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->_param.os_version_code = server->os_version_code;
|
||||||
|
|
||||||
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
||||||
|
@@ -52,5 +52,5 @@ GLIBTOP_SUID_PPP;
|
|||||||
void
|
void
|
||||||
glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf)
|
glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf)
|
||||||
{
|
{
|
||||||
memcpy (buf, &server->sysdeps, sizeof (glibtop_sysdeps));
|
memcpy (buf, &server->info->sysdeps, sizeof (glibtop_sysdeps));
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_cpu = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_cpu_s (glibtop *server)
|
glibtop_init_cpu_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
server->info->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ static const unsigned long _glibtop_sysdeps_interface_names =
|
|||||||
int
|
int
|
||||||
glibtop_init_interface_names_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_loadavg = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_loadavg_s (glibtop *server)
|
glibtop_init_loadavg_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
server->info->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_mem = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_mem_s (glibtop *server)
|
glibtop_init_mem_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
server->info->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_msg_limits = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_msg_limits_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ static const unsigned long _glibtop_sysdeps_netload = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_netload_s (glibtop *server)
|
glibtop_init_netload_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
server->info->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ static const unsigned long _glibtop_sysdeps_ppp = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_ppp_s (glibtop *server)
|
glibtop_init_ppp_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
server->info->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_args_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proc_cwd = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_cwd_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_kernel_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ static const unsigned long _glibtop_sysdeps_proclist = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proclist_s (glibtop *server)
|
glibtop_init_proclist_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
server->info->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_map_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_mem = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_mem_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_segment = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_segment_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_signal = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_signal_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_state = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_state_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_time = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_time_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_uid = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_proc_uid_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_sem_limits = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_sem_limits_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_shm_limits = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_shm_limits_s (glibtop *server)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_swap = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_swap_s (glibtop *server)
|
glibtop_init_swap_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
server->info->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_uptime = 0;
|
|||||||
int
|
int
|
||||||
glibtop_init_uptime_s (glibtop *server)
|
glibtop_init_uptime_s (glibtop *server)
|
||||||
{
|
{
|
||||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
server->info->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user