From 52d455f03f81a84bc9454e526591d37407cdc4d1 Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Mon, 29 Feb 2016 19:39:31 +0100 Subject: Add: Configuration of daemon FIFO size Configuration of daemon FIFO (default: /tmp/dlt) size is added to dlt.conf. Signed-off-by: Yusuke Sato Change-Id: I05cc56b9a05e4c3a0a1af49c374f35ae10f4674d --- src/daemon/dlt-daemon.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/daemon/dlt-daemon.c') 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. -- cgit v1.2.1