Fix building on Haiku OS

This commit is contained in:
Cacodemon345
2025-03-14 21:24:36 +06:00
parent aef06552fb
commit 0686045d2a
3 changed files with 20 additions and 2 deletions

View File

@@ -2,6 +2,9 @@
# define _FILE_OFFSET_BITS 64
# define _LARGEFILE64_SOURCE 1
#endif
#ifdef __HAIKU__
#include <OS.h>
#endif
#include <SDL.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -1398,16 +1401,20 @@ plat_set_thread_name(void *thread, const char *name)
if (thread) /* Apple pthread can only set self's name */
return;
char truncated[64];
#elif defined(Q_OS_NETBSD)
#elif defined(__NetBSD__)
char truncated[64];
#elif defined(__HAIKU__)
char truncated[32];
#else
char truncated[16];
#endif
strncpy(truncated, name, sizeof(truncated) - 1);
#ifdef __APPLE__
pthread_setname_np(truncated);
#elif defined(Q_OS_NETBSD)
#elif defined(__NetBSD__)
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, "%s");
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), truncated);
#else
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated);
#endif