1explain_ptrace_or_die(3) Library Functions Manual explain_ptrace_or_die(3)
2
3
4
6 explain_ptrace_or_die - process trace and report errors
7
9 #include <libexplain/ptrace.h>
10 long explain_ptrace_or_die(int request, pid_t pid, void *addr, void
11 *data);
12 long explain_ptrace_on_error(int request, pid_t pid, void *addr, void
13 *data);
14
16 The explain_ptrace_or_die function is used to call the ptrace(2) system
17 call. On failure an explanation will be printed to stderr, obtained
18 from the explain_ptrace(3) function, and then the process terminates by
19 calling exit(EXIT_FAILURE).
20
21 The explain_ptrace_on_error function is used to call the ptrace(2) sys‐
22 tem call. On failure an explanation will be printed to stderr, obtained
23 from the explain_ptrace(3) function, but still returns to the caller.
24
25 request The request, exactly as to be passed to the ptrace(2) system
26 call.
27
28 pid The pid, exactly as to be passed to the ptrace(2) system call.
29
30 addr The addr, exactly as to be passed to the ptrace(2) system call.
31
32 data The data, exactly as to be passed to the ptrace(2) system call.
33
35 The explain_ptrace_or_die function only returns on success, see
36 ptrace(2) for more information. On failure, prints an explanation and
37 exits, it does not return.
38
39 The explain_ptrace_on_error function always returns the value return by
40 the wrapped ptrace(2) system call.
41
43 The explain_ptrace_or_die function is intended to be used in a fashion
44 similar to the following example:
45 long result = explain_ptrace_or_die(request, pid, addr, data);
46
48 ptrace(2)
49 process trace
50
51 explain_ptrace(3)
52 explain ptrace(2) errors
53
54 exit(2) terminate the calling process
55
57 libexplain version 1.4
58 Copyright (C) 2010 Peter Miller
59
60
61
62 explain_ptrace_or_die(3)