sys-proctable 0.9.2-universal-mingw

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