summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-03-26 08:43:35 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-03-26 08:43:35 +0000
commitf3e4aab1c715da8604d0a2d20aadf53414facd67 (patch)
treea308e46ca2a6bcd69ef5e2e86200afd4c89774d0 /sys/uvm
parent1bff2693343e573573147ca06422bdece9097b4f (diff)
Rip out the KERN_ error codes.
ok otto@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_fault.c28
-rw-r--r--sys/uvm/uvm_loan.c6
-rw-r--r--sys/uvm/uvm_map.c38
-rw-r--r--sys/uvm/uvm_mmap.c10
-rw-r--r--sys/uvm/uvm_param.h13
5 files changed, 42 insertions, 53 deletions
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c
index 6f14ddf9954..348db5c3779 100644
--- a/sys/uvm/uvm_fault.c
+++ b/sys/uvm/uvm_fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_fault.c,v 1.42 2007/03/25 11:31:07 art Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.43 2007/03/26 08:43:34 art Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
@@ -608,7 +608,7 @@ uvm_fault(orig_map, vaddr, fault_type, access_type)
if (orig_map == kernel_map && uvmfault_check_intrsafe(&ufi)) {
UVMHIST_LOG(maphist, "<- VA 0x%lx in intrsafe map %p",
ufi.orig_rvaddr, ufi.map, 0, 0);
- return (KERN_FAILURE);
+ return (EFAULT);
}
/*
@@ -622,7 +622,7 @@ ReFault:
if (uvmfault_lookup(&ufi, FALSE) == FALSE) {
UVMHIST_LOG(maphist, "<- no mapping @ 0x%lx", vaddr, 0,0,0);
- return (KERN_INVALID_ADDRESS);
+ return (EFAULT);
}
/* locked: maps(read) */
@@ -635,7 +635,7 @@ ReFault:
"<- protection failure (prot=0x%lx, access=0x%lx)",
ufi.entry->protection, access_type, 0, 0);
uvmfault_unlockmaps(&ufi, FALSE);
- return (KERN_PROTECTION_FAILURE);
+ return (EACCES);
}
/*
@@ -646,7 +646,7 @@ ReFault:
UVMHIST_LOG(maphist,
"<- map %p not pageable", ufi.map, 0, 0, 0);
uvmfault_unlockmaps(&ufi, FALSE);
- return (KERN_FAILURE);
+ return (EFAULT);
}
/*
@@ -705,7 +705,7 @@ ReFault:
if (amap == NULL && uobj == NULL) {
uvmfault_unlockmaps(&ufi, FALSE);
UVMHIST_LOG(maphist,"<- no backing store, no overlay",0,0,0,0);
- return (KERN_INVALID_ADDRESS);
+ return (EFAULT);
}
/*
@@ -901,7 +901,7 @@ ReFault:
else if (result == VM_PAGER_REFAULT)
goto ReFault; /* try again! */
else
- return (KERN_PROTECTION_FAILURE);
+ return (EACCES);
}
/*
@@ -1075,13 +1075,13 @@ ReFault:
* page -- this is the only error we return right
* now.
*/
- return (KERN_PROTECTION_FAILURE); /* XXX */
+ return (EACCES); /* XXX */
default:
#ifdef DIAGNOSTIC
panic("uvm_fault: uvmfault_anonget -> %d", result);
#else
- return (KERN_PROTECTION_FAILURE);
+ return (EACCES);
#endif
}
@@ -1203,7 +1203,7 @@ ReFault:
UVMHIST_LOG(maphist,
"<- failed. out of VM",0,0,0,0);
uvmexp.fltnoanon++;
- return (KERN_RESOURCE_SHORTAGE);
+ return (ENOMEM);
}
uvmexp.fltnoram++;
@@ -1265,7 +1265,7 @@ ReFault:
UVMHIST_LOG(maphist,
"<- failed. out of VM",0,0,0,0);
/* XXX instrumentation */
- return (KERN_RESOURCE_SHORTAGE);
+ return (ENOMEM);
}
/* XXX instrumentation */
uvm_wait("flt_pmfail1");
@@ -1379,7 +1379,7 @@ Case2:
UVMHIST_LOG(maphist, "<- pgo_get failed (code %ld)",
result, 0,0,0);
- return (KERN_PROTECTION_FAILURE); /* XXX i/o error */
+ return (EACCES); /* XXX i/o error */
}
/* locked: uobjpage */
@@ -1619,7 +1619,7 @@ Case2:
UVMHIST_LOG(maphist, " promote: out of VM",
0,0,0,0);
uvmexp.fltnoanon++;
- return (KERN_RESOURCE_SHORTAGE);
+ return (ENOMEM);
}
UVMHIST_LOG(maphist, " out of RAM, waiting for more",
@@ -1725,7 +1725,7 @@ Case2:
UVMHIST_LOG(maphist,
"<- failed. out of VM",0,0,0,0);
/* XXX instrumentation */
- return (KERN_RESOURCE_SHORTAGE);
+ return (ENOMEM);
}
/* XXX instrumentation */
uvm_wait("flt_pmfail2");
diff --git a/sys/uvm/uvm_loan.c b/sys/uvm/uvm_loan.c
index 8fbdb5022fd..70bc4ed9dc5 100644
--- a/sys/uvm/uvm_loan.c
+++ b/sys/uvm/uvm_loan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_loan.c,v 1.23 2007/03/25 11:31:07 art Exp $ */
+/* $OpenBSD: uvm_loan.c,v 1.24 2007/03/26 08:43:34 art Exp $ */
/* $NetBSD: uvm_loan.c,v 1.22 2000/06/27 17:29:25 mrg Exp $ */
/*
@@ -234,7 +234,7 @@ uvm_loan(map, start, len, result, flags)
if ((flags & (UVM_LOAN_TOANON|UVM_LOAN_TOPAGE)) ==
(UVM_LOAN_TOANON|UVM_LOAN_TOPAGE) ||
(flags & (UVM_LOAN_TOANON|UVM_LOAN_TOPAGE)) == 0)
- return(KERN_FAILURE);
+ return (EFAULT);
/*
* "output" is a pointer to the current place to put the loaned
@@ -304,7 +304,7 @@ fail:
uvm_unloanpage((struct vm_page **)result,
output - result);
}
- return(KERN_FAILURE);
+ return (EFAULT);
}
/*
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 422010737c2..697c245db4f 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.83 2007/03/25 11:31:07 art Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.84 2007/03/26 08:43:34 art Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -749,7 +749,7 @@ uvm_map_p(map, startp, size, uobj, uoffset, align, flags, p)
if ((prot & maxprot) != prot) {
UVMHIST_LOG(maphist, "<- prot. failure: prot=0x%lx, max=0x%lx",
prot, maxprot,0,0);
- return(KERN_PROTECTION_FAILURE);
+ return (EACCES);
}
/*
@@ -758,14 +758,14 @@ uvm_map_p(map, startp, size, uobj, uoffset, align, flags, p)
if (vm_map_lock_try(map) == FALSE) {
if (flags & UVM_FLAG_TRYLOCK)
- return(KERN_FAILURE);
+ return (EFAULT);
vm_map_lock(map); /* could sleep here */
}
if ((prev_entry = uvm_map_findspace(map, *startp, size, startp,
uobj, uoffset, align, flags)) == NULL) {
UVMHIST_LOG(maphist,"<- uvm_map_findspace failed!",0,0,0,0);
vm_map_unlock(map);
- return (KERN_NO_SPACE);
+ return (ENOMEM);
}
#ifdef PMAP_GROWKERNEL
@@ -2184,7 +2184,7 @@ uvm_map_submap(map, start, end, submap)
uvm_map_reference(submap);
result = 0;
} else {
- result = KERN_INVALID_ARGUMENT;
+ result = EINVAL;
}
vm_map_unlock(map);
return(result);
@@ -2232,11 +2232,11 @@ uvm_map_protect(map, start, end, new_prot, set_max)
current = entry;
while ((current != &map->header) && (current->start < end)) {
if (UVM_ET_ISSUBMAP(current)) {
- rv = KERN_INVALID_ARGUMENT;
+ rv = EINVAL;
goto out;
}
if ((new_prot & current->max_protection) != new_prot) {
- rv = KERN_PROTECTION_FAILURE;
+ rv = EACCES;
goto out;
}
current = current->next;
@@ -2297,7 +2297,7 @@ uvm_map_protect(map, start, end, new_prot, set_max)
* XXX what uvm_map_protect() itself would
* XXX normally return.
*/
- rv = KERN_RESOURCE_SHORTAGE;
+ rv = ENOMEM;
}
}
@@ -2341,7 +2341,7 @@ uvm_map_inherit(map, start, end, new_inheritance)
break;
default:
UVMHIST_LOG(maphist,"<- done (INVALID ARG)",0,0,0,0);
- return (KERN_INVALID_ARGUMENT);
+ return (EINVAL);
}
vm_map_lock(map);
@@ -2410,7 +2410,7 @@ uvm_map_advice(map, start, end, new_advice)
default:
vm_map_unlock(map);
UVMHIST_LOG(maphist,"<- done (INVALID ARG)",0,0,0,0);
- return (KERN_INVALID_ARGUMENT);
+ return (EINVAL);
}
entry->advice = new_advice;
entry = entry->next;
@@ -2470,7 +2470,7 @@ uvm_map_pageable(map, start, end, new_pageable, lockflags)
vm_map_unlock(map);
UVMHIST_LOG(maphist,"<- done (INVALID ARG)",0,0,0,0);
- return (KERN_INVALID_ADDRESS);
+ return (EFAULT);
}
entry = start_entry;
@@ -2495,7 +2495,7 @@ uvm_map_pageable(map, start, end, new_pageable, lockflags)
vm_map_unlock(map);
UVMHIST_LOG(maphist,
"<- done (INVALID UNWIRE ARG)",0,0,0,0);
- return (KERN_INVALID_ARGUMENT);
+ return (EINVAL);
}
entry = entry->next;
}
@@ -2586,7 +2586,7 @@ uvm_map_pageable(map, start, end, new_pageable, lockflags)
if ((lockflags & UVM_LK_EXIT) == 0)
vm_map_unlock(map);
UVMHIST_LOG(maphist,"<- done (INVALID WIRE)",0,0,0,0);
- return (KERN_INVALID_ARGUMENT);
+ return (EINVAL);
}
entry = entry->next;
}
@@ -2781,7 +2781,7 @@ uvm_map_pageable_all(map, flags, limit)
if (atop(size) + uvmexp.wired > uvmexp.wiredmax) {
vm_map_unlock(map);
- return (KERN_NO_SPACE); /* XXX overloaded */
+ return (ENOMEM); /* XXX overloaded */
}
/* XXX non-pmap_wired_count case must be handled by caller */
@@ -2789,7 +2789,7 @@ uvm_map_pageable_all(map, flags, limit)
if (limit != 0 &&
(size + ptoa(pmap_wired_count(vm_map_pmap(map))) > limit)) {
vm_map_unlock(map);
- return (KERN_NO_SPACE); /* XXX overloaded */
+ return (ENOMEM); /* XXX overloaded */
}
#endif
@@ -2945,7 +2945,7 @@ uvm_map_clean(map, start, end, flags)
VM_MAP_RANGE_CHECK(map, start, end);
if (uvm_map_lookup_entry(map, start, &entry) == FALSE) {
vm_map_unlock_read(map);
- return(KERN_INVALID_ADDRESS);
+ return (EFAULT);
}
/*
@@ -2955,12 +2955,12 @@ uvm_map_clean(map, start, end, flags)
for (current = entry; current->start < end; current = current->next) {
if (UVM_ET_ISSUBMAP(current)) {
vm_map_unlock_read(map);
- return (KERN_INVALID_ARGUMENT);
+ return (EINVAL);
}
if (end > current->end && (current->next == &map->header ||
current->end != current->next->start)) {
vm_map_unlock_read(map);
- return (KERN_INVALID_ADDRESS);
+ return (EFAULT);
}
}
@@ -3102,7 +3102,7 @@ uvm_map_clean(map, start, end, flags)
simple_unlock(&uobj->vmobjlock);
if (rv == FALSE)
- error = KERN_FAILURE;
+ error = EFAULT;
}
start += size;
}
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index 13e361eeca1..5a4a751cfc0 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.65 2007/03/25 11:31:07 art Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.66 2007/03/26 08:43:34 art Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -831,7 +831,7 @@ sys_mprotect(p, v, retval)
if (rv == 0)
return (0);
- if (rv == KERN_PROTECTION_FAILURE)
+ if (rv == EACCES)
return (EACCES);
return (EINVAL);
}
@@ -870,7 +870,7 @@ sys_minherit(p, v, retval)
inherit)) {
case 0:
return (0);
- case KERN_PROTECTION_FAILURE:
+ case EACCES:
return (EACCES);
}
return (EINVAL);
@@ -1090,7 +1090,7 @@ sys_mlockall(p, v, retval)
error = 0;
break;
- case KERN_NO_SPACE: /* XXX overloaded */
+ case ENOMEM:
error = ENOMEM;
break;
@@ -1292,7 +1292,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit, p)
locklimit)
#endif
) {
- retval = KERN_RESOURCE_SHORTAGE;
+ retval = ENOMEM;
vm_map_unlock(map);
/* unmap the region! */
uvm_unmap(map, *addr, *addr + size);
diff --git a/sys/uvm/uvm_param.h b/sys/uvm/uvm_param.h
index 8822dc75daa..788539aea56 100644
--- a/sys/uvm/uvm_param.h
+++ b/sys/uvm/uvm_param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_param.h,v 1.11 2007/03/25 11:31:07 art Exp $ */
+/* $OpenBSD: uvm_param.h,v 1.12 2007/03/26 08:43:34 art Exp $ */
/* $NetBSD: uvm_param.h,v 1.5 2001/03/09 01:02:12 chs Exp $ */
/*
@@ -135,17 +135,6 @@ struct _ps_strings {
#define SWAPSKIPBYTES 8192 /* never use at the start of a swap space */
-/*
- * Return values from the VM routines.
- */
-#define KERN_INVALID_ADDRESS EFAULT
-#define KERN_PROTECTION_FAILURE EACCES
-#define KERN_NO_SPACE ENOMEM
-#define KERN_INVALID_ARGUMENT EINVAL
-#define KERN_FAILURE EFAULT
-#define KERN_RESOURCE_SHORTAGE ENOMEM
-#define KERN_PAGES_LOCKED 9 /* XXX never returned */
-
#ifndef ASSEMBLER
/*
* Convert addresses to pages and vice versa.