1GETPGID(3P) POSIX Programmer's Manual GETPGID(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 getpgid — get the process group ID for a process
13
15 #include <unistd.h>
16
17 pid_t getpgid(pid_t pid);
18
20 The getpgid() function shall return the process group ID of the process
21 whose process ID is equal to pid. If pid is equal to 0, getpgid()
22 shall return the process group ID of the calling process.
23
25 Upon successful completion, getpgid() shall return a process group ID.
26 Otherwise, it shall return (pid_t)-1 and set errno to indicate the
27 error.
28
30 The getpgid() function shall fail if:
31
32 EPERM The process whose process ID is equal to pid is not in the same
33 session as the calling process, and the implementation does not
34 allow access to the process group ID of that process from the
35 calling process.
36
37 ESRCH There is no process with a process ID equal to pid.
38
39 The getpgid() function may fail if:
40
41 EINVAL The value of the pid argument is invalid.
42
43 The following sections are informative.
44
46 None.
47
49 None.
50
52 None.
53
55 None.
56
58 exec, fork(), getpgrp(), getpid(), getsid(), setpgid(), setsid()
59
60 The Base Definitions volume of POSIX.1‐2017, <unistd.h>
61
63 Portions of this text are reprinted and reproduced in electronic form
64 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
65 table Operating System Interface (POSIX), The Open Group Base Specifi‐
66 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
67 Electrical and Electronics Engineers, Inc and The Open Group. In the
68 event of any discrepancy between this version and the original IEEE and
69 The Open Group Standard, the original IEEE and The Open Group Standard
70 is the referee document. The original Standard can be obtained online
71 at http://www.opengroup.org/unix/online.html .
72
73 Any typographical or formatting errors that appear in this page are
74 most likely to have been introduced during the conversion of the source
75 files to man page format. To report such errors, see https://www.ker‐
76 nel.org/doc/man-pages/reporting_bugs.html .
77
78
79
80IEEE/The Open Group 2017 GETPGID(3P)