aboutsummaryrefslogtreecommitdiff
path: root/devel/electron28/files/patch-base_process_process__posix.cc
diff options
context:
space:
mode:
authorHiroki Tagato <tagattie@FreeBSD.org>2024-01-29 07:45:17 +0000
committerHiroki Tagato <tagattie@FreeBSD.org>2024-01-29 07:47:07 +0000
commitf88751e60ac087f27ad0aa9393839272b6d8bdd7 (patch)
tree81ea3525e768f6787adfa8899435959d676c2ff2 /devel/electron28/files/patch-base_process_process__posix.cc
parent873eee30b8a665a7e6b16d74dc37c2dfbfdc7050 (diff)
downloadports-f88751e60ac087f27ad0aa9393839272b6d8bdd7.tar.gz
ports-f88751e60ac087f27ad0aa9393839272b6d8bdd7.zip
devel/electron28: add port: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build cross platform desktop apps with JavaScript, HTML, and CSS. It's easier than you think. If you can build a website, you can build a desktop app. Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It takes care of the hard parts so you can focus on the core of your application. WWW: https://electronjs.org/
Diffstat (limited to 'devel/electron28/files/patch-base_process_process__posix.cc')
-rw-r--r--devel/electron28/files/patch-base_process_process__posix.cc94
1 files changed, 94 insertions, 0 deletions
diff --git a/devel/electron28/files/patch-base_process_process__posix.cc b/devel/electron28/files/patch-base_process_process__posix.cc
new file mode 100644
index 000000000000..96114257c2cb
--- /dev/null
+++ b/devel/electron28/files/patch-base_process_process__posix.cc
@@ -0,0 +1,94 @@
+--- base/process/process_posix.cc.orig 2023-10-19 19:57:58 UTC
++++ base/process/process_posix.cc
+@@ -23,10 +23,15 @@
+ #include "base/trace_event/base_tracing.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include <sys/event.h>
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #if BUILDFLAG(CLANG_PROFILING)
+ #include "base/test/clang_profiling.h"
+ #endif
+@@ -93,7 +98,7 @@ bool WaitpidWithTimeout(base::ProcessHandle handle,
+ return ret_pid > 0;
+ }
+
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Using kqueue on Mac so that we can wait on non-child processes.
+ // We can't use kqueues on child processes because we need to reap
+ // our own children using wait.
+@@ -198,7 +203,7 @@ bool WaitForExitWithTimeoutImpl(base::ProcessHandle ha
+ const bool exited = (parent_pid < 0);
+
+ if (!exited && parent_pid != our_pid) {
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // On Mac we can wait on non child processes.
+ return WaitForSingleNonChildProcess(handle, timeout);
+ #else
+@@ -387,7 +392,56 @@ void Process::Exited(int exit_code) const {
+
+ int Process::GetOSPriority() const {
+ DCHECK(IsValid());
++// avoid pledge(2) violation
++#if BUILDFLAG(IS_BSD)
++ return 0;
++#else
+ return getpriority(PRIO_PROCESS, static_cast<id_t>(process_));
++#endif
+ }
++
++Time Process::CreationTime() const {
++// avoid ps pledge in the network process
++#if !BUILDFLAG(IS_BSD)
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(),
++ sizeof(struct kinfo_proc), 0 };
++ struct kinfo_proc *info = nullptr;
++ size_t info_size;
++#endif
++ Time ct = Time();
++
++#if !BUILDFLAG(IS_BSD)
++ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
++ goto out;
++
++ mib[5] = (info_size / sizeof(struct kinfo_proc));
++ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL)
++ goto out;
++
++ if (sysctl(mib, std::size(mib), info, &info_size, NULL, 0) < 0)
++ goto out;
++
++ ct = Time::FromTimeT(info->p_ustart_sec);
++
++out:
++ if (info)
++ free(info);
++#endif
++ return ct;
++}
++
++#if BUILDFLAG(IS_BSD)
++Process::Priority Process::GetPriority() const {
++ return Priority::kUserBlocking;
++}
++
++bool Process::SetPriority(Priority priority) {
++ return false;
++}
++
++bool Process::CanSetPriority() {
++ return false;
++}
++#endif
+
+ } // namespace base