diff options
author | Martin Ejdestig <martin.ejdestig@volvocars.com> | 2020-12-14 01:43:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-14 09:43:52 +0900 |
commit | 8f5e3dc0f3134ea2fdaffd13a16464b1a2f2ecd4 (patch) | |
tree | cd371956f6098d4d7e9e0937a929e87e5e5f0f71 /.github | |
parent | 329ba78deb40558df30aa8731928c9887197d30b (diff) | |
download | DLT-daemon-8f5e3dc0f3134ea2fdaffd13a16464b1a2f2ecd4.tar.gz |
Add support for logging with VSOCK (#255)
For more information about VSOCK, see "man vsock"
( https://man7.org/linux/man-pages/man7/vsock.7.html ).
Makes it possible for processes in a virtual machine to log directly in
DLT running on host without setting up a network connection between
guest and host. It is also probably more efficient. Have not done any
performance measurements (not main reason for patch), but no forwarding
is required as when running DLT in a multi-node setup.
When building dlt-daemon for host, WITH_DLT_DAEMON_VSOCK_IPC should be
enabled for daemon to listen on incoming VSOCK requests. Local
communication method between applications and daemon is still determined
with DLT_IPC. When building for guest, WITH_DLT_LIB_VSOCK_IPC should be
enabled and DLT_IPC will be ignored, which will make libdlt open a VSOCK
socket to the deamon for logging messages.
VSOCK can be tested without a virtual machine. Since VMADDR_CID_HOST is
used by libdlt when connecting, see vsock man page, clients can be run
on host to test VSOCK communication.
Some modifications has been done to be able to handle logging through
FIFO pipe and socket in the same build of dlt-daemon:
- dlt_receiver_init/free_unix_socket() is renamed to
dlt_receiver_init/free_global_buffer() and used for FIFO as well.
Also fixes memory leak since dlt_receiver_free_unix_socket() was used
regardless of whether DLT_USE_UNIX_SOCKET was defined or not.
- Pass type to dlt_receiver_init() instead of dlt_receiver_receive().
And remove preprocessor conditionals for handling
DLT_CONNECTION_APP_MSG in dlt_daemon_process_user_messages(). Also
fixes wrong enum type being passed to dlt_receiver_receive() in
dlt_client.c (DltClient::mode was used as a DltReceiverType enum but
it is a DltClientMode enum).
- Add a flag to DltDaemonApplication to indicate whether file descriptor
is "owned" by the DltDaemonApplication or not. When
dlt_daemon_application_add() is called due to message received on a
socket, fd is passed as an argument (app does not own fd). For FIFO,
a per application FIFO is opened (app owns the fd). Also fixes so that
user handle is reset for both application and all its contexts when
resetting any. Prevents fd from being used by accident after it has
been closed.
dlt_mkdir_recursive() is moved to src/daemon since it is only used in
the daemon. Minimizes use of DLT_USE_UNIX_SOCKET_IPC.
Other bugfixes:
- Call DLT_SEM_FREE() if setting socket to O_NONBLOCK fails in
src/lib/dlt_user.c:dlt_initialize_socket_connection().
- Close socket if dlt_receiver_init() fails in
src/lib/dlt_user.c:dlt_initialize_socket_connection().
Signed-off-by: Martin Ejdestig <martin.ejdestig@volvocars.com>
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions