Back to home page

OSCL-LXR

 
 

    


0001 libtraceevent(3)
0002 ================
0003 
0004 NAME
0005 ----
0006 tep_is_bigendian, tep_is_local_bigendian, tep_set_local_bigendian - Get / set
0007 the endianness of the local machine.
0008 
0009 SYNOPSIS
0010 --------
0011 [verse]
0012 --
0013 *#include <event-parse.h>*
0014 
0015 enum *tep_endian* {
0016         TEP_LITTLE_ENDIAN = 0,
0017         TEP_BIG_ENDIAN
0018 };
0019 
0020 int *tep_is_bigendian*(void);
0021 bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_);
0022 void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_);
0023 --
0024 
0025 DESCRIPTION
0026 -----------
0027 
0028 The _tep_is_bigendian()_ gets the endianness of the machine, executing
0029 the function.
0030 
0031 The _tep_is_local_bigendian()_ function gets the endianness of the local
0032 machine, saved in the _tep_ handler. The _tep_ argument is the trace event
0033 parser context. This API is a bit faster than _tep_is_bigendian()_, as it
0034 returns cached endianness of the local machine instead of checking it each time.
0035 
0036 The _tep_set_local_bigendian()_ function sets the endianness of the local
0037 machine in the _tep_ handler. The _tep_ argument is trace event parser context.
0038 The _endian_ argument is the endianness:
0039 [verse]
0040 --
0041         _TEP_LITTLE_ENDIAN_ - the machine is little endian,
0042         _TEP_BIG_ENDIAN_ - the machine is big endian.
0043 --
0044 
0045 RETURN VALUE
0046 ------------
0047 The _tep_is_bigendian()_ function returns non zero if the endianness of the
0048 machine, executing the code, is big endian and zero otherwise.
0049 
0050 The _tep_is_local_bigendian()_ function returns true, if the endianness of the
0051 local machine, saved in the _tep_ handler, is big endian, or false otherwise.
0052 
0053 EXAMPLE
0054 -------
0055 [source,c]
0056 --
0057 #include <event-parse.h>
0058 ...
0059 struct tep_handle *tep = tep_alloc();
0060 ...
0061         if (tep_is_bigendian())
0062                 tep_set_local_bigendian(tep, TEP_BIG_ENDIAN);
0063         else
0064                 tep_set_local_bigendian(tep, TEP_LITTLE_ENDIAN);
0065 ...
0066         if (tep_is_local_bigendian(tep))
0067                 printf("This machine you are running on is bigendian\n");
0068         else
0069                 printf("This machine you are running on is little endian\n");
0070 
0071 --
0072 
0073 FILES
0074 -----
0075 [verse]
0076 --
0077 *event-parse.h*
0078         Header file to include in order to have access to the library APIs.
0079 *-ltraceevent*
0080         Linker switch to add when building a program that uses the library.
0081 --
0082 
0083 SEE ALSO
0084 --------
0085 _libtraceevent(3)_, _trace-cmd(1)_
0086 
0087 AUTHOR
0088 ------
0089 [verse]
0090 --
0091 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0092 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0093 --
0094 REPORTING BUGS
0095 --------------
0096 Report bugs to  <linux-trace-devel@vger.kernel.org>
0097 
0098 LICENSE
0099 -------
0100 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0101 
0102 RESOURCES
0103 ---------
0104 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git