pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
portability.h
Go to the documentation of this file.
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>
38 typedef struct
39 {
40  uint32_t first32;
41  uint32_t second32;
42 } DBus8ByteStruct;
43 
54 typedef union
55 {
56  unsigned char bytes[8];
57  int16_t i16;
58  uint16_t u16;
59  int32_t i32;
60  uint32_t u32;
61  uint32_t bool_val;
62 # ifdef DBUS_HAVE_INT64
63  int64_t i64;
64  uint64_t u64;
65 # endif
66  DBus8ByteStruct eight;
67  double dbl;
68  unsigned char byt;
69  char *str;
70  int fd;
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