diff options
author | Rene Ladan <rene@FreeBSD.org> | 2022-02-20 11:35:15 +0000 |
---|---|---|
committer | Rene Ladan <rene@FreeBSD.org> | 2022-02-20 11:42:02 +0000 |
commit | a23dfd214ae04e8b4d116ca6411570b684eb5ed6 (patch) | |
tree | a42703b6563673398eee97ae6ad4d01eafd77738 | |
parent | 9341f0aca4ecea11124957da5ea6384640745e43 (diff) | |
download | ports-a23dfd214ae04e8b4d116ca6411570b684eb5ed6.tar.gz ports-a23dfd214ae04e8b4d116ca6411570b684eb5ed6.zip |
www/chromium: update to 98.0.4758.102
- The port now uses the combined patch set for OpenBSD and FreeBSD
maintained by Robert Nagy.
- Fix build on i386 again.
Obtained from: Robert Nagy <robert@openbsd.org>
Security: https://vuxml.freebsd.org/freebsd/e12432af-8e73-11ec-8bc4-3065ec8fd3ec.html
Security: https://vuxml.freebsd.org/freebsd/e852f43c-846e-11ec-b043-3065ec8fd3ec.html
1049 files changed, 26366 insertions, 14232 deletions
diff --git a/www/chromium/Makefile b/www/chromium/Makefile index b3c04a824fd4..d8adb70ae88c 100644 --- a/www/chromium/Makefile +++ b/www/chromium/Makefile @@ -1,7 +1,7 @@ # Created by: Florent Thoumie <flz@FreeBSD.org> PORTNAME= chromium -PORTVERSION= 97.0.4692.99 +PORTVERSION= 98.0.4758.102 CATEGORIES= www MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/ \ LOCAL/rene/chromium/:fonts @@ -14,7 +14,6 @@ LICENSE= BSD3CLAUSE LGPL21 MPL11 LICENSE_COMB= multi ONLY_FOR_ARCHS= aarch64 amd64 i386 -BROKEN_i386= Does not compile, __ElfN macros unknown BUILD_DEPENDS= bash:shells/bash \ ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \ @@ -29,7 +28,8 @@ BUILD_DEPENDS= bash:shells/bash \ ${LOCALBASE}/share/usbids/usb.ids:misc/usbids \ ${PYTHON_PKGNAMEPREFIX}html5lib>0:www/py-html5lib@${PY_FLAVOR} \ ${LOCALBASE}/include/va/va.h:multimedia/libva \ - ${LOCALBASE}/bin/python2.7:lang/python27 + ${LOCALBASE}/bin/python2.7:lang/python27 \ + ${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri LIB_DEPENDS= libatk-bridge-2.0.so:accessibility/at-spi2-atk \ libatspi.so:accessibility/at-spi2-core \ @@ -71,7 +71,7 @@ USES= bison compiler:c++17-lang cpe desktop-file-utils dos2unix gl gnome jpeg l CPE_VENDOR= google CPE_PRODUCT= chrome -DOS2UNIX_FILES= third_party/skia/third_party/vulkanmemoryallocator/include/vk_mem_alloc.h +DOS2UNIX_FILES= third_party/vulkan_memory_allocator/include/vk_mem_alloc.h USE_GL= gbm gl USE_GNOME= atk dconf gdkpixbuf2 glib20 gtk30 libxml2 libxslt USE_LDCONFIG= ${DATADIR} @@ -85,7 +85,6 @@ ALL_TARGET= chrome BINARY_ALIAS= python=${LOCALBASE}/bin/python2.7 \ python3=${PYTHON_CMD} -EXTRA_PATCHES+= ${FILESDIR}/extra-patch-clang # TODO bz@ : install libwidevinecdm.so (see third_party/widevine/cdm/BUILD.gn) # @@ -99,6 +98,8 @@ GN_ARGS+= clang_use_chrome_plugins=false \ enable_nacl=false \ enable_one_click_signin=true \ enable_remoting=false \ + enable_wmax_tokens=false \ + fatal_linker_warnings=false \ is_clang=true \ optimize_webui=false \ toolkit_views=true \ @@ -113,8 +114,10 @@ GN_ARGS+= clang_use_chrome_plugins=false \ use_system_freetype=false \ use_system_harfbuzz=true \ use_system_libjpeg=true \ + use_udev=false \ extra_cxxflags="${CXXFLAGS}" \ extra_ldflags="${LDFLAGS}" + # TODO: investigate building with these options: # use_system_minigbm GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles @@ -202,18 +205,11 @@ TEST_ALL_TARGET= ${TEST_TARGETS} .include <bsd.port.options.mk> .include <bsd.port.pre.mk> -# Add extra-patch-no-mempcpy-nasm only when there's no mempcpy() in base. -# Nested variable expansion avoids executing the test when not needed for -# expanding EXTRA_PATCHES. -EXTRA_PATCHES+= ${"${:!${GREP} mempcpy ${CROSS_SYSROOT}/usr/include/string.h \ - || ${TRUE}!}" == "":?${PATCHDIR}/extra-patch-no-mempcpy-nasm:} - .if ${PORT_OPTIONS:MHEIMDAL_BASE} && !exists(/usr/lib/libkrb5.so) IGNORE= you have selected HEIMDAL_BASE but do not have Heimdal installed in base .endif .if ${COMPILER_VERSION} < 120 -EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-build_config_compiler_pgo_pgo.gni .if ${PORT_OPTIONS:MLTO} BROKEN+= does not build with LTO needs LLVM 12+ @@ -245,20 +241,6 @@ post-extract-TEST-on: @${MKDIR} ${WRKSRC}/third_party/test_fonts/test_fonts @${MV} ${WRKDIR}/test_fonts ${WRKSRC}/third_party/test_fonts/ -post-patch: - @${MKDIR} ${WRKSRC}/sandbox/policy/freebsd - @${CP} ${FILESDIR}/dir_reader_freebsd.h ${WRKSRC}/base/files - @${CP} ${FILESDIR}/device_info_fetcher_freebsd.h ${WRKSRC}/chrome/browser/enterprise/signals - @${CP} ${FILESDIR}/device_info_fetcher_freebsd.cc ${WRKSRC}/chrome/browser/enterprise/signals - @${CP} ${FILESDIR}/sandbox_freebsd.h ${WRKSRC}/sandbox/policy/freebsd - @${CP} ${FILESDIR}/sandbox_freebsd.cc ${WRKSRC}/sandbox/policy/freebsd - -post-patch-SNDIO-on: - @${MKDIR} ${WRKSRC}/media/audio/sndio ${WRKSRC}/media/audio/openbsd - @${CP} ${FILESDIR}/sndio_output.* ${WRKSRC}/media/audio/sndio - @${CP} ${FILESDIR}/sndio_input.* ${WRKSRC}/media/audio/sndio - @${CP} ${FILESDIR}/audio_manager_openbsd.* ${WRKSRC}/media/audio/openbsd - pre-configure: # We used to remove bundled libraries to be sure that chromium uses # system libraries and not shipped ones. @@ -266,11 +248,13 @@ pre-configure: #./build/linux/unbundle/remove_bundled_libraries.py [list of preserved] cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \ ./build/linux/unbundle/replace_gn_files.py --system-libraries \ - flac fontconfig freetype harfbuzz-ng libdrm libpng libwebp libxml libxslt openh264 opus snappy || ${FALSE} + flac fontconfig freetype harfbuzz-ng libusb libdrm libpng libwebp libxml libxslt openh264 opus snappy || ${FALSE} # Chromium uses an unreleased version of FFmpeg, so configure it +.for brand in Chrome Chromium ${CP} -R \ - ${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/linux/ \ - ${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/freebsd + ${WRKSRC}/third_party/ffmpeg/chromium/config/${brand}/linux/ \ + ${WRKSRC}/third_party/ffmpeg/chromium/config/${brand}/freebsd +.endfor do-configure: # GN generator bootstrapping and generating ninja files @@ -281,8 +265,8 @@ do-configure: gen --args='${GN_ARGS}' out/${BUILDTYPE} # Setup nodejs dependency - @${MKDIR} ${WRKSRC}/third_party/node/freebsd/node-freebsd-x64/bin - ${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd-x64/bin/node + @${MKDIR} ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin + ${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin/node # Setup buildtools/freebsd @${MKDIR} ${WRKSRC}/buildtools/freebsd @@ -346,8 +330,8 @@ post-install-DEBUG-on: ${STAGEDIR}${DATADIR} post-install-DRIVER-on: - ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chromedriver \ - ${STAGEDIR}${PREFIX}/bin + ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chromedriver.unstripped \ + ${STAGEDIR}${PREFIX}/bin/chromedriver do-test-TEST-on: .for t in ${TEST_TARGETS} diff --git a/www/chromium/distinfo b/www/chromium/distinfo index b74af3a6db33..4f04e0f5b957 100644 --- a/www/chromium/distinfo +++ b/www/chromium/distinfo @@ -1,7 +1,7 @@ -TIMESTAMP = 1642767718 -SHA256 (chromium-97.0.4692.99.tar.xz) = c91bae205705b367f2cfc1f72ce1ee99b2ceb5edfc584e15c60a6ab5ff01ecba -SIZE (chromium-97.0.4692.99.tar.xz) = 1213731872 -SHA256 (chromium-97.0.4692.99-testdata.tar.xz) = 4d27100d2a5dda623231fb341a53c5f71fb52a5e2eeec37ccee8f6dfd568d139 -SIZE (chromium-97.0.4692.99-testdata.tar.xz) = 259732316 +TIMESTAMP = 1645271488 +SHA256 (chromium-98.0.4758.102.tar.xz) = 415b47e912766cd07f9f52e95bc6470b835acf1d6f566ae32e66ba8be608f33e +SIZE (chromium-98.0.4758.102.tar.xz) = 1242565220 +SHA256 (chromium-98.0.4758.102-testdata.tar.xz) = d18ea0af0a9a87d53e75fbdbd886b17f689e00486f819905b38f02a2619504e6 +SIZE (chromium-98.0.4758.102-testdata.tar.xz) = 258963780 SHA256 (test_fonts-85.tar.xz) = f22b61b3639acb147c98ec2e2305d8b96f0b55c8c74c40e2ea696402fae8cef9 SIZE (test_fonts-85.tar.xz) = 9511984 diff --git a/www/chromium/files/audio_manager_openbsd.cc b/www/chromium/files/audio_manager_openbsd.cc deleted file mode 100644 index 0521930829df..000000000000 --- a/www/chromium/files/audio_manager_openbsd.cc +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/metrics/histogram_macros.h" -#include "base/memory/ptr_util.h" - -#include "media/audio/openbsd/audio_manager_openbsd.h" - -#include "media/audio/audio_device_description.h" -#include "media/audio/audio_output_dispatcher.h" -#if defined(USE_SNDIO) -#include "media/audio/sndio/sndio_input.h" -#include "media/audio/sndio/sndio_output.h" -#else -#include "media/audio/fake_audio_manager.h" -#endif -#include "media/base/limits.h" -#include "media/base/media_switches.h" - -namespace media { - -enum OpenBSDAudioIO { - kPulse, - kSndio, - kAudioIOMax = kSndio -}; - -#if defined(USE_SNDIO) -// Maximum number of output streams that can be open simultaneously. -static const int kMaxOutputStreams = 4; - -// Default sample rate for input and output streams. -static const int kDefaultSampleRate = 48000; - -void AddDefaultDevice(AudioDeviceNames* device_names) { - DCHECK(device_names->empty()); - device_names->push_front(AudioDeviceName::CreateDefault()); -} - -bool AudioManagerOpenBSD::HasAudioOutputDevices() { - return true; -} - -bool AudioManagerOpenBSD::HasAudioInputDevices() { - return true; -} - -void AudioManagerOpenBSD::GetAudioInputDeviceNames( - AudioDeviceNames* device_names) { - DCHECK(device_names->empty()); - AddDefaultDevice(device_names); -} - -void AudioManagerOpenBSD::GetAudioOutputDeviceNames( - AudioDeviceNames* device_names) { - AddDefaultDevice(device_names); -} - -#if defined(USE_SNDIO) -const char* AudioManagerOpenBSD::GetName() { - return "SNDIO"; -} -#endif - -AudioParameters AudioManagerOpenBSD::GetInputStreamParameters( - const std::string& device_id) { - static const int kDefaultInputBufferSize = 1024; - - int user_buffer_size = GetUserBufferSize(); - int buffer_size = user_buffer_size ? - user_buffer_size : kDefaultInputBufferSize; - - return AudioParameters( - AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, - kDefaultSampleRate, buffer_size); -} - -AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread, - AudioLogFactory* audio_log_factory) - : AudioManagerBase(std::move(audio_thread), - audio_log_factory) { - DLOG(INFO) << "AudioManagerOpenBSD"; - SetMaxOutputStreamsAllowed(kMaxOutputStreams); -} - -AudioManagerOpenBSD::~AudioManagerOpenBSD() { - Shutdown(); -} - -AudioOutputStream* AudioManagerOpenBSD::MakeLinearOutputStream( - const AudioParameters& params, - const LogCallback& log_callback) { - DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); - return MakeOutputStream(params); -} - -AudioOutputStream* AudioManagerOpenBSD::MakeLowLatencyOutputStream( - const AudioParameters& params, - const std::string& device_id, - const LogCallback& log_callback) { - DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!"; - DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); - return MakeOutputStream(params); -} - -AudioInputStream* AudioManagerOpenBSD::MakeLinearInputStream( - const AudioParameters& params, - const std::string& device_id, - const LogCallback& log_callback) { - DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); - return MakeInputStream(params); -} - -AudioInputStream* AudioManagerOpenBSD::MakeLowLatencyInputStream( - const AudioParameters& params, - const std::string& device_id, - const LogCallback& log_callback) { - DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); - return MakeInputStream(params); -} - -AudioParameters AudioManagerOpenBSD::GetPreferredOutputStreamParameters( - const std::string& output_device_id, - const AudioParameters& input_params) { - // TODO(tommi): Support |output_device_id|. - DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!"; - static const int kDefaultOutputBufferSize = 2048; - - ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; - int sample_rate = kDefaultSampleRate; - int buffer_size = kDefaultOutputBufferSize; - if (input_params.IsValid()) { - sample_rate = input_params.sample_rate(); - channel_layout = input_params.channel_layout(); - buffer_size = std::min(buffer_size, input_params.frames_per_buffer()); - } - - int user_buffer_size = GetUserBufferSize(); - if (user_buffer_size) - buffer_size = user_buffer_size; - - return AudioParameters( - AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, - sample_rate, buffer_size); -} - -AudioInputStream* AudioManagerOpenBSD::MakeInputStream( - const AudioParameters& params) { - DLOG(INFO) << "MakeInputStream"; - return new SndioAudioInputStream(this, - AudioDeviceDescription::kDefaultDeviceId, params); -} - -AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream( - const AudioParameters& params) { - DLOG(INFO) << "MakeOutputStream"; - return new SndioAudioOutputStream(params, this); -} -#endif - -std::unique_ptr<media::AudioManager> CreateAudioManager( - std::unique_ptr<AudioThread> audio_thread, - AudioLogFactory* audio_log_factory) { - DLOG(INFO) << "CreateAudioManager"; -#if defined(USE_SNDIO) - UMA_HISTOGRAM_ENUMERATION("Media.OpenBSDAudioIO", kSndio, kAudioIOMax + 1); - return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread), - audio_log_factory); -#else - return std::make_unique<FakeAudioManager>(std::move(audio_thread), - audio_log_factory); -#endif - -} - -} // namespace media diff --git a/www/chromium/files/audio_manager_openbsd.h b/www/chromium/files/audio_manager_openbsd.h deleted file mode 100644 index 8c99db966d65..000000000000 --- a/www/chromium/files/audio_manager_openbsd.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ -#define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ - -#include <set> - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/threading/thread.h" -#include "media/audio/audio_manager_base.h" - -namespace media { - -class MEDIA_EXPORT AudioManagerOpenBSD : public AudioManagerBase { - public: - AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread, - AudioLogFactory* audio_log_factory); - ~AudioManagerOpenBSD() override; - - // Implementation of AudioManager. - bool HasAudioOutputDevices() override; - bool HasAudioInputDevices() override; - void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; - void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; - AudioParameters GetInputStreamParameters( - const std::string& device_id) override; - const char* GetName() override; - - // Implementation of AudioManagerBase. - AudioOutputStream* MakeLinearOutputStream( - const AudioParameters& params, - const LogCallback& log_callback) override; - AudioOutputStream* MakeLowLatencyOutputStream( - const AudioParameters& params, - const std::string& device_id, - const LogCallback& log_callback) override; - AudioInputStream* MakeLinearInputStream( - const AudioParameters& params, - const std::string& device_id, - const LogCallback& log_callback) override; - AudioInputStream* MakeLowLatencyInputStream( - const AudioParameters& params, - const std::string& device_id, - const LogCallback& log_callback) override; - - protected: - AudioParameters GetPreferredOutputStreamParameters( - const std::string& output_device_id, - const AudioParameters& input_params) override; - - private: - // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. - AudioOutputStream* MakeOutputStream(const AudioParameters& params); - AudioInputStream* MakeInputStream(const AudioParameters& params); - - DISALLOW_COPY_AND_ASSIGN(AudioManagerOpenBSD); -}; - -} // namespace media - -#endif // MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_ diff --git a/www/chromium/files/device_info_fetcher_freebsd.cc b/www/chromium/files/device_info_fetcher_freebsd.cc deleted file mode 100644 index dcd5af716e46..000000000000 --- a/www/chromium/files/device_info_fetcher_freebsd.cc +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/enterprise/signals/device_info_fetcher_freebsd.h" - -#if defined(USE_GIO) -#include <gio/gio.h> -#endif // defined(USE_GIO) -#include <sys/stat.h> -#include <sys/types.h> -#include <ifaddrs.h> -#include <net/if.h> -#include <net/if_dl.h> - -#include <string> - -#include "base/environment.h" -#include "base/files/dir_reader_posix.h" -#include "base/files/file.h" -#include "base/files/file_util.h" -#include "base/nix/xdg_util.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/system/sys_info.h" -#include "net/base/network_interfaces.h" - -namespace enterprise_signals { - -namespace { - -std::string GetDeviceModel() { - return base::SysInfo::HardwareModelName(); -} - -std::string GetOsVersion() { - return base::SysInfo::OperatingSystemVersion(); -} - -std::string GetDeviceHostName() { - return net::GetHostName(); -} - -std::string GetSerialNumber() { - return std::string(); -} - -// Implements the logic from the native client setup script. It reads the -// setting value straight from gsettings but picks the schema relevant to the -// currently active desktop environment. -// The current implementation support Gnone and Cinnamon only. -SettingValue GetScreenlockSecured() { -#if defined(USE_GIO) - static constexpr char kLockScreenKey[] = "lock-enabled"; - - std::unique_ptr<base::Environment> env(base::Environment::Create()); - const base::nix::DesktopEnvironment desktop_env = - base::nix::GetDesktopEnvironment(env.get()); - if (desktop_env != base::nix::DESKTOP_ENVIRONMENT_CINNAMON && - desktop_env != base::nix::DESKTOP_ENVIRONMENT_GNOME) { - return SettingValue::UNKNOWN; - } - - const std::string settings_schema = base::StringPrintf( - "org.%s.desktop.screensaver", - desktop_env == base::nix::DESKTOP_ENVIRONMENT_CINNAMON ? "cinnamon" - : "gnome"); - - GSettingsSchema* screensaver_schema = g_settings_schema_source_lookup( - g_settings_schema_source_get_default(), settings_schema.c_str(), FALSE); - GSettings* screensaver_settings = nullptr; - if (!screensaver_schema || - !g_settings_schema_has_key(screensaver_schema, kLockScreenKey)) { - return SettingValue::UNKNOWN; - } - screensaver_settings = g_settings_new(settings_schema.c_str()); - if (!screensaver_settings) - return SettingValue::UNKNOWN; - gboolean lock_screen_enabled = - g_settings_get_boolean(screensaver_settings, kLockScreenKey); - g_object_unref(screensaver_settings); - - return lock_screen_enabled ? SettingValue::ENABLED : SettingValue::DISABLED; -#else - return SettingValue::UNKNOWN; -#endif // defined(USE_GIO) -} - -// Implements the logic from the native host installation script. First find the -// root device identifier, then locate its parent and get its type. -SettingValue GetDiskEncrypted() { - return SettingValue::UNKNOWN; -} - -std::vector<std::string> GetMacAddresses() { - std::vector<std::string> result; - struct ifaddrs* ifa = nullptr; - - if (getifaddrs(&ifa) != 0) - return result; - - struct ifaddrs* interface = ifa; - for (; interface != nullptr; interface = interface->ifa_next) { - if (interface->ifa_addr == nullptr || - interface->ifa_addr->sa_family != AF_LINK) { - continue; - } - struct sockaddr_dl* sdl = - reinterpret_cast<struct sockaddr_dl*>(interface->ifa_addr); - if (!sdl || sdl->sdl_alen != 6) - continue; - char* link_address = static_cast<char*>(LLADDR(sdl)); - result.push_back(base::StringPrintf( - "%02x:%02x:%02x:%02x:%02x:%02x", link_address[0] & 0xff, - link_address[1] & 0xff, link_address[2] & 0xff, link_address[3] & 0xff, - link_address[4] & 0xff, link_address[5] & 0xff)); - } - return result; -} - -} // namespace - -DeviceInfoFetcherFreeBSD::DeviceInfoFetcherFreeBSD() = default; - -DeviceInfoFetcherFreeBSD::~DeviceInfoFetcherFreeBSD() = default; - -DeviceInfo DeviceInfoFetcherFreeBSD::Fetch() { - DeviceInfo device_info; - device_info.os_name = "freebsd"; - device_info.os_version = GetOsVersion(); - device_info.device_host_name = GetDeviceHostName(); - device_info.device_model = GetDeviceModel(); - device_info.serial_number = GetSerialNumber(); - device_info.screen_lock_secured = GetScreenlockSecured(); - device_info.disk_encrypted = GetDiskEncrypted(); - device_info.mac_addresses = GetMacAddresses(); - return device_info; -} - -} // namespace enterprise_signals diff --git a/www/chromium/files/device_info_fetcher_freebsd.h b/www/chromium/files/device_info_fetcher_freebsd.h deleted file mode 100644 index 2cd2f213f828..000000000000 --- a/www/chromium/files/device_info_fetcher_freebsd.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_ENTERPRISE_SIGNALS_DEVICE_INFO_FETCHER_FREEBSD_H_ -#define CHROME_BROWSER_ENTERPRISE_SIGNALS_DEVICE_INFO_FETCHER_FREEBSD_H_ - -#include "chrome/browser/enterprise/signals/device_info_fetcher.h" - -namespace enterprise_signals { - -// FreeBSD implementation of DeviceInfoFetcher. -class DeviceInfoFetcherFreeBSD : public DeviceInfoFetcher { - public: - DeviceInfoFetcherFreeBSD(); - DeviceInfoFetcherFreeBSD(const DeviceInfoFetcherFreeBSD&) = delete; - DeviceInfoFetcherFreeBSD& operator=(const DeviceInfoFetcherFreeBSD&) = delete; - ~DeviceInfoFetcherFreeBSD() override; - - // Overrides DeviceInfoFetcher: - DeviceInfo Fetch() override; -}; - -} // namespace enterprise_signals - -#endif // CHROME_BROWSER_ENTERPRISE_SIGNALS_DEVICE_INFO_FETCHER_FREEBSD_H_ diff --git a/www/chromium/files/dir_reader_freebsd.h b/www/chromium/files/dir_reader_freebsd.h deleted file mode 100644 index 7be73f000577..000000000000 --- a/www/chromium/files/dir_reader_freebsd.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_FILES_DIR_READER_FREEBSD_H_ -#define BASE_FILES_DIR_READER_FREEBSD_H_ - -#include <errno.h> -#include <fcntl.h> -#include <stddef.h> -#include <stdint.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <dirent.h> - -#include "base/logging.h" -#include "base/posix/eintr_wrapper.h" - -// See the comments in dir_reader_posix.h about this. - -namespace base { - -class DirReaderFreeBSD { - public: - explicit DirReaderFreeBSD(const char* directory_path) - : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)), - offset_(0), - size_(0) { - memset(buf_, 0, sizeof(buf_)); - } - - DirReaderFreeBSD(const DirReaderFreeBSD&) = delete; - DirReaderFreeBSD& operator=(const DirReaderFreeBSD&) = delete; - - ~DirReaderFreeBSD() { - if (fd_ >= 0) { - if (IGNORE_EINTR(close(fd_))) - RAW_LOG(ERROR, "Failed to close directory handle"); - } - } - - bool IsValid() const { - return fd_ >= 0; - } - - // Move to the next entry returning false if the iteration is complete. - bool Next() { - if (size_) { - struct dirent* dirent = reinterpret_cast<struct dirent*>(&buf_[offset_]); - offset_ += dirent->d_reclen; - } - - if (offset_ != size_) - return true; - - ssize_t r = getdents(fd_, buf_, sizeof(buf_)); - if (r == 0) - return false; - if (r == -1) { - DPLOG(FATAL) << "getdents failed"; - return false; - } - size_ = r; - offset_ = 0; - return true; - } - - const char* name() const { - if (!size_) - return nullptr; - - const struct dirent* dirent = - reinterpret_cast<const struct dirent*>(&buf_[offset_]); - return dirent->d_name; - } - - int fd() const { - return fd_; - } - - static bool IsFallback() { - return false; - } - - private: - const int fd_; - alignas(struct dirent) unsigned char buf_[512]; - size_t offset_; - size_t size_; -}; - -} // namespace base - -#endif // BASE_FILES_DIR_READER_LINUX_H_ diff --git a/www/chromium/files/extra-patch-clang b/www/chromium/files/extra-patch-clang deleted file mode 100644 index 104bbce09cda..000000000000 --- a/www/chromium/files/extra-patch-clang +++ /dev/null @@ -1,29 +0,0 @@ ---- base/strings/safe_sprintf_unittest.cc.orig 2019-03-11 22:00:51 UTC -+++ base/strings/safe_sprintf_unittest.cc -@@ -730,6 +730,7 @@ TEST(SafeSPrintfTest, EmbeddedNul) { - } - - TEST(SafeSPrintfTest, EmitNULL) { -+/* Avoid compiler error: http://pastebin.com/1edWUE84 - char buf[40]; - #if defined(__GNUC__) - #pragma GCC diagnostic push -@@ -741,6 +742,7 @@ TEST(SafeSPrintfTest, EmitNULL) { - EXPECT_EQ("0x0", std::string(buf)); - EXPECT_EQ(6, SafeSPrintf(buf, "%s", NULL)); - EXPECT_EQ("<NULL>", std::string(buf)); -+*/ - #if defined(__GCC__) - #pragma GCC diagnostic pop - #endif ---- base/threading/thread_local_storage_unittest.cc.orig 2019-03-11 22:00:51 UTC -+++ base/threading/thread_local_storage_unittest.cc -@@ -86,7 +86,7 @@ class ThreadLocalStorageRunner : public DelegateSimple - void ThreadLocalStorageCleanup(void *value) { - int *ptr = reinterpret_cast<int*>(value); - // Destructors should never be called with a NULL. -- ASSERT_NE(reinterpret_cast<int*>(NULL), ptr); -+ ASSERT_NE(static_cast<int*>(NULL), ptr); - if (*ptr == kFinalTlsValue) - return; // We've been called enough times. - ASSERT_LT(kFinalTlsValue, *ptr); diff --git a/www/chromium/files/extra-patch-no-mempcpy-nasm b/www/chromium/files/extra-patch-no-mempcpy-nasm deleted file mode 100644 index 2a62e36e7edf..000000000000 --- a/www/chromium/files/extra-patch-no-mempcpy-nasm +++ /dev/null @@ -1,11 +0,0 @@ ---- third_party/nasm/config/config-linux.h.orig 2021-04-14 18:43:05 UTC -+++ third_party/nasm/config/config-linux.h -@@ -336,7 +336,7 @@ - #define HAVE_MEMORY_H 1 - - /* Define to 1 if you have the `mempcpy' function. */ --#define HAVE_MEMPCPY 1 -+/* #undef HAVE_MEMPCPY */ - - /* Define to 1 if you have a working `mmap' system call. */ - #define HAVE_MMAP 1 diff --git a/www/chromium/files/patch-3p-pdfium_3p_base_allocator_partition__allocator_page__allocator__internals__posix.h b/www/chromium/files/patch-3p-pdfium_3p_base_allocator_partition__allocator_page__allocator__internals__posix.h deleted file mode 100644 index fdbba9ffa23b..000000000000 --- a/www/chromium/files/patch-3p-pdfium_3p_base_allocator_partition__allocator_page__allocator__internals__posix.h +++ /dev/null @@ -1,11 +0,0 @@ ---- third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2022-01-20 10:37:51 UTC -+++ third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h -@@ -16,7 +16,7 @@ - #if defined(OS_ANDROID) - #include <sys/prctl.h> - #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #include <sys/resource.h> - - #include <algorithm> diff --git a/www/chromium/files/patch-BUILD.gn b/www/chromium/files/patch-BUILD.gn index 88cb1c24f737..fbf272d4b247 100644 --- a/www/chromium/files/patch-BUILD.gn +++ b/www/chromium/files/patch-BUILD.gn @@ -1,5 +1,14 @@ ---- BUILD.gn.orig 2021-12-31 00:57:15 UTC +--- BUILD.gn.orig 2022-02-07 13:39:41 UTC +++ BUILD.gn +@@ -52,7 +52,7 @@ declare_args() { + root_extra_deps = [] + } + +-if (is_official_build) { ++if (is_official_build && !is_bsd) { + # An official (maximally optimized!) component (optimized for build times) + # build doesn't make sense and usually doesn't work. + assert(!is_component_build) @@ -454,7 +454,7 @@ group("gn_all") { ] } @@ -9,47 +18,23 @@ deps += [ "//third_party/breakpad:breakpad_unittests", "//third_party/breakpad:core-2-minidump", -@@ -500,8 +500,6 @@ group("gn_all") { - "//net:disk_cache_memory_test", - "//net:quic_client", - "//net:quic_server", -- "//sandbox/linux:chrome_sandbox", -- "//sandbox/linux:sandbox_linux_unittests", - "//testing:empty_main", - ] - -@@ -512,7 +510,7 @@ group("gn_all") { - ] - } - -- if (is_chrome_branded && is_official_build) { -+ if (is_chrome_branded && is_official_build && !is_bsd) { - # TODO(dpranke): add the linux_dump_symbols flag? - deps += [ "//chrome:linux_symbols" ] +@@ -638,6 +638,15 @@ group("gn_all") { } -@@ -556,10 +554,6 @@ group("gn_all") { - "//chrome/test:load_library_perf_tests", - "//chrome/test:sync_performance_tests", - "//chrome/test/chromedriver:chromedriver", -- "//courgette:courgette", -- "//courgette:courgette_fuzz", -- "//courgette:courgette_minimal_tool", -- "//courgette:courgette_unittests", - "//media/cast:generate_barcode_video", - "//media/cast:generate_timecode_audio", - "//net:crash_cache", -@@ -618,10 +612,6 @@ group("gn_all") { - "//mojo:mojo_perftests", - "//services/service_manager/public/cpp", - "//testing/gmock:gmock_main", -- "//third_party/breakpad:dump_syms($host_toolchain)", -- "//third_party/breakpad:microdump_stackwalk($host_toolchain)", -- "//third_party/breakpad:minidump_dump($host_toolchain)", -- "//third_party/breakpad:minidump_stackwalk($host_toolchain)", - ] + } - if (!is_android) { -@@ -699,7 +689,7 @@ group("gn_all") { ++ if (is_bsd) { ++ deps -= [ ++ "//third_party/breakpad:dump_syms($host_toolchain)", ++ "//third_party/breakpad:microdump_stackwalk($host_toolchain)", ++ "//third_party/breakpad:minidump_dump($host_toolchain)", ++ "//third_party/breakpad:minidump_stackwalk($host_toolchain)", ++ ] ++ } ++ + if (is_mac) { + deps += [ + "//third_party/breakpad:crash_inspector", +@@ -688,7 +697,7 @@ group("gn_all") { host_os == "win") { deps += [ "//chrome/test/mini_installer:mini_installer_tests" ] } @@ -58,43 +43,7 @@ deps += [ "//third_party/breakpad:symupload($host_toolchain)" ] } -@@ -715,7 +705,7 @@ group("gn_all") { - } - } - -- if (is_mac || is_win || is_android || is_linux || is_chromeos) { -+ if (is_mac || is_win || is_android || (is_linux && !is_bsd) || is_chromeos) { - deps += [ - "//third_party/crashpad/crashpad:crashpad_tests", - "//third_party/crashpad/crashpad/handler:crashpad_handler", -@@ -829,15 +819,17 @@ group("gn_all") { - "//chrome/browser/vr:vr_common_unittests", - "//chrome/browser/vr:vr_pixeltests", - ] -- if (!is_android) { -- deps += [ "//tools/perf/contrib/vr_benchmarks:vr_perf_tests" ] -- } else { -- deps += [ "//chrome/browser/android/vr:vr_android_unittests" ] -- import("//tools/perf/chrome_telemetry_build/android_browser_types.gni") -- foreach(_target_suffix, telemetry_android_browser_target_suffixes) { -- deps += [ -- "//tools/perf/contrib/vr_benchmarks:vr_perf_tests${_target_suffix}", -- ] -+ if (!is_bsd) { -+ if (!is_android) { -+ deps += [ "//tools/perf/contrib/vr_benchmarks:vr_perf_tests" ] -+ } else { -+ deps += [ "//chrome/browser/android/vr:vr_android_unittests" ] -+ import("//tools/perf/chrome_telemetry_build/android_browser_types.gni") -+ foreach(_target_suffix, telemetry_android_browser_target_suffixes) { -+ deps += [ -+ "//tools/perf/contrib/vr_benchmarks:vr_perf_tests${_target_suffix}", -+ ] -+ } - } - } - } -@@ -1140,7 +1132,7 @@ if (!is_ios) { +@@ -1139,7 +1148,7 @@ if (!is_ios) { data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ] } @@ -103,7 +52,7 @@ data_deps += [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] } -@@ -1149,7 +1141,7 @@ if (!is_ios) { +@@ -1148,7 +1157,7 @@ if (!is_ios) { data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] } @@ -112,22 +61,12 @@ data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] } -@@ -1518,7 +1510,7 @@ group("chromium_builder_perf") { - data_deps += [ "//chrome/test:performance_browser_tests" ] - } - if (is_linux || is_chromeos_lacros) { -- if (is_official_build) { -+ if (is_official_build && !is_bsd) { - # In GN builds, this is controlled by the 'linux_dump_symbols' - # flag, which defaults to 1 for official builds. For now, - # we skip the separate flag and just key off of is_official_build. -@@ -1530,9 +1522,6 @@ group("chromium_builder_perf") { +@@ -1525,7 +1534,7 @@ group("chromium_builder_perf") { if (is_win) { data_deps += [ "//chrome/installer/mini_installer:mini_installer" ] - } else { -- data_deps += -- [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] ++ } else if (!is_bsd) { + data_deps += + [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] } - if (is_win || is_android) { - data_deps += [ diff --git a/www/chromium/files/patch-apps_app__restore__service__browsertest.cc b/www/chromium/files/patch-apps_app__restore__service__browsertest.cc deleted file mode 100644 index f206af1b2f52..000000000000 --- a/www/chromium/files/patch-apps_app__restore__service__browsertest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- apps/app_restore_service_browsertest.cc.orig 2021-12-14 11:44:54 UTC -+++ apps/app_restore_service_browsertest.cc -@@ -140,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAcc - } - - // Flaky: crbug.com/269613 --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_BSD) - #define MAYBE_FileAccessIsRestored DISABLED_FileAccessIsRestored - #else - #define MAYBE_FileAccessIsRestored FileAccessIsRestored diff --git a/www/chromium/files/patch-apps_ui_views_app__window__frame__view.cc b/www/chromium/files/patch-apps_ui_views_app__window__frame__view.cc index 715b413018fa..4c99002b2147 100644 --- a/www/chromium/files/patch-apps_ui_views_app__window__frame__view.cc +++ b/www/chromium/files/patch-apps_ui_views_app__window__frame__view.cc @@ -1,11 +1,11 @@ ---- apps/ui/views/app_window_frame_view.cc.orig 2021-04-14 18:40:47 UTC +--- apps/ui/views/app_window_frame_view.cc.orig 2022-02-07 13:39:41 UTC +++ apps/ui/views/app_window_frame_view.cc @@ -137,7 +137,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient gfx::Rect window_bounds = client_bounds; // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is // complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#if defined(OS_LINUX) || defined(OS_BSD) || BUILDFLAG(IS_CHROMEOS_LACROS) ++#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD) // Get the difference between the widget's client area bounds and window // bounds, and grow |window_bounds| by that amount. gfx::Insets native_frame_insets = diff --git a/www/chromium/files/patch-ash_display_mirror__window__controller.cc b/www/chromium/files/patch-ash_display_mirror__window__controller.cc index 764566caed12..aae659dabc3b 100644 --- a/www/chromium/files/patch-ash_display_mirror__window__controller.cc +++ b/www/chromium/files/patch-ash_display_mirror__window__controller.cc @@ -1,6 +1,6 @@ ---- ash/display/mirror_window_controller.cc.orig 2021-12-31 00:57:16 UTC +--- ash/display/mirror_window_controller.cc.orig 2022-02-07 13:39:41 UTC +++ ash/display/mirror_window_controller.cc -@@ -284,7 +284,11 @@ void MirrorWindowController::UpdateWindow( +@@ -297,7 +297,11 @@ void MirrorWindowController::UpdateWindow( return info.id() == iter->first; }) == display_info_list.end()) { CloseAndDeleteHost(iter->second, true); diff --git a/www/chromium/files/patch-base_BUILD.gn b/www/chromium/files/patch-base_BUILD.gn index ac264690acfd..20b36c33a916 100644 --- a/www/chromium/files/patch-base_BUILD.gn +++ b/www/chromium/files/patch-base_BUILD.gn @@ -1,6 +1,6 @@ ---- base/BUILD.gn.orig 2021-12-31 00:57:18 UTC +--- base/BUILD.gn.orig 2022-02-07 13:39:41 UTC +++ base/BUILD.gn -@@ -954,7 +954,7 @@ component("base") { +@@ -975,7 +975,7 @@ component("base") { "timer/hi_res_timer_manager_posix.cc", ] @@ -9,10 +9,11 @@ sources += [ "cpu_affinity_posix.cc", "cpu_affinity_posix.h", -@@ -965,6 +965,11 @@ component("base") { +@@ -986,6 +986,12 @@ component("base") { "profiler/thread_delegate_posix.h", ] } ++ + if (is_bsd) { + sources += [ + "profiler/stack_sampler_posix.cc", @@ -21,74 +22,81 @@ } if (is_win) { -@@ -1391,7 +1396,7 @@ component("base") { +@@ -1416,11 +1422,24 @@ component("base") { # building inside the cros_sdk environment - use host_toolchain as a # more robust check for this. if (!use_sysroot && - (is_android || ((is_linux || is_chromeos) && !is_chromecast)) && -+ (is_android || ((is_linux || is_chromeos) && !is_chromecast) && !is_clang) && ++ (is_android || ((is_linux || is_chromeos) && !is_chromecast && !is_bsd)) && host_toolchain != "//build/toolchain/cros:host") { libs += [ "atomic" ] } -@@ -1444,7 +1449,7 @@ component("base") { - "allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc", - ] - } -- if (is_chromeos || is_linux) { -+ if ((is_chromeos || is_linux) && !is_bsd) { - sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ] - } - if (is_win) { -@@ -2142,6 +2147,34 @@ component("base") { - } - } ++ # *BSD needs libkvm ++ if (is_bsd) { ++ libs += [ "kvm" ] ++ } ++ ++ if (is_freebsd) { ++ libs += [ ++ "iconv", ++ "execinfo", ++ "util", ++ ] ++ } ++ + if (use_allocator_shim) { + sources += [ + "allocator/allocator_shim.cc", +@@ -1443,7 +1462,7 @@ component("base") { + "allocator/early_zone_registration_mac.h", + ] + } +- if (is_chromeos || is_linux) { ++ if (is_chromeos || (is_linux && !is_bsd)) { + sources += [ + "allocator/allocator_shim_override_cpp_symbols.h", + "allocator/allocator_shim_override_glibc_weak_symbols.h", +@@ -2176,6 +2195,42 @@ component("base") { + "linux_util.h", + ] + } ++ } ++ + if (is_bsd) { + sources -= [ + "files/file_path_watcher_linux.cc", + "files/file_util_linux.cc", ++ "files/scoped_file_linux.cc", + "process/memory_linux.cc", -+ "process/process_handle_linux.cc", ++ "process/process_linux.cc", ++ "system/sys_info_linux.cc", + "process/process_iterator_linux.cc", + "process/process_metrics_linux.cc", -+ "system/sys_info_linux.cc" ++ "process/process_handle_linux.cc" + ] + sources += [ -+ "files/file_path_watcher_freebsd.cc", ++ "process/memory_stubs.cc", + "files/file_path_watcher_kqueue.cc", + "files/file_path_watcher_kqueue.h", -+ "process/memory_stubs.cc", ++ "files/file_path_watcher_bsd.cc", ++ ] ++ } ++ ++ if (is_openbsd) { ++ sources += [ ++ "process/process_handle_openbsd.cc", ++ "process/process_iterator_openbsd.cc", ++ "process/process_metrics_openbsd.cc", ++ "system/sys_info_openbsd.cc", ++ ] ++ } else if (is_freebsd) { ++ sources += [ + "process/process_handle_freebsd.cc", + "process/process_iterator_freebsd.cc", + "process/process_metrics_freebsd.cc", + "system/sys_info_freebsd.cc", + ] -+ libs = [ -+ "execinfo", # logging.cc -+ "kvm", # process_metrics_freebsd -+ "util" # process_metrics_freebsd -+ ] -+ } -+ -+ - # iOS - if (is_ios) { - sources -= [ -@@ -3359,7 +3392,7 @@ test("base_unittests") { - } } -- if (is_linux || is_chromeos) { -+ if ((is_linux || is_chromeos) && !is_bsd) { - sources += [ - "debug/proc_maps_linux_unittest.cc", - "files/scoped_file_linux_unittest.cc", -@@ -3406,7 +3439,7 @@ test("base_unittests") { - "posix/unix_domain_socket_unittest.cc", - "task/thread_pool/task_tracker_posix_unittest.cc", - ] -- if (!is_nacl && !is_apple) { -+ if (!is_nacl && !is_apple && !is_bsd) { - sources += [ - "cpu_affinity_posix_unittest.cc", - "profiler/stack_copier_signal_unittest.cc", + # iOS diff --git a/www/chromium/files/patch-base_allocator_allocator__shim__default__dispatch__to__glibc.cc b/www/chromium/files/patch-base_allocator_allocator__shim__default__dispatch__to__glibc.cc deleted file mode 100644 index c8722784b6ee..000000000000 --- a/www/chromium/files/patch-base_allocator_allocator__shim__default__dispatch__to__glibc.cc +++ /dev/null @@ -1,88 +0,0 @@ ---- base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2021-12-14 11:44:55 UTC -+++ base/allocator/allocator_shim_default_dispatch_to_glibc.cc -@@ -10,18 +10,28 @@ - #include "base/process/memory.h" - - #include <dlfcn.h> --#include <malloc.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <malloc_np.h> - - // This translation unit defines a default dispatch for the allocator shim which - // routes allocations to libc functions. --// The code here is strongly inspired from tcmalloc's libc_override_glibc.h. -+// The code here is strongly inspired from tcmalloc's override_glibc.h. - - extern "C" { --void* __libc_malloc(size_t size); --void* __libc_calloc(size_t n, size_t size); --void* __libc_realloc(void* address, size_t size); --void* __libc_memalign(size_t alignment, size_t size); --void __libc_free(void* ptr); -+void* __malloc(size_t size); -+void* __calloc(size_t n, size_t size); -+void* __realloc(void* address, size_t len); -+void* __memalign(size_t alignment, size_t size) { -+ void *ret; -+ if (__posix_memalign(&ret, alignment, size) != 0) { -+ return nullptr; -+ } else { -+ return ret; -+ } -+} -+int __posix_memalign(void **ptr, size_t alignment, size_t size); -+void __free(void* ptr); - } // extern "C" - - namespace { -@@ -39,7 +49,7 @@ void* GlibcMalloc(const AllocatorDispatch*, size_t siz - if (UNLIKELY(size >= kMaxAllowedSize)) - base::TerminateBecauseOutOfMemory(size); - -- return __libc_malloc(size); -+ return __malloc(size); - } - - void* GlibcUncheckedMalloc(const AllocatorDispatch*, -@@ -48,7 +58,7 @@ void* GlibcUncheckedMalloc(const AllocatorDispatch*, - if (UNLIKELY(size >= kMaxAllowedSize)) - return nullptr; - -- return __libc_malloc(size); -+ return __malloc(size); - } - - void* GlibcCalloc(const AllocatorDispatch*, -@@ -59,7 +69,7 @@ void* GlibcCalloc(const AllocatorDispatch*, - if (UNLIKELY(!total.IsValid() || total.ValueOrDie() >= kMaxAllowedSize)) - base::TerminateBecauseOutOfMemory(size * n); - -- return __libc_calloc(n, size); -+ return __calloc(n, size); - } - - void* GlibcRealloc(const AllocatorDispatch*, -@@ -69,7 +79,7 @@ void* GlibcRealloc(const AllocatorDispatch*, - if (UNLIKELY(size >= kMaxAllowedSize)) - base::TerminateBecauseOutOfMemory(size); - -- return __libc_realloc(address, size); -+ return __realloc(address, size); - } - - void* GlibcMemalign(const AllocatorDispatch*, -@@ -79,11 +89,11 @@ void* GlibcMemalign(const AllocatorDispatch*, - if (UNLIKELY(size >= kMaxAllowedSize)) - base::TerminateBecauseOutOfMemory(size); - -- return __libc_memalign(alignment, size); -+ return __memalign(alignment, size); - } - - void GlibcFree(const AllocatorDispatch*, void* address, void* context) { -- __libc_free(address); -+ __free(address); - } - - NO_SANITIZE("cfi-icall") diff --git a/www/chromium/files/patch-base_allocator_allocator__shim__override__libc__symbols.h b/www/chromium/files/patch-base_allocator_allocator__shim__override__libc__symbols.h deleted file mode 100644 index 6308eb5707c2..000000000000 --- a/www/chromium/files/patch-base_allocator_allocator__shim__override__libc__symbols.h +++ /dev/null @@ -1,13 +0,0 @@ ---- base/allocator/allocator_shim_override_libc_symbols.h.orig 2021-04-14 18:40:48 UTC -+++ base/allocator/allocator_shim_override_libc_symbols.h -@@ -16,6 +16,10 @@ - #include <malloc.h> - #endif - -+#if defined(OS_BSD) -+#include <stdlib.h> -+#endif -+ - #include "base/allocator/allocator_shim_internals.h" - - extern "C" { diff --git a/www/chromium/files/patch-base_allocator_allocator__shim__unittest.cc b/www/chromium/files/patch-base_allocator_allocator__shim__unittest.cc deleted file mode 100644 index 3f3a8a53ae18..000000000000 --- a/www/chromium/files/patch-base_allocator_allocator__shim__unittest.cc +++ /dev/null @@ -1,47 +0,0 @@ ---- base/allocator/allocator_shim_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/allocator/allocator_shim_unittest.cc -@@ -369,7 +369,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) { - - #endif // !OS_WIN - --#if !defined(OS_WIN) && !defined(OS_APPLE) -+#if !defined(OS_WIN) && !defined(OS_APPLE) && !defined(OS_BSD) - void* memalign_ptr = memalign(128, 53); - ASSERT_NE(nullptr, memalign_ptr); - ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(memalign_ptr) % 128); -@@ -385,7 +385,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) { - ASSERT_GE(aligned_allocs_intercepted_by_size[kPageSize], 1u); - #endif // defined(OS_POSIX) && !defined(OS_ANDROID) - --#endif // !OS_WIN && !OS_APPLE -+#endif // !OS_WIN && !OS_APPLE && !OS_BSD - - // See allocator_shim_override_glibc_weak_symbols.h for why we intercept - // internal libc symbols. -@@ -412,7 +412,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) { - free(zero_alloc_ptr); - ASSERT_GE(frees_intercepted_by_addr[Hash(zero_alloc_ptr)], 1u); - --#if !defined(OS_WIN) && !defined(OS_APPLE) -+#if !defined(OS_WIN) && !defined(OS_APPLE) && !defined(OS_BSD) - free(memalign_ptr); - ASSERT_GE(frees_intercepted_by_addr[Hash(memalign_ptr)], 1u); - -@@ -421,7 +421,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) { - ASSERT_GE(frees_intercepted_by_addr[Hash(pvalloc_ptr)], 1u); - #endif // defined(OS_POSIX) && !defined(OS_ANDROID) - --#endif // !OS_WIN && !OS_APPLE -+#endif // !OS_WIN && !OS_APPLE && !OS_BSD - - #if !defined(OS_WIN) - free(posix_memalign_ptr); -@@ -615,7 +615,7 @@ static size_t GetUsableSize(void* ptr) { - static size_t GetUsableSize(void* ptr) { - return malloc_size(ptr); - } --#elif defined(OS_LINUX) || defined(OS_CHROMEOS) -+#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - static size_t GetUsableSize(void* ptr) { - return malloc_usable_size(ptr); - } diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_address__pool__manager.cc b/www/chromium/files/patch-base_allocator_partition__allocator_address__pool__manager.cc deleted file mode 100644 index bd1771f1163f..000000000000 --- a/www/chromium/files/patch-base_allocator_partition__allocator_address__pool__manager.cc +++ /dev/null @@ -1,16 +0,0 @@ ---- base/allocator/partition_allocator/address_pool_manager.cc.orig 2021-12-14 11:44:55 UTC -+++ base/allocator/partition_allocator/address_pool_manager.cc -@@ -8,6 +8,13 @@ - #include <sys/mman.h> - #endif - -+#if defined(OS_FREEBSD) -+#include <sys/mman.h> -+#include <fcntl.h> -+ -+#include "base/posix/eintr_wrapper.h" -+#endif -+ - #include <algorithm> - #include <limits> - diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_page__allocator.h b/www/chromium/files/patch-base_allocator_partition__allocator_page__allocator.h deleted file mode 100644 index 12f57b367556..000000000000 --- a/www/chromium/files/patch-base_allocator_partition__allocator_page__allocator.h +++ /dev/null @@ -1,11 +0,0 @@ ---- base/allocator/partition_allocator/page_allocator.h.orig 2021-12-14 11:44:55 UTC -+++ base/allocator/partition_allocator/page_allocator.h -@@ -170,7 +170,7 @@ BASE_EXPORT void DecommitAndZeroSystemPages(void* addr - // Whether decommitted memory is guaranteed to be zeroed when it is - // recommitted. Do not assume that this will not change over time. - constexpr BASE_EXPORT bool DecommittedMemoryIsAlwaysZeroed() { --#if defined(OS_APPLE) -+#if defined(OS_APPLE) || defined(OS_FREEBSD) - return false; - #else - return true; diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h b/www/chromium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h deleted file mode 100644 index cf452245c7a2..000000000000 --- a/www/chromium/files/patch-base_allocator_partition__allocator_page__allocator__internals__posix.h +++ /dev/null @@ -1,56 +0,0 @@ ---- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2021-12-14 11:44:55 UTC -+++ base/allocator/partition_allocator/page_allocator_internals_posix.h -@@ -28,10 +28,14 @@ - #if defined(OS_ANDROID) - #include <sys/prctl.h> - #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #include <sys/resource.h> - #endif - -+#if defined(OS_BSD) -+#include <fcntl.h> -+#endif -+ - #include "base/allocator/partition_allocator/page_allocator.h" - - #ifndef MAP_ANONYMOUS -@@ -151,12 +155,19 @@ void* SystemAllocPagesInternal(void* hint, - PA_DCHECK(PageTag::kFirst <= page_tag); - PA_DCHECK(PageTag::kLast >= page_tag); - int fd = VM_MAKE_TAG(static_cast<int>(page_tag)); -+#elif defined(OS_FREEBSD) -+ int fd = HANDLE_EINTR(open("/dev/zero", O_RDWR | O_CLOEXEC)); -+ PA_PCHECK(fd != -1); - #else - int fd = -1; - #endif - - int access_flag = GetAccessFlags(accessibility); -+#if defined(OS_FREEBSD) -+ int map_flags = MAP_PRIVATE; -+#else - int map_flags = MAP_ANONYMOUS | MAP_PRIVATE; -+#endif - - #if defined(OS_MAC) - // On macOS 10.14 and higher, executables that are code signed with the -@@ -183,6 +194,8 @@ void* SystemAllocPagesInternal(void* hint, - prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ret, length, - PageTagToName(page_tag)); - } -+#elif defined(OS_FREEBSD) -+ HANDLE_EINTR(close(fd)); - #endif - - return ret; -@@ -346,6 +359,8 @@ void DiscardSystemPagesInternal(void* address, size_t - ret = madvise(address, length, MADV_DONTNEED); - } - PA_PCHECK(ret == 0); -+#elif defined(OS_FREEBSD) -+ PA_PCHECK(0 == madvise(address, length, MADV_FREE)); - #else - // We have experimented with other flags, but with suboptimal results. - // diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h b/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h index 047945ce0075..b525560e52b0 100644 --- a/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h +++ b/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__config.h @@ -1,22 +1,11 @@ ---- base/allocator/partition_allocator/partition_alloc_config.h.orig 2021-12-31 00:57:18 UTC +--- base/allocator/partition_allocator/partition_alloc_config.h.orig 2022-02-07 13:39:41 UTC +++ base/allocator/partition_allocator/partition_alloc_config.h -@@ -59,6 +59,10 @@ static_assert(sizeof(void*) != 8, ""); +@@ -59,7 +59,7 @@ static_assert(sizeof(void*) != 8, ""); + + // POSIX is not only UNIX, e.g. macOS and other OSes. We do use Linux-specific + // features such as futex(2). +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) #define PA_HAS_LINUX_KERNEL #endif -+#if defined(OS_FREEBSD) -+#define PA_HAS_FREEBSD_KERNEL -+#endif -+ - // On some platforms, we implement locking by spinning in userspace, then going - // into the kernel only if there is contention. This requires platform support, - // namely: -@@ -73,7 +77,7 @@ static_assert(sizeof(void*) != 8, ""); - // assume that pthread_mutex_trylock() is suitable. - // - // Otherwise, a userspace spinlock implementation is used. --#if defined(PA_HAS_LINUX_KERNEL) || defined(OS_WIN) || \ -+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL) || defined(OS_WIN) || \ - (defined(OS_POSIX) && !defined(OS_APPLE)) || defined(OS_FUCHSIA) - #define PA_HAS_FAST_MUTEX - #endif diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h b/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h index 847ab3dc11a8..3c37a2b8e5a7 100644 --- a/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h +++ b/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__constants.h @@ -1,11 +1,11 @@ ---- base/allocator/partition_allocator/partition_alloc_constants.h.orig 2022-01-21 12:58:23 UTC +--- base/allocator/partition_allocator/partition_alloc_constants.h.orig 2022-02-07 13:39:41 UTC +++ base/allocator/partition_allocator/partition_alloc_constants.h -@@ -349,7 +349,7 @@ constexpr size_t kBitsPerSizeT = sizeof(void*) * CHAR_ +@@ -361,7 +361,7 @@ constexpr size_t kBitsPerSizeT = sizeof(void*) * CHAR_ // PartitionPurgeDecommitEmptySlotSpans flag will eagerly decommit all entries // in the ring buffer, so with periodic purge enabled, this typically happens // every few seconds. --#if defined(OS_LINUX) -+#if defined(OS_LINUX) || defined(OS_BSD) - // Set to a higher value on Linux, to assess impact on performance bots. This - // roughly halves the number of syscalls done during a speedometer 2.0 run on - // this platform. +-#if defined(OS_LINUX) || defined(OS_APPLE) ++#if defined(OS_LINUX) || defined(OS_APPLE) || defined(OS_BSD) + // Set to a higher value on Linux and macOS, to assess impact on performance + // bots. This roughly halves the number of syscalls done during a speedometer + // 2.0 run on these platforms. diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__unittest.cc b/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__unittest.cc deleted file mode 100644 index f713b26a5cb3..000000000000 --- a/www/chromium/files/patch-base_allocator_partition__allocator_partition__alloc__unittest.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- base/allocator/partition_allocator/partition_alloc_unittest.cc.orig 2021-12-31 00:57:18 UTC -+++ base/allocator/partition_allocator/partition_alloc_unittest.cc -@@ -1803,7 +1803,7 @@ TEST_F(PartitionAllocTest, LostFreeSlotSpansBug) { - // cause flake. - #if !defined(OS_WIN) && \ - (!defined(ARCH_CPU_64_BITS) || \ -- (defined(OS_POSIX) && !(defined(OS_APPLE) || defined(OS_ANDROID)))) -+ (defined(OS_POSIX) && !(defined(OS_APPLE) || defined(OS_ANDROID) || defined(OS_BSD)))) - - // The following four tests wrap a called function in an expect death statement - // to perform their test, because they are non-hermetic. Specifically they are -@@ -1869,7 +1869,7 @@ TEST_F(PartitionAllocDeathTest, DISABLED_RepeatedTryRe - } - - #endif // !defined(ARCH_CPU_64_BITS) || (defined(OS_POSIX) && -- // !(defined(OS_APPLE) || defined(OS_ANDROID))) -+ // !(defined(OS_APPLE) || defined(OS_ANDROID) || defined(OS_BSD))) - - // Make sure that malloc(-1) dies. - // In the past, we had an integer overflow that would alias malloc(-1) to diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_partition__page.h b/www/chromium/files/patch-base_allocator_partition__allocator_partition__page.h new file mode 100644 index 000000000000..3fd97ed4f2bf --- /dev/null +++ b/www/chromium/files/patch-base_allocator_partition__allocator_partition__page.h @@ -0,0 +1,12 @@ +--- base/allocator/partition_allocator/partition_page.h.orig 2022-02-07 13:39:41 UTC ++++ base/allocator/partition_allocator/partition_page.h +@@ -141,7 +141,8 @@ struct __attribute__((packed)) SlotSpanMetadata { + // in PartitionPage, which has other fields as well, and must fit in 32 bytes. + + // CHECK()ed in AllocNewSlotSpan(). +-#if defined(PA_HAS_64_BITS_POINTERS) && defined(OS_APPLE) ++#if (defined(PA_HAS_64_BITS_POINTERS) && defined(OS_APPLE)) || \ ++ (defined(OS_FREEBSD) && defined(__i386__)) + // System page size is not a constant on Apple OSes, but is either 4 or 16kiB + // (1 << 12 or 1 << 14), as checked in PartitionRoot::Init(). And + // PartitionPageSize() is 4 times the OS page size. diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_partition__root.cc b/www/chromium/files/patch-base_allocator_partition__allocator_partition__root.cc deleted file mode 100644 index 6eb3a48451aa..000000000000 --- a/www/chromium/files/patch-base_allocator_partition__allocator_partition__root.cc +++ /dev/null @@ -1,47 +0,0 @@ ---- base/allocator/partition_allocator/partition_root.cc.orig 2021-12-31 00:57:18 UTC -+++ base/allocator/partition_allocator/partition_root.cc -@@ -28,7 +28,7 @@ - #include "wow64apiset.h" - #endif - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #include <pthread.h> - #endif - -@@ -42,7 +42,7 @@ namespace base { - - namespace { - --#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - // NO_THREAD_SAFETY_ANALYSIS: acquires the lock and doesn't release it, by - // design. -@@ -111,7 +111,7 @@ void AfterForkInChild() { - internal::ThreadCacheRegistry::Instance() - .ForcePurgeAllThreadAfterForkUnsafe(); - } --#endif // defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - std::atomic<bool> g_global_init_called; - void PartitionAllocMallocInitOnce() { -@@ -121,7 +121,7 @@ void PartitionAllocMallocInitOnce() { - if (!g_global_init_called.compare_exchange_strong(expected, true)) - return; - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // When fork() is called, only the current thread continues to execute in the - // child process. If the lock is held, but *not* by this thread when fork() is - // called, we have a deadlock. -@@ -146,7 +146,7 @@ void PartitionAllocMallocInitOnce() { - int err = - pthread_atfork(BeforeForkInParent, AfterForkInParent, AfterForkInChild); - PA_CHECK(err == 0); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - } - - } // namespace diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_partition__root.h b/www/chromium/files/patch-base_allocator_partition__allocator_partition__root.h new file mode 100644 index 000000000000..86e2996e9bc2 --- /dev/null +++ b/www/chromium/files/patch-base_allocator_partition__allocator_partition__root.h @@ -0,0 +1,11 @@ +--- base/allocator/partition_allocator/partition_root.h.orig 2022-02-07 13:39:41 UTC ++++ base/allocator/partition_allocator/partition_root.h +@@ -1044,7 +1044,7 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::FreeNoH + // essentially). + #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && \ + ((defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMECAST)) || \ +- (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))) ++ ((defined(OS_LINUX) || defined(OS_BSD)) && defined(ARCH_CPU_64_BITS))) + PA_CHECK(IsManagedByPartitionAlloc(reinterpret_cast<uintptr_t>(ptr))); + #endif + diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc b/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc index ad0050c3bb6f..be1594ebc8d8 100644 --- a/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc +++ b/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.cc @@ -1,54 +1,47 @@ ---- base/allocator/partition_allocator/spinning_mutex.cc.orig 2021-12-14 11:44:55 UTC +--- base/allocator/partition_allocator/spinning_mutex.cc.orig 2022-02-07 13:39:41 UTC +++ base/allocator/partition_allocator/spinning_mutex.cc -@@ -22,6 +22,13 @@ - #include <unistd.h> - #endif // defined(PA_HAS_LINUX_KERNEL) +@@ -17,7 +17,15 @@ -+#if defined(PA_HAS_FREEBSD_KERNEL) -+#include <errno.h> + #if defined(PA_HAS_LINUX_KERNEL) + #include <errno.h> ++#if defined(OS_OPENBSD) ++#include <sys/futex.h> ++#elif defined(OS_FREEBSD) +#include <sys/types.h> +#include <sys/thr.h> +#include <sys/umtx.h> -+#endif // defined(PA_HAS_FREEBSD_KERNEL) -+ - #if !defined(PA_HAS_FAST_MUTEX) - #include "base/threading/platform_thread.h" - -@@ -43,7 +50,7 @@ namespace internal { - - #if defined(PA_HAS_FAST_MUTEX) - --#if defined(PA_HAS_LINUX_KERNEL) -+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL) - - void SpinningMutex::FutexWait() { - // Save and restore errno. -@@ -67,8 +74,13 @@ void SpinningMutex::FutexWait() { ++#else + #include <linux/futex.h> ++#endif + #include <sys/syscall.h> + #include <unistd.h> + #endif // defined(PA_HAS_LINUX_KERNEL) +@@ -86,8 +94,13 @@ void SpinningMutex::FutexWait() { // |kLockedContended| anymore. Note that even without spurious wakeups, the // value of |state_| is not guaranteed when this returns, as another thread // may get the lock before we get to run. -+#if defined(PA_HAS_LINUX_KERNEL) ++#if defined(OS_FREEBSD) ++ int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE, ++ kLockedContended, nullptr, nullptr); ++#else int err = syscall(SYS_futex, &state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, kLockedContended, nullptr, nullptr, 0); -+#elif defined(PA_HAS_FREEBSD_KERNEL) -+ int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE, -+ kLockedContended, nullptr, nullptr); +#endif if (err) { // These are programming error, check them. -@@ -80,8 +92,14 @@ void SpinningMutex::FutexWait() { +@@ -99,8 +112,14 @@ void SpinningMutex::FutexWait() { void SpinningMutex::FutexWake() { int saved_errno = errno; -+#if defined(PA_HAS_LINUX_KERNEL) - long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, - 1 /* wake up a single waiter */, nullptr, nullptr, 0); -+#elif defined(PA_HAS_FREEBSD_KERNEL) ++#if defined(OS_FREEBSD) + long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE, + 1 /* wake up a single waiter */, nullptr, nullptr); ++#else + long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, + 1 /* wake up a single waiter */, nullptr, nullptr, 0); +#endif -+ ++ PA_CHECK(retval != -1); errno = saved_errno; } diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.h b/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.h deleted file mode 100644 index a5899e29e5c8..000000000000 --- a/www/chromium/files/patch-base_allocator_partition__allocator_spinning__mutex.h +++ /dev/null @@ -1,20 +0,0 @@ ---- base/allocator/partition_allocator/spinning_mutex.h.orig 2021-12-14 11:44:55 UTC -+++ base/allocator/partition_allocator/spinning_mutex.h -@@ -106,7 +106,7 @@ class LOCKABLE BASE_EXPORT SpinningMutex { - - #if defined(PA_HAS_FAST_MUTEX) - --#if defined(PA_HAS_LINUX_KERNEL) -+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL) - void FutexWait(); - void FutexWake(); - -@@ -176,7 +176,7 @@ inline constexpr SpinningMutex::SpinningMutex() = defa - - #if defined(PA_HAS_FAST_MUTEX) - --#if defined(PA_HAS_LINUX_KERNEL) -+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL) - - ALWAYS_INLINE bool SpinningMutex::Try() { - // Using the weak variant of compare_exchange(), which may fail spuriously. On diff --git a/www/chromium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc b/www/chromium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc index 97c6764116f7..09e46dc3b1a8 100644 --- a/www/chromium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc +++ b/www/chromium/files/patch-base_allocator_partition__allocator_starscan_stack_stack.cc @@ -1,39 +1,50 @@ ---- base/allocator/partition_allocator/starscan/stack/stack.cc.orig 2021-09-24 04:25:55 UTC +--- base/allocator/partition_allocator/starscan/stack/stack.cc.orig 2022-02-07 13:39:41 UTC +++ base/allocator/partition_allocator/starscan/stack/stack.cc @@ -17,6 +17,10 @@ #include <pthread.h> #endif -+#if defined(OS_FREEBSD) ++#if defined(OS_BSD) +#include <pthread_np.h> +#endif + #if defined(LIBC_GLIBC) extern "C" void* __libc_stack_end; #endif -@@ -54,7 +58,15 @@ void* GetStackTop() { +@@ -48,6 +52,36 @@ void* GetStackTop() { void* GetStackTop() { - pthread_attr_t attr; -+#if defined(OS_FREEBSD) -+ int error = pthread_attr_init(&attr); -+ if (error) { + return pthread_get_stackaddr_np(pthread_self()); ++} ++ ++#elif defined(OS_OPENBSD) ++ ++void* GetStackTop() { ++ stack_t ss; ++ if (pthread_stackseg_np(pthread_self(), &ss) != 0) + return nullptr; -+ } -+ error = pthread_attr_get_np(pthread_self(), &attr); -+#else - int error = pthread_getattr_np(pthread_self(), &attr); -+#endif - if (!error) { - void* base; - size_t size; -@@ -71,6 +83,9 @@ void* GetStackTop() { - // See https://code.google.com/p/nativeclient/issues/detail?id=3431. - return __libc_stack_end; - #else -+#if defined(OS_FREEBSD) ++ return reinterpret_cast<uint8_t*>(ss.ss_sp); ++} ++ ++#elif defined(OS_FREEBSD) ++ ++void* GetStackTop() { ++ pthread_attr_t attr; ++ int error = pthread_attr_init(&attr); ++ if (error) { ++ return nullptr; ++ } ++ error = pthread_attr_get_np(pthread_self(), &attr); ++ if (!error) { ++ void* base; ++ size_t size; ++ error = pthread_attr_getstack(&attr, &base, &size); ++ PA_CHECK(!error); ++ pthread_attr_destroy(&attr); ++ return reinterpret_cast<uint8_t*>(base) + size; ++ } + pthread_attr_destroy(&attr); -+#endif - return nullptr; - #endif // defined(LIBC_GLIBC) ++ return nullptr; } + + #elif defined(OS_POSIX) || defined(OS_FUCHSIA) diff --git a/www/chromium/files/patch-base_atomicops.h b/www/chromium/files/patch-base_atomicops.h new file mode 100644 index 000000000000..2001ce228478 --- /dev/null +++ b/www/chromium/files/patch-base_atomicops.h @@ -0,0 +1,14 @@ +--- base/atomicops.h.orig 2022-02-07 13:39:41 UTC ++++ base/atomicops.h +@@ -57,7 +57,11 @@ typedef intptr_t Atomic64; + + // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or + // Atomic64 routines below, depending on your architecture. ++#if !defined(OS_OPENBSD) && defined(__i386__) ++typedef Atomic32 AtomicWord; ++#else + typedef intptr_t AtomicWord; ++#endif + + // Atomically execute: + // result = *ptr; diff --git a/www/chromium/files/patch-base_base__paths__posix.cc b/www/chromium/files/patch-base_base__paths__posix.cc new file mode 100644 index 000000000000..e4e467db6322 --- /dev/null +++ b/www/chromium/files/patch-base_base__paths__posix.cc @@ -0,0 +1,98 @@ +--- base/base_paths_posix.cc.orig 2022-02-07 13:39:41 UTC ++++ base/base_paths_posix.cc +@@ -15,6 +15,7 @@ + #include <ostream> + #include <string> + ++#include "base/command_line.h" + #include "base/environment.h" + #include "base/files/file_path.h" + #include "base/files/file_util.h" +@@ -25,9 +26,13 @@ + #include "base/process/process_metrics.h" + #include "build/build_config.h" + +-#if defined(OS_FREEBSD) ++#if defined(OS_BSD) + #include <sys/param.h> + #include <sys/sysctl.h> ++#if defined(OS_OPENBSD) ++#include <kvm.h> ++#define MAXTOKENS 2 ++#endif + #elif defined(OS_SOLARIS) || defined(OS_AIX) + #include <stdlib.h> + #endif +@@ -68,13 +73,65 @@ bool PathProviderPosix(int key, FilePath* result) { + *result = FilePath(bin_dir); + return true; + #elif defined(OS_OPENBSD) || defined(OS_AIX) +- // There is currently no way to get the executable path on OpenBSD +- char* cpath; +- if ((cpath = getenv("CHROME_EXE_PATH")) != NULL) +- *result = FilePath(cpath); +- else +- *result = FilePath("/usr/local/chrome/chrome"); +- return true; ++ char *cpath; ++#if !defined(OS_AIX) ++ struct kinfo_file *files; ++ kvm_t *kd = NULL; ++ char errbuf[_POSIX2_LINE_MAX]; ++ static char retval[PATH_MAX]; ++ int cnt; ++ struct stat sb; ++ pid_t cpid = getpid(); ++ bool ret = false; ++ ++ const base::CommandLine* command_line = ++ base::CommandLine::ForCurrentProcess(); ++ ++ VLOG(1) << "PathProviderPosix argv: " << command_line->argv()[0]; ++ ++ if (realpath(command_line->argv()[0].c_str(), retval) == NULL) ++ goto out; ++ ++ if (stat(command_line->argv()[0].c_str(), &sb) < 0) ++ goto out; ++ ++ if (!command_line->HasSwitch("no-sandbox")) { ++ ret = true; ++ *result = FilePath(retval); ++ VLOG(1) << "PathProviderPosix (sandbox) result: " << retval; ++ goto out; ++ } ++ ++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL) ++ goto out; ++ ++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid, ++ sizeof(struct kinfo_file), &cnt)) == NULL) ++ goto out; ++ ++ for (int i = 0; i < cnt; i++) { ++ if (files[i].fd_fd == KERN_FILE_TEXT && ++ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) && ++ files[i].va_fileid == sb.st_ino) { ++ ret = true; ++ *result = FilePath(retval); ++ VLOG(1) << "PathProviderPosix result: " << retval; ++ } ++ } ++out: ++ if (kd) ++ kvm_close(kd); ++ if (!ret) { ++#endif ++ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL) ++ *result = FilePath(cpath); ++ else ++ *result = FilePath("/usr/local/chrome/chrome"); ++ return true; ++#if !defined(OS_AIX) ++ } ++ return ret; ++#endif + #endif + } + case DIR_SRC_TEST_DATA_ROOT: { diff --git a/www/chromium/files/patch-base_base__switches.cc b/www/chromium/files/patch-base_base__switches.cc index c7fd2e4d641b..be1fb8bcdacd 100644 --- a/www/chromium/files/patch-base_base__switches.cc +++ b/www/chromium/files/patch-base_base__switches.cc @@ -1,17 +1,6 @@ ---- base/base_switches.cc.orig 2021-05-12 22:05:40 UTC +--- base/base_switches.cc.orig 2022-02-07 13:39:41 UTC +++ base/base_switches.cc -@@ -125,8 +125,8 @@ const char kDisableUsbKeyboardDetect[] = "disable - - // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch - // of lacros-chrome is complete. --#if defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \ -- !BUILDFLAG(IS_CHROMEOS_LACROS) -+#if defined(OS_BSD) || (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \ -+ !BUILDFLAG(IS_CHROMEOS_LACROS)) - // The /dev/shm partition is too small in certain VM environments, causing - // Chrome to fail or crash (see http://crbug.com/715363). Use this flag to - // work-around this issue (a temporary directory will always be used to create -@@ -161,7 +161,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria +@@ -170,7 +170,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria #endif diff --git a/www/chromium/files/patch-base_base__switches.h b/www/chromium/files/patch-base_base__switches.h index f878cbc00f2d..3388972738b8 100644 --- a/www/chromium/files/patch-base_base__switches.h +++ b/www/chromium/files/patch-base_base__switches.h @@ -1,17 +1,6 @@ ---- base/base_switches.h.orig 2021-05-12 22:05:40 UTC +--- base/base_switches.h.orig 2022-02-07 13:39:41 UTC +++ base/base_switches.h -@@ -42,8 +42,8 @@ extern const char kDisableUsbKeyboardDetect[]; - - // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch - // of lacros-chrome is complete. --#if defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \ -- !BUILDFLAG(IS_CHROMEOS_LACROS) -+#if defined(OS_BSD) || (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \ -+ !BUILDFLAG(IS_CHROMEOS_LACROS)) - extern const char kDisableDevShmUsage[]; - #endif - -@@ -59,7 +59,7 @@ extern const char kEnableIdleTracing[]; +@@ -60,7 +60,7 @@ extern const char kEnableIdleTracing[]; extern const char kForceFieldTrialParams[]; #endif diff --git a/www/chromium/files/patch-base_check.h b/www/chromium/files/patch-base_check.h deleted file mode 100644 index 8ff12ec1ffe7..000000000000 --- a/www/chromium/files/patch-base_check.h +++ /dev/null @@ -1,11 +0,0 @@ ---- base/check.h.orig 2021-04-22 11:38:19 UTC -+++ base/check.h -@@ -85,7 +85,7 @@ class BASE_EXPORT CheckError { - // Stream for adding optional details to the error message. - std::ostream& stream(); - -- NOMERGE ~CheckError(); -+ ~CheckError(); - - CheckError(const CheckError& other) = delete; - CheckError& operator=(const CheckError& other) = delete; diff --git a/www/chromium/files/patch-base_compiler__specific.h b/www/chromium/files/patch-base_compiler__specific.h new file mode 100644 index 000000000000..d9fcba02e013 --- /dev/null +++ b/www/chromium/files/patch-base_compiler__specific.h @@ -0,0 +1,11 @@ +--- base/compiler_specific.h.orig 2022-02-07 13:39:41 UTC ++++ base/compiler_specific.h +@@ -366,7 +366,7 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) { + #endif // defined(__clang_analyzer__) + + // Use nomerge attribute to disable optimization of merging multiple same calls. +-#if defined(__clang__) && __has_attribute(nomerge) ++#if defined(__clang__) && __has_attribute(nomerge) && !defined(OS_FREEBSD) + #define NOMERGE [[clang::nomerge]] + #else + #define NOMERGE diff --git a/www/chromium/files/patch-base_containers_checked__iterators__unittest.cc b/www/chromium/files/patch-base_containers_checked__iterators__unittest.cc deleted file mode 100644 index 95160ac0985a..000000000000 --- a/www/chromium/files/patch-base_containers_checked__iterators__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/containers/checked_iterators_unittest.cc.orig 2021-10-05 14:50:27 UTC -+++ base/containers/checked_iterators_unittest.cc -@@ -88,7 +88,7 @@ TEST(CheckedContiguousIterator, ConvertingComparisonOp - // lags a bit behind. - // TODO(crbug.com/1166360): Enable this test on ChromeOS once the shared libc++ - // is sufficiently modern. --#if defined(_LIBCPP_VERSION) && !defined(OS_NACL) && !defined(OS_CHROMEOS) -+#if defined(_LIBCPP_VERSION) && !defined(OS_NACL) && !defined(OS_CHROMEOS) && !defined(OS_BSD) - namespace { - - // Helper template that wraps an iterator and disables its dereference and diff --git a/www/chromium/files/patch-base_cpu.cc b/www/chromium/files/patch-base_cpu.cc deleted file mode 100644 index 6a0db27401ac..000000000000 --- a/www/chromium/files/patch-base_cpu.cc +++ /dev/null @@ -1,35 +0,0 @@ ---- base/cpu.cc.orig 2021-12-14 11:44:55 UTC -+++ base/cpu.cc -@@ -17,7 +17,7 @@ - #include "base/cxx17_backports.h" - #include "base/no_destructor.h" - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) - #include "base/containers/flat_set.h" - #include "base/files/file_util.h" -@@ -215,6 +215,14 @@ const ProcCpuInfo& ParseProcCpu() { - - return *info; - } -+#elif defined(OS_BSD) -+std::string* CpuInfoBrand() { -+ static std::string* brand = []() { -+ return new std::string(SysInfo::CPUModelName()); -+ }(); -+ -+ return brand; -+} - #endif // defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || - // defined(OS_LINUX) || defined(OS_CHROMEOS)) - -@@ -358,6 +366,8 @@ void CPU::Initialize(bool require_branding) { - has_bti_ = hwcap2 & HWCAP2_BTI; - #endif - -+#elif defined(OS_BSD) -+ cpu_brand_ = *CpuInfoBrand(); - #elif defined(OS_WIN) - // Windows makes high-resolution thread timing information available in - // user-space. diff --git a/www/chromium/files/patch-base_cpu.h b/www/chromium/files/patch-base_cpu.h index 5b713f08f882..1879d459ce46 100644 --- a/www/chromium/files/patch-base_cpu.h +++ b/www/chromium/files/patch-base_cpu.h @@ -1,20 +1,11 @@ ---- base/cpu.h.orig 2021-12-14 11:44:55 UTC +--- base/cpu.h.orig 2022-02-07 13:39:41 UTC +++ base/cpu.h -@@ -103,7 +103,7 @@ class BASE_EXPORT CPU final { - IntelMicroArchitecture GetIntelMicroArchitecture() const; +@@ -104,7 +104,7 @@ class BASE_EXPORT CPU final { const std::string& cpu_brand() const { return cpu_brand_; } --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) enum class CoreType { kUnknown = 0, -@@ -154,7 +154,7 @@ class BASE_EXPORT CPU final { - // cpuidle driver. - using CoreIdleTimes = std::vector<TimeDelta>; - static bool GetCumulativeCoreIdleTimes(CoreIdleTimes&); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - // defined(OS_AIX) - - private: + kOther, diff --git a/www/chromium/files/patch-base_debug_debugger__posix.cc b/www/chromium/files/patch-base_debug_debugger__posix.cc index 024e9e915cda..63a56d85b575 100644 --- a/www/chromium/files/patch-base_debug_debugger__posix.cc +++ b/www/chromium/files/patch-base_debug_debugger__posix.cc @@ -1,33 +1,45 @@ ---- base/debug/debugger_posix.cc.orig 2021-12-14 11:44:55 UTC +--- base/debug/debugger_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/debug/debugger_posix.cc -@@ -87,7 +87,7 @@ bool BeingDebugged() { - KERN_PROC, - KERN_PROC_PID, - getpid() --#if defined(OS_OPENBSD) -+#if defined(OS_BSD) - , sizeof(struct kinfo_proc), - 0 +@@ -36,6 +36,10 @@ + #include <sys/sysctl.h> #endif -@@ -95,33 +95,35 @@ bool BeingDebugged() { + ++#if defined(OS_OPENBSD) ++#include <sys/proc.h> ++#endif ++ + #if defined(OS_FREEBSD) + #include <sys/user.h> + #endif +@@ -95,32 +99,51 @@ bool BeingDebugged() { // Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and // binary interfaces may change. -- struct kinfo_proc info; -- size_t info_size = sizeof(info); ++#if defined(OS_OPENBSD) + struct kinfo_proc *info; + size_t info_size; ++#else + struct kinfo_proc info; + size_t info_size = sizeof(info); ++#endif --#if defined(OS_OPENBSD) + #if defined(OS_OPENBSD) if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0) return -1; -+ info = (struct kinfo_proc *)malloc(info_size); mib[5] = (info_size / sizeof(struct kinfo_proc)); --#endif - -- int sysctl_result = sysctl(mib, base::size(mib), &info, &info_size, NULL, 0); ++ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) { ++ is_set = true; ++ being_debugged = false; ++ return being_debugged; ++ } ++ + int sysctl_result = sysctl(mib, base::size(mib), info, &info_size, NULL, 0); + #endif + ++#if !defined(OS_OPENBSD) + int sysctl_result = sysctl(mib, base::size(mib), &info, &info_size, NULL, 0); ++#endif DCHECK_EQ(sysctl_result, 0); if (sysctl_result != 0) { is_set = true; @@ -39,18 +51,18 @@ // This process is being debugged if the P_TRACED flag is set. is_set = true; #if defined(OS_FREEBSD) -- being_debugged = (info.ki_flag & P_TRACED) != 0; -+ being_debugged = (info->ki_flag & P_TRACED) != 0; - #elif defined(OS_BSD) + being_debugged = (info.ki_flag & P_TRACED) != 0; +-#elif defined(OS_BSD) - being_debugged = (info.p_flag & P_TRACED) != 0; -+ being_debugged = (info->p_flag & P_TRACED) != 0; ++#elif defined(OS_OPENBSD) ++ being_debugged = (info->p_psflags & PS_TRACED) != 0; #else -- being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0; -+ being_debugged = (info->kp_proc.p_flag & P_TRACED) != 0; - #endif + being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0; ++#endif + +out: ++#if defined(OS_OPENBSD) + free(info); + #endif return being_debugged; } - diff --git a/www/chromium/files/patch-base_debug_elf__reader.cc b/www/chromium/files/patch-base_debug_elf__reader.cc index 50e4509445ed..21904ae7ca00 100644 --- a/www/chromium/files/patch-base_debug_elf__reader.cc +++ b/www/chromium/files/patch-base_debug_elf__reader.cc @@ -1,16 +1,6 @@ ---- base/debug/elf_reader.cc.orig 2021-07-19 18:45:05 UTC +--- base/debug/elf_reader.cc.orig 2022-02-07 13:39:41 UTC +++ base/debug/elf_reader.cc -@@ -39,7 +39,9 @@ using Nhdr = Elf64_Nhdr; - using Word = Elf64_Word; - #endif - -+#if !defined(OS_BSD) - constexpr char kGnuNoteName[] = "GNU"; -+#endif - - // Returns a pointer to the header of the ELF binary mapped into memory, or a - // null pointer if the header is invalid. Here and below |elf_mapped_base| is a -@@ -76,6 +78,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, +@@ -76,6 +76,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, bool found = false; while (current_section < section_end) { current_note = reinterpret_cast<const Nhdr*>(current_section); @@ -18,7 +8,7 @@ if (current_note->n_type == NT_GNU_BUILD_ID) { StringPiece note_name(current_section + sizeof(Nhdr), current_note->n_namesz); -@@ -85,6 +88,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, +@@ -85,6 +86,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base, break; } } diff --git a/www/chromium/files/patch-base_debug_proc__maps__linux.cc b/www/chromium/files/patch-base_debug_proc__maps__linux.cc index 9d9eff8794a9..c728ce89a006 100644 --- a/www/chromium/files/patch-base_debug_proc__maps__linux.cc +++ b/www/chromium/files/patch-base_debug_proc__maps__linux.cc @@ -1,6 +1,6 @@ ---- base/debug/proc_maps_linux.cc.orig 2021-04-14 18:40:48 UTC +--- base/debug/proc_maps_linux.cc.orig 2022-02-07 13:39:41 UTC +++ base/debug/proc_maps_linux.cc -@@ -13,13 +13,18 @@ +@@ -13,7 +13,7 @@ #include "base/strings/string_split.h" #include "build/build_config.h" @@ -9,133 +9,3 @@ #include <inttypes.h> #endif - namespace base { - namespace debug { - -+#if defined(OS_BSD) -+const char kProcSelfMapsPath[] = "/proc/curproc/map"; -+#else -+const char kProcSelfMapsPath[] = "/proc/self/maps"; -+ - // Scans |proc_maps| starting from |pos| returning true if the gate VMA was - // found, otherwise returns false. - static bool ContainsGateVMA(std::string* proc_maps, size_t pos) { -@@ -35,15 +40,16 @@ static bool ContainsGateVMA(std::string* proc_maps, si - return false; - #endif - } -+#endif - - bool ReadProcMaps(std::string* proc_maps) { - // seq_file only writes out a page-sized amount on each call. Refer to header - // file for details. - const long kReadSize = sysconf(_SC_PAGESIZE); - -- base::ScopedFD fd(HANDLE_EINTR(open("/proc/self/maps", O_RDONLY))); -+ base::ScopedFD fd(HANDLE_EINTR(open(kProcSelfMapsPath, O_RDONLY))); - if (!fd.is_valid()) { -- DPLOG(ERROR) << "Couldn't open /proc/self/maps"; -+ DPLOG(ERROR) << "Couldn't open " << kProcSelfMapsPath; - return false; - } - proc_maps->clear(); -@@ -57,7 +63,7 @@ bool ReadProcMaps(std::string* proc_maps) { - - ssize_t bytes_read = HANDLE_EINTR(read(fd.get(), buffer, kReadSize)); - if (bytes_read < 0) { -- DPLOG(ERROR) << "Couldn't read /proc/self/maps"; -+ DPLOG(ERROR) << "Couldn't read " << kProcSelfMapsPath; - proc_maps->clear(); - return false; - } -@@ -68,6 +74,7 @@ bool ReadProcMaps(std::string* proc_maps) { - if (bytes_read == 0) - break; - -+#if !defined(OS_BSD) - // The gate VMA is handled as a special case after seq_file has finished - // iterating through all entries in the virtual memory table. - // -@@ -78,6 +85,7 @@ bool ReadProcMaps(std::string* proc_maps) { - // Avoid this by searching for the gate VMA and breaking early. - if (ContainsGateVMA(proc_maps, pos)) - break; -+#endif - } - - return true; -@@ -105,11 +113,32 @@ bool ParseProcMaps(const std::string& input, - - MappedMemoryRegion region; - const char* line = lines[i].c_str(); -- char permissions[5] = {'\0'}; // Ensure NUL-terminated string. -+ char permissions[6] = {'\0'}; // Ensure NUL-terminated string. -+ int path_index = 0; -+ -+#if defined(OS_BSD) -+ if (lines[i].empty()) -+ continue; -+ -+ char cow; -+ -+ // Format: -+ // -+ // start end resident private_resident obj perms ref_count shadow_count flags cow needs_copy type fullpath cred ruid -+ // 0x200000 0x202000 2 6 0xfffff80005be9000 r-- 3 1 0x1000 COW NC vnode /bin/cat NCH -1 -+ // -+ if (sscanf(line, "%" SCNxPTR " %" SCNxPTR " %*ld %*ld %*[^ ] %5[^ ] %*d %*d %*x %c%*s %*s %*s %n", -+ ®ion.start, ®ion.end, permissions, &cow, &path_index) < 4) { -+ DPLOG(WARNING) << "sscanf failed for line: " << line; -+ return false; -+ } -+ -+ const char* fullpath = line + path_index; -+ const char* cred = strchr(fullpath, ' '); -+#else - uint8_t dev_major = 0; - uint8_t dev_minor = 0; - long inode = 0; -- int path_index = 0; - - // Sample format from man 5 proc: - // -@@ -125,6 +154,7 @@ bool ParseProcMaps(const std::string& input, - DPLOG(WARNING) << "sscanf failed for line: " << line; - return false; - } -+#endif - - region.permissions = 0; - -@@ -143,14 +173,31 @@ bool ParseProcMaps(const std::string& input, - else if (permissions[2] != '-') - return false; - -+#if defined(OS_BSD) -+ if (cow == 'C') { -+ region.permissions |= MappedMemoryRegion::PRIVATE; -+ } else if (cow != 'N') { -+ DPLOG(WARNING) << "unknown value for COW in line " << line << ": " << cow; -+ return false; -+ } -+#else - if (permissions[3] == 'p') - region.permissions |= MappedMemoryRegion::PRIVATE; - else if (permissions[3] != 's' && permissions[3] != 'S') // Shared memory. - return false; -+#endif - - // Pushing then assigning saves us a string copy. - regions.push_back(region); -+#if defined(OS_BSD) -+ if (cred != nullptr) { -+ regions.back().path.assign(line + path_index, cred - fullpath); -+ } else { -+ regions.back().path.assign(line + path_index); -+ } -+#else - regions.back().path.assign(line + path_index); -+#endif - } - - regions_out->swap(regions); diff --git a/www/chromium/files/patch-base_debug_stack__trace.cc b/www/chromium/files/patch-base_debug_stack__trace.cc deleted file mode 100644 index 2733c1b031d9..000000000000 --- a/www/chromium/files/patch-base_debug_stack__trace.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/debug/stack_trace.cc.orig 2021-09-14 01:51:47 UTC -+++ base/debug/stack_trace.cc -@@ -16,7 +16,7 @@ - #if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) - #include "third_party/abseil-cpp/absl/types/optional.h" - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - #include <pthread.h> - - #include "base/process/process_handle.h" diff --git a/www/chromium/files/patch-base_debug_stack__trace.h b/www/chromium/files/patch-base_debug_stack__trace.h deleted file mode 100644 index fd24a9ba8900..000000000000 --- a/www/chromium/files/patch-base_debug_stack__trace.h +++ /dev/null @@ -1,19 +0,0 @@ ---- base/debug/stack_trace.h.orig 2021-12-14 11:44:55 UTC -+++ base/debug/stack_trace.h -@@ -18,6 +18,7 @@ - #if !defined(OS_NACL) - #include <signal.h> - #endif -+#include <sys/stdint.h> - #include <unistd.h> - #endif - -@@ -155,7 +156,7 @@ BASE_EXPORT size_t CollectStackTrace(void** trace, siz - // scanning area at the origin of the stack, wasting time and not finding any - // frames (since Android libraries don't have frame pointers). Scanning is not - // enabled on other posix platforms due to legacy reasons. --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - constexpr bool kEnableScanningByDefault = true; - #else - constexpr bool kEnableScanningByDefault = false; diff --git a/www/chromium/files/patch-base_debug_stack__trace__posix.cc b/www/chromium/files/patch-base_debug_stack__trace__posix.cc index afefdadf5bf8..1852f89074be 100644 --- a/www/chromium/files/patch-base_debug_stack__trace__posix.cc +++ b/www/chromium/files/patch-base_debug_stack__trace__posix.cc @@ -1,4 +1,4 @@ ---- base/debug/stack_trace_posix.cc.orig 2021-12-14 11:44:55 UTC +--- base/debug/stack_trace_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/debug/stack_trace_posix.cc @@ -35,7 +35,7 @@ #include <AvailabilityMacros.h> @@ -9,67 +9,30 @@ #include "base/debug/proc_maps_linux.h" #endif -@@ -446,7 +446,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf - if (::signal(signal, SIG_DFL) == SIG_ERR) { - _exit(EXIT_FAILURE); - } --#elif !defined(OS_LINUX) -+#elif !defined(OS_LINUX) && !defined(OS_BSD) - // For all operating systems but Linux we do not reraise the signal that - // brought us here but terminate the process immediately. - // Otherwise various tests break on different operating systems, see -@@ -454,7 +454,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf - PrintToStderr( - "Calling _exit(EXIT_FAILURE). Core file will not be generated.\n"); - _exit(EXIT_FAILURE); --#endif // !defined(OS_LINUX) -+#endif // !defined(OS_LINUX) && !defined(OS_BSD) - - // After leaving this handler control flow returns to the point where the - // signal was raised, raising the current signal once again but executing the -@@ -695,13 +695,21 @@ class SandboxSymbolizeHelper { +@@ -693,6 +693,9 @@ class SandboxSymbolizeHelper { + // for the modules that are loaded in the current process. + // Returns true on success. + bool CacheMemoryRegions() { ++#if defined(OS_BSD) ++ return false; ++#else // Reads /proc/self/maps. std::string contents; if (!ReadProcMaps(&contents)) { -+#if defined(OS_BSD) -+ LOG(ERROR) << "Failed to read /proc/curproc/map"; -+#else - LOG(ERROR) << "Failed to read /proc/self/maps"; -+#endif - return false; - } +@@ -710,6 +713,7 @@ class SandboxSymbolizeHelper { - // Parses /proc/self/maps. - if (!ParseProcMaps(contents, ®ions_)) { -+#if defined(OS_BSD) -+ LOG(ERROR) << "Failed to parse the contents of /proc/curproc/map"; -+#else - LOG(ERROR) << "Failed to parse the contents of /proc/self/maps"; -+#endif - return false; - } - -@@ -732,7 +740,11 @@ class SandboxSymbolizeHelper { - // Skip regions with empty file names. - continue; - } -+#if defined(OS_BSD) -+ if (region.path[0] == '-') { -+#else - if (region.path[0] == '[') { + is_initialized_ = true; + return true; +#endif - // Skip pseudo-paths, like [stack], [vdso], [heap], etc ... - continue; - } -@@ -827,9 +839,9 @@ bool EnableInProcessStackDumping() { - success &= (sigaction(SIGBUS, &action, nullptr) == 0); - success &= (sigaction(SIGSEGV, &action, nullptr) == 0); - // On Linux, SIGSYS is reserved by the kernel for seccomp-bpf sandboxing. --#if !defined(OS_LINUX) && !defined(OS_CHROMEOS) -+#if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_BSD) - success &= (sigaction(SIGSYS, &action, nullptr) == 0); --#endif // !defined(OS_LINUX) && !defined(OS_CHROMEOS) -+#endif // !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_BSD) + } - return success; - } + // Opens all object files and caches their file descriptors. +@@ -866,7 +870,7 @@ size_t CollectStackTrace(void** trace, size_t count) { + // If we do not have unwind tables, then try tracing using frame pointers. + return base::debug::TraceStackFramePointers(const_cast<const void**>(trace), + count, 0); +-#elif !defined(__UCLIBC__) && !defined(_AIX) ++#elif !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_BSD) + // Though the backtrace API man page does not list any possible negative + // return values, we take no chance. + return base::saturated_cast<size_t>(backtrace(trace, count)); diff --git a/www/chromium/files/patch-base_debug_stack__trace__unittest.cc b/www/chromium/files/patch-base_debug_stack__trace__unittest.cc deleted file mode 100644 index a679dcb06d73..000000000000 --- a/www/chromium/files/patch-base_debug_stack__trace__unittest.cc +++ /dev/null @@ -1,40 +0,0 @@ ---- base/debug/stack_trace_unittest.cc.orig 2021-07-19 18:45:05 UTC -+++ base/debug/stack_trace_unittest.cc -@@ -71,6 +71,7 @@ TEST_F(StackTraceTest, OutputToStream) { - std::string::npos) - << "Unable to resolve symbols."; - -+#if !defined(OS_BSD) - // Expect a demangled symbol. - // Note that Windows Release builds omit the function parameters from the - // demangled stack output, otherwise this could be "testing::UnitTest::Run()". -@@ -89,9 +90,10 @@ TEST_F(StackTraceTest, OutputToStream) { - EXPECT_TRUE(backtrace_message.find(__func__) != std::string::npos) - << "Expected to find " << __func__ << " in backtrace:\n" - << backtrace_message; -+#endif - } - --#if !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) -+#if !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) && !defined(OS_BSD) - // Disabled in Official builds, where Link-Time Optimization can result in two - // or fewer stack frames being available, causing the test to fail. - TEST_F(StackTraceTest, TruncatedTrace) { -@@ -105,7 +107,7 @@ TEST_F(StackTraceTest, TruncatedTrace) { - truncated.Addresses(&count); - EXPECT_EQ(2u, count); - } --#endif // !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) -+#endif // !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) && !defined(OS_BSD) - - // The test is used for manual testing, e.g., to see the raw output. - TEST_F(StackTraceTest, DebugOutputToStream) { -@@ -344,7 +346,7 @@ TEST_F(StackTraceTest, MAYBE_TraceStackFramePointers) - // sometimes we read fp / pc from the place that previously held - // uninitialized value. - // TODO(crbug.com/1132511): Enable this test on Fuchsia. --#if defined(MEMORY_SANITIZER) || defined(OS_FUCHSIA) -+#if defined(MEMORY_SANITIZER) || defined(OS_FUCHSIA) || defined(OS_BSD) - #define MAYBE_TraceStackFramePointersFromBuffer \ - DISABLED_TraceStackFramePointersFromBuffer - #else diff --git a/www/chromium/files/patch-base_files_file__path__unittest.cc b/www/chromium/files/patch-base_files_file__path__unittest.cc deleted file mode 100644 index 14bb60990cde..000000000000 --- a/www/chromium/files/patch-base_files_file__path__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/files/file_path_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/files/file_path_unittest.cc -@@ -1202,7 +1202,7 @@ TEST_F(FilePathTest, FromUTF8Unsafe_And_AsUTF8Unsafe) - "\xEF\xBC\xA1\xEF\xBC\xA2\xEF\xBC\xA3.txt" }, - }; - --#if !defined(SYSTEM_NATIVE_UTF8) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) -+#if !defined(SYSTEM_NATIVE_UTF8) && (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) - ScopedLocale locale("en_US.UTF-8"); - #endif - diff --git a/www/chromium/files/patch-base_files_file__path__watcher__freebsd.cc b/www/chromium/files/patch-base_files_file__path__watcher__bsd.cc index a10889cb9fdb..b4632c587e95 100644 --- a/www/chromium/files/patch-base_files_file__path__watcher__freebsd.cc +++ b/www/chromium/files/patch-base_files_file__path__watcher__bsd.cc @@ -1,18 +1,14 @@ ---- base/files/file_path_watcher_freebsd.cc.orig 2021-04-15 08:12:30 UTC -+++ base/files/file_path_watcher_freebsd.cc -@@ -0,0 +1,61 @@ -+// Copyright (c) 2012 The Chromium Authors. All rights reserved. +--- base/files/file_path_watcher_bsd.cc.orig 2022-02-07 13:39:41 UTC ++++ base/files/file_path_watcher_bsd.cc +@@ -0,0 +1,54 @@ ++// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + -+// This file exists for Unix systems which don't have the inotify headers, and -+// thus cannot build file_watcher_inotify.cc -+ +#include <memory> + +#include "base/files/file_path_watcher.h" +#include "base/files/file_path_watcher_kqueue.h" -+ +#include "base/memory/ptr_util.h" +#include "build/build_config.h" + @@ -31,22 +27,19 @@ + Type type, + const FilePathWatcher::Callback& callback) override { + DCHECK(!impl_.get()); -+ + if (type == Type::kRecursive) { -+ return false; ++ if (!FilePathWatcher::RecursiveWatchAvailable()) ++ return false; + } else { + impl_ = std::make_unique<FilePathWatcherKQueue>(); + } -+ + DCHECK(impl_.get()); -+ + return impl_->Watch(path, type, callback); + } + + void Cancel() override { + if (impl_.get()) + impl_->Cancel(); -+ + set_cancelled(); + } + diff --git a/www/chromium/files/patch-base_files_file__path__watcher__kqueue.h b/www/chromium/files/patch-base_files_file__path__watcher__kqueue.h index 75dd465828bc..821858b75711 100644 --- a/www/chromium/files/patch-base_files_file__path__watcher__kqueue.h +++ b/www/chromium/files/patch-base_files_file__path__watcher__kqueue.h @@ -1,13 +1,10 @@ ---- base/files/file_path_watcher_kqueue.h.orig 2021-04-14 18:40:48 UTC +--- base/files/file_path_watcher_kqueue.h.orig 2022-02-07 13:39:41 UTC +++ base/files/file_path_watcher_kqueue.h -@@ -5,6 +5,10 @@ +@@ -5,6 +5,7 @@ #ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_ #define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_ -+#ifdef __FreeBSD__ -+#include <sys/stdint.h> -+#include <sys/types.h> -+#endif ++#include <sys/time.h> #include <sys/event.h> #include <memory> diff --git a/www/chromium/files/patch-base_files_file__path__watcher__unittest.cc b/www/chromium/files/patch-base_files_file__path__watcher__unittest.cc deleted file mode 100644 index c046f76ff4cc..000000000000 --- a/www/chromium/files/patch-base_files_file__path__watcher__unittest.cc +++ /dev/null @@ -1,56 +0,0 @@ ---- base/files/file_path_watcher_unittest.cc.orig 2021-09-24 04:25:55 UTC -+++ base/files/file_path_watcher_unittest.cc -@@ -451,12 +451,12 @@ TEST_F(FilePathWatcherTest, WatchDirectory) { - VLOG(1) << "Waiting for file1 creation"; - ASSERT_TRUE(WaitForEvents()); - --#if !defined(OS_APPLE) -+#if !defined(OS_APPLE) && !defined(OS_BSD) - // Mac implementation does not detect files modified in a directory. - ASSERT_TRUE(WriteFile(file1, "content v2")); - VLOG(1) << "Waiting for file1 modification"; - ASSERT_TRUE(WaitForEvents()); --#endif // !OS_APPLE -+#endif // !OS_APPLE && !OS_BSD - - ASSERT_TRUE(base::DeleteFile(file1)); - VLOG(1) << "Waiting for file1 deletion"; -@@ -1031,7 +1031,7 @@ TEST_F(FilePathWatcherTest, InotifyLimitInUpdateRecurs - } - } - --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - enum Permission { - Read, -@@ -1039,7 +1039,7 @@ enum Permission { - Execute - }; - --#if defined(OS_APPLE) -+#if defined(OS_APPLE) || defined(OS_BSD) - bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) { - struct stat stat_buf; - -@@ -1068,9 +1068,9 @@ bool ChangeFilePermissions(const FilePath& path, Permi - } - return chmod(path.value().c_str(), stat_buf.st_mode) == 0; - } --#endif // defined(OS_APPLE) -+#endif // defined(OS_APPLE) || defined(OS_BSD) - --#if defined(OS_APPLE) -+#if defined(OS_APPLE) || defined(OS_BSD) - // Linux implementation of FilePathWatcher doesn't catch attribute changes. - // http://crbug.com/78043 - // Windows implementation of FilePathWatcher catches attribute changes that -@@ -1106,7 +1106,7 @@ TEST_F(FilePathWatcherTest, DirAttributesChanged) { - ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); - } - --#endif // OS_APPLE -+#endif // OS_APPLE || OS_BSD - - #if defined(OS_MAC) - diff --git a/www/chromium/files/patch-base_files_file__util.h b/www/chromium/files/patch-base_files_file__util.h deleted file mode 100644 index de3e4fa1d2fb..000000000000 --- a/www/chromium/files/patch-base_files_file__util.h +++ /dev/null @@ -1,46 +0,0 @@ ---- base/files/file_util.h.orig 2021-09-24 04:25:55 UTC -+++ base/files/file_util.h -@@ -280,14 +280,14 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePat - BASE_EXPORT bool ExecutableExistsInPath(Environment* env, - const FilePath::StringType& executable); - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - // Determine if files under a given |path| can be mapped and then mprotect'd - // PROT_EXEC. This depends on the mount options used for |path|, which vary - // among different Linux distributions and possibly local configuration. It also - // depends on details of kernel--ChromeOS uses the noexec option for /dev/shm - // but its kernel allows mprotect with PROT_EXEC anyway. - BASE_EXPORT bool IsPathExecutable(const FilePath& path); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - - #endif // OS_POSIX - -@@ -610,7 +610,7 @@ BASE_EXPORT bool VerifyPathControlledByAdmin(const bas - // the directory |path|, in the number of FilePath::CharType, or -1 on failure. - BASE_EXPORT int GetMaximumPathComponentLength(const base::FilePath& path); - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - // Broad categories of file systems as returned by statfs() on Linux. - enum FileSystemType { - FILE_SYSTEM_UNKNOWN, // statfs failed. -@@ -657,7 +657,7 @@ BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath - const FilePath& to_path); - #endif // defined(OS_WIN) - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - // CopyFileContentsWithSendfile will use the sendfile(2) syscall to perform a - // file copy without moving the data between kernel and userspace. This is much - // more efficient than sequences of read(2)/write(2) calls. The |retry_slow| -@@ -669,7 +669,7 @@ BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath - BASE_EXPORT bool CopyFileContentsWithSendfile(File& infile, - File& outfile, - bool& retry_slow); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - - // Used by PreReadFile() when no kernel support for prefetching is available. - bool PreReadFileSlow(const FilePath& file_path, int64_t max_bytes); diff --git a/www/chromium/files/patch-base_files_file__util__posix.cc b/www/chromium/files/patch-base_files_file__util__posix.cc index 4f1bee8b12a5..a1831d52549c 100644 --- a/www/chromium/files/patch-base_files_file__util__posix.cc +++ b/www/chromium/files/patch-base_files_file__util__posix.cc @@ -1,142 +1,52 @@ ---- base/files/file_util_posix.cc.orig 2021-09-24 04:25:55 UTC +--- base/files/file_util_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/files/file_util_posix.cc -@@ -23,6 +23,10 @@ - #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) - #include <sys/sendfile.h> - #endif -+#if defined(OS_BSD) -+#include <sys/socket.h> -+#include <sys/uio.h> -+#endif - - #include "base/base_switches.h" - #include "base/bits.h" -@@ -384,7 +388,7 @@ bool CreatePipe(ScopedFD* read_fd, ScopedFD* write_fd, - } - - bool CreateLocalNonBlockingPipe(int fds[2]) { --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0; - #else - int raw_fds[2]; -@@ -937,8 +941,12 @@ bool AllocateFileRegion(File* file, int64_t offset, si - // space. It can fail because the filesystem doesn't support it. In that case, - // use the manual method below. - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) -+#if defined(OS_BSD) -+ if (HANDLE_EINTR(posix_fallocate(file->GetPlatformFile(), offset, size)) != -1) -+#else - if (HANDLE_EINTR(fallocate(file->GetPlatformFile(), 0, offset, size)) != -1) -+#endif - return true; - DPLOG(ERROR) << "fallocate"; - #elif defined(OS_APPLE) -@@ -1113,7 +1121,7 @@ int GetMaximumPathComponentLength(const FilePath& path - #if !defined(OS_ANDROID) - // This is implemented in file_util_android.cc for that platform. - bool GetShmemTempDir(bool executable, FilePath* path) { --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - bool disable_dev_shm = false; - #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS) - disable_dev_shm = CommandLine::ForCurrentProcess()->HasSwitch( -@@ -1129,7 +1137,7 @@ bool GetShmemTempDir(bool executable, FilePath* path) - *path = FilePath("/dev/shm"); - return true; - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - return GetTempDir(path); - } - #endif // !defined(OS_ANDROID) -@@ -1167,7 +1175,7 @@ PrefetchResult PreReadFile(const FilePath& file_path, - // posix_fadvise() is only available in the Android NDK in API 21+. Older - // versions may have the required kernel support, but don't have enough usage - // to justify backporting. --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \ - (defined(OS_ANDROID) && __ANDROID_API__ >= 21) - File file(file_path, File::FLAG_OPEN | File::FLAG_READ); - if (!file.IsValid()) -@@ -1203,7 +1211,7 @@ PrefetchResult PreReadFile(const FilePath& file_path, - return internal::PreReadFileSlow(file_path, max_bytes) - ? PrefetchResult{PrefetchResultCode::kSlowSuccess} - : PrefetchResult{PrefetchResultCode::kSlowFailed}; --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || (defined(OS_ANDROID) && -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || (defined(OS_ANDROID) && - // __ANDROID_API__ >= 21) - } - -@@ -1234,7 +1242,7 @@ bool MoveUnsafe(const FilePath& from_path, const FileP - return true; - } - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - bool CopyFileContentsWithSendfile(File& infile, - File& outfile, - bool& retry_slow) { -@@ -1243,17 +1251,36 @@ bool CopyFileContentsWithSendfile(File& infile, - return false; +@@ -694,32 +694,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p + File::Error* error) { + ScopedBlockingCall scoped_blocking_call( + FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir(). ++ const FilePath kFileSystemRoot("/"); + std::vector<FilePath> subpaths; + + // Collect a list of all parent directories. + FilePath last_path = full_path; +- subpaths.push_back(full_path); ++ if (full_path != kFileSystemRoot) ++ subpaths.push_back(full_path); + for (FilePath path = full_path.DirName(); +- path.value() != last_path.value(); path = path.DirName()) { ++ (path.value() != last_path.value() && ++ (path != kFileSystemRoot)); path = path.DirName()) { + subpaths.push_back(path); + last_path = path; } -+#if defined(OS_BSD) -+ off_t copied = 0; -+ off_t res = 0; -+#else - size_t copied = 0; - ssize_t res = 0; -+#endif - while (file_size - copied > 0) { - // Don't specify an offset and the kernel will begin reading/writing to the - // current file offsets. -+#if defined(OS_BSD) -+ int retv = HANDLE_EINTR(sendfile(infile.GetPlatformFile(), -+ outfile.GetPlatformFile(), -+ copied, -+ file_size - copied, -+ /*hdtr=*/nullptr, -+ &res, -+ 0)); -+ if (retv != 0) { -+ res = -1; -+ break; -+ } -+#else - res = HANDLE_EINTR(sendfile(outfile.GetPlatformFile(), - infile.GetPlatformFile(), /*offset=*/nullptr, - /*length=*/file_size - copied)); - if (res <= 0) { - break; + // Iterate through the parents and create the missing ones. + for (auto i = subpaths.rbegin(); i != subpaths.rend(); ++i) { +- if (DirectoryExists(*i)) +- continue; +- if (mkdir(i->value().c_str(), 0700) == 0) +- continue; +- // Mkdir failed, but it might have failed with EEXIST, or some other error +- // due to the directory appearing out of thin air. This can occur if +- // two processes are trying to create the same file system tree at the same +- // time. Check to see if it exists and make sure it is a directory. +- int saved_errno = errno; +- if (!DirectoryExists(*i)) { +- if (error) +- *error = File::OSErrorToFileError(saved_errno); +- return false; ++ if (!PathExists(*i)) { ++ if ((mkdir(i->value().c_str(), 0700) == -1) && ++ ((full_path != *i) ? (errno != ENOENT) : (-1))) { ++ int saved_errno = errno; ++ if (error) ++ *error = File::OSErrorToFileError(saved_errno); ++ return false; ++ } ++ } else if (!DirectoryExists(*i)) { ++ if (error) ++ *error = File::OSErrorToFileError(ENOTDIR); ++ return false; } -+#endif - - copied += res; } -@@ -1267,13 +1294,13 @@ bool CopyFileContentsWithSendfile(File& infile, - - return res >= 0; - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - - } // namespace internal - - #endif // !defined(OS_NACL_NONSFI) - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - BASE_EXPORT bool IsPathExecutable(const FilePath& path) { - bool result = false; - FilePath tmp_file_path; -@@ -1294,6 +1321,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path - } - return result; - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD) - - } // namespace base + return true; diff --git a/www/chromium/files/patch-base_files_file__util__unittest.cc b/www/chromium/files/patch-base_files_file__util__unittest.cc deleted file mode 100644 index 17631593b4b2..000000000000 --- a/www/chromium/files/patch-base_files_file__util__unittest.cc +++ /dev/null @@ -1,38 +0,0 @@ ---- base/files/file_util_unittest.cc.orig 2021-12-31 00:57:18 UTC -+++ base/files/file_util_unittest.cc -@@ -1640,7 +1640,7 @@ TEST_F(FileUtilTest, DeleteDirRecursiveWithOpenFile) { - #endif - } - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // This test will validate that files which would block when read result in a - // failure on a call to ReadFileToStringNonBlocking. To accomplish this we will - // use a named pipe because it appears as a file on disk and we can control how -@@ -1673,7 +1673,7 @@ TEST_F(FileUtilTest, TestNonBlockingFileReadLinux) { - ASSERT_EQ(result.size(), 1u); - EXPECT_EQ(result[0], 'a'); - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - TEST_F(FileUtilTest, MoveFileNew) { - // Create a file -@@ -3509,7 +3509,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) { - } - #endif // defined(OS_WIN) - --#if defined(OS_POSIX) && !defined(OS_APPLE) -+#if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_BSD) - TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) { - FilePath file_path("/proc/cpuinfo"); - std::string data = "temp"; -@@ -3527,7 +3527,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithProcFileSyste - - EXPECT_FALSE(ReadFileToStringWithMaxSize(file_path, nullptr, 4)); - } --#endif // defined(OS_POSIX) && !defined(OS_APPLE) -+#endif // defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_BSD) - - TEST_F(FileUtilTest, ReadFileToStringWithLargeFile) { - std::string data(kLargeFileSize, 'c'); diff --git a/www/chromium/files/patch-base_files_important__file__writer__cleaner.cc b/www/chromium/files/patch-base_files_important__file__writer__cleaner.cc new file mode 100644 index 000000000000..63a8f084dee3 --- /dev/null +++ b/www/chromium/files/patch-base_files_important__file__writer__cleaner.cc @@ -0,0 +1,12 @@ +--- base/files/important_file_writer_cleaner.cc.orig 2022-02-07 13:39:41 UTC ++++ base/files/important_file_writer_cleaner.cc +@@ -24,7 +24,8 @@ namespace base { + namespace { + + base::Time GetUpperBoundTime() { +-#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_FUCHSIA) ++// needed because of .CreationTime() pledge ++#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_FUCHSIA) || defined(OS_BSD) + // If process creation time is not available then use instance creation + // time as the upper-bound for old files. Modification times may be + // rounded-down to coarse-grained increments, e.g. FAT has 2s granularity, diff --git a/www/chromium/files/patch-base_files_scoped__file.cc b/www/chromium/files/patch-base_files_scoped__file.cc index bcef7a1f0bbd..874e2e3d597a 100644 --- a/www/chromium/files/patch-base_files_scoped__file.cc +++ b/www/chromium/files/patch-base_files_scoped__file.cc @@ -1,11 +1,11 @@ ---- base/files/scoped_file.cc.orig 2021-04-14 18:40:48 UTC +--- base/files/scoped_file.cc.orig 2022-02-07 13:39:41 UTC +++ base/files/scoped_file.cc -@@ -30,7 +30,7 @@ void ScopedFDCloseTraits::Free(int fd) { - // a single open directory would bypass the entire security model. +@@ -31,7 +31,7 @@ void ScopedFDCloseTraits::Free(int fd) { int ret = IGNORE_EINTR(close(fd)); --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || defined(OS_APPLE) || \ - defined(OS_FUCHSIA) || defined(OS_ANDROID) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE) || \ +- defined(OS_FUCHSIA) || defined(OS_ANDROID) ++ defined(OS_FUCHSIA) || defined(OS_ANDROID) || defined(OS_BSD) // NB: Some file descriptors can return errors from close() e.g. network // filesystems such as NFS and Linux input devices. On Linux, macOS, and + // Fuchsia's POSIX layer, errors from close other than EBADF do not indicate diff --git a/www/chromium/files/patch-base_files_scoped__file.h b/www/chromium/files/patch-base_files_scoped__file.h deleted file mode 100644 index 0973e46682f4..000000000000 --- a/www/chromium/files/patch-base_files_scoped__file.h +++ /dev/null @@ -1,43 +0,0 @@ ---- base/files/scoped_file.h.orig 2021-07-28 07:19:23 UTC -+++ base/files/scoped_file.h -@@ -26,7 +26,7 @@ struct BASE_EXPORT ScopedFDCloseTraits : public Scoped - static void Release(const ScopedGeneric<int, ScopedFDCloseTraits>&, int); - }; - #elif defined(OS_POSIX) || defined(OS_FUCHSIA) --#if defined(OS_CHROMEOS) || defined(OS_LINUX) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_BSD) - // On ChromeOS and Linux we guard FD lifetime with a global table and hook into - // libc close() to perform checks. - struct BASE_EXPORT ScopedFDCloseTraits : public ScopedGenericOwnershipTracking { -@@ -37,7 +37,7 @@ struct BASE_EXPORT ScopedFDCloseTraits { - return -1; - } - static void Free(int fd); --#if defined(OS_CHROMEOS) || defined(OS_LINUX) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_BSD) - static void Acquire(const ScopedGeneric<int, ScopedFDCloseTraits>&, int); - static void Release(const ScopedGeneric<int, ScopedFDCloseTraits>&, int); - #endif -@@ -54,7 +54,7 @@ struct ScopedFILECloser { - - } // namespace internal - --#if defined(OS_CHROMEOS) || defined(OS_LINUX) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_BSD) - namespace subtle { - - // Enables or disables enforcement of FD ownership as tracked by ScopedFD -@@ -104,11 +104,11 @@ typedef ScopedGeneric<int, internal::ScopedFDCloseTrai - // Automatically closes |FILE*|s. - typedef std::unique_ptr<FILE, internal::ScopedFILECloser> ScopedFILE; - --#if defined(OS_CHROMEOS) || defined(OS_LINUX) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_BSD) - // Queries the ownership status of an FD, i.e. whether it is currently owned by - // a ScopedFD in the calling process. - bool BASE_EXPORT IsFDOwned(int fd); --#endif // defined(OS_CHROMEOS) || defined(OS_LINUX) -+#endif // defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_BSD) - - } // namespace base - diff --git a/www/chromium/files/patch-base_files_scoped__file__linux.cc b/www/chromium/files/patch-base_files_scoped__file__linux.cc deleted file mode 100644 index 05667175c342..000000000000 --- a/www/chromium/files/patch-base_files_scoped__file__linux.cc +++ /dev/null @@ -1,23 +0,0 @@ ---- base/files/scoped_file_linux.cc.orig 2021-07-28 11:34:50 UTC -+++ base/files/scoped_file_linux.cc -@@ -80,12 +80,20 @@ bool IsFDOwned(int fd) { - - extern "C" { - -+#if defined(OS_FREEBSD) -+int __sys_close(int); -+#else - int __close(int); -+#endif - - __attribute__((visibility("default"), noinline)) int close(int fd) { - if (base::IsFDOwned(fd) && g_is_ownership_enforced) - CrashOnFdOwnershipViolation(); -+#if defined(OS_FREEBSD) -+ return __sys_close(fd); -+#else - return __close(fd); -+#endif - } - - } // extern "C" diff --git a/www/chromium/files/patch-base_i18n_icu__util.cc b/www/chromium/files/patch-base_i18n_icu__util.cc index c7da7bc3c69c..36122feefefa 100644 --- a/www/chromium/files/patch-base_i18n_icu__util.cc +++ b/www/chromium/files/patch-base_i18n_icu__util.cc @@ -1,4 +1,4 @@ ---- base/i18n/icu_util.cc.orig 2021-05-12 22:05:40 UTC +--- base/i18n/icu_util.cc.orig 2022-02-07 13:39:41 UTC +++ base/i18n/icu_util.cc @@ -49,7 +49,7 @@ #include "third_party/icu/source/common/unicode/unistr.h" @@ -9,12 +9,13 @@ ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && !BUILDFLAG(IS_CHROMECAST)) #include "third_party/icu/source/i18n/unicode/timezone.h" #endif -@@ -343,7 +343,7 @@ void InitializeIcuTimeZone() { +@@ -343,7 +343,8 @@ void InitializeIcuTimeZone() { FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization(); icu::TimeZone::adoptDefault( icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id))); -#elif (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !BUILDFLAG(IS_CHROMECAST) -+#elif (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) && !BUILDFLAG(IS_CHROMECAST) ++#elif (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) && \ ++ !BUILDFLAG(IS_CHROMECAST) // To respond to the time zone change properly, the default time zone // cache in ICU has to be populated on starting up. // See TimeZoneMonitorLinux::NotifyClientsFromImpl(). diff --git a/www/chromium/files/patch-base_linux__util.cc b/www/chromium/files/patch-base_linux__util.cc index 5455bc589b4d..853eb881f872 100644 --- a/www/chromium/files/patch-base_linux__util.cc +++ b/www/chromium/files/patch-base_linux__util.cc @@ -1,4 +1,4 @@ ---- base/linux_util.cc.orig 2021-09-14 01:51:47 UTC +--- base/linux_util.cc.orig 2022-02-07 13:39:41 UTC +++ base/linux_util.cc @@ -15,6 +15,7 @@ @@ -8,17 +8,7 @@ #include "base/files/dir_reader_posix.h" #include "base/files/file_util.h" -@@ -78,6 +79,9 @@ class DistroNameGetter { - public: - DistroNameGetter() { - static const char* const kFilesToCheck[] = {"/etc/os-release", -+#if defined(OS_BSD) -+ "/usr/local/etc/os-release", -+#endif - "/usr/lib/os-release"}; - for (const char* file : kFilesToCheck) { - if (ReadDistroFromOSReleaseFile(file)) -@@ -134,6 +138,9 @@ void SetLinuxDistro(const std::string& distro) { +@@ -134,6 +135,9 @@ void SetLinuxDistro(const std::string& distro) { } bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) { @@ -28,7 +18,7 @@ // 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22 char buf[25]; strings::SafeSPrintf(buf, "/proc/%d/task", pid); -@@ -153,6 +160,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t +@@ -153,6 +157,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t } return true; diff --git a/www/chromium/files/patch-base_location__unittest.cc b/www/chromium/files/patch-base_location__unittest.cc deleted file mode 100644 index 9d9b94b7d045..000000000000 --- a/www/chromium/files/patch-base_location__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/location_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/location_unittest.cc -@@ -37,7 +37,7 @@ TEST(LocationTest, CurrentYieldsCorrectValue) { - EXPECT_EQ(here.line_number(), previous_line + 1); - EXPECT_STREQ("TestBody", here.function_name()); - #endif --#elif defined(OFFICIAL_BUILD) -+#elif defined(OFFICIAL_BUILD) && !defined(OS_BSD) - #error Location builtins must be supported in official builds. - #elif BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS) - #error FROM_HERE requires location builtins to be supported. diff --git a/www/chromium/files/patch-base_logging__unittest.cc b/www/chromium/files/patch-base_logging__unittest.cc deleted file mode 100644 index a9cee4ddbae4..000000000000 --- a/www/chromium/files/patch-base_logging__unittest.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- base/logging_unittest.cc.orig 2021-12-31 00:57:18 UTC -+++ base/logging_unittest.cc -@@ -33,7 +33,7 @@ - #include "base/posix/eintr_wrapper.h" - #endif // OS_POSIX - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - #include <ucontext.h> - #endif - -@@ -553,7 +553,7 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo - // need the arch-specific boilerplate below, which is inspired by breakpad. - // At the same time, on OSX, ucontext.h is deprecated but si_addr works fine. - uintptr_t crash_addr = 0; --#if defined(OS_MAC) -+#if defined(OS_MAC) || defined(OS_BSD) - crash_addr = reinterpret_cast<uintptr_t>(info->si_addr); - #else // OS_* - ucontext_t* context = reinterpret_cast<ucontext_t*>(context_ptr); diff --git a/www/chromium/files/patch-base_memory_discardable__memory.cc b/www/chromium/files/patch-base_memory_discardable__memory.cc index b0860eea0c36..136569ca00cd 100644 --- a/www/chromium/files/patch-base_memory_discardable__memory.cc +++ b/www/chromium/files/patch-base_memory_discardable__memory.cc @@ -1,4 +1,4 @@ ---- base/memory/discardable_memory.cc.orig 2021-05-12 22:05:40 UTC +--- base/memory/discardable_memory.cc.orig 2022-02-07 13:39:41 UTC +++ base/memory/discardable_memory.cc @@ -24,7 +24,7 @@ const base::Feature kMadvFreeDiscardableMemory{ "MadvFreeDiscardableMemory", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -9,14 +9,7 @@ const base::Feature kDiscardableMemoryBackingTrial{ "DiscardableMemoryBackingTrial", base::FEATURE_DISABLED_BY_DEFAULT}; -@@ -42,13 +42,13 @@ const base::FeatureParam<DiscardableMemoryTrialGroup> - DiscardableMemoryTrialGroup::kEmulatedSharedMemory, - &kDiscardableMemoryBackingParamOptions}; - --#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - } // namespace features +@@ -48,7 +48,7 @@ const base::FeatureParam<DiscardableMemoryTrialGroup> namespace { @@ -25,12 +18,7 @@ DiscardableMemoryBacking GetBackingForFieldTrial() { DiscardableMemoryTrialGroup trial_group = -@@ -62,11 +62,11 @@ DiscardableMemoryBacking GetBackingForFieldTrial() { - } - NOTREACHED(); - } --#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) +@@ -66,7 +66,7 @@ DiscardableMemoryBacking GetBackingForFieldTrial() { } // namespace @@ -39,15 +27,7 @@ // Probe capabilities of this device to determine whether we should participate // in the discardable memory backing trial. -@@ -88,18 +88,18 @@ DiscardableMemoryTrialGroup GetDiscardableMemoryBackin - DCHECK(DiscardableMemoryBackingFieldTrialIsEnabled()); - return features::kDiscardableMemoryBackingParam.Get(); - } --#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - DiscardableMemory::DiscardableMemory() = default; - +@@ -95,7 +95,7 @@ DiscardableMemory::DiscardableMemory() = default; DiscardableMemory::~DiscardableMemory() = default; DiscardableMemoryBacking GetDiscardableMemoryBacking() { @@ -56,8 +36,3 @@ if (DiscardableMemoryBackingFieldTrialIsEnabled()) { return GetBackingForFieldTrial(); } --#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - #if defined(OS_ANDROID) - if (ashmem_device_is_supported()) diff --git a/www/chromium/files/patch-base_memory_discardable__memory__internal.h b/www/chromium/files/patch-base_memory_discardable__memory__internal.h index aad3103a3e2c..c511cb6b113c 100644 --- a/www/chromium/files/patch-base_memory_discardable__memory__internal.h +++ b/www/chromium/files/patch-base_memory_discardable__memory__internal.h @@ -1,4 +1,4 @@ ---- base/memory/discardable_memory_internal.h.orig 2021-04-14 18:40:48 UTC +--- base/memory/discardable_memory_internal.h.orig 2022-02-07 13:39:41 UTC +++ base/memory/discardable_memory_internal.h @@ -10,7 +10,7 @@ #include "base/metrics/field_trial_params.h" @@ -9,11 +9,3 @@ namespace base { -@@ -47,6 +47,6 @@ GetDiscardableMemoryBackingFieldTrialGroup(); - - } // namespace base - --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - - #endif // BASE_MEMORY_DISCARDABLE_MEMORY_INTERNAL_H_ diff --git a/www/chromium/files/patch-base_memory_madv__free__discardable__memory__posix.cc b/www/chromium/files/patch-base_memory_madv__free__discardable__memory__posix.cc index 7d915032033f..51230808b76b 100644 --- a/www/chromium/files/patch-base_memory_madv__free__discardable__memory__posix.cc +++ b/www/chromium/files/patch-base_memory_madv__free__discardable__memory__posix.cc @@ -1,11 +1,21 @@ ---- base/memory/madv_free_discardable_memory_posix.cc.orig 2021-04-14 18:40:48 UTC +--- base/memory/madv_free_discardable_memory_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/memory/madv_free_discardable_memory_posix.cc -@@ -292,7 +292,7 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT +@@ -292,6 +292,10 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT bool MadvFreeDiscardableMemoryPosix::IsResident() const { DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_); --#if defined(OS_APPLE) -+#if defined(OS_APPLE) || defined(OS_BSD) ++// XXX mincore ++#if defined(OS_BSD) ++ return false; ++#else + #if defined(OS_APPLE) std::vector<char> vec(allocated_pages_); #else - std::vector<unsigned char> vec(allocated_pages_); +@@ -307,6 +311,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() cons + return false; + } + return true; ++#endif + } + + bool MadvFreeDiscardableMemoryPosix::IsDiscarded() const { diff --git a/www/chromium/files/patch-base_memory_platform__shared__memory__region__posix.cc b/www/chromium/files/patch-base_memory_platform__shared__memory__region__posix.cc index ac2e0f6b2691..a35c8d880061 100644 --- a/www/chromium/files/patch-base_memory_platform__shared__memory__region__posix.cc +++ b/www/chromium/files/patch-base_memory_platform__shared__memory__region__posix.cc @@ -1,18 +1,6 @@ ---- base/memory/platform_shared_memory_region_posix.cc.orig 2022-01-20 10:35:46 UTC +--- base/memory/platform_shared_memory_region_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/memory/platform_shared_memory_region_posix.cc -@@ -23,7 +23,11 @@ struct ScopedPathUnlinkerTraits { - static const FilePath* InvalidValue() { return nullptr; } - - static void Free(const FilePath* path) { -+#if defined(OS_BSD) -+ if (shm_unlink(path->value().c_str())) -+#else - if (unlink(path->value().c_str())) -+#endif - PLOG(WARNING) << "unlink"; - } - }; -@@ -70,7 +74,7 @@ FDPair ScopedFDPair::get() const { +@@ -70,7 +70,7 @@ FDPair ScopedFDPair::get() const { return {fd.get(), readonly_fd.get()}; } @@ -21,16 +9,7 @@ // static ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) { PlatformSharedMemoryRegion region = -@@ -79,7 +83,7 @@ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion: - return region.PassPlatformHandle().fd; - return ScopedFD(); - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - // static - PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Take( -@@ -204,7 +208,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o +@@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o // static PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode, size_t size @@ -39,7 +18,7 @@ , bool executable #endif -@@ -233,7 +237,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: +@@ -233,7 +233,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: // flag. FilePath directory; if (!GetShmemTempDir( @@ -48,62 +27,3 @@ executable, #else false /* executable */, -@@ -242,6 +246,22 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: - return {}; - } - -+#if defined(OS_BSD) -+ UnguessableToken token = UnguessableToken::Create(); -+ FilePath path = directory.Append(token.ToString()); -+ ScopedFD fd{HANDLE_EINTR(shm_open(path.value().c_str(), O_CREAT | O_RDWR, 0700))}; -+ File shm_file(fd.release()); -+ -+ if (!shm_file.IsValid()) { -+ PLOG(ERROR) << "Creating shared memory failed"; -+ return {}; -+ } -+ -+ if (HANDLE_EINTR(ftruncate(shm_file.GetPlatformFile(), size)) == -1) { -+ PLOG(ERROR) << "Failed to extend shared memory object to size " << size; -+ return {}; -+ } -+#else - FilePath path; - ScopedFD fd = CreateAndOpenFdForTemporaryFileInDir(directory, &path); - File shm_file(fd.release()); -@@ -258,6 +278,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: - } - return {}; - } -+#endif // OS_BSD - - // Deleting the file prevents anyone else from mapping it in (making it - // private), and prevents the need for cleanup (once the last fd is -@@ -267,7 +288,11 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: - ScopedFD readonly_fd; - if (mode == Mode::kWritable) { - // Also open as readonly so that we can ConvertToReadOnly(). -+#if defined(OS_BSD) -+ readonly_fd.reset(HANDLE_EINTR(shm_open(path.value().c_str(), O_RDONLY, 0400))); -+#else - readonly_fd.reset(HANDLE_EINTR(open(path.value().c_str(), O_RDONLY))); -+#endif - if (!readonly_fd.is_valid()) { - DPLOG(ERROR) << "open(\"" << path.value() << "\", O_RDONLY) failed"; - return {}; -@@ -298,9 +323,15 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion: - } - } - -+#if defined(OS_BSD) - return PlatformSharedMemoryRegion( - {ScopedFD(shm_file.TakePlatformFile()), std::move(readonly_fd)}, mode, -+ size, token); -+#else -+ return PlatformSharedMemoryRegion( -+ {ScopedFD(shm_file.TakePlatformFile()), std::move(readonly_fd)}, mode, - size, UnguessableToken::Create()); -+#endif // OS_BSD - #endif // !defined(OS_NACL) - } - diff --git a/www/chromium/files/patch-base_memory_shared__memory__region__unittest.cc b/www/chromium/files/patch-base_memory_shared__memory__region__unittest.cc deleted file mode 100644 index 184ac299c806..000000000000 --- a/www/chromium/files/patch-base_memory_shared__memory__region__unittest.cc +++ /dev/null @@ -1,16 +0,0 @@ ---- base/memory/shared_memory_region_unittest.cc.orig 2021-04-14 18:40:48 UTC -+++ base/memory/shared_memory_region_unittest.cc -@@ -188,10 +188,13 @@ TYPED_TEST(SharedMemoryRegionTest, MapAtNotAlignedOffs - std::tie(region, rw_mapping) = CreateMappedRegion<TypeParam>(kDataSize); - ASSERT_TRUE(region.IsValid()); - ASSERT_TRUE(rw_mapping.IsValid()); -+#if !defined(OS_BSD) -+ // On FreeBSD, mmap() does not require an aligned offset - off_t offset = kDataSize / 2; - typename TypeParam::MappingType mapping = - region.MapAt(offset, kDataSize - offset); - EXPECT_FALSE(mapping.IsValid()); -+#endif - } - - TYPED_TEST(SharedMemoryRegionTest, MapZeroBytesFails) { diff --git a/www/chromium/files/patch-base_native__library__unittest.cc b/www/chromium/files/patch-base_native__library__unittest.cc deleted file mode 100644 index 58952dbd6b3a..000000000000 --- a/www/chromium/files/patch-base_native__library__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/native_library_unittest.cc.orig 2021-04-14 18:40:48 UTC -+++ base/native_library_unittest.cc -@@ -118,7 +118,7 @@ TEST(NativeLibraryTest, LoadLibrary) { - // Android dlopen() requires further investigation, as it might vary across - // versions with respect to symbol resolution scope. - // TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255 --#if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) && \ -+#if !defined(OS_ANDROID) && !defined(OS_BSD) && !defined(THREAD_SANITIZER) && \ - !defined(MEMORY_SANITIZER) - - // Verifies that the |prefer_own_symbols| option satisfies its guarantee that diff --git a/www/chromium/files/patch-base_numerics_safe__math__shared__impl.h b/www/chromium/files/patch-base_numerics_safe__math__shared__impl.h deleted file mode 100644 index 4a3d6cc92eb5..000000000000 --- a/www/chromium/files/patch-base_numerics_safe__math__shared__impl.h +++ /dev/null @@ -1,12 +0,0 @@ ---- base/numerics/safe_math_shared_impl.h.orig 2021-04-14 18:40:48 UTC -+++ base/numerics/safe_math_shared_impl.h -@@ -24,8 +24,7 @@ - // Where available use builtin math overflow support on Clang and GCC. - #elif !defined(__native_client__) && \ - ((defined(__clang__) && \ -- ((__clang_major__ > 3) || \ -- (__clang_major__ == 3 && __clang_minor__ >= 4))) || \ -+ (__clang_major__ > 6)) || \ - (defined(__GNUC__) && __GNUC__ >= 5)) - #include "base/numerics/safe_math_clang_gcc_impl.h" - #define BASE_HAS_OPTIMIZED_SAFE_MATH (1) diff --git a/www/chromium/files/patch-base_path__service__unittest.cc b/www/chromium/files/patch-base_path__service__unittest.cc deleted file mode 100644 index 3bf8f3f4cc0f..000000000000 --- a/www/chromium/files/patch-base_path__service__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/path_service_unittest.cc.orig 2021-12-31 00:57:18 UTC -+++ base/path_service_unittest.cc -@@ -46,7 +46,7 @@ bool ReturnsValidPath(int key) { - if (key == DIR_CACHE) - check_path_exists = false; - #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // On the linux try-bots: a path is returned (e.g. /home/chrome-bot/Desktop), - // but it doesn't exist. - if (key == DIR_USER_DESKTOP) diff --git a/www/chromium/files/patch-base_posix_can__lower__nice__to.cc b/www/chromium/files/patch-base_posix_can__lower__nice__to.cc index 9ffbb4524a4d..43b20c5e8988 100644 --- a/www/chromium/files/patch-base_posix_can__lower__nice__to.cc +++ b/www/chromium/files/patch-base_posix_can__lower__nice__to.cc @@ -1,20 +1,16 @@ ---- base/posix/can_lower_nice_to.cc.orig 2021-04-14 18:40:48 UTC +--- base/posix/can_lower_nice_to.cc.orig 2022-02-07 13:39:41 UTC +++ base/posix/can_lower_nice_to.cc -@@ -31,6 +31,9 @@ bool CanLowerNiceTo(int nice_value) { - if (geteuid() == 0) - return true; +@@ -11,8 +11,12 @@ -+#if defined(OS_BSD) -+ return false; -+#else - // 2. Skip checking the CAP_SYS_NICE permission because it would require - // libcap.so. + #include "build/build_config.h" -@@ -54,6 +57,7 @@ bool CanLowerNiceTo(int nice_value) { - // And lowering niceness to |nice_value| is allowed if it is greater than or - // equal to the limit: - return nice_value >= lowest_nice_allowed; ++#if defined(OS_FREEBSD) ++#include <sys/param.h> +#endif - } - - } // namespace internal ++ + // Not defined on AIX by default. +-#if defined(OS_AIX) ++#if defined(OS_AIX) || defined(OS_BSD) + #if defined(RLIMIT_NICE) + #error Assumption about OS_AIX is incorrect + #endif diff --git a/www/chromium/files/patch-base_posix_unix__domain__socket.cc b/www/chromium/files/patch-base_posix_unix__domain__socket.cc index 7064cdc080f5..db441a342cef 100644 --- a/www/chromium/files/patch-base_posix_unix__domain__socket.cc +++ b/www/chromium/files/patch-base_posix_unix__domain__socket.cc @@ -1,49 +1,39 @@ ---- base/posix/unix_domain_socket.cc.orig 2021-09-14 01:51:47 UTC +--- base/posix/unix_domain_socket.cc.orig 2022-02-07 13:39:41 UTC +++ base/posix/unix_domain_socket.cc -@@ -5,7 +5,10 @@ - #include "base/posix/unix_domain_socket.h" +@@ -50,7 +50,7 @@ bool CreateSocketPair(ScopedFD* one, ScopedFD* two) { - #include <errno.h> -+#include <sys/param.h> - #include <sys/socket.h> -+#include <sys/types.h> -+#include <sys/ucred.h> - #if !defined(OS_NACL_NONSFI) - #include <sys/un.h> - #endif -@@ -28,6 +31,14 @@ namespace base { + // static + bool UnixDomainSocket::EnableReceiveProcessId(int fd) { +-#if !defined(OS_APPLE) ++#if !defined(OS_APPLE) && !defined(OS_BSD) + const int enable = 1; + return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0; + #else +@@ -140,7 +140,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, - const size_t UnixDomainSocket::kMaxFileDescriptors = 16; - -+#ifndef SCM_CREDENTIALS -+# define SCM_CREDENTIALS 0x9001 -+#endif -+ -+#ifndef SO_PASSCRED -+# define SO_PASSCRED 0x9002 -+#endif -+ - #if !defined(OS_NACL_NONSFI) - bool CreateSocketPair(ScopedFD* one, ScopedFD* two) { - int raw_socks[2]; -@@ -150,7 +161,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, - #if !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) - // The PNaCl toolchain for Non-SFI binary build and macOS do not support - // ucred. macOS supports xucred, but this structure is insufficient. -- + CMSG_SPACE(sizeof(struct ucred)) -+ + CMSG_SPACE(sizeof(struct cmsgcred)) - #endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) - ; - char control_buffer[kControlBufferSize]; -@@ -180,9 +191,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, - // SCM_CREDENTIALS. + const size_t kControlBufferSize = + CMSG_SPACE(sizeof(int) * kMaxFileDescriptors) +-#if !defined(OS_APPLE) ++#if !defined(OS_APPLE) && !defined(OS_BSD) + // macOS does not support ucred. + // macOS supports xucred, but this structure is insufficient. + + CMSG_SPACE(sizeof(struct ucred)) +@@ -168,7 +168,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, + wire_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg)); + wire_fds_len = payload_len / sizeof(int); + } +-#if !defined(OS_APPLE) ++#if !defined(OS_APPLE) && !defined(OS_BSD) + // macOS does not support SCM_CREDENTIALS. if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS) { -- DCHECK_EQ(payload_len, sizeof(struct ucred)); -+ DCHECK_EQ(payload_len, sizeof(struct cmsgcred)); - DCHECK_EQ(pid, -1); -- pid = reinterpret_cast<struct ucred*>(CMSG_DATA(cmsg))->pid; -+ pid = getpid(); - } - #endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) - } +@@ -202,6 +202,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, + socklen_t pid_size = sizeof(pid); + if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size) != 0) + pid = -1; ++#elif defined(OS_BSD) ++ NOTIMPLEMENTED(); ++ pid = -1; + #else + // |pid| will legitimately be -1 if we read EOF, so only DCHECK if we + // actually received a message. Unfortunately, Linux allows sending zero diff --git a/www/chromium/files/patch-base_posix_unix__domain__socket__unittest.cc b/www/chromium/files/patch-base_posix_unix__domain__socket__unittest.cc deleted file mode 100644 index 47dce76652a8..000000000000 --- a/www/chromium/files/patch-base_posix_unix__domain__socket__unittest.cc +++ /dev/null @@ -1,12 +0,0 @@ ---- base/posix/unix_domain_socket_unittest.cc.orig 2021-04-14 18:40:48 UTC -+++ base/posix/unix_domain_socket_unittest.cc -@@ -8,6 +8,9 @@ - #include <stdint.h> - #include <sys/socket.h> - #include <sys/types.h> -+#if defined(OS_BSD) -+#include <signal.h> -+#endif - #include <unistd.h> - - #include "base/bind.h" diff --git a/www/chromium/files/patch-base_process_internal__linux.cc b/www/chromium/files/patch-base_process_internal__linux.cc deleted file mode 100644 index d0dba67d9274..000000000000 --- a/www/chromium/files/patch-base_process_internal__linux.cc +++ /dev/null @@ -1,97 +0,0 @@ ---- base/process/internal_linux.cc.orig 2021-04-14 18:40:48 UTC -+++ base/process/internal_linux.cc -@@ -30,7 +30,11 @@ namespace internal { - - const char kProcDir[] = "/proc"; - -+#if defined(OS_BSD) -+const char kStatFile[] = "status"; -+#else - const char kStatFile[] = "stat"; -+#endif - - FilePath GetProcPidDir(pid_t pid) { - return FilePath(kProcDir).Append(NumberToString(pid)); -@@ -66,6 +70,7 @@ bool ReadProcFile(const FilePath& file, std::string* b - DLOG(WARNING) << "Failed to read " << file.MaybeAsASCII(); - return false; - } -+ - return !buffer->empty(); - } - -@@ -81,6 +86,22 @@ bool ParseProcStats(const std::string& stats_data, - if (stats_data.empty()) - return false; - -+#if defined(OS_BSD) -+ proc_stats->clear(); -+ -+ std::vector<std::string> other_stats = SplitString( -+ stats_data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); -+ -+ for (const auto& i : other_stats) { -+ auto pos = i.find(','); -+ -+ if (pos == std::string::npos) { -+ proc_stats->push_back(i); -+ } else { -+ proc_stats->push_back(i.substr(0, pos)); -+ } -+ } -+#else - // The stat file is formatted as: - // pid (process name) data1 data2 .... dataN - // Look for the closing paren by scanning backwards, to avoid being fooled by -@@ -110,6 +131,7 @@ bool ParseProcStats(const std::string& stats_data, - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - for (const auto& i : other_stats) - proc_stats->push_back(i); -+#endif - return true; - } - -@@ -157,7 +179,11 @@ int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, Pro - } - - int64_t ReadProcSelfStatsAndGetFieldAsInt64(ProcStatsFields field_num) { -+#if defined(OS_BSD) -+ FilePath stat_file = FilePath(kProcDir).Append("curproc").Append(kStatFile); -+#else - FilePath stat_file = FilePath(kProcDir).Append("self").Append(kStatFile); -+#endif - return ReadStatFileAndGetFieldAsInt64(stat_file, field_num); - } - -@@ -173,6 +199,9 @@ size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, - } - - Time GetBootTime() { -+#if defined(OS_BSD) -+ return Time(); -+#else - FilePath path("/proc/stat"); - std::string contents; - if (!ReadProcFile(path, &contents)) -@@ -186,9 +215,13 @@ Time GetBootTime() { - if (!StringToInt(btime_it->second, &btime)) - return Time(); - return Time::FromTimeT(btime); -+#endif - } - - TimeDelta GetUserCpuTimeSinceBoot() { -+#if defined(OS_BSD) -+ return TimeDelta(); -+#else - FilePath path("/proc/stat"); - std::string contents; - if (!ReadProcFile(path, &contents)) -@@ -212,6 +245,7 @@ TimeDelta GetUserCpuTimeSinceBoot() { - return TimeDelta(); - - return ClockTicksToTimeDelta(user + nice); -+#endif - } - - TimeDelta ClockTicksToTimeDelta(int clock_ticks) { diff --git a/www/chromium/files/patch-base_process_internal__linux.h b/www/chromium/files/patch-base_process_internal__linux.h deleted file mode 100644 index 4f5d3719e412..000000000000 --- a/www/chromium/files/patch-base_process_internal__linux.h +++ /dev/null @@ -1,34 +0,0 @@ ---- base/process/internal_linux.h.orig 2021-12-14 11:44:55 UTC -+++ base/process/internal_linux.h -@@ -20,6 +20,8 @@ - #include "base/strings/string_number_conversions.h" - #include "base/threading/platform_thread.h" - -+#include <unistd.h> /* pid_t */ -+ - namespace base { - - class Time; -@@ -61,6 +63,14 @@ bool ParseProcStats(const std::string& stats_data, - // If the ordering ever changes, carefully review functions that use these - // values. - enum ProcStatsFields { -+#if defined(OS_BSD) -+ VM_COMM = 0, // Command name. -+ VM_PPID = 2, // Parent process id. -+ VM_PGRP = 3, // Process group id. -+ VM_STARTTIME = 7, // The process start time. -+ VM_UTIME = 8, // The user time. -+ VM_STIME = 9, // The system time -+#else - VM_COMM = 1, // Filename of executable, without parentheses. - VM_STATE = 2, // Letter indicating the state of the process. - VM_PPID = 3, // PID of the parent. -@@ -73,6 +83,7 @@ enum ProcStatsFields { - VM_STARTTIME = 21, // The time the process started in clock ticks. - VM_VSIZE = 22, // Virtual memory size in bytes. - VM_RSS = 23, // Resident Set Size in pages. -+#endif - }; - - // Reads the |field_num|th field from |proc_stats|. Returns 0 on failure. diff --git a/www/chromium/files/patch-base_process_kill.h b/www/chromium/files/patch-base_process_kill.h index b135b44d2e28..d74a364d078e 100644 --- a/www/chromium/files/patch-base_process_kill.h +++ b/www/chromium/files/patch-base_process_kill.h @@ -1,6 +1,6 @@ ---- base/process/kill.h.orig 2021-04-14 18:40:48 UTC +--- base/process/kill.h.orig 2022-02-07 13:39:41 UTC +++ base/process/kill.h -@@ -113,11 +113,11 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro +@@ -112,7 +112,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus( ProcessHandle handle, int* exit_code); @@ -9,8 +9,3 @@ // Spawns a thread to wait asynchronously for the child |process| to exit // and then reaps it. BASE_EXPORT void EnsureProcessGetsReaped(Process process); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #endif // defined(OS_POSIX) - - // Registers |process| to be asynchronously monitored for termination, forcibly diff --git a/www/chromium/files/patch-base_process_kill__posix.cc b/www/chromium/files/patch-base_process_kill__posix.cc index 23719e51bb67..1fc27331b044 100644 --- a/www/chromium/files/patch-base_process_kill__posix.cc +++ b/www/chromium/files/patch-base_process_kill__posix.cc @@ -1,6 +1,6 @@ ---- base/process/kill_posix.cc.orig 2021-12-14 11:44:55 UTC +--- base/process/kill_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/process/kill_posix.cc -@@ -162,7 +162,7 @@ void EnsureProcessTerminated(Process process) { +@@ -159,7 +159,7 @@ void EnsureProcessTerminated(Process process) { 0, new BackgroundReaper(std::move(process), Seconds(2))); } @@ -9,12 +9,3 @@ void EnsureProcessGetsReaped(Process process) { DCHECK(!process.is_current()); -@@ -173,7 +173,7 @@ void EnsureProcessGetsReaped(Process process) { - PlatformThread::CreateNonJoinable( - 0, new BackgroundReaper(std::move(process), TimeDelta())); - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - #endif // !defined(OS_APPLE) - #endif // !defined(OS_NACL_NONSFI) diff --git a/www/chromium/files/patch-base_process_launch.cc b/www/chromium/files/patch-base_process_launch.cc deleted file mode 100644 index 59944e45465b..000000000000 --- a/www/chromium/files/patch-base_process_launch.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/process/launch.cc.orig 2021-04-14 18:40:48 UTC -+++ base/process/launch.cc -@@ -15,7 +15,7 @@ LaunchOptions::~LaunchOptions() = default; - - LaunchOptions LaunchOptionsForTest() { - LaunchOptions options; --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // To prevent accidental privilege sharing to an untrusted child, processes - // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this - // new child will be used for testing only. diff --git a/www/chromium/files/patch-base_process_launch.h b/www/chromium/files/patch-base_process_launch.h index 0c41c6fe1c3e..0fe8b6553511 100644 --- a/www/chromium/files/patch-base_process_launch.h +++ b/www/chromium/files/patch-base_process_launch.h @@ -1,4 +1,4 @@ ---- base/process/launch.h.orig 2021-12-14 11:44:55 UTC +--- base/process/launch.h.orig 2022-02-07 13:39:41 UTC +++ base/process/launch.h @@ -192,7 +192,7 @@ struct BASE_EXPORT LaunchOptions { bool clear_environment = false; @@ -9,21 +9,3 @@ // If non-zero, start the process using clone(), using flags as provided. // Unlike in clone, clone_flags may not contain a custom termination signal // that is sent to the parent when the child dies. The termination signal will -@@ -205,7 +205,7 @@ struct BASE_EXPORT LaunchOptions { - - // Sets parent process death signal to SIGKILL. - bool kill_on_parent_death = false; --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - #if defined(OS_MAC) - // Mach ports that will be accessible to the child process. These are not -@@ -417,7 +417,7 @@ BASE_EXPORT void RaiseProcessToHighPriority(); - // binary. This should not be called in production/released code. - BASE_EXPORT LaunchOptions LaunchOptionsForTest(); - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) || defined(OS_BSD) - // A wrapper for clone with fork-like behavior, meaning that it returns the - // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are - // as in the clone system call (the CLONE_VM flag is not supported). diff --git a/www/chromium/files/patch-base_process_launch__posix.cc b/www/chromium/files/patch-base_process_launch__posix.cc index 4c7abac588b3..7e4f92b48eb9 100644 --- a/www/chromium/files/patch-base_process_launch__posix.cc +++ b/www/chromium/files/patch-base_process_launch__posix.cc @@ -1,115 +1,12 @@ ---- base/process/launch_posix.cc.orig 2021-09-24 04:25:55 UTC +--- base/process/launch_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/process/launch_posix.cc -@@ -58,12 +58,14 @@ - #if defined(OS_FREEBSD) - #include <sys/event.h> - #include <sys/ucontext.h> -+#include <sys/procctl.h> - #endif - - #if defined(OS_APPLE) +@@ -64,6 +64,9 @@ #error "macOS should use launch_mac.cc" #endif ++#if defined(OS_FREEBSD) +#pragma weak environ ++#endif extern char** environ; namespace base { -@@ -183,7 +185,7 @@ void ResetChildSignalHandlersToDefaults(void) { - #endif // !defined(NDEBUG) - } - } --#endif // !defined(OS_LINUX) || -+#endif // (!defined(OS_LINUX) && !defined(OS_BSD)) || - // (!defined(__i386__) && !defined(__x86_64__) && !defined(__arm__)) - } // anonymous namespace - -@@ -220,6 +222,28 @@ void CloseSuperfluousFds(const base::InjectiveMultimap - DirReaderPosix fd_dir(kFDDir); - if (!fd_dir.IsValid()) { - // Fallback case: Try every possible fd. -+ -+#if defined(OS_FREEBSD) -+ // CEM: blast away most of the range with closefrom(). A common use case -+ // of this function only maps STDIN/STDOUT/STDERR and closefrom(3) is much -+ // cheaper than x00,000 close(2) invocations with a high RLIMIT_NOFILE. -+ // -+ // In the other caller, it is still very likely that the fds we care about -+ // are in relatively low number space and we can save hundreds of thousands -+ // of syscalls. -+ int max_valid_fd = -1; -+ for (size_t j = 0; j < saved_mapping.size(); j++) { -+ int fd = saved_mapping[j].dest; -+ if (fd > max_valid_fd) -+ max_valid_fd = fd; -+ } -+ if (max_valid_fd < STDERR_FILENO) -+ max_valid_fd = STDERR_FILENO; -+ -+ closefrom(max_valid_fd + 1); -+ max_fds = static_cast<size_t>(max_valid_fd) + 1; -+#endif -+ - for (size_t i = 0; i < max_fds; ++i) { - const int fd = static_cast<int>(i); - if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO) -@@ -358,7 +382,7 @@ Process LaunchProcess(const std::vector<std::string>& - // might do things like block waiting for threads that don't even exist - // in the child. - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // See comments on the ResetFDOwnership() declaration in - // base/files/scoped_file.h regarding why this is called early here. - subtle::ResetFDOwnership(); -@@ -451,22 +475,32 @@ Process LaunchProcess(const std::vector<std::string>& - - // Set NO_NEW_PRIVS by default. Since NO_NEW_PRIVS only exists in kernel - // 3.5+, do not check the return value of prctl here. --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_FREEBSD) - #ifndef PR_SET_NO_NEW_PRIVS - #define PR_SET_NO_NEW_PRIVS 38 - #endif -+#if !defined(OS_FREEBSD) - if (!options.allow_new_privs) { - if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) && errno != EINVAL) { - // Only log if the error is not EINVAL (i.e. not supported). - RAW_LOG(FATAL, "prctl(PR_SET_NO_NEW_PRIVS) failed"); - } - } -+#endif - - if (options.kill_on_parent_death) { -+#if defined(OS_FREEBSD) -+ int procctl_value = SIGKILL; -+ if (procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &procctl_value)) { -+ RAW_LOG(ERROR, "procctl(PROC_PDEATHSIG_CTL) failed"); -+ _exit(127); -+ } -+#else - if (prctl(PR_SET_PDEATHSIG, SIGKILL) != 0) { - RAW_LOG(ERROR, "prctl(PR_SET_PDEATHSIG) failed"); - _exit(127); - } -+#endif - } - #endif - -@@ -558,7 +592,7 @@ static bool GetAppOutputInternal( - // DANGER: no calls to malloc or locks are allowed from now on: - // http://crbug.com/36678 - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // See comments on the ResetFDOwnership() declaration in - // base/files/scoped_file.h regarding why this is called early here. - subtle::ResetFDOwnership(); -@@ -750,6 +784,6 @@ pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, - - return 0; - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) || defined(OS_BSD) - - } // namespace base diff --git a/www/chromium/files/patch-base_process_memory.cc b/www/chromium/files/patch-base_process_memory.cc index 591fc6ec350c..67b524cc8e85 100644 --- a/www/chromium/files/patch-base_process_memory.cc +++ b/www/chromium/files/patch-base_process_memory.cc @@ -1,6 +1,15 @@ ---- base/process/memory.cc.orig 2021-09-14 01:51:47 UTC +--- base/process/memory.cc.orig 2022-02-07 13:39:41 UTC +++ base/process/memory.cc -@@ -70,7 +70,7 @@ void TerminateBecauseOutOfMemory(size_t size) { +@@ -63,14 +63,16 @@ NOINLINE void OnNoMemoryInternal(size_t size) { + + } // namespace internal + ++#if !defined(OS_BSD) + void TerminateBecauseOutOfMemory(size_t size) { + internal::OnNoMemoryInternal(size); + } ++#endif + // Defined in memory_mac.mm for macOS + use_allocator="none". In case of // USE_PARTITION_ALLOC_AS_MALLOC, no need to route the call to the system // default calloc of macOS. diff --git a/www/chromium/files/patch-base_process_memory.h b/www/chromium/files/patch-base_process_memory.h deleted file mode 100644 index ecbfa05d7fa1..000000000000 --- a/www/chromium/files/patch-base_process_memory.h +++ /dev/null @@ -1,11 +0,0 @@ ---- base/process/memory.h.orig 2021-07-19 18:45:05 UTC -+++ base/process/memory.h -@@ -32,7 +32,7 @@ BASE_EXPORT void TerminateBecauseOutOfMemory(size_t si - // TODO: this can be removed when Breakpad is no longer supported. - BASE_EXPORT extern size_t g_oom_size; - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) - // The maximum allowed value for the OOM score. - const int kMaxOomScore = 1000; diff --git a/www/chromium/files/patch-base_process_memory__stubs.cc b/www/chromium/files/patch-base_process_memory__stubs.cc deleted file mode 100644 index 80ef5e08c505..000000000000 --- a/www/chromium/files/patch-base_process_memory__stubs.cc +++ /dev/null @@ -1,14 +0,0 @@ ---- base/process/memory_stubs.cc.orig 2021-04-22 13:13:03 UTC -+++ base/process/memory_stubs.cc -@@ -19,9 +19,11 @@ bool AdjustOOMScore(ProcessId process, int score) { - return false; - } - -+#if !defined(OS_BSD) - void TerminateBecauseOutOfMemory(size_t size) { - abort(); - } -+#endif - - // UncheckedMalloc and Calloc exist so that platforms making use of - // EnableTerminationOnOutOfMemory have a way to allocate memory without diff --git a/www/chromium/files/patch-base_process_memory__unittest.cc b/www/chromium/files/patch-base_process_memory__unittest.cc deleted file mode 100644 index 3b2bc7a8d784..000000000000 --- a/www/chromium/files/patch-base_process_memory__unittest.cc +++ /dev/null @@ -1,67 +0,0 @@ ---- base/process/memory_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/process/memory_unittest.cc -@@ -38,6 +38,8 @@ - #if defined(OS_LINUX) || defined(OS_CHROMEOS) - #include <malloc.h> - #include "base/test/malloc_wrapper.h" -+#elif defined(OS_BSD) -+#include "base/test/malloc_wrapper.h" - #endif - #if defined(OS_ANDROID) - #include "base/android/build_info.h" -@@ -113,9 +115,9 @@ TEST(MemoryTest, AllocatorShimWorking) { - #endif - } - --// OpenBSD does not support these tests. Don't test these on ASan/TSan/MSan -+// BSD does not support these tests. Don't test these on ASan/TSan/MSan - // configurations: only test the real allocator. --#if !defined(OS_OPENBSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \ -+#if !defined(OS_BSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \ - !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) - - namespace { -@@ -338,7 +340,7 @@ TEST_F(OutOfMemoryDeathTest, SecurityAlignedRealloc) { - #endif // defined(OS_WIN) - #endif // !defined(OS_MAC) && !defined(OS_ANDROID) - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - TEST_F(OutOfMemoryDeathTest, Valloc) { - ASSERT_OOM_DEATH({ -@@ -384,7 +386,7 @@ TEST_F(OutOfMemoryDeathTest, ViaSharedLibraries) { - value_ = MallocWrapper(test_size_); - }); - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - // Android doesn't implement posix_memalign(). - #if defined(OS_POSIX) && !defined(OS_ANDROID) -@@ -535,7 +537,7 @@ TEST_F(OutOfMemoryTest, TerminateBecauseOutOfMemoryRep - #endif // OS_WIN - - #if defined(ARCH_CPU_32_BITS) && \ -- (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS)) -+ (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) - - void TestAllocationsReleaseReservation(void* (*alloc_fn)(size_t), - void (*free_fn)(void*)) { -@@ -593,7 +595,7 @@ TEST_F(OutOfMemoryHandledTest, NewReleasesReservation) - [](size_t size) { return static_cast<void*>(new char[size]); }, - [](void* ptr) { delete[] static_cast<char*>(ptr); }); - } --#endif // defined(ARCH_CPU_32_BITS) && (defined(OS_WIN) || defined(OS_LINUX) || -+#endif // defined(ARCH_CPU_32_BITS) && (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_BSD) || - // defined(OS_CHROMEOS)) - - #if defined(OS_ANDROID) || defined(OS_FUCHSIA) -@@ -654,7 +656,6 @@ TEST_F(OutOfMemoryHandledTest, UncheckedCalloc) { - EXPECT_EQ(0, bytes[i]); - free(value_); - -- EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); - EXPECT_TRUE(value_ == nullptr); - } - diff --git a/www/chromium/files/patch-base_process_process__handle__openbsd.cc b/www/chromium/files/patch-base_process_process__handle__openbsd.cc new file mode 100644 index 000000000000..f176993b81b2 --- /dev/null +++ b/www/chromium/files/patch-base_process_process__handle__openbsd.cc @@ -0,0 +1,89 @@ +--- base/process/process_handle_openbsd.cc.orig 2022-02-07 13:39:41 UTC ++++ base/process/process_handle_openbsd.cc +@@ -3,8 +3,11 @@ + // found in the LICENSE file. + + #include "base/process/process_handle.h" ++#include "base/files/file_util.h" + + #include <stddef.h> ++#include <sys/param.h> ++#include <sys/proc.h> + #include <sys/sysctl.h> + #include <sys/types.h> + #include <unistd.h> +@@ -14,39 +17,59 @@ + namespace base { + + ProcessId GetParentProcessId(ProcessHandle process) { +- struct kinfo_proc info; ++ struct kinfo_proc *info; + size_t length; ++ pid_t ppid; + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process, + sizeof(struct kinfo_proc), 0 }; + + if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0) + return -1; + ++ info = (struct kinfo_proc *)malloc(length); ++ + mib[5] = (length / sizeof(struct kinfo_proc)); + +- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0) +- return -1; ++ if (sysctl(mib, base::size(mib), info, &length, NULL, 0) < 0) { ++ ppid = -1; ++ goto out; ++ } + +- return info.p_ppid; ++ ppid = info->p_ppid; ++ ++out: ++ free(info); ++ return ppid; + } + + FilePath GetProcessExecutablePath(ProcessHandle process) { +- struct kinfo_proc kp; +- size_t len; ++ struct kinfo_proc *info; ++ size_t length; ++ char *path = NULL; + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process, + sizeof(struct kinfo_proc), 0 }; + +- if (sysctl(mib, base::size(mib), NULL, &len, NULL, 0) == -1) ++ if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) == -1) + return FilePath(); +- mib[5] = (len / sizeof(struct kinfo_proc)); +- if (sysctl(mib, base::size(mib), &kp, &len, NULL, 0) < 0) +- return FilePath(); +- if ((kp.p_flag & P_SYSTEM) != 0) +- return FilePath(); +- if (strcmp(kp.p_comm, "chrome") == 0) +- return FilePath(kp.p_comm); + +- return FilePath(); ++ info = (struct kinfo_proc *)malloc(length); ++ ++ mib[5] = (length / sizeof(struct kinfo_proc)); ++ ++ if (sysctl(mib, base::size(mib), info, &length, NULL, 0) < 0) ++ goto out; ++ ++ if ((info->p_flag & P_SYSTEM) != 0) ++ goto out; ++ ++ if (strcmp(info->p_comm, "chrome") == 0) { ++ path = info->p_comm; ++ goto out; ++ } ++ ++out: ++ free(info); ++ return FilePath(path); + } + + } // namespace base diff --git a/www/chromium/files/patch-base_process_process__iterator__openbsd.cc b/www/chromium/files/patch-base_process_process__iterator__openbsd.cc new file mode 100644 index 000000000000..a48483289ff4 --- /dev/null +++ b/www/chromium/files/patch-base_process_process__iterator__openbsd.cc @@ -0,0 +1,45 @@ +--- base/process/process_iterator_openbsd.cc.orig 2022-02-07 13:39:41 UTC ++++ base/process/process_iterator_openbsd.cc +@@ -6,6 +6,9 @@ + + #include <errno.h> + #include <stddef.h> ++#include <unistd.h> ++#include <sys/param.h> ++#include <sys/proc.h> + #include <sys/sysctl.h> + + #include "base/cxx17_backports.h" +@@ -19,12 +22,13 @@ ProcessIterator::ProcessIterator(const ProcessFilter* + : index_of_kinfo_proc_(), + filter_(filter) { + +- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid(), ++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, static_cast<int>(getuid()), + sizeof(struct kinfo_proc), 0 }; + + bool done = false; + int try_num = 1; + const int max_tries = 10; ++ size_t num_of_kinfo_proc; + + do { + size_t len = 0; +@@ -33,7 +37,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* + kinfo_procs_.resize(0); + done = true; + } else { +- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); ++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc); + // Leave some spare room for process table growth (more could show up + // between when we check and now) + num_of_kinfo_proc += 16; +@@ -49,7 +53,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* + } + } else { + // Got the list, just make sure we're sized exactly right +- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); ++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc); + kinfo_procs_.resize(num_of_kinfo_proc); + done = true; + } diff --git a/www/chromium/files/patch-base_process_process__linux.cc b/www/chromium/files/patch-base_process_process__linux.cc deleted file mode 100644 index b91800cecacc..000000000000 --- a/www/chromium/files/patch-base_process_process__linux.cc +++ /dev/null @@ -1,48 +0,0 @@ ---- base/process/process_linux.cc.orig 2021-04-14 18:40:48 UTC -+++ base/process/process_linux.cc -@@ -24,7 +24,9 @@ namespace base { - - namespace { - -+#if !defined(OS_BSD) - const int kForegroundPriority = 0; -+#endif - - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) - // We are more aggressive in our lowering of background process priority -@@ -69,7 +71,7 @@ struct CGroups { - return groups; - } - }; --#else -+#elif !defined(OS_BSD) - const int kBackgroundPriority = 5; - #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) - -@@ -85,13 +87,18 @@ Time Process::CreationTime() const { - if (!start_ticks) - return Time(); - -+#if defined(OS_BSD) -+ return Time::FromTimeT(start_ticks); -+#else - TimeDelta start_offset = internal::ClockTicksToTimeDelta(start_ticks); - Time boot_time = internal::GetBootTime(); - if (boot_time.is_null()) - return Time(); - return Time(boot_time + start_offset); -+#endif - } - -+#if !defined(OS_BSD) - // static - bool Process::CanBackgroundProcesses() { - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) -@@ -143,6 +150,7 @@ bool Process::SetProcessBackgrounded(bool background) - DPCHECK(result == 0); - return result == 0; - } -+#endif // !defined(OS_BSD) - - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) - bool IsProcessBackgroundedCGroup(const StringPiece& cgroup_contents) { diff --git a/www/chromium/files/patch-base_process_process__metrics.cc b/www/chromium/files/patch-base_process_process__metrics.cc index 20a9ba831c6f..aff587d7cf98 100644 --- a/www/chromium/files/patch-base_process_process__metrics.cc +++ b/www/chromium/files/patch-base_process_process__metrics.cc @@ -1,14 +1,14 @@ ---- base/process/process_metrics.cc.orig 2021-09-14 01:51:47 UTC +--- base/process/process_metrics.cc.orig 2022-02-07 13:39:41 UTC +++ base/process/process_metrics.cc -@@ -17,7 +17,7 @@ namespace base { - +@@ -18,7 +18,7 @@ namespace base { namespace { --#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ -+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) int CalculateEventsPerSecond(uint64_t event_count, uint64_t* last_event_count, + base::TimeTicks* last_calculated) { @@ -55,7 +55,7 @@ SystemMetrics SystemMetrics::Sample() { SystemMetrics system_metrics; @@ -27,21 +27,12 @@ Value meminfo = memory_info_.ToValue(); Value vmstat = vmstat_info_.ToValue(); meminfo.MergeDictionary(&vmstat); -@@ -125,7 +125,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage( - } +@@ -126,7 +126,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage( #endif --#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ -+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) int ProcessMetrics::CalculateIdleWakeupsPerSecond( uint64_t absolute_idle_wakeups) { -@@ -138,7 +138,7 @@ int ProcessMetrics::GetIdleWakeupsPerSecond() { - NOTIMPLEMENTED(); // http://crbug.com/120488 - return 0; - } --#endif // defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || -+#endif // defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || - // defined(OS_AIX) - - #if defined(OS_APPLE) + return CalculateEventsPerSecond(absolute_idle_wakeups, diff --git a/www/chromium/files/patch-base_process_process__metrics.h b/www/chromium/files/patch-base_process_process__metrics.h index 70884fc12fa6..d56de6d74153 100644 --- a/www/chromium/files/patch-base_process_process__metrics.h +++ b/www/chromium/files/patch-base_process_process__metrics.h @@ -1,15 +1,15 @@ ---- base/process/process_metrics.h.orig 2021-12-14 11:44:55 UTC +--- base/process/process_metrics.h.orig 2022-02-07 13:39:41 UTC +++ base/process/process_metrics.h @@ -37,7 +37,7 @@ - #include "base/win/windows_types.h" #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) #include <string> #include <utility> -@@ -54,7 +54,7 @@ class Value; + #include <vector> +@@ -53,7 +53,7 @@ class Value; // Full declaration is in process_metrics_iocounters.h. struct IoCounters; @@ -18,16 +18,7 @@ // Minor and major page fault counts since the process creation. // Both counts are process-wide, and exclude child processes. // -@@ -64,7 +64,7 @@ struct PageFaultCounts { - int64_t minor; - int64_t major; - }; --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - - // Convert a POSIX timeval to microseconds. - BASE_EXPORT int64_t TimeValToMicroseconds(const struct timeval& tv); -@@ -108,7 +108,7 @@ class BASE_EXPORT ProcessMetrics { +@@ -107,7 +107,7 @@ class BASE_EXPORT ProcessMetrics { // convenience wrapper for CreateProcessMetrics(). static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics(); @@ -37,24 +28,15 @@ // attempt to extend this to other platforms. BASE_EXPORT size_t GetResidentSetSize() const; @@ -134,7 +134,7 @@ class BASE_EXPORT ProcessMetrics { - // will result in a time delta of 2 seconds/per 1 wall-clock second. TimeDelta GetCumulativeCPUUsage() WARN_UNUSED_RESULT; --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) // Emits the cumulative CPU usage for all currently active threads since they // were started into the output parameter (replacing its current contents). -@@ -169,7 +169,7 @@ class BASE_EXPORT ProcessMetrics { - bool ParseProcTimeInState(const std::string& content, - PlatformThreadId tid, - TimeInStatePerThread& time_in_state_per_thread); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || - // defined(OS_AIX) - - // Returns the number of average idle cpu wakeups per second since the last -@@ -218,14 +218,14 @@ class BASE_EXPORT ProcessMetrics { + // Threads that have already terminated will not be reported. Thus, the sum of +@@ -217,7 +217,7 @@ class BASE_EXPORT ProcessMetrics { int GetOpenFdSoftLimit() const; #endif // defined(OS_POSIX) @@ -63,105 +45,70 @@ // Bytes of swap as reported by /proc/[pid]/status. uint64_t GetVmSwapBytes() const; - // Minor and major page fault count as reported by /proc/[pid]/stat. - // Returns true for success. - bool GetPageFaultCounts(PageFaultCounts* counts) const; --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - - // Returns total memory usage of malloc. - size_t GetMallocUsage(); @@ -237,7 +237,7 @@ class BASE_EXPORT ProcessMetrics { - ProcessMetrics(ProcessHandle process, PortProvider* port_provider); #endif // !defined(OS_MAC) --#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ -+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups); #endif -@@ -248,10 +248,10 @@ class BASE_EXPORT ProcessMetrics { - uint64_t absolute_package_idle_wakeups); + #if defined(OS_APPLE) +@@ -248,7 +248,7 @@ class BASE_EXPORT ProcessMetrics { #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) CPU::CoreType GetCoreType(int core_index); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || + #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || // defined(OS_AIX) - - #if defined(OS_WIN) @@ -273,7 +273,7 @@ class BASE_EXPORT ProcessMetrics { - // Number of bytes transferred to/from disk in bytes. uint64_t last_cumulative_disk_usage_ = 0; --#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ -+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) // Same thing for idle wakeups. TimeTicks last_idle_wakeups_time_; -@@ -315,7 +315,7 @@ BASE_EXPORT size_t GetHandleLimit(); - BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_descriptors); - #endif // defined(OS_POSIX) + uint64_t last_absolute_idle_wakeups_; +@@ -316,7 +316,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de --#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ -+#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || \ + #if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_AIX) || \ - defined(OS_FUCHSIA) +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_BSD) // Data about system-wide memory consumption. Values are in KB. Available on + // Windows, Mac, Linux, Android and Chrome OS. + // @@ -351,7 +351,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { - int avail_phys = 0; #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) // This provides an estimate of available memory as described here: // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 + // NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always @@ -366,7 +366,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { - int swap_free = 0; #endif --#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ -+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \ - defined(OS_AIX) || defined(OS_FUCHSIA) + #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) || defined(OS_FUCHSIA) ++ defined(OS_AIX) || defined(OS_FUCHSIA) || defined(OS_BSD) int buffers = 0; int cached = 0; -@@ -376,7 +376,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { - int inactive_file = 0; - int dirty = 0; - int reclaimable = 0; --#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || -+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || - // defined(OS_AIX) defined(OS_FUCHSIA) - - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) -@@ -399,11 +399,11 @@ struct BASE_EXPORT SystemMemoryInfoKB { - // Exposed for memory debugging widget. - BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo); - --#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || -+#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || - // defined(OS_CHROMEOS) defined(OS_ANDROID) || defined(OS_AIX) || + int active_anon = 0; +@@ -403,7 +403,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK // defined(OS_FUCHSIA) --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) // Parse the data found in /proc/<pid>/stat and return the sum of the // CPU-related ticks. Returns -1 on parse error. -@@ -479,7 +479,7 @@ BASE_EXPORT bool GetSystemDiskInfo(SystemDiskInfo* dis - // Returns the amount of time spent in user space since boot across all CPUs. - BASE_EXPORT TimeDelta GetUserCpuTimeSinceBoot(); - --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || - // defined(OS_AIX) - - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) -@@ -591,7 +591,7 @@ class BASE_EXPORT SystemMetrics { + // Exposed for testing. +@@ -590,7 +590,7 @@ class BASE_EXPORT SystemMetrics { FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics); size_t committed_memory_; diff --git a/www/chromium/files/patch-base_process_process__metrics__openbsd.cc b/www/chromium/files/patch-base_process_process__metrics__openbsd.cc new file mode 100644 index 000000000000..1cc46d52fa55 --- /dev/null +++ b/www/chromium/files/patch-base_process_process__metrics__openbsd.cc @@ -0,0 +1,213 @@ +--- base/process/process_metrics_openbsd.cc.orig 2022-02-07 13:39:41 UTC ++++ base/process/process_metrics_openbsd.cc +@@ -4,14 +4,30 @@ + + #include "base/process/process_metrics.h" + ++#include "base/files/file_util.h" ++#include "base/logging.h" ++#include "base/process/internal_linux.h" ++#include "base/strings/string_number_conversions.h" ++#include "base/strings/string_split.h" ++#include "base/strings/string_tokenizer.h" ++#include "base/strings/string_util.h" ++#include "base/system/sys_info.h" ++#include "base/threading/thread_restrictions.h" ++#include "base/notreached.h" ++ + #include <stddef.h> + #include <stdint.h> ++#include <fcntl.h> + #include <sys/param.h> + #include <sys/sysctl.h> ++#include <sys/vmmeter.h> + ++#include <kvm.h> ++ + #include "base/cxx17_backports.h" + #include "base/memory/ptr_util.h" + #include "base/process/process_metrics_iocounters.h" ++#include "base/values.h" + + namespace base { + +@@ -25,48 +41,13 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun + return false; + } + +-static int GetProcessCPU(pid_t pid) { +- struct kinfo_proc info; +- size_t length; +- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, +- sizeof(struct kinfo_proc), 0 }; +- +- if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0) +- return -1; +- +- mib[5] = (length / sizeof(struct kinfo_proc)); +- +- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0) +- return 0; +- +- return info.p_pctcpu; +-} +- +-double ProcessMetrics::GetPlatformIndependentCPUUsage() { +- TimeTicks time = TimeTicks::Now(); +- +- if (last_cpu_time_.is_zero()) { +- // First call, just set the last values. +- last_cpu_time_ = time; +- return 0; +- } +- +- int cpu = GetProcessCPU(process_); +- +- last_cpu_time_ = time; +- double percentage = static_cast<double>((cpu * 100.0) / FSCALE); +- +- return percentage; +-} +- + TimeDelta ProcessMetrics::GetCumulativeCPUUsage() { + NOTREACHED(); + return TimeDelta(); + } + + ProcessMetrics::ProcessMetrics(ProcessHandle process) +- : process_(process), +- last_cpu_(0) {} ++ : process_(process) {} + + size_t GetSystemCommitCharge() { + int mib[] = { CTL_VM, VM_METER }; +@@ -85,6 +66,129 @@ size_t GetSystemCommitCharge() { + pagesize = getpagesize(); + + return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); ++} ++ ++int ProcessMetrics::GetOpenFdCount() const { ++ struct kinfo_file *files; ++ kvm_t *kd = NULL; ++ int total_count = 0; ++ char errbuf[_POSIX2_LINE_MAX]; ++ ++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL) ++ goto out; ++ ++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process_, ++ sizeof(struct kinfo_file), &total_count)) == NULL) { ++ total_count = 0; ++ goto out; ++ } ++ ++ kvm_close(kd); ++ ++out: ++ return total_count; ++} ++ ++int ProcessMetrics::GetOpenFdSoftLimit() const { ++ return GetMaxFds(); ++} ++ ++uint64_t ProcessMetrics::GetVmSwapBytes() const { ++ NOTIMPLEMENTED(); ++ return 0; ++} ++ ++bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { ++ NOTIMPLEMENTED_LOG_ONCE(); ++ return false; ++} ++ ++SystemDiskInfo::SystemDiskInfo() { ++ reads = 0; ++ reads_merged = 0; ++ sectors_read = 0; ++ read_time = 0; ++ writes = 0; ++ writes_merged = 0; ++ sectors_written = 0; ++ write_time = 0; ++ io = 0; ++ io_time = 0; ++ weighted_io_time = 0; ++} ++ ++SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default; ++ ++bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) { ++ NOTIMPLEMENTED(); ++ return false; ++} ++ ++bool GetVmStatInfo(VmStatInfo* vmstat) { ++ NOTIMPLEMENTED(); ++ return false; ++} ++ ++int ProcessMetrics::GetIdleWakeupsPerSecond() { ++ NOTIMPLEMENTED(); ++ return 0; ++} ++ ++Value SystemMemoryInfoKB::ToValue() const { ++ Value res(Value::Type::DICTIONARY); ++ res.SetIntKey("total", total); ++ res.SetIntKey("free", free); ++ res.SetIntKey("available", available); ++ res.SetIntKey("buffers", buffers); ++ res.SetIntKey("cached", cached); ++ res.SetIntKey("active_anon", active_anon); ++ res.SetIntKey("inactive_anon", inactive_anon); ++ res.SetIntKey("active_file", active_file); ++ res.SetIntKey("inactive_file", inactive_file); ++ res.SetIntKey("swap_total", swap_total); ++ res.SetIntKey("swap_free", swap_free); ++ res.SetIntKey("swap_used", swap_total - swap_free); ++ res.SetIntKey("dirty", dirty); ++ res.SetIntKey("reclaimable", reclaimable); ++ ++ NOTIMPLEMENTED(); ++ ++ return res; ++} ++ ++Value VmStatInfo::ToValue() const { ++ Value res(Value::Type::DICTIONARY); ++ res.SetIntKey("pswpin", pswpin); ++ res.SetIntKey("pswpout", pswpout); ++ res.SetIntKey("pgmajfault", pgmajfault); ++ ++ NOTIMPLEMENTED(); ++ ++ return res; ++} ++ ++SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default; ++ ++Value SystemDiskInfo::ToValue() const { ++ Value res(Value::Type::DICTIONARY); ++ ++ // Write out uint64_t variables as doubles. ++ // Note: this may discard some precision, but for JS there's no other option. ++ res.SetDoubleKey("reads", static_cast<double>(reads)); ++ res.SetDoubleKey("reads_merged", static_cast<double>(reads_merged)); ++ res.SetDoubleKey("sectors_read", static_cast<double>(sectors_read)); ++ res.SetDoubleKey("read_time", static_cast<double>(read_time)); ++ res.SetDoubleKey("writes", static_cast<double>(writes)); ++ res.SetDoubleKey("writes_merged", static_cast<double>(writes_merged)); ++ res.SetDoubleKey("sectors_written", static_cast<double>(sectors_written)); ++ res.SetDoubleKey("write_time", static_cast<double>(write_time)); ++ res.SetDoubleKey("io", static_cast<double>(io)); ++ res.SetDoubleKey("io_time", static_cast<double>(io_time)); ++ res.SetDoubleKey("weighted_io_time", static_cast<double>(weighted_io_time)); ++ ++ NOTIMPLEMENTED(); ++ ++ return res; + } + + } // namespace base diff --git a/www/chromium/files/patch-base_process_process__metrics__posix.cc b/www/chromium/files/patch-base_process_process__metrics__posix.cc index 3fe1216db9df..9e3e19fc7abb 100644 --- a/www/chromium/files/patch-base_process_process__metrics__posix.cc +++ b/www/chromium/files/patch-base_process_process__metrics__posix.cc @@ -1,10 +1,10 @@ ---- base/process/process_metrics_posix.cc.orig 2021-07-19 18:45:05 UTC +--- base/process/process_metrics_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/process/process_metrics_posix.cc @@ -20,6 +20,8 @@ #if defined(OS_APPLE) #include <malloc/malloc.h> -+#elif defined(OS_FREEBSD) ++#elif defined(OS_OPENBSD) +#include <stdlib.h> #else #include <malloc.h> diff --git a/www/chromium/files/patch-base_process_process__posix.cc b/www/chromium/files/patch-base_process_process__posix.cc new file mode 100644 index 000000000000..b2245b1ea796 --- /dev/null +++ b/www/chromium/files/patch-base_process_process__posix.cc @@ -0,0 +1,70 @@ +--- base/process/process_posix.cc.orig 2022-02-07 13:39:41 UTC ++++ base/process/process_posix.cc +@@ -27,6 +27,11 @@ + #include <sys/event.h> + #endif + ++#if defined(OS_BSD) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif ++ + #if BUILDFLAG(CLANG_PROFILING) + #include "base/test/clang_profiling.h" + #endif +@@ -358,7 +363,55 @@ void Process::Exited(int exit_code) const {} + + int Process::GetPriority() const { + DCHECK(IsValid()); ++// avoid pledge(2) violation ++#if defined(OS_BSD) ++ return 0; ++#else + return getpriority(PRIO_PROCESS, process_); ++#endif ++} ++ ++Time Process::CreationTime() const { ++// avoid ps pledge in the network process ++#if !defined(OS_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 !defined(OS_BSD) ++ if (sysctl(mib, base::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, base::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; ++} ++ ++bool Process::IsProcessBackgrounded() const { ++ return false; ++} ++ ++bool Process::SetProcessBackgrounded(bool value) { ++ return false; ++} ++ ++// static ++bool Process::CanBackgroundProcesses() { ++ return false; + } + + } // namespace base diff --git a/www/chromium/files/patch-base_process_process__unittest.cc b/www/chromium/files/patch-base_process_process__unittest.cc deleted file mode 100644 index 4f9397702033..000000000000 --- a/www/chromium/files/patch-base_process_process__unittest.cc +++ /dev/null @@ -1,27 +0,0 @@ ---- base/process/process_unittest.cc.orig 2021-09-14 01:51:47 UTC -+++ base/process/process_unittest.cc -@@ -140,7 +140,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) { - // was spawned and a time recorded after it was spawned. However, since the - // base::Time and process creation clocks don't match, tolerate some error. - constexpr base::TimeDelta kTolerance = --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // On Linux, process creation time is relative to boot time which has a - // 1-second resolution. Tolerate 1 second for the imprecise boot time and - // 100 ms for the imprecise clock. -@@ -287,6 +287,7 @@ TEST_F(ProcessTest, WaitForExitOrEventWithEventSet) { - } - #endif // OS_WIN - -+#if !defined(OS_BSD) - // Ensure that the priority of a process is restored correctly after - // backgrounding and restoring. - // Note: a platform may not be willing or able to lower the priority of -@@ -344,6 +345,7 @@ TEST_F(ProcessTest, SetProcessBackgroundedSelf) { - int new_priority = process.GetPriority(); - EXPECT_EQ(old_priority, new_priority); - } -+#endif - - // Consumers can use WaitForExitWithTimeout(base::TimeDelta(), nullptr) to check - // whether the process is still running. This may not be safe because of the diff --git a/www/chromium/files/patch-base_process_process__util__unittest.cc b/www/chromium/files/patch-base_process_process__util__unittest.cc deleted file mode 100644 index b312c2876317..000000000000 --- a/www/chromium/files/patch-base_process_process__util__unittest.cc +++ /dev/null @@ -1,16 +0,0 @@ ---- base/process/process_util_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/process/process_util_unittest.cc -@@ -1342,11 +1342,11 @@ std::string TestLaunchProcess(const CommandLine& cmdli - options.fds_to_remap.emplace_back(fds[1], STDOUT_FILENO); - #endif // defined(OS_WIN) - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - options.clone_flags = clone_flags; - #else - CHECK_EQ(0, clone_flags); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - EXPECT_TRUE(LaunchProcess(cmdline, options).IsValid()); - write_pipe.Close(); diff --git a/www/chromium/files/patch-base_profiler_register__context.h b/www/chromium/files/patch-base_profiler_register__context.h deleted file mode 100644 index 136080cf3b91..000000000000 --- a/www/chromium/files/patch-base_profiler_register__context.h +++ /dev/null @@ -1,60 +0,0 @@ ---- base/profiler/register_context.h.orig 2021-09-14 01:51:47 UTC -+++ base/profiler/register_context.h -@@ -17,7 +17,7 @@ - #include <windows.h> - #elif defined(OS_APPLE) - #include <mach/machine/thread_status.h> --#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #include <sys/ucontext.h> - #endif - -@@ -209,6 +209,48 @@ inline uintptr_t& RegisterContextInstructionPointer(mc - } - - #endif // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) -+ -+#elif defined(OS_FREEBSD) -+ -+using RegisterContext = mcontext_t; -+ -+#if defined(ARCH_CPU_X86_64) -+inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_rsp); -+} -+ -+inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_rbp); -+} -+ -+inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_rip); -+} -+#elif defined(ARCH_CPU_X86) -+inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_esp); -+} -+ -+inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_ebp); -+} -+ -+inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_eip); -+} -+#elif defined(ARCH_CPU_ARM64) -+inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_gpregs.gp_sp); -+} -+ -+inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_gpregs.gp_x[29]); -+} -+ -+inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { -+ return AsUintPtr(&context->mc_gpregs.gp_elr); -+} -+#endif - - #else // #if defined(OS_WIN) - diff --git a/www/chromium/files/patch-base_profiler_sampling__profiler__thread__token.cc b/www/chromium/files/patch-base_profiler_sampling__profiler__thread__token.cc deleted file mode 100644 index fb64e59d8b3f..000000000000 --- a/www/chromium/files/patch-base_profiler_sampling__profiler__thread__token.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/profiler/sampling_profiler_thread_token.cc.orig 2021-04-14 18:40:48 UTC -+++ base/profiler/sampling_profiler_thread_token.cc -@@ -7,7 +7,7 @@ - namespace base { - - SamplingProfilerThreadToken GetSamplingProfilerCurrentThreadToken() { --#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - return {PlatformThread::CurrentId(), pthread_self()}; - #else - return {PlatformThread::CurrentId()}; diff --git a/www/chromium/files/patch-base_profiler_sampling__profiler__thread__token.h b/www/chromium/files/patch-base_profiler_sampling__profiler__thread__token.h deleted file mode 100644 index b9f665289555..000000000000 --- a/www/chromium/files/patch-base_profiler_sampling__profiler__thread__token.h +++ /dev/null @@ -1,20 +0,0 @@ ---- base/profiler/sampling_profiler_thread_token.h.orig 2021-04-14 18:40:48 UTC -+++ base/profiler/sampling_profiler_thread_token.h -@@ -9,7 +9,7 @@ - #include "base/threading/platform_thread.h" - #include "build/build_config.h" - --#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #include <pthread.h> - #endif - -@@ -21,7 +21,7 @@ namespace base { - // functions used to obtain the stack base address. - struct SamplingProfilerThreadToken { - PlatformThreadId id; --#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - pthread_t pthread_id; - #endif - }; diff --git a/www/chromium/files/patch-base_profiler_stack__copier__signal.cc b/www/chromium/files/patch-base_profiler_stack__copier__signal.cc deleted file mode 100644 index 4d309daebe17..000000000000 --- a/www/chromium/files/patch-base_profiler_stack__copier__signal.cc +++ /dev/null @@ -1,63 +0,0 @@ ---- base/profiler/stack_copier_signal.cc.orig 2021-07-19 18:45:05 UTC -+++ base/profiler/stack_copier_signal.cc -@@ -4,7 +4,14 @@ - - #include "base/profiler/stack_copier_signal.h" - -+#if defined(OS_LINUX) - #include <linux/futex.h> -+#include <syscall.h> -+#elif defined(OS_FREEBSD) -+#include <sys/types.h> -+#include <sys/thr.h> -+#include <sys/umtx.h> -+#endif - #include <signal.h> - #include <sys/ucontext.h> - #include <syscall.h> -@@ -37,8 +44,13 @@ class AsyncSafeWaitableEvent { - // for a pthread mutex. So, also check the condition. - while (true) { - int res = -+#if defined(OS_LINUX) - syscall(SYS_futex, futex_int_ptr(), FUTEX_WAIT | FUTEX_PRIVATE_FLAG, - 0, nullptr, nullptr, 0); -+#elif defined(OS_FREEBSD) -+ _umtx_op(futex_int_ptr(), UMTX_OP_WAIT_UINT_PRIVATE, 0, nullptr, -+ nullptr); -+#endif - if (futex_.load(std::memory_order_acquire) != 0) - return true; - if (res != 0) -@@ -48,8 +60,12 @@ class AsyncSafeWaitableEvent { - - void Signal() { - futex_.store(1, std::memory_order_release); -+#if defined(OS_LINUX) - syscall(SYS_futex, futex_int_ptr(), FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1, - nullptr, nullptr, 0); -+#elif defined(OS_FREEBSD) -+ _umtx_op(futex_int_ptr(), UMTX_OP_WAKE_PRIVATE, 1, nullptr, nullptr); -+#endif - } - - private: -@@ -223,11 +239,18 @@ bool StackCopierSignal::CopyStack(StackBuffer* stack_b - if (!scoped_sigaction.succeeded()) - return false; - -+#if defined(OS_LINUX) - if (syscall(SYS_tgkill, getpid(), thread_delegate_->GetThreadId(), - SIGURG) != 0) { - NOTREACHED(); - return false; - } -+#elif defined(OS_FREEBSD) -+ if (thr_kill2(getpid(), thread_delegate_->GetThreadId(), SIGURG) != 0) { -+ NOTREACHED(); -+ return false; -+ } -+#endif - bool finished_waiting = wait_event.Wait(); - TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cpu_profiler.debug"), - "StackCopierSignal copy stack"); diff --git a/www/chromium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc b/www/chromium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc deleted file mode 100644 index 039d8c363856..000000000000 --- a/www/chromium/files/patch-base_profiler_stack__sampling__profiler__test__util.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/profiler/stack_sampling_profiler_test_util.cc.orig 2021-04-14 18:40:48 UTC -+++ base/profiler/stack_sampling_profiler_test_util.cc -@@ -32,7 +32,7 @@ - // Fortunately, it provides _alloca, which functions identically. - #include <malloc.h> - #define alloca _alloca --#else -+#elif !defined(OS_BSD) - #include <alloca.h> - #endif - diff --git a/www/chromium/files/patch-base_profiler_stack__sampling__profiler__unittest.cc b/www/chromium/files/patch-base_profiler_stack__sampling__profiler__unittest.cc deleted file mode 100644 index 6de970a38eeb..000000000000 --- a/www/chromium/files/patch-base_profiler_stack__sampling__profiler__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/profiler/stack_sampling_profiler_unittest.cc.orig 2021-09-14 01:51:47 UTC -+++ base/profiler/stack_sampling_profiler_unittest.cc -@@ -41,7 +41,7 @@ - #include <intrin.h> - #include <malloc.h> - #include <windows.h> --#else -+#elif !defined(OS_BSD) - #include <alloca.h> - #endif - diff --git a/www/chromium/files/patch-base_profiler_thread__delegate__posix.cc b/www/chromium/files/patch-base_profiler_thread__delegate__posix.cc deleted file mode 100644 index 2cfaf0bebbc0..000000000000 --- a/www/chromium/files/patch-base_profiler_thread__delegate__posix.cc +++ /dev/null @@ -1,68 +0,0 @@ ---- base/profiler/thread_delegate_posix.cc.orig 2021-09-14 01:51:47 UTC -+++ base/profiler/thread_delegate_posix.cc -@@ -12,6 +12,10 @@ - #include "build/build_config.h" - #include "third_party/abseil-cpp/absl/types/optional.h" - -+#if defined(OS_BSD) -+#include <pthread_np.h> -+#endif -+ - #if defined(OS_ANDROID) - #include "base/files/file_util.h" - #include "base/files/scoped_file.h" -@@ -42,7 +46,12 @@ absl::optional<uintptr_t> GetAndroidMainThreadStackBas - uintptr_t GetThreadStackBaseAddressImpl( - SamplingProfilerThreadToken thread_token) { - pthread_attr_t attr; -+#if defined(OS_FREEBSD) -+ pthread_attr_init(&attr); -+ pthread_attr_get_np(thread_token.pthread_id, &attr); -+#elif defined(OS_LINUX) - pthread_getattr_np(thread_token.pthread_id, &attr); -+#endif - // See crbug.com/617730 for limitations of this approach on Linux. - void* address; - size_t size; -@@ -129,16 +138,33 @@ std::vector<uintptr_t*> ThreadDelegatePosix::GetRegist - return { - // Return the set of callee-save registers per the i386 System V ABI - // section 2.2.3, plus the stack pointer. -+#if defined(OS_FREEBSD) -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_ebx), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_ebp), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_esi), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_edi), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_esp), -+#else - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_EBX]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_EBP]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_ESI]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_EDI]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_ESP]), -+#endif - }; - #elif defined(ARCH_CPU_X86_FAMILY) && defined(ARCH_CPU_64_BITS) - return { - // Return the set of callee-save registers per the x86-64 System V ABI - // section 3.2.1, plus the stack pointer. -+#if defined(OS_FREEBSD) -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_rbp), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_rbx), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r12), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r13), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r14), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r15), -+ reinterpret_cast<uintptr_t*>(&thread_context->mc_rsp), -+#else - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RBP]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RBX]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R12]), -@@ -146,6 +172,7 @@ std::vector<uintptr_t*> ThreadDelegatePosix::GetRegist - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R14]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R15]), - reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RSP]), -+#endif - }; - #else // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) - // Unimplemented for other architectures. diff --git a/www/chromium/files/patch-base_rand__util.h b/www/chromium/files/patch-base_rand__util.h new file mode 100644 index 000000000000..1b379c09a366 --- /dev/null +++ b/www/chromium/files/patch-base_rand__util.h @@ -0,0 +1,11 @@ +--- base/rand_util.h.orig 2022-02-07 13:39:41 UTC ++++ base/rand_util.h +@@ -77,7 +77,7 @@ void RandomShuffle(Itr first, Itr last) { + std::shuffle(first, last, RandomBitGenerator()); + } + +-#if defined(OS_POSIX) ++#if defined(OS_POSIX) && !defined(OS_OPENBSD) + BASE_EXPORT int GetUrandomFD(); + #endif + diff --git a/www/chromium/files/patch-base_rand__util__posix.cc b/www/chromium/files/patch-base_rand__util__posix.cc new file mode 100644 index 000000000000..0d7503d62921 --- /dev/null +++ b/www/chromium/files/patch-base_rand__util__posix.cc @@ -0,0 +1,52 @@ +--- base/rand_util_posix.cc.orig 2022-02-07 13:39:41 UTC ++++ base/rand_util_posix.cc +@@ -17,7 +17,7 @@ + #include "base/posix/eintr_wrapper.h" + #include "build/build_config.h" + +-#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_NACL) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_NACL) && !defined(OS_BSD) + #include "third_party/lss/linux_syscall_support.h" + #elif defined(OS_MAC) + // TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK. +@@ -34,6 +34,7 @@ static constexpr int kOpenFlags = O_RDONLY; + static constexpr int kOpenFlags = O_RDONLY | O_CLOEXEC; + #endif + ++#if !defined(OS_OPENBSD) + // We keep the file descriptor for /dev/urandom around so we don't need to + // reopen it (which is expensive), and since we may not even be able to reopen + // it if we are later put in a sandbox. This class wraps the file descriptor so +@@ -51,6 +52,7 @@ class URandomFd { + private: + const int fd_; + }; ++#endif + + } // namespace + +@@ -62,6 +64,7 @@ namespace base { + // (https://chromium-review.googlesource.com/c/chromium/src/+/1545096) and land + // it or some form of it. + void RandBytes(void* output, size_t output_length) { ++#if !defined(OS_OPENBSD) + #if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_NACL) + // We have to call `getrandom` via Linux Syscall Support, rather than through + // the libc wrapper, because we might not have an up-to-date libc (e.g. on +@@ -93,11 +96,16 @@ void RandBytes(void* output, size_t output_length) { + const bool success = + ReadFromFD(urandom_fd, static_cast<char*>(output), output_length); + CHECK(success); ++#else ++ arc4random_buf(static_cast<char*>(output), output_length); ++#endif + } + ++#if !defined(OS_OPENBSD) + int GetUrandomFD() { + static NoDestructor<URandomFd> urandom_fd; + return urandom_fd->fd(); + } ++#endif + + } // namespace base diff --git a/www/chromium/files/patch-base_sampling__heap__profiler_sampling__heap__profiler.cc b/www/chromium/files/patch-base_sampling__heap__profiler_sampling__heap__profiler.cc deleted file mode 100644 index 78f5a70b338c..000000000000 --- a/www/chromium/files/patch-base_sampling__heap__profiler_sampling__heap__profiler.cc +++ /dev/null @@ -1,24 +0,0 @@ ---- base/sampling_heap_profiler/sampling_heap_profiler.cc.orig 2021-09-14 01:51:47 UTC -+++ base/sampling_heap_profiler/sampling_heap_profiler.cc -@@ -27,6 +27,10 @@ - #include <sys/prctl.h> - #endif - -+#if defined(OS_BSD) -+#include <pthread_np.h> -+#endif -+ - #if defined(OS_ANDROID) && BUILDFLAG(CAN_UNWIND_WITH_CFI_TABLE) && \ - defined(OFFICIAL_BUILD) - #include "base/trace_event/cfi_backtrace_android.h" // no-presubmit-check -@@ -62,6 +66,10 @@ const char* GetAndLeakThreadName() { - #elif defined(OS_APPLE) - int err = pthread_getname_np(pthread_self(), name, kBufferLen); - if (err == 0 && *name != '\0') -+ return strdup(name); -+#elif defined(OS_BSD) && __FreeBSD__ >= 12 -+ pthread_get_name_np(pthread_self(), name, kBufferLen); -+ if (*name != '\0') - return strdup(name); - #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) - diff --git a/www/chromium/files/patch-base_security__unittest.cc b/www/chromium/files/patch-base_security__unittest.cc deleted file mode 100644 index 75edbfea9696..000000000000 --- a/www/chromium/files/patch-base_security__unittest.cc +++ /dev/null @@ -1,28 +0,0 @@ ---- base/security_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/security_unittest.cc -@@ -61,7 +61,7 @@ NOINLINE Type HideValueFromCompiler(volatile Type valu - void OverflowTestsSoftExpectTrue(bool overflow_detected) { - if (!overflow_detected) { - #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -- defined(OS_APPLE) -+ defined(OS_APPLE) || defined(OS_BSD) - // Sadly, on Linux, Android, and OSX we don't have a good story yet. Don't - // fail the test, but report. - printf("Platform has overflow: %s\n", -@@ -121,7 +121,7 @@ TEST(SecurityTest, MAYBE_NewOverflow) { - #endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS) - } - --#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(__x86_64__) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) && defined(__x86_64__) - // Check if ptr1 and ptr2 are separated by less than size chars. - bool ArePointersToSameArea(void* ptr1, void* ptr2, size_t size) { - ptrdiff_t ptr_diff = reinterpret_cast<char*>(std::max(ptr1, ptr2)) - -@@ -175,6 +175,6 @@ TEST(SecurityTest, MALLOC_OVERFLOW_TEST(RandomMemoryAl - EXPECT_FALSE(impossible_random_address); - } - --#endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(__x86_64__) -+#endif // (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) && defined(__x86_64__) - - } // namespace diff --git a/www/chromium/files/patch-base_strings_string__util.cc b/www/chromium/files/patch-base_strings_string__util.cc new file mode 100644 index 000000000000..1003ec60edef --- /dev/null +++ b/www/chromium/files/patch-base_strings_string__util.cc @@ -0,0 +1,11 @@ +--- base/strings/string_util.cc.orig 2022-02-07 13:39:41 UTC ++++ base/strings/string_util.cc +@@ -36,7 +36,7 @@ namespace base { + bool IsWprintfFormatPortable(const wchar_t* format) { + // This snippet of code checks that we can build C++17 code. + // TODO(thakis): Enable this on all platforms, and then remove it again. +-#if !defined(OS_LINUX) && !BUILDFLAG(CFI_ICALL_CHECK) && \ ++#if !defined(OS_LINUX) && !defined(OS_BSD) && !BUILDFLAG(CFI_ICALL_CHECK) && \ + !BUILDFLAG(CFI_CAST_CHECK) + if constexpr (constexpr int i = 0; i > 0) { + } diff --git a/www/chromium/files/patch-base_strings_sys__string__conversions__unittest.cc b/www/chromium/files/patch-base_strings_sys__string__conversions__unittest.cc deleted file mode 100644 index bc016b95adbe..000000000000 --- a/www/chromium/files/patch-base_strings_sys__string__conversions__unittest.cc +++ /dev/null @@ -1,19 +0,0 @@ ---- base/strings/sys_string_conversions_unittest.cc.orig 2021-09-14 01:51:47 UTC -+++ base/strings/sys_string_conversions_unittest.cc -@@ -75,7 +75,7 @@ TEST(SysStrings, SysUTF8ToWide) { - } - - // Tests depend on setting a specific Linux locale. --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - TEST(SysStrings, SysWideToNativeMB) { - #if !defined(SYSTEM_NATIVE_UTF8) - ScopedLocale locale("en_US.UTF-8"); -@@ -190,6 +190,6 @@ TEST(SysStrings, SysNativeMBAndWide) { - EXPECT_EQ(wide, trip); - } - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - } // namespace base diff --git a/www/chromium/files/patch-base_synchronization_lock__impl.h b/www/chromium/files/patch-base_synchronization_lock__impl.h index b64073a52629..5e7c175fb687 100644 --- a/www/chromium/files/patch-base_synchronization_lock__impl.h +++ b/www/chromium/files/patch-base_synchronization_lock__impl.h @@ -1,19 +1,23 @@ ---- base/synchronization/lock_impl.h.orig 2021-12-14 11:44:55 UTC +--- base/synchronization/lock_impl.h.orig 2022-02-07 13:39:41 UTC +++ base/synchronization/lock_impl.h -@@ -107,6 +107,8 @@ void LockImpl::Unlock() { +@@ -107,6 +107,10 @@ void LockImpl::Unlock() { } #elif defined(OS_POSIX) || defined(OS_FUCHSIA) ++#if defined(OS_FREEBSD) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wthread-safety-analysis" ++#endif BASE_EXPORT std::string SystemErrorCodeToString(int error_code); -@@ -121,6 +123,7 @@ void LockImpl::Unlock() { +@@ -121,6 +125,9 @@ void LockImpl::Unlock() { int rv = pthread_mutex_unlock(&native_handle_); DCHECK_EQ(rv, 0) << ". " << strerror(rv); } ++#if defined(OS_FREEBSD) +#pragma GCC diagnostic pop ++#endif #endif // This is an implementation used for AutoLock templated on the lock type. diff --git a/www/chromium/files/patch-base_system_sys__info.cc b/www/chromium/files/patch-base_system_sys__info.cc index ad07c1b750e5..66ca14e577d0 100644 --- a/www/chromium/files/patch-base_system_sys__info.cc +++ b/www/chromium/files/patch-base_system_sys__info.cc @@ -1,6 +1,6 @@ ---- base/system/sys_info.cc.orig 2021-12-14 11:44:55 UTC +--- base/system/sys_info.cc.orig 2022-02-07 13:39:41 UTC +++ base/system/sys_info.cc -@@ -92,7 +92,7 @@ void SysInfo::GetHardwareInfo(base::OnceCallback<void( +@@ -100,7 +100,7 @@ void SysInfo::GetHardwareInfo(base::OnceCallback<void( #if defined(OS_WIN) || defined(OS_ANDROID) || defined(OS_APPLE) base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {}, base::BindOnce(&GetHardwareInfoSync), std::move(callback)); diff --git a/www/chromium/files/patch-base_system_sys__info.h b/www/chromium/files/patch-base_system_sys__info.h index b546599cf524..4991e13686f3 100644 --- a/www/chromium/files/patch-base_system_sys__info.h +++ b/www/chromium/files/patch-base_system_sys__info.h @@ -1,7 +1,7 @@ ---- base/system/sys_info.h.orig 2021-09-14 01:51:47 UTC +--- base/system/sys_info.h.orig 2022-02-07 13:39:41 UTC +++ base/system/sys_info.h -@@ -210,6 +210,8 @@ class BASE_EXPORT SysInfo { - // On Desktop this returns true when memory <= 512MB. +@@ -236,6 +236,8 @@ class BASE_EXPORT SysInfo { + // On Desktop this returns true when memory <= 2GB. static bool IsLowEndDevice(); + static uint64_t MaxSharedMemorySize(); @@ -9,12 +9,12 @@ private: FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory); FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo); -@@ -219,7 +221,7 @@ class BASE_EXPORT SysInfo { - static bool IsLowEndDeviceImpl(); +@@ -246,7 +248,7 @@ class BASE_EXPORT SysInfo { static HardwareInfo GetHardwareInfoSync(); --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_AIX) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_BSD) static int64_t AmountOfAvailablePhysicalMemory( const SystemMemoryInfoKB& meminfo); + #endif diff --git a/www/chromium/files/patch-base_system_sys__info__openbsd.cc b/www/chromium/files/patch-base_system_sys__info__openbsd.cc new file mode 100644 index 000000000000..9da562746469 --- /dev/null +++ b/www/chromium/files/patch-base_system_sys__info__openbsd.cc @@ -0,0 +1,100 @@ +--- base/system/sys_info_openbsd.cc.orig 2022-02-07 13:39:41 UTC ++++ base/system/sys_info_openbsd.cc +@@ -12,6 +12,7 @@ + + #include "base/cxx17_backports.h" + #include "base/notreached.h" ++#include "base/strings/string_util.h" + + namespace { + +@@ -29,9 +30,14 @@ int64_t AmountOfMemory(int pages_name) { + + namespace base { + ++// pledge(2) ++int64_t aofpmem = 0; ++int64_t aofapmem = 0; ++int64_t shmmax = 0; ++ + // static + int SysInfo::NumberOfProcessors() { +- int mib[] = {CTL_HW, HW_NCPU}; ++ int mib[] = {CTL_HW, HW_NCPUONLINE}; + int ncpu; + size_t size = sizeof(ncpu); + if (sysctl(mib, base::size(mib), &ncpu, &size, NULL, 0) < 0) { +@@ -43,38 +49,61 @@ int SysInfo::NumberOfProcessors() { + + // static + int64_t SysInfo::AmountOfPhysicalMemoryImpl() { +- return AmountOfMemory(_SC_PHYS_PAGES); ++ // pledge(2) ++ if (!aofpmem) ++ aofpmem = AmountOfMemory(_SC_PHYS_PAGES); ++ return aofpmem; + } + + // static + int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { + // We should add inactive file-backed memory also but there is no such + // information from OpenBSD unfortunately. +- return AmountOfMemory(_SC_AVPHYS_PAGES); ++ // pledge(2) ++ if (!aofapmem) ++ aofapmem = AmountOfMemory(_SC_AVPHYS_PAGES); ++ return aofapmem; + } + + // static ++std::string SysInfo::CPUModelName() { ++ int mib[] = {CTL_HW, HW_MODEL}; ++ char name[256]; ++ size_t len = base::size(name); ++ if (sysctl(mib, base::size(mib), name, &len, NULL, 0) < 0) { ++ NOTREACHED(); ++ return std::string(); ++ } ++ return name; ++} ++ ++// static + uint64_t SysInfo::MaxSharedMemorySize() { + int mib[] = {CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX}; + size_t limit; + size_t size = sizeof(limit); ++ // pledge(2) ++ if (shmmax) ++ goto out; + if (sysctl(mib, base::size(mib), &limit, &size, NULL, 0) < 0) { + NOTREACHED(); + return 0; + } +- return static_cast<uint64_t>(limit); ++ shmmax = static_cast<uint64_t>(limit); ++out: ++ return shmmax; + } + + // static +-std::string SysInfo::CPUModelName() { +- int mib[] = {CTL_HW, HW_MODEL}; +- char name[256]; +- size_t len = base::size(name); +- if (sysctl(mib, base::size(mib), name, &len, NULL, 0) < 0) { +- NOTREACHED(); +- return std::string(); +- } +- return name; ++SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() { ++ HardwareInfo info; ++ // Set the manufacturer to "OpenBSD" and the model to ++ // an empty string. ++ info.manufacturer = "OpenBSD"; ++ info.model = HardwareModelName(); ++ DCHECK(IsStringUTF8(info.manufacturer)); ++ DCHECK(IsStringUTF8(info.model)); ++ return info; + } + + } // namespace base diff --git a/www/chromium/files/patch-base_system_sys__info__posix.cc b/www/chromium/files/patch-base_system_sys__info__posix.cc index 46bca98b2550..107e2da853a5 100644 --- a/www/chromium/files/patch-base_system_sys__info__posix.cc +++ b/www/chromium/files/patch-base_system_sys__info__posix.cc @@ -1,18 +1,6 @@ ---- base/system/sys_info_posix.cc.orig 2021-04-14 18:40:48 UTC +--- base/system/sys_info_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/system/sys_info_posix.cc -@@ -26,6 +26,11 @@ - #if defined(OS_ANDROID) - #include <sys/vfs.h> - #define statvfs statfs // Android uses a statvfs-like statfs struct and call. -+#elif defined(OS_BSD) -+#include <sys/param.h> -+#include <sys/mount.h> -+#define statvfs statfs -+#define f_frsize f_bsize - #else - #include <sys/statvfs.h> - #endif -@@ -239,6 +244,8 @@ std::string SysInfo::OperatingSystemArchitecture() { +@@ -252,6 +252,8 @@ std::string SysInfo::OperatingSystemArchitecture() { arch = "x86"; } else if (arch == "amd64") { arch = "x86_64"; diff --git a/www/chromium/files/patch-base_system_sys__info__unittest.cc b/www/chromium/files/patch-base_system_sys__info__unittest.cc deleted file mode 100644 index e266b5462fbe..000000000000 --- a/www/chromium/files/patch-base_system_sys__info__unittest.cc +++ /dev/null @@ -1,46 +0,0 @@ ---- base/system/sys_info_unittest.cc.orig 2021-12-31 00:57:18 UTC -+++ base/system/sys_info_unittest.cc -@@ -64,13 +64,13 @@ TEST_F(SysInfoTest, AmountOfMem) { - EXPECT_GE(SysInfo::AmountOfVirtualMemory(), 0); - } - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #define MAYBE_AmountOfAvailablePhysicalMemory \ - DISABLED_AmountOfAvailablePhysicalMemory - #else - #define MAYBE_AmountOfAvailablePhysicalMemory AmountOfAvailablePhysicalMemory --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - TEST_F(SysInfoTest, MAYBE_AmountOfAvailablePhysicalMemory) { - // Note: info is in _K_bytes. - SystemMemoryInfoKB info; -@@ -101,7 +101,7 @@ TEST_F(SysInfoTest, MAYBE_AmountOfAvailablePhysicalMem - EXPECT_GT(amount, static_cast<int64_t>(info.free) * 1024); - EXPECT_LT(amount / 1024, info.total); - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) - - TEST_F(SysInfoTest, AmountOfFreeDiskSpace) { - // We aren't actually testing that it's correct, just that it's sane. -@@ -141,7 +141,7 @@ TEST_F(SysInfoTest, NestedVolumesAmountOfTotalDiskSpac - } - #endif // defined(OS_FUCHSIA) - --#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ -+#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || \ - defined(OS_CHROMEOS) || defined(OS_FUCHSIA) - TEST_F(SysInfoTest, OperatingSystemVersionNumbers) { - int32_t os_major_version = -1; -@@ -227,7 +227,7 @@ TEST_F(SysInfoTest, GetHardwareInfo) { - EXPECT_TRUE(IsStringUTF8(hardware_info->model)); - bool empty_result_expected = - #if defined(OS_ANDROID) || defined(OS_APPLE) || defined(OS_WIN) || \ -- defined(OS_LINUX) || defined(OS_CHROMEOS) -+ defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - false; - #else - true; diff --git a/www/chromium/files/patch-base_task_thread__pool_environment__config__unittest.cc b/www/chromium/files/patch-base_task_thread__pool_environment__config__unittest.cc deleted file mode 100644 index af894c771972..000000000000 --- a/www/chromium/files/patch-base_task_thread__pool_environment__config__unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/task/thread_pool/environment_config_unittest.cc.orig 2021-04-14 18:40:48 UTC -+++ base/task/thread_pool/environment_config_unittest.cc -@@ -14,7 +14,7 @@ namespace internal { - TEST(ThreadPoolEnvironmentConfig, CanUseBackgroundPriorityForWorker) { - #if defined(OS_WIN) || defined(OS_APPLE) - EXPECT_TRUE(CanUseBackgroundPriorityForWorkerThread()); --#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || \ -+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || defined(OS_BSD) || \ - defined(OS_CHROMEOS) || defined(OS_NACL) - EXPECT_FALSE(CanUseBackgroundPriorityForWorkerThread()); - #else diff --git a/www/chromium/files/patch-base_test_launcher_test__launcher.cc b/www/chromium/files/patch-base_test_launcher_test__launcher.cc index 13fb245637cf..9625a1f0bd0d 100644 --- a/www/chromium/files/patch-base_test_launcher_test__launcher.cc +++ b/www/chromium/files/patch-base_test_launcher_test__launcher.cc @@ -1,6 +1,6 @@ ---- base/test/launcher/test_launcher.cc.orig 2021-12-14 11:44:55 UTC +--- base/test/launcher/test_launcher.cc.orig 2022-02-07 13:39:41 UTC +++ base/test/launcher/test_launcher.cc -@@ -62,6 +62,7 @@ +@@ -63,6 +63,7 @@ #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_POSIX) @@ -8,21 +8,3 @@ #include <fcntl.h> #include "base/files/file_descriptor_watcher_posix.h" -@@ -620,7 +621,7 @@ ChildProcessResults DoLaunchChildTestProcess( - #if !defined(OS_FUCHSIA) - options.new_process_group = true; - #endif --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - options.kill_on_parent_death = true; - #endif - -@@ -1571,7 +1572,7 @@ bool TestLauncher::Init(CommandLine* command_line) { - results_tracker_.AddGlobalTag("OS_IOS"); - #endif - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - results_tracker_.AddGlobalTag("OS_LINUX"); - #endif - diff --git a/www/chromium/files/patch-base_test_test__file__util__linux.cc b/www/chromium/files/patch-base_test_test__file__util__linux.cc new file mode 100644 index 000000000000..137d156cf616 --- /dev/null +++ b/www/chromium/files/patch-base_test_test__file__util__linux.cc @@ -0,0 +1,13 @@ +--- base/test/test_file_util_linux.cc.orig 2022-02-07 13:39:41 UTC ++++ base/test/test_file_util_linux.cc +@@ -52,8 +52,10 @@ bool EvictFileFromSystemCache(const FilePath& file) { + return false; + if (fdatasync(fd.get()) != 0) + return false; ++#if !defined(OS_BSD) + if (posix_fadvise(fd.get(), 0, 0, POSIX_FADV_DONTNEED) != 0) + return false; ++#endif + return true; + } + diff --git a/www/chromium/files/patch-base_test_test__file__util__posix.cc b/www/chromium/files/patch-base_test_test__file__util__posix.cc deleted file mode 100644 index 2bd4c0452c6b..000000000000 --- a/www/chromium/files/patch-base_test_test__file__util__posix.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- base/test/test_file_util_posix.cc.orig 2021-04-14 18:40:48 UTC -+++ base/test/test_file_util_posix.cc -@@ -87,7 +87,7 @@ void SyncPageCacheToDisk() { - sync(); - } - --#if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_APPLE) && \ -+#if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_APPLE) && !defined(OS_BSD) && \ - !defined(OS_ANDROID) - bool EvictFileFromSystemCache(const FilePath& file) { - // There doesn't seem to be a POSIX way to cool the disk cache. diff --git a/www/chromium/files/patch-base_test_test__suite.cc b/www/chromium/files/patch-base_test_test__suite.cc deleted file mode 100644 index 511cfda2c7e8..000000000000 --- a/www/chromium/files/patch-base_test_test__suite.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- base/test/test_suite.cc.orig 2022-01-05 13:32:44 UTC -+++ base/test/test_suite.cc -@@ -221,7 +221,7 @@ class CheckForLeakedGlobals : public testing::EmptyTes - }; - - // base::Process is not available on iOS --#if !defined(OS_IOS) -+#if !defined(OS_IOS) && !defined(OS_BSD) - class CheckProcessPriority : public testing::EmptyTestEventListener { - public: - CheckProcessPriority() { CHECK(!IsProcessBackgrounded()); } -@@ -634,7 +634,7 @@ void TestSuite::Initialize() { - if (check_for_leaked_globals_) - listeners.Append(new CheckForLeakedGlobals); - if (check_for_thread_and_process_priority_) { --#if !defined(OS_IOS) -+#if !defined(OS_IOS) && !defined(OS_BSD) - listeners.Append(new CheckProcessPriority); - #endif - } diff --git a/www/chromium/files/patch-base_third__party_libevent_event-config.h b/www/chromium/files/patch-base_third__party_libevent_event-config.h new file mode 100644 index 000000000000..eaa2383bbb97 --- /dev/null +++ b/www/chromium/files/patch-base_third__party_libevent_event-config.h @@ -0,0 +1,11 @@ +--- base/third_party/libevent/event-config.h.orig 2022-02-07 13:39:41 UTC ++++ base/third_party/libevent/event-config.h +@@ -13,6 +13,8 @@ + #include "base/third_party/libevent/linux/event-config.h" + #elif defined(__FreeBSD__) + #include "base/third_party/libevent/freebsd/event-config.h" ++#elif defined(__OpenBSD__) ++#include "base/third_party/libevent/openbsd/event-config.h" + #elif defined(__sun) + #include "base/third_party/libevent/solaris/event-config.h" + #elif defined(_AIX) diff --git a/www/chromium/files/patch-base_third__party_libevent_openbsd_config.h b/www/chromium/files/patch-base_third__party_libevent_openbsd_config.h new file mode 100644 index 000000000000..6c3c65196f6d --- /dev/null +++ b/www/chromium/files/patch-base_third__party_libevent_openbsd_config.h @@ -0,0 +1,279 @@ +--- base/third_party/libevent/openbsd/config.h.orig 2022-02-07 13:39:41 UTC ++++ base/third_party/libevent/openbsd/config.h +@@ -0,0 +1,276 @@ ++/* config.h. Generated from config.h.in by configure. */ ++/* config.h.in. Generated from configure.in by autoheader. */ ++ ++/* Define if clock_gettime is available in libc */ ++#define DNS_USE_CPU_CLOCK_FOR_ID 1 ++ ++/* Define is no secure id variant is available */ ++/* #undef DNS_USE_GETTIMEOFDAY_FOR_ID */ ++ ++/* Define to 1 if you have the `clock_gettime' function. */ ++#define HAVE_CLOCK_GETTIME 1 ++ ++/* Define if /dev/poll is available */ ++/* #undef HAVE_DEVPOLL */ ++ ++/* Define to 1 if you have the <dlfcn.h> header file. */ ++#define HAVE_DLFCN_H 1 ++ ++/* Define if your system supports the epoll system calls */ ++/* #undef HAVE_EPOLL */ ++ ++/* Define to 1 if you have the `epoll_ctl' function. */ ++/* #undef HAVE_EPOLL_CTL */ ++ ++/* Define if your system supports event ports */ ++/* #undef HAVE_EVENT_PORTS */ ++ ++/* Define to 1 if you have the `fcntl' function. */ ++#define HAVE_FCNTL 1 ++ ++/* Define to 1 if you have the <fcntl.h> header file. */ ++#define HAVE_FCNTL_H 1 ++ ++/* Define to 1 if the system has the type `fd_mask'. */ ++#define HAVE_FD_MASK 1 ++ ++/* Define to 1 if you have the `getaddrinfo' function. */ ++#define HAVE_GETADDRINFO 1 ++ ++/* Define to 1 if you have the `getegid' function. */ ++#define HAVE_GETEGID 1 ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#define HAVE_GETEUID 1 ++ ++/* Define to 1 if you have the `getnameinfo' function. */ ++#define HAVE_GETNAMEINFO 1 ++ ++/* Define to 1 if you have the `gettimeofday' function. */ ++#define HAVE_GETTIMEOFDAY 1 ++ ++/* Define to 1 if you have the `inet_ntop' function. */ ++#define HAVE_INET_NTOP 1 ++ ++/* Define to 1 if you have the <inttypes.h> header file. */ ++#define HAVE_INTTYPES_H 1 ++ ++/* Define to 1 if you have the `issetugid' function. */ ++#define HAVE_ISSETUGID 1 ++ ++/* Define to 1 if you have the `kqueue' function. */ ++#define HAVE_KQUEUE 1 ++ ++/* Define to 1 if you have the `nsl' library (-lnsl). */ ++/* #undef HAVE_LIBNSL */ ++ ++/* Define to 1 if you have the `resolv' library (-lresolv). */ ++/* #undef HAVE_LIBRESOLV */ ++ ++/* Define to 1 if you have the `rt' library (-lrt). */ ++/* #undef HAVE_LIBRT */ ++ ++/* Define to 1 if you have the `socket' library (-lsocket). */ ++/* #undef HAVE_LIBSOCKET */ ++ ++/* Define to 1 if you have the <memory.h> header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the <netinet/in6.h> header file. */ ++/* #undef HAVE_NETINET_IN6_H */ ++ ++/* Define to 1 if you have the `poll' function. */ ++#define HAVE_POLL 1 ++ ++/* Define to 1 if you have the <poll.h> header file. */ ++#define HAVE_POLL_H 1 ++ ++/* Define to 1 if you have the `port_create' function. */ ++/* #undef HAVE_PORT_CREATE */ ++ ++/* Define to 1 if you have the <port.h> header file. */ ++/* #undef HAVE_PORT_H */ ++ ++/* Define to 1 if you have the `select' function. */ ++#define HAVE_SELECT 1 ++ ++/* Define if F_SETFD is defined in <fcntl.h> */ ++#define HAVE_SETFD 1 ++ ++/* Define to 1 if you have the `sigaction' function. */ ++#define HAVE_SIGACTION 1 ++ ++/* Define to 1 if you have the `signal' function. */ ++#define HAVE_SIGNAL 1 ++ ++/* Define to 1 if you have the <signal.h> header file. */ ++#define HAVE_SIGNAL_H 1 ++ ++/* Define to 1 if you have the <stdarg.h> header file. */ ++#define HAVE_STDARG_H 1 ++ ++/* Define to 1 if you have the <stdint.h> header file. */ ++#define HAVE_STDINT_H 1 ++ ++/* Define to 1 if you have the <stdlib.h> header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the <strings.h> header file. */ ++#define HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the <string.h> header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strlcpy' function. */ ++#define HAVE_STRLCPY 1 ++ ++/* Define to 1 if you have the `strsep' function. */ ++#define HAVE_STRSEP 1 ++ ++/* Define to 1 if you have the `strtok_r' function. */ ++#define HAVE_STRTOK_R 1 ++ ++/* Define to 1 if you have the `strtoll' function. */ ++#define HAVE_STRTOLL 1 ++ ++/* Define to 1 if the system has the type `struct in6_addr'. */ ++#define HAVE_STRUCT_IN6_ADDR 1 ++ ++/* Define to 1 if you have the <sys/devpoll.h> header file. */ ++/* #undef HAVE_SYS_DEVPOLL_H */ ++ ++/* Define to 1 if you have the <sys/epoll.h> header file. */ ++/* #undef HAVE_SYS_EPOLL_H */ ++ ++/* Define to 1 if you have the <sys/event.h> header file. */ ++#define HAVE_SYS_EVENT_H 1 ++ ++/* Define to 1 if you have the <sys/ioctl.h> header file. */ ++#define HAVE_SYS_IOCTL_H 1 ++ ++/* Define to 1 if you have the <sys/param.h> header file. */ ++#define HAVE_SYS_PARAM_H 1 ++ ++/* Define to 1 if you have the <sys/queue.h> header file. */ ++#define HAVE_SYS_QUEUE_H 1 ++ ++/* Define to 1 if you have the <sys/select.h> header file. */ ++#define HAVE_SYS_SELECT_H 1 ++ ++/* Define to 1 if you have the <sys/socket.h> header file. */ ++#define HAVE_SYS_SOCKET_H 1 ++ ++/* Define to 1 if you have the <sys/stat.h> header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the <sys/time.h> header file. */ ++#define HAVE_SYS_TIME_H 1 ++ ++/* Define to 1 if you have the <sys/types.h> header file. */ ++#define HAVE_SYS_TYPES_H 1 ++ ++/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */ ++#define HAVE_TAILQFOREACH 1 ++ ++/* Define if timeradd is defined in <sys/time.h> */ ++#define HAVE_TIMERADD 1 ++ ++/* Define if timerclear is defined in <sys/time.h> */ ++#define HAVE_TIMERCLEAR 1 ++ ++/* Define if timercmp is defined in <sys/time.h> */ ++#define HAVE_TIMERCMP 1 ++ ++/* Define if timerisset is defined in <sys/time.h> */ ++#define HAVE_TIMERISSET 1 ++ ++/* Define to 1 if the system has the type `uint16_t'. */ ++#define HAVE_UINT16_T 1 ++ ++/* Define to 1 if the system has the type `uint32_t'. */ ++#define HAVE_UINT32_T 1 ++ ++/* Define to 1 if the system has the type `uint64_t'. */ ++#define HAVE_UINT64_T 1 ++ ++/* Define to 1 if the system has the type `uint8_t'. */ ++#define HAVE_UINT8_T 1 ++ ++/* Define to 1 if you have the <unistd.h> header file. */ ++#define HAVE_UNISTD_H 1 ++ ++/* Define to 1 if you have the `vasprintf' function. */ ++#define HAVE_VASPRINTF 1 ++ ++/* Define if kqueue works correctly with pipes */ ++#define HAVE_WORKING_KQUEUE 1 ++ ++/* Define to the sub-directory in which libtool stores uninstalled libraries. ++ */ ++#define LT_OBJDIR ".libs/" ++ ++/* Numeric representation of the version */ ++#define NUMERIC_VERSION 0x01040f00 ++ ++/* Name of package */ ++#define PACKAGE "libevent" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#define PACKAGE_BUGREPORT "" ++ ++/* Define to the full name of this package. */ ++#define PACKAGE_NAME "" ++ ++/* Define to the full name and version of this package. */ ++#define PACKAGE_STRING "" ++ ++/* Define to the one symbol short name of this package. */ ++#define PACKAGE_TARNAME "" ++ ++/* Define to the home page for this package. */ ++#define PACKAGE_URL "" ++ ++/* Define to the version of this package. */ ++#define PACKAGE_VERSION "" ++ ++/* The size of `int', as computed by sizeof. */ ++#define SIZEOF_INT 4 ++ ++/* The size of `long', as computed by sizeof. */ ++#define SIZEOF_LONG 8 ++ ++/* The size of `long long', as computed by sizeof. */ ++#define SIZEOF_LONG_LONG 8 ++ ++/* The size of `short', as computed by sizeof. */ ++#define SIZEOF_SHORT 2 ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ ++#define TIME_WITH_SYS_TIME 1 ++ ++/* Version number of package */ ++#define VERSION "1.4.15" ++ ++/* Define to appropriate substitue if compiler doesnt have __func__ */ ++/* #undef __func__ */ ++ ++/* Define to empty if `const' does not conform to ANSI C. */ ++/* #undef const */ ++ ++/* Define to `__inline__' or `__inline' if that's what the C compiler ++ calls it, or to nothing if 'inline' is not supported under any name. */ ++#ifndef __cplusplus ++/* #undef inline */ ++#endif ++ ++/* Define to `int' if <sys/types.h> does not define. */ ++/* #undef pid_t */ ++ ++/* Define to `unsigned int' if <sys/types.h> does not define. */ ++/* #undef size_t */ ++ ++/* Define to unsigned int if you dont have it */ ++/* #undef socklen_t */ diff --git a/www/chromium/files/patch-base_third__party_libevent_openbsd_event-config.h b/www/chromium/files/patch-base_third__party_libevent_openbsd_event-config.h new file mode 100644 index 000000000000..de5423361f24 --- /dev/null +++ b/www/chromium/files/patch-base_third__party_libevent_openbsd_event-config.h @@ -0,0 +1,287 @@ +--- base/third_party/libevent/openbsd/event-config.h.orig 2022-02-07 13:39:41 UTC ++++ base/third_party/libevent/openbsd/event-config.h +@@ -0,0 +1,284 @@ ++/* event-config.h ++ * Generated by autoconf; post-processed by libevent. ++ * Do not edit this file. ++ * Do not rely on macros in this file existing in later versions. ++ */ ++#ifndef _EVENT_CONFIG_H_ ++#define _EVENT_CONFIG_H_ ++/* config.h. Generated from config.h.in by configure. */ ++/* config.h.in. Generated from configure.in by autoheader. */ ++ ++/* Define if clock_gettime is available in libc */ ++#define _EVENT_DNS_USE_CPU_CLOCK_FOR_ID 1 ++ ++/* Define is no secure id variant is available */ ++/* #undef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID */ ++ ++/* Define to 1 if you have the `clock_gettime' function. */ ++#define _EVENT_HAVE_CLOCK_GETTIME 1 ++ ++/* Define if /dev/poll is available */ ++/* #undef _EVENT_HAVE_DEVPOLL */ ++ ++/* Define to 1 if you have the <dlfcn.h> header file. */ ++#define _EVENT_HAVE_DLFCN_H 1 ++ ++/* Define if your system supports the epoll system calls */ ++/* #undef _EVENT_HAVE_EPOLL */ ++ ++/* Define to 1 if you have the `epoll_ctl' function. */ ++/* #undef _EVENT_HAVE_EPOLL_CTL */ ++ ++/* Define if your system supports event ports */ ++/* #undef _EVENT_HAVE_EVENT_PORTS */ ++ ++/* Define to 1 if you have the `fcntl' function. */ ++#define _EVENT_HAVE_FCNTL 1 ++ ++/* Define to 1 if you have the <fcntl.h> header file. */ ++#define _EVENT_HAVE_FCNTL_H 1 ++ ++/* Define to 1 if the system has the type `fd_mask'. */ ++#define _EVENT_HAVE_FD_MASK 1 ++ ++/* Define to 1 if you have the `getaddrinfo' function. */ ++#define _EVENT_HAVE_GETADDRINFO 1 ++ ++/* Define to 1 if you have the `getegid' function. */ ++#define _EVENT_HAVE_GETEGID 1 ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#define _EVENT_HAVE_GETEUID 1 ++ ++/* Define to 1 if you have the `getnameinfo' function. */ ++#define _EVENT_HAVE_GETNAMEINFO 1 ++ ++/* Define to 1 if you have the `gettimeofday' function. */ ++#define _EVENT_HAVE_GETTIMEOFDAY 1 ++ ++/* Define to 1 if you have the `inet_ntop' function. */ ++#define _EVENT_HAVE_INET_NTOP 1 ++ ++/* Define to 1 if you have the <inttypes.h> header file. */ ++#define _EVENT_HAVE_INTTYPES_H 1 ++ ++/* Define to 1 if you have the `issetugid' function. */ ++#define _EVENT_HAVE_ISSETUGID 1 ++ ++/* Define to 1 if you have the `kqueue' function. */ ++#define _EVENT_HAVE_KQUEUE 1 ++ ++/* Define to 1 if you have the `nsl' library (-lnsl). */ ++/* #undef _EVENT_HAVE_LIBNSL */ ++ ++/* Define to 1 if you have the `resolv' library (-lresolv). */ ++/* #undef _EVENT_HAVE_LIBRESOLV */ ++ ++/* Define to 1 if you have the `rt' library (-lrt). */ ++/* #undef _EVENT_HAVE_LIBRT */ ++ ++/* Define to 1 if you have the `socket' library (-lsocket). */ ++/* #undef _EVENT_HAVE_LIBSOCKET */ ++ ++/* Define to 1 if you have the <memory.h> header file. */ ++#define _EVENT_HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the <netinet/in6.h> header file. */ ++/* #undef _EVENT_HAVE_NETINET_IN6_H */ ++ ++/* Define to 1 if you have the `poll' function. */ ++#define _EVENT_HAVE_POLL 1 ++ ++/* Define to 1 if you have the <poll.h> header file. */ ++#define _EVENT_HAVE_POLL_H 1 ++ ++/* Define to 1 if you have the `port_create' function. */ ++/* #undef _EVENT_HAVE_PORT_CREATE */ ++ ++/* Define to 1 if you have the <port.h> header file. */ ++/* #undef _EVENT_HAVE_PORT_H */ ++ ++/* Define to 1 if you have the `select' function. */ ++#define _EVENT_HAVE_SELECT 1 ++ ++/* Define if F_SETFD is defined in <fcntl.h> */ ++#define _EVENT_HAVE_SETFD 1 ++ ++/* Define to 1 if you have the `sigaction' function. */ ++#define _EVENT_HAVE_SIGACTION 1 ++ ++/* Define to 1 if you have the `signal' function. */ ++#define _EVENT_HAVE_SIGNAL 1 ++ ++/* Define to 1 if you have the <signal.h> header file. */ ++#define _EVENT_HAVE_SIGNAL_H 1 ++ ++/* Define to 1 if you have the <stdarg.h> header file. */ ++#define _EVENT_HAVE_STDARG_H 1 ++ ++/* Define to 1 if you have the <stdint.h> header file. */ ++#define _EVENT_HAVE_STDINT_H 1 ++ ++/* Define to 1 if you have the <stdlib.h> header file. */ ++#define _EVENT_HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the <strings.h> header file. */ ++#define _EVENT_HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the <string.h> header file. */ ++#define _EVENT_HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strlcpy' function. */ ++#define _EVENT_HAVE_STRLCPY 1 ++ ++/* Define to 1 if you have the `strsep' function. */ ++#define _EVENT_HAVE_STRSEP 1 ++ ++/* Define to 1 if you have the `strtok_r' function. */ ++#define _EVENT_HAVE_STRTOK_R 1 ++ ++/* Define to 1 if you have the `strtoll' function. */ ++#define _EVENT_HAVE_STRTOLL 1 ++ ++/* Define to 1 if the system has the type `struct in6_addr'. */ ++#define _EVENT_HAVE_STRUCT_IN6_ADDR 1 ++ ++/* Define to 1 if you have the <sys/devpoll.h> header file. */ ++/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */ ++ ++/* Define to 1 if you have the <sys/epoll.h> header file. */ ++/* #undef _EVENT_HAVE_SYS_EPOLL_H */ ++ ++/* Define to 1 if you have the <sys/event.h> header file. */ ++#define _EVENT_HAVE_SYS_EVENT_H 1 ++ ++/* Define to 1 if you have the <sys/ioctl.h> header file. */ ++#define _EVENT_HAVE_SYS_IOCTL_H 1 ++ ++/* Define to 1 if you have the <sys/param.h> header file. */ ++#define _EVENT_HAVE_SYS_PARAM_H 1 ++ ++/* Define to 1 if you have the <sys/queue.h> header file. */ ++#define _EVENT_HAVE_SYS_QUEUE_H 1 ++ ++/* Define to 1 if you have the <sys/select.h> header file. */ ++#define _EVENT_HAVE_SYS_SELECT_H 1 ++ ++/* Define to 1 if you have the <sys/socket.h> header file. */ ++#define _EVENT_HAVE_SYS_SOCKET_H 1 ++ ++/* Define to 1 if you have the <sys/stat.h> header file. */ ++#define _EVENT_HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the <sys/time.h> header file. */ ++#define _EVENT_HAVE_SYS_TIME_H 1 ++ ++/* Define to 1 if you have the <sys/types.h> header file. */ ++#define _EVENT_HAVE_SYS_TYPES_H 1 ++ ++/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */ ++#define _EVENT_HAVE_TAILQFOREACH 1 ++ ++/* Define if timeradd is defined in <sys/time.h> */ ++#define _EVENT_HAVE_TIMERADD 1 ++ ++/* Define if timerclear is defined in <sys/time.h> */ ++#define _EVENT_HAVE_TIMERCLEAR 1 ++ ++/* Define if timercmp is defined in <sys/time.h> */ ++#define _EVENT_HAVE_TIMERCMP 1 ++ ++/* Define if timerisset is defined in <sys/time.h> */ ++#define _EVENT_HAVE_TIMERISSET 1 ++ ++/* Define to 1 if the system has the type `uint16_t'. */ ++#define _EVENT_HAVE_UINT16_T 1 ++ ++/* Define to 1 if the system has the type `uint32_t'. */ ++#define _EVENT_HAVE_UINT32_T 1 ++ ++/* Define to 1 if the system has the type `uint64_t'. */ ++#define _EVENT_HAVE_UINT64_T 1 ++ ++/* Define to 1 if the system has the type `uint8_t'. */ ++#define _EVENT_HAVE_UINT8_T 1 ++ ++/* Define to 1 if you have the <unistd.h> header file. */ ++#define _EVENT_HAVE_UNISTD_H 1 ++ ++/* Define to 1 if you have the `vasprintf' function. */ ++#define _EVENT_HAVE_VASPRINTF 1 ++ ++/* Define if kqueue works correctly with pipes */ ++#define _EVENT_HAVE_WORKING_KQUEUE 1 ++ ++/* Define to the sub-directory in which libtool stores uninstalled libraries. ++ */ ++#define _EVENT_LT_OBJDIR ".libs/" ++ ++/* Numeric representation of the version */ ++#define _EVENT_NUMERIC_VERSION 0x01040f00 ++ ++/* Name of package */ ++#define _EVENT_PACKAGE "libevent" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#define _EVENT_PACKAGE_BUGREPORT "" ++ ++/* Define to the full name of this package. */ ++#define _EVENT_PACKAGE_NAME "" ++ ++/* Define to the full name and version of this package. */ ++#define _EVENT_PACKAGE_STRING "" ++ ++/* Define to the one symbol short name of this package. */ ++#define _EVENT_PACKAGE_TARNAME "" ++ ++/* Define to the home page for this package. */ ++#define _EVENT_PACKAGE_URL "" ++ ++/* Define to the version of this package. */ ++#define _EVENT_PACKAGE_VERSION "" ++ ++/* The size of `int', as computed by sizeof. */ ++#define _EVENT_SIZEOF_INT 4 ++ ++/* The size of `long', as computed by sizeof. */ ++#define _EVENT_SIZEOF_LONG 8 ++ ++/* The size of `long long', as computed by sizeof. */ ++#define _EVENT_SIZEOF_LONG_LONG 8 ++ ++/* The size of `short', as computed by sizeof. */ ++#define _EVENT_SIZEOF_SHORT 2 ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define _EVENT_STDC_HEADERS 1 ++ ++/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ ++#define _EVENT_TIME_WITH_SYS_TIME 1 ++ ++/* Version number of package */ ++#define _EVENT_VERSION "1.4.15" ++ ++/* Define to appropriate substitue if compiler doesnt have __func__ */ ++/* #undef _EVENT___func__ */ ++ ++/* Define to empty if `const' does not conform to ANSI C. */ ++/* #undef _EVENT_const */ ++ ++/* Define to `__inline__' or `__inline' if that's what the C compiler ++ calls it, or to nothing if 'inline' is not supported under any name. */ ++#ifndef _EVENT___cplusplus ++/* #undef _EVENT_inline */ ++#endif ++ ++/* Define to `int' if <sys/types.h> does not define. */ ++/* #undef _EVENT_pid_t */ ++ ++/* Define to `unsigned int' if <sys/types.h> does not define. */ ++/* #undef _EVENT_size_t */ ++ ++/* Define to unsigned int if you dont have it */ ++/* #undef _EVENT_socklen_t */ ++#endif diff --git a/www/chromium/files/patch-base_third__party_symbolize_symbolize.cc b/www/chromium/files/patch-base_third__party_symbolize_symbolize.cc new file mode 100644 index 000000000000..c73aac47312a --- /dev/null +++ b/www/chromium/files/patch-base_third__party_symbolize_symbolize.cc @@ -0,0 +1,11 @@ +--- base/third_party/symbolize/symbolize.cc.orig 2022-02-07 13:39:41 UTC ++++ base/third_party/symbolize/symbolize.cc +@@ -113,7 +113,7 @@ _END_GOOGLE_NAMESPACE_ + #if defined(HAVE_DLFCN_H) + #include <dlfcn.h> + #endif +-#if defined(OS_OPENBSD) ++#if defined(__OpenBSD__) + #include <sys/exec_elf.h> + #else + #include <elf.h> diff --git a/www/chromium/files/patch-base_threading_platform__thread.h b/www/chromium/files/patch-base_threading_platform__thread.h index bff55b7b82ca..b1b6cf3f78e9 100644 --- a/www/chromium/files/patch-base_threading_platform__thread.h +++ b/www/chromium/files/patch-base_threading_platform__thread.h @@ -1,6 +1,6 @@ ---- base/threading/platform_thread.h.orig 2021-12-31 00:57:18 UTC +--- base/threading/platform_thread.h.orig 2022-02-07 13:39:41 UTC +++ base/threading/platform_thread.h -@@ -244,7 +244,7 @@ class BASE_EXPORT PlatformThread { +@@ -243,7 +243,7 @@ class BASE_EXPORT PlatformThread { // Returns a realtime period provided by `delegate`. static TimeDelta GetRealtimePeriod(Delegate* delegate); diff --git a/www/chromium/files/patch-base_threading_platform__thread__internal__posix.h b/www/chromium/files/patch-base_threading_platform__thread__internal__posix.h deleted file mode 100644 index 3619f1d34e67..000000000000 --- a/www/chromium/files/patch-base_threading_platform__thread__internal__posix.h +++ /dev/null @@ -1,18 +0,0 @@ ---- base/threading/platform_thread_internal_posix.h.orig 2021-12-31 00:57:18 UTC -+++ base/threading/platform_thread_internal_posix.h -@@ -46,13 +46,13 @@ bool SetCurrentThreadPriorityForPlatform(ThreadPriorit - // of CanIncreaseThreadPriority(). - absl::optional<ThreadPriority> GetCurrentThreadPriorityForPlatform(); - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // Current thread id is cached in thread local storage for performance reasons. - // In some rare cases it's important to clear that cache explicitly (e.g. after - // going through clone() syscall which does not call pthread_atfork() - // handlers). - BASE_EXPORT void ClearTidCache(); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - - } // namespace internal - diff --git a/www/chromium/files/patch-base_threading_platform__thread__linux.cc b/www/chromium/files/patch-base_threading_platform__thread__linux.cc index 30b2a7a63b6e..fcd82b84be44 100644 --- a/www/chromium/files/patch-base_threading_platform__thread__linux.cc +++ b/www/chromium/files/patch-base_threading_platform__thread__linux.cc @@ -1,4 +1,4 @@ ---- base/threading/platform_thread_linux.cc.orig 2022-01-20 10:35:46 UTC +--- base/threading/platform_thread_linux.cc.orig 2022-02-07 13:39:41 UTC +++ base/threading/platform_thread_linux.cc @@ -29,7 +29,9 @@ @@ -10,21 +10,8 @@ #include <sys/resource.h> #include <sys/time.h> #include <sys/types.h> -@@ -61,7 +63,7 @@ int g_scheduler_boost_adj; - int g_scheduler_limit_adj; - bool g_scheduler_use_latency_tune_adj; - --#if !defined(OS_NACL) && !defined(OS_AIX) -+#if !defined(OS_NACL) && !defined(OS_AIX) && !defined(OS_BSD) - - // Defined by linux uclamp ABI of sched_setattr(). - const uint32_t kSchedulerUclampMin = 0; -@@ -129,10 +131,10 @@ int sched_setattr(pid_t pid, - unsigned int flags) { - return syscall(__NR_sched_setattr, pid, attr, flags); - } --#endif // !defined(OS_NACL) && !defined(OS_AIX) -+#endif // !defined(OS_NACL) && !defined(OS_AIX) && !defined(OS_BSD) +@@ -132,7 +134,7 @@ int sched_setattr(pid_t pid, + #endif // !defined(OS_NACL) && !defined(OS_AIX) #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) -#if !defined(OS_NACL) @@ -77,15 +64,6 @@ // On linux we can get the thread names to show up in the debugger by setting // the process name for the LWP. We don't want to do this for the main // thread because that would rename the process, causing tools like killall -@@ -364,7 +366,7 @@ void PlatformThread::SetName(const std::string& name) - // We expect EPERM failures in sandboxed processes, just ignore those. - if (err < 0 && errno != EPERM) - DPLOG(ERROR) << "prctl(PR_SET_NAME)"; --#endif // !defined(OS_NACL) && !defined(OS_AIX) -+#endif // !defined(OS_NACL) && !defined(OS_AIX) && !defined(OS_BSD) - } - - #if !defined(OS_NACL) && !defined(OS_AIX) @@ -377,8 +379,10 @@ void PlatformThread::SetThreadPriority(ProcessId proce // priority. CHECK_NE(thread_id, process_id); @@ -97,14 +75,3 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) // For upstream uclamp interface. We try both legacy (schedtune, as done -@@ -435,7 +439,9 @@ void InitThreading() {} - void TerminateOnThread() {} - - size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { --#if !defined(THREAD_SANITIZER) -+#if defined(OS_BSD) -+ return (1 << 23); -+#elif !defined(THREAD_SANITIZER) - return 0; - #else - // ThreadSanitizer bloats the stack heavily. Evidence has been that the diff --git a/www/chromium/files/patch-base_threading_platform__thread__posix.cc b/www/chromium/files/patch-base_threading_platform__thread__posix.cc index 010ad62d6f9f..071a25201e45 100644 --- a/www/chromium/files/patch-base_threading_platform__thread__posix.cc +++ b/www/chromium/files/patch-base_threading_platform__thread__posix.cc @@ -1,22 +1,21 @@ ---- base/threading/platform_thread_posix.cc.orig 2021-12-14 11:44:55 UTC +--- base/threading/platform_thread_posix.cc.orig 2022-02-07 13:39:41 UTC +++ base/threading/platform_thread_posix.cc -@@ -33,6 +33,10 @@ - #include <sys/syscall.h> - #endif +@@ -74,7 +74,7 @@ void* ThreadFunc(void* params) { + if (!thread_params->joinable) + base::DisallowSingleton(); -+#if defined(OS_BSD) -+#include <pthread_np.h> -+#endif -+ - #if defined(OS_FUCHSIA) - #include <zircon/process.h> - #else -@@ -194,6 +198,8 @@ PlatformThreadId PlatformThread::CurrentId() { - // into the kernel. - #if defined(OS_APPLE) - return pthread_mach_thread_np(pthread_self()); +-#if !defined(OS_NACL) ++#if !defined(OS_NACL) && !defined(OS_BSD) + #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + internal::PCScan::NotifyThreadCreated(internal::GetStackPointer()); + #endif +@@ -333,6 +333,9 @@ bool PlatformThread::CanChangeThreadPriority(ThreadPri + // static + void PlatformThread::SetCurrentThreadPriorityImpl(ThreadPriority priority) { + #if defined(OS_NACL) ++ NOTIMPLEMENTED(); ++// avoid pledge(2) violation +#elif defined(OS_BSD) -+ return pthread_getthreadid_np(); - #elif defined(OS_LINUX) || defined(OS_CHROMEOS) - static InitAtFork init_at_fork; - if (g_thread_id == -1) { + NOTIMPLEMENTED(); + #else + if (internal::SetCurrentThreadPriorityForPlatform(priority)) diff --git a/www/chromium/files/patch-base_threading_platform__thread__unittest.cc b/www/chromium/files/patch-base_threading_platform__thread__unittest.cc deleted file mode 100644 index 17d59aae5527..000000000000 --- a/www/chromium/files/patch-base_threading_platform__thread__unittest.cc +++ /dev/null @@ -1,24 +0,0 @@ ---- base/threading/platform_thread_unittest.cc.orig 2022-01-20 10:35:46 UTC -+++ base/threading/platform_thread_unittest.cc -@@ -311,7 +311,7 @@ TEST(PlatformThreadTest, - // and hardcodes what we know. Please inform scheduler-dev@chromium.org if this - // proprerty changes for a given platform. - TEST(PlatformThreadTest, CanChangeThreadPriority) { --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // On Ubuntu, RLIMIT_NICE and RLIMIT_RTPRIO are 0 by default, so we won't be - // able to increase priority to any level. - constexpr bool kCanIncreasePriority = false; -@@ -409,9 +409,9 @@ TEST(PlatformThreadTest, SetHugeThreadName) { - - TEST(PlatformThreadTest, GetDefaultThreadStackSize) { - size_t stack_size = PlatformThread::GetDefaultThreadStackSize(); --#if defined(OS_WIN) || defined(OS_IOS) || defined(OS_FUCHSIA) || \ -- ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && \ -- !defined(THREAD_SANITIZER)) || \ -+#if defined(OS_WIN) || defined(OS_IOS) || defined(OS_FUCHSIA) || \ -+ ((defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) && \ -+ !defined(THREAD_SANITIZER)) || \ - (defined(OS_ANDROID) && !defined(ADDRESS_SANITIZER)) - EXPECT_EQ(0u, stack_size); - #else diff --git a/www/chromium/files/patch-base_threading_scoped__blocking__call__unittest.cc b/www/chromium/files/patch-base_threading_scoped__blocking__call__unittest.cc deleted file mode 100644 index d51bf587bd36..000000000000 --- a/www/chromium/files/patch-base_threading_scoped__blocking__call__unittest.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- base/threading/scoped_blocking_call_unittest.cc.orig 2021-12-14 11:44:55 UTC -+++ base/threading/scoped_blocking_call_unittest.cc -@@ -282,7 +282,7 @@ TEST_F(ScopedBlockingCallIOJankMonitoringTest, ManyInA - } - - TEST_F(ScopedBlockingCallIOJankMonitoringTest, OverlappingMultipleWindows) { -- constexpr auto kJankTiming = -+ auto kJankTiming = - internal::IOJankMonitoringWindow::kMonitoringWindow * 3 + - internal::IOJankMonitoringWindow::kIOJankInterval * 5; - -@@ -538,7 +538,7 @@ TEST_F(ScopedBlockingCallIOJankMonitoringTest, MultiTh - // First one starting at 10 seconds (can't start later than that or we'll trip - // the kTimeDiscrepancyTimeout per TaskEnvironment's inability to RunUntilIdle() - // with pending blocked tasks). --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - // https://crbug.com/1071166 - #define MAYBE_MultiThreadedOverlappedWindows \ - DISABLED_MultiThreadedOverlappedWindows diff --git a/www/chromium/files/patch-base_threading_thread__task__runner__handle.cc b/www/chromium/files/patch-base_threading_thread__task__runner__handle.cc deleted file mode 100644 index 821e6f66682f..000000000000 --- a/www/chromium/files/patch-base_threading_thread__task__runner__handle.cc +++ /dev/null @@ -1,26 +0,0 @@ ---- base/threading/thread_task_runner_handle.cc.orig 2021-12-14 11:44:55 UTC -+++ base/threading/thread_task_runner_handle.cc -@@ -8,6 +8,7 @@ - #include <utility> - - #include "base/bind.h" -+#include "base/callback_helpers.h" - #include "base/check_op.h" - #include "base/dcheck_is_on.h" - #include "base/lazy_instance.h" -@@ -40,6 +41,7 @@ const scoped_refptr<SingleThreadTaskRunner>& ThreadTas - return current->task_runner_; - } - -+#if defined(OS_BSD) - // static - bool ThreadTaskRunnerHandle::IsSet() { - return !!thread_task_runner_tls.Pointer()->Get(); -@@ -87,6 +89,7 @@ ThreadTaskRunnerHandleOverride::ThreadTaskRunnerHandle - if (!allow_nested_runloop) - no_running_during_override_.emplace(); - } -+#endif - - ThreadTaskRunnerHandleOverride::~ThreadTaskRunnerHandleOverride() { - if (task_runner_to_restore_) { diff --git a/www/chromium/files/patch-base_time_time.cc b/www/chromium/files/patch-base_time_time.cc index 8809f2523e7c..b2f0f148e1a8 100644 --- a/www/chromium/files/patch-base_time_time.cc +++ b/www/chromium/files/patch-base_time_time.cc @@ -1,6 +1,6 @@ ---- base/time/time.cc.orig 2021-09-24 04:25:56 UTC +--- base/time/time.cc.orig 2022-02-07 13:39:41 UTC +++ base/time/time.cc -@@ -4,12 +4,12 @@ +@@ -4,7 +4,7 @@ #include "base/time/time.h" @@ -9,9 +9,3 @@ // time.h is a widely included header and its size impacts build time. // Try not to raise this limit unless necessary. See // https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md - #pragma clang max_tokens_here 390000 --#endif // defined(OS_LINUX) -+#endif // defined(OS_LINUX) || defined(OS_BSD) - - #include <atomic> - #include <cmath> diff --git a/www/chromium/files/patch-base_trace__event_heap__profiler__allocation__context__tracker.cc b/www/chromium/files/patch-base_trace__event_heap__profiler__allocation__context__tracker.cc deleted file mode 100644 index 510fe325059f..000000000000 --- a/www/chromium/files/patch-base_trace__event_heap__profiler__allocation__context__tracker.cc +++ /dev/null @@ -1,38 +0,0 @@ ---- base/trace_event/heap_profiler_allocation_context_tracker.cc.orig 2021-12-14 11:44:55 UTC -+++ base/trace_event/heap_profiler_allocation_context_tracker.cc -@@ -30,6 +30,10 @@ - #include <sys/prctl.h> - #endif - -+#if defined(OS_BSD) -+#include <pthread_np.h> -+#endif -+ - namespace base { - namespace trace_event { - -@@ -62,13 +66,23 @@ ThreadLocalStorage::Slot& AllocationContextTrackerTLS( - // with id. This function intentionally leaks the allocated strings since they - // are used to tag allocations even after the thread dies. - const char* GetAndLeakThreadName() { -- char name[16]; -+#if defined(OS_BSD) -+ constexpr size_t kBufferLen = 64; -+#else -+ constexpr size_t kBufferLen = 16; -+#endif -+ char name[kBufferLen]; - #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) - // If the thread name is not set, try to get it from prctl. Thread name might - // not be set in cases where the thread started before heap profiling was - // enabled. - int err = prctl(PR_GET_NAME, name); - if (!err) { -+ return strdup(name); -+ } -+#elif defined(OS_BSD) -+ pthread_get_name_np(pthread_self(), name, kBufferLen); -+ if (*name != '\0') { - return strdup(name); - } - #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) diff --git a/www/chromium/files/patch-base_trace__event_memory__dump__manager.cc b/www/chromium/files/patch-base_trace__event_memory__dump__manager.cc new file mode 100644 index 000000000000..45c5ecd63a91 --- /dev/null +++ b/www/chromium/files/patch-base_trace__event_memory__dump__manager.cc @@ -0,0 +1,11 @@ +--- base/trace_event/memory_dump_manager.cc.orig 2022-02-07 13:39:41 UTC ++++ base/trace_event/memory_dump_manager.cc +@@ -78,7 +78,7 @@ const char* const MemoryDumpManager::kSystemAllocatorP + #if defined(MALLOC_MEMORY_TRACING_SUPPORTED) + MallocDumpProvider::kAllocatedObjects; + #else +- nullptr; ++ ""; + #endif + + // static diff --git a/www/chromium/files/patch-base_trace__event_process__memory__dump.cc b/www/chromium/files/patch-base_trace__event_process__memory__dump.cc index fa2b435c8b7a..dc76336b3bc7 100644 --- a/www/chromium/files/patch-base_trace__event_process__memory__dump.cc +++ b/www/chromium/files/patch-base_trace__event_process__memory__dump.cc @@ -1,4 +1,4 @@ ---- base/trace_event/process_memory_dump.cc.orig 2021-09-14 01:51:47 UTC +--- base/trace_event/process_memory_dump.cc.orig 2022-02-07 13:39:41 UTC +++ base/trace_event/process_memory_dump.cc @@ -105,7 +105,7 @@ absl::optional<size_t> ProcessMemoryDump::CountResiden #if defined(OS_WIN) @@ -9,3 +9,12 @@ std::unique_ptr<char[]> vec(new char[max_vec_size]); #elif defined(OS_POSIX) || defined(OS_FUCHSIA) std::unique_ptr<unsigned char[]> vec(new unsigned char[max_vec_size]); +@@ -127,7 +127,7 @@ absl::optional<size_t> ProcessMemoryDump::CountResiden + + for (size_t i = 0; i < page_count; i++) + resident_page_count += vec[i].VirtualAttributes.Valid; +-#elif defined(OS_FUCHSIA) ++#elif defined(OS_FUCHSIA) | defined(OS_BSD) + // TODO(fuchsia): Port, see https://crbug.com/706592. + ALLOW_UNUSED_LOCAL(chunk_start); + ALLOW_UNUSED_LOCAL(page_count); diff --git a/www/chromium/files/patch-base_tracing_trace__time.cc b/www/chromium/files/patch-base_tracing_trace__time.cc index 917480bf011b..b391966234ab 100644 --- a/www/chromium/files/patch-base_tracing_trace__time.cc +++ b/www/chromium/files/patch-base_tracing_trace__time.cc @@ -1,14 +1,28 @@ ---- base/tracing/trace_time.cc.orig 2021-07-21 11:24:56 UTC +--- base/tracing/trace_time.cc.orig 2022-02-07 13:39:41 UTC +++ base/tracing/trace_time.cc -@@ -16,7 +16,11 @@ int64_t TraceBootTicksNow() { +@@ -8,13 +8,17 @@ + #include "build/build_config.h" + #include "third_party/perfetto/include/perfetto/base/time.h" + ++#if defined(OS_FREEBSD) ++#define CLOCK_BOOTTIME CLOCK_UPTIME ++#endif ++ + namespace base { + namespace tracing { + + int64_t TraceBootTicksNow() { + // On Windows and Mac, TRACE_TIME_TICKS_NOW() behaves like boottime already. #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ - defined(OS_FUCHSIA) +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_BSD) struct timespec ts; -+#if defined(OS_BSD) int res = clock_gettime(CLOCK_BOOTTIME, &ts); -+#else -+ int res = clock_gettime(CLOCK_BOOTTIME, &ts); -+#endif if (res != -1) - return static_cast<int64_t>(perfetto::base::FromPosixTimespec(ts).count()); - #endif +@@ -24,4 +28,4 @@ int64_t TraceBootTicksNow() { + } + + } // namespace tracing +-} // namespace base +\ No newline at end of file ++} // namespace base diff --git a/www/chromium/files/patch-base_tracing_trace__time.h b/www/chromium/files/patch-base_tracing_trace__time.h index 684427507459..670469229ceb 100644 --- a/www/chromium/files/patch-base_tracing_trace__time.h +++ b/www/chromium/files/patch-base_tracing_trace__time.h @@ -1,11 +1,11 @@ ---- base/tracing/trace_time.h.orig 2021-07-21 13:25:51 UTC +--- base/tracing/trace_time.h.orig 2022-02-07 13:39:41 UTC +++ base/tracing/trace_time.h -@@ -11,7 +11,7 @@ - namespace base { +@@ -12,7 +12,7 @@ namespace base { namespace tracing { --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \ - defined(OS_FUCHSIA) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_BSD) // Linux, Android, and Fuchsia all use CLOCK_MONOTONIC. See crbug.com/166153 // about efforts to unify base::TimeTicks across all platforms. + constexpr perfetto::protos::pbzero::BuiltinClock kTraceClockId = diff --git a/www/chromium/files/patch-build_config_BUILD.gn b/www/chromium/files/patch-build_config_BUILD.gn index bd6a0ed90cff..2f3841e1bb68 100644 --- a/www/chromium/files/patch-build_config_BUILD.gn +++ b/www/chromium/files/patch-build_config_BUILD.gn @@ -1,21 +1,22 @@ ---- build/config/BUILD.gn.orig 2021-05-12 22:05:40 UTC +--- build/config/BUILD.gn.orig 2022-02-07 13:39:41 UTC +++ build/config/BUILD.gn -@@ -227,9 +227,7 @@ config("default_libs") { +@@ -222,13 +222,17 @@ config("default_libs") { + "CoreText.framework", + "Foundation.framework", ] - } else if (is_linux || is_chromeos) { +- } else if (is_linux || is_chromeos) { ++ } else if ((is_linux && !is_bsd) || is_chromeos) { libs = [ -- "dl", + "dl", "pthread", -- "rt", + "rt", ] - } +- } ++ } else if (is_bsd) { ++ libs = [ ++ "pthread", ++ ] ++ } } -@@ -308,7 +306,7 @@ config("executable_config") { - "//build/config/ios:ios_dynamic_flags", - "//build/config/ios:ios_executable_flags", - ] -- } else if (is_linux || is_chromeos || is_android || current_os == "aix") { -+ } else if (is_linux || is_bsd || is_chromeos || is_android || current_os == "aix") { - configs += [ "//build/config/gcc:executable_config" ] - if (is_chromecast) { - configs += [ "//build/config/chromecast:executable_config" ] + + group("common_deps") { diff --git a/www/chromium/files/patch-build_config_BUILDCONFIG.gn b/www/chromium/files/patch-build_config_BUILDCONFIG.gn index 3918db73189b..d80e17aa728c 100644 --- a/www/chromium/files/patch-build_config_BUILDCONFIG.gn +++ b/www/chromium/files/patch-build_config_BUILDCONFIG.gn @@ -1,35 +1,45 @@ ---- build/config/BUILDCONFIG.gn.orig 2021-12-31 00:57:18 UTC +--- build/config/BUILDCONFIG.gn.orig 2022-02-07 13:39:41 UTC +++ build/config/BUILDCONFIG.gn -@@ -189,8 +189,8 @@ if (host_toolchain == "") { - # TODO(dpranke): Add some sort of assert here that verifies that - # no toolchain omitted host_toolchain from its toolchain_args(). +@@ -136,7 +136,8 @@ declare_args() { + is_official_build = false -- if (host_os == "linux") { -- if (target_os != "linux") { -+ if (host_os == "linux" || host_os == "freebsd") { -+ if (target_os != "linux" && target_os != "freebsd") { - host_toolchain = "//build/toolchain/linux:clang_$host_cpu" - } else if (is_clang) { - host_toolchain = "//build/toolchain/linux:clang_$host_cpu" -@@ -229,7 +229,7 @@ if (target_os == "android") { - assert(host_os == "linux" || host_os == "mac", - "Android builds are only supported on Linux and Mac hosts.") - _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu" --} else if (target_os == "chromeos" || target_os == "linux") { -+} else if (target_os == "chromeos" || target_os == "linux" || target_os == "freebsd") { - # See comments in build/toolchain/cros/BUILD.gn about board compiles. - if (is_clang) { - _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" -@@ -293,10 +293,11 @@ if (custom_toolchain != "") { - # current_os value directly. - - is_android = current_os == "android" -+is_bsd = current_os == "freebsd" + # Set to true when compiling with the Clang compiler. +- is_clang = current_os != "linux" || ++ is_clang = current_os != "linux" || current_os == "openbsd" || ++ current_os == "freebsd" || + (current_cpu != "s390x" && current_cpu != "s390" && + current_cpu != "ppc64" && current_cpu != "ppc" && + current_cpu != "mips" && current_cpu != "mips64" && +@@ -218,6 +219,10 @@ if (host_toolchain == "") { + host_toolchain = "//build/toolchain/aix:$host_cpu" + } else if (host_os == "zos") { + host_toolchain = "//build/toolchain/zos:$host_cpu" ++ } else if (host_os == "openbsd") { ++ host_toolchain = "//build/toolchain/openbsd:clang_$host_cpu" ++ } else if (host_os == "freebsd") { ++ host_toolchain = "//build/toolchain/freebsd:clang_$host_cpu" + } else { + assert(false, "Unsupported host_os: $host_os") + } +@@ -262,6 +267,8 @@ if (target_os == "android") { + _default_toolchain = "//build/toolchain/aix:$target_cpu" + } else if (target_os == "zos") { + _default_toolchain = "//build/toolchain/zos:$target_cpu" ++} else if (target_os == "openbsd" || target_os == "freebsd") { ++ _default_toolchain = host_toolchain + } else { + assert(false, "Unsupported target_os: $target_os") + } +@@ -296,7 +303,11 @@ is_android = current_os == "android" is_chromeos = current_os == "chromeos" is_fuchsia = current_os == "fuchsia" is_ios = current_os == "ios" -is_linux = current_os == "linux" -+is_linux = current_os == "linux" || current_os == "freebsd" ++is_linux = current_os == "linux" || current_os == "openbsd" || ++ current_os == "freebsd" ++is_openbsd = current_os == "openbsd" ++is_freebsd = current_os == "freebsd" ++is_bsd = current_os == "openbsd" || current_os == "freebsd" is_mac = current_os == "mac" is_nacl = current_os == "nacl" is_win = current_os == "win" || current_os == "winuwp" diff --git a/www/chromium/files/patch-build_config_c++_c++.gni b/www/chromium/files/patch-build_config_c++_c++.gni deleted file mode 100644 index ec43c6b5fc4c..000000000000 --- a/www/chromium/files/patch-build_config_c++_c++.gni +++ /dev/null @@ -1,11 +0,0 @@ ---- build/config/c++/c++.gni.orig 2021-10-06 09:43:59 UTC -+++ build/config/c++/c++.gni -@@ -43,7 +43,7 @@ declare_args() { - - use_custom_libcxx = - use_custom_libcxx || (use_custom_libcxx_for_host && !is_a_target_toolchain) --use_custom_libcxx = use_custom_libcxx && !is_nacl -+use_custom_libcxx = use_custom_libcxx && !is_nacl && !is_bsd - - declare_args() { - # WARNING: Setting this to a non-default value is highly discouraged. diff --git a/www/chromium/files/patch-build_config_compiler_BUILD.gn b/www/chromium/files/patch-build_config_compiler_BUILD.gn index a74be1cecbd7..b2cb7fa98158 100644 --- a/www/chromium/files/patch-build_config_compiler_BUILD.gn +++ b/www/chromium/files/patch-build_config_compiler_BUILD.gn @@ -1,15 +1,6 @@ ---- build/config/compiler/BUILD.gn.orig 2021-12-31 00:57:18 UTC +--- build/config/compiler/BUILD.gn.orig 2022-02-07 13:39:41 UTC +++ build/config/compiler/BUILD.gn -@@ -140,7 +140,7 @@ declare_args() { - # - # TODO(crbug.com/1131993): Enabling this when 'is_android' is true breaks - # content_shell_test_apk on both ARM and x86. -- init_stack_vars = !is_android -+ init_stack_vars = !is_android && !is_bsd - - # This argument is to control whether enabling text section splitting in the - # final binary. When enabled, the separated text sections with prefix -@@ -241,7 +241,7 @@ config("default_include_dirs") { +@@ -236,13 +236,16 @@ config("default_include_dirs") { # Compiler instrumentation can introduce dependencies in DSOs to symbols in # the executable they are loaded into, so they are unresolved at link-time. config("no_unresolved_symbols") { @@ -18,39 +9,45 @@ (is_linux || is_chromeos || is_android || is_fuchsia)) { ldflags = [ "-Wl,-z,defs", -@@ -361,7 +361,7 @@ config("compiler") { - } + "-Wl,--as-needed", + ] + } ++ if (current_cpu == "x86" && is_openbsd) { ++ ldflags = [ "-Wl,-z,notext" ] ++ } + } - # Linker warnings. -- if (fatal_linker_warnings && !is_apple && current_os != "aix" && -+ if (fatal_linker_warnings && !is_apple && !is_bsd && current_os != "aix" && - current_os != "zos") { - ldflags += [ "-Wl,--fatal-warnings" ] + # compiler --------------------------------------------------------------------- +@@ -452,6 +455,10 @@ config("compiler") { } -@@ -539,7 +539,7 @@ config("compiler") { + } + ++ if (is_openbsd) { ++ ldflags += [ "-Wl,-z,wxneeded" ] ++ } ++ + # Linux-specific compiler flags setup. + # ------------------------------------ + if ((is_posix || is_fuchsia) && !is_apple && use_lld) { +@@ -534,7 +541,7 @@ config("compiler") { ldflags += [ "-Wl,-z,keep-text-section-prefix" ] } -- if (is_clang && !is_nacl && !use_xcode_clang && current_os != "zos") { -+ if (is_clang && !is_nacl && !is_bsd && !use_xcode_clang && current_os != "zos") { +- if (is_clang && !is_nacl && current_os != "zos") { ++ if (is_clang && !is_nacl && current_os != "zos" && !is_bsd) { cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ] # TODO(hans): Remove this once Clang generates better optimized debug info -@@ -682,7 +682,12 @@ config("compiler") { - # and let it use all cores. - # TODO(thakis): Check if '=0' (that is, number of cores, instead - # of "all" which means number of hardware threads) is faster. -- ldflags += [ "-Wl,--thinlto-jobs=all" ] -+ if (is_bsd) { -+ # FreeBSD < 13 uses LLVM 10, which doesn't support --thinlto-jobs=all -+ ldflags += [ "-Wl,--thinlto-jobs=2" ] -+ } else { -+ ldflags += [ "-Wl,--thinlto-jobs=all" ] -+ } - if (is_mac) { - ldflags += - [ "-Wl,-cache_path_lto," + -@@ -910,7 +915,7 @@ config("compiler_cpu_abi") { +@@ -903,7 +910,7 @@ config("compiler_cpu_abi") { + ] + } + } else if (current_cpu == "arm") { +- if (is_clang && !is_android && !is_nacl) { ++ if (is_clang && !is_android && !is_nacl && !is_bsd) { + cflags += [ "--target=arm-linux-gnueabihf" ] + ldflags += [ "--target=arm-linux-gnueabihf" ] + } +@@ -917,7 +924,7 @@ config("compiler_cpu_abi") { cflags += [ "-mtune=$arm_tune" ] } } else if (current_cpu == "arm64") { @@ -59,81 +56,58 @@ cflags += [ "--target=aarch64-linux-gnu" ] ldflags += [ "--target=aarch64-linux-gnu" ] } -@@ -1266,6 +1271,9 @@ config("compiler_deterministic") { +@@ -1238,7 +1245,7 @@ config("compiler_deterministic") { + # different build directory like "out/feature_a" and "out/feature_b" if + # we build same files with same compile flag. + # Other paths are already given in relative, no need to normalize them. +- if (is_nacl) { ++ if (is_nacl || is_bsd) { + # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here. + cflags += [ "-Xclang", - ".", +@@ -1525,7 +1532,7 @@ config("default_warnings") { + "-Wno-ignored-pragma-optimize", ] -+ } else if (is_bsd) { -+ # -ffile-compilation-dir is not supported in the LLVM version FreeBSD ships -+ cflags += [ "-fdebug-compilation-dir=." ] - } else { - # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir= - # and -fcoverage-compilation-dir=. -@@ -1519,7 +1527,7 @@ config("default_warnings") { - cflags += [ "-Wno-null-pointer-subtraction" ] - } -- if (current_toolchain == host_toolchain || !use_xcode_clang) { -+ if ((current_toolchain == host_toolchain || !use_xcode_clang) && !is_bsd) { - # Flags Xcode 9.2 (Clang clang-900.0.39.2) does not recognize. - cflags += [ - "-Wenum-compare-conditional", -@@ -1549,6 +1557,18 @@ config("default_warnings") { - cflags += [ "-Wmax-tokens" ] - } +- if (is_chromeos || default_toolchain == "//build/toolchain/cros:target") { ++ if (is_chromeos || default_toolchain == "//build/toolchain/cros:target" || is_bsd) { + # TODO(https://crbug.com/1016945): Re-enable once ChromeOS toolchain is up to date + cflags += [ "-Wno-builtin-assume-aligned-alignment" ] } -+ -+ if (is_clang && is_bsd) { -+ cflags += [ -+ "-Wno-ignored-pragma-optimize", -+ "-Wno-implicit-int-float-conversion", -+ "-Wno-final-dtor-non-final-class", -+ "-Wno-builtin-assume-aligned-alignment", -+ "-Wno-deprecated-copy", -+ "-Wno-thread-safety-analysis", -+ "-Wno-thread-safety-attributes", -+ ] -+ } - } - } - } -@@ -1684,7 +1704,7 @@ config("no_chromium_code") { +@@ -1676,7 +1683,7 @@ config("no_chromium_code") { # third-party libraries. "-Wno-c++11-narrowing", ] -- if (!is_nacl && (current_toolchain == host_toolchain || !use_xcode_clang)) { -+ if (!is_nacl && (current_toolchain == host_toolchain || !use_xcode_clang) && !is_bsd) { +- if (!is_nacl) { ++ if (!is_nacl && !is_freebsd) { cflags += [ # Disabled for similar reasons as -Wunused-variable. "-Wno-unused-but-set-variable", -@@ -1767,7 +1787,7 @@ config("thin_archive") { - # archives. - # TODO(crbug.com/1221615): Enable on is_apple if use_lld once that no longer - # confuses lldb. -- if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) { -+ if ((is_posix && !is_nacl && !is_apple && !is_bsd) || is_fuchsia) { - arflags = [ "-T" ] - } else if (is_win && use_lld) { - arflags = [ "/llvmlibthin" ] -@@ -2267,7 +2287,11 @@ config("symbols") { - # flag, so we can use use -g1 for pnacl and nacl-clang compiles. - # gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang. - if ((!is_nacl || is_clang) && current_os != "zos") { -- cflags += [ "-g2" ] -+ if (is_bsd) { -+ cflags += [ "-g0" ] -+ } else { -+ cflags += [ "-g2" ] -+ } +@@ -2191,7 +2198,7 @@ config("afdo_optimize_size") { + # between //base/allocator:tcmalloc and AFDO on GCC), so we provide a separate + # config to allow AFDO to be disabled per-target. + config("afdo") { +- if (is_clang) { ++ if (is_clang && !is_bsd) { + cflags = [] + if (clang_emit_debug_info_for_profiling) { + # Add the following flags to generate debug info for profiling. +@@ -2207,7 +2214,7 @@ config("afdo") { + cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ] + inputs = [ _clang_sample_profile ] + } +- } else if (auto_profile_path != "" && is_a_target_toolchain) { ++ } else if (auto_profile_path != "" && is_a_target_toolchain && !is_bsd) { + cflags = [ "-fauto-profile=${auto_profile_path}" ] + inputs = [ auto_profile_path ] + } +@@ -2346,7 +2353,8 @@ config("symbols") { } + } - # Since only one of the build options -gdwarf-aranges and -fembed-bitcode -@@ -2307,7 +2331,7 @@ config("symbols") { - # DWARF info may be corrupt; offsets in a range list entry are in different - # sections" there. Maybe just a bug in nacl_switch_32.S. - _enable_gdb_index = -- symbol_level == 2 && !is_apple && !is_nacl && current_cpu != "x86" && -+ symbol_level == 2 && !is_apple && !is_nacl && !is_bsd && current_cpu != "x86" && - current_os != "zos" && (use_gold || use_lld) && - # Disable on non-fission 32-bit Android because it pushes - # libcomponents_unittests over the 4gb size limit. +- if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos") { ++ if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos" && ++ !is_bsd) { + if (is_apple) { + # TODO(https://crbug.com/1050118): Investigate missing debug info on mac. + # Make sure we don't use constructor homing on mac. diff --git a/www/chromium/files/patch-build_config_compiler_compiler.gni b/www/chromium/files/patch-build_config_compiler_compiler.gni deleted file mode 100644 index a0b6161c64d8..000000000000 --- a/www/chromium/files/patch-build_config_compiler_compiler.gni +++ /dev/null @@ -1,11 +0,0 @@ ---- build/config/compiler/compiler.gni.orig 2021-12-31 00:57:18 UTC -+++ build/config/compiler/compiler.gni -@@ -219,7 +219,7 @@ declare_args() { - - declare_args() { - # Whether to use the gold linker from binutils instead of lld or bfd. -- use_gold = !use_lld && !(is_chromecast && is_linux && -+ use_gold = !is_bsd && !use_lld && !(is_chromecast && is_linux && - (current_cpu == "arm" || current_cpu == "mipsel")) && - (((is_linux || is_chromeos_lacros) && - (current_cpu == "x64" || current_cpu == "x86" || diff --git a/www/chromium/files/extra-patch-build_config_compiler_pgo_pgo.gni b/www/chromium/files/patch-build_config_compiler_pgo_pgo.gni index 9c861611d45c..87304bc3d133 100644 --- a/www/chromium/files/extra-patch-build_config_compiler_pgo_pgo.gni +++ b/www/chromium/files/patch-build_config_compiler_pgo_pgo.gni @@ -1,4 +1,4 @@ ---- build/config/compiler/pgo/pgo.gni.orig 2022-01-20 10:35:46 UTC +--- build/config/compiler/pgo/pgo.gni.orig 2022-02-07 13:39:41 UTC +++ build/config/compiler/pgo/pgo.gni @@ -16,7 +16,7 @@ declare_args() { # TODO(crbug.com/1052397): Remove chromeos_is_browser_only once diff --git a/www/chromium/files/patch-build_config_features.gni b/www/chromium/files/patch-build_config_features.gni deleted file mode 100644 index 282ec208bed4..000000000000 --- a/www/chromium/files/patch-build_config_features.gni +++ /dev/null @@ -1,11 +0,0 @@ ---- build/config/features.gni.orig 2021-04-14 18:40:48 UTC -+++ build/config/features.gni -@@ -26,7 +26,7 @@ declare_args() { - proprietary_codecs = is_chrome_branded || is_chromecast - - # libudev usage. This currently only affects the content layer. -- use_udev = (is_linux || is_chromeos) && !is_chromecast -+ use_udev = (is_linux || is_chromeos) && !is_chromecast && !is_bsd - - use_dbus = (is_linux || is_chromeos) && !is_chromecast - diff --git a/www/chromium/files/patch-build_config_freetype_freetype.gni b/www/chromium/files/patch-build_config_freetype_freetype.gni deleted file mode 100644 index 0db577fe0459..000000000000 --- a/www/chromium/files/patch-build_config_freetype_freetype.gni +++ /dev/null @@ -1,9 +0,0 @@ ---- build/config/freetype/freetype.gni.orig 2021-04-14 18:40:48 UTC -+++ build/config/freetype/freetype.gni -@@ -10,5 +10,5 @@ declare_args() { - # than version 2.7.1 and have color bitmap support compiled in. WARNING: - # System FreeType configurations other than as described WILL INTRODUCE TEXT - # RENDERING AND SECURITY REGRESSIONS. -- use_system_freetype = false -+ use_system_freetype = true - } diff --git a/www/chromium/files/patch-build_config_linux_BUILD.gn b/www/chromium/files/patch-build_config_linux_BUILD.gn index 1576d19ca1eb..f73ef24f032a 100644 --- a/www/chromium/files/patch-build_config_linux_BUILD.gn +++ b/www/chromium/files/patch-build_config_linux_BUILD.gn @@ -1,6 +1,6 @@ ---- build/config/linux/BUILD.gn.orig 2021-09-24 04:25:56 UTC +--- build/config/linux/BUILD.gn.orig 2022-02-07 13:39:41 UTC +++ build/config/linux/BUILD.gn -@@ -39,7 +39,7 @@ config("runtime_library") { +@@ -42,7 +42,7 @@ config("runtime_library") { if ((!(is_chromeos_ash || is_chromeos_lacros) || default_toolchain != "//build/toolchain/cros:target") && diff --git a/www/chromium/files/patch-build_config_linux_pkg-config.py b/www/chromium/files/patch-build_config_linux_pkg-config.py index 7ed4de72c661..e48b205448bd 100644 --- a/www/chromium/files/patch-build_config_linux_pkg-config.py +++ b/www/chromium/files/patch-build_config_linux_pkg-config.py @@ -1,26 +1,11 @@ ---- build/config/linux/pkg-config.py.orig 2021-04-14 18:40:48 UTC +--- build/config/linux/pkg-config.py.orig 2022-02-07 13:39:41 UTC +++ build/config/linux/pkg-config.py -@@ -59,8 +59,12 @@ def SetConfigPath(options): - print("You must specify an architecture via -a if using a sysroot.") - sys.exit(1) - -- libdir = sysroot + '/usr/' + options.system_libdir + '/pkgconfig' -- libdir += ':' + sysroot + '/usr/share/pkgconfig' -+ if "linux" in sys.platform: -+ libdir = sysroot + '/libdata/' + options.system_libdir + '/pkgconfig' -+ libdir += ':' + sysroot + '/usr/share/pkgconfig' -+ elif "bsd" in sys.platform: -+ libdir = sysroot + '/libdata/pkgconfig' -+ libdir += ':' + '/usr/libdata/pkgconfig' - os.environ['PKG_CONFIG_LIBDIR'] = libdir - return libdir - -@@ -109,7 +113,7 @@ def main(): +@@ -109,7 +109,7 @@ def main(): # If this is run on non-Linux platforms, just return nothing and indicate # success. This allows us to "kind of emulate" a Linux build from other # platforms. - if "linux" not in sys.platform: -+ if "bsd" not in sys.platform: ++ if not sys.platform.startswith(tuple(['linux', 'openbsd', 'freebsd'])): print("[[],[],[],[],[]]") return 0 diff --git a/www/chromium/files/patch-build_config_ozone.gni b/www/chromium/files/patch-build_config_ozone.gni index bf85cab41c34..97366e428630 100644 --- a/www/chromium/files/patch-build_config_ozone.gni +++ b/www/chromium/files/patch-build_config_ozone.gni @@ -1,12 +1,21 @@ ---- build/config/ozone.gni.orig 2021-12-14 11:44:55 UTC +--- build/config/ozone.gni.orig 2022-02-07 13:39:41 UTC +++ build/config/ozone.gni -@@ -91,6 +91,9 @@ declare_args() { +@@ -91,9 +91,17 @@ declare_args() { } else if (is_chromeos_lacros) { ozone_platform = "wayland" ozone_platform_wayland = true -+ } else if (is_bsd) { -+ ozone_platform = "x11" -+ ozone_platform_x11 = true - } else if (is_linux) { +- } else if (is_linux) { ++ } else if (is_linux && !is_bsd) { ozone_platform = "x11" ozone_platform_wayland = true ++ ozone_platform_x11 = true ++ } else if (is_openbsd) { ++ ozone_platform = "x11" ++ ozone_platform_wayland = false ++ ozone_platform_x11 = true ++ } else if (is_freebsd) { ++ ozone_platform = "x11" ++ ozone_platform_wayland = false + ozone_platform_x11 = true + } else if (is_win) { + ozone_platform = "windows" diff --git a/www/chromium/files/patch-build_config_rust.gni b/www/chromium/files/patch-build_config_rust.gni index bdf651b6b961..5dd7ad561eef 100644 --- a/www/chromium/files/patch-build_config_rust.gni +++ b/www/chromium/files/patch-build_config_rust.gni @@ -1,11 +1,11 @@ ---- build/config/rust.gni.orig 2021-12-31 00:57:18 UTC +--- build/config/rust.gni.orig 2022-02-07 13:39:41 UTC +++ build/config/rust.gni -@@ -67,7 +67,7 @@ toolchain_has_official_rust = - (!is_nacl && - (is_android && (current_cpu == "arm" || current_cpu == "arm64" || - current_cpu == "x64" || current_cpu == "x86"))) || -- (is_linux && current_cpu == "x64") -+ ((is_linux && !is_bsd) && current_cpu == "x64") - - toolchain_has_rust = enable_rust && (toolchain_has_official_rust || - use_unverified_rust_toolchain) +@@ -84,7 +84,7 @@ if (enable_rust) { + rust_sysroot = get_path_info(rust_sysroot_absolute, "abspath") + use_unverified_rust_toolchain = true + } else { +- if (host_os != "linux") { ++ if (host_os != "linux" && host_os != "openbsd" && host_os != "freebsd") { + assert( + false, + "Attempt to use standard Rust toolchain on an unsupported platform") diff --git a/www/chromium/files/patch-build_config_sysroot.gni b/www/chromium/files/patch-build_config_sysroot.gni deleted file mode 100644 index b68650b4abf9..000000000000 --- a/www/chromium/files/patch-build_config_sysroot.gni +++ /dev/null @@ -1,14 +0,0 @@ ---- build/config/sysroot.gni.orig 2021-04-14 18:40:48 UTC -+++ build/config/sysroot.gni -@@ -21,9 +21,9 @@ declare_args() { - - # Controls default is_linux sysroot. If set to true, and sysroot - # is empty, default sysroot is calculated. -- use_sysroot = current_cpu == "x86" || current_cpu == "x64" || -+ use_sysroot = !is_bsd && (current_cpu == "x86" || current_cpu == "x64" || - current_cpu == "arm" || current_cpu == "arm64" || -- current_cpu == "mipsel" || current_cpu == "mips64el" -+ current_cpu == "mipsel" || current_cpu == "mips64el") - } - - if (sysroot == "") { diff --git a/www/chromium/files/patch-build_config_v8__target__cpu.gni b/www/chromium/files/patch-build_config_v8__target__cpu.gni new file mode 100644 index 000000000000..40fa8f6348e3 --- /dev/null +++ b/www/chromium/files/patch-build_config_v8__target__cpu.gni @@ -0,0 +1,13 @@ +--- build/config/v8_target_cpu.gni.orig 2022-02-07 13:39:41 UTC ++++ build/config/v8_target_cpu.gni +@@ -36,6 +36,10 @@ declare_args() { + if (v8_target_cpu == "") { + if (current_toolchain == "//build/toolchain/linux:clang_x64_v8_arm64") { + v8_target_cpu = "arm64" ++ } else if (current_toolchain == "//build/toolchain/openbsd:clang_arm64") { ++ v8_target_cpu = "arm64" ++ } else if (current_toolchain == "//build/toolchain/freebsd:clang_arm64") { ++ v8_target_cpu = "arm64" + } else if (current_toolchain == "//build/toolchain/linux:clang_x86_v8_arm") { + v8_target_cpu = "arm" + } else if (current_toolchain == diff --git a/www/chromium/files/patch-build_gn__run__binary.py b/www/chromium/files/patch-build_gn__run__binary.py index 905ddf57f5d1..cf65b6532d6f 100644 --- a/www/chromium/files/patch-build_gn__run__binary.py +++ b/www/chromium/files/patch-build_gn__run__binary.py @@ -1,11 +1,11 @@ ---- build/gn_run_binary.py.orig 2021-04-14 18:40:48 UTC +--- build/gn_run_binary.py.orig 2022-02-07 13:39:41 UTC +++ build/gn_run_binary.py @@ -24,7 +24,7 @@ if not os.path.isabs(path): # The rest of the arguments are passed directly to the executable. args = [path] + sys.argv[2:] -ret = subprocess.call(args) -+ret = subprocess.call(args, env={"CHROME_EXE_PATH":"${WRKSRC}/out/Release/chrome"}) ++ret = subprocess.call(args, env={"CHROME_EXE_PATH":"${WRKSRC}/out/Release/chrome","LD_LIBRARY_PATH":"${WRKSRC}/out/Release"}) if ret != 0: if ret <= -100: # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to diff --git a/www/chromium/files/patch-build_linux_chrome.map b/www/chromium/files/patch-build_linux_chrome.map index 444c645ca7df..8e8c35005efb 100644 --- a/www/chromium/files/patch-build_linux_chrome.map +++ b/www/chromium/files/patch-build_linux_chrome.map @@ -1,14 +1,6 @@ ---- build/linux/chrome.map.orig 2021-04-14 18:40:48 UTC +--- build/linux/chrome.map.orig 2022-02-07 13:39:41 UTC +++ build/linux/chrome.map -@@ -1,4 +1,7 @@ - { -+local: -+ *; -+ - global: - __bss_start; - __data_start; -@@ -20,6 +23,10 @@ global: +@@ -20,6 +20,10 @@ global: # Program entry point. _start; @@ -19,11 +11,3 @@ # Memory allocation symbols. We want chrome and any libraries to # share the same heap, so it is correct to export these symbols. calloc; -@@ -83,7 +90,4 @@ global: - localtime_r; - - v8dbg_*; -- --local: -- *; - }; diff --git a/www/chromium/files/patch-build_linux_libpci_BUILD.gn b/www/chromium/files/patch-build_linux_libpci_BUILD.gn deleted file mode 100644 index fa8f9032e351..000000000000 --- a/www/chromium/files/patch-build_linux_libpci_BUILD.gn +++ /dev/null @@ -1,53 +0,0 @@ ---- build/linux/libpci/BUILD.gn.orig 2021-04-14 18:40:48 UTC -+++ build/linux/libpci/BUILD.gn -@@ -3,20 +3,36 @@ - # found in the LICENSE file. - - import("//tools/generate_library_loader/generate_library_loader.gni") -+import("//build/config/linux/pkg_config.gni") - --# This generates a target named "libpci". --generate_library_loader("libpci") { -- name = "LibPciLoader" -- output_h = "libpci.h" -- output_cc = "libpci_loader.cc" -- header = "<pci/pci.h>" -+declare_args() { -+ use_system_libpci = is_bsd -+} - -- functions = [ -- "pci_alloc", -- "pci_init", -- "pci_cleanup", -- "pci_scan_bus", -- "pci_fill_info", -- "pci_lookup_name", -- ] -+if (use_system_libpci) { -+ pkg_config("system_libpci") { -+ packages = [ "libpci" ] -+ } -+ -+ source_set("libpci") { -+ public_configs = [ ":system_libpci" ] -+ } -+ -+} else { -+ # This generates a target named "libpci". -+ generate_library_loader("libpci") { -+ name = "LibPciLoader" -+ output_h = "libpci.h" -+ output_cc = "libpci_loader.cc" -+ header = "<pci/pci.h>" -+ -+ functions = [ -+ "pci_alloc", -+ "pci_init", -+ "pci_cleanup", -+ "pci_scan_bus", -+ "pci_fill_info", -+ "pci_lookup_name", -+ ] -+ } - } diff --git a/www/chromium/files/patch-build_linux_strip__binary.gni b/www/chromium/files/patch-build_linux_strip__binary.gni deleted file mode 100644 index 7a6a20f0bfa8..000000000000 --- a/www/chromium/files/patch-build_linux_strip__binary.gni +++ /dev/null @@ -1,15 +0,0 @@ ---- build/linux/strip_binary.gni.orig 2021-08-17 16:31:26 UTC -+++ build/linux/strip_binary.gni -@@ -20,7 +20,11 @@ template("strip_binary") { - "testonly", - ]) - action("${target_name}") { -- eu_strip_binary = "//buildtools/third_party/eu-strip/bin/eu-strip" -+ if (is_bsd) { -+ eu_strip_binary = "//buildtools/freebsd/strip" -+ } else { -+ eu_strip_binary = "//buildtools/third_party/eu-strip/bin/eu-strip" -+ } - script = "//build/linux/strip_binary.py" - inputs = [ - invoker.binary_input, diff --git a/www/chromium/files/patch-build_linux_strip__binary.py b/www/chromium/files/patch-build_linux_strip__binary.py index cf3ba059ea85..9dd3c051630b 100644 --- a/www/chromium/files/patch-build_linux_strip__binary.py +++ b/www/chromium/files/patch-build_linux_strip__binary.py @@ -1,12 +1,10 @@ ---- build/linux/strip_binary.py.orig 2021-08-17 16:45:54 UTC +--- build/linux/strip_binary.py.orig 2022-02-07 13:39:41 UTC +++ build/linux/strip_binary.py -@@ -19,8 +19,7 @@ def main(): - args = argparser.parse_args() +@@ -10,6 +10,7 @@ import sys - cmd_line = [ -- args.eu_strip_binary_path, '-o', args.stripped_binary_output, '-f', -- args.symbol_output, args.binary_input -+ args.eu_strip_binary_path, '-o', args.stripped_binary_output, args.binary_input - ] - process = subprocess.Popen(cmd_line) + def main(): ++ return 0 + argparser = argparse.ArgumentParser(description='eu-strip binary.') + + argparser.add_argument('--eu-strip-binary-path', help='eu-strip path.') diff --git a/www/chromium/files/patch-build_toolchain_freebsd_BUILD.gn b/www/chromium/files/patch-build_toolchain_freebsd_BUILD.gn new file mode 100644 index 000000000000..7857149615a0 --- /dev/null +++ b/www/chromium/files/patch-build_toolchain_freebsd_BUILD.gn @@ -0,0 +1,69 @@ +--- build/toolchain/freebsd/BUILD.gn.orig 2022-02-07 13:39:41 UTC ++++ build/toolchain/freebsd/BUILD.gn +@@ -0,0 +1,66 @@ ++# Copyright 2013 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++import("//build/config/sysroot.gni") ++import("//build/toolchain/gcc_toolchain.gni") ++ ++clang_toolchain("clang_x86") { ++ toolchain_args = { ++ current_cpu = "x86" ++ current_os = "freebsd" ++ } ++} ++ ++gcc_toolchain("x86") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ toolchain_args = { ++ current_cpu = "x86" ++ current_os = "freebsd" ++ is_clang = false ++ } ++} ++ ++clang_toolchain("clang_x64") { ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "freebsd" ++ } ++} ++ ++gcc_toolchain("x64") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "freebsd" ++ is_clang = false ++ } ++} ++ ++clang_toolchain("clang_arm") { ++ toolchain_args = { ++ current_cpu = "arm64" ++ current_os = "freebsd" ++ } ++} ++ ++clang_toolchain("clang_arm64") { ++ toolchain_args = { ++ current_cpu = "arm64" ++ current_os = "freebsd" ++ } ++} diff --git a/www/chromium/files/patch-build_toolchain_gcc__solink__wrapper.py b/www/chromium/files/patch-build_toolchain_gcc__solink__wrapper.py new file mode 100644 index 000000000000..34debf134bea --- /dev/null +++ b/www/chromium/files/patch-build_toolchain_gcc__solink__wrapper.py @@ -0,0 +1,11 @@ +--- build/toolchain/gcc_solink_wrapper.py.orig 2022-02-07 13:39:41 UTC ++++ build/toolchain/gcc_solink_wrapper.py +@@ -39,7 +39,7 @@ def CollectDynSym(args): + """Replaces: nm --format=posix -g -D -p $sofile | cut -f1-2 -d' '""" + toc = '' + nm = subprocess.Popen(wrapper_utils.CommandToRun( +- [args.nm, '--format=posix', '-g', '-D', '-p', args.sofile]), ++ [args.nm, '-g', '-D', '-p', args.sofile]), + stdout=subprocess.PIPE, + bufsize=-1, + universal_newlines=True) diff --git a/www/chromium/files/patch-build_toolchain_gcc__toolchain.gni b/www/chromium/files/patch-build_toolchain_gcc__toolchain.gni index 02a487657479..b440c70df873 100644 --- a/www/chromium/files/patch-build_toolchain_gcc__toolchain.gni +++ b/www/chromium/files/patch-build_toolchain_gcc__toolchain.gni @@ -1,10 +1,11 @@ ---- build/toolchain/gcc_toolchain.gni.orig 2022-01-20 10:35:46 UTC +--- build/toolchain/gcc_toolchain.gni.orig 2022-02-07 13:39:41 UTC +++ build/toolchain/gcc_toolchain.gni -@@ -49,6 +49,11 @@ if (enable_resource_allowlist_generation) { +@@ -49,6 +49,12 @@ if (enable_resource_allowlist_generation) { "enable_resource_allowlist_generation=true does not work for target_os=$target_os") } +declare_args() { ++ extra_cppflags = "" + extra_cxxflags = "" + extra_ldflags = "" +} @@ -12,34 +13,27 @@ # This template defines a toolchain for something that works like gcc # (including clang). # -@@ -731,13 +736,23 @@ template("gcc_toolchain") { +@@ -737,13 +743,17 @@ template("gcc_toolchain") { # use_gold too. template("clang_toolchain") { gcc_toolchain(target_name) { - prefix = rebase_path("$clang_base_path/bin", root_build_dir) - cc = "${prefix}/clang" - cxx = "${prefix}/clang++" -- ld = cxx -- readelf = "${prefix}/llvm-readelf" -- ar = "${prefix}/llvm-ar" -- nm = "${prefix}/llvm-nm" -+ if (is_bsd) { ++ if (is_freebsd) { + prefix = "/usr/local/bin" -+ cc = "cc" -+ cxx = "c++" -+ ld = cxx -+ readelf = "readelf" -+ ar = "${prefix}/ar" -+ nm = "${prefix}/nm" + } else { -+ prefix = rebase_path("$clang_base_path/bin", root_build_dir) -+ cc = "${prefix}/clang" -+ cxx = "${prefix}/clang++" -+ ld = cxx -+ readelf = "${prefix}/llvm-readelf" -+ ar = "${prefix}/llvm-ar" -+ nm = "${prefix}/llvm-nm" ++ prefix = "/usr/bin" + } ++ cc = "cc" ++ cxx = "c++" + ld = cxx +- readelf = "${prefix}/llvm-readelf" +- ar = "${prefix}/llvm-ar" +- nm = "${prefix}/llvm-nm" ++ readelf = "${prefix}/readelf" ++ ar = "${prefix}/ar" ++ nm = "${prefix}/nm" forward_variables_from(invoker, [ diff --git a/www/chromium/files/patch-build_toolchain_get__concurrent__links.py b/www/chromium/files/patch-build_toolchain_get__concurrent__links.py deleted file mode 100644 index 5cf16130a4db..000000000000 --- a/www/chromium/files/patch-build_toolchain_get__concurrent__links.py +++ /dev/null @@ -1,14 +0,0 @@ ---- build/toolchain/get_concurrent_links.py.orig 2021-08-17 00:15:54 UTC -+++ build/toolchain/get_concurrent_links.py -@@ -53,6 +53,11 @@ def _GetTotalMemoryInBytes(): - return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize'])) - except Exception: - return 0 -+ elif sys.platform.startswith('freebsd'): -+ try: -+ return int(subprocess.check_output(['sysctl', '-n', 'hw.physmem'])) -+ except Exception: -+ return 1 - # TODO(scottmg): Implement this for other platforms. - return 0 - diff --git a/www/chromium/files/patch-build_toolchain_openbsd_BUILD.gn b/www/chromium/files/patch-build_toolchain_openbsd_BUILD.gn new file mode 100644 index 000000000000..04e6f6b416e2 --- /dev/null +++ b/www/chromium/files/patch-build_toolchain_openbsd_BUILD.gn @@ -0,0 +1,69 @@ +--- build/toolchain/openbsd/BUILD.gn.orig 2022-02-07 13:39:41 UTC ++++ build/toolchain/openbsd/BUILD.gn +@@ -0,0 +1,66 @@ ++# Copyright 2013 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++import("//build/config/sysroot.gni") ++import("//build/toolchain/gcc_toolchain.gni") ++ ++clang_toolchain("clang_x86") { ++ toolchain_args = { ++ current_cpu = "x86" ++ current_os = "openbsd" ++ } ++} ++ ++gcc_toolchain("x86") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ toolchain_args = { ++ current_cpu = "x86" ++ current_os = "openbsd" ++ is_clang = false ++ } ++} ++ ++clang_toolchain("clang_x64") { ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "openbsd" ++ } ++} ++ ++gcc_toolchain("x64") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "openbsd" ++ is_clang = false ++ } ++} ++ ++clang_toolchain("clang_arm") { ++ toolchain_args = { ++ current_cpu = "arm64" ++ current_os = "openbsd" ++ } ++} ++ ++clang_toolchain("clang_arm64") { ++ toolchain_args = { ++ current_cpu = "arm64" ++ current_os = "openbsd" ++ } ++} diff --git a/www/chromium/files/patch-cc_BUILD.gn b/www/chromium/files/patch-cc_BUILD.gn index 880917f66c4e..80e9e0adb0a0 100644 --- a/www/chromium/files/patch-cc_BUILD.gn +++ b/www/chromium/files/patch-cc_BUILD.gn @@ -1,6 +1,6 @@ ---- cc/BUILD.gn.orig 2021-12-31 00:57:18 UTC +--- cc/BUILD.gn.orig 2022-02-07 13:39:41 UTC +++ cc/BUILD.gn -@@ -655,7 +655,7 @@ cc_test_static_library("test_support") { +@@ -659,7 +659,7 @@ cc_test_static_library("test_support") { if (enable_vulkan) { deps += [ "//gpu/vulkan/init" ] } @@ -9,7 +9,7 @@ data_deps = [ "//third_party/mesa_headers" ] } } -@@ -879,7 +879,6 @@ cc_test("cc_unittests") { +@@ -884,7 +884,6 @@ cc_test("cc_unittests") { ] data_deps = [ "//testing/buildbot/filters:cc_unittests_filters", diff --git a/www/chromium/files/patch-cc_layers_scrollbar__layer__impl__base.cc b/www/chromium/files/patch-cc_layers_scrollbar__layer__impl__base.cc deleted file mode 100644 index e77f9cd02006..000000000000 --- a/www/chromium/files/patch-cc_layers_scrollbar__layer__impl__base.cc +++ /dev/null @@ -1,13 +0,0 @@ ---- cc/layers/scrollbar_layer_impl_base.cc.orig 2021-12-14 11:44:55 UTC -+++ cc/layers/scrollbar_layer_impl_base.cc -@@ -223,8 +223,8 @@ gfx::Rect ScrollbarLayerImplBase::ComputeThumbQuadRect - int thumb_offset = TrackStart(); - if (maximum > 0) { - float ratio = clamped_current_pos / maximum; -- float max_offset = track_length - thumb_length; -- thumb_offset += static_cast<int>(ratio * max_offset); -+ float _max_offset = track_length - thumb_length; -+ thumb_offset += static_cast<int>(ratio * _max_offset); - } - - float thumb_thickness_adjustment = diff --git a/www/chromium/files/patch-cc_test_layer__tree__test.cc b/www/chromium/files/patch-cc_test_layer__tree__test.cc deleted file mode 100644 index 67cf283f9328..000000000000 --- a/www/chromium/files/patch-cc_test_layer__tree__test.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- cc/test/layer_tree_test.cc.orig 2021-12-31 00:57:18 UTC -+++ cc/test/layer_tree_test.cc -@@ -681,7 +681,7 @@ LayerTreeTest::LayerTreeTest(viz::RendererType rendere - init_vulkan = true; - } else if (renderer_type_ == viz::RendererType::kSkiaDawn) { - scoped_feature_list_.InitAndEnableFeature(features::kSkiaDawn); --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - init_vulkan = true; - #elif defined(OS_WIN) - // TODO(rivr): Initialize D3D12 for Windows. diff --git a/www/chromium/files/patch-cc_test_pixel__test.cc b/www/chromium/files/patch-cc_test_pixel__test.cc deleted file mode 100644 index bfcb67dd94d9..000000000000 --- a/www/chromium/files/patch-cc_test_pixel__test.cc +++ /dev/null @@ -1,11 +0,0 @@ ---- cc/test/pixel_test.cc.orig 2021-07-19 18:45:05 UTC -+++ cc/test/pixel_test.cc -@@ -71,7 +71,7 @@ PixelTest::PixelTest(GraphicsBackend backend) - init_vulkan = true; - } else if (backend == kSkiaDawn) { - scoped_feature_list_.InitAndEnableFeature(features::kSkiaDawn); --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - init_vulkan = true; - #elif defined(OS_WIN) - // TODO(rivr): Initialize D3D12 for Windows. diff --git a/www/chromium/files/patch-cc_trees_property__tree.cc b/www/chromium/files/patch-cc_trees_property__tree.cc deleted file mode 100644 index 78ee286a558a..000000000000 --- a/www/chromium/files/patch-cc_trees_property__tree.cc +++ /dev/null @@ -1,20 +0,0 @@ ---- cc/trees/property_tree.cc.orig 2021-12-14 11:44:55 UTC -+++ cc/trees/property_tree.cc -@@ -1299,13 +1299,13 @@ gfx::Vector2dF ScrollTree::MaxScrollOffset(int scroll_ - - gfx::Size clip_layer_bounds = container_bounds(scroll_node->id); - -- gfx::Vector2dF max_offset( -+ gfx::Vector2dF _max_offset( - scaled_scroll_bounds.width() - clip_layer_bounds.width(), - scaled_scroll_bounds.height() - clip_layer_bounds.height()); - -- max_offset.Scale(1 / scale_factor); -- max_offset.SetToMax(gfx::Vector2dF()); -- return max_offset; -+ _max_offset.Scale(1 / scale_factor); -+ _max_offset.SetToMax(gfx::Vector2dF()); -+ return _max_offset; - } - - gfx::SizeF ScrollTree::scroll_bounds(int scroll_node_id) const { diff --git a/www/chromium/files/patch-chrome_BUILD.gn b/www/chromium/files/patch-chrome_BUILD.gn deleted file mode 100644 index cb38a1cd1657..000000000000 --- a/www/chromium/files/patch-chrome_BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ ---- chrome/BUILD.gn.orig 2021-12-31 00:57:18 UTC -+++ chrome/BUILD.gn -@@ -283,7 +283,9 @@ if (!is_android && !is_mac) { - ":xdg_mime", # Needs to be public for installer to consume files. - ] - -- data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] -+ if (!is_bsd) { -+ data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ] -+ } - } - - ldflags = [] -@@ -1392,7 +1394,7 @@ group("browser_dependencies") { - ] - } - -- if (!is_fuchsia) { -+ if (!is_fuchsia && !is_bsd) { - public_deps += [ "//components/crash/core/app" ] - } - -@@ -1715,7 +1717,7 @@ if (is_win && enable_resource_allowlist_generation) { - } - - if (is_linux || is_chromeos) { -- if (is_official_build) { -+ if (is_official_build && !is_bsd) { - group("linux_symbols") { - deps = [ - ":angle_egl_symbols", diff --git a/www/chromium/files/patch-chrome_app_BUILD.gn b/www/chromium/files/patch-chrome_app_BUILD.gn deleted file mode 100644 index dea4f40726e7..000000000000 --- a/www/chromium/files/patch-chrome_app_BUILD.gn +++ /dev/null @@ -1,11 +0,0 @@ ---- chrome/app/BUILD.gn.orig 2021-12-31 00:57:19 UTC -+++ chrome/app/BUILD.gn -@@ -184,7 +184,7 @@ static_library("test_support") { - ] - public_deps = [] - -- if (!is_fuchsia) { -+ if (!is_fuchsia && !is_bsd) { - # TODO(crbug.com/1226159): Complete crash reporting integration on Fuchsia. - deps += [ - "//components/crash/core/app", diff --git a/www/chromium/files/patch-chrome_app_chrome__main.cc b/www/chromium/files/patch-chrome_app_chrome__main.cc index ecce2391064c..25aa85dc6643 100644 --- a/www/chromium/files/patch-chrome_app_chrome__main.cc +++ b/www/chromium/files/patch-chrome_app_chrome__main.cc @@ -1,6 +1,6 @@ ---- chrome/app/chrome_main.cc.orig 2021-09-24 04:25:56 UTC +--- chrome/app/chrome_main.cc.orig 2022-02-07 13:39:41 UTC +++ chrome/app/chrome_main.cc -@@ -25,7 +25,7 @@ +@@ -26,7 +26,7 @@ #include "chrome/app/notification_metrics.h" #endif @@ -9,17 +9,12 @@ #include "base/base_switches.h" #endif -@@ -145,11 +145,11 @@ int ChromeMain(int argc, const char** argv) { - if (headless::IsChromeNativeHeadless()) { +@@ -147,7 +147,7 @@ int ChromeMain(int argc, const char** argv) { headless::SetUpCommandLine(command_line); } else { --#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ -+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_BSD) || \ - defined(OS_WIN) - if (command_line->HasSwitch(switches::kHeadless)) - return headless::HeadlessShellMain(params); --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_BSD) || - // defined(OS_WIN) - } - + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ +- defined(OS_WIN) ++ defined(OS_WIN) || defined(OS_BSD) + if (command_line->HasSwitch(switches::kHeadless)) { + #if BUILDFLAG(GOOGLE_CHROME_BRANDING) + command_line->AppendSwitch(::headless::switches::kEnableCrashReporter); diff --git a/www/chromium/files/patch-chrome_app_chrome__main__delegate.cc b/www/chromium/files/patch-chrome_app_chrome__main__delegate.cc index 41fbdee1f6d1..97abda5f5a89 100644 --- a/www/chromium/files/patch-chrome_app_chrome__main__delegate.cc +++ b/www/chromium/files/patch-chrome_app_chrome__main__delegate.cc @@ -1,6 +1,15 @@ ---- chrome/app/chrome_main_delegate.cc.orig 2021-12-31 00:57:19 UTC +--- chrome/app/chrome_main_delegate.cc.orig 2022-02-07 13:39:41 UTC +++ chrome/app/chrome_main_delegate.cc -@@ -155,15 +155,17 @@ +@@ -112,7 +112,7 @@ + #include "chrome/app/chrome_crash_reporter_client.h" + #endif + +-#if BUILDFLAG(ENABLE_NACL) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) ++#if BUILDFLAG(ENABLE_NACL) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_BSD) + #include "components/nacl/common/nacl_paths.h" + #include "components/nacl/zygote/nacl_fork_delegate_linux.h" + #endif +@@ -156,12 +156,12 @@ #include "v8/include/v8.h" #endif @@ -13,32 +22,18 @@ - defined(OS_LINUX) || defined(OS_CHROMEOS) + defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) #include "chrome/browser/policy/policy_path_parser.h" -+#if !defined(OS_BSD) #include "components/crash/core/app/crashpad.h" #endif -+#endif - - #if BUILDFLAG(ENABLE_NACL) - #include "components/nacl/common/nacl_switches.h" -@@ -267,7 +269,7 @@ void SetUpExtendedCrashReporting(bool is_browser_proce - - #endif // defined(OS_WIN) - --#if defined(OS_LINUX) || defined(OS_CHROMEOS) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) - void AdjustLinuxOOMScore(const std::string& process_type) { - int score = -1; - -@@ -302,7 +304,7 @@ void AdjustLinuxOOMScore(const std::string& process_ty - if (score > -1) - base::AdjustOOMScore(base::GetCurrentProcId(), score); - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) - - // Returns true if this subprocess type needs the ResourceBundle initialized +@@ -309,7 +309,7 @@ void AdjustLinuxOOMScore(const std::string& process_ty // and resources loaded. -@@ -348,7 +350,7 @@ bool HandleVersionSwitches(const base::CommandLine& co + bool SubprocessNeedsResourceBundle(const std::string& process_type) { + return +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) + // The zygote process opens the resources for the renderers. + process_type == switches::kZygoteProcess || + #endif +@@ -349,7 +349,7 @@ bool HandleVersionSwitches(const base::CommandLine& co // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. @@ -47,16 +42,7 @@ // Show the man page if --help or -h is on the command line. void HandleHelpSwitches(const base::CommandLine& command_line) { if (command_line.HasSwitch(switches::kHelp) || -@@ -358,7 +360,7 @@ void HandleHelpSwitches(const base::CommandLine& comma - PLOG(FATAL) << "execlp failed"; - } - } --#endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -+#endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD) - - #if !defined(OS_MAC) && !defined(OS_ANDROID) - void SIGTERMProfilingShutdown(int signal) { -@@ -412,7 +414,7 @@ void InitializeUserDataDir(base::CommandLine* command_ +@@ -413,7 +413,7 @@ void InitializeUserDataDir(base::CommandLine* command_ std::string process_type = command_line->GetSwitchValueASCII(switches::kProcessType); @@ -65,25 +51,16 @@ // On Linux, Chrome does not support running multiple copies under different // DISPLAYs, so the profile directory can be specified in the environment to // support the virtual desktop use-case. -@@ -424,7 +426,7 @@ void InitializeUserDataDir(base::CommandLine* command_ - user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string); - } - } --#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) -+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) - #if defined(OS_MAC) - policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); - #endif // OS_MAC -@@ -495,7 +497,7 @@ void RecordMainStartupMetrics(base::TimeTicks applicat - startup_metric_utils::RecordApplicationStartTime(now); +@@ -497,7 +497,7 @@ void RecordMainStartupMetrics(base::TimeTicks applicat #endif --#if defined(OS_MAC) || defined(OS_WIN) || defined(OS_LINUX) || \ -+#if defined(OS_MAC) || defined(OS_WIN) || defined(OS_LINUX) || defined(OS_BSD) || \ - defined(OS_CHROMEOS) + #if defined(OS_MAC) || defined(OS_WIN) || defined(OS_LINUX) || \ +- defined(OS_CHROMEOS) ++ defined(OS_CHROMEOS) || defined(OS_BSD) // Record the startup process creation time on supported platforms. On Android // this is recorded in ChromeMainDelegateAndroid. -@@ -679,6 +681,8 @@ void ChromeMainDelegate::PostFieldTrialInitialization( + startup_metric_utils::RecordStartupProcessCreationTime( +@@ -685,6 +685,8 @@ void ChromeMainDelegate::PostFieldTrialInitialization( // not always enabled on Linux/ChromeOS. #if defined(OS_LINUX) || defined(OS_CHROMEOS) bool enable_gwp_asan = crash_reporter::IsCrashpadEnabled(); @@ -92,16 +69,7 @@ #el |