www/chromium: update to 89.0.4389.114

Submitted by:	Matthias Wolf via github
Security:	https://www.vuxml.org/freebsd/bddadaa4-9227-11eb-99c5-e09467587c17.html
This commit is contained in:
Rene Ladan 2021-04-06 10:40:01 +02:00
parent a8416100c4
commit 1227b53ed1
944 changed files with 4663 additions and 3438 deletions

View File

@ -1,8 +1,8 @@
# Created by: Florent Thoumie <flz@FreeBSD.org>
# $FreeBSD$
# $FreeBSD: head/www/chromium/Makefile 563913 2021-02-03 19:46:35Z sunpoet $
PORTNAME= chromium
PORTVERSION= 88.0.4324.182
PORTVERSION= 89.0.4389.114
CATEGORIES= www java
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/ \
LOCAL/rene/chromium/:fonts
@ -60,12 +60,13 @@ LIB_DEPENDS= libatk-bridge-2.0.so:accessibility/at-spi2-atk \
libnss3.so:security/nss \
libexpat.so:textproc/expat2 \
libfontconfig.so:x11-fonts/fontconfig \
libxkbcommon.so:x11/libxkbcommon
libxkbcommon.so:x11/libxkbcommon \
libxshmfence.so:x11/libxshmfence
RUN_DEPENDS= xdg-open:devel/xdg-utils \
noto-basic>0:x11-fonts/noto-basic
USES= bison cpe desktop-file-utils dos2unix gl gnome jpeg localbase:ldflags \
USES= bison compiler:c++17-lang cpe desktop-file-utils dos2unix gl gnome jpeg localbase:ldflags \
ninja perl5 pkgconfig python:2.7,build shebangfix tar:xz xorg
MAKE_ARGS= -C out/${BUILDTYPE}
@ -121,9 +122,8 @@ GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles
# Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys .
# Note: these are for FreeBSD use ONLY. For your own distribution,
# please get your own set of keys.
GN_ARGS+= google_api_key="AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8" \
google_default_client_id="996322985003.apps.googleusercontent.com" \
google_default_client_secret="IR1za9-1VK0zZ0f_O8MVFicn"
GN_ARGS+= google_api_key="AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8"
SUB_FILES= chromium-browser.desktop chrome
SUB_LIST+= COMMENT="${COMMENT}"
@ -199,16 +199,17 @@ TEST_DISTFILES= ${PORTNAME}-${DISTVERSION}-testdata${EXTRACT_SUFX} \
test_fonts-85${EXTRACT_SUFX}:fonts
.include <bsd.port.options.mk>
.include <bsd.port.pre.mk>
.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 ${OPSYS} == FreeBSD && ${OSVERSION} < 1300000
.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 on FreeBSD < 13, needs LLVM 11+
BROKEN+= does not build with LTO needs LLVM 12+
.endif
.endif
@ -344,6 +345,8 @@ do-install:
post-install-DEBUG-on:
${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/*.so \
${STAGEDIR}${DATADIR}
${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libvulkan.so.1 \
${STAGEDIR}${DATADIR}
${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/character_data_generator \
${STAGEDIR}${DATADIR}
@ -351,4 +354,4 @@ post-install-DRIVER-on:
${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chromedriver \
${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>
.include <bsd.port.post.mk>

View File

@ -1,4 +1,4 @@
# $FreeBSD$
# $FreeBSD: head/www/chromium/Makefile.tests 489612 2019-01-07 19:47:18Z cpm $
TEST_TARGETS= base_unittests \
chromedriver_unittests \
crypto_unittests \

View File

@ -1,7 +1,7 @@
TIMESTAMP = 1613565416
SHA256 (chromium-88.0.4324.182.tar.xz) = 30411fc3ec2d33df4c5cad41f21affa3823c80f7dbd394f6d68f9a1e81015b81
SIZE (chromium-88.0.4324.182.tar.xz) = 857221352
SHA256 (chromium-88.0.4324.182-testdata.tar.xz) = 305c105341b67249ea640e341dcf3b1f534c597a84550ea38d2e1e47b3fd84c6
SIZE (chromium-88.0.4324.182-testdata.tar.xz) = 257484896
TIMESTAMP = 1617179966
SHA256 (chromium-89.0.4389.114.tar.xz) = f2f0abe9697a220a8545df74d832c6c8d85a4fb11845e7e398752d746e72ed00
SIZE (chromium-89.0.4389.114.tar.xz) = 890898912
SHA256 (chromium-89.0.4389.114-testdata.tar.xz) = 42d108ab42c81ce42973ec9ccac951237d29089c850738eeeea770ced3293bc6
SIZE (chromium-89.0.4389.114-testdata.tar.xz) = 257717396
SHA256 (test_fonts-85.tar.xz) = f22b61b3639acb147c98ec2e2305d8b96f0b55c8c74c40e2ea696402fae8cef9
SIZE (test_fonts-85.tar.xz) = 9511984

View File

@ -80,7 +80,7 @@ AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thre
AudioLogFactory* audio_log_factory)
: AudioManagerBase(std::move(audio_thread),
audio_log_factory) {
DLOG(WARNING) << "AudioManagerOpenBSD";
DLOG(INFO) << "AudioManagerOpenBSD";
SetMaxOutputStreamsAllowed(kMaxOutputStreams);
}
@ -147,14 +147,14 @@ AudioParameters AudioManagerOpenBSD::GetPreferredOutputStreamParameters(
AudioInputStream* AudioManagerOpenBSD::MakeInputStream(
const AudioParameters& params) {
DLOG(WARNING) << "MakeInputStream";
DLOG(INFO) << "MakeInputStream";
return new SndioAudioInputStream(this,
AudioDeviceDescription::kDefaultDeviceId, params);
}
AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
const AudioParameters& params) {
DLOG(WARNING) << "MakeOutputStream";
DLOG(INFO) << "MakeOutputStream";
return new SndioAudioOutputStream(params, this);
}
#endif
@ -162,7 +162,7 @@ AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
std::unique_ptr<media::AudioManager> CreateAudioManager(
std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory) {
DLOG(WARNING) << "CreateAudioManager";
DLOG(INFO) << "CreateAudioManager";
#if defined(USE_SNDIO)
UMA_HISTOGRAM_ENUMERATION("Media.OpenBSDAudioIO", kSndio, kAudioIOMax + 1);
return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),

View File

@ -1,11 +1,11 @@
--- build/config/compiler/pgo/pgo.gni.orig 2021-01-18 21:28:45 UTC
--- build/config/compiler/pgo/pgo.gni.orig 2021-03-12 23:57:15 UTC
+++ build/config/compiler/pgo/pgo.gni
@@ -13,7 +13,7 @@ declare_args() {
# 2 : Used during the PGO (optimization) phase.
chrome_pgo_phase = 0
if (is_official_build &&
- (is_win || is_mac || (is_linux && !chromeos_is_browser_only && !is_chromecast))) {
+ (is_win || is_mac || (is_linux && !chromeos_is_browser_only && !is_chromecast && !is_bsd))) {
@@ -16,7 +16,7 @@ declare_args() {
# TODO(crbug.com/1052397): Remove chromeos_is_browser_only once
# target_os switch for lacros-chrome is completed.
(is_win || is_mac ||
- (is_linux && !chromeos_is_browser_only && !is_chromecast))) {
+ (is_linux && !chromeos_is_browser_only && !is_chromecast && !is_bsd))) {
chrome_pgo_phase = 2
}

View File

@ -1,4 +1,4 @@
--- third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2021-01-18 21:31:51 UTC
--- third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2021-03-13 00:03:39 UTC
+++ third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -16,7 +16,7 @@
#if defined(OS_ANDROID)

View File

@ -1,6 +1,6 @@
--- BUILD.gn.orig 2021-01-18 21:28:44 UTC
--- BUILD.gn.orig 2021-03-12 23:57:14 UTC
+++ BUILD.gn
@@ -424,7 +424,7 @@ group("gn_all") {
@@ -421,7 +421,7 @@ group("gn_all") {
]
}
@ -9,7 +9,7 @@
deps += [
"//third_party/breakpad:breakpad_unittests",
"//third_party/breakpad:core-2-minidump",
@@ -467,8 +467,6 @@ group("gn_all") {
@@ -464,8 +464,6 @@ group("gn_all") {
"//net:disk_cache_memory_test",
"//net:quic_client",
"//net:quic_server",
@ -18,7 +18,7 @@
"//testing:empty_main",
]
@@ -523,10 +521,6 @@ group("gn_all") {
@@ -520,10 +518,6 @@ group("gn_all") {
"//chrome/test:load_library_perf_tests",
"//chrome/test:sync_performance_tests",
"//chrome/test/chromedriver:chromedriver",
@ -29,7 +29,7 @@
"//media/cast:generate_barcode_video",
"//media/cast:generate_timecode_audio",
"//net:crash_cache",
@@ -586,10 +580,6 @@ group("gn_all") {
@@ -582,10 +576,6 @@ group("gn_all") {
"//mojo:mojo_perftests",
"//services/service_manager/public/cpp",
"//testing/gmock:gmock_main",
@ -40,7 +40,7 @@
]
if (!is_android) {
@@ -667,7 +657,7 @@ group("gn_all") {
@@ -663,7 +653,7 @@ group("gn_all") {
host_os == "win") {
deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
}
@ -49,7 +49,7 @@
deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
}
@@ -682,7 +672,7 @@ group("gn_all") {
@@ -678,7 +668,7 @@ group("gn_all") {
}
}
@ -58,7 +58,7 @@
deps += [
"//third_party/crashpad/crashpad:crashpad_tests",
"//third_party/crashpad/crashpad/handler:crashpad_handler",
@@ -802,7 +792,6 @@ group("gn_all") {
@@ -790,7 +780,6 @@ group("gn_all") {
"//chrome/browser/vr:vr_common_perftests",
"//chrome/browser/vr:vr_common_unittests",
"//chrome/browser/vr:vr_pixeltests",
@ -66,7 +66,7 @@
]
if (is_android) {
deps += [ "//chrome/browser/android/vr:vr_android_unittests" ]
@@ -1090,7 +1079,7 @@ if (!is_ios) {
@@ -1081,7 +1070,7 @@ if (!is_ios) {
data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
}
@ -75,7 +75,7 @@
data_deps +=
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
}
@@ -1099,7 +1088,7 @@ if (!is_ios) {
@@ -1090,7 +1079,7 @@ if (!is_ios) {
data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
}
@ -84,7 +84,7 @@
data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
}
@@ -1320,9 +1309,6 @@ group("chromium_builder_perf") {
@@ -1315,9 +1304,6 @@ group("chromium_builder_perf") {
if (is_win) {
data_deps += [ "//chrome/installer/mini_installer:mini_installer" ]

View File

@ -1,4 +1,4 @@
--- apps/app_restore_service_browsertest.cc.orig 2020-11-13 06:36:34 UTC
--- apps/app_restore_service_browsertest.cc.orig 2021-03-12 23:57:14 UTC
+++ apps/app_restore_service_browsertest.cc
@@ -148,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAcc
}

View File

@ -1,6 +1,6 @@
--- apps/ui/views/app_window_frame_view.cc.orig 2021-01-18 21:28:44 UTC
--- apps/ui/views/app_window_frame_view.cc.orig 2021-03-12 23:57:14 UTC
+++ apps/ui/views/app_window_frame_view.cc
@@ -139,7 +139,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient
@@ -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.

View File

@ -1,4 +1,4 @@
--- ash/display/mirror_window_controller.cc.orig 2021-01-18 21:28:44 UTC
--- ash/display/mirror_window_controller.cc.orig 2021-03-12 23:57:14 UTC
+++ ash/display/mirror_window_controller.cc
@@ -286,7 +286,11 @@ void MirrorWindowController::UpdateWindow(
return info.id() == iter->first;

View File

@ -1,6 +1,6 @@
--- base/BUILD.gn.orig 2021-01-18 21:28:44 UTC
--- base/BUILD.gn.orig 2021-03-12 23:57:15 UTC
+++ base/BUILD.gn
@@ -873,7 +873,7 @@ component("base") {
@@ -885,7 +885,7 @@ component("base") {
"timer/hi_res_timer_manager_posix.cc",
]
@ -9,7 +9,7 @@
sources += [
"cpu_affinity_posix.cc",
"cpu_affinity_posix.h",
@@ -884,6 +884,11 @@ component("base") {
@@ -896,6 +896,11 @@ component("base") {
"profiler/thread_delegate_posix.h",
]
}
@ -21,7 +21,7 @@
}
if (is_win) {
@@ -1293,7 +1298,7 @@ component("base") {
@@ -1301,7 +1306,7 @@ component("base") {
# building inside the cros_sdk environment - use host_toolchain as a
# more robust check for this.
if (!use_sysroot &&
@ -30,7 +30,7 @@
host_toolchain != "//build/toolchain/cros:host") {
libs += [ "atomic" ]
}
@@ -1343,7 +1348,7 @@ component("base") {
@@ -1351,7 +1356,7 @@ component("base") {
"allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc",
]
}
@ -39,7 +39,7 @@
sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ]
}
if (is_win) {
@@ -1969,6 +1974,34 @@ component("base") {
@@ -1978,6 +1983,34 @@ component("base") {
}
}
@ -54,9 +54,9 @@
+ "system/sys_info_linux.cc"
+ ]
+ sources += [
+ "files/file_path_watcher_freebsd.cc",
+ "files/file_path_watcher_kqueue.cc",
+ "files/file_path_watcher_kqueue.h",
+ "files/file_path_watcher_stub.cc",
+ "process/memory_stubs.cc",
+ "process/process_handle_freebsd.cc",
+ "process/process_iterator_freebsd.cc",
@ -74,21 +74,21 @@
# iOS
if (is_ios) {
sources -= [
@@ -3111,7 +3144,7 @@ test("base_unittests") {
@@ -3130,7 +3163,7 @@ if (build_base_unittests) {
}
}
}
- if (is_linux || is_chromeos) {
+ if ((is_linux || is_chromeos) && !is_bsd) {
sources += [ "debug/proc_maps_linux_unittest.cc" ]
}
- if (is_linux || is_chromeos) {
+ if ((is_linux || is_chromeos) && !is_bsd) {
sources += [ "debug/proc_maps_linux_unittest.cc" ]
}
@@ -3152,7 +3185,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",
@@ -3171,7 +3204,7 @@ if (build_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",

View File

@ -0,0 +1,11 @@
--- base/allocator/allocator.gni.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/allocator.gni
@@ -58,7 +58,7 @@ declare_args() {
# not, and redesign or remove the flag accordingly. We may want to assert a
# possible conflict between |use_allocator = "partition"| and
# |use_partition_alloc = true| rather than prioritizing use_partition_alloc.
- use_partition_alloc = !is_ios # Never use PartitionAlloc on iOS.
+ use_partition_alloc = !is_ios # Never use PartitionAlloc on iOS.
}
if (!use_partition_alloc && use_allocator == "partition") {

View File

@ -1,4 +1,4 @@
--- base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2020-11-13 06:36:34 UTC
--- base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/allocator_shim_default_dispatch_to_glibc.cc
@@ -6,18 +6,28 @@
#include "base/compiler_specific.h"

View File

@ -1,4 +1,4 @@
--- base/allocator/allocator_shim_override_libc_symbols.h.orig 2021-01-18 21:28:44 UTC
--- base/allocator/allocator_shim_override_libc_symbols.h.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/allocator_shim_override_libc_symbols.h
@@ -16,6 +16,10 @@
#include <malloc.h>

View File

@ -1,6 +1,6 @@
--- base/allocator/allocator_shim_unittest.cc.orig 2021-01-18 21:28:44 UTC
--- base/allocator/allocator_shim_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/allocator_shim_unittest.cc
@@ -367,7 +367,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
@@ -369,7 +369,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
#endif // !OS_WIN
@ -9,7 +9,7 @@
void* memalign_ptr = memalign(128, 53);
ASSERT_NE(nullptr, memalign_ptr);
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(memalign_ptr) % 128);
@@ -383,7 +383,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
@@ -385,7 +385,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
ASSERT_GE(aligned_allocs_intercepted_by_size[kPageSize], 1u);
#endif // !defined(OS_ANDROID)
@ -18,7 +18,7 @@
// See allocator_shim_override_glibc_weak_symbols.h for why we intercept
// internal libc symbols.
@@ -410,7 +410,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
@@ -412,7 +412,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
free(zero_alloc_ptr);
ASSERT_GE(frees_intercepted_by_addr[Hash(zero_alloc_ptr)], 1u);
@ -27,7 +27,7 @@
free(memalign_ptr);
ASSERT_GE(frees_intercepted_by_addr[Hash(memalign_ptr)], 1u);
@@ -419,7 +419,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
@@ -421,7 +421,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
ASSERT_GE(frees_intercepted_by_addr[Hash(pvalloc_ptr)], 1u);
#endif // !defined(OS_ANDROID)
@ -36,7 +36,7 @@
#if !defined(OS_WIN)
free(posix_memalign_ptr);
@@ -595,7 +595,7 @@ static size_t GetUsableSize(void* ptr) {
@@ -614,7 +614,7 @@ static size_t GetUsableSize(void* ptr) {
static size_t GetUsableSize(void* ptr) {
return malloc_size(ptr);
}

View File

@ -0,0 +1,31 @@
--- base/allocator/partition_allocator/address_pool_manager.cc.orig 2021-03-12 23:57:15 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>
@@ -50,6 +57,14 @@ void DecommitPages(void* address, size_t size) {
void* ptr = mmap(address, size, PROT_NONE,
MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
PA_CHECK(ptr == address);
+#elif defined(OS_FREEBSD)
+ int fd = HANDLE_EINTR(open("/dev/zero", O_RDONLY));
+ PA_CHECK(fd != -1);
+
+ void *ptr = mmap(address, size, PROT_NONE,
+ MAP_FIXED | MAP_PRIVATE, fd, 0);
+ PA_PCHECK(ptr == address);
+ HANDLE_EINTR(close(fd));
#else
DecommitSystemPages(address, size, PageUpdatePermissions);
#endif

View File

@ -1,6 +1,6 @@
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2021-01-18 21:28:44 UTC
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -26,7 +26,7 @@
@@ -27,12 +27,16 @@
#if defined(OS_ANDROID)
#include <sys/prctl.h>
#endif
@ -9,3 +9,50 @@
#include <sys/resource.h>
#include <algorithm>
#endif
+#if defined(OS_FREEBSD)
+#include <fcntl.h>
+#endif
+
#include "base/allocator/partition_allocator/page_allocator.h"
#ifndef MAP_ANONYMOUS
@@ -168,12 +172,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_APPLE)
// On macOS 10.14 and higher, executables that are code signed with the
@@ -200,6 +211,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;
@@ -294,6 +307,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.
//

View File

@ -1,12 +1,15 @@
--- base/allocator/partition_allocator/partition_alloc.cc.orig 2021-01-18 21:28:44 UTC
--- base/allocator/partition_allocator/partition_alloc.cc.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/partition_allocator/partition_alloc.cc
@@ -65,6 +65,9 @@ void PartitionAllocGlobalInit(OomFunction on_out_of_me
@@ -56,7 +56,12 @@ void PartitionAllocGlobalInit(OomFunction on_out_of_me
"maximum direct mapped allocation");
// Check that some of our zanier calculations worked out as expected.
#if ENABLE_TAG_FOR_MTE_CHECKED_PTR
static_assert(kSmallestBucket >= kAlignment, "generic smallest bucket");
+#elif defined(__i386__) && defined(OS_FREEBSD)
+#if defined(__i386__) && defined(OS_FREEBSD)
+ // alignof(std::max_align_t) is only 4 on FreeBSD/i386
+ static_assert(kSmallestBucket >= kAlignment, "generic smallest bucket");
#else
+#else
static_assert(kSmallestBucket == kAlignment, "generic smallest bucket");
#endif
+#endif
static_assert(kMaxBucketed == 983040, "generic max bucketed");
STATIC_ASSERT_OR_PA_CHECK(
MaxSystemPagesPerSlotSpan() < (1 << 8),

View File

@ -1,26 +1,20 @@
--- base/allocator/partition_allocator/partition_alloc_unittest.cc.orig 2021-01-18 21:28:44 UTC
--- base/allocator/partition_allocator/partition_alloc_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -366,9 +366,13 @@ void FreeFullSlotSpan(PartitionRoot<base::internal::Th
}
@@ -1588,7 +1588,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
@@ -1634,7 +1634,7 @@ TEST_F(PartitionAllocDeathTest, RepeatedTryReallocRetu
}
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
bool CheckPageInCore(void* ptr, bool in_core) {
+#if defined(OS_BSD)
+ char ret = 0;
+#else
unsigned char ret = 0;
+#endif
EXPECT_EQ(0, mincore(ptr, SystemPageSize(), &ret));
return in_core == (ret & 1);
}
@@ -377,7 +381,7 @@ bool CheckPageInCore(void* ptr, bool in_core) {
EXPECT_TRUE(CheckPageInCore(ptr, in_core))
#else
#define CHECK_PAGE_IN_CORE(ptr, in_core) (void)(0)
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
#endif // !defined(ARCH_CPU_64_BITS) || (defined(OS_POSIX) &&
- // !(defined(OS_APPLE) || defined(OS_ANDROID)))
+ // !(defined(OS_APPLE) || defined(OS_ANDROID) || defined(OS_BSD)))
class MockPartitionStatsDumper : public PartitionStatsDumper {
public:
// Make sure that malloc(-1) dies.
// In the past, we had an integer overflow that would alias malloc(-1) to

View File

@ -0,0 +1,36 @@
--- base/allocator/partition_allocator/partition_bucket.cc.orig 2021-03-23 17:09:47 UTC
+++ base/allocator/partition_allocator/partition_bucket.cc
@@ -66,27 +66,33 @@ PartitionDirectMap(PartitionRoot<thread_safe>* root, i
metadata->extent.root = root;
// The new structures are all located inside a fresh system page so they
// will all be zeroed out. These DCHECKs are for documentation.
+#if !defined(OS_FREEBSD)
PA_DCHECK(!metadata->extent.super_page_base);
PA_DCHECK(!metadata->extent.super_pages_end);
PA_DCHECK(!metadata->extent.next);
+#endif
PA_DCHECK(PartitionPage<thread_safe>::FromPointerNoAlignmentCheck(slot) ==
&metadata->page);
auto* page = &metadata->page;
+#if !defined(OS_FREEBSD)
PA_DCHECK(!page->slot_span_metadata_offset);
PA_DCHECK(!page->slot_span_metadata.next_slot_span);
PA_DCHECK(!page->slot_span_metadata.num_allocated_slots);
PA_DCHECK(!page->slot_span_metadata.num_unprovisioned_slots);
PA_DCHECK(!page->slot_span_metadata.empty_cache_index);
+#endif
page->slot_span_metadata.bucket = &metadata->bucket;
auto* next_entry = new (slot) PartitionFreelistEntry();
page->slot_span_metadata.SetFreelistHead(next_entry);
+#if !defined(OS_FREEBSD)
PA_DCHECK(!metadata->bucket.active_slot_spans_head);
PA_DCHECK(!metadata->bucket.empty_slot_spans_head);
PA_DCHECK(!metadata->bucket.decommitted_slot_spans_head);
PA_DCHECK(!metadata->bucket.num_system_pages_per_slot_span);
PA_DCHECK(!metadata->bucket.num_full_slot_spans);
+#endif
metadata->bucket.slot_size = slot_size;
auto* map_extent = &metadata->direct_map_extent;

View File

@ -0,0 +1,49 @@
--- base/allocator/partition_allocator/spinning_mutex.cc.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/partition_allocator/spinning_mutex.cc
@@ -16,9 +16,16 @@
#include <unistd.h>
#endif // defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_FREEBSD_KERNEL)
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/thr.h>
+#include <sys/umtx.h>
+#endif // defined(PA_HAS_FREEBSD_KERNEL)
+
namespace base {
namespace internal {
-#if defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL)
void SpinningMutex::FutexWait() {
// Save and restore errno.
@@ -42,8 +49,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)
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.
@@ -55,8 +67,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)
+ long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE,
+ 1 /* wake up a single waiter */, nullptr, nullptr);
+#endif
+
PA_CHECK(retval != -1);
errno = saved_errno;
}

