sys-proctable 0.8.0-sparc-solaris-2.10 → 0.8.1-sparc-solaris-2.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,13 @@
1
+ == 0.8.1 - 6-Apr-2009
2
+ * The Linux and Solaris libraries now handle the possibility of a process
3
+ terminating in the middle of a read more gracefully. If that happens, they
4
+ merely skip to the next record, i.e. it's all or nothing. Thanks go to
5
+ Heejong Lee for the spot and patch.
6
+ * Fixed a bug in the Linux version where embedded nulls were not being
7
+ stripped out of the cmdline data.
8
+ * Added the comm alias back to the Solaris version. Thanks go to Jun Young Kim
9
+ for the spot.
10
+
1
11
  == 0.8.0 - 26-Jan-2009
2
12
  * The Linux and Solaris versions of this library are now pure Ruby. Be warned,
3
13
  however, that only Solaris 8 and later are now supported. This may change
data/lib/sys/proctable.rb CHANGED
@@ -13,7 +13,7 @@ module Sys
13
13
  private_class_method :new
14
14
 
15
15
  # The version of the sys-proctable library
16
- VERSION = '0.8.0'
16
+ VERSION = '0.8.1'
17
17
 
18
18
  private
19
19
 
@@ -194,7 +194,9 @@ module Sys
194
194
 
195
195
  public
196
196
 
197
- ProcTableStruct = Struct.new("ProcTableStruct", *@fields)
197
+ ProcTableStruct = Struct.new("ProcTableStruct", *@fields) do
198
+ alias comm fname
199
+ end
198
200
 
199
201
  # In block form, yields a ProcTableStruct for each process entry that you
200
202
  # have rights to. This method returns an array of ProcTableStruct's in
@@ -230,7 +232,7 @@ module Sys
230
232
  # Skip over any entries we don't have permissions to read
231
233
  next unless File.readable?("/proc/#{file}/psinfo")
232
234
 
233
- psinfo = IO.read("/proc/#{file}/psinfo")
235
+ psinfo = IO.read("/proc/#{file}/psinfo") rescue next
234
236
 
235
237
  psinfo_array = psinfo.unpack(@psinfo_pack_directive)
236
238
 
@@ -345,6 +347,8 @@ module Sys
345
347
  rescue Errno::EACCES, Errno::EOVERFLOW, EOFError
346
348
  # Skip this if we don't have proper permissions, if there's
347
349
  # no associated environment, or if there's a largefile issue.
350
+ rescue Errno::ENOENT
351
+ next # The process has terminated. Bail out!
348
352
  end
349
353
 
350
354
  ### struct prusage
@@ -386,6 +390,8 @@ module Sys
386
390
  struct.ioch = prusage_array[53]
387
391
  rescue Errno::EACCES
388
392
  # Do nothing if we lack permissions. Just move on.
393
+ rescue Errno::ENOENT
394
+ next # The process has terminated. Bail out!
389
395
  end
390
396
 
391
397
  # Information from /proc/<pid>/path. This is represented as a hash,
@@ -23,7 +23,7 @@ class TC_ProcTable_All < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  def test_version
26
- assert_equal('0.8.0', ProcTable::VERSION)
26
+ assert_equal('0.8.1', ProcTable::VERSION)
27
27
  end
28
28
 
29
29
  def test_fields
@@ -140,6 +140,12 @@ class TC_ProcTable_SunOS < Test::Unit::TestCase
140
140
  assert_true(@ptable.fname.size > 0)
141
141
  end
142
142
 
143
+ def test_comm_alias
144
+ assert_respond_to(@ptable, :comm)
145
+ assert_kind_of(String, @ptable.comm)
146
+ assert_true(@ptable.comm.size > 0)
147
+ end
148
+
143
149
  def test_psargs
144
150
  assert_respond_to(@ptable, :psargs)
145
151
  assert_kind_of(String, @ptable.psargs)
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: 0.8.0
4
+ version: 0.8.1
5
5
  platform: sparc-solaris-2.10
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-27 00:00:00 -07:00
12
+ date: 2009-04-06 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,8 @@ files:
45
45
  - doc/solaris.txt
46
46
  has_rdoc: true
47
47
  homepage: http://www.rubyforge.org/projects/sysutils
48
+ licenses: []
49
+
48
50
  post_install_message:
49
51
  rdoc_options: []
50
52
 
@@ -67,7 +69,7 @@ requirements: []
67
69
  rubyforge_project: sysutils
68
70
  rubygems_version: 1.3.1
69
71
  signing_key:
70
- specification_version: 2
72
+ specification_version: 3
71
73
  summary: An interface for providing process table information
72
74
  test_files:
73
75
  - test/test_sys_proctable_all.rb