summaryrefslogtreecommitdiffstats
path: root/sys/kern/exec_subr.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-11-06 00:17:27 +0000
committerart <art@openbsd.org>2002-11-06 00:17:27 +0000
commitcf0f9f55b685efdb9d9e8646f7a78c94cc792479 (patch)
tree1bd3a8b8ad70092949b578cfb6e804ab903ddc26 /sys/kern/exec_subr.c
parentthread safe libc -- 2nd try. OK miod@, millert@ (diff)
downloadwireguard-openbsd-cf0f9f55b685efdb9d9e8646f7a78c94cc792479.tar.xz
wireguard-openbsd-cf0f9f55b685efdb9d9e8646f7a78c94cc792479.zip
Eliminate the use of KERN_SUCCESS outside of uvm/
Also uvm_map returns KERN_* codes that are directly mapped to errnos, so we can return them instead of doing some attempt to translation. drahn@ "I see no problem" pval@ "makes sense"
Diffstat (limited to 'sys/kern/exec_subr.c')
-rw-r--r--sys/kern/exec_subr.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c
index 0bcd893f109..a4e64f3994a 100644
--- a/sys/kern/exec_subr.c
+++ b/sys/kern/exec_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_subr.c,v 1.22 2002/10/07 23:31:42 art Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.23 2002/11/06 00:17:28 art Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@@ -176,7 +176,7 @@ vmcmd_map_pagedvn(p, cmd)
* call this routine.
*/
struct uvm_object *uobj;
- int retval;
+ int error;
/*
* map the vnode in using uvm_map.
@@ -203,7 +203,7 @@ vmcmd_map_pagedvn(p, cmd)
* do the map
*/
- retval = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len,
+ error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len,
uobj, cmd->ev_offset, 0,
UVM_MAPFLAG(cmd->ev_prot, VM_PROT_ALL, UVM_INH_COPY,
UVM_ADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED));
@@ -212,15 +212,14 @@ vmcmd_map_pagedvn(p, cmd)
* check for error
*/
- if (retval == KERN_SUCCESS)
- return(0);
-
- /*
- * error: detach from object
- */
+ if (error) {
+ /*
+ * error: detach from object
+ */
+ uobj->pgops->pgo_detach(uobj);
+ }
- uobj->pgops->pgo_detach(uobj);
- return(EINVAL);
+ return (error);
}
/*