Add OpenBSD support to be able to get the thread name

llvm-svn: 353367
This commit is contained in:
Brad Smith 2019-02-07 02:06:58 +00:00
parent 2b93ef7ef6
commit 01227fea9e
1 changed files with 6 additions and 0 deletions

View File

@ -201,6 +201,12 @@ void llvm::get_thread_name(SmallVectorImpl<char> &Name) {
char buf[len]; char buf[len];
::pthread_getname_np(::pthread_self(), buf, len); ::pthread_getname_np(::pthread_self(), buf, len);
Name.append(buf, buf + strlen(buf));
#elif defined(__OpenBSD__)
constexpr uint32_t len = get_max_thread_name_length_impl();
char buf[len];
::pthread_get_name_np(::pthread_self(), buf, len);
Name.append(buf, buf + strlen(buf)); Name.append(buf, buf + strlen(buf));
#elif defined(__linux__) #elif defined(__linux__)
#if HAVE_PTHREAD_GETNAME_NP #if HAVE_PTHREAD_GETNAME_NP