diff --git a/www/chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc b/www/chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc index 45b62182cf6f..77b14bd16655 100644 --- a/www/chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc +++ b/www/chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc @@ -1,65 +1,78 @@ ---- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2023-08-17 12:40:56 UTC +--- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2023-08-23 10:45:26 UTC +++ third_party/abseil-cpp/absl/base/internal/sysinfo.cc @@ -30,10 +30,14 @@ #include #endif -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #endif +#if defined(__FreeBSD__) +#include +#endif + #if defined(__myriad2__) #include #endif @@ -186,6 +190,7 @@ static double GetNominalCPUFrequency() { #else +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // Helper function for reading a long from a file. Returns true if successful // and the memory location pointed to by value is set to the value read. static bool ReadLongFromFile(const char *file, long *value) { @@ -212,6 +217,7 @@ static bool ReadLongFromFile(const char *file, long *v } return ret; } +#endif #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) @@ -311,9 +317,11 @@ static double GetNominalCPUFrequency() { // a new mode (turbo mode). Essentially, those frequencies cannot // always be relied upon. The same reasons apply to /proc/cpuinfo as // well. +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/tsc_freq_khz", &freq)) { return freq * 1e3; // Value is kHz. } +#endif #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) // On these platforms, the TSC frequency is the nominal CPU -@@ -433,6 +441,18 @@ pid_t GetTID() { +@@ -332,10 +340,12 @@ static double GetNominalCPUFrequency() { + // If CPU scaling is in effect, we want to use the *maximum* + // frequency, not whatever CPU speed some random processor happens + // to be using now. ++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation + if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", + &freq)) { + return freq * 1e3; // Value is kHz. + } ++#endif + + return 1.0; + #endif // !ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY +@@ -433,6 +443,18 @@ pid_t GetTID() { static_assert(sizeof(pid_t) == sizeof(thread), "In NaCL int expected to be the same size as a pointer"); return reinterpret_cast(thread); +} + +#elif defined(__OpenBSD__) + +pid_t GetTID() { + return getthrid(); +} + +#elif defined(__FreeBSD__) + +pid_t GetTID() { + return pthread_getthreadid_np(); } #else diff --git a/www/ungoogled-chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc b/www/ungoogled-chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc index be3f7a7c54f7..77b14bd16655 100644 --- a/www/ungoogled-chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc +++ b/www/ungoogled-chromium/files/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc @@ -1,65 +1,78 @@ ---- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2023-08-18 10:26:52 UTC +--- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2023-08-23 10:45:26 UTC +++ third_party/abseil-cpp/absl/base/internal/sysinfo.cc @@ -30,10 +30,14 @@ #include #endif -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #endif +#if defined(__FreeBSD__) +#include +#endif + #if defined(__myriad2__) #include #endif @@ -186,6 +190,7 @@ static double GetNominalCPUFrequency() { #else +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // Helper function for reading a long from a file. Returns true if successful // and the memory location pointed to by value is set to the value read. static bool ReadLongFromFile(const char *file, long *value) { @@ -212,6 +217,7 @@ static bool ReadLongFromFile(const char *file, long *v } return ret; } +#endif #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) @@ -311,9 +317,11 @@ static double GetNominalCPUFrequency() { // a new mode (turbo mode). Essentially, those frequencies cannot // always be relied upon. The same reasons apply to /proc/cpuinfo as // well. +#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/tsc_freq_khz", &freq)) { return freq * 1e3; // Value is kHz. } +#endif #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) // On these platforms, the TSC frequency is the nominal CPU -@@ -433,6 +441,18 @@ pid_t GetTID() { +@@ -332,10 +340,12 @@ static double GetNominalCPUFrequency() { + // If CPU scaling is in effect, we want to use the *maximum* + // frequency, not whatever CPU speed some random processor happens + // to be using now. ++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation + if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", + &freq)) { + return freq * 1e3; // Value is kHz. + } ++#endif + + return 1.0; + #endif // !ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY +@@ -433,6 +443,18 @@ pid_t GetTID() { static_assert(sizeof(pid_t) == sizeof(thread), "In NaCL int expected to be the same size as a pointer"); return reinterpret_cast(thread); +} + +#elif defined(__OpenBSD__) + +pid_t GetTID() { + return getthrid(); +} + +#elif defined(__FreeBSD__) + +pid_t GetTID() { + return pthread_getthreadid_np(); } #else