sys-proctable 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,9 +1,13 @@
1
- == 0.8.0 - ???
2
- * Added preliminary support for Darwin (OS X). Thanks go to David Felstead
3
- for the code contribution.
1
+ == 0.7.4 - 20-Nov-2006
2
+ * Added a patch that deals with the large file compilation issue on Solaris.
3
+ You no longer need to build Ruby with --disable-largefile, or build a
4
+ 64 bit Ruby, in order for this package to work. Thanks go to Steven Jenkins
5
+ for the information that led to the patch.
4
6
  * Added inline rdoc to the source code.
5
7
  * Added a gemspec.
6
8
  * Fixed some potential 64 bit issues (struct declarations).
9
+ * Added preliminary support for Darwin (OS X). The code was provided by
10
+ David Felstead, but does not appear to compile successfully. Help wanted.
7
11
 
8
12
  == 0.7.3 - 27-Oct-2005
9
13
  * Fix for 1.8.3 and later (rb_pid_t). This should have only affected
@@ -0,0 +1,41 @@
1
+ CHANGES
2
+ INSTALL
3
+ MANIFEST
4
+ install.rb
5
+ sys-proctable.gemspec
6
+
7
+ doc/freebsd.txt
8
+ doc/hpux.txt
9
+ doc/linux.txt
10
+ doc/solaris.txt
11
+ doc/top.txt
12
+ doc/windows.txt
13
+
14
+ ext/extconf.rb
15
+ ext/bsd/bsd.c
16
+ ext/darwin/darwin.c
17
+ ext/freebsd/freebsd.c
18
+ ext/freebsd/freebsd.h
19
+ ext/hpux/hpux.c
20
+ ext/hpux/hpux.h
21
+ ext/linux/linux.c
22
+ ext/linux/linux.h
23
+ ext/sunos/sunos.c
24
+ ext/sunos/sunos.h
25
+ ext/version.h
26
+
27
+ examples/test_ps.rb
28
+
29
+ lib/top.rb
30
+
31
+ lib/sys/windows.rb
32
+
33
+ test/tc_all.rb
34
+ test/tc_freebsd.rb
35
+ test/tc_hpux.rb
36
+ test/tc_linux.rb
37
+ test/tc_sunos.rb
38
+ test/tc_top.rb
39
+ test/tc_windows.rb
40
+ test/tc_kvm_bsd.rb
41
+ test/test_memleak.rb
data/README CHANGED
@@ -1,68 +1,131 @@
1
- == Prerequisites
2
- Unix: Ruby 1.8.0 or later.
3
- Win32: Ruby 1.8.2 or later.
1
+ = Description
2
+ A Ruby interface for gathering process information.
4
3
 
5
- == Supported Platforms
4
+ = Prerequisites
5
+ === Unix
6
+ Ruby 1.8.0 or later.
7
+ === MS Windows
8
+ Ruby 1.8.2 or later.
9
+
10
+ = Supported Platforms
6
11
  * Windows NT family (NT, 2000, XP, etc)
7
12
  * Linux
8
13
  * FreeBSD (/proc or kvm)
9
14
  * Solaris
10
- * NetBSD (kvm only)
11
15
  * HP-UX
12
16
 
13
- == Installation
14
- Unix:
15
- ruby extconf.rb
17
+ = Installation
18
+ === UNIX
19
+ cd ext; ruby extconf.rb
16
20
  make
17
- ruby test.rb (optional)
18
- make site-install
21
+ cd ..; ruby test/ts_all.rb (optional)
22
+ make install
19
23
 
20
- Windows:
24
+ === MS Windows
21
25
  ruby test/tc_windows.rb (optional)
22
26
  ruby install.rb
23
27
 
