Hi all,
I am happy to announce the release of Sys::ProcTable 0.3.0.
This is a C extension for the ‘ps’ command on *nix systems (it is not
parsed system call output). With this module you can view process table
information, such as pid, euid, state, etc. The exact fields available
depend on your platform.
What’s new since the last announcement?
FreeBSD support has been added!
The ability to limit your results by command name
Now returns an array of structs in lvalue context
Some other minor bug fixes & changes
Thanks go to Sean Chittenden for providing me with a FreeBSD environment
to work on.
Quick synopsis:
require 'sys/proctable’
include Sys
List available fields
puts "Available fields: " + ProcTable.fields.join(’, ') # Everything
ProcTable.ps{ |p|
puts p.pid.to_s
puts p.comm
…
}
or just these two processes
ProcTable.ps(2123,327){ |p|
puts p.pid.to_s
puts p.comm
…
}
or only ‘vim’ processes
ProcTable.ps(“vim”){ |p|
puts p.pid.to_s
puts p.comm
…
}
Enjoy!
Dan