summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Vacek <stefan.vacek@intel.com>2015-12-01 09:49:57 +0100
committerLutz Helwing <lutz_helwing@mentor.com>2015-12-08 10:03:45 +0100
commit4251a7db0b2a576316a2a5435b72a709fd6101b0 (patch)
tree24bf28cdd0fc2ae3507694de3282cf3cfd69a655
parent98ab520a0d3a36f4a7cfa081742f5aef1f411bf0 (diff)
downloadDLT-daemon-4251a7db0b2a576316a2a5435b72a709fd6101b0.tar.gz
Fix register context before application is registered
Additional: - include sd-daemon.h if watchdog is enabled - fix formatting for printf 64bit values Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
-rw-r--r--src/daemon/dlt_daemon_client.c4
-rw-r--r--src/lib/dlt_user.c11
-rw-r--r--src/system/dlt-system-journal.c4
3 files changed, 7 insertions, 12 deletions
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index 2b23817..b23c5bb 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -50,6 +50,10 @@
#include <linux/stat.h>
#endif
+#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
+#include <systemd/sd-daemon.h>
+#endif
+
#include "dlt_types.h"
#include "dlt-daemon.h"
#include "dlt-daemon_cfg.h"
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 8e5b6a1..8a5d683 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -805,14 +805,6 @@ DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, c
DLT_SEM_LOCK();
- if (dlt_user.appID[0]=='\0')
- {
- dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "No application registered while trying to register ContextID %4s!\n", contextid);
-
- DLT_SEM_FREE();
- return DLT_RETURN_ERROR;
- }
-
if ((contextid == NULL) || (contextid[0] == '\0'))
{
DLT_SEM_FREE();
@@ -3354,7 +3346,6 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
if (log == NULL ||
log->handle == NULL ||
- dlt_user.appID[0] == '\0' ||
log->handle->contextID[0] == '\0' ||
(mtype < DLT_TYPE_LOG) || (mtype > DLT_TYPE_CONTROL)
)
@@ -4295,7 +4286,7 @@ DltReturnValue dlt_user_log_resend_buffer(void)
case DLT_USER_MESSAGE_LOG:
{
DltExtendedHeader * extendedHeader = (DltExtendedHeader *)(dlt_user.resend_buffer+sizeof(DltUserHeader)+
- sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra) - DLT_ID_SIZE);
+ sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra));
if ((extendedHeader) != 0 && (extendedHeader->apid[0]=='\0'))
{ // if application id is empty, add it
dlt_set_id(extendedHeader->apid,dlt_user.appID);
diff --git a/src/system/dlt-system-journal.c b/src/system/dlt-system-journal.c
index 52e1554..cc7ada0 100644
--- a/src/system/dlt-system-journal.c
+++ b/src/system/dlt-system-journal.c
@@ -57,6 +57,7 @@
#include <systemd/sd-journal.h>
#include <systemd/sd-id128.h>
+#include <inttypes.h> /* for PRI formatting macro */
extern DltSystemThreads threads;
@@ -177,7 +178,6 @@ void dlt_system_journal_get_timestamp(sd_journal *journal, MessageTimestamp *tim
snprintf(timestamp->real, sizeof(timestamp->real), "%s.%06"PRIu64, buffer_realtime_formatted, time_usecs % 1000000);
-
/* Try to get monotonic time from message source and if not successful try to get monotonic time from journal entry */
ret = dlt_system_journal_get(journal, buffer_monotime, "_SOURCE_MONOTONIC_TIMESTAMP", sizeof(buffer_monotime));
if (ret == 0 && strlen(buffer_monotime) > 0)
@@ -200,7 +200,7 @@ void dlt_system_journal_get_timestamp(sd_journal *journal, MessageTimestamp *tim
}
}
- snprintf(timestamp->monotonic, sizeof(timestamp->monotonic), "%"PRIu64".%06"PRIu64, time_usecs / 1000000, time_usecs % 1000000);
+ snprintf(timestamp->monotonic, sizeof(timestamp->monotonic), "%llu.%06llu", time_usecs / 1000000, time_usecs % 1000000);
}
void journal_thread(void *v_conf)