Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

djberg96 (2603)

djberg96
  (email not shown publicly)

Journal of djberg96 (2603)

Sunday June 30, 2002
08:38 PM

Sys::ProcTable

[ #6085 ]
The Ruby port of Proc::ProcessTable is coming along, and I'm already getting some good tips from Mike Hall, who apparently wrote an interface for the /proc info for a web app at some point.

Having started with Linux, I have already reached the conclusion, as did Mike earlier, that this system of laying out kernel information in flat files is DUMB. Solaris is usually a bigger headache, but on this particular issue they got it right by using the psinfo struct and a library provided for your convenience. To top it off, it appears that the layout changed between kernel 2.2. and 2.4. Lovely. Well, I'm developing on a 2.4 kernel, so upgrade or suffer, 'cuz I ain't dealing with it.

One issue where I've decided to part with Dan Urist's approach has to do with constructors. With Dan's module you actually create an object, where all the /proc data is stuffed into that object. Although convenient (and probably satisfactory for most people most of the time, including me), the problem with this approach is that the second after you create the object, your information is already out of date.

Given that, I'm doing a couple things different. First, if you just want to loop through /proc, it will be a class method. There will be no object instantiation. It's a waste of memory. Second, I'm going to offer a method that allows you to query a specific pid, and thus get the info for that pid *at the moment of the call*, instead of recalling earlier information.

On to the code...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.