cleanup: Remove expired ports:

2022-06-30 databases/pgpool-II-36: Upstream support ended use databases/pgpool-II-43
2022-06-30 ftp/multiget: Last release in 2007, doesn't support https, depends on deprecated wxgtk28 and dead upstream. Please consider using net/uget
2022-06-30 devel/electron13: EOLed upstream, switch to newer version
2022-06-30 ftp/puf: Last release in 2006, doesn't support https and upstream is dead. Please consider using www/aria2
2022-06-30 security/gss: Abandonware, last release in 2014 and no development since
2022-06-30 security/shishi: Abandonware, last release in 2013 and no development since
2022-06-30 ftp/urlgfe
2022-06-30 www/nspluginwrapper: Abandonware, last release in 2011 and upstream is dead. NPAPI plugins are now obsolete and depends on deprecated library GTK 2
2022-06-30 devel/govendor: Use Go modules
2022-06-30 devel/racer: Racer is not actively developped now. Please consider using newer software such as devel/rust-analyzer.
2022-06-30 net-mgmt/unifi6: No longer maintained by upstream
2022-06-30 devel/dep: Use Go modules
2022-06-30 databases/libgda5-bdb: Depends on deprecated databases/db5
2022-06-30 emulators/qemu5: Use emulators/qemu6 or emulators/qemu
2022-06-30 deskutils/bitcollider: bitzi.com is no longer available, closed down in 2013
2022-06-30 converters/htx: XHTML is considered obsolete in favor of HTML5
2022-06-30 www/getleft: Abandonware last updated on 2008
2022-06-30 ftp/wxdfast: Last release in 2009, doesn't support https, depends on deprecated wxgtk28 and dead upstream. Please consider using net/uget
This commit is contained in:
Rene Ladan 2022-06-30 22:48:41 +02:00
parent 10b96277e5
commit 30886720da
1160 changed files with 18 additions and 39388 deletions

18
MOVED
View file

@ -17462,3 +17462,21 @@ devel/psptoolchain-gcc-stage1||2022-06-30|Has expired: Security issues for multi
devel/psptoolchain-pspsdk-stage1||2022-06-30|Has expired: Security issues for multiple years
devel/psptoolchain-pspsdk-stage2||2022-06-30|Has expired: Security issues for multiple years
devel/psptoolchain-gcc-stage2||2022-06-30|Has expired: Security issues for multiple years
databases/pgpool-II-36||2022-06-30|Has expired: Upstream support ended use databases/pgpool-II-43
ftp/multiget||2022-06-30|Has expired: Last release in 2007, doesn't support https, depends on deprecated wxgtk28 and dead upstream. Please consider using net/uget
devel/electron13||2022-06-30|Has expired: EOLed upstream, switch to newer version
ftp/puf||2022-06-30|Has expired: Last release in 2006, doesn't support https and upstream is dead. Please consider using www/aria2
security/gss||2022-06-30|Has expired: Abandonware, last release in 2014 and no development since
security/shishi||2022-06-30|Has expired: Abandonware, last release in 2013 and no development since
ftp/urlgfe||2022-06-30|Has expired
www/nspluginwrapper||2022-06-30|Has expired: Abandonware, last release in 2011 and upstream is dead. NPAPI plugins are now obsolete and depends on deprecated library GTK 2
devel/govendor||2022-06-30|Has expired: Use Go modules
devel/racer||2022-06-30|Has expired: Racer is not actively developped now. Please consider using newer software such as devel/rust-analyzer.
net-mgmt/unifi6||2022-06-30|Has expired: No longer maintained by upstream
devel/dep||2022-06-30|Has expired: Use Go modules
databases/libgda5-bdb||2022-06-30|Has expired: Depends on deprecated databases/db5
emulators/qemu5||2022-06-30|Has expired: Use emulators/qemu6 or emulators/qemu
deskutils/bitcollider||2022-06-30|Has expired: bitzi.com is no longer available, closed down in 2013
converters/htx||2022-06-30|Has expired: XHTML is considered obsolete in favor of HTML5
www/getleft||2022-06-30|Has expired: Abandonware last updated on 2008
ftp/wxdfast||2022-06-30|Has expired: Last release in 2009, doesn't support https, depends on deprecated wxgtk28 and dead upstream. Please consider using net/uget

View file

@ -32,7 +32,6 @@
SUBDIR += gbase
SUBDIR += gbsdconv
SUBDIR += hs-aeson-pretty
SUBDIR += htx
SUBDIR += i18ntools
SUBDIR += ical2html
SUBDIR += iconv

View file

@ -1,22 +0,0 @@
# Created by: Vsevolod Stakhov <vsevolod@highsecure.ru>
PORTNAME= htx
DISTVERSION= 0.7.8
CATEGORIES= converters www
MASTER_SITES= http://stuff.myrealm.co.uk/htx/
MAINTAINER= ports@FreeBSD.org
COMMENT= HTML to XHTML converter
DEPRECATED= XHTML is considered obsolete in favor of HTML5
EXPIRATION_DATE=2022-06-30
USES= perl5 shebangfix
SHEBANG_FILES= htx
NO_BUILD= yes
PLIST_FILES= bin/htx
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/htx ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View file

@ -1,2 +0,0 @@
SHA256 (htx-0.7.8.tar.gz) = 667ba52d897165a84f5270a2ab6535c92e305e913530ab63e4ccf3cd252f46c1
SIZE (htx-0.7.8.tar.gz) = 10975

View file

@ -1,3 +0,0 @@
HTML to XHTML converter written in Perl
WWW: http://stuff.myrealm.co.uk/htx/

View file

@ -129,7 +129,6 @@
SUBDIR += libdrizzle
SUBDIR += libdrizzle-redux
SUBDIR += libgda5
SUBDIR += libgda5-bdb
SUBDIR += libgda5-jdbc
SUBDIR += libgda5-ldap
SUBDIR += libgda5-mdb
@ -578,7 +577,6 @@
SUBDIR += pglogical
SUBDIR += pgmetrics
SUBDIR += pgmodeler
SUBDIR += pgpool-II-36
SUBDIR += pgpool-II-37
SUBDIR += pgpool-II-40
SUBDIR += pgpool-II-41

View file

@ -1,20 +0,0 @@
# Created by: Joe Marcus Clarke <marcus@FreeBSD.org>
PORTREVISION= 2
CATEGORIES= databases gnome
PKGNAMESUFFIX= 5-bdb
MAINTAINER= gnome@FreeBSD.org
COMMENT= Provides Berkeley DB backend for the libgda5 library
MASTERDIR= ${.CURDIR}/../libgda5
BUILD_WRKSRC= ${WRKSRC}/providers/bdb/
INSTALL_WRKSRC= ${BUILD_WRKSRC}
PLIST= ${.CURDIR}/pkg-plist
DEPRECATED= Depends on deprecated databases/db5
EXPIRATION_DATE=2022-06-30
LIBGDA5_SLAVE= bdb
.include "${MASTERDIR}/Makefile"

View file

@ -1,3 +0,0 @@
lib/libgda-%%VERSION%%/providers/libgda-bdb.so
libdata/pkgconfig/libgda-bdb-%%VERSION%%.pc
share/libgda-%%VERSION%%/bdb_specs_dsn.xml

View file

@ -1,45 +0,0 @@
PORTNAME= pgpool-II
PORTVERSION= 3.6.28
CATEGORIES= databases
MASTER_SITES= http://www.pgpool.net/mediawiki/images/
PKGNAMESUFFIX= 36
MAINTAINER= tz@FreeBSD.org
COMMENT= Connection pool server for PostgreSQL
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/COPYING
DEPRECATED= Upstream support ended use databases/pgpool-II-43
EXPIRATION_DATE= 2022-06-30
USES= gmake libtool pgsql:9.3+
USE_LDCONFIG= yes
USE_RC_SUBR= pgpool
GNU_CONFIGURE= yes
CONFLICTS_INSTALL= pgpool-II-[0-9][0-9] pgpool-II[0-9][0-9] # etc/pcp.conf.sample
PORTSCOUT= limit:^3.6.[0-9]*
PORTDOCS= *
OPTIONS_DEFINE= DOCS SSL
OPTIONS_DEFAULT= SSL
SSL_USES= ssl
SSL_CONFIGURE_WITH= openssl
post-install:
@${MKDIR} ${STAGEDIR}/var/run/pgpool
${INSTALL_LIB} ${WRKSRC}/src/libs/pcp/.libs/libpcp.so.1.0.0 ${STAGEDIR}${PREFIX}/lib
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
cd ${WRKSRC} && ${COPYTREE_SHARE} doc ${STAGEDIR}${DOCSDIR} "-not -name Makefile.\*"
.for f in AUTHORS ChangeLog NEWS TODO
${INSTALL_DATA} ${WRKSRC}/$f ${STAGEDIR}${DOCSDIR}
.endfor
.include <bsd.port.mk>

View file

@ -1,3 +0,0 @@
TIMESTAMP = 1640293881
SHA256 (pgpool-II-3.6.28.tar.gz) = b2b7c04e687d9205601d8a2e48413a50bd64bd4d30e3ac0ec553fba61f2678f6
SIZE (pgpool-II-3.6.28.tar.gz) = 3363962

View file

@ -1,38 +0,0 @@
#!/bin/sh
# PROVIDE: pgpool
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# pgpool_enable (bool): Set to NO by default.
# Set it to YES to enable pgpool.
# pgpool_conf (file): Set location of your config.
# Default is "%%PREFIX%%/etc/pgpool.conf"
# pgpool_user (uid): User ID to run as (default nobody)
# pgpool_stop_mode (string): Shutdown mode
# Default is "smart"
# Possibilities are "smart", "fast", or "immediate"
#
. /etc/rc.subr
name=pgpool
rcvar=pgpool_enable
load_rc_config $name
: ${pgpool_enable="NO"}
: ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"}
: ${pgpool_user="nobody"}
: ${pgpool_stop_mode="smart"}
command="%%PREFIX%%/bin/pgpool"
command_args="-f ${pgpool_conf}"
stop_cmd="${command} -m ${pgpool_stop_mode} ${command_args} stop"
required_files="${pgpool_conf}"
run_rc_command "$1"

View file

@ -1,8 +0,0 @@
pgpool is a connection pool server for PostgreSQL. pgpool runs between
PostgreSQL's clients(front ends) and servers(back ends). A PostgreSQL client can
connect to pgpool as if it were a standard PostgreSQL server.
pgpool caches the connection to PostgreSQL server to reduce the overhead to
establish the connection to it.
WWW: https://pgpool.net/

View file

@ -1,15 +0,0 @@
[
{ type: install
message: <<EOM
In order to start pgpool you need some more configuration:
# sysrc -f /etc/rc.conf pgpool_enable="YES"
# sysrc -f /etc/rc.conf pgpool_user="root"
Please consider the usage of another user. The user is
required to have read/write access to /var/run/pgpool.
Using the root user is - as always - an security issue.
EOM
}
]

View file

@ -1,32 +0,0 @@
bin/pcp_attach_node
bin/pcp_detach_node
bin/pcp_node_count
bin/pcp_node_info
bin/pcp_pool_status
bin/pcp_proc_count
bin/pcp_proc_info
bin/pcp_promote_node
bin/pcp_recovery_node
bin/pcp_stop_pgpool
bin/pcp_watchdog_info
bin/pg_md5
bin/pgpool
bin/pgpool_setup
bin/watchdog_setup
@sample etc/pcp.conf.sample
@sample etc/pgpool.conf.sample
etc/pgpool.conf.sample-master-slave
etc/pgpool.conf.sample-replication
etc/pgpool.conf.sample-stream
@sample etc/pool_hba.conf.sample
include/libpcp_ext.h
include/pcp.h
include/pool_process_reporting.h
include/pool_type.h
lib/libpcp.a
lib/libpcp.so
lib/libpcp.so.1
lib/libpcp.so.1.0.0
%%DATADIR%%/insert_lock.sql
%%DATADIR%%/pgpool.pam
@dir /var/run/pgpool

View file

@ -17,7 +17,6 @@
SUBDIR += bigyear
SUBDIR += bijiben
SUBDIR += birdtray
SUBDIR += bitcollider
SUBDIR += bookworm
SUBDIR += cairo-dock
SUBDIR += cairo-dock-plugins

View file

