summaryrefslogtreecommitdiff
path: root/src/dlt-qnx-system
diff options
context:
space:
mode:
authorBiastoch, Darian (ADITG/ESM) <dbiastoch@de.adit-jv.com>2021-07-16 00:29:10 +0000
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-10-05 11:19:26 +0900
commit50a385e6afea50922569828438194477537a768b (patch)
tree120995ed2095145b31caf2958ddd259ced88786d /src/dlt-qnx-system
parent0ee7fdff3d6bb2f2055e7083fa48728f4d274661 (diff)
downloadDLT-daemon-50a385e6afea50922569828438194477537a768b.tar.gz
system: use signalfd for dlt-system
1: Move the call of pthread_sigmask in dlt-qnx-systems main before DLT_REGISTER_APP, because this already spawns a thread, what was done without applying pthread_sigmask before. 2: Replaced all threads in dlt-system, that are spawned for each feature, through one poll. This poll waits for a file descriptor event, that triggers the feature routine, that was executed before in the thread. Done this for following processes: * reading syslog and journal * frequently reading logfile and logprocess * triggering filetransfer, if a file was added/changed in watched directory * checking watchdog timer of systemd service file with defined intervall Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
Diffstat (limited to 'src/dlt-qnx-system')
-rw-r--r--src/dlt-qnx-system/dlt-qnx-system.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/dlt-qnx-system/dlt-qnx-system.c b/src/dlt-qnx-system/dlt-qnx-system.c
index afd34b4..03ad0fb 100644
--- a/src/dlt-qnx-system/dlt-qnx-system.c
+++ b/src/dlt-qnx-system/dlt-qnx-system.c
@@ -70,28 +70,27 @@ int main(int argc, char* argv[])
daemonize();
}
- DLT_REGISTER_APP(config.applicationId, "DLT QNX System");
- DLT_REGISTER_CONTEXT(dltQnxSystem, config.applicationContextId,
- "Context of main dlt qnx system manager");
-
- DLT_LOG(dltQnxSystem, DLT_LOG_DEBUG,
- DLT_STRING("Setting signals wait for abnormal exit"));
-
- g_threads.mainThread = pthread_self();
-
sigemptyset(&mask);
sigaddset(&mask, SIGTERM);
sigaddset(&mask, SIGHUP);
sigaddset(&mask, SIGQUIT);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGALRM);
- if (pthread_sigmask(SIG_BLOCK, &mask, NULL) == -1) {
- DLT_LOG(dltQnxSystem, DLT_LOG_WARN,
- DLT_STRING("Failed to block signals!"));
- DLT_UNREGISTER_APP();
+ if (pthread_sigmask(SIG_BLOCK, &mask, NULL) != 0)
+ {
+ fprintf(stderr, "Couldn't set mask for potential future threads.\n");
return -1;
}
+ DLT_REGISTER_APP(config.applicationId, "DLT QNX System");
+ DLT_REGISTER_CONTEXT(dltQnxSystem, config.applicationContextId,
+ "Context of main dlt qnx system manager");
+
+ DLT_LOG(dltQnxSystem, DLT_LOG_DEBUG,
+ DLT_STRING("Setting signals wait for abnormal exit"));
+
+ g_threads.mainThread = pthread_self();
+
DLT_LOG(dltQnxSystem, DLT_LOG_DEBUG, DLT_STRING("Launching threads."));
start_threads(&config);