1 dd038bc6 2021-09-21 thomas.ad #ifndef _GOT_COMPAT_H
2 dd038bc6 2021-09-21 thomas.ad #define _GOT_COMPAT_H
4 dd038bc6 2021-09-21 thomas.ad #include <sys/types.h>
5 dd038bc6 2021-09-21 thomas.ad #include <sys/ioctl.h>
6 dd038bc6 2021-09-21 thomas.ad #include <sys/uio.h>
8 dd038bc6 2021-09-21 thomas.ad #include <fnmatch.h>
9 dd038bc6 2021-09-21 thomas.ad #include <limits.h>
10 dd038bc6 2021-09-21 thomas.ad #include <stdio.h>
11 dd038bc6 2021-09-21 thomas.ad #include <stdint.h>
14 dd038bc6 2021-09-21 thomas.ad #include <termios.h>
15 dd038bc6 2021-09-21 thomas.ad #include <wchar.h>
18 dd038bc6 2021-09-21 thomas.ad /* For flock. */
19 dd038bc6 2021-09-21 thomas.ad #ifndef O_EXLOCK
20 dd038bc6 2021-09-21 thomas.ad #define O_EXLOCK 0
23 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_FLOCK
24 dd038bc6 2021-09-21 thomas.ad #define LOCK_SH 0
25 dd038bc6 2021-09-21 thomas.ad #define LOCK_EX 0
26 dd038bc6 2021-09-21 thomas.ad #define LOCK_NB 0
27 dd038bc6 2021-09-21 thomas.ad #define flock(fd, op) (0)
29 dd038bc6 2021-09-21 thomas.ad #include <sys/file.h>
32 dd038bc6 2021-09-21 thomas.ad #ifndef __dead
33 dd038bc6 2021-09-21 thomas.ad #define __dead __attribute__ ((__noreturn__))
36 dd038bc6 2021-09-21 thomas.ad #ifndef __OpenBSD__
37 dd038bc6 2021-09-21 thomas.ad #define pledge(s, p) (0)
38 dd038bc6 2021-09-21 thomas.ad #define unveil(s, p) (0)
41 dd038bc6 2021-09-21 thomas.ad #ifndef INFTIM
42 dd038bc6 2021-09-21 thomas.ad #define INFTIM -1
45 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_BSD_UUID
46 dd038bc6 2021-09-21 thomas.ad #include <uuid/uuid.h>
47 dd038bc6 2021-09-21 thomas.ad #define uuid_s_ok 0
48 dd038bc6 2021-09-21 thomas.ad #define uuid_s_bad_version 1
49 dd038bc6 2021-09-21 thomas.ad #define uuid_s_invalid_string_uuid 2
50 dd038bc6 2021-09-21 thomas.ad #define uuid_s_no_memory 3
52 dd038bc6 2021-09-21 thomas.ad /* Length of a node address (an IEEE 802 address). */
53 dd038bc6 2021-09-21 thomas.ad #define _UUID_NODE_LEN 6
55 dd038bc6 2021-09-21 thomas.ad struct uuid {
56 dd038bc6 2021-09-21 thomas.ad uint32_t time_low;
57 dd038bc6 2021-09-21 thomas.ad uint16_t time_mid;
58 dd038bc6 2021-09-21 thomas.ad uint16_t time_hi_and_version;
59 dd038bc6 2021-09-21 thomas.ad uint8_t clock_seq_hi_and_reserved;
60 dd038bc6 2021-09-21 thomas.ad uint8_t clock_seq_low;
61 dd038bc6 2021-09-21 thomas.ad uint8_t node[_UUID_NODE_LEN];
64 dd038bc6 2021-09-21 thomas.ad int32_t uuid_equal(struct uuid *, struct uuid *, uint32_t *);
65 dd038bc6 2021-09-21 thomas.ad int32_t uuid_is_nil(struct uuid *, uint32_t *);
66 dd038bc6 2021-09-21 thomas.ad void uuid_create(uuid_t *, uint32_t *);
67 dd038bc6 2021-09-21 thomas.ad void uuid_create_nil(struct uuid *, uint32_t *);
68 dd038bc6 2021-09-21 thomas.ad void uuid_from_string(const char *, uuid_t *, uint32_t *);
69 dd038bc6 2021-09-21 thomas.ad void uuid_to_string(uuid_t *, char **, uint32_t *);
72 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_STDINT_H
73 dd038bc6 2021-09-21 thomas.ad #include <stdint.h>
75 dd038bc6 2021-09-21 thomas.ad #include <inttypes.h>
78 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_QUEUE_H
79 dd038bc6 2021-09-21 thomas.ad #include <sys/queue.h>
81 dd038bc6 2021-09-21 thomas.ad #include "compat/queue.h"
84 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_TREE_H
85 dd038bc6 2021-09-21 thomas.ad #include <sys/tree.h>
87 dd038bc6 2021-09-21 thomas.ad #include "compat/tree.h"
90 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_UTIL_H
91 dd038bc6 2021-09-21 thomas.ad #include <util.h>
94 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_LIBUTIL_H
95 dd038bc6 2021-09-21 thomas.ad #include <libutil.h>
98 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_IMSG
100 dd038bc6 2021-09-21 thomas.ad #include "compat/imsg.h"
101 dd038bc6 2021-09-21 thomas.ad #endif
103 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_ASPRINTF
104 dd038bc6 2021-09-21 thomas.ad /* asprintf.c */
105 dd038bc6 2021-09-21 thomas.ad int asprintf(char **, const char *, ...);
106 dd038bc6 2021-09-21 thomas.ad int vasprintf(char **, const char *, va_list);
107 dd038bc6 2021-09-21 thomas.ad #endif
109 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_EXPLICIT_BZERO
110 dd038bc6 2021-09-21 thomas.ad /* explicit_bzero.c */
111 dd038bc6 2021-09-21 thomas.ad void explicit_bzero(void *, size_t);
112 dd038bc6 2021-09-21 thomas.ad #endif
114 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_GETDTABLECOUNT
115 dd038bc6 2021-09-21 thomas.ad /* getdtablecount.c */
116 dd038bc6 2021-09-21 thomas.ad int getdtablecount(void);
117 dd038bc6 2021-09-21 thomas.ad #endif
119 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_CLOSEFROM
120 dd038bc6 2021-09-21 thomas.ad /* closefrom.c */
121 dd038bc6 2021-09-21 thomas.ad //void closefrom(int);
122 dd038bc6 2021-09-21 thomas.ad #define closefrom(fd) (closefrom(fd), 0)
123 dd038bc6 2021-09-21 thomas.ad #endif
125 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_STRSEP
126 dd038bc6 2021-09-21 thomas.ad /* strsep.c */
127 dd038bc6 2021-09-21 thomas.ad char *strsep(char **, const char *);
128 dd038bc6 2021-09-21 thomas.ad #endif
130 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_STRTONUM
131 dd038bc6 2021-09-21 thomas.ad /* strtonum.c */
132 dd038bc6 2021-09-21 thomas.ad long long strtonum(const char *, long long, long long, const char **);
133 dd038bc6 2021-09-21 thomas.ad #endif
135 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_STRLCPY
136 dd038bc6 2021-09-21 thomas.ad /* strlcpy.c */
137 dd038bc6 2021-09-21 thomas.ad size_t strlcpy(char *, const char *, size_t);
138 dd038bc6 2021-09-21 thomas.ad #endif
140 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_STRLCAT
141 dd038bc6 2021-09-21 thomas.ad /* strlcat.c */
142 dd038bc6 2021-09-21 thomas.ad size_t strlcat(char *, const char *, size_t);
143 dd038bc6 2021-09-21 thomas.ad #endif
145 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_STRNLEN
146 dd038bc6 2021-09-21 thomas.ad /* strnlen.c */
147 dd038bc6 2021-09-21 thomas.ad size_t strnlen(const char *, size_t);
148 dd038bc6 2021-09-21 thomas.ad #endif
150 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_STRNDUP
151 dd038bc6 2021-09-21 thomas.ad /* strndup.c */
152 dd038bc6 2021-09-21 thomas.ad char *strndup(const char *, size_t);
153 dd038bc6 2021-09-21 thomas.ad #endif
155 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_GETPROGNAME
156 dd038bc6 2021-09-21 thomas.ad /* getprogname.c */
157 dd038bc6 2021-09-21 thomas.ad const char *getprogname(void);
158 dd038bc6 2021-09-21 thomas.ad #endif
160 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_GETLINE
161 dd038bc6 2021-09-21 thomas.ad /* getline.c */
162 dd038bc6 2021-09-21 thomas.ad ssize_t getline(char **, size_t *, FILE *);
163 dd038bc6 2021-09-21 thomas.ad #endif
165 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_FREEZERO
166 dd038bc6 2021-09-21 thomas.ad /* freezero.c */
167 dd038bc6 2021-09-21 thomas.ad void freezero(void *, size_t);
168 dd038bc6 2021-09-21 thomas.ad #endif
170 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_GETDTABLECOUNT
171 dd038bc6 2021-09-21 thomas.ad /* getdtablecount.c */
172 dd038bc6 2021-09-21 thomas.ad int getdtablecount(void);
173 dd038bc6 2021-09-21 thomas.ad #endif
175 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_REALLOCARRAY
176 dd038bc6 2021-09-21 thomas.ad /* reallocarray.c */
177 dd038bc6 2021-09-21 thomas.ad void *reallocarray(void *, size_t, size_t);
178 dd038bc6 2021-09-21 thomas.ad #endif
180 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_RECALLOCARRAY
181 dd038bc6 2021-09-21 thomas.ad /* recallocarray.c */
182 dd038bc6 2021-09-21 thomas.ad void *recallocarray(void *, size_t, size_t, size_t);
183 dd038bc6 2021-09-21 thomas.ad #endif
185 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_FMT_SCALED
186 dd038bc6 2021-09-21 thomas.ad /* fmt_scaled.c */
187 dd038bc6 2021-09-21 thomas.ad int fmt_scaled(long long, char *);
188 dd038bc6 2021-09-21 thomas.ad int scan_scaled(char *, long long *);
189 dd038bc6 2021-09-21 thomas.ad #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
191 dd038bc6 2021-09-21 thomas.ad #endif
193 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_LIBBSD
194 dd038bc6 2021-09-21 thomas.ad /* getopt.c */
195 dd038bc6 2021-09-21 thomas.ad extern int BSDopterr;
196 dd038bc6 2021-09-21 thomas.ad extern int BSDoptind;
197 dd038bc6 2021-09-21 thomas.ad extern int BSDoptopt;
198 dd038bc6 2021-09-21 thomas.ad extern int BSDoptreset;
199 dd038bc6 2021-09-21 thomas.ad extern char *BSDoptarg;
200 dd038bc6 2021-09-21 thomas.ad int BSDgetopt(int, char *const *, const char *);
201 dd038bc6 2021-09-21 thomas.ad #define getopt(ac, av, o) BSDgetopt(ac, av, o)
202 dd038bc6 2021-09-21 thomas.ad #define opterr BSDopterr
203 dd038bc6 2021-09-21 thomas.ad #define optind BSDoptind
204 dd038bc6 2021-09-21 thomas.ad #define optopt BSDoptopt
205 dd038bc6 2021-09-21 thomas.ad #define optreset BSDoptreset
206 dd038bc6 2021-09-21 thomas.ad #define optarg BSDoptarg
207 dd038bc6 2021-09-21 thomas.ad #endif
208 dd038bc6 2021-09-21 thomas.ad #endif
210 dd038bc6 2021-09-21 thomas.ad #ifndef HAVE_BSD_MERGESORT
211 dd038bc6 2021-09-21 thomas.ad /* mergesort.c */
212 dd038bc6 2021-09-21 thomas.ad int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
213 dd038bc6 2021-09-21 thomas.ad #endif