Modify setting command 23/318223/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 25 Sep 2024 23:13:38 +0000 (08:13 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 25 Sep 2024 23:13:38 +0000 (08:13 +0900)
- Using pthread_setname_np() instead

Change-Id: I24c3ad44b720e0b1f9a0183c5e1a3f8169930f39
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul/aul_worker.c

index 09fc7863c73749c4f033d2b885b28844b3405c38..7d963717006779785abfd102554606aef07e5bb9 100644 (file)
@@ -135,33 +135,6 @@ static struct job_s *__create_job(const char *name,
        return job;
 }
 
-static int __set_comm(const char *name)
-{
-       int fd;
-       ssize_t bytes_written;
-       char path[PATH_MAX];
-       pid_t tid = syscall(__NR_gettid);
-
-       _I("[%s] TID(%d)", name, tid);
-       snprintf(path, sizeof(path), "/proc/%d/comm", tid);
-       fd = open(path, O_WRONLY);
-       if (fd < 0) {
-               _E("Failed to open %s. error(%d)", path, errno);
-               return -1;
-       }
-
-       bytes_written = write(fd, name, strlen(name) + 1);
-       if (bytes_written < 0) {
-               _E("Failed to write name(%s)", name);
-               close(fd);
-               return -1;
-       }
-
-       close(fd);
-
-       return 0;
-}
-
 static GIOCondition __convert_aul_io_condition(int condition)
 {
        GIOCondition cond = 0;
@@ -360,7 +333,7 @@ static gpointer __worker_thread_loop(gpointer data)
        GSource *source;
 
        g_mutex_lock(&worker->mutex);
-       __set_comm(worker->name);
+       pthread_setname_np(pthread_self(), worker->name);
 
        source = g_idle_source_new();
        if (!source) {