Source-Changes-HG archive

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

[src/trunk]: src/share/man/man9 - add the bool type for IMMEDIATE flag.



details:   https://anonhg.NetBSD.org/src/rev/892f10798fa3
branches:  trunk
changeset: 771863:892f10798fa3
user:      jym <jym%NetBSD.org@localhost>
date:      Sun Dec 04 18:34:20 2011 +0000

description:
- add the bool type for IMMEDIATE flag.
- minor tweak to the handler example: it leaks 't' (on stack)
  when passed to sysctl_lookup(9), as it copyout its content via
  sysctl_data. That would not be the case if CTLFLAG_IMMEDIATE flag
  was set for this node but the example does not preclude that.

diffstat:

 share/man/man9/sysctl.9 |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r f38da6473704 -r 892f10798fa3 share/man/man9/sysctl.9
--- a/share/man/man9/sysctl.9   Sun Dec 04 17:00:10 2011 +0000
+++ b/share/man/man9/sysctl.9   Sun Dec 04 18:34:20 2011 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysctl.9,v 1.17 2010/05/16 05:18:35 jruoho Exp $
+.\"    $NetBSD: sysctl.9,v 1.18 2011/12/04 18:34:20 jym Exp $
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 16, 2010
+.Dd December 4, 2011
 .Dt SYSCTL 9
 .Os
 .Sh NAME
@@ -421,6 +421,7 @@
 flag is set, the
 .Fa qv
 argument will be interpreted as the initial value for the new
+.Dq bool ,
 .Dq int
 or
 .Dq quad
@@ -504,6 +505,8 @@
        struct sysctlnode node;
        int t, error;
 
+       t = *(int *)rnode-\*[Gt]sysctl_data;
+
        node = *rnode;
        node.sysctl_data = \*[Am]t;
        error = sysctl_lookup(SYSCTLFN_CALL(\*[Am]node));
@@ -513,7 +516,7 @@
        if (t \*[Lt] 0 || t \*[Gt] 20)
                return (EINVAL);
 
-       *(int*)rnode-\*[Gt]sysctl_data = t;
+       *(int *)rnode-\*[Gt]sysctl_data = t;
        return (0);
 }
 .Ed



Home | Main Index | Thread Index | Old Index