Update to the latest beta channel release
* v8_context_snapshot_generator fails with SIGILL during build. I have not investigated yet.
This commit is contained in:
parent
817852bae8
commit
2f1ecc9c8f
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.14 2012/09/24 18:26:53 asau Exp $
|
||||
|
||||
DISTNAME= chromium-85.0.4181.8
|
||||
DISTNAME= chromium-85.0.4183.39
|
||||
CATEGORIES= www
|
||||
MASTER_SITES= http://commondatastorage.googleapis.com/chromium-browser-official/
|
||||
EXTRACT_SUFX= .tar.xz
|
||||
|
@ -14,12 +14,25 @@ USE_TOOLS+= bash bison flex:pkgsrc gmake pax perl pkg-config
|
|||
TOOLS_PLATFORM.flex= # override the platform definition to use pkgsrc's flex.
|
||||
USE_LANGUAGES= c c++
|
||||
|
||||
CHECK_PORTABILITY_SKIP+= third_party/sqlite/src/configure
|
||||
CHECK_PORTABILITY_SKIP+= third_party/protobuf/post_process_dist.sh
|
||||
CHECK_PORTABILITY_SKIP+= third_party/ffmpeg/configure
|
||||
CHECK_PORTABILITY_SKIP+= third_party/xdg-utils/scripts/xdg-terminal
|
||||
CHECK_PORTABILITY_SKIP+= third_party/xdg-utils/scripts/xdg-terminal.in
|
||||
CHECK_PORTABILITY_SKIP+= third_party/llvm/flang/tools/f18/flang.sh.in
|
||||
CHECK_PORTABILITY_SKIP+= third_party/llvm/polly/lib/External/isl/configure
|
||||
CHECK_PORTABILITY_SKIP+= v8/tools/run-llprof.sh
|
||||
|
||||
BUILD_DEPENDS+= gperf>=3.0.1:../../devel/gperf
|
||||
BUILD_DEPENDS+= yasm-[0-9]*:../../devel/yasm
|
||||
BUILD_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
|
||||
BUILD_DEPENDS+= ${PYPKGPREFIX}-html5lib-[0-9]*:../../textproc/py-html5lib
|
||||
BUILD_DEPENDS+= ${PYPKGPREFIX}-beautifulsoup4-[0-9]*:../../www/py-beautifulsoup4
|
||||
BUILD_DEPENDS+= ${PYPKGPREFIX}-ply-[0-9]*:../../devel/py-ply
|
||||
BUILD_DEPENDS+= ${PYPKGPREFIX}-cElementTree-[0-9]*:../../textproc/py-cElementTree
|
||||
BUILD_DEPENDS+= nodejs-[0-9]*:../../lang/nodejs
|
||||
BUILD_DEPENDS+= openjdk11-[0-9]*:../../lang/openjdk11
|
||||
#BUILD_DEPENDS+= clang-[0-9]*:../../lang/clang # clang-format
|
||||
|
||||
PYTHON_VERSIONS_ACCEPTED= 27 # python3 not supported.
|
||||
|
||||
|
@ -28,180 +41,77 @@ DEPENDS+= xdg-utils-[0-9]*:../../misc/xdg-utils
|
|||
.include "../../mk/bsd.prefs.mk"
|
||||
.include "../../mk/compiler.mk"
|
||||
|
||||
#ONLY_FOR_PLATFORM+= *-*-arm # not tested yet
|
||||
#ONLY_FOR_PLATFORM+= *-*-arm # not yet
|
||||
#ONLY_FOR_PLATFORM+= *-*-aarch64 # not yet
|
||||
#ONLY_FOR_PLATFORM+= *-*-i386 # not yet
|
||||
ONLY_FOR_PLATFORM+= *-*-x86_64
|
||||
|
||||
# Workaround
|
||||
# Workaround for brotli and other commands.
|
||||
BUILDLINK_TRANSFORM.NetBSD+= rm:-ldl
|
||||
|
||||
# Do not use alloca(3) in libc.
|
||||
BUILDLINK_TRANSFORM+= opt:-std=c11:-std=gnu11
|
||||
BUILDLINK_TRANSFORM+= opt:-std=c99:-std=gnu99
|
||||
BUILDLINK_TRANSFORM+= opt:-std=c++14:-std=gnu++14
|
||||
BUILDLINK_TRANSFORM+= opt:-std=c++17:-std=gnu++17
|
||||
|
||||
REPLACE_BASH= chrome/tools/build/linux/chrome-wrapper
|
||||
|
||||
SUBST_CLASSES+= path
|
||||
SUBST_STAGE.path= post-patch
|
||||
SUBST_MESSAGE.path= Fixing pkg path
|
||||
SUBST_FILES.path+= chrome/common/chrome_paths.cc
|
||||
SUBST_SED.path+= -e 's:/usr/local/:${PREFIX}/:'
|
||||
SUBST_FILES.path+= third_party/pdfium/core/fxge/fx_ge_linux.cpp
|
||||
SUBST_FILES.path+= third_party/pdfium/xfa/fgas/font/cfx_fontsourceenum_file.cpp
|
||||
SUBST_FILES.path+= third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py
|
||||
SUBST_VARS.path+= PREFIX X11BASE
|
||||
|
||||
CFLAGS+= -fno-stack-protector
|
||||
CFLAGS+= -isystem${PREFIX}/lib/clang/10.0.0/include # third_party/zlib with clang
|
||||
|
||||
.include "options.mk"
|
||||
|
||||
MAKE_ENV+= BUILDTYPE=${BUILDTYPE}
|
||||
MAKE_ENV+= GPERF=${PREFIX}/bin/gperf
|
||||
|
||||
KEEPLIBS+= \
|
||||
base/third_party/dmg_fp \
|
||||
base/third_party/dynamic_annotations \
|
||||
base/third_party/icu \
|
||||
base/third_party/nspr \
|
||||
base/third_party/superfasthash \
|
||||
base/third_party/symbolize \
|
||||
base/third_party/valgrind \
|
||||
base/third_party/xdg_mime \
|
||||
base/third_party/xdg_user_dirs \
|
||||
breakpad/src/third_party/curl \
|
||||
chrome/third_party/mozilla_security_manager \
|
||||
courgette/third_party \
|
||||
net/third_party/mozilla_security_manager \
|
||||
net/third_party/nss \
|
||||
third_party/WebKit \
|
||||
third_party/analytics \
|
||||
third_party/angle \
|
||||
third_party/angle/src/common/third_party/numerics \
|
||||
third_party/angle/src/third_party/compiler \
|
||||
third_party/angle/src/third_party/libXNVCtrl \
|
||||
third_party/angle/src/third_party/murmurhash \
|
||||
third_party/angle/src/third_party/trace_event \
|
||||
third_party/boringssl \
|
||||
third_party/brotli \
|
||||
third_party/cacheinvalidation \
|
||||
third_party/catapult \
|
||||
third_party/catapult/third_party/polymer \
|
||||
third_party/catapult/third_party/py_vulcanize \
|
||||
third_party/catapult/third_party/py_vulcanize/third_party/rcssmin \
|
||||
third_party/catapult/third_party/py_vulcanize/third_party/rjsmin \
|
||||
third_party/catapult/tracing/third_party/d3 \
|
||||
third_party/catapult/tracing/third_party/gl-matrix \
|
||||
third_party/catapult/tracing/third_party/jszip \
|
||||
third_party/catapult/tracing/third_party/mannwhitneyu \
|
||||
third_party/ced \
|
||||
third_party/cld_2 \
|
||||
third_party/cld_3 \
|
||||
third_party/cros_system_api \
|
||||
third_party/devscripts \
|
||||
third_party/dom_distiller_js \
|
||||
third_party/fips181 \
|
||||
third_party/flatbuffers \
|
||||
third_party/flot \
|
||||
third_party/google_input_tools \
|
||||
third_party/google_input_tools/third_party/closure_library \
|
||||
third_party/google_input_tools/third_party/closure_library/third_party/closure \
|
||||
third_party/hunspell \
|
||||
third_party/iccjpeg \
|
||||
third_party/icu \
|
||||
third_party/inspector_protocol \
|
||||
third_party/jstemplate \
|
||||
third_party/khronos \
|
||||
third_party/leveldatabase \
|
||||
third_party/libXNVCtrl \
|
||||
third_party/libaddressinput \
|
||||
third_party/libjingle \
|
||||
third_party/libphonenumber \
|
||||
third_party/libsecret \
|
||||
third_party/libsrtp \
|
||||
third_party/libudev \
|
||||
third_party/libusb \
|
||||
third_party/libwebm \
|
||||
third_party/libxml/chromium \
|
||||
third_party/libyuv \
|
||||
third_party/lss \
|
||||
third_party/lzma_sdk \
|
||||
third_party/mesa \
|
||||
third_party/modp_b64 \
|
||||
third_party/mt19937ar \
|
||||
third_party/openh264 \
|
||||
third_party/openmax_dl \
|
||||
third_party/opus \
|
||||
third_party/ots \
|
||||
third_party/pdfium \
|
||||
third_party/pdfium/third_party/agg23 \
|
||||
third_party/pdfium/third_party/base \
|
||||
third_party/pdfium/third_party/bigint \
|
||||
third_party/pdfium/third_party/freetype \
|
||||
third_party/pdfium/third_party/lcms2-2.6 \
|
||||
third_party/pdfium/third_party/libjpeg \
|
||||
third_party/pdfium/third_party/libopenjpeg20 \
|
||||
third_party/pdfium/third_party/libpng16 \
|
||||
third_party/pdfium/third_party/libtiff \
|
||||
third_party/pdfium/third_party/zlib_v128 \
|
||||
third_party/polymer \
|
||||
third_party/protobuf \
|
||||
third_party/protobuf/third_party/six \
|
||||
third_party/qcms \
|
||||
third_party/sfntly \
|
||||
third_party/skia \
|
||||
third_party/smhasher \
|
||||
third_party/sqlite \
|
||||
third_party/tcmalloc \
|
||||
third_party/usrsctp \
|
||||
third_party/web-animations-js \
|
||||
third_party/webdriver \
|
||||
third_party/webrtc \
|
||||
third_party/widevine \
|
||||
third_party/woff2 \
|
||||
third_party/x86inc \
|
||||
third_party/zlib/google \
|
||||
url/third_party/mozilla \
|
||||
v8/src/third_party/valgrind \
|
||||
v8/third_party/inspector_protocol \
|
||||
base/third_party/libevent \
|
||||
third_party/adobe \
|
||||
third_party/speech-dispatcher \
|
||||
third_party/usb_ids \
|
||||
third_party/xdg-utils \
|
||||
third_party/yasm/run_yasm.py \
|
||||
third_party/jinja2 \
|
||||
third_party/ply \
|
||||
third_party/ffmpeg \
|
||||
third_party/markupsafe \
|
||||
third_party/harfbuzz-ng \
|
||||
third_party/zlib
|
||||
|
||||
# Proprietary codecs are enabled.
|
||||
GN_ARGS+= proprietary_codecs=true \
|
||||
ffmpeg_branding="Chrome"
|
||||
|
||||
GN_ARGS+= use_gconf=false \
|
||||
GN_ARGS+= clang_use_chrome_plugins=false \
|
||||
enable_hangout_services_extension=true \
|
||||
use_kerberos=false \
|
||||
use_cups=false \
|
||||
use_aura=true \
|
||||
use_cups=true \
|
||||
enable_nacl=false \
|
||||
enable_hevc_demuxing=true \
|
||||
enable_media_router=true \
|
||||
enable_remoting=false \
|
||||
fieldtrial_testing_like_official_build=true \
|
||||
toolkit_views=true \
|
||||
treat_warnings_as_errors=false \
|
||||
use_sysroot=false \
|
||||
use_system_libjpeg=true \
|
||||
use_system_sqlite=false \
|
||||
use_alsa=false \
|
||||
enable_webrtc=false \
|
||||
use_system_libjpeg=false \
|
||||
use_system_harfbuzz=true \
|
||||
use_system_freetype=true \
|
||||
enable_one_click_signin=true \
|
||||
use_allocator="none" \
|
||||
use_experimental_allocator_shim=false \
|
||||
is_clang=false \
|
||||
enable_webrtc=false \
|
||||
use_gnome_keyring=true
|
||||
use_allocator_shim=false \
|
||||
is_clang=true \
|
||||
use_lld=false \
|
||||
use_custom_libcxx=true \
|
||||
use_gold=false \
|
||||
icu_use_data_file=false
|
||||
GN_ARGS+= extra_cxxflags="-I${BUILDLINK_DIR}/include \
|
||||
-I${BUILDLINK_DIR}/include/glib \
|
||||
-I${BUILDLINK_DIR}/include/nss/nss " \
|
||||
-I${BUILDLINK_DIR}/include/nss/nss" \
|
||||
extra_ldflags="-L${PREFIX}/lib \
|
||||
-L${X11BASE}/lib \
|
||||
${COMPILER_RPATH_FLAG}${PREFIX}/lib \
|
||||
${COMPILER_RPATH_FLAG}${PREFIX}/lib/nspr \
|
||||
${COMPILER_RPATH_FLAG}${PREFIX}/lib/nss \
|
||||
${COMPILER_RPATH_FLAG}${PREFIX}/lib/ffmpeg4 \
|
||||
${COMPILER_RPATH_FLAG}${X11BASE}/lib"
|
||||
# To avoid error from sem_destroy(3) in mksnapshot
|
||||
GN_ARGS+= v8_use_snapshot=false
|
||||
|
||||
GN_BOOTSTRAP_FLAGS+= --no-clean --no-rebuild
|
||||
GN_BOOTSTRAP_FLAGS+= --no-clean --no-rebuild --skip-generate-buildfiles
|
||||
|
||||
# API key and OAuth credential for Google.
|
||||
# This is pkgsrc use only.
|
||||
|
@ -217,11 +127,15 @@ post-extract:
|
|||
${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/${LOWER_OPSYS}
|
||||
|
||||
pre-configure:
|
||||
cd ${WRKSRC} && \
|
||||
${PYTHONBIN} ./build/linux/unbundle/remove_bundled_libraries.py \
|
||||
${KEEPLIBS} --do-remove \
|
||||
|| ${FALSE}
|
||||
|
||||
# ${MKDIR} ${WRKSRC}/third_party/llvm-build/Release+Asserts/bin
|
||||
# ${LN} -sf ${PREFIX}/bin/clang++ \
|
||||
# ${WRKSRC}/third_party/llvm-build/Release+Asserts/bin/clang++
|
||||
# ${LN} -sf ${PREFIX}/bin/clang \
|
||||
# ${WRKSRC}/third_party/llvm-build/Release+Asserts/bin/clang
|
||||
# ${LN} -sf ${PREFIX}/bin/llvm-ar \
|
||||
# ${WRKSRC}/third_party/llvm-build/Release+Asserts/bin/llvm-ar
|
||||
${LN} -sf ${PREFIX}/java/openjdk11/bin/java \
|
||||
${BUILDLINK_DIR}/bin/java
|
||||
cp -r ${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/linux \
|
||||
${WRKSRC}/third_party/ffmpeg/chromium/config/Chrome/${LOWER_OPSYS}
|
||||
# a wrapper for rpath $ORIGIN removal
|
||||
|
@ -235,11 +149,16 @@ pre-configure:
|
|||
cd ${WRKSRC} && \
|
||||
${PYTHONBIN} ./build/linux/unbundle/replace_gn_files.py \
|
||||
--system-libraries \
|
||||
flac libjpeg libpng libvpx libwebp libxml libxslt \
|
||||
re2 snappy yasm \
|
||||
ffmpeg flac fontconfig freetype harfbuzz-ng libdrm libpng \
|
||||
libwebp libxml libxslt opus snappy \
|
||||
|| ${FALSE}
|
||||
|
||||
do-configure:
|
||||
# Create symlink to NetBSD nodejs command.
|
||||
${MKDIR} ${WRKSRC}/third_party/node/${LOWER_OPSYS}/node/bin
|
||||
${LN} -sf ${PREFIX}/bin/node \
|
||||
${WRKSRC}/third_party/node/${LOWER_OPSYS}/node/bin/node
|
||||
|
||||
cd ${WRKSRC} && \
|
||||
${SETENV} ${CONFIGURE_ENV} \
|
||||
${PYTHONBIN} ./tools/gn/bootstrap/bootstrap.py \
|
||||
|
@ -256,7 +175,19 @@ do-configure:
|
|||
do-build:
|
||||
cd ${WRKSRC} && \
|
||||
${SETENV} ${MAKE_ENV} \
|
||||
ninja -j ${MAKE_JOBS:U1} -C out/${BUILDTYPE} \
|
||||
${PREFIX}/bin/ninja -j ${MAKE_JOBS:U1} -C out/${BUILDTYPE} \
|
||||
mksnapshot
|
||||
${TOOLS_PLATFORM.paxctl} +m ${WRKSRC}/out/${BUILDTYPE}/mksnapshot
|
||||
|
||||
cd ${WRKSRC} && \
|
||||
${SETENV} ${MAKE_ENV} \
|
||||
${PREFIX}/bin/ninja -j ${MAKE_JOBS:U1} -C out/${BUILDTYPE} \
|
||||
v8_context_snapshot_generator
|
||||
${TOOLS_PLATFORM.paxctl} +m ${WRKSRC}/out/${BUILDTYPE}/v8_context_snapshot_generator
|
||||
|
||||
cd ${WRKSRC} && \
|
||||
${SETENV} ${MAKE_ENV} \
|
||||
${PREFIX}/bin/ninja -j ${MAKE_JOBS:U1} -C out/${BUILDTYPE} \
|
||||
chrome
|
||||
|
||||
CHROMIUM_DIR= chrome
|
||||
|
@ -313,10 +244,10 @@ do-install:
|
|||
.endfor
|
||||
|
||||
.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
|
||||
.include "../../audio/libopus/buildlink3.mk"
|
||||
.include "../../audio/speech-dispatcher/buildlink3.mk"
|
||||
.include "../../graphics/cairo/buildlink3.mk"
|
||||
# This introduces OpenSSL dependency and it conflicts with bundled BoringSSL.
|
||||
#.include "../../print/libcups/buildlink3.mk"
|
||||
.include "../../print/libcups/buildlink3.mk"
|
||||
.include "../../sysutils/dbus/buildlink3.mk"
|
||||
.include "../../sysutils/dbus-glib/buildlink3.mk"
|
||||
.include "../../x11/libdrm/buildlink3.mk"
|
||||
|
@ -324,8 +255,9 @@ do-install:
|
|||
.include "../../audio/flac/buildlink3.mk"
|
||||
.include "../../graphics/freetype2/buildlink3.mk"
|
||||
.include "../../security/libgnome-keyring/buildlink3.mk"
|
||||
.include "../../security/libsecret/buildlink3.mk"
|
||||
.include "../../fonts/harfbuzz/buildlink3.mk"
|
||||
# Not yet
|
||||
#.include "../../fonts/harfbuzz/buildlink3.mk"
|
||||
#.include "../../devel/libevent/buildlink3.mk"
|
||||
.include "../../graphics/libexif/buildlink3.mk"
|
||||
.include "../../fonts/fontconfig/buildlink3.mk"
|
||||
|
@ -344,7 +276,6 @@ BUILDLINK_TRANSFORM+= l:pci:pciutils
|
|||
.include "../../textproc/libxml2/buildlink3.mk"
|
||||
.include "../../textproc/libxslt/buildlink3.mk"
|
||||
.include "../../devel/dconf/buildlink3.mk"
|
||||
.include "../../x11/gtk2/buildlink3.mk"
|
||||
.include "../../x11/gtk3/buildlink3.mk"
|
||||
.include "../../x11/xorgproto/buildlink3.mk"
|
||||
.include "../../x11/libX11/buildlink3.mk"
|
||||
|
@ -358,15 +289,21 @@ BUILDLINK_TRANSFORM+= l:pci:pciutils
|
|||
.include "../../x11/libXrender/buildlink3.mk"
|
||||
.include "../../x11/libXScrnSaver/buildlink3.mk"
|
||||
.include "../../x11/libXtst/buildlink3.mk"
|
||||
.include "../../x11/libxcb/buildlink3.mk"
|
||||
.include "../../archivers/bzip2/buildlink3.mk"
|
||||
.include "../../mk/jpeg.buildlink3.mk"
|
||||
#.include "../../mk/jpeg.buildlink3.mk"
|
||||
.include "../../devel/libusb1/buildlink3.mk"
|
||||
.include "../../misc/usbids/buildlink3.mk"
|
||||
.include "../../textproc/icu/buildlink3.mk"
|
||||
#.include "../../textproc/icu/buildlink3.mk"
|
||||
.include "../../multimedia/libvpx/buildlink3.mk"
|
||||
.include "../../devel/zlib/buildlink3.mk"
|
||||
# Conflict between OpenSSL and BoringSSL.
|
||||
#.include "../../multimedia/ffmpeg4/buildlink3.mk"
|
||||
.include "../../multimedia/ffmpeg4/buildlink3.mk"
|
||||
.include "../../devel/libatomic/buildlink3.mk"
|
||||
# Some C++ files in ui/base/x are not buildable with GCC 8.4.0 on NetBSD/amd64.
|
||||
PKG_CC= ${PREFIX}/bin/clang
|
||||
PKG_CXX= ${PREFIX}/bin/clang++
|
||||
BUILDLINK_DEPMETHOD.clang= build
|
||||
.include "../../lang/clang/buildlink3.mk"
|
||||
|
||||
.include "../../lang/python/tool.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
||||
|
|
1516
chromium/distinfo
1516
chromium/distinfo
File diff suppressed because it is too large
Load Diff
|
@ -24,10 +24,10 @@ GN_ARGS+= is_debug=true
|
|||
# Dynamic link build causes link errors in pkgsrc.
|
||||
GN_ARGS+= is_component_build=false
|
||||
GN_BOOTSTRAP_FLAGS+= --debug
|
||||
#GN_VERBOSE= -v
|
||||
GN_VERBOSE= -v
|
||||
.else
|
||||
BUILDTYPE= Release
|
||||
GN_ARGS+= is_debug=false \
|
||||
symbol_level=0 \
|
||||
remove_webcore_debug_symbols=true
|
||||
symbol_level=0
|
||||
GN_VERBOSE= # empty
|
||||
.endif
|
||||
|
|
|
@ -1,62 +1,102 @@
|
|||
$NetBSD$
|
||||
|
||||
--- BUILD.gn.orig 2017-02-02 02:02:46.000000000 +0000
|
||||
--- BUILD.gn.orig 2020-06-25 09:32:34.000000000 +0000
|
||||
+++ BUILD.gn
|
||||
@@ -217,7 +217,7 @@ group("both_gn_and_gyp") {
|
||||
@@ -203,7 +203,7 @@ group("gn_all") {
|
||||
]
|
||||
}
|
||||
|
||||
- if (!is_ios && !is_android && !is_chromecast) {
|
||||
+ if (!is_ios && !is_android && !is_bsd && !is_chromecast) {
|
||||
- if (is_win || (is_linux && !is_chromeos) || is_android) {
|
||||
+ if (is_win || (is_linux && !is_chromeos) || is_android || is_bsd) {
|
||||
deps += [
|
||||
"//chrome",
|
||||
"//chrome/test:browser_tests",
|
||||
@@ -277,7 +277,7 @@ group("both_gn_and_gyp") {
|
||||
]
|
||||
}
|
||||
|
||||
- if (!is_ios) {
|
||||
+ if (!is_ios && !is_bsd) {
|
||||
# TODO(GYP): Figure out which of these should actually build on iOS,
|
||||
# and whether there should be other targets that are iOS-only and missing.
|
||||
deps += [
|
||||
@@ -320,7 +320,7 @@ group("both_gn_and_gyp") {
|
||||
"//ui/touch_selection:ui_touch_selection_unittests",
|
||||
"//url/ipc:url_ipc_unittests",
|
||||
]
|
||||
- } else {
|
||||
+ } else if (!is_bsd) {
|
||||
deps += [ "//ios:all" ]
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ group("both_gn_and_gyp") {
|
||||
]
|
||||
}
|
||||
|
||||
"//weblayer/shell:weblayer_shell",
|
||||
"//weblayer/test:weblayer_browsertests",
|
||||
@@ -413,12 +413,12 @@ group("gn_all") {
|
||||
# seems currently broken for this platform at the moment, and the
|
||||
# corresponding code build and works on Linux unmodified.
|
||||
# See instructions in the corresponding BUILD.gn.
|
||||
- if (is_linux) {
|
||||
+ if (is_linux || is_bsd) {
|
||||
# The following are definitely linux-only.
|
||||
deps +=
|
||||
[ "//third_party/android_crazy_linker:android_crazy_linker_zip_fuzzer" ]
|
||||
}
|
||||
|
||||
- if (is_linux || is_chromeos) {
|
||||
+ if (is_linux || is_chromeos || is_bsd) {
|
||||
# This is only used by ChromeOS, but we want maximal fuzzer coverage, so
|
||||
# run it under linux too.
|
||||
deps += [
|
||||
"//chrome:manpage",
|
||||
@@ -515,9 +515,16 @@ group("both_gn_and_gyp") {
|
||||
# TODO(dpranke): add the linux_dump_symbols flag?
|
||||
deps += [ "//chrome:linux_symbols" ]
|
||||
}
|
||||
@@ -474,6 +474,15 @@ group("gn_all") {
|
||||
"//testing:empty_main",
|
||||
]
|
||||
|
||||
+ if (is_bsd) {
|
||||
+ deps += [
|
||||
+ "//chrome:xdg_mime",
|
||||
+ "//net:disk_cache_memory_test",
|
||||
+ "//net:quic_client",
|
||||
+ "//net:quic_server",
|
||||
+ "//testing:empty_main",
|
||||
+ ]
|
||||
+
|
||||
+ if (is_bsd) {
|
||||
+ deps -= [
|
||||
+ "//sandbox/linux:chrome_sandbox",
|
||||
+ "//sandbox/linux:sandbox_linux_unittests",
|
||||
+ ]
|
||||
+ }
|
||||
if (use_dbus) {
|
||||
deps += [
|
||||
"//dbus:dbus_test_server",
|
||||
@@ -487,14 +496,14 @@ group("gn_all") {
|
||||
}
|
||||
}
|
||||
|
||||
- if (is_ios || is_win || (is_linux && !is_chromeos)) {
|
||||
+ if (is_ios || is_win || is_bsd || (is_linux && !is_chromeos)) {
|
||||
+ if (is_ios || is_win || (is_linux && !is_chromeos) || is_bsd) {
|
||||
deps += [
|
||||
"//base:base_i18n_perftests",
|
||||
"//base:base_perftests",
|
||||
@@ -588,7 +595,7 @@ group("both_gn_and_gyp") {
|
||||
"//google_apis:google_apis_unittests",
|
||||
]
|
||||
}
|
||||
|
||||
- if ((is_win || is_mac || is_linux || is_chromeos || is_fuchsia) &&
|
||||
+ if ((is_win || is_mac || is_linux || is_chromeos || is_fuchsia || is_bsd) &&
|
||||
(target_cpu == "x86" || target_cpu == "x64")) {
|
||||
deps += [ "//third_party/swiftshader" ]
|
||||
}
|
||||
@@ -520,7 +529,7 @@ group("gn_all") {
|
||||
"//ui/compositor:compositor_unittests",
|
||||
]
|
||||
|
||||
- if (!is_android) {
|
||||
+ if (!is_android && is_linux) {
|
||||
deps += [
|
||||
"//chrome/test:load_library_perf_tests",
|
||||
"//chrome/test:sync_performance_tests",
|
||||
@@ -545,6 +554,27 @@ group("gn_all") {
|
||||
]
|
||||
}
|
||||
|
||||
+ if (is_bsd) {
|
||||
+ deps += [
|
||||
+ "//chrome/test:load_library_perf_tests",
|
||||
+ "//chrome/test:sync_performance_tests",
|
||||
+ "//chrome/test/chromedriver:chromedriver",
|
||||
+ "//media/cast:generate_barcode_video",
|
||||
+ "//media/cast:generate_timecode_audio",
|
||||
+ "//net:crash_cache",
|
||||
+ "//net:dns_fuzz_stub",
|
||||
+ "//net:net_watcher", # TODO(GYP): This should be conditional on
|
||||
+ # use_v8_in_net
|
||||
+ "//net:run_testserver",
|
||||
+ "//net:stress_cache",
|
||||
+ "//net:tld_cleanup",
|
||||
+ "//ppapi:pepper_hash_for_uma",
|
||||
+ "//ppapi:ppapi_perftests",
|
||||
+ "//third_party/leveldatabase:env_chromium_unittests",
|
||||
+ "//third_party/libaddressinput:libaddressinput_unittests",
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
if (is_android) {
|
||||
deps += [ "//chrome/test/chromedriver:chromedriver($host_toolchain)" ]
|
||||
}
|
||||
@@ -559,7 +589,7 @@ group("gn_all") {
|
||||
if (enable_nacl) {
|
||||
deps += [ "//components/nacl/loader:nacl_loader_unittests" ]
|
||||
|
||||
|
@ -65,26 +105,59 @@ $NetBSD$
|
|||
# TODO(dpranke): Figure out what platforms should actually have this.
|
||||
deps += [ "//components/nacl/loader:nacl_helper" ]
|
||||
|
||||
@@ -698,7 +705,7 @@ group("both_gn_and_gyp") {
|
||||
deps +=
|
||||
[ "//chrome/installer/mini_installer:next_version_mini_installer" ]
|
||||
@@ -593,6 +623,17 @@ group("gn_all") {
|
||||
"//third_party/breakpad:minidump_dump($host_toolchain)",
|
||||
"//third_party/breakpad:minidump_stackwalk($host_toolchain)",
|
||||
]
|
||||
+ }
|
||||
+
|
||||
+ if (is_bsd) {
|
||||
+ deps += [
|
||||
+ "//components/network_hints/browser",
|
||||
+ "//content/public/app",
|
||||
+ "//mojo:mojo_perftests",
|
||||
+ "//services/service_manager/public/cpp",
|
||||
+ "//testing/gmock:gmock_main",
|
||||
+ ]
|
||||
+ }
|
||||
|
||||
if (!is_android) {
|
||||
deps += [
|
||||
@@ -665,7 +706,7 @@ group("gn_all") {
|
||||
host_os == "win") {
|
||||
deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
|
||||
}
|
||||
- } else if (!is_android && !is_ios) {
|
||||
+ } else if (!is_android && !is_ios && !is_bsd) {
|
||||
deps += [ "//breakpad:symupload($host_toolchain)" ]
|
||||
- } else if (!is_android && !is_ios && !is_fuchsia) {
|
||||
+ } else if (!is_android && !is_ios && !is_fuchsia && !is_bsd) {
|
||||
deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
|
||||
}
|
||||
|
||||
@@ -743,7 +750,7 @@ group("gn_only") {
|
||||
deps += [ "//components/proximity_auth:proximity_auth_unittests" ]
|
||||
@@ -680,7 +721,7 @@ group("gn_all") {
|
||||
}
|
||||
}
|
||||
|
||||
- if (is_mac || is_win || is_android || (is_linux && !is_chromeos)) {
|
||||
+ if (is_mac || is_win || is_android || (is_linux && !is_chromeos) || is_bsd) {
|
||||
deps += [
|
||||
"//third_party/crashpad/crashpad:crashpad_tests",
|
||||
"//third_party/crashpad/crashpad/handler:crashpad_handler",
|
||||
@@ -704,19 +745,19 @@ group("gn_all") {
|
||||
deps += [ "//content/browser/bluetooth/tools:bluetooth_metrics_hash" ]
|
||||
}
|
||||
|
||||
- if (is_win || is_linux) {
|
||||
+ if (is_win || is_linux || is_bsd) {
|
||||
deps += [
|
||||
"//mash:all",
|
||||
"//media/mojo/services:media_mojo_shell_unittests",
|
||||
@@ -763,7 +770,7 @@ group("gn_only") {
|
||||
}
|
||||
deps += [ "//mojo" ]
|
||||
}
|
||||
|
||||
- if (is_mac || is_linux || is_android || is_fuchsia) {
|
||||
+ if (is_mac || is_linux || is_android || is_fuchsia || is_bsd) {
|
||||
deps += [ "//third_party/perfetto:all" ]
|
||||
}
|
||||
|
||||
- if (is_win || is_mac || is_linux) {
|
||||
+ if (is_win || is_mac || is_linux || is_bsd) {
|
||||
deps += [ "//third_party/sqlite:sqlite_shell" ]
|
||||
}
|
||||
|
||||
- if (is_linux && !is_chromeos && !is_chromecast) {
|
||||
|
@ -92,84 +165,68 @@ $NetBSD$
|
|||
# TODO(GYP): Figure out if any of these should be in gn_all
|
||||
# and figure out how cross-platform they are
|
||||
deps += [
|
||||
@@ -816,7 +823,7 @@ group("gn_only") {
|
||||
]
|
||||
|
||||
if (target_cpu == "x86" || target_cpu == "x64") {
|
||||
- if (!is_android) {
|
||||
+ if (!is_android && !is_bsd) {
|
||||
deps += [ "//chrome/test:load_library_perf_tests" ]
|
||||
@@ -758,13 +799,13 @@ group("gn_all") {
|
||||
}
|
||||
deps += [
|
||||
@@ -824,7 +831,7 @@ group("gn_only") {
|
||||
"//third_party/libjpeg_turbo:simd_asm",
|
||||
]
|
||||
deps += [ "//third_party/libjpeg_turbo:simd_asm" ]
|
||||
}
|
||||
- if (is_linux && current_toolchain == host_toolchain) {
|
||||
+ if ((is_linux || is_bsd) && current_toolchain == host_toolchain) {
|
||||
deps += [ "//v8:v8_shell" ]
|
||||
}
|
||||
}
|
||||
@@ -834,7 +841,7 @@ group("gn_only") {
|
||||
}
|
||||
|
||||
if ((is_linux && !is_chromeos && !is_chromecast) || (is_win && use_drfuzz) ||
|
||||
if ((is_linux && !is_chromecast) || (is_win && use_libfuzzer) ||
|
||||
- (use_libfuzzer && is_mac)) {
|
||||
+ (use_libfuzzer && is_mac) || is_bsd) {
|
||||
deps += [
|
||||
"//chrome/services/ipp_parser/public/cpp:fuzzers",
|
||||
"//testing/libfuzzer/fuzzers",
|
||||
"//testing/libfuzzer/tests:libfuzzer_tests",
|
||||
@@ -877,7 +884,7 @@ group("gn_only") {
|
||||
|
||||
group("gn_mojo_targets") {
|
||||
testonly = true
|
||||
- if (is_linux && !is_chromeos) {
|
||||
+ if ((is_linux || is_bsd) && !is_chromeos) {
|
||||
# TODO(GYP): Figure out if any of these should be in gn_all
|
||||
# and figure out how cross-platform they are
|
||||
deps = [
|
||||
@@ -903,7 +910,7 @@ group("gn_visibility") {
|
||||
@@ -786,7 +827,7 @@ group("gn_all") {
|
||||
deps += [ "//native_client_sdk/src:nacl_core_sdk" ]
|
||||
}
|
||||
|
||||
- if (is_linux && use_ozone) {
|
||||
+ if ((is_linux || is_bsd) && use_ozone) {
|
||||
deps += [
|
||||
"//headless:headless_non_renderer",
|
||||
"//headless:headless_tests",
|
||||
@@ -798,8 +839,12 @@ group("gn_all") {
|
||||
"//chrome/browser/vr:vr_common_perftests",
|
||||
"//chrome/browser/vr:vr_common_unittests",
|
||||
"//chrome/browser/vr:vr_pixeltests",
|
||||
+ ]
|
||||
+ if (is_linux) {
|
||||
+ deps += [
|
||||
"//tools/perf/contrib/vr_benchmarks:vr_perf_tests",
|
||||
]
|
||||
+ }
|
||||
if (is_desktop_linux && use_ozone) {
|
||||
deps += [ "//chrome/browser/vr/testapp:vr_testapp" ]
|
||||
}
|
||||
@@ -838,7 +883,7 @@ group("gn_all") {
|
||||
deps += [ "//third_party/opencv:opencv_emd_fuzzer" ]
|
||||
}
|
||||
|
||||
-if (!is_ios) {
|
||||
+if (!is_ios || !is_bsd) {
|
||||
# This group includes all of the targets needed to build and test Blink,
|
||||
# including running the layout tests (see below).
|
||||
group("blink_tests") {
|
||||
@@ -949,7 +956,7 @@ if (!is_ios) {
|
||||
data_deps += [ "//content/shell:content_shell_crash_service" ]
|
||||
-if ((is_linux || is_win) && enable_remoting && !use_ozone) {
|
||||
+if ((is_linux || is_win || is_bsd) && enable_remoting && !use_ozone) {
|
||||
# This group is used for network annotation check test.
|
||||
group("shipped_binaries") {
|
||||
deps = [
|
||||
@@ -1085,7 +1130,7 @@ if (!is_ios) {
|
||||
]
|
||||
}
|
||||
|
||||
- if (!is_win && !is_android) {
|
||||
+ if (!is_win && !is_android && !is_bsd) {
|
||||
data_deps += [ "//breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||
data_deps +=
|
||||
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||
}
|
||||
@@ -1292,7 +1337,7 @@ group("chromium_builder_perf") {
|
||||
|
||||
@@ -957,7 +964,7 @@ if (!is_ios) {
|
||||
data_deps += [ "//breakpad:dump_syms($host_toolchain)" ]
|
||||
}
|
||||
|
||||
- if (is_linux) {
|
||||
+ if (is_linux && !is_bsd) {
|
||||
data_deps += [ "//breakpad:dump_syms($host_toolchain)" ]
|
||||
}
|
||||
|
||||
@@ -979,7 +986,7 @@ group("chromium_swarm_tests") {
|
||||
group("chromium_builder_perf") {
|
||||
testonly = true
|
||||
|
||||
- if (!is_ios && !is_android && !is_chromecast) {
|
||||
+ if (!is_ios && !is_android && !is_chromecast && !is_bsd) {
|
||||
data_deps = [
|
||||
"//cc:cc_perftests",
|
||||
"//chrome/test:load_library_perf_tests",
|
||||
@@ -1009,7 +1016,7 @@ group("chromium_builder_perf") {
|
||||
"//chrome/installer/mini_installer:mini_installer",
|
||||
"//chrome/test:angle_perftests",
|
||||
]
|
||||
if (is_win) {
|
||||
data_deps += [ "//chrome/installer/mini_installer:mini_installer" ]
|
||||
- } else {
|
||||
+ } else if (!is_bsd) {
|
||||
data_deps += [ "//breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||
data_deps +=
|
||||
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- apps/app_restore_service_browsertest.cc.orig 2020-06-25 09:31:17.000000000 +0000
|
||||
+++ apps/app_restore_service_browsertest.cc
|
||||
@@ -148,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowse
|
||||
}
|
||||
|
||||
// Flaky: crbug.com/269613
|
||||
-#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
+#if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_BSD)
|
||||
#define MAYBE_FileAccessIsRestored DISABLED_FileAccessIsRestored
|
||||
#else
|
||||
#define MAYBE_FileAccessIsRestored FileAccessIsRestored
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- apps/ui/views/app_window_frame_view.cc.orig 2017-02-02 02:02:46.000000000 +0000
|
||||
--- apps/ui/views/app_window_frame_view.cc.orig 2020-07-24 02:37:41.000000000 +0000
|
||||
+++ apps/ui/views/app_window_frame_view.cc
|
||||
@@ -132,7 +132,7 @@ gfx::Rect AppWindowFrameView::GetBoundsF
|
||||
@@ -125,7 +125,7 @@ gfx::Rect AppWindowFrameView::GetBoundsF
|
||||
gfx::Rect AppWindowFrameView::GetWindowBoundsForClientBounds(
|
||||
const gfx::Rect& client_bounds) const {
|
||||
gfx::Rect window_bounds = client_bounds;
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- ash/display/mirror_window_controller.cc.orig 2017-02-02 02:02:46.000000000 +0000
|
||||
+++ ash/display/mirror_window_controller.cc
|
||||
@@ -250,7 +250,11 @@ void MirrorWindowController::UpdateWindo
|
||||
return info.id() == iter->first;
|
||||
}) == display_info_list.end()) {
|
||||
CloseAndDeleteHost(iter->second, true);
|
||||
+#if defined(__llvm__)
|
||||
+ mirroring_host_info_map_.erase(iter++);
|
||||
+#else
|
||||
iter = mirroring_host_info_map_.erase(iter);
|
||||
+#endif
|
||||
} else {
|
||||
++iter;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- ash/shell.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ ash/shell.cc
|
||||
@@ -579,7 +579,7 @@ void Shell::Init(const ShellInitParams&
|
||||
|
||||
immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>();
|
||||
|
||||
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
+#if (defined(OS_LINUX) || defined(OS_BSD)) && !defined(OS_CHROMEOS)
|
||||
NOTREACHED() << "linux desktop does not support ash.";
|
||||
#endif
|
||||
|
|
@ -1,95 +1,146 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/BUILD.gn.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/BUILD.gn.orig 2020-07-15 18:56:44.000000000 +0000
|
||||
+++ base/BUILD.gn
|
||||
@@ -1076,6 +1076,46 @@ component("base") {
|
||||
public_deps += [ "//base/allocator:unified_allocator_shim" ]
|
||||
@@ -60,7 +60,7 @@ declare_args() {
|
||||
# replacement base::Location::Current(). On by default in non-official builds
|
||||
# for testing purposes.
|
||||
# TODO(https://crbug.com/974061): remove this eventually.
|
||||
- from_here_uses_location_builtins = !is_official_build
|
||||
+ from_here_uses_location_builtins = !is_official_build && !is_bsd
|
||||
|
||||
# Unsafe developer build. Has developer-friendly features that may weaken or
|
||||
# disable security measures like sandboxing or ASLR.
|
||||
@@ -887,7 +887,7 @@ jumbo_component("base") {
|
||||
"timer/hi_res_timer_manager_posix.cc",
|
||||
]
|
||||
|
||||
- if (!is_nacl && !is_mac && !is_ios) {
|
||||
+ if (!is_nacl && !is_mac && !is_ios && !is_bsd) {
|
||||
sources += [
|
||||
"profiler/stack_copier_signal.cc",
|
||||
"profiler/stack_copier_signal.h",
|
||||
@@ -896,6 +896,12 @@ jumbo_component("base") {
|
||||
"profiler/thread_delegate_posix.h",
|
||||
]
|
||||
}
|
||||
+
|
||||
+ if (is_bsd) {
|
||||
+ sources += [
|
||||
+ "profiler/stack_sampler_posix.cc",
|
||||
+ ]
|
||||
+ }
|
||||
}
|
||||
|
||||
+ if (is_bsd) {
|
||||
+ sources -= [
|
||||
+ "files/file_util_linux.cc",
|
||||
+ "files/file_path_watcher_linux.cc",
|
||||
+ "process/process_linux.cc",
|
||||
+ "process/process_iterator_linux.cc",
|
||||
+ "process/process_metrics_linux.cc",
|
||||
+ "process/process_handle_linux.cc",
|
||||
+ "sys_info_linux.cc",
|
||||
+ "trace_event/malloc_dump_provider.cc",
|
||||
+ "trace_event/malloc_dump_provider.h",
|
||||
+ "debug/proc_maps_linux.cc",
|
||||
+ "debug/proc_maps_linux.h",
|
||||
+ ]
|
||||
+ if (is_freebsd) {
|
||||
+ sources += [
|
||||
+ "files/file_path_watcher_stub.cc",
|
||||
+ "process/process_handle_freebsd.cc",
|
||||
+ "process/process_iterator_freebsd.cc",
|
||||
+ "process/process_metrics_freebsd.cc",
|
||||
+ "sys_info_freebsd.cc",
|
||||
+ ]
|
||||
+ }
|
||||
+ if (is_netbsd) {
|
||||
+ sources += [
|
||||
+ "files/file_path_watcher_stub.cc",
|
||||
+ "process/process_handle_netbsd.cc",
|
||||
+ "process/process_iterator_netbsd.cc",
|
||||
+ "process/process_metrics_netbsd.cc",
|
||||
+ "sys_info_netbsd.cc",
|
||||
+ ]
|
||||
+ }
|
||||
+ libs = [
|
||||
+ "execinfo", # logging.cc
|
||||
+ "kvm" # process_metrics_freebsd
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
# Allow more direct string conversions on platforms with native utf8
|
||||
# strings
|
||||
if (is_mac || is_ios || is_chromeos || is_chromecast) {
|
||||
@@ -1347,7 +1387,7 @@ component("base") {
|
||||
if (is_win) {
|
||||
@@ -1182,7 +1188,7 @@ jumbo_component("base") {
|
||||
]
|
||||
}
|
||||
|
||||
- if (is_linux) {
|
||||
+ if (is_linux || is_bsd) {
|
||||
sources += [
|
||||
"debug/proc_maps_linux.cc",
|
||||
"debug/proc_maps_linux.h",
|
||||
@@ -1233,7 +1239,7 @@ jumbo_component("base") {
|
||||
sources += [ "base_paths_posix.h" ]
|
||||
}
|
||||
|
||||
- if (is_linux) {
|
||||
+ if (is_linux || is_bsd) {
|
||||
sources += [
|
||||
"base_paths_posix.cc",
|
||||
"debug/elf_reader.cc",
|
||||
@@ -1287,7 +1293,7 @@ jumbo_component("base") {
|
||||
# Needed for <atomic> if using newer C++ library than sysroot, except if
|
||||
# building inside the cros_sdk environment - use host_toolchain as a
|
||||
# more robust check for this.
|
||||
- if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) &&
|
||||
+ if (!use_sysroot && (is_android || ((is_linux || is_bsd) && !is_chromecast) && !is_clang) &&
|
||||
host_toolchain != "//build/toolchain/cros:host") {
|
||||
libs += [ "atomic" ]
|
||||
}
|
||||
@@ -1313,7 +1319,7 @@ jumbo_component("base") {
|
||||
"allocator/allocator_shim_override_glibc_weak_symbols.h",
|
||||
]
|
||||
deps += [ "//base/allocator:tcmalloc" ]
|
||||
- } else if (is_linux && use_allocator == "none") {
|
||||
+ } else if ((is_linux || is_bsd) && use_allocator == "none") {
|
||||
sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ]
|
||||
} else if ((is_linux || is_android) && use_allocator == "partition") {
|
||||
# Cannot use the same dispatching for host-side binaries.
|
||||
@@ -1889,7 +1895,7 @@ jumbo_component("base") {
|
||||
}
|
||||
|
||||
# Linux.
|
||||
- if (is_linux) {
|
||||
+ if (is_linux || is_bsd) {
|
||||
if (is_asan || is_lsan || is_msan || is_tsan) {
|
||||
# For llvm-sanitizer.
|
||||
data += [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ]
|
||||
@@ -1372,7 +1412,7 @@ component("base") {
|
||||
"//base/third_party/xdg_user_dirs",
|
||||
]
|
||||
} else {
|
||||
- # Non-Linux.
|
||||
+ # Non-Linux/BSD.
|
||||
sources -= [
|
||||
"nix/mime_util_xdg.cc",
|
||||
"nix/mime_util_xdg.h",
|
||||
@@ -1388,6 +1428,20 @@ component("base") {
|
||||
# TODO(brettw) this will need to be parameterized at some point.
|
||||
linux_configs = []
|
||||
if (use_glib) {
|
||||
@@ -1925,6 +1931,33 @@ jumbo_component("base") {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (is_freebsd) {
|
||||
+ sources -= [
|
||||
+ "threading/platform_thread_linux.cc",
|
||||
+ ]
|
||||
+ sources += [ "threading/platform_thread_freebsd.cc" ]
|
||||
+ }
|
||||
+
|
||||
+ if (is_netbsd) {
|
||||
+ sources -= [
|
||||
+ "threading/platform_thread_linux.cc",
|
||||
+ "files/file_path_watcher_linux.cc",
|
||||
+ "files/file_util_linux.cc",
|
||||
+ "process/memory_linux.cc",
|
||||
+ "process/process_handle_linux.cc",
|
||||
+ "process/process_iterator_linux.cc",
|
||||
+ "process/process_metrics_linux.cc",
|
||||
+ "system/sys_info_linux.cc"
|
||||
+ ]
|
||||
+ sources += [
|
||||
+ "files/file_path_watcher_kqueue.cc",
|
||||
+ "files/file_path_watcher_kqueue.h",
|
||||
+ "files/file_path_watcher_stub.cc",
|
||||
+ "process/memory_stubs.cc",
|
||||
+ "process/process_handle_netbsd.cc",
|
||||
+ "process/process_iterator_netbsd.cc",
|
||||
+ "process/process_metrics_netbsd.cc",
|
||||
+ "system/sys_info_netbsd.cc",
|
||||
+ ]
|
||||
+ libs += [
|
||||
+ "execinfo", # logging.cc
|
||||
+ "kvm", # process_metrics_freebsd
|
||||
+ "util" # process_metrics_freebsd
|
||||
+ ]
|
||||
+ sources += [ "threading/platform_thread_netbsd.cc" ]
|
||||
+ }
|
||||
+
|
||||
# iOS
|
||||
if (is_ios) {
|
||||
set_sources_assignment_filter([])
|
||||
@@ -2154,6 +2208,12 @@ test("base_unittests") {
|
||||
set_sources_assignment_filter(sources_assignment_filter)
|
||||
sources -= [
|
||||
@@ -2987,7 +3020,7 @@ test("base_unittests") {
|
||||
]
|
||||
}
|
||||
|
||||
- if (is_linux) {
|
||||
+ if (is_linux || is_bsd) {
|
||||
sources += [ "debug/proc_maps_linux_unittest.cc" ]
|
||||
}
|
||||
|
||||
@@ -3026,7 +3059,7 @@ test("base_unittests") {
|
||||
"posix/unix_domain_socket_unittest.cc",
|
||||
"task/thread_pool/task_tracker_posix_unittest.cc",
|
||||
]
|
||||
- if (!is_nacl && !is_mac && !is_ios) {
|
||||
+ if (!is_nacl && !is_mac && !is_ios && !is_bsd) {
|
||||
sources += [ "profiler/stack_copier_signal_unittest.cc" ]
|
||||
}
|
||||
}
|
||||
@@ -3173,7 +3206,7 @@ test("base_unittests") {
|
||||
}
|
||||
}
|
||||
|
||||
- if (is_fuchsia || is_linux) {
|
||||
+ if (is_fuchsia || is_linux || is_bsd) {
|
||||
sources += [ "debug/elf_reader_unittest.cc" ]
|
||||
|
||||
deps += [ "//base/test:malloc_wrapper" ]
|
||||
@@ -3241,6 +3274,12 @@ test("base_unittests") {
|
||||
manifest = "//build/config/fuchsia/tests.cmx"
|
||||
}
|
||||
|
||||
+ if (is_bsd) {
|
||||
|
@ -98,6 +149,6 @@ $NetBSD$
|
|||
+ ]
|
||||
+ }
|
||||
+
|
||||
if (is_win) {
|
||||
deps += [ "//base:scoped_handle_test_dll" ]
|
||||
if (current_cpu == "x64") {
|
||||
if (!is_fuchsia && !is_ios) {
|
||||
sources += [ "files/file_locking_unittest.cc" ]
|
||||
}
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/allocator/BUILD.gn.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/allocator/BUILD.gn.orig 2020-07-15 18:55:48.000000000 +0000
|
||||
+++ base/allocator/BUILD.gn
|
||||
@@ -338,6 +338,9 @@ if (use_experimental_allocator_shim) {
|
||||
]
|
||||
} else if (is_linux && use_allocator == "none") {
|
||||
sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ]
|
||||
+ } else if (is_bsd && use_allocator == "none") {
|
||||
+ # TODO move the code to allocator_shim_default_dispatch_to_libc.cc"
|
||||
+ sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ]
|
||||
} else if (is_android && use_allocator == "none") {
|
||||
sources += [
|
||||
"allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
|
||||
@@ -64,7 +64,7 @@ config("tcmalloc_flags") {
|
||||
cflags = []
|
||||
}
|
||||
|
||||
- if (is_linux || is_android) {
|
||||
+ if (is_linux || is_android || is_bsd) {
|
||||
# We enable all warnings by default, but upstream disables a few.
|
||||
# Keep "-Wno-*" flags in sync with upstream by comparing against:
|
||||
# http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
|
||||
@@ -233,7 +233,7 @@ if (use_allocator == "tcmalloc") {
|
||||
defines += [ "ENABLE_PROFILING=1" ]
|
||||
}
|
||||
|
||||
- if (is_linux || is_android) {
|
||||
+ if (is_linux || is_android || is_bsd) {
|
||||
sources -= [
|
||||
"$tcmalloc_dir/src/system-alloc.h",
|
||||
"$tcmalloc_dir/src/windows/port.cc",
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/allocator/allocator_shim_default_dispatch_to_glibc.cc
|
||||
@@ -3,19 +3,46 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/allocator/allocator_shim.h"
|
||||
-
|
||||
-#include <malloc.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#if defined(OS_FREEBSD)
|
||||
+#include <malloc_np.h>
|
||||
+#endif
|
||||
|
||||
// This translation unit defines a default dispatch for the allocator shim which
|
||||
// routes allocations to libc functions.
|
||||
-// The code here is strongly inspired from tcmalloc's libc_override_glibc.h.
|
||||
+// The code here is strongly inspired from tcmalloc's override_glibc.h.
|
||||
|
||||
extern "C" {
|
||||
-void* __libc_malloc(size_t size);
|
||||
-void* __libc_calloc(size_t n, size_t size);
|
||||
-void* __libc_realloc(void* address, size_t size);
|
||||
-void* __libc_memalign(size_t alignment, size_t size);
|
||||
-void __libc_free(void* ptr);
|
||||
+#if defined(OS_FREEBSD)
|
||||
+void* __malloc(size_t size);
|
||||
+void* __calloc(size_t n, size_t size);
|
||||
+void* __realloc(void* address, size_t size);
|
||||
+void* __memalign(size_t alignment, size_t size) {
|
||||
+ void *ret;
|
||||
+ if (__posix_memalign(&ret, alignment, size) != 0) {
|
||||
+ return nullptr;
|
||||
+ } else {
|
||||
+ return ret;
|
||||
+ }
|
||||
+}
|
||||
+int __posix_memalign(void **ptr, size_t alignment, size_t size);
|
||||
+void __free(void* ptr);
|
||||
+#else
|
||||
+#define __malloc malloc
|
||||
+#define __calloc calloc
|
||||
+#define __realloc realloc
|
||||
+void* __memalign(size_t alignment, size_t size) {
|
||||
+ void *ret;
|
||||
+ if (posix_memalign(&ret, alignment, size) != 0) {
|
||||
+ return nullptr;
|
||||
+ } else {
|
||||
+ return ret;
|
||||
+ }
|
||||
+}
|
||||
+#define __posix_memalign posix_memalign
|
||||
+#define __free free
|
||||
+#endif
|
||||
} // extern "C"
|
||||
|
||||
namespace {
|
||||
@@ -23,23 +50,23 @@ namespace {
|
||||
using base::allocator::AllocatorDispatch;
|
||||
|
||||
void* GlibcMalloc(const AllocatorDispatch*, size_t size) {
|
||||
- return __libc_malloc(size);
|
||||
+ return __malloc(size);
|
||||
}
|
||||
|
||||
void* GlibcCalloc(const AllocatorDispatch*, size_t n, size_t size) {
|
||||
- return __libc_calloc(n, size);
|
||||
+ return __calloc(n, size);
|
||||
}
|
||||
|
||||
void* GlibcRealloc(const AllocatorDispatch*, void* address, size_t size) {
|
||||
- return __libc_realloc(address, size);
|
||||
+ return __realloc(address, size);
|
||||
}
|
||||
|
||||
void* GlibcMemalign(const AllocatorDispatch*, size_t alignment, size_t size) {
|
||||
- return __libc_memalign(alignment, size);
|
||||
+ return __memalign(alignment, size);
|
||||
}
|
||||
|
||||
void GlibcFree(const AllocatorDispatch*, void* address) {
|
||||
- __libc_free(address);
|
||||
+ __free(address);
|
||||
}
|
||||
|
||||
size_t GlibcGetSizeEstimate(const AllocatorDispatch*, void* address) {
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/allocator/allocator_shim_override_libc_symbols.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/allocator/allocator_shim_override_libc_symbols.h
|
||||
@@ -10,7 +10,7 @@
|
||||
#endif
|
||||
#define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_
|
||||
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#include "base/allocator/allocator_shim_internals.h"
|
||||
|
|
@ -1,63 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/allocator/allocator_shim_unittest.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/allocator/allocator_shim_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/allocator/allocator_shim_unittest.cc
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "base/allocator/allocator_shim.h"
|
||||
|
||||
-#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -193,11 +192,13 @@ TEST_F(AllocatorShimTest, InterceptLibcS
|
||||
ASSERT_GE(zero_allocs_intercepted_by_size[2 * 23], 1u);
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
+#if !defined(OS_BSD)
|
||||
void* memalign_ptr = memalign(128, 53);
|
||||
ASSERT_NE(nullptr, memalign_ptr);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(memalign_ptr) % 128);
|
||||
ASSERT_GE(aligned_allocs_intercepted_by_alignment[128], 1u);
|
||||
ASSERT_GE(aligned_allocs_intercepted_by_size[53], 1u);
|
||||
+#endif
|
||||
|
||||
void* posix_memalign_ptr = nullptr;
|
||||
int res = posix_memalign(&posix_memalign_ptr, 256, 59);
|
||||
@@ -214,12 +215,14 @@ TEST_F(AllocatorShimTest, InterceptLibcS
|
||||
ASSERT_GE(aligned_allocs_intercepted_by_alignment[kPageSize], 1u);
|
||||
ASSERT_GE(aligned_allocs_intercepted_by_size[61], 1u);
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
void* pvalloc_ptr = pvalloc(67);
|
||||
ASSERT_NE(nullptr, pvalloc_ptr);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(pvalloc_ptr) % kPageSize);
|
||||
ASSERT_GE(aligned_allocs_intercepted_by_alignment[kPageSize], 1u);
|
||||
// pvalloc rounds the size up to the next page.
|
||||
ASSERT_GE(aligned_allocs_intercepted_by_size[kPageSize], 1u);
|
||||
+#endif
|
||||
#endif // OS_WIN
|
||||
|
||||
char* realloc_ptr = static_cast<char*>(realloc(nullptr, 71));
|
||||
@@ -240,8 +243,10 @@ TEST_F(AllocatorShimTest, InterceptLibcS
|
||||
ASSERT_GE(frees_intercepted_by_addr[Hash(zero_alloc_ptr)], 1u);
|
||||
|
||||
#if !defined(OS_WIN)
|
||||
+#if !defined(OS_BSD)
|
||||
free(memalign_ptr);
|
||||
ASSERT_GE(frees_intercepted_by_addr[Hash(memalign_ptr)], 1u);
|
||||
+#endif
|
||||
|
||||
free(posix_memalign_ptr);
|
||||
ASSERT_GE(frees_intercepted_by_addr[Hash(posix_memalign_ptr)], 1u);
|
||||
@@ -249,8 +254,10 @@ TEST_F(AllocatorShimTest, InterceptLibcS
|
||||
free(valloc_ptr);
|
||||
ASSERT_GE(frees_intercepted_by_addr[Hash(valloc_ptr)], 1u);
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
free(pvalloc_ptr);
|
||||
ASSERT_GE(frees_intercepted_by_addr[Hash(pvalloc_ptr)], 1u);
|
||||
+#endif
|
||||
#endif // OS_WIN
|
||||
|
||||
free(realloc_ptr);
|
||||
@@ -557,7 +557,7 @@ static size_t GetAllocatedSize(void* ptr
|
||||
static size_t GetAllocatedSize(void* ptr) {
|
||||
return malloc_size(ptr);
|
||||
}
|
||||
-#elif defined(OS_LINUX)
|
||||
+#elif defined(OS_LINUX) || defined(OS_BSD)
|
||||
static size_t GetAllocatedSize(void* ptr) {
|
||||
return malloc_usable_size(ptr);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/allocator/partition_allocator/page_allocator_internals_posix.h
|
||||
@@ -24,7 +24,7 @@
|
||||
#if defined(OS_ANDROID)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <algorithm>
|
|
@ -0,0 +1,19 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/allocator/partition_allocator/partition_alloc_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/allocator/partition_allocator/partition_alloc_unittest.cc
|
||||
@@ -313,9 +313,13 @@ void FreeFullPage(PartitionRoot<base::in
|
||||
}
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
bool CheckPageInCore(void* ptr, bool in_core) {
|
||||
+#if defined(OS_BSD)
|
||||
+ char ret = 0;
|
||||
+#else
|
||||
unsigned char ret = 0;
|
||||
+#endif
|
||||
EXPECT_EQ(0, mincore(ptr, kSystemPageSize, &ret));
|
||||
return in_core == (ret & 1);
|
||||
}
|
|
@ -1,47 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/base_paths_posix.cc.orig 2016-11-10 20:02:09.000000000 +0000
|
||||
--- base/base_paths_posix.cc.orig 2020-07-15 18:55:48.000000000 +0000
|
||||
+++ base/base_paths_posix.cc
|
||||
@@ -24,9 +24,10 @@
|
||||
#include "base/process/process_metrics.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_FREEBSD)
|
||||
+#if defined(OS_BSD)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
+#include <unistd.h>
|
||||
#elif defined(OS_SOLARIS)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
@@ -59,6 +60,30 @@ bool PathProviderPosix(int key, FilePath
|
||||
@@ -67,7 +67,7 @@ bool PathProviderPosix(int key, FilePath
|
||||
}
|
||||
*result = FilePath(FilePath::StringType(bin_dir, length - 1));
|
||||
*result = FilePath(bin_dir);
|
||||
return true;
|
||||
+#elif defined(OS_NETBSD)
|
||||
+ char pathname[MAXPATHLEN];
|
||||
+ int mib[4];
|
||||
+ int ret;
|
||||
+ size_t size;
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC_ARGS;
|
||||
+ mib[2] = getpid();
|
||||
+ mib[3] = KERN_PROC_PATHNAME;
|
||||
+
|
||||
+ size = sizeof(pathname);
|
||||
+ ret = sysctl(mib, 4, NULL, &size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ ret = sysctl(mib, 4, pathname, &size, NULL, 0);
|
||||
+ if (ret == -1 || strlen(pathname) == 0) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ *result = FilePath(FilePath::StringType(pathname, size - 1));
|
||||
+ return true;
|
||||
#elif defined(OS_SOLARIS)
|
||||
char bin_dir[PATH_MAX + 1];
|
||||
if (realpath(getexecname(), bin_dir) == NULL) {
|
||||
-#elif defined(OS_OPENBSD) || defined(OS_AIX)
|
||||
+#elif defined(OS_OPENBSD) || defined(OS_AIX) || defined(OS_NETBSD)
|
||||
// There is currently no way to get the executable path on OpenBSD
|
||||
char* cpath;
|
||||
if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/base_switches.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/base_switches.cc
|
||||
@@ -117,7 +117,7 @@ const char kDisableHighResTimer[] = "dis
|
||||
const char kDisableUsbKeyboardDetect[] = "disable-usb-keyboard-detect";
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
+#if (defined(OS_LINUX) || defined(OS_BSD)) && !defined(OS_CHROMEOS)
|
||||
// The /dev/shm partition is too small in certain VM environments, causing
|
||||
// Chrome to fail or crash (see http://crbug.com/715363). Use this flag to
|
||||
// work-around this issue (a temporary directory will always be used to create
|
||||
@@ -142,7 +142,7 @@ const char kReachedCodeSamplingIntervalU
|
||||
"reached-code-sampling-interval-us";
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// Controls whether or not retired instruction counts are surfaced for threads
|
||||
// in trace events on Linux.
|
||||
//
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/base_switches.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/base_switches.h
|
||||
@@ -38,7 +38,7 @@ extern const char kDisableHighResTimer[]
|
||||
extern const char kDisableUsbKeyboardDetect[];
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
+#if (defined(OS_LINUX) || defined(OS_BSD)) && !defined(OS_CHROMEOS)
|
||||
extern const char kDisableDevShmUsage[];
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ extern const char kEnableReachedCodeProf
|
||||
extern const char kOrderfileMemoryOptimization[];
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
extern const char kEnableThreadInstructionCount[];
|
||||
#endif
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/cpu.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/cpu.cc
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "base/stl_util.h"
|
||||
|
||||
-#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX))
|
||||
+#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD))
|
||||
#include "base/files/file_util.h"
|
||||
#endif
|
||||
|
||||
@@ -136,7 +136,7 @@ uint64_t xgetbv(uint32_t xcr) {
|
||||
|
||||
#endif // ARCH_CPU_X86_FAMILY
|
||||
|
||||
-#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX))
|
||||
+#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD))
|
||||
std::string* CpuInfoBrand() {
|
||||
static std::string* brand = []() {
|
||||
// This function finds the value from /proc/cpuinfo under the key "model
|
||||
@@ -288,7 +288,7 @@ void CPU::Initialize() {
|
||||
}
|
||||
}
|
||||
#elif defined(ARCH_CPU_ARM_FAMILY)
|
||||
-#if (defined(OS_ANDROID) || defined(OS_LINUX))
|
||||
+#if (defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD))
|
||||
cpu_brand_ = *CpuInfoBrand();
|
||||
#elif defined(OS_WIN)
|
||||
// Windows makes high-resolution thread timing information available in
|
|
@ -1,62 +1,49 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/debugger_posix.cc.orig 2016-11-12 05:46:21.381633820 +0000
|
||||
--- base/debug/debugger_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/debug/debugger_posix.cc
|
||||
@@ -54,8 +54,48 @@
|
||||
namespace base {
|
||||
namespace debug {
|
||||
|
||||
-#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
+#if defined(OS_NETBSD)
|
||||
+bool BeingDebugged() {
|
||||
+ static bool is_set = false;
|
||||
+ static bool being_debugged = false;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (is_set)
|
||||
+ return being_debugged;
|
||||
+
|
||||
+ int mib[6];
|
||||
+ size_t size;
|
||||
+ struct kinfo_proc2 kproc;
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = getpid();
|
||||
+ mib[4] = sizeof(kinfo_proc2);
|
||||
+ mib[5] = 1;
|
||||
+
|
||||
+ ret = sysctl((int *)mib, 6, NULL, &size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ mib[5] = (size / sizeof(kinfo_proc2));
|
||||
|
||||
+ ret = sysctl((int *)mib, 6, &kproc, &size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return -1;
|
||||
+ is_set = true;
|
||||
+ being_debugged = false;
|
||||
+ return being_debugged;
|
||||
+ }
|
||||
+
|
||||
+ is_set = true;
|
||||
+ being_debugged = (kproc.p_flag & P_TRACED) != 0;
|
||||
+ return being_debugged;
|
||||
+
|
||||
+}
|
||||
+#else
|
||||
+#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
// Based on Apple's recommended method as described in
|
||||
// http://developer.apple.com/qa/qa2004/qa1361.html
|
||||
bool BeingDebugged() {
|
||||
@@ -167,6 +207,7 @@ bool BeingDebugged() {
|
||||
}
|
||||
@@ -93,6 +93,7 @@ bool BeingDebugged() {
|
||||
|
||||
// Initialize mib, which tells sysctl what info we want. In this case,
|
||||
// we're looking for information about a specific process ID.
|
||||
+#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
|
||||
int mib[] = {
|
||||
CTL_KERN,
|
||||
KERN_PROC,
|
||||
@@ -103,10 +104,24 @@ bool BeingDebugged() {
|
||||
0
|
||||
#endif
|
||||
};
|
||||
+#elif defined(OS_NETBSD)
|
||||
+ int mib[] = {
|
||||
+ CTL_KERN,
|
||||
+ KERN_PROC2,
|
||||
+ KERN_PROC_PID,
|
||||
+ getpid(),
|
||||
+ sizeof(struct kinfo_proc2),
|
||||
+ 1
|
||||
+ };
|
||||
+#endif
|
||||
|
||||
// We want to break into the debugger in Debug mode, and cause a crash dump in
|
||||
// Release mode. Breakpad behaves as follows:
|
||||
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
|
||||
// binary interfaces may change.
|
||||
+#if defined(OS_NETBSD)
|
||||
+ struct kinfo_proc2 info;
|
||||
+#else
|
||||
struct kinfo_proc info;
|
||||
+#endif
|
||||
size_t info_size = sizeof(info);
|
||||
|
||||
#if defined(OS_OPENBSD)
|
||||
@@ -114,6 +129,11 @@ bool BeingDebugged() {
|
||||
return -1;
|
||||
|
||||
mib[5] = (info_size / sizeof(struct kinfo_proc));
|
||||
+#elif defined(OS_NETBSD)
|
||||
+ if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ mib[5] = (info_size / sizeof(struct kinfo_proc2));
|
||||
#endif
|
||||
|
||||
int sysctl_result = sysctl(mib, base::size(mib), &info, &info_size, NULL, 0);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/elf_reader.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/debug/elf_reader.cc
|
||||
@@ -36,7 +36,9 @@ using Nhdr = Elf64_Nhdr;
|
||||
using Word = Elf64_Word;
|
||||
#endif
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
constexpr char kGnuNoteName[] = "GNU";
|
||||
+#endif
|
||||
|
||||
// Returns a pointer to the header of the ELF binary mapped into memory,
|
||||
// or a null pointer if the header is invalid.
|
||||
@@ -99,6 +101,7 @@ size_t ReadElfBuildId(const void* elf_ma
|
||||
bool found = false;
|
||||
while (current_section < section_end) {
|
||||
current_note = reinterpret_cast<const Nhdr*>(current_section);
|
||||
+#if !defined(OS_BSD)
|
||||
if (current_note->n_type == NT_GNU_BUILD_ID) {
|
||||
StringPiece note_name(current_section + sizeof(Nhdr),
|
||||
current_note->n_namesz);
|
||||
@@ -108,6 +111,7 @@ size_t ReadElfBuildId(const void* elf_ma
|
||||
break;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
size_t section_size = bits::Align(current_note->n_namesz, 4) +
|
||||
bits::Align(current_note->n_descsz, 4) +
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/proc_maps_linux.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/debug/proc_maps_linux.cc
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "base/strings/string_split.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_ANDROID)
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/proc_maps_linux.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/debug/proc_maps_linux.cc
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "base/strings/string_split.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
namespace base {
|
||||
namespace debug {
|
||||
|
||||
+#if defined(OS_FREEBSD)
|
||||
+const char kProcSelfMapsPath[] = "/proc/curproc/map";
|
||||
+#elif defined(OS_NETBSD)
|
||||
+const char kProcSelfMapsPath[] = "/proc/self/map";
|
||||
+#else
|
||||
+const char kProcSelfMapsPath[] = "/proc/self/map";
|
||||
+
|
||||
// Scans |proc_maps| starting from |pos| returning true if the gate VMA was
|
||||
// found, otherwise returns false.
|
||||
static bool ContainsGateVMA(std::string* proc_maps, size_t pos) {
|
||||
@@ -44,15 +51,16 @@ static bool ContainsGateVMA(std::string*
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
bool ReadProcMaps(std::string* proc_maps) {
|
||||
// seq_file only writes out a page-sized amount on each call. Refer to header
|
||||
// file for details.
|
||||
const long kReadSize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
- base::ScopedFD fd(HANDLE_EINTR(open("/proc/self/maps", O_RDONLY)));
|
||||
+ base::ScopedFD fd(HANDLE_EINTR(open(kProcSelfMapsPath, O_RDONLY)));
|
||||
if (!fd.is_valid()) {
|
||||
- DPLOG(ERROR) << "Couldn't open /proc/self/maps";
|
||||
+ DPLOG(ERROR) << "Couldn't open " << kProcSelfMapsPath;
|
||||
return false;
|
||||
}
|
||||
proc_maps->clear();
|
||||
@@ -66,7 +74,7 @@ bool ReadProcMaps(std::string* proc_maps
|
||||
|
||||
ssize_t bytes_read = HANDLE_EINTR(read(fd.get(), buffer, kReadSize));
|
||||
if (bytes_read < 0) {
|
||||
- DPLOG(ERROR) << "Couldn't read /proc/self/maps";
|
||||
+ DPLOG(ERROR) << "Couldn't read " << kProcSelfMapsPath;
|
||||
proc_maps->clear();
|
||||
return false;
|
||||
}
|
||||
@@ -77,6 +85,7 @@ bool ReadProcMaps(std::string* proc_maps
|
||||
if (bytes_read == 0)
|
||||
break;
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
// The gate VMA is handled as a special case after seq_file has finished
|
||||
// iterating through all entries in the virtual memory table.
|
||||
//
|
||||
@@ -87,6 +96,7 @@ bool ReadProcMaps(std::string* proc_maps
|
||||
// Avoid this by searching for the gate VMA and breaking early.
|
||||
if (ContainsGateVMA(proc_maps, pos))
|
||||
break;
|
||||
+#endif
|
||||
}
|
||||
|
||||
return true;
|
|
@ -1,19 +1,27 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/stack_trace_posix.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/debug/stack_trace_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/debug/stack_trace_posix.cc
|
||||
@@ -571,6 +571,10 @@ class SandboxSymbolizeHelper {
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
#include "base/debug/proc_maps_linux.h"
|
||||
#endif
|
||||
|
||||
@@ -657,6 +657,9 @@ class SandboxSymbolizeHelper {
|
||||
// for the modules that are loaded in the current process.
|
||||
// Returns true on success.
|
||||
bool CacheMemoryRegions() {
|
||||
+#if defined(OS_FREEBSD) || defined(OS_NETBSD)
|
||||
+ // TODO (rene) avoid link error, implement something?
|
||||
+#if defined(OS_BSD)
|
||||
+ return false;
|
||||
+#else
|
||||
// Reads /proc/self/maps.
|
||||
std::string contents;
|
||||
if (!ReadProcMaps(&contents)) {
|
||||
@@ -586,6 +590,7 @@ class SandboxSymbolizeHelper {
|
||||
@@ -674,6 +677,7 @@ class SandboxSymbolizeHelper {
|
||||
|
||||
is_initialized_ = true;
|
||||
return true;
|
||||
|
@ -21,3 +29,15 @@ $NetBSD$
|
|||
}
|
||||
|
||||
// Opens all object files and caches their file descriptors.
|
||||
@@ -697,7 +701,11 @@ class SandboxSymbolizeHelper {
|
||||
// Skip regions with empty file names.
|
||||
continue;
|
||||
}
|
||||
+#if defined(OS_BSD)
|
||||
if (region.path[0] == '[') {
|
||||
+#else
|
||||
+ if (region.path[0] == '[') {
|
||||
+#endif
|
||||
// Skip pseudo-paths, like [stack], [vdso], [heap], etc ...
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/stack_trace_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/debug/stack_trace_unittest.cc
|
||||
@@ -86,6 +86,7 @@ TEST_F(StackTraceTest, OutputToStream) {
|
||||
std::string::npos)
|
||||
<< "Unable to resolve symbols.";
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
// Expect a demangled symbol.
|
||||
// Note that Windows Release builds omit the function parameters from the
|
||||
// demangled stack output, otherwise this could be "testing::Test::Run()".
|
||||
@@ -103,9 +104,10 @@ TEST_F(StackTraceTest, OutputToStream) {
|
||||
EXPECT_TRUE(backtrace_message.find(__func__) != std::string::npos)
|
||||
<< "Expected to find " << __func__ << " in backtrace:\n"
|
||||
<< backtrace_message;
|
||||
+#endif
|
||||
}
|
||||
|
||||
-#if !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES)
|
||||
+#if !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) && !defined(OS_BSD)
|
||||
// Disabled in Official builds, where Link-Time Optimization can result in two
|
||||
// or fewer stack frames being available, causing the test to fail.
|
||||
TEST_F(StackTraceTest, TruncatedTrace) {
|
|
@ -1,18 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/debug/thread_heap_usage_tracker.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/debug/thread_heap_usage_tracker.cc
|
||||
@@ -14,11 +14,13 @@
|
||||
#include "base/threading/thread_local_storage.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
#if defined(OS_MACOSX) || defined(OS_IOS)
|
||||
#include <malloc/malloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
namespace base {
|
||||
namespace debug {
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_path_unittest.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/files/file_path_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/file_path_unittest.cc
|
||||
@@ -1133,7 +1133,7 @@ TEST_F(FilePathTest, FromUTF8Unsafe_And_
|
||||
@@ -1149,7 +1149,7 @@ TEST_F(FilePathTest, FromUTF8Unsafe_And_
|
||||
"\xEF\xBC\xA1\xEF\xBC\xA2\xEF\xBC\xA3.txt" },
|
||||
};
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_path_watcher_kqueue.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/files/file_path_watcher_kqueue.h
|
||||
@@ -5,6 +5,10 @@
|
||||
#ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
|
||||
#define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
|
||||
|
||||
+#ifdef __FreeBSD__
|
||||
+#include <sys/stdint.h>
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
#include <sys/event.h>
|
||||
|
||||
#include <memory>
|
|
@ -0,0 +1,49 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_path_watcher_stub.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/file_path_watcher_stub.cc
|
||||
@@ -5,10 +5,13 @@
|
||||
// This file exists for Unix systems which don't have the inotify headers, and
|
||||
// thus cannot build file_watcher_inotify.cc
|
||||
|
||||
+#include <memory>
|
||||
#include "base/files/file_path_watcher.h"
|
||||
+#include "base/files/file_path_watcher_kqueue.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
+#include "build/build_config.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
@@ -22,12 +25,29 @@ class FilePathWatcherImpl : public FileP
|
||||
bool Watch(const FilePath& path,
|
||||
bool recursive,
|
||||
const FilePathWatcher::Callback& callback) override {
|
||||
+#if defined(OS_BSD)
|
||||
+ DCHECK(!impl_.get());
|
||||
+ if (recursive) {
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ impl_ = std::make_unique<FilePathWatcherKQueue>();
|
||||
+ }
|
||||
+ DCHECK(impl_.get());
|
||||
+ return impl_->Watch(path, recursive, callback);
|
||||
+#else
|
||||
return false;
|
||||
+#endif
|
||||
}
|
||||
|
||||
- void Cancel() override {}
|
||||
+ void Cancel() override {
|
||||
+ if (impl_.get())
|
||||
+ impl_->Cancel();
|
||||
+ set_cancelled();
|
||||
+ }
|
||||
|
||||
private:
|
||||
+ std::unique_ptr<PlatformDelegate> impl_;
|
||||
+
|
||||
DISALLOW_COPY_AND_ASSIGN(FilePathWatcherImpl);
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_path_watcher_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/file_path_watcher_unittest.cc
|
||||
@@ -798,7 +798,7 @@ enum Permission {
|
||||
Execute
|
||||
};
|
||||
|
||||
-#if defined(OS_MACOSX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
|
||||
struct stat stat_buf;
|
||||
|
||||
@@ -829,7 +829,7 @@ bool ChangeFilePermissions(const FilePat
|
||||
}
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
-#if defined(OS_MACOSX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
// Linux implementation of FilePathWatcher doesn't catch attribute changes.
|
||||
// http://crbug.com/78043
|
||||
// Windows implementation of FilePathWatcher catches attribute changes that
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_util.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/files/file_util.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/file_util.h
|
||||
@@ -404,7 +404,7 @@ BASE_EXPORT bool VerifyPathControlledByA
|
||||
@@ -582,7 +582,7 @@ BASE_EXPORT bool VerifyPathControlledByA
|
||||
// the directory |path|, in the number of FilePath::CharType, or -1 on failure.
|
||||
BASE_EXPORT int GetMaximumPathComponentLength(const base::FilePath& path);
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
-#if defined(OS_LINUX) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_AIX) || defined(OS_BSD)
|
||||
// Broad categories of file systems as returned by statfs() on Linux.
|
||||
enum FileSystemType {
|
||||
FILE_SYSTEM_UNKNOWN, // statfs failed.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_util_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/file_util_posix.cc
|
||||
@@ -415,7 +415,7 @@ bool CreatePipe(ScopedFD* read_fd, Scope
|
||||
}
|
||||
|
||||
bool CreateLocalNonBlockingPipe(int fds[2]) {
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0;
|
||||
#else
|
||||
int raw_fds[2];
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/file_util_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/file_util_unittest.cc
|
||||
@@ -3501,7 +3501,7 @@ TEST_F(FileUtilTest, ReadFileToStringWit
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD)
|
||||
TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) {
|
||||
FilePath file_path("/proc/cpuinfo");
|
||||
std::string data = "temp";
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/files/scoped_file.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/files/scoped_file.cc
|
||||
@@ -31,7 +31,7 @@ void ScopedFDCloseTraits::Free(int fd) {
|
||||
int ret = IGNORE_EINTR(close(fd));
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_FUCHSIA) || \
|
||||
- defined(OS_ANDROID)
|
||||
+ defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// NB: Some file descriptors can return errors from close() e.g. network
|
||||
// filesystems such as NFS and Linux input devices. On Linux, macOS, and
|
||||
// Fuchsia's POSIX layer, errors from close other than EBADF do not indicate
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/i18n/icu_util.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/i18n/icu_util.cc
|
||||
@@ -49,7 +49,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(OS_ANDROID) || defined(OS_FUCHSIA) || \
|
||||
- (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST))
|
||||
+ (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST)) || defined(OS_BSD)
|
||||
#include "third_party/icu/source/i18n/unicode/timezone.h"
|
||||
#endif
|
||||
|
||||
@@ -341,7 +341,7 @@ void InitializeIcuTimeZone() {
|
||||
fuchsia::IntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
|
||||
icu::TimeZone::adoptDefault(
|
||||
icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
|
||||
-#elif defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST)
|
||||
+#elif (defined(OS_LINUX) || defined(OS_BSD)) && !BUILDFLAG(IS_CHROMECAST)
|
||||
// To respond to the time zone change properly, the default time zone
|
||||
// cache in ICU has to be populated on starting up.
|
||||
// See TimeZoneMonitorLinux::NotifyClientsFromImpl().
|
|
@ -1,20 +1,12 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/linux_util.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/linux_util.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/linux_util.cc
|
||||
@@ -110,12 +110,14 @@ char g_linux_distro[kDistroSize] =
|
||||
"CrOS";
|
||||
#elif defined(OS_ANDROID)
|
||||
"Android";
|
||||
+#elif defined(OS_BSD)
|
||||
+ "BSD";
|
||||
#else // if defined(OS_LINUX)
|
||||
"Unknown";
|
||||
#endif
|
||||
|
||||
std::string GetLinuxDistro() {
|
||||
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
return g_linux_distro;
|
||||
#elif defined(OS_LINUX)
|
||||
LinuxDistroHelper* distro_state_singleton = LinuxDistroHelper::GetInstance();
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "base/files/dir_reader_posix.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/files/scoped_file.h"
|
||||
+#include "base/logging.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/safe_sprintf.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/location_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/location_unittest.cc
|
||||
@@ -32,7 +32,7 @@ TEST(LocationTest, CurrentYieldsCorrectV
|
||||
EXPECT_EQ(here.line_number(), previous_line + 1);
|
||||
EXPECT_STREQ("TestBody", here.function_name());
|
||||
#endif
|
||||
-#elif defined(OFFICIAL_BUILD)
|
||||
+#elif defined(OFFICIAL_BUILD) && !defined(OS_BSD)
|
||||
#error Location builtins must be supported in official builds.
|
||||
#elif BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS)
|
||||
#error FROM_HERE requires location builtins to be supported.
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/logging_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/logging_unittest.cc
|
||||
@@ -552,7 +552,7 @@ void CheckCrashTestSighandler(int, sigin
|
||||
// need the arch-specific boilerplate below, which is inspired by breakpad.
|
||||
// At the same time, on OSX, ucontext.h is deprecated but si_addr works fine.
|
||||
uintptr_t crash_addr = 0;
|
||||
-#if defined(OS_MACOSX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
crash_addr = reinterpret_cast<uintptr_t>(info->si_addr);
|
||||
#else // OS_POSIX && !OS_MACOSX
|
||||
ucontext_t* context = reinterpret_cast<ucontext_t*>(context_ptr);
|
|
@ -0,0 +1,40 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/memory/discardable_memory.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/memory/discardable_memory.cc
|
||||
@@ -23,7 +23,7 @@ const base::Feature kMadvFreeDiscardable
|
||||
"MadvFreeDiscardableMemory", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
const base::Feature kDiscardableMemoryBackingTrial{
|
||||
"DiscardableMemoryBackingTrial", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
@@ -47,7 +47,7 @@ const base::FeatureParam<DiscardableMemo
|
||||
|
||||
namespace {
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
|
||||
DiscardableMemoryBacking GetBackingForFieldTrial() {
|
||||
DiscardableMemoryTrialGroup trial_group =
|
||||
@@ -65,7 +65,7 @@ DiscardableMemoryBacking GetBackingForFi
|
||||
|
||||
} // namespace
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
|
||||
// Probe capabilities of this device to determine whether we should participate
|
||||
// in the discardable memory backing trial.
|
||||
@@ -94,7 +94,7 @@ DiscardableMemory::DiscardableMemory() =
|
||||
DiscardableMemory::~DiscardableMemory() = default;
|
||||
|
||||
DiscardableMemoryBacking GetDiscardableMemoryBacking() {
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
if (DiscardableMemoryBackingFieldTrialIsEnabled()) {
|
||||
return GetBackingForFieldTrial();
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/memory/discardable_memory_internal.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/memory/discardable_memory_internal.h
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
|
||||
namespace base {
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/memory/madv_free_discardable_memory_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/memory/madv_free_discardable_memory_posix.cc
|
||||
@@ -292,7 +292,7 @@ void MadvFreeDiscardableMemoryPosix::Set
|
||||
|
||||
bool MadvFreeDiscardableMemoryPosix::IsResident() const {
|
||||
DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_);
|
||||
-#ifdef OS_MACOSX
|
||||
+#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
std::vector<char> vec(allocated_pages_);
|
||||
#else
|
||||
std::vector<unsigned char> vec(allocated_pages_);
|
|
@ -0,0 +1,31 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/memory/platform_shared_memory_region.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/memory/platform_shared_memory_region.h
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "base/files/scoped_file.h"
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
namespace content {
|
||||
class SandboxIPCHandler;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class BASE_EXPORT PlatformSharedMemoryRe
|
||||
kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE
|
||||
};
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) | defined(OS_BSD)
|
||||
// Structure to limit access to executable region creation.
|
||||
struct ExecutableRegion {
|
||||
private:
|
||||
@@ -266,7 +266,7 @@ class BASE_EXPORT PlatformSharedMemoryRe
|
||||
CheckPlatformHandlePermissionsCorrespondToMode);
|
||||
static PlatformSharedMemoryRegion Create(Mode mode,
|
||||
size_t size
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
,
|
||||
bool executable = false
|
||||
#endif
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/memory/platform_shared_memory_region_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/memory/platform_shared_memory_region_posix.cc
|
||||
@@ -70,7 +70,7 @@ FDPair ScopedFDPair::get() const {
|
||||
return {fd.get(), readonly_fd.get()};
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// static
|
||||
ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) {
|
||||
PlatformSharedMemoryRegion region =
|
||||
@@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtIn
|
||||
// static
|
||||
PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
|
||||
size_t size
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
,
|
||||
bool executable
|
||||
#endif
|
|
@ -0,0 +1,17 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/memory/shared_memory_region_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/memory/shared_memory_region_unittest.cc
|
||||
@@ -188,10 +188,12 @@ TYPED_TEST(SharedMemoryRegionTest, MapAt
|
||||
std::tie(region, rw_mapping) = CreateMappedRegion<TypeParam>(kDataSize);
|
||||
ASSERT_TRUE(region.IsValid());
|
||||
ASSERT_TRUE(rw_mapping.IsValid());
|
||||
+#if !defined(OS_BSD)
|
||||
off_t offset = kDataSize / 2;
|
||||
typename TypeParam::MappingType mapping =
|
||||
region.MapAt(offset, kDataSize - offset);
|
||||
EXPECT_FALSE(mapping.IsValid());
|
||||
+#endif
|
||||
}
|
||||
|
||||
TYPED_TEST(SharedMemoryRegionTest, MapZeroBytesFails) {
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/native_library_posix.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/native_library_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/native_library_posix.cc
|
||||
@@ -35,7 +35,7 @@ NativeLibrary LoadNativeLibraryWithOptio
|
||||
@@ -29,7 +29,7 @@ NativeLibrary LoadNativeLibraryWithOptio
|
||||
// http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892,
|
||||
// and http://crbug.com/40794.
|
||||
int flags = RTLD_LAZY;
|
||||
-#if defined(OS_ANDROID) || !defined(RTLD_DEEPBIND)
|
||||
+#if defined(OS_ANDROID) || !defined(RTLD_DEEPBIND) || defined(OS_BSD)
|
||||
// Certain platforms don't define RTLD_DEEPBIND. Android dlopen() requires
|
||||
// further investigation, as it might vary across versions. Crash here to
|
||||
// warn developers that they're trying to rely on uncertain behavior.
|
||||
CHECK(!options.prefer_own_symbols);
|
||||
-#else
|
||||
+#elif !defined(OS_BSD)
|
||||
if (options.prefer_own_symbols)
|
||||
flags |= RTLD_DEEPBIND;
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/native_library_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/native_library_unittest.cc
|
||||
@@ -121,7 +121,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
|
||||
// versions with respect to symbol resolution scope.
|
||||
// TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255
|
||||
#if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) && \
|
||||
- !defined(MEMORY_SANITIZER)
|
||||
+ !defined(MEMORY_SANITIZER) && !defined(OS_BSD)
|
||||
|
||||
// Verifies that the |prefer_own_symbols| option satisfies its guarantee that
|
||||
// a loaded library will always prefer local symbol resolution before
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/path_service_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/path_service_unittest.cc
|
||||
@@ -37,7 +37,7 @@ bool ReturnsValidPath(int dir_type) {
|
||||
if (dir_type == DIR_CACHE)
|
||||
check_path_exists = false;
|
||||
#endif
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// On the linux try-bots: a path is returned (e.g. /home/chrome-bot/Desktop),
|
||||
// but it doesn't exist.
|
||||
if (dir_type == DIR_USER_DESKTOP)
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/posix/can_lower_nice_to.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/posix/can_lower_nice_to.cc
|
||||
@@ -31,6 +31,9 @@ bool CanLowerNiceTo(int nice_value) {
|
||||
if (geteuid() == 0)
|
||||
return true;
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+ return false;
|
||||
+#else
|
||||
// 2. Skip checking the CAP_SYS_NICE permission because it would require
|
||||
// libcap.so.
|
||||
|
||||
@@ -54,6 +57,7 @@ bool CanLowerNiceTo(int nice_value) {
|
||||
// And lowering niceness to |nice_value| is allowed if it is greater than or
|
||||
// equal to the limit:
|
||||
return nice_value >= lowest_nice_allowed;
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace internal
|
|
@ -0,0 +1,56 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/posix/unix_domain_socket.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/posix/unix_domain_socket.cc
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/ucred.h>
|
||||
#if !defined(OS_NACL_NONSFI)
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
@@ -57,7 +59,7 @@ bool CreateSocketPair(ScopedFD* one, Sco
|
||||
|
||||
// static
|
||||
bool UnixDomainSocket::EnableReceiveProcessId(int fd) {
|
||||
-#if !defined(OS_MACOSX)
|
||||
+#if !defined(OS_MACOSX) && !defined(OS_NETBSD)
|
||||
const int enable = 1;
|
||||
return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
|
||||
#else
|
||||
@@ -151,7 +153,11 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
|
||||
#if !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX)
|
||||
// The PNaCl toolchain for Non-SFI binary build and macOS do not support
|
||||
// ucred. macOS supports xucred, but this structure is insufficient.
|
||||
+#if defined(OS_NETBSD)
|
||||
+ + CMSG_SPACE(sizeof(struct unpcbid))
|
||||
+#else
|
||||
+ CMSG_SPACE(sizeof(struct ucred))
|
||||
+#endif
|
||||
#endif // OS_NACL_NONSFI or OS_MACOSX
|
||||
;
|
||||
char control_buffer[kControlBufferSize];
|
||||
@@ -176,7 +182,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
|
||||
wire_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
|
||||
wire_fds_len = payload_len / sizeof(int);
|
||||
}
|
||||
-#if !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX)
|
||||
+#if !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX) && !defined(OS_NETBSD)
|
||||
// The PNaCl toolchain for Non-SFI binary build and macOS do not support
|
||||
// SCM_CREDENTIALS.
|
||||
if (cmsg->cmsg_level == SOL_SOCKET &&
|
||||
@@ -211,6 +217,12 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
|
||||
socklen_t pid_size = sizeof(pid);
|
||||
if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size) != 0)
|
||||
pid = -1;
|
||||
+#elif defined(OS_NETBSD)
|
||||
+ socklen_t pid_size = sizeof(pid);
|
||||
+ struct unpcbid cred;
|
||||
+ if (getsockopt(fd, 0, LOCAL_PEEREID, &cred, &pid_size) != 0)
|
||||
+ pid = -1;
|
||||
+ pid = cred.unp_pid;
|
||||
#else
|
||||
// |pid| will legitimately be -1 if we read EOF, so only DCHECK if we
|
||||
// actually received a message. Unfortunately, Linux allows sending zero
|
|
@ -1,47 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/posix/unix_domain_socket_linux.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/posix/unix_domain_socket_linux.cc
|
||||
@@ -23,6 +23,15 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+// Port over Linux ucred structure
|
||||
+struct ucred {
|
||||
+ pid_t pid; // process ID of the sending process
|
||||
+ uid_t uid; // user ID of the sending process
|
||||
+ gid_t gid; // group ID of the sending process
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
const size_t UnixDomainSocket::kMaxFileDescriptors = 16;
|
||||
|
||||
#if !defined(OS_NACL_NONSFI)
|
||||
@@ -40,8 +49,14 @@ static bool CreateSocketPair(ScopedFD* o
|
||||
|
||||
// static
|
||||
bool UnixDomainSocket::EnableReceiveProcessId(int fd) {
|
||||
+#if defined(OS_BSD)
|
||||
+ // XXX(rene) do this? :
|
||||
+ // taken from dbus, Academic Free License 2.1 / GPL 2+
|
||||
+ return 0; // fake OK
|
||||
+#else
|
||||
const int enable = 1;
|
||||
return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
|
||||
+#endif
|
||||
}
|
||||
#endif // !defined(OS_NACL_NONSFI)
|
||||
|
||||
@@ -147,7 +162,11 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
|
||||
// The PNaCl toolchain for Non-SFI binary build does not support
|
||||
// SCM_CREDENTIALS.
|
||||
if (cmsg->cmsg_level == SOL_SOCKET &&
|
||||
+#if defined(OS_BSD)
|
||||
+ 1) { // XXX(rene) carpet getting full ...
|
||||
+#else
|
||||
cmsg->cmsg_type == SCM_CREDENTIALS) {
|
||||
+#endif
|
||||
DCHECK_EQ(payload_len, sizeof(struct ucred));
|
||||
DCHECK_EQ(pid, -1);
|
||||
pid = reinterpret_cast<struct ucred*>(CMSG_DATA(cmsg))->pid;
|
|
@ -1,20 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/posix/unix_domain_socket_linux_unittest.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/posix/unix_domain_socket_linux_unittest.cc
|
||||
@@ -2,10 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
+#include "build/build_config.h"
|
||||
+
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
+#if defined(OS_BSD)
|
||||
+#include <signal.h>
|
||||
+#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/bind.h"
|
|
@ -1,13 +1,27 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/internal_linux.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/internal_linux.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/internal_linux.h
|
||||
@@ -14,6 +14,8 @@
|
||||
@@ -55,6 +55,14 @@ bool ParseProcStats(const std::string& s
|
||||
// If the ordering ever changes, carefully review functions that use these
|
||||
// values.
|
||||
enum ProcStatsFields {
|
||||
+#if defined(OS_BSD)
|
||||
+ VM_COMM = 0, // Command name.
|
||||
+ VM_PPID = 2, // Parent process id.
|
||||
+ VM_PGRP = 3, // Process group id.
|
||||
+ VM_STARTTIME = 7, // The process start time.
|
||||
+ VM_UTIME = 8, // The user time.
|
||||
+ VM_STIME = 9, // The system time
|
||||
+#else
|
||||
VM_COMM = 1, // Filename of executable, without parentheses.
|
||||
VM_STATE = 2, // Letter indicating the state of the process.
|
||||
VM_PPID = 3, // PID of the parent.
|
||||
@@ -67,6 +75,7 @@ enum ProcStatsFields {
|
||||
VM_STARTTIME = 21, // The time the process started in clock ticks.
|
||||
VM_VSIZE = 22, // Virtual memory size in bytes.
|
||||
VM_RSS = 23, // Resident Set Size in pages.
|
||||
+#endif
|
||||
};
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
|
||||
+#include <unistd.h> /* pid_t */
|
||||
+
|
||||
namespace base {
|
||||
|
||||
class Time;
|
||||
// Reads the |field_num|th field from |proc_stats|. Returns 0 on failure.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/kill.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/kill.h
|
||||
@@ -118,7 +118,7 @@ BASE_EXPORT TerminationStatus GetTermina
|
||||
BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
|
||||
ProcessHandle handle, int* exit_code);
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// Spawns a thread to wait asynchronously for the child |process| to exit
|
||||
// and then reaps it.
|
||||
BASE_EXPORT void EnsureProcessGetsReaped(Process process);
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/kill_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/kill_posix.cc
|
||||
@@ -168,7 +168,7 @@ void EnsureProcessTerminated(Process pro
|
||||
0, new BackgroundReaper(std::move(process), TimeDelta::FromSeconds(2)));
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
void EnsureProcessGetsReaped(Process process) {
|
||||
DCHECK(!process.is_current());
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/launch.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/launch.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/launch.cc
|
||||
@@ -15,7 +15,7 @@ LaunchOptions::~LaunchOptions() = defaul
|
||||
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/launch.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/launch.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/launch.h
|
||||
@@ -138,7 +138,7 @@ struct BASE_EXPORT LaunchOptions {
|
||||
// will be the same as its pid.
|
||||
bool new_process_group = false;
|
||||
@@ -180,7 +180,7 @@ struct BASE_EXPORT LaunchOptions {
|
||||
bool clear_environment = false;
|
||||
#endif // OS_WIN || OS_POSIX || OS_FUCHSIA
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// If non-zero, start the process using clone(), using flags as provided.
|
||||
// Unlike in clone, clone_flags may not contain a custom termination signal
|
||||
// that is sent to the parent when the child dies. The termination signal will
|
||||
@@ -151,7 +151,7 @@ struct BASE_EXPORT LaunchOptions {
|
||||
|
||||
// Sets parent process death signal to SIGKILL.
|
||||
bool kill_on_parent_death = false;
|
||||
-#endif // defined(OS_LINUX)
|
||||
+#endif // defined(OS_LINUX) || defined(OS_BSD)
|
||||
|
||||
#if defined(OS_POSIX)
|
||||
// If not empty, launch the specified executable instead of
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/launch_posix.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/launch_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/launch_posix.cc
|
||||
@@ -64,6 +64,7 @@
|
||||
#include "base/feature_list.h"
|
||||
#else
|
||||
extern char** environ;
|
||||
+#pragma weak environ
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
@@ -219,6 +220,8 @@ static const char kFDDir[] = "/dev/fd";
|
||||
@@ -214,6 +214,8 @@ static const char kFDDir[] = "/dev/fd";
|
||||
static const char kFDDir[] = "/dev/fd";
|
||||
#elif defined(OS_FREEBSD)
|
||||
#elif defined(OS_OPENBSD)
|
||||
static const char kFDDir[] = "/dev/fd";
|
||||
+#elif defined(OS_NETBSD)
|
||||
+static const char kFDDir[] = "/dev/fd";
|
||||
#elif defined(OS_OPENBSD)
|
||||
static const char kFDDir[] = "/dev/fd";
|
||||
#elif defined(OS_ANDROID)
|
||||
static const char kFDDir[] = "/proc/self/fd";
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/memory.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/memory.cc
|
||||
@@ -44,7 +44,7 @@ NOINLINE void OnNoMemoryInternal(size_t
|
||||
} // namespace internal
|
||||
|
||||
// Defined in memory_win.cc for Windows.
|
||||
-#if !defined(OS_WIN)
|
||||
+#if !defined(OS_WIN) && !defined(OS_BSD)
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -63,7 +63,7 @@ void TerminateBecauseOutOfMemory(size_t
|
||||
#endif // !defined(OS_WIN)
|
||||
|
||||
// Defined in memory_mac.mm for Mac.
|
||||
-#if !defined(OS_MACOSX)
|
||||
+#if !defined(OS_MACOSX) && !defined(OS_BSD)
|
||||
|
||||
bool UncheckedCalloc(size_t num_items, size_t size, void** result) {
|
||||
const size_t alloc_size = num_items * size;
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/memory.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/memory.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/memory.h
|
||||
@@ -32,7 +32,7 @@ BASE_EXPORT void EnableTerminationOnOutO
|
||||
@@ -24,7 +24,7 @@ BASE_EXPORT void EnableTerminationOnOutO
|
||||
// Crash reporting classifies such crashes as OOM.
|
||||
BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size);
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_ANDROID)
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_BSD)
|
||||
BASE_EXPORT extern size_t g_oom_size;
|
||||
|
||||
// The maximum allowed value for the OOM score.
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/memory_stubs.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/process/memory_stubs.cc
|
||||
@@ -31,6 +31,8 @@ void TerminateBecauseOutOfMemory(size_t
|
||||
// their respective stdlib function since those functions will return null on a
|
||||
// failure to allocate.
|
||||
|
||||
+#if !defined(OS_FREEBSD)
|
||||
+// FreeBSD brings it's own implementation in memory.cc -- cmt
|
||||
bool UncheckedMalloc(size_t size, void** result) {
|
||||
*result = malloc(size);
|
||||
return *result != nullptr;
|
||||
@@ -40,5 +42,6 @@ bool UncheckedCalloc(size_t num_items, s
|
||||
*result = calloc(num_items, size);
|
||||
return *result != nullptr;
|
||||
}
|
||||
+#endif
|
||||
|
||||
} // namespace base
|
|
@ -1,24 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/memory_unittest.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/memory_unittest.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/memory_unittest.cc
|
||||
@@ -82,10 +82,10 @@ TEST(MemoryTest, AllocatorShimWorking) {
|
||||
ASSERT_TRUE(base::allocator::IsAllocatorInitialized());
|
||||
}
|
||||
|
||||
-// OpenBSD does not support these tests. Don't test these on ASan/TSan/MSan
|
||||
+// BSD does not support these tests. Don't test these on ASan/TSan/MSan
|
||||
@@ -106,7 +106,7 @@ TEST(MemoryTest, AllocatorShimWorking) {
|
||||
// OpenBSD does not support these tests. Don't test these on ASan/TSan/MSan
|
||||
// configurations: only test the real allocator.
|
||||
// Windows only supports these tests with the allocator shim in place.
|
||||
-#if !defined(OS_OPENBSD) && \
|
||||
+#if !defined(OS_BSD) && \
|
||||
BUILDFLAG(ENABLE_WIN_ALLOCATOR_SHIM_TESTS) && \
|
||||
-#if !defined(OS_OPENBSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \
|
||||
+#if !defined(OS_BSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \
|
||||
!defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
|
||||
|
||||
@@ -439,5 +439,5 @@ TEST_F(OutOfMemoryHandledTest, Unchecked
|
||||
EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_));
|
||||
EXPECT_TRUE(value_ == NULL);
|
||||
}
|
||||
-#endif // !defined(OS_OPENBSD) && BUILDFLAG(ENABLE_WIN_ALLOCATOR_SHIM_TESTS) &&
|
||||
+#endif // !defined(OS_BSD) && BUILDFLAG(ENABLE_WIN_ALLOCATOR_SHIM_TESTS) &&
|
||||
// !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
|
||||
namespace {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_handle.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_handle.cc
|
||||
@@ -30,7 +30,7 @@ UniqueProcId GetUniqueIdForProcess() {
|
||||
: UniqueProcId(GetCurrentProcId());
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_AIX) || defined(OS_BSD)
|
||||
|
||||
void InitUniqueIdForProcessInPidNamespace(ProcessId pid_outside_of_namespace) {
|
||||
DCHECK(pid_outside_of_namespace != kNullProcessId);
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_handle.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_handle.h
|
||||
@@ -103,7 +103,7 @@ BASE_EXPORT ProcessId GetCurrentProcId()
|
||||
// processes may be reused.
|
||||
BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// When a process is started in a different PID namespace from the browser
|
||||
// process, this function must be called with the process's PID in the browser's
|
||||
// PID namespace in order to initialize its unique ID. Not thread safe.
|
|
@ -1,13 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_handle_freebsd.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/process/process_handle_freebsd.cc
|
||||
@@ -16,7 +16,7 @@ namespace base {
|
||||
|
||||
ProcessId GetParentProcessId(ProcessHandle process) {
|
||||
struct kinfo_proc info;
|
||||
- size_t length;
|
||||
+ size_t length = sizeof(struct kinfo_proc);
|
||||
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
|
||||
|
||||
if (sysctl(mib, arraysize(mib), &info, &length, NULL, 0) < 0)
|
|
@ -1,71 +1,57 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_handle_netbsd.cc.orig 2016-11-16 08:03:06.205887318 +0000
|
||||
--- base/process/process_handle_netbsd.cc.orig 2020-07-09 13:18:47.299833505 +0000
|
||||
+++ base/process/process_handle_netbsd.cc
|
||||
@@ -0,0 +1,66 @@
|
||||
@@ -0,0 +1,52 @@
|
||||
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "base/macros.h"
|
||||
+#include "base/process/process_handle.h"
|
||||
+#include "base/stl_util.h"
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <unistd.h>
|
||||
+#include <cstring>
|
||||
+
|
||||
+namespace base {
|
||||
+
|
||||
+ProcessId GetParentProcessId(ProcessHandle process) {
|
||||
+ struct kinfo_proc2 info;
|
||||
+ size_t info_size = sizeof(struct kinfo_proc2);
|
||||
+ int mib[6];
|
||||
+ int ret;
|
||||
+ size_t length;
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, process,
|
||||
+ sizeof(struct kinfo_proc2), 1 };
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = process;
|
||||
+ mib[4] = info_size;
|
||||
+ mib[5] = 1;
|
||||
+ if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ ret = sysctl(mib, 6, &info, &info_size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ mib[5] = (length / sizeof(struct kinfo_proc2));
|
||||
+
|
||||
+ if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (info_size == 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return info.p_ppid;
|
||||
+}
|
||||
+
|
||||
+FilePath GetProcessExecutablePath(ProcessHandle process) {
|
||||
+ size_t size = sizeof(struct kinfo_proc2);
|
||||
+ int mib[4];
|
||||
+ int ret;
|
||||
+ char pathname[MAXPATHLEN];
|
||||
+ struct kinfo_proc2 kp;
|
||||
+ size_t len;
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, process,
|
||||
+ sizeof(struct kinfo_proc2), 1 };
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC_ARGS;
|
||||
+ mib[2] = process;
|
||||
+ mib[3] = KERN_PROC_PATHNAME;
|
||||
+
|
||||
+ ret = sysctl(mib, 4, NULL, &size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ if (sysctl(mib, base::size(mib), NULL, &len, NULL, 0) == -1)
|
||||
+ return FilePath();
|
||||
+ }
|
||||
+
|
||||
+ ret = sysctl(mib, 4, pathname, &size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ mib[5] = (len / sizeof(struct kinfo_proc2));
|
||||
+ if (sysctl(mib, base::size(mib), &kp, &len, NULL, 0) < 0)
|
||||
+ return FilePath();
|
||||
+ }
|
||||
+ if (size == 0 || strlen(pathname) == 0) {
|
||||
+ if ((kp.p_flag & P_SYSTEM) != 0)
|
||||
+ return FilePath();
|
||||
+ }
|
||||
+ if (strcmp(kp.p_comm, "chrome") == 0)
|
||||
+ return FilePath(kp.p_comm);
|
||||
+
|
||||
+ return FilePath(pathname);
|
||||
+ return FilePath();
|
||||
+}
|
||||
+
|
||||
+} // namespace base
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_info_linux.cc.orig 2016-11-10 20:02:09.000000000 +0000
|
||||
+++ base/process/process_info_linux.cc
|
||||
@@ -11,10 +11,61 @@
|
||||
#include "base/process/process_handle.h"
|
||||
#include "base/time/time.h"
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <sys/user.h>
|
||||
+#endif
|
||||
+
|
||||
namespace base {
|
||||
|
||||
// static
|
||||
const Time CurrentProcessInfo::CreationTime() {
|
||||
+#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
|
||||
+ struct kinfo_proc proc;
|
||||
+ size_t len = sizeof(struct kinfo_proc);
|
||||
+ if (sysctl(mib, arraysize(mib), &proc, &len, NULL, 0) < 0)
|
||||
+ return Time();
|
||||
+#if defined(__DragonFly__)
|
||||
+ return Time::FromTimeVal(proc.kp_start);
|
||||
+#else
|
||||
+ return Time::FromTimeVal(proc.ki_start);
|
||||
+#endif
|
||||
+#elif defined(__NetBSD__)
|
||||
+ struct kinfo_proc2 kproc;
|
||||
+ size_t esize = sizeof(kinfo_proc2);
|
||||
+ size_t size;
|
||||
+ int st;
|
||||
+ int mib[6];
|
||||
+ struct timeval tv;
|
||||
+
|
||||
+ tv.tv_sec = 0;
|
||||
+ tv.tv_usec = 0;
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = getpid();
|
||||
+ mib[4] = esize;
|
||||
+ mib[5] = 0;
|
||||
+
|
||||
+ st = sysctl(mib, 6, NULL, &size, NULL, (size_t)0);
|
||||
+ if (st == -1) {
|
||||
+ return Time::FromTimeVal(tv);
|
||||
+ }
|
||||
+
|
||||
+ mib[5] = (int)(size / esize);
|
||||
+ st = sysctl(mib, 6, &kproc, &size, NULL, (size_t)0);
|
||||
+ if (st == -1) {
|
||||
+ return Time::FromTimeVal(tv);
|
||||
+ }
|
||||
+
|
||||
+ tv.tv_sec = kproc.p_ustart_sec;
|
||||
+ tv.tv_usec = kproc.p_ustart_usec;
|
||||
+
|
||||
+ return Time::FromTimeVal(tv);
|
||||
+#else
|
||||
ProcessHandle pid = GetCurrentProcessHandle();
|
||||
int64_t start_ticks =
|
||||
internal::ReadProcStatsAndGetFieldAsInt64(pid, internal::VM_STARTTIME);
|
||||
@@ -23,6 +74,7 @@ const Time CurrentProcessInfo::CreationT
|
||||
Time boot_time = internal::GetBootTime();
|
||||
DCHECK(!boot_time.is_null());
|
||||
return Time(boot_time + start_offset);
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace base
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_iterator.h.orig 2016-11-10 20:02:09.000000000 +0000
|
||||
--- base/process/process_iterator.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_iterator.h
|
||||
@@ -22,7 +22,7 @@
|
||||
@@ -24,7 +24,7 @@
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
|
@ -11,7 +11,7 @@ $NetBSD$
|
|||
#include <sys/sysctl.h>
|
||||
#elif defined(OS_FREEBSD)
|
||||
#include <sys/user.h>
|
||||
@@ -109,9 +109,12 @@ class BASE_EXPORT ProcessIterator {
|
||||
@@ -111,9 +111,12 @@ class BASE_EXPORT ProcessIterator {
|
||||
#if defined(OS_WIN)
|
||||
HANDLE snapshot_;
|
||||
bool started_iteration_;
|
||||
|
@ -22,6 +22,6 @@ $NetBSD$
|
|||
+#elif defined(OS_NETBSD)
|
||||
+ std::vector<kinfo_proc2> kinfo_procs_;
|
||||
+ size_t index_of_kinfo_proc_;
|
||||
#elif defined(OS_POSIX)
|
||||
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
||||
DIR* procfs_dir_;
|
||||
#endif
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_iterator_freebsd.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/process/process_iterator_freebsd.cc
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+/* getuid() */
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/string_split.h"
|
||||
@@ -72,19 +76,13 @@ bool ProcessIterator::CheckForNextProces
|
||||
for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
|
||||
size_t length;
|
||||
struct kinfo_proc kinfo = kinfo_procs_[index_of_kinfo_proc_];
|
||||
- int mib[] = { CTL_KERN, KERN_PROC_ARGS, kinfo.ki_pid };
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, kinfo.ki_pid };
|
||||
|
||||
if ((kinfo.ki_pid > 0) && (kinfo.ki_stat == SZOMB))
|
||||
continue;
|
||||
|
||||
- length = 0;
|
||||
- if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0) {
|
||||
- LOG(ERROR) << "failed to figure out the buffer size for a command line";
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- data.resize(length);
|
||||
-
|
||||
+ data.resize(ARG_MAX);
|
||||
+ length = ARG_MAX;
|
||||
if (sysctl(mib, arraysize(mib), &data[0], &length, NULL, 0) < 0) {
|
||||
LOG(ERROR) << "failed to fetch a commandline";
|
||||
continue;
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_iterator_netbsd.cc.orig 2016-11-12 02:51:19.578931241 +0000
|
||||
--- base/process/process_iterator_netbsd.cc.orig 2020-07-09 13:18:47.324483044 +0000
|
||||
+++ base/process/process_iterator_netbsd.cc
|
||||
@@ -0,0 +1,146 @@
|
||||
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
|
@ -97,13 +97,13 @@ $NetBSD$
|
|||
+
|
||||
+ // Find out what size buffer we need.
|
||||
+ size_t data_len = 0;
|
||||
+ if (sysctl(mib, arraysize(mib), NULL, &data_len, NULL, 0) < 0) {
|
||||
+ if (sysctl(mib, __arraycount(mib), NULL, &data_len, NULL, 0) < 0) {
|
||||
+ DVPLOG(1) << "failed to figure out the buffer size for a commandline";
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ data.resize(data_len);
|
||||
+ if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) {
|
||||
+ if (sysctl(mib, __arraycount(mib), &data[0], &data_len, NULL, 0) < 0) {
|
||||
+ DVPLOG(1) << "failed to fetch a commandline";
|
||||
+ continue;
|
||||
+ }
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_linux.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_linux.cc
|
||||
@@ -80,6 +80,9 @@ Time Process::CreationTime() const {
|
||||
internal::VM_STARTTIME)
|
||||
: internal::ReadProcStatsAndGetFieldAsInt64(
|
||||
Pid(), internal::VM_STARTTIME);
|
||||
+#if defined(OS_BSD)
|
||||
+ return Time::FromTimeT(start_ticks);
|
||||
+#else
|
||||
if (!start_ticks)
|
||||
return Time();
|
||||
TimeDelta start_offset = internal::ClockTicksToTimeDelta(start_ticks);
|
||||
@@ -87,8 +90,11 @@ Time Process::CreationTime() const {
|
||||
if (boot_time.is_null())
|
||||
return Time();
|
||||
return Time(boot_time + start_offset);
|
||||
+#endif
|
||||
}
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
+ return Time::FromTimeT(start_ticks);
|
||||
// static
|
||||
bool Process::CanBackgroundProcesses() {
|
||||
#if defined(OS_CHROMEOS)
|
||||
@@ -140,6 +146,7 @@ bool Process::SetProcessBackgrounded(boo
|
||||
DPCHECK(result == 0);
|
||||
return result == 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
bool IsProcessBackgroundedCGroup(const StringPiece& cgroup_contents) {
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_metrics.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_metrics.cc
|
||||
@@ -58,7 +58,7 @@ SystemMetrics SystemMetrics::Sample() {
|
||||
SystemMetrics system_metrics;
|
||||
|
||||
system_metrics.committed_memory_ = GetSystemCommitCharge();
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
GetSystemMemoryInfo(&system_metrics.memory_info_);
|
||||
GetVmStatInfo(&system_metrics.vmstat_info_);
|
||||
GetSystemDiskInfo(&system_metrics.disk_info_);
|
||||
@@ -76,7 +76,7 @@ std::unique_ptr<Value> SystemMetrics::To
|
||||
std::unique_ptr<DictionaryValue> res(new DictionaryValue());
|
||||
|
||||
res->SetIntKey("committed_memory", static_cast<int>(committed_memory_));
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
std::unique_ptr<DictionaryValue> meminfo = memory_info_.ToValue();
|
||||
std::unique_ptr<DictionaryValue> vmstat = vmstat_info_.ToValue();
|
||||
meminfo->MergeDictionary(vmstat.get());
|
|
@ -1,35 +1,95 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_metrics.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/process/process_metrics.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_metrics.h
|
||||
@@ -22,6 +22,12 @@
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
@@ -44,7 +44,7 @@ namespace base {
|
||||
// Full declaration is in process_metrics_iocounters.h.
|
||||
struct IoCounters;
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+#include <kvm.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#endif
|
||||
+
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// Minor and major page fault counts since the process creation.
|
||||
// Both counts are process-wide, and exclude child processes.
|
||||
//
|
||||
@@ -95,7 +95,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
// convenience wrapper for CreateProcessMetrics().
|
||||
static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics();
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// Resident Set Size is a Linux/Android specific memory concept. Do not
|
||||
// attempt to extend this to other platforms.
|
||||
BASE_EXPORT size_t GetResidentSetSize() const;
|
||||
@@ -186,7 +186,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
int GetOpenFdSoftLimit() const;
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// Bytes of swap as reported by /proc/[pid]/status.
|
||||
uint64_t GetVmSwapBytes() const;
|
||||
|
||||
@@ -205,7 +205,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
ProcessMetrics(ProcessHandle process, PortProvider* port_provider);
|
||||
#endif // !defined(OS_MACOSX) || defined(OS_IOS)
|
||||
|
||||
-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_AIX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_AIX) || defined(OS_BSD)
|
||||
int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups);
|
||||
#endif
|
||||
#if defined(OS_MACOSX)
|
||||
#include <mach/mach.h>
|
||||
#include "base/process/port_provider_mac.h"
|
||||
@@ -326,13 +332,17 @@ BASE_EXPORT bool GetSystemMemoryInfo(Sys
|
||||
@@ -234,7 +234,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
// Number of bytes transferred to/from disk in bytes.
|
||||
uint64_t last_cumulative_disk_usage_ = 0;
|
||||
|
||||
-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_AIX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_AIX) || defined(OS_BSD)
|
||||
// Same thing for idle wakeups.
|
||||
TimeTicks last_idle_wakeups_time_;
|
||||
uint64_t last_absolute_idle_wakeups_;
|
||||
@@ -286,7 +286,8 @@ BASE_EXPORT void IncreaseFdLimitTo(unsig
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
|
||||
- defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA)
|
||||
+ defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA) || \
|
||||
+ defined(OS_BSD)
|
||||
// Data about system-wide memory consumption. Values are in KB. Available on
|
||||
// Windows, Mac, Linux, Android and Chrome OS.
|
||||
//
|
||||
@@ -319,7 +320,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
||||
int avail_phys = 0;
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_BSD)
|
||||
// This provides an estimate of available memory as described here:
|
||||
// https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
|
||||
// NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always
|
||||
@@ -334,7 +335,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
||||
#endif
|
||||
|
||||
#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) || \
|
||||
- defined(OS_FUCHSIA)
|
||||
+ defined(OS_FUCHSIA) || defined(OS_BSD)
|
||||
int buffers = 0;
|
||||
int cached = 0;
|
||||
int active_anon = 0;
|
||||
@@ -372,7 +373,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(Sys
|
||||
#endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ||
|
||||
// defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA)
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_BSD)
|
||||
// Parse the data found in /proc/<pid>/stat and return the sum of the
|
||||
// CPU-related ticks. Returns -1 on parse error.
|
||||
// Exposed for testing.
|
||||
BASE_EXPORT int ParseProcStatCPU(const std::string& input);
|
||||
+#endif
|
||||
@@ -540,7 +541,7 @@ class BASE_EXPORT SystemMetrics {
|
||||
FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
|
||||
|
||||
size_t committed_memory_;
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// Get the number of threads of |process| as available in /proc/<pid>/stat.
|
||||
// This should be used with care as no synchronization with running threads is
|
||||
// done. This is mostly useful to guarantee being single-threaded.
|
||||
// Returns 0 on failure.
|
||||
BASE_EXPORT int GetNumberOfThreads(ProcessHandle process);
|
||||
+#endif
|
||||
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
// /proc/self/exe refers to the current executable.
|
||||
BASE_EXPORT extern const char kProcSelfExe[];
|
||||
|
||||
SystemMemoryInfoKB memory_info_;
|
||||
VmStatInfo vmstat_info_;
|
||||
SystemDiskInfo disk_info_;
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_metrics_freebsd.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/process/process_metrics_freebsd.cc
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/sys_info.h"
|
||||
|
||||
+#include <unistd.h> /* getpagesize() */
|
||||
+#include <fcntl.h> /* O_RDONLY */
|
||||
+
|
||||
namespace base {
|
||||
|
||||
ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||
@@ -122,4 +125,23 @@ size_t GetSystemCommitCharge() {
|
||||
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
||||
}
|
||||
|
||||
+int GetNumberOfThreads(ProcessHandle process) {
|
||||
+ // Taken from FreeBSD top (usr.bin/top/machine.c)
|
||||
+
|
||||
+ kvm_t* kd = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open");
|
||||
+ if (kd == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ struct kinfo_proc* pbase;
|
||||
+ int nproc;
|
||||
+ pbase = kvm_getprocs(kd, KERN_PROC_PID, process, &nproc);
|
||||
+ if (pbase == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (kvm_close(kd) == -1)
|
||||
+ return 0;
|
||||
+
|
||||
+ return nproc;
|
||||
+}
|
||||
+
|
||||
} // namespace base
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_metrics_netbsd.cc.orig 2016-11-12 06:32:44.816301555 +0000
|
||||
--- base/process/process_metrics_netbsd.cc.orig 2020-07-09 13:21:37.235642797 +0000
|
||||
+++ base/process/process_metrics_netbsd.cc
|
||||
@@ -0,0 +1,203 @@
|
||||
@@ -0,0 +1,79 @@
|
||||
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
|
@ -10,165 +10,67 @@ $NetBSD$
|
|||
+#include "base/process/process_metrics.h"
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/vmmeter.h>
|
||||
+
|
||||
+#include "base/macros.h"
|
||||
+#include "base/memory/ptr_util.h"
|
||||
+#include "base/sys_info.h"
|
||||
+
|
||||
+#include <unistd.h> /* getpagesize() */
|
||||
+#include <fcntl.h> /* O_RDONLY */
|
||||
+
|
||||
+#include <uvm/uvm_extern.h> /* struct vmtotal */
|
||||
+#include "base/process/process_metrics_iocounters.h"
|
||||
+#include "base/stl_util.h"
|
||||
+#include "base/logging.h"
|
||||
+
|
||||
+namespace base {
|
||||
+
|
||||
+ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||
+ : process_(process),
|
||||
+ last_system_time_(0),
|
||||
+ last_cpu_(0) {
|
||||
+ processor_count_ = base::SysInfo::NumberOfProcessors();
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
|
||||
+ ProcessHandle process) {
|
||||
+ return WrapUnique(new ProcessMetrics(process));
|
||||
+}
|
||||
+
|
||||
+size_t ProcessMetrics::GetPagefileUsage() const {
|
||||
+ struct kinfo_proc2 info;
|
||||
+ int mib[6];
|
||||
+ size_t info_size = sizeof(info);
|
||||
+ int ret;
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = process_;
|
||||
+ mib[4] = info_size;
|
||||
+ mib[5] = 1;
|
||||
+
|
||||
+ ret = sysctl(mib, 6, &info, &info_size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (info_size == 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return (info.p_vm_tsize + info.p_vm_dsize + info.p_vm_ssize);
|
||||
+}
|
||||
+
|
||||
+size_t ProcessMetrics::GetPeakPagefileUsage() const {
|
||||
+ printf("%s\n", __PRETTY_FUNCTION__);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+size_t ProcessMetrics::GetWorkingSetSize() const {
|
||||
+ struct kinfo_proc2 info;
|
||||
+ int mib[6];
|
||||
+ size_t info_size = sizeof(info);
|
||||
+ int ret;
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = process_;
|
||||
+ mib[4] = info_size;
|
||||
+ mib[5] = 1;
|
||||
+
|
||||
+ ret = sysctl(mib, 6, &info, &info_size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (info_size == 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return info.p_vm_rssize * getpagesize();
|
||||
+}
|
||||
+
|
||||
+size_t ProcessMetrics::GetPeakWorkingSetSize() const {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
|
||||
+ size_t* shared_bytes) {
|
||||
+ WorkingSetKBytes ws_usage;
|
||||
+ if (!GetWorkingSetKBytes(&ws_usage))
|
||||
+ return false;
|
||||
+
|
||||
+ if (private_bytes)
|
||||
+ *private_bytes = ws_usage.priv << 10;
|
||||
+
|
||||
+ if (shared_bytes)
|
||||
+ *shared_bytes = ws_usage.shared * 1024;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const {
|
||||
+// TODO(bapt) be sure we can't be precise
|
||||
+ size_t priv = GetWorkingSetSize();
|
||||
+ if (!priv)
|
||||
+ return false;
|
||||
+ ws_usage->priv = priv / 1024;
|
||||
+ ws_usage->shareable = 0;
|
||||
+ ws_usage->shared = 0;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+double ProcessMetrics::GetCPUUsage() {
|
||||
+ struct kinfo_proc2 info;
|
||||
+ int mib[6];
|
||||
+ size_t info_size = sizeof(info);
|
||||
+ int ret;
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = process_;
|
||||
+ mib[4] = info_size;
|
||||
+ mib[5] = 1;
|
||||
+
|
||||
+ ret = sysctl(mib, 6, &info, &info_size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (info_size == 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return (info.p_pctcpu / FSCALE) * 100.0;
|
||||
+}
|
||||
+
|
||||
+bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
|
||||
+/* ryoon: should be written */
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static int GetProcessCPU(pid_t pid) {
|
||||
+ struct kinfo_proc2 info;
|
||||
+ size_t length;
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, pid,
|
||||
+ sizeof(struct kinfo_proc2), 1 };
|
||||
+
|
||||
+ if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ mib[5] = (length / sizeof(struct kinfo_proc2));
|
||||
+
|
||||
+ if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ return info.p_pctcpu;
|
||||
+}
|
||||
+
|
||||
+TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
||||
+ //NOTREACHED();
|
||||
+ return TimeDelta();
|
||||
+}
|
||||
+
|
||||
+bool ProcessMetrics::GetCumulativeCPUUsagePerThread(CPUUsagePerThread&) {
|
||||
+ //NOTREACHED();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||
+ : process_(process) {}
|
||||
+
|
||||
+size_t GetSystemCommitCharge() {
|
||||
+ int mib[2], pagesize;
|
||||
+ int mib[] = { CTL_VM, VM_METER };
|
||||
+ int pagesize;
|
||||
+ struct vmtotal vmtotal;
|
||||
+ unsigned long mem_total, mem_free, mem_inactive;
|
||||
+ size_t len = sizeof(vmtotal);
|
||||
+ int ret;
|
||||
+
|
||||
+ printf("%s\n", __PRETTY_FUNCTION__);
|
||||
+
|
||||
+ mib[0] = CTL_VM;
|
||||
+ mib[1] = VM_METER;
|
||||
+
|
||||
+ ret = sysctl(mib, 2, &vmtotal, &len, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ if (sysctl(mib, base::size(mib), &vmtotal, &len, NULL, 0) < 0)
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ mem_total = vmtotal.t_vm;
|
||||
+ mem_free = vmtotal.t_free;
|
||||
|
@ -179,29 +81,4 @@ $NetBSD$
|
|||
+ return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
||||
+}
|
||||
+
|
||||
+int GetNumberOfThreads(ProcessHandle process) {
|
||||
+ int ret;
|
||||
+ int mib[6];
|
||||
+ struct kinfo_proc2 info;
|
||||
+ size_t info_size = sizeof(info);
|
||||
+
|
||||
+ mib[0] = CTL_KERN;
|
||||
+ mib[1] = KERN_PROC2;
|
||||
+ mib[2] = KERN_PROC_PID;
|
||||
+ mib[3] = process;
|
||||
+ mib[4] = info_size;
|
||||
+ mib[5] = 1;
|
||||
+
|
||||
+ ret = sysctl(mib, 6, &info, &info_size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (info_size == 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return info.p_nlwps;
|
||||
+}
|
||||
+
|
||||
+} // namespace base
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_metrics_posix.cc.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/process/process_metrics_posix.cc
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include <malloc/malloc.h>
|
||||
+#elif defined(OS_FREEBSD) || defined(OS_NETBSD)
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -126,7 +127,7 @@ size_t ProcessMetrics::GetMallocUsage()
|
||||
#else
|
||||
return minfo.hblkhd + minfo.arena;
|
||||
#endif
|
||||
-#elif defined(OS_FUCHSIA)
|
||||
+#elif defined(OS_FUCHSIA) || defined(OS_BSD)
|
||||
// TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
|
||||
return 0;
|
||||
#endif
|
|
@ -1,92 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_posix.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/process/process_posix.cc
|
||||
@@ -21,8 +21,18 @@
|
||||
#include <sys/event.h>
|
||||
#endif
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+#include <signal.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/event.h>
|
||||
+#include <sys/time.h>
|
||||
+#endif
|
||||
+
|
||||
namespace {
|
||||
|
||||
+const int kBackgroundPriority = 5;
|
||||
+const int kForegroundPriority = 0;
|
||||
+
|
||||
#if !defined(OS_NACL_NONSFI)
|
||||
|
||||
bool WaitpidWithTimeout(base::ProcessHandle handle,
|
||||
@@ -184,13 +194,13 @@ bool WaitForExitWithTimeoutImpl(base::Pr
|
||||
base::ProcessHandle parent_pid = base::GetParentProcessId(handle);
|
||||
base::ProcessHandle our_pid = base::GetCurrentProcessHandle();
|
||||
if (parent_pid != our_pid) {
|
||||
-#if defined(OS_MACOSX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
|
||||
// On Mac we can wait on non child processes.
|
||||
- return WaitForSingleNonChildProcess(handle, timeout);
|
||||
+ /* return WaitForSingleNonChildProcess(handle, timeout); */
|
||||
#else
|
||||
// Currently on Linux we can't handle non child processes.
|
||||
NOTIMPLEMENTED();
|
||||
-#endif // OS_MACOSX
|
||||
+#endif // OS_MACOSX || OS_FREEBSD
|
||||
}
|
||||
|
||||
int status;
|
||||
@@ -257,12 +267,16 @@ Process Process::DeprecatedGetProcessFro
|
||||
return Process(handle);
|
||||
}
|
||||
|
||||
-#if !defined(OS_LINUX) && !defined(OS_MACOSX)
|
||||
+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD)
|
||||
// static
|
||||
bool Process::CanBackgroundProcesses() {
|
||||
return false;
|
||||
}
|
||||
-#endif // !defined(OS_LINUX) && !defined(OS_MACOSX)
|
||||
+#elif defined(OS_FREEBSD)
|
||||
+bool Process::CanBackgroundProcesses() {
|
||||
+ return true;
|
||||
+}
|
||||
+#endif // !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD)
|
||||
|
||||
bool Process::IsValid() const {
|
||||
return process_ != kNullProcessHandle;
|
||||
@@ -365,15 +379,32 @@ bool Process::WaitForExitWithTimeout(Tim
|
||||
bool Process::IsProcessBackgrounded() const {
|
||||
// See SetProcessBackgrounded().
|
||||
DCHECK(IsValid());
|
||||
+#if defined(OS_FREEBSD)
|
||||
+ return true;
|
||||
+#else
|
||||
return false;
|
||||
+#endif
|
||||
}
|
||||
|
||||
bool Process::SetProcessBackgrounded(bool value) {
|
||||
+#if !defined(OS_FREEBSD)
|
||||
// Not implemented for POSIX systems other than Linux and Mac. With POSIX, if
|
||||
// we were to lower the process priority we wouldn't be able to raise it back
|
||||
// to its initial priority.
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
+#else
|
||||
+ DCHECK(IsValid());
|
||||
+
|
||||
+ if (!CanBackgroundProcesses())
|
||||
+ return false;
|
||||
+
|
||||
+ int priority = value ? kBackgroundPriority : kForegroundPriority;
|
||||
+ int result = setpriority(PRIO_PROCESS, process_, priority);
|
||||
+
|
||||
+ DPCHECK(result == 0);
|
||||
+ return result == 0;
|
||||
+#endif // !defined(OS_FREEBSD)
|
||||
}
|
||||
#endif // !defined(OS_LINUX) && !defined(OS_MACOSX)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_unittest.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/process/process_unittest.cc
|
||||
@@ -148,7 +148,7 @@ TEST_F(ProcessTest, CreationTimeOtherPro
|
||||
// was spawned and a time recorded after it was spawned. However, since the
|
||||
// base::Time and process creation clocks don't match, tolerate some error.
|
||||
constexpr base::TimeDelta kTolerance =
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// On Linux, process creation time is relative to boot time which has a
|
||||
// 1-second resolution. Tolerate 1 second for the imprecise boot time and
|
||||
// 100 ms for the imprecise clock.
|
|
@ -0,0 +1,31 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/process/process_util_unittest.cc.orig 2020-07-08 21:41:45.000000000 +0000
|
||||
+++ base/process/process_util_unittest.cc
|
||||
@@ -1307,7 +1307,7 @@ std::string TestLaunchProcess(const Comm
|
||||
options.fds_to_remap.emplace_back(fds[1], STDOUT_FILENO);
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
options.clone_flags = clone_flags;
|
||||
#else
|
||||
CHECK_EQ(0, clone_flags);
|
||||
@@ -1377,7 +1377,7 @@ TEST_F(ProcessUtilTest, LaunchProcess) {
|
||||
EXPECT_EQ("wibble", TestLaunchProcess(kPrintEnvCommand, env_changes,
|
||||
no_clear_environ, no_clone_flags));
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
// Test a non-trival value for clone_flags.
|
||||
EXPECT_EQ("wibble", TestLaunchProcess(kPrintEnvCommand, env_changes,
|
||||
no_clear_environ, CLONE_FS));
|
||||
@@ -1391,7 +1391,7 @@ TEST_F(ProcessUtilTest, LaunchProcess) {
|
||||
true /* clear_environ */, no_clone_flags));
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
MULTIPROCESS_TEST_MAIN(CheckPidProcess) {
|
||||
const pid_t kInitPid = 1;
|
||||
const pid_t pid = syscall(__NR_getpid);
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/profiler/register_context.h.orig 2020-07-08 21:41:45.000000000 +0000
|
||||
+++ base/profiler/register_context.h
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <windows.h>
|
||||
#elif defined(OS_MACOSX)
|
||||
#include <mach/machine/thread_status.h>
|
||||
-#elif defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
#include <sys/ucontext.h>
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/profiler/sampling_profiler_thread_token.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/profiler/sampling_profiler_thread_token.cc
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace base {
|
||||
|
||||
SamplingProfilerThreadToken GetSamplingProfilerCurrentThreadToken() {
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
return {PlatformThread::CurrentId(), pthread_self()};
|
||||
#else
|
||||
return {PlatformThread::CurrentId()};
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/profiler/sampling_profiler_thread_token.h.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/profiler/sampling_profiler_thread_token.h
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace base {
|
||||
// functions used to obtain the stack base address.
|
||||
struct SamplingProfilerThreadToken {
|
||||
PlatformThreadId id;
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_BSD)
|
||||
pthread_t pthread_id;
|
||||
#endif
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/profiler/stack_copier_signal.cc.orig 2020-07-15 18:55:48.000000000 +0000
|
||||
+++ base/profiler/stack_copier_signal.cc
|
||||
@@ -4,10 +4,14 @@
|
||||
|
||||
#include "base/profiler/stack_copier_signal.h"
|
||||
|
||||
+#if defined(OS_NETBSD)
|
||||
+#include <sys/futex.h>
|
||||
+#else
|
||||
#include <linux/futex.h>
|
||||
+#include <syscall.h>
|
||||
+#endif
|
||||
#include <signal.h>
|
||||
#include <sys/ucontext.h>
|
||||
-#include <syscall.h>
|
||||
|
||||
#include <atomic>
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/profiler/stack_sampling_profiler_unittest.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/profiler/stack_sampling_profiler_unittest.cc.orig 2020-07-08 21:41:45.000000000 +0000
|
||||
+++ base/profiler/stack_sampling_profiler_unittest.cc
|
||||
@@ -31,7 +31,7 @@
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <intrin.h>
|
||||
#include <malloc.h>
|
||||
#include <windows.h>
|
||||
-#else
|
||||
+#elif !defined(OS_BSD)
|
||||
+#elif defined(OS_LINUX)
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/sampling_heap_profiler/sampling_heap_profiler.cc.orig 2020-07-08 21:41:45.000000000 +0000
|
||||
+++ base/sampling_heap_profiler/sampling_heap_profiler.cc
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_MACOSX)
|
||||
+#if defined(OS_MACOSX) || defined(OS_BSD)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,14 @@ const char* GetAndLeakThreadName() {
|
||||
int err = prctl(PR_GET_NAME, name);
|
||||
if (!err)
|
||||
return strdup(name);
|
||||
+#elif defined(OS_FREEBSD)
|
||||
+ pthread_get_name_np(pthread_self(), name, kBufferLen);
|
||||
+ if (*name != '\0')
|
||||
+ return strdup(name);
|
||||
+#elif defined(OS_NETBSD)
|
||||
+ pthread_getname_np(pthread_self(), name, kBufferLen);
|
||||
+ if (*name != '\0')
|
||||
+ return strdup(name);
|
||||
#elif defined(OS_MACOSX)
|
||||
int err = pthread_getname_np(pthread_self(), name, kBufferLen);
|
||||
if (err == 0 && *name != '\0')
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/security_unittest.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/security_unittest.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/security_unittest.cc
|
||||
@@ -74,7 +74,7 @@ bool IsTcMallocBypassed() {
|
||||
@@ -59,7 +59,7 @@ NOINLINE Type HideValueFromCompiler(vola
|
||||
// FAILS_ is too clunky.
|
||||
void OverflowTestsSoftExpectTrue(bool overflow_detected) {
|
||||
if (!overflow_detected) {
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX)
|
||||
+#if defined(OS_POSIX) && !defined(OS_NACL)
|
||||
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
// Sadly, on Linux, Android, and OSX we don't have a good story yet. Don't
|
||||
// fail the test, but report.
|
||||
printf("Platform has overflow: %s\n",
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/synchronization/lock_impl.h.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/synchronization/lock_impl.h
|
||||
@@ -69,9 +69,12 @@ void LockImpl::Unlock() {
|
||||
::ReleaseSRWLockExclusive(reinterpret_cast<PSRWLOCK>(&native_handle_));
|
||||
}
|
||||
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
||||
+//#pragma GCC diagnostic push
|
||||
+//#pragma GCC diagnostic ignored "-Wthread-safety-analysis"
|
||||
void LockImpl::Unlock() {
|
||||
int rv = pthread_mutex_unlock(&native_handle_);
|
||||
DCHECK_EQ(rv, 0) << ". " << strerror(rv);
|
||||
+//#pragma GCC diagnostic pop
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/sys_info_freebsd.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/sys_info_freebsd.cc
|
||||
@@ -12,12 +12,34 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
+int64_t SysInfo::AmountOfAvailablePhysicalMemory() {
|
||||
+ int page_size, r = 0;
|
||||
+ unsigned pgfree, pginact, pgcache;
|
||||
+ size_t size = sizeof(page_size);
|
||||
+ size_t szpg = sizeof(pgfree);
|
||||
+ if(r == 0)
|
||||
+ r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
|
||||
+ if(r == 0)
|
||||
+ r = sysctlbyname("vm.stats.vm.v_free_count", &pgfree, &szpg, NULL, 0);
|
||||
+ if(r == 0)
|
||||
+ r = sysctlbyname("vm.stats.vm.v_inactive_count", &pginact, &szpg, NULL, 0);
|
||||
+ if(r == 0)
|
||||
+ r = sysctlbyname("vm.stats.vm.v_cache_count", &pgcache, &szpg, NULL, 0);
|
||||
+ if (r == -1) {
|
||||
+ NOTREACHED();
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return static_cast<int64_t>((pgfree + pginact + pgcache) * page_size);
|
||||
+}
|
||||
+
|
||||
int64_t SysInfo::AmountOfPhysicalMemory() {
|
||||
- int pages, page_size;
|
||||
+ int pages, page_size, r = 0;
|
||||
size_t size = sizeof(pages);
|
||||
- sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
|
||||
- sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
|
||||
- if (pages == -1 || page_size == -1) {
|
||||
+ if(r == 0)
|
||||
+ r = sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
|
||||
+ if(r == 0)
|
||||
+ r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
|
||||
+ if (r == -1) {
|
||||
NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
@@ -25,14 +47,24 @@ int64_t SysInfo::AmountOfPhysicalMemory(
|
||||
}
|
||||
|
||||
// static
|
||||
-uint64_t SysInfo::MaxSharedMemorySize() {
|
||||
- size_t limit;
|
||||
- size_t size = sizeof(limit);
|
||||
- if (sysctlbyname("kern.ipc.shmmax", &limit, &size, NULL, 0) < 0) {
|
||||
+std::string SysInfo::CPUModelName() {
|
||||
+ int mib[] = { CTL_HW, HW_MODEL };
|
||||
+ char name[256];
|
||||
+ size_t size = arraysize(name);
|
||||
+ if (sysctl(mib, arraysize(mib), &name, &size, NULL, 0) == 0)
|
||||
+ return name;
|
||||
+ return std::string();
|
||||
+}
|
||||
+
|
||||
+int SysInfo::NumberOfProcessors() {
|
||||
+ int mib[] = { CTL_HW, HW_NCPU };
|
||||
+ int ncpu;
|
||||
+ size_t size = sizeof(ncpu);
|
||||
+ if (sysctl(mib, arraysize(mib), &ncpu, &size, NULL, 0) == -1) {
|
||||
NOTREACHED();
|
||||
- return 0;
|
||||
+ return 1;
|
||||
}
|
||||
- return static_cast<uint64_t>(limit);
|
||||
+ return ncpu;
|
||||
}
|
||||
|
||||
} // namespace base
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/syslog_logging.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/syslog_logging.cc
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "base/debug/stack_trace.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/win/win_util.h"
|
||||
-#elif defined(OS_LINUX)
|
||||
+#elif defined(OS_LINUX) || defined(OS_BSD)
|
||||
// <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
|
||||
// base::LOG_INFO, base::LOG_WARNING.
|
||||
#include <syslog.h>
|
||||
@@ -113,7 +113,7 @@ EventLogMessage::~EventLogMessage() {
|
||||
|
||||
if (user_sid != nullptr)
|
||||
::LocalFree(user_sid);
|
||||
-#elif defined(OS_LINUX)
|
||||
+#elif defined(OS_LINUX) || defined(OS_BSD)
|
||||
const char kEventSource[] = "chrome";
|
||||
openlog(kEventSource, LOG_NOWAIT | LOG_PID, LOG_USER);
|
||||
// We can't use the defined names for the logging severity from syslog.h
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/system/sys_info.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/system/sys_info.cc
|
||||
@@ -102,7 +102,7 @@ void SysInfo::GetHardwareInfo(base::Once
|
||||
#elif defined(OS_ANDROID) || defined(OS_MACOSX)
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
FROM_HERE, {}, base::BindOnce(&GetHardwareInfoSync), std::move(callback));
|
||||
-#elif defined(OS_LINUX)
|
||||
+#elif defined(OS_LINUX) || defined(OS_BSD)
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
FROM_HERE, {base::MayBlock()}, base::BindOnce(&GetHardwareInfoSync),
|
||||
std::move(callback));
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/system/sys_info.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/system/sys_info.h
|
||||
@@ -201,6 +201,8 @@ class BASE_EXPORT SysInfo {
|
||||
// On Desktop this returns true when memory <= 512MB.
|
||||
static bool IsLowEndDevice();
|
||||
|
||||
+ static uint64_t MaxSharedMemorySize();
|
||||
+
|
||||
private:
|
||||
FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
|
||||
FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo);
|
||||
@@ -210,7 +212,7 @@ class BASE_EXPORT SysInfo {
|
||||
static bool IsLowEndDeviceImpl();
|
||||
static HardwareInfo GetHardwareInfoSync();
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_BSD)
|
||||
static int64_t AmountOfAvailablePhysicalMemory(
|
||||
const SystemMemoryInfoKB& meminfo);
|
||||
#endif
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/sys_info_netbsd.cc.orig 2016-11-12 07:18:17.632595486 +0000
|
||||
+++ base/sys_info_netbsd.cc
|
||||
@@ -0,0 +1,77 @@
|
||||
--- base/system/sys_info_netbsd.cc.orig 2020-07-09 13:28:11.909266556 +0000
|
||||
+++ base/system/sys_info_netbsd.cc
|
||||
@@ -0,0 +1,78 @@
|
||||
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "base/sys_info.h"
|
||||
+#include "base/system/sys_info.h"
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
|
@ -15,8 +15,8 @@ $NetBSD$
|
|||
+#include <sys/shm.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+
|
||||
+#include "base/logging.h"
|
||||
+#include "base/macros.h"
|
||||
+#include "base/notreached.h"
|
||||
+#include "base/stl_util.h"
|
||||
+
|
||||
+namespace {
|
||||
+
|
||||
|
@ -34,49 +34,50 @@ $NetBSD$
|
|||
+
|
||||
+namespace base {
|
||||
+
|
||||
+int64_t SysInfo::AmountOfPhysicalMemory() {
|
||||
+ return AmountOfMemory(_SC_PHYS_PAGES);
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+int64_t SysInfo::AmountOfAvailablePhysicalMemory() {
|
||||
+ int ret;
|
||||
+ int mib[2];
|
||||
+ int64_t memsize;
|
||||
+ unsigned long size = sizeof(memsize);
|
||||
+
|
||||
+ mib[0] = CTL_HW;
|
||||
+ mib[1] = HW_PHYSMEM64;
|
||||
+
|
||||
+ ret = sysctl(mib, 2, &memsize, &size, NULL, 0);
|
||||
+ if (ret == -1) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return memsize;
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+std::string SysInfo::CPUModelName() {
|
||||
+ int mib[] = { CTL_HW, HW_MODEL };
|
||||
+ char name[256];
|
||||
+ size_t len = arraysize(name);
|
||||
+ if (sysctl(mib, arraysize(mib), name, &len, NULL, 0) < 0) {
|
||||
+ NOTREACHED();
|
||||
+ return std::string();
|
||||
+ }
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+int SysInfo::NumberOfProcessors() {
|
||||
+ int mib[] = { CTL_HW, HW_NCPU };
|
||||
+ int mib[] = {CTL_HW, HW_NCPU};
|
||||
+ int ncpu;
|
||||
+ size_t size = sizeof(ncpu);
|
||||
+ if (sysctl(mib, arraysize(mib), &ncpu, &size, NULL, 0) < 0) {
|
||||
+ if (sysctl(mib, base::size(mib), &ncpu, &size, NULL, 0) < 0) {
|
||||
+ NOTREACHED();
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return ncpu;
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+int64_t SysInfo::AmountOfPhysicalMemoryImpl() {
|
||||
+ return AmountOfMemory(_SC_PHYS_PAGES);
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
|
||||
+ return AmountOfMemory(_SC_PHYS_PAGES);
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+uint64_t SysInfo::MaxSharedMemorySize() {
|
||||
+ int mib[] = {CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_SHMMAX};
|
||||
+ size_t limit;
|
||||
+ size_t size = sizeof(limit);
|
||||
+ if (sysctl(mib, base::size(mib), &limit, &size, NULL, 0) < 0) {
|
||||
+ NOTREACHED();
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return static_cast<uint64_t>(limit);
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+std::string SysInfo::CPUModelName() {
|
||||
+ int mib[] = {CTL_HW, HW_MODEL};
|
||||
+ char name[256];
|
||||
+ size_t len = base::size(name);
|
||||
+ if (sysctl(mib, base::size(mib), name, &len, NULL, 0) < 0) {
|
||||
+ NOTREACHED();
|
||||
+ return std::string();
|
||||
+ }
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+} // namespace base
|
|
@ -1,7 +1,7 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/sys_info_posix.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
+++ base/sys_info_posix.cc
|
||||
--- base/system/sys_info_posix.cc.orig 2020-07-15 18:55:48.000000000 +0000
|
||||
+++ base/system/sys_info_posix.cc
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace {
|
||||
|
@ -11,7 +11,7 @@ $NetBSD$
|
|||
int NumberOfProcessors() {
|
||||
// sysconf returns the number of "logical" (not "physical") processors on both
|
||||
// Mac and Linux. So we get the number of max available "logical" processors.
|
||||
@@ -128,7 +128,7 @@ bool GetDiskSpaceInfo(const base::FilePa
|
||||
@@ -127,7 +127,7 @@ bool GetDiskSpaceInfo(const base::FilePa
|
||||
|
||||
namespace base {
|
||||
|
||||
|
@ -20,3 +20,12 @@ $NetBSD$
|
|||
int SysInfo::NumberOfProcessors() {
|
||||
return g_lazy_number_of_processors.Get().value();
|
||||
}
|
||||
@@ -220,6 +220,8 @@ std::string SysInfo::OperatingSystemArch
|
||||
arch = "x86";
|
||||
} else if (arch == "amd64") {
|
||||
arch = "x86_64";
|
||||
+ } else if (arch == "arm64") {
|
||||
+ arch = "aarch64";
|
||||
} else if (std::string(info.sysname) == "AIX") {
|
||||
arch = "ppc64";
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/task/thread_pool/environment_config_unittest.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/task/thread_pool/environment_config_unittest.cc
|
||||
@@ -15,7 +15,7 @@ TEST(ThreadPoolEnvironmentConfig, CanUse
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS)
|
||||
EXPECT_TRUE(CanUseBackgroundPriorityForWorkerThread());
|
||||
#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || \
|
||||
- defined(OS_CHROMEOS) || defined(OS_NACL)
|
||||
+ defined(OS_CHROMEOS) || defined(OS_NACL) || defined(OS_BSD)
|
||||
EXPECT_FALSE(CanUseBackgroundPriorityForWorkerThread());
|
||||
#else
|
||||
#error Platform doesn't match any block
|
|
@ -1,13 +1,22 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/test/BUILD.gn.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/test/BUILD.gn.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/test/BUILD.gn
|
||||
@@ -303,7 +303,7 @@ static_library("run_all_base_unittests")
|
||||
]
|
||||
@@ -403,7 +403,7 @@ static_library("run_all_base_unittests")
|
||||
deps = [ ":test_support" ]
|
||||
}
|
||||
|
||||
-if (is_linux) {
|
||||
+if (is_linux || is_bsd) {
|
||||
source_set("fontconfig_util_linux") {
|
||||
sources = [
|
||||
"fontconfig_util_linux.cc",
|
||||
@@ -444,7 +444,7 @@ if (is_linux) {
|
||||
}
|
||||
}
|
||||
|
||||
-if (is_fuchsia || is_linux) {
|
||||
+if (is_fuchsia || is_linux || is_bsd) {
|
||||
shared_library("malloc_wrapper") {
|
||||
testonly = true
|
||||
sources = [
|
||||
sources = [ "malloc_wrapper.cc" ]
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/test/launcher/test_launcher.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/test/launcher/test_launcher.cc.orig 2020-07-08 21:41:45.000000000 +0000
|
||||
+++ base/test/launcher/test_launcher.cc
|
||||
@@ -59,6 +59,10 @@
|
||||
#include "base/win/windows_version.h"
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#if defined(OS_POSIX)
|
||||
+#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "base/files/file_descriptor_watcher_posix.h"
|
||||
@@ -582,7 +583,7 @@ ChildProcessResults DoLaunchChildTestPro
|
||||
#if !defined(OS_FUCHSIA)
|
||||
options.new_process_group = true;
|
||||
#endif
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
options.kill_on_parent_death = true;
|
||||
#endif
|
||||
|
||||
+#if defined(OS_FREEBSD)
|
||||
+#include <signal.h>
|
||||
@@ -1497,6 +1498,10 @@ bool TestLauncher::Init(CommandLine* com
|
||||
results_tracker_.AddGlobalTag("OS_OPENBSD");
|
||||
#endif
|
||||
|
||||
+#if defined(OS_NETBSD)
|
||||
+ results_tracker_.AddGlobalTag("OS_NETBSD");
|
||||
+#endif
|
||||
+
|
||||
namespace base {
|
||||
|
||||
// See https://groups.google.com/a/chromium.org/d/msg/chromium-dev/nkdTP7sstSc/uT3FaE_sgkAJ .
|
||||
#if defined(OS_POSIX)
|
||||
results_tracker_.AddGlobalTag("OS_POSIX");
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/test/test_file_util_posix.cc.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/test/test_file_util_posix.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/test/test_file_util_posix.cc
|
||||
@@ -79,7 +79,7 @@ bool DieFileDie(const FilePath& file, bo
|
||||
return DeleteFile(file, recurse);
|
||||
@@ -85,7 +85,7 @@ void SyncPageCacheToDisk() {
|
||||
sync();
|
||||
}
|
||||
|
||||
-#if !defined(OS_LINUX) && !defined(OS_MACOSX)
|
||||
+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_BSD)
|
||||
-#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
|
||||
+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) || defined(OS_BSD)
|
||||
bool EvictFileFromSystemCache(const FilePath& file) {
|
||||
// There doesn't seem to be a POSIX way to cool the disk cache.
|
||||
NOTIMPLEMENTED();
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/test/test_suite.cc.orig 2020-07-08 21:40:31.000000000 +0000
|
||||
+++ base/test/test_suite.cc
|
||||
@@ -70,7 +70,7 @@
|
||||
#include "base/test/test_support_ios.h"
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
#include "base/test/fontconfig_util_linux.h"
|
||||
#endif
|
||||
|
||||
@@ -386,7 +386,7 @@ void TestSuite::PreInitialize() {
|
||||
testing::GTEST_FLAG(catch_exceptions) = false;
|
||||
#endif
|
||||
EnableTerminationOnHeapCorruption();
|
||||
-#if defined(OS_LINUX) && defined(USE_AURA)
|
||||
+#if (defined(OS_LINUX) || defined(OS_BSD)) && defined(USE_AURA)
|
||||
// When calling native char conversion functions (e.g wrctomb) we need to
|
||||
// have the locale set. In the absence of such a call the "C" locale is the
|
||||
// default. In the gtk code (below) gtk_init() implicitly sets a locale.
|
||||
@@ -634,7 +634,7 @@ void TestSuite::Initialize() {
|
||||
// TODO(jshin): Should we set the locale via an OS X locale API here?
|
||||
i18n::SetICUDefaultLocale("en_US");
|
||||
|
||||
-#if defined(OS_LINUX)
|
||||
+#if defined(OS_LINUX) || defined(OS_BSD)
|
||||
SetUpFontconfig();
|
||||
#endif
|
||||
|
|
@ -1,17 +1,31 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/third_party/libevent/BUILD.gn.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/third_party/libevent/BUILD.gn.orig 2020-07-15 18:55:48.000000000 +0000
|
||||
+++ base/third_party/libevent/BUILD.gn
|
||||
@@ -29,6 +29,12 @@ static_library("libevent") {
|
||||
@@ -45,11 +45,25 @@ static_library("libevent") {
|
||||
include_dirs = [ "mac" ]
|
||||
} else if (is_linux) {
|
||||
sources += [ "epoll.c" ]
|
||||
sources += [
|
||||
- "epoll.c",
|
||||
+ "kqueue.c",
|
||||
"linux/config.h",
|
||||
"linux/event-config.h",
|
||||
]
|
||||
include_dirs = [ "linux" ]
|
||||
+ } else if (is_freebsd) {
|
||||
+ sources += [ "kqueue.c" ]
|
||||
+ sources += [
|
||||
+ "kqueue.c",
|
||||
+ "freebsd/config.h",
|
||||
+ "freebsd/event-config.h",
|
||||
+ ]
|
||||
+ include_dirs = [ "freebsd" ]
|
||||
+ } else if (is_netbsd) {
|
||||
+ sources += [ "kqueue.c" ]
|
||||
+ sources += [
|
||||
+ "kqueue.c",
|
||||
+ "netbsd/config.h",
|
||||
+ "netbsd/event-config.h",
|
||||
+ ]
|
||||
+ include_dirs = [ "netbsd" ]
|
||||
} else if (is_android) {
|
||||
sources += [ "epoll.c" ]
|
||||
include_dirs = [ "android" ]
|
||||
sources += [
|
||||
"android/config.h",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/third_party/libevent/event-config.h.orig 2016-11-10 20:02:09.000000000 +0000
|
||||
--- base/third_party/libevent/event-config.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/third_party/libevent/event-config.h
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "base/third_party/libevent/linux/event-config.h"
|
||||
|
@ -10,4 +10,4 @@ $NetBSD$
|
|||
+#include "base/third_party/libevent/netbsd/event-config.h"
|
||||
#elif defined(__sun)
|
||||
#include "base/third_party/libevent/solaris/event-config.h"
|
||||
#else
|
||||
#elif defined(_AIX)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- base/threading/platform_thread.h.orig 2017-02-02 02:02:47.000000000 +0000
|
||||
--- base/threading/platform_thread.h.orig 2020-06-25 09:31:18.000000000 +0000
|
||||
+++ base/threading/platform_thread.h
|
||||
@@ -205,7 +205,7 @@ class BASE_EXPORT PlatformThread {
|
||||
@@ -221,7 +221,7 @@ class BASE_EXPORT PlatformThread {
|
||||
|
||||
static ThreadPriority GetCurrentThreadPriority();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue