ipc: Allow IPC path to be set dynamically

Uses cache for XRT_IPC_MSG_SOCK_FILE
This commit is contained in:
Robbie Bridgewater 2022-05-03 21:30:25 -04:00 committed by Jakob Bornecrantz
parent 74d82ff37f
commit cc2e7b6da3
8 changed files with 8 additions and 5 deletions

View file

@ -305,6 +305,7 @@ option_with_deps(XRT_BUILD_DRIVER_SIMULAVR "Enable simula driver" DEPENDS XRT_HA
option(XRT_BUILD_DRIVER_SIMULATED "Enable simulated driver" ON)
option(XRT_BUILD_SAMPLES "Enable compiling sample code implementations that will not be linked into any final targets" ON)
set(XRT_IPC_MSG_SOCK_FILENAME monado_comp_ipc CACHE STRING "Service socket filename")
# cmake-format: on

View file

@ -28,3 +28,4 @@
#cmakedefine XRT_FEATURE_TRACING
#cmakedefine XRT_FEATURE_CLIENT_DEBUG_GUI
#cmakedefine XRT_FEATURE_WINDOW_PEEK
#cmakedefine XRT_IPC_MSG_SOCK_FILENAME "@XRT_IPC_MSG_SOCK_FILENAME@"

View file

@ -132,7 +132,7 @@ ipc_connect(struct ipc_connection *ipc_c)
char sock_file[PATH_MAX];
int size = u_file_get_path_in_runtime_dir(IPC_MSG_SOCK_FILE, sock_file, PATH_MAX);
int size = u_file_get_path_in_runtime_dir(XRT_IPC_MSG_SOCK_FILENAME, sock_file, PATH_MAX);
if (size == -1) {
IPC_ERROR(ipc_c, "Could not get socket file name");
return -1;

View file

@ -88,7 +88,7 @@ create_listen_socket(struct ipc_server_mainloop *ml, int *out_fd)
char sock_file[PATH_MAX];
int size = u_file_get_path_in_runtime_dir(IPC_MSG_SOCK_FILE, sock_file, PATH_MAX);
int size = u_file_get_path_in_runtime_dir(XRT_IPC_MSG_SOCK_FILENAME, sock_file, PATH_MAX);
if (size == -1) {
U_LOG_E("Could not get socket file name");
return -1;

View file

@ -19,10 +19,10 @@
#include "xrt/xrt_compositor.h"
#include "xrt/xrt_device.h"
#include "xrt/xrt_tracking.h"
#include "xrt/xrt_config_build.h"
#include <sys/types.h>
#define IPC_MSG_SOCK_FILE "monado_comp_ipc"
#define IPC_MAX_SWAPCHAIN_HANDLES 8
#define IPC_CRED_SIZE 1 // auth not implemented
#define IPC_BUF_SIZE 512 // must be >= largest message length in bytes

View file

@ -225,7 +225,7 @@ do_connect(struct ipc_connection *ipc_c)
char sock_file[PATH_MAX];
int rt_size = u_file_get_path_in_runtime_dir(IPC_MSG_SOCK_FILE, sock_file, PATH_MAX);
int rt_size = u_file_get_path_in_runtime_dir(XRT_IPC_MSG_SOCK_FILENAME, sock_file, PATH_MAX);
if (rt_size == -1) {
PE("Could not get socket file name");
return -1;

View file

@ -7,6 +7,7 @@ set(XRT_INSTALL_ABSOLUTE_SYSTEMD_UNIT_FILES @XRT_INSTALL_ABSOLUTE_SYSTEMD_UNIT_F
set(conflicts @conflicts@)
set(exit_on_disconnect @exit_on_disconnect@)
set(service_path "monado-service")
set(XRT_IPC_MSG_SOCK_FILENAME @XRT_IPC_MSG_SOCK_FILENAME@)
if(XRT_INSTALL_ABSOLUTE_SYSTEMD_UNIT_FILES)
set(service_path "${CMAKE_INSTALL_PREFIX}/@CMAKE_INSTALL_BINDIR@/${service_path}")
endif()

View file

@ -7,7 +7,7 @@ ConditionUser=!root
Conflicts=@conflicts@.socket
[Socket]
ListenStream=%t/monado_comp_ipc
ListenStream=%t/@XRT_IPC_MSG_SOCK_FILENAME@
RemoveOnStop=true
[Install]