Method: LinuxStat::Process.list
- Defined in:
- lib/linux_stat/process.rb
.list ⇒ Object
Returns the list of processes from /proc/.
The return type is an Array of Integers.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/linux_stat/process.rb', line 11 def list d = Dir['/proc/*'.freeze] ret, i = [], -1 count = d.length while(i += 1) < count pid = File.split(d[i])[1] pid_i = pid.to_i ret << pid_i if pid_i.to_s == pid end ret end |