[PATCH rtems-libbsd 7/7] kern: Add kernel trace support (KTR)

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jul 28 07:44:33 UTC 2021


On 28/07/2021 09:40, Chris Johns wrote:
> On 28/7/21 4:57 pm, Sebastian Huber wrote:
>> On 28/07/2021 08:53, Chris Johns wrote:
>>> On 28/7/21 4:27 pm, Sebastian Huber wrote:
>>>> On 27/07/2021 10:58,chrisj at rtems.org   wrote:
>>>>> diff --git a/rtemsbsd/rtems/rtems-kernel-thread.c
>>>>> b/rtemsbsd/rtems/rtems-kernel-thread.c
>>>>> index 3e1e44b9..49ec6df7 100644
>>>>> --- a/rtemsbsd/rtems/rtems-kernel-thread.c
>>>>> +++ b/rtemsbsd/rtems/rtems-kernel-thread.c
>>>>> @@ -260,6 +260,9 @@ rtems_bsd_thread_start(struct thread **td_ptr, void
>>>>> (*func)(void *), void *arg,
>>>>>             BSD_ASSERT(td != NULL);
>>>>>               _Thread_Set_name(thread, name);
>>>>> +#ifdef KTR
>>>>> +        strlcpy(td->td_name, name, sizeof(td->td_name));
>>>>> +#endif
>>>> Do we really need this copy and the td_name member?
>>>>
>>> I found it useful with the KTR output to have the thread. KTR is a
>>> developer/development aid and a good addition to libbsd.
>> We already have a name in the Thread_Control:
>>
>> the_thread->Join_queue.Queue.name;
>>
>> See also _Thread_Get_name().
> The `td_name` field is only present when the KTR is defined. I simply reused the
> decl present in `struct thread` rather than optimise what could be done and
> possibly create further issues. If the name field was present all the time I
> would agree a pointer to the TCB would be preferred but that adds a pointer to
> the thread struct which is currently not there.

Ok, good. I didn't notice that the td_name is conditional to KTR since 
it was in another patch. Maybe just use a const char *td_name pointer 
which is set to the value of the_thread->Join_queue.Queue.name. If a 
user changes the name after initialization, then it is up to date in KTR.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list