1explain_getpgrp_or_die(3) Library Functions Manual explain_getpgrp_or_die(3)
2
3
4
6 explain_getpgrp_or_die - get process group and report errors
7
9 #include <libexplain/getpgrp.h>
10 pid_t explain_getpgrp_or_die(pid_t pid);
11 pid_t explain_getpgrp_on_error(pid_t pid);
12
14 The explain_getpgrp_or_die function is used to call the getpgrp(2) sys‐
15 tem call. On failure an explanation will be printed to stderr, obtained
16 from the explain_getpgrp(3) function, and then the process terminates
17 by calling exit(EXIT_FAILURE).
18
19 The explain_getpgrp_on_error function is used to call the getpgrp(2)
20 system call. On failure an explanation will be printed to stderr,
21 obtained from the explain_getpgrp(3) function, but still returns to the
22 caller.
23
24 pid The pid, exactly as to be passed to the getpgrp(2) system call.
25
26 API Inconsistencies
27 Note: the getpgrp(2) function has two implementations. The POSIX.1
28 version has no arguments, while the BSD version has one argument. For
29 simplicity of implementation, the argument list seen here includes the
30 pid argument.
31
32 The POSIX.1 getpgid() semanatics can be obtained by calling getpgrp(0)
33 on BSD systems, and this is the API for libexplain, even on systems
34 that do not use the BSD API.
35
37 The explain_getpgrp_or_die function only returns on success, see getp‐
38 grp(2) for more information. On failure, prints an explanation and
39 exits, it does not return.
40
41 The explain_getpgrp_on_error function always returns the value return
42 by the wrapped getpgrp(2) system call.
43
45 The explain_getpgrp_or_die function is intended to be used in a fashion
46 similar to the following example:
47 pid_t result = explain_getpgrp_or_die(pid);
48
50 getpgrp(2)
51 get process group
52
53 explain_getpgrp(3)
54 explain getpgrp(2) errors
55
56 exit(2) terminate the calling process
57
59 libexplain version 1.4
60 Copyright (C) 2011 Peter Miller
61
62
63
64 explain_getpgrp_or_die(3)