sys-proctable 0.7.6-powerpc-darwin

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES ADDED
@@ -0,0 +1,233 @@
1
+ == 0.7.6 - 11-Jul-2007
2
+ * Fixed the starttime for Linux. Thanks go to Yaroslav Dmitriev for the spot.
3
+ * Fixed a bug in the MS Windows version within a private method that parsed
4
+ an MS specific date format. This was caused by a backwards incompatible
5
+ change in the Time.parse method in Ruby 1.8.6. See ruby-core: 11245 ff.
6
+ * Fixed the gemspec (I hope). Please let me know if you have problems.
7
+ * Added a Rakefile. Building, testing and installing should now be handled via
8
+ Rake tasks. The install.rb file has been removed - that code is now
9
+ integrated in the Rakefile.
10
+ * Minor directory layout changes and cleanup (mostly for the extconf.rb file).
11
+ * Side note - it seems that the code for OS X *does* work, at least on 10.4.10.
12
+ I can only conclude that previous reports about it failing were related to
13
+ bugs in OS X or were really just build issues. Apologies (and thanks, again)
14
+ to David Felstead for the code. However, see the README for more information
15
+ specific to OS X, as there are shortcomings.
16
+
17
+ == 0.7.5 - 23-Nov-2006
18
+ * Fixed int/long issues for Linux. Thanks go to Matt Lightner for the spot.
19
+ * Minor documentation fixes and changes to the extconf.rb file.
20
+
21
+ == 0.7.4 - 20-Nov-2006
22
+ * Added a patch that deals with the large file compilation issue on Solaris.
23
+ You no longer need to build Ruby with --disable-largefile, or build a
24
+ 64 bit Ruby, in order for this package to work. Thanks go to Steven Jenkins
25
+ for the information that led to the patch.
26
+ * Added inline rdoc to the source code.
27
+ * Added a gemspec.
28
+ * Fixed some potential 64 bit issues (struct declarations).
29
+ * Added preliminary support for Darwin (OS X). The code was provided by
30
+ David Felstead, but does not appear to compile successfully. Help wanted.
31
+
32
+ == 0.7.3 - 27-Oct-2005
33
+ * Fix for 1.8.3 and later (rb_pid_t). This should have only affected
34
+ Solaris.
35
+
36
+ == 0.7.2 - 15-May-2005
37
+ * Bug fix for the FreeBSD version that reads from /proc.
38
+ * Eliminated the test bug on Linux (inexplicably caused by File.copy). The
39
+ test suite should now run without segfaulting.
40
+ * Include bsd.c in tarball (oops).
41
+ * Minor test updates for FreeBSD.
42
+ * The 'pct_cpu' member for the BSD/kvm version has been changed to 'pctcpu'
43
+ for consistency with other platforms.
44
+
45
+ == 0.7.1 - 8-May-2005
46
+ * Bug fixed for the cmdline info on Linux. Thanks go to Arash Abedinzadeh
47
+ for the spot.
48
+ * Added an example program.
49
+ * Minor setup fix for Win32 in tc_all.rb.
50
+
51
+ == 0.7.0 - 25-Apr-2005
52
+ * Scrapped the C implementation for Windows in favor of an OLE + WMI pure Ruby
53
+ approach. See documentation for details.
54
+ * Added an optional lkvm implementation for BSD users. This is automatically
55
+ used if the /proc filesystem isn't found.
56
+ * Added prusage info for the Solaris version.
57
+ * Added name, eid, euid, gid and guid information for Linux. Thanks go to
58
+ James Hranicky for the patch.
59
+ * Fixed some potential bugs in the Linux version. Thanks go to James
60
+ Hranicky for the spot.
61
+ * Added the 'sys/top' package.
62
+ * ProcTable.fields no longer supports a block form.
63
+ * The BTIME (boot time) information has been removed from the Linux version.
64
+ If you want that information, use sys-uptime instead.
65
+ * The .html and .rd files have been removed. You can generate html on your
66
+ own with rdoc if you like.
67
+ * Some code cleanup on the C side of the house.
68
+ * Most documents made rdoc friendly.
69
+ * Renamed 'install_pure_ruby.rb' to just 'install.rb'.
70
+ * Removed the 'INSTALL' file. Installation instructions are in the README.
71
+ * Some test suite cleanup and reorganization.
72
+ * Moved project to RubyForge.
73
+
74
+ == 0.6.4 - 31-Mar-2004
75
+ * Fixed a bug in the pure Ruby version for Win32. Thanks go to Mark Hudson
76
+ for the spot.
77
+ * Fixed a bug in the C implementation for Win32 where the cmdline and path
78
+ values were sometimes wrong for running processes. Thanks go to Park Heesob
79
+ for the fix.
80
+ * Updated the VERSION constant and removed the VERSION class method in the
81
+ pure Ruby version for Win32.
82
+ * Updated install_pure_ruby.rb and test.rb scripts.
83
+ * Updated warranty information.
84
+ * The extconf.rb script has been revamped. See the INSTALL and README files
85
+ for important changes since the last release.
86
+ * The start ProcInfo struct member on Solaris, HP-UX and FreeBSD is now a
87
+ Time object, not a Fixnum/Bignum.
88
+ * Modified linux.c yet again to make gcc happy when it comes to multi-line
89
+ string literals.
90
+ * Minor change to way process state is handled on HP-UX.
91
+ * Documentation additions and updates, including warranty information.
92
+
93
+ == 0.6.3 - 24-Feb-2004
94
+ * Fixed a bug in the Solaris version where the cmd_args array did not
95
+ necessarily contain data on 2.7 and later. The current patch still
96
+ does not quite fix the problem for 2.6 and earlier but can be easily
97
+ derived manually by parsing the cmdline string.
98
+
99
+ == 0.6.2 - 20-Jan-2004
100
+ * Fixed a small memory leak in the solaris version.
101
+
102
+ == 0.6.1 - 31-Dec-2003
103
+ * Fixed a minor bug in the cmdline field on Linux where a blank character
104
+ was being appended to the end of the field.
105
+ * Fixed a minor annoyance where the windows.rb file was being copied into
106
+ the Ruby lib directory on install.
107
+ * Added a test_memleak.rb file. Currently only supported on Linux and
108
+ only does a file descriptor count check. I plan to expand this to
109
+ other platforms in the future.
110
+ * Minor test suite changes
111
+ * MANIFEST correction and update.
112
+
113
+ == 0.6.0 - 22-Oct-2003
114
+ * Significant API change (and thus, a version jump) - only a
115
+ single argument is now accepted to the ps() method, and only a PID
116
+ (Fixnum) is regarded as a valid argument.
117
+ * Calling ps() with a pid returns a single ProcTable struct (or nil
118
+ if the pid is not found), instead of a one element array.
119
+ * Argument to ps() now works properly on HP-UX and Win32.
120
+ * Removed the '#include <sys/types32.h>' in sunos.h. It wasn't needed
121
+ and you're not supposed to include it directly.
122
+ * Fixed 2.6 compatibility issue with regards to cmdline on Solaris.
123
+ * Removed the ProcStatException completely on Linux. There was no reason
124
+ to fail on a directory read for /proc/xxx/stat. If the read fails
125
+ (meaning the process died in the middle of collecting info for it), it
126
+ is simply ignored.
127
+ * The ttynum bug on HPUX has been fixed. In addition, the return value for
128
+ this field is now a string rather than an int and the field name has
129
+ been changed to "ttydev".
130
+ * The ttynum field has been changed to ttydev on Solaris and HPUX. On
131
+ Solaris, the ttydev is now reported as -1 if there is no associated tty.
132
+ In a future release, Solaris and the other *nix platforms will be changed
133
+ so that ttydev is always a device name (i.e String).
134
+ * Added plain text documentation for all platforms.
135
+ * Some test suite cleanup.
136
+ * Changed .rd2 extension to just '.rd'.
137
+
138
+ == 0.5.2 - 18-Jul-2003
139
+ * Modified cmdline to extend past the traditional 80 character limit on
140
+ Solaris, where possible (Solaris 2.6+ only).
141
+ * Added the cmdline_args and num_args fields on Solaris, which returns
142
+ an array of cmdline arguments and the number of cmdline arguments,
143
+ respectively.
144
+ * Minor modification to fields() method, in addition to warning cleanup
145
+ for Solaris.
146
+ * Changed "defunct" state string to "zombie" for Solaris.
147
+ * Should cleanly compile with -Wall -W now (gcc) on Solaris.
148
+ * Added solaris.txt to doc directory.
149
+ * MANIFEST corrections.
150
+
151
+ == 0.5.1 - 16-Jul-2003
152
+ * Fixed a nasty file descriptor bug in the Linux code, where file descriptors
153
+ were continuously being used up.
154
+ * Added the BTIME (boot time) constant for Linux.
155
+ * Fixed up the test/test.rb file a bit.
156
+ * Added BTIME tests to tc_linux.rb.
157
+
158
+ == 0.5.0 - 11-Jul-200
159
+ * Added HP-UX support!
160
+ * Note that passing PID's or strings as arguments to ps() is not supported
161
+ in the HP-UX version. This functionality will be stripped out of the
162
+ other versions in a future release. See the README file for more details.
163
+ * Removed the VERSION() class method. Use the constant instead.
164
+ * Separated the rd docs from their respective source files. Now in the doc
165
+ directory.
166
+ * Got rid of the interactive html generation in extconf.rb.
167
+ * Changed License to Artistic.
168
+
169
+ == 0.4.3 - 30-May-2003
170
+ * Added a version.h file to store the version number. Modified all of the
171
+ C source files to use that instead of hard coding the version everywhere.
172
+ * Added a generic test.rb script for those without TestUnit installed, or
173
+ just futzing in general. Modified the extconf.rb script to copy this
174
+ instead of writing an inline HERE document.
175
+ * Modified extconf.rb so that it builds with mingw or cygwin. Thanks go to
176
+ Peter Fischer for the spot and patch.
177
+ * Modified test suite to work with TestUnit 0.1.6 or 0.1.8.
178
+
179
+ == 0.4.2 - 14-Apr-2003
180
+ * Added pure Ruby version for Win32 - thanks Park Heesob.
181
+ * Modified extconf.rb file to handle pure Ruby versions.
182
+ * Added install_pure_ruby.rb file, an alternate installation
183
+ script for pure Ruby versions.
184
+
185
+ == 0.4.1 - 31-Mar-2003
186
+ * Added support for Solaris 2.5.x.
187
+ * All exceptions are now a direct subclass of StandardError.
188
+ * Value returned for wchan now more meaningful (2.5.x only for now).
189
+ * Fixed the start, utime and ctime for FreeBSD.
190
+ * Minor fix to FreeBSD test suite.
191
+ * Some changes to extconf.rb.
192
+ * Minor doc changes.
193
+ * Added License and Copyright info.
194
+
195
+ == 0.4.0 - 10-Mar-2003
196
+ * Added MS Windows support (non-cygwin).
197
+ * Added environment information for Linux version.
198
+ * Added real exceptions (type depends on platform).
199
+ * Added a test suite (for those with testunit installed).
200
+ * Removed the sys-uname requirement.
201
+ * Heavily modified the extconf.rb script.
202
+ * Changed "Changelog" to "CHANGES" and "Manifest" to "MANIFEST".
203
+ * Added a VERSION constant and class method.
204
+ * Minor internal directory layout change (put 'os' under 'lib').
205
+ * Changed package name to lower case.
206
+ * Doc changes, including license information.
207
+
208
+ == 0.3.1 - 16-Aug-2002
209
+ * Added a "comm" field to the sunos version. I am going to try to make this a
210
+ common field for all platforms to help reduce RUBY_PLATFORM checking.
211
+ * Fixed the release date for 0.3.0 (was accidentally marked *July*).
212
+ * Added an INSTALL file.
213
+ * Minor documentation change to the sunos.c source file.
214
+
215
+ == 0.3.0 - 11-Aug-2002
216
+ * Added FreeBSD support!
217
+ * Struct name changed to just "ProcTableStruct" to be compliant with future
218
+ versions of Ruby.
219
+ * The ps() function now returns an array of ProcTableStruct's in lvalue context.
220
+ * Fixed the ability to search by process name in Linux.
221
+ * Modified Linux "comm" field to strip parenthesis.
222
+ * Some doc changes/additions.
223
+ * Added Sean Chittenden to the "Acknowledgements" section. Sean provided me
224
+ with access to a FreeBSD box, which is how I was able to provide FreeBSD
225
+ support. Thanks Sean!
226
+
227
+ == 0.2.0 - 19-Jul-2002
228
+ * Added the ability to search by process name.
229
+ * test.rb modified to be cross-platform.
230
+ * Solaris - fixed bug with fname (was accidentally called "name").
231
+
232
+ == 0.1.0 - 2-Jul-2002
233
+ - Initial release.
data/MANIFEST ADDED
@@ -0,0 +1,41 @@
1
+ CHANGES
2
+ INSTALL
3
+ MANIFEST
4
+ Rakefile
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 ADDED
@@ -0,0 +1,140 @@
1
+ = Description
2
+ A Ruby interface for gathering process information.
3
+
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
11
+ * Windows NT family (NT, 2000, XP, etc)
12
+ * Linux
13
+ * FreeBSD (/proc or kvm)
14
+ * Solaris
15
+ * HP-UX
16
+ * OS X
17
+
18
+ = Installation
19
+ * rake test (optional)
20
+ * rake install
21
+
22
+ = Synopsis
23
+ require 'sys/proctable'
24
+ include Sys
25
+
26
+ # Everything
27
+ ProcTable.ps{ |p|
28
+ puts p.pid.to_s
29
+ puts p.comm
30
+ ...
31
+ }
32
+
33
+ or
34
+
35
+ # Just one process
36
+ s = ProcTable.ps(2123)
37
+ puts s.pid.to_s
38
+ puts s.comm
39
+ ...
40
+
41
+ # Return the results as an array of ProcTableStructs
42
+ a = ProcTable.ps
43
+ a.each do |p|
44
+ puts a.pid
45
+ ...
46
+ end
47
+
48
+ = Notes
49
+ Windows users may pass a host name as a second argument to get process
50
+ information from a different host. This relies on the WMI service running.
51
+
52
+ If you're building C source code, the ts_all.rb file is autogenerated for
53
+ you.
54
+
55
+ = Known Issues
56
+ === BSD
57
+ If you're building on FreeBSD, a standard /proc filesystem read approach is
58
+ used if mounted. Otherwise, a kvm interface is used. There are more fields
59
+ available with the kvm interface, but keep in mind that you need to be a
60
+ member of the kvm group (or root) to use this. You can tweak the extconf.rb
61
+ file manually if you want to force the issue.
62
+
63
+ Not all fields are available on FreeBSD 5.x (yet). OpenBSD and NetBSD are
64
+ not yet supported.
65
+
66
+ === Solaris
67
+ The cmdline member on solaris is limited to 80 characters unless you (or
68
+ your program) own the process. This is a Solaris design flaw/feature.
69
+
70
+ === OS X
71
+ At the moment you do not get the full command line string. The code required
72
+ to get this information is obnoxious and I don't have any compelling desire
73
+ to add it. However, if you're willing to submit a patch I'll accept it.
74
+
75
+ You can find a good starting point with the OS X code found in Dan Urist's
76
+ Proc::ProcessTable module. You can find that module on CPAN. Point your
77
+ browser at http://search.cpan.org.
78
+
79
+ === Misc
80
+ If you build your library as a C extension (which is what will happen if
81
+ you run the 'build', 'test', or 'install' Rake tasks), then the windows.rb
82
+ file under 'lib/sys/' is renamed to 'windows.orig'. This is necessary to
83
+ prevent mkmf from auto-installing it during the 'make install' phase.
84
+
85
+ The 'clean' Rake task will rename it back to 'windows.rb'.
86
+
87
+ === Thread Safety
88
+ I am not currently using a thread-safe version of readdir(). I am not
89
+ especially concerned about it either. If you are trying to read information
90
+ out of /proc from different threads at the same time there is something
91
+ seriously wrong with your code logic. Using readdir_r() still won't solve
92
+ all potential thread safety issues anyway.
93
+
94
+ = Future Plans
95
+ I'm considering using a pure Ruby version for Linux.
96
+
97
+ Research has indicated that the kvm approach is less favored than a sysctl
98
+ approach on BSD variants. I will try to add this interface in the 0.8.0
99
+ release.
100
+
101
+ = Acknowledgements
102
+ This package is largely based on the Perl module Proc::ProcessTable by
103
+ Dan Urist. Many ideas, as well as large chunks of code, were taken
104
+ from his work. So, a big THANK YOU goes out to Dan Urist.
105
+
106
+ A big thanks also goes out to Mike Hall who was very helpful with ideas,
107
+ logic and testing.
108
+
109
+ Thanks also go to Sean Chittenden for providing an account on one of his
110
+ FreeBSD machines. This is how the FreeBSD support was (initially) added.
111
+
112
+ Thanks go to James Hranicky for providing a patch that grabs name, eid,
113
+ euid, gid and guid info in the Linux version, along with some general
114
+ debugging help.
115
+
116
+ Finally I'd like to thank all the folks who have submitted bug reports
117
+ and/or patches.
118
+
119
+ = Help Wanted
120
+ I do not have access to all platforms. There are a few other major platforms
121
+ out there, namely AIX, OpenBSD, and IRIX, among others, that I would
122
+ like to see ports for. There are two ways you can help - either submit code
123
+ for your particular platform or give me an account on your platform so I can
124
+ develop on it.
125
+
126
+ = More documentation
127
+ See the documentation under the 'doc' directory for your platform for more
128
+ information, including platform specific notes and issues.
129
+
130
+ = License
131
+ Ruby's
132
+
133
+ = Copyright
134
+ (C) 2003-2007 Daniel J. Berger
135
+ All Rights Reserved.
136
+
137
+ = Author
138
+ Daniel J. Berger
139
+ djberg96 at nospam at gmail dot com
140
+ imperator on IRC (Freenode)
data/doc/freebsd.txt ADDED
@@ -0,0 +1,90 @@
1
+ = Description
2
+ sys-proctable
3
+
4
+ A Ruby interface to the 'ps' command. This is a C extension, not parsed
5
+ output. For FreeBSD, data is read directly out of the /proc filesystem.
6
+
7
+ = Synopsis
8
+ require 'sys/proctable'
9
+ include Sys
10
+
11
+ # Everything
12
+ ProcTable.ps{ |p|
13
+ puts p.pid.to_s
14
+ puts p.comm
15
+ ...
16
+ }
17
+
18
+ or
19
+
20
+ # Just one process
21
+ p = ProcTable.ps(2123)
22
+ puts p.pid.to_s
23
+ puts p.comm
24
+ ...
25
+
26
+ or
27
+
28
+ # Return the results as an array of ProcTableStructs
29
+ a = ProcTable.ps()
30
+ a.each do |p|
31
+ puts a.pid
32
+ ...
33
+ end
34
+
35
+ = Constants
36
+ VERSION
37
+ Returns the current version number for this package (as a string).
38
+
39
+ = Class Methods
40
+ ProcTable.fields
41
+ Returns an array of fields available on the current OS.
42
+
43
+ ProcTable.ps(pid = nil)
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.
48
+
49
+ If a pid argument is provided, a single ProcTable struct is returned, or
50
+ nil if the pid is not found.
51
+
52
+ = Exception Classes
53
+ ProcTableError < StandardError
54
+ Raised if the /proc field is unreadable and/or unmounted.
55
+
56
+ = Supported fields
57
+ You can view the supported fields with the "fields()" class method.
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.
68
+
69
+ If you find any other bugs please log them on the project
70
+ page at http://www.rubyforge.org/projects/sysutils
71
+
72
+ = License
73
+ Ruby's
74
+
75
+ = Copyright
76
+ (C) 2003-2006 Daniel J. Berger
77
+ All Rights Reserved
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 nospam at gmail dot com
87
+ imperator on IRC (Freenode)
88
+
89
+ = See Also
90
+ ps, proc