1*4882a593Smuzhiyunlibtraceevent(3) 2*4882a593Smuzhiyun================ 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunNAME 5*4882a593Smuzhiyun---- 6*4882a593Smuzhiyuntep_strerror - Returns a string describing regular errno and tep error number. 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunSYNOPSIS 9*4882a593Smuzhiyun-------- 10*4882a593Smuzhiyun[verse] 11*4882a593Smuzhiyun-- 12*4882a593Smuzhiyun*#include <event-parse.h>* 13*4882a593Smuzhiyun 14*4882a593Smuzhiyunint *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_); 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun-- 17*4882a593SmuzhiyunDESCRIPTION 18*4882a593Smuzhiyun----------- 19*4882a593SmuzhiyunThe _tep_strerror()_ function converts tep error number into a human 20*4882a593Smuzhiyunreadable string. 21*4882a593SmuzhiyunThe _tep_ argument is trace event parser context. The _errnum_ is a regular 22*4882a593Smuzhiyunerrno, defined in errno.h, or a tep error number. The string, describing this 23*4882a593Smuzhiyunerror number is copied in the _buf_ argument. The _buflen_ argument is 24*4882a593Smuzhiyunthe size of the _buf_. 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunIt as a thread safe wrapper around strerror_r(). The library function has two 27*4882a593Smuzhiyundifferent behaviors - POSIX and GNU specific. The _tep_strerror()_ API always 28*4882a593Smuzhiyunbehaves as the POSIX version - the error string is copied in the user supplied 29*4882a593Smuzhiyunbuffer. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunRETURN VALUE 32*4882a593Smuzhiyun------------ 33*4882a593SmuzhiyunThe _tep_strerror()_ function returns 0, if a valid _errnum_ is passed and the 34*4882a593Smuzhiyunstring is copied into _buf_. If _errnum_ is not a valid error number, 35*4882a593Smuzhiyun-1 is returned and _buf_ is not modified. 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunEXAMPLE 38*4882a593Smuzhiyun------- 39*4882a593Smuzhiyun[source,c] 40*4882a593Smuzhiyun-- 41*4882a593Smuzhiyun#include <event-parse.h> 42*4882a593Smuzhiyun... 43*4882a593Smuzhiyunstruct tep_handle *tep = tep_alloc(); 44*4882a593Smuzhiyun... 45*4882a593Smuzhiyunchar buf[32]; 46*4882a593Smuzhiyunchar *pool = calloc(1, 128); 47*4882a593Smuzhiyunif (tep == NULL) { 48*4882a593Smuzhiyun tep_strerror(tep, TEP_ERRNO__MEM_ALLOC_FAILED, buf, 32); 49*4882a593Smuzhiyun printf ("The pool is not initialized, %s", buf); 50*4882a593Smuzhiyun} 51*4882a593Smuzhiyun... 52*4882a593Smuzhiyun-- 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunFILES 55*4882a593Smuzhiyun----- 56*4882a593Smuzhiyun[verse] 57*4882a593Smuzhiyun-- 58*4882a593Smuzhiyun*event-parse.h* 59*4882a593Smuzhiyun Header file to include in order to have access to the library APIs. 60*4882a593Smuzhiyun*-ltraceevent* 61*4882a593Smuzhiyun Linker switch to add when building a program that uses the library. 62*4882a593Smuzhiyun-- 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunSEE ALSO 65*4882a593Smuzhiyun-------- 66*4882a593Smuzhiyun_libtraceevent(3)_, _trace-cmd(1)_ 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunAUTHOR 69*4882a593Smuzhiyun------ 70*4882a593Smuzhiyun[verse] 71*4882a593Smuzhiyun-- 72*4882a593Smuzhiyun*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 73*4882a593Smuzhiyun*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 74*4882a593Smuzhiyun-- 75*4882a593SmuzhiyunREPORTING BUGS 76*4882a593Smuzhiyun-------------- 77*4882a593SmuzhiyunReport bugs to <linux-trace-devel@vger.kernel.org> 78*4882a593Smuzhiyun 79*4882a593SmuzhiyunLICENSE 80*4882a593Smuzhiyun------- 81*4882a593Smuzhiyunlibtraceevent is Free Software licensed under the GNU LGPL 2.1 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunRESOURCES 84*4882a593Smuzhiyun--------- 85*4882a593Smuzhiyunhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 86