bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH gnumach] Add thread_get_name RPC to get the name of a thread.


From: Samuel Thibault
Subject: Re: [PATCH gnumach] Add thread_get_name RPC to get the name of a thread.
Date: Sun, 14 Jul 2024 20:21:57 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le jeu. 11 juil. 2024 23:36:39 +0100, a ecrit:
> ---
>  include/mach/gnumach.defs |  8 ++++++++
>  kern/thread.c             | 21 +++++++++++++++++++++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs
> index 7ecf74d..f13e866 100644
> --- a/include/mach/gnumach.defs
> +++ b/include/mach/gnumach.defs
> @@ -215,3 +215,11 @@ routine vm_pages_phys(
>  simpleroutine thread_set_name(
>               thread  : thread_t;
>               name    : kernel_debug_name_t);
> +
> +/*
> + *  Get the name of thread THREAD as set by thread_set_name. Will return
> + *  the name of the task if no THREAD name is set.
> + */
> +routine thread_get_name(
> +        thread : thread_t;
> +        out name : kernel_debug_name_t);
> diff --git a/kern/thread.c b/kern/thread.c
> index 68cc667..a656c07 100644
> --- a/kern/thread.c
> +++ b/kern/thread.c
> @@ -2647,3 +2647,24 @@ thread_set_name(
>       thread->name[sizeof thread->name - 1] = '\0';
>       return KERN_SUCCESS;
>  }
> +
> +/*
> + *  thread_get_name
> + *
> + *  Return the name of the thread THREAD.
> + *  Will use the name of the thread as set by thread_set_name.
> + *  If thread_set_name was not used, this will return the name of the task
> + *  copied when the thread was created.
> + */
> +kern_return_t
> +thread_get_name(
> +             thread_t        thread,
> +             kernel_debug_name_t     name)
> +{
> +     if (thread == THREAD_NULL)
> +             return KERN_INVALID_ARGUMENT;
> +
> +     strncpy(name, thread->name, sizeof thread->name);
> +
> +     return KERN_SUCCESS;
> +}
> -- 
> 2.45.2
> 
> 



reply via email to

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