Source-Changes-HG archive

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

[src/trunk]: src/sys eliminate the KERN_* error codes in favor of the traditi...



details:   https://anonhg.NetBSD.org/src/rev/2ff72796dc18
branches:  trunk
changeset: 507149:2ff72796dc18
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Mar 15 06:10:32 2001 +0000

description:
eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS                    0
KERN_INVALID_ADDRESS            EFAULT
KERN_PROTECTION_FAILURE         EACCES
KERN_NO_SPACE                   ENOMEM
KERN_INVALID_ARGUMENT           EINVAL
KERN_FAILURE                    various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE          ENOMEM
KERN_NOT_RECEIVER               <unused>
KERN_NO_ACCESS                  <unused>
KERN_PAGES_LOCKED               <unused>

diffstat:

 sys/arch/alpha/alpha/machdep.c         |    6 +-
 sys/arch/alpha/alpha/pmap.c            |   29 +-
 sys/arch/alpha/alpha/trap.c            |   14 +-
 sys/arch/amiga/amiga/machdep.c         |    4 +-
 sys/arch/amiga/amiga/pmap.c            |   21 +-
 sys/arch/amiga/amiga/trap.c            |   28 +-
 sys/arch/amiga/dev/clock.c             |    6 +-
 sys/arch/amiga/dev/gayle_pcmcia.c      |    4 +-
 sys/arch/amigappc/amigappc/machdep.c   |    4 +-
 sys/arch/arc/arc/machdep.c             |    4 +-
 sys/arch/arm/arm32/pmap.c              |    8 +-
 sys/arch/arm26/arm26/except.c          |   12 +-
 sys/arch/arm26/arm26/machdep.c         |    6 +-
 sys/arch/arm26/arm26/pmap.c            |    6 +-
 sys/arch/arm32/arm32/fault.c           |   14 +-
 sys/arch/arm32/arm32/machdep.c         |    4 +-
 sys/arch/atari/atari/machdep.c         |    9 +-
 sys/arch/atari/atari/pmap.c            |   19 +-
 sys/arch/atari/atari/trap.c            |   12 +-
 sys/arch/bebox/bebox/machdep.c         |    4 +-
 sys/arch/cobalt/cobalt/machdep.c       |    4 +-
 sys/arch/hp300/dev/grf.c               |    7 +-
 sys/arch/hp300/hp300/machdep.c         |    9 +-
 sys/arch/hp300/hp300/pmap.c            |   23 +-
 sys/arch/hp300/hp300/trap.c            |   16 +-
 sys/arch/hpcarm/hpcarm/fault.c         |   13 +-
 sys/arch/hpcarm/hpcarm/machdep.c       |    4 +-
 sys/arch/hpcmips/hpcmips/machdep.c     |    6 +-
 sys/arch/i386/i386/machdep.c           |    4 +-
 sys/arch/i386/i386/pmap.c              |   13 +-
 sys/arch/i386/i386/trap.c              |   15 +-
 sys/arch/luna68k/luna68k/machdep.c     |   10 +-
 sys/arch/luna68k/luna68k/pmap.c        |   19 +-
 sys/arch/luna68k/luna68k/trap.c        |   14 +-
 sys/arch/mac68k/dev/grf_compat.c       |    9 +-
 sys/arch/mac68k/mac68k/machdep.c       |    4 +-
 sys/arch/mac68k/mac68k/pmap.c          |   19 +-
 sys/arch/mac68k/mac68k/trap.c          |   12 +-
 sys/arch/macppc/macppc/machdep.c       |    4 +-
 sys/arch/mips/mips/pmap.c              |   10 +-
 sys/arch/mips/mips/trap.c              |   23 +-
 sys/arch/mipsco/mipsco/machdep.c       |    6 +-
 sys/arch/mvme68k/mvme68k/machdep.c     |    8 +-
 sys/arch/mvme68k/mvme68k/pmap.c        |   23 +-
 sys/arch/mvme68k/mvme68k/trap.c        |   16 +-
 sys/arch/news68k/news68k/machdep.c     |    9 +-
 sys/arch/news68k/news68k/pmap.c        |   23 +-
 sys/arch/news68k/news68k/trap.c        |   16 +-
 sys/arch/newsmips/newsmips/machdep.c   |    6 +-
 sys/arch/next68k/next68k/machdep.c     |    8 +-
 sys/arch/next68k/next68k/pmap.c        |   27 +-
 sys/arch/next68k/next68k/trap.c        |   16 +-
 sys/arch/ofppc/ofppc/machdep.c         |    4 +-
 sys/arch/pc532/pc532/machdep.c         |    6 +-
 sys/arch/pc532/pc532/pmap.c            |   13 +-
 sys/arch/pc532/pc532/trap.c            |   10 +-
 sys/arch/pmax/pmax/machdep.c           |    6 +-
 sys/arch/powerpc/powerpc/pmap.c        |    6 +-
 sys/arch/powerpc/powerpc/trap.c        |   18 +-
 sys/arch/prep/prep/machdep.c           |    4 +-
 sys/arch/sandpoint/sandpoint/machdep.c |    4 +-
 sys/arch/sgimips/sgimips/machdep.c     |    4 +-
 sys/arch/sh3/sh3/pmap.c                |   12 +-
 sys/arch/sh3/sh3/sh3_machdep.c         |    4 +-
 sys/arch/sh3/sh3/trap.c                |   16 +-
 sys/arch/sparc/sparc/machdep.c         |    4 +-
 sys/arch/sparc/sparc/pmap.c            |   48 +----
 sys/arch/sparc/sparc/trap.c            |   37 +-
 sys/arch/sparc64/sparc64/machdep.c     |    8 +-
 sys/arch/sparc64/sparc64/pmap.c        |    8 +-
 sys/arch/sparc64/sparc64/trap.c        |   41 ++--
 sys/arch/sun3/sun3/machdep.c           |    6 +-
 sys/arch/sun3/sun3/pmap.c              |   10 +-
 sys/arch/sun3/sun3/trap.c              |   12 +-
 sys/arch/sun3/sun3x/machdep.c          |    6 +-
 sys/arch/sun3/sun3x/pmap.c             |    8 +-
 sys/arch/vax/vax/machdep.c             |    4 +-
 sys/arch/vax/vax/pmap.c                |   12 +-
 sys/arch/vax/vax/trap.c                |    6 +-
 sys/arch/x68k/dev/grf.c                |    7 +-
 sys/arch/x68k/x68k/clock.c             |    6 +-
 sys/arch/x68k/x68k/machdep.c           |    4 +-
 sys/arch/x68k/x68k/pmap.c              |   23 +-
 sys/arch/x68k/x68k/trap.c              |   16 +-
 sys/compat/netbsd32/netbsd32_sysctl.c  |    9 +-
 sys/compat/svr4/svr4_misc.c            |   23 +-
 sys/compat/svr4_32/svr4_32_misc.c      |   21 +-
 sys/compat/vax1k/vax1k_subr.c          |   11 +-
 sys/dev/ic/rrunner.c                   |   36 +---
 sys/kern/exec_subr.c                   |   61 ++----
 sys/kern/init_main.c                   |    5 +-
 sys/kern/kern_physio.c                 |   41 +---
 sys/kern/kern_sysctl.c                 |    9 +-
 sys/kern/sysv_shm.c                    |   29 +-
 sys/uvm/uvm_bio.c                      |    5 +-
 sys/uvm/uvm_device.c                   |    4 +-
 sys/uvm/uvm_extern.h                   |    6 +-
 sys/uvm/uvm_fault.c                    |  102 ++++------
 sys/uvm/uvm_glue.c                     |   18 +-
 sys/uvm/uvm_io.c                       |   11 +-
 sys/uvm/uvm_km.c                       |   21 +-
 sys/uvm/uvm_loan.c                     |   28 +-
 sys/uvm/uvm_map.c                      |  166 +++++++---------
 sys/uvm/uvm_map.h                      |    6 +-
 sys/uvm/uvm_map_i.h                    |    8 +-
 sys/uvm/uvm_mmap.c                     |  316 +++++++++++---------------------
 sys/uvm/uvm_pager.c                    |    8 +-
 sys/uvm/uvm_param.h                    |   16 +-
 sys/uvm/uvm_unix.c                     |   29 +-
 sys/uvm/uvm_user.c                     |   14 +-
 110 files changed, 815 insertions(+), 1171 deletions(-)

