All: Fix build on Haiku.

This commit is contained in:
Augustin Cavalier 2017-04-24 00:16:11 -04:00 committed by endrift
parent 86db6fa7e2
commit 953335846b
3 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,8 @@ CXX_GUARD_START
#include <sys/time.h>
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <pthread_np.h>
#elif defined(__HAIKU__)
#include <OS.h>
#endif
#define THREAD_ENTRY void*
@ -88,6 +90,9 @@ static inline int ThreadSetName(const char* name) {
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
pthread_set_name_np(pthread_self(), name);
return 0;
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), name);
return 0;
#elif !defined(BUILD_PANDORA) // Pandora's glibc is too old
return pthread_setname_np(pthread_self(), name);
#else

View File

@ -147,7 +147,7 @@ const char* _vdeName(struct VDirEntry* vde) {
static enum VFSType _vdeType(struct VDirEntry* vde) {
struct VDirEntryDE* vdede = (struct VDirEntryDE*) vde;
#ifndef WIN32
#if !defined(WIN32) && !defined(__HAIKU__)
if (vdede->ent->d_type == DT_DIR) {
return VFS_DIRECTORY;
}

View File

@ -166,7 +166,11 @@ static bool _vfdSync(struct VFile* vf, const void* buffer, size_t size) {
UNUSED(size);
struct VFileFD* vfd = (struct VFileFD*) vf;
#ifndef _WIN32
#ifdef __HAIKU__
futimens(vfd->fd, NULL);
#else
futimes(vfd->fd, NULL);
#endif
if (buffer && size) {
return msync(buffer, size, MS_SYNC) == 0;
}