24
- == Notes
25
- Windows users may pass a host name as a second argument to get process
26
- information from a different host. This relies on the WMI service running.
27
-
28
- If you're building C source code, the test.rb file is autogenerated for you.
29
-
30
- == BSD Issues
31
- If you're building on FreeBSD, a standard /proc filesystem read approach is
32
- used if mounted. Otherwise, a kvm interface is used. There are more fields
33
- available with the kvm interface, but keep in mind that you need to be a
34
- member of the kvm group (or root) to use this. You can tweak the
35
- extconf.rb file manually if you want to force the issue.
36
-
37
- Not all fields are available on FreeBSD 5.x (yet). OpenBSD and NetBSD are
38
- not yet supported.
39
-
40
- Research has indicated that the kvm approach is less favored than a sysctl
41
- approach. I will try to add this interface in the 0.8.0 release.
42
-
43
- == Solaris Issues
44
- The cmdline member on solaris is limited to 80 characters unless you (or
45
- your program) own the process. This is a Solaris design flaw, er, feature.
46
-
47
- == Other Issues
48
- If you build your library as a C extension (mandatory on all platforms
49
- except MS Windows at the moment), then the windows.rb file under 'lib/os/'
50
- is renamed to 'windows.orig'. This is to prevent mkmf from auto-installing
51
- it during the 'make site-install' phase.
52
-
53
- == Thread Safety
54
- I am not currently using a thread-safe version of readdir(). I am not especially
55
- concerned about it either. If you are trying to read information out of /proc
56
- from different threads at the same time there is something seriously wrong with
57
- your code logic. Using readdir_r() still won't solve all potential thread safety
58
- issues anyway.
59
-
60
- == Future Plans
61
- I think I'm going to replace the version for Linux with a pure Ruby version.
62
-
63
- == Help Wanted
64
- I do not have access to all platforms. There are a few other major platforms
65
- out there, namely OS X, AIX, OpenBSD, and IRIX, among others, that I would
66
- like to see ports for. There are two ways you can help - either submit code
67
- for your particular platform or give me an account on your platform so I can
68
- develop on it.
28
+ = Synopsis
29
+ require 'sys/proctable'
30
+ include Sys
31
+
32
+ # Everything
33
+ ProcTable.ps{ |p|
34
+ puts p.pid.to_s
35
+ puts p.comm
36
+ ...
37
+ }
38
+
39
+ or
40
+
41
+ # Just one process
42
+ s = ProcTable.ps(2123)
43
+ puts s.pid.to_s
44
+ puts s.comm
45
+ ...
46
+
47
+ # Return the results as an array of ProcTableStructs
48
+ a = ProcTable.ps
49
+ a.each do |p|
50
+ puts a.pid
51
+ ...
52
+ end
53
+
54
+ = Notes
55
+ Windows users may pass a host name as a second argument to get process
56
+ information from a different host. This relies on the WMI service running.
57
+
58
+ If you're building C source code, the ts_all.rb file is autogenerated for
59
+ you.
60
+
61
+ = Known Issues
62
+ === BSD
63
+ If you're building on FreeBSD, a standard /proc filesystem read approach is
64
+ used if mounted. Otherwise, a kvm interface is used. There are more fields
65
+ available with the kvm interface, but keep in mind that you need to be a
66
+ member of the kvm group (or root) to use this. You can tweak the
67
+ extconf.rb file manually if you want to force the issue.
68
+
69
+ Not all fields are available on FreeBSD 5.x (yet). OpenBSD and NetBSD are
70
+ not yet supported.
71
+
72
+ Research has indicated that the kvm approach is less favored than a sysctl
73
+ approach. I will try to add this interface in the 0.8.0 release.
74
+
75
+ === Solaris
76
+ The cmdline member on solaris is limited to 80 characters unless you (or
77
+ your program) own the process. This is a Solaris design flaw/feature.
78
+
79
+ === Misc
80
+ If you build your library as a C extension (mandatory on all platforms
81
+ except MS Windows at the moment), then the windows.rb file under 'lib/sys/'
82
+ is renamed to 'windows.orig'. This is to prevent mkmf from auto-installing
83
+ it during the 'make install' phase.
84
+
85
+ === Thread Safety
86
+ I am not currently using a thread-safe version of readdir(). I am not
87
+ especially concerned about it either. If you are trying to read information
88
+ out of /proc from different threads at the same time there is something
89
+ seriously wrong with your code logic. Using readdir_r() still won't solve
90
+ all potential thread safety issues anyway.
91
+
92
+ = Future Plans
93
+ I'm considering using a pure Ruby version for Linux.
94
+
95
+ = Acknowledgements
96
+ This package is largely based on the Perl module Proc::ProcessTable by
97
+ Dan Urist. Many ideas, as well as large chunks of code, were taken
98
+ from his work. So, a big THANK YOU goes out to Dan Urist.
99
+
100
+ A big thanks also goes out to Mike Hall who was very helpful with ideas,
101
+ logic and testing.
102
+
103
+ Thanks also go to Sean Chittenden for providing an account on one of his
104
+ FreeBSD machines. This is how the FreeBSD support was (initially) added.
105
+
106
+ Thanks go to James Hranicky for providing a patch that grabs name, eid,
107
+ euid, gid and guid info in the Linux version, along with some general
108
+ debugging help.
109
+
110
+ = Help Wanted
111
+ I do not have access to all platforms. There are a few other major platforms
112
+ out there, namely OS X, AIX, OpenBSD, and IRIX, among others, that I would
113
+ like to see ports for. There are two ways you can help - either submit code
114
+ for your particular platform or give me an account on your platform so I can
115
+ develop on it.
116
+
117
+ = More documentation
118
+ See the documentation under the 'doc' directory for your platform for more
119
+ information, including platform specific notes and issues.
120
+
121
+ = License
122
+ Ruby's
123
+
124
+ = Copyright
125
+ (C) 2003-2006 Daniel J. Berger
126
+ All Rights Reserved.
127
+
128
+ = Author
129
+ Daniel J. Berger
130
+ djberg96 at nospam at gmail dot com
131
+ imperator on IRC (Freenode)
@@ -1,10 +1,10 @@
1
- == Description
1
+ = Description
2
2
  sys-proctable
