]> git.hungrycats.org Git - bees/commitdiff
trace: use pthread_setname wrapper
authorZygo Blaxell <bees@furryterror.org>
Thu, 29 Dec 2022 09:03:53 +0000 (04:03 -0500)
committerZygo Blaxell <bees@furryterror.org>
Thu, 5 Jan 2023 06:10:17 +0000 (01:10 -0500)
libcrucible can deal with the Linux kernel and/or libc's thread name
limitations.  No need to duplicate that work in bees.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-trace.cc

index 9e9c71ffa09d4dda06a28bf87b4e97f39245e469..d04d4c1b59cf44ffe3e061526cb06aae8998ca6d 100644 (file)
@@ -111,9 +111,7 @@ void
 BeesNote::set_name(const string &name)
 {
        tl_name = name;
-       catch_all([&]() {
-               DIE_IF_MINUS_ERRNO(pthread_setname_np(pthread_self(), name.c_str()));
-       });
+       pthread_setname(name);
 }
 
 string
@@ -134,19 +132,12 @@ BeesNote::get_name()
        }
 
        // OK try the pthread name next.
-       char buf[24];
-       memset(buf, '\0', sizeof(buf));
-       int err = pthread_getname_np(pthread_self(), buf, sizeof(buf));
-       if (err) {
-               return string("pthread_getname_np: ") + strerror(err);
-       }
-       buf[sizeof(buf) - 1] = '\0';
 
        // thread_getname_np returns process name
        // ...by default?  ...for the main thread?
        // ...except during exception handling?
        // ...randomly?
-       return buf;
+       return pthread_getname();
 }
 
 BeesNote::ThreadStatusMap