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