* mmap.cc (mmap): Check for reusing a mapping only on MAP_SHARED

and on MAP_PRIVATE|MAP_ANON in the special case of offset 0.
This commit is contained in:
Corinna Vinschen
2001-02-08 21:10:45 +00:00
parent db49d0b530
commit 889109ab1f
2 changed files with 8 additions and 2 deletions

View File

@@ -455,8 +455,9 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off)
list *l = mmapped_areas->get_list_by_fd (fd);
/* First check if this mapping matches into the chunk of another
already performed mapping. Only for MAP_SHARED mapping. */
if (l && (flags & MAP_SHARED))
already performed mapping. Only valid for MAP_SHARED and for
MAP_ANON in a special case of MAP_PRIVATE. */
if (l && ((flags & MAP_SHARED) || (fd == -1 && off == 0)))
{
mmap_record *rec;
if ((rec = l->match (off, len)) != NULL)