summaryrefslogtreecommitdiff
path: root/src/daemon/dlt-daemon.c
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/daemon/dlt-daemon.c
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/daemon/dlt-daemon.c')
-rw-r--r--src/daemon/dlt-daemon.c28
1 files changed, 28 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.