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)
46 #ifdef HAVE_LINUX_LANDLOCK_H
47 int landlock_no_fs(void);
48 int landlock_unveil(const char *, const char *);
50 /* #define unveil(s, p) landlock_unveil((s), (p)) */
58 #include <uuid/uuid.h>
60 #define uuid_s_bad_version 1
61 #define uuid_s_invalid_string_uuid 2
62 #define uuid_s_no_memory 3
64 /* Length of a node address (an IEEE 802 address). */
65 #define _UUID_NODE_LEN 6
70 uint16_t time_hi_and_version;
71 uint8_t clock_seq_hi_and_reserved;
72 uint8_t clock_seq_low;
73 uint8_t node[_UUID_NODE_LEN];
76 int32_t uuid_equal(struct uuid *, struct uuid *, uint32_t *);
77 int32_t uuid_is_nil(struct uuid *, uint32_t *);
78 void uuid_create(uuid_t *, uint32_t *);
79 void uuid_create_nil(struct uuid *, uint32_t *);
80 void uuid_from_string(const char *, uuid_t *, uint32_t *);
81 void uuid_to_string(uuid_t *, char **, uint32_t *);
91 #include <sys/queue.h>
93 #include "compat/queue.h"
99 #include "compat/tree.h"
106 #ifdef HAVE_LIBUTIL_H
112 #include "compat/imsg.h"
115 #ifdef HAVE_LIBCRYPTO
120 #define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
121 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
123 #define SHA1_CTX SHA_CTX
124 #define SHA1Init SHA1_Init
125 #define SHA1Update SHA1_Update
126 #define SHA1Final SHA1_Final
129 #ifndef HAVE_ASPRINTF
131 int asprintf(char **, const char *, ...);
132 int vasprintf(char **, const char *, va_list);
135 #ifndef HAVE_EXPLICIT_BZERO
136 /* explicit_bzero.c */
137 void explicit_bzero(void *, size_t);
140 #ifndef HAVE_GETDTABLECOUNT
141 /* getdtablecount.c */
142 int getdtablecount(void);
145 #ifndef HAVE_CLOSEFROM
147 //void closefrom(int);
148 #define closefrom(fd) (closefrom(fd), 0)
151 #if defined (__FreeBSD__)
152 #define closefrom(fd) (closefrom(fd), 0)
157 char *strsep(char **, const char *);
160 #ifndef HAVE_STRTONUM
162 long long strtonum(const char *, long long, long long, const char **);
167 size_t strlcpy(char *, const char *, size_t);
172 size_t strlcat(char *, const char *, size_t);
177 size_t strnlen(const char *, size_t);
182 char *strndup(const char *, size_t);
185 #ifndef HAVE_GETPROGNAME
187 const char *getprogname(void);
192 ssize_t getline(char **, size_t *, FILE *);
195 #ifndef HAVE_FREEZERO
197 void freezero(void *, size_t);
200 #ifndef HAVE_GETDTABLECOUNT
201 /* getdtablecount.c */
202 int getdtablecount(void);
205 #ifndef HAVE_REALLOCARRAY
207 void *reallocarray(void *, size_t, size_t);
210 #ifndef HAVE_RECALLOCARRAY
211 /* recallocarray.c */
212 void *recallocarray(void *, size_t, size_t, size_t);
215 #ifndef HAVE_FMT_SCALED
217 int fmt_scaled(long long, char *);
218 int scan_scaled(char *, long long *);
219 #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
225 extern int BSDopterr;
226 extern int BSDoptind;
227 extern int BSDoptopt;
228 extern int BSDoptreset;
229 extern char *BSDoptarg;
230 int BSDgetopt(int, char *const *, const char *);
231 #define getopt(ac, av, o) BSDgetopt(ac, av, o)
232 #define opterr BSDopterr
233 #define optind BSDoptind
234 #define optopt BSDoptopt
235 #define optreset BSDoptreset
236 #define optarg BSDoptarg
240 #ifndef HAVE_BSD_MERGESORT
242 int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));