Date: Wed, 20 Sep 2006 11:22:44 +0200 From: Alexander Leidinger <Alexander@Leidinger.net> To: Marcin Cieslak <saper@SYSTEM.PL> Cc: emulation@freebsd.org Subject: Re: i386 mmap(2) fixed for LTP Message-ID: <20060920112244.3gx7bjlfk44g4w8g@webmail.leidinger.net> In-Reply-To: <450F3BA3.40304@SYSTEM.PL>
index | next in thread | previous in thread | raw e-mail
Quoting Marcin Cieslak <saper@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
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060920112244.3gx7bjlfk44g4w8g>
