mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
mm/shm: Convert bytes to pages by MM_NPAGES instead of MM_PGALIGNUP
This commit is contained in:
+1
-1
@@ -153,7 +153,7 @@ FAR void *shmat(int shmid, FAR const void *shmaddr, int shmflg)
|
||||
|
||||
/* Convert the region size to pages */
|
||||
|
||||
npages = MM_PGALIGNUP(region->sr_ds.shm_segsz);
|
||||
npages = MM_NPAGES(region->sr_ds.shm_segsz);
|
||||
|
||||
/* Attach, i.e, map, on shared memory region to the user virtual address. */
|
||||
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ int shmdt(FAR const void *shmaddr)
|
||||
|
||||
/* Convert the region size to pages */
|
||||
|
||||
npages = MM_PGALIGNUP(region->sr_ds.shm_segsz);
|
||||
npages = MM_NPAGES(region->sr_ds.shm_segsz);
|
||||
|
||||
/* Detach, i.e, unmap, on shared memory region from a user virtual
|
||||
* address.
|
||||
|
||||
+3
-3
@@ -173,11 +173,11 @@ static int shm_extend(int shmid, size_t size)
|
||||
|
||||
/* This is the number of pages that are needed to satisfy the allocation */
|
||||
|
||||
pgneeded = MM_PGALIGNUP(size);
|
||||
pgneeded = MM_NPAGES(size);
|
||||
|
||||
/* This is the number of pages that have already been allocated */
|
||||
|
||||
pgalloc = MM_PGALIGNUP(region->sr_ds.shm_segsz);
|
||||
pgalloc = MM_NPAGES(region->sr_ds.shm_segsz);
|
||||
|
||||
/* Loop until all pages have been allocated (or something bad happens) */
|
||||
|
||||
@@ -192,7 +192,7 @@ static int shm_extend(int shmid, size_t size)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Increment the number of pages successully allocated */
|
||||
/* Increment the number of pages successfully allocated */
|
||||
|
||||
pgalloc++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user