<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 4, 2015 at 5:00 AM, zhenyu.ren <span dir="ltr"><<a href="mailto:zhenyu.ren@aliyun.com" target="_blank">zhenyu.ren@aliyun.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,dev-team<br>
<br>
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)<br>
<br>
static char *get_cmdline_by_pid(pid_t pid)<br>
{<br>
int ret;<br>
FILE *fp = NULL;<br>
char *cmdline = NULL;<br>
char path[20]; /* Can't go bigger than /proc/65535/cmdline */<br>
<br>
<br>
I think path[20] is not big enough .Do you have any better idea?<br></blockquote><div><br></div><div>Good catch! Sorry for the delay, traveling has caused me to fall behind on e-mails... Catching up!</div><div><br></div><div>Based on PROC(5):</div><div><br></div><div><div> /proc/sys/kernel/pid_max (since Linux 2.5.34)</div><div> This file specifies the value at which PIDs wrap around</div><div> (i.e., the value in this file is one greater than the</div><div> maximum PID). PIDs greater than this value are not allo‐</div><div> cated; thus, the value in this file also acts as a sys‐</div><div> tem-wide limit on the total number of processes and</div><div> threads. The default value for this file, 32768, results</div><div> in the same range of PIDs as on earlier kernels. On</div><div> 32-bit platforms, 32768 is the maximum value for pid_max.</div><div> On 64-bit systems, pid_max can be set to any value up to</div><div> 2^22 (PID_MAX_LIMIT, approximately 4 million).</div></div><div><br></div><div>I have introduced a fix in master, stable-2.6 and stable-2.5.</div><div><br></div><div><div>commit fae9a062a468c47fc71ef7aa96374bf9d87d137e</div><div>Author: Jérémie Galarneau <<a href="mailto:jeremie.galarneau@efficios.com">jeremie.galarneau@efficios.com</a>></div><div>Date: Tue Jun 23 23:27:31 2015 +0200</div><div><br></div><div> Fix: get_cmdline_by_pid path length assumes a max pid of 65535</div><div> </div><div> PROC(5) mentions that "On 64-bit systems, pid_max can be set to any</div><div> value up to 2^22 (PID_MAX_LIMIT, approximately 4 million)."</div><div> </div><div> We use 32 bits for simplicity's sake.</div><div> </div><div> Reported-by: Zhenyu Ren <<a href="mailto:zhenyu.ren@aliyun.com">zhenyu.ren@aliyun.com</a>></div><div> Signed-off-by: Jérémie Galarneau <<a href="mailto:jeremie.galarneau@efficios.com">jeremie.galarneau@efficios.com</a>></div></div><div><br></div><div><br></div><div>Thanks!<br></div><div>Jérémie</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Thanks<br>
zhenyu.ren<br>
<br>
_______________________________________________<br>
lttng-dev mailing list<br>
<a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br>
<a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Jérémie Galarneau<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></div>
</div></div>