From ed62a96e4332398a373a6d43c15284686fefa7a0 Mon Sep 17 00:00:00 2001 From: kib Date: Thu, 5 Mar 2009 11:45:42 +0000 Subject: Systematically use vm_size_t to specify the size of the segment for VM KPI. Do not overload the local variable size in kern_shmat() due to vm_size_t change. Fix style bug by adding explicit comparision with 0. Discussed with: bde MFC after: 1 week --- sys/kern/sysv_shm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index a945523..5311e08 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -122,7 +122,7 @@ static sy_call_t *shmcalls[] = { #define SHMSEG_WANTED 0x1000 static int shm_last_free, shm_nused, shmalloced; -size_t shm_committed; +vm_size_t shm_committed; static struct shmid_kernel *shmsegs; struct shmmap_state { @@ -245,7 +245,7 @@ static void shm_deallocate_segment(shmseg) struct shmid_kernel *shmseg; { - size_t size; + vm_size_t size; GIANT_REQUIRED; @@ -265,7 +265,7 @@ shm_delete_mapping(struct vmspace *vm, struct shmmap_state *shmmap_s) { struct shmid_kernel *shmseg; int segnum, result; - size_t size; + vm_size_t size; GIANT_REQUIRED; @@ -362,8 +362,8 @@ kern_shmat(td, shmid, shmaddr, shmflg) mtx_lock(&Giant); shmmap_s = p->p_vmspace->vm_shm; if (shmmap_s == NULL) { - size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, M_WAITOK); + shmmap_s = malloc(shminfo.shmseg * sizeof(struct shmmap_state), + M_SHM, M_WAITOK); for (i = 0; i < shminfo.shmseg; i++) shmmap_s[i].shmid = -1; p->p_vmspace->vm_shm = shmmap_s; @@ -722,7 +722,7 @@ shmget_existing(td, uap, mode, segnum) if (error != 0) return (error); #endif - if (uap->size && uap->size > shmseg->shm_bsegsz) + if (uap->size != 0 && uap->size > shmseg->shm_bsegsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); -- cgit v1.1