]> git.armaanb.net Git - opendoas.git/blob - libopenbsd/openbsd.h
use config.h and link objects instead of libopenbsd.a
[opendoas.git] / libopenbsd / openbsd.h
1 #ifndef _LIB_OPENBSD_H_
2 #define _LIB_OPENBSD_H_
3
4 #include <stdarg.h>
5 #include <sys/types.h>
6
7 #ifndef __UNUSED
8 # define __UNUSED __attribute__ ((unused))
9 #endif
10
11 #ifndef __dead
12 # define __dead __attribute__ ((noreturn))
13 #endif
14
15 /* API definitions lifted from OpenBSD src/include */
16
17 /* stdlib.h */
18 #ifndef HAVE_REALLOCARRAY
19 void * reallocarray(void *optr, size_t nmemb, size_t size);
20 #endif /* HAVE_REALLOCARRAY */
21 #ifndef HAVE_STRTONUM
22 long long strtonum(const char *numstr, long long minval,
23                 long long maxval, const char **errstrp);
24 #endif /* !HAVE_STRTONUM */
25
26 /* string.h */
27 #ifndef HAVE_EXPLICIT_BZERO
28 void explicit_bzero(void *, size_t);
29 #endif
30 #ifndef HAVE_STRLCAT
31 size_t strlcat(char *dst, const char *src, size_t dsize);
32 #endif /* !HAVE_STRLCAT */
33 #ifndef HAVE_STRLCPY
34 size_t strlcpy(char *dst, const char *src, size_t dsize);
35 #endif /* !HAVE_STRLCPY */
36
37 /* unistd.h */
38 #ifndef HAVE_EXECVPE
39 int execvpe(const char *, char *const *, char *const *);
40 #endif /* !HAVE_EXECVPE */
41 #ifndef HAVE_SETRESUID
42 int setresuid(uid_t, uid_t, uid_t);
43 #endif /* !HAVE_SETRESUID */
44 #ifndef HAVE_PLEDGE
45 int pledge(const char *promises, const char *paths[]);
46 #endif /* !HAVE_PLEDGE */
47 #ifndef HAVE_CLOSEFROM
48 void closefrom(int);
49 #endif /* !HAVE_CLOSEFROM */
50
51 /* err.h */
52 #ifndef HAVE_VERRC
53 void __dead verrc(int eval, int code, const char *fmt, va_list ap);
54 #endif /* !HAVE_VERRC */
55 #ifndef HAVE_ERRC
56 __dead void errc(int eval, int code, const char *fmt, ...);
57 #endif /* !HAVE_ERRC */
58
59 #ifndef HAVE_SETPROGNAME
60 const char * getprogname(void);
61 void setprogname(const char *progname);
62 #endif /* !HAVE_SETPROGNAME */
63
64 #ifndef HAVE_SETRESGID
65 int     setresgid(gid_t, gid_t, gid_t);
66 #endif
67 #ifndef HAVE_SETRESUID
68 int     setresuid(uid_t, uid_t, uid_t);
69 #endif
70
71 #endif /* _LIB_OPENBSD_H_ */