SF.net SVN: gar:[26419] csw/mgar/pkg/collectd/trunk

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Wed May 2 15:56:28 CEST 2018


Revision: 26419
          http://sourceforge.net/p/gar/code/26419
Author:   dmichelsen
Date:     2018-05-02 13:56:11 +0000 (Wed, 02 May 2018)
Log Message:
-----------
collectd/trunk: Update to 5.8.0

Modified Paths:
--------------
    csw/mgar/pkg/collectd/trunk/Makefile
    csw/mgar/pkg/collectd/trunk/checksums

Added Paths:
-----------
    csw/mgar/pkg/collectd/trunk/files/0003-Include-config.h-early-or-_FILE_OFFSET_BITS-is-wrong.patch
    csw/mgar/pkg/collectd/trunk/files/0071-Include-kstat.h-if-available-to-provide-kstat_ctl_t.patch
    csw/mgar/pkg/collectd/trunk/files/0076-Include-kstat.h-when-available.patch
    csw/mgar/pkg/collectd/trunk/files/0077-Add-fallback-for-endianess-conversion.patch

Modified: csw/mgar/pkg/collectd/trunk/Makefile
===================================================================
--- csw/mgar/pkg/collectd/trunk/Makefile	2018-05-02 12:53:01 UTC (rev 26418)
+++ csw/mgar/pkg/collectd/trunk/Makefile	2018-05-02 13:56:11 UTC (rev 26419)
@@ -1,7 +1,7 @@
 # $Id$
 #
 NAME = collectd
-VERSION = 5.7.1
+VERSION = 5.8.0
 GARTYPE = v2
 
 DESCRIPTION = Collects system performance statistics periodically
@@ -11,6 +11,11 @@
 DISTFILES += $(DISTNAME).tar.bz2
 DISTFILES += cswcollectd
 
+PATCHFILES += 0003-Include-config.h-early-or-_FILE_OFFSET_BITS-is-wrong.patch
+PATCHFILES += 0071-Include-kstat.h-if-available-to-provide-kstat_ctl_t.patch
+PATCHFILES += 0076-Include-kstat.h-when-available.patch
+PATCHFILES += 0077-Add-fallback-for-endianess-conversion.patch
+
 VENDOR_URL = http://collectd.org/
 
 # Lots of others missing
@@ -117,7 +122,7 @@
 RUNTIME_DEP_PKGS_CSWcollectd += CSWlibcurl4
 RUNTIME_DEP_PKGS_CSWcollectd += CSWlibgcc-s1
 RUNTIME_DEP_PKGS_CSWcollectd += CSWlibgcrypt20
-RUNTIME_DEP_PKGS_CSWcollectd += CSWlibltdl7
+RUNTIME_DEP_PKGS_CSWcollectd += CSWlibnetsnmpagent30
 RUNTIME_DEP_PKGS_CSWcollectd += CSWlibxml2-2
 RUNTIME_DEP_PKGS_CSWcollectd += CSWperl
 RUNTIME_DEP_PKGS_CSWcollectd += CSWlibyajl2
@@ -270,6 +275,8 @@
 PRESERVECONF += $(sysconfdir)/collectd.conf
 PRESERVECONF += $(sysconfdir)/64/collectd.conf
 
+SKIPTEST ?= 1
+
 include gar/category.mk
 
 xxxpost-patch:

Modified: csw/mgar/pkg/collectd/trunk/checksums
===================================================================
--- csw/mgar/pkg/collectd/trunk/checksums	2018-05-02 12:53:01 UTC (rev 26418)
+++ csw/mgar/pkg/collectd/trunk/checksums	2018-05-02 13:56:11 UTC (rev 26419)
@@ -1 +1 @@
-dc36141ed3058c4919bbd54b87c07873  collectd-5.7.1.tar.bz2
+a841159323624f18bf03198e9f5aa364  collectd-5.8.0.tar.bz2

