svn commit: r189398 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Thu Mar 5 03:45:44 PST 2009
Author: kib
Date: Thu Mar 5 11:45:42 2009
New Revision: 189398
URL: http://svn.freebsd.org/changeset/base/189398
Log:
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
Modified:
head/sys/kern/sysv_shm.c
Modified: head/sys/kern/sysv_shm.c
==============================================================================
--- head/sys/kern/sysv_shm.c Thu Mar 5 08:57:35 2009 (r189397)
+++ head/sys/kern/sysv_shm.c Thu Mar 5 11:45:42 2009 (r189398)
@@ -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, 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);
More information about the svn-src-all
mailing list