Truncated thread names in pstree

Mike Frysinger vapier at gentoo.org
Tue Jun 4 03:30:01 UTC 2013


On Sunday 02 June 2013 14:46:13 Dag Wieers wrote:
> BTW I don't see why we do COMM_LEN + 1 in the non-threaded name. Isn't the
> process name always limited to 15 characters (plus null-termination) ?

yes, the kernel currently does this:
linux/fs/exec.c:
	setup_new_exec(): set_task_comm(current, bprm->tcomm);
	set_task_comm(): strlcpy(tsk->comm, buf, sizeof(tsk->comm));

but the kernel writes out 16 bytes in the proc name:
linux/fs/proc/base.c:
	REG("comm",      S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
	proc_pid_set_comm_operations{}.open: comm_open()
	comm_open(): single_open(filp, comm_show, inode);
	comm_show(): seq_printf(m, "%s\n", p->comm);

i think this is just us coding defensively.  or not.  who knows :).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130603/b49f1827/attachment.asc>


More information about the busybox mailing list