Added: csw/mgar/pkg/collectd/trunk/files/0003-Include-config.h-early-or-_FILE_OFFSET_BITS-is-wrong.patch
===================================================================
--- csw/mgar/pkg/collectd/trunk/files/0003-Include-config.h-early-or-_FILE_OFFSET_BITS-is-wrong.patch	                        (rev 0)
+++ csw/mgar/pkg/collectd/trunk/files/0003-Include-config.h-early-or-_FILE_OFFSET_BITS-is-wrong.patch	2018-05-02 13:56:11 UTC (rev 26419)
@@ -0,0 +1,26 @@
+From 3f24dce20ad6ea1b2ed11780f9423e8675885539 Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Thu, 22 Mar 2018 14:54:01 +0100
+Subject: [PATCH 03/10] Include config.h early or _FILE_OFFSET_BITS is wrongly
+ defined and bails out on Solaris 32 bit
+
+---
+ src/libcollectdclient/collectd/network_buffer.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/libcollectdclient/collectd/network_buffer.h b/src/libcollectdclient/collectd/network_buffer.h
+index d66b815..ed8ab51 100644
+--- a/src/libcollectdclient/collectd/network_buffer.h
++++ b/src/libcollectdclient/collectd/network_buffer.h
+@@ -27,6 +27,8 @@
+ #ifndef LIBCOLLECTDCLIENT_NETWORK_BUFFER_H
+ #define LIBCOLLECTDCLIENT_NETWORK_BUFFER_H 1
+ 
++#include "config.h"
++
+ #include "collectd/network.h" /* for lcc_security_level_t */
+ #include "collectd/types.h"
+ 
+-- 
+2.4.0
+

