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)

Friday June 14, 2002
07:02 PM

Now *that* is a lot of C code

[ #5670 ]
I've been toying with the notion of creating a Ruby interface to the unix 'ps' command. Rather than reinvent the wheel, I decided to look at the source code for the Perl module Proc::ProcessTable to see what I could learn from it.

What did I discover? Dan Urist (the author) has put a *helluva* lot of effort into this module, especially considering that 'ps' just doesn't do that much (on the frontend, I mean). Much more effort than I originally thought. To be honest, I thought he was just parsing output using strictly Perl! There are a bunch of C source and header files, 2 each for 11 different platforms it looks like, plus the .xs and .pm files.

Hopefully, I'll be able to borrow a lot from his source code. I also now remember that his module requires Storable and File::Find, though I can't remember why now.

Thank you Dan Urist!

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.
  • Proc::ProcessTable is easily the most intricate, system-dependent C-based module I've ever seen. I'm scared to death to look to see how it works. It looks like he basically had to code everything for each platform supported. I remember when I first looked at the module there were a lot of platforms only partially working. It's come a long way, and works great now everytime I need it (on x86 Linux and Sparc Solaris; I should try it on ppc Linux now that I have the chance).

    I remember that the comp.unix.

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • Your idea about a libprocstat sounds very good. It might even be a way for all three communities to "get along" for a while. :)

      In the end, we had to ditch Proc::ProcessTable and parse output manually for our client-server app because of taint issues due to File::Find IIRC. Newer versions have an 'untaint' option, and I suggested that he allow this as an option in the constructor (where it would be passed to File::Find later) but he didn't seem to like that idea much.