Question regarding L4_err class usage in method commit_result.

Adam Lackorzynski adam at os.inf.tu-dresden.de
Fri Mar 22 00:16:59 CET 2013


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.



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list