Question regarding L4_err class usage in method commit_result.

Sergey Grekhov grekhss at yandex.ru
Fri Mar 22 06:05:45 CET 2013


Hello, Adam!
Thanks for your reply! One thing I still can not understand is following. In the source code (contrib/kernel/fiasco.oc/src/abi/l4_types.cpp) there is a following comment:


/**
 * Constants for error codes returned by kernel objects.
 */
class L4_err
{
// definition follows
}

The comment says that L4_err defines error codes and this codes are returned by kernel objects. So, does it mean that these constants are used internally in F.OC? If not (if yes, as well) then where are they used?

22.03.2013, 03:19, "Adam Lackorzynski" <adam at os.inf.tu-dresden.de>:
> Hi,
>
> On Thu Mar 21, 2013 at 13:55:29 +0400, Sergey Grekhov wrote:
>
>>  I have a question regarding method Kobject_iface::commit_result() in
>>  the code of Fiasco.OC. One can easily find in the code something
>>  similar to following:
>>
>>                return commit_result(-L4_err::EPerm);
>>
>>  And this call is very confusing: it looks like returning message tag
>>  with error, but in fact the error bit (0x8000) is not set. Moreover,
>>  some values from L4_err is intersection with enumeration
>>  L4_msg_tag::Protocol because of:
>>  1) sign '-' used when commiting result;
>>  2) place where both values are saved - bits 31...16 of the message
>>  tag.
>>  And, finally, there are lots of returns similar to mentioned one
>>  (return commit_result(-L4_err::EPerm)) and there are no _any_ code
>>  which checks presence of these errors in the tag.
>>
>>  I am very confused about these strange values saved in L4_msg_tag and
>>  it appears to me that in these cases should be used method
>>  Kobject_iface::commit_error().
>>  Can someone explain the logic behind returning values defined in class
>>  L4_err?
>
> The error bit 0x8000 indicates an IPC error, i.e. an error related to
> communication. Just using commit_result() returns a return code to the
> caller, also meaning that the IPC itself was ok. And indeed, the label
> field in the msg_tag is used for both transmitting a protocol number to
> the callee and the return code back to the caller, that's why they are
> also negative to indicate errors. The msg_tag error bit is checked in
> userland, see l4_ipc_error() and l4_error() functions in l4sys.

To be honest, I still can not put thing in right places in my head. If commit_result() is used for returning when IPS is ok (means error bit 0x8000 is not set in that case), then what's the point of calling it with something looks like error (L4_err)? Besides, I did not see any code in l4sys which indicates that IPC can return in label, for example, value L4_err::EBadproto == 39, thus I make an implication that these code are not for returning to the callee. Did I miss something? 

Thanks in advance for your answer.

Kind regards,
Sergey Grekhov.

>
> Adam
> --
> Adam                 adam at os.inf.tu-dresden.de
>   Lackorzynski         http://os.inf.tu-dresden.de/~adam/
>
> _______________________________________________
> l4-hackers mailing list
> l4-hackers at os.inf.tu-dresden.de
> http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers

-- 
Best regards,
Sergey Grekhov




More information about the l4-hackers mailing list