i386 mmap(2) fixed for LTP
Alexander Leidinger
Alexander at Leidinger.net
Wed Sep 20 02:23:08 PDT 2006
Quoting Marcin Cieslak <saper at SYSTEM.PL> (from Tue, 19 Sep 2006
02:36:51 +0200):
> Using this patch I guess we have all mmap()-related LTP issues solved.
> This fixes outstanding map07 test.
Please add patches as attachments, not inline. Somehow they are
mangled and I have to aapply them by hand. This is ok for such small
patches (and I have to review them at the same time...), but not for
larger patches.
> Please feel free to review.
> + /* Linux mmap(2):
The /* should be on a line by itself. Fixed locally.
> - bsd_args.prot = linux_args->prot | PROT_READ; /* always required */
> - if (linux_args->flags & LINUX_MAP_ANON)
> + bsd_args.prot = linux_args->prot;
> + if (linux_args->flags & LINUX_MAP_ANON) {
No need for the opening { here.
> bsd_args.fd = -1;
> - else
> + } else {
> + /*
> + * Linux follows Solaris mmap(2) description:
> + * The file descriptor fildes is opened with
> + * read permission, regardless of the
> + * protection options specified.
> + * If PROT_WRITE is specified, the application
> + * must have opened the file descriptor
> + * fildes with write permission unless
> + * MAP_PRIVATE is specified in the flags
> + * argument as described below.
> + */
> +
> + if ((error = fget(td, linux_args->fd, &fp)) != 0)
> + return error;
> + if (fp->f_type != DTYPE_VNODE)
> + return EINVAL;
Missing fdrop in the error case? Added locally for testing.
> + /* Linux mmap() just fails for O_WRONLY files */
> + if (! (fp->f_flag & FREAD))
> + return EACCES;
Same as above.
Bye,
Alexander.
--
If it would be cheaper to repair the old one, the
company will insist on the latest model.
http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137
More information about the freebsd-emulation
mailing list