summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/exec_subr.c43
-rw-r--r--sys/kern/init_main.c5
-rw-r--r--sys/kern/kern_physio.c11
-rw-r--r--sys/kern/kern_sysctl.c12
-rw-r--r--sys/kern/sysv_shm.c15
5 files changed, 35 insertions, 51 deletions
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c
index e79db64dcae..1d816ded073 100644
--- a/sys/kern/exec_subr.c
+++ b/sys/kern/exec_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_subr.c,v 1.15 2001/11/27 05:27:11 art Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.16 2001/11/28 13:47:39 art Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@@ -138,14 +138,8 @@ vmcmd_map_pagedvn(p, cmd)
struct proc *p;
struct exec_vmcmd *cmd;
{
- /*
- * note that if you're going to map part of an process as being
- * paged from a vnode, that vnode had damn well better be marked as
- * VTEXT. that's handled in the routine which sets up the vmcmd to
- * call this routine.
- */
struct uvm_object *uobj;
- int retval;
+ int error;
/*
* map the vnode in using uvm_map.
@@ -173,24 +167,16 @@ 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));
- /*
- * check for error
- */
-
- if (retval == KERN_SUCCESS)
- return(0);
-
- /*
- * error: detach from object
- */
+ if (error) {
+ uobj->pgops->pgo_detach(uobj);
+ }
- uobj->pgops->pgo_detach(uobj);
- return(EINVAL);
+ return(error);
}
/*
@@ -207,7 +193,7 @@ vmcmd_map_readvn(p, cmd)
int error;
if (cmd->ev_len == 0)
- return(KERN_SUCCESS); /* XXXCDC: should it happen? */
+ return (0);
cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
@@ -217,13 +203,13 @@ vmcmd_map_readvn(p, cmd)
UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
if (error)
- return error;
+ return (error);
error = vn_rdwr(UIO_READ, cmd->ev_vp, (caddr_t)cmd->ev_addr,
cmd->ev_len, cmd->ev_offset, UIO_USERSPACE, IO_UNIT|IO_NODELOCKED,
p->p_ucred, NULL, p);
if (error)
- return error;
+ return (error);
if (cmd->ev_prot != (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)) {
/*
@@ -232,13 +218,12 @@ vmcmd_map_readvn(p, cmd)
* it mapped read-only, so now we are going to have to call
* uvm_map_protect() to fix up the protection. ICK.
*/
- return(uvm_map_protect(&p->p_vmspace->vm_map,
+ return (uvm_map_protect(&p->p_vmspace->vm_map,
trunc_page(cmd->ev_addr),
round_page(cmd->ev_addr + cmd->ev_len),
cmd->ev_prot, FALSE));
- } else {
- return(KERN_SUCCESS);
}
+ return (0);
}
/*
@@ -255,7 +240,7 @@ vmcmd_map_zero(p, cmd)
int error;
if (cmd->ev_len == 0)
- return(KERN_SUCCESS); /* XXXCDC: should it happen? */
+ return (0);
cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
@@ -266,7 +251,7 @@ vmcmd_map_zero(p, cmd)
if (error)
return error;
- return(KERN_SUCCESS);
+ return (0);
}
/*
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 800eb96aa08..4324fb9ece5 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.86 2001/11/27 22:53:19 provos Exp $ */
+/* $OpenBSD: init_main.c,v 1.87 2001/11/28 13:47:39 art Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -511,8 +511,7 @@ start_init(arg)
if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE,
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
- UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW))
- != KERN_SUCCESS)
+ UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)))
panic("init: couldn't allocate argument space");
#ifdef MACHINE_STACK_GROWS_UP
p->p_vmspace->vm_maxsaddr = (caddr_t)addr + PAGE_SIZE;
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 6be92145c71..bd83546c9dd 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_physio.c,v 1.16 2001/11/15 23:15:15 art Exp $ */
+/* $OpenBSD: kern_physio.c,v 1.17 2001/11/28 13:47:39 art Exp $ */
/* $NetBSD: kern_physio.c,v 1.28 1997/05/19 10:43:28 pk Exp $ */
/*-
@@ -173,11 +173,12 @@ physio(strategy, bp, dev, flags, minphys, uio)
* restores it.
*/
PHOLD(p);
- if (uvm_vslock(p, bp->b_data, todo, (flags & B_READ) ?
- VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ) !=
- KERN_SUCCESS) {
+ error = uvm_vslock(p, bp->b_data, todo,
+ (flags & B_READ) ?
+ VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ);
+ if (error) {
bp->b_flags |= B_ERROR;
- bp->b_error = EFAULT;
+ bp->b_error = error;
goto after_unlock;
}
vmapbuf(bp, todo);
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 4c4a911d690..44eb2f9924c 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.59 2001/11/06 19:53:20 miod Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.60 2001/11/28 13:47:39 art Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -187,12 +187,14 @@ sys___sysctl(p, v, retval)
if (SCARG(uap, old) != NULL) {
if ((error = lockmgr(&sysctl_lock, LK_EXCLUSIVE, NULL, p)) != 0)
return (error);
- if (dolock)
- if (uvm_vslock(p, SCARG(uap, old), oldlen,
- VM_PROT_READ|VM_PROT_WRITE) != KERN_SUCCESS) {
+ if (dolock) {
+ error = uvm_vslock(p, SCARG(uap, old), oldlen,
+ VM_PROT_READ|VM_PROT_WRITE);
+ if (error) {
lockmgr(&sysctl_lock, LK_RELEASE, NULL, p);
- return EFAULT;
+ return (error);
}
+ }
savelen = oldlen;
}
error = (*fn)(name + 1, SCARG(uap, namelen) - 1, SCARG(uap, old),
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index f7a233d632c..817d7512b6c 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.22 2001/11/07 01:18:01 art Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.23 2001/11/28 13:47:39 art Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -144,15 +144,13 @@ shm_delete_mapping(vm, shmmap_s)
struct shmmap_state *shmmap_s;
{
struct shmid_ds *shmseg;
- int segnum, result;
+ int segnum;
size_t size;
segnum = IPCID_TO_IX(shmmap_s->shmid);
shmseg = &shmsegs[segnum];
size = round_page(shmseg->shm_segsz);
- result = uvm_deallocate(&vm->vm_map, shmmap_s->va, size);
- if (result != KERN_SUCCESS)
- return EINVAL;
+ uvm_deallocate(&vm->vm_map, shmmap_s->va, size);
shmmap_s->shmid = -1;
shmseg->shm_dtime = time.tv_sec;
if ((--shmseg->shm_nattch <= 0) &&
@@ -207,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) {
@@ -252,11 +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;