bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] exec: provide a meaningful name for new tasks


From: Samuel Thibault
Subject: Re: [PATCH 1/2] exec: provide a meaningful name for new tasks
Date: Sat, 22 Feb 2014 06:19:14 -0800
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Fri 21 Feb 2014 20:52:04 +0100, a écrit :
> The name will be used in error messages printed by the kernel.  This
> makes attributing the errors to processes possible.
> 
> * exec/exec.c (do_exec): Set the name of the new task.

Ack.

> ---
>  exec/exec.c | 27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/exec/exec.c b/exec/exec.c
> index fad9492..e693f63 100644
> --- a/exec/exec.c
> +++ b/exec/exec.c
> @@ -1151,14 +1151,29 @@ do_exec (file_t file,
>        }
>    boot->user_entry = e.entry;        /* already adjusted in `load' */
>  
> -  /* Set the start_code and end_code values for this process.
> -     /hurd/exec is used to start /hurd/proc, so at this point there is
> +  /* /hurd/exec is used to start /hurd/proc, so at this point there is
>       no proc server, so we need to be careful here.  */
>    if (boot->portarray[INIT_PORT_PROC] != MACH_PORT_NULL)
> -    e.error = proc_set_code (boot->portarray[INIT_PORT_PROC],
> -                          e.start_code, e.end_code);
> -  if (e.error)
> -    goto out;
> +    {
> +      /* Set the start_code and end_code values for this process.  */
> +      e.error = proc_set_code (boot->portarray[INIT_PORT_PROC],
> +                            e.start_code, e.end_code);
> +      if (e.error)
> +     goto out;
> +
> +      pid_t pid;
> +      e.error = proc_task2pid (boot->portarray[INIT_PORT_PROC],
> +                            newtask, &pid);
> +      if (e.error)
> +     goto out;
> +
> +      char *name;
> +      if (asprintf (&name, "%s(%d)", argv, pid) > 0)
> +     {
> +       task_set_name (newtask, name);
> +       free (name);
> +     }
> +    }
>  
>    /* Create the initial thread.  */
>    e.error = thread_create (newtask, &thread);
> -- 
> 1.8.5.2
> 

-- 
Samuel
<studdud> what the fuck is wtf



reply via email to

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