tools lib traceevent: Provide le16toh define for older systems

Where such macro is not present, so just copy its definition from
glibc's endian.h and define it if not already.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/n/tip-4j90i2na07ppidt0z6cbuxr7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2015-05-14 12:28:11 -03:00
parent 4fd113b5ce
commit b390d85060
1 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,19 @@
#include <endian.h>
#include "event-parse.h"
/*
* From glibc endian.h, for older systems where it is not present, e.g.: RHEL5,
* Fedora6.
*/
#ifndef le16toh
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define le16toh(x) (x)
# else
# define le16toh(x) __bswap_16 (x)
# endif
#endif
static unsigned long long
process___le16_to_cpup(struct trace_seq *s, unsigned long long *args)
{