Skip to content

Commit

Permalink
Merge pull request #119 from marcone/threadnames
Browse files Browse the repository at this point in the history
Set names for threads
  • Loading branch information
jfdelnero authored Nov 13, 2024
2 parents 49219da + b632fc5 commit f5ef898
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <pthread.h>
#include <string.h>
#include <sys/inotify.h>
#include <sys/prctl.h>
#include <unistd.h>
#include <signal.h>

Expand Down Expand Up @@ -109,6 +110,8 @@ static void* inotify_thread(void* arg)
const struct inotify_event *event;
struct sigaction sa;

prctl(PR_SET_NAME, (unsigned long) __func__);

ctx = (mtp_ctx *)arg;

sa.sa_handler = NULL;
Expand Down
3 changes: 3 additions & 0 deletions src/msgqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <unistd.h>
#include <signal.h>

#include <sys/prctl.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -72,6 +73,8 @@ static void* msgqueue_thread( void* arg )
int store_index;
struct sigaction sa;

prctl(PR_SET_NAME, (unsigned long) __func__);

ctx = (mtp_ctx *)arg;

sa.sa_handler = NULL;
Expand Down
3 changes: 3 additions & 0 deletions src/umtprd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <sys/prctl.h>

#ifdef SYSTEMD_NOTIFY
#include <systemd/sd-login.h>
Expand All @@ -54,6 +55,8 @@ void* io_thread(void* arg)
usb_gadget * ctx;
int ret;

prctl(PR_SET_NAME, (unsigned long) __func__);

ctx = (usb_gadget *)arg;

while (is_usb_up(ctx))
Expand Down

0 comments on commit f5ef898

Please sign in to comment.