From owner-svn-src-user@FreeBSD.ORG Sat Nov 8 10:28:18 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD66E5B5; Sat, 8 Nov 2014 10:28:18 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 672B9DCC; Sat, 8 Nov 2014 10:28:18 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id sA8ASBgt025640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 8 Nov 2014 12:28:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua sA8ASBgt025640 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id sA8ASBhM025639; Sat, 8 Nov 2014 12:28:11 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 8 Nov 2014 12:28:11 +0200 From: Konstantin Belousov To: Dmitry Chagin Subject: Re: svn commit: r274257 - in user/dchagin/lemul/sys: compat/freebsd32 kern Message-ID: <20141108102811.GU53947@kib.kiev.ua> References: <201411072312.sA7NC86v017392@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201411072312.sA7NC86v017392@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Nov 2014 10:28:19 -0000 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 > > Log: > Add native ppoll system call. > > 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 > > Modified: user/dchagin/lemul/sys/compat/freebsd32/freebsd32_misc.c > ============================================================================== > --- 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 != NULL) { > + error = copyin(uap->ts, &ts32, sizeof(ts32)); > + if (error != 0) > + return (error); > + CP(ts32, ts, tv_sec); > + CP(ts32, ts, tv_nsec); > + tsp = &ts; > + } else > + tsp = NULL; > + if (uap->set != NULL) { > + error = copyin(uap->set, &set, sizeof(set)); > + if (error != 0) > + return (error); > + ssp = &set; > + } else > + ssp = NULL; > + > + return (kern_ppoll(td, uap->fds, uap->nfds, tsp, ssp)); > +} > > Modified: user/dchagin/lemul/sys/compat/freebsd32/syscalls.master > ============================================================================== > --- 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); } > > Modified: user/dchagin/lemul/sys/kern/sys_generic.c > ============================================================================== > --- user/dchagin/lemul/sys/kern/sys_generic.c Fri Nov 7 22:52:02 2014 (r274256) > +++ user/dchagin/lemul/sys/kern/sys_generic.c Fri Nov 7 23:12:07 2014 (r274257) > @@ -1377,6 +1377,41 @@ out: > return (error); > } > > +#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 maintain the unused manually copied syscall arg structs definitions. At least, I never added them for new syscalls. > +}; > +#endif > +int > +sys_ppoll(td, uap) > + struct thread *td; > + struct ppoll_args *uap; Please use C89 function definitions for new code. > +{ > + struct timespec ts, *tsp; > + sigset_t set, *ssp; > + int error; > + > + if (uap->ts != NULL) { > + error = copyin(uap->ts, &ts, sizeof(ts)); > + if (error) > + return (error); > + tsp = &ts; > + } else > + tsp = NULL; > + if (uap->set != NULL) { > + error = copyin(uap->set, &set, sizeof(set)); > + if (error) > + return (error); > + ssp = &set; > + } else > + ssp = 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) 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. Also, I think ppoll(2) should be extracted from the branch and committed on its own. What about man page ? Or update of poll(2).