diff --git a/common/lt_debug.cpp b/common/lt_debug.cpp index cf65343..06434f7 100644 --- a/common/lt_debug.cpp +++ b/common/lt_debug.cpp @@ -3,6 +3,10 @@ #include #include #include +#include +#include +#include + int cnxt_debug = 0; /* compat, unused */ @@ -76,3 +80,11 @@ void lt_debug_init(void) fprintf(stderr, "\n"); } } + +void hal_set_threadname(const char *name) +{ + char threadname[17]; + strncpy(threadname, name, sizeof(threadname)); + threadname[16] = 0; + prctl (PR_SET_NAME, (unsigned long)&threadname); +} diff --git a/common/lt_debug.h b/common/lt_debug.h index 296152b..69a451a 100644 --- a/common/lt_debug.h +++ b/common/lt_debug.h @@ -23,6 +23,7 @@ extern int debuglevel; +void hal_set_threadname(const char *name); void _lt_debug(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); void _lt_info(int facility, const void *, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); void lt_debug_init(void);