@ -1,25 +0,0 @@
# Created by: Andrew Pantyukhin <infofarmer@FreeBSD.org>
PORTNAME= bitcollider
PORTVERSION= 0.6.0
PORTREVISION= 4
CATEGORIES= deskutils multimedia
MASTER_SITES= SF/${PORTNAME}/Bitcollider/${PORTVERSION}
MAINTAINER= ports@FreeBSD.org
COMMENT= Bitzi metadata generator
DEPRECATED= bitzi.com is no longer available, closed down in 2013
EXPIRATION_DATE=2022-06-30
GNU_CONFIGURE= yes
USES= libtool
INSTALL_TARGET= install-strip
USE_LDCONFIG= yes
CFLAGS+= -lm
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/bitcollider/plugins/*.bcp
.include <bsd.port.mk>

View file

@ -1,2 +0,0 @@
SHA256 (bitcollider-0.6.0.tar.gz) = 733c6e4bb64ad25e114e1ae8d50514ff13b5246dc9307cd11447b3449a0f31f5
SIZE (bitcollider-0.6.0.tar.gz) = 641374

View file

@ -1,13 +0,0 @@
--- Makefile.in.orig 2014-03-01 18:35:51.000000000 +0100
+++ Makefile.in 2014-03-01 18:36:24.000000000 +0100
@@ -615,8 +615,8 @@
$(SHELL) ./config.status --recheck
install-data-local:
- mkdir -p $(libdir)/bitcollider/plugins
- $(INSTALL) -m 0655 plugins/*.bcp $(libdir)/bitcollider/plugins
+ mkdir -p $(DESTDIR)$(libdir)/bitcollider/plugins
+ $(INSTALL) -m 0655 plugins/*.bcp $(DESTDIR)$(libdir)/bitcollider/plugins
mkdir -p $(DESTDIR)$(bindir)
$(INSTALL) -s -m 0655 src/bitcollider $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(includedir)/bitcollider

View file

@ -1,6 +0,0 @@
The bitcollider is a small utility that generates
bitprints and metadata tags from files for lookup
and submission at the Bitzi community metadata
project. For more details, please see http://bitzi.com.
WWW: http://bitcollider.sourceforge.net/

View file

@ -1,15 +0,0 @@
bin/bitcollider
include/bitcollider/bitcollider.h
include/bitcollider/plugin.h
include/bitcollider/sha1.h
include/bitcollider/tiger.h
include/bitcollider/tigertree.h
include/bitcollider/defs.h
include/bitcollider/cache.h
lib/bitcollider/plugins/image.bcp
lib/bitcollider/plugins/video.bcp
lib/bitcollider/plugins/wav.bcp
lib/libbitcollider.a
lib/libbitcollider.so
lib/libbitcollider.so.1
lib/libbitcollider.so.1.0.0

View file

@ -511,7 +511,6 @@
SUBDIR += deheader
SUBDIR += delta
SUBDIR += delve
SUBDIR += dep
SUBDIR += deployer
SUBDIR += derelict-sdl2
SUBDIR += derelict-util
@ -570,7 +569,6 @@
SUBDIR += efl
SUBDIR += egypt
SUBDIR += eiffelstudio
SUBDIR += electron13
SUBDIR += electron17
SUBDIR += electron18
SUBDIR += electron19
@ -865,7 +863,6 @@
SUBDIR += gorm
SUBDIR += goswagger
SUBDIR += got
SUBDIR += govendor
SUBDIR += gpds
SUBDIR += gperf
SUBDIR += gpm
@ -5578,7 +5575,6 @@
SUBDIR += quickcheck++
SUBDIR += quilt
SUBDIR += rabs
SUBDIR += racer
SUBDIR += radare2
SUBDIR += radian
SUBDIR += ragel

View file

@ -1,30 +0,0 @@
PORTNAME= dep
DISTVERSIONPREFIX= v
DISTVERSION= 0.5.4
PORTREVISION= 3
CATEGORIES= devel
# https://github.com/golang/dep/pull/2228
PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
PATCHFILES= 6d3cf343515fe34645284b75819bed3de5ea930e.patch:-p1
MAINTAINER= dmgk@FreeBSD.org
COMMENT= Prototype dependency management tool for Go
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
DEPRECATED= Use Go modules
EXPIRATION_DATE= 2022-06-30
USES= go
USE_GITHUB= yes
GH_ACCOUNT= golang
GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
GO_TARGET= ./cmd/dep
PLIST_FILES= bin/dep
.include <bsd.port.mk>

View file

@ -1,5 +0,0 @@
TIMESTAMP = 1577447961
SHA256 (golang-dep-v0.5.4_GH0.tar.gz) = 929c8f759838f98323211ba408a831ea80d93b75beda8584b6d950f393a3298a
SIZE (golang-dep-v0.5.4_GH0.tar.gz) = 3973452
SHA256 (6d3cf343515fe34645284b75819bed3de5ea930e.patch) = 8f14cc0349743c2de8894fc35cba88a804dfbbfc0f101c18a1e2b09e42582722
SIZE (6d3cf343515fe34645284b75819bed3de5ea930e.patch) = 5541303

View file

@ -1,9 +0,0 @@
Dep is a Go tool for managing vendor dependencies (not to be confused
with godep, a different, deprecated tool). dep updates the vendor/
directory contents based on a manifest, prunes unnecessary dependencies,
and adds missing dependencies to vendor/ as necessary.
dep is the heir-apparent for vendor management and is being actively
driven by the Go core team with an eye toward inclusion in the Go tool.
WWW: https://github.com/golang/dep

View file

@ -1,315 +0,0 @@
PORTNAME= electron
DISTVERSIONPREFIX= v
DISTVERSION= ${ELECTRON_VER:S/-beta./.b/}
PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/:chromium \
https://commondatastorage.googleapis.com/chromium-fonts/:chromium_testfonts
PKGNAMESUFFIX= ${ELECTRON_VER_MAJOR}
DISTFILES= chromium-${CHROMIUM_VER}${EXTRACT_SUFX}:chromium \
${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
DEPRECATED= EOLed upstream, switch to newer version
EXPIRATION_DATE= 2022-06-30
FETCH_DEPENDS= yarn-node14>0:www/yarn-node14
EXTRACT_DEPENDS= yarn-node14>0:www/yarn-node14
PATCH_DEPENDS= git:devel/git
BUILD_DEPENDS= ${LOCALBASE}/bin/ar:devel/binutils \
gperf:devel/gperf \
yasm:devel/yasm \
${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \
node14>0:www/node14 \
npm-node14>0:www/npm-node14
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 \
libavcodec.so:multimedia/ffmpeg \
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-node14>0:www/npm-node14
USES= bison cpe dos2unix gettext-tools gl gnome jpeg localbase:ldflags \
ninja pkgconfig python:2.7,build,test shebangfix tar:xz xorg
CPE_VENDOR= electronjs
DOS2UNIX_FILES= third_party/skia/third_party/vulkanmemoryallocator/include/vk_mem_alloc.h \
third_party/vulkan_memory_allocator/src/vk_mem_alloc.h
USE_GITHUB= yes
GH_TAGNAME= ${DISTVERSIONPREFIX}${ELECTRON_VER}
GH_TUPLE= nodejs:node:v${NODE_VER}:node \
nodejs:nan:v${NAN_VER}:nan
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/freebsd/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= python=${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
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
# See ${WRKSRC}/electron/DEPS for CHROMIUM_VER
CHROMIUM_VER= 91.0.4472.164
# 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= 14.16.0
# See ${WRKSRC}/electron/DEPS for NAN_VER
NAN_VER= 2.14.2
YARN_TIMESTAMP= 1643790250
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 \
fieldtrial_testing_like_official_build=true \
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=true \
use_system_harfbuzz=true \
use_system_libjpeg=true \
extra_cxxflags="${CXXFLAGS}" \
extra_ldflags="${LDFLAGS}"
GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles
.include "Makefile.version"
.include <bsd.port.pre.mk>
# Add extra-patch-no-mempcpy-nasm only when there's no mempcpy() in base.
# Nested variable expansion avoids executing the test when not needed for
# expanding EXTRA_PATCHES.
EXTRA_PATCHES+= ${"${:!${GREP} mempcpy ${CROSS_SYSROOT}/usr/include/string.h \
|| ${TRUE}!}" == "":?${PATCHDIR}/extra-patch-no-mempcpy-nasm:}
.if ${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}/test_fonts ${WRKSRC}/third_party/test_fonts
# Take in clang-format from official chromium distribution
${MKDIR} ${WRKSRC}/buildtools/freebsd
${CP} ${WRKSRC}/buildtools/linux64/clang-format ${WRKSRC}/buildtools/freebsd
# Copy FreeBSD-specific files from FILESDIR
${MKDIR} ${WRKSRC}/sandbox/policy/freebsd
${CP} ${FILESDIR}/dir_reader_freebsd.h ${WRKSRC}/base/files
${CP} ${FILESDIR}/device_info_fetcher_freebsd.h ${WRKSRC}/chrome/browser/enterprise/signals
${CP} ${FILESDIR}/device_info_fetcher_freebsd.cc ${WRKSRC}/chrome/browser/enterprise/signals
${CP} ${FILESDIR}/sandbox_freebsd.h ${WRKSRC}/sandbox/policy/freebsd
${CP} ${FILESDIR}/sandbox_freebsd.cc ${WRKSRC}/sandbox/policy/freebsd
# 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
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 \
ffmpeg flac fontconfig freetype harfbuzz-ng libdrm libpng \
libusb libwebp libxml libxslt openh264 opus snappy || ${FALSE}
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-x64/bin
${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd-x64/bin/node
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 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 ${STAGEDIR}${DATADIR}
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>

View file

@ -1,2 +0,0 @@
ELECTRON_VER= 13.6.9
ELECTRON_VER_MAJOR= ${ELECTRON_VER:C/\..*//}

View file

@ -1,13 +0,0 @@
TIMESTAMP = 1643791817
SHA256 (electron/chromium-91.0.4472.164.tar.xz) = 84e56fa2ad96d910cab429c513eeaca7bfa94096fef057bd024be826ce8426bd
SIZE (electron/chromium-91.0.4472.164.tar.xz) = 950253100
SHA256 (electron/cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb) = ec973eccd669d417fbf2d0a4dac730744a3174268ff062db5451b55c82bc3492
SIZE (electron/cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb) = 26759650
SHA256 (electron/electron-yarn-cache-13.6.9.tar.xz) = 47379de3a855bdc07e595952776d362e1fe84643841defd0830c9f6144ecfa6c
SIZE (electron/electron-yarn-cache-13.6.9.tar.xz) = 34735428
SHA256 (electron/electron-electron-v13.6.9_GH0.tar.gz) = c994d88a7d0854b590cf1d2f0b23bd366f8da4a03ee9cb93e4bef466c4392ccb
SIZE (electron/electron-electron-v13.6.9_GH0.tar.gz) = 10266097
SHA256 (electron/nodejs-node-v14.16.0_GH0.tar.gz) = bcdf869b0743405515ee897b1047b5e851a717e426b4974d26537c9b10dfd53a
SIZE (electron/nodejs-node-v14.16.0_GH0.tar.gz) = 87850748
SHA256 (electron/nodejs-nan-v2.14.2_GH0.tar.gz) = 26dce4db0194c4a7b51b33d0324f3cf36eb67be49dc43a043e0a2dffc9dcdd6d
SIZE (electron/nodejs-nan-v2.14.2_GH0.tar.gz) = 178650

View file

@ -1,26 +0,0 @@
#! /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

View file

@ -1,143 +0,0 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/enterprise/signals/device_info_fetcher_freebsd.h"
#if defined(USE_GIO)
#include <gio/gio.h>
#endif // defined(USE_GIO)
#include <sys/stat.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <string>
#include "base/environment.h"
#include "base/files/dir_reader_posix.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/nix/xdg_util.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/system/sys_info.h"
#include "net/base/network_interfaces.h"
using SettingValue = enterprise_signals::DeviceInfo::SettingValue;
namespace enterprise_signals {
namespace {
std::string GetDeviceModel() {
return base::SysInfo::HardwareModelName();
}
std::string GetOsVersion() {
return base::SysInfo::OperatingSystemVersion();
}
std::string GetDeviceHostName() {
return net::GetHostName();
}
std::string GetSerialNumber() {
return std::string();
}
// Implements the logic from the native client setup script. It reads the
// setting value straight from gsettings but picks the schema relevant to the
// currently active desktop environment.
// The current implementation support Gnone and Cinnamon only.
SettingValue GetScreenlockSecured() {
#if defined(USE_GIO)
static constexpr char kLockScreenKey[] = "lock-enabled";
std::unique_ptr<base::Environment> env(base::Environment::Create());
const base::nix::DesktopEnvironment desktop_env =
base::nix::GetDesktopEnvironment(env.get());
if (desktop_env != base::nix::DESKTOP_ENVIRONMENT_CINNAMON &&
desktop_env != base::nix::DESKTOP_ENVIRONMENT_GNOME) {
return SettingValue::UNKNOWN;
}
const std::string settings_schema = base::StringPrintf(
"org.%s.desktop.screensaver",
desktop_env == base::nix::DESKTOP_ENVIRONMENT_CINNAMON ? "cinnamon"
: "gnome");
GSettingsSchema* screensaver_schema = g_settings_schema_source_lookup(
g_settings_schema_source_get_default(), settings_schema.c_str(), FALSE);
GSettings* screensaver_settings = nullptr;
if (!screensaver_schema ||
!g_settings_schema_has_key(screensaver_schema, kLockScreenKey)) {
return SettingValue::UNKNOWN;
}
screensaver_settings = g_settings_new(settings_schema.c_str());
if (!screensaver_settings)
return SettingValue::UNKNOWN;
gboolean lock_screen_enabled =
g_settings_get_boolean(screensaver_settings, kLockScreenKey);
g_object_unref(screensaver_settings);
return lock_screen_enabled ? SettingValue::ENABLED : SettingValue::DISABLED;
#else
return SettingValue::UNKNOWN;
#endif // defined(USE_GIO)
}
// Implements the logic from the native host installation script. First find the
// root device identifier, then locate its parent and get its type.
SettingValue GetDiskEncrypted() {
return SettingValue::UNKNOWN;
}
std::vector<std::string> GetMacAddresses() {
std::vector<std::string> result;
struct ifaddrs* ifa = nullptr;
if (getifaddrs(&ifa) != 0)
return result;
struct ifaddrs* interface = ifa;
for (; interface != nullptr; interface = interface->ifa_next) {
if (interface->ifa_addr == nullptr ||
interface->ifa_addr->sa_family != AF_LINK) {
continue;
}
struct sockaddr_dl* sdl =
reinterpret_cast<struct sockaddr_dl*>(interface->ifa_addr);
if (!sdl || sdl->sdl_alen != 6)
continue;
char* link_address = static_cast<char*>(LLADDR(sdl));
result.push_back(base::StringPrintf(
"%02x:%02x:%02x:%02x:%02x:%02x", link_address[0] & 0xff,
link_address[1] & 0xff, link_address[2] & 0xff, link_address[3] & 0xff,
link_address[4] & 0xff, link_address[5] & 0xff));
}
return result;
}
} // namespace
DeviceInfoFetcherFreeBSD::DeviceInfoFetcherFreeBSD() = default;
DeviceInfoFetcherFreeBSD::~DeviceInfoFetcherFreeBSD() = default;
DeviceInfo DeviceInfoFetcherFreeBSD::Fetch() {
DeviceInfo device_info;
device_info.os_name = "freebsd";
device_info.os_version = GetOsVersion();
device_info.device_host_name = GetDeviceHostName();
device_info.device_model = GetDeviceModel();
device_info.serial_number = GetSerialNumber();
device_info.screen_lock_secured = GetScreenlockSecured();
device_info.disk_encrypted = GetDiskEncrypted();
device_info.mac_addresses = GetMacAddresses();
return device_info;
}
} // namespace enterprise_signals

