"Can't obtain network semaphore"

Ian Caddy ianc at microsol.iinet.net.au
Wed Dec 15 05:03:00 UTC 2004


Till Straumann wrote:
> Ian Caddy wrote:
> 
>> What would happen if the network semaphore object id was corrupted.  
>> It wouldn't even get to the section of code to get the mutex, but 
>> would return on invalid ID error when it tried to get the object.
>>
>> Steve did not mention what the actual return code from the call to the 
>> semaphore get, does it correspond to the internal return code of 4?
> 
> 
> Yes, Steve did report earlier a return code of 4
> 

If the actual return code from the actual call:

	sc = rtems_semaphore_obtain

was 4 then (at least on 4.5.0) indicates a:

   RTEMS_INVALID_ID               =  4, /* invalid object id */

In this case it would not go into any of the mutex code.



>> This could have been returned from another earlier function call.
> 
> 
> No. _CORE_mutex_Seize() sets this to 0 on entry (in 'trylock').
> 
> T.
>

But if the ID is invalid, it will not enter the seize code, therefore 
the Wait.return_code will not get initialised or even changed from what 
ever it was set to before the call, in other words from the last call 
that modified it.

The actual return code from the function is different to the 
Wait.return_code as it is translated at the end of semobtain.c:

         return _Semaphore_Translate_core_mutex_return_code(
                   _Thread_Executing->Wait.return_code );


The acual rtems_status_code of 4 is not possible through this mechanism.

Ian Caddy




More information about the users mailing list