rename mmap MAP_SHARED to MAP_IPC_SHARED
. MAP_SHARED was used to implement sysv shared memory . used to signal shareable memory region to VM . assumptions about this situation break when processes use MAP_SHARED for its normal, standardised meaning
This commit is contained in:
parent
255ae85b1e
commit
85f6d866e6
7 changed files with 16 additions and 6 deletions
|
@ -13,7 +13,6 @@
|
|||
#define PROT_EXEC 0x04 /* pages can be executed */
|
||||
|
||||
/* flags argument for mmap() */
|
||||
#define MAP_SHARED 0x0001 /* share changes */
|
||||
#define MAP_PRIVATE 0x0002 /* changes are private */
|
||||
#define MAP_ANON 0x0004 /* anonymous memory */
|
||||
#define MAP_PREALLOC 0x0008 /* not on-demand */
|
||||
|
@ -21,6 +20,7 @@
|
|||
#define MAP_LOWER16M 0x0020 /* physically below 16MB */
|
||||
#define MAP_ALIGN64K 0x0040 /* physically aligned at 64kB */
|
||||
#define MAP_LOWER1M 0x0080 /* physically below 16MB */
|
||||
#define MAP_IPC_SHARED 0x0100 /* used to implement shared memory */
|
||||
|
||||
/* mmap() error return */
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
|
|
@ -35,7 +35,9 @@ typedef __off_t off_t; /* file offset */
|
|||
* Flags contain sharing type and options.
|
||||
* Sharing types; choose one.
|
||||
*/
|
||||
#ifndef __minix
|
||||
#define MAP_SHARED 0x0001 /* share changes */
|
||||
#endif
|
||||
#define MAP_PRIVATE 0x0002 /* changes are private */
|
||||
|
||||
/*
|
||||
|
@ -52,6 +54,7 @@ typedef __off_t off_t; /* file offset */
|
|||
#define MAP_ALIGN64K 0x0040 /* physically aligned at 64kB */
|
||||
#define MAP_LOWER1M 0x0080 /* physically below 16MB */
|
||||
#define MAP_ALIGNMENT_64KB MAP_ALIGN64K
|
||||
#define MAP_IPC_SHARED 0x0100 /* share changes */
|
||||
|
||||
/*
|
||||
* Error indicator returned by mmap(2)
|
||||
|
|
|
@ -74,7 +74,7 @@ PUBLIC int do_shmget(message *m)
|
|||
memset(shm, 0, sizeof(struct shm_struct));
|
||||
shm->page = (vir_bytes) mmap(0, size,
|
||||
PROT_READ|PROT_WRITE,
|
||||
MAP_CONTIG|MAP_PREALLOC|MAP_ANON|MAP_SHARED,
|
||||
MAP_CONTIG|MAP_PREALLOC|MAP_ANON|MAP_IPC_SHARED,
|
||||
-1, 0);
|
||||
if (shm->page == (vir_bytes) MAP_FAILED)
|
||||
return ENOMEM;
|
||||
|
|
|
@ -56,7 +56,7 @@ PRIVATE void print_region(struct vm_region_info *vri, int *n)
|
|||
(vri->vri_prot & PROT_READ) ? 'r' : '-',
|
||||
(vri->vri_prot & PROT_WRITE) ? 'w' : '-',
|
||||
(vri->vri_prot & PROT_EXEC) ? 'x' : '-',
|
||||
(vri->vri_flags & MAP_SHARED) ? 's' : 'p',
|
||||
(vri->vri_flags & MAP_IPC_SHARED) ? 's' : 'p',
|
||||
vri->vri_length / 1024L);
|
||||
(*n)++;
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ PRIVATE int dump_regions(int slot)
|
|||
(vri[i].vri_prot & PROT_READ) ? 'r' : '-',
|
||||
(vri[i].vri_prot & PROT_WRITE) ? 'w' : '-',
|
||||
(vri[i].vri_prot & PROT_EXEC) ? 'x' : '-',
|
||||
(vri[i].vri_flags & MAP_SHARED) ? 's' : 'p');
|
||||
(vri[i].vri_flags & MAP_IPC_SHARED) ? 's' : 'p');
|
||||
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,14 @@ PUBLIC int do_mmap(message *m)
|
|||
if(m->VMM_FLAGS & MAP_LOWER16M) vrflags |= VR_LOWER16MB;
|
||||
if(m->VMM_FLAGS & MAP_LOWER1M) vrflags |= VR_LOWER1MB;
|
||||
if(m->VMM_FLAGS & MAP_ALIGN64K) vrflags |= VR_PHYS64K;
|
||||
if(m->VMM_FLAGS & MAP_SHARED) vrflags |= VR_SHARED;
|
||||
if(m->VMM_FLAGS & MAP_IPC_SHARED) {
|
||||
vrflags |= VR_SHARED;
|
||||
/* Shared memory has to be preallocated. */
|
||||
if(m->VMM_FLAGS & (MAP_PREALLOC|MAP_ANON) !=
|
||||
(MAP_PREALLOC|MAP_ANON)) {
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
if(m->VMM_FLAGS & MAP_CONTIG) vrflags |= VR_CONTIG;
|
||||
|
||||
if(len % VM_PAGE_SIZE)
|
||||
|
|
|
@ -1999,7 +1999,7 @@ PUBLIC int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
|
|||
if (!(vr->flags & VR_WRITABLE))
|
||||
vri->vri_prot &= ~PROT_WRITE;
|
||||
|
||||
vri->vri_flags = (vr->flags & VR_SHARED) ? MAP_SHARED : 0;
|
||||
vri->vri_flags = (vr->flags & VR_SHARED) ? MAP_IPC_SHARED : 0;
|
||||
|
||||
next = vr->vaddr + vr->length;
|
||||
region_incr_iter(&v_iter);
|
||||
|
|
Loading…
Reference in a new issue