diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-11-06 00:17:29 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-11-06 00:17:29 +0000 |
commit | de4292869d583caed19f8d21c3e9ccee475357da (patch) | |
tree | 7958c0387bbcafc6637201216cc72b2f11a6d193 /sys/kern | |
parent | 18f91d47d9735c52e8c411d33ddfd95db158838b (diff) |
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')
-rw-r--r-- | sys/kern/exec_subr.c | 21 | ||||
-rw-r--r-- | sys/kern/sysv_shm.c | 10 |
2 files changed, 14 insertions, 17 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); } /* diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 7a0aa69fcf6..4dce0048b20 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.28 2002/10/29 18:30:21 art Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.29 2002/11/06 00:17:28 art Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -205,7 +205,6 @@ sys_shmat(p, v, retval) vaddr_t attach_va; vm_prot_t prot; vsize_t size; - int rv; shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm; if (shmmap_s == NULL) { @@ -250,12 +249,11 @@ sys_shmat(p, v, retval) } shm_handle = shmseg->shm_internal; uao_reference(shm_handle->shm_object); - rv = uvm_map(&p->p_vmspace->vm_map, &attach_va, size, + error = uvm_map(&p->p_vmspace->vm_map, &attach_va, size, shm_handle->shm_object, 0, 0, UVM_MAPFLAG(prot, prot, UVM_INH_SHARE, UVM_ADV_RANDOM, 0)); - if (rv != KERN_SUCCESS) { - return ENOMEM; - } + if (error) + return (error); shmmap_s->va = attach_va; shmmap_s->shmid = SCARG(uap, shmid); |