Added: csw/mgar/pkg/collectd/trunk/files/0071-Include-kstat.h-if-available-to-provide-kstat_ctl_t.patch
===================================================================
--- csw/mgar/pkg/collectd/trunk/files/0071-Include-kstat.h-if-available-to-provide-kstat_ctl_t.patch	                        (rev 0)
+++ csw/mgar/pkg/collectd/trunk/files/0071-Include-kstat.h-if-available-to-provide-kstat_ctl_t.patch	2018-05-02 13:56:11 UTC (rev 26419)
@@ -0,0 +1,225 @@
+From b2ce05053cc602f0b8599e8a6c0de80063647ba4 Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Sat, 10 Mar 2018 18:34:33 +0100
+Subject: [PATCH 071/100] Include kstat.h if available to provide kstat_ctl_t
+
+---
+ src/cpu.c                     | 3 +++
+ src/daemon/collectd.c         | 5 +++++
+ src/daemon/common.c           | 4 ++++
+ src/daemon/common_test.c      | 4 ++++
+ src/daemon/plugin_mock.c      | 4 ++++
+ src/daemon/utils_subst_test.c | 4 ++++
+ src/disk.c                    | 3 +++
+ src/interface.c               | 3 +++
+ src/tape.c                    | 4 ++++
+ src/uptime.c                  | 4 ++++
+ src/utils_mount_test.c        | 4 ++++
+ src/utils_vl_lookup.c         | 4 ++++
+ src/zfs_arc.c                 | 5 +++++
+ 13 files changed, 51 insertions(+)
+
+diff --git a/src/cpu.c b/src/cpu.c
+index 0bf38e7..8480f11 100644
+--- a/src/cpu.c
++++ b/src/cpu.c
+@@ -134,6 +134,9 @@ static mach_msg_type_number_t cpu_list_len;
+ /* #endif KERNEL_LINUX */
+ 
+ #elif defined(HAVE_LIBKSTAT)
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
+ /* colleague tells me that Sun doesn't sell systems with more than 100 or so
+  * CPUs.. */
+ #define MAX_NUMCPU 256
+diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c
+index d6060a1..727876b 100644
+--- a/src/daemon/collectd.c
++++ b/src/daemon/collectd.c
+@@ -43,6 +43,10 @@
+ #include <statgrab.h>
+ #endif
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #ifndef COLLECTD_LOCALE
+ #define COLLECTD_LOCALE "C"
+ #endif
+@@ -201,6 +205,7 @@ static int change_basedir(const char *orig_dir, _Bool create) {
+ } /* static int change_basedir (char *dir) */
+ 
+ #if HAVE_LIBKSTAT
++extern kstat_ctl_t *kc;
+ static void update_kstat(void) {
+   if (kc == NULL) {
+     if ((kc = kstat_open()) == NULL)
+diff --git a/src/daemon/common.c b/src/daemon/common.c
+index bf833ee..fbbb608 100644
+--- a/src/daemon/common.c
++++ b/src/daemon/common.c
+@@ -60,6 +60,10 @@
+ #include <sys/capability.h>
+ #endif
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #ifdef HAVE_LIBKSTAT
+ extern kstat_ctl_t *kc;
+ #endif
+diff --git a/src/daemon/common_test.c b/src/daemon/common_test.c
+index 4d2ccaa..af2840e 100644
+--- a/src/daemon/common_test.c
++++ b/src/daemon/common_test.c
+@@ -27,6 +27,10 @@
+ #include "common.h"
+ #include "testing.h"
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #if HAVE_LIBKSTAT
+ kstat_ctl_t *kc;
+ #endif /* HAVE_LIBKSTAT */
+diff --git a/src/daemon/plugin_mock.c b/src/daemon/plugin_mock.c
+index 6df4c15..96bf382 100644
+--- a/src/daemon/plugin_mock.c
++++ b/src/daemon/plugin_mock.c
+@@ -26,6 +26,10 @@
+ 
+ #include "plugin.h"
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #if HAVE_LIBKSTAT
+ kstat_ctl_t *kc = NULL;
+ #endif /* HAVE_LIBKSTAT */
+diff --git a/src/daemon/utils_subst_test.c b/src/daemon/utils_subst_test.c
+index 00ea0ea..5379219 100644
+--- a/src/daemon/utils_subst_test.c
++++ b/src/daemon/utils_subst_test.c
+@@ -30,6 +30,10 @@
+ #include "testing.h"
+ #include "utils_subst.h"
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #if HAVE_LIBKSTAT
+ kstat_ctl_t *kc;
+ #endif /* HAVE_LIBKSTAT */
+diff --git a/src/disk.c b/src/disk.c
+index 004ce9e..45706bc 100644
+--- a/src/disk.c
++++ b/src/disk.c
+@@ -120,6 +120,9 @@ static struct gmesh geom_tree;
+ /* #endif KERNEL_FREEBSD */
+ 
+ #elif HAVE_LIBKSTAT
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
+ #define MAX_NUMDISK 1024
+ extern kstat_ctl_t *kc;
+ static kstat_t *ksp[MAX_NUMDISK];
+diff --git a/src/interface.c b/src/interface.c
+index 6c80334..c45ef66 100644
+--- a/src/interface.c
++++ b/src/interface.c
+@@ -91,6 +91,9 @@ static ignorelist_t *ignorelist = NULL;
+ static _Bool report_inactive = 1;
+ 
+ #ifdef HAVE_LIBKSTAT
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
+ #define MAX_NUMIF 256
+ extern kstat_ctl_t *kc;
+ static kstat_t *ksp[MAX_NUMIF];
+diff --git a/src/tape.c b/src/tape.c
+index debb1d2..f59b7ea 100644
+--- a/src/tape.c
++++ b/src/tape.c
+@@ -29,6 +29,10 @@
+ #error "No applicable input method."
+ #endif
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #define MAX_NUMTAPE 256
+ extern kstat_ctl_t *kc;
+ static kstat_t *ksp[MAX_NUMTAPE];
+diff --git a/src/uptime.c b/src/uptime.c
+index 31a2c1e..43d72e5 100644
+--- a/src/uptime.c
++++ b/src/uptime.c
+@@ -53,6 +53,10 @@
+  * Global variables
+  */
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #if HAVE_LIBKSTAT
+ extern kstat_ctl_t *kc;
+ #endif /* #endif HAVE_LIBKSTAT */
+diff --git a/src/utils_mount_test.c b/src/utils_mount_test.c
+index ca65950..e8f3009 100644
+--- a/src/utils_mount_test.c
++++ b/src/utils_mount_test.c
+@@ -30,6 +30,10 @@
+ #include "testing.h"
+ #include "utils_mount.h"
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #if HAVE_LIBKSTAT
+ kstat_ctl_t *kc;
+ #endif /* HAVE_LIBKSTAT */
+diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c
+index 76c0674..052c4c0 100644
+--- a/src/utils_vl_lookup.c
++++ b/src/utils_vl_lookup.c
+@@ -33,6 +33,10 @@
+ #include "utils_avltree.h"
+ #include "utils_vl_lookup.h"
+ 
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ #if HAVE_LIBKSTAT
+ kstat_ctl_t *kc;
+ #endif /* HAVE_LIBKSTAT */
+diff --git a/src/zfs_arc.c b/src/zfs_arc.c
+index af4bfcc..c9abdd5 100644
+--- a/src/zfs_arc.c
++++ b/src/zfs_arc.c
+@@ -99,6 +99,11 @@ static void free_zfs_values(kstat_t *ksp) {
+ }
+ 
+ #elif defined(KERNEL_SOLARIS)
++
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
++
+ extern kstat_ctl_t *kc;
+ 
+ static long long get_zfs_value(kstat_t *ksp, char *name) {
+-- 
+2.4.0
+

Added: csw/mgar/pkg/collectd/trunk/files/0076-Include-kstat.h-when-available.patch
===================================================================
--- csw/mgar/pkg/collectd/trunk/files/0076-Include-kstat.h-when-available.patch	                        (rev 0)
+++ csw/mgar/pkg/collectd/trunk/files/0076-Include-kstat.h-when-available.patch	2018-05-02 13:56:11 UTC (rev 26419)
@@ -0,0 +1,26 @@
+From 45df07a30926475b2a33f63f79cda615928a7d96 Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Wed, 21 Mar 2018 21:22:45 +0100
+Subject: [PATCH 076/100] Include kstat.h when available
+
+---
+ src/daemon/common.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/daemon/common.h b/src/daemon/common.h
+index cf4c5a7..e364362 100644
+--- a/src/daemon/common.h
++++ b/src/daemon/common.h
+@@ -289,6 +289,9 @@ int timeval_cmp(struct timeval tv0, struct timeval tv1, struct timeval *delta);
+ int check_create_dir(const char *file_orig);
+ 
+ #ifdef HAVE_LIBKSTAT
++#if HAVE_KSTAT_H
++#include <kstat.h>
++#endif
+ int get_kstat(kstat_t **ksp_ptr, char *module, int instance, char *name);
+ long long get_kstat_value(kstat_t *ksp, char *name);
+ #endif
+-- 
+2.4.0
+

Added: csw/mgar/pkg/collectd/trunk/files/0077-Add-fallback-for-endianess-conversion.patch
===================================================================
--- csw/mgar/pkg/collectd/trunk/files/0077-Add-fallback-for-endianess-conversion.patch	                        (rev 0)
+++ csw/mgar/pkg/collectd/trunk/files/0077-Add-fallback-for-endianess-conversion.patch	2018-05-02 13:56:11 UTC (rev 26419)
@@ -0,0 +1,261 @@
+From 32f1126d3f18fce78e6d06c8c7f94763f21afcef Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Wed, 21 Mar 2018 22:09:15 +0100
+Subject: [PATCH 077/100] Add fallback for endianess conversion
+
+---
+ src/stdendian.h | 242 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 242 insertions(+)
+ create mode 100644 src/stdendian.h
+
+diff --git a/src/stdendian.h b/src/stdendian.h
+new file mode 100644
+index 0000000..d419096
+--- /dev/null
++++ b/src/stdendian.h
+@@ -0,0 +1,242 @@
++/*
++ *   stdendian.h
++ *
++ *   This header defines the following endian macros as defined here:
++ *   http://austingroupbugs.net/view.php?id=162
++ *
++ *     BYTE_ORDER         this macro shall have a value equal to one
++ *                        of the *_ENDIAN macros in this header.
++ *     LITTLE_ENDIAN      if BYTE_ORDER == LITTLE_ENDIAN, the host
++ *                        byte order is from least significant to
++ *                        most significant.
++ *     BIG_ENDIAN         if BYTE_ORDER == BIG_ENDIAN, the host byte
++ *                        order is from most significant to least
++ *                        significant.
++ *
++ *   The following are defined as macros:
++ *
++ *     uint16_t bswap16(uint16_t x);
++ *     uint32_t bswap32(uint32_t x);
++ *     uint64_t bswap64(uint64_t x);
++
++ *     uint16_t htobe16(uint16_t x);
++ *     uint16_t htole16(uint16_t x);
++ *     uint16_t be16toh(uint16_t x);
++ *     uint16_t le16toh(uint16_t x);
++ *
++ *     uint32_t htobe32(uint32_t x);
++ *     uint32_t htole32(uint32_t x);
++ *     uint32_t be32toh(uint32_t x);
++ *     uint32_t le32toh(uint32_t x);
++ *
++ *     uint64_t htobe64(uint64_t x);
++ *     uint64_t htole64(uint64_t x);
++ *     uint64_t be64toh(uint64_t x);
++ *     uint64_t le64toh(uint64_t x);
++ *
++ *   The header defines the following macro for OpenCL compatibility
++ *   https://www.khronos.org/registry/cl/sdk/2.0/docs/man/xhtml/preprocessorDirectives.html
++ *
++ *     __ENDIAN_LITTLE__  if BYTE_ORDER == LITTLE_ENDIAN then this
++ *                        macro is present for OpenCL compatibility
++ *
++ *   The implementation provides a uniform interface to endian macros using only
++ *   system headers on recent Linux, Darwin, FreeBSD, Solaris and Windows systems. 
++ *
++ *   This approach is intended to avoid the need for preflight configure scripts.
++ *   An alternative approach would be to test compiler CPU architecture marcros.
++ *
++ *   This header has had *limited* testing on recent C11/C++11 compilers and is
++ *   based on the austin bug tracker interface, manpages, and headers present in
++ *   Linux, FreeBSD, Windows, Solaris and Darwin.
++ *
++ *   The header uses __builtin_bswapXX intrinsic with GCC/Clang (__GNUC__) on
++ *   platforms that do not provide bswap16, bswap32, bswap64 (Darwin)
++ *
++ *   Public Domain.
++ */
++
++#if HAVE_STDINT_H
++#include <stdint.h>
++#endif
++
++/* Linux / GLIBC */
++#if defined(__linux__) || defined(__GLIBC__)
++#include <endian.h>
++#include <byteswap.h>
++#define __ENDIAN_DEFINED        1
++#define __BSWAP_DEFINED         1
++#define __HOSTSWAP_DEFINED      1
++#define _BYTE_ORDER             __BYTE_ORDER
++#define _LITTLE_ENDIAN          __LITTLE_ENDIAN
++#define _BIG_ENDIAN             __BIG_ENDIAN
++#define bswap16(x)              bswap_16(x)
++#define bswap32(x)              bswap_32(x)
++#define bswap64(x)              bswap_64(x)
++#endif /* __linux__ || __GLIBC__ */
++
++/* BSD */
++#if defined(__FreeBSD__) || defined(__NetBSD__) || \
++    defined(__DragonFly__) || defined(__OpenBSD__)
++#include <sys/endian.h>
++#define __ENDIAN_DEFINED        1
++#define __BSWAP_DEFINED         1
++#define __HOSTSWAP_DEFINED      1
++#endif /* BSD */
++
++/* Solaris */
++#if defined (sun)
++#include <sys/isa_defs.h>
++#include <sys/byteorder.h>
++#define bswap16(x)		BSWAP_16(x)
++#define bswap32(x)		BSWAP_32(x)
++#define bswap64(x)		BSWAP_64(x)
++/* sun headers don't set a value for _LITTLE_ENDIAN or _BIG_ENDIAN */
++#if defined(_LITTLE_ENDIAN)
++#undef _LITTLE_ENDIAN
++#define _LITTLE_ENDIAN          1234
++#define _BIG_ENDIAN             4321
++#define _BYTE_ORDER             _LITTLE_ENDIAN
++#elif defined(_BIG_ENDIAN)
++#undef _BIG_ENDIAN
++#define _LITTLE_ENDIAN          1234
++#define _BIG_ENDIAN             4321
++#define _BYTE_ORDER             _BIG_ENDIAN
++#endif
++#define __ENDIAN_DEFINED        1
++#endif /* sun */
++
++/* Windows */
++#if defined(_WIN32) || defined(_MSC_VER)
++/* assumes all Microsoft targets are little endian */
++#define _LITTLE_ENDIAN          1234
++#define _BIG_ENDIAN             4321
++#define _BYTE_ORDER             _LITTLE_ENDIAN
++#define __ENDIAN_DEFINED        1
++#endif /* _MSC_VER */
++
++/* OS X */
++#if defined(__APPLE__)
++#include <machine/endian.h>
++#define _BYTE_ORDER             BYTE_ORDER
++#define _LITTLE_ENDIAN          LITTLE_ENDIAN
++#define _BIG_ENDIAN             BIG_ENDIAN
++#define __ENDIAN_DEFINED        1
++#endif /* __APPLE__ */
++
++/* OpenCL */
++#if defined (__OPENCL_VERSION__)
++#define _LITTLE_ENDIAN          1234
++#define __BIG_ENDIAN            4321
++#if defined (__ENDIAN_LITTLE__)
++#define _BYTE_ORDER             _LITTLE_ENDIAN
++#else
++#define _BYTE_ORDER             _BIG_ENDIAN
++#endif
++#define bswap16(x)              as_ushort(as_uchar2(ushort(x)).s1s0)
++#define bswap32(x)              as_uint(as_uchar4(uint(x)).s3s2s1s0)
++#define bswap64(x)              as_ulong(as_uchar8(ulong(x)).s7s6s5s4s3s2s1s0)
++#define __ENDIAN_DEFINED        1
++#define __BSWAP_DEFINED         1
++#endif
++
++/* Unknown */
++#if !__ENDIAN_DEFINED
++#error Could not determine CPU byte order
++#endif
++
++/* POSIX - http://austingroupbugs.net/view.php?id=162 */
++#ifndef BYTE_ORDER
++#define BYTE_ORDER _BYTE_ORDER
++#endif
++#ifndef LITTLE_ENDIAN
++#define LITTLE_ENDIAN _LITTLE_ENDIAN
++#endif
++#ifndef BIG_ENDIAN
++#define BIG_ENDIAN _BIG_ENDIAN
++#endif
++
++/* OpenCL compatibility - define __ENDIAN_LITTLE__ on little endian systems */
++#if _BYTE_ORDER == _LITTLE_ENDIAN
++#if !defined (__ENDIAN_LITTLE__)
++#define __ENDIAN_LITTLE__   1
++#endif
++#endif
++
++/* Byte swap macros */
++#if !__BSWAP_DEFINED
++
++#ifndef bswap16
++/* handle missing __builtin_bswap16 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 */
++#if defined __GNUC__
++/* define bswap16(x) __builtin_bswap16(x) */
++#else
++#define bswap16(x) ((uint16_t)((((uint16_t) (x) & 0xff00) >> 8) | \
++                               (((uint16_t) (x) & 0x00ff) << 8)))
++#endif
++#endif
++
++#ifndef bswap32
++#if defined __GNUC__
++#define bswap32(x) __builtin_bswap32(x)
++#else
++#define bswap32(x) ((uint32_t)((((uint32_t) (x) & 0xff000000) >> 24) | \
++                               (((uint32_t) (x) & 0x00ff0000) >> 8) | \
++                               (((uint32_t) (x) & 0x0000ff00) << 8) | \
++                               (((uint32_t) (x) & 0x000000ff) << 24)))
++#endif
++#endif
++
++#ifndef bswap64
++#if defined __GNUC__
++#define bswap64(x) __builtin_bswap64(x)
++#else
++#define bswap64(x) ((uint64_t)((((uint64_t) (x) & 0xff00000000000000ull) >> 56) | \
++                               (((uint64_t) (x) & 0x00ff000000000000ull) >> 40) | \
++                               (((uint64_t) (x) & 0x0000ff0000000000ull) >> 24) | \
++                               (((uint64_t) (x) & 0x000000ff00000000ull) >> 8) | \
++                               (((uint64_t) (x) & 0x00000000ff000000ull) << 8) | \
++                               (((uint64_t) (x) & 0x0000000000ff0000ull) << 24) | \
++                               (((uint64_t) (x) & 0x000000000000ff00ull) << 40) | \
++                               (((uint64_t) (x) & 0x00000000000000ffull) << 56)))
++#endif
++#endif
++
++#endif
++
++/* Host swap macros */
++#ifndef __HOSTSWAP_DEFINED
++#if __BYTE_ORDER == __LITTLE_ENDIAN
++#define htobe16(x)              bswap16((x))
++#define htole16(x)              ((uint16_t)(x))
++#define be16toh(x)              bswap16((x))
++#define le16toh(x)              ((uint16_t)(x))
++
++#define htobe32(x)              bswap32((x))
++#define htole32(x)              ((uint32_t)(x))
++#define be32toh(x)              bswap32((x))
++#define le32toh(x)              ((uint32_t)(x))
++
++#define htobe64(x)              bswap64((x))
++#define htole64(x)              ((uint64_t)(x))
++#define be64toh(x)              bswap64((x))
++#define le64toh(x)              ((uint64_t)(x))
++#elif __BYTE_ORDER == __BIG_ENDIAN
++#define htobe16(x)              ((uint16_t)(x))
++#define htole16(x)              bswap16((x))
++#define be16toh(x)              ((uint16_t)(x))
++#define le16toh(x)              bswap16((x))
++
++#define htobe32(x)              ((uint32_t)(x))
++#define htole32(x)              bswap32((x))
++#define be32toh(x)              ((uint32_t)(x))
++#define le64toh(x)              bswap64((x))
++
++#define htobe64(x)              ((uint64_t)(x))
++#define htole64(x)              bswap64((x))
++#define be64toh(x)              ((uint64_t)(x))
++#define le32toh(x)              bswap32((x))
++#endif
++#endif
++
++
+-- 
+2.4.0
+

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list