3
3
 
4
4
  A Ruby interface to the 'ps' command. This is a C extension, not parsed
5
5
  output. For FreeBSD, data is read directly out of the /proc filesystem.
6
6
 
7
- == Synopsis
7
+ = Synopsis
8
8
  require 'sys/proctable'
9
9
  include Sys
10
10
 
@@ -32,70 +32,59 @@
32
32
  ...
33
33
  end
34
34
 
35
- == Constants
35
+ = Constants
36
36
  VERSION
37
- Returns the current version number for this package (as a string).
37
+ Returns the current version number for this package (as a string).
38
38
 
39
- == Class Methods
39
+ = Class Methods
40
40
  ProcTable.fields
41
- Returns a list of fields available on the current OS. Also takes a block.
41
+ Returns a list of fields available on the current OS. Also takes a block.
42
42
 
43
43
  ProcTable.ps(pid = nil)
44
44
  ProcTable.ps{ |s| ... }
45
- If no pid's or processes are included as arguments, in block form it
46
- returns a struct of type ProcTableStruct for every process in the proc
47
- table. Otherwise it returns an array of ProcTableStruct's.
45
+ If no pid's or processes are included as arguments, in block form it
46
+ returns a struct of type ProcTableStruct for every process in the proc
47
+ table. Otherwise it returns an array of ProcTableStruct's.
48
48
 
49
- If a pid argument is provided, a single ProcTable struct is returned, or
50
- nil if the pid is not found.
49
+ If a pid argument is provided, a single ProcTable struct is returned, or
50
+ nil if the pid is not found.
51
51
 
52
- == Exception Classes
52
+ = Exception Classes
53
53
  ProcTableError < StandardError
54
- Raised if the /proc field is unreadable and/or unmounted.
54
+ Raised if the /proc field is unreadable and/or unmounted.
55
55
 
56
- == Supported fields
57
- You can view the supported fields with the "fields()" class method.
56
+ = Supported fields
57
+ You can view the supported fields with the "fields()" class method.
58
58
 
59
- == Future Plans
60
- Add a pure-ruby version as an alternative
61
- Add support for other *BSD flavors
62
- Add ttydev info
63
- Add a sysctl version
64
-
65
- == Known Bugs
66
- The kvm version for FreeBSD 5.x does not support all of the fields that
67
- the 4.x version supports.
59
+ = Future Plans
60
+ Add a pure-ruby version as an alternative
61
+ Add support for other *BSD flavors
62
+ Add ttydev info
63
+ Add a sysctl version
64
+
65
+ = Known Bugs
66
+ The kvm version for FreeBSD 5.x does not support all of the fields that
67
+ the 4.x version supports.
68
68
 
69
- If you find any other bugs please log them on the project
70
- page at http://www.rubyforge.org/projects/sysutils
69
+ If you find any other bugs please log them on the project
70
+ page at http://www.rubyforge.org/projects/sysutils
71
71
 
72
- == License
73
- Ruby's
72
+ = License
73
+ Ruby's
74
74
 
75
- == Copyright
76
- (C) 2003-2005 Daniel J. Berger
77
- All Rights Reserved
75
+ = Copyright
76
+ (C) 2003-2006 Daniel J. Berger
77
+ All Rights Reserved
78
78
 
79
- == Warranty
80
- This package is provided "as is" and without any express or
81
- implied warranties, including, without limitation, the implied
82
- warranties of merchantability and fitness for a particular purpose
83
-
84
- == Author
85
- Daniel J. Berger
86
- djberg96 at yahoo dot com
87
- imperator/rubyhacker1 on IRC (Freenode)
88
-
89
- == Credits
90
- This module is largely based on the Perl module Proc::ProcessTable by
91
- Dan Urist. Many ideas, as well as large chunks of code, were taken
92
- from his work. So, a big THANK YOU goes out to Dan Urist.
93
-
94
- A big thanks also goes out to Mike Hall who was very helpful with ideas,
95
- logic and testing.
96
-
97
- Thanks also go to Sean Chittenden for providing an account on one of his
98
- FreeBSD machines. This is how the FreeBSD support was (originally) added.
99
-
100
- == See Also
101
- ps, proc
79
+ = Warranty
80
+ This package is provided "as is" and without any express or
81
+ implied warranties, including, without limitation, the implied
82
+ warranties of merchantability and fitness for a particular purpose
83
+
84
+ = Author
85
+ Daniel J. Berger
86
+ djberg96 at nospam at gmail dot com
87
+ imperator on IRC (Freenode)
88
+
89
+ = See Also
90
+ ps, proc
@@ -1,10 +1,10 @@
1
- == Description
1
+ = Description
2
2
  sys-proctable
