pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
portability.h
Go to the documentation of this file.
1 /*
2  * Copyright 2001-2021 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 PORTABILITY_H
10 # define PORTABILITY_H
11 
12 /* Needs to be defined before any other includes, otherwise some system
13  * headers do not behave as expected! Major black magic... */
14 # undef _GNU_SOURCE /* in case it was defined on the command line */
15 # define _GNU_SOURCE
16 
17 /* Please leave this as the first #include - Solaris needs it there */
18 # ifdef HAVE_CONFIG_H
19 # ifndef PCMK__CONFIG_H
20 # define PCMK__CONFIG_H
21 # include <config.h>
22 # endif
23 # endif
24 
25 /* Prototypes for libreplace functions */
26 
27 # ifndef HAVE_DAEMON
28  /* We supply a replacement function, but need a prototype */
29 int daemon(int nochdir, int noclose);
30 # endif /* HAVE_DAEMON */
31 
32 # ifndef HAVE_SETENV
33  /* We supply a replacement function, but need a prototype */
34 int setenv(const char *name, const char *value, int why);
35 # endif /* HAVE_SETENV */
36 
37 # ifndef HAVE_STRERROR
38  /* We supply a replacement function, but need a prototype */
39 char *strerror(int errnum);
40 # endif /* HAVE_STRERROR */
41 
42 # ifndef HAVE_STRCHRNUL
43  /* We supply a replacement function, but need a prototype */
44 char *strchrnul(const char *s, int c_in);
45 # endif /* HAVE_STRCHRNUL */
46 
47 # ifndef HAVE_ALPHASORT
48 # include <dirent.h>
49 int
50  alphasort(const void *dirent1, const void *dirent2);
51 # endif /* HAVE_ALPHASORT */
52 
53 # ifndef HAVE_STRNLEN
54 size_t strnlen(const char *s, size_t maxlen);
55 # else
56 # define USE_GNU
57 # endif
58 
59 # ifndef HAVE_STRNDUP
60 char *strndup(const char *str, size_t len);
61 # else
62 # define USE_GNU
63 # endif
64 
65 # if SUPPORT_DBUS
66 # ifndef HAVE_DBUSBASICVALUE
67 # include <stdint.h>
68 # include <dbus/dbus.h>
73 typedef struct
74 {
75  uint32_t first32;
76  uint32_t second32;
77 } DBus8ByteStruct;
78 
89 typedef union
90 {
91  unsigned char bytes[8];
92  int16_t i16;
93  uint16_t u16;
94  int32_t i32;
95  uint32_t u32;
96  uint32_t bool_val;
97 # ifdef DBUS_HAVE_INT64
98  int64_t i64;
99  uint64_t u64;
100 # endif
101  DBus8ByteStruct eight;
102  double dbl;
103  unsigned char byt;
104  char *str;
105  int fd;
106 } DBusBasicValue;
107 # endif
108 # endif
109 
110 /* Replacement error codes for non-linux */
111 # include <errno.h>
112 
113 # ifndef ENOTUNIQ
114 # define ENOTUNIQ 190
115 # endif
116 
117 # ifndef ECOMM
118 # define ECOMM 191
119 # endif
120 
121 # ifndef ELIBACC
122 # define ELIBACC 192
123 # endif
124 
125 # ifndef EREMOTEIO
126 # define EREMOTEIO 193
127 # endif
128 
129 # ifndef EUNATCH
130 # define EUNATCH 194
131 # endif
132 
133 # ifndef ENOKEY
134 # define ENOKEY 195
135 # endif
136 
137 # ifndef ENODATA
138 # define ENODATA 196
139 # endif
140 
141 # ifndef ETIME
142 # define ETIME 197
143 # endif
144 
145 # ifndef ENOSR
146 # define ENOSR 198
147 # endif
148 
149 # ifndef ENOSTR
150 # define ENOSTR 199
151 # endif
152 
153 # ifndef EKEYREJECTED
154 # define EKEYREJECTED 200
155 # endif
156 
157 #endif /* PORTABILITY_H */
int alphasort(const void *dirent1, const void *dirent2)
char * strerror(int errnum)
char * strndup(const char *str, size_t len)
int daemon(int nochdir, int noclose)
int setenv(const char *name, const char *value, int why)
size_t strnlen(const char *s, size_t maxlen)
char * strchrnul(const char *s, int c_in)
char * name
Definition: pcmk_fence.c:31