diff options
author | Mattias Andrée <maandree@kth.se> | 2017-11-06 23:43:22 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2017-11-06 23:43:22 +0100 |
commit | 3145df792e44939c34b506b015e12a4c5235c9fa (patch) | |
tree | f75c2a12ee613cb80eb224c734edef4d51329074 /libsbusd.h | |
parent | Remove unused headers (diff) | |
download | sbus-3145df792e44939c34b506b015e12a4c5235c9fa.tar.gz sbus-3145df792e44939c34b506b015e12a4c5235c9fa.tar.bz2 sbus-3145df792e44939c34b506b015e12a4c5235c9fa.tar.xz |
Fix two errors and move reuseable code from sbusd to libsbusd
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libsbusd.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libsbusd.h b/libsbusd.h new file mode 100644 index 0000000..535c1d3 --- /dev/null +++ b/libsbusd.h @@ -0,0 +1,32 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef LIBSBUSD_H +#define LIBSBUSD_H + +#include <sys/un.h> +#include <stdlib.h> + +enum { + LIBSBUS_AFUNIX_FD, + LIBSBUS_AFUNIX_RANDOM, + LIBSBUS_AFUNIX_ABSTRACT, + LIBSBUS_AFUNIX_CONCRETE +}; + +#ifndef eprintf +# define eprintf(...) (libsbusd_weprintf(__VA_ARGS__), exit(1)) +#endif + +void libsbusd_weprintf(const char *, ...); +#ifndef weprintf +# define weprintf libsbusd_weprintf +#endif + +int libsbusd_doessubmatch(const char *, const char *); +int libsbusd_issubed(char *const *, size_t, const char *); +void libsbusd_adduser(uid_t *, size_t *, const char *); +void libsbusd_daemonise(const char *, void (*)(int)); +int libsbusd_afunix(struct sockaddr_un *, int *, const char *); +int libsbusd_mksocket(struct sockaddr_un *, const char *, int, mode_t); +void libsbusd_initalise(int, const char **, void (*)(int)); + +#endif |