We need to get the syscall return value and the errno separately. However, when for instance, the connect syscall is executed in a non-blocking socket and it returns -1 and errno=115 (EINPROGRESS) all we get in a "probe syscall.*.return" is: returnval() = -115 retstr = "-115 (EINPROGRESS)" We couldn't find in any part of the documentation that returnval() or the syscall return value will be replaced with the errno value, so I wonder if it's a bug or in any case, how can we get/recover the original syscall return code?
> We couldn't find in any part of the documentation that returnval() or the > syscall return value will be replaced with the errno value [...] It turns out that this is an artefact of how linux system calls work. A positive/zero return value is success, a negative return value usually is an error code that the glibc runtime will shift into the global 'errno'. At the low systemtap level, the negative errno -is- the genuine return value from the syscall. Unfortunately, we don't have convenient probes at the glibc level to observe the C-level aftereffects properly. There is a glibc RFE open (for quite some time now) for them to insert some sys/sdt.h markers, so that stap could present the cooked results properly. (RHers, see also https://bugzilla.redhat.com/show_bug.cgi?id=742034 .)
Ouch I see, thank you for the quick response.