Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Nov 2014 15:35:06 +0100
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        Chagin Dmitry <dchagin@freebsd.org>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   Re: svn commit: r274257 - in user/dchagin/lemul/sys: compat/freebsd32 kern
Message-ID:  <20141108143506.GF19308@ivaldir.etoilebsd.net>
In-Reply-To: <20141108141640.GC15283@dchagin.static.corbina.net>
References:  <201411072312.sA7NC86v017392@svn.freebsd.org> <20141108102811.GU53947@kib.kiev.ua> <20141108141640.GC15283@dchagin.static.corbina.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--AGZzQgpsuUlWC1xT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Nov 08, 2014 at 05:16:40PM +0300, Chagin Dmitry wrote:
> On Sat, Nov 08, 2014 at 12:28:11PM +0200, Konstantin Belousov wrote:
> > On Fri, Nov 07, 2014 at 11:12:08PM +0000, Dmitry Chagin wrote:
> > > Author: dchagin
> > > Date: Fri Nov  7 23:12:07 2014
> > > New Revision: 274257
> > > URL: https://svnweb.freebsd.org/changeset/base/274257
> > >=20
> > > Log:
> > >   Add native ppoll system call.
> > >=20
> > > Modified:
> > >   user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c
> > >   user/dchagin/lemul/sys/compat/freebsd32/syscalls.master
> > >   user/dchagin/lemul/sys/kern/sys_generic.c
> > >   user/dchagin/lemul/sys/kern/syscalls.master
> > >=20
> > > Modified: user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c
> > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > > --- user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c	Fri Nov =
 7 22:52:02 2014	(r274256)
> > > +++ user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c	Fri Nov =
 7 23:12:07 2014	(r274257)
> > > @@ -3017,3 +3017,31 @@ freebsd32_fcntl(struct thread *td, struc
> > >  	}
> > >  	return (kern_fcntl_freebsd(td, uap->fd, uap->cmd, tmp));
> > >  }
> > > +
> > > +int
> > > +freebsd32_ppoll(struct thread *td, struct freebsd32_ppoll_args *uap)
> > > +{
> > > +	struct timespec32 ts32;
> > > +	struct timespec ts, *tsp;
> > > +	sigset_t set, *ssp;
> > > +	int error;
> > > +
> > > +	if (uap->ts !=3D NULL) {
> > > +		error =3D copyin(uap->ts, &ts32, sizeof(ts32));
> > > +		if (error !=3D 0)
> > > +			return (error);
> > > +		CP(ts32, ts, tv_sec);
> > > +		CP(ts32, ts, tv_nsec);
> > > +		tsp =3D &ts;
> > > +	} else
> > > +		tsp =3D NULL;
> > > +	if (uap->set !=3D NULL) {
> > > +		error =3D copyin(uap->set, &set, sizeof(set));
> > > +		if (error !=3D 0)
> > > +			return (error);
> > > +		ssp =3D &set;
> > > +	} else
> > > +		ssp =3D NULL;
> > > +
> > > +	return (kern_ppoll(td, uap->fds, uap->nfds, tsp, ssp));
> > > +}
> > >=20
> > > Modified: user/dchagin/lemul/sys/compat/freebsd32/syscalls.master
> > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > > --- user/dchagin/lemul/sys/compat/freebsd32/syscalls.master	Fri Nov  =
7 22:52:02 2014	(r274256)
> > > +++ user/dchagin/lemul/sys/compat/freebsd32/syscalls.master	Fri Nov  =
7 23:12:07 2014	(r274257)
> > > @@ -1066,3 +1066,6 @@
> > >  				    uint32_t id1, uint32_t id2, int com, \
> > >  				    void *data); }
> > >  #endif
> > > +545	AUE_POLL	STD	{ int freebsd32_ppoll(struct pollfd *fds, \
> > > +				    u_int nfds, const struct timespec32 *ts, \
> > > +				    const sigset_t *set); }
> > >=20
> > > Modified: user/dchagin/lemul/sys/kern/sys_generic.c
> > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > > --- user/dchagin/lemul/sys/kern/sys_generic.c	Fri Nov  7 22:52:02 201=
4	(r274256)
> > > +++ user/dchagin/lemul/sys/kern/sys_generic.c	Fri Nov  7 23:12:07 201=
4	(r274257)
> > > @@ -1377,6 +1377,41 @@ out:
> > >  	return (error);
> > >  }
> > > =20
> > > +#ifndef _SYS_SYSPROTO_H_
> > > +struct ppoll_args {
> > > +	struct pollfd *fds;
> > > +	u_int	nfds;
> > > +	struct timespec	*ts;
> > > +	sigset_ *set;
> > This is spelled sigset_t.  In fact, I do not think we should keep maint=
ain
> > the unused manually copied syscall arg structs definitions.  At least,
> > I never added them for new syscalls.
> >=20
>=20
> yeah, thank you! i'll fix soon.
>=20
>=20
> > > +};
> > > +#endif
> > > +int
> > > +sys_ppoll(td, uap)
> > > +	struct thread *td;
> > > +	struct ppoll_args *uap;
> > Please use C89 function definitions for new code.
> >=20
>=20
> sure
>=20
> > > +{
> > > +	struct timespec ts, *tsp;
> > > +	sigset_t set, *ssp;
> > > +	int error;
> > > +
> > > +	if (uap->ts !=3D NULL) {
> > > +		error =3D copyin(uap->ts, &ts, sizeof(ts));
> > > +		if (error)
> > > +			return (error);
> > > +		tsp =3D &ts;
> > > +	} else
> > > +		tsp =3D NULL;
> > > +	if (uap->set !=3D NULL) {
> > > +		error =3D copyin(uap->set, &set, sizeof(set));
> > > +		if (error)
> > > +			return (error);
> > > +		ssp =3D &set;
> > > +	} else
> > > +		ssp =3D NULL;
> > > +
> > > +	return (kern_ppoll(td, uap->fds, uap->nfds, tsp, ssp));
> > > +}
> > > +
> > >  int
> > >  kern_ppoll(struct thread *td, struct pollfd *fds, u_int nfds,
> > >      struct timespec *tsp, sigset_t *uset)
> >=20
> > One more note about kern_ppoll().  As I see, tsp and uset are supposed
> > to be in the KVA, while fds points to UVA.  This is consistent with
> > kern_select(), but is surprising for somebody who reads the code.
> > Please add comments explaining the conventions.
>=20
> ok
> >=20
> > Also, I think ppoll(2) should be extracted from the branch and committed
> > on its own.
>=20
> agree
> >=20
> > What about man page ?  Or update of poll(2).
>=20
> oh.. I'll try, it's not easy for me
>=20
If you need review/help on this you can use phabricator for asking some peo=
ple
to review there is a '#manpages' group with people willing to help on the
manpage side of the code :)

Best regards,
Bapt

--AGZzQgpsuUlWC1xT
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlReKhoACgkQ8kTtMUmk6EwPSQCfeIbxAX80Ozk2urN/o9P4MqqL
VhYAni6GjAtKhxyCVlLD1WMW4VnPxsYJ
=UAGu
-----END PGP SIGNATURE-----

--AGZzQgpsuUlWC1xT--



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