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.
severity 588249 wishlist
thanks
Hi
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
I agree with your assessment.. the behaviour certainly seems consistent with "ps": $ ps ax -o fname [...] udevd hald-add wpa_supp [...] It sounds like there's a bug in 'mon' in that case, it probably shouldn't be using "fname", or at least be expecting it to be truncated. The value returned by Proc::ProcessTable also includes "exec", the full path to the executable (available for root and the owner of the process). It may be better if mon used that, if possible. This would also avoid a process with the same filename (but different path) from matching erroneously.
# reassign to the 'mon' package reassign 588249 mon thanks Hi Dario too (Maintainer of mon). Chris thanks for commenting on it. Ok, then I just reassign this bugreport to the 'mon' package. Bests Salvatore
# reassign to the 'mon' package reassign 588249 mon thanks Hi Dario too (Maintainer of mon). Chris thanks for commenting on it. Ok, then I just reassign this bugreport to the 'mon' package. Bests Salvatore
Hi all, Thanks for spotting and investigate this issue. I've forwarded the bug long ago on upstream's bug report interface but no answer yet. :( I'll go deeper in this issue to see if can be solved soon. Regards and thanks again.