Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools lib traceevent: Man page for host endian APIs

Create man pages for libtraceevent APIs:

tep_is_bigendian(),
tep_is_local_bigendian(),
tep_set_local_bigendian()

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/linux-trace-devel/20190503091119.23399-8-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190510200107.063709363@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov and committed by
Arnaldo Carvalho de Melo
802e985e 9571f737

+104
+104
tools/lib/traceevent/Documentation/libtraceevent-host_endian.txt
··· 1 + libtraceevent(3) 2 + ================ 3 + 4 + NAME 5 + ---- 6 + tep_is_bigendian, tep_is_local_bigendian, tep_set_local_bigendian - Get / set 7 + the endianness of the local machine. 8 + 9 + SYNOPSIS 10 + -------- 11 + [verse] 12 + -- 13 + *#include <event-parse.h>* 14 + 15 + enum *tep_endian* { 16 + TEP_LITTLE_ENDIAN = 0, 17 + TEP_BIG_ENDIAN 18 + }; 19 + 20 + int *tep_is_bigendian*(void); 21 + bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_); 22 + void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 23 + -- 24 + 25 + DESCRIPTION 26 + ----------- 27 + 28 + The _tep_is_bigendian()_ gets the endianness of the machine, executing 29 + the function. 30 + 31 + The _tep_is_local_bigendian()_ function gets the endianness of the local 32 + machine, saved in the _tep_ handler. The _tep_ argument is the trace event 33 + parser context. This API is a bit faster than _tep_is_bigendian()_, as it 34 + returns cached endianness of the local machine instead of checking it each time. 35 + 36 + The _tep_set_local_bigendian()_ function sets the endianness of the local 37 + machine in the _tep_ handler. The _tep_ argument is trace event parser context. 38 + The _endian_ argument is the endianness: 39 + [verse] 40 + -- 41 + _TEP_LITTLE_ENDIAN_ - the machine is little endian, 42 + _TEP_BIG_ENDIAN_ - the machine is big endian. 43 + -- 44 + 45 + RETURN VALUE 46 + ------------ 47 + The _tep_is_bigendian()_ function returns non zero if the endianness of the 48 + machine, executing the code, is big endian and zero otherwise. 49 + 50 + The _tep_is_local_bigendian()_ function returns true, if the endianness of the 51 + local machine, saved in the _tep_ handler, is big endian, or false otherwise. 52 + 53 + EXAMPLE 54 + ------- 55 + [source,c] 56 + -- 57 + #include <event-parse.h> 58 + ... 59 + struct tep_handle *tep = tep_alloc(); 60 + ... 61 + if (tep_is_bigendian()) 62 + tep_set_local_bigendian(tep, TEP_BIG_ENDIAN); 63 + else 64 + tep_set_local_bigendian(tep, TEP_LITTLE_ENDIAN); 65 + ... 66 + if (tep_is_local_bigendian(tep)) 67 + printf("This machine you are running on is bigendian\n"); 68 + else 69 + printf("This machine you are running on is little endian\n"); 70 + 71 + -- 72 + 73 + FILES 74 + ----- 75 + [verse] 76 + -- 77 + *event-parse.h* 78 + Header file to include in order to have access to the library APIs. 79 + *-ltraceevent* 80 + Linker switch to add when building a program that uses the library. 81 + -- 82 + 83 + SEE ALSO 84 + -------- 85 + _libtraceevent(3)_, _trace-cmd(1)_ 86 + 87 + AUTHOR 88 + ------ 89 + [verse] 90 + -- 91 + *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 92 + *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 93 + -- 94 + REPORTING BUGS 95 + -------------- 96 + Report bugs to <linux-trace-devel@vger.kernel.org> 97 + 98 + LICENSE 99 + ------- 100 + libtraceevent is Free Software licensed under the GNU LGPL 2.1 101 + 102 + RESOURCES 103 + --------- 104 + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git