Blame


1 8d1b399b 2021-07-22 op /*
2 8d1b399b 2021-07-22 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 8d1b399b 2021-07-22 op *
4 8d1b399b 2021-07-22 op * Permission to use, copy, modify, and distribute this software for any
5 8d1b399b 2021-07-22 op * purpose with or without fee is hereby granted, provided that the above
6 8d1b399b 2021-07-22 op * copyright notice and this permission notice appear in all copies.
7 8d1b399b 2021-07-22 op *
8 8d1b399b 2021-07-22 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 8d1b399b 2021-07-22 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 8d1b399b 2021-07-22 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 8d1b399b 2021-07-22 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 8d1b399b 2021-07-22 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 8d1b399b 2021-07-22 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 8d1b399b 2021-07-22 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 8d1b399b 2021-07-22 op */
16 8d1b399b 2021-07-22 op
17 8d1b399b 2021-07-22 op #ifndef COMPAT_H
18 8d1b399b 2021-07-22 op #define COMPAT_H
19 8d1b399b 2021-07-22 op
20 8d1b399b 2021-07-22 op #include "config.h"
21 8d1b399b 2021-07-22 op
22 8d1b399b 2021-07-22 op #include <sys/types.h>
23 8d1b399b 2021-07-22 op #include <sys/uio.h>
24 8d1b399b 2021-07-22 op
25 8d1b399b 2021-07-22 op #include <stdarg.h>
26 8d1b399b 2021-07-22 op #include <stddef.h>
27 8d1b399b 2021-07-22 op #include <stdint.h>
28 8d1b399b 2021-07-22 op
29 06a84967 2021-07-22 op #define ATTR_DEAD __attribute__((noreturn))
30 06a84967 2021-07-22 op
31 af9b96a0 2021-07-27 op #if HAVE_EVENT2
32 af9b96a0 2021-07-27 op # include <event2/event.h>
33 af9b96a0 2021-07-27 op # include <event2/event_compat.h>
34 af9b96a0 2021-07-27 op # include <event2/event_struct.h>
35 af9b96a0 2021-07-27 op # include <event2/buffer.h>
36 af9b96a0 2021-07-27 op # include <event2/buffer_compat.h>
37 af9b96a0 2021-07-27 op # include <event2/bufferevent.h>
38 af9b96a0 2021-07-27 op # include <event2/bufferevent_struct.h>
39 af9b96a0 2021-07-27 op # include <event2/bufferevent_compat.h>
40 af9b96a0 2021-07-27 op #else
41 af9b96a0 2021-07-27 op # include <event.h>
42 af9b96a0 2021-07-27 op #endif
43 af9b96a0 2021-07-27 op
44 8d1b399b 2021-07-22 op #ifdef HAVE_QUEUE_H
45 8d1b399b 2021-07-22 op # include <sys/queue.h>
46 8d1b399b 2021-07-22 op #else
47 8d1b399b 2021-07-22 op # include "compat/queue.h"
48 8d1b399b 2021-07-22 op #endif
49 8d1b399b 2021-07-22 op
50 1a443ec0 2021-07-22 op #ifdef HAVE_SYS_TREE_H
51 1a443ec0 2021-07-22 op # include <sys/tree.h>
52 1a443ec0 2021-07-22 op #else
53 1a443ec0 2021-07-22 op # include "compat/tree.h"
54 1a443ec0 2021-07-22 op #endif
55 1a443ec0 2021-07-22 op
56 8d1b399b 2021-07-22 op #ifdef HAVE_LIBUTIL
57 8d1b399b 2021-07-22 op # include <imsg.h>
58 a200a3ec 2021-07-22 op # include <ohash.h>
59 8d1b399b 2021-07-22 op #else
60 8d1b399b 2021-07-22 op # include "compat/imsg.h"
61 a200a3ec 2021-07-22 op # include "compat/ohash.h"
62 8d1b399b 2021-07-22 op #endif
63 8d1b399b 2021-07-22 op
64 2ac95ad9 2021-07-22 op #ifndef HAVE_ARC4RANDOM
65 2ac95ad9 2021-07-22 op # include <stdint.h>
66 2ac95ad9 2021-07-22 op uint32_t arc4random(void);
67 2ac95ad9 2021-07-22 op void arc4random_buf(void *, size_t);
68 2ac95ad9 2021-07-22 op uint32_t arc4random_uniform(uint32_t);
69 2ac95ad9 2021-07-22 op #endif
70 2ac95ad9 2021-07-22 op
71 805e39bf 2021-07-22 op #ifndef HAVE_ASPRINTF
72 805e39bf 2021-07-22 op int asprintf(char **, const char *, ...);
73 805e39bf 2021-07-22 op int vasprintf(char **, const char *, ...);
74 805e39bf 2021-07-22 op #endif
75 805e39bf 2021-07-22 op
76 805e39bf 2021-07-22 op #ifndef HAVE_ERR
77 805e39bf 2021-07-22 op void err(int, const char *, ...);
78 805e39bf 2021-07-22 op void errx(int, const char *, ...);
79 805e39bf 2021-07-22 op void warn(int, const char *, ...);
80 805e39bf 2021-07-22 op void warnx(int, const char *, ...);
81 8884ce6e 2021-07-25 op #else
82 8884ce6e 2021-07-25 op #include <err.h>
83 805e39bf 2021-07-22 op #endif
84 805e39bf 2021-07-22 op
85 8563e129 2021-07-22 op #ifndef FREEZERO
86 8563e129 2021-07-22 op void freezero(void *, size_t);
87 8563e129 2021-07-22 op #endif
88 8563e129 2021-07-22 op
89 805e39bf 2021-07-22 op #ifndef HAVE_GETDTABLECOUNT
90 805e39bf 2021-07-22 op int getdtablecount(void);
91 805e39bf 2021-07-22 op #endif
92 805e39bf 2021-07-22 op
93 805e39bf 2021-07-22 op #ifndef HAVE_GETDTABLESIZE
94 805e39bf 2021-07-22 op int getdtablesize(void);
95 805e39bf 2021-07-22 op #endif
96 805e39bf 2021-07-22 op
97 8d1b399b 2021-07-22 op #ifndef HAVE_GETPROGNAME
98 8d1b399b 2021-07-22 op const char *getprogname(void);
99 8d1b399b 2021-07-22 op #endif
100 8d1b399b 2021-07-22 op
101 805e39bf 2021-07-22 op #ifndef HAVE_RECALLOCARRAY
102 805e39bf 2021-07-22 op void *recallocarray(void *, size_t, size_t, size_t);
103 805e39bf 2021-07-22 op #endif
104 805e39bf 2021-07-22 op
105 805e39bf 2021-07-22 op #ifndef HAVE_SETPROCTITLE
106 805e39bf 2021-07-22 op void setproctitle(const char *, ...);
107 805e39bf 2021-07-22 op #endif
108 805e39bf 2021-07-22 op
109 8d1b399b 2021-07-22 op #ifndef HAVE_SETPROGNAME
110 8d4e2725 2021-07-22 op void setprogname(const char *);
111 8d1b399b 2021-07-22 op #endif
112 8d1b399b 2021-07-22 op
113 805e39bf 2021-07-22 op #ifndef HAVE_STRLCAT
114 805e39bf 2021-07-22 op size_t strlcat(char *, const char *, size_t);
115 8d1b399b 2021-07-22 op #endif
116 805e39bf 2021-07-22 op
117 805e39bf 2021-07-22 op #ifndef HAVE_STRLCPY
118 805e39bf 2021-07-22 op size_t strlcpy(char *, const char *, size_t);
119 805e39bf 2021-07-22 op #endif
120 805e39bf 2021-07-22 op
121 15974c9d 2021-07-28 op #ifndef HAVE_STRSEP
122 15974c9d 2021-07-28 op char *strsep(char **, const char *);
123 15974c9d 2021-07-28 op #endif
124 15974c9d 2021-07-28 op
125 805e39bf 2021-07-22 op #ifndef HAVE_STRTONUM
126 805e39bf 2021-07-22 op long long strtonum(const char *, long long, long long, const char **);
127 805e39bf 2021-07-22 op #endif
128 805e39bf 2021-07-22 op
129 805e39bf 2021-07-22 op #endif /* COMPAT_H */