summaryrefslogtreecommitdiff
path: root/src/system/dlt-system-journal.c
diff options
context:
space:
mode:
authorSebastian Kloska <sebastian.kloska@daimler.com>2019-09-10 14:25:34 +0200
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2019-09-13 11:56:51 +0900
commit5f42ef3c92b3a1f5679e92ba3b2bb3a547c16da2 (patch)
tree229e98a7e06116883b1dae61c47b90ec889fe5db /src/system/dlt-system-journal.c
parentc9d1ba4b522afb79a719daea9e421724299f197f (diff)
downloadDLT-daemon-5f42ef3c92b3a1f5679e92ba3b2bb3a547c16da2.tar.gz
Proper setup and error checking of pthread_create
* Replace all start_XXX functions with one start_thread * Don't make pthread_t static * Don't use pthread_attr_t. Simply pass NULL * Bail out when pthread_create() fails * Check if MAX_THREADS gets exceeded Signed-off-by: Sebastian Kloska <sebastian.kloska@daimler.com>
Diffstat (limited to 'src/system/dlt-system-journal.c')
-rw-r--r--src/system/dlt-system-journal.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/system/dlt-system-journal.c b/src/system/dlt-system-journal.c
index 2845406..ee3ddf0 100644
--- a/src/system/dlt-system-journal.c
+++ b/src/system/dlt-system-journal.c
@@ -154,7 +154,8 @@ void dlt_system_journal_get_timestamp(sd_journal *journal, MessageTimestamp *tim
if (errno != 0)
time_usecs = 0;
}
- else if ((ret = sd_journal_get_realtime_usec(journal, &time_usecs)) < 0) {
+ else if ((ret = sd_journal_get_realtime_usec(journal, &time_usecs)) < 0)
+ {
DLT_LOG(dltsystem, DLT_LOG_WARN,
DLT_STRING("dlt-system-journal failed to get realtime: "),
DLT_STRING(strerror(-ret)));
@@ -180,7 +181,8 @@ void dlt_system_journal_get_timestamp(sd_journal *journal, MessageTimestamp *tim
if (errno != 0)
time_usecs = 0;
}
- else if ((ret = sd_journal_get_monotonic_usec(journal, &time_usecs, NULL)) < 0) {
+ else if ((ret = sd_journal_get_monotonic_usec(journal, &time_usecs, NULL)) < 0)
+ {
DLT_LOG(dltsystem, DLT_LOG_WARN,
DLT_STRING("dlt-system-journal failed to get monotonic time: "),
DLT_STRING(strerror(-ret)));
@@ -396,14 +398,4 @@ void journal_thread(void *v_conf)
}
-void start_systemd_journal(DltSystemConfiguration *conf)
-{
- DLT_LOG(dltsystem, DLT_LOG_DEBUG,
- DLT_STRING("dlt-system-journal, start journal"));
- static pthread_attr_t t_attr;
- static pthread_t pt;
- pthread_create(&pt, &t_attr, (void *)journal_thread, conf);
- threads.threads[threads.count++] = pt;
-}
-
#endif /* DLT_SYSTEMD_JOURNAL_ENABLE */