7 #if defined(__FreeBSD__)
8 #include <sys/endian.h>
32 #define flock(fd, op) (0)
38 #define __dead __attribute__ ((__noreturn__))
42 #define pledge(s, p) (0)
43 #define unveil(s, p) (0)
51 #include <uuid/uuid.h>
53 #define uuid_s_bad_version 1
54 #define uuid_s_invalid_string_uuid 2
55 #define uuid_s_no_memory 3
57 /* Length of a node address (an IEEE 802 address). */
58 #define _UUID_NODE_LEN 6
63 uint16_t time_hi_and_version;
64 uint8_t clock_seq_hi_and_reserved;
65 uint8_t clock_seq_low;
66 uint8_t node[_UUID_NODE_LEN];
69 int32_t uuid_equal(struct uuid *, struct uuid *, uint32_t *);
70 int32_t uuid_is_nil(struct uuid *, uint32_t *);
71 void uuid_create(uuid_t *, uint32_t *);
72 void uuid_create_nil(struct uuid *, uint32_t *);
73 void uuid_from_string(const char *, uuid_t *, uint32_t *);
74 void uuid_to_string(uuid_t *, char **, uint32_t *);
84 #include <sys/queue.h>
86 #include "compat/queue.h"
92 #include "compat/tree.h"
105 #include "compat/imsg.h"
108 #ifdef HAVE_LIBCRYPTO
113 #define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
114 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
116 #define SHA1_CTX SHA_CTX
117 #define SHA1Init SHA1_Init
118 #define SHA1Update SHA1_Update
119 #define SHA1Final SHA1_Final
122 #ifndef HAVE_ASPRINTF
124 int asprintf(char **, const char *, ...);
125 int vasprintf(char **, const char *, va_list);
128 #ifndef HAVE_EXPLICIT_BZERO
129 /* explicit_bzero.c */
130 void explicit_bzero(void *, size_t);
133 #ifndef HAVE_GETDTABLECOUNT
134 /* getdtablecount.c */
135 int getdtablecount(void);
138 #ifndef HAVE_CLOSEFROM
140 //void closefrom(int);
141 #define closefrom(fd) (closefrom(fd), 0)
144 #if defined (__FreeBSD__)
145 #define closefrom(fd) (closefrom(fd), 0)
150 char *strsep(char **, const char *);
153 #ifndef HAVE_STRTONUM
155 long long strtonum(const char *, long long, long long, const char **);
160 size_t strlcpy(char *, const char *, size_t);
165 size_t strlcat(char *, const char *, size_t);
170 size_t strnlen(const char *, size_t);
175 char *strndup(const char *, size_t);
178 #ifndef HAVE_GETPROGNAME
180 const char *getprogname(void);
185 ssize_t getline(char **, size_t *, FILE *);
188 #ifndef HAVE_FREEZERO
190 void freezero(void *, size_t);
193 #ifndef HAVE_GETDTABLECOUNT
194 /* getdtablecount.c */
195 int getdtablecount(void);
198 #ifndef HAVE_REALLOCARRAY
200 void *reallocarray(void *, size_t, size_t);
203 #ifndef HAVE_RECALLOCARRAY
204 /* recallocarray.c */
205 void *recallocarray(void *, size_t, size_t, size_t);
208 #ifndef HAVE_FMT_SCALED
210 int fmt_scaled(long long, char *);
211 int scan_scaled(char *, long long *);
212 #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
218 extern int BSDopterr;
219 extern int BSDoptind;
220 extern int BSDoptopt;
221 extern int BSDoptreset;
222 extern char *BSDoptarg;
223 int BSDgetopt(int, char *const *, const char *);
224 #define getopt(ac, av, o) BSDgetopt(ac, av, o)
225 #define opterr BSDopterr
226 #define optind BSDoptind
227 #define optopt BSDoptopt
228 #define optreset BSDoptreset
229 #define optarg BSDoptarg
233 #ifndef HAVE_BSD_MERGESORT
235 int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));