console-socket: Add an optional component to UNIX socket abstract names
Allows multiple instances of obmc-console-server to run concurrently
without interfering with each other.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I7ef9c14e554c687e8d606e1eaaed82a7f1c06d98
diff --git a/console-server.h b/console-server.h
index d6822c5..b6ab1b8 100644
--- a/console-server.h
+++ b/console-server.h
@@ -23,6 +23,7 @@
#include <time.h>
#include <systemd/sd-bus.h>
#include <sys/time.h>
+#include <sys/un.h>
struct console;
struct config;
@@ -138,9 +139,11 @@
int config_parse_logsize(const char *size_str, size_t *size);
/* socket paths */
-extern const char *console_socket_path;
-extern const size_t console_socket_path_len;
-extern const char *console_socket_path_readable;
+ssize_t console_socket_path(struct sockaddr_un *addr, const char *id);
+
+typedef char (socket_path_t)[sizeof(((struct sockaddr_un *)NULL)->sun_path)];
+ssize_t console_socket_path_readable(const struct sockaddr_un *addr,
+ size_t addrlen, socket_path_t path);
/* utils */
int write_buf_to_fd(int fd, const uint8_t *buf, size_t len);