[BACK]Return to db_usrreq.c CVS log [TXT][DIR] Up to [local] / sys / ddb

Annotation of sys/ddb/db_usrreq.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: db_usrreq.c,v 1.12 2006/03/15 21:49:40 miod Exp $     */
                      2:
                      3: /*
                      4:  * Copyright (c) 1996 Michael Shalayeff.  All rights reserved.
                      5:  *
                      6:  * Redistribution and use in source and binary forms, with or without
                      7:  * modification, are permitted provided that the following conditions
                      8:  * are met:
                      9:  * 1. Redistributions of source code must retain the above copyright
                     10:  *    notice, this list of conditions and the following disclaimer.
                     11:  * 2. Redistributions in binary form must reproduce the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer in the
                     13:  *    documentation and/or other materials provided with the distribution.
                     14:  *
                     15:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     16:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     17:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     18:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     19:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     20:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     21:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     22:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     23:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     24:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     25:  */
                     26:
                     27: #include <sys/param.h>
                     28: #include <sys/types.h>
                     29: #include <sys/kernel.h>
                     30: #include <sys/proc.h>
                     31: #include <uvm/uvm_extern.h>
                     32: #include <sys/sysctl.h>
                     33:
                     34: #include <ddb/db_var.h>
                     35:
                     36: int    db_log = 1;
                     37:
                     38: int
                     39: ddb_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
                     40:     size_t newlen, struct proc *p)
                     41: {
                     42:        int error, ctlval;
                     43:
                     44:        /* All sysctl names at this level are terminal. */
                     45:        if (namelen != 1)
                     46:                return (ENOTDIR);
                     47:
                     48:        switch (name[0]) {
                     49:
                     50:        case DBCTL_RADIX:
                     51:                return sysctl_int(oldp, oldlenp, newp, newlen, &db_radix);
                     52:        case DBCTL_MAXWIDTH:
                     53:                return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_width);
                     54:        case DBCTL_TABSTOP:
                     55:                return sysctl_int(oldp, oldlenp, newp, newlen, &db_tab_stop_width);
                     56:        case DBCTL_MAXLINE:
                     57:                return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_line);
                     58:        case DBCTL_PANIC:
                     59:                if (securelevel > 0)
                     60:                        return (sysctl_int_lower(oldp, oldlenp, newp, newlen,
                     61:                            &db_panic));
                     62:                else {
                     63:                        ctlval = db_panic;
                     64:                        if ((error = sysctl_int(oldp, oldlenp, newp, newlen,
                     65:                            &ctlval)) || newp == NULL)
                     66:                                return (error);
                     67:                        if (ctlval != 1 && ctlval != 0)
                     68:                                return (EINVAL);
                     69:                        db_panic = ctlval;
                     70:                        return (0);
                     71:                }
                     72:                break;
                     73:        case DBCTL_CONSOLE:
                     74:                if (securelevel > 0)
                     75:                        return (sysctl_int_lower(oldp, oldlenp, newp, newlen,
                     76:                            &db_console));
                     77:                else {
                     78:                        ctlval = db_console;
                     79:                        if ((error = sysctl_int(oldp, oldlenp, newp, newlen,
                     80:                            &ctlval)) || newp == NULL)
                     81:                                return (error);
                     82:                        if (ctlval != 1 && ctlval != 0)
                     83:                                return (EINVAL);
                     84:                        db_console = ctlval;
                     85:                        return (0);
                     86:                }
                     87:                break;
                     88:        case DBCTL_LOG:
                     89:                return (sysctl_int(oldp, oldlenp, newp, newlen, &db_log));
                     90:        default:
                     91:                return (EOPNOTSUPP);
                     92:        }
                     93:        /* NOTREACHED */
                     94: }

CVSweb