Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Cosmetic changes.



details:   https://anonhg.NetBSD.org/src/rev/4d66bb9869db
branches:  trunk
changeset: 543666:4d66bb9869db
user:      enami <enami%NetBSD.org@localhost>
date:      Sat Mar 01 23:48:44 2003 +0000

description:
Cosmetic changes.

diffstat:

 sys/kern/kern_sysctl.c |  166 ++++++++++++++++++++++++------------------------
 1 files changed, 83 insertions(+), 83 deletions(-)

diffs (truncated from 469 to 300 lines):

diff -r f2e318c3ea83 -r 4d66bb9869db sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Sat Mar 01 22:55:02 2003 +0000
+++ b/sys/kern/kern_sysctl.c    Sat Mar 01 23:48:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.128 2003/03/01 05:41:56 atatat Exp $ */
+/*     $NetBSD: kern_sysctl.c,v 1.129 2003/03/01 23:48:44 enami Exp $  */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.128 2003/03/01 05:41:56 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.129 2003/03/01 23:48:44 enami Exp $");
 
 #include "opt_ddb.h"
 #include "opt_insecure.h"
@@ -168,7 +168,7 @@
        if (SCARG(uap, namelen) > CTL_MAXNAME || SCARG(uap, namelen) < 2)
                return (EINVAL);
        error = copyin(SCARG(uap, name), &name,
-                      SCARG(uap, namelen) * sizeof(int));
+           SCARG(uap, namelen) * sizeof(int));
        if (error)
                return (error);
 
@@ -178,8 +178,8 @@
         * this is checked in proc_sysctl() (once we know the targer proc).
         */
        if (SCARG(uap, new) != NULL && name[0] != CTL_PROC &&
-                   (error = suser(p->p_ucred, &p->p_acflag)))
-                       return error;
+           (error = suser(p->p_ucred, &p->p_acflag)))
+               return (error);
 
        switch (name[0]) {
        case CTL_KERN:
@@ -238,7 +238,7 @@
                error = uvm_vslock(p, SCARG(uap, old), oldlen, VM_PROT_WRITE);
                if (error) {
                        (void) lockmgr(&sysctl_memlock, LK_RELEASE, NULL);
-                       return error;
+                       return (error);
                }
                savelen = oldlen;
        }
@@ -280,7 +280,7 @@
 
 extern int     kern_logsigexit;
 extern fixpt_t ccpu;
-extern  int    forkfsleep;
+extern int     forkfsleep;
 extern int     dumponpanic;
 
 #ifndef MULTIPROCESSOR
@@ -322,7 +322,7 @@
        int ncpus = 0;
        for (CPU_INFO_FOREACH(cii, ci))
                ncpus++;
-       return ncpus;
+       return (ncpus);
 }
 
 #endif
@@ -385,7 +385,7 @@
            {
                int nmaxproc = maxproc;
 
-               error = (sysctl_int(oldp, oldlenp, newp, newlen, &nmaxproc));
+               error = sysctl_int(oldp, oldlenp, newp, newlen, &nmaxproc);
 
                if (!error && newp) {
                        if (nmaxproc < 0 || nmaxproc >= PID_MAX - PID_SKIP)
@@ -427,7 +427,7 @@
                return (error);
        case KERN_HOSTID:
                inthostid = hostid;  /* XXX assumes sizeof long <= sizeof int */
-               error =  sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);
+               error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);
                if (newp && !error)
                        hostid = inthostid;
                return (error);
@@ -474,10 +474,10 @@
                return (sysctl_ntptime(oldp, oldlenp));
 #endif
        case KERN_AUTONICETIME:
-               old_autonicetime = autonicetime;
-               error = sysctl_int(oldp, oldlenp, newp, newlen, &autonicetime);
+               old_autonicetime = autonicetime;
+               error = sysctl_int(oldp, oldlenp, newp, newlen, &autonicetime);
                if (autonicetime < 0)
