Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern First caller to set a description on a node sets it...



details:   https://anonhg.NetBSD.org/src/rev/ff282583468d
branches:  trunk
changeset: 565399:ff282583468d
user:      atatat <atatat%NetBSD.org@localhost>
date:      Tue Apr 06 18:52:35 2004 +0000

description:
First caller to set a description on a node sets it.  This allows one
setup function to set the description, even if the node has been
instantiated elsewhere.  Or not, depending on the other that the setup
functions are called.

diffstat:

 sys/kern/kern_sysctl.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 624882d7a09c -r ff282583468d sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Tue Apr 06 16:49:56 2004 +0000
+++ b/sys/kern/kern_sysctl.c    Tue Apr 06 18:52:35 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.170 2004/04/01 04:50:06 atatat Exp $ */
+/*     $NetBSD: kern_sysctl.c,v 1.171 2004/04/06 18:52:35 atatat Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.170 2004/04/01 04:50:06 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.171 2004/04/06 18:52:35 atatat Exp $");
 
 #include "opt_defcorename.h"
 #include "opt_insecure.h"
@@ -2007,13 +2007,21 @@
                        if (cnode != NULL)
                                *cnode = pnode;
                        if (descr != NULL) {
-                               if (flags & CTLFLAG_OWNDESC) {
+                               /*
+                                * allow first caller to *set* a
+                                * description actually to set it
+                                */
+                               if (pnode->sysctl_desc != NULL)
+                                       /* skip it...we've got one */;
+                               else if (flags & CTLFLAG_OWNDESC) {
                                        size_t l = strlen(descr) + 1;
                                        char *d = malloc(l, M_SYSCTLDATA,
                                                         M_WAITOK|M_CANFAIL);
                                        if (d != NULL) {
                                                memcpy(d, descr, l);
                                                pnode->sysctl_desc = d;
+                                               pnode->sysctl_flags |=
+                                                   CTLFLAG_OWNDESC;
                                        }
                                }
                                else



Home | Main Index | Thread Index | Old Index