View file

@ -1,26 +0,0 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ENTERPRISE_SIGNALS_DEVICE_INFO_FETCHER_FREEBSD_H_
#define CHROME_BROWSER_ENTERPRISE_SIGNALS_DEVICE_INFO_FETCHER_FREEBSD_H_
#include "chrome/browser/enterprise/signals/device_info_fetcher.h"
namespace enterprise_signals {
// FreeBSD implementation of DeviceInfoFetcher.
class DeviceInfoFetcherFreeBSD : public DeviceInfoFetcher {
public:
DeviceInfoFetcherFreeBSD();
DeviceInfoFetcherFreeBSD(const DeviceInfoFetcherFreeBSD&) = delete;
DeviceInfoFetcherFreeBSD& operator=(const DeviceInfoFetcherFreeBSD&) = delete;
~DeviceInfoFetcherFreeBSD() override;
// Overrides DeviceInfoFetcher:
DeviceInfo Fetch() override;
};
} // namespace enterprise_signals
#endif // CHROME_BROWSER_ENTERPRISE_SIGNALS_DEVICE_INFO_FETCHER_FREEBSD_H_

View file

@ -1,95 +0,0 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_FILES_DIR_READER_FREEBSD_H_
#define BASE_FILES_DIR_READER_FREEBSD_H_
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
// See the comments in dir_reader_posix.h about this.
namespace base {
class DirReaderFreeBSD {
public:
explicit DirReaderFreeBSD(const char* directory_path)
: fd_(open(directory_path, O_RDONLY | O_DIRECTORY)),
offset_(0),
size_(0) {
memset(buf_, 0, sizeof(buf_));
}
DirReaderFreeBSD(const DirReaderFreeBSD&) = delete;
DirReaderFreeBSD& operator=(const DirReaderFreeBSD&) = delete;
~DirReaderFreeBSD() {
if (fd_ >= 0) {
if (IGNORE_EINTR(close(fd_)))
RAW_LOG(ERROR, "Failed to close directory handle");
}
}
bool IsValid() const {
return fd_ >= 0;
}
// Move to the next entry returning false if the iteration is complete.
bool Next() {
if (size_) {
struct dirent* dirent = reinterpret_cast<struct dirent*>(&buf_[offset_]);
offset_ += dirent->d_reclen;
}
if (offset_ != size_)
return true;
ssize_t r = getdents(fd_, buf_, sizeof(buf_));
if (r == 0)
return false;
if (r == -1) {
DPLOG(FATAL) << "getdents failed";
return false;
}
size_ = r;
offset_ = 0;
return true;
}
const char* name() const {
if (!size_)
return nullptr;
const struct dirent* dirent =
reinterpret_cast<const struct dirent*>(&buf_[offset_]);
return dirent->d_name;
}
int fd() const {
return fd_;
}
static bool IsFallback() {
return false;
}
private:
const int fd_;
alignas(struct dirent) unsigned char buf_[512];
size_t offset_;
size_t size_;
};
} // namespace base
#endif // BASE_FILES_DIR_READER_LINUX_H_

View file

@ -1,11 +0,0 @@
--- third_party/nasm/config/config-linux.h.orig 2021-01-07 00:39:33 UTC
+++ third_party/nasm/config/config-linux.h
@@ -336,7 +336,7 @@
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mempcpy' function. */
-#define HAVE_MEMPCPY 1
+/* #undef HAVE_MEMPCPY */
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1

View file

@ -1,150 +0,0 @@
{
"name": "electron",
"version": "13.6.9",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
"@electron/docs-parser": "^0.10.1",
"@electron/typescript-definitions": "^8.8.0",
"@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.0.3",
"aws-sdk": "^2.727.1",
"check-for-leaks": "^1.2.1",
"colors": "1.4.0",
"dotenv-safe": "^4.0.4",
"dugite": "^1.45.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": "^2.2.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",
"nugget": "^2.0.1",
"null-loader": "^4.0.0",
"pre-flight": "^1.1.0",
"remark-cli": "^4.0.0",
"remark-preset-lint-markdown-style-guide": "^2.1.1",
"request": "^2.88.2",
"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": "python script/run-clang-format.py -r -c chromium_src/ 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": "python ./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",
"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"
],
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "check-for-leaks"
}
},
"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}": [
"python script/run-clang-format.py -r -c --fix"
],
"*.md": [
"npm run lint:docs"
],
"*.{gn,gni}": [
"npm run gn-check",
"python 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"
]
}
}

View file

@ -1,96 +0,0 @@
--- BUILD.gn.orig 2021-07-15 19:13:29 UTC
+++ BUILD.gn
@@ -429,7 +429,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",
@@ -474,8 +474,6 @@ group("gn_all") {
"//net:disk_cache_memory_test",
"//net:quic_client",
"//net:quic_server",
- "//sandbox/linux:chrome_sandbox",
- "//sandbox/linux:sandbox_linux_unittests",
"//testing:empty_main",
]
@@ -530,10 +528,6 @@ group("gn_all") {
"//chrome/test:load_library_perf_tests",
"//chrome/test:sync_performance_tests",
"//chrome/test/chromedriver:chromedriver",
- "//courgette:courgette",
- "//courgette:courgette_fuzz",
- "//courgette:courgette_minimal_tool",
- "//courgette:courgette_unittests",
"//media/cast:generate_barcode_video",
"//media/cast:generate_timecode_audio",
"//net:crash_cache",
@@ -592,10 +586,6 @@ group("gn_all") {
"//mojo:mojo_perftests",
"//services/service_manager/public/cpp",
"//testing/gmock:gmock_main",
- "//third_party/breakpad:dump_syms($host_toolchain)",
- "//third_party/breakpad:microdump_stackwalk($host_toolchain)",
- "//third_party/breakpad:minidump_dump($host_toolchain)",
- "//third_party/breakpad:minidump_stackwalk($host_toolchain)",
]
if (!is_android) {
@@ -673,7 +663,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)" ]
}
@@ -688,7 +678,7 @@ group("gn_all") {
}
}
- if (is_mac || is_win || is_android || is_linux || is_chromeos) {
+ if (is_mac || is_win || is_android || (is_linux && !is_bsd) || is_chromeos) {
deps += [
"//third_party/crashpad/crashpad:crashpad_tests",
"//third_party/crashpad/crashpad/handler:crashpad_handler",
@@ -803,7 +793,6 @@ group("gn_all") {
"//chrome/browser/vr:vr_common_perftests",
"//chrome/browser/vr:vr_common_unittests",
"//chrome/browser/vr:vr_pixeltests",
- "//tools/perf/contrib/vr_benchmarks:vr_perf_tests",
]
if (is_android) {
deps += [ "//chrome/browser/android/vr:vr_android_unittests" ]
@@ -1102,7 +1091,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)" ]
}
@@ -1111,7 +1100,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)" ]
}
@@ -1355,9 +1344,6 @@ group("chromium_builder_perf") {
if (is_win) {
data_deps += [ "//chrome/installer/mini_installer:mini_installer" ]
- } else {
- data_deps +=
- [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
}
if (is_win || is_android) {
data_deps += [

View file

@ -1,11 +0,0 @@
--- apps/app_restore_service_browsertest.cc.orig 2021-01-07 00:36:17 UTC
+++ apps/app_restore_service_browsertest.cc
@@ -148,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAcc
}
// Flaky: crbug.com/269613
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_BSD)
#define MAYBE_FileAccessIsRestored DISABLED_FileAccessIsRestored
#else
#define MAYBE_FileAccessIsRestored FileAccessIsRestored

View file

@ -1,11 +0,0 @@
--- apps/ui/views/app_window_frame_view.cc.orig 2021-04-14 01:08:35 UTC
+++ apps/ui/views/app_window_frame_view.cc
@@ -137,7 +137,7 @@ gfx::Rect AppWindowFrameView::GetWindowBoundsForClient
gfx::Rect window_bounds = client_bounds;
// TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
// complete.
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_LINUX) || defined(OS_BSD) || BUILDFLAG(IS_CHROMEOS_LACROS)
// 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 =

View file

@ -1,14 +0,0 @@
--- ash/display/mirror_window_controller.cc.orig 2021-04-14 01:08:35 UTC
+++ ash/display/mirror_window_controller.cc
@@ -286,7 +286,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;
}

View file