diffs (truncated from 6278 to 300 lines):

diff -r 4f5f86af4a44 -r 2ff72796dc18 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Thu Mar 15 03:20:43 2001 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Thu Mar 15 06:10:32 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.230 2001/01/22 13:56:56 jdolecek Exp $ */
+/* $NetBSD: machdep.c,v 1.231 2001/03/15 06:10:32 chs Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.230 2001/01/22 13:56:56 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.231 2001/03/15 06:10:32 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -868,7 +868,7 @@
        if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size),
                    NULL, UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
-                               UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
+                               UVM_ADV_NORMAL, 0)) != 0)
                panic("startup: cannot allocate VM for buffers");
        base = bufpages / nbuf;
        residual = bufpages % nbuf;
diff -r 4f5f86af4a44 -r 2ff72796dc18 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Thu Mar 15 03:20:43 2001 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Thu Mar 15 06:10:32 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.156 2001/01/14 03:33:34 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.157 2001/03/15 06:10:33 chs Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -154,7 +154,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.156 2001/01/14 03:33:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.157 2001/03/15 06:10:33 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1700,9 +1700,6 @@
                printf("pmap_enter(%p, %lx, %lx, %x, %x)\n",
                       pmap, va, pa, prot, flags);
 #endif
-       if (pmap == NULL)
-               return (KERN_SUCCESS);
-
        managed = PAGE_IS_MANAGED(pa);
        isactive = PMAP_ISACTIVE(pmap, cpu_id);
        wired = (flags & PMAP_WIRED) != 0;
@@ -1753,7 +1750,7 @@
                 */
                if (pmap->pm_lev1map == kernel_lev1map) {
                        error = pmap_lev1map_create(pmap, cpu_id);
-                       if (error != KERN_SUCCESS) {
+                       if (error) {
                                if (flags & PMAP_CANFAIL)
                                        return (error);
                                panic("pmap_enter: unable to create lev1map");
@@ -1770,7 +1767,7 @@
                if (pmap_pte_v(l1pte) == 0) {
                        pmap_physpage_addref(l1pte);
                        error = pmap_ptpage_alloc(pmap, l1pte, PGU_L2PT);
-                       if (error != KERN_SUCCESS) {
+                       if (error) {
                                pmap_l1pt_delref(pmap, l1pte, cpu_id);
                                if (flags & PMAP_CANFAIL)
                                        return (error);
@@ -1795,7 +1792,7 @@
                if (pmap_pte_v(l2pte) == 0) {
                        pmap_physpage_addref(l2pte);
                        error = pmap_ptpage_alloc(pmap, l2pte, PGU_L3PT);
-                       if (error != KERN_SUCCESS) {
+                       if (error) {
                                pmap_l2pt_delref(pmap, l1pte, l2pte, cpu_id);
                                if (flags & PMAP_CANFAIL)
                                        return (error);
@@ -1901,7 +1898,7 @@
         */
        if (managed) {
                error = pmap_pv_enter(pmap, pa, va, pte, TRUE);
-               if (error != KERN_SUCCESS) {
+               if (error) {
                        pmap_l3pt_delref(pmap, va, pte, cpu_id, NULL);
                        if (flags & PMAP_CANFAIL)
                                return (error);
@@ -1986,7 +1983,7 @@
        PMAP_UNLOCK(pmap);
        PMAP_MAP_TO_HEAD_UNLOCK();
        
-       return (KERN_SUCCESS);
+       return 0;
 }
 
 /*
@@ -3062,7 +3059,7 @@
         */
        newpv = pmap_pv_alloc();
        if (newpv == NULL)
-               return (KERN_RESOURCE_SHORTAGE);
+               return ENOMEM;
        newpv->pv_va = va;
        newpv->pv_pmap = pmap;
        newpv->pv_pte = pte;
@@ -3095,7 +3092,7 @@
        if (dolock)
                simple_unlock(&pvh->pvh_slock);
 
-       return (KERN_SUCCESS);
+       return 0;
 }
 
 /*
@@ -3535,7 +3532,7 @@
        l1pt = pool_cache_get(&pmap_l1pt_cache, PR_NOWAIT);
        if (l1pt == NULL) {
                simple_unlock(&pmap_growkernel_slock);
-               return (KERN_RESOURCE_SHORTAGE);
+               return ENOMEM;
        }
 
        pmap->pm_lev1map = l1pt;
@@ -3550,7 +3547,7 @@
                pmap_asn_alloc(pmap, cpu_id);
                PMAP_ACTIVATE(pmap, curproc, cpu_id);
        }
-       return (KERN_SUCCESS);
+       return 0;
 }
 
 /*
@@ -3697,7 +3694,7 @@
                 * another pmap!
                 */
                if (pmap_ptpage_steal(pmap, usage, &ptpa) == FALSE)
-                       return (KERN_RESOURCE_SHORTAGE);
+                       return ENOMEM;
        }
 
        /*
@@ -3707,7 +3704,7 @@
            PG_V | PG_KRE | PG_KWE | PG_WIRED |
            (pmap == pmap_kernel() ? PG_ASM : 0));
 
-       return (KERN_SUCCESS);
+       return 0;
 }
 
 /*
diff -r 4f5f86af4a44 -r 2ff72796dc18 sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c       Thu Mar 15 03:20:43 2001 +0000
+++ b/sys/arch/alpha/alpha/trap.c       Thu Mar 15 06:10:32 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.66 2001/01/03 22:15:38 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.67 2001/03/15 06:10:33 chs Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2001/01/03 22:15:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67 2001/03/15 06:10:33 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -487,17 +487,17 @@
                        if (map != kernel_map &&
                            (caddr_t)va >= vm->vm_maxsaddr &&
                            va < USRSTACK) {
-                               if (rv == KERN_SUCCESS) {
+                               if (rv == 0) {
                                        unsigned nss;
        
                                        nss = btoc(USRSTACK -
                                            (unsigned long)va);
                                        if (nss > vm->vm_ssize)
                                                vm->vm_ssize = nss;
-                               } else if (rv == KERN_PROTECTION_FAILURE)
-                                       rv = KERN_INVALID_ADDRESS;
+                               } else if (rv == EACCES)
+                                       rv = EFAULT;
                        }
-                       if (rv == KERN_SUCCESS) {
+                       if (rv == 0) {
                                if (user)
                                        KERNEL_PROC_UNLOCK(p);
                                else
@@ -519,7 +519,7 @@
                                goto dopanic;
                        }
                        ucode = a0;
-                       if (rv == KERN_RESOURCE_SHORTAGE) {
+                       if (rv == ENOMEM) {
                                printf("UVM: pid %d (%s), uid %d killed: "
                                       "out of swap\n", p->p_pid, p->p_comm,
                                       p->p_cred && p->p_ucred ?
diff -r 4f5f86af4a44 -r 2ff72796dc18 sys/arch/amiga/amiga/machdep.c
--- a/sys/arch/amiga/amiga/machdep.c    Thu Mar 15 03:20:43 2001 +0000
+++ b/sys/arch/amiga/amiga/machdep.c    Thu Mar 15 06:10:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.159 2001/02/14 20:24:17 is Exp $ */
+/*     $NetBSD: machdep.c,v 1.160 2001/03/15 06:10:34 chs Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -262,7 +262,7 @@
        if (uvm_map(kernel_map, (vm_offset_t *)&buffers, round_page(size),
            NULL, UVM_UNKNOWN_OFFSET, 0,
            UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
-           UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
+           UVM_ADV_NORMAL, 0)) != 0)
                panic("startup: cannot allocate VM for buffers");
        minaddr = (vm_offset_t) buffers;
        if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
diff -r 4f5f86af4a44 -r 2ff72796dc18 sys/arch/amiga/amiga/pmap.c
--- a/sys/arch/amiga/amiga/pmap.c       Thu Mar 15 03:20:43 2001 +0000
+++ b/sys/arch/amiga/amiga/pmap.c       Thu Mar 15 06:10:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.82 2001/01/20 17:08:41 mhitch Exp $ */
+/*     $NetBSD: pmap.c,v 1.83 2001/03/15 06:10:34 chs Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -519,14 +519,14 @@
                    NULL, UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
                                UVM_INH_NONE, UVM_ADV_RANDOM,
-                               UVM_FLAG_FIXED)) != KERN_SUCCESS)
+                               UVM_FLAG_FIXED)) != 0)
                goto bogons;
        addr = (vaddr_t) Sysmap;
        if (uvm_map(kernel_map, &addr, AMIGA_KPTSIZE,
                    NULL, UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
                                UVM_INH_NONE, UVM_ADV_RANDOM,
-                               UVM_FLAG_FIXED)) != KERN_SUCCESS) {
+                               UVM_FLAG_FIXED)) != 0) {
                /*
                 * If this fails, it is probably because the static
                 * portion of the kernel page table isn't big enough
@@ -618,11 +618,9 @@
        rv = uvm_map(kernel_map, &addr, s, NULL, UVM_UNKNOWN_OFFSET, 0,
                     UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
                                 UVM_ADV_RANDOM, UVM_FLAG_NOMERGE));
-       if (rv != KERN_SUCCESS || (addr + s) >= (vaddr_t)Sysmap)
+       if (rv != 0 || (addr + s) >= (vaddr_t)Sysmap)
                panic("pmap_init: kernel PT too small");
-       rv = uvm_unmap(kernel_map, addr, addr + s);
-       if (rv != KERN_SUCCESS)
-               panic("pmap_init: uvm_unmap failed");
+       uvm_unmap(kernel_map, addr, addr + s);
 
        /*
         * Now allocate the space and link the pages together to
@@ -1149,11 +1147,6 @@
        if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
                printf("pmap_enter(%p, %lx, %lx, %x, %x)\n",
                    pmap, va, pa, prot, wired);
-#endif
-       if (pmap == NULL)
-               return (KERN_SUCCESS);
-
-#ifdef DEBUG
        if (pmap == pmap_kernel())
                enter_stats.kernel++;
        else
@@ -1393,7 +1386,7 @@
                pmap_check_wiring("enter", trunc_page((vaddr_t) pmap_pte(pmap, va)));
        }
 #endif
-       return (KERN_SUCCESS);
+       return 0;
 }
 
 void
@@ -2570,7 +2563,7 @@
 #endif
                s = uvm_fault_wire(pt_map, va, va + PAGE_SIZE,
                    VM_PROT_READ|VM_PROT_WRITE);
-               if (s != KERN_SUCCESS) {
+               if (s != 0) {
                        printf("uvm_fault_wire(pt_map, 0x%lx, 0%lx, RW) "
                                "-> %d\n", va, va + PAGE_SIZE, s);
                        panic("pmap_enter: uvm_fault_wire failed");
diff -r 4f5f86af4a44 -r 2ff72796dc18 sys/arch/amiga/amiga/trap.c
--- a/sys/arch/amiga/amiga/trap.c       Thu Mar 15 03:20:43 2001 +0000
+++ b/sys/arch/amiga/amiga/trap.c       Thu Mar 15 06:10:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.82 2001/02/14 20:24:17 is Exp $     */
+/*     $NetBSD: trap.c,v 1.83 2001/03/15 06:10:34 chs Exp $    */
 
 /*
  * Copyright (c) 1988 University of Utah.



Home | Main Index | Thread Index | Old Index