| Server IP : 82.208.35.60 / Your IP : 216.73.216.238 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/devel/electron19/files/ |
Upload File : |
--- electron/shell/common/node_bindings_linux.cc.orig 2022-06-08 15:30:58 UTC
+++ electron/shell/common/node_bindings_linux.cc
@@ -4,17 +4,31 @@
#include "shell/common/node_bindings_linux.h"
+#if !defined(OS_BSD)
#include <sys/epoll.h>
+#else
+#include <errno.h>
+#include <sys/select.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#endif
namespace electron {
NodeBindingsLinux::NodeBindingsLinux(BrowserEnvironment browser_env)
+#if !defined(OS_BSD)
: NodeBindings(browser_env), epoll_(epoll_create(1)) {
+#else
+ : NodeBindings(browser_env) {
+#endif
+#if !defined(OS_BSD)
int backend_fd = uv_backend_fd(uv_loop_);
struct epoll_event ev = {0};
ev.events = EPOLLIN;
ev.data.fd = backend_fd;
epoll_ctl(epoll_, EPOLL_CTL_ADD, backend_fd, &ev);
+#endif
}
NodeBindingsLinux::~NodeBindingsLinux() = default;
@@ -42,6 +56,7 @@ void NodeBindingsLinux::RunMessageLoop() {
}
void NodeBindingsLinux::PollEvents() {
+#if !defined(OS_BSD)
int timeout = uv_backend_timeout(uv_loop_);
// Wait for new libuv events.
@@ -50,6 +65,26 @@ void NodeBindingsLinux::PollEvents() {
struct epoll_event ev;
r = epoll_wait(epoll_, &ev, 1, timeout);
} while (r == -1 && errno == EINTR);
+#else
+ struct timeval tv;
+ int timeout = uv_backend_timeout(uv_loop_);
+ if (timeout != -1) {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ }
+
+ fd_set readset;
+ int fd = uv_backend_fd(uv_loop_);
+ FD_ZERO(&readset);
+ FD_SET(fd, &readset);
+
+ // Wait for new libuv events.
+ int r;
+ do {
+ r = select(fd + 1, &readset, nullptr, nullptr,
+ timeout == -1 ? nullptr : &tv);
+ } while (r == -1 && errno == EINTR);
+#endif
}
// static