mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
libuv: Add recipe for 1.29.1 based on leorize's port.
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
SUMMARY="A new platform layer for Node"
|
||||
SUMMARY="Cross-platform asynchronous I/O"
|
||||
DESCRIPTION="libuv is a multi-platform support library with a focus on \
|
||||
asynchronous I/O. It was primarily developed for use by Node.js, but it's also \
|
||||
used by Luvit, Julia, pyuv, and others."
|
||||
HOMEPAGE="http://libuv.org/"
|
||||
COPYRIGHT="2009-2017 Ryan Dahl and others"
|
||||
HOMEPAGE="https://libuv.org/"
|
||||
COPYRIGHT="2015-present libuv project contributors"
|
||||
LICENSE="MIT"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/libuv/libuv/archive/v$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="41ce914a88da21d3b07a76023beca57576ca5b376c6ac440c80bc581cbca1250"
|
||||
SOURCE_URI="https://github.com/libuv/libuv/archive/v$portVersion/libuv-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="bdde1140087ce97080ea323c3598553ece00a24ae63ac568be78bef3e97f3e25"
|
||||
PATCHES="libuv-$portVersion.patchset"
|
||||
|
||||
# libuv requires platform-specific implementations, no piggy-back, really broken
|
||||
ARCHITECTURES="!x86_gcc2 !x86 !x86_64"
|
||||
SECONDARY_ARCHITECTURES="!x86_gcc2 !x86"
|
||||
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
libVersion="1.0.0"
|
||||
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
|
||||
|
||||
PROVIDES="
|
||||
libuv$secondaryArchSuffix = $portVersion
|
||||
lib:libuv$secondaryArchSuffix = 1.0.0 compat >= 1
|
||||
lib:libuv$secondaryArchSuffix = $libVersionCompat
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
@@ -24,7 +26,7 @@ REQUIRES="
|
||||
|
||||
PROVIDES_devel="
|
||||
libuv${secondaryArchSuffix}_devel = $portVersion
|
||||
devel:libuv$secondaryArchSuffix = 1.0.0 compat >= 1
|
||||
devel:libuv$secondaryArchSuffix = $libVersionCompat
|
||||
"
|
||||
REQUIRES_devel="
|
||||
libuv$secondaryArchSuffix == $portVersion
|
||||
@@ -44,10 +46,16 @@ BUILD_PREREQUIRES="
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
"
|
||||
|
||||
defineDebugInfoPackage libuv$secondaryArchSuffix \
|
||||
"$libDir"/libuv.so.$libVersion
|
||||
|
||||
BUILD()
|
||||
{
|
||||
./autogen.sh
|
||||
|
||||
export CPPFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE"
|
||||
export LIBS="-lposix_error_mapper -lbsd"
|
||||
|
||||
runConfigure ./configure
|
||||
make $jobArgs
|
||||
}
|
||||
@@ -69,5 +77,5 @@ INSTALL()
|
||||
|
||||
TEST()
|
||||
{
|
||||
make check #|| true # Test suite doesn't pass
|
||||
make check
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
From d1477d1d6bddccb53eb92edcc8039d131eda5224 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Sat, 10 Jun 2017 12:04:15 +0200
|
||||
Subject: [PATCH] Haiku supporting patches
|
||||
|
||||
---
|
||||
configure.ac | 7 +++++++
|
||||
src/unix/core.c | 31 ++++++++++++++++++++++++++++++-
|
||||
test/test-fs.c | 3 ++-
|
||||
3 files changed, 39 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 8ac06f7..5f78510 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -42,13 +42,16 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
LT_INIT
|
||||
# TODO(bnoordhuis) Check for -pthread vs. -pthreads
|
||||
AC_CHECK_LIB([dl], [dlopen])
|
||||
+AC_CHECK_LIB([root], [dlopen])
|
||||
AC_CHECK_LIB([kstat], [kstat_lookup])
|
||||
AC_CHECK_LIB([nsl], [gethostbyname])
|
||||
+AC_CHECK_LIB([network], [gethostbyname])
|
||||
AC_CHECK_LIB([perfstat], [perfstat_cpu])
|
||||
AC_CHECK_LIB([pthread], [pthread_mutex_init])
|
||||
AC_CHECK_LIB([rt], [clock_gettime])
|
||||
AC_CHECK_LIB([sendfile], [sendfile])
|
||||
AC_CHECK_LIB([socket], [socket])
|
||||
+AC_CHECK_LIB([network], [socket])
|
||||
AC_SYS_LARGEFILE
|
||||
AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])])
|
||||
AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])])
|
||||
@@ -63,9 +66,13 @@ AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])
|
||||
AM_CONDITIONAL([OS390], [AS_CASE([$host_os],[openedition*], [true], [false])])
|
||||
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
|
||||
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
|
||||
+AM_CONDITIONAL([HAIKU], [AS_CASE([$host_os],[haiku*], [true], [false])])
|
||||
AS_CASE([$host_os],[mingw*], [
|
||||
LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -luser32"
|
||||
])
|
||||
+AS_CASE([$host_os],[haiku*], [
|
||||
+ LIBS="$LIBS -lnetwork"
|
||||
+])
|
||||
AS_CASE([$host_os], [openbsd*], [], [
|
||||
AC_CHECK_LIB([kvm], [kvm_open])
|
||||
])
|
||||
diff --git a/src/unix/core.c b/src/unix/core.c
|
||||
index 8276c60..f9a96e2 100644
|
||||
--- a/src/unix/core.c
|
||||
+++ b/src/unix/core.c
|
||||
@@ -57,6 +57,19 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+# include <fcntl.h>
|
||||
+# if defined(O_CLOEXEC)
|
||||
+# define UV__O_CLOEXEC O_CLOEXEC
|
||||
+# endif
|
||||
+# if !defined(FIONCLEX)
|
||||
+# define FIONCLEX 0x5450
|
||||
+# endif
|
||||
+# if !defined(FIOCLEX)
|
||||
+# define FIOCLEX 0x5451
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
#if defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__)
|
||||
@@ -928,7 +941,7 @@ int uv_getrusage(uv_rusage_t* rusage) {
|
||||
rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec;
|
||||
rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec;
|
||||
|
||||
-#if !defined(__MVS__)
|
||||
+#if !defined(__MVS__) && !defined(__HAIKU__)
|
||||
rusage->ru_maxrss = usage.ru_maxrss;
|
||||
rusage->ru_ixrss = usage.ru_ixrss;
|
||||
rusage->ru_idrss = usage.ru_idrss;
|
||||
@@ -944,6 +957,22 @@ int uv_getrusage(uv_rusage_t* rusage) {
|
||||
rusage->ru_nvcsw = usage.ru_nvcsw;
|
||||
rusage->ru_nivcsw = usage.ru_nivcsw;
|
||||
#endif
|
||||
+#if defined(__HAIKU__)
|
||||
+ rusage->ru_maxrss = 0;
|
||||
+ rusage->ru_ixrss = 0;
|
||||
+ rusage->ru_idrss = 0;
|
||||
+ rusage->ru_isrss = 0;
|
||||
+ rusage->ru_minflt = 0;
|
||||
+ rusage->ru_majflt = 0;
|
||||
+ rusage->ru_nswap = 0;
|
||||
+ rusage->ru_inblock = 0;
|
||||
+ rusage->ru_oublock = 0;
|
||||
+ rusage->ru_msgsnd = 0;
|
||||
+ rusage->ru_msgrcv = 0;
|
||||
+ rusage->ru_nsignals = 0;
|
||||
+ rusage->ru_nvcsw = 0;
|
||||
+ rusage->ru_nivcsw = 0;
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/test/test-fs.c b/test/test-fs.c
|
||||
index c482ab5..1af17e1 100644
|
||||
--- a/test/test-fs.c
|
||||
+++ b/test/test-fs.c
|
||||
@@ -29,7 +29,8 @@
|
||||
|
||||
/* FIXME we shouldn't need to branch in this file */
|
||||
#if defined(__unix__) || defined(__POSIX__) || \
|
||||
- defined(__APPLE__) || defined(_AIX) || defined(__MVS__)
|
||||
+ defined(__APPLE__) || defined(_AIX) || defined(__MVS__) || \
|
||||
+ defined(__HAIKU__)
|
||||
#include <unistd.h> /* unlink, rmdir, etc. */
|
||||
#else
|
||||
# include <direct.h>
|
||||
--
|
||||
2.12.2
|
||||
|
||||
382
dev-libs/libuv/patches/libuv-1.29.1.patchset
Normal file
382
dev-libs/libuv/patches/libuv-1.29.1.patchset
Normal file
@@ -0,0 +1,382 @@
|
||||
From c99db7565d0208b88f81891e63fd64924f40dfe2 Mon Sep 17 00:00:00 2001
|
||||
From: Leorize <leorize+oss@disroot.org>
|
||||
Date: Sat, 25 May 2019 15:15:03 -0400
|
||||
Subject: [PATCH] build, core, unix, test: add support for Haiku
|
||||
|
||||
This commit add support for Haiku, an open-source operating system
|
||||
inspired by BeOS.
|
||||
---
|
||||
Makefile.am | 15 ++++
|
||||
configure.ac | 4 +
|
||||
include/uv/unix.h | 3 +-
|
||||
src/unix/bsd-ifaddrs.c | 7 +-
|
||||
src/unix/core.c | 4 +-
|
||||
src/unix/haiku.c | 176 ++++++++++++++++++++++++++++++++++++++++
|
||||
src/unix/process.c | 5 ++
|
||||
test/test-fs-copyfile.c | 3 +-
|
||||
test/test-fs.c | 6 +-
|
||||
9 files changed, 217 insertions(+), 6 deletions(-)
|
||||
create mode 100644 src/unix/haiku.c
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 07224f3..d143d08 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -320,6 +320,10 @@ test_run_tests_CFLAGS += -D_ALL_SOURCE \
|
||||
-D_LINUX_SOURCE_COMPAT
|
||||
endif
|
||||
|
||||
+if HAIKU
|
||||
+test_run_tests_CFLAGS += -D_BSD_SOURCE
|
||||
+endif
|
||||
+
|
||||
if LINUX
|
||||
test_run_tests_CFLAGS += -D_GNU_SOURCE
|
||||
endif
|
||||
@@ -409,6 +413,17 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
|
||||
test_run_tests_LDFLAGS += -lutil
|
||||
endif
|
||||
|
||||
+if HAIKU
|
||||
+uvinclude_HEADERS += include/uv/posix.h
|
||||
+libuv_la_CFLAGS += -D_BSD_SOURCE
|
||||
+libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
|
||||
+ src/unix/haiku.c \
|
||||
+ src/unix/no-fsevents.c \
|
||||
+ src/unix/no-proctitle.c \
|
||||
+ src/unix/posix-hrtime.c \
|
||||
+ src/unix/posix-poll.c
|
||||
+endif
|
||||
+
|
||||
if HURD
|
||||
uvinclude_HEADERS += include/uv/posix.h
|
||||
libuv_la_SOURCES += src/unix/no-fsevents.c \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index ad99f9a..5ab75b8 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -56,6 +56,7 @@ AM_CONDITIONAL([CYGWIN], [AS_CASE([$host_os],[cygwin*], [true], [false])
|
||||
AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])])
|
||||
AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])])
|
||||
AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[*freebsd*], [true], [false])])
|
||||
+AM_CONDITIONAL([HAIKU], [AS_CASE([$host_os],[haiku], [true], [false])])
|
||||
AM_CONDITIONAL([HURD], [AS_CASE([$host_os],[gnu*], [true], [false])])
|
||||
AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])])
|
||||
AM_CONDITIONAL([MSYS], [AS_CASE([$host_os],[msys*], [true], [false])])
|
||||
@@ -71,6 +72,9 @@ AS_CASE([$host_os], [netbsd*], [AC_CHECK_LIB([kvm], [kvm_open])])
|
||||
AS_CASE([$host_os], [kfreebsd*], [
|
||||
LIBS="$LIBS -lfreebsd-glue"
|
||||
])
|
||||
+AS_CASE([$host_os], [haiku], [
|
||||
+ LIBS="$LIBS -lnetwork"
|
||||
+])
|
||||
AC_CHECK_HEADERS([sys/ahafs_evProds.h])
|
||||
AC_CONFIG_FILES([Makefile libuv.pc])
|
||||
AC_CONFIG_LINKS([test/fixtures/empty_file:test/fixtures/empty_file])
|
||||
diff --git a/include/uv/unix.h b/include/uv/unix.h
|
||||
index f73b7b0..c8d36e7 100644
|
||||
--- a/include/uv/unix.h
|
||||
+++ b/include/uv/unix.h
|
||||
@@ -64,7 +64,8 @@
|
||||
#elif defined(__PASE__) || \
|
||||
defined(__CYGWIN__) || \
|
||||
defined(__MSYS__) || \
|
||||
- defined(__GNU__)
|
||||
+ defined(__GNU__) || \
|
||||
+ defined(__HAIKU__)
|
||||
# include "uv/posix.h"
|
||||
#endif
|
||||
|
||||
diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
|
||||
index a4c6bf9..0d7bbe6 100644
|
||||
--- a/src/unix/bsd-ifaddrs.c
|
||||
+++ b/src/unix/bsd-ifaddrs.c
|
||||
@@ -31,6 +31,10 @@
|
||||
#include <net/if_dl.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__HAIKU__)
|
||||
+#define IFF_RUNNING IFF_LINK
|
||||
+#endif
|
||||
+
|
||||
static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
return 1;
|
||||
@@ -45,7 +49,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
|
||||
if (exclude_type == UV__EXCLUDE_IFPHYS)
|
||||
return (ent->ifa_addr->sa_family != AF_LINK);
|
||||
#endif
|
||||
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || \
|
||||
+ defined(__HAIKU__)
|
||||
/*
|
||||
* On BSD getifaddrs returns information related to the raw underlying
|
||||
* devices. We're not interested in this information.
|
||||
diff --git a/src/unix/core.c b/src/unix/core.c
|
||||
index 3bada90..1b3de43 100644
|
||||
--- a/src/unix/core.c
|
||||
+++ b/src/unix/core.c
|
||||
@@ -579,7 +579,7 @@ int uv__nonblock_ioctl(int fd, int set) {
|
||||
}
|
||||
|
||||
|
||||
-#if !defined(__CYGWIN__) && !defined(__MSYS__)
|
||||
+#if !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__HAIKU__)
|
||||
int uv__cloexec_ioctl(int fd, int set) {
|
||||
int r;
|
||||
|
||||
@@ -947,7 +947,7 @@ int uv_getrusage(uv_rusage_t* rusage) {
|
||||
rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec;
|
||||
rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec;
|
||||
|
||||
-#if !defined(__MVS__)
|
||||
+#if !defined(__MVS__) && !defined(__HAIKU__)
|
||||
rusage->ru_maxrss = usage.ru_maxrss;
|
||||
rusage->ru_ixrss = usage.ru_ixrss;
|
||||
rusage->ru_idrss = usage.ru_idrss;
|
||||
diff --git a/src/unix/haiku.c b/src/unix/haiku.c
|
||||
new file mode 100644
|
||||
index 0000000..70ccdcc
|
||||
--- /dev/null
|
||||
+++ b/src/unix/haiku.c
|
||||
@@ -0,0 +1,176 @@
|
||||
+/* Copyright libuv project contributors. All rights reserved.
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+ * of this software and associated documentation files (the "Software"), to
|
||||
+ * deal in the Software without restriction, including without limitation the
|
||||
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the Software is
|
||||
+ * furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in
|
||||
+ * all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
+ * IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include "uv.h"
|
||||
+#include "internal.h"
|
||||
+
|
||||
+#include <FindDirectory.h> /* find_path() */
|
||||
+#include <OS.h>
|
||||
+
|
||||
+
|
||||
+void uv_loadavg(double avg[3]) {
|
||||
+ avg[0] = 0;
|
||||
+ avg[1] = 0;
|
||||
+ avg[2] = 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint64_t uv_get_constrained_memory(void) {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int uv_exepath(char* buffer, size_t* size) {
|
||||
+ char abspath[B_PATH_NAME_LENGTH];
|
||||
+ status_t status;
|
||||
+ ssize_t abspath_len;
|
||||
+
|
||||
+ if (buffer == NULL || size == NULL || *size == 0)
|
||||
+ return UV_EINVAL;
|
||||
+
|
||||
+ status = find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, abspath,
|
||||
+ sizeof(abspath));
|
||||
+ if (status != B_OK)
|
||||
+ return UV__ERR(status);
|
||||
+
|
||||
+ abspath_len = uv__strscpy(buffer, abspath, *size);
|
||||
+ *size -= 1;
|
||||
+ if (abspath_len >= 0 && *size > (size_t)abspath_len)
|
||||
+ *size = (size_t)abspath_len;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint64_t uv_get_free_memory(void) {
|
||||
+ status_t status;
|
||||
+ system_info sinfo;
|
||||
+
|
||||
+ status = get_system_info(&sinfo);
|
||||
+ if (status != B_OK)
|
||||
+ return 0;
|
||||
+
|
||||
+ return (sinfo.max_pages - sinfo.used_pages) * B_PAGE_SIZE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint64_t uv_get_total_memory(void) {
|
||||
+ status_t status;
|
||||
+ system_info sinfo;
|
||||
+
|
||||
+ status = get_system_info(&sinfo);
|
||||
+ if (status != B_OK)
|
||||
+ return 0;
|
||||
+
|
||||
+ return sinfo.max_pages * B_PAGE_SIZE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int uv_resident_set_memory(size_t* rss) {
|
||||
+ area_info area;
|
||||
+ ssize_t cookie;
|
||||
+ status_t status;
|
||||
+ thread_info thread;
|
||||
+
|
||||
+ status = get_thread_info(find_thread(NULL), &thread);
|
||||
+ if (status != B_OK)
|
||||
+ return UV__ERR(status);
|
||||
+
|
||||
+ cookie = 0;
|
||||
+ *rss = 0;
|
||||
+ while (get_next_area_info(thread.team, &cookie, &area) == B_OK)
|
||||
+ *rss += area.ram_size;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int uv_uptime(double* uptime) {
|
||||
+ /* system_time() returns time since booting in microseconds */
|
||||
+ *uptime = (double)system_time() / 1000000;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
||||
+ cpu_topology_node_info* topology_infos;
|
||||
+ int i;
|
||||
+ status_t status;
|
||||
+ system_info system;
|
||||
+ uint32_t topology_count;
|
||||
+ uint64_t cpuspeed;
|
||||
+ uv_cpu_info_t* cpu_info;
|
||||
+
|
||||
+ if (cpu_infos == NULL || count == NULL)
|
||||
+ return UV_EINVAL;
|
||||
+
|
||||
+ status = get_cpu_topology_info(NULL, &topology_count);
|
||||
+ if (status != B_OK)
|
||||
+ return UV__ERR(status);
|
||||
+
|
||||
+ topology_infos = uv__malloc(topology_count * sizeof(*topology_infos));
|
||||
+ if (topology_infos == NULL)
|
||||
+ return UV_ENOMEM;
|
||||
+
|
||||
+ status = get_cpu_topology_info(topology_infos, &topology_count);
|
||||
+ if (status != B_OK) {
|
||||
+ uv__free(topology_infos);
|
||||
+ return UV__ERR(status);
|
||||
+ }
|
||||
+
|
||||
+ cpuspeed = 0;
|
||||
+ for (i = 0; i < (int)topology_count; i++) {
|
||||
+ if (topology_infos[i].type == B_TOPOLOGY_CORE) {
|
||||
+ cpuspeed = topology_infos[i].data.core.default_frequency;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ uv__free(topology_infos);
|
||||
+
|
||||
+ status = get_system_info(&system);
|
||||
+ if (status != B_OK)
|
||||
+ return UV__ERR(status);
|
||||
+
|
||||
+ *cpu_infos = uv__calloc(system.cpu_count, sizeof(**cpu_infos));
|
||||
+ if (*cpu_infos == NULL)
|
||||
+ return UV_ENOMEM;
|
||||
+
|
||||
+ /* CPU time and model are not exposed by Haiku. */
|
||||
+ cpu_info = *cpu_infos;
|
||||
+ for (i = 0; i < (int)system.cpu_count; i++) {
|
||||
+ cpu_info->model = uv__strdup("unknown");
|
||||
+ cpu_info->speed = (int)(cpuspeed / 1000000);
|
||||
+ cpu_info++;
|
||||
+ }
|
||||
+ *count = system.cpu_count;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < count; i++)
|
||||
+ uv__free(cpu_infos[i].model);
|
||||
+
|
||||
+ uv__free(cpu_infos);
|
||||
+}
|
||||
diff --git a/src/unix/process.c b/src/unix/process.c
|
||||
index b284308..e29bf15 100644
|
||||
--- a/src/unix/process.c
|
||||
+++ b/src/unix/process.c
|
||||
@@ -385,6 +385,11 @@ static void uv__process_child_init(const uv_process_options_t* options,
|
||||
if (n == SIGKILL || n == SIGSTOP)
|
||||
continue; /* Can't be changed. */
|
||||
|
||||
+#if defined(__HAIKU__)
|
||||
+ if (n == SIGKILLTHR)
|
||||
+ continue; /* Can't be changed. */
|
||||
+#endif
|
||||
+
|
||||
if (SIG_ERR != signal(n, SIG_DFL))
|
||||
continue;
|
||||
|
||||
diff --git a/test/test-fs-copyfile.c b/test/test-fs-copyfile.c
|
||||
index cd8a2ea..918c086 100644
|
||||
--- a/test/test-fs-copyfile.c
|
||||
+++ b/test/test-fs-copyfile.c
|
||||
@@ -24,7 +24,8 @@
|
||||
|
||||
#if defined(__unix__) || defined(__POSIX__) || \
|
||||
defined(__APPLE__) || defined(__sun) || \
|
||||
- defined(_AIX) || defined(__MVS__)
|
||||
+ defined(_AIX) || defined(__MVS__) || \
|
||||
+ defined(__HAIKU__)
|
||||
#include <unistd.h> /* unlink, etc. */
|
||||
#else
|
||||
# include <direct.h>
|
||||
diff --git a/test/test-fs.c b/test/test-fs.c
|
||||
index c3153c7..6cc2257 100644
|
||||
--- a/test/test-fs.c
|
||||
+++ b/test/test-fs.c
|
||||
@@ -31,7 +31,8 @@
|
||||
/* FIXME we shouldn't need to branch in this file */
|
||||
#if defined(__unix__) || defined(__POSIX__) || \
|
||||
defined(__APPLE__) || defined(__sun) || \
|
||||
- defined(_AIX) || defined(__MVS__)
|
||||
+ defined(_AIX) || defined(__MVS__) || \
|
||||
+ defined(__HAIKU__)
|
||||
#include <unistd.h> /* unlink, rmdir, etc. */
|
||||
#else
|
||||
# include <winioctl.h>
|
||||
@@ -1653,6 +1654,8 @@ TEST_IMPL(fs_chown) {
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(fchown_cb_count == 1);
|
||||
|
||||
+#ifndef __HAIKU__
|
||||
+ /* Haiku doesn't support hardlink */
|
||||
/* sync link */
|
||||
r = uv_fs_link(NULL, &req, "test_file", "test_file_link", NULL);
|
||||
ASSERT(r == 0);
|
||||
@@ -1670,6 +1673,7 @@ TEST_IMPL(fs_chown) {
|
||||
ASSERT(r == 0);
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(lchown_cb_count == 1);
|
||||
+#endif
|
||||
|
||||
/* Close file */
|
||||
r = uv_fs_close(NULL, &req, file, NULL);
|
||||
--
|
||||
2.21.0
|
||||
|
||||
Reference in New Issue
Block a user