tree-wide: properly name all threads we fork off
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Dec 2017 12:31:55 +0000 (13:31 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Dec 2017 10:48:21 +0000 (11:48 +0100)
src/basic/async.c
src/journal/journal-file.c
src/libsystemd/sd-resolve/sd-resolve.c

index 2c51883..ccd9eee 100644 (file)
@@ -81,6 +81,8 @@ int asynchronous_sync(pid_t *ret_pid) {
 }
 
 static void *close_thread(void *p) {
+        (void) pthread_setname_np(pthread_self(), "close");
+
         assert_se(close_nointr(PTR_TO_FD(p)) != -EBADF);
         return NULL;
 }
index 7fef403..844a94f 100644 (file)
@@ -147,6 +147,8 @@ static void journal_file_set_offline_internal(JournalFile *f) {
 static void * journal_file_set_offline_thread(void *arg) {
         JournalFile *f = arg;
 
+        (void) pthread_setname_np(pthread_self(), "journal-offline");
+
         journal_file_set_offline_internal(f);
 
         return NULL;
index be3748e..0f369f4 100644 (file)
@@ -405,7 +405,7 @@ static void* thread_worker(void *p) {
         assert_se(pthread_sigmask(SIG_BLOCK, &fullset, NULL) == 0);
 
         /* Assign a pretty name to this thread */
-        (void) prctl(PR_SET_NAME, (unsigned long) "sd-resolve");
+        (void) pthread_setname_np(pthread_self(), "sd-resolve");
 
         while (!resolve->dead) {
                 union {