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:
Martin Baulig
2000-11-20 16:52:30 +00:00
committed by Martin Baulig
parent 7a7e7d1bc3
commit c15ff3f342
29 changed files with 51 additions and 34 deletions

View File

@@ -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;
}

View File

@@ -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";

View File

@@ -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;

View File

@@ -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));
}