【C】prctl

1、定义

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(int op, ...);

基本的线程、进程管理函数。第一个参数决定了进行什么样的操作。

2、具体操作

2.1 PR_SET_NAME, PR_GET_NAME

int prctl(PR_SET_NAME, char name[16]);
int prctl(PR_GET_NAME, const char name[16]);

设置\获取进程名。最大仅支持16字节(包含终止符),超过将截断。

posted @ 2024-07-25 16:07  NotReferenced  阅读(3)  评论(0编辑  收藏  举报