sys-proctable 0.9.1-universal-solaris

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES ADDED
@@ -0,0 +1,302 @@
1
+ == 0.9.1 - 3-Aug-2011
2
+ * Added the pctcpu and pctmem members for Linux.
3
+ * Added Errno::ESRCH to a rescue clause on Linux that fixed a bug
4
+ where a missing entry wasn't being skipped when run as root. Thanks
5
+ go to Austin Ziegler for the spot and patch.
6
+ * Fixed a build warning for Darwin.
7
+ * Updates to the test suite for both Darwin and Linux.
8
+ * Added an explicit type check for BSD for pids.
9
+ * Added nicer error messages for BSD if kvm_open fails.
10
+ * Added .core files to the clean task.
11
+ * Altered the platform settings in the Rakefile so that generated gems
12
+ use 'universal' platform architectures for any particular operating system.
13
+
14
+ == 0.9.0 - 14-Oct-2009
15
+ * Changed the license to Artistic 2.0.
16
+ * Fixed a bug in the OS X code where a segfault would occur when an attempt
17
+ was made to gather resource usage information on zombie processes. From
18
+ now on that information is always set to nil for zombie processes. Thanks
19
+ go to Tom Lianza for the spot and Philip Kromer for investigating the
20
+ root cause of the failure.
21
+ * Removed the FreeBSD code that read out of /proc. It was a pain from a
22
+ maintenance point of view, and most FreeBSD installs do not mount /proc
23
+ by default. The FreeBSD platform now uses the same code that the other
24
+ BSD platforms use.
25
+ * Fixed a bug in the BSD code where the ProcTable::Error class had the
26
+ wrong parent class.
27
+ * Some major gemspec updates, including an updated license. The platform
28
+ handling logic is now in the Rakefile in the 'gem' task.
29
+ * Updated the README file to include an additional acknowledgement, a
30
+ license change and some minor formatting changes.
31
+ * The test-unit library was changed from a runtime to a development dependency.
32
+
33
+ == 0.8.1 - 6-Apr-2009
34
+ * The Linux and Solaris libraries now handle the possibility of a process
35
+ terminating in the middle of a read more gracefully. If that happens, they
36
+ merely skip to the next record, i.e. it's all or nothing. Thanks go to
37
+ Heejong Lee for the spot and patch.
38
+ * Fixed a bug in the Linux version where embedded nulls were not being
39
+ stripped out of the cmdline data.
40
+ * Added the comm alias back to the Solaris version. Thanks go to Jun Young Kim
41
+ for the spot.
42
+
43
+ == 0.8.0 - 26-Jan-2009
44
+ * The Linux and Solaris versions of this library are now pure Ruby. Be warned,
45
+ however, that only Solaris 8 and later are now supported. This may change
46
+ in a future release if there's demand to support 2.6 and 2.7.
47
+ * Some Struct::ProcTableStruct members have changed. As a general rule they
48
+ now more closely match the C struct member name. See individual platforms
49
+ for more details.
50
+ * Bug fix for the cmd_args struct member on Solaris.
51
+ * Bug fixes for OS X. Added a VERSION constant, fixed struct name, and changed
52
+ pct_cpu to pctcpu.
53
+ * The .new method is now explicitly illegal.
54
+ * The Struct::ProcTableStruct instances are now frozen. This is read-only data.
55
+ * Added the peak_page_file_usage and status members on MS Windows. The status
56
+ member is always nil, but was added for completeness.
57
+ * Fixed the quota_peak_paged_pool_usage member on MS Windows.
58
+ * ProcTableError is now ProcTable::Error.
59
+ * Minor test case fix for kvm/bsd based versions.
60
+ * Added the 'time' library as a require for Windows (to parse MS date/time
61
+ format strings).
62
+ * The kvm (bsd.c) implementation now works for FreeBSD 7.
63
+ * Added many more tests.
64
+ * Added some benchmarking code in the 'benchmarks' directory.
65
+ * Added a 'bench' Rake task.
66
+ * Renamed the test_ps.rb file to example_ps.rb in order to avoid any possible
67
+ confusion with actual test files.
68
+ * Added an 'example' rake task to run the example file.
69
+
70
+ == 0.7.6 - 11-Jul-2007
71
+ * Fixed the starttime for Linux. Thanks go to Yaroslav Dmitriev for the spot.
72
+ * Fixed a bug in the MS Windows version within a private method that parsed
73
+ an MS specific date format. This was caused by a backwards incompatible
74
+ change in the Time.parse method in Ruby 1.8.6. See ruby-core: 11245 ff.
75
+ * Fixed the gemspec (I hope). Please let me know if you have problems.
76
+ * Added a Rakefile. Building, testing and installing should now be handled via
77
+ Rake tasks. The install.rb file has been removed - that code is now
78
+ integrated in the Rakefile.
79
+ * Minor directory layout changes and cleanup (mostly for the extconf.rb file).
80
+ * Side note - it seems that the code for OS X *does* work, at least on 10.4.10.
81
+ I can only conclude that previous reports about it failing were related to
82
+ bugs in OS X or were really just build issues. Apologies (and thanks, again)
83
+ to David Felstead for the code. However, see the README for more information
84
+ specific to OS X, as there are shortcomings.
85
+
86
+ == 0.7.5 - 23-Nov-2006
87
+ * Fixed int/long issues for Linux. Thanks go to Matt Lightner for the spot.
88
+ * Minor documentation fixes and changes to the extconf.rb file.
89
+
90
+ == 0.7.4 - 20-Nov-2006
91
+ * Added a patch that deals with the large file compilation issue on Solaris.
92
+ You no longer need to build Ruby with --disable-largefile, or build a
93
+ 64 bit Ruby, in order for this package to work. Thanks go to Steven Jenkins
94
+ for the information that led to the patch.
95
+ * Added inline rdoc to the source code.
96
+ * Added a gemspec.
97
+ * Fixed some potential 64 bit issues (struct declarations).
98
+ * Added preliminary support for Darwin (OS X). The code was provided by
99
+ David Felstead, but does not appear to compile successfully. Help wanted.
100
+
101
+ == 0.7.3 - 27-Oct-2005
102
+ * Fix for 1.8.3 and later (rb_pid_t). This should have only affected
103
+ Solaris.
104
+
105
+ == 0.7.2 - 15-May-2005
106
+ * Bug fix for the FreeBSD version that reads from /proc.
107
+ * Eliminated the test bug on Linux (inexplicably caused by File.copy). The
108
+ test suite should now run without segfaulting.
109
+ * Include bsd.c in tarball (oops).
110
+ * Minor test updates for FreeBSD.
111
+ * The 'pct_cpu' member for the BSD/kvm version has been changed to 'pctcpu'
112
+ for consistency with other platforms.
113
+
114
+ == 0.7.1 - 8-May-2005
115
+ * Bug fixed for the cmdline info on Linux. Thanks go to Arash Abedinzadeh
116
+ for the spot.
117
+ * Added an example program.
118
+ * Minor setup fix for Win32 in tc_all.rb.
119
+
120
+ == 0.7.0 - 25-Apr-2005
121
+ * Scrapped the C implementation for Windows in favor of an OLE + WMI pure Ruby
122
+ approach. See documentation for details.
123
+ * Added an optional lkvm implementation for BSD users. This is automatically
124
+ used if the /proc filesystem isn't found.
125
+ * Added prusage info for the Solaris version.
126
+ * Added name, eid, euid, gid and guid information for Linux. Thanks go to
127
+ James Hranicky for the patch.
128
+ * Fixed some potential bugs in the Linux version. Thanks go to James
129
+ Hranicky for the spot.
130
+ * Added the 'sys/top' package.
131
+ * ProcTable.fields no longer supports a block form.
132
+ * The BTIME (boot time) information has been removed from the Linux version.
133
+ If you want that information, use sys-uptime instead.
134
+ * The .html and .rd files have been removed. You can generate html on your
135
+ own with rdoc if you like.
136
+ * Some code cleanup on the C side of the house.
137
+ * Most documents made rdoc friendly.
138
+ * Renamed 'install_pure_ruby.rb' to just 'install.rb'.
139
+ * Removed the 'INSTALL' file. Installation instructions are in the README.
140
+ * Some test suite cleanup and reorganization.
141
+ * Moved project to RubyForge.
142
+
143
+ == 0.6.4 - 31-Mar-2004
144
+ * Fixed a bug in the pure Ruby version for Win32. Thanks go to Mark Hudson
145
+ for the spot.
146
+ * Fixed a bug in the C implementation for Win32 where the cmdline and path
147
+ values were sometimes wrong for running processes. Thanks go to Park Heesob
148
+ for the fix.
149
+ * Updated the VERSION constant and removed the VERSION class method in the
150
+ pure Ruby version for Win32.
151
+ * Updated install_pure_ruby.rb and test.rb scripts.
152
+ * Updated warranty information.
153
+ * The extconf.rb script has been revamped. See the INSTALL and README files
154
+ for important changes since the last release.
155
+ * The start ProcInfo struct member on Solaris, HP-UX and FreeBSD is now a
156
+ Time object, not a Fixnum/Bignum.
157
+ * Modified linux.c yet again to make gcc happy when it comes to multi-line
158
+ string literals.
159
+ * Minor change to way process state is handled on HP-UX.
160
+ * Documentation additions and updates, including warranty information.
161
+
162
+ == 0.6.3 - 24-Feb-2004
163
+ * Fixed a bug in the Solaris version where the cmd_args array did not
164
+ necessarily contain data on 2.7 and later. The current patch still
165
+ does not quite fix the problem for 2.6 and earlier but can be easily
166
+ derived manually by parsing the cmdline string.
167
+
168
+ == 0.6.2 - 20-Jan-2004
169
+ * Fixed a small memory leak in the solaris version.
170
+
171
+ == 0.6.1 - 31-Dec-2003
172
+ * Fixed a minor bug in the cmdline field on Linux where a blank character
173
+ was being appended to the end of the field.
174
+ * Fixed a minor annoyance where the windows.rb file was being copied into
175
+ the Ruby lib directory on install.
176
+ * Added a test_memleak.rb file. Currently only supported on Linux and
177
+ only does a file descriptor count check. I plan to expand this to
178
+ other platforms in the future.
179
+ * Minor test suite changes
180
+ * MANIFEST correction and update.
181
+
182
+ == 0.6.0 - 22-Oct-2003
183
+ * Significant API change (and thus, a version jump) - only a
184
+ single argument is now accepted to the ps() method, and only a PID
185
+ (Fixnum) is regarded as a valid argument.
186
+ * Calling ps() with a pid returns a single ProcTable struct (or nil
187
+ if the pid is not found), instead of a one element array.
188
+ * Argument to ps() now works properly on HP-UX and Win32.
189
+ * Removed the '#include <sys/types32.h>' in sunos.h. It wasn't needed
190
+ and you're not supposed to include it directly.
191
+ * Fixed 2.6 compatibility issue with regards to cmdline on Solaris.
192
+ * Removed the ProcStatException completely on Linux. There was no reason
193
+ to fail on a directory read for /proc/xxx/stat. If the read fails
194
+ (meaning the process died in the middle of collecting info for it), it
195
+ is simply ignored.
196
+ * The ttynum bug on HPUX has been fixed. In addition, the return value for
197
+ this field is now a string rather than an int and the field name has
198
+ been changed to "ttydev".
199
+ * The ttynum field has been changed to ttydev on Solaris and HPUX. On
200
+ Solaris, the ttydev is now reported as -1 if there is no associated tty.
201
+ In a future release, Solaris and the other *nix platforms will be changed
202
+ so that ttydev is always a device name (i.e String).
203
+ * Added plain text documentation for all platforms.
204
+ * Some test suite cleanup.
205
+ * Changed .rd2 extension to just '.rd'.
206
+
207
+ == 0.5.2 - 18-Jul-2003
208
+ * Modified cmdline to extend past the traditional 80 character limit on
209
+ Solaris, where possible (Solaris 2.6+ only).
210
+ * Added the cmdline_args and num_args fields on Solaris, which returns
211
+ an array of cmdline arguments and the number of cmdline arguments,
212
+ respectively.
213
+ * Minor modification to fields() method, in addition to warning cleanup
214
+ for Solaris.
215
+ * Changed "defunct" state string to "zombie" for Solaris.
216
+ * Should cleanly compile with -Wall -W now (gcc) on Solaris.
217
+ * Added solaris.txt to doc directory.
218
+ * MANIFEST corrections.
219
+
220
+ == 0.5.1 - 16-Jul-2003
221
+ * Fixed a nasty file descriptor bug in the Linux code, where file descriptors
222
+ were continuously being used up.
223
+ * Added the BTIME (boot time) constant for Linux.
224
+ * Fixed up the test/test.rb file a bit.
225
+ * Added BTIME tests to tc_linux.rb.
226
+
227
+ == 0.5.0 - 11-Jul-200
228
+ * Added HP-UX support!
229
+ * Note that passing PID's or strings as arguments to ps() is not supported
230
+ in the HP-UX version. This functionality will be stripped out of the
231
+ other versions in a future release. See the README file for more details.
232
+ * Removed the VERSION() class method. Use the constant instead.
233
+ * Separated the rd docs from their respective source files. Now in the doc
234
+ directory.
235
+ * Got rid of the interactive html generation in extconf.rb.
236
+ * Changed License to Artistic.
237
+
238
+ == 0.4.3 - 30-May-2003
239
+ * Added a version.h file to store the version number. Modified all of the
240
+ C source files to use that instead of hard coding the version everywhere.
241
+ * Added a generic test.rb script for those without TestUnit installed, or
242
+ just futzing in general. Modified the extconf.rb script to copy this
243
+ instead of writing an inline HERE document.
244
+ * Modified extconf.rb so that it builds with mingw or cygwin. Thanks go to
245
+ Peter Fischer for the spot and patch.
246
+ * Modified test suite to work with TestUnit 0.1.6 or 0.1.8.
247
+
248
+ == 0.4.2 - 14-Apr-2003
249
+ * Added pure Ruby version for Win32 - thanks Park Heesob.
250
+ * Modified extconf.rb file to handle pure Ruby versions.
251
+ * Added install_pure_ruby.rb file, an alternate installation
252
+ script for pure Ruby versions.
253
+
254
+ == 0.4.1 - 31-Mar-2003
255
+ * Added support for Solaris 2.5.x.
256
+ * All exceptions are now a direct subclass of StandardError.
257
+ * Value returned for wchan now more meaningful (2.5.x only for now).
258
+ * Fixed the start, utime and ctime for FreeBSD.
259
+ * Minor fix to FreeBSD test suite.
260
+ * Some changes to extconf.rb.
261
+ * Minor doc changes.
262
+ * Added License and Copyright info.
263
+
264
+ == 0.4.0 - 10-Mar-2003
265
+ * Added MS Windows support (non-cygwin).
266
+ * Added environment information for Linux version.
267
+ * Added real exceptions (type depends on platform).
268
+ * Added a test suite (for those with testunit installed).
269
+ * Removed the sys-uname requirement.
270
+ * Heavily modified the extconf.rb script.
271
+ * Changed "Changelog" to "CHANGES" and "Manifest" to "MANIFEST".
272
+ * Added a VERSION constant and class method.
273
+ * Minor internal directory layout change (put 'os' under 'lib').
274
+ * Changed package name to lower case.
275
+ * Doc changes, including license information.
276
+
277
+ == 0.3.1 - 16-Aug-2002
278
+ * Added a "comm" field to the sunos version. I am going to try to make this a
279
+ common field for all platforms to help reduce RUBY_PLATFORM checking.
280
+ * Fixed the release date for 0.3.0 (was accidentally marked *July*).
281
+ * Added an INSTALL file.
282
+ * Minor documentation change to the sunos.c source file.
283
+
284
+ == 0.3.0 - 11-Aug-2002
285
+ * Added FreeBSD support!
286
+ * Struct name changed to just "ProcTableStruct" to be compliant with future
287
+ versions of Ruby.
288
+ * The ps() function now returns an array of ProcTableStruct's in lvalue context.
289
+ * Fixed the ability to search by process name in Linux.
290
+ * Modified Linux "comm" field to strip parenthesis.
291
+ * Some doc changes/additions.
292
+ * Added Sean Chittenden to the "Acknowledgements" section. Sean provided me
293
+ with access to a FreeBSD box, which is how I was able to provide FreeBSD
294
+ support. Thanks Sean!
295
+
296
+ == 0.2.0 - 19-Jul-2002
297
+ * Added the ability to search by process name.
298
+ * test.rb modified to be cross-platform.
299
+ * Solaris - fixed bug with fname (was accidentally called "name").
300
+
301
+ == 0.1.0 - 2-Jul-2002
302
+ - Initial release.
data/MANIFEST ADDED
@@ -0,0 +1,30 @@
1
+ * CHANGES
2
+ * MANIFEST
3
+ * Rakefile
4
+ * README
5
+ * sys-proctable.gemspec
6
+ * doc/bsd.txt
7
+ * doc/hpux.txt
8
+ * doc/linux.txt
9
+ * doc/solaris.txt
10
+ * doc/top.txt
11
+ * doc/windows.txt
12
+ * example/example_ps.rb
13
+ * ext/bsd/extconf.rb
14
+ * ext/bsd/sys/proctable.c
15
+ * ext/darwin/extconf.rb
16
+ * ext/darwin/sys/proctable.c
17
+ * ext/hpux/extconf.rb
18
+ * ext/hpux/sys/proctable.c
19
+ * lib/sys/top.rb
20
+ * lib/linux/sys/proctable.rb
21
+ * lib/sunos/sys/proctable.rb
22
+ * lib/windows/sys/proctable.rb
23
+ * test/test_sys_proctable_all.rb
24
+ * test/test_sys_proctable_darwin.rb
25
+ * test/test_sys_proctable_hpux.rb
26
+ * test/test_sys_proctable_bsd.rb
27
+ * test/test_sys_proctable_linux.rb
28
+ * test/test_sys_proctable_sunos.rb
29
+ * test/test_sys_proctable_windows.rb
30
+ * test/test_sys_top.rb
data/README ADDED
@@ -0,0 +1,119 @@
1
+ == Description
2
+ A Ruby interface for gathering process information.
3
+
4
+ == Prerequisites
5
+ * Test::Unit 2.x (development only)
6
+
7
+ == Supported Platforms
8
+ * Windows 2000 or later
9
+ * Linux 2.6+
10
+ * BSD (various flavors)
11
+ * Solaris 8+
12
+ * HP-UX 10+
13
+ * OS X 10.4+
14
+
15
+ == Installation
16
+ gem install sys-proctable
17
+
18
+ You may need to specify a platform in some cases. For example:
19
+
20
+ gem install sys-proctable --platform mswin32 # Windows
21
+ gem install sys-proctable --platform sunos # Solaris
22
+ gem install sys-proctable --platform linux # Linux
23
+
24
+ == Synopsis
25
+ require 'sys/proctable'
26
+ include Sys
27
+
28
+ # Everything
29
+ ProcTable.ps{ |p|
30
+ puts p.pid.to_s
31
+ puts p.comm
32
+ # ...
33
+ }
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
+ == Known Issues
53
+ === BSD
54
+ A kvm interface is used. That means the owner of the process using the
55
+ sys-proctable library needs to be a member of the kvm group (or root).
56
+
57
+ === Solaris
58
+ The cmdline member on Solaris is limited to 80 characters unless you (or
59
+ your program) own the process. This is a Solaris design flaw/feature.
60
+
61
+ === OS X
62
+ At the moment you do not get the full command line string. The code required
63
+ to get this information is obnoxious and I don't have any compelling desire
64
+ to add it. However, if you're willing to submit a patch I'll accept it.
65
+
66
+ You can find a good starting point with the OS X code found in Dan Urist's
67
+ Proc::ProcessTable module. You can find that module on CPAN. Point your
68
+ browser at http://search.cpan.org.
69
+
70
+ === Thread Safety
71
+ I am not currently using a thread-safe version of readdir() for versions
72
+ of this library that use C. I am not especially concerned about it either.
73
+ If you are trying to read information out of /proc from different threads
74
+ at the same time there is something seriously wrong with your code logic.
75
+ Using readdir_r() still won't solve all potential thread safety issues anyway.
76
+
77
+ == Future Plans
78
+ Research has indicated that the kvm approach is less favored than a sysctl
79
+ approach on BSD variants. I will try to add this interface in a future
80
+ release.
81
+
82
+ == Acknowledgements
83
+ This library is largely based on the Perl module Proc::ProcessTable by
84
+ Dan Urist. Many ideas, as well as large chunks of code, were taken
85
+ from his work. So, a big THANK YOU goes out to Dan Urist.
86
+
87
+ A big thanks also goes out to Mike Hall who was very helpful with ideas,
88
+ logic and testing.
89
+
90
+ Thanks also go to Sean Chittenden for providing an account on one of his
91
+ FreeBSD machines. This is how the FreeBSD support was (initially) added.
92
+
93
+ Thanks go to James Hranicky for providing a patch that grabs name, eid,
94
+ euid, gid and guid info in the Linux version, along with some general
95
+ debugging help.
96
+
97
+ Thanks go to David Felstead for the original OS X code.
98
+
99
+ Finally I'd like to thank all the folks who have submitted bug reports
100
+ and/or patches.
101
+
102
+ == Help Wanted
103
+ I do not have access to all platforms. If your platform is not supported
104
+ then you will need to either submit a patch or give me a remote account
105
+ on a box with a compiler so that I can write the code.
106
+
107
+ == More documentation
108
+ See the documentation under the 'doc' directory for more information,
109
+ including platform specific notes and issues.
110
+
111
+ == License
112
+ Artistic 2.0
113
+
114
+ == Copyright
115
+ (C) 2003-2010 Daniel J. Berger
116
+ All Rights Reserved.
117
+
118
+ == Author
119
+ Daniel J. Berger