dlt-daemon: upgrade 2.18.10 to 3.0.0

Changes:
https://github.com/COVESA/dlt-daemon/releases

Remove patches already in 3.0.0:
544.patch
567.patch
0001-CMakeLists-txt-make-DLT_WatchdogSec-can-be-set-by-user.patch
0003-allow-build-with-cmake-4.patch

Add patches to fix build failures
0001-Fix-compile-failure-related-to-gzlog.patch
0001-Fix-kinds-of-build-failure.patch
0001-Fix-build-failures.patch
0001-fix-build-failure-when-systemd-is-enabled.patch
0001-Fix-build-failure-with-glibc-2.43.patch

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Changqing Li 2026-03-18 16:27:01 +08:00 committed by Khem Raj
parent cf4788c916
commit 0001e284a9
No known key found for this signature in database
GPG Key ID: BB053355919D3314
10 changed files with 1088 additions and 260 deletions

View File

@ -1,40 +0,0 @@
From bc03f142507da92add8ba325fdf8187d47a7d719 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Fri, 13 Dec 2024 16:37:24 +0800
Subject: [PATCH] CMakeLists.txt: make DLT_WatchdogSec can be set by user
In my test env, WatchdogSec default value 2 is not enough, manually
changed to 3 is ok. This makes dlt.service/dlt-system.service start
failed during boot time. So, make DLT_WatchdogSec can be set by user, so
user can set them to proper value at build time, then service can start
successfully in boot time.
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Upstream-Status: Backport [https://github.com/COVESA/dlt-daemon/pull/720/commits/bc03f142507da92add8ba325fdf8187d47a7d719]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
systemd/CMakeLists.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
index 16cbe86b5..659378d16 100644
--- a/systemd/CMakeLists.txt
+++ b/systemd/CMakeLists.txt
@@ -18,10 +18,14 @@ if(WITH_SYSTEMD)
set(SYSTEMD_CONFIGURATIONS_FILES_DIR ${SYSTEMD_UNITDIR} )
if(WITH_SYSTEMD_WATCHDOG)
- set( DLT_WatchdogSec 2 )
+ if(NOT DEFINED DLT_WatchdogSec)
+ set(DLT_WatchdogSec 2 CACHE STRING "Watchdog timeout in seconds")
+ endif()
message( STATUS "The systemd watchdog is enabled - timeout is set to ${DLT_WatchdogSec} seconds")
else(WITH_SYSTEMD_WATCHDOG)
- set( DLT_WatchdogSec 0 )
+ if(NOT DEFINED DLT_WatchdogSec)
+ set(DLT_WatchdogSec 0 CACHE STRING "Watchdog timeout in seconds")
+ endif()
message( STATUS "The systemd watchdog is disabled")
endif(WITH_SYSTEMD_WATCHDOG)

View File

@ -0,0 +1,55 @@
From c833520ac8cb473a6d820a063adb10c49304c4a8 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Wed, 18 Mar 2026 13:42:04 +0800
Subject: [PATCH] Fix build failure with glibc 2.43
src/shared/dlt_common.c:6477:17: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
| 6477 | char *dot = strrchr(filename, '.');
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/828]
[1] https://github.com/bminor/glibc/commit/cd748a63ab1a7ae846175c532a3daab341c62690
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
include/dlt/dlt_common.h | 2 +-
src/shared/dlt_common.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h
index 85cf5b7..30d3ca7 100644
--- a/include/dlt/dlt_common.h
+++ b/include/dlt/dlt_common.h
@@ -2308,7 +2308,7 @@ int dlt_execute_command(char *filename, char *command, ...);
* @param filename Only file names without prepended path allowed.
* @return pointer to extension
*/
-char *get_filename_ext(const char *filename);
+const char *get_filename_ext(const char *filename);
/**
* Extract the base name of given file name (without the extension).
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index aa0aaaa..4c379af 100644
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -6467,14 +6467,14 @@ int dlt_execute_command(char *filename, char *command, ...)
return ret;
}
-char *get_filename_ext(const char *filename)
+const char *get_filename_ext(const char *filename)
{
if (filename == NULL) {
fprintf(stderr, "ERROR: %s: invalid arguments\n", __func__);
return "";
}
- char *dot = strrchr(filename, '.');
+ const char *dot = strrchr(filename, '.');
return (!dot || dot == filename) ? NULL : dot;
}
--
2.34.1

View File

@ -0,0 +1,360 @@
From 4813b72cfe82062db41dd1d8cfa7069634d78d9e Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Mon, 16 Mar 2026 13:28:40 +0800
Subject: [PATCH] Fix build failures
Fix the following similar build failures, some of the build failure
reproduced with arm64/riscv64, some of the build reproduced with 32bit
x86/arm.
dlt_daemon_common.c:2785:26: error: conversion to 'int8_t' {aka 'signed char'} from 'char' may change the sign of the result [-Werror=sign-conversion]
src/tests/dlt-test-multi-process-client-v2.c:302:49: error: format '%lld' expects argument of type 'long long int', but argument 2 has type 'time_t' {aka 'long int'} [-Werror=format=]
302 | printf(" Time running (seconds) : %lld\n", time(NULL) - stats.first_message_time);
| ~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| long long int time_t {aka long int}
| %ld
src/lib/dlt_user.c:5109:60: error: format '%lld' expects argument of type 'long long int', but argument 4 has type '__off_t' {aka 'long int'} [-Werror=format=]
5109 | dlt_vlog(LOG_DEBUG, "%s: Current file size=[%lld]\n", __func__,
| ~~~^
| |
| long long int
| %ld
5110 | st.st_size);
| ~~~~~~~~~~
| |
| __off_t {aka long int}
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/827]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
src/daemon/dlt-daemon.c | 8 ++---
src/daemon/dlt_daemon_client.c | 32 ++++++++++----------
src/daemon/dlt_daemon_common.c | 4 +--
src/lib/dlt_user.c | 18 +++++------
src/shared/dlt_common.c | 2 +-
src/shared/dlt_multiple_files.c | 2 +-
src/tests/dlt-test-multi-process-client-v2.c | 8 ++---
src/tests/dlt-test-multi-process-v2.c | 2 +-
src/tests/dlt-test-multi-process.c | 2 +-
9 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 523bf33..2ae5bc9 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -457,7 +457,7 @@ int option_file_parser(DltDaemonLocal *daemon_local)
if (n < 0 || (size_t)n > sizeof(daemon_local->flags.loggingFilename)) {
dlt_vlog(LOG_WARNING, "%s: snprintf truncation/error(%ld) %s\n",
- __func__, n, daemon_local->flags.loggingFilename);
+ __func__, (long int)n, daemon_local->flags.loggingFilename);
}
daemon_local->flags.enableLoggingFileLimit = false;
daemon_local->flags.loggingFileSize = 250000;
@@ -2501,7 +2501,7 @@ void dlt_daemon_exit_trigger()
n = snprintf(tmp, DLT_PATH_MAX, "%s/dlt", dltFifoBaseDir);
if (n < 0 || (size_t)n > DLT_PATH_MAX) {
dlt_vlog(LOG_WARNING, "%s: snprintf truncation/error(%ld) %s\n",
- __func__, n, tmp);
+ __func__, (long int)n, tmp);
}
(void)unlink(tmp);
@@ -2878,8 +2878,8 @@ int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local,
dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local,
msg.headerbuffer, sizeof(DltStorageHeader),
msg.headerbuffer + sizeof(DltStorageHeader),
- (size_t)(msg.headersize - (int32_t)sizeof(DltStorageHeader)),
- msg.databuffer, (size_t)msg.datasize, verbose);
+ (int)(msg.headersize - (int32_t)sizeof(DltStorageHeader)),
+ msg.databuffer, (int)msg.datasize, verbose);
free(msg.databuffer);
}else {
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index 50d8f19..20a512b 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -551,8 +551,8 @@ int dlt_daemon_client_send_message_to_all_client(DltDaemon *daemon,
return dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL, daemon, daemon_local,
daemon_local->msg.headerbuffer, sizeof(DltStorageHeader),
daemon_local->msg.headerbuffer + sizeof(DltStorageHeader),
- (size_t)(daemon_local->msg.headersize - (int32_t)sizeof(DltStorageHeader)),
- daemon_local->msg.databuffer, (size_t)daemon_local->msg.datasize, verbose);
+ (int)(daemon_local->msg.headersize - (int32_t)sizeof(DltStorageHeader)),
+ daemon_local->msg.databuffer, (int)daemon_local->msg.datasize, verbose);
}
@@ -771,8 +771,8 @@ int dlt_daemon_client_send_control_message(int sock,
if ((ret =
dlt_daemon_client_send(sock, daemon, daemon_local, msg->headerbuffer, sizeof(DltStorageHeader),
msg->headerbuffer + sizeof(DltStorageHeader),
- (size_t)(msg->headersize - (int32_t)sizeof(DltStorageHeader)),
- msg->databuffer, (size_t)msg->datasize, verbose))) {
+ (int)(msg->headersize - (int32_t)sizeof(DltStorageHeader)),
+ msg->databuffer, (int)msg->datasize, verbose))) {
dlt_log(LOG_DEBUG, "dlt_daemon_control_send_control_message: DLT message send to all failed!.\n");
return ret;
}
@@ -1919,7 +1919,7 @@ void dlt_daemon_control_get_log_info(int sock,
/* Allocate buffer for response message */
resp.databuffer = (uint8_t *)malloc((size_t)resp.datasize);
- resp.databuffersize = (size_t)resp.datasize;
+ resp.databuffersize = resp.datasize;
if (resp.databuffer == 0) {
dlt_daemon_control_service_response(sock,
@@ -2572,7 +2572,7 @@ int dlt_daemon_control_message_buffer_overflow(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2633,7 +2633,7 @@ int dlt_daemon_control_message_buffer_overflow_v2(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2686,7 +2686,7 @@ void dlt_daemon_control_service_response(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2732,7 +2732,7 @@ void dlt_daemon_control_service_response_v2(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2779,7 +2779,7 @@ int dlt_daemon_control_message_unregister_context(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2842,7 +2842,7 @@ int dlt_daemon_control_message_unregister_context_v2(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2909,7 +2909,7 @@ int dlt_daemon_control_message_connection_info(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -2962,7 +2962,7 @@ int dlt_daemon_control_message_connection_info_v2(int sock,
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -3010,7 +3010,7 @@ int dlt_daemon_control_message_timezone(int sock, DltDaemon *daemon, DltDaemonLo
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -3072,7 +3072,7 @@ int dlt_daemon_control_message_timezone_v2(int sock, DltDaemon *daemon, DltDaemo
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
@@ -3127,7 +3127,7 @@ int dlt_daemon_control_message_marker(int sock, DltDaemon *daemon, DltDaemonLoca
if (msg.databuffer == 0) {
msg.databuffer = (uint8_t *)malloc((size_t)msg.datasize);
- msg.databuffersize = (size_t)msg.datasize;
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer == 0)
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 2f08c6a..65b264a 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -2782,7 +2782,7 @@ int dlt_daemon_user_send_log_state(DltDaemon *daemon, DltDaemonApplication *app,
if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_STATE) < DLT_RETURN_OK)
return -1;
- logstate.log_state = daemon->connectionState;
+ logstate.log_state = (int8_t)daemon->connectionState;
/* log to FIFO */
ret = dlt_user_log_out2_with_timeout(app->user_handle,
@@ -2811,7 +2811,7 @@ int dlt_daemon_user_send_log_state_v2(DltDaemon *daemon, DltDaemonApplication *a
if (dlt_user_set_userheader_v2(&userheader, DLT_USER_MESSAGE_LOG_STATE) < DLT_RETURN_OK)
return -1;
- logstate.log_state = daemon->connectionState;
+ logstate.log_state = (int8_t)daemon->connectionState;
/* log to FIFO */
ret = dlt_user_log_out2_with_timeout(app->user_handle,
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 6d0098d..e432e26 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -5106,8 +5106,8 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, const int mtype, int *
return DLT_RETURN_ERROR;
}
- dlt_vlog(LOG_DEBUG, "%s: Current file size=[%ld]\n", __func__,
- st.st_size);
+ dlt_vlog(LOG_DEBUG, "%s: Current file size=[%lld]\n", __func__,
+ (long long int)st.st_size);
/* Check filesize */
/* Return error if the file size has reached to maximum */
unsigned int msg_size = (unsigned int)st.st_size + (unsigned int)msg.headersize +
@@ -5115,8 +5115,8 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, const int mtype, int *
if (msg_size > dlt_user.filesize_max) {
dlt_user_file_reach_max = true;
dlt_vlog(LOG_ERR,
- "%s: File size (%ld bytes) reached to defined maximum size (%d bytes)\n",
- __func__, st.st_size, dlt_user.filesize_max);
+ "%s: File size (%lld bytes) reached to defined maximum size (%d bytes)\n",
+ __func__, (long long int)st.st_size, dlt_user.filesize_max);
dlt_mutex_unlock();
return DLT_RETURN_FILESZERR;
}
@@ -5612,21 +5612,21 @@ DltReturnValue dlt_user_log_send_log_v2(DltContextData *log, const int mtype, Dl
return DLT_RETURN_ERROR;
}
- dlt_vlog(LOG_DEBUG, "%s: Current file size=[%ld]\n", __func__,
- st.st_size);
+ dlt_vlog(LOG_DEBUG, "%s: Current file size=[%lld]\n", __func__,
+ (long long int)st.st_size);
/* Check filesize */
/* Return error if the file size has reached to maximum */
unsigned int msg_size = 0;
if (st.st_size < 0 || st.st_size > UINT_MAX) {
- dlt_vlog(LOG_ERR, "%s: File size (%ld bytes) is invalid or too large for unsigned int\n", __func__, st.st_size);
+ dlt_vlog(LOG_ERR, "%s: File size (%lld bytes) is invalid or too large for unsigned int\n", __func__, (long long int)st.st_size);
return DLT_RETURN_FILESZERR;
}
msg_size = (unsigned int)st.st_size + (unsigned int) msg.headersizev2 + (unsigned int) log->size;
if (msg_size > dlt_user.filesize_max) {
dlt_user_file_reach_max = true;
dlt_vlog(LOG_ERR,
- "%s: File size (%ld bytes) reached to defined maximum size (%d bytes)\n",
- __func__, st.st_size, dlt_user.filesize_max);
+ "%s: File size (%lld bytes) reached to defined maximum size (%d bytes)\n",
+ __func__, (long long int)st.st_size, dlt_user.filesize_max);
return DLT_RETURN_FILESZERR;
}
else {
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index 6ad354b..aa0aaaa 100644
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -1220,7 +1220,7 @@ DltReturnValue dlt_message_header_flags_v2(DltMessageV2 *msg, char *text, size_t
for (int i = 0; i<5; ++i){
tt = (tt << 8) | msg->headerextrav2.seconds[i];
}
- snprintf(text + strlen(text), textlength - strlen(text), "%ld.%.9u ", tt, msg->headerextrav2.nanoseconds);
+ snprintf(text + strlen(text), textlength - strlen(text), "%lld.%.9u ", (long long int)tt, msg->headerextrav2.nanoseconds);
}
else
snprintf(text + strlen(text), textlength - strlen(text), "---------- ");
diff --git a/src/shared/dlt_multiple_files.c b/src/shared/dlt_multiple_files.c
index c4019e5..65529ff 100644
--- a/src/shared/dlt_multiple_files.c
+++ b/src/shared/dlt_multiple_files.c
@@ -257,7 +257,7 @@ ssize_t multiple_files_buffer_get_total_size(const MultipleFilesRingBuffer *file
if (((unsigned int)res < sizeof(filename)) && (res > 0)) {
errno = 0;
if (0 == stat(filename, &status))
- size += status.st_size;
+ size += (ssize_t)status.st_size;
else
fprintf(stderr, "file %s cannot be stat-ed, error=%s\n", filename, strerror(errno));
}
diff --git a/src/tests/dlt-test-multi-process-client-v2.c b/src/tests/dlt-test-multi-process-client-v2.c
index 2bb1158..ec99720 100644
--- a/src/tests/dlt-test-multi-process-client-v2.c
+++ b/src/tests/dlt-test-multi-process-client-v2.c
@@ -299,10 +299,10 @@ void print_stats(s_statistics stats, s_parameters params)
printf(" Messages received : %d\n", stats.messages_received);
printf(" Broken messages received : %d\n", stats.broken_messages_received);
printf(" Bytes received : %d\n", stats.bytes_received);
- printf(" Time running (seconds) : %ld\n", time(NULL) - stats.first_message_time);
- printf(" Throughput (msgs/sec)/(B/sec) : %ld/%ld\n",
- stats.messages_received / ((time(NULL) - stats.first_message_time) + 1),
- (stats.bytes_received) / ((time(NULL) - stats.first_message_time) + 1));
+ printf(" Time running (seconds) : %lld\n", (long long int)(time(NULL) - stats.first_message_time));
+ printf(" Throughput (msgs/sec)/(B/sec) : %lld/%lld\n",
+ (long long int)(stats.messages_received / ((time(NULL) - stats.first_message_time) + 1)),
+ (long long int)((stats.bytes_received) / ((time(NULL) - stats.first_message_time) + 1)));
if (params.messages_left == 0) {
if (stats.broken_messages_received == 0)
diff --git a/src/tests/dlt-test-multi-process-v2.c b/src/tests/dlt-test-multi-process-v2.c
index 44a8622..1d3a54a 100644
--- a/src/tests/dlt-test-multi-process-v2.c
+++ b/src/tests/dlt-test-multi-process-v2.c
@@ -393,7 +393,7 @@ void *do_logging(void *arg)
sleep_time = mksleep_time(data->params.delay, data->params.delay_fudge);
ts.tv_sec = sleep_time / 1000000000;
- ts.tv_nsec = sleep_time % 1000000000;
+ ts.tv_nsec = (long int)(sleep_time % 1000000000);
nanosleep(&ts, NULL);
}
diff --git a/src/tests/dlt-test-multi-process.c b/src/tests/dlt-test-multi-process.c
index 016c8b4..00fb11c 100644
--- a/src/tests/dlt-test-multi-process.c
+++ b/src/tests/dlt-test-multi-process.c
@@ -370,7 +370,7 @@ void *do_logging(void *arg)
sleep_time = mksleep_time(data->params.delay, data->params.delay_fudge);
ts.tv_sec = sleep_time / 1000000000;
- ts.tv_nsec = sleep_time % 1000000000;
+ ts.tv_nsec = (long int)(sleep_time % 1000000000);
nanosleep(&ts, NULL);
}
--
2.34.1

View File

@ -0,0 +1,69 @@
From bee9bce043c72de1d27a4251333ace9fe66bcc74 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Thu, 12 Mar 2026 19:37:11 +0800
Subject: [PATCH] Fix compile failure related to gzlog
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* In commit [1], gzlog is changed from gzFile to gzFile*, this cause
failure:
/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c:88:21: error: passing argument 1 of gzclose from incompatible pointer type [-Werror=incompatible-pointer-types]
88 | gzclose(data->gzlog);
| ~~~~^~~~~~~
| |
| struct gzFile_s **
compilation terminated due to -Wfatal-errors.
so change gzlog back to gzFile, so that all the gzxxx function can work
well.
* Change to gzFile causes the following failure, since fileno need
FILE*, according to code "config->gzlog = gzdopen(config->fd, mode)",
seems we don't need to use fileno, just use config->fd is ok.
/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage_behavior.c:1133:48: error: passing argument 1 of fileno from incompatible pointer type [-Werror=incompatible-pointer-types]
1133 | if (fsync(fileno(config->gzlog)) != 0) {
| ~~~~~~^~~~~~~
| |
| gzFile {aka struct gzFile_s *}
compilation terminated due to -Wfatal-errors.
[1] https://github.com/COVESA/dlt-daemon/commit/543087ba98c103dc576edadeccf614c9dab1b9b3
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/826]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
src/offlinelogstorage/dlt_offline_logstorage.h | 2 +-
src/offlinelogstorage/dlt_offline_logstorage_behavior.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.h b/src/offlinelogstorage/dlt_offline_logstorage.h
index fe38687..09ea5ce 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.h
+++ b/src/offlinelogstorage/dlt_offline_logstorage.h
@@ -217,7 +217,7 @@ struct DltLogStorageFilterConfig
FILE *log; /* current open log file */
int fd; /* The file descriptor for the active log file */
#ifdef DLT_LOGSTORAGE_USE_GZIP
- gzFile *gzlog; /* current open gz log file */
+ gzFile gzlog; /* current open gz log file */
#endif
void *cache; /* log data cache */
unsigned int specific_size; /* cache size used for specific_size sync strategy */
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
index f17fbb2..ff09c9e 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
@@ -1130,7 +1130,7 @@ int dlt_logstorage_prepare_on_msg(DltLogStorageFilterConfig *config,
(config->sync == DLT_LOGSTORAGE_SYNC_UNSET)) {
#ifdef DLT_LOGSTORAGE_USE_GZIP
if (config->gzip_compression == DLT_LOGSTORAGE_GZIP_ON) {
- if (fsync(fileno(config->gzlog)) != 0) {
+ if (fsync(config->fd) != 0) {
if (errno != ENOSYS) {
dlt_vlog(LOG_ERR, "%s: failed to sync gzip log file\n", __func__);
}
--
2.34.1

View File

@ -0,0 +1,174 @@
From 3d713358fe19ce02e7c580d26222ec2386c94bc9 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Thu, 12 Mar 2026 20:06:34 +0800
Subject: [PATCH] Fix kinds of build failure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix kinds of build failures caused by -Werror=sign-conversion,
-Werror=cast-qual, -Werror=conversion etc.
Eg:
src/offlinelogstorage/dlt_offline_logstorage.h:129:49: error: unsigned conversion from int to unsigned int changes value from -1 to 4294967295 [-Werror=sign-conversion]
129 | #define DLT_LOGSTORAGE_GZIP_ERROR -1 /* error case */
| ^
/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c:1303:36: note: in expansion of macro DLT_LOGSTORAGE_GZIP_ERROR
1303 | config->gzip_compression = DLT_LOGSTORAGE_GZIP_ERROR;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/offlinelogstorage/dlt_offline_logstorage_behavior.c:851:16: error: conversion from z_size_t {aka long unsigned int} to int may change value [-Werror=conversion]
851 | return gzfwrite(ptr, size, nmemb, config->gzlog);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/console/dlt-control-common.c:922:25: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
922 | json_object_to_file((char*)filename, json_filter_obj);
|
Use explicit type conversion to make the build can pass
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/826]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
src/console/dlt-control-common.c | 2 +-
src/daemon/dlt-daemon.c | 4 ++--
src/daemon/udp_connection/dlt_daemon_udp_socket.c | 10 +++++-----
src/examples/dlt-example-multicast-clientmsg-view.c | 8 ++++----
src/offlinelogstorage/dlt_offline_logstorage.h | 2 +-
.../dlt_offline_logstorage_behavior.c | 4 ++--
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c
index 2aeea280..4f9e95b4 100644
--- a/src/console/dlt-control-common.c
+++ b/src/console/dlt-control-common.c
@@ -919,7 +919,7 @@ DltReturnValue dlt_json_filter_save(DltFilter *filter, const char *filename, int
}
printf("Saving current filter into '%s'\n", filename);
- json_object_to_file((char*)filename, json_filter_obj);
+ json_object_to_file(filename, json_filter_obj);
return DLT_RETURN_OK;
}
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 97af1cd9..94024eb4 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -867,7 +867,7 @@ int option_file_parser(DltDaemonLocal *daemon_local)
if ((longval == MULTICAST_CONNECTION_DISABLED)
|| (longval == MULTICAST_CONNECTION_ENABLED)) {
- daemon_local->UDPConnectionSetup = longval;
+ daemon_local->UDPConnectionSetup = (int)longval;
printf("Option: %s=%s\n", token, value);
}
else {
@@ -884,7 +884,7 @@ int option_file_parser(DltDaemonLocal *daemon_local)
}
else if (strcmp(token, "UDPMulticastIPPort") == 0)
{
- daemon_local->UDPMulticastIPPort = strtol(value, NULL, 10);
+ daemon_local->UDPMulticastIPPort = (int)strtol(value, NULL, 10);
}
#endif
else if (strcmp(token, "BindAddress") == 0)
diff --git a/src/daemon/udp_connection/dlt_daemon_udp_socket.c b/src/daemon/udp_connection/dlt_daemon_udp_socket.c
index 4c40cda8..b3408773 100644
--- a/src/daemon/udp_connection/dlt_daemon_udp_socket.c
+++ b/src/daemon/udp_connection/dlt_daemon_udp_socket.c
@@ -66,7 +66,7 @@ void dlt_daemon_udp_setmulticast_addr(DltDaemonLocal *daemon_local)
struct sockaddr_in clientaddr;
clientaddr.sin_family = AF_INET;
inet_pton(AF_INET, daemon_local->UDPMulticastIPAddress, &clientaddr.sin_addr);
- clientaddr.sin_port = htons(daemon_local->UDPMulticastIPPort);
+ clientaddr.sin_port = htons((uint16_t)daemon_local->UDPMulticastIPPort);
memcpy(&g_udpmulticast_addr.clientaddr, &clientaddr, sizeof(struct sockaddr_in));
g_udpmulticast_addr.clientaddr_size = sizeof(g_udpmulticast_addr.clientaddr);
g_udpmulticast_addr.isvalidflag = ADDRESS_VALID;
@@ -224,17 +224,17 @@ void dlt_daemon_udp_clientmsg_send(DltDaemonClientSockInfo *clientinfo,
if ((clientinfo->isvalidflag == ADDRESS_VALID) &&
(size1 > 0) && (size2 > 0)) {
- void *data = (void *)calloc(size1 + size2, sizeof(char));
+ void *data = (void *)calloc((size_t)(size1 + size2), sizeof(char));
if (data == NULL) {
dlt_vlog(LOG_ERR, "%s: calloc failure\n", __func__);
return;
}
- memcpy(data, data1, size1);
- memcpy(data + size1, data2, size2);
+ memcpy(data, data1, (size_t)size1);
+ memcpy((int*)data + size1, data2, (size_t)size2);
- if (sendto(g_udp_sock_fd, data, size1 + size2, 0, (struct sockaddr *)&clientinfo->clientaddr,
+ if (sendto(g_udp_sock_fd, data, (size_t)(size1 + size2), 0, (struct sockaddr *)&clientinfo->clientaddr,
clientinfo->clientaddr_size) < 0)
dlt_vlog(LOG_ERR, "%s: Send UDP Packet Data failed\n", __func__);
diff --git a/src/examples/dlt-example-multicast-clientmsg-view.c b/src/examples/dlt-example-multicast-clientmsg-view.c
index c00537e5..f8920453 100644
--- a/src/examples/dlt-example-multicast-clientmsg-view.c
+++ b/src/examples/dlt-example-multicast-clientmsg-view.c
@@ -74,9 +74,9 @@ int dlt_receiver_receive_socket_udp(struct clientinfostruct *clientinfo, DltRece
/* wait for data from socket */
unsigned int addrlen = sizeof(clientinfo->addr);
- if ((receiver->bytesRcvd = recvfrom(clientinfo->fd,
+ if ((receiver->bytesRcvd = (int32_t)recvfrom(clientinfo->fd,
receiver->buf + receiver->lastBytesRcvd,
- receiver->buffersize - receiver->lastBytesRcvd,
+ (size_t)(receiver->buffersize - receiver->lastBytesRcvd),
0,
(struct sockaddr *)&(clientinfo->addr), &addrlen))
<= 0) {
@@ -177,11 +177,11 @@ int main()
dlt_receiver_receive_socket_udp(&clientinfo, &(clientinfo.receiver));
while (dlt_message_read(&msg, (unsigned char *)(clientinfo.receiver.buf),
- clientinfo.receiver.bytesRcvd, 0, 0) == DLT_MESSAGE_ERROR_OK) {
+ (unsigned int)clientinfo.receiver.bytesRcvd, 0, 0) == DLT_MESSAGE_ERROR_OK) {
dlt_receive_message_callback_udp(&msg);
if (dlt_receiver_remove(&(clientinfo.receiver),
- msg.headersize + msg.datasize - sizeof(DltStorageHeader))
+ msg.headersize + msg.datasize - ((int32_t)(sizeof(DltStorageHeader))))
== DLT_RETURN_ERROR) {
/* Return value ignored */
dlt_message_free(&msg, 0);
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.h b/src/offlinelogstorage/dlt_offline_logstorage.h
index 09ea5ce4..cfb70f33 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.h
+++ b/src/offlinelogstorage/dlt_offline_logstorage.h
@@ -192,7 +192,7 @@ struct DltLogStorageFilterConfig
int overwrite; /* Overwrite strategy */
int skip; /* Flag to skip file logging if DISCARD_NEW */
char *ecuid; /* ECU identifier */
- unsigned int gzip_compression; /* Toggle if log files should be gzip compressed */
+ int gzip_compression; /* Toggle if log files should be gzip compressed */
/* callback function for filter configurations */
int (*dlt_logstorage_prepare)(DltLogStorageFilterConfig *config,
DltLogStorageUserConfig *file_config,
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
index ff09c9eb..ae8f4442 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
@@ -848,10 +848,10 @@ DLT_STATIC int dlt_logstorage_write_to_log(void *ptr, size_t size, size_t nmemb,
{
#ifdef DLT_LOGSTORAGE_USE_GZIP
if (config->gzip_compression == DLT_LOGSTORAGE_GZIP_ON) {
- return gzfwrite(ptr, size, nmemb, config->gzlog);
+ return (int)gzfwrite(ptr, size, nmemb, config->gzlog);
}
else {
- return fwrite(ptr, size, nmemb, config->log);
+ return (int)fwrite(ptr, size, nmemb, config->log);
}
#else
return (int)fwrite(ptr, size, nmemb, config->log);
--
2.34.1

View File

@ -0,0 +1,423 @@
From 28322f951bb8510ddb4cf767426a67c81ce826ab Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Tue, 17 Mar 2026 13:04:11 +0800
Subject: [PATCH] fix build failure when systemd is enabled
Fix build failures when -DWITH_SYSTEMD=ON, -DWITH_SYSTEMD_WATCHDOG=ON,
-DWITH_SYSTEMD_JOURNAL=ON:
Eg:
src/system/dlt-system-syslog.c:91:39: error: conversion from 'int' to '__uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
91 | syslog_addr.sin6_port = htons(opts.Port);
| ~~~~^~~~~
src/system/dlt-system-logfile.c:74:21: error: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Werror=conversion]
74 | bytes = fread(buffer, 1, sizeof(buffer) - 1, pFile);
| ^~~~~
src/daemon/dlt-daemon.c:5513:14: error: unused variable 'curr_time' [-Werror=unused-variable]
5513 | uint32_t curr_time = 0U;
| ^~~~~~~~~
src/system/dlt-system-syslog.c:120:22: error: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Werror=conversion]
120 | int bytes_read = recvfrom(sock, recv_data, RECV_BUF_SZ, 0,
| ^~~~~~~~
src/system/dlt-system-logfile.c:76:23: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits]
76 | if (bytes >= 0)
| ^~
src/system/dlt-system-filetransfer.c:727:56: error: '__builtin___snprintf_chk' output may be truncated before the last format cha racter [-Werror=format-truncation=]
10 727 | snprintf(tosend, length, "%s/%s", opts->Directory[j], ie->name);
src/system/dlt-system-filetransfer.c:153: error: declaration of 'len' shadows a previous local [-Werror=shadow]
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/828]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
src/daemon/dlt-daemon.c | 8 +----
src/daemon/dlt_daemon_client.c | 2 +-
src/system/dlt-system-filetransfer.c | 43 +++++++++++++-----------
src/system/dlt-system-journal.c | 2 +-
src/system/dlt-system-logfile.c | 4 +--
src/system/dlt-system-process-handling.c | 2 +-
src/system/dlt-system-processes.c | 2 +-
src/system/dlt-system-syslog.c | 6 ++--
src/system/dlt-system-watchdog.c | 8 ++---
systemd/3rdparty/sd-daemon.c | 5 +--
10 files changed, 40 insertions(+), 42 deletions(-)
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index ef42f89..8c318a4 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1620,7 +1620,7 @@ int main(int argc, char *argv[])
watchdogTimeoutSeconds = 30;
}
- daemon.watchdog_trigger_interval = watchdogTimeoutSeconds;
+ daemon.watchdog_trigger_interval = (unsigned int)watchdogTimeoutSeconds;
daemon.watchdog_last_trigger_time = 0U;
create_timer_fd(&daemon_local,
watchdogTimeoutSeconds,
@@ -5509,9 +5509,6 @@ int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daem
int ret;
static uint8_t data[DLT_DAEMON_RCVBUFSIZE];
int length;
-#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
- uint32_t curr_time = 0U;
-#endif
PRINT_FUNCTION_VERBOSE(verbose);
@@ -5554,9 +5551,6 @@ int dlt_daemon_send_ringbuffer_to_client_v2(DltDaemon *daemon, DltDaemonLocal *d
int ret;
static uint8_t data[DLT_DAEMON_RCVBUFSIZE];
int length;
-#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
- uint32_t curr_time = 0U;
-#endif
PRINT_FUNCTION_VERBOSE(verbose);
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index 20a512b..681bf1e 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -4690,7 +4690,7 @@ int dlt_daemon_process_systemd_timer(DltDaemon *daemon,
if ((daemon_local == NULL) || (daemon == NULL) || (receiver == NULL)) {
dlt_vlog(LOG_ERR, "%s: invalid parameters", __func__);
- return res;
+ return (int)res;
}
res = read(receiver->fd, &expir, sizeof(expir));
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index c082f22..6024a3e 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -105,14 +105,14 @@ char *unique_name(char *src)
DLT_STRING("dlt-system-filetransfer, creating unique temporary file name."));
time_t t = time(NULL);
int ok;
- uint32_t l = getFileSerialNumber(src, &ok) ^ t;
+ uint32_t l = (uint32_t)(getFileSerialNumber(src, &ok) ^ t);
if (!ok)
return (char *)NULL;
char *basename_f = basename(src);
/* Length of ULONG_MAX + 1 */
- int len = 11 + strlen(basename_f);
+ size_t len = 11 + strlen(basename_f);
if (len > NAME_MAX) {
DLT_LOG(dltsystem, DLT_LOG_WARN,
@@ -155,7 +155,7 @@ void send_dumped_file(FiletransferOptions const *opts, char *dst_tosend)
while ((total - used) < (total / 2)) {
struct timespec t;
t.tv_sec = 0;
- t.tv_nsec = 1000000ul * opts->TimeoutBetweenLogs;
+ t.tv_nsec = (long int)(1000000ul * (unsigned long)opts->TimeoutBetweenLogs);
nanosleep(&t, NULL);
dlt_user_log_resend_buffer();
dlt_user_check_buffer(&total, &used);
@@ -220,7 +220,7 @@ int compress_file_to(char *src, char *dst, int level)
MALLOC_ASSERT(buf);
while (!feof(src_file)) {
- int read = fread(buf, 1, Z_CHUNK_SZ, src_file);
+ size_t read = fread(buf, 1, Z_CHUNK_SZ, src_file);
if (ferror(src_file)) {
free(buf);
@@ -230,7 +230,7 @@ int compress_file_to(char *src, char *dst, int level)
return -1;
}
- gzwrite(dst_file, buf, read);
+ gzwrite(dst_file, buf, (unsigned int)read);
}
if (remove(src) < 0)
@@ -290,7 +290,7 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
char *dst_tocompress;/*file which is going to be compressed, the compressed one is named dst_tosend */
- int len = strlen(fdir) + strlen(SUBDIR_COMPRESS) + strlen(rn) + 3;/*the filename in .tocompress +2 for 2*"/", +1 for \0 */
+ size_t len = strlen(fdir) + strlen(SUBDIR_COMPRESS) + strlen(rn) + 3;/*the filename in .tocompress +2 for 2*"/", +1 for \0 */
dst_tocompress = malloc(len);
MALLOC_ASSERT(dst_tocompress);
@@ -328,7 +328,7 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
/*move it directly into "tosend" */
DLT_LOG(dltsystem, DLT_LOG_DEBUG,
DLT_STRING("dlt-system-filetransfer, Moving file to tmp directory."));
- int len = strlen(fdir) + strlen(SUBDIR_TOSEND) + strlen(rn) + 3;
+ size_t len = strlen(fdir) + strlen(SUBDIR_TOSEND) + strlen(rn) + 3;
dst_tosend = malloc(len);/*the resulting filename in .tosend +2 for 2*"/", +1 for \0 */
snprintf(dst_tosend, len, "%s/%s/%s", fdir, SUBDIR_TOSEND, rn);
@@ -379,7 +379,7 @@ int flush_dir_send(FiletransferOptions const *opts, const char *compress_dir, co
DLT_LOG(dltsystem, DLT_LOG_DEBUG,
DLT_STRING("dlt-system-filetransfer, old compressed file found in send directory:"),
DLT_STRING(dp->d_name));
- int len = strlen(send_dir) + strlen(dp->d_name) + 2;
+ size_t len = strlen(send_dir) + strlen(dp->d_name) + 2;
fn = malloc(len);
MALLOC_ASSERT(fn);
snprintf(fn, len, "%s/%s", send_dir, dp->d_name);
@@ -394,10 +394,10 @@ int flush_dir_send(FiletransferOptions const *opts, const char *compress_dir, co
strncpy(tmp, dp->d_name, strlen(dp->d_name) - strlen(COMPRESS_EXTENSION));
tmp[strlen(dp->d_name) - strlen(COMPRESS_EXTENSION)] = '\0';
- int len = strlen(tmp) + strlen(compress_dir) + 1 + 1;/*2 sizes + 1*"/" + \0 */
- char *path_uncompressed = malloc(len);
+ size_t length = strlen(tmp) + strlen(compress_dir) + 1 + 1;/*2 sizes + 1*"/" + \0 */
+ char *path_uncompressed = malloc(length);
MALLOC_ASSERT(path_uncompressed);
- snprintf(path_uncompressed, len, "%s/%s", compress_dir, tmp);
+ snprintf(path_uncompressed, length, "%s/%s", compress_dir, tmp);
struct stat sb;
@@ -475,7 +475,7 @@ int flush_dir_compress(FiletransferOptions const *opts, int which, const char *c
/*compress file into to_send dir */
- int len = strlen(compress_dir) + strlen(dp->d_name) + 2;
+ size_t len = strlen(compress_dir) + strlen(dp->d_name) + 2;
char *cd_filename = malloc(len);
MALLOC_ASSERT(cd_filename);
snprintf(cd_filename, len, "%s/%s", compress_dir, dp->d_name);
@@ -526,7 +526,7 @@ int flush_dir_original(FiletransferOptions const *opts, int which)
DLT_LOG(dltsystem, DLT_LOG_DEBUG,
DLT_STRING("dlt-system-filetransfer, old file found in directory."));
- int len = strlen(sdir) + strlen(dp->d_name) + 2;
+ size_t len = strlen(sdir) + strlen(dp->d_name) + 2;
char *fn = malloc(len);
MALLOC_ASSERT(fn);
snprintf(fn, len, "%s/%s", sdir, dp->d_name);
@@ -564,7 +564,7 @@ int flush_dir(FiletransferOptions const *opts, int which)
char *compress_dir;
char *send_dir;
- int len = strlen(opts->Directory[which]) + strlen(SUBDIR_COMPRESS) + 2;
+ size_t len = strlen(opts->Directory[which]) + strlen(SUBDIR_COMPRESS) + 2;
compress_dir = malloc (len);
MALLOC_ASSERT(compress_dir);
snprintf(compress_dir, len, "%s/%s", opts->Directory[which], SUBDIR_COMPRESS);
@@ -625,7 +625,7 @@ int init_filetransfer_dirs(DltSystemConfiguration *config)
/*create subdirectories for processing the files */
char *subdirpath;
- int len = strlen(opts->Directory[i]) + strlen(SUBDIR_COMPRESS) + 2;
+ size_t len = strlen(opts->Directory[i]) + strlen(SUBDIR_COMPRESS) + 2;
subdirpath = malloc (len);
MALLOC_ASSERT(subdirpath);
snprintf(subdirpath, len, "%s/%s", opts->Directory[i], SUBDIR_COMPRESS);
@@ -699,7 +699,7 @@ int process_files(FiletransferOptions const *opts)
unsigned int i = 0;
- while (i < (len - INOTIFY_SZ)) {
+ while (i < ((long unsigned int)len - INOTIFY_SZ)) {
struct inotify_event *ie = (struct inotify_event *)&buf[i];
if (ie->len > 0) {
@@ -712,26 +712,29 @@ int process_files(FiletransferOptions const *opts)
DLT_LOG_DEBUG,
DLT_STRING("dlt-system-filetransfer, found new file."),
DLT_STRING(ie->name));
- int length = strlen(opts->Directory[j]) + ie->len + 1;
+ size_t length = strlen(opts->Directory[j]) + strlen(ie->name) + 2;
if (length > PATH_MAX) {
DLT_LOG(filetransferContext,
DLT_LOG_ERROR,
DLT_STRING(
"dlt-system-filetransfer: Very long path for file transfer. Cancelling transfer! Length is: "),
- DLT_INT(length));
+ DLT_INT((int)length));
return -1;
}
char *tosend = malloc(length);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tosend, length, "%s/%s", opts->Directory[j], ie->name);
+#pragma GCC diagnostic pop
send_one(tosend, opts, j);
free(tosend);
}
}
}
- i += INOTIFY_SZ + ie->len;
+ i += (unsigned int)INOTIFY_SZ + ie->len;
}
#endif
@@ -741,4 +744,4 @@ int process_files(FiletransferOptions const *opts)
void filetransfer_fd_handler(DltSystemConfiguration *config)
{
process_files(&(config->Filetransfer));
-}
\ No newline at end of file
+}
diff --git a/src/system/dlt-system-journal.c b/src/system/dlt-system-journal.c
index 366555b..9a55c3f 100644
--- a/src/system/dlt-system-journal.c
+++ b/src/system/dlt-system-journal.c
@@ -393,7 +393,7 @@ void register_journal_fd(sd_journal **j, struct pollfd *pollfd, int i, DltSyste
DLT_STRING(strerror(pollfd[i].fd)));
j_tmp = NULL;
}
- pollfd[i].events = sd_journal_get_events(j_tmp);
+ pollfd[i].events = (short)sd_journal_get_events(j_tmp);
if(pollfd[i].events < 0) {
DLT_LOG(dltsystem, DLT_LOG_ERROR, DLT_STRING("Error while getting journal events: "),
DLT_STRING(strerror(pollfd[i].events)));
diff --git a/src/system/dlt-system-logfile.c b/src/system/dlt-system-logfile.c
index 941a3be..d31441c 100644
--- a/src/system/dlt-system-logfile.c
+++ b/src/system/dlt-system-logfile.c
@@ -64,7 +64,7 @@ void send_file(LogFileOptions const *fileopt, int n)
FILE *pFile;
DltContext context = logfileContext[n];
char buffer[1024];
- int bytes;
+ size_t bytes;
int seq = 1;
pFile = fopen((*fileopt).Filename[n], "r");
@@ -73,7 +73,7 @@ void send_file(LogFileOptions const *fileopt, int n)
while (!feof(pFile)) {
bytes = fread(buffer, 1, sizeof(buffer) - 1, pFile);
- if (bytes >= 0)
+ if (bytes == (sizeof(buffer) - 1))
buffer[bytes] = 0;
else
buffer[0] = 0;
diff --git a/src/system/dlt-system-process-handling.c b/src/system/dlt-system-process-handling.c
index 3e092d4..708e9e3 100644
--- a/src/system/dlt-system-process-handling.c
+++ b/src/system/dlt-system-process-handling.c
@@ -201,7 +201,7 @@ int register_timer_fd(struct pollfd *pollfd, int fdcnt)
void timer_fd_handler(int fd, DltSystemConfiguration *config)
{
uint64_t timersElapsed = 0ULL;
- int r = read(fd, &timersElapsed, 8U); // only needed to reset fd event
+ int r = (int)read(fd, &timersElapsed, 8U); // only needed to reset fd event
if (r < 0)
DLT_LOG(dltsystem, DLT_LOG_ERROR, DLT_STRING("Error while reading timer fd: "),
DLT_STRING(strerror(r)));
diff --git a/src/system/dlt-system-processes.c b/src/system/dlt-system-processes.c
index c35596c..b17b8ee 100644
--- a/src/system/dlt-system-processes.c
+++ b/src/system/dlt-system-processes.c
@@ -72,7 +72,7 @@ void send_process(LogProcessOptions const *popts, int n)
struct dirent *dp;
char filename[PATH_MAX];
char buffer[1024];
- int bytes;
+ size_t bytes;
int found = 0;
/* go through all process files in directory */
diff --git a/src/system/dlt-system-syslog.c b/src/system/dlt-system-syslog.c
index 59e9d3f..d6b1b8a 100644
--- a/src/system/dlt-system-syslog.c
+++ b/src/system/dlt-system-syslog.c
@@ -88,7 +88,7 @@ int init_socket(SyslogOptions opts)
#ifdef DLT_USE_IPv6
syslog_addr.sin6_family = AF_INET6;
syslog_addr.sin6_addr = in6addr_any;
- syslog_addr.sin6_port = htons(opts.Port);
+ syslog_addr.sin6_port = htons((uint16_t)opts.Port);
#else
syslog_addr.sin_family = AF_INET;
syslog_addr.sin_addr.s_addr = INADDR_ANY;
@@ -117,7 +117,7 @@ int read_socket(int sock)
struct sockaddr_in client_addr;
socklen_t addr_len = sizeof(struct sockaddr_in);
- int bytes_read = recvfrom(sock, recv_data, RECV_BUF_SZ, 0,
+ int bytes_read = (int)recvfrom(sock, recv_data, RECV_BUF_SZ, 0,
(struct sockaddr *)&client_addr, &addr_len);
if (bytes_read == -1) {
@@ -157,4 +157,4 @@ int register_syslog_fd(struct pollfd *pollfd, int i, DltSystemConfiguration *con
void syslog_fd_handler(int syslogSock)
{
read_socket(syslogSock);
-}
\ No newline at end of file
+}
diff --git a/src/system/dlt-system-watchdog.c b/src/system/dlt-system-watchdog.c
index 7ed1604..6334214 100644
--- a/src/system/dlt-system-watchdog.c
+++ b/src/system/dlt-system-watchdog.c
@@ -56,7 +56,7 @@ int calculate_period(struct itimerspec *itval)
}
DLT_LOG(watchdogContext, DLT_LOG_DEBUG, DLT_STRING("watchdogusec: "), DLT_STRING(watchdogUSec));
- watchdogTimeoutSeconds = atoi(watchdogUSec);
+ watchdogTimeoutSeconds = (unsigned int)atoi(watchdogUSec);
if (watchdogTimeoutSeconds <= 0) {
snprintf(str, 512, "systemd watchdog timeout incorrect: %u\n", watchdogTimeoutSeconds);
@@ -78,9 +78,9 @@ int calculate_period(struct itimerspec *itval)
sec = notifiyPeriodNSec / 1000000;
ns = (notifiyPeriodNSec - (sec * 1000000)) * 1000;
itval->it_interval.tv_sec = sec;
- itval->it_interval.tv_nsec = ns;
+ itval->it_interval.tv_nsec = (long int)ns;
itval->it_value.tv_sec = sec;
- itval->it_value.tv_nsec = ns;
+ itval->it_value.tv_nsec = (long int)ns;
return 0;
}
@@ -114,7 +114,7 @@ void watchdog_fd_handler(int fd)
#endif
{
uint64_t timersElapsed = 0ULL;
- int r = read(fd, &timersElapsed, 8U); // only needed to reset fd event
+ int r = (int)read(fd, &timersElapsed, 8U); // only needed to reset fd event
if(r < 0)
DLT_LOG(watchdogContext, DLT_LOG_ERROR, DLT_STRING("Could not reset systemd watchdog. Exit with: "),
DLT_STRING(strerror(r)));
diff --git a/systemd/3rdparty/sd-daemon.c b/systemd/3rdparty/sd-daemon.c
index de3f985..9fde8cc 100644
--- a/systemd/3rdparty/sd-daemon.c
+++ b/systemd/3rdparty/sd-daemon.c
@@ -46,6 +46,7 @@
#include <stdio.h>
#include <stddef.h>
#include <limits.h>
+#include <stdint.h>
#if defined(__linux__)
#include <mqueue.h>
@@ -456,12 +457,12 @@ _sd_export_ int sd_notify(int unset_environment, const char *state) {
sockaddr.un.sun_path[0] = 0;
memset(&iovec, 0, sizeof(iovec));
- iovec.iov_base = (char*) state;
+ iovec.iov_base = (void *)(uintptr_t)state;
iovec.iov_len = strlen(state);
memset(&msghdr, 0, sizeof(msghdr));
msghdr.msg_name = &sockaddr;
- msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
+ msghdr.msg_namelen = (socklen_t)(offsetof(struct sockaddr_un, sun_path) + strlen(e));
if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
msghdr.msg_namelen = sizeof(struct sockaddr_un);
--
2.34.1

View File

@ -1,99 +0,0 @@
From ae23f2cccc169874d89903cad24bf36e19bef659 Mon Sep 17 00:00:00 2001
From: Alper Ak <alperyasinak1@gmail.com>
Date: Wed, 9 Jul 2025 18:18:33 +0300
Subject: [PATCH] cmake: Set minimum required version to 3.5 for CMake 4+
compatibility
Fix:
| CMake Error at CMakeLists.txt:17 (cmake_minimum_required):
| Compatibility with CMake < 3.5 has been removed from CMake.
|
| Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
| to tell CMake that the project requires at least <min> but has been updated
| to work with policies introduced by <max> or earlier.
|
| Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
|
|
| -- Configuring incomplete, errors occurred!
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/755]
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
---
CMakeLists.txt | 2 +-
examples/example1/CMakeLists.txt | 2 +-
examples/example2/CMakeLists.txt | 2 +-
examples/example3/CMakeLists.txt | 2 +-
examples/example4/CMakeLists.txt | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94185b8..2a0f619 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@
#######
# Set minimum Cmake version and setup policy behavior
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.5)
if(${CMAKE_VERSION} VERSION_GREATER "3.20" OR ${CMAKE_VERSION} VERSION_EQUAL "3.20")
cmake_policy(SET CMP0115 OLD)
diff --git a/examples/example1/CMakeLists.txt b/examples/example1/CMakeLists.txt
index 60644a1..44cd053 100644
--- a/examples/example1/CMakeLists.txt
+++ b/examples/example1/CMakeLists.txt
@@ -17,7 +17,7 @@
# DLT example implementation
#
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required( VERSION 3.5 )
project( automotive-dlt-example1 )
#
diff --git a/examples/example2/CMakeLists.txt b/examples/example2/CMakeLists.txt
index 66a4f24..a8efbcf 100644
--- a/examples/example2/CMakeLists.txt
+++ b/examples/example2/CMakeLists.txt
@@ -17,7 +17,7 @@
# DLT example implementation
#
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required( VERSION 3.5 )
project( automotive-dlt-example2 )
#
diff --git a/examples/example3/CMakeLists.txt b/examples/example3/CMakeLists.txt
index 45b7467..4d4958d 100644
--- a/examples/example3/CMakeLists.txt
+++ b/examples/example3/CMakeLists.txt
@@ -17,7 +17,7 @@
# DLT example implementation
#
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required( VERSION 3.5 )
project( automotive-dlt-example3 )
#
diff --git a/examples/example4/CMakeLists.txt b/examples/example4/CMakeLists.txt
index 53a4fad..161c333 100644
--- a/examples/example4/CMakeLists.txt
+++ b/examples/example4/CMakeLists.txt
@@ -17,7 +17,7 @@
# DLT example implementation
#
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required( VERSION 3.5 )
project( automotive-dlt-example4 )
#
--
2.43.0

View File

@ -1,80 +0,0 @@
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/544]
From 8121a979026d5fcb05bd4e5d3a0647f321b56106 Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Date: Thu, 28 Sep 2023 12:54:23 +0200
Subject: [PATCH] Add common dlt_cdh_cpuinfo.c to unblock build on non amd64
and i386 arcs
---
src/core_dump_handler/dlt_cdh.h | 2 ++
src/core_dump_handler/dlt_cdh_cpuinfo.c | 33 +++++++++++++++++++++++++
src/core_dump_handler/dlt_cdh_crashid.c | 2 +-
3 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 src/core_dump_handler/dlt_cdh_cpuinfo.c
diff --git a/src/core_dump_handler/dlt_cdh.h b/src/core_dump_handler/dlt_cdh.h
index d572ecf3..8608c6c4 100644
--- a/src/core_dump_handler/dlt_cdh.h
+++ b/src/core_dump_handler/dlt_cdh.h
@@ -55,6 +55,8 @@ typedef struct
uint64_t pc;
uint64_t ip;
uint64_t lr;
+ uint64_t sp;
+ uint64_t fp;
} cdh_registers_t;
diff --git a/src/core_dump_handler/dlt_cdh_cpuinfo.c b/src/core_dump_handler/dlt_cdh_cpuinfo.c
new file mode 100644
index 00000000..03509fda
--- /dev/null
+++ b/src/core_dump_handler/dlt_cdh_cpuinfo.c
@@ -0,0 +1,33 @@
+/*
+ * SPDX license identifier: MPL-2.0
+ *
+ * Copyright (C) 2011-2015, BMW AG
+ *
+ * This file is part of COVESA Project DLT - Diagnostic Log and Trace.
+ *
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License (MPL), v. 2.0.
+ * If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * For further information see http://www.covesa.org/.
+ */
+
+/*!
+ * \author Gianfranco Costamagna <locutusofborg@debian.org>
+ *
+ * \copyright Copyright © 2011-2015 BMW AG. \n
+ * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
+ *
+ * \file dlt_cdh_cpuinfo.c
+ */
+
+#include "dlt_cdh_cpuinfo.h"
+
+void get_registers(prstatus_t *prstatus, cdh_registers_t *registers)
+{
+/* struct user_regs_struct *ptr_reg = (struct user_regs_struct *)prstatus->pr_reg;
+
+ registers->pc = ptr_reg->pc;*/ /* [REG_PROC_COUNTER]; */
+
+}
diff --git a/src/core_dump_handler/dlt_cdh_crashid.c b/src/core_dump_handler/dlt_cdh_crashid.c
index bca44e0e..8dd98d70 100644
--- a/src/core_dump_handler/dlt_cdh_crashid.c
+++ b/src/core_dump_handler/dlt_cdh_crashid.c
@@ -30,7 +30,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <asm/prctl.h>
+#include <sys/prctl.h>
#include <inttypes.h>
#include "dlt_cdh.h"

View File

@ -1,36 +0,0 @@
Upstream-Status: Submitted [https://github.com/COVESA/dlt-daemon/pull/567]
From c84e48f6986054cf8b9459e608235b7bd1635746 Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Date: Mon, 13 Nov 2023 12:37:23 +0100
Subject: [PATCH] dlt_cdh:
Make sure on 64 bit we read an ELF64 structure.
Otherwise we get a read error, and the context file is missing some good
to know information
---
src/core_dump_handler/dlt_cdh.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/core_dump_handler/dlt_cdh.h b/src/core_dump_handler/dlt_cdh.h
index 8608c6c4..3dac480a 100644
--- a/src/core_dump_handler/dlt_cdh.h
+++ b/src/core_dump_handler/dlt_cdh.h
@@ -45,10 +45,17 @@
#define CORE_FILE_PATTERN "%s/core.%d.%s.%d.gz"
#define CONTEXT_FILE_PATTERN "%s/context.%d.%s.%d.txt"
+#if ((__SIZEOF_POINTER) == 4)
#define ELF_Ehdr Elf32_Ehdr
#define ELF_Phdr Elf32_Phdr
#define ELF_Shdr Elf32_Shdr
#define ELF_Nhdr Elf32_Nhdr
+#else
+#define ELF_Ehdr Elf64_Ehdr
+#define ELF_Phdr Elf64_Phdr
+#define ELF_Shdr Elf64_Shdr
+#define ELF_Nhdr Elf64_Nhdr
+#endif
typedef struct
{

View File

@ -17,12 +17,13 @@ DEPENDS = "zlib gzip-native json-c"
SRC_URI = "git://github.com/COVESA/${BPN}.git;protocol=https;branch=master \ SRC_URI = "git://github.com/COVESA/${BPN}.git;protocol=https;branch=master \
file://0002-Don-t-execute-processes-as-a-specific-user.patch \ file://0002-Don-t-execute-processes-as-a-specific-user.patch \
file://0004-Modify-systemd-config-directory.patch \ file://0004-Modify-systemd-config-directory.patch \
file://544.patch \ file://0001-Fix-compile-failure-related-to-gzlog.patch \
file://567.patch \ file://0001-Fix-kinds-of-build-failure.patch \
file://0001-CMakeLists-txt-make-DLT_WatchdogSec-can-be-set-by-user.patch \ file://0001-Fix-build-failures.patch \
file://0003-allow-build-with-cmake-4.patch \ file://0001-fix-build-failure-when-systemd-is-enabled.patch \
file://0001-Fix-build-failure-with-glibc-2.43.patch \
" "
SRCREV = "0f2d4cfffada6f8448a2cb27995b38eb4271044f" SRCREV = "f595ea29d1007ca1c3b2d1fd3a88adf7d3db6320"
PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd systemd-watchdog systemd-journal ', '', d)} \ PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd systemd-watchdog systemd-journal ', '', d)} \
@ -71,4 +72,5 @@ FILES:${PN}-doc += "${datadir}/dlt-filetransfer"
do_install:append() { do_install:append() {
rm -f ${D}${bindir}/dlt-test-* rm -f ${D}${bindir}/dlt-test-*
sed -i -e 's:${RECIPE_SYSROOT}::g' ${D}/usr/lib/pkgconfig/automotive-dlt.pc
} }