diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2010-04-14 15:22:58 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2010-04-14 15:22:58 +0000 |
| commit | f70ad5484f0bf06d599b98a6a8cfd47739789c0b (patch) | |
| tree | 7beb9564f2205a26ca89cd7eae85354907823d9e | |
| parent | f76f001a479b56103810de5da5fc0635984c11ad (diff) | |
Notes
| -rw-r--r-- | lib/libc/sys/mmap.2 | 7 | ||||
| -rw-r--r-- | sys/vm/vm_mmap.c | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2 index e63274808d51..85019b2e25c1 100644 --- a/lib/libc/sys/mmap.2 +++ b/lib/libc/sys/mmap.2 @@ -105,7 +105,7 @@ The file descriptor used for creating must be \-1. The .Fa offset -argument is ignored. +argument must be 0. .\".It Dv MAP_FILE .\"Mapped from a regular file or character-special device memory. .It Dv MAP_FIXED @@ -312,6 +312,11 @@ was equal to zero. was specified and the .Fa fd argument was not -1. +.It Bq Er EINVAL +.Dv MAP_ANON +was specified and the +.Fa offset +argument was not 0. .It Bq Er ENODEV .Dv MAP_ANON has not been specified and diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index c8d25ee3a305..14a39795f5fe 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -232,7 +232,7 @@ mmap(td, uap) /* make sure mapping fits into numeric range etc */ if ((uap->len == 0 && !SV_CURPROC_FLAG(SV_AOUT) && curproc->p_osrel >= 800104) || - ((flags & MAP_ANON) && uap->fd != -1)) + ((flags & MAP_ANON) && (uap->fd != -1 || pos != 0))) return (EINVAL); if (flags & MAP_STACK) { @@ -298,7 +298,6 @@ mmap(td, uap) handle = NULL; handle_type = OBJT_DEFAULT; maxprot = VM_PROT_ALL; - pos = 0; } else { /* * Mapping file, get fp for validation and |
