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 a97ec9eb 2021-12-23 op #ifndef __dead
30 a97ec9eb 2021-12-23 op #define __dead __attribute__((noreturn))
31 a97ec9eb 2021-12-23 op #endif
32 06a84967 2021-07-22 op
33 af9b96a0 2021-07-27 op #if HAVE_EVENT2
34 af9b96a0 2021-07-27 op # include <event2/event.h>
35 af9b96a0 2021-07-27 op # include <event2/event_compat.h>
36 af9b96a0 2021-07-27 op # include <event2/event_struct.h>
37 af9b96a0 2021-07-27 op # include <event2/buffer.h>
38 af9b96a0 2021-07-27 op # include <event2/buffer_compat.h>
39 af9b96a0 2021-07-27 op # include <event2/bufferevent.h>
40 af9b96a0 2021-07-27 op # include <event2/bufferevent_struct.h>
41 af9b96a0 2021-07-27 op # include <event2/bufferevent_compat.h>
42 af9b96a0 2021-07-27 op #else
43 af9b96a0 2021-07-27 op # include <event.h>
44 af9b96a0 2021-07-27 op #endif
45 af9b96a0 2021-07-27 op
46 8d1b399b 2021-07-22 op #ifdef HAVE_QUEUE_H
47 8d1b399b 2021-07-22 op # include <sys/queue.h>
48 8d1b399b 2021-07-22 op #else
49 8d1b399b 2021-07-22 op # include "compat/queue.h"
50 8d1b399b 2021-07-22 op #endif
51 8d1b399b 2021-07-22 op
52 1a443ec0 2021-07-22 op #ifdef HAVE_SYS_TREE_H
53 1a443ec0 2021-07-22 op # include <sys/tree.h>
54 1a443ec0 2021-07-22 op #else
55 1a443ec0 2021-07-22 op # include "compat/tree.h"
56 1a443ec0 2021-07-22 op #endif
57 1a443ec0 2021-07-22 op
58 8d1b399b 2021-07-22 op #ifdef HAVE_LIBUTIL
59 8d1b399b 2021-07-22 op # include <imsg.h>
60 a200a3ec 2021-07-22 op # include <ohash.h>
61 8d1b399b 2021-07-22 op #else
62 8d1b399b 2021-07-22 op # include "compat/imsg.h"
63 a200a3ec 2021-07-22 op # include "compat/ohash.h"
64 8d1b399b 2021-07-22 op #endif
65 8d1b399b 2021-07-22 op
66 2ac95ad9 2021-07-22 op #ifndef HAVE_ARC4RANDOM
67 2ac95ad9 2021-07-22 op # include <stdint.h>
68 2ac95ad9 2021-07-22 op uint32_t arc4random(void);
69 2ac95ad9 2021-07-22 op void arc4random_buf(void *, size_t);
70 2ac95ad9 2021-07-22 op uint32_t arc4random_uniform(uint32_t);
71 2ac95ad9 2021-07-22 op #endif
72 2ac95ad9 2021-07-22 op
73 805e39bf 2021-07-22 op #ifndef HAVE_ASPRINTF
74 805e39bf 2021-07-22 op int asprintf(char **, const char *, ...);
75 805e39bf 2021-07-22 op int vasprintf(char **, const char *, ...);
76 805e39bf 2021-07-22 op #endif
77 805e39bf 2021-07-22 op
78 805e39bf 2021-07-22 op #ifndef HAVE_ERR
79 805e39bf 2021-07-22 op void err(int, const char *, ...);
80 805e39bf 2021-07-22 op void errx(int, const char *, ...);
81 805e39bf 2021-07-22 op void warn(int, const char *, ...);
82 805e39bf 2021-07-22 op void warnx(int, const char *, ...);
83 8884ce6e 2021-07-25 op #else
84 8884ce6e 2021-07-25 op #include <err.h>
85 805e39bf 2021-07-22 op #endif
86 805e39bf 2021-07-22 op
87 8563e129 2021-07-22 op #ifndef FREEZERO
88 8563e129 2021-07-22 op void freezero(void *, size_t);
89 8563e129 2021-07-22 op #endif
90 8563e129 2021-07-22 op
91 805e39bf 2021-07-22 op #ifndef HAVE_GETDTABLECOUNT
92 805e39bf 2021-07-22 op int getdtablecount(void);
93 805e39bf 2021-07-22 op #endif
94 805e39bf 2021-07-22 op
95 805e39bf 2021-07-22 op #ifndef HAVE_GETDTABLESIZE
96 805e39bf 2021-07-22 op int getdtablesize(void);
97 805e39bf 2021-07-22 op #endif
98 805e39bf 2021-07-22 op
99 8d1b399b 2021-07-22 op #ifndef HAVE_GETPROGNAME
100 8d1b399b 2021-07-22 op const char *getprogname(void);
101 8d1b399b 2021-07-22 op #endif
102 8d1b399b 2021-07-22 op
103 f5299d10 2021-08-04 op #ifndef HAVE_MEMMEM
104 f5299d10 2021-08-04 op void *memmem(const void *, size_t, const void *, size_t);
105 f5299d10 2021-08-04 op #endif
106 f5299d10 2021-08-04 op
107 805e39bf 2021-07-22 op #ifndef HAVE_RECALLOCARRAY
108 805e39bf 2021-07-22 op void *recallocarray(void *, size_t, size_t, size_t);
109 805e39bf 2021-07-22 op #endif
110 805e39bf 2021-07-22 op
111 805e39bf 2021-07-22 op #ifndef HAVE_SETPROCTITLE
112 805e39bf 2021-07-22 op void setproctitle(const char *, ...);
113 805e39bf 2021-07-22 op #endif
114 805e39bf 2021-07-22 op
115 8d1b399b 2021-07-22 op #ifndef HAVE_SETPROGNAME
116 8d4e2725 2021-07-22 op void setprogname(const char *);
117 8d1b399b 2021-07-22 op #endif
118 8d1b399b 2021-07-22 op
119 805e39bf 2021-07-22 op #ifndef HAVE_STRLCAT
120 805e39bf 2021-07-22 op size_t strlcat(char *, const char *, size_t);
121 8d1b399b 2021-07-22 op #endif
122 805e39bf 2021-07-22 op
123 805e39bf 2021-07-22 op #ifndef HAVE_STRLCPY
124 805e39bf 2021-07-22 op size_t strlcpy(char *, const char *, size_t);
125 805e39bf 2021-07-22 op #endif
126 805e39bf 2021-07-22 op
127 15974c9d 2021-07-28 op #ifndef HAVE_STRSEP
128 15974c9d 2021-07-28 op char *strsep(char **, const char *);
129 15974c9d 2021-07-28 op #endif
130 15974c9d 2021-07-28 op
131 805e39bf 2021-07-22 op #ifndef HAVE_STRTONUM
132 805e39bf 2021-07-22 op long long strtonum(const char *, long long, long long, const char **);
133 805e39bf 2021-07-22 op #endif
134 805e39bf 2021-07-22 op
135 3d179b77 2021-12-15 op #ifdef HAVE_VIS
136 3d179b77 2021-12-15 op # include <vis.h>
137 3d179b77 2021-12-15 op #else
138 3d179b77 2021-12-15 op # include "compat/vis.h"
139 3d179b77 2021-12-15 op #endif
140 3d179b77 2021-12-15 op
141 805e39bf 2021-07-22 op #endif /* COMPAT_H */