xref: /aosp_15_r20/external/libtraceevent/Documentation/libtraceevent-strerror.txt (revision 436bf2bcd5202612ffffe471bbcc1f277cc8d28e)
1*436bf2bcSAndroid Build Coastguard Workerlibtraceevent(3)
2*436bf2bcSAndroid Build Coastguard Worker================
3*436bf2bcSAndroid Build Coastguard Worker
4*436bf2bcSAndroid Build Coastguard WorkerNAME
5*436bf2bcSAndroid Build Coastguard Worker----
6*436bf2bcSAndroid Build Coastguard Workertep_strerror - Returns a string describing regular errno and tep error number.
7*436bf2bcSAndroid Build Coastguard Worker
8*436bf2bcSAndroid Build Coastguard WorkerSYNOPSIS
9*436bf2bcSAndroid Build Coastguard Worker--------
10*436bf2bcSAndroid Build Coastguard Worker[verse]
11*436bf2bcSAndroid Build Coastguard Worker--
12*436bf2bcSAndroid Build Coastguard Worker*#include <event-parse.h>*
13*436bf2bcSAndroid Build Coastguard Worker
14*436bf2bcSAndroid Build Coastguard Workerint *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_);
15*436bf2bcSAndroid Build Coastguard Worker
16*436bf2bcSAndroid Build Coastguard Worker--
17*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION
18*436bf2bcSAndroid Build Coastguard Worker-----------
19*436bf2bcSAndroid Build Coastguard WorkerThe *tep_strerror()* function converts tep error number into a human
20*436bf2bcSAndroid Build Coastguard Workerreadable string.
21*436bf2bcSAndroid Build Coastguard WorkerThe _tep_ argument is trace event parser context. The _errnum_ is a regular
22*436bf2bcSAndroid Build Coastguard Workererrno, defined in errno.h, or a tep error number. The string, describing this
23*436bf2bcSAndroid Build Coastguard Workererror number is copied in the _buf_ argument. The _buflen_ argument is
24*436bf2bcSAndroid Build Coastguard Workerthe size of the _buf_.
25*436bf2bcSAndroid Build Coastguard Worker
26*436bf2bcSAndroid Build Coastguard WorkerIt as a thread safe wrapper around strerror_r(). The library function has two
27*436bf2bcSAndroid Build Coastguard Workerdifferent behaviors - POSIX and GNU specific. The *tep_strerror()* API always
28*436bf2bcSAndroid Build Coastguard Workerbehaves as the POSIX version - the error string is copied in the user supplied
29*436bf2bcSAndroid Build Coastguard Workerbuffer.
30*436bf2bcSAndroid Build Coastguard Worker
31*436bf2bcSAndroid Build Coastguard WorkerRETURN VALUE
32*436bf2bcSAndroid Build Coastguard Worker------------
33*436bf2bcSAndroid Build Coastguard WorkerThe *tep_strerror()* function returns 0, if a valid _errnum_ is passed and the
34*436bf2bcSAndroid Build Coastguard Workerstring is copied into _buf_. If _errnum_ is not a valid error number,
35*436bf2bcSAndroid Build Coastguard Worker-1 is returned and _buf_ is not modified.
36*436bf2bcSAndroid Build Coastguard Worker
37*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE
38*436bf2bcSAndroid Build Coastguard Worker-------
39*436bf2bcSAndroid Build Coastguard Worker[source,c]
40*436bf2bcSAndroid Build Coastguard Worker--
41*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h>
42*436bf2bcSAndroid Build Coastguard Worker...
43*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc();
44*436bf2bcSAndroid Build Coastguard Worker...
45*436bf2bcSAndroid Build Coastguard Workerchar buf[32];
46*436bf2bcSAndroid Build Coastguard Workerchar *pool = calloc(1, 128);
47*436bf2bcSAndroid Build Coastguard Workerif (tep == NULL) {
48*436bf2bcSAndroid Build Coastguard Worker	tep_strerror(tep, TEP_ERRNO__MEM_ALLOC_FAILED, buf, 32);
49*436bf2bcSAndroid Build Coastguard Worker	printf ("The pool is not initialized, %s", buf);
50*436bf2bcSAndroid Build Coastguard Worker}
51*436bf2bcSAndroid Build Coastguard Worker...
52*436bf2bcSAndroid Build Coastguard Worker--
53*436bf2bcSAndroid Build Coastguard Worker
54*436bf2bcSAndroid Build Coastguard WorkerFILES
55*436bf2bcSAndroid Build Coastguard Worker-----
56*436bf2bcSAndroid Build Coastguard Worker[verse]
57*436bf2bcSAndroid Build Coastguard Worker--
58*436bf2bcSAndroid Build Coastguard Worker*event-parse.h*
59*436bf2bcSAndroid Build Coastguard Worker	Header file to include in order to have access to the library APIs.
60*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent*
61*436bf2bcSAndroid Build Coastguard Worker	Linker switch to add when building a program that uses the library.
62*436bf2bcSAndroid Build Coastguard Worker--
63*436bf2bcSAndroid Build Coastguard Worker
64*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO
65*436bf2bcSAndroid Build Coastguard Worker--------
66*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1)
67*436bf2bcSAndroid Build Coastguard Worker
68*436bf2bcSAndroid Build Coastguard WorkerAUTHOR
69*436bf2bcSAndroid Build Coastguard Worker------
70*436bf2bcSAndroid Build Coastguard Worker[verse]
71*436bf2bcSAndroid Build Coastguard Worker--
72*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*.
73*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page.
74*436bf2bcSAndroid Build Coastguard Worker--
75*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS
76*436bf2bcSAndroid Build Coastguard Worker--------------
77*436bf2bcSAndroid Build Coastguard WorkerReport bugs to  <[email protected]>
78*436bf2bcSAndroid Build Coastguard Worker
79*436bf2bcSAndroid Build Coastguard WorkerLICENSE
80*436bf2bcSAndroid Build Coastguard Worker-------
81*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1
82*436bf2bcSAndroid Build Coastguard Worker
83*436bf2bcSAndroid Build Coastguard WorkerRESOURCES
84*436bf2bcSAndroid Build Coastguard Worker---------
85*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
86