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.
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
Xenomai-core mailing list