1*4882a593Smuzhiyunlibtraceevent(3) 2*4882a593Smuzhiyun================ 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunNAME 5*4882a593Smuzhiyun---- 6*4882a593Smuzhiyuntep_alloc, tep_free,tep_ref, tep_unref,tep_get_ref - Create, destroy, manage 7*4882a593Smuzhiyunreferences of trace event parser context. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunSYNOPSIS 10*4882a593Smuzhiyun-------- 11*4882a593Smuzhiyun[verse] 12*4882a593Smuzhiyun-- 13*4882a593Smuzhiyun*#include <event-parse.h>* 14*4882a593Smuzhiyun 15*4882a593Smuzhiyunstruct tep_handle pass:[*]*tep_alloc*(void); 16*4882a593Smuzhiyunvoid *tep_free*(struct tep_handle pass:[*]_tep_); 17*4882a593Smuzhiyunvoid *tep_ref*(struct tep_handle pass:[*]_tep_); 18*4882a593Smuzhiyunvoid *tep_unref*(struct tep_handle pass:[*]_tep_); 19*4882a593Smuzhiyunint *tep_get_ref*(struct tep_handle pass:[*]_tep_); 20*4882a593Smuzhiyun-- 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunDESCRIPTION 23*4882a593Smuzhiyun----------- 24*4882a593SmuzhiyunThese are the main functions to create and destroy tep_handle - the main 25*4882a593Smuzhiyunstructure, representing the trace event parser context. This context is used as 26*4882a593Smuzhiyunthe input parameter of most library APIs. 27*4882a593Smuzhiyun 28*4882a593SmuzhiyunThe _tep_alloc()_ function allocates and initializes the tep context. 29*4882a593Smuzhiyun 30*4882a593SmuzhiyunThe _tep_free()_ function will decrement the reference of the _tep_ handler. 31*4882a593SmuzhiyunWhen there is no more references, then it will free the handler, as well 32*4882a593Smuzhiyunas clean up all its resources that it had used. The argument _tep_ is 33*4882a593Smuzhiyunthe pointer to the trace event parser context. 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunThe _tep_ref()_ function adds a reference to the _tep_ handler. 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunThe _tep_unref()_ function removes a reference from the _tep_ handler. When 38*4882a593Smuzhiyunthe last reference is removed, the _tep_ is destroyed, and all resources that 39*4882a593Smuzhiyunit had used are cleaned up. 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunThe _tep_ref_get()_ functions gets the current references of the _tep_ handler. 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunRETURN VALUE 44*4882a593Smuzhiyun------------ 45*4882a593Smuzhiyun_tep_alloc()_ returns a pointer to a newly created tep_handle structure. 46*4882a593SmuzhiyunNULL is returned in case there is not enough free memory to allocate it. 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun_tep_ref_get()_ returns the current references of _tep_. 49*4882a593SmuzhiyunIf _tep_ is NULL, 0 is returned. 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunEXAMPLE 52*4882a593Smuzhiyun------- 53*4882a593Smuzhiyun[source,c] 54*4882a593Smuzhiyun-- 55*4882a593Smuzhiyun#include <event-parse.h> 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun... 58*4882a593Smuzhiyunstruct tep_handle *tep = tep_alloc(); 59*4882a593Smuzhiyun... 60*4882a593Smuzhiyunint ref = tep_get_ref(tep); 61*4882a593Smuzhiyuntep_ref(tep); 62*4882a593Smuzhiyunif ( (ref+1) != tep_get_ref(tep)) { 63*4882a593Smuzhiyun /* Something wrong happened, the counter is not incremented by 1 */ 64*4882a593Smuzhiyun} 65*4882a593Smuzhiyuntep_unref(tep); 66*4882a593Smuzhiyun... 67*4882a593Smuzhiyuntep_free(tep); 68*4882a593Smuzhiyun... 69*4882a593Smuzhiyun-- 70*4882a593SmuzhiyunFILES 71*4882a593Smuzhiyun----- 72*4882a593Smuzhiyun[verse] 73*4882a593Smuzhiyun-- 74*4882a593Smuzhiyun*event-parse.h* 75*4882a593Smuzhiyun Header file to include in order to have access to the library APIs. 76*4882a593Smuzhiyun*-ltraceevent* 77*4882a593Smuzhiyun Linker switch to add when building a program that uses the library. 78*4882a593Smuzhiyun-- 79*4882a593Smuzhiyun 80*4882a593SmuzhiyunSEE ALSO 81*4882a593Smuzhiyun-------- 82*4882a593Smuzhiyun_libtraceevent(3)_, _trace-cmd(1)_ 83*4882a593Smuzhiyun 84*4882a593SmuzhiyunAUTHOR 85*4882a593Smuzhiyun------ 86*4882a593Smuzhiyun[verse] 87*4882a593Smuzhiyun-- 88*4882a593Smuzhiyun*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 89*4882a593Smuzhiyun*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 90*4882a593Smuzhiyun-- 91*4882a593SmuzhiyunREPORTING BUGS 92*4882a593Smuzhiyun-------------- 93*4882a593SmuzhiyunReport bugs to <linux-trace-devel@vger.kernel.org> 94*4882a593Smuzhiyun 95*4882a593SmuzhiyunLICENSE 96*4882a593Smuzhiyun------- 97*4882a593Smuzhiyunlibtraceevent is Free Software licensed under the GNU LGPL 2.1 98*4882a593Smuzhiyun 99*4882a593SmuzhiyunRESOURCES 100*4882a593Smuzhiyun--------- 101*4882a593Smuzhiyunhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 102