1PRCTL(2)                   Linux Programmer's Manual                  PRCTL(2)
2
3
4

NAME

6       prctl - operations on a process
7

SYNOPSIS

9       #include <sys/prctl.h>
10
11       int prctl(int option, unsigned long arg2, unsigned long arg3 , unsigned
12       long arg4, unsigned long arg5);
13

DESCRIPTION

15       prctl() is called with a first argument describing  what  to  do  (with
16       values  defined in <linux/prctl.h>), and further parameters with a sig‐
17       nificance depending on the first one.  The first argument can be:
18
19       PR_SET_PDEATHSIG
20              (since Linux 2.1.57) Set the parent process death signal of  the
21              calling  process  to  arg2  (either  a signal value in the range
22              1..maxsig, or 0 to clear).  This is the signal that the  calling
23              process  will  get  when its parent dies.  This value is cleared
24              upon a fork().
25
26       PR_GET_PDEATHSIG
27              (Since Linux 2.3.15)  Read  the  current  value  of  the  parent
28              process death signal into the (int *) arg2.
29
30       PR_SET_DUMPABLE
31              (Since  Linux  2.3.20)  Set  the  state  of the flag determining
32              whether core dumps are produced for this process  upon  delivery
33              of  a  signal whose default behaviour is to produce a core dump.
34              (Normally this flag is set for a process by default, but  it  is
35              cleared  when  a set-user-ID or set-group-ID program is executed
36              and also by various system calls that  manipulate  process  UIDs
37              and  GIDs).  In kernels up to and including 2.6.12, arg2 must be
38              either 0 (process is not dumpable) or 1 (process  is  dumpable).
39              Between  kernels 2.6.13 and 2.6.17, the value 2 was also permit‐
40              ted, which caused any binary which normally would not be  dumped
41              to  be  dumped readable by root only; for security reasons, this
42              feature  has  been  removed.   (See  also  the  description   of
43              /proc/sys/fs/suid_dumpable in proc(5).)
44
45       PR_GET_DUMPABLE
46              (Since Linux 2.3.20) Return (as the function result) the current
47              state of the calling process's dumpable flag.
48
49       PR_SET_KEEPCAPS
50              (Since Linux 2.2.18) Set the state of the process's "keep  capa‐
51              bilities" flag, which determines whether the process's effective
52              and permitted capability sets are cleared when a change is  made
53              to  the  process's  user  IDs  such that the process's real UID,
54              effective UID, and saved set-user-ID all become non-zero when at
55              least  one  of  them  previously  had the value 0.  (By default,
56              these credential sets are  cleared).   arg2  must  be  either  0
57              (capabilities are cleared) or 1 (capabilities are kept).
58
59       PR_GET_KEEPCAPS
60              (Since Linux 2.2.18) Return (as the function result) the current
61              state of the calling process's "keep capabilities" flag.
62
63       PR_SET_TIMING
64              (Since Linux 2.6.0-test4) Set whether  to  use  (normal,  tradi‐
65              tional)  statistical  process timing or accurate timestamp based
66              process timing,  by  passing  PR_TIMING_STATISTICAL  or  PR_TIM‐
67              ING_TIMESTAMP to arg2.
68
69       PR_GET_TIMING
70              (Since  Linux 2.6.0-test4) Return (as the function result) which
71              process timing method is currently in use.
72
73       PR_SET_NAME
74              (Since Linux 2.6.9) Set the process name for the calling process
75              to arg2.
76
77       PR_GET_NAME
78              (Since  Linux  2.6.11)  Get  the  process  name  for the calling
79              process from arg2.
80
81       PR_GET_ENDIAN
82              (Since Linux 2.6.18, PowerPC only) Return the endian-ness of the
83              calling process.
84
85       PR_SET_ENDIAN
86              (Since  Linux  2.6.18,  PowerPC only) Set the endian-ness of the
87              calling process to the value given in arg2, which should be  one
88              of    the   following:   PR_ENDIAN_BIG,   PR_ENDIAN_LITTLE,   or
89              PR_ENDIAN_PPC_LITTLE (PowerPC pseudo little endian).
90
91       PR_SET_UNALIGN
92              (Since Linux 2.3.48, only on  parisc  and  ia64)  Set  unaligned
93              access control bits to arg2. Pass PR_UNALIGN_NOPRINT to silently
94              fix up unaligned user accesses, or PR_UNALIGN_SIGBUS to generate
95              SIGBUS on unaligned user access.
96
97       PR_GET_UNALIGN
98              (Since  Linux  2.3.48,  only  on  parisc and ia64) Get unaligned
99              access control bits from arg2.
100
101       PR_SET_FPEMU
102              (Since Linux 2.4.18, 2.5.9, only  on  ia64)  Set  floating-point
103              emulation  control  bits  to  arg2.   Pass  PR_FPEMU_NOPRINT  to
104              silently emulate fp operations accesses, or  PR_FPEMU_SIGFPE  to
105              not emulate fp operations and send SIGFPE instead.
106
107       PR_GET_FPEMU
108              (Since  Linux  2.4.18,  2.5.9,  only on ia64) Get floating-point
109              emulation control bits from arg2.
110
111       PR_SET_FPEXC
112              (Since Linux 2.4.21, 2.5.32, only on PowerPC) Set floating-point
113              exception  mode  to  arg2. Pass PR_FP_EXC_SW_ENABLE to use FPEXC
114              for FP  exception  enables,  PR_FP_EXC_DIV  for  floating  point
115              divide  by  zero,  PR_FP_EXC_OVF  for  floating  point overflow,
116              PR_FP_EXC_UND for floating point  underflow,  PR_FP_EXC_RES  for
117              floating  point inexact result, PR_FP_EXC_INV for floating point
118              invalid operation, PR_FP_EXC_DISABLED  for  FP  exceptions  dis‐
119              abled,  PR_FP_EXC_NONRECOV  for  async non-recoverable exception
120              mode, PR_FP_EXC_ASYNC  for  async  recoverable  exception  mode,
121              PR_FP_EXC_PRECISE for precise exception mode.
122
123       PR_GET_FPEXC
124              (Since Linux 2.4.21, 2.5.32, only on PowerPC) Get floating-point
125              exception mode from arg2.
126

RETURN VALUE

128       PR_GET_DUMPABLE and PR_GET_KEEPCAPS return 0  or  1  on  success.   All
129       other option values return 0 on success.  On error, -1 is returned, and
130       errno is set appropriately.
131

ERRORS

133       EINVAL The value of option is not recognized, or it is PR_SET_PDEATHSIG
134              and arg2 is not zero or a signal number.
135

CONFORMING TO

137       This  call  is  Linux  specific.   IRIX has a prctl() system call (also
138       introduced in Linux 2.1.44 as irix_prctl  on  the  MIPS  architecture),
139       with prototype
140
141       ptrdiff_t prctl(int option, int arg2, int arg3);
142
143       and  options  to  get the maximum number of processes per user, get the
144       maximum number of processors the calling  process  can  use,  find  out
145       whether  a specified process is currently blocked, get or set the maxi‐
146       mum stack size, etc.
147

AVAILABILITY

149       The prctl() system call was introduced in Linux 2.1.57.
150

SEE ALSO

152       signal(2), core(5)
153
154
155
156Linux 2.6.17                      2006-08-30                          PRCTL(2)
Impressum