diff options
author | Alexander Mohr <alexander.m.mohr@mercedes-benz.com> | 2022-10-05 10:23:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 10:23:44 +0200 |
commit | 34471d85fca14a5ec359d2d06a8d7018cb23beb2 (patch) | |
tree | dc72a52209b959681290f0beaf57d41ef33377ad /systemd | |
parent | 450d002090876725f5df486cc66ffb08d5c618e4 (diff) | |
download | DLT-daemon-34471d85fca14a5ec359d2d06a8d7018cb23beb2.tar.gz |
systemd: add support for socket activation via systemd (#401)
dlt-daemon now support activation via systemd socket.
This allows dlt-daemon to be started as soon as an application
is requesting access to the dlt socket.
This commits implements opening the socket only when
UNIX_SOCKET is used for IPC
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Diffstat (limited to 'systemd')
-rw-r--r-- | systemd/CMakeLists.txt | 6 | ||||
-rwxr-xr-x | systemd/dlt.socket.cmake | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index 50e91d9..bfd4cd9 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -63,6 +63,12 @@ if(WITH_SYSTEMD) install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt-adaptor-udp.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) endif(WITH_DLT_ADAPTOR_UDP) + if (WITH_SYSTEMD_SOCKET_ACTIVATION) + configure_file(${PROJECT_SOURCE_DIR}/systemd/dlt.socket.cmake ${PROJECT_BINARY_DIR}/systemd/dlt.socket) + message( STATUS "Configured systemd socket file:dlt.socket" ) + install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt.socket DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) + endif() + message(STATUS "Unit files will be installed to ${SYSTEMD_CONFIGURATIONS_FILES_DIR} after make install" ) endif(WITH_SYSTEMD) diff --git a/systemd/dlt.socket.cmake b/systemd/dlt.socket.cmake new file mode 100755 index 0000000..9764c0f --- /dev/null +++ b/systemd/dlt.socket.cmake @@ -0,0 +1,8 @@ +[Socket] +ListenStream=@DLT_USER_IPC_PATH@/dlt +FileDescriptorName=@DLT_USER_IPC_PATH@/dlt +SocketGroup=dlt +SocketMode=0666 + +[Install] +WantedBy=sockets.target
\ No newline at end of file |