All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Include all heaps in statistics
       [not found] <E1NA3bT-0002c1-7v@domain.hid>
@ 2009-11-16 16:09 ` Gilles Chanteperdrix
  2009-11-16 16:36   ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2009-11-16 16:09 UTC (permalink / raw)
  To: xenomai-core

GIT version control wrote:
> +void xnheap_set_label(xnheap_t *heap, const char *label, ...)
> +{
> +	va_list args;
> +	spl_t s;
> +
> +	va_start(args, label);
> +
> +	xnlock_get_irqsave(&nklock, s);
> +	vsnprintf(heap->label, sizeof(heap->label), label, args);
> +	xnlock_put_irqrestore(&nklock, s);

Why do we need locking here ?

-- 
                                          Gilles



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Include all heaps in statistics
  2009-11-16 16:09 ` [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Include all heaps in statistics Gilles Chanteperdrix
@ 2009-11-16 16:36   ` Jan Kiszka
  2009-11-16 16:41     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2009-11-16 16:36 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Gilles Chanteperdrix wrote:
> GIT version control wrote:
>> +void xnheap_set_label(xnheap_t *heap, const char *label, ...)
>> +{
>> +	va_list args;
>> +	spl_t s;
>> +
>> +	va_start(args, label);
>> +
>> +	xnlock_get_irqsave(&nklock, s);
>> +	vsnprintf(heap->label, sizeof(heap->label), label, args);
>> +	xnlock_put_irqrestore(&nklock, s);
> 
> Why do we need locking here ?
> 

We already registered the heap, so I want to avoid that someone dumping
/proc sees an inconsistent string - or even an unterminated one.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Include all heaps in statistics
  2009-11-16 16:36   ` Jan Kiszka
@ 2009-11-16 16:41     ` Gilles Chanteperdrix
  2009-11-16 16:55       ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2009-11-16 16:41 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> GIT version control wrote:
>>> +void xnheap_set_label(xnheap_t *heap, const char *label, ...)
>>> +{
>>> +	va_list args;
>>> +	spl_t s;
>>> +
>>> +	va_start(args, label);
>>> +
>>> +	xnlock_get_irqsave(&nklock, s);
>>> +	vsnprintf(heap->label, sizeof(heap->label), label, args);
>>> +	xnlock_put_irqrestore(&nklock, s);
>> Why do we need locking here ?
>>
> 
> We already registered the heap, so I want to avoid that someone dumping
> /proc sees an inconsistent string - or even an unterminated one.

There are other ways to avoid that, but, I am over-reacting to printf.
But it is not really a printf, it is an snprintf, which is not that heavy.

-- 
                                          Gilles



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Include all heaps in statistics
  2009-11-16 16:41     ` Gilles Chanteperdrix
@ 2009-11-16 16:55       ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2009-11-16 16:55 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> GIT version control wrote:
>>>> +void xnheap_set_label(xnheap_t *heap, const char *label, ...)
>>>> +{
>>>> +	va_list args;
>>>> +	spl_t s;
>>>> +
>>>> +	va_start(args, label);
>>>> +
>>>> +	xnlock_get_irqsave(&nklock, s);
>>>> +	vsnprintf(heap->label, sizeof(heap->label), label, args);
>>>> +	xnlock_put_irqrestore(&nklock, s);
>>> Why do we need locking here ?
>>>
>> We already registered the heap, so I want to avoid that someone dumping
>> /proc sees an inconsistent string - or even an unterminated one.
> 
> There are other ways to avoid that, but, I am over-reacting to printf.
> But it is not really a printf, it is an snprintf, which is not that heavy.

Right, this was a lazy approach due to the fact that we call snprintf
under nklock already.

Jan

PS: I just force-updated my queue for a cosmetic change
("unlabeled (%p)" -> "unlabeled @0x%p").

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-16 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1NA3bT-0002c1-7v@domain.hid>
2009-11-16 16:09 ` [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Include all heaps in statistics Gilles Chanteperdrix
2009-11-16 16:36   ` Jan Kiszka
2009-11-16 16:41     ` Gilles Chanteperdrix
2009-11-16 16:55       ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.