Permalink
Browse files

Add AIX support.

  • Loading branch information...
2 parents e44be8a + bc5b720 commit 21805ea9c4a46a05f722c82b0da961002561b3da @djberg96 committed Feb 21, 2014
Showing with 974 additions and 5 deletions.
  1. +3 −0 MANIFEST
  2. +11 −1 Rakefile
  3. +86 −0 doc/aix.txt
  4. +458 −0 lib/aix/sys/proctable.rb
  5. +86 −0 lib/darwin/sys/proctable.rb
  6. +6 −4 lib/sys/top.rb
  7. +324 −0 test/test_sys_proctable_aix.rb
View
@@ -3,6 +3,7 @@
* Rakefile
* README
* sys-proctable.gemspec
+* doc/aix.txt
* doc/bsd.txt
* doc/hpux.txt
* doc/linux.txt
@@ -17,9 +18,11 @@
* ext/hpux/extconf.rb
* ext/hpux/sys/proctable.c
* lib/sys/top.rb
+* lib/aix/sys/proctable.rb
* lib/linux/sys/proctable.rb
* lib/sunos/sys/proctable.rb
* lib/windows/sys/proctable.rb
+* test/test_sys_proctable_aix.rb
* test/test_sys_proctable_all.rb
* test/test_sys_proctable_darwin.rb
* test/test_sys_proctable_hpux.rb
View
@@ -38,7 +38,7 @@ task :build => [:clean] do
ext = '.sl'
end
- unless CONFIG['host_os'] =~ /win32|mswin|dos|cygwin|mingw|windows|linux|sunos|solaris/i
+ unless CONFIG['host_os'] =~ /win32|mswin|dos|cygwin|mingw|windows|linux|sunos|solaris|aix/i
Dir.chdir(dir) do
ruby 'extconf.rb'
sh 'make'
@@ -61,6 +61,8 @@ task :install => [:build] do
file = 'lib/linux/sys/proctable.rb'
when /sunos|solaris/i
file = 'lib/sunos/sys/proctable.rb'
+ when /aix/i
+ file = 'lib/aix/sys/proctable.rb'
when /bsd/i
Dir.chdir('ext/bsd'){ sh 'make install' }
when /darwin/i
@@ -111,6 +113,9 @@ Rake::TestTask.new do |t|
when /sunos|solaris/i
t.test_files = FileList['test/test_sys_proctable_sunos.rb']
t.libs << 'lib/sunos'
+ when /aix/i
+ t.test_files = FileList['test/test_sys_proctable_aix.rb']
+ t.libs << 'lib/aix'
when /darwin/i
t.libs << 'ext/darwin'
t.test_files = FileList['test/test_sys_proctable_darwin.rb']
@@ -162,6 +167,11 @@ namespace :gem do
spec.require_paths = ['lib', 'lib/sunos']
spec.files += ['lib/sunos/sys/proctable.rb']
spec.test_files << 'test/test_sys_proctable_sunos.rb'
+ when /aix/i
+ spec.platform = Gem::Platform.new(['universal', 'aix5'])
+ spec.require_paths = ['lib', 'lib/aix']
+ spec.files += ['lib/aix/sys/proctable.rb']
+ spec.test_files << 'test/test_sys_proctable_aix.rb'
when /mswin|win32|dos|cygwin|mingw|windows/i
spec.platform = Gem::Platform.new(['universal', 'mingw32'])
spec.require_paths = ['lib', 'lib/windows']
View
@@ -0,0 +1,86 @@
+= Description
+ A Ruby interface for gathering process table information. This is a pure
+ Ruby implementation that unpacks data out of your /proc filesystem.
+
+= Synopsis
+ require 'sys/proctable'
+ include Sys
+
+ # Everything
+ ProcTable.ps{ |p|
+ puts p.pid.to_s
+ puts p.comm
+ ...
+ }
+
+ or
+
+ # Just one process
+ p = ProcTable.ps(2123)
+ puts p.pid.to_s
+ puts p.comm
+ ...
+
+ or
+
+ # Return the results as an array of ProcTableStructs
+ a = ProcTable.ps()
+ a.each do |p|
+ puts a.pid
+ ...
+ end
+
+= Constants
+VERSION
+ Returns the current version number for this library (as a string).
+
+= Class Methods
+ProcTable.fields
+ Returns an array of fields available on the current OS.
+
+ProcTable.ps(pid=nil)
+ProcTable.ps { |s| ... }
+ If no pid's or processes are included as arguments, in block form it
+ returns a struct of type ProcTableStruct for every process in the proc
+ table. Otherwise it returns an array of ProcTableStruct's.
+
+ If a process id is provided, a single ProcTable struct is returned, or
+ nil if the pid is not found.
+
+= Exception Classes
+ProcTable::Error < StandardError
+ Raised if the /proc field is unreadable and/or unmounted.
+
+= Supported fields
+ You can view the supported fields with the "fields()" class method.
+
+= Future Plans
+ Have the flags fields return meaningful values.
+
+= Notes
+ The "comm" field isn't really part of the psinfo struct. It is just a copy
+ (i.e. is identical to) the "fname" field. It exists to provide a degree
+ of consistency between all of the platforms.
+
+= Known Bugs
+ None known. Please log any bugs on the project page at
+ http://www.rubyforge.org/projects/sysutils
+
+= License
+ Artistic 2.0
+
+= Copyright
+ (C) 2003-2014 Daniel J. Berger
+ All Rights Reserved
+
+= Warranty
+ This package is provided "as is" and without any express or
+ implied warranties, including, without limitation, the implied
+ warranties of merchantability and fitness for a particular purpose.
+
+= Authors
+ Rick Ohnemus
+ Daniel J. Berger
+
+= See Also
+ ps, proc
Oops, something went wrong.

0 comments on commit 21805ea

Please sign in to comment.