From mboxrd@z Thu Jan 1 00:00:00 1970 From: jeremie.galarneau@efficios.com (=?UTF-8?Q?J=C3=A9r=C3=A9mie_Galarneau?=) Date: Wed, 24 Jun 2015 00:03:12 +0200 Subject: [lttng-dev] lttng list -u return "Error: Command error" In-Reply-To: <---.GY------rzHGY$b39120f9-2664-4e5c-bb89-379e7494cb0d@aliyun.com> References: <---.GY------rzHGY$b39120f9-2664-4e5c-bb89-379e7494cb0d@aliyun.com> Message-ID: On Thu, Jun 4, 2015 at 5:00 AM, zhenyu.ren wrote: > Hi,dev-team > > 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[20]; /* Can't go bigger than /proc/65535/cmdline > */ > > > I think path[20] 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. commit fae9a062a468c47fc71ef7aa96374bf9d87d137e Author: J?r?mie Galarneau 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 Signed-off-by: J?r?mie Galarneau Thanks! J?r?mie > > Thanks > zhenyu.ren > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -- J?r?mie Galarneau EfficiOS Inc. http://www.efficios.com -------------- next part -------------- An HTML attachment was scrubbed... URL: