1libtraceevent(3)
2================
3
4NAME
5----
6tep_is_bigendian, tep_is_local_bigendian, tep_set_local_bigendian - Get / set
7the endianness of the local machine.
8
9SYNOPSIS
10--------
11[verse]
12--
13*#include <event-parse.h>*
14
15enum *tep_endian* {
16	TEP_LITTLE_ENDIAN = 0,
17	TEP_BIG_ENDIAN
18};
19
20int *tep_is_bigendian*(void);
21bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_);
22void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_);
23--
24
25DESCRIPTION
26-----------
27
28The _tep_is_bigendian()_ gets the endianness of the machine, executing
29the function.
30
31The _tep_is_local_bigendian()_ function gets the endianness of the local
32machine, saved in the _tep_ handler. The _tep_ argument is the trace event
33parser context. This API is a bit faster than _tep_is_bigendian()_, as it
34returns cached endianness of the local machine instead of checking it each time.
35
36The _tep_set_local_bigendian()_ function sets the endianness of the local
37machine in the _tep_ handler. The _tep_ argument is trace event parser context.
38The _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
45RETURN VALUE
46------------
47The _tep_is_bigendian()_ function returns non zero if the endianness of the
48machine, executing the code, is big endian and zero otherwise.
49
50The _tep_is_local_bigendian()_ function returns true, if the endianness of the
51local machine, saved in the _tep_ handler, is big endian, or false otherwise.
52
53EXAMPLE
54-------
55[source,c]
56--
57#include <event-parse.h>
58...
59struct 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
73FILES
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
83SEE ALSO
84--------
85_libtraceevent(3)_, _trace-cmd(1)_
86
87AUTHOR
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--
94REPORTING BUGS
95--------------
96Report bugs to  <linux-trace-devel@vger.kernel.org>
97
98LICENSE
99-------
100libtraceevent is Free Software licensed under the GNU LGPL 2.1
101
102RESOURCES
103---------
104https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
105