From 4251a7db0b2a576316a2a5435b72a709fd6101b0 Mon Sep 17 00:00:00 2001 From: Stefan Vacek Date: Tue, 1 Dec 2015 09:49:57 +0100 Subject: 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 --- src/daemon/dlt_daemon_client.c | 4 ++++ src/lib/dlt_user.c | 11 +---------- src/system/dlt-system-journal.c | 4 ++-- 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 #endif +#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE +#include +#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 #include +#include /* 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) -- cgit v1.2.1