How to get the name of a semaphore by id

Juergen Zeller juergen.zeller at argovision.de
Fri Dec 24 12:25:15 UTC 2004


This should help:


static void val2name (uint32 val, uint8 *str)
{
str[0] = (val >> 24) & 0xff;
str[1] = (val >> 16) & 0xff;
str[2] = (val >> 8) & 0xff;
str[3] = (val >> 0) & 0xff;
str[4] = '\0';
}

static void debug_semaphores (void)
{
Thread_Control *the_thread;
Semaphore_Control *the_semaphore;
Objects_Information *information;
Objects_Id id;
uint8 name[5];

//information = &_Semaphore_Information;
information = 
_Objects_Information_table[OBJECTS_CLASSIC_API][OBJECTS_RTEMS_SEMAPHORES];
if (information) {

printk ("--------------------------------------------\n");
printk ("Semaphore Info: Task Info:\n");
printk ("ID NAME STATUS ID NAME\n");
printk ("--------------------------------------------\n");

for (id = information->minimum_id; id <= information->maximum_id; id++) {
the_semaphore = (Semaphore_Control *) information->local_table[id & 0xffff];
if (the_semaphore) {
if ((the_semaphore->attribute_set & RTEMS_SEMAPHORE_CLASS)
!= RTEMS_COUNTING_SEMAPHORE) {

val2name ((uint32)the_semaphore->Object.name, name);
fprintk ("0x%8.8x %4s", the_semaphore->Object.id, name);
the_thread =
_Thread_queue_First (&the_semaphore->Core_control.mutex.Wait_queue);
if (the_thread) {
val2name (*((uint32 *)(the_thread->Object.name)), name);
fprintk (" busy 0x%8.8x %4s\n", the_thread->Object.id, name);
} else {
printk (" free\n");
}
}
}
}
}
}


merry christmas

juergen

Wilfried Busalski schrieb:

>Hi
>
>How do I get the name of a semphore when i only know the id of it ?
>
>
>Regards
>
>Wilfried Busalski
>
>
>
>  
>


-- 
Freundliche Gru"?e aus Sinzing

Ju"rgen Zeller
Entwicklung Software
_____________________________________________________________

TVI Lederer GmbH & Co KG
Industriestra?e 4
D-93161 Sinzing

T +49 (0) 941-30737-61
F +49 (0) 941 30737-37

juergen.zeller at ARGOVISION.de
www.ARGOVISION.de




More information about the users mailing list