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 06a84967 2021-07-22 op #define ATTR_DEAD __attribute__((noreturn))
30 06a84967 2021-07-22 op
31 8d1b399b 2021-07-22 op #ifdef HAVE_QUEUE_H
32 8d1b399b 2021-07-22 op # include <sys/queue.h>
33 8d1b399b 2021-07-22 op #else
34 8d1b399b 2021-07-22 op # include "compat/queue.h"
35 8d1b399b 2021-07-22 op #endif
36 8d1b399b 2021-07-22 op
37 1a443ec0 2021-07-22 op #ifdef HAVE_SYS_TREE_H
38 1a443ec0 2021-07-22 op # include <sys/tree.h>
39 1a443ec0 2021-07-22 op #else
40 1a443ec0 2021-07-22 op # include "compat/tree.h"
41 1a443ec0 2021-07-22 op #endif
42 1a443ec0 2021-07-22 op
43 8d1b399b 2021-07-22 op #ifdef HAVE_LIBUTIL
44 8d1b399b 2021-07-22 op # include <imsg.h>
45 a200a3ec 2021-07-22 op # include <ohash.h>
46 8d1b399b 2021-07-22 op #else
47 8d1b399b 2021-07-22 op # include "compat/imsg.h"
48 a200a3ec 2021-07-22 op # include "compat/ohash.h"
49 8d1b399b 2021-07-22 op #endif
50 8d1b399b 2021-07-22 op
51 2ac95ad9 2021-07-22 op #ifndef HAVE_ARC4RANDOM
52 2ac95ad9 2021-07-22 op # include <stdint.h>
53 2ac95ad9 2021-07-22 op uint32_t arc4random(void);
54 2ac95ad9 2021-07-22 op void arc4random_buf(void *, size_t);
55 2ac95ad9 2021-07-22 op uint32_t arc4random_uniform(uint32_t);
56 2ac95ad9 2021-07-22 op #endif
57 2ac95ad9 2021-07-22 op
58 805e39bf 2021-07-22 op #ifndef HAVE_ASPRINTF
59 805e39bf 2021-07-22 op int asprintf(char **, const char *, ...);
60 805e39bf 2021-07-22 op int vasprintf(char **, const char *, ...);
61 805e39bf 2021-07-22 op #endif
62 805e39bf 2021-07-22 op
63 805e39bf 2021-07-22 op #ifndef HAVE_ERR
64 805e39bf 2021-07-22 op void err(int, const char *, ...);
65 805e39bf 2021-07-22 op void errx(int, const char *, ...);
66 805e39bf 2021-07-22 op void warn(int, const char *, ...);
67 805e39bf 2021-07-22 op void warnx(int, const char *, ...);
68 8884ce6e 2021-07-25 op #else
69 8884ce6e 2021-07-25 op #include <err.h>
70 805e39bf 2021-07-22 op #endif
71 805e39bf 2021-07-22 op
72 8563e129 2021-07-22 op #ifndef FREEZERO
73 8563e129 2021-07-22 op void freezero(void *, size_t);
74 8563e129 2021-07-22 op #endif
75 8563e129 2021-07-22 op
76 805e39bf 2021-07-22 op #ifndef HAVE_GETDTABLECOUNT
77 805e39bf 2021-07-22 op int getdtablecount(void);
78 805e39bf 2021-07-22 op #endif
79 805e39bf 2021-07-22 op
80 805e39bf 2021-07-22 op #ifndef HAVE_GETDTABLESIZE
81 805e39bf 2021-07-22 op int getdtablesize(void);
82 805e39bf 2021-07-22 op #endif
83 805e39bf 2021-07-22 op
84 8d1b399b 2021-07-22 op #ifndef HAVE_GETPROGNAME
85 8d1b399b 2021-07-22 op const char *getprogname(void);
86 8d1b399b 2021-07-22 op #endif
87 8d1b399b 2021-07-22 op
88 805e39bf 2021-07-22 op #ifndef HAVE_RECALLOCARRAY
89 805e39bf 2021-07-22 op void *recallocarray(void *, size_t, size_t, size_t);
90 805e39bf 2021-07-22 op #endif
91 805e39bf 2021-07-22 op
92 805e39bf 2021-07-22 op #ifndef HAVE_SETPROCTITLE
93 805e39bf 2021-07-22 op void setproctitle(const char *, ...);
94 805e39bf 2021-07-22 op #endif
95 805e39bf 2021-07-22 op
96 8d1b399b 2021-07-22 op #ifndef HAVE_SETPROGNAME
97 8d4e2725 2021-07-22 op void setprogname(const char *);
98 8d1b399b 2021-07-22 op #endif
99 8d1b399b 2021-07-22 op
100 805e39bf 2021-07-22 op #ifndef HAVE_STRLCAT
101 805e39bf 2021-07-22 op size_t strlcat(char *, const char *, size_t);
102 8d1b399b 2021-07-22 op #endif
103 805e39bf 2021-07-22 op
104 805e39bf 2021-07-22 op #ifndef HAVE_STRLCPY
105 805e39bf 2021-07-22 op size_t strlcpy(char *, const char *, size_t);
106 805e39bf 2021-07-22 op #endif
107 805e39bf 2021-07-22 op
108 805e39bf 2021-07-22 op #ifndef HAVE_STRTONUM
109 805e39bf 2021-07-22 op long long strtonum(const char *, long long, long long, const char **);
110 805e39bf 2021-07-22 op #endif
111 805e39bf 2021-07-22 op
112 805e39bf 2021-07-22 op #endif /* COMPAT_H */