[PATCH 1/2] fork: pass arguments to fork1 in a dedicated structure
Konstantin Belousov
kib at freebsd.org
Tue Feb 2 13:11:52 UTC 2016
On Tue, Feb 02, 2016 at 05:07:48AM +0100, Mateusz Guzik wrote:
> From: Mateusz Guzik <mjg at freebsd.org>
>
> ---
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20160202/7a8c9b30/attachment.sig>
More information about the freebsd-hackers
mailing list