Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / tools / lib / traceevent / Documentation / libtraceevent-strerror.txt
1 libtraceevent(3)
2 ================
3
4 NAME
5 ----
6 tep_strerror - Returns a string describing regular errno and tep error number.
7
8 SYNOPSIS
9 --------
10 [verse]
11 --
12 *#include <event-parse.h>*
13
14 int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_);
15
16 --
17 DESCRIPTION
18 -----------
19 The _tep_strerror()_ function converts tep error number into a human
20 readable string.
21 The _tep_ argument is trace event parser context. The _errnum_ is a regular
22 errno, defined in errno.h, or a tep error number. The string, describing this
23 error number is copied in the _buf_ argument. The _buflen_ argument is
24 the size of the _buf_.
25
26 It as a thread safe wrapper around strerror_r(). The library function has two
27 different behaviors - POSIX and GNU specific. The _tep_strerror()_ API always
28 behaves as the POSIX version - the error string is copied in the user supplied
29 buffer.
30
31 RETURN VALUE
32 ------------
33 The _tep_strerror()_ function returns 0, if a valid _errnum_ is passed and the
34 string is copied into _buf_. If _errnum_ is not a valid error number,
35 -1 is returned and _buf_ is not modified.
36
37 EXAMPLE
38 -------
39 [source,c]
40 --
41 #include <event-parse.h>
42 ...
43 struct tep_handle *tep = tep_alloc();
44 ...
45 char buf[32];
46 char *pool = calloc(1, 128);
47 if (tep == NULL) {
48         tep_strerror(tep, TEP_ERRNO__MEM_ALLOC_FAILED, buf, 32);
49         printf ("The pool is not initialized, %s", buf);
50 }
51 ...
52 --
53
54 FILES
55 -----
56 [verse]
57 --
58 *event-parse.h*
59         Header file to include in order to have access to the library APIs.
60 *-ltraceevent*
61         Linker switch to add when building a program that uses the library.
62 --
63
64 SEE ALSO
65 --------
66 _libtraceevent(3)_, _trace-cmd(1)_
67
68 AUTHOR
69 ------
70 [verse]
71 --
72 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
73 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
74 --
75 REPORTING BUGS
76 --------------
77 Report bugs to  <linux-trace-devel@vger.kernel.org>
78
79 LICENSE
80 -------
81 libtraceevent is Free Software licensed under the GNU LGPL 2.1
82
83 RESOURCES
84 ---------
85 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git