Last active
January 20, 2016 12:37
-
-
Save dpisarewski/be86168a4be3c42025f2 to your computer and use it in GitHub Desktop.
This file contains 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
require 'inline' | |
class SigHandler | |
inline do |builder| | |
builder.include '<signal.h>' | |
builder.c ' | |
long address(){ | |
struct sigaction oldact; | |
sigaction(SIGINT, NULL, &oldact); | |
sigaction(SIGINT, &oldact, NULL); | |
printf("SIGINT handler address: 0x%lx\n", (long) oldact.sa_sigaction); | |
return (long) oldact.sa_sigaction; | |
} | |
' | |
end | |
end | |
handler_address = SigHandler.new.address | |
#puts ObjectSpace._id2ref(handler_address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment