update to 124.0.6367.207
This commit is contained in:
parent
687f3acd55
commit
fe9bc9d89b
958 changed files with 7372 additions and 6231 deletions
|
@ -4,10 +4,13 @@ BROKEN-riscv64 = Unknown current CPU: riscv64
|
||||||
USE_WXNEEDED= Yes
|
USE_WXNEEDED= Yes
|
||||||
|
|
||||||
DPB_PROPERTIES= parallel parallel2
|
DPB_PROPERTIES= parallel parallel2
|
||||||
|
.if ${MACHINE_ARCH:Mi386}
|
||||||
|
DPB_PROPERTIES+= lonesome
|
||||||
|
.endif
|
||||||
|
|
||||||
COMMENT= Chromium browser sans integration with Google
|
COMMENT= Chromium browser sans integration with Google
|
||||||
|
|
||||||
V= 117.0.5938.149
|
V= 124.0.6367.207
|
||||||
UGV= ${V}-1
|
UGV= ${V}-1
|
||||||
|
|
||||||
DISTNAME= ungoogled-chromium-${V}
|
DISTNAME= ungoogled-chromium-${V}
|
||||||
|
@ -15,8 +18,7 @@ DISTNAME= ungoogled-chromium-${V}
|
||||||
DISTFILES+= ${CHROMIUM_DISTFILES} \
|
DISTFILES+= ${CHROMIUM_DISTFILES} \
|
||||||
${REGRESS_DISTFILES}
|
${REGRESS_DISTFILES}
|
||||||
|
|
||||||
DISTFILES.u= libudev-openbsd-20221108-c3330efd.tar.gz \
|
DISTFILES.u= ${UGOOGLE_DISTFILES} \
|
||||||
${UGOOGLE_DISTFILES} \
|
|
||||||
${REGRESS_DISTFILES.u}
|
${REGRESS_DISTFILES.u}
|
||||||
|
|
||||||
CHROMIUM_DISTFILES+= chromium-${V}${EXTRACT_SUFX}
|
CHROMIUM_DISTFILES+= chromium-${V}${EXTRACT_SUFX}
|
||||||
|
@ -46,29 +48,31 @@ PERMIT_PACKAGE = Yes
|
||||||
SITES= https://commondatastorage.googleapis.com/chromium-browser-official/
|
SITES= https://commondatastorage.googleapis.com/chromium-browser-official/
|
||||||
SITES.u=http://nerd.hu/distfiles/
|
SITES.u=http://nerd.hu/distfiles/
|
||||||
|
|
||||||
MODULES= lang/python x11/qt5
|
MODULES= lang/clang lang/python x11/qt5
|
||||||
MODQT5_DEPS= No
|
|
||||||
|
|
||||||
COMPILER = base-clang ports-clang ports-gcc
|
|
||||||
|
|
||||||
|
MODCLANG_VERSION= 17
|
||||||
|
MODQT5_DEPS= No
|
||||||
MODPY_RUNDEP= No
|
MODPY_RUNDEP= No
|
||||||
|
|
||||||
|
COMPILER= ports-clang
|
||||||
|
|
||||||
# uses pledge()
|
# uses pledge()
|
||||||
WANTLIB+= GL X11 Xau Xcomposite Xdamage Xdmcp Xext Xfixes Xft Xi Xrandr
|
WANTLIB+= GL X11 Xau Xcomposite Xdamage Xdmcp Xext Xfixes Xft Xi Xrandr
|
||||||
WANTLIB+= Xrender Xtst atk-1.0 atk-bridge-2.0 atspi c c++ c++abi cairo
|
WANTLIB+= Xrender Xtst aom atk-1.0 atk-bridge-2.0 atspi c cairo
|
||||||
WANTLIB+= cbor crypto cups dav1d dbus-1 drm event execinfo expat ffi fido2
|
WANTLIB+= cbor crypto cups dav1d dbus-1 drm event execinfo expat ffi fido2
|
||||||
WANTLIB+= fontconfig freetype fribidi gbm gio-2.0 glib-2.0 gmodule-2.0
|
WANTLIB+= fontconfig freetype fribidi gbm gio-2.0 glib-2.0 gmodule-2.0
|
||||||
WANTLIB+= gobject-2.0 graphite2 gthread-2.0 harfbuzz harfbuzz-gobject
|
WANTLIB+= gobject-2.0 graphite2 gthread-2.0 harfbuzz harfbuzz-gobject
|
||||||
WANTLIB+= harfbuzz-subset iconv icudata icui18n icuuc intl jpeg kvm m
|
WANTLIB+= harfbuzz-subset iconv icudata icui18n icuuc intl jpeg kvm m
|
||||||
WANTLIB+= nspr4 nss3 nssutil3 openh264 opus pango-1.0 pangocairo-1.0
|
WANTLIB+= nspr4 nss3 nssutil3 openh264 opus pango-1.0 pangocairo-1.0
|
||||||
WANTLIB+= pangoft2-1.0 pcre2-8 pixman-1 plc4 plds4 png pthread pthread smime3
|
WANTLIB+= pangoft2-1.0 pcre2-8 pixman-1 plc4 plds4 png pthread pthread smime3
|
||||||
WANTLIB+= snappy sndio usbhid util xcb xcb-render xcb-shm xkbcommon xml2
|
WANTLIB+= sndio usbhid util vpx xcb xcb-render xcb-shm xkbcommon xml2
|
||||||
WANTLIB+= xshmfence xslt z
|
WANTLIB+= xshmfence xslt z
|
||||||
|
|
||||||
RUN_DEPENDS= devel/xdg-utils \
|
RUN_DEPENDS= devel/xdg-utils \
|
||||||
devel/desktop-file-utils \
|
devel/desktop-file-utils \
|
||||||
fonts/noto/fonts \
|
fonts/noto/fonts \
|
||||||
graphics/libexif \
|
graphics/libexif \
|
||||||
|
sysutils/libudev-openbsd \
|
||||||
x11/gtk+3,-main \
|
x11/gtk+3,-main \
|
||||||
x11/gtk+4,-guic \
|
x11/gtk+4,-guic \
|
||||||
x11/gtk+3,-cups
|
x11/gtk+3,-cups
|
||||||
|
@ -77,6 +81,7 @@ BUILD_DEPENDS= archivers/bzip2 \
|
||||||
devel/gperf \
|
devel/gperf \
|
||||||
devel/bison \
|
devel/bison \
|
||||||
lang/node \
|
lang/node \
|
||||||
|
lang/rust \
|
||||||
shells/bash \
|
shells/bash \
|
||||||
sysutils/flock \
|
sysutils/flock \
|
||||||
sysutils/pciutils \
|
sysutils/pciutils \
|
||||||
|
@ -85,11 +90,12 @@ BUILD_DEPENDS= archivers/bzip2 \
|
||||||
x11/qt5/qtbase,-main \
|
x11/qt5/qtbase,-main \
|
||||||
${MODGCC4_CPPDEP} \
|
${MODGCC4_CPPDEP} \
|
||||||
${RUN_DEPENDS}
|
${RUN_DEPENDS}
|
||||||
LIB_DEPENDS= archivers/snappy \
|
LIB_DEPENDS= audio/opus \
|
||||||
audio/opus \
|
|
||||||
devel/pango \
|
devel/pango \
|
||||||
graphics/jpeg \
|
graphics/jpeg \
|
||||||
|
multimedia/aom \
|
||||||
multimedia/dav1d \
|
multimedia/dav1d \
|
||||||
|
multimedia/libvpx \
|
||||||
multimedia/openh264 \
|
multimedia/openh264 \
|
||||||
security/nss \
|
security/nss \
|
||||||
textproc/icu4c \
|
textproc/icu4c \
|
||||||
|
@ -99,8 +105,6 @@ LIB_DEPENDS= archivers/snappy \
|
||||||
print/cups,-libs \
|
print/cups,-libs \
|
||||||
${MODGCC4_CPPLIBDEP}
|
${MODGCC4_CPPLIBDEP}
|
||||||
|
|
||||||
BUILD_DEPENDS+= sysutils/libudev-openbsd:build
|
|
||||||
|
|
||||||
USE_GMAKE= Yes
|
USE_GMAKE= Yes
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
@ -140,22 +144,23 @@ BUILDDIR= ${WRKSRC}/out/${BUILDTYPE}
|
||||||
# removes them from the bundled third_party directory and replaces them
|
# removes them from the bundled third_party directory and replaces them
|
||||||
# with hooks to use them from the system.
|
# with hooks to use them from the system.
|
||||||
GN_SYSTEM_LIBS= dav1d \
|
GN_SYSTEM_LIBS= dav1d \
|
||||||
|
fontconfig \
|
||||||
icu \
|
icu \
|
||||||
|
libaom \
|
||||||
libevent \
|
libevent \
|
||||||
libjpeg \
|
libjpeg \
|
||||||
libpng \
|
libpng \
|
||||||
|
libvpx \
|
||||||
libxml \
|
libxml \
|
||||||
libxslt \
|
libxslt \
|
||||||
openh264 \
|
openh264 \
|
||||||
opus \
|
opus
|
||||||
snappy
|
|
||||||
|
|
||||||
GN_ARGS= is_official_build=true \
|
GN_ARGS= is_official_build=true \
|
||||||
is_debug=false \
|
is_debug=false \
|
||||||
is_cfi=false \
|
is_cfi=false \
|
||||||
optimize_webui=true \
|
optimize_webui=true \
|
||||||
enable_rust=false \
|
enable_log_error_not_reached=true \
|
||||||
use_bundled_fontconfig=false \
|
|
||||||
use_kerberos=false \
|
use_kerberos=false \
|
||||||
use_sndio=true \
|
use_sndio=true \
|
||||||
use_cups=true \
|
use_cups=true \
|
||||||
|
@ -172,8 +177,17 @@ GN_ARGS= is_official_build=true \
|
||||||
enable_backup_ref_ptr_support=false \
|
enable_backup_ref_ptr_support=false \
|
||||||
extra_cppflags=\"-idirafter ${LOCALBASE}/include -idirafter ${X11BASE}/include\" \
|
extra_cppflags=\"-idirafter ${LOCALBASE}/include -idirafter ${X11BASE}/include\" \
|
||||||
fatal_linker_warnings=false \
|
fatal_linker_warnings=false \
|
||||||
use_custom_libcxx=false \
|
use_custom_libcxx=true \
|
||||||
use_udev=true
|
use_custom_libunwind=true \
|
||||||
|
use_udev=true \
|
||||||
|
v8_enable_cet_ibt=true
|
||||||
|
|
||||||
|
# rust
|
||||||
|
RUSTC_VERSION!!=rustc -V
|
||||||
|
MAKE_ENV+= RUSTC_BOOTSTRAP=1
|
||||||
|
GN_ARGS+= enable_rust=true \
|
||||||
|
rust_sysroot_absolute=\"${LOCALBASE}\" \
|
||||||
|
rustc_version=\"${RUSTC_VERSION}\"
|
||||||
|
|
||||||
# notyet
|
# notyet
|
||||||
GN_ARGS+= use_vaapi=false
|
GN_ARGS+= use_vaapi=false
|
||||||
|
@ -262,6 +276,7 @@ pre-patch:
|
||||||
pre-configure:
|
pre-configure:
|
||||||
@ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python
|
@ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python
|
||||||
@ln -sf ${MODQT5_MOC} ${WRKDIR}/bin/moc
|
@ln -sf ${MODQT5_MOC} ${WRKDIR}/bin/moc
|
||||||
|
@ln -sf ${LOCALBASE}/bin/llvm-ar-${MODCLANG_VERSION} ${WRKDIR}/bin/ar
|
||||||
cd ${WRKSRC}/third_party/ffmpeg && \
|
cd ${WRKSRC}/third_party/ffmpeg && \
|
||||||
${MODPY_BIN} chromium/scripts/build_ffmpeg.py openbsd ${FFMPEG_TARGET} --config-only --branding=${FFMPEG_BRAND}
|
${MODPY_BIN} chromium/scripts/build_ffmpeg.py openbsd ${FFMPEG_TARGET} --config-only --branding=${FFMPEG_BRAND}
|
||||||
cd ${FFMPEG_BDIR} && ${GMAKE} ffversion.h
|
cd ${FFMPEG_BDIR} && ${GMAKE} ffversion.h
|
||||||
|
@ -326,6 +341,7 @@ do-install:
|
||||||
.if ${MACHINE_ARCH} != "aarch64"
|
.if ${MACHINE_ARCH} != "aarch64"
|
||||||
# SwiftShader
|
# SwiftShader
|
||||||
${INSTALL_DATA} ${BUILDDIR}/libvk_swiftshader.so ${PREFIX}/${DIST_TARGET_DIR}
|
${INSTALL_DATA} ${BUILDDIR}/libvk_swiftshader.so ${PREFIX}/${DIST_TARGET_DIR}
|
||||||
|
${INSTALL_DATA} ${BUILDDIR}/vk_swiftshader_icd.json ${PREFIX}/${DIST_TARGET_DIR}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${FLAVOR:Mcomponent}
|
.if ${FLAVOR:Mcomponent}
|
||||||
|
@ -346,8 +362,6 @@ do-install:
|
||||||
unveil.gpu unveil.main unveil.utility_audio unveil.utility_network unveil.utility_video
|
unveil.gpu unveil.main unveil.utility_audio unveil.utility_network unveil.utility_video
|
||||||
${INSTALL_DATA} ${FILESDIR}/${f} ${PREFIX}/share/examples/ungoogled-chromium
|
${INSTALL_DATA} ${FILESDIR}/${f} ${PREFIX}/share/examples/ungoogled-chromium
|
||||||
.endfor
|
.endfor
|
||||||
${INSTALL_DATA} ${WRKDIR}/sysutils/libudev-openbsd/build-${MACHINE_ARCH}/libudev.so.0.0 \
|
|
||||||
${PREFIX}/${DIST_TARGET_DIR}/libudev.so.0
|
|
||||||
|
|
||||||
pre-test:
|
pre-test:
|
||||||
.for _d in ${REGRESS_DISTFILES:C/:[0-9]$//}
|
.for _d in ${REGRESS_DISTFILES:C/:[0-9]$//}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
SHA256 (chromium-117.0.5938.149-testdata.tar.xz) = OFrq6X5mpm7wrasDl1OKmdmsWcO7THFfY64UMc+4kkg=
|
SHA256 (chromium-124.0.6367.207-testdata.tar.xz) = 0wOGpzcZpk/dGR97UXCRheTT/EmIiwSjkFBtQ3DmmwY=
|
||||||
SHA256 (chromium-117.0.5938.149.tar.xz) = 3dfIUr0ZHAkXq4AGVdo0HnWDwjd8oiCuB3/F3n/H2d8=
|
SHA256 (chromium-124.0.6367.207.tar.xz) = bW3IuUMBJXOiRN2wE7KB7LyX93/h/G9VpBGCQdEH66U=
|
||||||
SHA256 (libudev-openbsd-20221108-c3330efd.tar.gz) = BBKUTWeCkarFwKZQ+eg9DfekIMr5xi2G4Lce0C43pnc=
|
|
||||||
SHA256 (test_fonts-336e775eec536b2d785cc80eff6ac39051931286.tar.gz) = osopYtr0gqj5QxY1QeHHO6SyaU+rzSUQmB8ttO2kk8g=
|
SHA256 (test_fonts-336e775eec536b2d785cc80eff6ac39051931286.tar.gz) = osopYtr0gqj5QxY1QeHHO6SyaU+rzSUQmB8ttO2kk8g=
|
||||||
SHA256 (ungoogled-chromium-117.0.5938.149-1.tar.gz) = CvzB/vbhjGEueiXGXwi5jQ2z5iHID/hVy/1aeRtq0Do=
|
SHA256 (ungoogled-chromium-124.0.6367.207-1.tar.gz) = 4QljFlGv/ari3cIswegfVtjH61g/gWxu594h2Xl3MVs=
|
||||||
SIZE (chromium-117.0.5938.149-testdata.tar.xz) = 264315044
|
SIZE (chromium-124.0.6367.207-testdata.tar.xz) = 277899644
|
||||||
SIZE (chromium-117.0.5938.149.tar.xz) = 3141300340
|
SIZE (chromium-124.0.6367.207.tar.xz) = 3450794132
|
||||||
SIZE (libudev-openbsd-20221108-c3330efd.tar.gz) = 32757
|
|
||||||
SIZE (test_fonts-336e775eec536b2d785cc80eff6ac39051931286.tar.gz) = 32624734
|
SIZE (test_fonts-336e775eec536b2d785cc80eff6ac39051931286.tar.gz) = 32624734
|
||||||
SIZE (ungoogled-chromium-117.0.5938.149-1.tar.gz) = 651923
|
SIZE (ungoogled-chromium-124.0.6367.207-1.tar.gz) = 667461
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: BUILD.gn
|
Index: BUILD.gn
|
||||||
--- BUILD.gn.orig
|
--- BUILD.gn.orig
|
||||||
+++ BUILD.gn
|
+++ BUILD.gn
|
||||||
@@ -61,7 +61,7 @@ declare_args() {
|
@@ -64,7 +64,7 @@ declare_args() {
|
||||||
root_extra_deps = []
|
root_extra_deps = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: BUILD.gn
|
||||||
# An official (maximally optimized!) component (optimized for build times)
|
# An official (maximally optimized!) component (optimized for build times)
|
||||||
# build doesn't make sense and usually doesn't work.
|
# build doesn't make sense and usually doesn't work.
|
||||||
assert(!is_component_build)
|
assert(!is_component_build)
|
||||||
@@ -95,7 +95,6 @@ group("gn_all") {
|
@@ -96,7 +96,6 @@ group("gn_all") {
|
||||||
"//codelabs",
|
"//codelabs",
|
||||||
"//components:components_unittests",
|
"//components:components_unittests",
|
||||||
"//components/gwp_asan:gwp_asan_unittests",
|
"//components/gwp_asan:gwp_asan_unittests",
|
||||||
|
@ -18,7 +18,7 @@ Index: BUILD.gn
|
||||||
"//net:net_unittests",
|
"//net:net_unittests",
|
||||||
"//sandbox:sandbox_unittests",
|
"//sandbox:sandbox_unittests",
|
||||||
"//services:services_unittests",
|
"//services:services_unittests",
|
||||||
@@ -422,7 +421,7 @@ group("gn_all") {
|
@@ -427,7 +426,7 @@ group("gn_all") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ Index: BUILD.gn
|
||||||
deps += [
|
deps += [
|
||||||
"//third_party/breakpad:breakpad_unittests",
|
"//third_party/breakpad:breakpad_unittests",
|
||||||
"//third_party/breakpad:core-2-minidump",
|
"//third_party/breakpad:core-2-minidump",
|
||||||
@@ -614,6 +613,15 @@ group("gn_all") {
|
@@ -619,6 +618,15 @@ group("gn_all") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Index: BUILD.gn
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
deps += [
|
deps += [
|
||||||
"//third_party/breakpad:dump_syms",
|
"//third_party/breakpad:dump_syms",
|
||||||
@@ -663,7 +671,7 @@ group("gn_all") {
|
@@ -665,7 +673,7 @@ group("gn_all") {
|
||||||
host_os == "win") {
|
host_os == "win") {
|
||||||
deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
|
deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
|
||||||
}
|
}
|
||||||
|
@ -52,16 +52,16 @@ Index: BUILD.gn
|
||||||
deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
|
deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1087,7 +1095,7 @@ if (!is_ios && !is_cronet_build) {
|
@@ -1086,7 +1094,7 @@ if (use_blink && !is_cronet_build) {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) {
|
- if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) {
|
||||||
+ if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos && !is_bsd) {
|
+ if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos && !is_bsd) {
|
||||||
script_test("webdriver_wpt_tests") {
|
script_test("chrome_wpt_tests") {
|
||||||
script = "//third_party/blink/tools/run_wpt_tests.py"
|
script = "//third_party/blink/tools/run_wpt_tests.py"
|
||||||
args = [
|
args = [
|
||||||
@@ -1177,7 +1185,7 @@ if (!is_ios && !is_cronet_build) {
|
@@ -1177,7 +1185,7 @@ if (use_blink && !is_cronet_build) {
|
||||||
data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
|
data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ Index: BUILD.gn
|
||||||
data_deps +=
|
data_deps +=
|
||||||
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
|
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||||
}
|
}
|
||||||
@@ -1186,7 +1194,7 @@ if (!is_ios && !is_cronet_build) {
|
@@ -1186,7 +1194,7 @@ if (use_blink && !is_cronet_build) {
|
||||||
data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
|
data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: apps/ui/views/app_window_frame_view.cc
|
Index: apps/ui/views/app_window_frame_view.cc
|
||||||
--- apps/ui/views/app_window_frame_view.cc.orig
|
--- apps/ui/views/app_window_frame_view.cc.orig
|
||||||
+++ apps/ui/views/app_window_frame_view.cc
|
+++ apps/ui/views/app_window_frame_view.cc
|
||||||
@@ -137,7 +137,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient
|
@@ -148,7 +148,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient
|
||||||
gfx::Rect window_bounds = client_bounds;
|
gfx::Rect window_bounds = client_bounds;
|
||||||
// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
|
// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
|
||||||
// complete.
|
// complete.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/BUILD.gn
|
Index: base/BUILD.gn
|
||||||
--- base/BUILD.gn.orig
|
--- base/BUILD.gn.orig
|
||||||
+++ base/BUILD.gn
|
+++ base/BUILD.gn
|
||||||
@@ -198,7 +198,7 @@ buildflag_header("ios_cronet_buildflags") {
|
@@ -200,7 +200,7 @@ buildflag_header("ios_cronet_buildflags") {
|
||||||
flags = [ "CRONET_BUILD=$is_cronet_build" ]
|
flags = [ "CRONET_BUILD=$is_cronet_build" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: base/BUILD.gn
|
||||||
buildflag_header("message_pump_buildflags") {
|
buildflag_header("message_pump_buildflags") {
|
||||||
header = "message_pump_buildflags.h"
|
header = "message_pump_buildflags.h"
|
||||||
header_dir = "base/message_loop"
|
header_dir = "base/message_loop"
|
||||||
@@ -1112,11 +1112,23 @@ component("base") {
|
@@ -1131,11 +1131,23 @@ component("base") {
|
||||||
# Needed for <atomic> if using newer C++ library than sysroot, except if
|
# Needed for <atomic> if using newer C++ library than sysroot, except if
|
||||||
# building inside the cros_sdk environment - use host_toolchain as a
|
# building inside the cros_sdk environment - use host_toolchain as a
|
||||||
# more robust check for this.
|
# more robust check for this.
|
||||||
|
@ -34,8 +34,8 @@ Index: base/BUILD.gn
|
||||||
+
|
+
|
||||||
if (use_allocator_shim) {
|
if (use_allocator_shim) {
|
||||||
if (is_apple) {
|
if (is_apple) {
|
||||||
sources += [ "allocator/early_zone_registration_mac.h" ]
|
sources += [ "allocator/early_zone_registration_apple.h" ]
|
||||||
@@ -1133,7 +1145,7 @@ component("base") {
|
@@ -1155,7 +1167,7 @@ component("base") {
|
||||||
|
|
||||||
# Allow more direct string conversions on platforms with native utf8
|
# Allow more direct string conversions on platforms with native utf8
|
||||||
# strings
|
# strings
|
||||||
|
@ -44,7 +44,7 @@ Index: base/BUILD.gn
|
||||||
defines += [ "SYSTEM_NATIVE_UTF8" ]
|
defines += [ "SYSTEM_NATIVE_UTF8" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2075,6 +2087,22 @@ component("base") {
|
@@ -2113,6 +2125,22 @@ component("base") {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ Index: base/BUILD.gn
|
||||||
# iOS
|
# iOS
|
||||||
if (is_ios) {
|
if (is_ios) {
|
||||||
sources += [
|
sources += [
|
||||||
@@ -2207,6 +2235,29 @@ component("base") {
|
@@ -2249,6 +2277,33 @@ component("base") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,8 @@ Index: base/BUILD.gn
|
||||||
+ sources -= [
|
+ sources -= [
|
||||||
+ "files/file_path_watcher_inotify.cc",
|
+ "files/file_path_watcher_inotify.cc",
|
||||||
+ "files/scoped_file_linux.cc",
|
+ "files/scoped_file_linux.cc",
|
||||||
|
+ "process/set_process_title_linux.cc",
|
||||||
|
+ "process/set_process_title_linux.h",
|
||||||
+ "system/sys_info_linux.cc",
|
+ "system/sys_info_linux.cc",
|
||||||
+ "process/process_iterator_linux.cc",
|
+ "process/process_iterator_linux.cc",
|
||||||
+ "process/process_linux.cc",
|
+ "process/process_linux.cc",
|
||||||
|
@ -85,6 +87,8 @@ Index: base/BUILD.gn
|
||||||
+ "profiler/thread_delegate_posix.cc",
|
+ "profiler/thread_delegate_posix.cc",
|
||||||
+ "profiler/thread_delegate_posix.h",
|
+ "profiler/thread_delegate_posix.h",
|
||||||
+ "threading/platform_thread_linux.cc",
|
+ "threading/platform_thread_linux.cc",
|
||||||
|
+ "stack_canary_linux.cc",
|
||||||
|
+ "stack_canary_linux.h",
|
||||||
+ ]
|
+ ]
|
||||||
+ sources += [
|
+ sources += [
|
||||||
+ "files/file_path_watcher_kqueue.cc",
|
+ "files/file_path_watcher_kqueue.cc",
|
||||||
|
@ -97,7 +101,7 @@ Index: base/BUILD.gn
|
||||||
if (use_blink) {
|
if (use_blink) {
|
||||||
sources += [
|
sources += [
|
||||||
"files/file_path_watcher.cc",
|
"files/file_path_watcher.cc",
|
||||||
@@ -2217,7 +2268,7 @@ component("base") {
|
@@ -2259,7 +2314,7 @@ component("base") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dep_libevent) {
|
if (dep_libevent) {
|
||||||
|
@ -106,16 +110,25 @@ Index: base/BUILD.gn
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_libevent) {
|
if (use_libevent) {
|
||||||
@@ -3587,7 +3638,7 @@ test("base_unittests") {
|
@@ -3072,7 +3127,7 @@ if (is_apple) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-if (!is_nacl && (is_linux || is_chromeos)) {
|
||||||
|
+if (!is_nacl && !is_bsd && (is_linux || is_chromeos)) {
|
||||||
|
# This test must compile with -fstack-protector-all
|
||||||
|
source_set("stack_canary_linux_unittests") {
|
||||||
|
testonly = true
|
||||||
|
@@ -3716,7 +3771,7 @@ test("base_unittests") {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (is_linux || is_chromeos) {
|
- if (is_linux || is_chromeos) {
|
||||||
+ if ((is_linux || is_chromeos) && !is_bsd) {
|
+ if (!is_bsd && (is_linux || is_chromeos)) {
|
||||||
sources += [
|
sources += [
|
||||||
"debug/proc_maps_linux_unittest.cc",
|
"debug/proc_maps_linux_unittest.cc",
|
||||||
"files/scoped_file_linux_unittest.cc",
|
"files/scoped_file_linux_unittest.cc",
|
||||||
@@ -3608,7 +3659,7 @@ test("base_unittests") {
|
@@ -3743,7 +3798,7 @@ test("base_unittests") {
|
||||||
"posix/file_descriptor_shuffle_unittest.cc",
|
"posix/file_descriptor_shuffle_unittest.cc",
|
||||||
"posix/unix_domain_socket_unittest.cc",
|
"posix/unix_domain_socket_unittest.cc",
|
||||||
]
|
]
|
||||||
|
@ -124,7 +137,7 @@ Index: base/BUILD.gn
|
||||||
sources += [
|
sources += [
|
||||||
"profiler/stack_base_address_posix_unittest.cc",
|
"profiler/stack_base_address_posix_unittest.cc",
|
||||||
"profiler/stack_copier_signal_unittest.cc",
|
"profiler/stack_copier_signal_unittest.cc",
|
||||||
@@ -3619,7 +3670,7 @@ test("base_unittests") {
|
@@ -3754,7 +3809,7 @@ test("base_unittests") {
|
||||||
|
|
||||||
# Allow more direct string conversions on platforms with native utf8
|
# Allow more direct string conversions on platforms with native utf8
|
||||||
# strings
|
# strings
|
||||||
|
@ -133,7 +146,7 @@ Index: base/BUILD.gn
|
||||||
defines += [ "SYSTEM_NATIVE_UTF8" ]
|
defines += [ "SYSTEM_NATIVE_UTF8" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3871,7 +3922,7 @@ test("base_unittests") {
|
@@ -4022,7 +4077,7 @@ test("base_unittests") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
Index: base/allocator/dispatcher/tls.h
|
Index: base/allocator/dispatcher/tls.h
|
||||||
--- base/allocator/dispatcher/tls.h.orig
|
--- base/allocator/dispatcher/tls.h.orig
|
||||||
+++ base/allocator/dispatcher/tls.h
|
+++ base/allocator/dispatcher/tls.h
|
||||||
@@ -50,7 +50,7 @@ struct BASE_EXPORT MMapAllocator {
|
@@ -76,7 +76,7 @@ struct BASE_EXPORT MMapAllocator {
|
||||||
partition_alloc::PartitionPageSize();
|
constexpr static size_t AllocationChunkSize = 16384;
|
||||||
#elif BUILDFLAG(IS_APPLE)
|
#elif BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS)
|
||||||
constexpr static size_t AllocationChunkSize = 16384;
|
constexpr static size_t AllocationChunkSize = 16384;
|
||||||
-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
||||||
+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/BUILD.gn
|
|
||||||
--- base/allocator/partition_allocator/BUILD.gn.orig
|
|
||||||
+++ base/allocator/partition_allocator/BUILD.gn
|
|
||||||
@@ -541,7 +541,7 @@ source_set("allocator_shim") {
|
|
||||||
]
|
|
||||||
configs += [ ":mac_no_default_new_delete_symbols" ]
|
|
||||||
}
|
|
||||||
- if (is_chromeos || is_linux) {
|
|
||||||
+ if ((is_chromeos || is_linux) && !is_bsd) {
|
|
||||||
sources += [
|
|
||||||
"shim/allocator_shim_override_cpp_symbols.h",
|
|
||||||
"shim/allocator_shim_override_glibc_weak_symbols.h",
|
|
|
@ -1,39 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/page_allocator_constants.h
|
|
||||||
--- base/allocator/partition_allocator/page_allocator_constants.h.orig
|
|
||||||
+++ base/allocator/partition_allocator/page_allocator_constants.h
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
// elimination.
|
|
||||||
#define PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR __attribute__((const))
|
|
||||||
|
|
||||||
-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
|
||||||
+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
|
||||||
// This should work for all POSIX (if needed), but currently all other
|
|
||||||
// supported OS/architecture combinations use either hard-coded values
|
|
||||||
// (such as x86) or have means to determine these values without needing
|
|
||||||
@@ -92,7 +92,7 @@ PageAllocationGranularityShift() {
|
|
||||||
return 14; // 16kB
|
|
||||||
#elif BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS)
|
|
||||||
return static_cast<size_t>(vm_page_shift);
|
|
||||||
-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
|
||||||
+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
|
||||||
// arm64 supports 4kb (shift = 12), 16kb (shift = 14), and 64kb (shift = 16)
|
|
||||||
// page sizes. Retrieve from or initialize cache.
|
|
||||||
size_t shift = page_characteristics.shift.load(std::memory_order_relaxed);
|
|
||||||
@@ -113,7 +113,7 @@ PageAllocationGranularity() {
|
|
||||||
// This is literally equivalent to |1 << PageAllocationGranularityShift()|
|
|
||||||
// below, but was separated out for IS_APPLE to avoid << on a non-constexpr.
|
|
||||||
return vm_page_size;
|
|
||||||
-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
|
||||||
+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
|
||||||
// arm64 supports 4kb, 16kb, and 64kb page sizes. Retrieve from or
|
|
||||||
// initialize cache.
|
|
||||||
size_t size = page_characteristics.size.load(std::memory_order_relaxed);
|
|
||||||
@@ -152,7 +152,7 @@ SystemPageShift() {
|
|
||||||
PA_ALWAYS_INLINE PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR size_t
|
|
||||||
SystemPageSize() {
|
|
||||||
#if (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS)) || \
|
|
||||||
- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64))
|
|
||||||
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64))
|
|
||||||
// This is literally equivalent to |1 << SystemPageShift()| below, but was
|
|
||||||
// separated out for 64-bit IS_APPLE and arm64 on Linux to avoid << on a
|
|
||||||
// non-constexpr.
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/page_allocator.h
|
|
||||||
--- base/allocator/partition_allocator/page_allocator.h.orig
|
|
||||||
+++ base/allocator/partition_allocator/page_allocator.h
|
|
||||||
@@ -258,7 +258,7 @@ void DecommitAndZeroSystemPages(void* address,
|
|
||||||
// recommitted. Do not assume that this will not change over time.
|
|
||||||
constexpr PA_COMPONENT_EXPORT(
|
|
||||||
PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() {
|
|
||||||
-#if BUILDFLAG(IS_APPLE)
|
|
||||||
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
return true;
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_address_space.cc
|
|
||||||
--- base/allocator/partition_allocator/partition_address_space.cc.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_address_space.cc
|
|
||||||
@@ -420,7 +420,7 @@ void PartitionAddressSpace::UninitThreadIsolatedPoolFo
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
|
||||||
+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
|
||||||
|
|
||||||
PageCharacteristics page_characteristics;
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h
|
|
||||||
--- base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h
|
|
||||||
@@ -24,9 +24,9 @@
|
|
||||||
// Annotate a function indicating it should not be inlined.
|
|
||||||
// Use like:
|
|
||||||
// NOINLINE void DoStuff() { ... }
|
|
||||||
-#if defined(__clang__) && PA_HAS_ATTRIBUTE(noinline)
|
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 15) && PA_HAS_ATTRIBUTE(noinline)
|
|
||||||
#define PA_NOINLINE [[clang::noinline]]
|
|
||||||
-#elif defined(COMPILER_GCC) && PA_HAS_ATTRIBUTE(noinline)
|
|
||||||
+#elif (defined(COMPILER_GCC) || defined(__clang__)) && PA_HAS_ATTRIBUTE(noinline)
|
|
||||||
#define PA_NOINLINE __attribute__((noinline))
|
|
||||||
#elif defined(COMPILER_MSVC)
|
|
||||||
#define PA_NOINLINE __declspec(noinline)
|
|
||||||
@@ -34,7 +34,7 @@
|
|
||||||
#define PA_NOINLINE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if defined(__clang__) && defined(NDEBUG) && PA_HAS_ATTRIBUTE(always_inline)
|
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 15) && defined(NDEBUG) && PA_HAS_ATTRIBUTE(always_inline)
|
|
||||||
#define PA_ALWAYS_INLINE [[clang::always_inline]] inline
|
|
||||||
#elif defined(COMPILER_GCC) && defined(NDEBUG) && \
|
|
||||||
PA_HAS_ATTRIBUTE(always_inline)
|
|
||||||
@@ -53,7 +53,7 @@
|
|
||||||
// prevent code folding, see NO_CODE_FOLDING() in base/debug/alias.h.
|
|
||||||
// Use like:
|
|
||||||
// void NOT_TAIL_CALLED FooBar();
|
|
||||||
-#if defined(__clang__) && PA_HAS_ATTRIBUTE(not_tail_called)
|
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 15) && PA_HAS_ATTRIBUTE(not_tail_called)
|
|
||||||
#define PA_NOT_TAIL_CALLED [[clang::not_tail_called]]
|
|
||||||
#else
|
|
||||||
#define PA_NOT_TAIL_CALLED
|
|
|
@ -1,14 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc
|
|
||||||
--- base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc
|
|
||||||
@@ -90,6 +90,10 @@ void RandBytes(void* output, size_t output_length) {
|
|
||||||
if (getentropy(output, output_length) == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
+#elif BUILDFLAG(IS_BSD)
|
|
||||||
+ if (getentropy(output, output_length) == 0) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
#endif
|
|
||||||
// If getrandom(2) above returned with an error and the /dev/urandom fallback
|
|
||||||
// took place on Linux/ChromeOS bots, they would fail with a CHECK in
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc
|
|
||||||
--- base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc
|
|
||||||
@@ -17,7 +17,7 @@
|
|
||||||
#include "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h"
|
|
||||||
#include "build/build_config.h"
|
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include <atomic>
|
|
||||||
#endif
|
|
|
@ -1,30 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_config.h
|
|
||||||
--- base/allocator/partition_allocator/partition_alloc_config.h.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_config.h
|
|
||||||
@@ -94,7 +94,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).
|
|
||||||
#define PA_CONFIG_HAS_LINUX_KERNEL() \
|
|
||||||
- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID))
|
|
||||||
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD))
|
|
||||||
|
|
||||||
// On some platforms, we implement locking by spinning in userspace, then going
|
|
||||||
// into the kernel only if there is contention. This requires platform support,
|
|
||||||
@@ -236,7 +236,7 @@ constexpr bool kUseLazyCommit = false;
|
|
||||||
// On these platforms, lock all the partitions before fork(), and unlock after.
|
|
||||||
// This may be required on more platforms in the future.
|
|
||||||
#define PA_CONFIG_HAS_ATFORK_HANDLER() \
|
|
||||||
- (BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
|
|
||||||
+ (BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
|
|
||||||
|
|
||||||
// PartitionAlloc uses PartitionRootEnumerator to acquire all
|
|
||||||
// PartitionRoots at BeforeFork and to release at AfterFork.
|
|
||||||
@@ -283,7 +283,7 @@ constexpr bool kUseLazyCommit = false;
|
|
||||||
// Also enabled on ARM64 macOS, as the 16kiB pages on this platform lead to
|
|
||||||
// larger slot spans.
|
|
||||||
#define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() \
|
|
||||||
- (BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)))
|
|
||||||
+ (BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_BSD))
|
|
||||||
|
|
||||||
// Enable shadow metadata.
|
|
||||||
//
|
|
|
@ -1,22 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_constants.h
|
|
||||||
--- base/allocator/partition_allocator/partition_alloc_constants.h.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_constants.h
|
|
||||||
@@ -95,7 +95,7 @@ PartitionPageShift() {
|
|
||||||
return 18; // 256 KiB
|
|
||||||
}
|
|
||||||
#elif (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS)) || \
|
|
||||||
- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64))
|
|
||||||
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64))
|
|
||||||
PA_ALWAYS_INLINE PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR size_t
|
|
||||||
PartitionPageShift() {
|
|
||||||
return PageAllocationGranularityShift() + 2;
|
|
||||||
@@ -297,7 +297,8 @@ constexpr size_t kNumPools = kMaxPoolHandle - 1;
|
|
||||||
// 8GB for each of the glued pools).
|
|
||||||
#if BUILDFLAG(HAS_64_BIT_POINTERS)
|
|
||||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || \
|
|
||||||
- BUILDFLAG(ENABLE_POINTER_COMPRESSION)
|
|
||||||
+ BUILDFLAG(ENABLE_POINTER_COMPRESSION) || \
|
|
||||||
+ BUILDFLAG(IS_BSD)
|
|
||||||
constexpr size_t kPoolMaxSize = 8 * kGiB;
|
|
||||||
#else
|
|
||||||
constexpr size_t kPoolMaxSize = 16 * kGiB;
|
|
|
@ -1,12 +1,21 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc.gni
|
Index: base/allocator/partition_allocator/partition_alloc.gni
|
||||||
--- base/allocator/partition_allocator/partition_alloc.gni.orig
|
--- base/allocator/partition_allocator/partition_alloc.gni.orig
|
||||||
+++ base/allocator/partition_allocator/partition_alloc.gni
|
+++ base/allocator/partition_allocator/partition_alloc.gni
|
||||||
@@ -332,7 +332,7 @@ declare_args() {
|
@@ -33,7 +33,7 @@ if (is_nacl) {
|
||||||
# pkeys support is explicitly disabled in all Cronet builds, as some test
|
use_large_empty_slot_span_ring = is_mac
|
||||||
|
|
||||||
|
has_memory_tagging =
|
||||||
|
- current_cpu == "arm64" && is_clang && !is_asan && (is_linux || is_android)
|
||||||
|
+ current_cpu == "arm64" && is_clang && !is_asan && !is_bsd && (is_linux || is_android)
|
||||||
|
|
||||||
|
declare_args() {
|
||||||
|
# Causes all the allocations to be routed via allocator_shim.cc. Usually,
|
||||||
|
@@ -351,7 +351,7 @@ declare_args() {
|
||||||
# dependencies that use partition_allocator are compiled in AOSP against a
|
# dependencies that use partition_allocator are compiled in AOSP against a
|
||||||
# version of glibc that does not include pkeys syscall numbers.
|
# version of glibc that does not include pkeys syscall numbers.
|
||||||
- enable_pkeys = is_linux && target_cpu == "x64" && !is_cronet_build
|
enable_pkeys =
|
||||||
+ enable_pkeys = (is_linux && !is_bsd) && target_cpu == "x64" && !is_cronet_build
|
- (is_linux || is_chromeos) && target_cpu == "x64" && !is_cronet_build
|
||||||
|
+ !is_bsd && (is_linux || is_chromeos) && target_cpu == "x64" && !is_cronet_build
|
||||||
}
|
}
|
||||||
assert(!enable_pkeys || (is_linux && target_cpu == "x64"),
|
assert(!enable_pkeys || ((is_linux || is_chromeos) && target_cpu == "x64"),
|
||||||
"Pkeys are only supported on x64 linux")
|
"Pkeys are only supported on x64 linux and ChromeOS")
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/allocator/partition_allocator/partition_page_constants.h
|
|
||||||
--- base/allocator/partition_allocator/partition_page_constants.h.orig
|
|
||||||
+++ base/allocator/partition_allocator/partition_page_constants.h
|
|
||||||
@@ -16,7 +16,7 @@ namespace partition_alloc::internal {
|
|
||||||
// (1 << 12 or 1 << 14), as checked in PartitionRoot::Init(). And
|
|
||||||
// PartitionPageSize() is 4 times the OS page size.
|
|
||||||
static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 14) / kSmallestBucket;
|
|
||||||
-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
|
|
||||||
+#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
|
|
||||||
// System page size can be 4, 16, or 64 kiB on Linux on arm64. 64 kiB is
|
|
||||||
// currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code,
|
|
||||||
// so we use the 16 kiB maximum (64 kiB will crash).
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/BUILD.gn.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
|
||||||
|
@@ -851,7 +851,7 @@ if (is_clang_or_gcc) {
|
||||||
|
configs -= [ "//build/config/compiler:enable_arc" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (is_chromeos || is_linux) {
|
||||||
|
+ if ((is_chromeos || is_linux) && !is_bsd) {
|
||||||
|
shim_headers += [
|
||||||
|
"shim/allocator_shim_override_cpp_symbols.h",
|
||||||
|
"shim/allocator_shim_override_glibc_weak_symbols.h",
|
|
@ -1,6 +1,6 @@
|
||||||
Index: base/allocator/partition_allocator/address_space_randomization.h
|
Index: base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h
|
||||||
--- base/allocator/partition_allocator/address_space_randomization.h.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h.orig
|
||||||
+++ base/allocator/partition_allocator/address_space_randomization.h
|
+++ base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h
|
||||||
@@ -38,7 +38,7 @@ AslrMask(uintptr_t bits) {
|
@@ -38,7 +38,7 @@ AslrMask(uintptr_t bits) {
|
||||||
|
|
||||||
#if defined(ARCH_CPU_64_BITS)
|
#if defined(ARCH_CPU_64_BITS)
|
||||||
|
@ -10,7 +10,7 @@ Index: base/allocator/partition_allocator/address_space_randomization.h
|
||||||
|
|
||||||
// We shouldn't allocate system pages at all for sanitizer builds. However,
|
// We shouldn't allocate system pages at all for sanitizer builds. However,
|
||||||
// we do, and if random hint addresses interfere with address ranges
|
// we do, and if random hint addresses interfere with address ranges
|
||||||
@@ -124,7 +124,7 @@ AslrMask(uintptr_t bits) {
|
@@ -128,7 +128,7 @@ AslrMask(uintptr_t bits) {
|
||||||
return AslrAddress(0x20000000ULL);
|
return AslrAddress(0x20000000ULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
|
||||||
|
@@ -26,7 +26,7 @@
|
||||||
|
#define PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR __attribute__((const))
|
||||||
|
|
||||||
|
#elif (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS)) || \
|
||||||
|
- (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64))
|
||||||
|
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64))
|
||||||
|
// This should work for all POSIX (if needed), but currently all other
|
||||||
|
// supported OS/architecture combinations use either hard-coded values
|
||||||
|
// (such as x86) or have means to determine these values without needing
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/page_allocator.h
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/page_allocator.h.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/page_allocator.h
|
||||||
|
@@ -259,7 +259,7 @@ bool DecommitAndZeroSystemPages(void* address,
|
||||||
|
// recommitted. Do not assume that this will not change over time.
|
||||||
|
constexpr PA_COMPONENT_EXPORT(
|
||||||
|
PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() {
|
||||||
|
-#if BUILDFLAG(IS_APPLE)
|
||||||
|
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return true;
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/allocator/partition_allocator/page_allocator_internals_posix.h
|
Index: base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h
|
||||||
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h.orig
|
||||||
+++ base/allocator/partition_allocator/page_allocator_internals_posix.h
|
+++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h
|
||||||
@@ -403,8 +403,12 @@ bool TryRecommitSystemPagesInternal(
|
@@ -411,8 +411,12 @@ bool TryRecommitSystemPagesInternal(
|
||||||
|
|
||||||
void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
|
void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
|
||||||
void* ptr = reinterpret_cast<void*>(address);
|
void* ptr = reinterpret_cast<void*>(address);
|
|
@ -0,0 +1,35 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
|
||||||
|
@@ -13,11 +13,11 @@
|
||||||
|
#include "partition_alloc/partition_alloc_base/posix/eintr_wrapper.h"
|
||||||
|
#include "partition_alloc/partition_alloc_base/strings/safe_sprintf.h"
|
||||||
|
|
||||||
|
-#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_APPLE)
|
||||||
|
+#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
|
||||||
|
#include <link.h> // For ElfW() macro.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if BUILDFLAG(IS_APPLE)
|
||||||
|
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ namespace partition_alloc::internal::base::debug {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
-#if !BUILDFLAG(IS_APPLE)
|
||||||
|
+#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
|
||||||
|
|
||||||
|
// On Android the 'open' function has two versions:
|
||||||
|
// int open(const char *pathname, int flags);
|
||||||
|
@@ -369,7 +369,7 @@ void PrintStackTraceInternal(const void** trace, size_
|
||||||
|
}
|
||||||
|
#endif // !BUILDFLAG(IS_APPLE)
|
||||||
|
|
||||||
|
-#if BUILDFLAG(IS_APPLE)
|
||||||
|
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
|
||||||
|
// Since /proc/self/maps is not available, use dladdr() to obtain module
|
||||||
|
// names and offsets inside the modules from the given addresses.
|
||||||
|
void PrintStackTraceInternal(const void* const* trace, size_t size) {
|
|
@ -0,0 +1,14 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
|
||||||
|
@@ -102,6 +102,10 @@ void RandBytes(void* output, size_t output_length) {
|
||||||
|
if (getentropy(output, output_length) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+#elif BUILDFLAG(IS_BSD)
|
||||||
|
+ if (getentropy(output, output_length) == 0) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
#endif
|
||||||
|
// If getrandom(2) above returned with an error and the /dev/urandom fallback
|
||||||
|
// took place on Linux/ChromeOS bots, they would fail with a CHECK in
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
|
||||||
|
@@ -37,6 +37,8 @@ typedef DWORD PlatformThreadId;
|
||||||
|
typedef zx_handle_t PlatformThreadId;
|
||||||
|
#elif BUILDFLAG(IS_APPLE)
|
||||||
|
typedef mach_port_t PlatformThreadId;
|
||||||
|
+#elif BUILDFLAG(IS_BSD)
|
||||||
|
+typedef uint64_t PlatformThreadId;
|
||||||
|
#elif BUILDFLAG(IS_POSIX)
|
||||||
|
typedef pid_t PlatformThreadId;
|
||||||
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
|
||||||
--- base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h.orig
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_internal_posix.h
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
|
||||||
@@ -10,7 +10,7 @@
|
@@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace partition_alloc::internal::base::internal {
|
namespace partition_alloc::internal::base::internal {
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
#include "partition_alloc/partition_alloc_base/logging.h"
|
||||||
|
#include "partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h"
|
||||||
|
|
||||||
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <atomic>
|
||||||
|
#endif
|
|
@ -0,0 +1,21 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h
|
||||||
|
@@ -251,7 +251,7 @@ constexpr bool kUseLazyCommit = false;
|
||||||
|
// On these platforms, lock all the partitions before fork(), and unlock after.
|
||||||
|
// This may be required on more platforms in the future.
|
||||||
|
#define PA_CONFIG_HAS_ATFORK_HANDLER() \
|
||||||
|
- (BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
|
||||||
|
+ (BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
|
||||||
|
|
||||||
|
// PartitionAlloc uses PartitionRootEnumerator to acquire all
|
||||||
|
// PartitionRoots at BeforeFork and to release at AfterFork.
|
||||||
|
@@ -299,7 +299,7 @@ constexpr bool kUseLazyCommit = false;
|
||||||
|
//
|
||||||
|
// Also enabled on ARM64 macOS and iOS, as the 16kiB pages on this platform lead
|
||||||
|
// to larger slot spans.
|
||||||
|
-#if BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_ARM64))
|
||||||
|
+#if BUILDFLAG(IS_LINUX) || (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_BSD)
|
||||||
|
#define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() 1
|
||||||
|
#else
|
||||||
|
#define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() 0
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h
|
||||||
|
@@ -313,7 +313,7 @@ constexpr size_t kNumPools = kMaxPoolHandle - 1;
|
||||||
|
// 8GB for each of the glued pools).
|
||||||
|
#if BUILDFLAG(HAS_64_BIT_POINTERS)
|
||||||
|
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || \
|
||||||
|
- BUILDFLAG(ENABLE_POINTER_COMPRESSION)
|
||||||
|
+ BUILDFLAG(ENABLE_POINTER_COMPRESSION) || BUILDFLAG(IS_BSD)
|
||||||
|
constexpr size_t kPoolMaxSize = 8 * kGiB;
|
||||||
|
#else
|
||||||
|
constexpr size_t kPoolMaxSize = 16 * kGiB;
|
|
@ -1,6 +1,6 @@
|
||||||
Index: base/allocator/partition_allocator/partition_alloc_forward.h
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h
|
||||||
--- base/allocator/partition_allocator/partition_alloc_forward.h.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h.orig
|
||||||
+++ base/allocator/partition_allocator/partition_alloc_forward.h
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h
|
||||||
@@ -28,9 +28,13 @@ namespace internal {
|
@@ -28,9 +28,13 @@ namespace internal {
|
||||||
// the second one 16. We could technically return something different for
|
// the second one 16. We could technically return something different for
|
||||||
// malloc() and operator new(), but this would complicate things, and most of
|
// malloc() and operator new(), but this would complicate things, and most of
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/allocator/partition_allocator/partition_root.cc
|
Index: base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
|
||||||
--- base/allocator/partition_allocator/partition_root.cc.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/partition_root.cc.orig
|
||||||
+++ base/allocator/partition_allocator/partition_root.cc
|
+++ base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
|
||||||
@@ -46,7 +46,7 @@
|
@@ -47,7 +47,7 @@
|
||||||
#include "wow64apiset.h"
|
#include "wow64apiset.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: base/allocator/partition_allocator/partition_root.cc
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ void PartitionAllocMallocInitOnce() {
|
@@ -279,7 +279,7 @@ void PartitionAllocMallocInitOnce() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,16 +19,7 @@ Index: base/allocator/partition_allocator/partition_root.cc
|
||||||
// When fork() is called, only the current thread continues to execute in the
|
// 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
|
// child process. If the lock is held, but *not* by this thread when fork() is
|
||||||
// called, we have a deadlock.
|
// called, we have a deadlock.
|
||||||
@@ -372,7 +372,7 @@ static size_t PartitionPurgeSlotSpan(internal::SlotSpa
|
@@ -950,7 +950,7 @@ void PartitionRoot::Init(PartitionOptions opts) {
|
||||||
constexpr size_t kMaxSlotCount =
|
|
||||||
(PartitionPageSize() * kMaxPartitionPagesPerRegularSlotSpan) /
|
|
||||||
MinPurgeableSlotSize();
|
|
||||||
-#elif BUILDFLAG(IS_APPLE) || (BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64))
|
|
||||||
+#elif BUILDFLAG(IS_APPLE) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64))
|
|
||||||
// It's better for slot_usage to be stack-allocated and fixed-size, which
|
|
||||||
// demands that its size be constexpr. On IS_APPLE and Linux on arm64,
|
|
||||||
// PartitionPageSize() is always SystemPageSize() << 2, so regardless of
|
|
||||||
@@ -849,7 +849,7 @@ void PartitionRoot::Init(PartitionOptions opts) {
|
|
||||||
// apple OSes.
|
// apple OSes.
|
||||||
PA_CHECK((internal::SystemPageSize() == (size_t{1} << 12)) ||
|
PA_CHECK((internal::SystemPageSize() == (size_t{1} << 12)) ||
|
||||||
(internal::SystemPageSize() == (size_t{1} << 14)));
|
(internal::SystemPageSize() == (size_t{1} << 14)));
|
|
@ -1,10 +1,10 @@
|
||||||
Index: base/allocator/partition_allocator/spinning_mutex.cc
|
Index: base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc
|
||||||
--- base/allocator/partition_allocator/spinning_mutex.cc.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc.orig
|
||||||
+++ base/allocator/partition_allocator/spinning_mutex.cc
|
+++ base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc
|
||||||
@@ -18,7 +18,16 @@
|
@@ -17,7 +17,16 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PA_CONFIG(HAS_LINUX_KERNEL)
|
#if PA_CONFIG(HAS_LINUX_KERNEL)
|
||||||
#include <errno.h>
|
|
||||||
+#if defined(OS_OPENBSD)
|
+#if defined(OS_OPENBSD)
|
||||||
+#include <sys/time.h>
|
+#include <sys/time.h>
|
||||||
+#include <sys/futex.h>
|
+#include <sys/futex.h>
|
||||||
|
@ -17,8 +17,8 @@ Index: base/allocator/partition_allocator/spinning_mutex.cc
|
||||||
+#endif
|
+#endif
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif // PA_CONFIG(HAS_LINUX_KERNEL)
|
|
||||||
@@ -108,8 +117,16 @@ void SpinningMutex::FutexWait() {
|
@@ -109,8 +118,16 @@ void SpinningMutex::FutexWait() {
|
||||||
// |kLockedContended| anymore. Note that even without spurious wakeups, the
|
// |kLockedContended| anymore. Note that even without spurious wakeups, the
|
||||||
// value of |state_| is not guaranteed when this returns, as another thread
|
// value of |state_| is not guaranteed when this returns, as another thread
|
||||||
// may get the lock before we get to run.
|
// may get the lock before we get to run.
|
||||||
|
@ -35,7 +35,7 @@ Index: base/allocator/partition_allocator/spinning_mutex.cc
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
// These are programming error, check them.
|
// These are programming error, check them.
|
||||||
@@ -121,8 +138,16 @@ void SpinningMutex::FutexWait() {
|
@@ -122,8 +139,16 @@ void SpinningMutex::FutexWait() {
|
||||||
|
|
||||||
void SpinningMutex::FutexWake() {
|
void SpinningMutex::FutexWake() {
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
|
@ -1,6 +1,6 @@
|
||||||
Index: base/allocator/partition_allocator/starscan/stack/stack.cc
|
Index: base/allocator/partition_allocator/src/partition_alloc/starscan/stack/stack.cc
|
||||||
--- base/allocator/partition_allocator/starscan/stack/stack.cc.orig
|
--- base/allocator/partition_allocator/src/partition_alloc/starscan/stack/stack.cc.orig
|
||||||
+++ base/allocator/partition_allocator/starscan/stack/stack.cc
|
+++ base/allocator/partition_allocator/src/partition_alloc/starscan/stack/stack.cc
|
||||||
@@ -18,6 +18,10 @@
|
@@ -18,6 +18,10 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc
|
||||||
|
--- base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc.orig
|
||||||
|
+++ base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc
|
||||||
|
@@ -16,7 +16,7 @@
|
||||||
|
#include "partition_alloc/partition_alloc_check.h"
|
||||||
|
#include "partition_alloc/thread_isolation/thread_isolation.h"
|
||||||
|
|
||||||
|
-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
+#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
|
||||||
|
#error "This pkey code is currently only supported on Linux and ChromeOS"
|
||||||
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@ Index: base/base_paths_posix.cc
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@@ -25,9 +26,13 @@
|
@@ -26,9 +27,13 @@
|
||||||
#include "base/process/process_metrics.h"
|
#include "base/process/process_metrics.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
||||||
|
@ -24,7 +24,17 @@ Index: base/base_paths_posix.cc
|
||||||
#elif BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_AIX)
|
#elif BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_AIX)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -68,13 +73,65 @@ bool PathProviderPosix(int key, FilePath* result) {
|
@@ -48,8 +53,7 @@ bool PathProviderPosix(int key, FilePath* result) {
|
||||||
|
*result = bin_dir;
|
||||||
|
return true;
|
||||||
|
#elif BUILDFLAG(IS_FREEBSD)
|
||||||
|
- int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
|
||||||
|
- std::optional<std::string> bin_dir = StringSysctl(name, std::size(name));
|
||||||
|
+ std::optional<std::string> bin_dir = StringSysctl({ CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 });
|
||||||
|
if (!bin_dir.has_value() || bin_dir.value().length() <= 1) {
|
||||||
|
NOTREACHED() << "Unable to resolve path.";
|
||||||
|
return false;
|
||||||
|
@@ -65,13 +69,65 @@ bool PathProviderPosix(int key, FilePath* result) {
|
||||||
*result = FilePath(bin_dir);
|
*result = FilePath(bin_dir);
|
||||||
return true;
|
return true;
|
||||||
#elif BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_AIX)
|
#elif BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_AIX)
|
||||||
|
@ -64,7 +74,7 @@ Index: base/base_paths_posix.cc
|
||||||
+ goto out;
|
+ goto out;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
|
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, (int)KVM_NO_FILES, errbuf)) == NULL)
|
||||||
+ goto out;
|
+ goto out;
|
||||||
+
|
+
|
||||||
+ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid,
|
+ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid,
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/base_switches.cc
|
|
||||||
--- base/base_switches.cc.orig
|
|
||||||
+++ base/base_switches.cc
|
|
||||||
@@ -162,7 +162,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
||||||
// TODO(crbug.com/1176772): Remove kEnableCrashpad and IsCrashpadEnabled() when
|
|
||||||
// Crashpad is fully enabled on Linux. Indicates that Crashpad should be
|
|
||||||
// enabled.
|
|
|
@ -1,12 +0,0 @@
|
||||||
Index: base/base_switches.h
|
|
||||||
--- base/base_switches.h.orig
|
|
||||||
+++ base/base_switches.h
|
|
||||||
@@ -56,7 +56,7 @@ extern const char kEnableIdleTracing[];
|
|
||||||
extern const char kForceFieldTrialParams[];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
||||||
// TODO(crbug.com/1176772): Remove kEnableCrashpad and IsCrashpadEnabled() when
|
|
||||||
// Crashpad is fully enabled on Linux.
|
|
||||||
extern const char kEnableCrashpad[];
|
|
|
@ -1,36 +1,12 @@
|
||||||
Index: base/compiler_specific.h
|
Index: base/compiler_specific.h
|
||||||
--- base/compiler_specific.h.orig
|
--- base/compiler_specific.h.orig
|
||||||
+++ base/compiler_specific.h
|
+++ base/compiler_specific.h
|
||||||
@@ -41,9 +41,9 @@
|
@@ -316,7 +316,7 @@
|
||||||
// Annotate a function indicating it should not be inlined.
|
//
|
||||||
// Use like:
|
// In some cases it's desirable to remove this, e.g. on hot functions, or if
|
||||||
// NOINLINE void DoStuff() { ... }
|
// we have purposely changed the reference canary.
|
||||||
-#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
|
-#if defined(COMPILER_GCC) || defined(__clang__)
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 15) && HAS_ATTRIBUTE(noinline)
|
+#if (defined(COMPILER_GCC) || defined(__clang__)) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
|
||||||
#define NOINLINE [[clang::noinline]]
|
#if HAS_ATTRIBUTE(__no_stack_protector__)
|
||||||
-#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
|
#define NO_STACK_PROTECTOR __attribute__((__no_stack_protector__))
|
||||||
+#elif (defined(COMPILER_GCC) || defined(__clang__)) && HAS_ATTRIBUTE(noinline)
|
|
||||||
#define NOINLINE __attribute__((noinline))
|
|
||||||
#elif defined(COMPILER_MSVC)
|
|
||||||
#define NOINLINE __declspec(noinline)
|
|
||||||
@@ -51,9 +51,9 @@
|
|
||||||
#define NOINLINE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if defined(__clang__) && defined(NDEBUG) && HAS_ATTRIBUTE(always_inline)
|
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 15) && defined(NDEBUG) && HAS_ATTRIBUTE(always_inline)
|
|
||||||
#define ALWAYS_INLINE [[clang::always_inline]] inline
|
|
||||||
-#elif defined(COMPILER_GCC) && defined(NDEBUG) && HAS_ATTRIBUTE(always_inline)
|
|
||||||
+#elif (defined(COMPILER_GCC) || defined(__clang__)) && defined(NDEBUG) && HAS_ATTRIBUTE(always_inline)
|
|
||||||
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
|
|
||||||
#elif defined(COMPILER_MSVC) && defined(NDEBUG)
|
|
||||||
#define ALWAYS_INLINE __forceinline
|
|
||||||
@@ -69,7 +69,7 @@
|
|
||||||
// prevent code folding, see NO_CODE_FOLDING() in base/debug/alias.h.
|
|
||||||
// Use like:
|
|
||||||
// NOT_TAIL_CALLED void FooBar();
|
|
||||||
-#if defined(__clang__) && HAS_ATTRIBUTE(not_tail_called)
|
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 15) && HAS_ATTRIBUTE(not_tail_called)
|
|
||||||
#define NOT_TAIL_CALLED [[clang::not_tail_called]]
|
|
||||||
#else
|
#else
|
||||||
#define NOT_TAIL_CALLED
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/debug/debugger_posix.cc
|
Index: base/debug/debugger_posix.cc
|
||||||
--- base/debug/debugger_posix.cc.orig
|
--- base/debug/debugger_posix.cc.orig
|
||||||
+++ base/debug/debugger_posix.cc
|
+++ base/debug/debugger_posix.cc
|
||||||
@@ -35,6 +35,10 @@
|
@@ -36,6 +36,10 @@
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ Index: base/debug/debugger_posix.cc
|
||||||
if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
|
if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mib[5] = (info_size / sizeof(struct kinfo_proc));
|
- mib[5] = (info_size / sizeof(struct kinfo_proc));
|
||||||
|
+ mib[5] = static_cast<int>((info_size / sizeof(struct kinfo_proc)));
|
||||||
+ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) {
|
+ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) {
|
||||||
+ is_set = true;
|
+ is_set = true;
|
||||||
+ being_debugged = false;
|
+ being_debugged = false;
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
Index: base/debug/elf_reader.cc
|
Index: base/debug/elf_reader.cc
|
||||||
--- base/debug/elf_reader.cc.orig
|
--- base/debug/elf_reader.cc.orig
|
||||||
+++ base/debug/elf_reader.cc
|
+++ base/debug/elf_reader.cc
|
||||||
@@ -78,6 +78,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base,
|
@@ -45,6 +45,10 @@ using Xword = Elf64_Xword;
|
||||||
bool found = false;
|
|
||||||
while (current_section < section_end) {
|
|
||||||
current_note = reinterpret_cast<const Nhdr*>(current_section);
|
|
||||||
+#if !BUILDFLAG(IS_BSD)
|
|
||||||
if (current_note->n_type == NT_GNU_BUILD_ID) {
|
|
||||||
StringPiece note_name(current_section + sizeof(Nhdr),
|
|
||||||
current_note->n_namesz);
|
|
||||||
@@ -87,6 +88,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base,
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
size_t section_size = bits::AlignUp(current_note->n_namesz, 4u) +
|
constexpr char kGnuNoteName[] = "GNU";
|
||||||
bits::AlignUp(current_note->n_descsz, 4u) +
|
|
||||||
|
+#ifndef NT_GNU_BUILD_ID
|
||||||
|
+#define NT_GNU_BUILD_ID 3
|
||||||
|
+#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
|
||||||
|
// pointer to the start of the ELF image.
|
||||||
|
|
|
@ -1,22 +1,30 @@
|
||||||
Index: base/debug/stack_trace.cc
|
Index: base/debug/stack_trace.cc
|
||||||
--- base/debug/stack_trace.cc.orig
|
--- base/debug/stack_trace.cc.orig
|
||||||
+++ base/debug/stack_trace.cc
|
+++ base/debug/stack_trace.cc
|
||||||
@@ -273,7 +273,9 @@ void StackTrace::Print() const {
|
@@ -247,7 +247,7 @@ bool StackTrace::WillSymbolizeToStreamForTesting() {
|
||||||
}
|
// Symbols are not expected to be reliable when gn args specifies
|
||||||
|
// symbol_level=0.
|
||||||
void StackTrace::OutputToStream(std::ostream* os) const {
|
return false;
|
||||||
+#if !BUILDFLAG(IS_BSD)
|
-#elif defined(__UCLIBC__) || defined(_AIX)
|
||||||
OutputToStreamWithPrefix(os, nullptr);
|
+#elif defined(__UCLIBC__) || defined(_AIX) || BUILDFLAG(IS_BSD)
|
||||||
+#endif
|
// StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
|
||||||
}
|
// See https://crbug.com/706728
|
||||||
|
return false;
|
||||||
std::string StackTrace::ToString() const {
|
@@ -291,7 +291,7 @@ std::string StackTrace::ToString() const {
|
||||||
@@ -281,7 +283,7 @@ std::string StackTrace::ToString() const {
|
|
||||||
}
|
}
|
||||||
std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
|
std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
-#if !defined(__UCLIBC__) && !defined(_AIX)
|
-#if !defined(__UCLIBC__) && !defined(_AIX)
|
||||||
+#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
|
+#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
|
||||||
OutputToStreamWithPrefix(&stream, prefix_string);
|
if (ShouldSuppressOutput()) {
|
||||||
#endif
|
return "Backtrace suppressed.";
|
||||||
return stream.str();
|
}
|
||||||
|
@@ -301,7 +301,7 @@ std::string StackTrace::ToStringWithPrefix(const char*
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
|
||||||
|
-#if !defined(__UCLIBC__) && !defined(_AIX)
|
||||||
|
+#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
|
||||||
|
s.OutputToStream(&os);
|
||||||
|
#else
|
||||||
|
os << "StackTrace::OutputToStream not implemented.";
|
||||||
|
|
|
@ -10,16 +10,19 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
#define HAVE_BACKTRACE
|
#define HAVE_BACKTRACE
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -59,7 +59,7 @@
|
@@ -59,8 +59,10 @@
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
||||||
|
+#if !BUILDFLAG(IS_BSD)
|
||||||
|
#include <sys/prctl.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
#include "base/debug/proc_maps_linux.h"
|
#include "base/debug/proc_maps_linux.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -301,7 +303,7 @@ void PrintToStderr(const char* output) {
|
||||||
@@ -300,7 +300,7 @@ void PrintToStderr(const char* output) {
|
|
||||||
std::ignore = HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)));
|
std::ignore = HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +31,7 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
void AlarmSignalHandler(int signal, siginfo_t* info, void* void_context) {
|
void AlarmSignalHandler(int signal, siginfo_t* info, void* void_context) {
|
||||||
// We have seen rare cases on AMD linux where the default signal handler
|
// We have seen rare cases on AMD linux where the default signal handler
|
||||||
// either does not run or a thread (Probably an AMD driver thread) prevents
|
// either does not run or a thread (Probably an AMD driver thread) prevents
|
||||||
@@ -317,7 +317,11 @@ void AlarmSignalHandler(int signal, siginfo_t* info, v
|
@@ -318,7 +320,11 @@ void AlarmSignalHandler(int signal, siginfo_t* info, v
|
||||||
"Warning: Default signal handler failed to terminate process.\n");
|
"Warning: Default signal handler failed to terminate process.\n");
|
||||||
PrintToStderr("Calling exit_group() directly to prevent timeout.\n");
|
PrintToStderr("Calling exit_group() directly to prevent timeout.\n");
|
||||||
// See: https://man7.org/linux/man-pages/man2/exit_group.2.html
|
// See: https://man7.org/linux/man-pages/man2/exit_group.2.html
|
||||||
|
@ -40,7 +43,7 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
|
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
|
||||||
// BUILDFLAG(IS_CHROMEOS)
|
// BUILDFLAG(IS_CHROMEOS)
|
||||||
@@ -534,7 +538,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
|
@@ -535,7 +541,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +52,7 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
// Set an alarm to trigger in case the default handler does not terminate
|
// Set an alarm to trigger in case the default handler does not terminate
|
||||||
// the process. See 'AlarmSignalHandler' for more details.
|
// the process. See 'AlarmSignalHandler' for more details.
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
@@ -559,6 +563,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
|
@@ -560,6 +566,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
|
||||||
// signals that do not re-raise autonomously), such as signals delivered via
|
// signals that do not re-raise autonomously), such as signals delivered via
|
||||||
// kill() and asynchronous hardware faults such as SEGV_MTEAERR, which would
|
// kill() and asynchronous hardware faults such as SEGV_MTEAERR, which would
|
||||||
// otherwise be lost when re-raising the signal via raise().
|
// otherwise be lost when re-raising the signal via raise().
|
||||||
|
@ -57,7 +60,7 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
long retval = syscall(SYS_rt_tgsigqueueinfo, getpid(), syscall(SYS_gettid),
|
long retval = syscall(SYS_rt_tgsigqueueinfo, getpid(), syscall(SYS_gettid),
|
||||||
info->si_signo, info);
|
info->si_signo, info);
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
@@ -573,6 +578,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
|
@@ -574,6 +581,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* inf
|
||||||
if (errno != EPERM) {
|
if (errno != EPERM) {
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +68,21 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
|
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
|
||||||
// BUILDFLAG(IS_CHROMEOS)
|
// BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
@@ -821,6 +827,9 @@ class SandboxSymbolizeHelper {
|
@@ -763,6 +771,7 @@ class SandboxSymbolizeHelper {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if !BUILDFLAG(IS_BSD)
|
||||||
|
// This class is copied from
|
||||||
|
// third_party/crashpad/crashpad/util/linux/scoped_pr_set_dumpable.h.
|
||||||
|
// It aims at ensuring the process is dumpable before opening /proc/self/mem.
|
||||||
|
@@ -855,11 +864,15 @@ class SandboxSymbolizeHelper {
|
||||||
|
r.base = cur_base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
// Parses /proc/self/maps in order to compile a list of all object file names
|
||||||
// for the modules that are loaded in the current process.
|
// for the modules that are loaded in the current process.
|
||||||
// Returns true on success.
|
// Returns true on success.
|
||||||
bool CacheMemoryRegions() {
|
bool CacheMemoryRegions() {
|
||||||
|
@ -75,7 +92,7 @@ Index: base/debug/stack_trace_posix.cc
|
||||||
// Reads /proc/self/maps.
|
// Reads /proc/self/maps.
|
||||||
std::string contents;
|
std::string contents;
|
||||||
if (!ReadProcMaps(&contents)) {
|
if (!ReadProcMaps(&contents)) {
|
||||||
@@ -838,6 +847,7 @@ class SandboxSymbolizeHelper {
|
@@ -877,6 +890,7 @@ class SandboxSymbolizeHelper {
|
||||||
|
|
||||||
is_initialized_ = true;
|
is_initialized_ = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/files/file_path_watcher.h
|
Index: base/files/file_path_watcher.h
|
||||||
--- base/files/file_path_watcher.h.orig
|
--- base/files/file_path_watcher.h.orig
|
||||||
+++ base/files/file_path_watcher.h
|
+++ base/files/file_path_watcher.h
|
||||||
@@ -59,7 +59,7 @@ class BASE_EXPORT FilePathWatcher {
|
@@ -105,7 +105,7 @@ class BASE_EXPORT FilePathWatcher {
|
||||||
Type type = Type::kNonRecursive;
|
Type type = Type::kNonRecursive;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/files/file_path_watcher_unittest.cc
|
Index: base/files/file_path_watcher_unittest.cc
|
||||||
--- base/files/file_path_watcher_unittest.cc.orig
|
--- base/files/file_path_watcher_unittest.cc.orig
|
||||||
+++ base/files/file_path_watcher_unittest.cc
|
+++ base/files/file_path_watcher_unittest.cc
|
||||||
@@ -586,7 +586,7 @@ TEST_F(FilePathWatcherTest, WatchDirectory) {
|
@@ -847,7 +847,7 @@ TEST_F(FilePathWatcherTest, WatchDirectory) {
|
||||||
}
|
}
|
||||||
delegate.RunUntilEventsMatch(event_expecter);
|
delegate.RunUntilEventsMatch(event_expecter);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: base/files/file_path_watcher_unittest.cc
|
||||||
ASSERT_TRUE(WriteFile(file1, "content v2"));
|
ASSERT_TRUE(WriteFile(file1, "content v2"));
|
||||||
// Mac implementation does not detect files modified in a directory.
|
// Mac implementation does not detect files modified in a directory.
|
||||||
// TODO(https://crbug.com/1432064): Expect that no events are fired on Mac.
|
// TODO(https://crbug.com/1432064): Expect that no events are fired on Mac.
|
||||||
@@ -1525,7 +1525,7 @@ namespace {
|
@@ -1783,7 +1783,7 @@ namespace {
|
||||||
|
|
||||||
enum Permission { Read, Write, Execute };
|
enum Permission { Read, Write, Execute };
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ Index: base/files/file_path_watcher_unittest.cc
|
||||||
bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
|
bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
@@ -1559,7 +1559,7 @@ bool ChangeFilePermissions(const FilePath& path, Permi
|
@@ -1817,7 +1817,7 @@ bool ChangeFilePermissions(const FilePath& path, Permi
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/files/file_util_posix.cc
|
Index: base/files/file_util_posix.cc
|
||||||
--- base/files/file_util_posix.cc.orig
|
--- base/files/file_util_posix.cc.orig
|
||||||
+++ base/files/file_util_posix.cc
|
+++ base/files/file_util_posix.cc
|
||||||
@@ -756,32 +756,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p
|
@@ -816,33 +816,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p
|
||||||
File::Error* error) {
|
File::Error* error) {
|
||||||
ScopedBlockingCall scoped_blocking_call(
|
ScopedBlockingCall scoped_blocking_call(
|
||||||
FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir().
|
FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir().
|
||||||
|
@ -35,11 +35,12 @@ Index: base/files/file_util_posix.cc
|
||||||
- if (!DirectoryExists(subpath)) {
|
- if (!DirectoryExists(subpath)) {
|
||||||
- if (error)
|
- if (error)
|
||||||
- *error = File::OSErrorToFileError(saved_errno);
|
- *error = File::OSErrorToFileError(saved_errno);
|
||||||
|
- errno = saved_errno;
|
||||||
- return false;
|
- return false;
|
||||||
+ if (!PathExists(subpath)) {
|
+ if (!PathExists(subpath)) {
|
||||||
+ if ((mkdir(subpath.value().c_str(), 0700) == -1) &&
|
+ if ((mkdir(subpath.value().c_str(), 0700) == -1) &&
|
||||||
+ ((full_path != subpath) ? (errno != ENOENT) : (-1))) {
|
+ ((full_path != subpath) ? (errno != ENOENT) : (-1))) {
|
||||||
+ int saved_errno = errno;
|
+ int saved_errno = errno;
|
||||||
+ if (error)
|
+ if (error)
|
||||||
+ *error = File::OSErrorToFileError(saved_errno);
|
+ *error = File::OSErrorToFileError(saved_errno);
|
||||||
+ return false;
|
+ return false;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/files/file_util_unittest.cc
|
Index: base/files/file_util_unittest.cc
|
||||||
--- base/files/file_util_unittest.cc.orig
|
--- base/files/file_util_unittest.cc.orig
|
||||||
+++ base/files/file_util_unittest.cc
|
+++ base/files/file_util_unittest.cc
|
||||||
@@ -3871,7 +3871,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) {
|
@@ -3870,7 +3870,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) {
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_WIN)
|
#endif // BUILDFLAG(IS_WIN)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: base/files/file_util_unittest.cc
|
||||||
TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) {
|
TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) {
|
||||||
FilePath file_path("/proc/cpuinfo");
|
FilePath file_path("/proc/cpuinfo");
|
||||||
std::string data = "temp";
|
std::string data = "temp";
|
||||||
@@ -4594,7 +4594,7 @@ TEST(FileUtilMultiThreadedTest, MultiThreadedTempFiles
|
@@ -4651,7 +4651,7 @@ TEST(FileUtilMultiThreadedTest, MultiThreadedTempFiles
|
||||||
NULL);
|
NULL);
|
||||||
#else
|
#else
|
||||||
size_t bytes_written =
|
size_t bytes_written =
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
Index: base/functional/unretained_traits.h
|
Index: base/functional/unretained_traits.h
|
||||||
--- base/functional/unretained_traits.h.orig
|
--- base/functional/unretained_traits.h.orig
|
||||||
+++ base/functional/unretained_traits.h
|
+++ base/functional/unretained_traits.h
|
||||||
@@ -130,7 +130,7 @@ struct TypeSupportsUnretained {
|
@@ -93,7 +93,7 @@ struct SupportsUnretainedImpl {
|
||||||
// official builds, and then in non-test code as well.
|
// official builds, and then in non-test code as well.
|
||||||
#if !defined(UNIT_TEST) && !defined(OFFICIAL_BUILD)
|
#if defined(FORCE_UNRETAINED_COMPLETENESS_CHECKS_FOR_TESTS) || \
|
||||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
|
(!defined(UNIT_TEST) && !defined(OFFICIAL_BUILD) && \
|
||||||
- defined(FORCE_UNRETAINED_COMPLETENESS_CHECKS_FOR_TESTS)
|
- (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)))
|
||||||
+ || BUILDFLAGS(IS_BSD) || defined(FORCE_UNRETAINED_COMPLETENESS_CHECKS_FOR_TESTS)
|
+ (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)))
|
||||||
static_assert(IsCompleteTypeV<T> ||
|
static_assert(v,
|
||||||
IsIncompleteTypeSafeForUnretained<std::remove_cv_t<T>>,
|
"Argument requires unretained storage, but type is not "
|
||||||
"T must be fully defined.");
|
"fully defined. This prevents determining whether "
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/i18n/icu_util.cc
|
Index: base/i18n/icu_util.cc
|
||||||
--- base/i18n/icu_util.cc.orig
|
--- base/i18n/icu_util.cc.orig
|
||||||
+++ base/i18n/icu_util.cc
|
+++ base/i18n/icu_util.cc
|
||||||
@@ -51,7 +51,7 @@
|
@@ -52,7 +52,7 @@
|
||||||
#include "third_party/icu/source/common/unicode/unistr.h"
|
#include "third_party/icu/source/common/unicode/unistr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: base/i18n/icu_util.cc
|
||||||
BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
|
BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
|
||||||
#include "third_party/icu/source/i18n/unicode/timezone.h"
|
#include "third_party/icu/source/i18n/unicode/timezone.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -345,7 +345,7 @@ void InitializeIcuTimeZone() {
|
@@ -328,7 +328,7 @@ void InitializeIcuTimeZone() {
|
||||||
FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
|
FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
|
||||||
icu::TimeZone::adoptDefault(
|
icu::TimeZone::adoptDefault(
|
||||||
icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
|
icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
|
||||||
|
|
|
@ -9,7 +9,7 @@ Index: base/linux_util.cc
|
||||||
|
|
||||||
#include "base/base_export.h"
|
#include "base/base_export.h"
|
||||||
#include "base/files/dir_reader_posix.h"
|
#include "base/files/dir_reader_posix.h"
|
||||||
@@ -135,6 +136,9 @@ void SetLinuxDistro(const std::string& distro) {
|
@@ -153,10 +154,14 @@ void SetLinuxDistro(const std::string& distro) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
|
bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
|
||||||
|
@ -19,11 +19,8 @@ Index: base/linux_util.cc
|
||||||
// 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22
|
// 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22
|
||||||
char buf[25];
|
char buf[25];
|
||||||
strings::SafeSPrintf(buf, "/proc/%d/task", pid);
|
strings::SafeSPrintf(buf, "/proc/%d/task", pid);
|
||||||
@@ -152,6 +156,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t
|
return GetThreadsFromProcessDir(buf, tids);
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
+#endif
|
+#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,
|
bool GetThreadsForCurrentProcess(std::vector<pid_t>* tids) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ Index: base/logging_unittest.cc
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -575,14 +575,18 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo
|
@@ -570,14 +570,18 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo
|
||||||
// need the arch-specific boilerplate below, which is inspired by breakpad.
|
// 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.
|
// At the same time, on OSX, ucontext.h is deprecated but si_addr works fine.
|
||||||
uintptr_t crash_addr = 0;
|
uintptr_t crash_addr = 0;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
Index: base/memory/platform_shared_memory_region.h
|
Index: base/memory/platform_shared_memory_region.h
|
||||||
--- base/memory/platform_shared_memory_region.h.orig
|
--- base/memory/platform_shared_memory_region.h.orig
|
||||||
+++ base/memory/platform_shared_memory_region.h
|
+++ base/memory/platform_shared_memory_region.h
|
||||||
@@ -16,7 +16,7 @@
|
@@ -17,7 +17,7 @@
|
||||||
|
#include "base/unguessable_token.h"
|
||||||
#include <stdint.h>
|
#include "build/build_config.h"
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
||||||
namespace content {
|
namespace content {
|
||||||
class SandboxIPCHandler;
|
class SandboxIPCHandler;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
|
@@ -84,7 +84,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
|
||||||
kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE
|
kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ Index: base/memory/platform_shared_memory_region.h
|
||||||
// Structure to limit access to executable region creation.
|
// Structure to limit access to executable region creation.
|
||||||
struct ExecutableRegion {
|
struct ExecutableRegion {
|
||||||
private:
|
private:
|
||||||
@@ -215,7 +215,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
|
@@ -216,7 +216,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
|
||||||
CheckPlatformHandlePermissionsCorrespondToMode);
|
CheckPlatformHandlePermissionsCorrespondToMode);
|
||||||
static PlatformSharedMemoryRegion Create(Mode mode,
|
static PlatformSharedMemoryRegion Create(Mode mode,
|
||||||
size_t size
|
size_t size
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/native_library_unittest.cc
|
Index: base/native_library_unittest.cc
|
||||||
--- base/native_library_unittest.cc.orig
|
--- base/native_library_unittest.cc.orig
|
||||||
+++ base/native_library_unittest.cc
|
+++ base/native_library_unittest.cc
|
||||||
@@ -134,7 +134,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
|
@@ -133,7 +133,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
|
||||||
// versions with respect to symbol resolution scope.
|
// versions with respect to symbol resolution scope.
|
||||||
// TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255
|
// TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255
|
||||||
#if !BUILDFLAG(IS_ANDROID) && !defined(THREAD_SANITIZER) && \
|
#if !BUILDFLAG(IS_ANDROID) && !defined(THREAD_SANITIZER) && \
|
||||||
|
|
11
www/ungoogled-chromium/patches/patch-base_posix_sysctl_cc
Normal file
11
www/ungoogled-chromium/patches/patch-base_posix_sysctl_cc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Index: base/posix/sysctl.cc
|
||||||
|
--- base/posix/sysctl.cc.orig
|
||||||
|
+++ base/posix/sysctl.cc
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
|
||||||
|
#include "base/posix/sysctl.h"
|
||||||
|
|
||||||
|
+#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
#include <initializer_list>
|
|
@ -10,6 +10,24 @@ Index: base/posix/unix_domain_socket.cc
|
||||||
const int enable = 1;
|
const int enable = 1;
|
||||||
return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
|
return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
|
||||||
#else
|
#else
|
||||||
|
@@ -77,7 +77,7 @@ bool UnixDomainSocket::SendMsg(int fd,
|
||||||
|
|
||||||
|
struct cmsghdr* cmsg;
|
||||||
|
msg.msg_control = control_buffer;
|
||||||
|
-#if BUILDFLAG(IS_APPLE)
|
||||||
|
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
|
||||||
|
msg.msg_controllen = checked_cast<socklen_t>(control_len);
|
||||||
|
#else
|
||||||
|
msg.msg_controllen = control_len;
|
||||||
|
@@ -85,7 +85,7 @@ bool UnixDomainSocket::SendMsg(int fd,
|
||||||
|
cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
|
cmsg->cmsg_level = SOL_SOCKET;
|
||||||
|
cmsg->cmsg_type = SCM_RIGHTS;
|
||||||
|
-#if BUILDFLAG(IS_APPLE)
|
||||||
|
+#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
|
||||||
|
cmsg->cmsg_len = checked_cast<u_int>(CMSG_LEN(sizeof(int) * fds.size()));
|
||||||
|
#else
|
||||||
|
cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fds.size());
|
||||||
@@ -149,7 +149,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
|
@@ -149,7 +149,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
|
||||||
|
|
||||||
const size_t kControlBufferSize =
|
const size_t kControlBufferSize =
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
Index: base/process/internal_linux.h
|
||||||
|
--- base/process/internal_linux.h.orig
|
||||||
|
+++ base/process/internal_linux.h
|
||||||
|
@@ -138,6 +138,9 @@ TimeDelta ClockTicksToTimeDelta(int64_t clock_ticks);
|
||||||
|
// arguments to the lambda.
|
||||||
|
template <typename Lambda>
|
||||||
|
void ForEachProcessTask(base::ProcessHandle process, Lambda&& lambda) {
|
||||||
|
+#if BUILDFLAG(IS_BSD)
|
||||||
|
+ return;
|
||||||
|
+#else
|
||||||
|
// Iterate through the different threads tracked in /proc/<pid>/task.
|
||||||
|
FilePath fd_path = GetProcPidDir(process).Append("task");
|
||||||
|
|
||||||
|
@@ -157,6 +160,7 @@ void ForEachProcessTask(base::ProcessHandle process, L
|
||||||
|
FilePath task_path = fd_path.Append(tid_str);
|
||||||
|
lambda(tid, task_path);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/kill.h
|
Index: base/process/kill.h
|
||||||
--- base/process/kill.h.orig
|
--- base/process/kill.h.orig
|
||||||
+++ base/process/kill.h
|
+++ base/process/kill.h
|
||||||
@@ -113,7 +113,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro
|
@@ -121,7 +121,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro
|
||||||
BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
|
BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
|
||||||
ProcessHandle handle, int* exit_code);
|
ProcessHandle handle, int* exit_code);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/launch_posix.cc
|
Index: base/process/launch_posix.cc
|
||||||
--- base/process/launch_posix.cc.orig
|
--- base/process/launch_posix.cc.orig
|
||||||
+++ base/process/launch_posix.cc
|
+++ base/process/launch_posix.cc
|
||||||
@@ -64,6 +64,9 @@
|
@@ -61,6 +61,9 @@
|
||||||
#error "macOS should use launch_mac.cc"
|
#error "macOS should use launch_mac.cc"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/memory_linux.cc
|
Index: base/process/memory_linux.cc
|
||||||
--- base/process/memory_linux.cc.orig
|
--- base/process/memory_linux.cc.orig
|
||||||
+++ base/process/memory_linux.cc
|
+++ base/process/memory_linux.cc
|
||||||
@@ -20,6 +20,7 @@
|
@@ -28,6 +28,7 @@ void __libc_free(void*);
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Index: base/process/memory_linux.cc
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void ReleaseReservationOrTerminate() {
|
void ReleaseReservationOrTerminate() {
|
||||||
@@ -29,12 +30,14 @@ void ReleaseReservationOrTerminate() {
|
@@ -37,12 +38,14 @@ void ReleaseReservationOrTerminate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -24,7 +24,7 @@ Index: base/process/memory_linux.cc
|
||||||
// Set the new-out of memory handler.
|
// Set the new-out of memory handler.
|
||||||
std::set_new_handler(&ReleaseReservationOrTerminate);
|
std::set_new_handler(&ReleaseReservationOrTerminate);
|
||||||
// If we're using glibc's allocator, the above functions will override
|
// If we're using glibc's allocator, the above functions will override
|
||||||
@@ -43,8 +46,10 @@ void EnableTerminationOnOutOfMemory() {
|
@@ -51,8 +54,10 @@ void EnableTerminationOnOutOfMemory() {
|
||||||
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
|
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
|
||||||
allocator_shim::SetCallNewHandlerOnMallocFailure(true);
|
allocator_shim::SetCallNewHandlerOnMallocFailure(true);
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,7 +35,7 @@ Index: base/process/memory_linux.cc
|
||||||
// ScopedAllowBlocking() has private constructor and it can only be used in
|
// ScopedAllowBlocking() has private constructor and it can only be used in
|
||||||
// friend classes/functions. Declaring a class is easier in this situation to
|
// friend classes/functions. Declaring a class is easier in this situation to
|
||||||
// avoid adding more dependency to thread_restrictions.h because of the
|
// avoid adding more dependency to thread_restrictions.h because of the
|
||||||
@@ -104,6 +109,7 @@ bool AdjustOOMScoreHelper::AdjustOOMScore(ProcessId pr
|
@@ -112,6 +117,7 @@ bool AdjustOOMScoreHelper::AdjustOOMScore(ProcessId pr
|
||||||
bool AdjustOOMScore(ProcessId process, int score) {
|
bool AdjustOOMScore(ProcessId process, int score) {
|
||||||
return AdjustOOMScoreHelper::AdjustOOMScore(process, score);
|
return AdjustOOMScoreHelper::AdjustOOMScore(process, score);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ Index: base/process/process_handle_freebsd.cc
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -15,10 +16,13 @@ namespace base {
|
@@ -20,10 +21,13 @@ namespace base {
|
||||||
|
|
||||||
ProcessId GetParentProcessId(ProcessHandle process) {
|
ProcessId GetParentProcessId(ProcessHandle process) {
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/process_handle.h
|
Index: base/process/process_handle.h
|
||||||
--- base/process/process_handle.h.orig
|
--- base/process/process_handle.h.orig
|
||||||
+++ base/process/process_handle.h
|
+++ base/process/process_handle.h
|
||||||
@@ -106,7 +106,7 @@ BASE_EXPORT ProcessId GetCurrentProcId();
|
@@ -86,7 +86,7 @@ BASE_EXPORT ProcessId GetCurrentProcId();
|
||||||
// processes may be reused.
|
// processes may be reused.
|
||||||
BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
|
BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
Index: base/process/process_handle_openbsd.cc
|
Index: base/process/process_handle_openbsd.cc
|
||||||
--- base/process/process_handle_openbsd.cc.orig
|
--- base/process/process_handle_openbsd.cc.orig
|
||||||
+++ base/process/process_handle_openbsd.cc
|
+++ base/process/process_handle_openbsd.cc
|
||||||
@@ -3,8 +3,11 @@
|
@@ -3,48 +3,112 @@
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/process/process_handle.h"
|
#include "base/process/process_handle.h"
|
||||||
+#include "base/files/file_util.h"
|
+#include "base/files/file_util.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
+#include <sys/param.h>
|
+#include <sys/param.h>
|
||||||
+#include <sys/proc.h>
|
+#include <sys/proc.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -12,39 +15,59 @@
|
|
||||||
|
+#include <kvm.h>
|
||||||
|
+
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
ProcessId GetParentProcessId(ProcessHandle process) {
|
ProcessId GetParentProcessId(ProcessHandle process) {
|
||||||
|
@ -27,18 +31,19 @@ Index: base/process/process_handle_openbsd.cc
|
||||||
if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
|
if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
- mib[5] = (length / sizeof(struct kinfo_proc));
|
||||||
+ info = (struct kinfo_proc *)malloc(length);
|
+ info = (struct kinfo_proc *)malloc(length);
|
||||||
+
|
|
||||||
mib[5] = (length / sizeof(struct kinfo_proc));
|
|
||||||
|
|
||||||
- if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
|
- if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
|
||||||
- return -1;
|
- return -1;
|
||||||
|
+ mib[5] = static_cast<int>((length / sizeof(struct kinfo_proc)));
|
||||||
|
|
||||||
|
- return info.p_ppid;
|
||||||
+ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) {
|
+ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) {
|
||||||
+ ppid = -1;
|
+ ppid = -1;
|
||||||
+ goto out;
|
+ goto out;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
- return info.p_ppid;
|
|
||||||
+ ppid = info->p_ppid;
|
+ ppid = info->p_ppid;
|
||||||
+
|
+
|
||||||
+out:
|
+out:
|
||||||
|
@ -48,16 +53,20 @@ Index: base/process/process_handle_openbsd.cc
|
||||||
|
|
||||||
FilePath GetProcessExecutablePath(ProcessHandle process) {
|
FilePath GetProcessExecutablePath(ProcessHandle process) {
|
||||||
- struct kinfo_proc kp;
|
- struct kinfo_proc kp;
|
||||||
- size_t len;
|
+ struct kinfo_file *files;
|
||||||
+ struct kinfo_proc *info;
|
+ kvm_t *kd = NULL;
|
||||||
+ size_t length;
|
+ char errbuf[_POSIX2_LINE_MAX];
|
||||||
+ char *path = NULL;
|
+ char **retvalargs, *cpath, retval[PATH_MAX];
|
||||||
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
|
+ int cnt;
|
||||||
sizeof(struct kinfo_proc), 0 };
|
size_t len;
|
||||||
|
- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
|
||||||
|
- sizeof(struct kinfo_proc), 0 };
|
||||||
|
+ char *tokens[2];
|
||||||
|
+ struct stat sb;
|
||||||
|
+ FilePath result;
|
||||||
|
|
||||||
- if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) == -1)
|
- if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) == -1)
|
||||||
+ if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) == -1)
|
- return FilePath();
|
||||||
return FilePath();
|
|
||||||
- mib[5] = (len / sizeof(struct kinfo_proc));
|
- mib[5] = (len / sizeof(struct kinfo_proc));
|
||||||
- if (sysctl(mib, std::size(mib), &kp, &len, NULL, 0) < 0)
|
- if (sysctl(mib, std::size(mib), &kp, &len, NULL, 0) < 0)
|
||||||
- return FilePath();
|
- return FilePath();
|
||||||
|
@ -65,26 +74,61 @@ Index: base/process/process_handle_openbsd.cc
|
||||||
- return FilePath();
|
- return FilePath();
|
||||||
- if (strcmp(kp.p_comm, "chrome") == 0)
|
- if (strcmp(kp.p_comm, "chrome") == 0)
|
||||||
- return FilePath(kp.p_comm);
|
- return FilePath(kp.p_comm);
|
||||||
|
+ int mib[] = { CTL_KERN, KERN_PROC_ARGS, process, KERN_PROC_ARGV };
|
||||||
|
|
||||||
- return FilePath();
|
- return FilePath();
|
||||||
+ info = (struct kinfo_proc *)malloc(length);
|
+ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
|
||||||
|
+ result = FilePath(cpath);
|
||||||
|
+ else
|
||||||
|
+ result = FilePath("/usr/local/chrome/chrome");
|
||||||
+
|
+
|
||||||
+ mib[5] = (length / sizeof(struct kinfo_proc));
|
+ if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) != -1) {
|
||||||
|
+ retvalargs = static_cast<char**>(malloc(len));
|
||||||
|
+ if (!retvalargs)
|
||||||
|
+ return result;
|
||||||
+
|
+
|
||||||
+ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0)
|
+ if (sysctl(mib, std::size(mib), retvalargs, &len, NULL, 0) < 0) {
|
||||||
+ goto out;
|
+ free(retvalargs);
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if ((info->p_flag & P_SYSTEM) != 0)
|
+ if ((*tokens = strtok(retvalargs[0], ":")) == NULL) {
|
||||||
+ goto out;
|
+ free(retvalargs);
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if (strcmp(info->p_comm, "chrome") == 0) {
|
+ free(retvalargs);
|
||||||
+ path = info->p_comm;
|
+
|
||||||
+ goto out;
|
+ if (tokens[0] == NULL)
|
||||||
|
+ return result;
|
||||||
|
+
|
||||||
|
+ if (realpath(tokens[0], retval) == NULL)
|
||||||
|
+ return result;
|
||||||
|
+
|
||||||
|
+ if (stat(retval, &sb) < 0)
|
||||||
|
+ return result;
|
||||||
|
+
|
||||||
|
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, (int)KVM_NO_FILES,
|
||||||
|
+ errbuf)) == NULL)
|
||||||
|
+ return result;
|
||||||
|
+
|
||||||
|
+ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process,
|
||||||
|
+ sizeof(struct kinfo_file), &cnt)) == NULL) {
|
||||||
|
+ kvm_close(kd);
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ 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) {
|
||||||
|
+ kvm_close(kd);
|
||||||
|
+ result = FilePath(retval);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+out:
|
+ return result;
|
||||||
+ free(info);
|
|
||||||
+ return FilePath(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
|
|
@ -36,17 +36,12 @@ Index: base/process/process_metrics.cc
|
||||||
double ProcessMetrics::GetPlatformIndependentCPUUsage(
|
double ProcessMetrics::GetPlatformIndependentCPUUsage(
|
||||||
TimeDelta cumulative_cpu) {
|
TimeDelta cumulative_cpu) {
|
||||||
TimeTicks time = TimeTicks::Now();
|
TimeTicks time = TimeTicks::Now();
|
||||||
@@ -126,7 +125,6 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage(
|
@@ -130,10 +129,9 @@ std::optional<double> ProcessMetrics::GetPlatformIndep
|
||||||
double ProcessMetrics::GetPlatformIndependentCPUUsage() {
|
}
|
||||||
return GetPlatformIndependentCPUUsage(GetCumulativeCPUUsage());
|
return GetPlatformIndependentCPUUsage(cpu_usage.value());
|
||||||
}
|
}
|
||||||
-#endif
|
-#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
|
||||||
double ProcessMetrics::GetPreciseCPUUsage(TimeDelta cumulative_cpu) {
|
|
||||||
@@ -157,7 +155,7 @@ double ProcessMetrics::GetPreciseCPUUsage() {
|
|
||||||
#endif // BUILDFLAG(IS_WIN)
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
||||||
- BUILDFLAG(IS_AIX)
|
- BUILDFLAG(IS_AIX)
|
||||||
+ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
|
+ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/process_metrics_freebsd.cc
|
Index: base/process/process_metrics_freebsd.cc
|
||||||
--- base/process/process_metrics_freebsd.cc.orig
|
--- base/process/process_metrics_freebsd.cc.orig
|
||||||
+++ base/process/process_metrics_freebsd.cc
|
+++ base/process/process_metrics_freebsd.cc
|
||||||
@@ -3,20 +3,39 @@
|
@@ -3,42 +3,57 @@
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/process/process_metrics.h"
|
#include "base/process/process_metrics.h"
|
||||||
|
@ -18,7 +18,6 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+#include <libutil.h>
|
+#include <libutil.h>
|
||||||
+
|
+
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/process/process_metrics_iocounters.h"
|
|
||||||
+#include "base/values.h"
|
+#include "base/values.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
@ -27,28 +26,28 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+ int pagesize = getpagesize();
|
+ int pagesize = getpagesize();
|
||||||
+ int pageshift = 0;
|
+ int pageshift = 0;
|
||||||
|
|
||||||
|
-ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||||
|
- : process_(process),
|
||||||
|
- last_cpu_(0) {}
|
||||||
+ while (pagesize > 1) {
|
+ while (pagesize > 1) {
|
||||||
+ pageshift++;
|
+ pageshift++;
|
||||||
+ pagesize >>= 1;
|
+ pagesize >>= 1;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ return pageshift;
|
+ return pageshift;
|
||||||
+}
|
+}
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
+ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
|
||||||
- : process_(process),
|
+
|
||||||
- last_cpu_(0) {}
|
|
||||||
+ : process_(process) {}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
|
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
|
||||||
@@ -24,22 +43,19 @@ std::unique_ptr<ProcessMetrics> ProcessMetrics::Create
|
ProcessHandle process) {
|
||||||
return WrapUnique(new ProcessMetrics(process));
|
return WrapUnique(new ProcessMetrics(process));
|
||||||
}
|
}
|
||||||
|
|
||||||
-double ProcessMetrics::GetPlatformIndependentCPUUsage() {
|
-std::optional<double> ProcessMetrics::GetPlatformIndependentCPUUsage() {
|
||||||
+TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
+std::optional<TimeDelta> ProcessMetrics::GetCumulativeCPUUsage() {
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
- int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, process_};
|
- int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, process_};
|
||||||
- size_t length = sizeof(info);
|
- size_t length = sizeof(info);
|
||||||
|
@ -58,22 +57,22 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_ };
|
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_ };
|
||||||
+
|
+
|
||||||
if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
|
if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
|
||||||
- return 0;
|
- return std::nullopt;
|
||||||
+ return TimeDelta();
|
+ return std::optional(TimeDelta());
|
||||||
|
|
||||||
- return (info.ki_pctcpu / FSCALE) * 100.0;
|
- return std::optional(double{info.ki_pctcpu} / FSCALE * 100.0);
|
||||||
+ return Microseconds(info.ki_runtime);
|
+ return std::optional(Microseconds(info.ki_runtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
-TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
-std::optional<TimeDelta> ProcessMetrics::GetCumulativeCPUUsage() {
|
||||||
- NOTREACHED();
|
- NOTREACHED();
|
||||||
- return TimeDelta();
|
- return std::nullopt;
|
||||||
-}
|
-}
|
||||||
-
|
-
|
||||||
bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
|
size_t GetSystemCommitCharge() {
|
||||||
return false;
|
int mib[2], pagesize;
|
||||||
}
|
unsigned long mem_total, mem_free, mem_inactive;
|
||||||
@@ -65,6 +81,230 @@ size_t GetSystemCommitCharge() {
|
@@ -60,6 +75,230 @@ size_t GetSystemCommitCharge() {
|
||||||
pagesize = getpagesize();
|
pagesize = getpagesize();
|
||||||
|
|
||||||
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
||||||
|
@ -172,7 +171,7 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+ kvm_close(kd);
|
+ kvm_close(kd);
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ size_t rss;
|
+ size_t rss;
|
||||||
+
|
+
|
||||||
+ if (nproc > 0) {
|
+ if (nproc > 0) {
|
||||||
|
@ -198,7 +197,7 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+ kvm_close(kd);
|
+ kvm_close(kd);
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ size_t swrss;
|
+ size_t swrss;
|
||||||
+
|
+
|
||||||
+ if (nproc > 0) {
|
+ if (nproc > 0) {
|
||||||
|
@ -248,7 +247,7 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+
|
+
|
||||||
+Value::Dict SystemDiskInfo::ToDict() const {
|
+Value::Dict SystemDiskInfo::ToDict() const {
|
||||||
+ Value::Dict res;
|
+ Value::Dict res;
|
||||||
+
|
+
|
||||||
+ // Write out uint64_t variables as doubles.
|
+ // Write out uint64_t variables as doubles.
|
||||||
+ // Note: this may discard some precision, but for JS there's no other option.
|
+ // Note: this may discard some precision, but for JS there's no other option.
|
||||||
+ res.Set("reads", static_cast<double>(reads));
|
+ res.Set("reads", static_cast<double>(reads));
|
||||||
|
@ -264,7 +263,7 @@ Index: base/process/process_metrics_freebsd.cc
|
||||||
+ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
|
+ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
|
||||||
+
|
+
|
||||||
+ NOTIMPLEMENTED();
|
+ NOTIMPLEMENTED();
|
||||||
+
|
+
|
||||||
+ return res;
|
+ return res;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/process_metrics.h
|
Index: base/process/process_metrics.h
|
||||||
--- base/process/process_metrics.h.orig
|
--- base/process/process_metrics.h.orig
|
||||||
+++ base/process/process_metrics.h
|
+++ base/process/process_metrics.h
|
||||||
@@ -37,7 +37,7 @@
|
@@ -38,7 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
||||||
|
@ -10,16 +10,16 @@ Index: base/process/process_metrics.h
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -50,7 +50,7 @@ namespace base {
|
@@ -48,7 +48,7 @@
|
||||||
// Full declaration is in process_metrics_iocounters.h.
|
|
||||||
struct IoCounters;
|
namespace base {
|
||||||
|
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
|
||||||
// Minor and major page fault counts since the process creation.
|
// Minor and major page fault counts since the process creation.
|
||||||
// Both counts are process-wide, and exclude child processes.
|
// Both counts are process-wide, and exclude child processes.
|
||||||
//
|
//
|
||||||
@@ -105,7 +105,7 @@ class BASE_EXPORT ProcessMetrics {
|
@@ -103,7 +103,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||||
// convenience wrapper for CreateProcessMetrics().
|
// convenience wrapper for CreateProcessMetrics().
|
||||||
static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics();
|
static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics();
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ Index: base/process/process_metrics.h
|
||||||
// Resident Set Size is a Linux/Android specific memory concept. Do not
|
// Resident Set Size is a Linux/Android specific memory concept. Do not
|
||||||
// attempt to extend this to other platforms.
|
// attempt to extend this to other platforms.
|
||||||
BASE_EXPORT size_t GetResidentSetSize() const;
|
BASE_EXPORT size_t GetResidentSetSize() const;
|
||||||
@@ -163,7 +163,7 @@ class BASE_EXPORT ProcessMetrics {
|
@@ -137,7 +137,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||||
#endif // BUILDFLAG(IS_WIN)
|
[[nodiscard]] std::optional<TimeDelta> GetCumulativeCPUUsage();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
||||||
- BUILDFLAG(IS_AIX)
|
- BUILDFLAG(IS_AIX)
|
||||||
|
@ -37,7 +37,7 @@ Index: base/process/process_metrics.h
|
||||||
// Emits the cumulative CPU usage for all currently active threads since they
|
// Emits the cumulative CPU usage for all currently active threads since they
|
||||||
// were started into the output parameter (replacing its current contents).
|
// were started into the output parameter (replacing its current contents).
|
||||||
// Threads that have already terminated will not be reported. Thus, the sum of
|
// Threads that have already terminated will not be reported. Thus, the sum of
|
||||||
@@ -223,7 +223,7 @@ class BASE_EXPORT ProcessMetrics {
|
@@ -182,7 +182,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||||
int GetOpenFdSoftLimit() const;
|
int GetOpenFdSoftLimit() const;
|
||||||
#endif // BUILDFLAG(IS_POSIX)
|
#endif // BUILDFLAG(IS_POSIX)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ Index: base/process/process_metrics.h
|
||||||
// Bytes of swap as reported by /proc/[pid]/status.
|
// Bytes of swap as reported by /proc/[pid]/status.
|
||||||
uint64_t GetVmSwapBytes() const;
|
uint64_t GetVmSwapBytes() const;
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ class BASE_EXPORT ProcessMetrics {
|
@@ -203,7 +203,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||||
#endif // !BUILDFLAG(IS_MAC)
|
#endif // !BUILDFLAG(IS_MAC)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
||||||
|
@ -55,7 +55,7 @@ Index: base/process/process_metrics.h
|
||||||
int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups);
|
int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups);
|
||||||
#endif
|
#endif
|
||||||
#if BUILDFLAG(IS_APPLE)
|
#if BUILDFLAG(IS_APPLE)
|
||||||
@@ -266,9 +266,7 @@ class BASE_EXPORT ProcessMetrics {
|
@@ -225,12 +225,10 @@ class BASE_EXPORT ProcessMetrics {
|
||||||
// Used to store the previous times and CPU usage counts so we can
|
// Used to store the previous times and CPU usage counts so we can
|
||||||
// compute the CPU usage between calls.
|
// compute the CPU usage between calls.
|
||||||
TimeTicks last_cpu_time_;
|
TimeTicks last_cpu_time_;
|
||||||
|
@ -63,18 +63,13 @@ Index: base/process/process_metrics.h
|
||||||
TimeDelta last_cumulative_cpu_;
|
TimeDelta last_cumulative_cpu_;
|
||||||
-#endif
|
-#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
|
||||||
TimeTicks last_cpu_time_for_precise_cpu_usage_;
|
|
||||||
@@ -276,7 +274,7 @@ class BASE_EXPORT ProcessMetrics {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
||||||
- BUILDFLAG(IS_AIX)
|
- BUILDFLAG(IS_AIX)
|
||||||
+ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
|
+ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
|
||||||
// Same thing for idle wakeups.
|
// Same thing for idle wakeups.
|
||||||
TimeTicks last_idle_wakeups_time_;
|
TimeTicks last_idle_wakeups_time_;
|
||||||
uint64_t last_absolute_idle_wakeups_;
|
uint64_t last_absolute_idle_wakeups_;
|
||||||
@@ -316,7 +314,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de
|
@@ -271,7 +269,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
|
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
|
||||||
BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) || \
|
BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) || \
|
||||||
|
@ -83,7 +78,7 @@ Index: base/process/process_metrics.h
|
||||||
// Data about system-wide memory consumption. Values are in KB. Available on
|
// Data about system-wide memory consumption. Values are in KB. Available on
|
||||||
// Windows, Mac, Linux, Android and Chrome OS.
|
// Windows, Mac, Linux, Android and Chrome OS.
|
||||||
//
|
//
|
||||||
@@ -351,7 +349,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
@@ -306,7 +304,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
||||||
|
@ -92,7 +87,7 @@ Index: base/process/process_metrics.h
|
||||||
// This provides an estimate of available memory as described here:
|
// This provides an estimate of available memory as described here:
|
||||||
// https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
|
// 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
|
// NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always
|
||||||
@@ -366,7 +364,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
@@ -321,7 +319,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
||||||
|
@ -101,7 +96,7 @@ Index: base/process/process_metrics.h
|
||||||
int buffers = 0;
|
int buffers = 0;
|
||||||
int cached = 0;
|
int cached = 0;
|
||||||
int active_anon = 0;
|
int active_anon = 0;
|
||||||
@@ -403,7 +401,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK
|
@@ -358,7 +356,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK
|
||||||
// BUILDFLAG(IS_FUCHSIA)
|
// BUILDFLAG(IS_FUCHSIA)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
||||||
|
@ -110,7 +105,7 @@ Index: base/process/process_metrics.h
|
||||||
// Parse the data found in /proc/<pid>/stat and return the sum of the
|
// Parse the data found in /proc/<pid>/stat and return the sum of the
|
||||||
// CPU-related ticks. Returns -1 on parse error.
|
// CPU-related ticks. Returns -1 on parse error.
|
||||||
// Exposed for testing.
|
// Exposed for testing.
|
||||||
@@ -591,7 +589,7 @@ class BASE_EXPORT SystemMetrics {
|
@@ -552,7 +550,7 @@ class BASE_EXPORT SystemMetrics {
|
||||||
FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
|
FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
|
||||||
|
|
||||||
size_t committed_memory_;
|
size_t committed_memory_;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/process_metrics_openbsd.cc
|
Index: base/process/process_metrics_openbsd.cc
|
||||||
--- base/process/process_metrics_openbsd.cc.orig
|
--- base/process/process_metrics_openbsd.cc.orig
|
||||||
+++ base/process/process_metrics_openbsd.cc
|
+++ base/process/process_metrics_openbsd.cc
|
||||||
@@ -6,14 +6,23 @@
|
@@ -6,73 +6,49 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -9,28 +9,21 @@ Index: base/process/process_metrics_openbsd.cc
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
+#include <sys/vmmeter.h>
|
+#include <sys/vmmeter.h>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
+#include <kvm.h>
|
+#include <kvm.h>
|
||||||
+
|
+
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/process/process_metrics_iocounters.h"
|
|
||||||
+#include "base/values.h"
|
+#include "base/values.h"
|
||||||
+#include "base/notreached.h"
|
+#include "base/notreached.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
+ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
-namespace {
|
||||||
+ : process_(process) {}
|
+ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
|
||||||
+
|
|
||||||
// static
|
|
||||||
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
|
|
||||||
ProcessHandle process) {
|
|
||||||
@@ -24,49 +33,23 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int GetProcessCPU(pid_t pid) {
|
-static std::optional<int> GetProcessCPU(pid_t pid) {
|
||||||
+TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
+std::optional<TimeDelta> ProcessMetrics::GetCumulativeCPUUsage() {
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
- size_t length;
|
- size_t length;
|
||||||
- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid,
|
- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid,
|
||||||
|
@ -38,43 +31,55 @@ Index: base/process/process_metrics_openbsd.cc
|
||||||
+ size_t length = sizeof(struct kinfo_proc);
|
+ size_t length = sizeof(struct kinfo_proc);
|
||||||
+ struct timeval tv;
|
+ struct timeval tv;
|
||||||
|
|
||||||
- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
|
- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) {
|
||||||
- return -1;
|
- return std::nullopt;
|
||||||
|
- }
|
||||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_,
|
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_,
|
||||||
+ sizeof(struct kinfo_proc), 1 };
|
+ sizeof(struct kinfo_proc), 1 };
|
||||||
|
|
||||||
- mib[5] = (length / sizeof(struct kinfo_proc));
|
- mib[5] = (length / sizeof(struct kinfo_proc));
|
||||||
-
|
-
|
||||||
if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
|
if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) {
|
||||||
- return 0;
|
- return std::nullopt;
|
||||||
+ return TimeDelta();
|
+ return std::optional(TimeDelta());
|
||||||
|
}
|
||||||
|
|
||||||
- return info.p_pctcpu;
|
- return std::optional(info.p_pctcpu);
|
||||||
-}
|
|
||||||
+ tv.tv_sec = info.p_rtime_sec;
|
+ tv.tv_sec = info.p_rtime_sec;
|
||||||
+ tv.tv_usec = info.p_rtime_usec;
|
+ tv.tv_usec = info.p_rtime_usec;
|
||||||
|
+
|
||||||
|
+ return std::optional(Microseconds(TimeValToMicroseconds(tv)));
|
||||||
|
}
|
||||||
|
|
||||||
-double ProcessMetrics::GetPlatformIndependentCPUUsage() {
|
-} // namespace
|
||||||
|
-
|
||||||
|
// static
|
||||||
|
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
|
||||||
|
ProcessHandle process) {
|
||||||
|
return WrapUnique(new ProcessMetrics(process));
|
||||||
|
}
|
||||||
|
|
||||||
|
-std::optional<double> ProcessMetrics::GetPlatformIndependentCPUUsage() {
|
||||||
- TimeTicks time = TimeTicks::Now();
|
- TimeTicks time = TimeTicks::Now();
|
||||||
-
|
-
|
||||||
- if (last_cpu_time_.is_zero()) {
|
- if (last_cpu_time_.is_zero()) {
|
||||||
- // First call, just set the last values.
|
- // First call, just set the last values.
|
||||||
- last_cpu_time_ = time;
|
- last_cpu_time_ = time;
|
||||||
- return 0;
|
- return std::optional(0.0);
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- int cpu = GetProcessCPU(process_);
|
- const std::optional<int> cpu = GetProcessCPU(process_);
|
||||||
|
- if (!cpu.has_value()) {
|
||||||
|
- return std::nullopt;
|
||||||
|
- }
|
||||||
-
|
-
|
||||||
- last_cpu_time_ = time;
|
- last_cpu_time_ = time;
|
||||||
- double percentage = static_cast<double>((cpu * 100.0) / FSCALE);
|
- return std::optional(double{cpu.value()} / FSCALE * 100.0);
|
||||||
|
-}
|
||||||
-
|
-
|
||||||
- return percentage;
|
-std::optional<TimeDelta> ProcessMetrics::GetCumulativeCPUUsage() {
|
||||||
+ return Microseconds(TimeValToMicroseconds(tv));
|
|
||||||
}
|
|
||||||
|
|
||||||
-TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
|
||||||
- NOTREACHED();
|
- NOTREACHED();
|
||||||
- return TimeDelta();
|
- return std::nullopt;
|
||||||
-}
|
-}
|
||||||
-
|
-
|
||||||
-ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
-ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||||
|
@ -83,9 +88,17 @@ Index: base/process/process_metrics_openbsd.cc
|
||||||
-
|
-
|
||||||
size_t GetSystemCommitCharge() {
|
size_t GetSystemCommitCharge() {
|
||||||
int mib[] = { CTL_VM, VM_METER };
|
int mib[] = { CTL_VM, VM_METER };
|
||||||
int pagesize;
|
- int pagesize;
|
||||||
@@ -84,6 +67,133 @@ size_t GetSystemCommitCharge() {
|
+ size_t pagesize;
|
||||||
pagesize = getpagesize();
|
struct vmtotal vmtotal;
|
||||||
|
unsigned long mem_total, mem_free, mem_inactive;
|
||||||
|
size_t len = sizeof(vmtotal);
|
||||||
|
@@ -84,9 +60,136 @@ size_t GetSystemCommitCharge() {
|
||||||
|
mem_free = vmtotal.t_free;
|
||||||
|
mem_inactive = vmtotal.t_vm - vmtotal.t_avm;
|
||||||
|
|
||||||
|
- pagesize = getpagesize();
|
||||||
|
+ pagesize = checked_cast<size_t>(getpagesize());
|
||||||
|
|
||||||
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
||||||
+}
|
+}
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
Index: base/process/process_metrics_unittest.cc
|
Index: base/process/process_metrics_unittest.cc
|
||||||
--- base/process/process_metrics_unittest.cc.orig
|
--- base/process/process_metrics_unittest.cc.orig
|
||||||
+++ base/process/process_metrics_unittest.cc
|
+++ base/process/process_metrics_unittest.cc
|
||||||
@@ -44,7 +44,7 @@ namespace debug {
|
@@ -56,7 +56,8 @@
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
||||||
BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \
|
BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \
|
||||||
- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
|
- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE)
|
||||||
+ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
|
+ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE) || \
|
||||||
|
+ BUILDFLAG(IS_BSD)
|
||||||
namespace {
|
#define ENABLE_CPU_TESTS 1
|
||||||
|
#else
|
||||||
@@ -347,7 +347,7 @@ TEST_F(SystemMetricsTest, ParseVmstat) {
|
#define ENABLE_CPU_TESTS 0
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
|
|
||||||
BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \
|
|
||||||
- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
|
|
||||||
+ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
|
|
||||||
|
|
||||||
// Test that ProcessMetrics::GetPlatformIndependentCPUUsage() doesn't return
|
|
||||||
// negative values when the number of threads running on the process decreases
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/process/process_unittest.cc
|
Index: base/process/process_unittest.cc
|
||||||
--- base/process/process_unittest.cc.orig
|
--- base/process/process_unittest.cc.orig
|
||||||
+++ base/process/process_unittest.cc
|
+++ base/process/process_unittest.cc
|
||||||
@@ -195,7 +195,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) {
|
@@ -199,7 +199,7 @@ TEST_F(ProcessTest, CreationTimeOtherProcess) {
|
||||||
// was spawned and a time recorded after it was spawned. However, since the
|
// 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.
|
// base::Time and process creation clocks don't match, tolerate some error.
|
||||||
constexpr base::TimeDelta kTolerance =
|
constexpr base::TimeDelta kTolerance =
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/profiler/module_cache.cc
|
Index: base/profiler/module_cache.cc
|
||||||
--- base/profiler/module_cache.cc.orig
|
--- base/profiler/module_cache.cc.orig
|
||||||
+++ base/profiler/module_cache.cc
|
+++ base/profiler/module_cache.cc
|
||||||
@@ -52,7 +52,7 @@ std::string TransformModuleIDToSymbolServerFormat(Stri
|
@@ -38,7 +38,7 @@ std::string TransformModuleIDToSymbolServerFormat(std:
|
||||||
// Android and Linux Chrome builds use the "breakpad" format to index their
|
// Android and Linux Chrome builds use the "breakpad" format to index their
|
||||||
// build id, so we transform the build id for these platforms. All other
|
// build id, so we transform the build id for these platforms. All other
|
||||||
// platforms keep their symbols indexed by the original build ID.
|
// platforms keep their symbols indexed by the original build ID.
|
||||||
|
|
|
@ -16,6 +16,6 @@ Index: base/profiler/sampling_profiler_thread_token.cc
|
||||||
return {id, pthread_self()};
|
return {id, pthread_self()};
|
||||||
-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
+#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
+#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
||||||
absl::optional<uintptr_t> maybe_stack_base =
|
std::optional<uintptr_t> maybe_stack_base =
|
||||||
GetThreadStackBaseAddress(id, pthread_self());
|
GetThreadStackBaseAddress(id, pthread_self());
|
||||||
return {id, maybe_stack_base};
|
return {id, maybe_stack_base};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/profiler/sampling_profiler_thread_token.h
|
Index: base/profiler/sampling_profiler_thread_token.h
|
||||||
--- base/profiler/sampling_profiler_thread_token.h.orig
|
--- base/profiler/sampling_profiler_thread_token.h.orig
|
||||||
+++ base/profiler/sampling_profiler_thread_token.h
|
+++ base/profiler/sampling_profiler_thread_token.h
|
||||||
@@ -12,7 +12,7 @@
|
@@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#if BUILDFLAG(IS_ANDROID)
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -10,7 +10,7 @@ Index: base/profiler/sampling_profiler_thread_token.h
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ struct SamplingProfilerThreadToken {
|
@@ -27,7 +27,7 @@ struct SamplingProfilerThreadToken {
|
||||||
PlatformThreadId id;
|
PlatformThreadId id;
|
||||||
#if BUILDFLAG(IS_ANDROID)
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
pthread_t pthread_id;
|
pthread_t pthread_id;
|
||||||
|
|
|
@ -12,7 +12,7 @@ Index: base/profiler/stack_base_address_posix.cc
|
||||||
#if BUILDFLAG(IS_CHROMEOS)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
extern "C" void* __libc_stack_end;
|
extern "C" void* __libc_stack_end;
|
||||||
#endif
|
#endif
|
||||||
@@ -45,7 +49,21 @@ absl::optional<uintptr_t> GetAndroidMainThreadStackBas
|
@@ -45,7 +49,21 @@ std::optional<uintptr_t> GetAndroidMainThreadStackBase
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_LINUX)
|
#if !BUILDFLAG(IS_LINUX)
|
||||||
uintptr_t GetThreadStackBaseAddressImpl(pthread_t pthread_id) {
|
uintptr_t GetThreadStackBaseAddressImpl(pthread_t pthread_id) {
|
||||||
|
@ -49,3 +49,12 @@ Index: base/profiler/stack_base_address_posix.cc
|
||||||
const uintptr_t base_address = reinterpret_cast<uintptr_t>(address) + size;
|
const uintptr_t base_address = reinterpret_cast<uintptr_t>(address) + size;
|
||||||
return base_address;
|
return base_address;
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +100,7 @@ std::optional<uintptr_t> GetThreadStackBaseAddress(Pla
|
||||||
|
// trying to work around the problem.
|
||||||
|
return std::nullopt;
|
||||||
|
#else
|
||||||
|
- const bool is_main_thread = id == GetCurrentProcId();
|
||||||
|
+ const bool is_main_thread = id == checked_cast<PlatformThreadId>(GetCurrentProcId());
|
||||||
|
if (is_main_thread) {
|
||||||
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
|
// The implementation of pthread_getattr_np() in Bionic reads proc/self/maps
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/profiler/stack_sampling_profiler_test_util.cc
|
Index: base/profiler/stack_sampling_profiler_test_util.cc
|
||||||
--- base/profiler/stack_sampling_profiler_test_util.cc.orig
|
--- base/profiler/stack_sampling_profiler_test_util.cc.orig
|
||||||
+++ base/profiler/stack_sampling_profiler_test_util.cc
|
+++ base/profiler/stack_sampling_profiler_test_util.cc
|
||||||
@@ -36,7 +36,7 @@
|
@@ -37,7 +37,7 @@
|
||||||
// Fortunately, it provides _alloca, which functions identically.
|
// Fortunately, it provides _alloca, which functions identically.
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#define alloca _alloca
|
#define alloca _alloca
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/profiler/stack_sampling_profiler_unittest.cc
|
Index: base/profiler/stack_sampling_profiler_unittest.cc
|
||||||
--- base/profiler/stack_sampling_profiler_unittest.cc.orig
|
--- base/profiler/stack_sampling_profiler_unittest.cc.orig
|
||||||
+++ base/profiler/stack_sampling_profiler_unittest.cc
|
+++ base/profiler/stack_sampling_profiler_unittest.cc
|
||||||
@@ -41,7 +41,7 @@
|
@@ -42,7 +42,7 @@
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
Index: base/profiler/thread_delegate_posix.cc
|
Index: base/profiler/thread_delegate_posix.cc
|
||||||
--- base/profiler/thread_delegate_posix.cc.orig
|
--- base/profiler/thread_delegate_posix.cc.orig
|
||||||
+++ base/profiler/thread_delegate_posix.cc
|
+++ base/profiler/thread_delegate_posix.cc
|
||||||
@@ -13,7 +13,7 @@
|
@@ -14,7 +14,7 @@
|
||||||
|
#include "base/process/process_handle.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
|
-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
|
||||||
+#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
|
+#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
|
||||||
#include "base/profiler/stack_base_address_posix.h"
|
#include "base/profiler/stack_base_address_posix.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ namespace base {
|
@@ -23,7 +23,7 @@ namespace base {
|
||||||
std::unique_ptr<ThreadDelegatePosix> ThreadDelegatePosix::Create(
|
std::unique_ptr<ThreadDelegatePosix> ThreadDelegatePosix::Create(
|
||||||
SamplingProfilerThreadToken thread_token) {
|
SamplingProfilerThreadToken thread_token) {
|
||||||
absl::optional<uintptr_t> base_address;
|
std::optional<uintptr_t> base_address;
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
||||||
base_address = thread_token.stack_base_address;
|
base_address = thread_token.stack_base_address;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/rand_util.h
|
Index: base/rand_util.h
|
||||||
--- base/rand_util.h.orig
|
--- base/rand_util.h.orig
|
||||||
+++ base/rand_util.h
|
+++ base/rand_util.h
|
||||||
@@ -121,7 +121,7 @@ void RandomShuffle(Itr first, Itr last) {
|
@@ -149,7 +149,7 @@ void RandomShuffle(Itr first, Itr last) {
|
||||||
std::shuffle(first, last, RandomBitGenerator());
|
std::shuffle(first, last, RandomBitGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/rand_util_posix.cc
|
Index: base/rand_util_posix.cc
|
||||||
--- base/rand_util_posix.cc.orig
|
--- base/rand_util_posix.cc.orig
|
||||||
+++ base/rand_util_posix.cc
|
+++ base/rand_util_posix.cc
|
||||||
@@ -22,7 +22,7 @@
|
@@ -23,7 +23,7 @@
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@ Index: base/rand_util_posix.cc
|
||||||
#include "third_party/lss/linux_syscall_support.h"
|
#include "third_party/lss/linux_syscall_support.h"
|
||||||
#elif BUILDFLAG(IS_MAC)
|
#elif BUILDFLAG(IS_MAC)
|
||||||
// TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK.
|
// TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK.
|
||||||
@@ -46,6 +46,7 @@ static constexpr int kOpenFlags = O_RDONLY;
|
@@ -40,6 +40,7 @@ namespace base {
|
||||||
static constexpr int kOpenFlags = O_RDONLY | O_CLOEXEC;
|
|
||||||
#endif
|
namespace {
|
||||||
|
|
||||||
+#if !BUILDFLAG(IS_BSD)
|
+#if !BUILDFLAG(IS_BSD)
|
||||||
// We keep the file descriptor for /dev/urandom around so we don't need to
|
#if BUILDFLAG(IS_AIX)
|
||||||
// reopen it (which is expensive), and since we may not even be able to reopen
|
// AIX has no 64-bit support for O_CLOEXEC.
|
||||||
// it if we are later put in a sandbox. This class wraps the file descriptor so
|
static constexpr int kOpenFlags = O_RDONLY;
|
||||||
@@ -63,10 +64,11 @@ class URandomFd {
|
@@ -64,10 +65,11 @@ class URandomFd {
|
||||||
private:
|
private:
|
||||||
const int fd_;
|
const int fd_;
|
||||||
};
|
};
|
||||||
|
@ -31,26 +31,26 @@ Index: base/rand_util_posix.cc
|
||||||
// TODO(pasko): Unify reading kernel version numbers in:
|
// TODO(pasko): Unify reading kernel version numbers in:
|
||||||
// mojo/core/channel_linux.cc
|
// mojo/core/channel_linux.cc
|
||||||
// chrome/browser/android/seccomp_support_detector.cc
|
// chrome/browser/android/seccomp_support_detector.cc
|
||||||
@@ -176,6 +178,7 @@ bool UseBoringSSLForRandBytes() {
|
@@ -177,6 +179,7 @@ bool UseBoringSSLForRandBytes() {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void RandBytes(void* output, size_t output_length, bool avoid_allocation) {
|
void RandBytes(span<uint8_t> output, bool avoid_allocation) {
|
||||||
+#if !BUILDFLAG(IS_BSD)
|
+#if !BUILDFLAG(IS_BSD)
|
||||||
#if !BUILDFLAG(IS_NACL)
|
#if !BUILDFLAG(IS_NACL)
|
||||||
// The BoringSSL experiment takes priority over everything else.
|
// The BoringSSL experiment takes priority over everything else.
|
||||||
if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) {
|
if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) {
|
||||||
@@ -214,6 +217,9 @@ void RandBytes(void* output, size_t output_length, boo
|
@@ -215,6 +218,9 @@ void RandBytes(span<uint8_t> output, bool avoid_alloca
|
||||||
const bool success =
|
const int urandom_fd = GetUrandomFD();
|
||||||
ReadFromFD(urandom_fd, static_cast<char*>(output), output_length);
|
const bool success = ReadFromFD(urandom_fd, as_writable_chars(output));
|
||||||
CHECK(success);
|
CHECK(success);
|
||||||
+#else
|
+#else
|
||||||
+ arc4random_buf(static_cast<char*>(output), output_length);
|
+ arc4random_buf(output.data(), output.size());
|
||||||
+#endif
|
+#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -233,9 +239,11 @@ void RandBytes(void* output, size_t output_length) {
|
@@ -239,9 +245,11 @@ void RandBytes(void* output, size_t output_length) {
|
||||||
RandBytes(output, output_length, /*avoid_allocation=*/false);
|
RandBytes(make_span(static_cast<uint8_t*>(output), output_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
+#if !BUILDFLAG(IS_BSD)
|
+#if !BUILDFLAG(IS_BSD)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/synchronization/lock_impl.h
|
Index: base/synchronization/lock_impl.h
|
||||||
--- base/synchronization/lock_impl.h.orig
|
--- base/synchronization/lock_impl.h.orig
|
||||||
+++ base/synchronization/lock_impl.h
|
+++ base/synchronization/lock_impl.h
|
||||||
@@ -104,6 +104,10 @@ void LockImpl::Unlock() {
|
@@ -107,6 +107,10 @@ void LockImpl::Unlock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
|
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
|
||||||
|
@ -12,7 +12,7 @@ Index: base/synchronization/lock_impl.h
|
||||||
|
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
BASE_EXPORT void dcheck_trylock_result(int rv);
|
BASE_EXPORT void dcheck_trylock_result(int rv);
|
||||||
@@ -124,6 +128,9 @@ void LockImpl::Unlock() {
|
@@ -127,6 +131,9 @@ void LockImpl::Unlock() {
|
||||||
dcheck_unlock_result(rv);
|
dcheck_unlock_result(rv);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/syslog_logging.cc
|
Index: base/syslog_logging.cc
|
||||||
--- base/syslog_logging.cc.orig
|
--- base/syslog_logging.cc.orig
|
||||||
+++ base/syslog_logging.cc
|
+++ base/syslog_logging.cc
|
||||||
@@ -15,7 +15,7 @@
|
@@ -17,7 +17,7 @@
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/win/scoped_handle.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/win_util.h"
|
#include "base/win/win_util.h"
|
||||||
|
@ -10,7 +10,7 @@ Index: base/syslog_logging.cc
|
||||||
// <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
|
// <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
|
||||||
// base::LOG_INFO, base::LOG_WARNING.
|
// base::LOG_INFO, base::LOG_WARNING.
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
@@ -147,7 +147,7 @@ EventLogMessage::~EventLogMessage() {
|
@@ -149,7 +149,7 @@ EventLogMessage::~EventLogMessage() {
|
||||||
|
|
||||||
if (user_sid != nullptr)
|
if (user_sid != nullptr)
|
||||||
::LocalFree(user_sid);
|
::LocalFree(user_sid);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/system/sys_info.cc
|
Index: base/system/sys_info.cc
|
||||||
--- base/system/sys_info.cc.orig
|
--- base/system/sys_info.cc.orig
|
||||||
+++ base/system/sys_info.cc
|
+++ base/system/sys_info.cc
|
||||||
@@ -166,7 +166,7 @@ std::string SysInfo::HardwareModelName() {
|
@@ -225,7 +225,7 @@ std::string SysInfo::HardwareModelName() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SysInfo::GetHardwareInfo(base::OnceCallback<void(HardwareInfo)> callback) {
|
void SysInfo::GetHardwareInfo(base::OnceCallback<void(HardwareInfo)> callback) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/system/sys_info.h
|
Index: base/system/sys_info.h
|
||||||
--- base/system/sys_info.h.orig
|
--- base/system/sys_info.h.orig
|
||||||
+++ base/system/sys_info.h
|
+++ base/system/sys_info.h
|
||||||
@@ -264,6 +264,8 @@ class BASE_EXPORT SysInfo {
|
@@ -322,6 +322,8 @@ class BASE_EXPORT SysInfo {
|
||||||
static void ResetCpuSecurityMitigationsEnabledForTesting();
|
static void ResetCpuSecurityMitigationsEnabledForTesting();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Index: base/system/sys_info.h
|
||||||
private:
|
private:
|
||||||
friend class test::ScopedAmountOfPhysicalMemoryOverride;
|
friend class test::ScopedAmountOfPhysicalMemoryOverride;
|
||||||
FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
|
FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
|
||||||
@@ -276,7 +278,7 @@ class BASE_EXPORT SysInfo {
|
@@ -334,7 +336,7 @@ class BASE_EXPORT SysInfo {
|
||||||
static HardwareInfo GetHardwareInfoSync();
|
static HardwareInfo GetHardwareInfoSync();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
|
||||||
|
|
|
@ -1,22 +1,29 @@
|
||||||
Index: base/system/sys_info_openbsd.cc
|
Index: base/system/sys_info_openbsd.cc
|
||||||
--- base/system/sys_info_openbsd.cc.orig
|
--- base/system/sys_info_openbsd.cc.orig
|
||||||
+++ base/system/sys_info_openbsd.cc
|
+++ base/system/sys_info_openbsd.cc
|
||||||
@@ -11,6 +11,7 @@
|
@@ -3,7 +3,6 @@
|
||||||
#include <sys/sysctl.h>
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "base/system/sys_info.h"
|
||||||
|
-
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
@@ -12,6 +11,7 @@
|
||||||
|
|
||||||
#include "base/notreached.h"
|
#include "base/notreached.h"
|
||||||
|
#include "base/posix/sysctl.h"
|
||||||
+#include "base/strings/string_util.h"
|
+#include "base/strings/string_util.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -26,9 +27,15 @@ uint64_t AmountOfMemory(int pages_name) {
|
@@ -27,9 +27,14 @@ uint64_t AmountOfMemory(int pages_name) {
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
+// pledge(2)
|
+// pledge(2)
|
||||||
+int64_t aofpmem = 0;
|
+uint64_t aofpmem = 0;
|
||||||
+int64_t aofapmem = 0;
|
+uint64_t shmmax = 0;
|
||||||
+int64_t shmmax = 0;
|
|
||||||
+char cpumodel[256];
|
+char cpumodel[256];
|
||||||
+
|
+
|
||||||
// static
|
// static
|
||||||
|
@ -26,7 +33,7 @@ Index: base/system/sys_info_openbsd.cc
|
||||||
int ncpu;
|
int ncpu;
|
||||||
size_t size = sizeof(ncpu);
|
size_t size = sizeof(ncpu);
|
||||||
if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
|
if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
|
||||||
@@ -40,10 +47,26 @@ int SysInfo::NumberOfProcessors() {
|
@@ -41,10 +46,26 @@ int SysInfo::NumberOfProcessors() {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
|
uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
|
||||||
|
@ -54,7 +61,7 @@ Index: base/system/sys_info_openbsd.cc
|
||||||
uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
|
uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
|
||||||
// We should add inactive file-backed memory also but there is no such
|
// We should add inactive file-backed memory also but there is no such
|
||||||
// information from OpenBSD unfortunately.
|
// information from OpenBSD unfortunately.
|
||||||
@@ -55,23 +78,28 @@ uint64_t SysInfo::MaxSharedMemorySize() {
|
@@ -56,16 +77,28 @@ uint64_t SysInfo::MaxSharedMemorySize() {
|
||||||
int mib[] = {CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX};
|
int mib[] = {CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX};
|
||||||
size_t limit;
|
size_t limit;
|
||||||
size_t size = sizeof(limit);
|
size_t size = sizeof(limit);
|
||||||
|
@ -73,14 +80,7 @@ Index: base/system/sys_info_openbsd.cc
|
||||||
|
|
||||||
// static
|
// static
|
||||||
-std::string SysInfo::CPUModelName() {
|
-std::string SysInfo::CPUModelName() {
|
||||||
- int mib[] = {CTL_HW, HW_MODEL};
|
- return StringSysctl({CTL_HW, HW_MODEL}).value();
|
||||||
- char name[256];
|
|
||||||
- size_t len = std::size(name);
|
|
||||||
- if (sysctl(mib, std::size(mib), name, &len, NULL, 0) < 0) {
|
|
||||||
- NOTREACHED();
|
|
||||||
- return std::string();
|
|
||||||
- }
|
|
||||||
- return name;
|
|
||||||
+SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
|
+SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
|
||||||
+ HardwareInfo info;
|
+ HardwareInfo info;
|
||||||
+ // Set the manufacturer to "OpenBSD" and the model to
|
+ // Set the manufacturer to "OpenBSD" and the model to
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
Index: base/system/sys_info_posix.cc
|
Index: base/system/sys_info_posix.cc
|
||||||
--- base/system/sys_info_posix.cc.orig
|
--- base/system/sys_info_posix.cc.orig
|
||||||
+++ base/system/sys_info_posix.cc
|
+++ base/system/sys_info_posix.cc
|
||||||
@@ -117,7 +117,7 @@ bool GetDiskSpaceInfo(const base::FilePath& path,
|
@@ -118,7 +118,7 @@ bool GetDiskSpaceInfo(const base::FilePath& path,
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
-#if !BUILDFLAG(IS_OPENBSD)
|
-#if !BUILDFLAG(IS_OPENBSD)
|
||||||
+#if !BUILDFLAG(IS_BSD)
|
+#if !BUILDFLAG(IS_BSD)
|
||||||
|
// static
|
||||||
int SysInfo::NumberOfProcessors() {
|
int SysInfo::NumberOfProcessors() {
|
||||||
#if BUILDFLAG(IS_MAC)
|
#if BUILDFLAG(IS_MAC)
|
||||||
absl::optional<int> number_of_physical_cores =
|
@@ -175,7 +175,7 @@ int SysInfo::NumberOfProcessors() {
|
||||||
@@ -161,7 +161,7 @@ int SysInfo::NumberOfProcessors() {
|
|
||||||
|
|
||||||
return num_cpus;
|
return cached_num_cpus;
|
||||||
}
|
}
|
||||||
-#endif // !BUILDFLAG(IS_OPENBSD)
|
-#endif // !BUILDFLAG(IS_OPENBSD)
|
||||||
+#endif // !BUILDFLAG(IS_BSD)
|
+#endif // !BUILDFLAG(IS_BSD)
|
||||||
|
|
||||||
// static
|
// static
|
||||||
uint64_t SysInfo::AmountOfVirtualMemory() {
|
uint64_t SysInfo::AmountOfVirtualMemory() {
|
||||||
@@ -251,6 +251,8 @@ std::string SysInfo::OperatingSystemArchitecture() {
|
@@ -265,6 +265,8 @@ std::string SysInfo::OperatingSystemArchitecture() {
|
||||||
arch = "x86";
|
arch = "x86";
|
||||||
} else if (arch == "amd64") {
|
} else if (arch == "amd64") {
|
||||||
arch = "x86_64";
|
arch = "x86_64";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/system/sys_info_unittest.cc
|
Index: base/system/sys_info_unittest.cc
|
||||||
--- base/system/sys_info_unittest.cc.orig
|
--- base/system/sys_info_unittest.cc.orig
|
||||||
+++ base/system/sys_info_unittest.cc
|
+++ base/system/sys_info_unittest.cc
|
||||||
@@ -263,12 +263,16 @@ TEST_F(SysInfoTest, GetHardwareInfo) {
|
@@ -264,12 +264,16 @@ TEST_F(SysInfoTest, GetHardwareInfo) {
|
||||||
EXPECT_TRUE(IsStringUTF8(hardware_info->model));
|
EXPECT_TRUE(IsStringUTF8(hardware_info->model));
|
||||||
bool empty_result_expected =
|
bool empty_result_expected =
|
||||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || \
|
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || \
|
||||||
|
|
|
@ -2,7 +2,7 @@ Index: base/test/launcher/test_launcher.cc
|
||||||
--- base/test/launcher/test_launcher.cc.orig
|
--- base/test/launcher/test_launcher.cc.orig
|
||||||
+++ base/test/launcher/test_launcher.cc
|
+++ base/test/launcher/test_launcher.cc
|
||||||
@@ -69,6 +69,7 @@
|
@@ -69,6 +69,7 @@
|
||||||
#include "third_party/libxml/chromium/libxml_utils.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
#if BUILDFLAG(IS_POSIX)
|
#if BUILDFLAG(IS_POSIX)
|
||||||
+#include <signal.h>
|
+#include <signal.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/test/test_file_util_posix.cc
|
Index: base/test/test_file_util_posix.cc
|
||||||
--- base/test/test_file_util_posix.cc.orig
|
--- base/test/test_file_util_posix.cc.orig
|
||||||
+++ base/test/test_file_util_posix.cc
|
+++ base/test/test_file_util_posix.cc
|
||||||
@@ -88,7 +88,7 @@ void SyncPageCacheToDisk() {
|
@@ -89,7 +89,7 @@ void SyncPageCacheToDisk() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_APPLE) && \
|
#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_APPLE) && \
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/threading/hang_watcher.cc
|
||||||
|
--- base/threading/hang_watcher.cc.orig
|
||||||
|
+++ base/threading/hang_watcher.cc
|
||||||
|
@@ -332,7 +332,7 @@ void HangWatcher::InitializeOnMainThread(ProcessType p
|
||||||
|
|
||||||
|
bool enable_hang_watcher = base::FeatureList::IsEnabled(kEnableHangWatcher);
|
||||||
|
|
||||||
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
|
+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
|
||||||
|
if (is_zygote_child) {
|
||||||
|
enable_hang_watcher =
|
||||||
|
enable_hang_watcher &&
|
|
@ -21,9 +21,9 @@ Index: base/threading/platform_thread_bsd.cc
|
||||||
+ return false;
|
+ return false;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+absl::optional<ThreadPriorityForTest>
|
+std::optional<ThreadPriorityForTest>
|
||||||
+GetCurrentThreadPriorityForPlatformForTest() {
|
+GetCurrentThreadPriorityForPlatformForTest() {
|
||||||
+ return absl::nullopt;
|
+ return std::nullopt;
|
||||||
+}
|
+}
|
||||||
+} // namespace internal
|
+} // namespace internal
|
||||||
+
|
+
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: base/threading/platform_thread.h
|
||||||
|
--- base/threading/platform_thread.h.orig
|
||||||
|
+++ base/threading/platform_thread.h
|
||||||
|
@@ -46,6 +46,8 @@ typedef DWORD PlatformThreadId;
|
||||||
|
typedef zx_koid_t PlatformThreadId;
|
||||||
|
#elif BUILDFLAG(IS_APPLE)
|
||||||
|
typedef mach_port_t PlatformThreadId;
|
||||||
|
+#elif BUILDFLAG(IS_BSD)
|
||||||
|
+typedef uint64_t PlatformThreadId;
|
||||||
|
#elif BUILDFLAG(IS_POSIX)
|
||||||
|
typedef pid_t PlatformThreadId;
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/threading/platform_thread_internal_posix.cc
|
Index: base/threading/platform_thread_internal_posix.cc
|
||||||
--- base/threading/platform_thread_internal_posix.cc.orig
|
--- base/threading/platform_thread_internal_posix.cc.orig
|
||||||
+++ base/threading/platform_thread_internal_posix.cc
|
+++ base/threading/platform_thread_internal_posix.cc
|
||||||
@@ -41,7 +41,7 @@ ThreadPriorityForTest NiceValueToThreadPriorityForTest
|
@@ -42,7 +42,7 @@ ThreadPriorityForTest NiceValueToThreadPriorityForTest
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetCurrentThreadNiceValue() {
|
int GetCurrentThreadNiceValue() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/threading/platform_thread_posix.cc
|
Index: base/threading/platform_thread_posix.cc
|
||||||
--- base/threading/platform_thread_posix.cc.orig
|
--- base/threading/platform_thread_posix.cc.orig
|
||||||
+++ base/threading/platform_thread_posix.cc
|
+++ base/threading/platform_thread_posix.cc
|
||||||
@@ -76,12 +76,12 @@ void* ThreadFunc(void* params) {
|
@@ -78,12 +78,12 @@ void* ThreadFunc(void* params) {
|
||||||
if (!thread_params->joinable)
|
if (!thread_params->joinable)
|
||||||
base::DisallowSingleton();
|
base::DisallowSingleton();
|
||||||
|
|
||||||
|
@ -16,7 +16,16 @@ Index: base/threading/platform_thread_posix.cc
|
||||||
#if BUILDFLAG(IS_APPLE)
|
#if BUILDFLAG(IS_APPLE)
|
||||||
PlatformThread::SetCurrentThreadRealtimePeriodValue(
|
PlatformThread::SetCurrentThreadRealtimePeriodValue(
|
||||||
delegate->GetRealtimePeriod());
|
delegate->GetRealtimePeriod());
|
||||||
@@ -353,7 +353,7 @@ void PlatformThreadBase::Detach(PlatformThreadHandle t
|
@@ -267,6 +267,8 @@ PlatformThreadId PlatformThreadBase::CurrentId() {
|
||||||
|
return reinterpret_cast<int32_t>(pthread_self());
|
||||||
|
#elif BUILDFLAG(IS_POSIX) && BUILDFLAG(IS_AIX)
|
||||||
|
return pthread_self();
|
||||||
|
+#elif BUILDFLAG(IS_BSD)
|
||||||
|
+ return reinterpret_cast<uint64_t>(pthread_self());
|
||||||
|
#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_AIX)
|
||||||
|
return reinterpret_cast<int64_t>(pthread_self());
|
||||||
|
#endif
|
||||||
|
@@ -357,7 +359,7 @@ void PlatformThreadBase::Detach(PlatformThreadHandle t
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool PlatformThreadBase::CanChangeThreadType(ThreadType from, ThreadType to) {
|
bool PlatformThreadBase::CanChangeThreadType(ThreadType from, ThreadType to) {
|
||||||
|
@ -25,7 +34,7 @@ Index: base/threading/platform_thread_posix.cc
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if (from >= to) {
|
if (from >= to) {
|
||||||
@@ -374,6 +374,9 @@ void SetCurrentThreadTypeImpl(ThreadType thread_type,
|
@@ -378,6 +380,9 @@ void SetCurrentThreadTypeImpl(ThreadType thread_type,
|
||||||
MessagePumpType pump_type_hint) {
|
MessagePumpType pump_type_hint) {
|
||||||
#if BUILDFLAG(IS_NACL)
|
#if BUILDFLAG(IS_NACL)
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
|
@ -35,7 +44,7 @@ Index: base/threading/platform_thread_posix.cc
|
||||||
#else
|
#else
|
||||||
if (internal::SetCurrentThreadTypeForPlatform(thread_type, pump_type_hint))
|
if (internal::SetCurrentThreadTypeForPlatform(thread_type, pump_type_hint))
|
||||||
return;
|
return;
|
||||||
@@ -396,7 +399,7 @@ void SetCurrentThreadTypeImpl(ThreadType thread_type,
|
@@ -400,7 +405,7 @@ void SetCurrentThreadTypeImpl(ThreadType thread_type,
|
||||||
|
|
||||||
// static
|
// static
|
||||||
ThreadPriorityForTest PlatformThreadBase::GetCurrentThreadPriorityForTest() {
|
ThreadPriorityForTest PlatformThreadBase::GetCurrentThreadPriorityForTest() {
|
||||||
|
|
|
@ -17,9 +17,9 @@ Index: base/threading/platform_thread_unittest.cc
|
||||||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||||
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
||||||
// On Ubuntu, RLIMIT_NICE and RLIMIT_RTPRIO are 0 by default, so we won't be
|
// On Ubuntu, RLIMIT_NICE and RLIMIT_RTPRIO are 0 by default, so we won't be
|
||||||
// able to increase priority to any level.
|
// able to increase priority to any level unless we are root (euid == 0).
|
||||||
constexpr bool kCanIncreasePriority = false;
|
bool kCanIncreasePriority = false;
|
||||||
@@ -695,12 +695,16 @@ INSTANTIATE_TEST_SUITE_P(
|
@@ -706,12 +706,16 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
|
|
||||||
#endif // BUILDFLAG(IS_APPLE)
|
#endif // BUILDFLAG(IS_APPLE)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/trace_event/malloc_dump_provider.cc
|
Index: base/trace_event/malloc_dump_provider.cc
|
||||||
--- base/trace_event/malloc_dump_provider.cc.orig
|
--- base/trace_event/malloc_dump_provider.cc.orig
|
||||||
+++ base/trace_event/malloc_dump_provider.cc
|
+++ base/trace_event/malloc_dump_provider.cc
|
||||||
@@ -25,6 +25,8 @@
|
@@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#if BUILDFLAG(IS_APPLE)
|
#if BUILDFLAG(IS_APPLE)
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
|
@ -10,7 +10,7 @@ Index: base/trace_event/malloc_dump_provider.cc
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -188,7 +190,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size,
|
@@ -181,7 +183,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size,
|
||||||
|
|
||||||
#if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
|
#if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
|
||||||
(!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
|
(!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
|
||||||
|
@ -19,7 +19,7 @@ Index: base/trace_event/malloc_dump_provider.cc
|
||||||
void ReportMallinfoStats(ProcessMemoryDump* pmd,
|
void ReportMallinfoStats(ProcessMemoryDump* pmd,
|
||||||
size_t* total_virtual_size,
|
size_t* total_virtual_size,
|
||||||
size_t* resident_size,
|
size_t* resident_size,
|
||||||
@@ -359,6 +361,9 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDump
|
@@ -366,6 +368,9 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDump
|
||||||
&allocated_objects_count);
|
&allocated_objects_count);
|
||||||
#elif BUILDFLAG(IS_FUCHSIA)
|
#elif BUILDFLAG(IS_FUCHSIA)
|
||||||
// TODO(fuchsia): Port, see https://crbug.com/706592.
|
// TODO(fuchsia): Port, see https://crbug.com/706592.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: base/trace_event/process_memory_dump.cc
|
Index: base/trace_event/process_memory_dump.cc
|
||||||
--- base/trace_event/process_memory_dump.cc.orig
|
--- base/trace_event/process_memory_dump.cc.orig
|
||||||
+++ base/trace_event/process_memory_dump.cc
|
+++ base/trace_event/process_memory_dump.cc
|
||||||
@@ -112,7 +112,7 @@ absl::optional<size_t> ProcessMemoryDump::CountResiden
|
@@ -113,7 +113,7 @@ std::optional<size_t> ProcessMemoryDump::CountResident
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
std::unique_ptr<PSAPI_WORKING_SET_EX_INFORMATION[]> vec(
|
std::unique_ptr<PSAPI_WORKING_SET_EX_INFORMATION[]> vec(
|
||||||
new PSAPI_WORKING_SET_EX_INFORMATION[max_vec_size]);
|
new PSAPI_WORKING_SET_EX_INFORMATION[max_vec_size]);
|
||||||
|
@ -10,7 +10,7 @@ Index: base/trace_event/process_memory_dump.cc
|
||||||
std::unique_ptr<char[]> vec(new char[max_vec_size]);
|
std::unique_ptr<char[]> vec(new char[max_vec_size]);
|
||||||
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
|
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
|
||||||
std::unique_ptr<unsigned char[]> vec(new unsigned char[max_vec_size]);
|
std::unique_ptr<unsigned char[]> vec(new unsigned char[max_vec_size]);
|
||||||
@@ -134,7 +134,7 @@ absl::optional<size_t> ProcessMemoryDump::CountResiden
|
@@ -135,7 +135,7 @@ std::optional<size_t> ProcessMemoryDump::CountResident
|
||||||
|
|
||||||
for (size_t i = 0; i < page_count; i++)
|
for (size_t i = 0; i < page_count; i++)
|
||||||
resident_page_count += vec[i].VirtualAttributes.Valid;
|
resident_page_count += vec[i].VirtualAttributes.Valid;
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
Index: base/trace_event/trace_log.cc
|
|
||||||
--- base/trace_event/trace_log.cc.orig
|
|
||||||
+++ base/trace_event/trace_log.cc
|
|
||||||
@@ -2187,8 +2187,13 @@ void TraceLog::SetTraceBufferForTesting(
|
|
||||||
#if BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
|
|
||||||
void TraceLog::OnSetup(const perfetto::DataSourceBase::SetupArgs& args) {
|
|
||||||
AutoLock lock(track_event_lock_);
|
|
||||||
+#if defined(__clang__) && (__clang_major__ >= 16)
|
|
||||||
track_event_sessions_.emplace_back(args.internal_instance_index, *args.config,
|
|
||||||
args.backend_type);
|
|
||||||
+#else
|
|
||||||
+ track_event_sessions_.emplace_back(TrackEventSession{args.internal_instance_index, *args.config,
|
|
||||||
+ args.backend_type});
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void TraceLog::OnStart(const perfetto::DataSourceBase::StartArgs&) {
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: build/config/clang/BUILD.gn
|
||||||
|
--- build/config/clang/BUILD.gn.orig
|
||||||
|
+++ build/config/clang/BUILD.gn
|
||||||
|
@@ -203,7 +203,7 @@ template("clang_lib") {
|
||||||
|
|
||||||
|
# Adds a dependency on the Clang runtime library clang_rt.builtins.
|
||||||
|
clang_lib("compiler_builtins") {
|
||||||
|
- if (!toolchain_has_rust) {
|
||||||
|
+ if (!toolchain_has_rust || is_bsd) {
|
||||||
|
# Since there's no Rust in the toolchain, there's no concern that we'll use
|
||||||
|
# the Rust stdlib's intrinsics here.
|
||||||
|
#
|
|
@ -1,7 +1,16 @@
|
||||||
Index: build/config/compiler/BUILD.gn
|
Index: build/config/compiler/BUILD.gn
|
||||||
--- build/config/compiler/BUILD.gn.orig
|
--- build/config/compiler/BUILD.gn.orig
|
||||||
+++ build/config/compiler/BUILD.gn
|
+++ build/config/compiler/BUILD.gn
|
||||||
@@ -248,13 +248,16 @@ config("default_include_dirs") {
|
@@ -204,7 +204,7 @@ declare_args() {
|
||||||
|
# This greatly reduces the size of debug builds, at the cost of
|
||||||
|
# debugging information which is required by some specialized
|
||||||
|
# debugging tools.
|
||||||
|
- simple_template_names = is_clang && !is_nacl && !is_win && !is_apple
|
||||||
|
+ simple_template_names = is_clang && !is_nacl && !is_win && !is_apple && !is_bsd
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_args() {
|
||||||
|
@@ -268,13 +268,16 @@ config("default_include_dirs") {
|
||||||
# Compiler instrumentation can introduce dependencies in DSOs to symbols in
|
# Compiler instrumentation can introduce dependencies in DSOs to symbols in
|
||||||
# the executable they are loaded into, so they are unresolved at link-time.
|
# the executable they are loaded into, so they are unresolved at link-time.
|
||||||
config("no_unresolved_symbols") {
|
config("no_unresolved_symbols") {
|
||||||
|
@ -14,12 +23,12 @@ Index: build/config/compiler/BUILD.gn
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+ if (current_cpu == "x86" && is_openbsd) {
|
+ if (current_cpu == "x86" && is_openbsd) {
|
||||||
+ ldflags = [ "-Wl,-z,notext" ]
|
+ ldflags = [ "-Wl,-z,notext", "-Wl,--strip-all" ]
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
# compiler ---------------------------------------------------------------------
|
# compiler ---------------------------------------------------------------------
|
||||||
@@ -499,6 +502,10 @@ config("compiler") {
|
@@ -515,6 +518,10 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +39,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
# Linux-specific compiler flags setup.
|
# Linux-specific compiler flags setup.
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
if (use_gold) {
|
if (use_gold) {
|
||||||
@@ -574,7 +581,7 @@ config("compiler") {
|
@@ -590,7 +597,7 @@ config("compiler") {
|
||||||
ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
|
ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,25 +48,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
|
cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
|
||||||
if (save_reproducers_on_lld_crash && use_lld) {
|
if (save_reproducers_on_lld_crash && use_lld) {
|
||||||
ldflags += [
|
ldflags += [
|
||||||
@@ -759,7 +766,7 @@ config("compiler") {
|
@@ -1180,7 +1187,7 @@ config("compiler_cpu_abi") {
|
||||||
|
|
||||||
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
|
||||||
|
|
||||||
- if (!is_chromeos) {
|
|
||||||
+ if (!is_chromeos && !is_bsd) {
|
|
||||||
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
|
||||||
# toolchain has this flag.
|
|
||||||
# We only use one version of LLVM within a build so there's no need to
|
|
||||||
@@ -866,7 +873,7 @@ config("compiler") {
|
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
|
||||||
# lldb doesn't have the needed changes yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
|
||||||
- if (is_clang && !is_nacl && !is_win && !is_apple) {
|
|
||||||
+ if (is_clang && !is_nacl && !is_win && !is_apple && !is_bsd) {
|
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1108,7 +1115,7 @@ config("compiler_cpu_abi") {
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
} else if (current_cpu == "arm") {
|
} else if (current_cpu == "arm") {
|
||||||
|
@ -66,7 +57,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
!(is_chromeos_lacros && is_chromeos_device)) {
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
||||||
cflags += [ "--target=arm-linux-gnueabihf" ]
|
cflags += [ "--target=arm-linux-gnueabihf" ]
|
||||||
ldflags += [ "--target=arm-linux-gnueabihf" ]
|
ldflags += [ "--target=arm-linux-gnueabihf" ]
|
||||||
@@ -1123,7 +1130,7 @@ config("compiler_cpu_abi") {
|
@@ -1195,7 +1202,7 @@ config("compiler_cpu_abi") {
|
||||||
cflags += [ "-mtune=$arm_tune" ]
|
cflags += [ "-mtune=$arm_tune" ]
|
||||||
}
|
}
|
||||||
} else if (current_cpu == "arm64") {
|
} else if (current_cpu == "arm64") {
|
||||||
|
@ -75,7 +66,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
!(is_chromeos_lacros && is_chromeos_device)) {
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
||||||
cflags += [ "--target=aarch64-linux-gnu" ]
|
cflags += [ "--target=aarch64-linux-gnu" ]
|
||||||
ldflags += [ "--target=aarch64-linux-gnu" ]
|
ldflags += [ "--target=aarch64-linux-gnu" ]
|
||||||
@@ -1458,7 +1465,7 @@ config("compiler_deterministic") {
|
@@ -1530,7 +1537,7 @@ config("compiler_deterministic") {
|
||||||
# different build directory like "out/feature_a" and "out/feature_b" if
|
# different build directory like "out/feature_a" and "out/feature_b" if
|
||||||
# we build same files with same compile flag.
|
# we build same files with same compile flag.
|
||||||
# Other paths are already given in relative, no need to normalize them.
|
# Other paths are already given in relative, no need to normalize them.
|
||||||
|
@ -84,7 +75,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
# TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
|
# TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
|
||||||
cflags += [
|
cflags += [
|
||||||
"-Xclang",
|
"-Xclang",
|
||||||
@@ -1510,7 +1517,7 @@ config("compiler_deterministic") {
|
@@ -1582,7 +1589,7 @@ config("compiler_deterministic") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("clang_revision") {
|
config("clang_revision") {
|
||||||
|
@ -93,16 +84,26 @@ Index: build/config/compiler/BUILD.gn
|
||||||
update_args = [
|
update_args = [
|
||||||
"--print-revision",
|
"--print-revision",
|
||||||
"--verify-version=$clang_version",
|
"--verify-version=$clang_version",
|
||||||
@@ -1764,7 +1771,7 @@ config("default_warnings") {
|
@@ -1890,9 +1897,6 @@ config("default_warnings") {
|
||||||
"-Wno-ignored-pragma-optimize",
|
|
||||||
|
# TODO(crbug.com/1494809): Evaluate and possibly enable.
|
||||||
|
"-Wno-vla-extension",
|
||||||
|
-
|
||||||
|
- # TODO(https://crbug.com/1490607): Fix and re-enable.
|
||||||
|
- "-Wno-thread-safety-reference-return",
|
||||||
|
]
|
||||||
|
|
||||||
|
cflags_cc += [
|
||||||
|
@@ -1900,7 +1904,7 @@ config("default_warnings") {
|
||||||
|
"-Wenum-compare-conditional",
|
||||||
]
|
]
|
||||||
|
|
||||||
- if (!is_nacl) {
|
- if (!is_nacl) {
|
||||||
+ if (!is_nacl && !is_bsd) {
|
+ if (!is_nacl && !is_bsd) {
|
||||||
cflags += [
|
cflags_cc += [
|
||||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
# TODO(https://crbug.com/1513724): Fix and re-enable.
|
||||||
"-Wno-deprecated-builtins",
|
"-Wno-c++11-narrowing-const-reference",
|
||||||
@@ -1973,7 +1980,7 @@ config("no_chromium_code") {
|
@@ -2089,7 +2093,7 @@ config("no_chromium_code") {
|
||||||
# third-party libraries.
|
# third-party libraries.
|
||||||
"-Wno-c++11-narrowing",
|
"-Wno-c++11-narrowing",
|
||||||
]
|
]
|
||||||
|
@ -111,7 +112,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
cflags += [
|
cflags += [
|
||||||
# Disabled for similar reasons as -Wunused-variable.
|
# Disabled for similar reasons as -Wunused-variable.
|
||||||
"-Wno-unused-but-set-variable",
|
"-Wno-unused-but-set-variable",
|
||||||
@@ -2483,7 +2490,7 @@ config("afdo_optimize_size") {
|
@@ -2597,7 +2601,7 @@ config("afdo_optimize_size") {
|
||||||
# There are some targeted places that AFDO regresses, so we provide a separate
|
# There are some targeted places that AFDO regresses, so we provide a separate
|
||||||
# config to allow AFDO to be disabled per-target.
|
# config to allow AFDO to be disabled per-target.
|
||||||
config("afdo") {
|
config("afdo") {
|
||||||
|
@ -120,7 +121,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
cflags = []
|
cflags = []
|
||||||
if (clang_emit_debug_info_for_profiling) {
|
if (clang_emit_debug_info_for_profiling) {
|
||||||
# Add the following flags to generate debug info for profiling.
|
# Add the following flags to generate debug info for profiling.
|
||||||
@@ -2510,7 +2517,7 @@ config("afdo") {
|
@@ -2624,7 +2628,7 @@ config("afdo") {
|
||||||
cflags += [ "-Wno-backend-plugin" ]
|
cflags += [ "-Wno-backend-plugin" ]
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
|
@ -129,7 +130,7 @@ Index: build/config/compiler/BUILD.gn
|
||||||
cflags = [ "-fauto-profile=${auto_profile_path}" ]
|
cflags = [ "-fauto-profile=${auto_profile_path}" ]
|
||||||
inputs = [ auto_profile_path ]
|
inputs = [ auto_profile_path ]
|
||||||
}
|
}
|
||||||
@@ -2674,7 +2681,8 @@ config("symbols") {
|
@@ -2788,7 +2792,8 @@ config("symbols") {
|
||||||
configs += [ "//build/config:compress_debug_sections" ]
|
configs += [ "//build/config:compress_debug_sections" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
Index: build/config/compiler/pgo/BUILD.gn
|
|
||||||
--- build/config/compiler/pgo/BUILD.gn.orig
|
|
||||||
+++ build/config/compiler/pgo/BUILD.gn
|
|
||||||
@@ -138,13 +138,14 @@ config("pgo_optimization_flags") {
|
|
||||||
|
|
||||||
# Enable basic block layout based on the extended TSP problem. This aims to
|
|
||||||
# improve icache utilization and reduce the binary size.
|
|
||||||
- if (use_thin_lto) {
|
|
||||||
+ # __clang_major__ >= 15
|
|
||||||
+ if (use_thin_lto && !is_bsd) {
|
|
||||||
if (is_win) {
|
|
||||||
ldflags = [ "-mllvm:-enable-ext-tsp-block-placement=1" ]
|
|
||||||
} else {
|
|
||||||
ldflags = [ "-Wl,-mllvm,-enable-ext-tsp-block-placement=1" ]
|
|
||||||
}
|
|
||||||
- } else {
|
|
||||||
+ } else if (!is_bsd) {
|
|
||||||
cflags += [
|
|
||||||
"-mllvm",
|
|
||||||
"-enable-ext-tsp-block-placement=1",
|
|
|
@ -1,7 +1,7 @@
|
||||||
Index: build/config/ozone.gni
|
Index: build/config/ozone.gni
|
||||||
--- build/config/ozone.gni.orig
|
--- build/config/ozone.gni.orig
|
||||||
+++ build/config/ozone.gni
|
+++ build/config/ozone.gni
|
||||||
@@ -87,7 +87,15 @@ declare_args() {
|
@@ -84,7 +84,15 @@ declare_args() {
|
||||||
} else if (is_chromeos_lacros) {
|
} else if (is_chromeos_lacros) {
|
||||||
ozone_platform = "wayland"
|
ozone_platform = "wayland"
|
||||||
ozone_platform_wayland = true
|
ozone_platform_wayland = true
|
||||||
|
|
14
www/ungoogled-chromium/patches/patch-build_config_rust_gni
Normal file
14
www/ungoogled-chromium/patches/patch-build_config_rust_gni
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Index: build/config/rust.gni
|
||||||
|
--- build/config/rust.gni.orig
|
||||||
|
+++ build/config/rust.gni
|
||||||
|
@@ -277,6 +277,10 @@ if (is_linux || is_chromeos) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+if (is_bsd) {
|
||||||
|
+ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
assert(!toolchain_has_rust || rust_abi_target != "")
|
||||||
|
|
||||||
|
# This variable is passed to the Rust libstd build.
|
|
@ -1,7 +1,7 @@
|
||||||
Index: build/linux/unbundle/libusb.gn
|
Index: build/linux/unbundle/libusb.gn
|
||||||
--- build/linux/unbundle/libusb.gn.orig
|
--- build/linux/unbundle/libusb.gn.orig
|
||||||
+++ build/linux/unbundle/libusb.gn
|
+++ build/linux/unbundle/libusb.gn
|
||||||
@@ -0,0 +1,24 @@
|
@@ -1,3 +1,27 @@
|
||||||
+# Copyright 2016 The Chromium Authors. All rights reserved.
|
+# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||||
+# Use of this source code is governed by a BSD-style license that can be
|
+# Use of this source code is governed by a BSD-style license that can be
|
||||||
+# found in the LICENSE file.
|
+# found in the LICENSE file.
|
||||||
|
@ -26,3 +26,6 @@ Index: build/linux/unbundle/libusb.gn
|
||||||
+ ]
|
+ ]
|
||||||
+ public_configs = [ ":system_libusb" ]
|
+ public_configs = [ ":system_libusb" ]
|
||||||
+}
|
+}
|
||||||
|
import("//build/config/linux/pkg_config.gni")
|
||||||
|
import("//build/shim_headers.gni")
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue