Bug#588249: libproc-processtable-perl: length of fname field in ProcessTable is insufficient
Salvatore Bonaccorso
salvatore.bonaccorso at gmail.com
Wed Jul 7 07:52:31 UTC 2010
severity 588249 wishlist
thanks
Hi
On Tue, Jul 06, 2010 at 03:41:18PM +0200, J G Miller wrote:
> Package: libproc-processtable-perl
> Version: 0.45-1
> Severity: normal
>
> Whilst setting up mon (monitoring system) with the ps.monitor script
> which uses Proc::ProcessTable to get a list of the processes on the
> system, I discovered that processes with very long names are being
> truncated, thus causing a false alert in mon.
>
> Debugging the relevant part of the ps.monitor script --
>
> use Proc::ProcessTable;
>
> my $process_table = new Proc::ProcessTable('cache_ttys' => 0 );
>
> foreach $process ( @{$process_table->table} )
> {
> printf ("Examining ->%s<-\n", $process->cmndline);
> printf ("+++ Checking if ->%s<- is required\n\n", $process->fname);
> }
>
> reveals that process name in fname is truncated at 15 characters
>
> Examining ->transmission-daemon<-
> +++ Checking if ->transmission-da<- is required
>
> Thus it is evident that the width of fname should be increased
> from 16 to 24 if possible.
>
> Obviously in its current form, checking of process names greater
> than 15 characters will lead to false alarms in mon, and problems
> in other packages which use this functionality.
I think this is indeed not possible, but a comment from someone else
is appreciated to confirm that in case:
This seems to be a limitiation in linux itself, first in os/Linux.c we
have:
/* scan in pid, and the command, in linux the command is a max of 15 chars
* plus a terminating NULL byte; prs->comm will be NULL terminated since
* that area of memory is all zerored out when prs is allocated */
if (sscanf(stat_text, "%d (%15c", &prs->pid, prs->comm) != 2)
goto done;
In the Linux kernel itself, we have
include/linux/elfcore.h: char pr_fname[16]; /* filename of executable */
So probably there is no work around this if you use fname.
So as it is not really caused by fname in Proc::ProcessTable I think
this is more like a wishlist, as it is by 'limitation' in the linux
kernel.
Comments?
Bests
Salvatore
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20100707/93d594a2/attachment.pgp>
More information about the pkg-perl-maintainers
mailing list