Commit | Line | Data |
---|---|---|
931b8415 CL |
1 | .\" Copyright (c) 1980, 1991 Regents of the University of California. |
2 | .\" All rights reserved. | |
3ebb09da | 3 | .\" |
931b8415 | 4 | .\" %sccs.include.redist.man% |
3ebb09da | 5 | .\" |
931b8415 CL |
6 | .\" @(#)setpgid.2 6.3 (Berkeley) %G% |
7 | .\" | |
8 | .Dd | |
9 | .Dt SETPGID 2 | |
10 | .Os BSD 4 | |
11 | .Sh NAME | |
12 | .Nm setpgid , | |
13 | .Nm setpgrp | |
14 | .Nd set process group | |
15 | .Sh SYNOPSIS | |
16 | .Fd #include <unistd.h> | |
17 | .Ft int | |
18 | .Fn setpgid pid_tpid pid_tpgrp | |
19 | .Ft int | |
20 | .Fn setpgrp pid_tpid pid_tpgrp | |
21 | .Sh DESCRIPTION | |
22 | .Fn Setpgid | |
3ebb09da | 23 | sets the process group of the specified process |
931b8415 | 24 | .Ar pid |
3ebb09da | 25 | to the specified |
931b8415 | 26 | .Ar pgrp . |
3ebb09da | 27 | If |
931b8415 | 28 | .Ar pid |
3ebb09da | 29 | is zero, then the call applies to the current process. |
931b8415 | 30 | .Pp |
3ebb09da KM |
31 | If the invoker is not the super-user, then the affected process |
32 | must have the same effective user-id as the invoker or be a descendant | |
33 | of the invoking process. | |
931b8415 CL |
34 | .Sh RETURN VALUES |
35 | .Fn Setpgid | |
76559d79 | 36 | returns 0 when the operation was successful. |
931b8415 CL |
37 | If the request failed, -1 is returned and the global variable |
38 | .Va errno | |
f4199a91 | 39 | indicates the reason. |
931b8415 CL |
40 | .Sh ERRORS |
41 | .Fn Setpgid | |
42 | will fail and the process group will not be altered if: | |
43 | .Bl -tag -width indent | |
44 | .It Bq Er ESRCH | |
f4199a91 | 45 | The requested process does not exist. |
931b8415 | 46 | .It Bq Er EPERM |
f4199a91 KM |
47 | The effective user ID of the requested process is different |
48 | from that of the caller and the process is not a descendent | |
49 | of the calling process. | |
931b8415 CL |
50 | .El |
51 | .Sh SEE ALSO | |
52 | .Xr getpgrp 2 | |
53 | .Sh STANDARDS | |
54 | .Fn Setpgid | |
55 | conforms to IEEE Std 1003.1-1988 | |
56 | .Pq Dq Tn POSIX . | |
57 | .Sh COMPATIBILITY | |
58 | .Fn Setpgrp | |
76559d79 | 59 | is identical to |
931b8415 | 60 | .Fn setpgid , |
76559d79 | 61 | and is retained for calling convention compatibility with historical |
931b8415 CL |
62 | versions of |
63 | .Bx . |