/procのcmdlineとcomm

こういうのを書いて実行すると

#!/usr/bin/env perl
use strict;
use warnings;

$0="abcdefghijklmnopqrstuvwxyz";
my $cmdline = `cat /proc/$$/cmdline`;
my $comm    = `cat /proc/$$/comm`;


print "Cmdline\t: " . $cmdline . "\n";
print "Comm\t: " . $comm . "\n";

結果こうなる

Cmdline	: abcdefghijklmnopqrstuvwxyz
Comm	: abcdefghijklmno

※/proc/[pid]/commは/proc/[pid]/statに入っているcomm(スペース区切り2個目)と同じ

psとpstreeでみると
ps

1000     13535  0.0  0.0  19500  2260 pts/13   S+   11:24   0:00 abcdefghijklmnopqrstuvwxyz

pstree

  │   │   └─abcdefghijklmno,13535

見てるものが違う?

追記

psmiscのpstreeは/proc/[pid]/statのcommを見てるようでした

man proc

/proc/[pid]/cmdline
This holds the complete command line for the process, unless the process is a zombie. In the latter case, there is nothing in this file: that is, a read on this file will return 0 characters. The command-line arguments appear in this file as a set
of strings separated by null bytes ('\0'), with a further null byte after the last string.

comm %s The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out.