View File

@ -0,0 +1,33 @@
--- base/allocator/partition_allocator/spinning_mutex.h.orig 2021-03-12 23:57:15 UTC
+++ base/allocator/partition_allocator/spinning_mutex.h
@@ -22,7 +22,11 @@
#define PA_HAS_LINUX_KERNEL
#endif
-#if defined(PA_HAS_LINUX_KERNEL) || defined(OS_WIN)
+#if defined(OS_FREEBSD)
+#define PA_HAS_FREEBSD_KERNEL
+#endif
+
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL) || defined(OS_WIN)
#define PA_HAS_SPINNING_MUTEX
#endif
@@ -66,7 +70,7 @@ class LOCKABLE BASE_EXPORT SpinningMutex {
// as the slow path has better characteristics than SpinLocks's.
static constexpr int kSpinCount = 1000;
-#if defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL)
void FutexWait();
void FutexWake();
@@ -111,7 +115,7 @@ ALWAYS_INLINE void SpinningMutex::Acquire() {
inline constexpr SpinningMutex::SpinningMutex() = default;
-#if defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL)
ALWAYS_INLINE bool SpinningMutex::Try() {
int expected = kUnlocked;

View File

@ -1,15 +1,17 @@
--- base/base_switches.cc.orig 2020-11-13 06:36:34 UTC
--- base/base_switches.cc.orig 2021-03-12 23:57:15 UTC
+++ base/base_switches.cc
@@ -117,7 +117,7 @@ const char kDisableHighResTimer[] = "disable-highres-t
const char kDisableUsbKeyboardDetect[] = "disable-usb-keyboard-detect";
#endif
@@ -120,8 +120,8 @@ const char kDisableUsbKeyboardDetect[] = "disable
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS)
+#if (defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS)) || defined(OS_BSD)
// 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
@@ -152,7 +152,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria
@@ -156,7 +156,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria
#endif

View File

@ -1,15 +1,17 @@
--- base/base_switches.h.orig 2020-11-13 06:36:34 UTC
--- base/base_switches.h.orig 2021-03-12 23:57:15 UTC
+++ base/base_switches.h
@@ -39,7 +39,7 @@ extern const char kDisableHighResTimer[];
extern const char kDisableUsbKeyboardDetect[];
#endif
@@ -41,8 +41,8 @@ extern const char kDisableUsbKeyboardDetect[];
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS)
+#if (defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS)) || defined(OS_BSD)
// 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
@@ -55,7 +55,7 @@ extern const char kEnableIdleTracing[];
@@ -58,7 +58,7 @@ extern const char kEnableIdleTracing[];
extern const char kForceFieldTrialParams[];
#endif

View File

@ -1,4 +1,4 @@
--- base/cpu.cc.orig 2021-01-18 21:28:44 UTC
--- base/cpu.cc.orig 2021-03-12 23:57:15 UTC
+++ base/cpu.cc
@@ -16,7 +16,7 @@
@ -9,9 +9,9 @@
defined(OS_AIX)
#include "base/containers/flat_set.h"
#include "base/files/file_util.h"
@@ -182,6 +182,14 @@ std::string* CpuInfoBrand() {
@@ -212,6 +212,14 @@ const ProcCpuInfo& ParseProcCpu() {
return brand;
return *info;
}
+#elif defined(OS_BSD)
+std::string* CpuInfoBrand() {
@ -24,12 +24,12 @@
#endif // defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) ||
// defined(OS_LINUX) || defined(OS_CHROMEOS))
@@ -305,7 +313,7 @@ void CPU::Initialize() {
}
}
#elif defined(ARCH_CPU_ARM_FAMILY)
-#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
cpu_brand_ = *CpuInfoBrand();
@@ -348,6 +356,8 @@ void CPU::Initialize() {
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.

View File

@ -1,6 +1,6 @@
--- base/cpu.h.orig 2020-11-16 17:24:49 UTC
--- base/cpu.h.orig 2021-03-12 23:57:15 UTC
+++ base/cpu.h
@@ -73,7 +73,7 @@ class BASE_EXPORT CPU final {
@@ -84,7 +84,7 @@ class BASE_EXPORT CPU final {
IntelMicroArchitecture GetIntelMicroArchitecture() const;
const std::string& cpu_brand() const { return cpu_brand_; }
@ -9,7 +9,7 @@
defined(OS_AIX)
enum class CoreType {
kUnknown = 0,
@@ -124,7 +124,7 @@ class BASE_EXPORT CPU final {
@@ -135,7 +135,7 @@ class BASE_EXPORT CPU final {
// cpuidle driver.
using CoreIdleTimes = std::vector<TimeDelta>;
static bool GetCumulativeCoreIdleTimes(CoreIdleTimes&);

View File

@ -1,4 +1,4 @@
--- base/debug/debugger_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/debug/debugger_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/debug/debugger_posix.cc
@@ -98,7 +98,7 @@ bool BeingDebugged() {
KERN_PROC,

View File

@ -1,4 +1,4 @@
--- base/debug/elf_reader.cc.orig 2020-11-13 06:36:34 UTC
--- base/debug/elf_reader.cc.orig 2021-03-12 23:57:15 UTC
+++ base/debug/elf_reader.cc
@@ -38,7 +38,9 @@ using Nhdr = Elf64_Nhdr;
using Word = Elf64_Word;

View File

@ -1,6 +1,6 @@
--- base/debug/proc_maps_linux.cc.orig 2020-11-13 06:36:34 UTC
--- base/debug/proc_maps_linux.cc.orig 2021-03-12 23:57:15 UTC
+++ base/debug/proc_maps_linux.cc
@@ -13,7 +13,7 @@
@@ -13,13 +13,18 @@
#include "base/strings/string_split.h"
#include "build/build_config.h"
@ -9,7 +9,6 @@
#include <inttypes.h>
#endif
@@ -29,6 +29,11 @@
namespace base {
namespace debug {
@ -21,7 +20,7 @@
// 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) {
@@ -44,15 +49,16 @@ static bool ContainsGateVMA(std::string* proc_maps, si
@@ -35,15 +40,16 @@ static bool ContainsGateVMA(std::string* proc_maps, si
return false;
#endif
}
@ -40,7 +39,7 @@
return false;
}
proc_maps->clear();
@@ -66,7 +72,7 @@ bool ReadProcMaps(std::string* proc_maps) {
@@ -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) {
@ -49,7 +48,7 @@
proc_maps->clear();
return false;
}
@@ -77,6 +83,7 @@ bool ReadProcMaps(std::string* proc_maps) {
@@ -68,6 +74,7 @@ bool ReadProcMaps(std::string* proc_maps) {
if (bytes_read == 0)
break;
@ -57,7 +56,7 @@
// The gate VMA is handled as a special case after seq_file has finished
// iterating through all entries in the virtual memory table.
//
@@ -87,6 +94,7 @@ bool ReadProcMaps(std::string* proc_maps) {
@@ -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;
@ -65,17 +64,18 @@
}
return true;
@@ -115,10 +123,32 @@ bool ParseProcMaps(const std::string& input,
@@ -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[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:
@ -83,7 +83,7 @@
+ // 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 %*llx %3c %*d %*d %*x %c%*s %*s %*s %n",
+ if (sscanf(line, "%" SCNxPTR " %" SCNxPTR " %*ld %*ld %*[^ ] %5[^ ] %*d %*d %*x %c%*s %*s %*s %n",
+ &region.start, &region.end, permissions, &cow, &path_index) < 4) {
+ DPLOG(WARNING) << "sscanf failed for line: " << line;
+ return false;
@ -99,7 +99,7 @@
// Sample format from man 5 proc:
//
@@ -134,6 +164,7 @@ bool ParseProcMaps(const std::string& input,
@@ -125,6 +154,7 @@ bool ParseProcMaps(const std::string& input,
DPLOG(WARNING) << "sscanf failed for line: " << line;
return false;
}
@ -107,7 +107,7 @@
region.permissions = 0;
@@ -152,14 +183,31 @@ bool ParseProcMaps(const std::string& input,
@@ -143,14 +173,31 @@ bool ParseProcMaps(const std::string& input,
else if (permissions[2] != '-')
return false;

View File

@ -1,4 +1,4 @@
--- base/debug/stack_trace.cc.orig 2020-11-13 06:36:34 UTC
--- base/debug/stack_trace.cc.orig 2021-03-12 23:57:15 UTC
+++ base/debug/stack_trace.cc
@@ -15,7 +15,7 @@

View File

@ -1,4 +1,4 @@
--- base/debug/stack_trace.h.orig 2020-11-13 06:36:34 UTC
--- base/debug/stack_trace.h.orig 2021-03-12 23:57:15 UTC
+++ base/debug/stack_trace.h
@@ -19,6 +19,7 @@
#if !defined(OS_NACL)

View File

@ -1,4 +1,4 @@
--- base/debug/stack_trace_posix.cc.orig 2021-01-18 21:28:44 UTC
--- base/debug/stack_trace_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/debug/stack_trace_posix.cc
@@ -35,7 +35,7 @@
#include <AvailabilityMacros.h>
@ -9,7 +9,29 @@
#include "base/debug/proc_maps_linux.h"
#endif
@@ -696,7 +696,11 @@ class SandboxSymbolizeHelper {
@@ -659,13 +659,21 @@ class SandboxSymbolizeHelper {
// 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;
}
// Parses /proc/self/maps.
if (!ParseProcMaps(contents, &regions_)) {
+#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;
}
@@ -696,7 +704,11 @@ class SandboxSymbolizeHelper {
// Skip regions with empty file names.
continue;
}

View File

@ -1,4 +1,4 @@
--- base/debug/stack_trace_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/debug/stack_trace_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/debug/stack_trace_unittest.cc
@@ -88,6 +88,7 @@ TEST_F(StackTraceTest, OutputToStream) {
std::string::npos)
@ -29,3 +29,12 @@
// The test is used for manual testing, e.g., to see the raw output.
TEST_F(StackTraceTest, DebugOutputToStream) {
@@ -361,7 +363,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

View File

@ -1,4 +1,4 @@
--- base/files/file_path_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/files/file_path_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/files/file_path_unittest.cc
@@ -1149,7 +1149,7 @@ TEST_F(FilePathTest, FromUTF8Unsafe_And_AsUTF8Unsafe)
"\xEF\xBC\xA1\xEF\xBC\xA2\xEF\xBC\xA3.txt" },

View File

@ -0,0 +1,64 @@
--- base/files/file_path_watcher_freebsd.cc.orig 2021-03-15 11:01:22 UTC
+++ base/files/file_path_watcher_freebsd.cc
@@ -0,0 +1,61 @@
+// 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.
+
+// 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"
+
+namespace base {
+
+namespace {
+
+class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
+ public:
+ FilePathWatcherImpl() = default;
+ FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
+ FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
+ ~FilePathWatcherImpl() override = default;
+
+ bool Watch(const FilePath& path,
+ Type type,
+ const FilePathWatcher::Callback& callback) override {
+ DCHECK(!impl_.get());
+
+ if (type == Type::kRecursive) {
+ 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();
+ }
+
+ private:
+ std::unique_ptr<PlatformDelegate> impl_;
+};
+
+} // namespace
+
+FilePathWatcher::FilePathWatcher() {
+ sequence_checker_.DetachFromSequence();
+ impl_ = std::make_unique<FilePathWatcherImpl>();
+}
+
+} // namespace base

View File

@ -1,4 +1,4 @@
--- base/files/file_path_watcher_kqueue.h.orig 2020-11-13 06:36:34 UTC
--- base/files/file_path_watcher_kqueue.h.orig 2021-03-12 23:57:15 UTC
+++ base/files/file_path_watcher_kqueue.h
@@ -5,6 +5,10 @@
#ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_

View File

@ -1,53 +0,0 @@
--- base/files/file_path_watcher_stub.cc.orig 2021-01-18 21:28:44 UTC
+++ base/files/file_path_watcher_stub.cc
@@ -1,14 +1,15 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 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 "base/files/file_path_watcher.h"
+#include <memory>
+#include "base/files/file_path_watcher.h"
+#include "base/files/file_path_watcher_kqueue.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "build/build_config.h"
namespace base {
@@ -22,12 +23,29 @@ class FilePathWatcherImpl : public FilePathWatcher::Pl
bool Watch(const FilePath& path,
Type type,
const FilePathWatcher::Callback& callback) override {
+#if defined(OS_BSD)
+ DCHECK(!impl_.get());
+ if (type == Type::kRecursive) {
+ return false;
+ } else {
+ impl_ = std::make_unique<FilePathWatcherKQueue>();
+ }
+ DCHECK(impl_.get());
+ return impl_->Watch(path, type, callback);
+#else
return false;
+#endif
}
- void Cancel() override {}
+ void Cancel() override {
+ if (impl_.get())
+ impl_->Cancel();
+ set_cancelled();
+ }
private:
+ std::unique_ptr<PlatformDelegate> impl_;
+
DISALLOW_COPY_AND_ASSIGN(FilePathWatcherImpl);
};

View File

@ -1,6 +1,6 @@
--- base/files/file_path_watcher_unittest.cc.orig 2021-01-18 21:28:44 UTC
--- base/files/file_path_watcher_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/files/file_path_watcher_unittest.cc
@@ -438,12 +438,12 @@ TEST_F(FilePathWatcherTest, WatchDirectory) {
@@ -444,12 +444,12 @@ TEST_F(FilePathWatcherTest, WatchDirectory) {
VLOG(1) << "Waiting for file1 creation";
ASSERT_TRUE(WaitForEvents());
@ -15,16 +15,7 @@
ASSERT_TRUE(base::DeleteFile(file1));
VLOG(1) << "Waiting for file1 deletion";
@@ -650,7 +650,7 @@ TEST_F(FilePathWatcherTest, FileAttributesChanged) {
ASSERT_TRUE(WaitForEvents());
}
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
// Verify that creating a symlink is caught.
TEST_F(FilePathWatcherTest, CreateLink) {
@@ -816,7 +816,7 @@ TEST_F(FilePathWatcherTest, LinkedDirectoryPart3) {
@@ -822,7 +822,7 @@ TEST_F(FilePathWatcherTest, LinkedDirectoryPart3) {
ASSERT_TRUE(WaitForEvents());
}
@ -33,7 +24,7 @@
enum Permission {
Read,
@@ -824,7 +824,7 @@ enum Permission {
@@ -830,7 +830,7 @@ enum Permission {
Execute
};
@ -42,7 +33,7 @@
bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
struct stat stat_buf;
@@ -853,9 +853,9 @@ bool ChangeFilePermissions(const FilePath& path, Permi
@@ -859,9 +859,9 @@ bool ChangeFilePermissions(const FilePath& path, Permi
}
return chmod(path.value().c_str(), stat_buf.st_mode) == 0;
}
@ -54,7 +45,7 @@
// Linux implementation of FilePathWatcher doesn't catch attribute changes.
// http://crbug.com/78043
// Windows implementation of FilePathWatcher catches attribute changes that
@@ -891,7 +891,7 @@ TEST_F(FilePathWatcherTest, DirAttributesChanged) {
@@ -897,7 +897,7 @@ TEST_F(FilePathWatcherTest, DirAttributesChanged) {
ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true));
}

View File

@ -1,6 +1,6 @@
--- base/files/file_util.h.orig 2021-01-18 21:28:44 UTC
--- base/files/file_util.h.orig 2021-03-12 23:57:15 UTC
+++ base/files/file_util.h
@@ -278,14 +278,14 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePat
@@ -284,14 +284,14 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePat
BASE_EXPORT bool ExecutableExistsInPath(Environment* env,
const FilePath::StringType& executable);
@ -17,7 +17,7 @@
#endif // OS_POSIX
@@ -597,7 +597,7 @@ BASE_EXPORT bool VerifyPathControlledByAdmin(const bas
@@ -603,7 +603,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);

View File

@ -1,6 +1,6 @@
--- base/files/file_util_posix.cc.orig 2021-01-18 21:28:44 UTC
--- base/files/file_util_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/files/file_util_posix.cc
@@ -406,7 +406,7 @@ bool CreatePipe(ScopedFD* read_fd, ScopedFD* write_fd,
@@ -380,7 +380,7 @@ bool CreatePipe(ScopedFD* read_fd, ScopedFD* write_fd,
}
bool CreateLocalNonBlockingPipe(int fds[2]) {
@ -9,7 +9,7 @@
return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0;
#else
int raw_fds[2];
@@ -953,8 +953,12 @@ bool AllocateFileRegion(File* file, int64_t offset, si
@@ -927,8 +927,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.
@ -23,7 +23,25 @@
return true;
DPLOG(ERROR) << "fallocate";
#elif defined(OS_APPLE)
@@ -1178,7 +1182,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
@@ -1098,7 +1102,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(
@@ -1114,7 +1118,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)
@@ -1152,7 +1156,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.
@ -32,7 +50,7 @@
(defined(OS_ANDROID) && __ANDROID_API__ >= 21)
File file(file_path, File::FLAG_OPEN | File::FLAG_READ);
if (!file.IsValid())
@@ -1214,7 +1218,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
@@ -1188,7 +1192,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
return internal::PreReadFileSlow(file_path, max_bytes)
? PrefetchResult{PrefetchResultCode::kSlowSuccess}
: PrefetchResult{PrefetchResultCode::kSlowFailed};
@ -41,7 +59,7 @@
// __ANDROID_API__ >= 21)
}
@@ -1249,7 +1253,7 @@ bool MoveUnsafe(const FilePath& from_path, const FileP
@@ -1223,7 +1227,7 @@ bool MoveUnsafe(const FilePath& from_path, const FileP
#endif // !defined(OS_NACL_NONSFI)
@ -50,7 +68,7 @@
BASE_EXPORT bool IsPathExecutable(const FilePath& path) {
bool result = false;
FilePath tmp_file_path;
@@ -1270,6 +1274,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path
@@ -1244,6 +1248,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path
}
return result;
}

View File

@ -1,4 +1,4 @@
--- base/files/file_util_unittest.cc.orig 2021-01-18 21:28:44 UTC
--- base/files/file_util_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/files/file_util_unittest.cc
@@ -1638,7 +1638,7 @@ TEST_F(FileUtilTest, DeleteDirRecursiveWithOpenFile) {
#endif

View File

@ -1,4 +1,4 @@
--- base/files/scoped_file.cc.orig 2020-11-13 06:36:34 UTC
--- base/files/scoped_file.cc.orig 2021-03-12 23:57:15 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.

View File

@ -1,4 +1,4 @@
--- base/i18n/icu_util.cc.orig 2021-01-18 21:28:44 UTC
--- base/i18n/icu_util.cc.orig 2021-03-12 23:57:15 UTC
+++ base/i18n/icu_util.cc
@@ -48,7 +48,7 @@
#include "third_party/icu/source/common/unicode/unistr.h"

View File

@ -1,4 +1,4 @@
--- base/linux_util.cc.orig 2020-11-13 06:36:34 UTC
--- base/linux_util.cc.orig 2021-03-12 23:57:15 UTC
+++ base/linux_util.cc
@@ -15,6 +15,7 @@
@ -8,7 +8,7 @@
#include "base/files/dir_reader_posix.h"
#include "base/files/file_util.h"
@@ -78,6 +79,9 @@ class DistroNameGetter {
@@ -79,6 +80,9 @@ class DistroNameGetter {
public:
DistroNameGetter() {
static const char* const kFilesToCheck[] = {"/etc/os-release",
@ -18,7 +18,7 @@
"/usr/lib/os-release"};
for (const char* file : kFilesToCheck) {
if (ReadDistroFromOSReleaseFile(file))
@@ -134,6 +138,9 @@ void SetLinuxDistro(const std::string& distro) {
@@ -135,6 +139,9 @@ void SetLinuxDistro(const std::string& distro) {
}
bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
@ -28,7 +28,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
@@ -154,6 +161,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t
}
return true;

View File

@ -1,4 +1,4 @@
--- base/location_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/location_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/location_unittest.cc
@@ -32,7 +32,7 @@ TEST(LocationTest, CurrentYieldsCorrectValue) {
EXPECT_EQ(here.line_number(), previous_line + 1);

View File

@ -1,6 +1,6 @@
--- base/logging_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/logging_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/logging_unittest.cc
@@ -29,7 +29,7 @@
@@ -30,7 +30,7 @@
#include "base/posix/eintr_wrapper.h"
#endif // OS_POSIX
@ -9,7 +9,7 @@
#include <ucontext.h>
#endif
@@ -559,7 +559,7 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo
@@ -560,7 +560,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;

View File

@ -1,4 +1,4 @@
--- base/memory/discardable_memory.cc.orig 2020-11-13 06:36:34 UTC
--- base/memory/discardable_memory.cc.orig 2021-03-12 23:57:15 UTC
+++ base/memory/discardable_memory.cc
@@ -23,7 +23,7 @@ const base::Feature kMadvFreeDiscardableMemory{
"MadvFreeDiscardableMemory", base::FEATURE_DISABLED_BY_DEFAULT};

View File

@ -1,4 +1,4 @@
--- base/memory/discardable_memory_internal.h.orig 2020-11-13 06:36:34 UTC
--- base/memory/discardable_memory_internal.h.orig 2021-03-12 23:57:15 UTC
+++ base/memory/discardable_memory_internal.h
@@ -10,7 +10,7 @@
#include "base/metrics/field_trial_params.h"

View File

@ -1,4 +1,4 @@
--- base/memory/madv_free_discardable_memory_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/memory/madv_free_discardable_memory_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/memory/madv_free_discardable_memory_posix.cc
@@ -292,7 +292,7 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT

View File

@ -1,4 +1,4 @@
--- base/memory/platform_shared_memory_region.h.orig 2020-11-13 06:36:34 UTC
--- base/memory/platform_shared_memory_region.h.orig 2021-03-12 23:57:15 UTC
+++ base/memory/platform_shared_memory_region.h
@@ -27,7 +27,7 @@
#include "base/files/scoped_file.h"

View File

@ -1,6 +1,18 @@
--- base/memory/platform_shared_memory_region_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/memory/platform_shared_memory_region_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/memory/platform_shared_memory_region_posix.cc
@@ -70,7 +70,7 @@ FDPair ScopedFDPair::get() const {
@@ -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 {
return {fd.get(), readonly_fd.get()};
}
@ -9,7 +21,7 @@
// static
ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) {
PlatformSharedMemoryRegion region =
@@ -79,7 +79,7 @@ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion:
@@ -79,7 +83,7 @@ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion:
return region.PassPlatformHandle().fd;
return ScopedFD();
}
@ -18,7 +30,7 @@
// static
PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Take(
@@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o
@@ -204,7 +208,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o
// static
PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
size_t size
@ -27,12 +39,62 @@
,
bool executable
#endif
@@ -233,7 +233,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
// flag.
FilePath directory;
if (!GetShmemTempDir(
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
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)
}

View File

@ -1,4 +1,4 @@
--- base/memory/shared_memory_region_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/memory/shared_memory_region_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/memory/shared_memory_region_unittest.cc
@@ -188,10 +188,13 @@ TYPED_TEST(SharedMemoryRegionTest, MapAtNotAlignedOffs
std::tie(region, rw_mapping) = CreateMappedRegion<TypeParam>(kDataSize);

View File

@ -1,4 +1,4 @@
--- base/message_loop/message_pump_glib.cc.orig 2020-11-20 15:15:51 UTC
--- base/message_loop/message_pump_glib.cc.orig 2021-03-12 23:57:15 UTC
+++ base/message_loop/message_pump_glib.cc
@@ -8,6 +8,11 @@
#include <glib.h>

View File

@ -1,4 +1,4 @@
--- base/native_library_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/native_library_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/native_library_posix.cc
@@ -29,7 +29,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FileP
// http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892,

View File

@ -1,4 +1,4 @@
--- base/native_library_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/native_library_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/native_library_unittest.cc
@@ -118,7 +118,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
// Android dlopen() requires further investigation, as it might vary across

View File

@ -1,4 +1,4 @@
--- base/numerics/safe_math_shared_impl.h.orig 2020-11-13 06:36:34 UTC
--- base/numerics/safe_math_shared_impl.h.orig 2021-03-12 23:57:15 UTC
+++ base/numerics/safe_math_shared_impl.h
@@ -24,8 +24,7 @@
// Where available use builtin math overflow support on Clang and GCC.

View File

@ -1,4 +1,4 @@
--- base/path_service_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/path_service_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/path_service_unittest.cc
@@ -38,7 +38,7 @@ bool ReturnsValidPath(int dir_type) {
if (dir_type == DIR_CACHE)

View File

@ -1,4 +1,4 @@
--- base/posix/can_lower_nice_to.cc.orig 2020-11-13 06:36:34 UTC
--- base/posix/can_lower_nice_to.cc.orig 2021-03-12 23:57:15 UTC
+++ base/posix/can_lower_nice_to.cc
@@ -31,6 +31,9 @@ bool CanLowerNiceTo(int nice_value) {
if (geteuid() == 0)

View File

@ -1,4 +1,4 @@
--- base/posix/unix_domain_socket.cc.orig 2020-11-13 06:36:34 UTC
--- base/posix/unix_domain_socket.cc.orig 2021-03-12 23:57:15 UTC
+++ base/posix/unix_domain_socket.cc
@@ -5,7 +5,10 @@
#include "base/posix/unix_domain_socket.h"

View File

@ -1,4 +1,4 @@
--- base/posix/unix_domain_socket_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/posix/unix_domain_socket_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/posix/unix_domain_socket_unittest.cc
@@ -8,6 +8,9 @@
#include <stdint.h>

View File

@ -1,4 +1,4 @@
--- base/process/internal_linux.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/internal_linux.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/internal_linux.cc
@@ -30,7 +30,11 @@ namespace internal {

View File

@ -1,4 +1,4 @@
--- base/process/internal_linux.h.orig 2020-11-13 06:36:34 UTC
--- base/process/internal_linux.h.orig 2021-03-12 23:57:15 UTC
+++ base/process/internal_linux.h
@@ -18,6 +18,8 @@
#include "base/strings/string_number_conversions.h"

View File

@ -1,4 +1,4 @@
--- base/process/kill.h.orig 2020-11-13 06:36:34 UTC
--- base/process/kill.h.orig 2021-03-12 23:57:15 UTC
+++ base/process/kill.h
@@ -113,11 +113,11 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro
BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(

View File

@ -1,4 +1,4 @@
--- base/process/kill_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/kill_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/kill_posix.cc
@@ -160,7 +160,7 @@ void EnsureProcessTerminated(Process process) {
0, new BackgroundReaper(std::move(process), TimeDelta::FromSeconds(2)));

View File

@ -1,4 +1,4 @@
--- base/process/launch.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/launch.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/launch.cc
@@ -15,7 +15,7 @@ LaunchOptions::~LaunchOptions() = default;

View File

@ -1,6 +1,6 @@
--- base/process/launch.h.orig 2020-11-13 06:36:34 UTC
--- base/process/launch.h.orig 2021-03-12 23:57:15 UTC
+++ base/process/launch.h
@@ -180,7 +180,7 @@ struct BASE_EXPORT LaunchOptions {
@@ -182,7 +182,7 @@ struct BASE_EXPORT LaunchOptions {
bool clear_environment = false;
#endif // OS_WIN || OS_POSIX || OS_FUCHSIA
@ -9,7 +9,7 @@
// 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
@@ -193,7 +193,7 @@ struct BASE_EXPORT LaunchOptions {
@@ -195,7 +195,7 @@ struct BASE_EXPORT LaunchOptions {
// Sets parent process death signal to SIGKILL.
bool kill_on_parent_death = false;
@ -18,7 +18,7 @@
#if defined(OS_MAC)
// Mach ports that will be accessible to the child process. These are not
@@ -408,7 +408,7 @@ BASE_EXPORT void RaiseProcessToHighPriority();
@@ -410,7 +410,7 @@ BASE_EXPORT void RaiseProcessToHighPriority();
// binary. This should not be called in production/released code.
BASE_EXPORT LaunchOptions LaunchOptionsForTest();

View File

@ -1,6 +1,13 @@
--- base/process/launch_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/launch_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/launch_posix.cc
@@ -65,6 +65,7 @@
@@ -59,12 +59,14 @@
#if defined(OS_FREEBSD)
#include <sys/event.h>
#include <sys/ucontext.h>
+#include <sys/procctl.h>
#endif
#if defined(OS_APPLE)
#error "macOS should use launch_mac.cc"
#endif
@ -8,7 +15,7 @@
extern char** environ;
namespace base {
@@ -228,6 +229,28 @@ void CloseSuperfluousFds(const base::InjectiveMultimap
@@ -221,6 +223,28 @@ void CloseSuperfluousFds(const base::InjectiveMultimap
DirReaderPosix fd_dir(kFDDir);
if (!fd_dir.IsValid()) {
// Fallback case: Try every possible fd.
@ -37,3 +44,37 @@
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)
@@ -444,22 +468,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

View File

@ -1,4 +1,4 @@
--- base/process/memory.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/memory.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/memory.cc
@@ -55,7 +55,7 @@ NOINLINE void OnNoMemoryInternal(size_t size) {
} // namespace internal

View File

@ -1,4 +1,4 @@
--- base/process/memory.h.orig 2020-11-13 06:36:34 UTC
--- base/process/memory.h.orig 2021-03-12 23:57:15 UTC
+++ base/process/memory.h
@@ -24,7 +24,7 @@ BASE_EXPORT void EnableTerminationOnOutOfMemory();
// Crash reporting classifies such crashes as OOM.

View File

@ -1,4 +1,4 @@
--- base/process/memory_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/memory_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/memory_unittest.cc
@@ -38,6 +38,8 @@
#if defined(OS_LINUX) || defined(OS_CHROMEOS)

View File

@ -1,4 +1,4 @@
--- base/process/process_handle.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_handle.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_handle.cc
@@ -30,7 +30,7 @@ UniqueProcId GetUniqueIdForProcess() {
: UniqueProcId(GetCurrentProcId());

View File

@ -1,4 +1,4 @@
--- base/process/process_handle.h.orig 2020-11-13 06:36:34 UTC
--- base/process/process_handle.h.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_handle.h
@@ -103,7 +103,7 @@ BASE_EXPORT ProcessId GetCurrentProcId();
// processes may be reused.

View File

@ -1,4 +1,4 @@
--- base/process/process_handle_freebsd.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_handle_freebsd.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_handle_freebsd.cc
@@ -16,10 +16,13 @@ namespace base {

View File

@ -1,4 +1,4 @@
--- base/process/process_iterator_freebsd.cc.orig 2021-01-18 21:28:45 UTC
--- base/process/process_iterator_freebsd.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_iterator_freebsd.cc
@@ -10,6 +10,10 @@
#include <sys/sysctl.h>

View File

@ -1,4 +1,4 @@
--- base/process/process_linux.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_linux.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_linux.cc
@@ -24,7 +24,9 @@ namespace base {
@ -8,7 +8,7 @@
const int kForegroundPriority = 0;
+#endif
#if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS)
#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;
@ -17,7 +17,7 @@
-#else
+#elif !defined(OS_BSD)
const int kBackgroundPriority = 5;
#endif // defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS)
#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -96,13 +98,18 @@ Time Process::CreationTime() const {
if (!start_ticks)
@ -37,12 +37,12 @@
+#if !defined(OS_BSD)
// static
bool Process::CanBackgroundProcesses() {
#if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS)
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -154,6 +161,7 @@ bool Process::SetProcessBackgrounded(bool background)
DPCHECK(result == 0);
return result == 0;
}
+#endif // !defined(OS_BSD)
#if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS)
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
bool IsProcessBackgroundedCGroup(const StringPiece& cgroup_contents) {

View File

@ -1,6 +1,6 @@
--- base/process/process_metrics.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_metrics.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_metrics.cc
@@ -49,7 +49,7 @@ SystemMetrics SystemMetrics::Sample() {
@@ -50,7 +50,7 @@ SystemMetrics SystemMetrics::Sample() {
SystemMetrics system_metrics;
system_metrics.committed_memory_ = GetSystemCommitCharge();
@ -9,7 +9,7 @@
GetSystemMemoryInfo(&system_metrics.memory_info_);
GetVmStatInfo(&system_metrics.vmstat_info_);
GetSystemDiskInfo(&system_metrics.disk_info_);
@@ -68,7 +68,7 @@ std::unique_ptr<Value> SystemMetrics::ToValue() const
@@ -69,7 +69,7 @@ std::unique_ptr<Value> SystemMetrics::ToValue() const
std::unique_ptr<DictionaryValue> res(new DictionaryValue());
res->SetIntKey("committed_memory", static_cast<int>(committed_memory_));
@ -18,7 +18,7 @@
std::unique_ptr<DictionaryValue> meminfo = memory_info_.ToValue();
std::unique_ptr<DictionaryValue> vmstat = vmstat_info_.ToValue();
meminfo->MergeDictionary(vmstat.get());
@@ -119,7 +119,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage(
@@ -120,7 +120,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage(
}
#endif
@ -27,7 +27,7 @@
defined(OS_AIX)
int ProcessMetrics::CalculateIdleWakeupsPerSecond(
uint64_t absolute_idle_wakeups) {
@@ -132,7 +132,7 @@ int ProcessMetrics::GetIdleWakeupsPerSecond() {
@@ -133,7 +133,7 @@ int ProcessMetrics::GetIdleWakeupsPerSecond() {
NOTIMPLEMENTED(); // http://crbug.com/120488
return 0;
}

View File

@ -1,4 +1,4 @@
--- base/process/process_metrics.h.orig 2020-11-13 06:36:34 UTC
--- base/process/process_metrics.h.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_metrics.h
@@ -47,7 +47,7 @@ namespace base {
// Full declaration is in process_metrics_iocounters.h.
@ -128,7 +128,7 @@
+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) ||
// defined(OS_AIX) defined(OS_FUCHSIA)
#if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS)
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -406,11 +406,11 @@ struct BASE_EXPORT SystemMemoryInfoKB {
// Exposed for memory debugging widget.
BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo);
@ -151,7 +151,7 @@
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) ||
// defined(OS_AIX)
#if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS)
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -597,7 +597,7 @@ class BASE_EXPORT SystemMetrics {
FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);

View File

@ -1,4 +1,4 @@
--- base/process/process_metrics_freebsd.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_metrics_freebsd.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_metrics_freebsd.cc
@@ -3,8 +3,10 @@
// found in the LICENSE file.

View File

@ -1,4 +1,4 @@
--- base/process/process_metrics_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_metrics_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_metrics_posix.cc
@@ -20,6 +20,8 @@

View File

@ -1,6 +1,6 @@
--- base/process/process_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/process/process_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_unittest.cc
@@ -153,7 +153,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) {
@@ -138,7 +138,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 =

View File

@ -1,4 +1,4 @@
--- base/process/process_util_unittest.cc.orig 2021-01-18 21:28:45 UTC
--- base/process/process_util_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/process/process_util_unittest.cc
@@ -1308,11 +1308,11 @@ std::string TestLaunchProcess(const CommandLine& cmdli
options.fds_to_remap.emplace_back(fds[1], STDOUT_FILENO);

View File

@ -1,4 +1,4 @@
--- base/profiler/register_context.h.orig 2020-11-13 06:36:34 UTC
--- base/profiler/register_context.h.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/register_context.h
@@ -17,7 +17,7 @@
#include <windows.h>

View File

@ -1,4 +1,4 @@
--- base/profiler/sampling_profiler_thread_token.cc.orig 2020-11-13 06:36:34 UTC
--- base/profiler/sampling_profiler_thread_token.cc.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/sampling_profiler_thread_token.cc
@@ -7,7 +7,7 @@
namespace base {

View File

@ -1,4 +1,4 @@
--- base/profiler/sampling_profiler_thread_token.h.orig 2020-11-13 06:36:34 UTC
--- base/profiler/sampling_profiler_thread_token.h.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/sampling_profiler_thread_token.h
@@ -9,7 +9,7 @@
#include "base/threading/platform_thread.h"

View File

@ -1,4 +1,4 @@
--- base/profiler/stack_copier_signal.cc.orig 2020-11-13 06:36:34 UTC
--- base/profiler/stack_copier_signal.cc.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/stack_copier_signal.cc
@@ -4,7 +4,14 @@
@ -15,7 +15,7 @@
#include <signal.h>
#include <sys/ucontext.h>
#include <syscall.h>
@@ -34,8 +41,13 @@ class AsyncSafeWaitableEvent {
@@ -35,8 +42,13 @@ class AsyncSafeWaitableEvent {
// for a pthread mutex. So, also check the condition.
while (true) {
int res =
@ -29,7 +29,7 @@
if (futex_.load(std::memory_order_acquire) != 0)
return true;
if (res != 0)
@@ -45,8 +57,12 @@ class AsyncSafeWaitableEvent {
@@ -46,8 +58,12 @@ class AsyncSafeWaitableEvent {
void Signal() {
futex_.store(1, std::memory_order_release);
@ -42,7 +42,7 @@
}
private:
@@ -216,11 +232,18 @@ bool StackCopierSignal::CopyStack(StackBuffer* stack_b
@@ -221,11 +237,18 @@ bool StackCopierSignal::CopyStack(StackBuffer* stack_b
if (!scoped_sigaction.succeeded())
return false;

View File

@ -1,4 +1,4 @@
--- base/profiler/stack_sampling_profiler_test_util.cc.orig 2020-11-13 06:36:34 UTC
--- base/profiler/stack_sampling_profiler_test_util.cc.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/stack_sampling_profiler_test_util.cc
@@ -32,7 +32,7 @@
// Fortunately, it provides _alloca, which functions identically.

View File

@ -1,4 +1,4 @@
--- base/profiler/stack_sampling_profiler_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/profiler/stack_sampling_profiler_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/stack_sampling_profiler_unittest.cc
@@ -42,7 +42,7 @@
#include <intrin.h>

View File

@ -1,4 +1,4 @@
--- base/profiler/thread_delegate_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/profiler/thread_delegate_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/profiler/thread_delegate_posix.cc
@@ -12,6 +12,9 @@
#include "base/profiler/thread_delegate_posix.h"

View File

@ -1,4 +1,4 @@
--- base/sampling_heap_profiler/sampling_heap_profiler.cc.orig 2020-11-13 06:36:34 UTC
--- base/sampling_heap_profiler/sampling_heap_profiler.cc.orig 2021-03-12 23:57:15 UTC
+++ base/sampling_heap_profiler/sampling_heap_profiler.cc
@@ -30,6 +30,10 @@
#include <sys/prctl.h>

View File

@ -1,4 +1,4 @@
--- base/security_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/security_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/security_unittest.cc
@@ -61,7 +61,7 @@ NOINLINE Type HideValueFromCompiler(volatile Type valu
void OverflowTestsSoftExpectTrue(bool overflow_detected) {

View File

@ -1,4 +1,4 @@
--- base/strings/sys_string_conversions_unittest.cc.orig 2020-11-16 14:00:26 UTC
--- base/strings/sys_string_conversions_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/strings/sys_string_conversions_unittest.cc
@@ -76,7 +76,7 @@ TEST(SysStrings, SysUTF8ToWide) {
}

View File

@ -1,4 +1,4 @@
--- base/synchronization/lock_impl.h.orig 2020-11-13 06:36:34 UTC
--- base/synchronization/lock_impl.h.orig 2021-03-12 23:57:15 UTC
+++ base/synchronization/lock_impl.h
@@ -105,6 +105,8 @@ void LockImpl::Unlock() {
}

View File

@ -1,4 +1,4 @@
--- base/syslog_logging.cc.orig 2020-11-13 06:36:34 UTC
--- base/syslog_logging.cc.orig 2021-03-12 23:57:15 UTC
+++ base/syslog_logging.cc
@@ -13,7 +13,7 @@
#include "base/strings/string_util.h"

View File

@ -1,7 +1,7 @@
--- base/system/sys_info.cc.orig 2020-11-13 06:36:34 UTC
--- base/system/sys_info.cc.orig 2021-03-12 23:57:15 UTC
+++ base/system/sys_info.cc
@@ -104,7 +104,7 @@ void SysInfo::GetHardwareInfo(base::OnceCallback<void(
#elif defined(OS_ANDROID) || defined(OS_APPLE)
@@ -94,7 +94,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));
-#elif defined(OS_LINUX) || defined(OS_CHROMEOS)

View File

@ -1,6 +1,6 @@
--- base/system/sys_info.h.orig 2021-01-18 21:28:45 UTC
--- base/system/sys_info.h.orig 2021-03-12 23:57:15 UTC
+++ base/system/sys_info.h
@@ -208,6 +208,8 @@ class BASE_EXPORT SysInfo {
@@ -202,6 +202,8 @@ class BASE_EXPORT SysInfo {
// On Desktop this returns true when memory <= 512MB.
static bool IsLowEndDevice();
@ -9,7 +9,7 @@
private:
FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo);
@@ -217,7 +219,7 @@ class BASE_EXPORT SysInfo {
@@ -211,7 +213,7 @@ class BASE_EXPORT SysInfo {
static bool IsLowEndDeviceImpl();
static HardwareInfo GetHardwareInfoSync();

View File

@ -1,4 +1,4 @@
--- base/system/sys_info_freebsd.cc.orig 2020-11-13 06:36:34 UTC
--- base/system/sys_info_freebsd.cc.orig 2021-03-12 23:57:15 UTC
+++ base/system/sys_info_freebsd.cc
@@ -9,30 +9,95 @@
#include <sys/sysctl.h>

View File

@ -1,6 +1,18 @@
--- base/system/sys_info_posix.cc.orig 2020-11-13 06:36:34 UTC
--- base/system/sys_info_posix.cc.orig 2021-03-12 23:57:15 UTC
+++ base/system/sys_info_posix.cc
@@ -223,6 +223,8 @@ std::string SysInfo::OperatingSystemArchitecture() {
@@ -25,6 +25,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
@@ -224,6 +229,8 @@ std::string SysInfo::OperatingSystemArchitecture() {
arch = "x86";
} else if (arch == "amd64") {
arch = "x86_64";

View File

@ -1,6 +1,6 @@
--- base/system/sys_info_unittest.cc.orig 2021-01-18 21:28:45 UTC
--- base/system/sys_info_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/system/sys_info_unittest.cc
@@ -50,13 +50,13 @@ TEST_F(SysInfoTest, AmountOfMem) {
@@ -62,13 +62,13 @@ TEST_F(SysInfoTest, AmountOfMem) {
EXPECT_GE(SysInfo::AmountOfVirtualMemory(), 0);
}
@ -17,16 +17,16 @@
TEST_F(SysInfoTest, MAYBE_AmountOfAvailablePhysicalMemory) {
// Note: info is in _K_bytes.
SystemMemoryInfoKB info;
@@ -87,7 +87,7 @@ TEST_F(SysInfoTest, MAYBE_AmountOfAvailablePhysicalMem
@@ -99,7 +99,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_BSDD)
+#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.
@@ -137,7 +137,7 @@ TEST_F(SysInfoTest, NestedVolumesAmountOfTotalDiskSpac
@@ -149,7 +149,7 @@ TEST_F(SysInfoTest, NestedVolumesAmountOfTotalDiskSpac
}
#endif // defined(OS_FUCHSIA)
@ -35,7 +35,7 @@
defined(OS_CHROMEOS) || defined(OS_FUCHSIA)
TEST_F(SysInfoTest, OperatingSystemVersionNumbers) {
int32_t os_major_version = -1;
@@ -198,7 +198,7 @@ TEST_F(SysInfoTest, GetHardwareInfo) {
@@ -210,7 +210,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) || \

View File

@ -1,4 +1,4 @@
--- base/task/thread_pool/environment_config_unittest.cc.orig 2020-11-13 06:36:34 UTC
--- base/task/thread_pool/environment_config_unittest.cc.orig 2021-03-12 23:57:15 UTC
+++ base/task/thread_pool/environment_config_unittest.cc
@@ -14,7 +14,7 @@ namespace internal {
TEST(ThreadPoolEnvironmentConfig, CanUseBackgroundPriorityForWorker) {

View File

@ -1,6 +1,6 @@
--- base/test/BUILD.gn.orig 2021-01-18 21:28:45 UTC
--- base/test/BUILD.gn.orig 2021-03-12 23:57:15 UTC
+++ base/test/BUILD.gn
@@ -416,7 +416,11 @@ if (is_linux || is_chromeos) {
@@ -428,7 +428,11 @@ if (is_linux || is_chromeos) {
copy("fonts_conf") {
sources = [ "fonts.conf" ]

Some files were not shown because too many files have changed in this diff Show More