Hm...I don't have access to a Linux box at the moment, but I've run it
on different flavors of Linux without problem in the past.
Is RHEL 3.0 the 2.6.x kernel?
Can you do me a favor? Download Proc::ProcessTable (author: Dan Urist)
from search.cpan.org and try to run a sample Perl program (sys-proctable
is based on that code). If the Perl example works, then there's a bug
in my code. If his doesn't work, well, then I guess there's still a bug
in my code. At least I'll know it isn't something obvious, though. 
Regards,
Dan
ยทยทยท
-----Original Message-----
From: John-Mason P. Shackelford [mailto:john-mason@shackelford.org]
Sent: Monday, March 14, 2005 12:43 PM
To: ruby-talk ML
Subject: sys-proctable segfault on Ruby 1.8.2
On RHEL 3.0 I am seeing a segfault when I run the sample script:
a = ProcTable.ps()
a.each do |p|
puts a.pid
end
I am running Ruby 1.8.2 (2004-12-25) with sys-proctable-0.6.4.
Has anyone else seen this?
Berger, Daniel wrote:
On RHEL 3.0 I am seeing a segfault when I run the sample script:
a = ProcTable.ps()
a.each do |p|
puts a.pid
end
I am running Ruby 1.8.2 (2004-12-25) with sys-proctable-0.6.4.
Has anyone else seen this?
Hm...I don't have access to a Linux box at the moment, but I've run it
on different flavors of Linux without problem in the past.
Is RHEL 3.0 the 2.6.x kernel?
Bingo! That was it. That was the problem that I couldn't recall the
details of when I mentioned it to you a few weeks ago. 
RHEL 3.0 is a 2.4 kernel.
Kirk Haines
Dan,
Dan Urist's Proc::ProcessTable 0.39 seems to run fine for me. I just cut and paste the example on http://search.cpan.org/~durist/Proc-ProcessTable-0.39/ProcessTable.pm.
Thanks, BTW, for contributing win32utils--I am about to dig in there too.
Thanks again,
John-Mason P. Shackelford
John-Mason P. Shackelford wrote:
Dan,
Dan Urist's Proc::ProcessTable 0.39 seems to run fine for me. I just
cut
and paste the example on
http://search.cpan.org/~durist/Proc-ProcessTable-0.39/ProcessTable.pm\.
Thanks, BTW, for contributing win32utils--I am about to dig in there
too.
Thanks again,
John-Mason P. Shackelford
I can't duplicate this on my Suse install, but I have an idea. I think
the only difference between my version and Dan's is that I added an
'environ' struct member that contains a hash of key/value pairs based
on the environment of the process. So, I suspect that's where things
have gone wrong.
Do me a favor, and change this line (should be around line 157):
char key[64];
to this:
char key[256];
And see what happens. I wonder if you've got a process with an
environment variable greater than 64 characters. Anyway, I'll bet the
problem is somewhere in loop that tries to parse /proc/PID/environ.
Regards,
Dan