]> git.armaanb.net Git - opendoas.git/blob - libopenbsd/openbsd.h
libopenbsd: define __dead as noreturn
[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 /* pwd.h */
18 #define _PW_NAME_LEN 63
19
20 /* stdlib.h */
21 #ifndef HAVE_REALLOCARRAY
22 void * reallocarray(void *optr, size_t nmemb, size_t size);
23 #endif /* HAVE_REALLOCARRAY */
24 #ifndef HAVE_STRTONUM
25 long long strtonum(const char *numstr, long long minval,
26                 long long maxval, const char **errstrp);
27 #endif /* !HAVE_STRTONUM */
28
29 /* string.h */
30 #ifndef HAVE_EXPLICIT_BZERO
31 void explicit_bzero(void *, size_t);
32 #endif
33 #ifndef HAVE_STRLCAT
34 size_t strlcat(char *dst, const char *src, size_t dsize);
35 #endif /* !HAVE_STRLCAT */
36 #ifndef HAVE_STRLCPY
37 size_t strlcpy(char *dst, const char *src, size_t dsize);
38 #endif /* !HAVE_STRLCPY */
39
40 /* unistd.h */
41 #ifndef HAVE_EXECVPE
42 int execvpe(const char *, char *const *, char *const *);
43 #endif /* !HAVE_EXECVPE */
44 #ifndef HAVE_SETRESUID
45 int setresuid(uid_t, uid_t, uid_t);
46 #endif /* !HAVE_SETRESUID */
47 #ifndef HAVE_PLEDGE
48 int pledge(const char *promises, const char *paths[]);
49 #endif /* !HAVE_PLEDGE */
50 #ifndef HAVE_CLOSEFROM
51 void closefrom(int);
52 #endif /* !HAVE_CLOSEFROM */
53
54 /* err.h */
55 #ifndef HAVE_VERRC
56 void __dead verrc(int eval, int code, const char *fmt, va_list ap);
57 #endif /* !HAVE_VERRC */
58 #ifndef HAVE_ERRC
59 __dead void errc(int eval, int code, const char *fmt, ...);
60 #endif /* !HAVE_ERRC */
61
62 #ifndef HAVE_SETPROGNAME
63 const char * getprogname(void);
64 void setprogname(const char *progname);
65 #endif /* !HAVE_SETPROGNAME */
66
67 #endif /* _LIB_OPENBSD_H_ */