diff options
Diffstat (limited to 'www/chromium-uc/patches/patch-base_process_process_posix_cc')
| -rw-r--r-- | www/chromium-uc/patches/patch-base_process_process_posix_cc | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/www/chromium-uc/patches/patch-base_process_process_posix_cc b/www/chromium-uc/patches/patch-base_process_process_posix_cc new file mode 100644 index 0000000..a69f6e8 --- /dev/null +++ b/www/chromium-uc/patches/patch-base_process_process_posix_cc | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | $OpenBSD: patch-base_process_process_posix_cc,v 1.34 2021/09/01 16:54:38 robert Exp $ | ||
| 2 | |||
| 3 | Index: base/process/process_posix.cc | ||
| 4 | --- base/process/process_posix.cc.orig | ||
| 5 | +++ base/process/process_posix.cc | ||
| 6 | @@ -27,6 +27,11 @@ | ||
| 7 | #include <sys/event.h> | ||
| 8 | #endif | ||
| 9 | |||
| 10 | +#if defined(OS_BSD) | ||
| 11 | +#include <sys/types.h> | ||
| 12 | +#include <sys/sysctl.h> | ||
| 13 | +#endif | ||
| 14 | + | ||
| 15 | #if BUILDFLAG(CLANG_PROFILING) | ||
| 16 | #include "base/test/clang_profiling.h" | ||
| 17 | #endif | ||
| 18 | @@ -363,7 +368,55 @@ void Process::Exited(int exit_code) const {} | ||
| 19 | |||
| 20 | int Process::GetPriority() const { | ||
| 21 | DCHECK(IsValid()); | ||
| 22 | +// avoid pledge(2) violation | ||
| 23 | +#if defined(OS_BSD) | ||
| 24 | + return 0; | ||
| 25 | +#else | ||
| 26 | return getpriority(PRIO_PROCESS, process_); | ||
| 27 | +#endif | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +Time Process::CreationTime() const { | ||
| 31 | +// avoid ps pledge in the network process | ||
| 32 | +#if !defined(OS_OPENBSD) | ||
| 33 | + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(), | ||
| 34 | + sizeof(struct kinfo_proc), 0 }; | ||
| 35 | + struct kinfo_proc *info = nullptr; | ||
| 36 | + size_t info_size; | ||
| 37 | +#endif | ||
| 38 | + Time ct = Time(); | ||
| 39 | + | ||
| 40 | +#if !defined(OS_OPENBSD) | ||
| 41 | + if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0) | ||
| 42 | + goto out; | ||
| 43 | + | ||
| 44 | + mib[5] = (info_size / sizeof(struct kinfo_proc)); | ||
| 45 | + if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) | ||
| 46 | + goto out; | ||
| 47 | + | ||
| 48 | + if (sysctl(mib, base::size(mib), info, &info_size, NULL, 0) < 0) | ||
| 49 | + goto out; | ||
| 50 | + | ||
| 51 | + ct = Time::FromTimeT(info->p_ustart_sec); | ||
| 52 | + | ||
| 53 | +out: | ||
| 54 | + if (info) | ||
| 55 | + free(info); | ||
| 56 | +#endif | ||
| 57 | + return ct; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +bool Process::IsProcessBackgrounded() const { | ||
| 61 | + return false; | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +bool Process::SetProcessBackgrounded(bool value) { | ||
| 65 | + return false; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +// static | ||
| 69 | +bool Process::CanBackgroundProcesses() { | ||
| 70 | + return false; | ||
| 71 | } | ||
| 72 | |||
| 73 | } // namespace base | ||
