]> git.armaanb.net Git - opendoas.git/blob - libopenbsd/openbsd.h
remove nonstandard sys/cdefs.h
[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 #include "readpassphrase.h"
8
9 /* API definitions lifted from OpenBSD src/include */
10
11 /* login_cap.h */
12 #ifndef HAVE_LOGIN_CAP_H
13 #define        LOGIN_SETGROUP          0x0001  /* Set group */
14 #define        LOGIN_SETLOGIN          0x0002  /* Set login */
15 #define        LOGIN_SETPATH           0x0004  /* Set path */
16 #define        LOGIN_SETPRIORITY       0x0008  /* Set priority */
17 #define        LOGIN_SETRESOURCES      0x0010  /* Set resource limits */
18 #define        LOGIN_SETUMASK          0x0020  /* Set umask */
19 #define        LOGIN_SETUSER           0x0040  /* Set user */
20 #define        LOGIN_SETENV            0x0080  /* Set environment */
21 #define        LOGIN_SETALL            0x00ff  /* Set all. */
22
23 typedef struct login_cap login_cap_t;
24 struct passwd;
25 int setusercontext(login_cap_t *, struct passwd *, uid_t, unsigned int);
26 #endif /* !HAVE_LOGIN_CAP_H */
27
28 /* pwd.h */
29 #define _PW_NAME_LEN 63
30
31 /* stdlib.h */
32 #ifndef HAVE_REALLOCARRAY
33 void * reallocarray(void *optr, size_t nmemb, size_t size);
34 #endif /* HAVE_REALLOCARRAY */
35 #ifndef HAVE_STRTONUM
36 long long strtonum(const char *numstr, long long minval,
37                 long long maxval, const char **errstrp);
38 #endif /* !HAVE_STRTONUM */
39
40 /* string.h */
41 #ifndef HAVE_EXPLICIT_BZERO
42 void explicit_bzero(void *, size_t);
43 #endif
44 #ifndef HAVE_STRLCAT
45 size_t strlcat(char *dst, const char *src, size_t dsize);
46 #endif /* !HAVE_STRLCAT */
47 #ifndef HAVE_STRLCPY
48 size_t strlcpy(char *dst, const char *src, size_t dsize);
49 #endif /* !HAVE_STRLCPY */
50
51 /* unistd.h */
52 #ifndef HAVE_EXECVPE
53 int execvpe(const char *, char *const *, char *const *);
54 #endif /* !HAVE_EXECVPE */
55 #ifndef HAVE_SETRESUID
56 int setresuid(uid_t, uid_t, uid_t);
57 #endif /* !HAVE_SETRESUID */
58 #ifndef HAVE_PLEDGE
59 int pledge(const char *promises, const char *paths[]);
60 #endif /* !HAVE_PLEDGE */
61
62 /* err.h */
63 #ifndef HAVE_VERRC
64 void verrc(int eval, int code, const char *fmt, va_list ap);
65 #endif /* !HAVE_VERRC */
66 #ifndef HAVE_ERRC
67 void errc(int eval, int code, const char *fmt, ...);
68 #endif /* !HAVE_ERRC */
69
70 #ifndef HAVE_SETPROGNAME
71 const char * getprogname(void);
72 void setprogname(const char *progname);
73 #endif /* !HAVE_SETPROGNAME */
74
75 #endif /* _LIB_OPENBSD_H_ */