All: Fix build on Haiku.

This commit is contained in:
Augustin Cavalier 2017-04-24 00:16:11 -04:00 committed by Vicki Pfau
parent 2a8ae75561
commit abe3432739
3 changed files with 10 additions and 1 deletions

View File

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

View File

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

View File

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