1LIBTRACEEVENT(3)             libtraceevent Manual             LIBTRACEEVENT(3)
2
3
4

NAME

6       tep_is_bigendian, tep_is_local_bigendian, tep_set_local_bigendian - Get
7       / set the endianness of the local machine.
8

SYNOPSIS

10       #include <event-parse.h>
11
12       enum tep_endian {
13               TEP_LITTLE_ENDIAN = 0,
14               TEP_BIG_ENDIAN
15       };
16
17       int tep_is_bigendian(void);
18       bool tep_is_local_bigendian(struct tep_handle *tep);
19       void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian);
20

DESCRIPTION

22       The tep_is_bigendian() gets the endianness of the machine, executing
23       the function.
24
25       The tep_is_local_bigendian() function gets the endianness of the local
26       machine, saved in the tep handler. The tep argument is the trace event
27       parser context. This API is a bit faster than tep_is_bigendian(), as it
28       returns cached endianness of the local machine instead of checking it
29       each time.
30
31       The tep_set_local_bigendian() function sets the endianness of the local
32       machine in the tep handler. The tep argument is trace event parser
33       context. The endian argument is the endianness:
34
35                   TEP_LITTLE_ENDIAN - the machine is little endian,
36                   TEP_BIG_ENDIAN - the machine is big endian.
37

RETURN VALUE

39       The tep_is_bigendian() function returns non zero if the endianness of
40       the machine, executing the code, is big endian and zero otherwise.
41
42       The tep_is_local_bigendian() function returns true, if the endianness
43       of the local machine, saved in the tep handler, is big endian, or false
44       otherwise.
45

EXAMPLE

47           #include <event-parse.h>
48           ...
49           struct tep_handle *tep = tep_alloc();
50           ...
51                   if (tep_is_bigendian())
52                           tep_set_local_bigendian(tep, TEP_BIG_ENDIAN);
53                   else
54                           tep_set_local_bigendian(tep, TEP_LITTLE_ENDIAN);
55           ...
56                   if (tep_is_local_bigendian(tep))
57                           printf("This machine you are running on is bigendian\n");
58                   else
59                           printf("This machine you are running on is little endian\n");
60

FILES

62           event-parse.h
63                   Header file to include in order to have access to the library APIs.
64           -ltraceevent
65                   Linker switch to add when building a program that uses the library.
66

SEE ALSO

68       libtraceevent(3), trace-cmd(1)
69

AUTHOR

71           Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
72           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
73

REPORTING BUGS

75       Report bugs to <linux-trace-devel@vger.kernel.org[3]>
76

LICENSE

78       libtraceevent is Free Software licensed under the GNU LGPL 2.1
79

RESOURCES

81       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
82

NOTES

84        1. rostedt@goodmis.org
85           mailto:rostedt@goodmis.org
86
87        2. tz.stoyanov@gmail.com
88           mailto:tz.stoyanov@gmail.com
89
90        3. linux-trace-devel@vger.kernel.org
91           mailto:linux-trace-devel@vger.kernel.org
92
93
94
95libtraceevent 1.1.1               02/08/2021                  LIBTRACEEVENT(3)
Impressum