@ -1,94 +0,0 @@
--- base/BUILD.gn.orig 2021-07-15 19:13:29 UTC
+++ base/BUILD.gn
@@ -963,7 +963,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",
@@ -974,6 +974,11 @@ component("base") {
"profiler/thread_delegate_posix.h",
]
}
+ if (is_bsd) {
+ sources += [
+ "profiler/stack_sampler_posix.cc",
+ ]
+ }
}
if (is_win) {
@@ -1377,7 +1382,7 @@ component("base") {
# building inside the cros_sdk environment - use host_toolchain as a
# more robust check for this.
if (!use_sysroot &&
- (is_android || ((is_linux || is_chromeos) && !is_chromecast)) &&
+ (is_android || ((is_linux || is_chromeos) && !is_chromecast) && !is_clang) &&
host_toolchain != "//build/toolchain/cros:host") {
libs += [ "atomic" ]
}
@@ -1430,7 +1435,7 @@ component("base") {
"allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc",
]
}
- if (is_chromeos || is_linux) {
+ if ((is_chromeos || is_linux) && !is_bsd) {
sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ]
}
if (is_win) {
@@ -2064,6 +2069,34 @@ component("base") {
}
}
+ if (is_bsd) {
+ sources -= [
+ "files/file_path_watcher_linux.cc",
+ "files/file_util_linux.cc",
+ "process/memory_linux.cc",
+ "process/process_handle_linux.cc",
+ "process/process_iterator_linux.cc",
+ "process/process_metrics_linux.cc",
+ "system/sys_info_linux.cc"
+ ]
+ sources += [
+ "files/file_path_watcher_freebsd.cc",
+ "files/file_path_watcher_kqueue.cc",
+ "files/file_path_watcher_kqueue.h",
+ "process/memory_stubs.cc",
+ "process/process_handle_freebsd.cc",
+ "process/process_iterator_freebsd.cc",
+ "process/process_metrics_freebsd.cc",
+ "system/sys_info_freebsd.cc",
+ ]
+ libs = [
+ "execinfo", # logging.cc
+ "kvm", # process_metrics_freebsd
+ "util" # process_metrics_freebsd
+ ]
+ }
+
+
# iOS
if (is_ios) {
sources -= [
@@ -3273,7 +3306,7 @@ if (build_base_unittests) {
}
}
- if (is_linux || is_chromeos) {
+ if ((is_linux || is_chromeos) && !is_bsd) {
sources += [ "debug/proc_maps_linux_unittest.cc" ]
}
@@ -3313,7 +3346,7 @@ if (build_base_unittests) {
"posix/unix_domain_socket_unittest.cc",
"task/thread_pool/task_tracker_posix_unittest.cc",
]
- if (!is_nacl && !is_apple) {
+ if (!is_nacl && !is_apple && !is_bsd) {
sources += [
"cpu_affinity_posix_unittest.cc",
"profiler/stack_copier_signal_unittest.cc",

View file

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

View file

@ -1,76 +0,0 @@
--- base/allocator/allocator_shim_default_dispatch_to_glibc.cc.orig 2021-01-07 00:36:18 UTC
+++ base/allocator/allocator_shim_default_dispatch_to_glibc.cc
@@ -6,18 +6,28 @@
#include "base/compiler_specific.h"
#include <dlfcn.h>
-#include <malloc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc_np.h>
// This translation unit defines a default dispatch for the allocator shim which
// routes allocations to libc functions.
-// The code here is strongly inspired from tcmalloc's libc_override_glibc.h.
+// The code here is strongly inspired from tcmalloc's override_glibc.h.
extern "C" {
-void* __libc_malloc(size_t size);
-void* __libc_calloc(size_t n, size_t size);
-void* __libc_realloc(void* address, size_t size);
-void* __libc_memalign(size_t alignment, size_t size);
-void __libc_free(void* ptr);
+void* __malloc(size_t size);
+void* __calloc(size_t n, size_t size);
+void* __realloc(void* address, size_t len);
+void* __memalign(size_t alignment, size_t size) {
+ void *ret;
+ if (__posix_memalign(&ret, alignment, size) != 0) {
+ return nullptr;
+ } else {
+ return ret;
+ }
+}
+int __posix_memalign(void **ptr, size_t alignment, size_t size);
+void __free(void* ptr);
} // extern "C"
namespace {
@@ -25,32 +35,32 @@ namespace {
using base::allocator::AllocatorDispatch;
void* GlibcMalloc(const AllocatorDispatch*, size_t size, void* context) {
- return __libc_malloc(size);
+ return __malloc(size);
}
void* GlibcCalloc(const AllocatorDispatch*,
size_t n,
size_t size,
void* context) {
- return __libc_calloc(n, size);
+ return __calloc(n, size);
}
void* GlibcRealloc(const AllocatorDispatch*,
void* address,
size_t size,
void* context) {
- return __libc_realloc(address, size);
+ return __realloc(address, size);
}
void* GlibcMemalign(const AllocatorDispatch*,
size_t alignment,
size_t size,
void* context) {
- return __libc_memalign(alignment, size);
+ return __memalign(alignment, size);
}
void GlibcFree(const AllocatorDispatch*, void* address, void* context) {
- __libc_free(address);
+ __free(address);
}
NO_SANITIZE("cfi-icall")

View file

@ -1,13 +0,0 @@
--- base/allocator/allocator_shim_override_libc_symbols.h.orig 2021-04-14 01:08:36 UTC
+++ base/allocator/allocator_shim_override_libc_symbols.h
@@ -16,6 +16,10 @@
#include <malloc.h>
#endif
+#if defined(OS_BSD)
+#include <stdlib.h>
+#endif
+
#include "base/allocator/allocator_shim_internals.h"
extern "C" {

View file

@ -1,47 +0,0 @@
--- base/allocator/allocator_shim_unittest.cc.orig 2021-04-14 01:08:36 UTC
+++ base/allocator/allocator_shim_unittest.cc
@@ -369,7 +369,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
#endif // !OS_WIN
-#if !defined(OS_WIN) && !defined(OS_APPLE)
+#if !defined(OS_WIN) && !defined(OS_APPLE) && !defined(OS_BSD)
void* memalign_ptr = memalign(128, 53);
ASSERT_NE(nullptr, memalign_ptr);
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(memalign_ptr) % 128);
@@ -385,7 +385,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
ASSERT_GE(aligned_allocs_intercepted_by_size[kPageSize], 1u);
#endif // !defined(OS_ANDROID)
-#endif // !OS_WIN && !OS_APPLE
+#endif // !OS_WIN && !OS_APPLE && !OS_BSD
// See allocator_shim_override_glibc_weak_symbols.h for why we intercept
// internal libc symbols.
@@ -412,7 +412,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
free(zero_alloc_ptr);
ASSERT_GE(frees_intercepted_by_addr[Hash(zero_alloc_ptr)], 1u);
-#if !defined(OS_WIN) && !defined(OS_APPLE)
+#if !defined(OS_WIN) && !defined(OS_APPLE) && !defined(OS_BSD)
free(memalign_ptr);
ASSERT_GE(frees_intercepted_by_addr[Hash(memalign_ptr)], 1u);
@@ -421,7 +421,7 @@ TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
ASSERT_GE(frees_intercepted_by_addr[Hash(pvalloc_ptr)], 1u);
#endif // !defined(OS_ANDROID)
-#endif // !OS_WIN && !OS_APPLE
+#endif // !OS_WIN && !OS_APPLE && !OS_BSD
#if !defined(OS_WIN)
free(posix_memalign_ptr);
@@ -614,7 +614,7 @@ static size_t GetUsableSize(void* ptr) {
static size_t GetUsableSize(void* ptr) {
return malloc_size(ptr);
}
-#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
static size_t GetUsableSize(void* ptr) {
return malloc_usable_size(ptr);
}

View file

@ -1,31 +0,0 @@
--- base/allocator/partition_allocator/address_pool_manager.cc.orig 2021-04-14 01:08:36 UTC
+++ base/allocator/partition_allocator/address_pool_manager.cc
@@ -8,6 +8,13 @@
#include <sys/mman.h>
#endif
+#if defined(OS_FREEBSD)
+#include <sys/mman.h>
+#include <fcntl.h>
+
+#include "base/posix/eintr_wrapper.h"
+#endif
+
#include <algorithm>
#include <limits>
@@ -50,6 +57,14 @@ void DecommitPages(void* address, size_t size) {
void* ptr = mmap(address, size, PROT_NONE,
MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
PA_CHECK(ptr == address);
+#elif defined(OS_FREEBSD)
+ int fd = HANDLE_EINTR(open("/dev/zero", O_RDONLY));
+ PA_CHECK(fd != -1);
+
+ void *ptr = mmap(address, size, PROT_NONE,
+ MAP_FIXED | MAP_PRIVATE, fd, 0);
+ PA_PCHECK(ptr == address);
+ HANDLE_EINTR(close(fd));
#else
DecommitSystemPages(address, size, PageUpdatePermissions);
#endif

View file

@ -1,58 +0,0 @@
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2021-07-15 19:13:29 UTC
+++ base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -28,12 +28,16 @@
#if defined(OS_ANDROID)
#include <sys/prctl.h>
#endif
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
#include <sys/resource.h>
#include <algorithm>
#endif
+#if defined(OS_FREEBSD)
+#include <fcntl.h>
+#endif
+
#include "base/allocator/partition_allocator/page_allocator.h"
#ifndef MAP_ANONYMOUS
@@ -153,12 +157,19 @@ void* SystemAllocPagesInternal(void* hint,
PA_DCHECK(PageTag::kFirst <= page_tag);
PA_DCHECK(PageTag::kLast >= page_tag);
int fd = VM_MAKE_TAG(static_cast<int>(page_tag));
+#elif defined(OS_FREEBSD)
+ int fd = HANDLE_EINTR(open("/dev/zero", O_RDWR | O_CLOEXEC));
+ PA_PCHECK(fd != -1);
#else
int fd = -1;
#endif
int access_flag = GetAccessFlags(accessibility);
+#if defined(OS_FREEBSD)
+ int map_flags = MAP_PRIVATE;
+#else
int map_flags = MAP_ANONYMOUS | MAP_PRIVATE;
+#endif
#if defined(OS_APPLE)
// On macOS 10.14 and higher, executables that are code signed with the
@@ -185,6 +196,8 @@ void* SystemAllocPagesInternal(void* hint,
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ret, length,
PageTagToName(page_tag));
}
+#elif defined(OS_FREEBSD)
+ HANDLE_EINTR(close(fd));
#endif
return ret;
@@ -317,6 +330,8 @@ void DiscardSystemPagesInternal(void* address, size_t
ret = madvise(address, length, MADV_DONTNEED);
}
PA_PCHECK(ret == 0);
+#elif defined(OS_FREEBSD)
+ PA_PCHECK(0 == madvise(address, length, MADV_FREE));
#else
// We have experimented with other flags, but with suboptimal results.
//

View file

@ -1,15 +0,0 @@
--- base/allocator/partition_allocator/partition_alloc.cc.orig 2021-04-14 01:08:36 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 == 983040, "generic max bucketed");
STATIC_ASSERT_OR_PA_CHECK(
MaxSystemPagesPerSlotSpan() < (1 << 8),

View file

@ -1,17 +0,0 @@
--- base/allocator/partition_allocator/partition_alloc_config.h.orig 2021-07-15 19:13:29 UTC
+++ base/allocator/partition_allocator/partition_alloc_config.h
@@ -34,9 +34,13 @@ static_assert(sizeof(void*) != 8, "");
#define PA_HAS_LINUX_KERNEL
#endif
+#if defined(OS_FREEBSD)
+#define PA_HAS_FREEBSD_KERNEL
+#endif
+
// SpinningMutex uses either futex(2) on Linux, or a fast userspace "try"
// operation, which is available on Windows.
-#if defined(PA_HAS_LINUX_KERNEL) || defined(OS_WIN)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL) || defined(OS_WIN)
#define PA_HAS_SPINNING_MUTEX
#endif

View file

@ -1,20 +0,0 @@
--- base/allocator/partition_allocator/partition_alloc_unittest.cc.orig 2021-11-13 11:05:57 UTC
+++ base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -1659,7 +1659,7 @@ TEST_F(PartitionAllocTest, LostFreeSlotSpansBug) {
// cause flake.
#if !defined(OS_WIN) && \
(!defined(ARCH_CPU_64_BITS) || \
- (defined(OS_POSIX) && !(defined(OS_APPLE) || defined(OS_ANDROID))))
+ (defined(OS_POSIX) && !(defined(OS_APPLE) || defined(OS_ANDROID) || defined(OS_BSD))))
// The following four tests wrap a called function in an expect death statement
// to perform their test, because they are non-hermetic. Specifically they are
@@ -1710,7 +1710,7 @@ TEST_F(PartitionAllocDeathTest, DISABLED_RepeatedTryRe
}
#endif // !defined(ARCH_CPU_64_BITS) || (defined(OS_POSIX) &&
- // !(defined(OS_APPLE) || defined(OS_ANDROID)))
+ // !(defined(OS_APPLE) || defined(OS_ANDROID) || defined(OS_BSD)))
// Make sure that malloc(-1) dies.
// In the past, we had an integer overflow that would alias malloc(-1) to

View file

@ -1,47 +0,0 @@
--- base/allocator/partition_allocator/partition_root.cc.orig 2021-07-15 19:13:29 UTC
+++ base/allocator/partition_allocator/partition_root.cc
@@ -22,7 +22,7 @@
#include "wow64apiset.h"
#endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
#include <pthread.h>
#endif
@@ -36,7 +36,7 @@ namespace {
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
// NO_THREAD_SAFETY_ANALYSIS: acquires the lock and doesn't release it, by
// design.
@@ -89,7 +89,7 @@ void AfterForkInChild() {
internal::ThreadCacheRegistry::Instance()
.ForcePurgeAllThreadAfterForkUnsafe();
}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_BSD)
std::atomic<bool> g_global_init_called;
void PartitionAllocMallocInitOnce() {
@@ -99,7 +99,7 @@ void PartitionAllocMallocInitOnce() {
if (!g_global_init_called.compare_exchange_strong(expected, true))
return;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
// When fork() is called, only the current thread continues to execute in the
// child process. If the lock is held, but *not* by this thread when fork() is
// called, we have a deadlock.
@@ -124,7 +124,7 @@ void PartitionAllocMallocInitOnce() {
int err =
pthread_atfork(BeforeForkInParent, AfterForkInParent, AfterForkInChild);
PA_CHECK(err == 0);
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_BSD)
}
#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)

View file

@ -1,49 +0,0 @@
--- base/allocator/partition_allocator/spinning_mutex.cc.orig 2021-04-14 01:08:36 UTC
+++ base/allocator/partition_allocator/spinning_mutex.cc
@@ -16,9 +16,16 @@
#include <unistd.h>
#endif // defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_FREEBSD_KERNEL)
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/thr.h>
+#include <sys/umtx.h>
+#endif // defined(PA_HAS_FREEBSD_KERNEL)
+
namespace base {
namespace internal {
-#if defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL)
void SpinningMutex::FutexWait() {
// Save and restore errno.
@@ -42,8 +49,13 @@ void SpinningMutex::FutexWait() {
// |kLockedContended| anymore. Note that even without spurious wakeups, the
// value of |state_| is not guaranteed when this returns, as another thread
// may get the lock before we get to run.
+#if defined(PA_HAS_LINUX_KERNEL)
int err = syscall(SYS_futex, &state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
kLockedContended, nullptr, nullptr, 0);
+#elif defined(PA_HAS_FREEBSD_KERNEL)
+ int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE,
+ kLockedContended, nullptr, nullptr);
+#endif
if (err) {
// These are programming error, check them.
@@ -55,8 +67,14 @@ void SpinningMutex::FutexWait() {
void SpinningMutex::FutexWake() {
int saved_errno = errno;
+#if defined(PA_HAS_LINUX_KERNEL)
long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
1 /* wake up a single waiter */, nullptr, nullptr, 0);
+#elif defined(PA_HAS_FREEBSD_KERNEL)
+ long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE,
+ 1 /* wake up a single waiter */, nullptr, nullptr);
+#endif
+
PA_CHECK(retval != -1);
errno = saved_errno;
}

View file

@ -1,20 +0,0 @@
--- base/allocator/partition_allocator/spinning_mutex.h.orig 2021-07-15 19:13:29 UTC
+++ base/allocator/partition_allocator/spinning_mutex.h
@@ -59,7 +59,7 @@ class LOCKABLE BASE_EXPORT SpinningMutex {
// as the slow path has better characteristics than SpinLocks's.
static constexpr int kSpinCount = 1000;
-#if defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL)
void FutexWait();
void FutexWake();
@@ -104,7 +104,7 @@ ALWAYS_INLINE void SpinningMutex::Acquire() {
inline constexpr SpinningMutex::SpinningMutex() = default;
-#if defined(PA_HAS_LINUX_KERNEL)
+#if defined(PA_HAS_LINUX_KERNEL) || defined(PA_HAS_FREEBSD_KERNEL)
ALWAYS_INLINE bool SpinningMutex::Try() {
// Using the weak variant of compare_exchange(), which may fail spuriously. On

View file

@ -1,11 +0,0 @@
--- base/allocator/partition_allocator/starscan/pcscan.cc.orig 2021-07-15 19:13:29 UTC
+++ base/allocator/partition_allocator/starscan/pcscan.cc
@@ -67,7 +67,7 @@ namespace internal {
namespace {
-#if DCHECK_IS_ON() && defined(OS_LINUX)
+#if DCHECK_IS_ON() && (defined(OS_LINUX) || defined(OS_BSD))
// Currently, check reentracy only on Linux. On Android TLS is emulated by the
// runtime lib, which can allocate and therefore cause reentrancy.
struct ReentrantScannerGuard final {

View file

@ -1,22 +0,0 @@
--- base/base_switches.cc.orig 2021-07-15 19:13:29 UTC
+++ base/base_switches.cc
@@ -125,8 +125,8 @@ const char kDisableUsbKeyboardDetect[] = "disable
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
-#if defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \
- !BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_BSD) || (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \
+ !BUILDFLAG(IS_CHROMEOS_LACROS))
// The /dev/shm partition is too small in certain VM environments, causing
// Chrome to fail or crash (see http://crbug.com/715363). Use this flag to
// work-around this issue (a temporary directory will always be used to create
@@ -161,7 +161,7 @@ const char kForceFieldTrialParams[] = "force-fieldtria
#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.
//

View file

@ -1,22 +0,0 @@
--- base/base_switches.h.orig 2021-07-15 19:13:29 UTC
+++ base/base_switches.h
@@ -42,8 +42,8 @@ extern const char kDisableUsbKeyboardDetect[];
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
-#if defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \
- !BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(OS_BSD) || (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \
+ !BUILDFLAG(IS_CHROMEOS_LACROS))
extern const char kDisableDevShmUsage[];
#endif
@@ -59,7 +59,7 @@ extern const char kEnableIdleTracing[];
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

View file

@ -1,11 +0,0 @@
--- base/check.h.orig 2021-07-15 19:13:29 UTC
+++ base/check.h
@@ -85,7 +85,7 @@ class BASE_EXPORT CheckError {
// Stream for adding optional details to the error message.
std::ostream& stream();
- NOMERGE ~CheckError();
+ ~CheckError();
CheckError(const CheckError& other) = delete;
CheckError& operator=(const CheckError& other) = delete;

View file

@ -1,35 +0,0 @@
--- base/cpu.cc.orig 2021-07-15 19:13:29 UTC
+++ base/cpu.cc
@@ -16,7 +16,7 @@
#include "base/stl_util.h"
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \
defined(OS_AIX)
#include "base/containers/flat_set.h"
#include "base/files/file_util.h"
@@ -214,6 +214,14 @@ const ProcCpuInfo& ParseProcCpu() {
return *info;
}
+#elif defined(OS_BSD)
+std::string* CpuInfoBrand() {
+ static std::string* brand = []() {
+ return new std::string(SysInfo::CPUModelName());
+ }();
+
+ return brand;
+}
#endif // defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) ||
// defined(OS_LINUX) || defined(OS_CHROMEOS))
@@ -352,6 +360,8 @@ void CPU::Initialize(bool require_branding) {
has_bti_ = hwcap2 & HWCAP2_BTI;
#endif
+#elif defined(OS_BSD)
+ cpu_brand_ = *CpuInfoBrand();
#elif defined(OS_WIN)
// Windows makes high-resolution thread timing information available in
// user-space.

View file

@ -1,20 +0,0 @@
--- base/cpu.h.orig 2021-07-15 19:13:29 UTC
+++ base/cpu.h
@@ -92,7 +92,7 @@ class BASE_EXPORT CPU final {
IntelMicroArchitecture GetIntelMicroArchitecture() const;
const std::string& cpu_brand() const { return cpu_brand_; }
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \
defined(OS_AIX)
enum class CoreType {
kUnknown = 0,
@@ -143,7 +143,7 @@ class BASE_EXPORT CPU final {
// cpuidle driver.
using CoreIdleTimes = std::vector<TimeDelta>;
static bool GetCumulativeCoreIdleTimes(CoreIdleTimes&);
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ||
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
// defined(OS_AIX)
private:

View file

@ -1,56 +0,0 @@
--- base/debug/debugger_posix.cc.orig 2021-01-07 00:36:18 UTC
+++ base/debug/debugger_posix.cc
@@ -98,7 +98,7 @@ bool BeingDebugged() {
KERN_PROC,
KERN_PROC_PID,
getpid()
-#if defined(OS_OPENBSD)
+#if defined(OS_BSD)
, sizeof(struct kinfo_proc),
0
#endif
@@ -106,33 +106,35 @@ bool BeingDebugged() {
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
// binary interfaces may change.
- struct kinfo_proc info;
- size_t info_size = sizeof(info);
+ struct kinfo_proc *info;
+ size_t info_size;
-#if defined(OS_OPENBSD)
if (sysctl(mib, base::size(mib), NULL, &info_size, NULL, 0) < 0)
return -1;
+ info = (struct kinfo_proc *)malloc(info_size);
mib[5] = (info_size / sizeof(struct kinfo_proc));
-#endif
- int sysctl_result = sysctl(mib, base::size(mib), &info, &info_size, NULL, 0);
+ int sysctl_result = sysctl(mib, base::size(mib), info, &info_size, NULL, 0);
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;
+ being_debugged = (info->ki_flag & P_TRACED) != 0;
#elif defined(OS_BSD)
- being_debugged = (info.p_flag & P_TRACED) != 0;
+ being_debugged = (info->p_flag & P_TRACED) != 0;
#else
- being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
+ being_debugged = (info->kp_proc.p_flag & P_TRACED) != 0;
#endif
+
+out:
+ free(info);
return being_debugged;
}

View file

@ -1,28 +0,0 @@
--- base/debug/elf_reader.cc.orig 2021-07-15 19:13:29 UTC
+++ base/debug/elf_reader.cc
@@ -38,7 +38,9 @@ using Nhdr = Elf64_Nhdr;
using Word = Elf64_Word;
#endif
+#if !defined(OS_BSD)
constexpr char kGnuNoteName[] = "GNU";
+#endif
// Returns a pointer to the header of the ELF binary mapped into memory, or a
// null pointer if the header is invalid. Here and below |elf_mapped_base| is a
@@ -75,6 +77,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);
@@ -84,6 +87,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) +

View file

@ -1,141 +0,0 @@
--- base/debug/proc_maps_linux.cc.orig 2021-04-14 01:08:36 UTC
+++ base/debug/proc_maps_linux.cc
@@ -13,13 +13,18 @@
#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
namespace base {
namespace debug {
+#if defined(OS_BSD)
+const char kProcSelfMapsPath[] = "/proc/curproc/map";
+#else
+const char kProcSelfMapsPath[] = "/proc/self/maps";
+
// Scans |proc_maps| starting from |pos| returning true if the gate VMA was
// found, otherwise returns false.
static bool ContainsGateVMA(std::string* proc_maps, size_t pos) {
@@ -35,15 +40,16 @@ static bool ContainsGateVMA(std::string* proc_maps, si
return false;
#endif
}
+#endif
bool ReadProcMaps(std::string* proc_maps) {
// seq_file only writes out a page-sized amount on each call. Refer to header
// file for details.
const long kReadSize = sysconf(_SC_PAGESIZE);
- base::ScopedFD fd(HANDLE_EINTR(open("/proc/self/maps", O_RDONLY)));
+ base::ScopedFD fd(HANDLE_EINTR(open(kProcSelfMapsPath, O_RDONLY)));
if (!fd.is_valid()) {
- DPLOG(ERROR) << "Couldn't open /proc/self/maps";
+ DPLOG(ERROR) << "Couldn't open " << kProcSelfMapsPath;
return false;
}
proc_maps->clear();
@@ -57,7 +63,7 @@ bool ReadProcMaps(std::string* proc_maps) {
ssize_t bytes_read = HANDLE_EINTR(read(fd.get(), buffer, kReadSize));
if (bytes_read < 0) {
- DPLOG(ERROR) << "Couldn't read /proc/self/maps";
+ DPLOG(ERROR) << "Couldn't read " << kProcSelfMapsPath;
proc_maps->clear();
return false;
}
@@ -68,6 +74,7 @@ bool ReadProcMaps(std::string* proc_maps) {
if (bytes_read == 0)
break;
+#if !defined(OS_BSD)
// The gate VMA is handled as a special case after seq_file has finished
// iterating through all entries in the virtual memory table.
//
@@ -78,6 +85,7 @@ bool ReadProcMaps(std::string* proc_maps) {
// Avoid this by searching for the gate VMA and breaking early.
if (ContainsGateVMA(proc_maps, pos))
break;
+#endif
}
return true;
@@ -105,11 +113,32 @@ bool ParseProcMaps(const std::string& input,
MappedMemoryRegion region;
const char* line = lines[i].c_str();
- char permissions[5] = {'\0'}; // Ensure NUL-terminated string.
+ char permissions[6] = {'\0'}; // Ensure NUL-terminated string.
+ int path_index = 0;
+
+#if defined(OS_BSD)
+ if (lines[i].empty())
+ continue;
+
+ char cow;
+
+ // Format:
+ //
+ // start end resident private_resident obj perms ref_count shadow_count flags cow needs_copy type fullpath cred ruid
+ // 0x200000 0x202000 2 6 0xfffff80005be9000 r-- 3 1 0x1000 COW NC vnode /bin/cat NCH -1
+ //
+ if (sscanf(line, "%" SCNxPTR " %" SCNxPTR " %*ld %*ld %*[^ ] %5[^ ] %*d %*d %*x %c%*s %*s %*s %n",
+ &region.start, &region.end, permissions, &cow, &path_index) < 4) {
+ DPLOG(WARNING) << "sscanf failed for line: " << line;
+ return false;
+ }
+
+ const char* fullpath = line + path_index;
+ const char* cred = strchr(fullpath, ' ');
+#else
uint8_t dev_major = 0;
uint8_t dev_minor = 0;
long inode = 0;
- int path_index = 0;
// Sample format from man 5 proc:
//
@@ -125,6 +154,7 @@ bool ParseProcMaps(const std::string& input,
DPLOG(WARNING) << "sscanf failed for line: " << line;
return false;
}
+#endif
region.permissions = 0;
@@ -143,14 +173,31 @@ bool ParseProcMaps(const std::string& input,
else if (permissions[2] != '-')
return false;
+#if defined(OS_BSD)
+ if (cow == 'C') {
+ region.permissions |= MappedMemoryRegion::PRIVATE;
+ } else if (cow != 'N') {
+ DPLOG(WARNING) << "unknown value for COW in line " << line << ": " << cow;
+ return false;
+ }
+#else
if (permissions[3] == 'p')
region.permissions |= MappedMemoryRegion::PRIVATE;
else if (permissions[3] != 's' && permissions[3] != 'S') // Shared memory.
return false;
+#endif
// Pushing then assigning saves us a string copy.
regions.push_back(region);
+#if defined(OS_BSD)
+ if (cred != nullptr) {
+ regions.back().path.assign(line + path_index, cred - fullpath);
+ } else {
+ regions.back().path.assign(line + path_index);
+ }
+#else
regions.back().path.assign(line + path_index);
+#endif
}
regions_out->swap(regions);

View file

@ -1,11 +0,0 @@
--- base/debug/stack_trace.cc.orig 2021-01-07 00:36:18 UTC
+++ base/debug/stack_trace.cc
@@ -15,7 +15,7 @@
#if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS)
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
#include <pthread.h>
#include "base/process/process_handle.h"
#include "base/threading/platform_thread.h"

View file

@ -1,10 +0,0 @@
--- base/debug/stack_trace.h.orig 2021-01-07 00:36:18 UTC
+++ base/debug/stack_trace.h
@@ -19,6 +19,7 @@
#if !defined(OS_NACL)
#include <signal.h>
#endif
+#include <sys/stdint.h>
#include <unistd.h>
#endif

View file

@ -1,45 +0,0 @@
--- base/debug/stack_trace_posix.cc.orig 2021-04-14 01:08:36 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
@@ -659,13 +659,21 @@ class SandboxSymbolizeHelper {
// Reads /proc/self/maps.
std::string contents;
if (!ReadProcMaps(&contents)) {
+#if defined(OS_BSD)
+ LOG(ERROR) << "Failed to read /proc/curproc/map";
+#else
LOG(ERROR) << "Failed to read /proc/self/maps";
+#endif
return false;
}
// Parses /proc/self/maps.
if (!ParseProcMaps(contents, &regions_)) {
+#if defined(OS_BSD)
+ LOG(ERROR) << "Failed to parse the contents of /proc/curproc/map";
+#else
LOG(ERROR) << "Failed to parse the contents of /proc/self/maps";
+#endif
return false;
}
@@ -696,7 +704,11 @@ class SandboxSymbolizeHelper {
// Skip regions with empty file names.
continue;
}
+#if defined(OS_BSD)
+ if (region.path[0] == '-') {
+#else
if (region.path[0] == '[') {
+#endif
// Skip pseudo-paths, like [stack], [vdso], [heap], etc ...
continue;
}

View file

@ -1,40 +0,0 @@
--- base/debug/stack_trace_unittest.cc.orig 2021-04-14 01:08:36 UTC
+++ base/debug/stack_trace_unittest.cc
@@ -88,6 +88,7 @@ TEST_F(StackTraceTest, OutputToStream) {
std::string::npos)
<< "Unable to resolve symbols.";
+#if !defined(OS_BSD)
// Expect a demangled symbol.
// Note that Windows Release builds omit the function parameters from the
// demangled stack output, otherwise this could be "testing::UnitTest::Run()".
@@ -106,9 +107,10 @@ TEST_F(StackTraceTest, OutputToStream) {
EXPECT_TRUE(backtrace_message.find(__func__) != std::string::npos)
<< "Expected to find " << __func__ << " in backtrace:\n"
<< backtrace_message;
+#endif
}
-#if !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES)
+#if !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) && !defined(OS_BSD)
// Disabled in Official builds, where Link-Time Optimization can result in two
// or fewer stack frames being available, causing the test to fail.
TEST_F(StackTraceTest, TruncatedTrace) {
@@ -122,7 +124,7 @@ TEST_F(StackTraceTest, TruncatedTrace) {
truncated.Addresses(&count);
EXPECT_EQ(2u, count);
}
-#endif // !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES)
+#endif // !defined(OFFICIAL_BUILD) && !defined(NO_UNWIND_TABLES) && !defined(OS_BSD)
// The test is used for manual testing, e.g., to see the raw output.
TEST_F(StackTraceTest, DebugOutputToStream) {
@@ -361,7 +363,7 @@ TEST_F(StackTraceTest, MAYBE_TraceStackFramePointers)
// sometimes we read fp / pc from the place that previously held
// uninitialized value.
// TODO(crbug.com/1132511): Enable this test on Fuchsia.
-#if defined(MEMORY_SANITIZER) || defined(OS_FUCHSIA)
+#if defined(MEMORY_SANITIZER) || defined(OS_FUCHSIA) || defined(OS_BSD)
#define MAYBE_TraceStackFramePointersFromBuffer \
DISABLED_TraceStackFramePointersFromBuffer
#else

View file

@ -1,11 +0,0 @@
--- base/files/file_path_unittest.cc.orig 2021-07-15 19:13:29 UTC
+++ base/files/file_path_unittest.cc
@@ -1179,7 +1179,7 @@ TEST_F(FilePathTest, FromUTF8Unsafe_And_AsUTF8Unsafe)
"\xEF\xBC\xA1\xEF\xBC\xA2\xEF\xBC\xA3.txt" },
};
-#if !defined(SYSTEM_NATIVE_UTF8) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
+#if !defined(SYSTEM_NATIVE_UTF8) && (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD))
ScopedLocale locale("en_US.UTF-8");
#endif

View file

@ -1,64 +0,0 @@
--- base/files/file_path_watcher_freebsd.cc.orig 2021-04-22 07:53:22 UTC
+++ base/files/file_path_watcher_freebsd.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file exists for Unix systems which don't have the inotify headers, and
+// thus cannot build file_watcher_inotify.cc
+
+#include <memory>
+
+#include "base/files/file_path_watcher.h"
+#include "base/files/file_path_watcher_kqueue.h"
+
+#include "base/memory/ptr_util.h"
+#include "build/build_config.h"
+
+namespace base {
+
+namespace {
+
+class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
+ public:
+ FilePathWatcherImpl() = default;
+ FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
+ FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
+ ~FilePathWatcherImpl() override = default;
+
+ bool Watch(const FilePath& path,
+ Type type,
+ const FilePathWatcher::Callback& callback) override {
+ DCHECK(!impl_.get());
+
+ if (type == Type::kRecursive) {
+ return false;
+ } else {
+ impl_ = std::make_unique<FilePathWatcherKQueue>();
+ }
+
+ DCHECK(impl_.get());
+
+ return impl_->Watch(path, type, callback);
+ }
+
+ void Cancel() override {
+ if (impl_.get())
+ impl_->Cancel();
+
+ set_cancelled();
+ }
+
+ private:
+ std::unique_ptr<PlatformDelegate> impl_;
+};
+
+} // namespace
+
+FilePathWatcher::FilePathWatcher() {
+ sequence_checker_.DetachFromSequence();
+ impl_ = std::make_unique<FilePathWatcherImpl>();
+}
+
+} // namespace base

View file

@ -1,13 +0,0 @@
--- base/files/file_path_watcher_kqueue.h.orig 2021-01-07 00:36:18 UTC
+++ base/files/file_path_watcher_kqueue.h
@@ -5,6 +5,10 @@
#ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
#define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
+#ifdef __FreeBSD__
+#include <sys/stdint.h>
+#include <sys/types.h>
+#endif
#include <sys/event.h>
#include <memory>

View file

@ -1,56 +0,0 @@
--- base/files/file_path_watcher_unittest.cc.orig 2021-07-15 19:13:29 UTC
+++ base/files/file_path_watcher_unittest.cc
@@ -452,12 +452,12 @@ TEST_F(FilePathWatcherTest, WatchDirectory) {
VLOG(1) << "Waiting for file1 creation";
ASSERT_TRUE(WaitForEvents());
-#if !defined(OS_APPLE)
+#if !defined(OS_APPLE) && !defined(OS_BSD)
// Mac implementation does not detect files modified in a directory.
ASSERT_TRUE(WriteFile(file1, "content v2"));
VLOG(1) << "Waiting for file1 modification";
ASSERT_TRUE(WaitForEvents());
-#endif // !OS_APPLE
+#endif // !OS_APPLE && !OS_BSD
ASSERT_TRUE(base::DeleteFile(file1));
VLOG(1) << "Waiting for file1 deletion";
@@ -1034,7 +1034,7 @@ TEST_F(FilePathWatcherTest, InotifyLimitInUpdateRecurs
}
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
enum Permission {
Read,
@@ -1042,7 +1042,7 @@ enum Permission {
Execute
};
-#if defined(OS_APPLE)
+#if defined(OS_APPLE) || defined(OS_BSD)
bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
struct stat stat_buf;
@@ -1071,9 +1071,9 @@ bool ChangeFilePermissions(const FilePath& path, Permi
}
return chmod(path.value().c_str(), stat_buf.st_mode) == 0;
}
-#endif // defined(OS_APPLE)
+#endif // defined(OS_APPLE) || defined(OS_BSD)
-#if defined(OS_APPLE)
+#if defined(OS_APPLE) || defined(OS_BSD)
// Linux implementation of FilePathWatcher doesn't catch attribute changes.
// http://crbug.com/78043
// Windows implementation of FilePathWatcher catches attribute changes that
@@ -1109,7 +1109,7 @@ TEST_F(FilePathWatcherTest, DirAttributesChanged) {
ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true));
}
-#endif // OS_APPLE
+#endif // OS_APPLE || OS_BSD
#if defined(OS_MAC)

View file

@ -1,28 +0,0 @@
--- base/files/file_util.h.orig 2021-07-15 19:13:29 UTC
+++ base/files/file_util.h
@@ -283,14 +283,14 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePat
BASE_EXPORT bool ExecutableExistsInPath(Environment* env,
const FilePath::StringType& executable);
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
// Determine if files under a given |path| can be mapped and then mprotect'd
// PROT_EXEC. This depends on the mount options used for |path|, which vary
// among different Linux distributions and possibly local configuration. It also
// depends on details of kernel--ChromeOS uses the noexec option for /dev/shm
// but its kernel allows mprotect with PROT_EXEC anyway.
BASE_EXPORT bool IsPathExecutable(const FilePath& path);
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
#endif // OS_POSIX
@@ -602,7 +602,7 @@ BASE_EXPORT bool VerifyPathControlledByAdmin(const bas
// the directory |path|, in the number of FilePath::CharType, or -1 on failure.
BASE_EXPORT int GetMaximumPathComponentLength(const base::FilePath& path);
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
// Broad categories of file systems as returned by statfs() on Linux.
enum FileSystemType {
FILE_SYSTEM_UNKNOWN, // statfs failed.

View file

@ -1,78 +0,0 @@
--- base/files/file_util_posix.cc.orig 2021-07-15 19:13:29 UTC
+++ base/files/file_util_posix.cc
@@ -384,7 +384,7 @@ bool CreatePipe(ScopedFD* read_fd, ScopedFD* write_fd,
}
bool CreateLocalNonBlockingPipe(int fds[2]) {
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0;
#else
int raw_fds[2];
@@ -932,8 +932,12 @@ bool AllocateFileRegion(File* file, int64_t offset, si
// space. It can fail because the filesystem doesn't support it. In that case,
// use the manual method below.
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
+#if defined(OS_BSD)
+ if (HANDLE_EINTR(posix_fallocate(file->GetPlatformFile(), offset, size)) != -1)
+#else
if (HANDLE_EINTR(fallocate(file->GetPlatformFile(), 0, offset, size)) != -1)
+#endif
return true;
DPLOG(ERROR) << "fallocate";
#elif defined(OS_APPLE)
@@ -1103,7 +1107,7 @@ int GetMaximumPathComponentLength(const FilePath& path
#if !defined(OS_ANDROID)
// This is implemented in file_util_android.cc for that platform.
bool GetShmemTempDir(bool executable, FilePath* path) {
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
bool disable_dev_shm = false;
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
disable_dev_shm = CommandLine::ForCurrentProcess()->HasSwitch(
@@ -1119,7 +1123,7 @@ bool GetShmemTempDir(bool executable, FilePath* path)
*path = FilePath("/dev/shm");
return true;
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
return GetTempDir(path);
}
#endif // !defined(OS_ANDROID)
@@ -1157,7 +1161,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
// posix_fadvise() is only available in the Android NDK in API 21+. Older
// versions may have the required kernel support, but don't have enough usage
// to justify backporting.
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || \
(defined(OS_ANDROID) && __ANDROID_API__ >= 21)
File file(file_path, File::FLAG_OPEN | File::FLAG_READ);
if (!file.IsValid())
@@ -1193,7 +1197,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
return internal::PreReadFileSlow(file_path, max_bytes)
? PrefetchResult{PrefetchResultCode::kSlowSuccess}
: PrefetchResult{PrefetchResultCode::kSlowFailed};
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || (defined(OS_ANDROID) &&
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || (defined(OS_ANDROID) &&
// __ANDROID_API__ >= 21)
}
@@ -1263,7 +1267,7 @@ bool CopyFileContentsWithSendfile(File& infile,
#endif // !defined(OS_NACL_NONSFI)
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
BASE_EXPORT bool IsPathExecutable(const FilePath& path) {
bool result = false;
FilePath tmp_file_path;
@@ -1284,6 +1288,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path
}
return result;
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_BSD)
} // namespace base

View file

@ -1,38 +0,0 @@
--- base/files/file_util_unittest.cc.orig 2021-04-14 01:08:36 UTC
+++ base/files/file_util_unittest.cc
@@ -1638,7 +1638,7 @@ TEST_F(FileUtilTest, DeleteDirRecursiveWithOpenFile) {
#endif
}
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
// This test will validate that files which would block when read result in a
// failure on a call to ReadFileToStringNonBlocking. To accomplish this we will
// use a named pipe because it appears as a file on disk and we can control how
@@ -1671,7 +1671,7 @@ TEST_F(FileUtilTest, TestNonBlockingFileReadLinux) {
ASSERT_EQ(result.size(), 1u);
EXPECT_EQ(result[0], 'a');
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
TEST_F(FileUtilTest, MoveFileNew) {
// Create a file
@@ -3506,7 +3506,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithNamedPipe) {
}
#endif // defined(OS_WIN)
-#if defined(OS_POSIX) && !defined(OS_APPLE)
+#if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_BSD)
TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) {
FilePath file_path("/proc/cpuinfo");
std::string data = "temp";
@@ -3524,7 +3524,7 @@ TEST_F(FileUtilTest, ReadFileToStringWithProcFileSyste
EXPECT_FALSE(ReadFileToStringWithMaxSize(file_path, nullptr, 4));
}
-#endif // defined(OS_POSIX) && !defined(OS_APPLE)
+#endif // defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_BSD)
TEST_F(FileUtilTest, ReadFileToStringWithLargeFile) {
std::string data(kLargeFileSize, 'c');

View file

@ -1,11 +0,0 @@
--- base/files/scoped_file.cc.orig 2021-01-07 00:36:18 UTC
+++ base/files/scoped_file.cc
@@ -30,7 +30,7 @@ void ScopedFDCloseTraits::Free(int fd) {
// a single open directory would bypass the entire security model.
int ret = IGNORE_EINTR(close(fd));
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE) || \
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || defined(OS_APPLE) || \
defined(OS_FUCHSIA) || defined(OS_ANDROID)
// NB: Some file descriptors can return errors from close() e.g. network
// filesystems such as NFS and Linux input devices. On Linux, macOS, and

View file

@ -1,20 +0,0 @@
--- base/i18n/icu_util.cc.orig 2021-07-15 19:13:29 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,7 @@ 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().

View file

@ -1,38 +0,0 @@
--- base/linux_util.cc.orig 2021-04-14 01:08:36 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"
@@ -79,6 +80,9 @@ class DistroNameGetter {
public:
DistroNameGetter() {
static const char* const kFilesToCheck[] = {"/etc/os-release",
+#if defined(OS_BSD)
+ "/usr/local/etc/os-release",
+#endif
"/usr/lib/os-release"};
for (const char* file : kFilesToCheck) {
if (ReadDistroFromOSReleaseFile(file))
@@ -135,6 +139,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);
@@ -154,6 +161,7 @@ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t
}
return true;
+#endif
}
pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,

View file

@ -1,11 +0,0 @@
--- base/location_unittest.cc.orig 2021-01-07 00:36:18 UTC
+++ base/location_unittest.cc
@@ -32,7 +32,7 @@ TEST(LocationTest, CurrentYieldsCorrectValue) {
EXPECT_EQ(here.line_number(), previous_line + 1);
EXPECT_STREQ("TestBody", here.function_name());
#endif
-#elif defined(OFFICIAL_BUILD)
+#elif defined(OFFICIAL_BUILD) && !defined(OS_BSD)
#error Location builtins must be supported in official builds.
#elif BUILDFLAG(FROM_HERE_USES_LOCATION_BUILTINS)
#error FROM_HERE requires location builtins to be supported.

View file

@ -1,20 +0,0 @@
--- base/logging_unittest.cc.orig 2021-07-15 19:13:29 UTC
+++ base/logging_unittest.cc
@@ -32,7 +32,7 @@
#include "base/posix/eintr_wrapper.h"
#endif // OS_POSIX
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
#include <ucontext.h>
#endif
@@ -557,7 +557,7 @@ void CheckCrashTestSighandler(int, siginfo_t* info, vo
// need the arch-specific boilerplate below, which is inspired by breakpad.
// At the same time, on OSX, ucontext.h is deprecated but si_addr works fine.
uintptr_t crash_addr = 0;
-#if defined(OS_MAC)
+#if defined(OS_MAC) || defined(OS_BSD)
crash_addr = reinterpret_cast<uintptr_t>(info->si_addr);
#else // OS_*
ucontext_t* context = reinterpret_cast<ucontext_t*>(context_ptr);

View file

@ -1,63 +0,0 @@
--- base/memory/discardable_memory.cc.orig 2021-07-15 19:13:29 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};
@@ -42,13 +42,13 @@ const base::FeatureParam<DiscardableMemoryTrialGroup>
DiscardableMemoryTrialGroup::kEmulatedSharedMemory,
&kDiscardableMemoryBackingParamOptions};
-#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
} // namespace features
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 =
@@ -62,11 +62,11 @@ DiscardableMemoryBacking GetBackingForFieldTrial() {
}
NOTREACHED();
}
-#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
} // 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.
@@ -88,18 +88,18 @@ DiscardableMemoryTrialGroup GetDiscardableMemoryBackin
DCHECK(DiscardableMemoryBackingFieldTrialIsEnabled());
return features::kDiscardableMemoryBackingParam.Get();
}
-#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
DiscardableMemory::DiscardableMemory() = default;
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();
}
-#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
#if defined(OS_ANDROID)
if (ashmem_device_is_supported())

View file

@ -1,19 +0,0 @@
--- base/memory/discardable_memory_internal.h.orig 2021-01-07 00:36:18 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 {
@@ -47,6 +47,6 @@ GetDiscardableMemoryBackingFieldTrialGroup();
} // namespace base
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
#endif // BASE_MEMORY_DISCARDABLE_MEMORY_INTERNAL_H_

View file

@ -1,11 +0,0 @@
--- base/memory/madv_free_discardable_memory_posix.cc.orig 2021-01-07 00:36:18 UTC
+++ base/memory/madv_free_discardable_memory_posix.cc
@@ -292,7 +292,7 @@ void MadvFreeDiscardableMemoryPosix::SetKeepMemoryForT
bool MadvFreeDiscardableMemoryPosix::IsResident() const {
DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_);
-#if defined(OS_APPLE)
+#if defined(OS_APPLE) || defined(OS_BSD)
std::vector<char> vec(allocated_pages_);
#else
std::vector<unsigned char> vec(allocated_pages_);

View file

@ -1,29 +0,0 @@
--- base/memory/platform_shared_memory_region.h.orig 2021-01-07 00:36:18 UTC
+++ base/memory/platform_shared_memory_region.h
@@ -27,7 +27,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;
}
@@ -120,7 +120,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

View file

@ -1,100 +0,0 @@
--- base/memory/platform_shared_memory_region_posix.cc.orig 2021-04-14 01:08:36 UTC
+++ base/memory/platform_shared_memory_region_posix.cc
@@ -23,7 +23,11 @@ struct ScopedPathUnlinkerTraits {
static const FilePath* InvalidValue() { return nullptr; }
static void Free(const FilePath* path) {
+#if defined(OS_BSD)
+ if (shm_unlink(path->value().c_str()))
+#else
if (unlink(path->value().c_str()))
+#endif
PLOG(WARNING) << "unlink";
}
};
@@ -70,7 +74,7 @@ FDPair ScopedFDPair::get() const {
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 =
@@ -79,7 +83,7 @@ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion:
return region.PassPlatformHandle().fd;
return ScopedFD();
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
// static
PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Take(
@@ -204,7 +208,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t o
// 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
@@ -242,6 +246,22 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
return {};
}
+#if defined(OS_BSD)
+ UnguessableToken token = UnguessableToken::Create();
+ FilePath path = directory.Append(token.ToString());
+ ScopedFD fd{HANDLE_EINTR(shm_open(path.value().c_str(), O_CREAT | O_RDWR, 0700))};
+ File shm_file(fd.release());
+
+ if (!shm_file.IsValid()) {
+ PLOG(ERROR) << "Creating shared memory failed";
+ return {};
+ }
+
+ if (HANDLE_EINTR(ftruncate(shm_file.GetPlatformFile(), size)) == -1) {
+ PLOG(ERROR) << "Failed to extend shared memory object to size " << size;
+ return {};
+ }
+#else
FilePath path;
ScopedFD fd = CreateAndOpenFdForTemporaryFileInDir(directory, &path);
File shm_file(fd.release());
@@ -258,6 +278,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
}
return {};
}
+#endif // OS_BSD
// Deleting the file prevents anyone else from mapping it in (making it
// private), and prevents the need for cleanup (once the last fd is
@@ -267,7 +288,11 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
ScopedFD readonly_fd;
if (mode == Mode::kWritable) {
// Also open as readonly so that we can ConvertToReadOnly().
+#if defined(OS_BSD)
+ readonly_fd.reset(HANDLE_EINTR(shm_open(path.value().c_str(), O_RDONLY, 0400)));
+#else
readonly_fd.reset(HANDLE_EINTR(open(path.value().c_str(), O_RDONLY)));
+#endif
if (!readonly_fd.is_valid()) {
DPLOG(ERROR) << "open(\"" << path.value() << "\", O_RDONLY) failed";
return {};
@@ -298,9 +323,15 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion:
}
}
+#if defined(OS_BSD)
return PlatformSharedMemoryRegion(
{ScopedFD(shm_file.TakePlatformFile()), std::move(readonly_fd)}, mode,
+ size, token);
+#else
+ return PlatformSharedMemoryRegion(
+ {ScopedFD(shm_file.TakePlatformFile()), std::move(readonly_fd)}, mode,
size, UnguessableToken::Create());
+#endif // OS_BSD
#endif // !defined(OS_NACL)
}

View file

@ -1,16 +0,0 @@
--- base/memory/shared_memory_region_unittest.cc.orig 2021-01-07 00:36:18 UTC
+++ base/memory/shared_memory_region_unittest.cc
@@ -188,10 +188,13 @@ TYPED_TEST(SharedMemoryRegionTest, MapAtNotAlignedOffs
std::tie(region, rw_mapping) = CreateMappedRegion<TypeParam>(kDataSize);
ASSERT_TRUE(region.IsValid());
ASSERT_TRUE(rw_mapping.IsValid());
+#if !defined(OS_BSD)
+ // On FreeBSD, mmap() does not require an aligned offset
off_t offset = kDataSize / 2;
typename TypeParam::MappingType mapping =
region.MapAt(offset, kDataSize - offset);
EXPECT_FALSE(mapping.IsValid());
+#endif
}
TYPED_TEST(SharedMemoryRegionTest, MapZeroBytesFails) {

View file

@ -1,28 +0,0 @@
--- base/message_loop/message_pump_glib.cc.orig 2021-01-07 00:36:18 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/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h"
@@ -48,9 +53,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:

View file

@ -1,11 +0,0 @@
--- 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.

View file

@ -1,11 +0,0 @@
--- base/native_library_unittest.cc.orig 2021-01-07 00:36:18 UTC
+++ base/native_library_unittest.cc
@@ -118,7 +118,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
// Android dlopen() requires further investigation, as it might vary across
// versions with respect to symbol resolution scope.
// TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255
-#if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) && \
+#if !defined(OS_ANDROID) && !defined(OS_BSD) && !defined(THREAD_SANITIZER) && \
!defined(MEMORY_SANITIZER)
// Verifies that the |prefer_own_symbols| option satisfies its guarantee that

View file

@ -1,12 +0,0 @@
--- base/numerics/safe_math_shared_impl.h.orig 2021-01-07 00:36:18 UTC
+++ base/numerics/safe_math_shared_impl.h
@@ -24,8 +24,7 @@
// Where available use builtin math overflow support on Clang and GCC.
#elif !defined(__native_client__) && \
((defined(__clang__) && \
- ((__clang_major__ > 3) || \
- (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
+ (__clang_major__ > 6)) || \
(defined(__GNUC__) && __GNUC__ >= 5))
#include "base/numerics/safe_math_clang_gcc_impl.h"
#define BASE_HAS_OPTIMIZED_SAFE_MATH (1)

View file

@ -1,11 +0,0 @@
--- base/path_service_unittest.cc.orig 2021-01-07 00:36:18 UTC
+++ base/path_service_unittest.cc
@@ -38,7 +38,7 @@ bool ReturnsValidPath(int dir_type) {
if (dir_type == DIR_CACHE)
check_path_exists = false;
#endif
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
// On the linux try-bots: a path is returned (e.g. /home/chrome-bot/Desktop),
// but it doesn't exist.
if (dir_type == DIR_USER_DESKTOP)

View file

@ -1,20 +0,0 @@
--- base/posix/can_lower_nice_to.cc.orig 2021-01-07 00:36:18 UTC
+++ base/posix/can_lower_nice_to.cc
@@ -31,6 +31,9 @@ bool CanLowerNiceTo(int nice_value) {
if (geteuid() == 0)
return true;
+#if defined(OS_BSD)
+ return false;
+#else
// 2. Skip checking the CAP_SYS_NICE permission because it would require
// libcap.so.
@@ -54,6 +57,7 @@ bool CanLowerNiceTo(int nice_value) {
// And lowering niceness to |nice_value| is allowed if it is greater than or
// equal to the limit:
return nice_value >= lowest_nice_allowed;
+#endif
}
} // namespace internal

View file

@ -1,49 +0,0 @@
--- base/posix/unix_domain_socket.cc.orig 2021-07-15 19:13:29 UTC
+++ base/posix/unix_domain_socket.cc
@@ -5,7 +5,10 @@
#include "base/posix/unix_domain_socket.h"
#include <errno.h>
+#include <sys/param.h>
#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/ucred.h>
#if !defined(OS_NACL_NONSFI)
#include <sys/un.h>
#endif
@@ -29,6 +32,14 @@ namespace base {
const size_t UnixDomainSocket::kMaxFileDescriptors = 16;
+#ifndef SCM_CREDENTIALS
+# define SCM_CREDENTIALS 0x9001
+#endif
+
+#ifndef SO_PASSCRED
+# define SO_PASSCRED 0x9002
+#endif
+
#if !defined(OS_NACL_NONSFI)
bool CreateSocketPair(ScopedFD* one, ScopedFD* two) {
int raw_socks[2];
@@ -151,7 +162,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
#if !defined(OS_NACL_NONSFI) && !defined(OS_APPLE)
// The PNaCl toolchain for Non-SFI binary build and macOS do not support
// ucred. macOS supports xucred, but this structure is insufficient.
- + CMSG_SPACE(sizeof(struct ucred))
+ + CMSG_SPACE(sizeof(struct cmsgcred))
#endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE)
;
char control_buffer[kControlBufferSize];
@@ -181,9 +192,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
// SCM_CREDENTIALS.
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SCM_CREDENTIALS) {
- DCHECK_EQ(payload_len, sizeof(struct ucred));
+ DCHECK_EQ(payload_len, sizeof(struct cmsgcred));
DCHECK_EQ(pid, -1);
- pid = reinterpret_cast<struct ucred*>(CMSG_DATA(cmsg))->pid;
+ pid = getpid();
}
#endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE)
}

View file

@ -1,12 +0,0 @@
--- base/posix/unix_domain_socket_unittest.cc.orig 2021-01-07 00:36:18 UTC
+++ base/posix/unix_domain_socket_unittest.cc
@@ -8,6 +8,9 @@
#include <stdint.h>
#include <sys/socket.h>
#include <sys/types.h>
+#if defined(OS_BSD)
+#include <signal.h>
+#endif
#include <unistd.h>
#include "base/bind.h"

View file

@ -1,97 +0,0 @@
--- base/process/internal_linux.cc.orig 2021-01-07 00:36:18 UTC
+++ base/process/internal_linux.cc
@@ -30,7 +30,11 @@ namespace internal {
const char kProcDir[] = "/proc";
+#if defined(OS_BSD)
+const char kStatFile[] = "status";
+#else
const char kStatFile[] = "stat";
+#endif
FilePath GetProcPidDir(pid_t pid) {
return FilePath(kProcDir).Append(NumberToString(pid));
@@ -66,6 +70,7 @@ bool ReadProcFile(const FilePath& file, std::string* b
DLOG(WARNING) << "Failed to read " << file.MaybeAsASCII();
return false;
}
+
return !buffer->empty();
}
@@ -81,6 +86,22 @@ bool ParseProcStats(const std::string& stats_data,
if (stats_data.empty())
return false;
+#if defined(OS_BSD)
+ proc_stats->clear();
+
+ std::vector<std::string> other_stats = SplitString(
+ stats_data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+
+ for (const auto& i : other_stats) {
+ auto pos = i.find(',');
+
+ if (pos == std::string::npos) {
+ proc_stats->push_back(i);
+ } else {
+ proc_stats->push_back(i.substr(0, pos));
+ }
+ }
+#else
// The stat file is formatted as:
// pid (process name) data1 data2 .... dataN
// Look for the closing paren by scanning backwards, to avoid being fooled by
@@ -110,6 +131,7 @@ bool ParseProcStats(const std::string& stats_data,
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (const auto& i : other_stats)
proc_stats->push_back(i);
+#endif
return true;
}
@@ -157,7 +179,11 @@ int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, Pro
}
int64_t ReadProcSelfStatsAndGetFieldAsInt64(ProcStatsFields field_num) {
+#if defined(OS_BSD)
+ FilePath stat_file = FilePath(kProcDir).Append("curproc").Append(kStatFile);
+#else
FilePath stat_file = FilePath(kProcDir).Append("self").Append(kStatFile);
+#endif
return ReadStatFileAndGetFieldAsInt64(stat_file, field_num);
}
@@ -173,6 +199,9 @@ size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid,
}
Time GetBootTime() {
+#if defined(OS_BSD)
+ return Time();
+#else
FilePath path("/proc/stat");
std::string contents;
if (!ReadProcFile(path, &contents))
@@ -186,9 +215,13 @@ Time GetBootTime() {
if (!StringToInt(btime_it->second, &btime))
return Time();
return Time::FromTimeT(btime);
+#endif
}
TimeDelta GetUserCpuTimeSinceBoot() {
+#if defined(OS_BSD)
+ return TimeDelta();
+#else
FilePath path("/proc/stat");
std::string contents;
if (!ReadProcFile(path, &contents))
@@ -212,6 +245,7 @@ TimeDelta GetUserCpuTimeSinceBoot() {
return TimeDelta();
return ClockTicksToTimeDelta(user + nice);
+#endif
}
TimeDelta ClockTicksToTimeDelta(int clock_ticks) {

View file

@ -1,34 +0,0 @@
--- base/process/internal_linux.h.orig 2021-01-07 00:36:18 UTC
+++ base/process/internal_linux.h
@@ -18,6 +18,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/threading/platform_thread.h"
+#include <unistd.h> /* pid_t */
+
namespace base {
class Time;
@@ -59,6 +61,14 @@ bool ParseProcStats(const std::string& stats_data,
// If the ordering ever changes, carefully review functions that use these
// values.
enum ProcStatsFields {
+#if defined(OS_BSD)
+ VM_COMM = 0, // Command name.
+ VM_PPID = 2, // Parent process id.
+ VM_PGRP = 3, // Process group id.
+ VM_STARTTIME = 7, // The process start time.
+ VM_UTIME = 8, // The user time.
+ VM_STIME = 9, // The system time
+#else
VM_COMM = 1, // Filename of executable, without parentheses.
VM_STATE = 2, // Letter indicating the state of the process.
VM_PPID = 3, // PID of the parent.
@@ -71,6 +81,7 @@ enum ProcStatsFields {
VM_STARTTIME = 21, // The time the process started in clock ticks.
VM_VSIZE = 22, // Virtual memory size in bytes.
VM_RSS = 23, // Resident Set Size in pages.
+#endif
};
// Reads the |field_num|th field from |proc_stats|. Returns 0 on failure.

View file

@ -1,16 +0,0 @@
--- base/process/kill.h.orig 2021-01-07 00:36:18 UTC
+++ base/process/kill.h
@@ -113,11 +113,11 @@ 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);
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
#endif // defined(OS_POSIX)
// Registers |process| to be asynchronously monitored for termination, forcibly

View file

@ -1,20 +0,0 @@
--- base/process/kill_posix.cc.orig 2021-01-07 00:36:18 UTC
+++ base/process/kill_posix.cc
@@ -160,7 +160,7 @@ void EnsureProcessTerminated(Process process) {
0, new BackgroundReaper(std::move(process), TimeDelta::FromSeconds(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());
@@ -171,7 +171,7 @@ void EnsureProcessGetsReaped(Process process) {
PlatformThread::CreateNonJoinable(
0, new BackgroundReaper(std::move(process), TimeDelta()));
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
#endif // !defined(OS_APPLE)
#endif // !defined(OS_NACL_NONSFI)

View file

@ -1,11 +0,0 @@
--- base/process/launch.cc.orig 2021-01-07 00:36:18 UTC
+++ base/process/launch.cc
@@ -15,7 +15,7 @@ LaunchOptions::~LaunchOptions() = default;
LaunchOptions LaunchOptionsForTest() {
LaunchOptions options;
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
// To prevent accidental privilege sharing to an untrusted child, processes
// are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this
// new child will be used for testing only.

View file

@ -1,29 +0,0 @@
--- base/process/launch.h.orig 2021-07-15 19:13:29 UTC
+++ base/process/launch.h
@@ -190,7 +190,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
@@ -203,7 +203,7 @@ struct BASE_EXPORT LaunchOptions {
// Sets parent process death signal to SIGKILL.
bool kill_on_parent_death = false;
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
#if defined(OS_MAC)
// Mach ports that will be accessible to the child process. These are not
@@ -415,7 +415,7 @@ BASE_EXPORT void RaiseProcessToHighPriority();
// binary. This should not be called in production/released code.
BASE_EXPORT LaunchOptions LaunchOptionsForTest();
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) || defined(OS_BSD)
// A wrapper for clone with fork-like behavior, meaning that it returns the
// child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are
// as in the clone system call (the CLONE_VM flag is not supported).

View file

@ -1,80 +0,0 @@
--- base/process/launch_posix.cc.orig 2021-04-14 01:08:36 UTC
+++ base/process/launch_posix.cc
@@ -59,12 +59,14 @@
#if defined(OS_FREEBSD)
#include <sys/event.h>
#include <sys/ucontext.h>
+#include <sys/procctl.h>
#endif
#if defined(OS_APPLE)
#error "macOS should use launch_mac.cc"
#endif
+#pragma weak environ
extern char** environ;
namespace base {
@@ -221,6 +223,28 @@ void CloseSuperfluousFds(const base::InjectiveMultimap
DirReaderPosix fd_dir(kFDDir);
if (!fd_dir.IsValid()) {
// Fallback case: Try every possible fd.
+
+#if defined(OS_FREEBSD)
+ // CEM: blast away most of the range with closefrom(). A common use case
+ // of this function only maps STDIN/STDOUT/STDERR and closefrom(3) is much
+ // cheaper than x00,000 close(2) invocations with a high RLIMIT_NOFILE.
+ //
+ // In the other caller, it is still very likely that the fds we care about
+ // are in relatively low number space and we can save hundreds of thousands
+ // of syscalls.
+ int max_valid_fd = -1;
+ for (size_t j = 0; j < saved_mapping.size(); j++) {
+ int fd = saved_mapping[j].dest;
+ if (fd > max_valid_fd)
+ max_valid_fd = fd;
+ }
+ if (max_valid_fd < STDERR_FILENO)
+ max_valid_fd = STDERR_FILENO;
+
+ closefrom(max_valid_fd + 1);
+ max_fds = static_cast<size_t>(max_valid_fd) + 1;
+#endif
+
for (size_t i = 0; i < max_fds; ++i) {
const int fd = static_cast<int>(i);
if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO)
@@ -444,22 +468,32 @@ Process LaunchProcess(const std::vector<std::string>&
// Set NO_NEW_PRIVS by default. Since NO_NEW_PRIVS only exists in kernel
// 3.5+, do not check the return value of prctl here.
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_FREEBSD)
#ifndef PR_SET_NO_NEW_PRIVS
#define PR_SET_NO_NEW_PRIVS 38
#endif
+#if !defined(OS_FREEBSD)
if (!options.allow_new_privs) {
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) && errno != EINVAL) {
// Only log if the error is not EINVAL (i.e. not supported).
RAW_LOG(FATAL, "prctl(PR_SET_NO_NEW_PRIVS) failed");
}
}
+#endif
if (options.kill_on_parent_death) {
+#if defined(OS_FREEBSD)
+ int procctl_value = SIGKILL;
+ if (procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &procctl_value)) {
+ RAW_LOG(ERROR, "procctl(PROC_PDEATHSIG_CTL) failed");
+ _exit(127);
+ }
+#else
if (prctl(PR_SET_PDEATHSIG, SIGKILL) != 0) {
RAW_LOG(ERROR, "prctl(PR_SET_PDEATHSIG) failed");
_exit(127);
}
+#endif
}
#endif

View file

@ -1,11 +0,0 @@
--- base/process/memory.cc.orig 2021-07-15 19:13:29 UTC
+++ base/process/memory.cc
@@ -69,7 +69,7 @@ void TerminateBecauseOutOfMemory(size_t size) {
}
// Defined in memory_mac.mm for Mac.
-#if !defined(OS_APPLE)
+#if !defined(OS_APPLE) && !defined(OS_BSD)
bool UncheckedCalloc(size_t num_items, size_t size, void** result) {
const size_t alloc_size = num_items * size;

View file

@ -1,11 +0,0 @@
--- base/process/memory.h.orig 2021-07-15 19:13:29 UTC
+++ base/process/memory.h
@@ -31,7 +31,7 @@ BASE_EXPORT void TerminateBecauseOutOfMemory(size_t si
// TODO: this can be removed when Breakpad is no longer supported.
BASE_EXPORT extern size_t g_oom_size;
-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD) || \
defined(OS_AIX)
// The maximum allowed value for the OOM score.
const int kMaxOomScore = 1000;

View file

@ -1,14 +0,0 @@
--- base/process/memory_stubs.cc.orig 2021-07-15 19:13:29 UTC
+++ base/process/memory_stubs.cc
@@ -19,9 +19,11 @@ bool AdjustOOMScore(ProcessId process, int score) {
return false;
}
+#if !defined(OS_BSD)
void TerminateBecauseOutOfMemory(size_t size) {
abort();
}
+#endif
// UncheckedMalloc and Calloc exist so that platforms making use of
// EnableTerminationOnOutOfMemory have a way to allocate memory without

View file

@ -1,66 +0,0 @@
--- base/process/memory_unittest.cc.orig 2021-07-15 19:13:29 UTC
+++ base/process/memory_unittest.cc
@@ -38,6 +38,8 @@
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#include <malloc.h>
#include "base/test/malloc_wrapper.h"
+#elif defined(OS_BSD)
+#include "base/test/malloc_wrapper.h"
#endif
#if defined(OS_WIN)
@@ -110,9 +112,9 @@ TEST(MemoryTest, AllocatorShimWorking) {
#endif
}
-// OpenBSD does not support these tests. Don't test these on ASan/TSan/MSan
+// BSD does not support these tests. Don't test these on ASan/TSan/MSan
// configurations: only test the real allocator.
-#if !defined(OS_OPENBSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \
+#if !defined(OS_BSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) && \
!defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
namespace {
@@ -307,7 +309,7 @@ TEST_F(OutOfMemoryDeathTest, SecurityAlignedRealloc) {
#endif // defined(OS_WIN)
#endif // !defined(OS_MAC) && !defined(OS_ANDROID)
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
TEST_F(OutOfMemoryDeathTest, Valloc) {
ASSERT_OOM_DEATH({
@@ -353,7 +355,7 @@ TEST_F(OutOfMemoryDeathTest, ViaSharedLibraries) {
value_ = MallocWrapper(test_size_);
});
}
-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
// Android doesn't implement posix_memalign().
#if defined(OS_POSIX) && !defined(OS_ANDROID)
@@ -504,7 +506,7 @@ TEST_F(OutOfMemoryTest, TerminateBecauseOutOfMemoryRep
#endif // OS_WIN
#if defined(ARCH_CPU_32_BITS) && \
- (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS))
+ (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD))
void TestAllocationsReleaseReservation(void* (*alloc_fn)(size_t),
void (*free_fn)(void*)) {
@@ -562,7 +564,7 @@ TEST_F(OutOfMemoryHandledTest, NewReleasesReservation)
[](size_t size) { return static_cast<void*>(new char[size]); },
[](void* ptr) { delete[] static_cast<char*>(ptr); });
}
-#endif // defined(ARCH_CPU_32_BITS) && (defined(OS_WIN) || defined(OS_LINUX) ||
+#endif // defined(ARCH_CPU_32_BITS) && (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_BSD) ||
// defined(OS_CHROMEOS))
// See the comment in |UncheckedMalloc()|, it behaves as malloc() in these
@@ -624,5 +626,5 @@ TEST_F(OutOfMemoryHandledTest, UncheckedCalloc) {
#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) || defined(OS_ANDROID)
-#endif // !defined(OS_OPENBSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) &&
+#endif // !defined(OS_BSD) && BUILDFLAG(USE_ALLOCATOR_SHIM) &&
// !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)

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