An extension that lists the system's supported syscalls (e.g. SYS_open, SYS_write, etc.). These are read from sys/syscall.h when the gem is built.
So far this has been tested on a couple of Linux machines; it should in principle work on other *nixes, but I haven't tested it.
require 'rubygems' require 'syscalls' include Syscalls puts Process.pid #=> (your process's pid) puts syscall(SYS_getpid) #=> (your process's pid)
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] (Debian squeeze)
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] (CentOS 5.5)
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux] (CentOS 5.5)
sudo gem install syscalls
added a copy of Kernel.syscall, which is going away (according to a warning that it gives in 1.9.2-p290).
(The MIT License)
Copyright © 2011 John Lees-Miller
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.