parent
2cd8b7d803
commit
f1fd521309
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= gpsprune
|
||||
PORTVERSION= 21.2
|
||||
PORTVERSION= 21.3
|
||||
CATEGORIES= astro java
|
||||
MASTER_SITES= https://activityworkshop.net/software/${PORTNAME}/ \
|
||||
https://mirror.amdmi3.ru/distfiles/
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1649335039
|
||||
SHA256 (gpsprune_21.2.jar) = 4206cb6e9aa50b6b084db3cae1971aa2f9b2730856b67bb4eb1f05d20ae91027
|
||||
SIZE (gpsprune_21.2.jar) = 1272912
|
||||
TIMESTAMP = 1652697039
|
||||
SHA256 (gpsprune_21.3.jar) = d2e3c230c5a2c70d5d65e1b5da4bc53b8153a7caab3ac2f22d32ad192549c6ec
|
||||
SIZE (gpsprune_21.3.jar) = 1273421
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= mkgmap
|
||||
PORTVERSION= r4900
|
||||
PORTVERSION= r4902
|
||||
CATEGORIES= astro converters java
|
||||
MASTER_SITES= https://www.mkgmap.org.uk/download/
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1651835702
|
||||
SHA256 (mkgmap-r4900.tar.gz) = c1749b65e779e6fc70df21c25b4f596b8b5b1bbf7797c533aa5134b76a657500
|
||||
SIZE (mkgmap-r4900.tar.gz) = 3523037
|
||||
TIMESTAMP = 1652697028
|
||||
SHA256 (mkgmap-r4902.tar.gz) = 78a1a66e91a3c6fd4a73732dca03db33445f68368bbef372a0118d77601c9233
|
||||
SIZE (mkgmap-r4902.tar.gz) = 3522878
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= siril
|
||||
DISTVERSION= 1.0.1
|
||||
DISTVERSION= 1.0.2
|
||||
CATEGORIES= astro graphics
|
||||
MASTER_SITES= https://free-astro.org/download/
|
||||
|
||||
|
@ -34,8 +34,6 @@ USES= compiler:c++11-lang desktop-file-utils gettext \
|
|||
gnome meson pkgconfig jpeg shared-mime-info tar:bz2
|
||||
USE_GNOME= atk cairo gdkpixbuf2 gtk30 intltool pango
|
||||
|
||||
NO_WRKSUBDIR= yes
|
||||
|
||||
BINARY_ALIAS= git=false
|
||||
|
||||
OPTIONS_DEFINE= CURL OPENMP
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1651984466
|
||||
SHA256 (siril-1.0.1.tar.bz2) = 88bd69dfef04a61a38a9a5a1b0d7e69e2f45321ce6d9ef61a617d8a1a52671cc
|
||||
SIZE (siril-1.0.1.tar.bz2) = 3486586
|
||||
TIMESTAMP = 1652726828
|
||||
SHA256 (siril-1.0.2.tar.bz2) = 4973bd7ad6d3cb7ad279ef27bb5c79f37ca1f914c7b6ad8fe689e1d59189f2db
|
||||
SIZE (siril-1.0.2.tar.bz2) = 3097839
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
--- meson.build.orig 2022-04-05 08:15:46 UTC
|
||||
+++ meson.build
|
||||
@@ -138,6 +138,7 @@ elif platform_bsd
|
||||
siril_link_arg += '-Wl,--no-as-needed' # workaround for https://gitlab.com/free-astro/siril/-/issues/614 (Bug#251206)
|
||||
siril_link_arg += '-rdynamic'
|
||||
siril_link_arg += '-lexecinfo'
|
||||
+ siril_link_arg += '-Wl,--no-as-needed' # workaround for https://gitlab.com/free-astro/siril/-/issues/614 (Bug#251206)
|
||||
elif platform_windows
|
||||
#TODO: Do Meson provide more elegant way?
|
||||
siril_link_arg += '-Wl,--export-all-symbols'
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= dmidiplayer
|
||||
DISTVERSION= 1.5.3
|
||||
DISTVERSION= 1.6.0
|
||||
CATEGORIES= audio
|
||||
MASTER_SITES= SF/${PORTNAME}/v${DISTVERSION}/
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1651104232
|
||||
SHA256 (dmidiplayer-1.5.3.tar.bz2) = 8f6ac971f97a25f4dfb4272eac578c886fc41f58a1681e4cb23e9ef70f07ab56
|
||||
SIZE (dmidiplayer-1.5.3.tar.bz2) = 1666249
|
||||
TIMESTAMP = 1652730130
|
||||
SHA256 (dmidiplayer-1.6.0.tar.bz2) = 81baac7f438e071481d9bdfc6ebcaa23e73117dba1142a70a1077a29e6deff5c
|
||||
SIZE (dmidiplayer-1.6.0.tar.bz2) = 1909560
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
bin/dmidiplayer
|
||||
share/man/man1/dmidiplayer.1.gz
|
||||
share/applications/net.sourceforge.dmidiplayer.desktop
|
||||
%%DATADIR%%/Negra_Sombra.kar
|
||||
%%DATADIR%%/dmidiplayer_cs.qm
|
||||
%%DATADIR%%/dmidiplayer_de.qm
|
||||
%%DATADIR%%/dmidiplayer_es.qm
|
||||
%%DATADIR%%/dmidiplayer_fr.qm
|
||||
%%DATADIR%%/dmidiplayer_gl.qm
|
||||
%%DATADIR%%/dmidiplayer_it.qm
|
||||
%%DATADIR%%/dmidiplayer_ru.qm
|
||||
%%DATADIR%%/examples.lst
|
||||
|
@ -22,4 +23,5 @@ share/icons/hicolor/32x32/apps/dmidiplayer.png
|
|||
share/icons/hicolor/48x48/apps/dmidiplayer.png
|
||||
share/icons/hicolor/64x64/apps/dmidiplayer.png
|
||||
share/icons/hicolor/scalable/apps/dmidiplayer.svgz
|
||||
share/metainfo/net.sourceforge.dmidiplayer.appdata.xml
|
||||
share/man/man1/dmidiplayer.1.gz
|
||||
share/metainfo/net.sourceforge.dmidiplayer.metainfo.xml
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= jack-example-tools
|
||||
DISTVERSION= 1
|
||||
DISTVERSION= 3
|
||||
CATEGORIES= audio
|
||||
|
||||
MAINTAINER= dev@submerge.ch
|
||||
|
@ -9,36 +9,36 @@ LICENSE= GPLv2 GPLv3+
|
|||
LICENSE_COMB= multi
|
||||
|
||||
LIB_DEPENDS= libjack.so:audio/jack \
|
||||
libsndfile.so:audio/libsndfile \
|
||||
libsamplerate.so:audio/libsamplerate \
|
||||
libsndfile.so:audio/libsndfile \
|
||||
libsysinfo.so:devel/libsysinfo
|
||||
|
||||
USES= compiler:c11 pkgconfig meson localbase:ldflags
|
||||
USES= compiler:c11 localbase:ldflags meson pkgconfig
|
||||
|
||||
USE_GITHUB= yes
|
||||
GH_ACCOUNT= jackaudio
|
||||
|
||||
CONFIGURE_ARGS= -Djack_net=enabled \
|
||||
-Djack_netsource=enabled \
|
||||
-Djack_rec=enabled
|
||||
CFLAGS+= -fPIC
|
||||
CPPFLAGS+= -I${LOCALBASE}/include
|
||||
|
||||
CONFIGURE_ARGS= -Djack_net=enabled -Djack_netsource=enabled -Djack_rec=enabled
|
||||
|
||||
OPTIONS_DEFINE= ALSA READLINE OPUS
|
||||
OPTIONS_DEFAULT= READLINE OPUS
|
||||
OPTIONS_DEFINE= ALSA OPUS READLINE
|
||||
OPTIONS_DEFAULT= OPUS READLINE
|
||||
OPTIONS_SUB= yes
|
||||
|
||||
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib \
|
||||
libzita-alsa-pcmi.so:audio/zita-alsa-pcmi \
|
||||
libzita-resampler.so:audio/zita-resampler
|
||||
ALSA_MESON_ENABLED= alsa_in_out zalsa
|
||||
OPUS_LIB_DEPENDS= libopus.so:audio/opus
|
||||
OPUS_MESON_ENABLED= opus_support
|
||||
|
||||
READLINE_USES= readline
|
||||
READLINE_MESON_ENABLED= readline_support
|
||||
READLINE_LDFLAGS= -lreadline
|
||||
|
||||
OPUS_LIB_DEPENDS= libopus.so:audio/opus
|
||||
OPUS_MESON_ENABLED= opus_support
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
# The alloca.h header is not available on FreeBSD. Upstream knows:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1642267725
|
||||
SHA256 (jackaudio-jack-example-tools-1_GH0.tar.gz) = dd4fc199b1cfe73ca31890b2427e935321a4e9934be4b80fa8a159afe75bd446
|
||||
SIZE (jackaudio-jack-example-tools-1_GH0.tar.gz) = 124188
|
||||
TIMESTAMP = 1651427119
|
||||
SHA256 (jackaudio-jack-example-tools-3_GH0.tar.gz) = 661a95d43c276d444b03756564ceaa3b53a2a0b78c8147631383f31fa85135c6
|
||||
SIZE (jackaudio-jack-example-tools-3_GH0.tar.gz) = 125686
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= yoshimi
|
||||
DISTVERSION= 2.1.2.2
|
||||
DISTVERSION= 2.2.0
|
||||
CATEGORIES= audio
|
||||
|
||||
MAINTAINER= yuri@FreeBSD.org
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1639511507
|
||||
SHA256 (Yoshimi-yoshimi-2.1.2.2_GH0.tar.gz) = 194c552d5b57883dee2c8bc9f37cc3743787541a8c3fe56afc556f24324a4576
|
||||
SIZE (Yoshimi-yoshimi-2.1.2.2_GH0.tar.gz) = 7641720
|
||||
TIMESTAMP = 1652737033
|
||||
SHA256 (Yoshimi-yoshimi-2.2.0_GH0.tar.gz) = 4d447357bfeaddcfa40e393f0fc81f1d5381f36cb1f7999c36ee0c5736af239e
|
||||
SIZE (Yoshimi-yoshimi-2.2.0_GH0.tar.gz) = 8021191
|
||||
|
|
|
@ -2,9 +2,9 @@ bin/yoshimi
|
|||
lib/lv2/yoshimi.lv2/manifest.ttl
|
||||
lib/lv2/yoshimi.lv2/yoshimi.ttl
|
||||
lib/lv2/yoshimi.lv2/yoshimi_lv2.so
|
||||
share/man/man1/yoshimi.1.gz
|
||||
share/applications/yoshimi.desktop
|
||||
share/icons/hicolor/scalable/apps/yoshimi.svg
|
||||
share/icons/hicolor/scalable/apps/yoshimi_alt.svg
|
||||
share/man/man1/yoshimi.1.gz
|
||||
share/metainfo/yoshimi.appdata.xml
|
||||
share/pixmaps/yoshimi.png
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
PORTNAME= vkmark
|
||||
DISTVERSION= 2017.08-24
|
||||
DISTVERSIONSUFFIX= -g53abc4f
|
||||
PORTREVISION= 2
|
||||
DISTVERSION= 2017.08-29
|
||||
DISTVERSIONSUFFIX= -gd872846
|
||||
CATEGORIES= benchmarks
|
||||
|
||||
PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
|
||||
|
@ -13,8 +12,6 @@ COMMENT= Vulkan benchmark
|
|||
LICENSE= LGPL21+
|
||||
LICENSE_FILE= ${WRKSRC}/COPYING-LGPL2.1
|
||||
|
||||
BROKEN= https://github.com/vkmark/vkmark/issues/40
|
||||
|
||||
BUILD_DEPENDS= vulkan-headers>0:graphics/vulkan-headers \
|
||||
glm>0:math/glm
|
||||
LIB_DEPENDS= libvulkan.so:graphics/vulkan-loader \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TIMESTAMP = 1615558568
|
||||
SHA256 (vkmark-vkmark-2017.08-24-g53abc4f_GH0.tar.gz) = a80d70c19834f7b6a1a2987ddeca3d9f6d875269380ffbb09bf8ae33a3380fbf
|
||||
SIZE (vkmark-vkmark-2017.08-24-g53abc4f_GH0.tar.gz) = 720578
|
||||
TIMESTAMP = 1652699223
|
||||
SHA256 (vkmark-vkmark-2017.08-29-gd872846_GH0.tar.gz) = cec2bd4aab462e188a80fedccb8c454dc8b1d2bca3c8b411e0788f1c45f3d112
|
||||
SIZE (vkmark-vkmark-2017.08-29-gd872846_GH0.tar.gz) = 769259
|
||||
SHA256 (27fa846e34ed.patch) = 794580167aa2839b5410a7e4e48f38bd6c75a9f675f454dc3ae088fea6a1277a
|
||||
SIZE (27fa846e34ed.patch) = 2028
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= biosig
|
||||
DISTVERSION= 2.4.0
|
||||
DISTVERSION= 2.4.1
|
||||
CATEGORIES= biology
|
||||
MASTER_SITES= SF/${PORTNAME}/BioSig%20for%20C_C%2B%2B/src/
|
||||
DISTNAME= ${PORTNAME}-${PORTVERSION}.src
|
||||
|
@ -15,7 +15,7 @@ LIB_DEPENDS= libb64.so:converters/libb64 \
|
|||
libiconv.so:converters/libiconv \
|
||||
libtinyxml.so:textproc/tinyxml
|
||||
|
||||
USES= gmake iconv localbase:ldflags
|
||||
USES= gmake iconv localbase:ldflags tar:xz
|
||||
USE_LDCONFIG= yes
|
||||
|
||||
WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1647805069
|
||||
SHA256 (biosig-2.4.0.src.tar.gz) = 3a7cdc0f003f28de2572984db865808039a52a943c587cfb5a87679548864365
|
||||
SIZE (biosig-2.4.0.src.tar.gz) = 2540501
|
||||
TIMESTAMP = 1652738419
|
||||
SHA256 (biosig-2.4.1.src.tar.xz) = f7426d3fd238df1c54071ca59a14c3f4f92839fe1a54cdcfed9f32598ec98080
|
||||
SIZE (biosig-2.4.1.src.tar.xz) = 1864696
|
||||
|
|
|
@ -218,6 +218,7 @@ man/man1/sigviewer.1.gz
|
|||
%%DATADIR%%/matlab/t330_StimFit/Contents.m
|
||||
%%DATADIR%%/matlab/t330_StimFit/demo_stimfit.m
|
||||
%%DATADIR%%/matlab/t330_StimFit/microstimfit.m
|
||||
%%DATADIR%%/matlab/t330_StimFit/minidet.m
|
||||
%%DATADIR%%/matlab/t330_StimFit/simul001.m
|
||||
%%DATADIR%%/matlab/t330_StimFit/simul002.m
|
||||
%%DATADIR%%/matlab/t340_MachineLearningOptimalDetection/README.md
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
PORTNAME= taxonkit
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 0.10.1
|
||||
PORTREVISION= 1
|
||||
DISTVERSION= 0.11.0
|
||||
CATEGORIES= biology
|
||||
|
||||
MAINTAINER= yuri@FreeBSD.org
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TIMESTAMP = 1645983173
|
||||
SHA256 (go/biology_taxonkit/taxonkit-v0.10.1/v0.10.1.mod) = 2f19f315db37ae1bc6f77fe30bff16c18b0f2dfb417afb3b6b3dee6f3f028915
|
||||
SIZE (go/biology_taxonkit/taxonkit-v0.10.1/v0.10.1.mod) = 877
|
||||
SHA256 (go/biology_taxonkit/taxonkit-v0.10.1/v0.10.1.zip) = efbf882a1f4c9ed89171668a5f70696f8906716beef5973bab03d57372747fa5
|
||||
SIZE (go/biology_taxonkit/taxonkit-v0.10.1/v0.10.1.zip) = 1581567
|
||||
TIMESTAMP = 1652725345
|
||||
SHA256 (go/biology_taxonkit/taxonkit-v0.11.0/v0.11.0.mod) = 94b649063d9e17f19db8b47b1ba840e302e26b44b423523fc0abef0590122a9b
|
||||
SIZE (go/biology_taxonkit/taxonkit-v0.11.0/v0.11.0.mod) = 1000
|
||||
SHA256 (go/biology_taxonkit/taxonkit-v0.11.0/v0.11.0.zip) = 31feb95e6b66f692e4fda301986e96a5076b371d173a550774853a9e940bd83a
|
||||
SIZE (go/biology_taxonkit/taxonkit-v0.11.0/v0.11.0.zip) = 1593283
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Created by: gahr
|
||||
|
||||
PORTNAME= cassandra-cpp-driver
|
||||
PORTVERSION= 2.16.0
|
||||
PORTVERSION= 2.16.2
|
||||
PORTREVISION= 0
|
||||
CATEGORIES= databases
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1615540362
|
||||
SHA256 (datastax-cpp-driver-2.16.0_GH0.tar.gz) = 35b0f4bac3d17fef47e28611dbeb51e07639395e957f23f4a3cc60770db1ab9c
|
||||
SIZE (datastax-cpp-driver-2.16.0_GH0.tar.gz) = 12282109
|
||||
TIMESTAMP = 1652697359
|
||||
SHA256 (datastax-cpp-driver-2.16.2_GH0.tar.gz) = de60751bd575b5364c2c5a17a24a40f3058264ea2ee6fef19de126ae550febc9
|
||||
SIZE (datastax-cpp-driver-2.16.2_GH0.tar.gz) = 12284853
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Created by: Palle Girgensohn <girgen@FreeBSD.org>
|
||||
|
||||
PORTNAME= powa-web
|
||||
PORTVERSION= 4.0.2
|
||||
PORTVERSION= 4.1.3
|
||||
CATEGORIES= databases python
|
||||
MASTER_SITES= CHEESESHOP
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1598863311
|
||||
SHA256 (powa-web-4.0.2.tar.gz) = f1fb85293f4eac7b6d283422b4268605dec371d794a45b9f623b772cd593988a
|
||||
SIZE (powa-web-4.0.2.tar.gz) = 8175439
|
||||
TIMESTAMP = 1652688719
|
||||
SHA256 (powa-web-4.1.3.tar.gz) = 11090a4db0f3546610a3898adf0094b02706add4eff12508cfd0cd6384f5b19e
|
||||
SIZE (powa-web-4.1.3.tar.gz) = 8247514
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Created by: Jason Helfman <jgh@FreeBSD.org>
|
||||
|
||||
PORTNAME= xpad
|
||||
PORTVERSION= 5.4.0
|
||||
PORTREVISION= 2
|
||||
PORTVERSION= 5.7.0
|
||||
CATEGORIES= deskutils
|
||||
MASTER_SITES= https://launchpad.net/${PORTNAME}/trunk/${PORTVERSION}/+download/
|
||||
|
||||
|
@ -12,6 +11,7 @@ COMMENT= Virtual note-pad system for your X11 desktop
|
|||
LICENSE= GPLv3
|
||||
|
||||
RUN_DEPENDS= gnome-icon-theme>=0:misc/gnome-icon-theme
|
||||
LIB_DEPENDS+= libharfbuzz.so:print/harfbuzz
|
||||
|
||||
USES= autoreconf compiler:c++11-lang gmake pkgconfig tar:bzip2 gnome xorg
|
||||
|
||||
|
@ -20,7 +20,7 @@ OPTIONS_SUB= yes
|
|||
|
||||
CONFLICTS_INSTALL= xpad3
|
||||
USE_XORG= x11 sm ice
|
||||
USE_GNOME= gtk30 intltool gtksourceview3 cairo
|
||||
USE_GNOME= gtk30 gtksourceview4 cairo gdkpixbuf2
|
||||
CPPFLAGS+= ${CXXFLAGS} -I${LOCALBASE}/include
|
||||
LDFLAGS+= -L${LOCALBASE}/lib
|
||||
GNU_CONFIGURE= yes
|
||||
|
@ -67,12 +67,6 @@ share/locale/zh_TW/LC_MESSAGES/xpad.mo
|
|||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's|glib/glist.h|glib.h|g' \
|
||||
${WRKSRC}/src/xpad-undo.c
|
||||
@${REINPLACE_CMD} -e 's|/etc/xdg/autostart|${LOCALBASE}/etc/xdg/autostart|g' \
|
||||
${WRKSRC}/Makefile.am
|
||||
|
||||
post-install-DOCS-on:
|
||||
@${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
.for doc in AUTHORS ChangeLog INSTALL NEWS README TODO THANKS
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1565721806
|
||||
SHA256 (xpad-5.4.0.tar.bz2) = a395cb282a2cfb0d56f1e911afb7e38ad74f6d738082a7c6c181b3052ca7f5e2
|
||||
SIZE (xpad-5.4.0.tar.bz2) = 163394
|
||||
TIMESTAMP = 1652600372
|
||||
SHA256 (xpad-5.7.0.tar.bz2) = ead80a5e8b52e854d730e0c075df5a190be311522a441e87f1d2ec57fdd0856b
|
||||
SIZE (xpad-5.7.0.tar.bz2) = 162675
|
||||
|
|
|
@ -14,4 +14,4 @@ release:
|
|||
* Support for the X session management protocol.
|
||||
* Support for the www.freedesktop.org system tray proposal.
|
||||
|
||||
WWW: https://launchpad.net/xpad
|
||||
WWW: https://launchpad.net/xpad/trunk
|
||||
|
|
|
@ -568,6 +568,7 @@
|
|||
SUBDIR += egypt
|
||||
SUBDIR += eiffelstudio
|
||||
SUBDIR += electron13
|
||||
SUBDIR += electron17
|
||||
SUBDIR += elf
|
||||
SUBDIR += elf-dissector
|
||||
SUBDIR += elfcat
|
||||
|
|
|
@ -0,0 +1,339 @@
|
|||
PORTNAME= electron
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= ${ELECTRON_VER:S/-beta./.b/}
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= https://github.com/tagattie/FreeBSD-Electron/releases/download/v17.4.4/:chromium \
|
||||
https://commondatastorage.googleapis.com/chromium-nodejs/:chromium_node \
|
||||
https://commondatastorage.googleapis.com/chromium-fonts/:chromium_testfonts
|
||||
PKGNAMESUFFIX= ${ELECTRON_VER_MAJOR}
|
||||
DISTFILES= chromium-${CHROMIUM_VER}${EXTRACT_SUFX}:chromium \
|
||||
${CHROMIUM_NODE_MODULES_HASH}:chromium_node \
|
||||
${CHROMIUM_TEST_FONTS_HASH}:chromium_testfonts \
|
||||
electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX}:prefetch
|
||||
DIST_SUBDIR= ${PORTNAME}
|
||||
|
||||
MAINTAINER= tagattie@FreeBSD.org
|
||||
COMMENT= Build cross-platform desktop apps with JavaScript, HTML, and CSS
|
||||
|
||||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/electron/LICENSE
|
||||
|
||||
FETCH_DEPENDS= yarn-node16>0:www/yarn-node16
|
||||
EXTRACT_DEPENDS= yarn-node16>0:www/yarn-node16
|
||||
PATCH_DEPENDS= git:devel/git
|
||||
BUILD_DEPENDS= ${LOCALBASE}/bin/ar:devel/binutils \
|
||||
gperf:devel/gperf \
|
||||
yasm:devel/yasm \
|
||||
${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri \
|
||||
${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \
|
||||
node16>0:www/node16 \
|
||||
npm-node16>0:www/npm-node16
|
||||
LIB_DEPENDS= libatk-bridge-2.0.so:accessibility/at-spi2-atk \
|
||||
libatspi.so:accessibility/at-spi2-core \
|
||||
libsnappy.so:archivers/snappy \
|
||||
libFLAC.so:audio/flac \
|
||||
libopus.so:audio/opus \
|
||||
libdbus-1.so:devel/dbus \
|
||||
libnotify.so:devel/libnotify \
|
||||
libpci.so:devel/libpci \
|
||||
libnspr4.so:devel/nspr \
|
||||
libre2.so:devel/re2 \
|
||||
libdrm.so:graphics/libdrm \
|
||||
libpng.so:graphics/png \
|
||||
libwebp.so:graphics/webp \
|
||||
libva.so:multimedia/libva \
|
||||
libopenh264.so:multimedia/openh264 \
|
||||
libfreetype.so:print/freetype2 \
|
||||
libharfbuzz.so:print/harfbuzz \
|
||||
libsecret-1.so:security/libsecret \
|
||||
libnss3.so:security/nss \
|
||||
libexpat.so:textproc/expat2 \
|
||||
libxkbcommon.so:x11/libxkbcommon \
|
||||
libxshmfence.so:x11/libxshmfence \
|
||||
libfontconfig.so:x11-fonts/fontconfig
|
||||
RUN_DEPENDS= xdg-open:devel/xdg-utils
|
||||
TEST_DEPENDS= git:devel/git \
|
||||
${PYTHON_PKGNAMEPREFIX}python-dbusmock>0:devel/py-python-dbusmock@${PY_FLAVOR} \
|
||||
npm-node16>0:www/npm-node16
|
||||
|
||||
USES= bison cpe dos2unix gettext-tools gl gnome iconv jpeg \
|
||||
localbase:ldflags ninja pkgconfig python:build,test shebangfix \
|
||||
tar:xz xorg
|
||||
CPE_VENDOR= electronjs
|
||||
DOS2UNIX_FILES= third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
|
||||
USE_GITHUB= yes
|
||||
GH_TAGNAME= ${DISTVERSIONPREFIX}${ELECTRON_VER}
|
||||
GH_TUPLE= nodejs:node:v${NODE_VER}:node \
|
||||
nodejs:nan:${NAN_VER}:nan \
|
||||
Squirrel:Squirrel.Mac:${SQUIRREL_MAC_VER}:squirrel_mac \
|
||||
ReactiveCocoa:ReactiveObjC:${REACTIVEOBJC_VER}:reactiveobjc \
|
||||
Mantle:Mantle:${MANTLE_VER}:mantle
|
||||
USE_GL= gbm gl glesv2
|
||||
USE_GNOME= atk cairo gdkpixbuf2 gtk30 libxml2 libxslt pango
|
||||
USE_LDCONFIG= ${DATADIR}
|
||||
USE_XORG= x11 xcb xcomposite xcursor xdamage xext xfixes xi xrandr \
|
||||
xrender xscrnsaver xtst
|
||||
|
||||
SHEBANG_FILES= buildtools/linux64/clang-format
|
||||
|
||||
MAKE_ARGS= -C out/${BUILDTYPE}
|
||||
MAKE_ENV+= C_INCLUDE_PATH=${LOCALBASE}/include \
|
||||
CPLUS_INCLUDE_PATH=${LOCALBASE}/include
|
||||
ALL_TARGET= electron third_party/electron_node:headers
|
||||
POST_BUILD_TARGETS= licenses version
|
||||
POST_BUILD_DIST_TARGETS= electron_dist_zip electron_chromedriver_zip \
|
||||
electron_mksnapshot_zip
|
||||
|
||||
DATADIR= ${PREFIX}/share/${PORTNAME}${PKGNAMESUFFIX}
|
||||
BINARY_ALIAS= python3=${PYTHON_CMD}
|
||||
|
||||
NO_WRKSUBDIR= yes
|
||||
WRKSRC_SUBDIR= src
|
||||
|
||||
PLIST_SUB= ELECTRON_VER=${ELECTRON_VER} \
|
||||
ELECTRON_VER_MAJOR=${ELECTRON_VER_MAJOR}
|
||||
|
||||
OPTIONS_DEFINE= CUPS DEBUG DIST DRIVER KERBEROS LTO
|
||||
OPTIONS_DEFAULT= CUPS DRIVER KERBEROS ALSA
|
||||
OPTIONS_GROUP= AUDIO
|
||||
OPTIONS_GROUP_AUDIO= ALSA PULSEAUDIO SNDIO
|
||||
OPTIONS_SUB= yes
|
||||
|
||||
DIST_DESC= Build distribution zip files
|
||||
DRIVER_DESC= Install chromedriver
|
||||
|
||||
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib
|
||||
ALSA_RUN_DEPENDS= ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins
|
||||
ALSA_VARS= GN_ARGS+=use_alsa=true
|
||||
ALSA_VARS_OFF= GN_ARGS+=use_alsa=false
|
||||
CUPS_LIB_DEPENDS= libcups.so:print/cups
|
||||
CUPS_VARS= GN_ARGS+=use_cups=true
|
||||
CUPS_VARS_OFF= GN_ARGS+=use_cups=false
|
||||
DEBUG_VARS= BUILDTYPE=Debug \
|
||||
GN_FILE=testing.gn \
|
||||
GN_ARGS+=is_debug=true \
|
||||
GN_BOOTSTRAP_FLAGS+=--debug
|
||||
DEBUG_VARS_OFF= BUILDTYPE=Release \
|
||||
GN_FILE=release.gn \
|
||||
GN_ARGS+=blink_symbol_level=0 \
|
||||
GN_ARGS+=is_debug=false \
|
||||
GN_ARGS+=symbol_level=0
|
||||
DIST_IMPLIES= DRIVER
|
||||
DRIVER_ALL_TARGET= chromedriver
|
||||
KERBEROS_VARS= GN_ARGS+=use_kerberos=true
|
||||
KERBEROS_VARS_OFF= GN_ARGS+=use_kerberos=false
|
||||
LTO_VARS= GN_ARGS+=use_thin_lto=true \
|
||||
GN_ARGS+=thin_lto_enable_optimizations=true
|
||||
LTO_VARS_OFF= GN_ARGS+=use_thin_lto=false
|
||||
PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio
|
||||
PULSEAUDIO_VARS= GN_ARGS+=use_pulseaudio=true
|
||||
PULSEAUDIO_VARS_OFF= GN_ARGS+=use_pulseaudio=false
|
||||
# With SNDIO=on we exclude audio_manager_linux from the build (see
|
||||
# media/audio/BUILD.gn) and use audio_manager_openbsd which does not
|
||||
# support falling back to ALSA or PulseAudio.
|
||||
SNDIO_PREVENTS= ALSA PULSEAUDIO
|
||||
SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio
|
||||
SNDIO_VARS= GN_ARGS+=use_sndio=true
|
||||
SNDIO_VARS_OFF= GN_ARGS+=use_sndio=false
|
||||
|
||||
# See ${WRKSRC}/electron/DEPS for CHROMIUM_VER
|
||||
CHROMIUM_VER= 98.0.4758.141
|
||||
# See ${WRKSRC}/third_party/node/node_modules.tar.gz.sha1 for CHROMIUM_NODE_MODULES_HASH
|
||||
CHROMIUM_NODE_MODULES_HASH= 31d731fb82ea62a6dae24d2bdfe6f0aa6164b949
|
||||
# See ${WRKSRC}/third_party/test_fonts/test_fonts.tar.gz.sha1 for CHROMIUM_TEST_FONTS_HASH
|
||||
CHROMIUM_TEST_FONTS_HASH= cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb
|
||||
# See ${WRKSRC}/electron/DEPS for NODE_VER
|
||||
NODE_VER= 16.13.0
|
||||
# See ${WRKSRC}/electron/DEPS for NAN_VER
|
||||
NAN_VER= 65b32af46e9d7fab2e4ff657751205b3865f4920
|
||||
# See ${WRKSRC}/electron/DEPS for SQUIRREL_MAC_VER
|
||||
SQUIRREL_MAC_VER= 0e5d146ba13101a1302d59ea6e6e0b3cace4ae38
|
||||
# See ${WRKSRC}/electron/DEPS for REACTIVEOBJC_VER
|
||||
REACTIVEOBJC_VER= 74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76
|
||||
# See ${WRKSRC}/electron/DEPS for MANTLE_VER
|
||||
MANTLE_VER= 78d3966b3c331292ea29ec38661b25df0a245948
|
||||
|
||||
YARN_TIMESTAMP= 1652331828
|
||||
|
||||
GN_ARGS+= clang_use_chrome_plugins=false \
|
||||
enable_hangout_services_extension=true \
|
||||
enable_js_type_check=false \
|
||||
enable_nacl=false \
|
||||
enable_one_click_signin=true \
|
||||
enable_remoting=false \
|
||||
enable_wmax_tokens=false \
|
||||
fatal_linker_warnings=false \
|
||||
is_clang=true \
|
||||
optimize_webui=false \
|
||||
toolkit_views=true \
|
||||
treat_warnings_as_errors=false \
|
||||
use_allocator="none" \
|
||||
use_allocator_shim=false \
|
||||
use_aura=true \
|
||||
use_custom_libcxx=false \
|
||||
use_gnome_keyring=false \
|
||||
use_lld=true \
|
||||
use_sysroot=false \
|
||||
use_system_freetype=false \
|
||||
use_system_harfbuzz=true \
|
||||
use_system_libjpeg=true \
|
||||
use_udev=false \
|
||||
extra_cxxflags="${CXXFLAGS}" \
|
||||
extra_ldflags="${LDFLAGS}"
|
||||
GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles
|
||||
|
||||
.include "Makefile.version"
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${ARCH} == "amd64"
|
||||
PLIST_SUB+= AMD64=""
|
||||
.else
|
||||
PLIST_SUB+= AMD64="@comment "
|
||||
.endif
|
||||
|
||||
.if ${ARCH} == "i386"
|
||||
PLIST_SUB+= I386=""
|
||||
.else
|
||||
PLIST_SUB+= I386="@comment "
|
||||
.endif
|
||||
|
||||
pre-fetch:
|
||||
@${MKDIR} ${DISTDIR}/${DIST_SUBDIR}
|
||||
if [ ! -f ${DISTDIR}/${DIST_SUBDIR}/electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX} ]; \
|
||||
then ${MKDIR} ${WRKDIR}; \
|
||||
${ECHO_CMD} 'yarn-offline-mirror "./yarn-offline-cache"' >> \
|
||||
${WRKDIR}/.yarnrc; \
|
||||
${CP} ${FILESDIR}/package.json ${FILESDIR}/yarn.lock ${WRKDIR}; \
|
||||
cd ${WRKDIR} && ${SETENV} HOME=${WRKDIR} XDG_CACHE_HOME=${WRKDIR}/.cache \
|
||||
yarn --frozen-lockfile --ignore-scripts; \
|
||||
${MTREE_CMD} -cbnSp yarn-offline-cache | ${MTREE_CMD} -C | ${SED} \
|
||||
-e 's:time=[0-9.]*:time=${YARN_TIMESTAMP}.000000000:' \
|
||||
-e 's:\([gu]id\)=[0-9]*:\1=0:g' \
|
||||
-e 's:flags=.*:flags=none:' \
|
||||
-e 's:^\.:./yarn-offline-cache:' > yarn-offline-cache.mtree; \
|
||||
${TAR} cJf ${DISTDIR}/${DIST_SUBDIR}/electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX} \
|
||||
@yarn-offline-cache.mtree; \
|
||||
${RM} -r ${WRKDIR}; \
|
||||
fi
|
||||
|
||||
post-extract:
|
||||
# Move extracted sources to appropriate locations
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/chromium-${CHROMIUM_VER} ${WRKSRC}
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${PORTNAME}-${ELECTRON_VER} ${WRKSRC}/electron
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_nan}-${NAN_VER} \
|
||||
${WRKSRC}/third_party/nan
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_node}-${NODE_VER} \
|
||||
${WRKSRC}/third_party/electron_node
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_squirrel_mac}-${SQUIRREL_MAC_VER} \
|
||||
${WRKSRC}/third_party/squirrel.mac
|
||||
${MKDIR} ${WRKSRC}/third_party/squirrel.mac/vendor
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_reactiveobjc}-${REACTIVEOBJC_VER} \
|
||||
${WRKSRC}/third_party/squirrel.mac/vendor/ReactiveObjC
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_mantle}-${MANTLE_VER} \
|
||||
${WRKSRC}/third_party/squirrel.mac/vendor/Mantle
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/node_modules ${WRKSRC}/third_party/node
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/test_fonts ${WRKSRC}/third_party/test_fonts
|
||||
# Install node modules for electron
|
||||
${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/yarn-offline-cache ${WRKDIR}
|
||||
${ECHO_CMD} 'yarn-offline-mirror "../../../yarn-offline-cache"' >> ${WRKSRC}/electron/.yarnrc
|
||||
${MV} ${WRKSRC}/electron/package.json ${WRKSRC}/electron/package.json.bak
|
||||
${CP} ${FILESDIR}/package.json ${WRKSRC}/electron
|
||||
cd ${WRKSRC}/electron && \
|
||||
${SETENV} HOME=${WRKDIR} XDG_CACHE_HOME=${WRKDIR}/.cache yarn --frozen-lockfile --offline
|
||||
|
||||
pre-patch:
|
||||
${SH} ${FILESDIR}/apply-electron-patches.sh ${WRKSRC}
|
||||
# ${FIND} ${WRKSRC} -type f -name '*.orig' -print -delete
|
||||
# ${FIND} ${WRKSRC} -type f -name '*~' -print -delete
|
||||
|
||||
pre-configure:
|
||||
# We used to remove bundled libraries to be sure that chromium uses
|
||||
# system libraries and not shipped ones.
|
||||
# cd ${WRKSRC} && ${PYTHON_CMD} \
|
||||
#./build/linux/unbundle/remove_bundled_libraries.py [list of preserved]
|
||||
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \
|
||||
./build/linux/unbundle/replace_gn_files.py --system-libraries \
|
||||
flac fontconfig freetype harfbuzz-ng libdrm libpng libusb \
|
||||
libwebp libxml libxslt openh264 opus snappy || ${FALSE}
|
||||
# Chromium uses an unreleased version of FFmpeg, so configure it
|
||||
.for brand in Chrome Chromium
|
||||
${CP} -r \
|
||||
${WRKSRC}/third_party/ffmpeg/chromium/config/${brand}/linux/ \
|
||||
${WRKSRC}/third_party/ffmpeg/chromium/config/${brand}/freebsd
|
||||
.endfor
|
||||
|
||||
do-configure:
|
||||
# GN generator bootstrapping and generating ninja files
|
||||
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} CC=${CC} CXX=${CXX} LD=${CXX} \
|
||||
READELF=${READELF} AR=${AR} NM=${NM} ${PYTHON_CMD} \
|
||||
./tools/gn/bootstrap/bootstrap.py ${GN_BOOTSTRAP_FLAGS}
|
||||
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ./out/${BUILDTYPE}/gn gen out/${BUILDTYPE} \
|
||||
--args='import("//electron/build/args/${GN_FILE}") ${GN_ARGS}'
|
||||
# Setup nodejs dependency
|
||||
${MKDIR} ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin
|
||||
${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin/node
|
||||
# Setup buildtools/freebsd
|
||||
${MKDIR} ${WRKSRC}/buildtools/freebsd
|
||||
${LN} -sf ${WRKSRC}/buildtools/linux64/clang-format ${WRKSRC}/buildtools/freebsd
|
||||
${LN} -sf ${WRKSRC}/out/${BUILDTYPE}/gn ${WRKSRC}/buildtools/freebsd
|
||||
${LN} -sf /usr/bin/strip ${WRKSRC}/buildtools/freebsd/strip
|
||||
|
||||
post-build:
|
||||
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
|
||||
${MAKE_CMD} ${MAKE_ARGS} ${POST_BUILD_TARGETS}
|
||||
|
||||
post-build-DIST-on:
|
||||
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
|
||||
${MAKE_CMD} ${MAKE_ARGS} ${POST_BUILD_DIST_TARGETS}
|
||||
cd ${WRKSRC}/out/${BUILDTYPE} && \
|
||||
${CP} chromedriver.zip chromedriver-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \
|
||||
${CP} dist.zip electron-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \
|
||||
${CP} mksnapshot.zip mksnapshot-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \
|
||||
${SHA256} -r *-v${ELECTRON_VER}-freebsd-*.zip | ${SED} -e 's/ / */' > SHASUMS256.txt
|
||||
|
||||
do-install:
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}
|
||||
.for f in electron mksnapshot v8_context_snapshot_generator
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
|
||||
.endfor
|
||||
.for f in libEGL.so libGLESv2.so libffmpeg.so libvk_swiftshader.so libvulkan.so.1
|
||||
${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
|
||||
.endfor
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}/swiftshader
|
||||
.for f in libEGL.so libGLESv2.so
|
||||
${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/swiftshader/${f} ${STAGEDIR}${DATADIR}/swiftshader
|
||||
.endfor
|
||||
.for f in LICENSE LICENSES.chromium.html icudtl.dat snapshot_blob.bin v8_context_snapshot.bin version vk_swiftshader_icd.json
|
||||
${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
|
||||
.endfor
|
||||
.for f in chrome_100_percent.pak chrome_200_percent.pak resources.pak
|
||||
${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR}
|
||||
.endfor
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}/locales
|
||||
${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/locales/*.pak ${STAGEDIR}${DATADIR}/locales
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}/resources
|
||||
.for f in default_app.asar
|
||||
${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/resources/${f} ${STAGEDIR}${DATADIR}/resources
|
||||
.endfor
|
||||
cd ${WRKSRC}/out/${BUILDTYPE}/gen && ${COPYTREE_SHARE} node_headers ${STAGEDIR}${DATADIR}
|
||||
cd ${WRKSRC}/out/${BUILDTYPE} && ${COPYTREE_SHARE} gen/electron/buildflags ${STAGEDIR}${DATADIR}
|
||||
cd ${WRKSRC}/out/${BUILDTYPE} && ${COPYTREE_SHARE} gen/v8/embedded.S ${STAGEDIR}${DATADIR}
|
||||
${RLN} ${STAGEDIR}${DATADIR}/electron ${STAGEDIR}${PREFIX}/bin/electron${PKGNAMESUFFIX}
|
||||
|
||||
post-install-DIST-on:
|
||||
${MKDIR} ${STAGEDIR}${DATADIR}/releases
|
||||
${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/SHASUMS256.txt ${STAGEDIR}${DATADIR}/releases
|
||||
${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/*-v${ELECTRON_VER}-freebsd-*.zip ${STAGEDIR}${DATADIR}/releases
|
||||
|
||||
post-install-DRIVER-on:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chromedriver.unstripped \
|
||||
${STAGEDIR}${DATADIR}/chromedriver
|
||||
|
||||
do-test:
|
||||
# Note 1: "npm install" will run before actual tests are executed
|
||||
# Note 2: Xvfb or something similar is necessary for headless testing
|
||||
cd ${WRKSRC}/electron && \
|
||||
${SETENV} ${TEST_ENV} ELECTRON_OUT_DIR=${BUILDTYPE} LOCAL_GIT_DIRECTORY=${LOCALBASE} \
|
||||
npm run test -- --ci
|
||||
|
||||
.include <bsd.port.post.mk>
|
|
@ -0,0 +1,2 @@
|
|||
ELECTRON_VER= 17.4.4
|
||||
ELECTRON_VER_MAJOR= ${ELECTRON_VER:C/\..*//}
|
|
@ -0,0 +1,21 @@
|
|||
TIMESTAMP = 1652335688
|
||||
SHA256 (electron/chromium-98.0.4758.141.tar.xz) = 0b712acb66c69b78b011c19ba07b2696ee36335e9712066ff5d74aedeb8fbb16
|
||||
SIZE (electron/chromium-98.0.4758.141.tar.xz) = 1115175012
|
||||
SHA256 (electron/31d731fb82ea62a6dae24d2bdfe6f0aa6164b949) = fc35bf178fb99ae9fca39191d7eb054a985824b8bf16f588ed6c03edfa96d4f9
|
||||
SIZE (electron/31d731fb82ea62a6dae24d2bdfe6f0aa6164b949) = 11461198
|
||||
SHA256 (electron/cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb) = ec973eccd669d417fbf2d0a4dac730744a3174268ff062db5451b55c82bc3492
|
||||
SIZE (electron/cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb) = 26759650
|
||||
SHA256 (electron/electron-yarn-cache-17.4.4.tar.xz) = 5b0e706093113582548130b1597ee9d895582fe7ab94e42a1d8a5a867dcc68b1
|
||||
SIZE (electron/electron-yarn-cache-17.4.4.tar.xz) = 36633704
|
||||
SHA256 (electron/electron-electron-v17.4.4_GH0.tar.gz) = 9ad8891cc131f3016f37c793ea2fe3158f52ba34642b1fce615547601113d114
|
||||
SIZE (electron/electron-electron-v17.4.4_GH0.tar.gz) = 10221111
|
||||
SHA256 (electron/nodejs-node-v16.13.0_GH0.tar.gz) = f0327e99f730bf2506a1f13dbd452ec80b33667a7ce1c77a2dacd6babc8643c7
|
||||
SIZE (electron/nodejs-node-v16.13.0_GH0.tar.gz) = 87424981
|
||||
SHA256 (electron/nodejs-nan-65b32af46e9d7fab2e4ff657751205b3865f4920_GH0.tar.gz) = a649b75bfa9c1a0254c73d022c6e98924b9471f593bcc83832daaf68da4cae8d
|
||||
SIZE (electron/nodejs-nan-65b32af46e9d7fab2e4ff657751205b3865f4920_GH0.tar.gz) = 178733
|
||||
SHA256 (electron/Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38_GH0.tar.gz) = f4ebb40a8d85dbb7ef02aa0571b2f8e22182c6d73b6992484a53c90047779d01
|
||||
SIZE (electron/Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38_GH0.tar.gz) = 2112918
|
||||
SHA256 (electron/ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76_GH0.tar.gz) = 88e65f116c7a06fccedb43970fba63080a57a4e5dc29147d2cdfe1ee58dd0546
|
||||
SIZE (electron/ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76_GH0.tar.gz) = 1136238
|
||||
SHA256 (electron/Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948_GH0.tar.gz) = a365df6d83e0be3cc000b70bd39734d80c28f0d9983ebe44698337a2ca464bb1
|
||||
SIZE (electron/Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948_GH0.tar.gz) = 62962
|
|
@ -0,0 +1,26 @@
|
|||
#! /bin/sh
|
||||
|
||||
PATH=/bin:/usr/bin:/usr/local/bin
|
||||
|
||||
GIT_CMD="git"
|
||||
PATCH_CMD="${GIT_CMD} apply"
|
||||
#PATCH_FLAGS="--numstat --check" # for debugging
|
||||
PATCH_FLAGS="--verbose --reject"
|
||||
|
||||
WRKSRC=$1
|
||||
PATCH_CONF=${WRKSRC}/electron/patches/config.json
|
||||
|
||||
${GIT_CMD} status "${WRKSRC}" > /dev/null 2>&1 && IS_GIT_REPO=1
|
||||
|
||||
PATCHD_REPOD_PAIRS=$(sed -e '1d; $d; /^$/d; s/[",]//g; s/: */:/' "${PATCH_CONF}")
|
||||
for prp in ${PATCHD_REPOD_PAIRS}; do
|
||||
pd=$(echo "${prp}" | awk -F: '{print $1}' | sed -e 's/src/./')
|
||||
rd=$(echo "${prp}" | awk -F: '{print $2}' | sed -e 's/src/./')
|
||||
(cd "${WRKSRC}/${rd}" && \
|
||||
if [ -n "${IS_GIT_REPO}" ]; then
|
||||
PATCH_FLAGS="${PATCH_FLAGS} --directory=$(${GIT_CMD} rev-parse --show-prefix)"
|
||||
fi && \
|
||||
while read -r p; do
|
||||
${PATCH_CMD} ${PATCH_FLAGS} "${WRKSRC}/${pd}/${p}"
|
||||
done < "${WRKSRC}/${pd}/.patches")
|
||||
done
|
|
@ -0,0 +1,144 @@
|
|||
{
|
||||
"name": "electron",
|
||||
"version": "17.4.4",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
"@azure/storage-blob": "^12.9.0",
|
||||
"@electron/docs-parser": "^0.12.3",
|
||||
"@electron/typescript-definitions": "^8.9.5",
|
||||
"@octokit/auth-app": "^2.10.0",
|
||||
"@octokit/rest": "^18.0.3",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
"@types/basic-auth": "^1.1.3",
|
||||
"@types/busboy": "^0.2.3",
|
||||
"@types/chai": "^4.2.12",
|
||||
"@types/chai-as-promised": "^7.1.3",
|
||||
"@types/dirty-chai": "^2.0.2",
|
||||
"@types/express": "^4.17.7",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/klaw": "^3.0.1",
|
||||
"@types/minimist": "^1.2.0",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^14.6.2",
|
||||
"@types/semver": "^7.3.3",
|
||||
"@types/send": "^0.14.5",
|
||||
"@types/split": "^1.0.0",
|
||||
"@types/stream-json": "^1.5.1",
|
||||
"@types/temp": "^0.8.34",
|
||||
"@types/uuid": "^3.4.6",
|
||||
"@types/webpack": "^4.41.21",
|
||||
"@types/webpack-env": "^1.15.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.4.1",
|
||||
"@typescript-eslint/parser": "^4.4.1",
|
||||
"asar": "^3.1.0",
|
||||
"aws-sdk": "^2.727.1",
|
||||
"check-for-leaks": "^1.2.1",
|
||||
"colors": "1.4.0",
|
||||
"dotenv-safe": "^4.0.4",
|
||||
"dugite": "^1.103.0",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-mocha": "^7.0.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"eslint-plugin-typescript": "^0.14.0",
|
||||
"express": "^4.16.4",
|
||||
"folder-hash": "^2.1.1",
|
||||
"fs-extra": "^9.0.1",
|
||||
"got": "^6.3.0",
|
||||
"husky": "^6.0.0",
|
||||
"klaw": "^3.0.0",
|
||||
"lint": "^1.1.2",
|
||||
"lint-staged": "^10.2.11",
|
||||
"markdownlint": "^0.21.1",
|
||||
"markdownlint-cli": "^0.25.0",
|
||||
"minimist": "^1.2.5",
|
||||
"null-loader": "^4.0.0",
|
||||
"pre-flight": "^1.1.0",
|
||||
"remark-cli": "^10.0.0",
|
||||
"remark-preset-lint-markdown-style-guide": "^4.0.0",
|
||||
"semver": "^5.6.0",
|
||||
"shx": "^0.3.2",
|
||||
"standard-markdown": "^6.0.0",
|
||||
"stream-json": "^1.7.1",
|
||||
"tap-xunit": "^2.4.1",
|
||||
"temp": "^0.8.3",
|
||||
"timers-browserify": "1.4.2",
|
||||
"ts-loader": "^8.0.2",
|
||||
"ts-node": "6.2.0",
|
||||
"typescript": "^4.1.3",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"wrapper-webpack-plugin": "^2.1.0"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asar": "asar",
|
||||
"generate-version-json": "node script/generate-version-json.js",
|
||||
"lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
|
||||
"lint:js": "node ./script/lint.js --js",
|
||||
"lint:clang-format": "python3 script/run-clang-format.py -r -c shell/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
|
||||
"lint:clang-tidy": "ts-node ./script/run-clang-tidy.ts",
|
||||
"lint:cpp": "node ./script/lint.js --cc",
|
||||
"lint:objc": "node ./script/lint.js --objc",
|
||||
"lint:py": "node ./script/lint.js --py",
|
||||
"lint:gn": "node ./script/lint.js --gn",
|
||||
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links && npm run lint:markdownlint",
|
||||
"lint:docs-relative-links": "python3 ./script/check-relative-doc-links.py",
|
||||
"lint:markdownlint": "markdownlint \"*.md\" \"docs/**/*.md\"",
|
||||
"lint:js-in-markdown": "standard-markdown docs",
|
||||
"create-api-json": "electron-docs-parser --dir=./",
|
||||
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --api=electron-api.json && node spec/ts-smoke/runner.js",
|
||||
"gn-typescript-definitions": "npm run create-typescript-definitions && shx cp electron.d.ts",
|
||||
"pre-flight": "pre-flight",
|
||||
"gn-check": "node ./script/gn-check.js",
|
||||
"precommit": "lint-staged",
|
||||
"preinstall": "node -e 'process.exit(0)'",
|
||||
"prepack": "check-for-leaks",
|
||||
"repl": "node ./script/start.js --interactive",
|
||||
"start": "node ./script/start.js",
|
||||
"test": "node ./script/spec-runner.js",
|
||||
"tsc": "tsc",
|
||||
"webpack": "webpack"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Electron Community",
|
||||
"keywords": [
|
||||
"electron"
|
||||
],
|
||||
"lint-staged": {
|
||||
"*.{js,ts}": [
|
||||
"node script/lint.js --js --fix --only --"
|
||||
],
|
||||
"*.{js,ts,d.ts}": [
|
||||
"ts-node script/gen-filenames.ts"
|
||||
],
|
||||
"*.{cc,mm,c,h}": [
|
||||
"python3 script/run-clang-format.py -r -c --fix"
|
||||
],
|
||||
"*.md": [
|
||||
"npm run lint:docs"
|
||||
],
|
||||
"*.{gn,gni}": [
|
||||
"npm run gn-check",
|
||||
"python3 script/run-gn-format.py"
|
||||
],
|
||||
"*.py": [
|
||||
"node script/lint.js --py --fix --only --"
|
||||
],
|
||||
"docs/api/**/*.md": [
|
||||
"ts-node script/gen-filenames.ts",
|
||||
"markdownlint --config .markdownlint.autofix.json --fix",
|
||||
"git add filenames.auto.gni"
|
||||
],
|
||||
"{*.patch,.patches}": [
|
||||
"node script/lint.js --patches --only --",
|
||||
"ts-node script/check-patch-diff.ts"
|
||||
],
|
||||
"DEPS": [
|
||||
"node script/gen-hunspell-filenames.js"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
--- BUILD.gn.orig 2022-05-11 07:16:44 UTC
|
||||
+++ BUILD.gn
|
||||
@@ -52,7 +52,7 @@ declare_args() {
|
||||
root_extra_deps = []
|
||||
}
|
||||
|
||||
-if (is_official_build) {
|
||||
+if (is_official_build && !is_bsd) {
|
||||
# An official (maximally optimized!) component (optimized for build times)
|
||||
# build doesn't make sense and usually doesn't work.
|
||||
assert(!is_component_build)
|
||||
@@ -454,7 +454,7 @@ group("gn_all") {
|
||||
]
|
||||
}
|
||||
|
||||
- if (is_linux || is_chromeos || is_android) {
|
||||
+ if ((is_linux && !is_bsd) || is_chromeos || is_android) {
|
||||
deps += [
|
||||
"//third_party/breakpad:breakpad_unittests",
|
||||
"//third_party/breakpad:core-2-minidump",
|
||||
@@ -638,6 +638,15 @@ group("gn_all") {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (is_bsd) {
|
||||
+ deps -= [
|
||||
+ "//third_party/breakpad:dump_syms($host_toolchain)",
|
||||
+ "//third_party/breakpad:microdump_stackwalk($host_toolchain)",
|
||||
+ "//third_party/breakpad:minidump_dump($host_toolchain)",
|
||||
+ "//third_party/breakpad:minidump_stackwalk($host_toolchain)",
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
if (is_mac) {
|
||||
deps += [
|
||||
"//third_party/breakpad:crash_inspector",
|
||||
@@ -688,7 +697,7 @@ group("gn_all") {
|
||||
host_os == "win") {
|
||||
deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
|
||||
}
|
||||
- } 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)" ]
|
||||
}
|
||||
|
||||
@@ -1139,7 +1148,7 @@ if (!is_ios) {
|
||||
data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
|
||||
}
|
||||
|
||||
- if (!is_win && !is_android) {
|
||||
+ if (!is_win && !is_android && !is_bsd) {
|
||||
data_deps +=
|
||||
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||
}
|
||||
@@ -1148,7 +1157,7 @@ if (!is_ios) {
|
||||
data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
|
||||
}
|
||||
|
||||
- if (is_linux || is_chromeos) {
|
||||
+ if ((is_linux && !is_bsd) || is_chromeos) {
|
||||
data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
|
||||
}
|
||||
|
||||
@@ -1525,7 +1534,7 @@ group("chromium_builder_perf") {
|
||||
|
||||
if (is_win) {
|
||||
data_deps += [ "//chrome/installer/mini_installer:mini_installer" ]
|
||||
- } else {
|
||||
+ } else if (!is_bsd) {
|
||||
data_deps +=
|
||||
[ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- apps/ui/views/app_window_frame_view.cc.orig 2022-05-11 07:16:44 UTC
|
||||
+++ apps/ui/views/app_window_frame_view.cc
|
||||
@@ -137,7 +137,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient
|
||||
gfx::Rect window_bounds = client_bounds;
|
||||
// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
|
||||
// complete.
|
||||
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
+#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD)
|
||||
// Get the difference between the widget's client area bounds and window
|
||||
// bounds, and grow |window_bounds| by that amount.
|
||||
gfx::Insets native_frame_insets =
|
|
@ -0,0 +1,14 @@
|
|||
--- ash/display/mirror_window_controller.cc.orig 2022-05-11 07:16:45 UTC
|
||||
+++ ash/display/mirror_window_controller.cc
|
||||
@@ -297,7 +297,11 @@ void MirrorWindowController::UpdateWindow(
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
--- base/BUILD.gn.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/BUILD.gn
|
||||
@@ -975,7 +975,7 @@ component("base") {
|
||||
"timer/hi_res_timer_manager_posix.cc",
|
||||
]
|
||||
|
||||
- if (!is_nacl && !is_apple) {
|
||||
+ if (!is_nacl && !is_apple && !is_bsd) {
|
||||
sources += [
|
||||
"cpu_affinity_posix.cc",
|
||||
"cpu_affinity_posix.h",
|
||||
@@ -986,6 +986,12 @@ component("base") {
|
||||
"profiler/thread_delegate_posix.h",
|
||||
]
|
||||
}
|
||||
+
|
||||
+ if (is_bsd) {
|
||||
+ sources += [
|
||||
+ "profiler/stack_sampler_posix.cc",
|
||||
+ ]
|
||||
+ }
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
@@ -1416,11 +1422,24 @@ component("base") {
|
||||
# building inside the cros_sdk environment - use host_toolchain as a
|
||||
# more robust check for this.
|
||||
if (!use_sysroot &&
|
||||
- (is_android || ((is_linux || is_chromeos) && !is_chromecast)) &&
|
||||
+ (is_android || ((is_linux || is_chromeos) && !is_chromecast && !is_bsd)) &&
|
||||
host_toolchain != "//build/toolchain/cros:host") {
|
||||
libs += [ "atomic" ]
|
||||
}
|
||||
|
||||
+ # *BSD needs libkvm
|
||||
+ if (is_bsd) {
|
||||
+ libs += [ "kvm" ]
|
||||
+ }
|
||||
+
|
||||
+ if (is_freebsd) {
|
||||
+ libs += [
|
||||
+ "iconv",
|
||||
+ "execinfo",
|
||||
+ "util",
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
if (use_allocator_shim) {
|
||||
sources += [
|
||||
"allocator/allocator_shim.cc",
|
||||
@@ -1443,7 +1462,7 @@ component("base") {
|
||||
"allocator/early_zone_registration_mac.h",
|
||||
]
|
||||
}
|
||||
- if (is_chromeos || is_linux) {
|
||||
+ if (is_chromeos || (is_linux && !is_bsd)) {
|
||||
sources += [
|
||||
"allocator/allocator_shim_override_cpp_symbols.h",
|
||||
"allocator/allocator_shim_override_glibc_weak_symbols.h",
|
||||
@@ -2176,6 +2195,42 @@ component("base") {
|
||||
"linux_util.h",
|
||||
]
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ if (is_bsd) {
|
||||
+ sources -= [
|
||||
+ "files/file_path_watcher_linux.cc",
|
||||
+ "files/file_util_linux.cc",
|
||||
+ "files/scoped_file_linux.cc",
|
||||
+ "process/memory_linux.cc",
|
||||
+ "process/process_linux.cc",
|
||||
+ "system/sys_info_linux.cc",
|
||||
+ "process/process_iterator_linux.cc",
|
||||
+ "process/process_metrics_linux.cc",
|
||||
+ "process/process_handle_linux.cc"
|
||||
+ ]
|
||||
+ sources += [
|
||||
+ "process/memory_stubs.cc",
|
||||
+ "files/file_path_watcher_kqueue.cc",
|
||||
+ "files/file_path_watcher_kqueue.h",
|
||||
+ "files/file_path_watcher_bsd.cc",
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
+ if (is_openbsd) {
|
||||
+ sources += [
|
||||
+ "process/process_handle_openbsd.cc",
|
||||
+ "process/process_iterator_openbsd.cc",
|
||||
+ "process/process_metrics_openbsd.cc",
|
||||
+ "system/sys_info_openbsd.cc",
|
||||
+ ]
|
||||
+ } else if (is_freebsd) {
|
||||
+ sources += [
|
||||
+ "process/process_handle_freebsd.cc",
|
||||
+ "process/process_iterator_freebsd.cc",
|
||||
+ "process/process_metrics_freebsd.cc",
|
||||
+ "system/sys_info_freebsd.cc",
|
||||
+ ]
|
||||
}
|
||||
|
||||
# iOS
|
|
@ -0,0 +1,11 @@
|
|||
--- base/allocator/partition_allocator/address_space_randomization.h.orig 2021-09-14 01:51:47 UTC
|
||||
+++ base/allocator/partition_allocator/address_space_randomization.h
|
||||
@@ -36,7 +36,7 @@ AslrMask(uintptr_t bits) {
|
||||
|
||||
#if defined(ARCH_CPU_64_BITS)
|
||||
|
||||
- #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
|
||||
+ #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) && !defined(OS_BSD)
|
||||
|
||||
// We shouldn't allocate system pages at all for sanitizer builds. However,
|
||||
// we do, and if random hint addresses interfere with address ranges
|
|
@ -0,0 +1,11 @@
|
|||
--- base/allocator/partition_allocator/page_allocator.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/page_allocator.h
|
||||
@@ -170,7 +170,7 @@ BASE_EXPORT void DecommitAndZeroSystemPages(void* addr
|
||||
// Whether decommitted memory is guaranteed to be zeroed when it is
|
||||
// recommitted. Do not assume that this will not change over time.
|
||||
constexpr BASE_EXPORT bool DecommittedMemoryIsAlwaysZeroed() {
|
||||
-#if defined(OS_APPLE)
|
||||
+#if defined(OS_APPLE) || defined(OS_BSD)
|
||||
return false;
|
||||
#else
|
||||
return true;
|
|
@ -0,0 +1,16 @@
|
|||
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/page_allocator_internals_posix.h
|
||||
@@ -339,8 +339,12 @@ bool TryRecommitSystemPagesInternal(
|
||||
}
|
||||
|
||||
void DiscardSystemPagesInternal(void* address, size_t length) {
|
||||
-#if defined(OS_APPLE)
|
||||
+#if defined(OS_APPLE) || defined(OS_BSD)
|
||||
+#if defined(OS_BSD)
|
||||
+ int ret = madvise(address, length, MADV_FREE);
|
||||
+#else
|
||||
int ret = madvise(address, length, MADV_FREE_REUSABLE);
|
||||
+#endif
|
||||
if (ret) {
|
||||
// MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED.
|
||||
ret = madvise(address, length, MADV_DONTNEED);
|
|
@ -0,0 +1,15 @@
|
|||
--- base/allocator/partition_allocator/partition_alloc.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/partition_alloc.cc
|
||||
@@ -56,7 +56,12 @@ void PartitionAllocGlobalInit(OomFunction on_out_of_me
|
||||
"maximum direct mapped allocation");
|
||||
|
||||
// Check that some of our zanier calculations worked out as expected.
|
||||
+#if defined(__i386__) && defined(OS_FREEBSD)
|
||||
+ // alignof(std::max_align_t) is only 4 on FreeBSD/i386
|
||||
+ static_assert(kSmallestBucket >= kAlignment, "generic smallest bucket");
|
||||
+#else
|
||||
static_assert(kSmallestBucket == kAlignment, "generic smallest bucket");
|
||||
+#endif
|
||||
static_assert(kMaxBucketed == 917504, "generic max bucketed");
|
||||
STATIC_ASSERT_OR_PA_CHECK(
|
||||
MaxSystemPagesPerRegularSlotSpan() <= 16,
|
|
@ -0,0 +1,11 @@
|
|||
--- base/allocator/partition_allocator/partition_alloc_config.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/partition_alloc_config.h
|
||||
@@ -59,7 +59,7 @@ static_assert(sizeof(void*) != 8, "");
|
||||
|
||||
// POSIX is not only UNIX, e.g. macOS and other OSes. We do use Linux-specific
|
||||
// features such as futex(2).
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
#define PA_HAS_LINUX_KERNEL
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- base/allocator/partition_allocator/partition_alloc_constants.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/partition_alloc_constants.h
|
||||
@@ -371,7 +371,7 @@ constexpr size_t kBitsPerSizeT = sizeof(void*) * CHAR_
|
||||
// PartitionPurgeDecommitEmptySlotSpans flag will eagerly decommit all entries
|
||||
// in the ring buffer, so with periodic purge enabled, this typically happens
|
||||
// every few seconds.
|
||||
-#if defined(OS_LINUX) || defined(OS_APPLE)
|
||||
+#if defined(OS_LINUX) || defined(OS_APPLE) || defined(OS_BSD)
|
||||
// Set to a higher value on Linux and macOS, to assess impact on performance
|
||||
// bots. This roughly halves the number of syscalls done during a speedometer
|
||||
// 2.0 run on these platforms.
|
|
@ -0,0 +1,12 @@
|
|||
--- base/allocator/partition_allocator/partition_page.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/partition_page.h
|
||||
@@ -141,7 +141,8 @@ struct __attribute__((packed)) SlotSpanMetadata {
|
||||
// in PartitionPage, which has other fields as well, and must fit in 32 bytes.
|
||||
|
||||
// CHECK()ed in AllocNewSlotSpan().
|
||||
-#if defined(PA_HAS_64_BITS_POINTERS) && defined(OS_APPLE)
|
||||
+#if (defined(PA_HAS_64_BITS_POINTERS) && defined(OS_APPLE)) || \
|
||||
+ (defined(OS_FREEBSD) && defined(__i386__))
|
||||
// System page size is not a constant on Apple OSes, but is either 4 or 16kiB
|
||||
// (1 << 12 or 1 << 14), as checked in PartitionRoot::Init(). And
|
||||
// PartitionPageSize() is 4 times the OS page size.
|
|
@ -0,0 +1,11 @@
|
|||
--- base/allocator/partition_allocator/partition_root.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/partition_root.h
|
||||
@@ -1044,7 +1044,7 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::FreeNoH
|
||||
// essentially).
|
||||
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && \
|
||||
((defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMECAST)) || \
|
||||
- (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)))
|
||||
+ ((defined(OS_LINUX) || defined(OS_BSD)) && defined(ARCH_CPU_64_BITS)))
|
||||
PA_CHECK(IsManagedByPartitionAlloc(reinterpret_cast<uintptr_t>(ptr)));
|
||||
#endif
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
--- base/allocator/partition_allocator/spinning_mutex.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/spinning_mutex.cc
|
||||
@@ -17,7 +17,15 @@
|
||||
|
||||
#if defined(PA_HAS_LINUX_KERNEL)
|
||||
#include <errno.h>
|
||||
+#if defined(OS_OPENBSD)
|
||||
+#include <sys/futex.h>
|
||||
+#elif defined(OS_FREEBSD)
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/thr.h>
|
||||
+#include <sys/umtx.h>
|
||||
+#else
|
||||
#include <linux/futex.h>
|
||||
+#endif
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#endif // defined(PA_HAS_LINUX_KERNEL)
|
||||
@@ -86,8 +94,13 @@ void SpinningMutex::FutexWait() {
|
||||
// |kLockedContended| anymore. Note that even without spurious wakeups, the
|
||||
// value of |state_| is not guaranteed when this returns, as another thread
|
||||
// may get the lock before we get to run.
|
||||
+#if defined(OS_FREEBSD)
|
||||
+ int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE,
|
||||
+ kLockedContended, nullptr, nullptr);
|
||||
+#else
|
||||
int err = syscall(SYS_futex, &state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
|
||||
kLockedContended, nullptr, nullptr, 0);
|
||||
+#endif
|
||||
|
||||
if (err) {
|
||||
// These are programming error, check them.
|
||||
@@ -99,8 +112,14 @@ void SpinningMutex::FutexWait() {
|
||||
|
||||
void SpinningMutex::FutexWake() {
|
||||
int saved_errno = errno;
|
||||
+#if defined(OS_FREEBSD)
|
||||
+ long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE,
|
||||
+ 1 /* wake up a single waiter */, nullptr, nullptr);
|
||||
+#else
|
||||
long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
|
||||
1 /* wake up a single waiter */, nullptr, nullptr, 0);
|
||||
+#endif
|
||||
+
|
||||
PA_CHECK(retval != -1);
|
||||
errno = saved_errno;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
--- base/allocator/partition_allocator/starscan/stack/stack.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/starscan/stack/stack.cc
|
||||
@@ -17,6 +17,10 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+#include <pthread_np.h>
|
||||
+#endif
|
||||
+
|
||||
#if defined(LIBC_GLIBC)
|
||||
extern "C" void* __libc_stack_end;
|
||||
#endif
|
||||
@@ -48,6 +52,36 @@ void* GetStackTop() {
|
||||
|
||||
void* GetStackTop() {
|
||||
return pthread_get_stackaddr_np(pthread_self());
|
||||
+}
|
||||
+
|
||||
+#elif defined(OS_OPENBSD)
|
||||
+
|
||||
+void* GetStackTop() {
|
||||
+ stack_t ss;
|
||||
+ if (pthread_stackseg_np(pthread_self(), &ss) != 0)
|
||||
+ return nullptr;
|
||||
+ return reinterpret_cast<uint8_t*>(ss.ss_sp);
|
||||
+}
|
||||
+
|
||||
+#elif defined(OS_FREEBSD)
|
||||
+
|
||||
+void* GetStackTop() {
|
||||
+ pthread_attr_t attr;
|
||||
+ int error = pthread_attr_init(&attr);
|
||||
+ if (error) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ error = pthread_attr_get_np(pthread_self(), &attr);
|
||||
+ if (!error) {
|
||||
+ void* base;
|
||||
+ size_t size;
|
||||
+ error = pthread_attr_getstack(&attr, &base, &size);
|
||||
+ PA_CHECK(!error);
|
||||
+ pthread_attr_destroy(&attr);
|
||||
+ return reinterpret_cast<uint8_t*>(base) + size;
|
||||
+ }
|
||||
+ pthread_attr_destroy(&attr);
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
|
@ -0,0 +1,20 @@
|
|||
--- base/allocator/partition_allocator/starscan/state_bitmap.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/allocator/partition_allocator/starscan/state_bitmap.h
|
||||
@@ -393,7 +393,7 @@ template <size_t PageSize, size_t PageAlignment, size_
|
||||
template <typename Filter,
|
||||
typename CallbackForwarder,
|
||||
typename Callback,
|
||||
- bool Clear>
|
||||
+ bool ClearBits>
|
||||
inline void
|
||||
StateBitmap<PageSize, PageAlignment, AllocationAlignment>::IterateImpl(
|
||||
size_t epoch,
|
||||
@@ -423,7 +423,7 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignme
|
||||
|
||||
callback_forwarder(callback, object_address, bits);
|
||||
|
||||
- if (Clear) {
|
||||
+ if (ClearBits) {
|
||||
// Clear the current bits.
|
||||
AsAtomicCell(cell_index)
|
||||
.fetch_and(clear_value_mask, std::memory_order_relaxed);
|
|
@ -0,0 +1,14 @@
|
|||
--- base/atomicops.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/atomicops.h
|
||||
@@ -57,7 +57,11 @@ typedef intptr_t Atomic64;
|
||||
|
||||
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
|
||||
// Atomic64 routines below, depending on your architecture.
|
||||
+#if !defined(OS_OPENBSD) && defined(__i386__)
|
||||
+typedef Atomic32 AtomicWord;
|
||||
+#else
|
||||
typedef intptr_t AtomicWord;
|
||||
+#endif
|
||||
|
||||
// Atomically execute:
|
||||
// result = *ptr;
|
|
@ -0,0 +1,98 @@
|
|||
--- base/base_paths_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/base_paths_posix.cc
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
+#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
@@ -25,9 +26,13 @@
|
||||
#include "base/process/process_metrics.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if defined(OS_FREEBSD)
|
||||
+#if defined(OS_BSD)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
+#if defined(OS_OPENBSD)
|
||||
+#include <kvm.h>
|
||||
+#define MAXTOKENS 2
|
||||
+#endif
|
||||
#elif defined(OS_SOLARIS) || defined(OS_AIX)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
@@ -68,13 +73,65 @@ bool PathProviderPosix(int key, FilePath* result) {
|
||||
*result = FilePath(bin_dir);
|
||||
return true;
|
||||
#elif defined(OS_OPENBSD) || defined(OS_AIX)
|
||||
- // There is currently no way to get the executable path on OpenBSD
|
||||
- char* cpath;
|
||||
- if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
|
||||
- *result = FilePath(cpath);
|
||||
- else
|
||||
- *result = FilePath("/usr/local/chrome/chrome");
|
||||
- return true;
|
||||
+ char *cpath;
|
||||
+#if !defined(OS_AIX)
|
||||
+ struct kinfo_file *files;
|
||||
+ kvm_t *kd = NULL;
|
||||
+ char errbuf[_POSIX2_LINE_MAX];
|
||||
+ static char retval[PATH_MAX];
|
||||
+ int cnt;
|
||||
+ struct stat sb;
|
||||
+ pid_t cpid = getpid();
|
||||
+ bool ret = false;
|
||||
+
|
||||
+ const base::CommandLine* command_line =
|
||||
+ base::CommandLine::ForCurrentProcess();
|
||||
+
|
||||
+ VLOG(1) << "PathProviderPosix argv: " << command_line->argv()[0];
|
||||
+
|
||||
+ if (realpath(command_line->argv()[0].c_str(), retval) == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (stat(command_line->argv()[0].c_str(), &sb) < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (!command_line->HasSwitch("no-sandbox")) {
|
||||
+ ret = true;
|
||||
+ *result = FilePath(retval);
|
||||
+ VLOG(1) << "PathProviderPosix (sandbox) result: " << retval;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid,
|
||||
+ sizeof(struct kinfo_file), &cnt)) == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ for (int i = 0; i < cnt; i++) {
|
||||
+ if (files[i].fd_fd == KERN_FILE_TEXT &&
|
||||
+ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) &&
|
||||
+ files[i].va_fileid == sb.st_ino) {
|
||||
+ ret = true;
|
||||
+ *result = FilePath(retval);
|
||||
+ VLOG(1) << "PathProviderPosix result: " << retval;
|
||||
+ }
|
||||
+ }
|
||||
+out:
|
||||
+ if (kd)
|
||||
+ kvm_close(kd);
|
||||
+ if (!ret) {
|
||||
+#endif
|
||||
+ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
|
||||
+ *result = FilePath(cpath);
|
||||
+ else
|
||||
+ *result = FilePath("/usr/local/chrome/chrome");
|
||||
+ return true;
|
||||
+#if !defined(OS_AIX)
|
||||
+ }
|
||||
+ return ret;
|
||||
+#endif
|
||||
#endif
|
||||
}
|
||||
case DIR_SRC_TEST_DATA_ROOT: {
|
|
@ -0,0 +1,11 @@
|
|||
--- base/base_switches.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/base_switches.cc
|
||||
@@ -170,7 +170,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria
|
||||
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
// Controls whether or not retired instruction counts are surfaced for threads
|
||||
// in trace events on Linux.
|
||||
//
|
|
@ -0,0 +1,11 @@
|
|||
--- base/base_switches.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/base_switches.h
|
||||
@@ -60,7 +60,7 @@ extern const char kEnableIdleTracing[];
|
||||
extern const char kForceFieldTrialParams[];
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
extern const char kEnableThreadInstructionCount[];
|
||||
|
||||
// TODO(crbug.com/1176772): Remove kEnableCrashpad and IsCrashpadEnabled() when
|
|
@ -0,0 +1,11 @@
|
|||
--- base/compiler_specific.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/compiler_specific.h
|
||||
@@ -366,7 +366,7 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
|
||||
#endif // defined(__clang_analyzer__)
|
||||
|
||||
// Use nomerge attribute to disable optimization of merging multiple same calls.
|
||||
-#if defined(__clang__) && __has_attribute(nomerge)
|
||||
+#if defined(__clang__) && __has_attribute(nomerge) && !defined(OS_FREEBSD)
|
||||
#define NOMERGE [[clang::nomerge]]
|
||||
#else
|
||||
#define NOMERGE
|
|
@ -0,0 +1,11 @@
|
|||
--- base/cpu.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/cpu.h
|
||||
@@ -104,7 +104,7 @@ class BASE_EXPORT CPU final {
|
||||
const std::string& cpu_brand() const { return cpu_brand_; }
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
enum class CoreType {
|
||||
kUnknown = 0,
|
||||
kOther,
|
|
@ -0,0 +1,68 @@
|
|||
--- base/debug/debugger_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/debug/debugger_posix.cc
|
||||
@@ -36,6 +36,10 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
+#if defined(OS_OPENBSD)
|
||||
+#include <sys/proc.h>
|
||||
+#endif
|
||||
+
|
||||
#if defined(OS_FREEBSD)
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
@@ -95,32 +99,51 @@ bool BeingDebugged() {
|
||||
|
||||
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
|
||||
// binary interfaces may change.
|
||||
+#if defined(OS_OPENBSD)
|
||||
+ struct kinfo_proc *info;
|
||||
+ size_t info_size;
|
||||
+#else
|
||||
struct kinfo_proc info;
|
||||
size_t info_size = sizeof(info);
|
||||
+#endif
|
||||
|
||||
#if defined(OS_OPENBSD)
|
||||
if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0)
|
||||
return -1;
|
||||
|
||||
mib[5] = (info_size / sizeof(struct kinfo_proc));
|
||||
+ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) {
|
||||
+ is_set = true;
|
||||
+ being_debugged = false;
|
||||
+ return being_debugged;
|
||||
+ }
|
||||
+
|
||||
+ int sysctl_result = sysctl(mib, base::size(mib), info, &info_size, NULL, 0);
|
||||
#endif
|
||||
|
||||
+#if !defined(OS_OPENBSD)
|
||||
int sysctl_result = sysctl(mib, base::size(mib), &info, &info_size, NULL, 0);
|
||||
+#endif
|
||||
DCHECK_EQ(sysctl_result, 0);
|
||||
if (sysctl_result != 0) {
|
||||
is_set = true;
|
||||
being_debugged = false;
|
||||
- return being_debugged;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
// This process is being debugged if the P_TRACED flag is set.
|
||||
is_set = true;
|
||||
#if defined(OS_FREEBSD)
|
||||
being_debugged = (info.ki_flag & P_TRACED) != 0;
|
||||
-#elif defined(OS_BSD)
|
||||
- being_debugged = (info.p_flag & P_TRACED) != 0;
|
||||
+#elif defined(OS_OPENBSD)
|
||||
+ being_debugged = (info->p_psflags & PS_TRACED) != 0;
|
||||
#else
|
||||
being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
|
||||
+#endif
|
||||
+
|
||||
+out:
|
||||
+#if defined(OS_OPENBSD)
|
||||
+ free(info);
|
||||
#endif
|
||||
return being_debugged;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
--- base/debug/elf_reader.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/debug/elf_reader.cc
|
||||
@@ -76,6 +76,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base,
|
||||
bool found = false;
|
||||
while (current_section < section_end) {
|
||||
current_note = reinterpret_cast<const Nhdr*>(current_section);
|
||||
+#if !defined(OS_BSD)
|
||||
if (current_note->n_type == NT_GNU_BUILD_ID) {
|
||||
StringPiece note_name(current_section + sizeof(Nhdr),
|
||||
current_note->n_namesz);
|
||||
@@ -85,6 +86,7 @@ size_t ReadElfBuildId(const void* elf_mapped_base,
|
||||
break;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
size_t section_size = bits::AlignUp(current_note->n_namesz, 4) +
|
||||
bits::AlignUp(current_note->n_descsz, 4) +
|
|
@ -0,0 +1,11 @@
|
|||
--- base/debug/proc_maps_linux.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ 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_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
--- base/debug/stack_trace_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/debug/stack_trace_posix.cc
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
#include "base/debug/proc_maps_linux.h"
|
||||
#endif
|
||||
|
||||
@@ -693,6 +693,9 @@ class SandboxSymbolizeHelper {
|
||||
// for the modules that are loaded in the current process.
|
||||
// Returns true on success.
|
||||
bool CacheMemoryRegions() {
|
||||
+#if defined(OS_BSD)
|
||||
+ return false;
|
||||
+#else
|
||||
// Reads /proc/self/maps.
|
||||
std::string contents;
|
||||
if (!ReadProcMaps(&contents)) {
|
||||
@@ -710,6 +713,7 @@ class SandboxSymbolizeHelper {
|
||||
|
||||
is_initialized_ = true;
|
||||
return true;
|
||||
+#endif
|
||||
}
|
||||
|
||||
// Opens all object files and caches their file descriptors.
|
||||
@@ -866,7 +870,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
|
||||
// If we do not have unwind tables, then try tracing using frame pointers.
|
||||
return base::debug::TraceStackFramePointers(const_cast<const void**>(trace),
|
||||
count, 0);
|
||||
-#elif !defined(__UCLIBC__) && !defined(_AIX)
|
||||
+#elif !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_BSD)
|
||||
// Though the backtrace API man page does not list any possible negative
|
||||
// return values, we take no chance.
|
||||
return base::saturated_cast<size_t>(backtrace(trace, count));
|
|
@ -0,0 +1,57 @@
|
|||
--- base/files/file_path_watcher_bsd.cc.orig 2022-05-13 07:20:04 UTC
|
||||
+++ base/files/file_path_watcher_bsd.cc
|
||||
@@ -0,0 +1,54 @@
|
||||
+// Copyright 2021 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include <memory>
|
||||
+
|
||||
+#include "base/files/file_path_watcher.h"
|
||||
+#include "base/files/file_path_watcher_kqueue.h"
|
||||
+#include "base/memory/ptr_util.h"
|
||||
+#include "build/build_config.h"
|
||||
+
|
||||
+namespace base {
|
||||
+
|
||||
+namespace {
|
||||
+
|
||||
+class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
|
||||
+ public:
|
||||
+ FilePathWatcherImpl() = default;
|
||||
+ FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
|
||||
+ FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
|
||||
+ ~FilePathWatcherImpl() override = default;
|
||||
+
|
||||
+ bool Watch(const FilePath& path,
|
||||
+ Type type,
|
||||
+ const FilePathWatcher::Callback& callback) override {
|
||||
+ DCHECK(!impl_.get());
|
||||
+ if (type == Type::kRecursive) {
|
||||
+ if (!FilePathWatcher::RecursiveWatchAvailable())
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ impl_ = std::make_unique<FilePathWatcherKQueue>();
|
||||
+ }
|
||||
+ DCHECK(impl_.get());
|
||||
+ return impl_->Watch(path, type, callback);
|
||||
+ }
|
||||
+
|
||||
+ void Cancel() override {
|
||||
+ if (impl_.get())
|
||||
+ impl_->Cancel();
|
||||
+ set_cancelled();
|
||||
+ }
|
||||
+
|
||||
+ private:
|
||||
+ std::unique_ptr<PlatformDelegate> impl_;
|
||||
+};
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
+FilePathWatcher::FilePathWatcher() {
|
||||
+ sequence_checker_.DetachFromSequence();
|
||||
+ impl_ = std::make_unique<FilePathWatcherImpl>();
|
||||
+}
|
||||
+
|
||||
+} // namespace base
|
|
@ -0,0 +1,10 @@
|
|||
--- base/files/file_path_watcher_kqueue.h.orig 2022-05-11 07:00:27 UTC
|
||||
+++ base/files/file_path_watcher_kqueue.h
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
|
||||
#define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
|
||||
|
||||
+#include <sys/time.h>
|
||||
#include <sys/event.h>
|
||||
|
||||
#include <memory>
|
|
@ -0,0 +1,52 @@
|
|||
--- base/files/file_util_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/files/file_util_posix.cc
|
||||
@@ -694,32 +694,34 @@ bool CreateDirectoryAndGetError(const FilePath& full_p
|
||||
File::Error* error) {
|
||||
ScopedBlockingCall scoped_blocking_call(
|
||||
FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir().
|
||||
+ const FilePath kFileSystemRoot("/");
|
||||
std::vector<FilePath> subpaths;
|
||||
|
||||
// Collect a list of all parent directories.
|
||||
FilePath last_path = full_path;
|
||||
- subpaths.push_back(full_path);
|
||||
+ if (full_path != kFileSystemRoot)
|
||||
+ subpaths.push_back(full_path);
|
||||
for (FilePath path = full_path.DirName();
|
||||
- path.value() != last_path.value(); path = path.DirName()) {
|
||||
+ (path.value() != last_path.value() &&
|
||||
+ (path != kFileSystemRoot)); path = path.DirName()) {
|
||||
subpaths.push_back(path);
|
||||
last_path = path;
|
||||
}
|
||||
|
||||
// Iterate through the parents and create the missing ones.
|
||||
for (auto i = subpaths.rbegin(); i != subpaths.rend(); ++i) {
|
||||
- if (DirectoryExists(*i))
|
||||
- continue;
|
||||
- if (mkdir(i->value().c_str(), 0700) == 0)
|
||||
- continue;
|
||||
- // Mkdir failed, but it might have failed with EEXIST, or some other error
|
||||
- // due to the directory appearing out of thin air. This can occur if
|
||||
- // two processes are trying to create the same file system tree at the same
|
||||
- // time. Check to see if it exists and make sure it is a directory.
|
||||
- int saved_errno = errno;
|
||||
- if (!DirectoryExists(*i)) {
|
||||
- if (error)
|
||||
- *error = File::OSErrorToFileError(saved_errno);
|
||||
- return false;
|
||||
+ if (!PathExists(*i)) {
|
||||
+ if ((mkdir(i->value().c_str(), 0700) == -1) &&
|
||||
+ ((full_path != *i) ? (errno != ENOENT) : (-1))) {
|
||||
+ int saved_errno = errno;
|
||||
+ if (error)
|
||||
+ *error = File::OSErrorToFileError(saved_errno);
|
||||
+ return false;
|
||||
+ }
|
||||
+ } else if (!DirectoryExists(*i)) {
|
||||
+ if (error)
|
||||
+ *error = File::OSErrorToFileError(ENOTDIR);
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
return true;
|
|
@ -0,0 +1,12 @@
|
|||
--- base/files/important_file_writer_cleaner.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/files/important_file_writer_cleaner.cc
|
||||
@@ -24,7 +24,8 @@ namespace base {
|
||||
namespace {
|
||||
|
||||
base::Time GetUpperBoundTime() {
|
||||
-#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_FUCHSIA)
|
||||
+// needed because of .CreationTime() pledge
|
||||
+#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_FUCHSIA) || defined(OS_BSD)
|
||||
// If process creation time is not available then use instance creation
|
||||
// time as the upper-bound for old files. Modification times may be
|
||||
// rounded-down to coarse-grained increments, e.g. FAT has 2s granularity,
|
|
@ -0,0 +1,11 @@
|
|||
--- base/files/scoped_file.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ 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_CHROMEOS) || defined(OS_APPLE) || \
|
||||
- defined(OS_FUCHSIA) || defined(OS_ANDROID)
|
||||
+ defined(OS_FUCHSIA) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// NB: Some file descriptors can return errors from close() e.g. network
|
||||
// filesystems such as NFS and Linux input devices. On Linux, macOS, and
|
||||
// Fuchsia's POSIX layer, errors from close other than EBADF do not indicate
|
|
@ -0,0 +1,21 @@
|
|||
--- base/i18n/icu_util.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/i18n/icu_util.cc
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "third_party/icu/source/common/unicode/unistr.h"
|
||||
#endif
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_FUCHSIA) || \
|
||||
+#if defined(OS_ANDROID) || defined(OS_FUCHSIA) || defined(OS_BSD) || \
|
||||
((defined(OS_LINUX) || defined(OS_CHROMEOS)) && !BUILDFLAG(IS_CHROMECAST))
|
||||
#include "third_party/icu/source/i18n/unicode/timezone.h"
|
||||
#endif
|
||||
@@ -343,7 +343,8 @@ void InitializeIcuTimeZone() {
|
||||
FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
|
||||
icu::TimeZone::adoptDefault(
|
||||
icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
|
||||
-#elif (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !BUILDFLAG(IS_CHROMECAST)
|
||||
+#elif (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)) && \
|
||||
+ !BUILDFLAG(IS_CHROMECAST)
|
||||
// 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().
|
|
@ -0,0 +1,28 @@
|
|||
--- base/linux_util.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/linux_util.cc
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <iomanip>
|
||||
#include <memory>
|
||||
+#include <sstream>
|
||||
|
||||
#include "base/files/dir_reader_posix.h"
|
||||
#include "base/files/file_util.h"
|
||||
@@ -134,6 +135,9 @@ void SetLinuxDistro(const std::string& distro) {
|
||||
}
|
||||
|
||||
bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
|
||||
+#if defined(OS_BSD)
|
||||
+ return false;
|
||||
+#else
|
||||
// 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22
|
||||
char buf[25];
|
||||
strings::SafeSPrintf(buf, "/proc/%d/task", pid);
|
||||
@@ -153,6 +157,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t
|
||||
}
|
||||
|
||||
return true;
|
||||
+#endif
|
||||
}
|
||||
|
||||
pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,
|
|
@ -0,0 +1,38 @@
|
|||
--- base/memory/discardable_memory.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/memory/discardable_memory.cc
|
||||
@@ -24,7 +24,7 @@ const base::Feature kMadvFreeDiscardableMemory{
|
||||
"MadvFreeDiscardableMemory", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
const base::Feature kDiscardableMemoryBackingTrial{
|
||||
"DiscardableMemoryBackingTrial", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
@@ -48,7 +48,7 @@ const base::FeatureParam<DiscardableMemoryTrialGroup>
|
||||
|
||||
namespace {
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
|
||||
DiscardableMemoryBacking GetBackingForFieldTrial() {
|
||||
DiscardableMemoryTrialGroup trial_group =
|
||||
@@ -66,7 +66,7 @@ DiscardableMemoryBacking GetBackingForFieldTrial() {
|
||||
|
||||
} // namespace
|
||||
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
|
||||
// Probe capabilities of this device to determine whether we should participate
|
||||
// in the discardable memory backing trial.
|
||||
@@ -95,7 +95,7 @@ DiscardableMemory::DiscardableMemory() = default;
|
||||
DiscardableMemory::~DiscardableMemory() = default;
|
||||
|
||||
DiscardableMemoryBacking GetDiscardableMemoryBacking() {
|
||||
-#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
if (DiscardableMemoryBackingFieldTrialIsEnabled()) {
|
||||
return GetBackingForFieldTrial();
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- base/memory/discardable_memory_internal.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ 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) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
|
||||
namespace base {
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
--- base/memory/madv_free_discardable_memory_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/memory/madv_free_discardable_memory_posix.cc
|
||||
@@ -292,6 +292,10 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT
|
||||
|
||||
bool MadvFreeDiscardableMemoryPosix::IsResident() const {
|
||||
DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_);
|
||||
+// XXX mincore
|
||||
+#if defined(OS_BSD)
|
||||
+ return false;
|
||||
+#else
|
||||
#if defined(OS_APPLE)
|
||||
std::vector<char> vec(allocated_pages_);
|
||||
#else
|
||||
@@ -307,6 +311,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() cons
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
+#endif
|
||||
}
|
||||
|
||||
bool MadvFreeDiscardableMemoryPosix::IsDiscarded() const {
|
|
@ -0,0 +1,29 @@
|
|||
--- base/memory/platform_shared_memory_region.h.orig 2021-11-19 04:25:04 UTC
|
||||
+++ base/memory/platform_shared_memory_region.h
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "base/files/scoped_file.h"
|
||||
#endif
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
namespace content {
|
||||
class SandboxIPCHandler;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
|
||||
kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE
|
||||
};
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
// Structure to limit access to executable region creation.
|
||||
struct ExecutableRegion {
|
||||
private:
|
||||
@@ -264,7 +264,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
|
||||
CheckPlatformHandlePermissionsCorrespondToMode);
|
||||
static PlatformSharedMemoryRegion Create(Mode mode,
|
||||
size_t size
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
,
|
||||
bool executable = false
|
||||
#endif
|
|
@ -0,0 +1,29 @@
|
|||
--- base/memory/platform_shared_memory_region_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ 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) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
// static
|
||||
ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) {
|
||||
PlatformSharedMemoryRegion region =
|
||||
@@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o
|
||||
// static
|
||||
PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
|
||||
size_t size
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
,
|
||||
bool executable
|
||||
#endif
|
||||
@@ -233,7 +233,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
|
||||
// flag.
|
||||
FilePath directory;
|
||||
if (!GetShmemTempDir(
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
executable,
|
||||
#else
|
||||
false /* executable */,
|
|
@ -0,0 +1,28 @@
|
|||
--- base/message_loop/message_pump_glib.cc.orig 2021-09-14 01:51:47 UTC
|
||||
+++ base/message_loop/message_pump_glib.cc
|
||||
@@ -8,6 +8,11 @@
|
||||
#include <glib.h>
|
||||
#include <math.h>
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+#include <pthread.h>
|
||||
+#include <pthread_np.h>
|
||||
+#endif
|
||||
+
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
@@ -49,9 +54,13 @@ int GetTimeIntervalMilliseconds(TimeTicks next_task_ti
|
||||
}
|
||||
|
||||
bool RunningOnMainThread() {
|
||||
+#if defined(OS_BSD)
|
||||
+ return pthread_main_np();
|
||||
+#else
|
||||
auto pid = getpid();
|
||||
auto tid = PlatformThread::CurrentId();
|
||||
return pid > 0 && tid > 0 && pid == tid;
|
||||
+#endif
|
||||
}
|
||||
|
||||
// A brief refresher on GLib:
|
|
@ -0,0 +1,11 @@
|
|||
--- base/native_library_posix.cc.orig 2021-07-15 19:13:29 UTC
|
||||
+++ base/native_library_posix.cc
|
||||
@@ -31,7 +31,7 @@ NativeLibrary LoadNativeLibraryWithOptions(const FileP
|
||||
// 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.
|
|
@ -0,0 +1,16 @@
|
|||
--- base/posix/can_lower_nice_to.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/posix/can_lower_nice_to.cc
|
||||
@@ -11,8 +11,12 @@
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
+#if defined(OS_FREEBSD)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
+
|
||||
// Not defined on AIX by default.
|
||||
-#if defined(OS_AIX)
|
||||
+#if defined(OS_AIX) || defined(OS_BSD)
|
||||
#if defined(RLIMIT_NICE)
|
||||
#error Assumption about OS_AIX is incorrect
|
||||
#endif
|
|
@ -0,0 +1,39 @@
|
|||
--- base/posix/unix_domain_socket.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/posix/unix_domain_socket.cc
|
||||
@@ -50,7 +50,7 @@ bool CreateSocketPair(ScopedFD* one, ScopedFD* two) {
|
||||
|
||||
// static
|
||||
bool UnixDomainSocket::EnableReceiveProcessId(int fd) {
|
||||
-#if !defined(OS_APPLE)
|
||||
+#if !defined(OS_APPLE) && !defined(OS_BSD)
|
||||
const int enable = 1;
|
||||
return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
|
||||
#else
|
||||
@@ -140,7 +140,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
|
||||
|
||||
const size_t kControlBufferSize =
|
||||
CMSG_SPACE(sizeof(int) * kMaxFileDescriptors)
|
||||
-#if !defined(OS_APPLE)
|
||||
+#if !defined(OS_APPLE) && !defined(OS_BSD)
|
||||
// macOS does not support ucred.
|
||||
// macOS supports xucred, but this structure is insufficient.
|
||||
+ CMSG_SPACE(sizeof(struct ucred))
|
||||
@@ -168,7 +168,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
|
||||
wire_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
|
||||
wire_fds_len = payload_len / sizeof(int);
|
||||
}
|
||||
-#if !defined(OS_APPLE)
|
||||
+#if !defined(OS_APPLE) && !defined(OS_BSD)
|
||||
// macOS does not support SCM_CREDENTIALS.
|
||||
if (cmsg->cmsg_level == SOL_SOCKET &&
|
||||
cmsg->cmsg_type == SCM_CREDENTIALS) {
|
||||
@@ -202,6 +202,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
|
||||
socklen_t pid_size = sizeof(pid);
|
||||
if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size) != 0)
|
||||
pid = -1;
|
||||
+#elif defined(OS_BSD)
|
||||
+ NOTIMPLEMENTED();
|
||||
+ pid = -1;
|
||||
#else
|
||||
// |pid| will legitimately be -1 if we read EOF, so only DCHECK if we
|
||||
// actually received a message. Unfortunately, Linux allows sending zero
|
|
@ -0,0 +1,11 @@
|
|||
--- base/process/kill.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/kill.h
|
||||
@@ -112,7 +112,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(Pro
|
||||
BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
|
||||
ProcessHandle handle, int* exit_code);
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || 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,11 @@
|
|||
--- base/process/kill_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/kill_posix.cc
|
||||
@@ -159,7 +159,7 @@ void EnsureProcessTerminated(Process process) {
|
||||
0, new BackgroundReaper(std::move(process), Seconds(2)));
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
void EnsureProcessGetsReaped(Process process) {
|
||||
DCHECK(!process.is_current());
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- base/process/launch.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/launch.h
|
||||
@@ -192,7 +192,7 @@ struct BASE_EXPORT LaunchOptions {
|
||||
bool clear_environment = false;
|
||||
#endif // OS_WIN || OS_POSIX || OS_FUCHSIA
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || 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
|
|
@ -0,0 +1,12 @@
|
|||
--- base/process/launch_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/launch_posix.cc
|
||||
@@ -64,6 +64,9 @@
|
||||
#error "macOS should use launch_mac.cc"
|
||||
#endif
|
||||
|
||||
+#if defined(OS_FREEBSD)
|
||||
+#pragma weak environ
|
||||
+#endif
|
||||
extern char** environ;
|
||||
|
||||
namespace base {
|
|
@ -0,0 +1,20 @@
|
|||
--- base/process/memory.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/memory.cc
|
||||
@@ -63,14 +63,16 @@ NOINLINE void OnNoMemoryInternal(size_t size) {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
+#if !defined(OS_BSD)
|
||||
void TerminateBecauseOutOfMemory(size_t size) {
|
||||
internal::OnNoMemoryInternal(size);
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Defined in memory_mac.mm for macOS + use_allocator="none". In case of
|
||||
// USE_PARTITION_ALLOC_AS_MALLOC, no need to route the call to the system
|
||||
// default calloc of macOS.
|
||||
-#if !defined(OS_APPLE) || BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
|
||||
+#if (!defined(OS_APPLE) && !defined(OS_BSD)) || BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
|
||||
|
||||
bool UncheckedCalloc(size_t num_items, size_t size, void** result) {
|
||||
const size_t alloc_size = num_items * size;
|
|
@ -0,0 +1,11 @@
|
|||
--- base/process/process_handle.cc.orig 2021-01-07 00:36:18 UTC
|
||||
+++ base/process/process_handle.cc
|
||||
@@ -30,7 +30,7 @@ UniqueProcId GetUniqueIdForProcess() {
|
||||
: UniqueProcId(GetCurrentProcId());
|
||||
}
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
|
||||
|
||||
void InitUniqueIdForProcessInPidNamespace(ProcessId pid_outside_of_namespace) {
|
||||
DCHECK(pid_outside_of_namespace != kNullProcessId);
|
|
@ -0,0 +1,11 @@
|
|||
--- base/process/process_handle.h.orig 2021-09-14 01:51:47 UTC
|
||||
+++ base/process/process_handle.h
|
||||
@@ -106,7 +106,7 @@ BASE_EXPORT ProcessId GetCurrentProcId();
|
||||
// processes may be reused.
|
||||
BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || 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.
|
|
@ -0,0 +1,23 @@
|
|||
--- base/process/process_handle_freebsd.cc.orig 2021-09-14 01:51:47 UTC
|
||||
+++ base/process/process_handle_freebsd.cc
|
||||
@@ -12,15 +12,19 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/cxx17_backports.h"
|
||||
+#include "base/files/file_path.h"
|
||||
|
||||
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, base::size(mib), &info, &length, NULL, 0) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (length < sizeof(struct kinfo_proc))
|
||||
return -1;
|
||||
|
||||
return info.ki_ppid;
|
|
@ -0,0 +1,89 @@
|
|||
--- base/process/process_handle_openbsd.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_handle_openbsd.cc
|
||||
@@ -3,8 +3,11 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/process/process_handle.h"
|
||||
+#include "base/files/file_util.h"
|
||||
|
||||
#include <stddef.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
@@ -14,39 +17,59 @@
|
||||
namespace base {
|
||||
|
||||
ProcessId GetParentProcessId(ProcessHandle process) {
|
||||
- struct kinfo_proc info;
|
||||
+ struct kinfo_proc *info;
|
||||
size_t length;
|
||||
+ pid_t ppid;
|
||||
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
|
||||
sizeof(struct kinfo_proc), 0 };
|
||||
|
||||
if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0)
|
||||
return -1;
|
||||
|
||||
+ info = (struct kinfo_proc *)malloc(length);
|
||||
+
|
||||
mib[5] = (length / sizeof(struct kinfo_proc));
|
||||
|
||||
- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0)
|
||||
- return -1;
|
||||
+ if (sysctl(mib, base::size(mib), info, &length, NULL, 0) < 0) {
|
||||
+ ppid = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
- return info.p_ppid;
|
||||
+ ppid = info->p_ppid;
|
||||
+
|
||||
+out:
|
||||
+ free(info);
|
||||
+ return ppid;
|
||||
}
|
||||
|
||||
FilePath GetProcessExecutablePath(ProcessHandle process) {
|
||||
- struct kinfo_proc kp;
|
||||
- size_t len;
|
||||
+ struct kinfo_proc *info;
|
||||
+ size_t length;
|
||||
+ char *path = NULL;
|
||||
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
|
||||
sizeof(struct kinfo_proc), 0 };
|
||||
|
||||
- if (sysctl(mib, base::size(mib), NULL, &len, NULL, 0) == -1)
|
||||
+ if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) == -1)
|
||||
return FilePath();
|
||||
- mib[5] = (len / sizeof(struct kinfo_proc));
|
||||
- if (sysctl(mib, base::size(mib), &kp, &len, NULL, 0) < 0)
|
||||
- return FilePath();
|
||||
- if ((kp.p_flag & P_SYSTEM) != 0)
|
||||
- return FilePath();
|
||||
- if (strcmp(kp.p_comm, "chrome") == 0)
|
||||
- return FilePath(kp.p_comm);
|
||||
|
||||
- return FilePath();
|
||||
+ info = (struct kinfo_proc *)malloc(length);
|
||||
+
|
||||
+ mib[5] = (length / sizeof(struct kinfo_proc));
|
||||
+
|
||||
+ if (sysctl(mib, base::size(mib), info, &length, NULL, 0) < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ if ((info->p_flag & P_SYSTEM) != 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (strcmp(info->p_comm, "chrome") == 0) {
|
||||
+ path = info->p_comm;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ free(info);
|
||||
+ return FilePath(path);
|
||||
}
|
||||
|
||||
} // namespace base
|
|
@ -0,0 +1,51 @@
|
|||
--- base/process/process_iterator_freebsd.cc.orig 2021-09-14 01:51:47 UTC
|
||||
+++ base/process/process_iterator_freebsd.cc
|
||||
@@ -21,7 +21,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
|
||||
: index_of_kinfo_proc_(),
|
||||
filter_(filter) {
|
||||
|
||||
- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid() };
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, (int) getuid() };
|
||||
|
||||
bool done = false;
|
||||
int try_num = 1;
|
||||
@@ -40,7 +40,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
|
||||
num_of_kinfo_proc += 16;
|
||||
kinfo_procs_.resize(num_of_kinfo_proc);
|
||||
len = num_of_kinfo_proc * sizeof(struct kinfo_proc);
|
||||
- if (sysctl(mib, base::size(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) {
|
||||
+ if (sysctl(mib, base::size(mib), kinfo_procs_.data(), &len, NULL, 0) < 0) {
|
||||
// If we get a mem error, it just means we need a bigger buffer, so
|
||||
// loop around again. Anything else is a real error and give up.
|
||||
if (errno != ENOMEM) {
|
||||
@@ -50,7 +50,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
|
||||
}
|
||||
} else {
|
||||
// Got the list, just make sure we're sized exactly right
|
||||
- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
+ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
kinfo_procs_.resize(num_of_kinfo_proc);
|
||||
done = true;
|
||||
}
|
||||
@@ -72,18 +72,13 @@ bool ProcessIterator::CheckForNextProcess() {
|
||||
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, base::size(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, base::size(mib), &data[0], &length, NULL, 0) < 0) {
|
||||
LOG(ERROR) << "failed to fetch a commandline";
|
|
@ -0,0 +1,45 @@
|
|||
--- base/process/process_iterator_openbsd.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_iterator_openbsd.cc
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "base/cxx17_backports.h"
|
||||
@@ -19,12 +22,13 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
|
||||
: index_of_kinfo_proc_(),
|
||||
filter_(filter) {
|
||||
|
||||
- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid(),
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, static_cast<int>(getuid()),
|
||||
sizeof(struct kinfo_proc), 0 };
|
||||
|
||||
bool done = false;
|
||||
int try_num = 1;
|
||||
const int max_tries = 10;
|
||||
+ size_t num_of_kinfo_proc;
|
||||
|
||||
do {
|
||||
size_t len = 0;
|
||||
@@ -33,7 +37,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
|
||||
kinfo_procs_.resize(0);
|
||||
done = true;
|
||||
} else {
|
||||
- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
+ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
// Leave some spare room for process table growth (more could show up
|
||||
// between when we check and now)
|
||||
num_of_kinfo_proc += 16;
|
||||
@@ -49,7 +53,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter*
|
||||
}
|
||||
} else {
|
||||
// Got the list, just make sure we're sized exactly right
|
||||
- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
+ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
|
||||
kinfo_procs_.resize(num_of_kinfo_proc);
|
||||
done = true;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
--- base/process/process_metrics.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_metrics.cc
|
||||
@@ -18,7 +18,7 @@ namespace base {
|
||||
namespace {
|
||||
|
||||
#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
int CalculateEventsPerSecond(uint64_t event_count,
|
||||
uint64_t* last_event_count,
|
||||
base::TimeTicks* last_calculated) {
|
||||
@@ -55,7 +55,7 @@ SystemMetrics SystemMetrics::Sample() {
|
||||
SystemMetrics system_metrics;
|
||||
|
||||
system_metrics.committed_memory_ = GetSystemCommitCharge();
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
GetSystemMemoryInfo(&system_metrics.memory_info_);
|
||||
GetVmStatInfo(&system_metrics.vmstat_info_);
|
||||
GetSystemDiskInfo(&system_metrics.disk_info_);
|
||||
@@ -74,7 +74,7 @@ Value SystemMetrics::ToValue() const {
|
||||
Value res(Value::Type::DICTIONARY);
|
||||
|
||||
res.SetIntKey("committed_memory", static_cast<int>(committed_memory_));
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
Value meminfo = memory_info_.ToValue();
|
||||
Value vmstat = vmstat_info_.ToValue();
|
||||
meminfo.MergeDictionary(&vmstat);
|
||||
@@ -126,7 +126,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage(
|
||||
#endif
|
||||
|
||||
#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
int ProcessMetrics::CalculateIdleWakeupsPerSecond(
|
||||
uint64_t absolute_idle_wakeups) {
|
||||
return CalculateEventsPerSecond(absolute_idle_wakeups,
|
|
@ -0,0 +1,119 @@
|
|||
--- base/process/process_metrics.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_metrics.h
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -53,7 +53,7 @@ class Value;
|
||||
// Full declaration is in process_metrics_iocounters.h.
|
||||
struct IoCounters;
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || 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.
|
||||
//
|
||||
@@ -107,7 +107,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
// convenience wrapper for CreateProcessMetrics().
|
||||
static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics();
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || 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;
|
||||
@@ -134,7 +134,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
TimeDelta GetCumulativeCPUUsage() WARN_UNUSED_RESULT;
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
// Emits the cumulative CPU usage for all currently active threads since they
|
||||
// were started into the output parameter (replacing its current contents).
|
||||
// Threads that have already terminated will not be reported. Thus, the sum of
|
||||
@@ -217,7 +217,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
int GetOpenFdSoftLimit() const;
|
||||
#endif // defined(OS_POSIX)
|
||||
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
// Bytes of swap as reported by /proc/[pid]/status.
|
||||
uint64_t GetVmSwapBytes() const;
|
||||
|
||||
@@ -237,7 +237,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
#endif // !defined(OS_MAC)
|
||||
|
||||
#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups);
|
||||
#endif
|
||||
#if defined(OS_APPLE)
|
||||
@@ -248,7 +248,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
CPU::CoreType GetCoreType(int core_index);
|
||||
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ||
|
||||
// defined(OS_AIX)
|
||||
@@ -273,7 +273,7 @@ class BASE_EXPORT ProcessMetrics {
|
||||
uint64_t last_cumulative_disk_usage_ = 0;
|
||||
|
||||
#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
// Same thing for idle wakeups.
|
||||
TimeTicks last_idle_wakeups_time_;
|
||||
uint64_t last_absolute_idle_wakeups_;
|
||||
@@ -316,7 +316,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_de
|
||||
|
||||
#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \
|
||||
defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_AIX) || \
|
||||
- defined(OS_FUCHSIA)
|
||||
+ defined(OS_FUCHSIA) || defined(OS_BSD)
|
||||
// Data about system-wide memory consumption. Values are in KB. Available on
|
||||
// Windows, Mac, Linux, Android and Chrome OS.
|
||||
//
|
||||
@@ -351,7 +351,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
// This provides an estimate of available memory as described here:
|
||||
// https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
|
||||
// NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always
|
||||
@@ -366,7 +366,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
|
||||
#endif
|
||||
|
||||
#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
|
||||
- defined(OS_AIX) || defined(OS_FUCHSIA)
|
||||
+ defined(OS_AIX) || defined(OS_FUCHSIA) || defined(OS_BSD)
|
||||
int buffers = 0;
|
||||
int cached = 0;
|
||||
int active_anon = 0;
|
||||
@@ -403,7 +403,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoK
|
||||
// defined(OS_FUCHSIA)
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
// Parse the data found in /proc/<pid>/stat and return the sum of the
|
||||
// CPU-related ticks. Returns -1 on parse error.
|
||||
// Exposed for testing.
|
||||
@@ -590,7 +590,7 @@ class BASE_EXPORT SystemMetrics {
|
||||
FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
|
||||
|
||||
size_t committed_memory_;
|
||||
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
|
||||
SystemMemoryInfoKB memory_info_;
|
||||
VmStatInfo vmstat_info_;
|
||||
SystemDiskInfo disk_info_;
|
|
@ -0,0 +1,277 @@
|
|||
--- base/process/process_metrics_freebsd.cc.orig 2021-09-14 01:51:47 UTC
|
||||
+++ base/process/process_metrics_freebsd.cc
|
||||
@@ -3,21 +3,41 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/process/process_metrics.h"
|
||||
+#include "base/notreached.h"
|
||||
|
||||
#include <stddef.h>
|
||||
+#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/user.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+#include <fcntl.h> /* O_RDONLY */
|
||||
+#include <kvm.h>
|
||||
+#include <libutil.h>
|
||||
+
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/process/process_metrics_iocounters.h"
|
||||
+#include "base/values.h"
|
||||
|
||||
namespace base {
|
||||
+namespace {
|
||||
|
||||
+int GetPageShift() {
|
||||
+ int pagesize = getpagesize();
|
||||
+ int pageshift = 0;
|
||||
+
|
||||
+ while (pagesize > 1) {
|
||||
+ pageshift++;
|
||||
+ pagesize >>= 1;
|
||||
+ }
|
||||
+
|
||||
+ return pageshift;
|
||||
+}
|
||||
+}
|
||||
+
|
||||
ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||
- : process_(process),
|
||||
- last_cpu_(0) {}
|
||||
+ : process_(process) {}
|
||||
|
||||
// static
|
||||
std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
|
||||
@@ -37,7 +57,7 @@ double ProcessMetrics::GetPlatformIndependentCPUUsage(
|
||||
}
|
||||
|
||||
TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
||||
- NOTREACHED();
|
||||
+ NOTIMPLEMENTED();
|
||||
return TimeDelta();
|
||||
}
|
||||
|
||||
@@ -68,4 +88,221 @@ 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;
|
||||
+}
|
||||
+
|
||||
+bool GetSystemMemoryInfo(SystemMemoryInfoKB *meminfo) {
|
||||
+ unsigned int mem_total, mem_free, swap_total, swap_used;
|
||||
+ size_t length;
|
||||
+ int pagesizeKB;
|
||||
+
|
||||
+ pagesizeKB = getpagesize() / 1024;
|
||||
+
|
||||
+ length = sizeof(mem_total);
|
||||
+ if (sysctlbyname("vm.stats.vm.v_page_count", &mem_total,
|
||||
+ &length, NULL, 0) != 0 || length != sizeof(mem_total))
|
||||
+ return false;
|
||||
+
|
||||
+ length = sizeof(mem_free);
|
||||
+ if (sysctlbyname("vm.stats.vm.v_free_count", &mem_free, &length, NULL, 0)
|
||||
+ != 0 || length != sizeof(mem_free))
|
||||
+ return false;
|
||||
+
|
||||
+ length = sizeof(swap_total);
|
||||
+ if (sysctlbyname("vm.swap_size", &swap_total, &length, NULL, 0)
|
||||
+ != 0 || length != sizeof(swap_total))
|
||||
+ return false;
|
||||
+
|
||||
+ length = sizeof(swap_used);
|
||||
+ if (sysctlbyname("vm.swap_anon_use", &swap_used, &length, NULL, 0)
|
||||
+ != 0 || length != sizeof(swap_used))
|
||||
+ return false;
|
||||
+
|
||||
+ meminfo->total = mem_total * pagesizeKB;
|
||||
+ meminfo->free = mem_free * pagesizeKB;
|
||||
+ meminfo->swap_total = swap_total * pagesizeKB;
|
||||
+ meminfo->swap_free = (swap_total - swap_used) * pagesizeKB;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+int ProcessMetrics::GetOpenFdCount() const {
|
||||
+ struct kinfo_file * kif;
|
||||
+ int cnt;
|
||||
+
|
||||
+ if ((kif = kinfo_getfile(process_, &cnt)) == NULL)
|
||||
+ return -1;
|
||||
+
|
||||
+ free(kif);
|
||||
+
|
||||
+ return cnt;
|
||||
+}
|
||||
+
|
||||
+int ProcessMetrics::GetOpenFdSoftLimit() const {
|
||||
+ size_t length;
|
||||
+ int total_count = 0;
|
||||
+ int mib[] = { CTL_KERN, KERN_MAXFILESPERPROC };
|
||||
+
|
||||
+ length = sizeof(total_count);
|
||||
+
|
||||
+ if (sysctl(mib, base::size(mib), &total_count, &length, NULL, 0) < 0) {
|
||||
+ total_count = -1;
|
||||
+ }
|
||||
+
|
||||
+ return total_count;
|
||||
+}
|
||||
+
|
||||
+size_t ProcessMetrics::GetResidentSetSize() const {
|
||||
+ kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open");
|
||||
+
|
||||
+ if (kd == nullptr)
|
||||
+ return 0;
|
||||
+
|
||||
+ struct kinfo_proc *pp;
|
||||
+ int nproc;
|
||||
+
|
||||
+ if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) {
|
||||
+ kvm_close(kd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ size_t rss;
|
||||
+
|
||||
+ if (nproc > 0) {
|
||||
+ rss = pp->ki_rssize << GetPageShift();
|
||||
+ } else {
|
||||
+ rss = 0;
|
||||
+ }
|
||||
+
|
||||
+ kvm_close(kd);
|
||||
+ return rss;
|
||||
+}
|
||||
+
|
||||
+uint64_t ProcessMetrics::GetVmSwapBytes() const {
|
||||
+ kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open");
|
||||
+
|
||||
+ if (kd == nullptr)
|
||||
+ return 0;
|
||||
+
|
||||
+ struct kinfo_proc *pp;
|
||||
+ int nproc;
|
||||
+
|
||||
+ if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) {
|
||||
+ kvm_close(kd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ size_t swrss;
|
||||
+
|
||||
+ if (nproc > 0) {
|
||||
+ swrss = pp->ki_swrss > pp->ki_rssize
|
||||
+ ? (pp->ki_swrss - pp->ki_rssize) << GetPageShift()
|
||||
+ : 0;
|
||||
+ } else {
|
||||
+ swrss = 0;
|
||||
+ }
|
||||
+
|
||||
+ kvm_close(kd);
|
||||
+ return swrss;
|
||||
+}
|
||||
+
|
||||
+int ProcessMetrics::GetIdleWakeupsPerSecond() {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+bool GetVmStatInfo(VmStatInfo* vmstat) {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+SystemDiskInfo::SystemDiskInfo() {
|
||||
+ reads = 0;
|
||||
+ reads_merged = 0;
|
||||
+ sectors_read = 0;
|
||||
+ read_time = 0;
|
||||
+ writes = 0;
|
||||
+ writes_merged = 0;
|
||||
+ sectors_written = 0;
|
||||
+ write_time = 0;
|
||||
+ io = 0;
|
||||
+ io_time = 0;
|
||||
+ weighted_io_time = 0;
|
||||
+}
|
||||
+
|
||||
+SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default;
|
||||
+
|
||||
+SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
|
||||
+
|
||||
+Value SystemDiskInfo::ToValue() const {
|
||||
+ Value res(Value::Type::DICTIONARY);
|
||||
+
|
||||
+ // Write out uint64_t variables as doubles.
|
||||
+ // Note: this may discard some precision, but for JS there's no other option.
|
||||
+ res.SetDoubleKey("reads", static_cast<double>(reads));
|
||||
+ res.SetDoubleKey("reads_merged", static_cast<double>(reads_merged));
|
||||
+ res.SetDoubleKey("sectors_read", static_cast<double>(sectors_read));
|
||||
+ res.SetDoubleKey("read_time", static_cast<double>(read_time));
|
||||
+ res.SetDoubleKey("writes", static_cast<double>(writes));
|
||||
+ res.SetDoubleKey("writes_merged", static_cast<double>(writes_merged));
|
||||
+ res.SetDoubleKey("sectors_written", static_cast<double>(sectors_written));
|
||||
+ res.SetDoubleKey("write_time", static_cast<double>(write_time));
|
||||
+ res.SetDoubleKey("io", static_cast<double>(io));
|
||||
+ res.SetDoubleKey("io_time", static_cast<double>(io_time));
|
||||
+ res.SetDoubleKey("weighted_io_time", static_cast<double>(weighted_io_time));
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+Value SystemMemoryInfoKB::ToValue() const {
|
||||
+ Value res(Value::Type::DICTIONARY);
|
||||
+
|
||||
+ res.SetIntKey("total", total);
|
||||
+ res.SetIntKey("free", free);
|
||||
+ res.SetIntKey("available", available);
|
||||
+ res.SetIntKey("buffers", buffers);
|
||||
+ res.SetIntKey("cached", cached);
|
||||
+ res.SetIntKey("active_anon", active_anon);
|
||||
+ res.SetIntKey("inactive_anon", inactive_anon);
|
||||
+ res.SetIntKey("active_file", active_file);
|
||||
+ res.SetIntKey("inactive_file", inactive_file);
|
||||
+ res.SetIntKey("swap_total", swap_total);
|
||||
+ res.SetIntKey("swap_free", swap_free);
|
||||
+ res.SetIntKey("swap_used", swap_total - swap_free);
|
||||
+ res.SetIntKey("dirty", dirty);
|
||||
+ res.SetIntKey("reclaimable", reclaimable);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+Value VmStatInfo::ToValue() const {
|
||||
+ Value res(Value::Type::DICTIONARY);
|
||||
+
|
||||
+ res.SetIntKey("pswpin", pswpin);
|
||||
+ res.SetIntKey("pswpout", pswpout);
|
||||
+ res.SetIntKey("pgmajfault", pgmajfault);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
} // namespace base
|
|
@ -0,0 +1,213 @@
|
|||
--- base/process/process_metrics_openbsd.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_metrics_openbsd.cc
|
||||
@@ -4,14 +4,30 @@
|
||||
|
||||
#include "base/process/process_metrics.h"
|
||||
|
||||
+#include "base/files/file_util.h"
|
||||
+#include "base/logging.h"
|
||||
+#include "base/process/internal_linux.h"
|
||||
+#include "base/strings/string_number_conversions.h"
|
||||
+#include "base/strings/string_split.h"
|
||||
+#include "base/strings/string_tokenizer.h"
|
||||
+#include "base/strings/string_util.h"
|
||||
+#include "base/system/sys_info.h"
|
||||
+#include "base/threading/thread_restrictions.h"
|
||||
+#include "base/notreached.h"
|
||||
+
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
+#include <fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
+#include <sys/vmmeter.h>
|
||||
|
||||
+#include <kvm.h>
|
||||
+
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/process/process_metrics_iocounters.h"
|
||||
+#include "base/values.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
@@ -25,48 +41,13 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_coun
|
||||
return false;
|
||||
}
|
||||
|
||||
-static int GetProcessCPU(pid_t pid) {
|
||||
- struct kinfo_proc info;
|
||||
- size_t length;
|
||||
- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid,
|
||||
- sizeof(struct kinfo_proc), 0 };
|
||||
-
|
||||
- if (sysctl(mib, base::size(mib), NULL, &length, NULL, 0) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- mib[5] = (length / sizeof(struct kinfo_proc));
|
||||
-
|
||||
- if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0)
|
||||
- return 0;
|
||||
-
|
||||
- return info.p_pctcpu;
|
||||
-}
|
||||
-
|
||||
-double ProcessMetrics::GetPlatformIndependentCPUUsage() {
|
||||
- TimeTicks time = TimeTicks::Now();
|
||||
-
|
||||
- if (last_cpu_time_.is_zero()) {
|
||||
- // First call, just set the last values.
|
||||
- last_cpu_time_ = time;
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- int cpu = GetProcessCPU(process_);
|
||||
-
|
||||
- last_cpu_time_ = time;
|
||||
- double percentage = static_cast<double>((cpu * 100.0) / FSCALE);
|
||||
-
|
||||
- return percentage;
|
||||
-}
|
||||
-
|
||||
TimeDelta ProcessMetrics::GetCumulativeCPUUsage() {
|
||||
NOTREACHED();
|
||||
return TimeDelta();
|
||||
}
|
||||
|
||||
ProcessMetrics::ProcessMetrics(ProcessHandle process)
|
||||
- : process_(process),
|
||||
- last_cpu_(0) {}
|
||||
+ : process_(process) {}
|
||||
|
||||
size_t GetSystemCommitCharge() {
|
||||
int mib[] = { CTL_VM, VM_METER };
|
||||
@@ -85,6 +66,129 @@ size_t GetSystemCommitCharge() {
|
||||
pagesize = getpagesize();
|
||||
|
||||
return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
|
||||
+}
|
||||
+
|
||||
+int ProcessMetrics::GetOpenFdCount() const {
|
||||
+ struct kinfo_file *files;
|
||||
+ kvm_t *kd = NULL;
|
||||
+ int total_count = 0;
|
||||
+ char errbuf[_POSIX2_LINE_MAX];
|
||||
+
|
||||
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process_,
|
||||
+ sizeof(struct kinfo_file), &total_count)) == NULL) {
|
||||
+ total_count = 0;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ kvm_close(kd);
|
||||
+
|
||||
+out:
|
||||
+ return total_count;
|
||||
+}
|
||||
+
|
||||
+int ProcessMetrics::GetOpenFdSoftLimit() const {
|
||||
+ return GetMaxFds();
|
||||
+}
|
||||
+
|
||||
+uint64_t ProcessMetrics::GetVmSwapBytes() const {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
|
||||
+ NOTIMPLEMENTED_LOG_ONCE();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+SystemDiskInfo::SystemDiskInfo() {
|
||||
+ reads = 0;
|
||||
+ reads_merged = 0;
|
||||
+ sectors_read = 0;
|
||||
+ read_time = 0;
|
||||
+ writes = 0;
|
||||
+ writes_merged = 0;
|
||||
+ sectors_written = 0;
|
||||
+ write_time = 0;
|
||||
+ io = 0;
|
||||
+ io_time = 0;
|
||||
+ weighted_io_time = 0;
|
||||
+}
|
||||
+
|
||||
+SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default;
|
||||
+
|
||||
+bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+bool GetVmStatInfo(VmStatInfo* vmstat) {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+int ProcessMetrics::GetIdleWakeupsPerSecond() {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+Value SystemMemoryInfoKB::ToValue() const {
|
||||
+ Value res(Value::Type::DICTIONARY);
|
||||
+ res.SetIntKey("total", total);
|
||||
+ res.SetIntKey("free", free);
|
||||
+ res.SetIntKey("available", available);
|
||||
+ res.SetIntKey("buffers", buffers);
|
||||
+ res.SetIntKey("cached", cached);
|
||||
+ res.SetIntKey("active_anon", active_anon);
|
||||
+ res.SetIntKey("inactive_anon", inactive_anon);
|
||||
+ res.SetIntKey("active_file", active_file);
|
||||
+ res.SetIntKey("inactive_file", inactive_file);
|
||||
+ res.SetIntKey("swap_total", swap_total);
|
||||
+ res.SetIntKey("swap_free", swap_free);
|
||||
+ res.SetIntKey("swap_used", swap_total - swap_free);
|
||||
+ res.SetIntKey("dirty", dirty);
|
||||
+ res.SetIntKey("reclaimable", reclaimable);
|
||||
+
|
||||
+ NOTIMPLEMENTED();
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+Value VmStatInfo::ToValue() const {
|
||||
+ Value res(Value::Type::DICTIONARY);
|
||||
+ res.SetIntKey("pswpin", pswpin);
|
||||
+ res.SetIntKey("pswpout", pswpout);
|
||||
+ res.SetIntKey("pgmajfault", pgmajfault);
|
||||
+
|
||||
+ NOTIMPLEMENTED();
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
|
||||
+
|
||||
+Value SystemDiskInfo::ToValue() const {
|
||||
+ Value res(Value::Type::DICTIONARY);
|
||||
+
|
||||
+ // Write out uint64_t variables as doubles.
|
||||
+ // Note: this may discard some precision, but for JS there's no other option.
|
||||
+ res.SetDoubleKey("reads", static_cast<double>(reads));
|
||||
+ res.SetDoubleKey("reads_merged", static_cast<double>(reads_merged));
|
||||
+ res.SetDoubleKey("sectors_read", static_cast<double>(sectors_read));
|
||||
+ res.SetDoubleKey("read_time", static_cast<double>(read_time));
|
||||
+ res.SetDoubleKey("writes", static_cast<double>(writes));
|
||||
+ res.SetDoubleKey("writes_merged", static_cast<double>(writes_merged));
|
||||
+ res.SetDoubleKey("sectors_written", static_cast<double>(sectors_written));
|
||||
+ res.SetDoubleKey("write_time", static_cast<double>(write_time));
|
||||
+ res.SetDoubleKey("io", static_cast<double>(io));
|
||||
+ res.SetDoubleKey("io_time", static_cast<double>(io_time));
|
||||
+ res.SetDoubleKey("weighted_io_time", static_cast<double>(weighted_io_time));
|
||||
+
|
||||
+ NOTIMPLEMENTED();
|
||||
+
|
||||
+ return res;
|
||||
}
|
||||
|
||||
} // namespace base
|
|
@ -0,0 +1,20 @@
|
|||
--- base/process/process_metrics_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_metrics_posix.cc
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#if defined(OS_APPLE)
|
||||
#include <malloc/malloc.h>
|
||||
+#elif defined(OS_OPENBSD)
|
||||
+#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -136,7 +138,7 @@ size_t ProcessMetrics::GetMallocUsage() {
|
||||
return stats.size_in_use;
|
||||
#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
|
||||
return GetMallocUsageMallinfo();
|
||||
-#elif defined(OS_FUCHSIA)
|
||||
+#elif defined(OS_FUCHSIA) || defined(OS_BSD)
|
||||
// TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
|
||||
return 0;
|
||||
#endif
|
|
@ -0,0 +1,70 @@
|
|||
--- base/process/process_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/process/process_posix.cc
|
||||
@@ -27,6 +27,11 @@
|
||||
#include <sys/event.h>
|
||||
#endif
|
||||
|
||||
+#if defined(OS_BSD)
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#endif
|
||||
+
|
||||
#if BUILDFLAG(CLANG_PROFILING)
|
||||
#include "base/test/clang_profiling.h"
|
||||
#endif
|
||||
@@ -358,7 +363,55 @@ void Process::Exited(int exit_code) const {}
|
||||
|
||||
int Process::GetPriority() const {
|
||||
DCHECK(IsValid());
|
||||
+// avoid pledge(2) violation
|
||||
+#if defined(OS_BSD)
|
||||
+ return 0;
|
||||
+#else
|
||||
return getpriority(PRIO_PROCESS, process_);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+Time Process::CreationTime() const {
|
||||
+// avoid ps pledge in the network process
|
||||
+#if !defined(OS_BSD)
|
||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(),
|
||||
+ sizeof(struct kinfo_proc), 0 };
|
||||
+ struct kinfo_proc *info = nullptr;
|
||||
+ size_t info_size;
|
||||
+#endif
|
||||
+ Time ct = Time();
|
||||
+
|
||||
+#if !defined(OS_BSD)
|
||||
+ if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ mib[5] = (info_size / sizeof(struct kinfo_proc));
|
||||
+ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (sysctl(mib, base::size(mib), info, &info_size, NULL, 0) < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ ct = Time::FromTimeT(info->p_ustart_sec);
|
||||
+
|
||||
+out:
|
||||
+ if (info)
|
||||
+ free(info);
|
||||
+#endif
|
||||
+ return ct;
|
||||
+}
|
||||
+
|
||||
+bool Process::IsProcessBackgrounded() const {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+bool Process::SetProcessBackgrounded(bool value) {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
+bool Process::CanBackgroundProcesses() {
|
||||
+ return false;
|
||||
}
|
||||
|
||||
} // namespace base
|
|
@ -0,0 +1,11 @@
|
|||
--- base/rand_util.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/rand_util.h
|
||||
@@ -77,7 +77,7 @@ void RandomShuffle(Itr first, Itr last) {
|
||||
std::shuffle(first, last, RandomBitGenerator());
|
||||
}
|
||||
|
||||
-#if defined(OS_POSIX)
|
||||
+#if defined(OS_POSIX) && !defined(OS_OPENBSD)
|
||||
BASE_EXPORT int GetUrandomFD();
|
||||
#endif
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
--- base/rand_util_posix.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/rand_util_posix.cc
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
-#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_NACL)
|
||||
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_NACL) && !defined(OS_BSD)
|
||||
#include "third_party/lss/linux_syscall_support.h"
|
||||
#elif defined(OS_MAC)
|
||||
// TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK.
|
||||
@@ -34,6 +34,7 @@ static constexpr int kOpenFlags = O_RDONLY;
|
||||
static constexpr int kOpenFlags = O_RDONLY | O_CLOEXEC;
|
||||
#endif
|
||||
|
||||
+#if !defined(OS_OPENBSD)
|
||||
// We keep the file descriptor for /dev/urandom around so we don't need to
|
||||
// reopen it (which is expensive), and since we may not even be able to reopen
|
||||
// it if we are later put in a sandbox. This class wraps the file descriptor so
|
||||
@@ -51,6 +52,7 @@ class URandomFd {
|
||||
private:
|
||||
const int fd_;
|
||||
};
|
||||
+#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -62,6 +64,7 @@ namespace base {
|
||||
// (https://chromium-review.googlesource.com/c/chromium/src/+/1545096) and land
|
||||
// it or some form of it.
|
||||
void RandBytes(void* output, size_t output_length) {
|
||||
+#if !defined(OS_OPENBSD)
|
||||
#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && !defined(OS_NACL)
|
||||
// We have to call `getrandom` via Linux Syscall Support, rather than through
|
||||
// the libc wrapper, because we might not have an up-to-date libc (e.g. on
|
||||
@@ -93,11 +96,16 @@ void RandBytes(void* output, size_t output_length) {
|
||||
const bool success =
|
||||
ReadFromFD(urandom_fd, static_cast<char*>(output), output_length);
|
||||
CHECK(success);
|
||||
+#else
|
||||
+ arc4random_buf(static_cast<char*>(output), output_length);
|
||||
+#endif
|
||||
}
|
||||
|
||||
+#if !defined(OS_OPENBSD)
|
||||
int GetUrandomFD() {
|
||||
static NoDestructor<URandomFd> urandom_fd;
|
||||
return urandom_fd->fd();
|
||||
}
|
||||
+#endif
|
||||
|
||||
} // namespace base
|
|
@ -0,0 +1,11 @@
|
|||
--- base/strings/string_util.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/strings/string_util.cc
|
||||
@@ -36,7 +36,7 @@ namespace base {
|
||||
bool IsWprintfFormatPortable(const wchar_t* format) {
|
||||
// This snippet of code checks that we can build C++17 code.
|
||||
// TODO(thakis): Enable this on all platforms, and then remove it again.
|
||||
-#if !defined(OS_LINUX) && !BUILDFLAG(CFI_ICALL_CHECK) && \
|
||||
+#if !defined(OS_LINUX) && !defined(OS_BSD) && !BUILDFLAG(CFI_ICALL_CHECK) && \
|
||||
!BUILDFLAG(CFI_CAST_CHECK)
|
||||
if constexpr (constexpr int i = 0; i > 0) {
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
--- base/synchronization/lock_impl.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/synchronization/lock_impl.h
|
||||
@@ -107,6 +107,10 @@ void LockImpl::Unlock() {
|
||||
}
|
||||
|
||||
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
||||
+#if defined(OS_FREEBSD)
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wthread-safety-analysis"
|
||||
+#endif
|
||||
|
||||
BASE_EXPORT std::string SystemErrorCodeToString(int error_code);
|
||||
|
||||
@@ -121,6 +125,9 @@ void LockImpl::Unlock() {
|
||||
int rv = pthread_mutex_unlock(&native_handle_);
|
||||
DCHECK_EQ(rv, 0) << ". " << strerror(rv);
|
||||
}
|
||||
+#if defined(OS_FREEBSD)
|
||||
+#pragma GCC diagnostic pop
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
// This is an implementation used for AutoLock templated on the lock type.
|
|
@ -0,0 +1,20 @@
|
|||
--- base/syslog_logging.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/syslog_logging.cc
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/win/scoped_handle.h"
|
||||
#include "base/win/win_util.h"
|
||||
-#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
// <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
|
||||
// base::LOG_INFO, base::LOG_WARNING.
|
||||
#include <syslog.h>
|
||||
@@ -145,7 +145,7 @@ EventLogMessage::~EventLogMessage() {
|
||||
|
||||
if (user_sid != nullptr)
|
||||
::LocalFree(user_sid);
|
||||
-#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || 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,11 @@
|
|||
--- base/system/sys_info.cc.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/system/sys_info.cc
|
||||
@@ -100,7 +100,7 @@ void SysInfo::GetHardwareInfo(base::OnceCallback<void(
|
||||
#if defined(OS_WIN) || defined(OS_ANDROID) || defined(OS_APPLE)
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
FROM_HERE, {}, base::BindOnce(&GetHardwareInfoSync), std::move(callback));
|
||||
-#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
FROM_HERE, {base::MayBlock()}, base::BindOnce(&GetHardwareInfoSync),
|
||||
std::move(callback));
|
|
@ -0,0 +1,20 @@
|
|||
--- base/system/sys_info.h.orig 2022-05-11 07:16:46 UTC
|
||||
+++ base/system/sys_info.h
|
||||
@@ -236,6 +236,8 @@ class BASE_EXPORT SysInfo {
|
||||
// On Desktop this returns true when memory <= 2GB.
|
||||
static bool IsLowEndDevice();
|
||||
|
||||
+ static uint64_t MaxSharedMemorySize();
|
||||
+
|
||||
private:
|
||||
FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
|
||||
FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo);
|
||||
@@ -246,7 +248,7 @@ class BASE_EXPORT SysInfo {
|
||||
static HardwareInfo GetHardwareInfoSync();
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
|
||||
- defined(OS_AIX)
|
||||
+ defined(OS_AIX) || defined(OS_BSD)
|
||||
static int64_t AmountOfAvailablePhysicalMemory(
|
||||
const SystemMemoryInfoKB& meminfo);
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue