diff options
author | Simon Brandner <simon.brandner@partner.bmw.de> | 2013-03-28 11:36:33 +0100 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2013-07-19 16:54:52 +0200 |
commit | 1f04be47b58dc6ab0352d685626beabf4423cb7a (patch) | |
tree | 16c37bedf6f0ddc58e77927d79fd3c5c3c152755 /src/tests | |
parent | a52cae9ddaacb322119562c857dcf1636205666f (diff) | |
download | DLT-daemon-1f04be47b58dc6ab0352d685626beabf4423cb7a.tar.gz |
made the APID strings in dlt-test-multi-process counting from 00-99
made all strerror output in user lib in one line with error message to avoid mixed up line multithreading conditions
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/tests')
-rwxr-xr-x | src/tests/dlt-test-multi-process.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tests/dlt-test-multi-process.c b/src/tests/dlt-test-multi-process.c index e5dfcea..a34813d 100755 --- a/src/tests/dlt-test-multi-process.c +++ b/src/tests/dlt-test-multi-process.c @@ -48,6 +48,7 @@ #include <errno.h> #include <pthread.h> #include <sys/wait.h> +#include <syslog.h> #include "dlt.h" #include "dlt_common.h" @@ -85,7 +86,7 @@ volatile sig_atomic_t in_handler = 0; // Globals for cleanup from main and signal handler pid_t pids[MAX_PROCS]; -int pidcount = 0; +unsigned int pidcount = 0; /** * Print instructions. @@ -202,7 +203,7 @@ int main(int argc, char **argv) if(signal(SIGTERM, quit_handler) == SIG_IGN) signal(SIGTERM, SIG_IGN); // kill (nice) - printf("Setup done. Listening. My pid: %d\n", getpid()); + printf("Setup done. Listening. My pid: %d\n", getpid()); fflush(stdout); int err = wait_for_death(); @@ -216,7 +217,7 @@ int main(int argc, char **argv) void do_forks(s_parameters params) { - int i; + int i; // Launch child processes for(i=0;i<params.nprocs;i++) @@ -293,7 +294,8 @@ void do_logging(s_thread_data *data) char ctid[5]; char ctid_name[256]; - sprintf(ctid,"%.2x", rand() & 0x0000ffff); + + sprintf(ctid,"%.2x", rand() & 0x0000ffff); sprintf(ctid_name, "Child %s in dlt-test-multi-process", ctid); DLT_REGISTER_CONTEXT(mycontext, ctid, ctid_name); @@ -318,8 +320,10 @@ void run_threads(s_parameters params) int i; srand(getpid()); - sprintf(apid,"MT%.1x", rand() & 0x000000ff); - sprintf(apid_name, "Apps %s.", apid); + + sprintf(apid,"MT%02u", pidcount); + sprintf(apid_name, "Apps %s.", apid); + DLT_REGISTER_APP(apid, apid_name); thread_data.params = params; |