mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 19:50:05 +02:00
libuv: Implement various missing functions. (#3897)
This patch syncs the changes of alaviss's libuv port from upstream into HaikuPorts with the following changes: * Implements uv__fs_utime() using utimensat() * Implements uv__fs_futime() using futimens() * Stub implementation of uv_get_constrained_memory() This is just enough to get npm (Node Package Manager) working.
This commit is contained in:
committed by
waddlesplash
parent
e9f386c0d1
commit
530e5de5a5
@@ -5,7 +5,7 @@ used by Luvit, Julia, pyuv, and others."
|
||||
HOMEPAGE="https://libuv.org/"
|
||||
COPYRIGHT="2015-present libuv project contributors"
|
||||
LICENSE="MIT"
|
||||
REVISION="2"
|
||||
REVISION="3"
|
||||
SOURCE_URI="https://github.com/libuv/libuv/archive/v$portVersion/libuv-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="bdde1140087ce97080ea323c3598553ece00a24ae63ac568be78bef3e97f3e25"
|
||||
PATCHES="libuv-$portVersion.patchset"
|
||||
|
||||
@@ -1,39 +1,16 @@
|
||||
From c99db7565d0208b88f81891e63fd64924f40dfe2 Mon Sep 17 00:00:00 2001
|
||||
From 6fec6a490af8575c0d7294d291bce304f17698fb 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
|
||||
Date: Fri, 4 Jan 2019 23:45:20 +0700
|
||||
Subject: build, core, unix: 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
|
||||
index 07224f3..32f4db7 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 \
|
||||
@@ -409,6 +409,17 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
|
||||
test_run_tests_LDFLAGS += -lutil
|
||||
endif
|
||||
|
||||
@@ -74,19 +51,18 @@ index ad99f9a..5ab75b8 100644
|
||||
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
|
||||
index f73b7b0..6c93ee9 100644
|
||||
--- a/include/uv/unix.h
|
||||
+++ b/include/uv/unix.h
|
||||
@@ -64,7 +64,8 @@
|
||||
#elif defined(__PASE__) || \
|
||||
defined(__CYGWIN__) || \
|
||||
@@ -66,6 +66,8 @@
|
||||
defined(__MSYS__) || \
|
||||
- defined(__GNU__)
|
||||
+ defined(__GNU__) || \
|
||||
+ defined(__HAIKU__)
|
||||
defined(__GNU__)
|
||||
# include "uv/posix.h"
|
||||
+#elif defined(__HAIKU__)
|
||||
+# include "uv/posix.h"
|
||||
#endif
|
||||
|
||||
#ifndef NI_MAXHOST
|
||||
diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
|
||||
index a4c6bf9..0d7bbe6 100644
|
||||
--- a/src/unix/bsd-ifaddrs.c
|
||||
@@ -136,10 +112,10 @@ index 3bada90..1b3de43 100644
|
||||
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
|
||||
index 0000000..6f40365
|
||||
--- /dev/null
|
||||
+++ b/src/unix/haiku.c
|
||||
@@ -0,0 +1,176 @@
|
||||
@@ -0,0 +1,171 @@
|
||||
+/* Copyright libuv project contributors. All rights reserved.
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -175,11 +151,6 @@ index 0000000..70ccdcc
|
||||
+}
|
||||
+
|
||||
+
|
||||
+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;
|
||||
@@ -332,6 +303,31 @@ index b284308..e29bf15 100644
|
||||
if (SIG_ERR != signal(n, SIG_DFL))
|
||||
continue;
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
From 82f8a7d7f00ebd552b9ad3aec5516c7cb6d3571a Mon Sep 17 00:00:00 2001
|
||||
From: Leorize <leorize+oss@disroot.org>
|
||||
Date: Sat, 5 Jan 2019 01:15:42 +0700
|
||||
Subject: test: add Haiku support
|
||||
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 32f4db7..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
|
||||
diff --git a/test/test-fs-copyfile.c b/test/test-fs-copyfile.c
|
||||
index cd8a2ea..918c086 100644
|
||||
--- a/test/test-fs-copyfile.c
|
||||
@@ -380,3 +376,64 @@ index c3153c7..6cc2257 100644
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
From fadf058a448f666ef5871a71a6d804d3f733aac7 Mon Sep 17 00:00:00 2001
|
||||
From: Calvin Hill <calvin@hakobaito.co.uk>
|
||||
Date: Mon, 3 Jun 2019 10:22:50 +0700
|
||||
Subject: unix/fs: implement uv_fs_utime and uv_fs_futime for Haiku
|
||||
|
||||
|
||||
diff --git a/src/unix/fs.c b/src/unix/fs.c
|
||||
index 24a130f..bc2f8f3 100644
|
||||
--- a/src/unix/fs.c
|
||||
+++ b/src/unix/fs.c
|
||||
@@ -189,7 +189,8 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
|
||||
|
||||
static ssize_t uv__fs_futime(uv_fs_t* req) {
|
||||
#if defined(__linux__) \
|
||||
- || defined(_AIX71)
|
||||
+ || defined(_AIX71) \
|
||||
+ || defined(__HAIKU__)
|
||||
/* utimesat() has nanosecond resolution but we stick to microseconds
|
||||
* for the sake of consistency with other platforms.
|
||||
*/
|
||||
@@ -796,7 +797,8 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
|
||||
static ssize_t uv__fs_utime(uv_fs_t* req) {
|
||||
#if defined(__linux__) \
|
||||
|| defined(_AIX71) \
|
||||
- || defined(__sun)
|
||||
+ || defined(__sun) \
|
||||
+ || defined(__HAIKU__)
|
||||
/* utimesat() has nanosecond resolution but we stick to microseconds
|
||||
* for the sake of consistency with other platforms.
|
||||
*/
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
From 59990bc91770dca4099c7c8d34a59dd2a2890e85 Mon Sep 17 00:00:00 2001
|
||||
From: Leorize <leorize+oss@disroot.org>
|
||||
Date: Mon, 3 Jun 2019 11:14:48 +0700
|
||||
Subject: haiku: add uv_get_constrained_memory() stub
|
||||
|
||||
Haiku doesn't have memory limits.
|
||||
|
||||
diff --git a/src/unix/haiku.c b/src/unix/haiku.c
|
||||
index 6f40365..7708851 100644
|
||||
--- a/src/unix/haiku.c
|
||||
+++ b/src/unix/haiku.c
|
||||
@@ -79,6 +79,11 @@ uint64_t uv_get_total_memory(void) {
|
||||
}
|
||||
|
||||
|
||||
+uint64_t uv_get_constrained_memory(void) {
|
||||
+ return 0; /* Memory constraints are unknown. */
|
||||
+}
|
||||
+
|
||||
+
|
||||
int uv_resident_set_memory(size_t* rss) {
|
||||
area_info area;
|
||||
ssize_t cookie;
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user