Haiku build fix proposal (#17117) ##sys

This commit is contained in:
David CARLIER 2020-06-27 16:20:43 +01:00 committed by GitHub
parent 51405f81f4
commit 4d22e92d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 7 deletions

11
configure vendored
View File

@ -646,7 +646,10 @@ if [ "$HOST_OS" = "openbsd" ]; then
USEROSTYPE="bsd"
else
if [ "$HOST_OS" = "darwin" ]; then
USEROSTYPE="darwin"; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
USEROSTYPE="darwin"
else
if [ "$HOST_OS" = "haiku" ]; then
USEROSTYPE="haiku"; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
if [ "$LIBVERSION" = "xxx" ]; then
LIBVERSION="$VERSION"; fi
if [ "$USEROSTYPE" = "gnulinux" ]; then
@ -673,8 +676,12 @@ if [ "$USEROSTYPE" = "solaris" ]; then
HAVE_PTRACE="0"
USE_PTRACE_WRAP="0"
else
if [ "$USEROSTYPE" = "haiku" ]; then
HAVE_PTRACE="0"
USE_PTRACE_WRAP="0"
else
HAVE_PTRACE="1"
USE_PTRACE_WRAP="0"; fi; fi; fi; fi; fi
USE_PTRACE_WRAP="0"; fi; fi; fi; fi; fi; fi
if [ "$DEBUGGER" = "0" ]; then
HAVE_PTRACE="0"; fi
if [ "$WANT_PTRACE_WRAP" = "0" ]; then

View File

@ -183,7 +183,10 @@ IFEQ USEROSTYPE auto ; {
}{
IFEQ HOST_OS darwin ; {
USEROSTYPE = darwin ;
} } } } } } } } } } }
}{
IFEQ HOST_OS haiku ; {
USEROSTYPE = haiku ;
} } } } } } } } } } } }
}
(( this hack is required for openbsd ports ))
@ -217,10 +220,14 @@ IFEQ USEROSTYPE mingw32 ; {
IFEQ USEROSTYPE solaris ; {
HAVE_PTRACE = 0 ;
USE_PTRACE_WRAP = 0 ;
}{
IFEQ USEROSTYPE haiku ; {
HAVE_PTRACE = 0 ;
USE_PTRACE_WRAP = 0 ;
}{
HAVE_PTRACE = 1 ;
USE_PTRACE_WRAP = 0 ;
} } } } }
} } } } } }
IFNOT DEBUGGER {
HAVE_PTRACE = 0 ;

View File

@ -140,7 +140,7 @@
static inline struct tm *gmtime_r(const time_t *t, struct tm *r) { return (gmtime_s(r, t))? NULL : r; }
#endif
#if defined(EMSCRIPTEN) || defined(__linux__) || defined(__APPLE__) || defined(__GNU__) || defined(__ANDROID__) || defined(__QNX__) || defined(__sun)
#if defined(EMSCRIPTEN) || defined(__linux__) || defined(__APPLE__) || defined(__GNU__) || defined(__ANDROID__) || defined(__QNX__) || defined(__sun) || defined(__HAIKU__)
#define __BSD__ 0
#define __UNIX__ 1
#endif
@ -354,6 +354,11 @@ static inline void *r_new_copy(int size, void *data) {
#include <dirent.h>
#include <unistd.h>
#include <sys/time.h>
#ifdef __HAIKU__
// Original macro cast it to clockid_t
#undef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 0
#endif
#endif
#ifndef HAVE_EPRINTF
@ -593,6 +598,8 @@ enum {
#define R_SYS_OS "openbsd"
#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
#define R_SYS_OS "freebsd"
#elif defined (__HAIKU__)
#define R_SYS_OS "haiku"
#else
#define R_SYS_OS "unknown"
#endif

View File

@ -26,7 +26,7 @@
#include <windows.h>
#else
#if __linux__ || __APPLE__ || __OpenBSD__ || __FreeBSD__ || __NetBSD__ || __DragonFly__
#if __linux__ || __APPLE__ || __OpenBSD__ || __FreeBSD__ || __NetBSD__ || __DragonFly__ || __HAIKU__
#include <sys/ioctl.h>
#include <termios.h>
#else

View File

@ -20,6 +20,10 @@
# define FREEBSD_WITH_BACKTRACE
# endif
#endif
#if defined(__HAIKU__)
# include <kernel/image.h>
# include <sys/param.h>
#endif
#include <sys/types.h>
#include <r_types.h>
#include <r_util.h>
@ -1175,6 +1179,22 @@ R_API char *r_sys_pid_to_path(int pid) {
if (ret != 0) {
return NULL;
}
#elif __HAIKU__
char pathbuf[MAXPATHLEN];
int32_t group = 0;
image_info ii;
while (get_next_image_info (0, &group, &ii) == B_OK) {
if (ii.type == B_APP_IMAGE) {
break;
}
}
if (ii.type == B_APP_IMAGE) {
r_str_ncpy (pathbuf, ii.name, MAXPATHLEN);
} else {
pathbuf[0] = '\0';
}
#else
char buf[128], pathbuf[1024];
snprintf (buf, sizeof (buf), "/proc/%d/exe", pid);

View File

@ -9,7 +9,7 @@
#else
# include <sys/param.h>
# include <sys/mman.h>
# if !defined(__pnacl__) && !defined(__native_client__)
# if !defined(__pnacl__) && !defined(__native_client__) && !defined(__HAIKU__)
# include <sys/syscall.h>
# if !defined(SYS_write) && defined(__NR_write)
# define SYS_write __NR_write