-                       autonicetime = old_autonicetime;
+                       autonicetime = old_autonicetime;
                return (error);
        case KERN_AUTONICEVAL:
                error = sysctl_int(oldp, oldlenp, newp, newlen, &autoniceval);
@@ -576,7 +576,7 @@
                    sizeof consdev));
 #if NPTY > 0
        case KERN_MAXPTYS:
-               return sysctl_pty(oldp, oldlenp, newp, newlen);
+               return (sysctl_pty(oldp, oldlenp, newp, newlen));
 #endif
 #ifndef PIPE_SOCKETPAIR
        case KERN_PIPE:
@@ -621,7 +621,7 @@
                /* userland sees value in ms, internally is in ticks */
                int timo, lsleep = forkfsleep * 1000 / hz;
 
-               error = (sysctl_int(oldp, oldlenp, newp, newlen, &lsleep));
+               error = sysctl_int(oldp, oldlenp, newp, newlen, &lsleep);
                if (newp && !error) {
                        /* refuse negative values, and overly 'long time' */
                        if (lsleep < 0 || lsleep > MAXSLP * 1000)
@@ -642,7 +642,7 @@
        case KERN_POSIX_SEMAPHORES:     /* XXX _POSIX_VERSION */
 #ifdef P1003_1B_SEMAPHORE
                return (sysctl_rdint(oldp, oldlenp, newp, 200112));
-#else          
+#else
                return (sysctl_rdint(oldp, oldlenp, newp, 0));
 #endif
        case KERN_POSIX_BARRIERS:       /* XXX _POSIX_VERSION */
@@ -783,7 +783,7 @@
        u_int i;
 
        if (namelen < 2)
-               return EINVAL;
+               return (EINVAL);
 
        if (name[0] == PROC_CURPROC) {
                ptmp = p;
@@ -803,76 +803,76 @@
                }
                proclist_unlock_read();
                if (ptmp == NULL)
-                       return(ESRCH);
+                       return (ESRCH);
                if (p->p_ucred->cr_uid != 0) {
-                       if(p->p_cred->p_ruid != ptmp->p_cred->p_ruid ||
+                       if (p->p_cred->p_ruid != ptmp->p_cred->p_ruid ||
                            p->p_cred->p_ruid != ptmp->p_cred->p_svuid)
-                               return EPERM;
+                               return (EPERM);
                        if (ptmp->p_cred->p_rgid != ptmp->p_cred->p_svgid)
-                               return EPERM; /* sgid proc */
+                               return (EPERM); /* sgid proc */
                        for (i = 0; i < p->p_ucred->cr_ngroups; i++) {
                                if (p->p_ucred->cr_groups[i] ==
                                    ptmp->p_cred->p_rgid)
                                        break;
                        }
                        if (i == p->p_ucred->cr_ngroups)
-                               return EPERM;
+                               return (EPERM);
                }
        }
-       switch(name[1]) {
-       case PROC_PID_STOPFORK: 
+       switch (name[1]) {
+       case PROC_PID_STOPFORK:
                if (namelen != 2)
-                       return EINVAL;
+                       return (EINVAL);
                i = ((ptmp->p_flag & P_STOPFORK) != 0);
                if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &i)) != 0)
-                       return error;
+                       return (error);
                if (i != 0)
                        ptmp->p_flag |= P_STOPFORK;
                else
                        ptmp->p_flag &= ~P_STOPFORK;
-               return 0;
+               return (0);
                break;
-       
-       case PROC_PID_STOPEXEC: 
+
+       case PROC_PID_STOPEXEC:
                if (namelen != 2)
-                       return EINVAL;
+                       return (EINVAL);
                i = ((ptmp->p_flag & P_STOPEXEC) != 0);
                if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &i)) != 0)
-                       return error;
-               if (i != 0)     
+                       return (error);
+               if (i != 0)
                        ptmp->p_flag |= P_STOPEXEC;
                else
                        ptmp->p_flag &= ~P_STOPEXEC;
