logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

prctl - operations on a process or thread

Caveats

The prototype of the libc wrapper uses a variadic argument list. This makes it necessary to pass the arguments with the right width. When passing numeric constants, such as 0, use a suffix: 0L. Careless use of some prctl() operations can confuse the user-space run-time environment, so these operations should be used with care.

Description

prctl() manipulates various aspects of the behavior of the calling thread or process. prctl() is called with a first argument describing what to do, and further arguments with a significance depending on the first one. The first argument can be: PR_CAP_AMBIENTPR_CAPBSET_READPR_CAPBSET_DROPPR_SET_CHILD_SUBREAPERPR_GET_CHILD_SUBREAPERPR_SET_DUMPABLEPR_GET_DUMPABLEPR_SET_ENDIANPR_GET_ENDIANPR_SET_FP_MODEPR_GET_FP_MODEPR_SET_FPEMUPR_GET_FPEMUPR_SET_FPEXCPR_GET_FPEXCPR_SET_IO_FLUSHERPR_GET_IO_FLUSHERPR_SET_KEEPCAPSPR_GET_KEEPCAPSPR_MCE_KILLPR_MCE_KILL_GETPR_SET_MMPR_SET_VMAPR_MPX_ENABLE_MANAGEMENTPR_MPX_DISABLE_MANAGEMENTPR_SET_NAMEPR_GET_NAMEPR_SET_NO_NEW_PRIVSPR_GET_NO_NEW_PRIVSPR_PAC_RESET_KEYSPR_SET_PDEATHSIGPR_GET_PDEATHSIGPR_SET_PTRACERPR_SET_SECCOMPPR_GET_SECCOMPPR_SET_SECUREBITSPR_GET_SECUREBITSPR_GET_SPECULATION_CTRLPR_SET_SPECULATION_CTRLPR_SVE_SET_VLPR_SVE_GET_VLPR_SET_SYSCALL_USER_DISPATCHPR_SET_TAGGED_ADDR_CTRLPR_GET_TAGGED_ADDR_CTRLPR_TASK_PERF_EVENTS_DISABLEPR_TASK_PERF_EVENTS_ENABLEPR_SET_THP_DISABLEPR_GET_THP_DISABLEPR_GET_TID_ADDRESSPR_SET_TIMERSLACKPR_GET_TIMERSLACKPR_SET_TIMINGPR_GET_TIMINGPR_SET_TSCPR_GET_TSCPR_SET_UNALIGNPR_GET_UNALIGNPR_GET_AUXVPR_SET_MDWEPR_GET_MDWE

Errors

EINVAL The value of op is not recognized, or not supported on this system. EINVAL An unused argument is nonzero.

History

Linux 2.1.57, glibc 2.0.6

Library

Standard C library (libc, -lc)

Name

prctl - operations on a process or thread

Return Value

On success, a nonnegative value is returned. On error, -1 is returned, and errno is set to indicate the error.

See Also

signal(2), PR_CAP_AMBIENT(2const), PR_CAPBSET_READ(2const), PR_CAPBSET_DROP(2const), PR_SET_CHILD_SUBREAPER(2const), PR_GET_CHILD_SUBREAPER(2const), PR_SET_DUMPABLE(2const), PR_GET_DUMPABLE(2const), PR_SET_ENDIAN(2const), PR_GET_ENDIAN(2const), PR_SET_FP_MODE(2const), PR_GET_FP_MODE(2const), PR_SET_FPEMU(2const), PR_GET_FPEMU(2const), PR_SET_FPEXC(2const), PR_GET_FPEXC(2const), PR_SET_IO_FLUSHER(2const), PR_GET_IO_FLUSHER(2const), PR_SET_KEEPCAPS(2const), PR_GET_KEEPCAPS(2const), PR_MCE_KILL(2const), PR_MCE_KILL_GET(2const), PR_SET_MM(2const), PR_SET_VMA(2const), PR_MPX_ENABLE_MANAGEMENT(2const), PR_MPX_DISABLE_MANAGEMENT(2const), PR_SET_NAME(2const), PR_GET_NAME(2const), PR_SET_NO_NEW_PRIVS(2const), PR_GET_NO_NEW_PRIVS(2const), PR_PAC_RESET_KEYS(2const), PR_SET_PDEATHSIG(2const), PR_GET_PDEATHSIG(2const), PR_SET_PTRACER(2const), PR_SET_SECCOMP(2const), PR_GET_SECCOMP(2const), PR_SET_SECUREBITS(2const), PR_GET_SECUREBITS(2const), PR_SET_SPECULATION_CTRL(2const), PR_GET_SPECULATION_CTRL(2const), PR_SVE_SET_VL(2const), PR_SVE_GET_VL(2const), PR_SET_SYSCALL_USER_DISPATCH(2const), PR_SET_TAGGED_ADDR_CTRL(2const), PR_GET_TAGGED_ADDR_CTRL(2const), PR_TASK_PERF_EVENTS_DISABLE(2const), PR_TASK_PERF_EVENTS_ENABLE(2const), PR_SET_THP_DISABLE(2const), PR_GET_THP_DISABLE(2const), PR_GET_TID_ADDRESS(2const), PR_SET_TIMERSLACK(2const), PR_GET_TIMERSLACK(2const), PR_SET_TIMING(2const), PR_GET_TIMING(2const), PR_SET_TSC(2const), PR_GET_TSC(2const), PR_SET_UNALIGN(2const), PR_GET_UNALIGN(2const), PR_GET_AUXV(2const), PR_SET_MDWE(2const), PR_GET_MDWE(2const), core(5) Linux man-pages 6.9.1 2024-06-01 prctl(2)

Standards

Linux.

Synopsis

#include<linux/prctl.h> /* Definition of PR_* constants */ #include<sys/prctl.h>intprctl(intop,...);

Versions

IRIX has a prctl() system call (also introduced in Linux 2.1.44 as irix_prctl on the MIPS architecture), with prototype ptrdiff_tprctl(intop,intarg2,intarg3); and operations to get the maximum number of processes per user, get the maximum number of processors the calling process can use, find out whether a specified process is currently blocked, get or set the maximum stack size, and so on.

See Also