summaryrefslogtreecommitdiff
path: root/src/daemon/dlt-daemon.c
Commit message (Collapse)AuthorAgeFilesLines
* Code beautification using uncrustifyChristoph Lipka2018-12-211-1217/+1000
| | | | Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
* dlt-daemon: Output current number of connections as defaultYusuke Sato2018-12-211-15/+18
| | | | | | | | | | In previous, number of connections was output only if verbose mode in dlt.conf was enabled. This information is basically useful and is not output frequently. Therefore number of connections information is made to output as default when new connection is established or the connection is lost. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* exit DLT daemon if /dev/null open fails during forkJeevan Ramakant Nagvekar2018-12-211-0/+5
| | | | | | | If /dev/null fails to open during DLT daemon's fork handling, it is treated as an error and DLT daemon exits. Signed-off-by: Jeevan Ramakant Nagvekar <jeevan.nagvekar1@wipro.com>
* Improvement - use dup2 in place of dup in daemon forkJeevan Ramakant Nagvekar2018-12-211-16/+19
| | | | | | | | | | | 1> While daemonizing DLT, for connecting I/O file descriptors to /dev/NULL POSIX call dup() is used. dup2() POSIX call is now used where explicit standard I/O descriptor number is mentioned. 2>After fork() directory changed to root in place of FIFO Base directory - "/tmp" Signed-off-by: Jeevan Ramakant Nagvekar <jeevan.nagvekar1@wipro.com>
* Remove one-instance-lock mechanismJeevan Ramakant Nagvekar2018-12-211-31/+1
| | | | | | | | | | | | | | This commit removes DLT's "one-instance-lock" mechanism. In daemonized mode, on first instance, a file is created (if not already created) and locked. If second instance is attempted file locking fails since the file is already locked by first instance. This prevents new instance of the DLT daemon. After analysis its found that there is no need of any mechanism for prevention of another instance. The same is already taken care by socket mechanism. Since main socket is created by first instance, attempt to create it again with same port number fails. Signed-off-by: Jeevan Ramakant Nagvekar <jeevan.nagvekar1@wipro.com>
* daemon: Add exit triggerSaya Sugiura2018-12-211-13/+18
| | | | | Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* UnitTest: UpdatesManikandanC2018-12-211-2/+4
| | | | | | | | | | | | Gateway Logstorage Event Handler Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Aditya Paluri <venkataaditya.paluri@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* Removed log level change callback notification while context register done ↵Ravi Sankar P2018-12-211-6/+10
| | | | | | with ll_ts API Signed-off-by: Ravi Sankar P <ponnurangamravi.sankar@in.bosch.com>
* Dynamic allocation of msg bufferManikandanC2018-12-101-4/+5
| | | | | | | | | | | | | It is possible to change the default buffer size for log message creation via environment variable: export DLT_LOG_MSG_BUF_LEN=<value> Instead of using a static buffer with size of 1390 bytes, the buffer is allocated dynamically with the specified value.The max size is restricted to approx 65k. Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* Use poll in the dlt-daemon for POSIX complianceManikandanC2018-11-301-10/+10
| | | | | | | | | | | The poll system call is now used in the daemon to enable DLT use in POSIX compliant systems. Also added introduced new unregister_app macro to avoid missing of logs in startup buffer. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com>
* Log storage - Updates (#82)ManikandanChockalingam2018-11-151-5/+8
| | | | | | | | | | - improvements and refactor key creation - Sync strategies added Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Ravi Sankar P <ponnurangamravi.sankar@in.bosch.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* dlt-daemon: per ECU list of user information (#80)ManikandanChockalingam2018-10-301-49/+74
| | | | | | Prepare daemon to store applications/context information of other ECUs as well. This commit prepares the dlt-daemon to store logs from passive nodes in a logstorage device. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* Fix compiler warning PR #77Christoph Lipka2018-09-251-1/+1
| | | | | | warning: extra tokens at end of #ifdef directive Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
* Fix compilation with glibc 2.28 (#77)Oleksndr Kravchuk2018-09-251-1/+1
| | | | | | | | Package compilation fails with GLIBC 2.28: stat.h:56:8: error: redefinition of 'struct statx_timestamp' stat.h:99:8: error: redefinition of 'struct statx' Signed-off-by: Oleksandr Kravchuk <oleksandr.kravchuk@pelagicore.com>
* dlt-daemon: Output signal number at exit (#68)Yusuke Sato2018-05-291-7/+8
| | | | | | | | | | | So far, signal number had been output in signal handler. However this was not so safety. And when syslog was used as log output destination of dlt_log(), we could not see any info in the same Life Cycle. So dlt_log() is removed from signal handler and signal number is newly output by DLT message and dlt_log() at exit. This info will help analysis why dlt-daemon exits. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* dlt-daemon: Improve error logging on accept() failure (#69)Yusuke Sato2018-05-281-3/+3
| | | | | | | | | Error log in case of accept() failure is improved with errno info. This helps us to analyze dlt-daemon's issue in future. (e.g.) Connection request come to wrong socket unexpectedly and this causes exiting dlt-daemon. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* dlt-daemon: Avoid to output duplicated application registration message (#63)Yusuke Sato2018-05-231-11/+21
| | | | | | | | | | | | | | | | If application tries to send application registration request before dlt-daemon startup, the request is sent twice as below: 1. Buffered request in user library buffer 2. New request when user app succeeds to attach to dlt-daemon In previous, dlt-daemon had been output the registration messages 2 times even though these messages were come from same application. This duplicated output is avoided by this change. Warning message in case of dlt-runtime-context.cfg exists is also avoided. This file is created when Control message: "Store Config" is used. This is not irregular case. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* dlt-daemon: Not output Context un-/registration DLT message by default (#62)Yusuke Sato2018-05-231-5/+11
| | | | | | | | | | | This patch changes Context un-/registration message not to output DLT by default for the purpose of reducing trace messages. Actually dlt-daemon already sends almost same meaning control message which can show Context un-/registration([get_log_info] and [unregister_context]). These are duplicate message and should be suppressed in normal case. Only if "Verbose = 1" is set in dlt.conf, the messages are output as same as before. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* IPC: Unix socket added (#43)ManikandanChockalingam2018-05-181-46/+206
| | | | | | | | | * IPC: Unix socket added The user can select either FIFO or UNIX socket as IPC between user library and daemon through CMakelist option. Socket path configurable for both FIFO and Unix Socket now configurable in CMake Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* dlt-daemon: Fix repeated output of marker message (#54)Yusuke Sato2018-05-081-1/+4
| | | | | | | | Marker message had been continued to output if application called dlt_log_marker() due to missing byte removing processing against marker message. Therefore the byte removing for marker message processing is added. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* Data stuck in receiver buffer when dlt_daemon_user_send_log_level() fails (#21)Lutz Helwing2017-08-221-5/+1
| | | | | | | | | | | | - When dlt_daemon_user_send_log_level() called in dlt_daemon_process_user_message_register_context() fails -1 was returned which caused dlt_daemon_process_user_messages() to stop processing receiver buffer. Remaining data was stuck until new data arrived over FIFO. - Make debug output of dlt_daemon_user_send_log_level() more verbose. Signed-off-by: Lutz Helwing <lutz_helwing@mentor.com>
* MultiNode: Specify config file location in dlt.confChristoph Lipka2016-10-241-0/+14
| | | | Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* process user message: Fix bound handlingFrederic Berat2016-10-241-16/+99
| | | | | | | | | | | | | | | | | | | | | | | | On context and application registration, the data needs to be read in 2 parts. If the first part was at the end of the receiver buffer, it was wrongly removed whereas the complete data is not full received and therefore interpretable. This has to be fixed by not removing the data before everything is checked. Thus, while readjusting the buffer to the first found header, the offset was not properly updated. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Process User Messages: Fix buffer handling In case application and context registration the buffer need to be read two times. But before removing the data, the data need to be readjusted to its origin. This was missing in a previous fix. Furthermore, in case of corrupted description field, applications and contexts will be registered anyway with the dummy description "Unknown". Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* Fix: dlt-daemon overwrites ECU ID even if user log message already has the ↵Yusuke Sato2016-09-231-2/+2
| | | | | | | | | | | ECU ID that is not default value dlt-daemon overwrites ECU ID even if user log message already has the ECU ID that is not default value. This phenomenon happens when application uses dlt_forward_msg(). Therefore, dlt-daemon is modified not to overwrite ECU ID if log message has already has the ECU ID. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp> Change-Id: Icbc6304e5571242bf75ff0d32cbe4b004f1d7f9d
* Add: Configuration of option of get log info response during context ↵Yusuke Sato2016-09-231-1/+7
| | | | | | | | | | registration Option of get log info response during context registration was fixed to 7. This modification enables to change that option. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp> Change-Id: Ia75f15cdb33e0bffd77c5ba71a1960e820714e61
* Add: Configuration of daemon FIFO sizeYusuke Sato2016-09-231-0/+28
| | | | | | | 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
* dlt-daemon: Free DltDaemon structure on exitChristoph Lipka2016-04-281-3/+2
| | | | | Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Change-Id: I504664fa8d2a4c6d9449a1911bf139dfe6005d76
* dlt-daemon: Fix user log handler return valueFrederic Berat2016-04-281-8/+8
| | | | | | | | The user log message handler was returning 1 instead of -1 in case of failure, which was not expected. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Change-Id: Id03b2879f631e804f9939a9f52132be26491f888
* dlt-daemon: Connection activation reworkFrederic Berat2016-04-281-2/+1
| | | | | | | | The activation of the connection is now centralized in one common function. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Change-Id: I86703eab411088905a85f526d5102875e2c92b7e
* dlt-daemon: receiver reworkFrederic Berat2016-04-281-615/+595
| | | | | | | | | | The receiver structures have been removed from the dlt-daemon structure, they are now part of the connection. The overall usage of the receiver structrure has also been reviewed in the daemon. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Change-Id: I7cf80d79ed73bd6d4f370bb3f278d26ccc9d8d7a
* Set default log-levels in dlt.confStefan Vacek2015-12-091-5/+47
| | | | | | | | - feature: allow to define a default-log-level in dlt.conf (see dlt.conf for documentation) - bugfix: make dlt_unlock_mutex not inline to fix linkage - bugfix: initial log-level was not set correctly when no dlt-daemon was running Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
* Dlt MultiNodeChristoph Lipka2015-12-071-116/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MultiNode allows to connect DLT Daemons running on different operating systems, e.g. in a virtualized environment. The central component is the Gateway DLT Daemon which connects external DLT Clients, like the DLT Viewer running on a host computer, with Passive DLT Daemons running on nodes without a physical connection to external DLT clients. The Gateway DLT Daemon itself acts as a DLT client when connecting to a Passive DLT Daemon. To use the Gateway functionality, it has to be enabled in dlt.conf: GatewayMode = 1 All communication between passive nodes and DLT Viewer has to be send via the Gateway node. The Gateway node forwards log messages coming from passive nodes to all connected DLT clients. It also forwards command and control requests coming from DLT clients to the corresponding passive node. The Gateway DLT Daemon read a configuration file (dlt_gateway.conf) at startup with information about Passive DLT Daemon connections. Afterwards, the Daemon will try to connect to the passive DLT Daemons. If the connection cannot be established after the configured timeout, the Gateway DLT Daemon will give up connecting. The configuration file has to contain the following information about a passive node: [PassiveNode1] IPaddress = 192.168.2.35 Port = 3490 EcuID = ECU2 Connect = OnStartup ; timeout in seconds Timeout = 10 Precondition is, that the passive node is configured with the correct ECU id, ECU2 in this case. If the passive node sends messages with another than configured ECU id, the Gateway DLT Daemon will shut down the connection. It is also possible to connect to a passive DLT daemon using the dlt-passive-node-ctrl application. In this case "Connect=OnDemand" has to be configured in the configuration file. To connect to PassiveNode1, "dlt-passive-node-ctrl -n ECU2 -c 1" has to be executed. With "dlt-passive-node-ctrl -s" the status of passive node connections can be retrieved. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* Fix daemon shutdownChristoph Lipka2015-11-241-7/+30
| | | | | | | | | The shutdown of the daemon was not proper implemented. This commit fixes: - memory leaks - removal of created sockets Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* DltLogstorage: Logstorage CacheChristoph Lipka2015-11-241-6/+23
| | | | | | | | | | | | | | | | | | When using DltLogstorage on internal storage device, it is needed to reduce writing to internal storage device as much as possible. This patch introduces sync strategies to Logstorage to provide that functionality. The ON_MSG strategy is the default sync strategy that flushes every written log message to the storage device (fflush). The ON_DAEMON_EXIT strategy only flushes data to disk when the daemon exits. The strategy can be defined per filter in the dlt_logstorage.conf configuration file by adding SyncBehavior=<Strategy> to a configuration. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* Offline logstorage: Offline logstorage featureS. Hameed2015-11-241-2/+46
| | | | | | | | | | | | | | Features: 1. Offline log storage to internal and external devices (PATH based trigger) 2. File options configurable in dlt.conf a : Appends timestamp in log file name (OfflineLogstorageTimestamp) b : Appends delimiter in log file name (OfflineLogstorageDelimiter) c : Wrap around value for log file count in file name (OfflineLogstorageMaxCounter) 3. Common config file parser support Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* Unix socket control interfaceChristoph Lipka2015-11-241-0/+162
| | | | | | | | | | | | | | | | Control applications running in the same Linux OS should be able to communicate with the DLT Daemon via a socket connection. To be able to do that, the DLT Client library need to be extended. DLT Clients connected via this UNIX socket are not handled as normal DLT Clients and no log messages will be forwarded to them. This avoids problems in situations when a control application is connected to the DLT Daemon before any other 'real' DLT Client (e.g. DLT Viewer) is connected. In this situations, all already stored log messages are flushed to the control application and therefore lost, because the control application most likely ignore all incoming messages besides the one in which it is interested in. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* offline trace: supported trace file name configuration based on indexManikandan C2015-11-181-1/+11
| | | | | | | | | Changes made for trace file name configuration based on index and made it configurable from dlt.conf file. Using this configuration one can select either timestamp based or index based log file creation for offline trace. Signed-off-by: Manikandan C <Manikandan.Chockalingam@in.bosch.com>
* dlt-daemon: Implement epoll based event handlingFrederic Berat2015-11-111-283/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | The event handling has been reworked in order to use epoll and restructure the code. There are 2 new structures. The DltConnection which contains all basic connection information, like the type, the file descriptor, and the receiver structure corresponding. The DltEventHandler that manages the DltConnections and the associated events. The concept is basically the following. The daemon will create different connections, serial connections, socket connections, fifos etc ... Each of them will then register itself to the event handler, and give it the ownership of this connection. From this point in time, the daemon can act on the connections. Once an event is triggered, the event handler will call the connection specific callback, creates new connections when clients arrives, and potentially destroy the connection in case of hangup. On exit, the daemon cleanup the event handler, which leads to the destruction of the connections. The work there is a first step for a global restructuring. Several modification will follow, in order to rationalize the different daemon structures, and avoid variable and code duplication. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com>
* DLT daemon improvement - dlt_init()-checkLutz Helwing2015-10-071-875/+875
| | | | | | | | | | DLT daemon improvement - parameter value range check Adapt unit tests to check for enum return values Changed C version to gnu99 and C++ version to gnu++0c Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Fixed INTERNAL-mode connection bug in dlt-daemonSven Hassler2015-10-071-1/+1
| | | | | | | | | | | When logging-mode of the DLT-daemon was set to DLT_USER_MODE_INTERNAL or DLT_USER_MODE_OFF and a client tried to connect to the daemon, the socket for accepting new connections would be closed. This would make connecting to the daemon impossible, even if the logging mode was reset to DLT_USER_MODE_EXTERNAL or DLT_USER_MODE_BOTH. Fixed this by removing conditional check on the logging mode - clients connections are always accepted now. If the logging-mode is being switched from INTERNAL to EXTERNAL or BOTH while a client is connected, the client will then start to receive messages normally. Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Allow multiple instances of dlt-daemonStefan Vacek2015-10-071-20/+75
| | | | | | | | | | | | | | | | - Make dlt-daemon configurable to specify directory of fifos and port of dlt-daemon, this allows to run multiple instances of dlt-daemon at one node at the same time. This is useful in testing environment where simultanous tests should not interfere due to the same instance of dlt-daemon - dlt-daemon: add option -t <dir> to specify a directory where all fifos will be created - dlt-daemon: add option -p <port> to specify the port under which dlt-daemon can be connected - client-library: add environment variable DLT_PIPE_DIR to specify a non-default directory of fifos for logging applications - client-library: add environment variable DLT_DAEMON_TCP_PORT to specify the port under which dlt-daemon can be reached (especially when using dlt-receive) Signed-off-by: Stefan Vacek <stefan.vacek@intel.com> Signed-off-by: Lutz Helwing <lutz_helwing@mentor.com>
* Offline Logstorage [1/4]: DLT preparation to enable offline logstorageS. Hameed2015-07-301-0/+27
| | | | Signed-off-by: S. Hameed <shameed@jp.adit-jv.com>
* Removed all trailing whitespacesLutz Helwing2015-07-211-31/+31
| | | | Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Fix compilation warnings and possible misuse of snprintStefan Vacek2015-07-211-3/+0
| | | | | | | | | - sprintf was used were snprint was intended - make proper usage of 64bit values in printf-formatting - remove some not used variables - make some casts to make printf happy Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
* Fixed license headers and copyright doxygen commentsLutz Helwing2015-06-171-2/+2
| | | | Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Updated license headers to latest GENIVI license policy. Fixed further LRT ↵Lutz Helwing2015-06-171-11/+15
| | | | | | Scan findings. Renamed and cleanup further files. Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* dlt-daemon: Explicitly set the default loggingLevel to LOG_INFOSid Heroor2015-06-171-1/+1
| | | | Signed-off-by: Sid Heroor <heroor@heptaxel.com>
* dlt-daemon: Explicitly set the default loggingMode to DLT_LOG_TO_CONSOLESid Heroor2015-06-171-1/+1
| | | | Signed-off-by: Sid Heroor <heroor@heptaxel.com>
* Remove absolute installation paths so that DLT can be installed at any ↵Jacques GUILLOU2015-04-021-2/+2
| | | | | | location (not only "/usr"). Signed-off-by: Jacques GUILLOU <jacques.guillou@pelagicore.com>
* Change daemon state handling to have all traces in online trace even when ↵Sascha Philipp2015-03-251-4/+8
| | | | | | | offline trace is active Change-Id: Ic212c4956582b18e05739d593bf5c792d60d9c00 Signed-off-by: Sascha Philipp <sascha.philipp@continental-corporation.com>