sys-proctable 0.7.6 → 1.2.4
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.rdoc} +197 -0
- data/LICENSE +177 -0
- data/MANIFEST.rdoc +26 -0
- data/README.md +158 -0
- data/Rakefile +94 -0
- data/benchmarks/bench_ips_ps.rb +63 -0
- data/benchmarks/bench_ps.rb +21 -0
- data/examples/example_ps.rb +20 -0
- data/lib/aix/sys/proctable.rb +458 -0
- data/lib/darwin/sys/proctable.rb +406 -0
- data/lib/freebsd/sys/proctable.rb +363 -0
- data/lib/linux/sys/proctable.rb +315 -0
- data/lib/linux/sys/proctable/cgroup_entry.rb +50 -0
- data/lib/linux/sys/proctable/smaps.rb +118 -0
- data/lib/sunos/sys/proctable.rb +456 -0
- data/lib/sys-proctable.rb +1 -0
- data/lib/sys-top.rb +1 -0
- data/lib/sys/proctable.rb +18 -0
- data/lib/sys/proctable/version.rb +6 -0
- data/lib/sys/top.rb +28 -19
- data/lib/windows/sys/proctable.rb +208 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/sys_proctable_aix_spec.rb +328 -0
- data/spec/sys_proctable_all_spec.rb +90 -0
- data/spec/sys_proctable_darwin_spec.rb +120 -0
- data/spec/sys_proctable_freebsd_spec.rb +210 -0
- data/spec/sys_proctable_linux_spec.rb +323 -0
- data/spec/sys_proctable_sunos_spec.rb +316 -0
- data/spec/sys_proctable_windows_spec.rb +317 -0
- data/spec/sys_top_spec.rb +51 -0
- data/sys-proctable.gemspec +48 -0
- metadata +150 -67
- metadata.gz.sig +7 -0
- data/MANIFEST +0 -41
- data/README +0 -140
- data/doc/freebsd.txt +0 -90
- data/doc/hpux.txt +0 -77
- data/doc/linux.txt +0 -85
- data/doc/solaris.txt +0 -99
- data/doc/top.txt +0 -53
- data/doc/windows.txt +0 -122
- data/ext/extconf.rb +0 -98
- data/ext/sunos/sunos.c +0 -374
- data/ext/sunos/sunos.h +0 -177
- data/ext/version.h +0 -2
- data/test/tc_all.rb +0 -59
- data/test/tc_freebsd.rb +0 -45
- data/test/tc_hpux.rb +0 -49
- data/test/tc_kvm_bsd.rb +0 -31
- data/test/tc_linux.rb +0 -45
- data/test/tc_sunos.rb +0 -52
- data/test/tc_top.rb +0 -26
- data/test/tc_windows.rb +0 -40
- data/test/test_memleak.rb +0 -54
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# sys_top_spec.rb
|
|
3
|
+
#
|
|
4
|
+
# Test suite for the sys-top library that is included with this distribution.
|
|
5
|
+
##############################################################################
|
|
6
|
+
require 'rspec'
|
|
7
|
+
require 'sys/top'
|
|
8
|
+
|
|
9
|
+
describe Sys::Top do
|
|
10
|
+
context "constants" do
|
|
11
|
+
it "sets the version to the expected value" do
|
|
12
|
+
expect(Sys::Top::VERSION).to eql('1.0.5')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "top" do
|
|
17
|
+
it "defines a top method" do
|
|
18
|
+
expect(described_class).to respond_to(:top)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "returns an array" do
|
|
22
|
+
expect(described_class.top).to be_kind_of(Array)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "works with no arguments" do
|
|
26
|
+
expect{ described_class.top }.to_not raise_error
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "accepts a maximum of two arguments" do
|
|
30
|
+
expect{ described_class.top(1, 'foo', 2) }.to raise_error(ArgumentError)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "accepts optional arguments" do
|
|
34
|
+
expect{ described_class.top(5) }.to_not raise_error
|
|
35
|
+
expect{ described_class.top(5, 'cmdline') }.to_not raise_error
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "returns the expected results with no arguments" do
|
|
39
|
+
expect(described_class.top.size).to eql(10)
|
|
40
|
+
expect(described_class.top.first).to be_kind_of(Struct::ProcTableStruct)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "returns the expected result with a size argument" do
|
|
44
|
+
expect(described_class.top(5).size).to eql(5)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "returns the expected result with a size and sort_by argument" do
|
|
48
|
+
expect(described_class.top(5, :cmdline).size).to eql(5)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = 'sys-proctable'
|
|
5
|
+
spec.version = '1.2.4'
|
|
6
|
+
spec.author = 'Daniel J. Berger'
|
|
7
|
+
spec.license = 'Apache-2.0'
|
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
|
9
|
+
spec.homepage = 'http://github.com/djberg96/sys-proctable'
|
|
10
|
+
spec.summary = 'An interface for providing process table information'
|
|
11
|
+
spec.test_files = FileList['spec/**/*.rb']
|
|
12
|
+
spec.cert_chain = ['certs/djberg96_pub.pem']
|
|
13
|
+
|
|
14
|
+
spec.files = FileList[
|
|
15
|
+
"benchmarks/**/*.rb",
|
|
16
|
+
"examples/**/*.rb",
|
|
17
|
+
"lib/**/*.rb",
|
|
18
|
+
'CHANGES.rdoc',
|
|
19
|
+
'LICENSE',
|
|
20
|
+
'MANIFEST.rdoc',
|
|
21
|
+
'Rakefile',
|
|
22
|
+
'README.md',
|
|
23
|
+
'sys-proctable.gemspec'
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
spec.extra_rdoc_files = ['CHANGES.rdoc', 'README.md', 'MANIFEST.rdoc']
|
|
27
|
+
|
|
28
|
+
spec.add_dependency('ffi')
|
|
29
|
+
spec.add_development_dependency('rspec')
|
|
30
|
+
spec.add_development_dependency('rake')
|
|
31
|
+
|
|
32
|
+
spec.metadata = {
|
|
33
|
+
'homepage_uri' => 'https://github.com/djberg96/sys-proctable',
|
|
34
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/sys-proctable/issues',
|
|
35
|
+
'changelog_uri' => 'https://github.com/djberg96/sys-proctable/blob/master/CHANGES.rdoc',
|
|
36
|
+
'documentation_uri' => 'https://github.com/djberg96/sys-proctable/wiki',
|
|
37
|
+
'source_code_uri' => 'https://github.com/djberg96/sys-proctable',
|
|
38
|
+
'wiki_uri' => 'https://github.com/djberg96/sys-proctable/wiki'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
spec.description = <<-EOF
|
|
42
|
+
The sys-proctable library provides an interface for gathering information
|
|
43
|
+
about processes on your system, i.e. the process table. Most major
|
|
44
|
+
platforms are supported and, while different platforms may return
|
|
45
|
+
different information, the external interface is identical across
|
|
46
|
+
platforms.
|
|
47
|
+
EOF
|
|
48
|
+
end
|
metadata
CHANGED
|
@@ -1,73 +1,156 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
2
|
-
rubygems_version: 0.9.4
|
|
3
|
-
specification_version: 1
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
4
2
|
name: sys-proctable
|
|
5
|
-
version: !ruby/object:Gem::Version
|
|
6
|
-
version:
|
|
7
|
-
date: 2007-07-11 00:00:00 -06:00
|
|
8
|
-
summary: An interface for providing process table information
|
|
9
|
-
require_paths:
|
|
10
|
-
- lib
|
|
11
|
-
email: djberg96@gmail.com
|
|
12
|
-
homepage: http://www.rubyforge.org/projects/sysutils
|
|
13
|
-
rubyforge_project: sysutils
|
|
14
|
-
description: An interface for providing process table information
|
|
15
|
-
autorequire:
|
|
16
|
-
default_executable:
|
|
17
|
-
bindir: bin
|
|
18
|
-
has_rdoc: true
|
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
20
|
-
requirements:
|
|
21
|
-
- - ">="
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version: 1.8.0
|
|
24
|
-
version:
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.2.4
|
|
25
5
|
platform: ruby
|
|
26
|
-
|
|
27
|
-
cert_chain:
|
|
28
|
-
post_install_message:
|
|
29
|
-
authors:
|
|
6
|
+
authors:
|
|
30
7
|
- Daniel J. Berger
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain:
|
|
11
|
+
- |
|
|
12
|
+
-----BEGIN CERTIFICATE-----
|
|
13
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
|
14
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
|
15
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
|
16
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
|
17
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
|
18
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
|
19
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
|
20
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
|
21
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
|
22
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
|
|
23
|
+
ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
|
|
24
|
+
74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
|
|
25
|
+
058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
|
|
26
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
|
27
|
+
AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
|
|
28
|
+
YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
|
29
|
+
/3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
|
|
30
|
+
h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
|
|
31
|
+
6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
|
|
32
|
+
ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
|
33
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
|
34
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
|
35
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
|
36
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
|
37
|
+
-----END CERTIFICATE-----
|
|
38
|
+
date:
|
|
39
|
+
dependencies:
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: ffi
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rspec
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rake
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
description: |2
|
|
83
|
+
The sys-proctable library provides an interface for gathering information
|
|
84
|
+
about processes on your system, i.e. the process table. Most major
|
|
85
|
+
platforms are supported and, while different platforms may return
|
|
86
|
+
different information, the external interface is identical across
|
|
87
|
+
platforms.
|
|
88
|
+
email: djberg96@gmail.com
|
|
89
|
+
executables: []
|
|
90
|
+
extensions: []
|
|
91
|
+
extra_rdoc_files:
|
|
92
|
+
- CHANGES.rdoc
|
|
93
|
+
- README.md
|
|
94
|
+
- MANIFEST.rdoc
|
|
95
|
+
files:
|
|
96
|
+
- benchmarks/bench_ips_ps.rb
|
|
97
|
+
- benchmarks/bench_ps.rb
|
|
98
|
+
- examples/example_ps.rb
|
|
99
|
+
- lib/aix/sys/proctable.rb
|
|
100
|
+
- lib/darwin/sys/proctable.rb
|
|
101
|
+
- lib/freebsd/sys/proctable.rb
|
|
102
|
+
- lib/linux/sys/proctable.rb
|
|
103
|
+
- lib/linux/sys/proctable/cgroup_entry.rb
|
|
104
|
+
- lib/linux/sys/proctable/smaps.rb
|
|
105
|
+
- lib/sunos/sys/proctable.rb
|
|
106
|
+
- lib/sys-proctable.rb
|
|
107
|
+
- lib/sys-top.rb
|
|
108
|
+
- lib/sys/proctable.rb
|
|
109
|
+
- lib/sys/proctable/version.rb
|
|
47
110
|
- lib/sys/top.rb
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
111
|
+
- lib/windows/sys/proctable.rb
|
|
112
|
+
- CHANGES.rdoc
|
|
113
|
+
- LICENSE
|
|
114
|
+
- MANIFEST.rdoc
|
|
115
|
+
- Rakefile
|
|
116
|
+
- README.md
|
|
117
|
+
- sys-proctable.gemspec
|
|
118
|
+
homepage: http://github.com/djberg96/sys-proctable
|
|
119
|
+
licenses:
|
|
120
|
+
- Apache-2.0
|
|
121
|
+
metadata:
|
|
122
|
+
homepage_uri: https://github.com/djberg96/sys-proctable
|
|
123
|
+
bug_tracker_uri: https://github.com/djberg96/sys-proctable/issues
|
|
124
|
+
changelog_uri: https://github.com/djberg96/sys-proctable/blob/master/CHANGES.rdoc
|
|
125
|
+
documentation_uri: https://github.com/djberg96/sys-proctable/wiki
|
|
126
|
+
source_code_uri: https://github.com/djberg96/sys-proctable
|
|
127
|
+
wiki_uri: https://github.com/djberg96/sys-proctable/wiki
|
|
128
|
+
post_install_message:
|
|
57
129
|
rdoc_options: []
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
130
|
+
require_paths:
|
|
131
|
+
- lib
|
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
|
+
requirements:
|
|
134
|
+
- - ">="
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: '0'
|
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
|
+
requirements:
|
|
139
|
+
- - ">="
|
|
140
|
+
- !ruby/object:Gem::Version
|
|
141
|
+
version: '0'
|
|
70
142
|
requirements: []
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
143
|
+
rubygems_version: 3.0.6
|
|
144
|
+
signing_key:
|
|
145
|
+
specification_version: 4
|
|
146
|
+
summary: An interface for providing process table information
|
|
147
|
+
test_files:
|
|
148
|
+
- spec/spec_helper.rb
|
|
149
|
+
- spec/sys_proctable_aix_spec.rb
|
|
150
|
+
- spec/sys_proctable_all_spec.rb
|
|
151
|
+
- spec/sys_proctable_darwin_spec.rb
|
|
152
|
+
- spec/sys_proctable_freebsd_spec.rb
|
|
153
|
+
- spec/sys_proctable_linux_spec.rb
|
|
154
|
+
- spec/sys_proctable_sunos_spec.rb
|
|
155
|
+
- spec/sys_proctable_windows_spec.rb
|
|
156
|
+
- spec/sys_top_spec.rb
|
metadata.gz.sig
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
������s���r���k��S�P�܁�&����%J0h�@�����h"�ۤ
|
|
2
|
+
����LJ<��=�.����H)&�� �/ۈ�j����}��L���&S+�|)Y����$��h7�
|
|
3
|
+
U��4m
|
|
4
|
+
�;��19��Wު�c@;�uc���s�2``#�F�K!\Ӓ��%��p�[�Y�R/9CX�G�0x����I�2<�9ES��������?{C��ߵ����T�`��)��pq�*�G��v')�$��?���$�� &,��
|
|
5
|
+
�0�L:��-��ћ�|��J2�+64Fk_�T�*Qxk��� ���֪Y���8�l���tj{E�o�
|
|
6
|
+
�;����Y
|
|
7
|
+
'S)!�_q���g<k�C�P����'b m_���E-�7g
|
data/MANIFEST
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
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)
|