Skip to content

Instantly share code, notes, and snippets.

@dpisarewski
Last active January 20, 2016 12:37
Show Gist options
  • Save dpisarewski/be86168a4be3c42025f2 to your computer and use it in GitHub Desktop.
Save dpisarewski/be86168a4be3c42025f2 to your computer and use it in GitHub Desktop.
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