sys-proctable 0.7.4-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES ADDED
@@ -0,0 +1,213 @@
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.
6
+ * Added inline rdoc to the source code.
7
+ * Added a gemspec.
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.
11
+
12
+ == 0.7.3 - 27-Oct-2005
13
+ * Fix for 1.8.3 and later (rb_pid_t). This should have only affected
14
+ Solaris.
15
+
16
+ == 0.7.2 - 15-May-2005
17
+ * Bug fix for the FreeBSD version that reads from /proc.
18
+ * Eliminated the test bug on Linux (inexplicably caused by File.copy). The
19
+ test suite should now run without segfaulting.
20
+ * Include bsd.c in tarball (oops).
21
+ * Minor test updates for FreeBSD.
22
+ * The 'pct_cpu' member for the BSD/kvm version has been changed to 'pctcpu'
23
+ consistency with other platforms.
24
+
25
+ == 0.7.1 - 8-May-2005
26
+ * Bug fixed for the cmdline info on Linux. Thanks go to Arash Abedinzadeh
27
+ for the spot.
28
+ * Added an example program.
29
+ * Minor setup fix for Win32 in tc_all.rb.
30
+
31
+ == 0.7.0 - 25-Apr-2005
32
+ * Scrapped the C implementation for Windows in favor of an OLE + WMI pure Ruby
33
+ approach. See documentation for details.
34
+ * Added an optional lkvm implementation for BSD users. This is automatically
35
+ used if the /proc filesystem isn't found.
36
+ * Added prusage info for the Solaris version.
37
+ * Added name, eid, euid, gid and guid information for Linux. Thanks go to
38
+ James Hranicky for the patch.
39
+ * Fixed some potential bugs in the Linux version. Thanks go to James
40
+ Hranicky for the spot.
41
+ * Added the 'sys/top' package.
42
+ * ProcTable.fields no longer supports a block form.
43
+ * The BTIME (boot time) information has been removed from the Linux version.
44
+ If you want that information, use sys-uptime instead.
45
+ * The .html and .rd files have been removed. You can generate html on your
46
+ own with rdoc if you like.
47
+ * Some code cleanup on the C side of the house.
48
+ * Most documents made rdoc friendly.
49
+ * Renamed 'install_pure_ruby.rb' to just 'install.rb'.
50
+ * Removed the 'INSTALL' file. Installation instructions are in the README.
51
+ * Some test suite cleanup and reorganization.
52
+ * Moved project to RubyForge.
53
+
54
+ == 0.6.4 - 31-Mar-2004
55
+ * Fixed a bug in the pure Ruby version for Win32. Thanks go to Mark Hudson
56
+ for the spot.
57
+ * Fixed a bug in the C implementation for Win32 where the cmdline and path
58
+ values were sometimes wrong for running processes. Thanks go to Park Heesob
59
+ for the fix.
60
+ * Updated the VERSION constant and removed the VERSION class method in the
61
+ pure Ruby version for Win32.
62
+ * Updated install_pure_ruby.rb and test.rb scripts.
63
+ * Updated warranty information.
64
+ * The extconf.rb script has been revamped. See the INSTALL and README files
65
+ for important changes since the last release.
66
+ * The start ProcInfo struct member on Solaris, HP-UX and FreeBSD is now a
67
+ Time object, not a Fixnum/Bignum.
68
+ * Modified linux.c yet again to make gcc happy when it comes to multi-line
69
+ string literals.
70
+ * Minor change to way process state is handled on HP-UX.
71
+ * Documentation additions and updates, including warranty information.
72
+
73
+ == 0.6.3 - 24-Feb-2004
74
+ * Fixed a bug in the Solaris version where the cmd_args array did not
75
+ necessarily contain data on 2.7 and later. The current patch still
76
+ does not quite fix the problem for 2.6 and earlier but can be easily
77
+ derived manually by parsing the cmdline string.
78
+
79
+ == 0.6.2 - 20-Jan-2004
80
+ * Fixed a small memory leak in the solaris version.
81
+
82
+ == 0.6.1 - 31-Dec-2003
83
+ * Fixed a minor bug in the cmdline field on Linux where a blank character
84
+ was being appended to the end of the field.
85
+ * Fixed a minor annoyance where the windows.rb file was being copied into
86
+ the Ruby lib directory on install.
87
+ * Added a test_memleak.rb file. Currently only supported on Linux and
88
+ only does a file descriptor count check. I plan to expand this to
89
+ other platforms in the future.
90
+ * Minor test suite changes
91
+ * MANIFEST correction and update.
92
+
93
+ == 0.6.0 - 22-Oct-2003
94
+ * Significant API change (and thus, a version jump) - only a
95
+ single argument is now accepted to the ps() method, and only a PID
96
+ (Fixnum) is regarded as a valid argument.
97
+ * Calling ps() with a pid returns a single ProcTable struct (or nil
98
+ if the pid is not found), instead of a one element array.
99
+ * Argument to ps() now works properly on HP-UX and Win32.
100
+ * Removed the '#include <sys/types32.h>' in sunos.h. It wasn't needed
101
+ and you're not supposed to include it directly.
102
+ * Fixed 2.6 compatibility issue with regards to cmdline on Solaris.
103
+ * Removed the ProcStatException completely on Linux. There was no reason
104
+ to fail on a directory read for /proc/xxx/stat. If the read fails
105
+ (meaning the process died in the middle of collecting info for it), it
106
+ is simply ignored.
107
+ * The ttynum bug on HPUX has been fixed. In addition, the return value for
108
+ this field is now a string rather than an int and the field name has
109
+ been changed to "ttydev".
110
+ * The ttynum field has been changed to ttydev on Solaris and HPUX. On
111
+ Solaris, the ttydev is now reported as -1 if there is no associated tty.
112
+ In a future release, Solaris and the other *nix platforms will be changed
113
+ so that ttydev is always a device name (i.e String).
114
+ * Added plain text documentation for all platforms.
115
+ * Some test suite cleanup.
116
+ * Changed .rd2 extension to just '.rd'.
117
+
118
+ == 0.5.2 - 18-Jul-2003
119
+ * Modified cmdline to extend past the traditional 80 character limit on
120
+ Solaris, where possible (Solaris 2.6+ only).
121
+ * Added the cmdline_args and num_args fields on Solaris, which returns
122
+ an array of cmdline arguments and the number of cmdline arguments,
123
+ respectively.
124
+ * Minor modification to fields() method, in addition to warning cleanup
125
+ for Solaris.
126
+ * Changed "defunct" state string to "zombie" for Solaris.
127
+ * Should cleanly compile with -Wall -W now (gcc) on Solaris.
128
+ * Added solaris.txt to doc directory.
129
+ * MANIFEST corrections.
130
+
131
+ == 0.5.1 - 16-Jul-2003
132
+ * Fixed a nasty file descriptor bug in the Linux code, where file descriptors
133
+ were continuously being used up.
134
+ * Added the BTIME (boot time) constant for Linux.
135
+ * Fixed up the test/test.rb file a bit.
136
+ * Added BTIME tests to tc_linux.rb.
137
+
138
+ == 0.5.0 - 11-Jul-200
139
+ * Added HP-UX support!
140
+ * Note that passing PID's or strings as arguments to ps() is not supported
141
+ in the HP-UX version. This functionality will be stripped out of the
142
+ other versions in a future release. See the README file for more details.
143
+ * Removed the VERSION() class method. Use the constant instead.
144
+ * Separated the rd docs from their respective source files. Now in the doc
145
+ directory.
146
+ * Got rid of the interactive html generation in extconf.rb.
147
+ * Changed License to Artistic.
148
+
149
+ == 0.4.3 - 30-May-2003
150
+ * Added a version.h file to store the version number. Modified all of the
151
+ C source files to use that instead of hard coding the version everywhere.
152
+ * Added a generic test.rb script for those without TestUnit installed, or
153
+ just futzing in general. Modified the extconf.rb script to copy this
154
+ instead of writing an inline HERE document.
155
+ * Modified extconf.rb so that it builds with mingw or cygwin. Thanks go to
156
+ Peter Fischer for the spot and patch.
157
+ * Modified test suite to work with TestUnit 0.1.6 or 0.1.8.
158
+
159
+ == 0.4.2 - 14-Apr-2003
160
+ * Added pure Ruby version for Win32 - thanks Park Heesob.
161
+ * Modified extconf.rb file to handle pure Ruby versions.
162
+ * Added install_pure_ruby.rb file, an alternate installation
163
+ script for pure Ruby versions.
164
+
165
+ == 0.4.1 - 31-Mar-2003
166
+ * Added support for Solaris 2.5.x.
167
+ * All exceptions are now a direct subclass of StandardError.
168
+ * Value returned for wchan now more meaningful (2.5.x only for now).
169
+ * Fixed the start, utime and ctime for FreeBSD.
170
+ * Minor fix to FreeBSD test suite.
171
+ * Some changes to extconf.rb.
172
+ * Minor doc changes.
173
+ * Added License and Copyright info.
174
+
175
+ == 0.4.0 - 10-Mar-2003
176
+ * Added MS Windows support (non-cygwin).
177
+ * Added environment information for Linux version.
178
+ * Added real exceptions (type depends on platform).
179
+ * Added a test suite (for those with testunit installed).
180
+ * Removed the sys-uname requirement.
181
+ * Heavily modified the extconf.rb script.
182
+ * Changed "Changelog" to "CHANGES" and "Manifest" to "MANIFEST".
183
+ * Added a VERSION constant and class method.
184
+ * Minor internal directory layout change (put 'os' under 'lib').
185
+ * Changed package name to lower case.
186
+ * Doc changes, including license information.
187
+
188
+ == 0.3.1 - 16-Aug-2002
189
+ * Added a "comm" field to the sunos version. I am going to try to make this a
190
+ common field for all platforms to help reduce RUBY_PLATFORM checking.
191
+ * Fixed the release date for 0.3.0 (was accidentally marked *July*).
192
+ * Added an INSTALL file.
193
+ * Minor documentation change to the sunos.c source file.
194
+
195
+ == 0.3.0 - 11-Aug-2002
196
+ * Added FreeBSD support!
197
+ * Struct name changed to just "ProcTableStruct" to be compliant with future
198
+ versions of Ruby.
199
+ * The ps() function now returns an array of ProcTableStruct's in lvalue context.
200
+ * Fixed the ability to search by process name in Linux.
201
+ * Modified Linux "comm" field to strip parenthesis.
202
+ * Some doc changes/additions.
203
+ * Added Sean Chittenden to the "Acknowledgements" section. Sean provided me
204
+ with access to a FreeBSD box, which is how I was able to provide FreeBSD
205
+ support. Thanks Sean!
206
+
207
+ == 0.2.0 - 19-Jul-2002
208
+ * Added the ability to search by process name.
209
+ * test.rb modified to be cross-platform.
210
+ * Solaris - fixed bug with fname (was accidentally called "name").
211
+
212
+ == 0.1.0 - 2-Jul-2002
213
+ - Initial release.
@@ -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 ADDED
@@ -0,0 +1,131 @@
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
+
17
+ = Installation
18
+ === UNIX
19
+ cd ext; ruby extconf.rb
20
+ make
21
+ cd ..; ruby test/ts_all.rb (optional)
22
+ make install
23
+
24
+ === MS Windows
25
+ ruby test/tc_windows.rb (optional)
26
+ ruby install.rb
27
+
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)
@@ -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 a list of fields available on the current OS. Also takes a block.
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