summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaya Sugiura <ssugiura@jp.adit-jv.com>2021-07-21 08:35:47 +0000
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-10-05 11:19:26 +0900
commit79737026ed7b5ddae4c375b564fd5f27f573b025 (patch)
tree933265417c12d61078a98c02032ce01c6a5b2830
parent7d222bed9dff4713d6fb261b56910f216463597b (diff)
downloadDLT-daemon-79737026ed7b5ddae4c375b564fd5f27f573b025.tar.gz
daemon: Enable to use FIFO on QNX
It depends on OSes if maximum size of pipe can be configured per process or not. For example, on QNX it can be only set from pipe resource manager. Also flags used to set the value are only supported on Linux. Now DaemonFIFOSize option in dlt.conf is only relevant for Linux. Also -f option is added to build scripts to enable FIFO as IPC. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
-rw-r--r--doc/dlt.conf.5.md7
-rw-r--r--src/daemon/dlt-daemon.c20
-rw-r--r--src/daemon/dlt.conf1
3 files changed, 22 insertions, 6 deletions
diff --git a/doc/dlt.conf.5.md b/doc/dlt.conf.5.md
index 8109c27..aeb2dfc 100644
--- a/doc/dlt.conf.5.md
+++ b/doc/dlt.conf.5.md
@@ -103,6 +103,13 @@ The step size the Ringbuffer is increased, used for storing temporary DLT messag
Default: 500000
+## Daemon FIFOSize
+
+The size of Daemon FIFO (MinSize: depend on pagesize of system, MaxSize: please check `/proc/sys/fs/pipe-max-size`)
+This is only supported for Linux.
+
+ Default: 65536
+
## ContextLogLevel
Initial log-level that is sent when an application registers. DLT_LOG_OFF = 0, DLT_LOG_FATAL = 1, DLT_LOG_ERROR = 2, DLT_LOG_WARN = 3, DLT_LOG_INFO = 4, DLT_LOG_DEBUG = 5, DLT_LOG_VERBOSE = 6
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index c09a809..fd7d3e5 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -553,12 +553,6 @@ int option_file_parser(DltDaemonLocal *daemon_local)
value, &(daemon_local->RingbufferStepSize)) < 0)
return -1;
}
- else if (strcmp(token, "DaemonFIFOSize") == 0)
- {
- if (dlt_daemon_check_numeric_setting(token,
- value, &(daemon_local->daemonFifoSize)) < 0)
- return -1;
- }
else if (strcmp(token, "SharedMemorySize") == 0)
{
daemon_local->flags.sharedMemorySize = atoi(value);
@@ -714,6 +708,15 @@ int option_file_parser(DltDaemonLocal *daemon_local)
}
#ifdef DLT_DAEMON_USE_FIFO_IPC
+ else if (strcmp(token, "DaemonFIFOSize") == 0)
+ {
+ if (dlt_daemon_check_numeric_setting(token,
+ value, &(daemon_local->daemonFifoSize)) < 0)
+ return -1;
+#ifndef __linux__
+ printf("Option DaemonFIFOSize is set but only supported on Linux. Ignored.\n");
+#endif
+ }
else if (strcmp(token, "DaemonFifoGroup") == 0)
{
strncpy(daemon_local->flags.daemonFifoGroup, value, NAME_MAX);
@@ -1375,11 +1378,16 @@ static int dlt_daemon_init_fifo(DltDaemonLocal *daemon_local)
return -1;
} /* if */
+#ifdef __linux__
+ /* F_SETPIPE_SZ and F_GETPIPE_SZ are only supported for Linux.
+ * For other OSes it depends on its system e.g. pipe manager.
+ */
if (daemon_local->daemonFifoSize != 0) {
/* Set Daemon FIFO size */
if (fcntl(fd, F_SETPIPE_SZ, daemon_local->daemonFifoSize) == -1)
dlt_vlog(LOG_ERR, "set FIFO size error: %s\n", strerror(errno));
}
+#endif
/* Get Daemon FIFO size */
if ((fifo_size = fcntl(fd, F_GETPIPE_SZ, 0)) == -1)
diff --git a/src/daemon/dlt.conf b/src/daemon/dlt.conf
index ab2a9bd..7e19817 100644
--- a/src/daemon/dlt.conf
+++ b/src/daemon/dlt.conf
@@ -61,6 +61,7 @@ RingbufferMaxSize = 10000000
RingbufferStepSize = 500000
# The size of Daemon FIFO (/tmp/dlt) (Default: 65536, MinSize: depend on pagesize of system, MaxSize: please check /proc/sys/fs/pipe-max-size)
+# This is only supported for Linux.
# DaemonFIFOSize = 65536
# Initial log-level that is sent when an application registers (Default: 4)