process control
#include <sys/prctl.h>
int prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5);
第一個引數決定要做什麼和定義後續引數怎麼用,可以是:
- PR_CAP_AMBIENT (Linux 4.3+)
- PR_CAPBSET_READ (Linux 2.6.25+)
- PR_CAPBSET_DROP (Linux 2.6.25+)
- PR_SET_CHILD_SUBREAPER (Linux 3.4+)
- PR_GET_CHILD_SUBREAPER (Linux 3.4+)
- PR_SET_DUMPABLE
- PR_GET_DUMPABLE
- PR_SET_KEEPCAPS
- PR_GET_KEEPCAPS
- PR_MCE_KILL (Linux 2.6.32+)
- PR_MCE_KILL_GET (Linux 2.6.32+)
- PR_SET_MM (Linux 3.3+)
- PR_MPX_ENABLE_MANAGEMENT, PR_MPX_DISABLE_MANAGEMENT (since Linux 3.19+)
- PR_SET_NAME (Linux 2.6.9+):設定自己 thread 名稱為 (char *)arg2,和 pthread_setname_np() 設定的、pthread_getname_np() 取得的屬性一樣,也可以透過 /proc/self/task/[tid]/comm 存取 (Linux 2.6.33+)。
- PR_GET_NAME (Linux 2.6.11+):在 (char *)arg2 給 buffer 供回傳 thread 名稱字串,buffer 應該要有 16-byte 空間。
- PR_SET_NO_NEW_PRIVS (Linux 3.5+)
- PR_GET_NO_NEW_PRIVS (Linux 3.5+)
- PR_SET_PDEATHSIG
- PR_GET_PDEATHSIG
- PR_SET_PTRACER (Linux 3.4+)
- PR_SET_SECCOMP (Linux 2.6.23+)
- PR_GET_SECCOMP (Linux 2.6.23+)
- PR_SET_SECUREBITS (Linux 2.6.26+)
- PR_GET_SECUREBITS (Linux 2.6.26+)
- PR_GET_SPECULATION_CTRL (Linux 4.17+)
- PR_SET_SPECULATION_CTRL (Linux 4.17+)
- PR_SET_THP_DISABLE (Linux 3.15+)
- PR_TASK_PERF_EVENTS_DISABLE (Linux 2.6.31+)
- PR_TASK_PERF_EVENTS_ENABLE (Linux 2.6.31+)
- PR_GET_THP_DISABLE (Linux 3.15+)
- PR_GET_TID_ADDRESS (Linux 3.5+)
- PR_SET_TIMERSLACK (Linux 2.6.28+)
- PR_GET_TIMERSLACK (Linux 2.6.28+)
- PR_SET_TIMING
- PR_GET_TIMING
- PR_SET_TSC (Linux 2.6.26+, x86 only)
- PR_GET_TSC (Linux 2.6.26+, x86 only)
- PR_SET_UNALIGN
- PR_GET_UNALIGN
參考:man prctl
沒有留言:
張貼留言