From owner-freebsd-hackers@freebsd.org Tue Feb 2 14:28:26 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6F69A9967F for ; Tue, 2 Feb 2016 14:28:26 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B230BDED for ; Tue, 2 Feb 2016 14:28:26 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound2.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Tue, 2 Feb 2016 14:29:26 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u12ESJEN008802; Tue, 2 Feb 2016 07:28:19 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1454423299.11162.27.camel@freebsd.org> Subject: Re: [PATCH 1/2] fork: pass arguments to fork1 in a dedicated structure From: Ian Lepore To: Konstantin Belousov , Mateusz Guzik Cc: freebsd-hackers@freebsd.org, Mateusz Guzik Date: Tue, 02 Feb 2016 07:28:19 -0700 In-Reply-To: <20160202131145.GT91220@kib.kiev.ua> References: <20160201103632.GL91220@kib.kiev.ua> <1454386069-29657-1-git-send-email-mjguzik@gmail.com> <1454386069-29657-2-git-send-email-mjguzik@gmail.com> <20160202131145.GT91220@kib.kiev.ua> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2016 14:28:27 -0000 On Tue, 2016-02-02 at 15:11 +0200, Konstantin Belousov wrote: > On Tue, Feb 02, 2016 at 05:07:48AM +0100, Mateusz Guzik wrote: > > From: Mateusz Guzik > > > > --- > > sys/compat/cloudabi/cloudabi_proc.c | 7 +++++- > > sys/compat/linux/linux_fork.c | 17 ++++++++++---- > > sys/kern/init_main.c | 6 +++-- > > sys/kern/kern_fork.c | 46 +++++++++++++++++++++++++ > > ------------ > > sys/kern/kern_kthread.c | 7 ++++-- > > sys/sys/proc.h | 12 ++++++++-- > > 6 files changed, 68 insertions(+), 27 deletions(-) > > > > diff --git a/sys/compat/cloudabi/cloudabi_proc.c > > b/sys/compat/cloudabi/cloudabi_proc.c > > index d917337..010efca 100644 > > --- a/sys/compat/cloudabi/cloudabi_proc.c > > +++ b/sys/compat/cloudabi/cloudabi_proc.c > > @@ -75,12 +75,17 @@ int > > cloudabi_sys_proc_fork(struct thread *td, > > struct cloudabi_sys_proc_fork_args *uap) > > { > > + struct fork_req fr = {}; > > struct filecaps fcaps = {}; > > struct proc *p2; > > int error, fd; > > > > cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_EVENT); > > - error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, > > &fd, 0, &fcaps); > > + fr.fr_flags = RFFDG | RFPROC | RFPROCDESC; > > + fr.fr_procp = &p2; > > + fr.fr_pd_fd = &fd; > > + fr.fr_pd_fcaps = &fcaps; > > + error = fork1(td, &fr); > > if (error != 0) > > return (error); > The patch is fine. > > Would be great to not use initializer in declaration, i.e. use > bzero() > instead of c99 designated initializers. This would be a better suggestion if the compiler recognized and optimized bzero() with inline code like it does for those forbidden assignments. Or, to put it more basically: it's the 21st century, can't we please please please start using the tools we've got properly instead of slavishly following some silly rules from 1985? -- Ian