ps中进程名称中冒号后的文本是什么

时间:2014-01-02 16:27:45

标签: linux

下面ps列表中进程名称中的冒号后面的文本是什么?我知道文本意味着什么,但我正在寻找在流程中指定文本的位置。

6965 ?        Ss     0:00 nginx: master process nginx
8213 ?        S      0:01  \_ nginx: worker process
8214 ?        S      0:01  \_ nginx: worker process
8215 ?        S      0:01  \_ nginx: worker process
8216 ?        S      0:00  \_ nginx: worker process

1 个答案:

答案 0 :(得分:1)

请查看prctl,PR_SET_NAME是您正在寻找的正确的系统调用。

从该页面复制:

   PR_SET_NAME (since Linux 2.6.9)
          Set the name of the calling thread, using the value in the
          location pointed to by (char *) arg2.  The name can be up to
          16 bytes long, and should be null-terminated if it contains
          fewer bytes.  This is the same attribute that can be set via
          pthread_setname_np(3) and retrieved using
          pthread_getname_np(3).  The attribute is likewise accessible
          via /proc/self/task/[tid]/comm, where tid is the name of the
          calling thread.