3
3
 
4
4
  A Ruby version of the 'ps' command. This is a C extension, not parsed
5
5
  output. For HP-UX, proc structs are grabbed via the pstat_getproc() call.
6
6
 
7
- == Synopsis
7
+ = Synopsis
8
8
  require 'sys/proctable'
9
9
  include Sys
10
10
 
@@ -24,67 +24,55 @@
24
24
  ...
25
25
  end
26
26
 
27
- == Constants
27
+ = Constants
28
28
  VERSION
29
- Returns the current version number for this package (as a string).
29
+ Returns the current version number for this package (as a string).
30
30
 
31
- == Class Methods
31
+ = Class Methods
32
32
  ProcTable.fields
33
- Returns a list of fields available on the current OS. May also take
34
- a block.
33
+ Returns a list of fields available on the current OS. May also take
34
+ a block.
35
35
 
36
36
  ProcTable.ps(pid=nil)
37
37
  ProcTable.ps{ |s| ... }
38
- Returns a struct of type ProcTableStruct for every process in the proc
39
- table in block form. Otherwise it returns an array of ProcTableStruct's.
38
+ Returns a struct of type ProcTableStruct for every process in the proc
39
+ table in block form. Otherwise it returns an array of ProcTableStruct's.
40
40
 
41
- If a pid is provided then a single ProcTable struct is returned, or nil
42
- if the pid is not found.
41
+ If a pid is provided then a single ProcTable struct is returned, or nil
42
+ if the pid is not found.
43
43
 
44
- == Supported fields
44
+ = Supported fields
45
+ You can view the supported fields with the "fields()" class method.
45
46
 
46
- You can view the supported fields with the "fields()" class method.
47
+ = Future Plans
48
+ Have the flags field return a meaningful value.
47
49
 
48
- == Future Plans
49
- Have the flags field return a meaningful value.
50
+ = Notes
51
+ The "comm" field isn't really part of the psinfo struct. It is just a copy
52
+ (i.e. is identical to) the "fname" field. I added it to provide a degree
53
+ of consistency between all of the platforms. I will also make a point
54
+ of adding it to any future platform releases.
50
55
 
51
- == Notes
52
- The "comm" field isn't really part of the psinfo struct. It is just a copy
53
- (i.e. is identical to) the "fname" field. I added it to provide a degree
54
- of consistency between all of the platforms. I will also make a point
55
- of adding it to any future platform releases.
56
+ = Known Bugs
57
+ None that I'm aware of. Please log any bugs on the project page at
58
+ http://www.rubyforge.org/projects/sysutils
56
59
 
57
- == Known Bugs
58
- None that I'm aware of. Please log any bugs on the project page at
59
- http://www.rubyforge.org/projects/sysutils
60
+ = License
61
+ Ruby's
60
62
 
61
- == License
62
- Ruby's
63
-
64
- == Copyright
65
- (C) 2003-2005 Daniel J. Berger
66
- All Rights Reserved.
63
+ = Copyright
64
+ (C) 2003-2006 Daniel J. Berger
65
+ All Rights Reserved.
67
66
 
68
- == Warranty
69
- This package is provided "as is" and without any express or
70
- implied warranties, including, without limitation, the implied
71
- warranties of merchantability and fitness for a particular purpose.
72
-
73
- == Author
74
- Daniel J. Berger
75
- djberg96 at yahoo dot com
76
- imperator/rubyhacker1 on IRC (Freenode)
77
-
78
- == Credits
79
- This module is largely based on the Perl module Proc::ProcessTable by
80
- Dan Urist. Many ideas, as well as large chunks of code, were taken
81
- from his work. So, a big THANK YOU goes out to Dan Urist.
82
-
83
- A big thanks also goes out to Mike Hall who was very helpful with ideas,
84
- logic and testing.
85
-
86
- Thanks also go to Sean Chittenden for providing an account on one of his
87
- FreeBSD machines. This is how the FreeBSD support was (initially) added.
88
-
89
- == See Also
90
- ps, proc
67
+ = Warranty
68
+ This package is provided "as is" and without any express or
69
+ implied warranties, including, without limitation, the implied
70
+ warranties of merchantability and fitness for a particular purpose.
71
+
72
+ = Author
73
+ Daniel J. Berger
74
+ djberg96 at nospam at gmail dot com
75
+ imperator on IRC (Freenode)
76
+
77
+ = See Also
78
+ ps, proc