sys-proctable 1.0.0-universal-freebsd → 1.1.0-universal-freebsd
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +11 -1
- data/MANIFEST +1 -2
- data/README +8 -16
- data/Rakefile +7 -10
- data/lib/sys/proctable/version.rb +1 -1
- data/sys-proctable.gemspec +2 -2
- data/test/test_sys_proctable_all.rb +30 -19
- data/test/test_sys_top.rb +30 -11
- metadata +12 -12
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571d09ed4098395e9a6768e4ade6a50e579e7108
|
4
|
+
data.tar.gz: 33581e29bdc3d3b943e75721470c3a6db751364d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977fa5f793be4b8db241e4560aa00c350a1ebe0c694f17b981244e6347e150a42fbbff5c35d43426b410c385eec08d9f7bf2f0da21c34a202aa0c61430cf5bff
|
7
|
+
data.tar.gz: 1ffedea1dfc31a88918447dd9ae1fb2f80f0ccffaea06b09dd9cdd4d4acb56bc37858db00aa3d0f3c63954d632fff650cf9b306bc488a082bbcf959fccac34cf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
+
== 1.1.0 - 27-Jun-2016
|
2
|
+
* License was changed to Apache 2.0.
|
3
|
+
* The OS X version now requires OS X 10.7 or later.
|
4
|
+
* Scrapped the C implementation for OS X, and replaced it with a libproc wrapper
|
5
|
+
using FFI, so it is now pure Ruby. Note that some new struct members have been
|
6
|
+
added, while others have been dropped. This includes pctcpu, so Sys::Top does
|
7
|
+
not work at the moment.
|
8
|
+
* Rakefile updates to accomodate the changes for OS X.
|
9
|
+
* Some test suite updates and refactoring.
|
10
|
+
|
1
11
|
== 1.0.0 - 11-Jan-2016
|
2
12
|
* Added smaps information for Linux. Thanks go to Joe Rafaniello for the patch.
|
3
|
-
* This
|
13
|
+
* This really should not have been a major release, sorry.
|
4
14
|
|
5
15
|
== 0.9.9 - 8-Nov-2015
|
6
16
|
* Added support for cgroups on Linux. Thanks go to Dennis Günnewig for the patch.
|
data/MANIFEST
CHANGED
@@ -11,14 +11,13 @@
|
|
11
11
|
* doc/top.txt
|
12
12
|
* doc/windows.txt
|
13
13
|
* example/example_ps.rb
|
14
|
-
* ext/darwin/extconf.rb
|
15
|
-
* ext/darwin/sys/proctable.c
|
16
14
|
* ext/hpux/extconf.rb
|
17
15
|
* ext/hpux/sys/proctable.c
|
18
16
|
* lib/sys-proctable.rb
|
19
17
|
* lib/sys/top.rb
|
20
18
|
* lib/sys/proctable/version.rb
|
21
19
|
* lib/aix/sys/proctable.rb
|
20
|
+
* lib/darwin/sys/proctable.rb
|
22
21
|
* lib/freebsd/sys/proctable.rb
|
23
22
|
* lib/linux/sys/proctable.rb
|
24
23
|
* lib/sunos/sys/proctable.rb
|
data/README
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
* FreeBSD
|
11
11
|
* Solaris 8+
|
12
12
|
* HP-UX 10+
|
13
|
-
* OS X 10.
|
13
|
+
* OS X 10.7+
|
14
14
|
* AIX 5.3+
|
15
15
|
|
16
16
|
== Installation
|
@@ -22,6 +22,7 @@
|
|
22
22
|
gem install sys-proctable --platform sunos # Solaris
|
23
23
|
gem install sys-proctable --platform linux # Linux
|
24
24
|
gem install sys-proctable --platform freebsd # FreeBSD
|
25
|
+
gem install sys-proctable --platform darwin # OS X
|
25
26
|
|
26
27
|
== Synopsis
|
27
28
|
require 'sys/proctable'
|
@@ -60,16 +61,13 @@
|
|
60
61
|
The cmdline member on Solaris is limited to 80 characters unless you (or
|
61
62
|
your program) own the process. This is a Solaris design flaw/feature.
|
62
63
|
|
63
|
-
===
|
64
|
-
|
65
|
-
|
66
|
-
If you are trying to read information out of /proc from different threads
|
67
|
-
at the same time there is something seriously wrong with your code logic.
|
68
|
-
Using readdir_r() still won't solve all potential thread safety issues anyway.
|
64
|
+
=== OS X
|
65
|
+
The libproc interface is used. That means you will only get list of
|
66
|
+
processes that you have access to. To get a full listing, run as root.
|
69
67
|
|
70
68
|
== Future Plans
|
71
69
|
Add support for NetBSD and OpenBSD.
|
72
|
-
Convert
|
70
|
+
Convert remaining C code (just HP-UX at this point) to FFI.
|
73
71
|
|
74
72
|
== Acknowledgements
|
75
73
|
This library was originally based on the Perl module Proc::ProcessTable
|
@@ -87,7 +85,7 @@
|
|
87
85
|
debugging help.
|
88
86
|
|
89
87
|
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.
|
88
|
+
to Matthias Zirnstein for adding the original cmdline support for OS X.
|
91
89
|
|
92
90
|
Finally I'd like to thank all the folks who have submitted bug reports
|
93
91
|
and/or patches.
|
@@ -102,17 +100,11 @@
|
|
102
100
|
including platform specific notes and issues.
|
103
101
|
|
104
102
|
== License
|
105
|
-
|
103
|
+
Apache 2.0
|
106
104
|
|
107
105
|
== Copyright
|
108
106
|
(C) 2003-2016 Daniel J. Berger
|
109
107
|
All Rights Reserved.
|
110
108
|
|
111
|
-
== Contributions
|
112
|
-
Although this library is free, please consider having your company
|
113
|
-
setup a gittip if used by your company professionally.
|
114
|
-
|
115
|
-
http://www.gittip.com/djberg96/
|
116
|
-
|
117
109
|
== Author
|
118
110
|
Daniel J. Berger
|
data/Rakefile
CHANGED
@@ -27,15 +27,12 @@ task :build => [:clean] do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
case CONFIG['host_os']
|
30
|
-
when /darwin/i
|
31
|
-
dir = 'ext/darwin'
|
32
|
-
ext = '.bundle'
|
33
30
|
when /hpux/i
|
34
31
|
dir = 'ext/hpux'
|
35
32
|
ext = '.sl'
|
36
33
|
end
|
37
34
|
|
38
|
-
if CONFIG['host_os'] =~ /
|
35
|
+
if CONFIG['host_os'] =~ /hpux/i
|
39
36
|
Dir.chdir(dir) do
|
40
37
|
ruby 'extconf.rb'
|
41
38
|
sh 'make'
|
@@ -63,7 +60,7 @@ task :install => [:build] do
|
|
63
60
|
when /freebsd/i
|
64
61
|
file = 'lib/freebsd/sys/proctable.rb'
|
65
62
|
when /darwin/i
|
66
|
-
|
63
|
+
file = 'lib/darwin/sys/proctable.rb'
|
67
64
|
when /hpux/i
|
68
65
|
Dir.chdir('ext/hpux'){ sh 'make install' }
|
69
66
|
end
|
@@ -74,7 +71,7 @@ end
|
|
74
71
|
desc 'Uninstall the sys-proctable library'
|
75
72
|
task :uninstall do
|
76
73
|
case CONFIG['host_os']
|
77
|
-
when /
|
74
|
+
when /hpux/i
|
78
75
|
dir = File.join(CONFIG['sitearchdir'], 'sys')
|
79
76
|
file = File.join(dir, 'proctable.' + CONFIG['DLEXT'])
|
80
77
|
else
|
@@ -117,7 +114,7 @@ Rake::TestTask.new do |t|
|
|
117
114
|
t.test_files = FileList['test/test_sys_proctable_freebsd.rb']
|
118
115
|
t.libs << 'lib/freebsd'
|
119
116
|
when /darwin/i
|
120
|
-
t.libs << '
|
117
|
+
t.libs << 'lib/darwin'
|
121
118
|
t.test_files = FileList['test/test_sys_proctable_darwin.rb']
|
122
119
|
when /hpux/i
|
123
120
|
t.libs << 'ext/hpux'
|
@@ -153,10 +150,10 @@ namespace :gem do
|
|
153
150
|
spec.add_dependency('ffi')
|
154
151
|
when /darwin/i
|
155
152
|
spec.platform = Gem::Platform.new(['universal', 'darwin'])
|
156
|
-
spec.
|
157
|
-
spec.
|
153
|
+
spec.require_paths = ['lib', 'lib/darwin']
|
154
|
+
spec.files += ['lib/darwin/sys/proctable.rb']
|
158
155
|
spec.test_files << 'test/test_sys_proctable_darwin.rb'
|
159
|
-
spec.
|
156
|
+
spec.add_dependency('ffi')
|
160
157
|
when /hpux/i
|
161
158
|
spec.platform = Gem::Platform.new(['universal', 'hpux'])
|
162
159
|
spec.files << 'ext/hpux/sys/proctable.c'
|
data/sys-proctable.gemspec
CHANGED
@@ -2,9 +2,9 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'sys-proctable'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.1.0'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
|
-
spec.license = '
|
7
|
+
spec.license = 'Apache 2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
9
9
|
spec.homepage = 'http://github.com/djberg96/sys-proctable'
|
10
10
|
spec.platform = Gem::Platform::CURRENT # Probably altered by Rake task
|
@@ -15,66 +15,77 @@ class TC_ProcTable_All < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def setup
|
18
|
-
@pid =
|
18
|
+
@pid = Process.pid
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
assert_equal('1.
|
21
|
+
test "version is set to expected value" do
|
22
|
+
assert_equal('1.1.0', ProcTable::VERSION)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
test "fields basic functionality" do
|
26
26
|
assert_respond_to(ProcTable, :fields)
|
27
27
|
assert_nothing_raised{ ProcTable.fields }
|
28
|
+
end
|
29
|
+
|
30
|
+
test "fields returns expected type" do
|
28
31
|
assert_kind_of(Array, ProcTable.fields)
|
29
32
|
assert_kind_of(String, ProcTable.fields.first)
|
30
33
|
end
|
31
34
|
|
32
|
-
|
35
|
+
test "ps basic functionality" do
|
33
36
|
assert_respond_to(ProcTable, :ps)
|
34
37
|
assert_nothing_raised{ ProcTable.ps }
|
35
38
|
assert_nothing_raised{ ProcTable.ps{} }
|
36
39
|
end
|
37
40
|
|
38
|
-
|
41
|
+
test "ps accepts an optional pid" do
|
39
42
|
assert_nothing_raised{ ProcTable.ps(0) }
|
40
43
|
end
|
41
44
|
|
42
|
-
|
45
|
+
test "ps with explicit nil works as expected" do
|
43
46
|
assert_nothing_raised{ ProcTable.ps(nil) }
|
44
47
|
assert_kind_of(Array, ProcTable.ps(nil))
|
45
48
|
end
|
46
49
|
|
47
|
-
|
50
|
+
test "ps returns expected results" do
|
48
51
|
assert_kind_of(Array, ProcTable.ps)
|
49
52
|
assert_kind_of(Struct::ProcTableStruct, ProcTable.ps(@pid))
|
50
|
-
assert_equal(nil, ProcTable.ps(999999999))
|
51
|
-
assert_equal(nil, ProcTable.ps(999999999){})
|
52
|
-
assert_equal(nil, ProcTable.ps{})
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
test "ps returns nil if process does not exist" do
|
56
|
+
assert_nil(ProcTable.ps(999999999))
|
57
|
+
assert_nil(ProcTable.ps(999999999){})
|
58
|
+
assert_nil(ProcTable.ps{})
|
59
|
+
end
|
60
|
+
|
61
|
+
test "structs returned by ps are frozen" do
|
56
62
|
assert_true(ProcTable.ps.first.frozen?)
|
57
63
|
end
|
58
64
|
|
59
|
-
|
65
|
+
test "ps accepts numeric arguments only" do
|
60
66
|
assert_raises(TypeError){ ProcTable.ps('vim') }
|
67
|
+
end
|
68
|
+
|
69
|
+
test "ps accepts a maximum of one argument on Unix platforms" do
|
61
70
|
omit_if(@@windows, 'ArgumentError check skipped on MS Windows')
|
62
71
|
assert_raises(ArgumentError){ ProcTable.ps(0, 'localhost') }
|
63
72
|
end
|
64
73
|
|
65
|
-
|
74
|
+
test "traditional constructor is disabled" do
|
66
75
|
assert_raise(NoMethodError){ Sys::ProcTable.new }
|
67
76
|
end
|
68
77
|
|
69
|
-
|
78
|
+
test "custom error class is defined" do
|
70
79
|
assert_not_nil(Sys::ProcTable::Error)
|
71
80
|
assert_kind_of(StandardError, Sys::ProcTable::Error.new)
|
72
81
|
end
|
73
82
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
83
|
+
test "ps works within a thread" do
|
84
|
+
assert_nothing_raised{
|
85
|
+
Thread.new do
|
86
|
+
Sys::ProcTable.ps
|
87
|
+
end.value
|
88
|
+
}
|
78
89
|
end
|
79
90
|
|
80
91
|
def teardown
|
data/test/test_sys_top.rb
CHANGED
@@ -2,45 +2,64 @@
|
|
2
2
|
# test_sys_top.rb
|
3
3
|
#
|
4
4
|
# Test suite for the sys-top library that is included with this distribution.
|
5
|
+
#
|
6
|
+
# Tests omitted on OSX until I figure out how to get pctcpu information.
|
5
7
|
##############################################################################
|
6
|
-
require '
|
7
|
-
gem 'test-unit'
|
8
|
-
|
9
|
-
require 'test/unit'
|
8
|
+
require 'test-unit'
|
10
9
|
require 'sys/top'
|
11
10
|
|
12
11
|
class TC_Top < Test::Unit::TestCase
|
13
12
|
include Sys
|
14
13
|
|
15
|
-
def
|
14
|
+
def setup
|
15
|
+
@osx = RbConfig::CONFIG['host_os'] =~ /darwin/i
|
16
|
+
end
|
17
|
+
|
18
|
+
test "top version" do
|
16
19
|
assert_equal('1.0.4', Top::VERSION)
|
17
20
|
end
|
18
21
|
|
19
|
-
|
22
|
+
test "top basic functionality" do
|
20
23
|
assert_respond_to(Top, :top)
|
24
|
+
end
|
25
|
+
|
26
|
+
test "top works with no arguments" do
|
27
|
+
omit_if(@osx)
|
21
28
|
assert_nothing_raised{ Top.top }
|
29
|
+
end
|
30
|
+
|
31
|
+
test "top accepts optional arguments" do
|
32
|
+
omit_if(@osx)
|
22
33
|
assert_nothing_raised{ Top.top(5) }
|
23
34
|
assert_nothing_raised{ Top.top(5, 'cmdline') }
|
24
35
|
end
|
25
36
|
|
26
|
-
|
37
|
+
test "top with no arguments returns expected results" do
|
38
|
+
omit_if(@osx)
|
27
39
|
assert_equal(10, Top.top.length)
|
28
40
|
assert_kind_of(Struct::ProcTableStruct, Top.top.first)
|
29
41
|
end
|
30
42
|
|
31
|
-
|
43
|
+
test "top with size argument returns expected result" do
|
44
|
+
omit_if(@osx)
|
32
45
|
assert_equal(5, Top.top(5).length)
|
33
46
|
end
|
34
47
|
|
35
|
-
|
48
|
+
test "top with size and sort_by argument returns expected result" do
|
49
|
+
omit_if(@osx)
|
36
50
|
assert_equal(5, Top.top(5, :cmdline).length)
|
37
51
|
end
|
38
52
|
|
39
|
-
|
53
|
+
test "top returns an array" do
|
54
|
+
omit_if(@osx)
|
40
55
|
assert_kind_of(Array, Top.top)
|
41
56
|
end
|
42
57
|
|
43
|
-
|
58
|
+
test "top accepts a maximum of two arguments" do
|
44
59
|
assert_raises(ArgumentError){ Top.top(1, 'foo', 2) }
|
45
60
|
end
|
61
|
+
|
62
|
+
def teardown
|
63
|
+
@osx = nil
|
64
|
+
end
|
46
65
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-proctable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: universal-freebsd
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -30,48 +30,48 @@ cert_chain:
|
|
30
30
|
EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
|
31
31
|
tGSHgAmcLlkdGgan182qsE/4kKM=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-
|
33
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: test-unit
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
type: :development
|
43
43
|
prerelease: false
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rake
|
51
51
|
requirement: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: ffi
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
description: |2
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- lib/freebsd/sys/proctable.rb
|
105
105
|
homepage: http://github.com/djberg96/sys-proctable
|
106
106
|
licenses:
|
107
|
-
-
|
107
|
+
- Apache 2.0
|
108
108
|
metadata: {}
|
109
109
|
post_install_message:
|
110
110
|
rdoc_options: []
|
@@ -113,17 +113,17 @@ require_paths:
|
|
113
113
|
- lib/freebsd
|
114
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - '>='
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - '>='
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.6.6
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: An interface for providing process table information
|
metadata.gz.sig
CHANGED
Binary file
|