From a99d5454e81ff345fd1e18bce02027f8ce33b09b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 5 Oct 2013 22:01:57 +0200 Subject: [PATCH] add set_threadname function Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/3ed147cab733c51fc7b165f194596bc7ce9d7b9c Author: Stefan Seyfried Date: 2013-10-05 (Sat, 05 Oct 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- common/lt_debug.cpp | 12 ++++++++++++ common/lt_debug.h | 1 + 2 files changed, 13 insertions(+) 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);