peschkaj has asked for the wisdom of the Perl Monks concerning the following question:

I am using Proc::ProcessTable to act as ps -ef remotely via a socket server. However, when I access the hash key that contains the command( $p->{cmd} ), I notice that it is being truncated at a certain length (which I could not tell you off the top of my head). Is there a way to adjust the size of the buffer that holds the values?

If you make something idiot-proof, eventually someone will make a better idiot.
I am that better idiot.

Replies are listed 'Best First'.
Re: Proc::ProcessTable method questions
by converter (Priest) on Nov 07, 2002 at 07:51 UTC

    It's difficult to answer your query without looking at your code. Maybe you're making an invalid assumption and truncating the command line string without realizing it.

    If you want to see how the process data are gathered look at the C source and headers in the /os directory of the source tree (Proc-ProcessTable-0.35/os/). On linux the process data are gathered from the /proc filesystem, which is the same method used by the ps util. On other OSs where the /proc filesystem isn't supported there are different methods for gathering process data, but all of the methods used should probably return the complete command line string.

Re: Proc::ProcessTable method questions
by BazB (Priest) on Nov 07, 2002 at 12:51 UTC

    What platform are you running on?

    On Solaris the length of the cmdline field stored by the OS is 80 characters - it's a limitation of Solaris (certainly as of 5.8/Solaris 8).
    This is documented in Proc::ProcessTable's README.solaris.
    Proc::ProcessTable can only give you as much as the OS is willing to give.

    Read the README.OS file(s) that come with the module.

    Cheers.

    BazB.

      I think I may be hitting that 80 character limit on HP-UX 11.00. The README.hpux is pretty worthless, it just lists the supported commands. I'm going to go with that assumption and try to figure out a way around it.

      If you make something idiot-proof, eventually someone will make a better idiot.
      I am that better idiot.
Re: Proc::ProcessTable method questions
by peschkaj (Pilgrim) on Nov 07, 2002 at 02:02 UTC
    It's not actually making use of PS. To be quite honest, i'm not sure at all how Proc::ProcessTable works.

    If you make something idiot-proof, eventually someone will make a better idiot.
    I am that better idiot.
Re: Proc::ProcessTable method questions
by Aristotle (Chancellor) on Nov 06, 2002 at 20:26 UTC
    I'm unsure about the specifics of Proc::ProcessTable, but if it's using ps(1), you should pass the w switch.

    Makeshifts last the longest.