[lttng-dev] lttng list -u return "Error: Command error"
jeremie.galarneau at efficios.com
Tue Jun 23 18:03:12 EDT 2015
On Thu, Jun 4, 2015 at 5:00 AM, zhenyu.ren <zhenyu.ren at aliyun.com> wrote:
> As the subject is my problem. It seems that the function
> get_cmdline_by_pid() will fail if kernel.pid_max > 100000 (i.e. 131072)
> static char *get_cmdline_by_pid(pid_t pid)
> int ret;
> FILE *fp = NULL;
> char *cmdline = NULL;
> char path; /* Can't go bigger than /proc/65535/cmdline
> I think path is not big enough .Do you have any better idea?
Good catch! Sorry for the delay, traveling has caused me to fall behind on
e-mails... Catching up!
Based on PROC(5):
/proc/sys/kernel/pid_max (since Linux 2.5.34)
This file specifies the value at which PIDs wrap around
(i.e., the value in this file is one greater than the
maximum PID). PIDs greater than this value are not allo‐
cated; thus, the value in this file also acts as a sys‐
tem-wide limit on the total number of processes and
threads. The default value for this file, 32768, results
in the same range of PIDs as on earlier kernels. On
32-bit platforms, 32768 is the maximum value for pid_max.
On 64-bit systems, pid_max can be set to any value up to
2^22 (PID_MAX_LIMIT, approximately 4 million).
I have introduced a fix in master, stable-2.6 and stable-2.5.
Author: Jérémie Galarneau <jeremie.galarneau at efficios.com>
Date: Tue Jun 23 23:27:31 2015 +0200
Fix: get_cmdline_by_pid path length assumes a max pid of 65535
PROC(5) mentions that "On 64-bit systems, pid_max can be set to any
value up to 2^22 (PID_MAX_LIMIT, approximately 4 million)."
We use 32 bits for simplicity's sake.
Reported-by: Zhenyu Ren <zhenyu.ren at aliyun.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lttng-dev