Skip site navigation (1)Skip section navigation (2)
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>
References:  <450F3BA3.40304@SYSTEM.PL>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Marcin Cieslak <saper@SYSTEM.PL> (from Tue, 19 Sep 2006 =20
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 =20
mangled and I have to aapply them by hand. This is ok for such small =20
patches (and I have to review them at the same time...), but not for =20
larger patches.

> Please feel free to review.

> +=09/* Linux mmap(2):

The /* should be on a line by itself. Fixed locally.


> -=09bsd_args.prot =3D linux_args->prot | PROT_READ;=09/* always required *=
/
> -=09if (linux_args->flags & LINUX_MAP_ANON)
> +=09bsd_args.prot =3D linux_args->prot;
> +=09if (linux_args->flags & LINUX_MAP_ANON) {

No need for the opening { here.

>  =09=09bsd_args.fd =3D -1;
> -=09else
> +=09} else {
> +=09=09/*
> +=09=09 * Linux follows Solaris mmap(2) description:
> +=09=09 * The file descriptor fildes is opened with
> +=09=09 * read permission, regardless of the
> +=09=09 * protection options specified.
> +=09=09 * If PROT_WRITE is specified, the application
> +=09=09 * must have opened the file descriptor
> +=09=09 * fildes with write permission unless
> +=09=09 * MAP_PRIVATE is specified in the flags
> +=09=09 * argument as described below.
> +=09=09 */
> +
> +=09=09if ((error =3D fget(td, linux_args->fd, &fp)) !=3D 0)
> +                        return error;
> +=09=09if (fp->f_type !=3D DTYPE_VNODE)
> +=09=09=09return EINVAL;

Missing fdrop in the error case? Added locally for testing.

> +=09=09/* Linux mmap() just fails for O_WRONLY files */
> +=09=09if (! (fp->f_flag & FREAD))
> +=09=09=09return EACCES;

Same as above.

Bye,
Alexander.

--=20
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 =3D B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID =3D 72077137




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060920112244.3gx7bjlfk44g4w8g>