summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYusuke Sato <yusuke-sato@apn.alpine.co.jp>2016-02-29 19:39:31 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2016-09-23 15:37:25 +0200
commit52d455f03f81a84bc9454e526591d37407cdc4d1 (patch)
treede39b780ec3dc6a7d9b332492f244c781edb672b /src
parente4182740e0e6477623f0a4ed269086aa5ccdd388 (diff)
downloadDLT-daemon-52d455f03f81a84bc9454e526591d37407cdc4d1.tar.gz
Add: Configuration of daemon FIFO size
Configuration of daemon FIFO (default: /tmp/dlt) size is added to dlt.conf. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp> Change-Id: I05cc56b9a05e4c3a0a1af49c374f35ae10f4674d
Diffstat (limited to 'src')
-rw-r--r--src/daemon/dlt-daemon.c28
-rw-r--r--src/daemon/dlt-daemon.h1
-rw-r--r--src/daemon/dlt.conf3
3 files changed, 32 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 6d58bb4..f075b09 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -231,6 +231,7 @@ int option_file_parser(DltDaemonLocal *daemon_local)
daemon_local->RingbufferMinSize = DLT_DAEMON_RINGBUFFER_MIN_SIZE;
daemon_local->RingbufferMaxSize = DLT_DAEMON_RINGBUFFER_MAX_SIZE;
daemon_local->RingbufferStepSize = DLT_DAEMON_RINGBUFFER_STEP_SIZE;
+ daemon_local->daemonFifoSize = 0;
daemon_local->flags.sendECUSoftwareVersion = 0;
memset(daemon_local->flags.pathToECUSoftwareVersion, 0, sizeof(daemon_local->flags.pathToECUSoftwareVersion));
daemon_local->flags.sendTimezone = 0;
@@ -396,6 +397,10 @@ int option_file_parser(DltDaemonLocal *daemon_local)
{
sscanf(value,"%lu",&(daemon_local->RingbufferStepSize));
}
+ else if(strcmp(token,"DaemonFIFOSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->daemonFifoSize));
+ }
else if(strcmp(token,"SharedMemorySize")==0)
{
daemon_local->flags.sharedMemorySize = atoi(value);
@@ -972,6 +977,7 @@ static int dlt_daemon_init_fifo(DltDaemonLocal *daemon_local)
{
int ret;
int fd = -1;
+ int fifo_size;
char local_str[DLT_DAEMON_TEXTBUFSIZE];
/* open named pipe(FIFO) to receive DLT messages from users */
@@ -1005,6 +1011,28 @@ static int dlt_daemon_init_fifo(DltDaemonLocal *daemon_local)
return -1;
} /* if */
+ if (daemon_local->daemonFifoSize != 0)
+ {
+ /* Set Daemon FIFO size */
+ if (fcntl(fd, F_SETPIPE_SZ , daemon_local->daemonFifoSize) == -1)
+ {
+ snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"set FIFO size error: %s\n",strerror(errno));
+ dlt_log(LOG_ERR, str);
+ }
+ }
+
+ /* Get Daemon FIFO size */
+ if ((fifo_size = fcntl(fd, F_GETPIPE_SZ , 0)) == -1)
+ {
+ snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"get FIFO size error: %s\n",strerror(errno));
+ dlt_log(LOG_ERR, str);
+ }
+ else
+ {
+ snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"FIFO size: %d\n",fifo_size);
+ dlt_log(LOG_INFO, str);
+ }
+
/* Early init, to be able to catch client (app) connections
* as soon as possible. This registration is automatically ignored
* during next execution.
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index ad169fc..947b892 100644
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -148,6 +148,7 @@ typedef struct
unsigned long RingbufferMinSize;
unsigned long RingbufferMaxSize;
unsigned long RingbufferStepSize;
+ unsigned long daemonFifoSize;
} DltDaemonLocal;
typedef struct
diff --git a/src/daemon/dlt.conf b/src/daemon/dlt.conf
index 376a94f..4d8561c 100644
--- a/src/daemon/dlt.conf
+++ b/src/daemon/dlt.conf
@@ -56,6 +56,9 @@ RingbufferMaxSize = 10000000
# The step size the Ringbuffer is increased, used for storing temporary DLT messages, until client is connected (Default: 500000)
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)
+# DaemonFIFOSize = 65536
+
# Initial log-level that is sent when an application registers (Default: 4)
# 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
# ContextLogLevel = 4