Last active
August 29, 2015 14:01
-
-
Save AlainODea/0335ac86110e6b9a15d3 to your computer and use it in GitHub Desktop.
DTrace EAGAIN returns from read(2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
syscall::open:entry | |
/arg0 != NULL/ | |
{ | |
self->pathptr = arg0; | |
self->oflag = arg1; | |
} | |
syscall::open:return | |
/self->pathptr != NULL/ | |
{ | |
self->path = copyinstr(self->pathptr); | |
self->pathptr = 0; | |
printf("open(%s, %d) = %d (%d)\n", | |
self->path, self->oflag, arg1, errno); | |
self->path = 0; | |
self->oflag = 0; | |
} | |
syscall::read:entry | |
{ | |
self->filedes = arg1; | |
} | |
syscall::read:return | |
/self->filedes != NULL && errno == 11/ | |
{ | |
printf("read(%d, buf) = %d (%d)\n", | |
self->filedes, arg1, errno); | |
self->filedes = 0; | |
ustack(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix invalid address by guarding against null path in open(2).
Fix dynamic variables dropped by explicitly releasing thread-locals by assigning them to 0 as they are no longer needed.