On 07/02/2012 15:32, Alexander Kabaev wrote:
Pardon my possibly naive question, but isn't using errno to detect
whether the syscall is succesful a wrong techique? Syscall will NOT
change errno unless unless it actually failed, so unless dtrace's errno
emulation is more magic than I thought, your script will mistakenly
attribute error code coming from a distant past to syscalls just
complete with no errors?

I didn't think about this at all, just picked this script from some website.
But now I did an experiment: in the test process I placed on failing open(2) call and next to it a succeeding one. And this dtrace script only shows one failed open(2) call, not two as you would expect if errno was indeed preserved between them.

So maybe there is some magic to it in dtrace functionality.

Someone more familiar with the matter maybe can explain this.

Yuri
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to