The Knights of Syllable
Joined: 14 Sep 2007
|Posted: Wed May 06, 2009 4:34 pm Post subject: Some syscall return values to not match their prototypes
|This was noticed when debugging and issue with get_msg_x(). The prototype is:
which suggests that if the call times out, the syscall should return ETIME directly to the caller. In testing it has been found that what actually happens is that errno is set to ETIME and the syscall returns -1. This is clearly different to what is suggested by the prototype and differs from the usual Syllable calling conventions.
The issue appears to be that the Glibc implementation for get_msg_x() is essentially:
return INLINE_SYSCALL( raw_get_msg_x, ... );
The INLINE_SYSCALL macro will capture any "abnormal" return values from the syscall and sets errno on our behalf, returning -1 to the caller to indicate the abnormal return from the syscall.
The specific wrapper for get_msg_x()/raw_get_msg_x() could clearly be made smarter to implicitly handle such a condition, but it may also bee that other syscalls show the same behaviour. Other syscalls will have to be checked, especially those listed directly in syscalls.list.
It is unknown what effect fixing these syscalls may have on dependent code.