-               return 0;
+               return (0);
                break;
 
        case PROC_PID_CORENAME:
                if (namelen != 2)
-                       return EINVAL;
+                       return (EINVAL);
                /*
                 * Can't use sysctl_string() here because we may malloc a new
                 * area during the process, so we have to do it by hand.
                 */
                curlen = strlen(ptmp->p_limit->pl_corename) + 1;
-               if (oldlenp  && *oldlenp < curlen) {
+               if (oldlenp && *oldlenp < curlen) {
                        if (!oldp)
                                *oldlenp = curlen;
                        return (ENOMEM);
                }
                if (newp) {
                        if (securelevel > 2)
-                               return EPERM;
+                               return (EPERM);
                        if (newlen > MAXPATHLEN)
-                               return ENAMETOOLONG;
+                               return (ENAMETOOLONG);
                        tmps = malloc(newlen + 1, M_TEMP, M_WAITOK);
                        if (tmps == NULL)
-                               return ENOMEM;
+                               return (ENOMEM);
                        error = copyin(newp, tmps, newlen + 1);
                        tmps[newlen] = '\0';
                        if (error)
                                goto cleanup;
                        /* Enforce to be either 'core' for end with '.core' */
-                       if (newlen < 4)  { /* c.o.r.e */
+                       if (newlen < 4) {       /* c.o.r.e */
                                error = EINVAL;
                                goto cleanup;
                        }
@@ -920,7 +920,7 @@
 
        case PROC_PID_LIMIT:
                if (namelen != 4 || name[2] >= PROC_PID_LIMIT_MAXID)
-                       return EINVAL;
+                       return (EINVAL);
                memcpy(&alim, &ptmp->p_rlimit[name[2] - 1], sizeof(alim));
                if (name[3] == PROC_PID_LIMIT_TYPE_HARD)
                        error = sysctl_quad(oldp, oldlenp, newp, newlen,
@@ -928,16 +928,16 @@
                else if (name[3] == PROC_PID_LIMIT_TYPE_SOFT)
                        error = sysctl_quad(oldp, oldlenp, newp, newlen,
                            &alim.rlim_cur);
-               else 
-                       error = EINVAL;
+               else
+                       error = (EINVAL);
 
                if (error)
-                       return error;
+                       return (error);
 
                if (newp)
                        error = dosetrlimit(ptmp, p->p_cred,
                            name[2] - 1, &alim);
-               return error;
+               return (error);
                break;
 
        default:
@@ -954,7 +954,7 @@
 {
        static struct {
                const char *name;
-               int  type;
+               int type;
        } emulations[] = CTL_EMUL_NAMES;
        const struct emul *e;
        const char *ename;
@@ -980,7 +980,7 @@
        lockmgr(&exec_lock, LK_SHARED, NULL);
        if ((e = emul_search(ename))) {
                error = (*e->e_sysctl)(name + 1, namelen - 1, oldp, oldlenp,
-                               newp, newlen, p);
+                   newp, newlen, p);
        } else
                error = EOPNOTSUPP;
        lockmgr(&exec_lock, LK_RELEASE, NULL);
@@ -988,17 +988,19 @@
        return (error);
 #else
        for (i = 0; i < nexecs_builtin; i++) {
-           e = execsw_builtin[i].es_emul;
-           /*
-            * In order to match e.g. e->e_name "irix o32" with ename "irix", 
-            * we limit the comparison to the length of ename.
-            */
-           if (e == NULL || strncmp(ename, e->e_name, strlen(ename)) != 0 ||
-               e->e_sysctl == NULL)
-               continue;
+               e = execsw_builtin[i].es_emul;
+               /*
+                * In order to match e.g. e->e_name "irix o32"
+                * with ename "irix", we limit the comparison
+                * to the length of ename.
+                */
+               if (e == NULL ||
+                   strncmp(ename, e->e_name, strlen(ename)) != 0 ||



Home | Main Index | Thread Index | Old Index