1tcgetpgrp(3C) Standard C Library Functions tcgetpgrp(3C)
2
3
4
6 tcgetpgrp - get foreground process group ID
7
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 pid_t tcgetpgrp(int fildes);
13
14
16 The tcgetpgrp() function will return the value of the process group ID
17 of the foreground process group associated with the terminal.
18
19
20 If there is no foreground process group, tcgetpgrp() returns a value
21 greater than 1 that does not match the process group ID of any existing
22 process group.
23
24
25 The tcgetpgrp() function is allowed from a process that is a member of
26 a background process group; however, the information may be subse‐
27 quently changed by a process that is a member of a foreground process
28 group.
29
31 Upon successful completion, tcgetpgrp() returns the value of the
32 process group ID of the foreground process associated with the termi‐
33 nal. Otherwise, −1 is returned and errno is set to indicate the error.
34
36 The tcgetpgrp() function will fail if:
37
38 EBADF The fildes argument is not a valid file descriptor.
39
40
41 ENOTTY The calling process does not have a controlling terminal, or
42 the file is not the controlling terminal.
43
44
46 See attributes(5) for descriptions of the following attributes:
47
48
49
50
51 ┌─────────────────────────────┬───────────────────────────────┐
52 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
53 ├─────────────────────────────┼───────────────────────────────┤
54 │Interface Stability │Standard │
55 ├─────────────────────────────┼───────────────────────────────┤
56 │MT-Level │MT-Safe, and Async-Signal-Safe │
57 └─────────────────────────────┴───────────────────────────────┘
58
60 setpgid(2), setsid(2), tcsetpgrp(3C), attributes(5), standards(5),
61 termio(7I)
62
63
64
65SunOS 5.11 14 Aug 2002 tcgetpgrp(3C)