bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH hurd] Add proc_getchildren_rusage RPC and track rusage for ch


From: Samuel Thibault
Subject: Re: [PATCH hurd] Add proc_getchildren_rusage RPC and track rusage for children and descendants
Date: Sat, 17 Feb 2024 02:24:30 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le ven. 16 févr. 2024 13:26:29 -0500, a ecrit:
> ---
>  hurd/process.defs | 6 ++++++
>  proc/info.c       | 8 ++++++++
>  proc/proc.h       | 4 +++-
>  proc/wait.c       | 2 ++
>  4 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/hurd/process.defs b/hurd/process.defs
> index 9a8b3a1..007aa2b 100644
> --- a/hurd/process.defs
> +++ b/hurd/process.defs
> @@ -466,3 +466,9 @@ simpleroutine proc_reauthenticate_reassign (
>     that the user has received from auth_user_authenticate call.  */
>  simpleroutine proc_reauthenticate_complete (
>       process: process_t);
> +
> +/* Returns the rusage information for the children that were waited
> + * for plus all their descendants.  */
> +routine proc_getchildren_rusage (
> +     process: process_t;
> +     out children_rusage: rusage_t);
> diff --git a/proc/info.c b/proc/info.c
> index 2d85662..e5b0f47 100644
> --- a/proc/info.c
> +++ b/proc/info.c
> @@ -1093,3 +1093,11 @@ S_proc_get_exe (struct proc *callerp,
>    return 0;
>  }
>  
> +kern_return_t
> +S_proc_getchildren_rusage (struct proc *p, struct rusage *ru)
> +{
> +  if (!p)
> +    return EOPNOTSUPP;
> +  *ru = p->p_child_rusage;
> +  return 0;
> +}
> diff --git a/proc/proc.h b/proc/proc.h
> index a83a509..bbba095 100644
> --- a/proc/proc.h
> +++ b/proc/proc.h
> @@ -76,7 +76,9 @@ struct proc
>    int p_sigcode;
>    struct rusage p_rusage;    /* my usage if I'm dead, to return via wait */
>  
> -  struct rusage p_child_rusage;      /* accumulates p_rusage of all dead 
> children */
> +  /* Accumulates p_rusage of all dead children, including
> +   * grandchildren and their descendants.  */
> +  struct rusage p_child_rusage;
>  
>    unsigned int p_exec:1;     /* has called proc_mark_exec */
>    unsigned int p_stopped:1;  /* has called proc_mark_stop */
> diff --git a/proc/wait.c b/proc/wait.c
> index 4551d28..a31b0e7 100644
> --- a/proc/wait.c
> +++ b/proc/wait.c
> @@ -156,6 +156,8 @@ alert_parent (struct proc *p)
>  {
>    /* We accumulate the aggregate usage stats of all our dead children.  */
>    rusage_add (&p->p_parent->p_child_rusage, &p->p_rusage);
> +  /* ... and descendants.  */
> +  rusage_add (&p->p_parent->p_child_rusage, &p->p_child_rusage);
>  
>    send_signal (p->p_parent->p_msgport, SIGCHLD, CLD_EXITED, 
> p->p_parent->p_task);
>  
> -- 
> 2.39.2
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]