From 1a94ea1045cefea14be31b74e49b9c9be4e90b7d Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Mon, 1 Dec 2014 13:48:10 +0100 Subject: [PATCH] libCom/osi: fix - do not set the main thread's Linux name to _main_ (linux) --- src/libCom/osi/os/Linux/osdThreadExtra.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/os/Linux/osdThreadExtra.c b/src/libCom/osi/os/Linux/osdThreadExtra.c index bbde444f8..6423004c5 100644 --- a/src/libCom/osi/os/Linux/osdThreadExtra.c +++ b/src/libCom/osi/os/Linux/osdThreadExtra.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -57,8 +58,10 @@ static void thread_hook(epicsThreadId pthreadInfo) /* Set the name of the thread's process. Limited to 16 characters. */ char comm[16]; - snprintf(comm, sizeof(comm), "%s", pthreadInfo->name); - prctl(PR_SET_NAME, comm, 0l, 0l, 0l); + if (strcmp(pthreadInfo->name, "_main_")) { + snprintf(comm, sizeof(comm), "%s", pthreadInfo->name); + prctl(PR_SET_NAME, comm, 0l, 0l, 0l); + } pthreadInfo->lwpId = syscall(SYS_gettid); }