diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
commit | e81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch) | |
tree | 9ed5e1a91f242e2cb5911577356e487a55c01b78 /source/Host/netbsd/HostThreadNetBSD.cpp | |
parent | 85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff) |
Notes
Diffstat (limited to 'source/Host/netbsd/HostThreadNetBSD.cpp')
-rw-r--r-- | source/Host/netbsd/HostThreadNetBSD.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/source/Host/netbsd/HostThreadNetBSD.cpp b/source/Host/netbsd/HostThreadNetBSD.cpp new file mode 100644 index 0000000000000..06bc502516a6f --- /dev/null +++ b/source/Host/netbsd/HostThreadNetBSD.cpp @@ -0,0 +1,50 @@ +//===-- HostThreadNetBSD.cpp -----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// lldb Includes +#include "lldb/Host/netbsd/HostThreadNetBSD.h" +#include "lldb/Host/Host.h" + +// C includes +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> +#include <string.h> +#include <sys/sysctl.h> +#include <sys/user.h> + +// C++ includes +#include <string> + +using namespace lldb_private; + +HostThreadNetBSD::HostThreadNetBSD() +{ +} + +HostThreadNetBSD::HostThreadNetBSD(lldb::thread_t thread) + : HostThreadPosix(thread) +{ +} + +void +HostThreadNetBSD::SetName(lldb::thread_t thread, llvm::StringRef &name) +{ + ::pthread_setname_np(thread, "%s", const_cast<char*>(name.data())); +} + +void +HostThreadNetBSD::GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name) +{ + char buf[PTHREAD_MAX_NAMELEN_NP]; + ::pthread_getname_np(thread, buf, PTHREAD_MAX_NAMELEN_NP); + + name.clear(); + name.append(buf, buf + strlen(buf)); +} |