summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40e7714)
raw | patch | inline | side by side (parent: 40e7714)
author | Florian Forster <octo@noris.net> | |
Fri, 13 Mar 2009 17:23:20 +0000 (18:23 +0100) | ||
committer | Florian Forster <octo@noris.net> | |
Fri, 13 Mar 2009 17:23:20 +0000 (18:23 +0100) |
When the kstat chain has been updated (and init is called again),
get_kstat should overwrite the existing kstat pointer thingy.
get_kstat should overwrite the existing kstat pointer thingy.
src/common.c | patch | blob | history | |
src/memory.c | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 182f923dabe68e21dd8788e03863b437d4ab6030..122f96246bdb496460d3c9be37a2c2a02f079796 100644 (file)
--- a/src/common.c
+++ b/src/common.c
int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name)
{
char ident[128];
+
+ *ksp_ptr = NULL;
if (kc == NULL)
return (-1);
ssnprintf (ident, sizeof (ident), "%s,%i,%s", module, instance, name);
+ *ksp_ptr = kstat_lookup (kc, module, instance, name);
if (*ksp_ptr == NULL)
{
- if ((*ksp_ptr = kstat_lookup (kc, module, instance, name)) == NULL)
- {
- ERROR ("Cound not find kstat %s", ident);
- return (-1);
- }
+ ERROR ("get_kstat: Cound not find kstat %s", ident);
+ return (-1);
+ }
- if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED)
- {
- WARNING ("kstat %s has wrong type", ident);
- *ksp_ptr = NULL;
- return (-1);
- }
+ if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED)
+ {
+ ERROR ("get_kstat: kstat %s has wrong type", ident);
+ *ksp_ptr = NULL;
+ return (-1);
}
#ifdef assert
if (kstat_read (kc, *ksp_ptr, NULL) == -1)
{
- WARNING ("kstat %s could not be read", ident);
+ ERROR ("get_kstat: kstat %s could not be read", ident);
return (-1);
}
if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED)
{
- WARNING ("kstat %s has wrong type", ident);
+ ERROR ("get_kstat: kstat %s has wrong type", ident);
return (-1);
}
diff --git a/src/memory.c b/src/memory.c
index c31b30efe29b109cf3ae7c73055a48502c5b21fb..63c3e6ac12c5bfa63d5078ff9f0527c25b173974 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
#elif defined(HAVE_LIBKSTAT)
/* getpagesize(3C) tells me this does not fail.. */
pagesize = getpagesize ();
- if (get_kstat (&ksp, "unix", 0, "system_pages"))
+ if (get_kstat (&ksp, "unix", 0, "system_pages") != 0)
+ {
ksp = NULL;
+ return (-1);
+ }
#endif /* HAVE_LIBKSTAT */
return (0);