mystuff/devel/adb/patches/patch-vendor_adb_sysdeps_h
2026-03-21 23:43:54 +01:00

27 lines
896 B
Plaintext

Index: vendor/adb/sysdeps.h
--- vendor/adb/sysdeps.h.orig
+++ vendor/adb/sysdeps.h
@@ -409,6 +409,9 @@ size_t ParseCompleteUTF8(const char* first, const char
#include <netinet/tcp.h>
#include <poll.h>
#include <pthread.h>
+#ifdef __OpenBSD__
+#include <pthread_np.h>
+#endif
#include <signal.h>
#include <stdarg.h>
#include <stdint.h>
@@ -652,6 +655,12 @@ inline int adb_socket_get_local_port(borrowed_fd fd) {
static inline int adb_thread_setname(const std::string& name) {
#ifdef __APPLE__
return pthread_setname_np(name.c_str());
+#elif defined(__OpenBSD__)
+ char buf[16];
+ strncpy(buf, name.c_str(), sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = 0;
+ pthread_set_name_np(pthread_self(), buf);
+ return 0;
#else
// Both bionic and glibc's pthread_setname_np fails rather than truncating long strings.
// glibc doesn't have strlcpy, so we have to fake it.