Blame


1 dd038bc6 2021-09-21 thomas.ad #ifndef _GOT_COMPAT_H
2 dd038bc6 2021-09-21 thomas.ad #define _GOT_COMPAT_H
3 dd038bc6 2021-09-21 thomas.ad
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>
7 dd038bc6 2021-09-21 thomas.ad
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>
12 dd038bc6 2021-09-21 thomas.ad
13 dd038bc6 2021-09-21 thomas.ad /*
14 dd038bc6 2021-09-21 thomas.ad #include <termios.h>
15 dd038bc6 2021-09-21 thomas.ad #include <wchar.h>
16 dd038bc6 2021-09-21 thomas.ad */
17 dd038bc6 2021-09-21 thomas.ad
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
21 dd038bc6 2021-09-21 thomas.ad #endif
22 dd038bc6 2021-09-21 thomas.ad
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)
28 dd038bc6 2021-09-21 thomas.ad #else
29 dd038bc6 2021-09-21 thomas.ad #include <sys/file.h>
30 dd038bc6 2021-09-21 thomas.ad #endif
31 dd038bc6 2021-09-21 thomas.ad
32 dd038bc6 2021-09-21 thomas.ad #ifndef __dead
33 dd038bc6 2021-09-21 thomas.ad #define __dead __attribute__ ((__noreturn__))
34 dd038bc6 2021-09-21 thomas.ad #endif
35 dd038bc6 2021-09-21 thomas.ad
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)
39 dd038bc6 2021-09-21 thomas.ad #endif
40 dd038bc6 2021-09-21 thomas.ad
41 dd038bc6 2021-09-21 thomas.ad #ifndef INFTIM
42 dd038bc6 2021-09-21 thomas.ad #define INFTIM -1
43 dd038bc6 2021-09-21 thomas.ad #endif
44 dd038bc6 2021-09-21 thomas.ad
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
51 dd038bc6 2021-09-21 thomas.ad
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
54 dd038bc6 2021-09-21 thomas.ad
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];
62 dd038bc6 2021-09-21 thomas.ad };
63 dd038bc6 2021-09-21 thomas.ad
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 *);
70 dd038bc6 2021-09-21 thomas.ad #endif
71 dd038bc6 2021-09-21 thomas.ad
72 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_STDINT_H
73 dd038bc6 2021-09-21 thomas.ad #include <stdint.h>
74 dd038bc6 2021-09-21 thomas.ad #else
75 dd038bc6 2021-09-21 thomas.ad #include <inttypes.h>
76 dd038bc6 2021-09-21 thomas.ad #endif
77 dd038bc6 2021-09-21 thomas.ad
78 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_QUEUE_H
79 dd038bc6 2021-09-21 thomas.ad #include <sys/queue.h>
80 dd038bc6 2021-09-21 thomas.ad #else
81 dd038bc6 2021-09-21 thomas.ad #include "compat/queue.h"
82 dd038bc6 2021-09-21 thomas.ad #endif
83 dd038bc6 2021-09-21 thomas.ad
84 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_TREE_H
85 dd038bc6 2021-09-21 thomas.ad #include <sys/tree.h>
86 dd038bc6 2021-09-21 thomas.ad #else
87 dd038bc6 2021-09-21 thomas.ad #include "compat/tree.h"
88 dd038bc6 2021-09-21 thomas.ad #endif
89 dd038bc6 2021-09-21 thomas.ad
90 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_UTIL_H
91 dd038bc6 2021-09-21 thomas.ad #include <util.h>
92 dd038bc6 2021-09-21 thomas.ad #endif
93 dd038bc6 2021-09-21 thomas.ad
94 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_LIBUTIL_H
95 dd038bc6 2021-09-21 thomas.ad #include <libutil.h>
96 dd038bc6 2021-09-21 thomas.ad #endif
97 dd038bc6 2021-09-21 thomas.ad
98 dd038bc6 2021-09-21 thomas.ad #ifdef HAVE_IMSG
99 dd038bc6 2021-09-21 thomas.ad #else
100 dd038bc6 2021-09-21 thomas.ad #include "compat/imsg.h"
101 dd038bc6 2021-09-21 thomas.ad #endif
102 dd038bc6 2021-09-21 thomas.ad
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
108 dd038bc6 2021-09-21 thomas.ad
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
113 dd038bc6 2021-09-21 thomas.ad
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
118 dd038bc6 2021-09-21 thomas.ad
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
124 dd038bc6 2021-09-21 thomas.ad
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
129 dd038bc6 2021-09-21 thomas.ad
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
134 dd038bc6 2021-09-21 thomas.ad
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
139 dd038bc6 2021-09-21 thomas.ad
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
144 dd038bc6 2021-09-21 thomas.ad
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
149 dd038bc6 2021-09-21 thomas.ad
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
154 dd038bc6 2021-09-21 thomas.ad
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
159 dd038bc6 2021-09-21 thomas.ad
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
164 dd038bc6 2021-09-21 thomas.ad
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
169 dd038bc6 2021-09-21 thomas.ad
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
174 dd038bc6 2021-09-21 thomas.ad
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
179 dd038bc6 2021-09-21 thomas.ad
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
184 dd038bc6 2021-09-21 thomas.ad
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 */
190 dd038bc6 2021-09-21 thomas.ad
191 dd038bc6 2021-09-21 thomas.ad #endif
192 dd038bc6 2021-09-21 thomas.ad
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
209 dd038bc6 2021-09-21 thomas.ad
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