root/include/portability.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2001-2023 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 #ifndef PCMK__PORTABILITY__H
  10 #  define PCMK__PORTABILITY__H
  11 
  12 /* This header provides replacements for required definitions and declarations
  13  * that certain supported build environments don't provide
  14  */
  15 
  16 /* This header *MUST* be included before any system headers, because the
  17  * following definition can change the behavior of some of them.
  18  */
  19 #  undef _GNU_SOURCE            /* in case it was defined on the command line */
  20 #  define _GNU_SOURCE
  21 
  22 /* Please leave this as the first #include - Solaris needs it there */
  23 #  ifdef HAVE_CONFIG_H
  24 #    ifndef PCMK__CONFIG_H
  25 #      define PCMK__CONFIG_H
  26 #      include <config.h>
  27 #    endif
  28 #  endif
  29 
  30 #  if HAVE_DBUS
  31 #    ifndef HAVE_DBUSBASICVALUE
  32 #      include <stdint.h>
  33 #      include <dbus/dbus.h>
  34 /**
  35  * An 8-byte struct you could use to access int64 without having
  36  * int64 support
  37  */
  38 typedef struct
  39 {
  40   uint32_t first32;  /**< first 32 bits in the 8 bytes (beware endian issues) */
  41   uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */
  42 } DBus8ByteStruct;
  43 
  44 /**
  45  * A simple value union that lets you access bytes as if they
  46  * were various types; useful when dealing with basic types via
  47  * void pointers and varargs.
  48  *
  49  * This union also contains a pointer member (which can be used
  50  * to retrieve a string from dbus_message_iter_get_basic(), for
  51  * instance), so on future platforms it could conceivably be larger
  52  * than 8 bytes.
  53  */
  54 typedef union
  55 {
  56   unsigned char bytes[8]; /**< as 8 individual bytes */
  57   int16_t  i16;   /**< as int16 */
  58   uint16_t u16;   /**< as int16 */
  59   int32_t  i32;   /**< as int32 */
  60   uint32_t u32;   /**< as int32 */
  61   uint32_t bool_val; /**< as boolean */
  62 #      ifdef DBUS_HAVE_INT64
  63   int64_t  i64;   /**< as int64 */
  64   uint64_t u64;   /**< as int64 */
  65 #      endif
  66   DBus8ByteStruct eight; /**< as 8-byte struct */
  67   double dbl;          /**< as double */
  68   unsigned char byt;   /**< as byte */
  69   char *str;           /**< as char* (string, object path or signature) */
  70   int fd;              /**< as Unix file descriptor */
  71 } DBusBasicValue;
  72 #    endif  // !defined(HAVE_DBUSBASICVALUE)
  73 #  endif    // !defined(HAVE_DBUS)
  74 
  75 // Replacement constants for Linux-specific errno values
  76 
  77 #  include <errno.h>
  78 
  79 #  ifndef ENOTUNIQ
  80 #    define PCMK__ENOTUNIQ
  81 #    define ENOTUNIQ  190
  82 #  endif
  83 
  84 #  ifndef ECOMM
  85 #    define PCMK__ECOMM
  86 #    define ECOMM     191
  87 #  endif
  88 
  89 #  ifndef ELIBACC
  90 #    define PCMK__ELIBACC
  91 #    define ELIBACC   192
  92 #  endif
  93 
  94 #  ifndef EREMOTEIO
  95 #    define PCMK__EREMOTIO
  96 #    define EREMOTEIO 193
  97 #  endif
  98 
  99 #  ifndef ENOKEY
 100 #    define PCMK__ENOKEY
 101 #    define ENOKEY    195
 102 #  endif
 103 
 104 #  ifndef ENODATA
 105 #    define PCMK__ENODATA
 106 #    define ENODATA   196
 107 #  endif
 108 
 109 #  ifndef ETIME
 110 #    define PCMK__ETIME
 111 #    define ETIME     197
 112 #  endif
 113 
 114 #  ifndef EKEYREJECTED
 115 #    define PCMK__EKEYREJECTED
 116 #    define EKEYREJECTED 200
 117 #  endif
 118 
 119 #endif // PCMK__PORTABILITY__H

/* [previous][next][first][last][top][bottom][index][help] */