线程名称超过15个字符? [英] Thread name longer than 15 chars?

查看:97
本文介绍了线程名称超过15个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用诸如prctl或pthread_set_name_np之类的函数,可以更改线程的名称.至少在Linux 2.6.38中,这两个函数所施加的限制是该名称不能超过15个字符(NULL终止为第16个字节).

By using functions like prctl, or pthread_set_name_np it's possible to change the name of a thread. The limit both functions imposes, at least in Linux 2.6.38, is that the name cannot be longer than 15 characters (NULL termination being the 16th byte).

这15个字符的限制在哪里,是否有任何(甚至是非正统的)方法?

Where is this 15 character limit imposed, and is there any (even unorthodox) way around it?

更新 :

Update:

如评论中所述,这是由内核强加的.

As mentioned in the comments, this is imposed by the kernel.

定义可以在这里找到: http://lxr.linux.no/linux+v2 .6.37/include/linux/sched.h#L245

The definition can be found here: http://lxr.linux.no/linux+v2.6.37/include/linux/sched.h#L245

推荐答案

15个字符的限制由内核完成.

15-char limit is done by kernel.

struct task_struct :: comm [TASK_COMM_LEN],它是16字节宽.

struct task_struct::comm[TASK_COMM_LEN] which is 16-byte wide.

如果要增加内核,则必须重新编译内核.

You have to recompile kernel, if you want to increase that.

这篇关于线程名称超过15个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