summaryrefslogtreecommitdiff
path: root/databases/mongodb3
diff options
context:
space:
mode:
authoradam <adam@pkgsrc.org>2019-07-09 07:28:30 +0000
committeradam <adam@pkgsrc.org>2019-07-09 07:28:30 +0000
commit782f6839833d32bcb3da54c60024eb6ea654461f (patch)
tree3adbe837a1ba6894b45cb7f3c7a605ec9281ed48 /databases/mongodb3
parent0a1fa528eb6bb2c2fe72570d5dc210dacb42fca9 (diff)
downloadpkgsrc-782f6839833d32bcb3da54c60024eb6ea654461f.tar.gz
mongodb3: updated to 3.4.21
3.4.21: Issues fixed: SERVER-39820: Add the client IP address to the successful authentication log message SERVER-41213: Unique background index builds may produce inconsistent keys SERVER-37765: Platform Support: Remove Ubuntu 14.04 SERVER-37774: Platform Support: Remove Enterprise Ubuntu 16.04 PPCLE WT-4615: Sync backup file before returning backup cursor 3.4.20: Issues fixed: SERVER-39166: $graphLookup should force a pipeline to split in sharded cluster SERVER-39723: Change listIndexes command behavior to show in-progress index builds TOOLS-2158: mongodump failing on Windows with “error opening system CA store: Access is denied.” 3.4.19: Issues fixed: SERVER-18985: setParameter should log at level 0 SERVER-22766: Dynamic oplog sizing for WiredTiger nodes SERVER-33469: Make syslog log lines consistent with mongod log lines SERVER-37132: Negation of $in with regex can incorrectly plan from the cache, leading to missing query results SERVER-37182: Different values when referencing whole object vs. a field of that object after $arrayToObject SERVER-37616: Implement tuneable batch size for the rangedeleter 3.4.18: Issues fixed: SERVER-25175: listIndexes shouldn’t include in-progress background indexes SERVER-35418: Allow specifying CAs for incoming and outgoing connections separately. SERVER-36944: applyOps does not permit unknown field names when creating a v:1 index. SERVER-37058: Update with numeric field names inside an array can cause validation to fail. 3.4.17: Issues fixed: SERVER-33857 Missing log redaction due to confusion with Command::redactForLogging(). SERVER-34846 Covered index with collated field returns incorrect result when collation not involved in match or sort. SERVER-36010 Change log messages for Windows stacktraces to use error() or severe() rather than log(). SERVER-34558: Add SSL_version to client metadata logging. 3.4.16: Issues fixed: SERVER-32999: Platform Support: Remove Debian 7 builds. SERVER-29301: Upgrade MozJS to ESR 45.9.0 SERVER-5461: Add syncSourceHost field to replSetGetStatus output. 3.4.15: Issues fixed: SERVER-31535: Platform Support: remove Ubuntu 12.04 builds. SERVER-32923: Platform Support: remove SLES11 builds. SERVER-20056: Log a startup warning if wiredTigerCacheSizeGB is > 80% of RAM. SERVER-28981: Sharding balancer prefers shards in a specific order when moving chunks. 3.4.14: Issues fixed: SERVER-28151: Authentication database should be synced first during an initial sync. SERVER-32886: Unnecessary sleeps during chunk migration. SERVER-32933: Allow mongod to start when unable to reach LDAP server. 3.4.13: Issues fixed: SERVER-33238: Prevent WiredTiger read ticket count from going negative. 3.4.12: Issues fixed: SERVER-31437: Fix parsing of mongo host/db connect string. SERVER-32875: Don’t stall ftdc due to running out of tickets. SERVER-33089: Unable to start queryable mongod because it failed to regenerate index for admin.system.users. 3.4.11: Issues fixed: SERVER-19605: Oplog timeout should be configurable. SERVER-19919: Chunks that exceed 250000 docs but are under half chunk size get marked as jumbo. SERVER-29293: Recipient shard fails to abort migration on stepdown. SERVER-32001: unindexing a key in a partial unique index may cause server crash 3.4.10: Issues fixed: SERVER-15723: Avoid G_X lock for rename_collection within database SERVER-31049: View with collation doesn’t work as expected in sharded cluster SERVER-29287: Upgrade pcre to 8.41 SERVER-31204: Calling shardCollection after enableSharding may fail if executed against different mongos 3.4.9: Issues fixed: SERVER-20392: Sharding an existing small collection results in large number of chunks SERVER-30189: Reduce calls to allocator for large $in expressions SERVER-30487: RangeDeleter holds WT transaction open while waiting for majority SERVER-30636: Range deleter assert failed because of replication lag 3.4.7: Issues fixed: SERVER-29282: BSON Document Size can be exceeded when grouping inserts on SECONDARY nodes SERVER-29568: Enable configuration of OpenSSL cipher suite via setParameter SERVER-29817: Optimize incremental update performance of ChunkManager and CollectionMetadata 3.4.6: Issues fixed: SERVER-27347: Only close idle cached cursors on the WiredTiger ident that is busy. SERVER-29618: $geoWithin in aggregation pipeline after $lookup and $unwind returns incorrect results. WT-3362: Cursor opens should never block for the duration of a checkpoint. 3.4.5: Issues fixed: SERVER-28952: Multikey indexes should not be eligible for DISTINCT_SCAN if distinct key is an array component. SERVER-28427: GlobalLock with timeout can still block indefinitely. SERVER-29018 mongos can segfault in getMore on views with find batchSize of 0.
Diffstat (limited to 'databases/mongodb3')
-rw-r--r--databases/mongodb3/Makefile105
-rw-r--r--databases/mongodb3/distinfo28
-rw-r--r--databases/mongodb3/options.mk7
-rw-r--r--databases/mongodb3/patches/patch-SConstruct58
-rw-r--r--databases/mongodb3/patches/patch-debian_mongod.conf23
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_base_initializer.h3
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp20
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp15
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_platform_random.cpp3
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp63
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp82
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h3
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp20
-rw-r--r--databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp253
14 files changed, 180 insertions, 503 deletions
diff --git a/databases/mongodb3/Makefile b/databases/mongodb3/Makefile
index ca83030abaa..410cda35a2c 100644
--- a/databases/mongodb3/Makefile
+++ b/databases/mongodb3/Makefile
@@ -1,16 +1,15 @@
-# $NetBSD: Makefile,v 1.2 2019/07/01 04:08:01 ryoon Exp $
+# $NetBSD: Makefile,v 1.3 2019/07/09 07:28:30 adam Exp $
# This package is intentionally old to avoid:
# Server Side Public License
# c++17 (and c++14 if 3.4.4 does not already need it)
-DISTNAME= mongodb-src-r3.4.4
-PKGNAME= ${DISTNAME:S/src-r//:S/-rc/rc/}
-PKGREVISION= 7
+DISTNAME= mongodb-src-r3.4.21
+PKGNAME= ${DISTNAME:S/src-r//}
CATEGORIES= databases
MASTER_SITES= http://fastdl.mongodb.org/src/
MAINTAINER= gdt@NetBSD.org
-HOMEPAGE= http://mongodb.org/
+HOMEPAGE= https://www.mongodb.com/
COMMENT= NoSQL distributed document-oriented database
LICENSE= gnu-agpl-v3 # Client and tools licensed under apache-2.0
@@ -21,29 +20,27 @@ EXTRACT_USING= bsdtar
NO_CONFIGURE= yes
USE_LANGUAGES= c c++
+GCC_REQD+= 5.3.0
SCONS_ARGS= ${_MAKE_JOBS}
+SCONS_ARGS+= --disable-warnings-as-errors
+SCONS_ARGS+= --release
+SCONS_ARGS+= --runtime-hardening=off # does not produce executables
SCONS_ARGS+= --use-system-boost
+#SCONS_ARGS+= --use-system-icu
SCONS_ARGS+= --use-system-pcre
SCONS_ARGS+= --use-system-snappy
SCONS_ARGS+= --use-system-tcmalloc
SCONS_ARGS+= --use-system-yaml
SCONS_ARGS+= --use-system-zlib
SCONS_ARGS+= --js-engine=mozjs
-SCONS_ARGS+= --release
-PYTHON_VERSIONS_INCOMPATIBLE= 34 35 36 37 # not yet supported as of 3.0.4
+PYTHON_VERSIONS_ACCEPTED= 27 # not yet supported as of 3.4.21
.include "../../mk/bsd.prefs.mk"
-# XXX this doesn't work for some reason
-#.if !empty(INSTALL_UNSTRIPPED:Uno:M[Yy][Ee][Ss])
-#SCONS_ARGS+= --nostrip
-#.endif
-
-GCC_REQD+= 5.3.0
-
-CPPFLAGS+= -fno-jump-tables
+CPPFLAGS+= -fno-jump-tables # XXX: still needed?
+LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib -L${PREFIX}/lib
.include "options.mk"
@@ -56,6 +53,7 @@ BUILD_DEFS+= MONGODB_LOGPATH
MONGODB_USER?= mongodb
MONGODB_GROUP?= mongodb
MONGODB_DBPATH?= ${VARBASE}/mongodb
+MONGODB_CONFIGDBPATH?= ${VARBASE}/mongoconfigdb
MONGODB_LOGPATH?= ${VARBASE}/log/mongodb
PKG_USERS_VARS+= MONGODB_USER
@@ -68,34 +66,31 @@ PKG_GECOS.${MONGODB_USER}= MongoDB database administrator
PKG_HOME.${MONGODB_USER}= ${MONGODB_DBPATH}
PKG_SHELL.${MONGODB_USER}= ${SH}
-OWN_DIRS_PERMS+= ${MONGODB_DBPATH} ${MONGODB_USER} ${MONGODB_GROUP} 0755
-OWN_DIRS_PERMS+= ${MONGODB_DBPATH}/journal ${MONGODB_USER} ${MONGODB_GROUP} 0755
-OWN_DIRS_PERMS+= ${MONGODB_LOGPATH} ${MONGODB_USER} ${MONGODB_GROUP} 0755
+OWN_DIRS_PERMS+= ${MONGODB_DBPATH:Q} ${MONGODB_USER} ${MONGODB_GROUP} 0755
+OWN_DIRS_PERMS+= ${MONGODB_DBPATH:Q}/journal ${MONGODB_USER} ${MONGODB_GROUP} 0755
+OWN_DIRS_PERMS+= ${MONGODB_LOGPATH:Q} ${MONGODB_USER} ${MONGODB_GROUP} 0755
FILES_SUBST+= MONGODB_USER=${MONGODB_USER}
FILES_SUBST+= MONGODB_GROUP=${MONGODB_GROUP}
FILES_SUBST+= MONGODB_DBPATH=${MONGODB_DBPATH}
FILES_SUBST+= MONGODB_LOGPATH=${MONGODB_LOGPATH}
-# XXX No better idea how to pass CXXFLAGS and LDFLAGS to scons
-SUBST_CLASSES+= scons
-SUBST_STAGE.scons= pre-build
-SUBST_FILES.scons= SConstruct
-SUBST_VARS.scons= PREFIX CXXFLAGS LDFLAGS
-
SUBST_CLASSES+= path
SUBST_STAGE.path= pre-build
-SUBST_FILES.path= src/mongo/db/flushtest.cpp debian/mongod.conf
-SUBST_FILES.path+= debian/mongod.1 debian/mongo.1 src/mongo/shell/dbshell.cpp
-SUBST_SED.path= -e 's|/data/db|${MONGODB_DBPATH}|g'
-SUBST_SED.path+= -e 's|/etc|${PKG_SYSCONFDIR}|'
-SUBST_VARS.path= MONGODB_DBPATH MONGODB_LOGPATH
-
-LDFLAGS+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.boost-libs}/lib
-
-MONGODB_MAN_FILES= bsondump.1 mongo.1 mongod.1 mongodump.1 mongoexport.1 \
- mongofiles.1 mongoimport.1 mongooplog.1 mongoperf.1 \
- mongorestore.1 mongos.1 mongosniff.1 mongostat.1 mongotop.1
+SUBST_MESSAGE.path= Replacing database paths.
+SUBST_FILES.path= debian/mongo.1 debian/mongod.1
+SUBST_FILES.path+= src/mongo/shell/dbshell.cpp
+SUBST_FILES.path+= src/mongo/db/storage/storage_options.cpp
+SUBST_SED.path= -e 's,/data/db,${MONGODB_DBPATH},g'
+SUBST_SED.path+= -e 's,/data/configdb,${MONGODB_CONFIGDBPATH},g'
+SUBST_SED.path+= -e 's,/etc,${PKG_SYSCONFDIR},g'
+
+SUBST_CLASSES+= varbase
+SUBST_STAGE.varbase= pre-build
+SUBST_MESSAGE.varbase= Changing /var to ${VARBASE}.
+SUBST_FILES.varbase= debian/mongod.conf
+SUBST_SED.varbase= -e 's,/var/lib,${VARBASE},g'
+SUBST_SED.varbase+= -e 's,/var/log,${VARBASE},g'
NOT_PAX_MPROTECT_SAFE+= bin/mongo bin/mongod
@@ -106,31 +101,44 @@ INSTALLATION_DIRS+= share/doc/mongodb share/examples/mongodb ${PKGMANDIR}/man1
CONF_FILES+= share/examples/mongodb/mongod.conf \
${PKG_SYSCONFDIR}/mongod.conf
+# Copy system specific files for NetBSD and DragonFly
post-extract:
- chmod -R g-w ${WRKSRC}
- cp -r ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/freebsd \
+ ${CHMOD} -R g-w ${WRKSRC}
+ ${CP} -R ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/freebsd \
${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/dragonfly
- cp -r ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/openbsd \
+ ${CP} -R ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/openbsd \
${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/netbsd
- cp ${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_openbsd.cpp \
+ ${CP} ${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_openbsd.cpp \
${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_netbsd.cpp
+ ${CP} ${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_freebsd.cpp \
+ ${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_dragonfly.cpp
+ ${CP} ${WRKSRC}/src/mongo/util/processinfo_openbsd.cpp \
+ ${WRKSRC}/src/mongo/util/processinfo_netbsd.cpp
+ ${CP} ${WRKSRC}/src/mongo/util/processinfo_freebsd.cpp \
+ ${WRKSRC}/src/mongo/util/processinfo_dragonfly.cpp
+ ${CP} ${WRKSRC}/src/mongo/platform/stack_locator_freebsd.cpp \
+ ${WRKSRC}/src/mongo/platform/stack_locator_netbsd.cpp
+ ${CP} ${WRKSRC}/src/mongo/platform/stack_locator_freebsd.cpp \
+ ${WRKSRC}/src/mongo/platform/stack_locator_dragonfly.cpp
+ ${CP} -R ${WRKSRC}/src/third_party/wiredtiger/build_openbsd \
+ ${WRKSRC}/src/third_party/wiredtiger/build_netbsd
+ ${CP} -R ${WRKSRC}/src/third_party/wiredtiger/build_freebsd \
+ ${WRKSRC}/src/third_party/wiredtiger/build_dragonfly
do-build:
- cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SCONSBIN} ${SCONS_ARGS} core
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SCONSBIN} ${SCONS_ARGS} \
+ CC=${CC:Q} CXX=${CXX:Q} CFLAGS=${CFLAGS:Q} CXXFLAGS=${CXXFLAGS:Q} \
+ LINKFLAGS=${LDFLAGS:Q} CPPPATH=${INCL_PATH:Q} VERBOSE=1 core
do-install:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SCONSBIN} ${SCONS_ARGS} \
- --prefix=${DESTDIR}${PREFIX} install
-
-do-test:
- cd ${WRKSRC} && ./test
+ CC=${CC:Q} CXX=${CXX:Q} CFLAGS=${CFLAGS:Q} CXXFLAGS=${CXXFLAGS:Q} \
+ LINKFLAGS=${LDFLAGS:Q} CPPPATH=${INCL_PATH:Q} \
+ --prefix=${DESTDIR}${PREFIX} install
post-install:
${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/mongodb
-.for file in ${MONGODB_MAN_FILES}
- ${INSTALL_MAN} ${WRKSRC}/debian/${file} \
- ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
-.endfor
+ ${INSTALL_MAN} ${WRKSRC}/debian/*.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
${INSTALL_DATA} ${WRKSRC}/debian/mongod.conf \
${DESTDIR}${PREFIX}/share/examples/mongodb
@@ -143,5 +151,6 @@ post-install:
.include "../../devel/snappy/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../net/libpcap/buildlink3.mk"
+#.include "../../textproc/icu/buildlink3.mk"
.include "../../textproc/yaml-cpp/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/databases/mongodb3/distinfo b/databases/mongodb3/distinfo
index fedb5d5b294..812dbacf89e 100644
--- a/databases/mongodb3/distinfo
+++ b/databases/mongodb3/distinfo
@@ -1,28 +1,22 @@
-$NetBSD: distinfo,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: distinfo,v 1.2 2019/07/09 07:28:30 adam Exp $
-SHA1 (mongodb-src-r3.4.4.tar.gz) = 6f9f2d8a3c1c2f4089fd03f8be0b86ff0431d955
-RMD160 (mongodb-src-r3.4.4.tar.gz) = 2a65f380204a92762ceea2be35dbe2c671e106f6
-SHA512 (mongodb-src-r3.4.4.tar.gz) = dbae89b49c363e7258021cd31385e4449bfdfdfd5adfcb1683e4431372731e58ec33bf8f7576d2d52659a52461bd6a32fbc67d5c6e36d52184ec1aabb345d940
-Size (mongodb-src-r3.4.4.tar.gz) = 39867133 bytes
-SHA1 (patch-SConstruct) = 6ec188274fb25614494ec192be7809a6a01962de
-SHA1 (patch-debian_mongod.conf) = e5074b5f7ad50560b99d652feab58da764ba542c
-SHA1 (patch-src_mongo_base_initializer.h) = add32c5940c922a98122d0e6883eb3ad52dc25c5
-SHA1 (patch-src_mongo_db_dbwebserver.cpp) = 1e7bb9588930742839d2bc9e26b33751a64f98c7
-SHA1 (patch-src_mongo_db_fts_unicode_string.cpp) = 98c5b1b39c07190f08ec9f22ec3002b0a803f72f
+SHA1 (mongodb-src-r3.4.21.tar.gz) = af4e39c4d91332e9216e924c27f9e7230fb0fe88
+RMD160 (mongodb-src-r3.4.21.tar.gz) = d276839102a6dbef7f069154172025f8990b5d59
+SHA512 (mongodb-src-r3.4.21.tar.gz) = 8f4f091ab0a018e6476b860392c26bd379d34b62d5f6a510ae515c992b177407ee370c213579f70d5595d98a8dc0c2fd6b97ccf77683f7995d5d4e1bf5ca367b
+Size (mongodb-src-r3.4.21.tar.gz) = 40151763 bytes
+SHA1 (patch-SConstruct) = da410da1bd59c5a7b6ac5e3ba00144bf569efd77
+SHA1 (patch-src_mongo_base_initializer.h) = f82d58895251f7be08a09012ed7db64e3863a1fe
SHA1 (patch-src_mongo_db_matcher_expression__leaf.cpp) = 52064034fabb5de63eccf87ddd140303c54f0312
SHA1 (patch-src_mongo_db_repl_isself.c) = 82321c918b91ce1a68ce79c14589126aca6baf96
SHA1 (patch-src_mongo_db_repl_master__slave.cpp) = 2f37f0819a2b2743df01f6b6ab0b3013b3b7d726
SHA1 (patch-src_mongo_db_repl_oplog__fetcher.cpp) = e12dbfbd4e70ee210cdd4eb0582661666e8eb06a
SHA1 (patch-src_mongo_installer_msi_SConscript) = 78424fa10f90470dd941b900ef8fd131d28f6e65
-SHA1 (patch-src_mongo_platform_random.cpp) = 59c31e55fc2dc5a2b82b8f16dacf8736d8354cdb
-SHA1 (patch-src_mongo_platform_stack__locator__dragonfly.cpp) = fb885c491e4de1cfbc2875620d854af726e5b45f
-SHA1 (patch-src_mongo_platform_stack__locator__netbsd.cpp) = 3b09e86b2401555b6ab4c31d14c0693d766119c2
+SHA1 (patch-src_mongo_platform_random.cpp) = 9af0fd82a653bf4f273ce107e54c5e63eaeb3b85
+SHA1 (patch-src_mongo_platform_stack__locator__netbsd.cpp) = 3f67bbae82c0f3cae410a21219589bc082e7b9b1
SHA1 (patch-src_mongo_shell_bench.cpp) = c0fd15347d35e37daf87b642148215dee3ab7220
-SHA1 (patch-src_mongo_shell_linenoise__utf8.h) = f975925f56125d48b5124894fa1adf1382a634d2
+SHA1 (patch-src_mongo_shell_linenoise__utf8.h) = 952b1599364893d9fd0be915e3d0c2faabb9153f
SHA1 (patch-src_mongo_util_intrusive__counter.h) = 9f1af59e1bc86e33bf183a6dda1737007afc7a18
-SHA1 (patch-src_mongo_util_net_miniwebserver.cpp) = 3715e826b8d03793066a84b2c1680c32c6ee6368
-SHA1 (patch-src_mongo_util_processinfo__dragonfly.cpp) = 62c236ce820dfe81f45625b15e022cca0f2c10ee
-SHA1 (patch-src_mongo_util_processinfo__netbsd.cpp) = 6eabe5ffec4168bb9ba8a58b7d742772d38b4714
+SHA1 (patch-src_mongo_util_processinfo__netbsd.cpp) = 6c01ad839ff31e7500d76af6622dfa726fcc8264
SHA1 (patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_dpml__exception.c) = ef3b260e8a49227cbbabf427500b7c70bce15083
SHA1 (patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_op__system.h) = 39f6fba82e2870ee4a5d99785033621225a72a16
SHA1 (patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_src_bid__functions.h) = d3a85d3a3b33691466c65cdf51c56f221429aea9
diff --git a/databases/mongodb3/options.mk b/databases/mongodb3/options.mk
index b1c7d5f8bc1..cf7509ac83c 100644
--- a/databases/mongodb3/options.mk
+++ b/databases/mongodb3/options.mk
@@ -1,10 +1,9 @@
-# $NetBSD: options.mk,v 1.1 2019/06/28 16:30:56 gdt Exp $
+# $NetBSD: options.mk,v 1.2 2019/07/09 07:28:30 adam Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.mongodb
PKG_SUPPORTED_OPTIONS= ssl wiredtiger
-PKG_SUGGESTED_OPTIONS= #
-.if !empty(MACHINE_ARCH:Mx86_64)
+.if ${MACHINE_ARCH} == "x86_64"
PKG_SUGGESTED_OPTIONS+= wiredtiger
.endif
@@ -19,7 +18,7 @@ SCONS_ARGS+= --ssl
# MongoDB doesn't provide guarantees for non-bundled WiredTiger:
# https://groups.google.com/forum/#!msg/mongodb-dev/31FQSo4KVCI/Fx-WtJ9fzU4J
.if !empty(PKG_OPTIONS:Mwiredtiger)
-. if empty(MACHINE_ARCH:Mx86_64)
+. if ${MACHINE_ARCH} != "x86_64"
PKG_FAIL_REASON+= "WiredTiger is not supported on 32-bit platforms"
. endif
SCONS_ARGS+= --wiredtiger=on
diff --git a/databases/mongodb3/patches/patch-SConstruct b/databases/mongodb3/patches/patch-SConstruct
index e9594d764cb..4fbd064b64c 100644
--- a/databases/mongodb3/patches/patch-SConstruct
+++ b/databases/mongodb3/patches/patch-SConstruct
@@ -1,9 +1,12 @@
-$NetBSD: patch-SConstruct,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: patch-SConstruct,v 1.2 2019/07/09 07:28:30 adam Exp $
-Add support for NetBSD/Dragonfly, fix locations.
+Add support for NetBSD/Dragonfly.
+Fix locations.
+Don't compile with debug info.
+Don't mess with the linker.
Respect LDFLAGS and CXXFLAGS
---- SConstruct.orig 2017-04-20 21:43:42.000000000 +0000
+--- SConstruct.orig 2019-05-21 17:07:37.000000000 +0000
+++ SConstruct
@@ -30,7 +30,7 @@ EnsureSConsVersion( 2, 3, 0 )
def print_build_failures():
@@ -72,7 +75,7 @@ Respect LDFLAGS and CXXFLAGS
env_vars = Variables(
files=variables_files,
-@@ -892,6 +896,7 @@ envDict = dict(BUILD_ROOT=buildDir,
+@@ -899,6 +903,7 @@ envDict = dict(BUILD_ROOT=buildDir,
INSTALL_DIR=installDir,
CONFIG_HEADER_DEFINES={},
LIBDEPS_TAG_EXPANSIONS=[],
@@ -80,7 +83,7 @@ Respect LDFLAGS and CXXFLAGS
)
env = Environment(variables=env_vars, **envDict)
-@@ -901,12 +906,12 @@ env.AddMethod(env_os_is_wrapper, 'Target
+@@ -908,12 +913,12 @@ env.AddMethod(env_os_is_wrapper, 'Target
env.AddMethod(env_get_os_name_wrapper, 'GetTargetOSName')
def fatal_error(env, msg, *args):
@@ -96,7 +99,7 @@ Respect LDFLAGS and CXXFLAGS
Exit(1)
-@@ -926,7 +931,7 @@ else:
+@@ -933,7 +938,7 @@ else:
env.AddMethod(lambda env: env['VERBOSE'], 'Verbose')
if has_option('variables-help'):
@@ -105,7 +108,7 @@ Respect LDFLAGS and CXXFLAGS
Exit(0)
unknown_vars = env_vars.UnknownVariables()
-@@ -1029,7 +1034,9 @@ def CheckForProcessor(context, which_arc
+@@ -1036,7 +1041,9 @@ def CheckForProcessor(context, which_arc
os_macros = {
"windows": "_WIN32",
"solaris": "__sun",
@@ -115,7 +118,7 @@ Respect LDFLAGS and CXXFLAGS
"openbsd": "__OpenBSD__",
"osx": "__APPLE__",
"linux": "__linux__",
-@@ -1124,7 +1131,7 @@ else:
+@@ -1131,7 +1138,7 @@ else:
env['TARGET_ARCH'] = detected_processor
if env['TARGET_OS'] not in os_macros:
@@ -124,7 +127,7 @@ Respect LDFLAGS and CXXFLAGS
elif not detectConf.CheckForOS(env['TARGET_OS']):
env.ConfError("TARGET_OS ({0}) is not supported by compiler", env['TARGET_OS'])
-@@ -1360,7 +1367,7 @@ elif env['_LIBDEPS'] == '$_LIBDEPS_LIBS'
+@@ -1367,7 +1374,7 @@ elif env['_LIBDEPS'] == '$_LIBDEPS_LIBS'
libdeps.setup_environment(env, emitting_shared=(link_model.startswith("dynamic")))
@@ -133,13 +136,13 @@ Respect LDFLAGS and CXXFLAGS
env['LINK_LIBGROUP_START'] = '-Wl,--start-group'
env['LINK_LIBGROUP_END'] = '-Wl,--end-group'
env['LINK_WHOLE_ARCHIVE_START'] = '-Wl,--whole-archive'
-@@ -1388,10 +1395,24 @@ if env.TargetOSIs('linux'):
+@@ -1395,10 +1402,24 @@ if env.TargetOSIs('linux'):
elif env.TargetOSIs('solaris'):
env.Append( LIBS=["socket","resolv","lgrp"] )
+elif os.sys.platform.startswith( "dragonfly" ):
-+ env.Append( CPPPATH=[ "@PREFIX@/include" ] )
-+ env.Append( LIBPATH=[ "@PREFIX@/lib" ] )
++ env.Append( CPPPATH=[ "/dist/pkg/include" ] )
++ env.Append( LIBPATH=[ "/dist/pkg/lib" ] )
+ env.Append( LIBS=[ "m" ] )
+ env.Append( LIBS=[ "kvm" ] )
+ env.Append( CPPDEFINES=[ "__dragonfly__" ] )
@@ -149,8 +152,8 @@ Respect LDFLAGS and CXXFLAGS
env.Append( CCFLAGS=[ "-fno-omit-frame-pointer" ] )
+elif os.sys.platform.startswith( "netbsd" ):
-+ env.Append( CPPPATH=[ "@PREFIX@/include" ] )
-+ env.Append( LIBPATH=[ "@PREFIX@/lib" ] )
++ env.Append( CPPPATH=[ "/dist/pkg/include" ] )
++ env.Append( LIBPATH=[ "/dist/pkg/lib" ] )
+ env.Append( LIBS=[ "m" ] )
+ env.Append( LIBS=[ "kvm" ] )
+ env.Append( CPPDEFINES=[ "__netbsd__" ] )
@@ -158,7 +161,15 @@ Respect LDFLAGS and CXXFLAGS
elif env.TargetOSIs('openbsd'):
env.Append( LIBS=[ "kvm" ] )
-@@ -1570,6 +1591,9 @@ if env.TargetOSIs('posix'):
+@@ -1564,7 +1585,6 @@ if env.TargetOSIs('posix'):
+ # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used.
+ env.Append( CCFLAGS=["-fno-omit-frame-pointer",
+ "-fno-strict-aliasing",
+- "-ggdb",
+ "-pthread",
+ "-Wall",
+ "-Wsign-compare",
+@@ -1577,6 +1597,9 @@ if env.TargetOSIs('posix'):
env.Append( CXXFLAGS=["-Woverloaded-virtual"] )
env.Append( LINKFLAGS=["-pthread"] )
@@ -168,7 +179,7 @@ Respect LDFLAGS and CXXFLAGS
# SERVER-9761: Ensure early detection of missing symbols in dependent libraries at program
# startup.
-@@ -2158,9 +2182,9 @@ def doConfigure(myenv):
+@@ -2165,9 +2188,9 @@ def doConfigure(myenv):
if usingLibStdCxx:
def CheckModernLibStdCxx(context):
test_body = """
@@ -181,15 +192,24 @@ Respect LDFLAGS and CXXFLAGS
"""
context.Message('Checking for libstdc++ 5.3.0 or better... ')
-@@ -2764,6 +2788,7 @@ def doConfigure(myenv):
- # permit more than four parameters.
+@@ -2375,7 +2398,7 @@ def doConfigure(myenv):
+ #
+ myenv.Append( CCFLAGS=["/Zc:inline"])
+
+- if myenv.ToolchainIs('gcc', 'clang'):
++ if myenv.ToolchainIs('gcc', 'clang') and get_option('runtime-hardening') == "on":
+ # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
+ # because it is much faster.
+ AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
+@@ -2800,6 +2823,7 @@ def doConfigure(myenv):
"BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD",
"BOOST_SYSTEM_NO_DEPRECATED",
+ "BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS",
+ "BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE",
]
)
-@@ -2830,7 +2855,7 @@ def doConfigure(myenv):
+@@ -2866,7 +2890,7 @@ def doConfigure(myenv):
myenv.ConfError("Couldn't find SASL header/libraries")
# requires ports devel/libexecinfo to be installed
diff --git a/databases/mongodb3/patches/patch-debian_mongod.conf b/databases/mongodb3/patches/patch-debian_mongod.conf
deleted file mode 100644
index 27f335f6914..00000000000
--- a/databases/mongodb3/patches/patch-debian_mongod.conf
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD: patch-debian_mongod.conf,v 1.1 2019/06/28 16:30:56 gdt Exp $
-
-Use proper paths in default config file.
---- debian/mongod.conf.orig 2017-04-20 21:43:42.000000000 +0000
-+++ debian/mongod.conf
-@@ -5,7 +5,7 @@
-
- # Where and how to store data.
- storage:
-- dbPath: /var/lib/mongodb
-+ dbPath: /var/mongodb
- journal:
- enabled: true
- # engine:
-@@ -16,7 +16,7 @@ storage:
- systemLog:
- destination: file
- logAppend: true
-- path: /var/log/mongodb/mongod.log
-+ path: /var/mongodb/mongod.log
-
- # network interfaces
- net:
diff --git a/databases/mongodb3/patches/patch-src_mongo_base_initializer.h b/databases/mongodb3/patches/patch-src_mongo_base_initializer.h
index 895c36e23ba..35a8e214b83 100644
--- a/databases/mongodb3/patches/patch-src_mongo_base_initializer.h
+++ b/databases/mongodb3/patches/patch-src_mongo_base_initializer.h
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_mongo_base_initializer.h,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: patch-src_mongo_base_initializer.h,v 1.2 2019/07/09 07:28:30 adam Exp $
Fixes at least SunOS.
+
--- src/mongo/base/initializer.h.orig 2014-04-07 00:36:57.000000000 +0000
+++ src/mongo/base/initializer.h
@@ -17,6 +17,7 @@
diff --git a/databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp b/databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp
deleted file mode 100644
index da6581281ef..00000000000
--- a/databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-src_mongo_db_dbwebserver.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
-
---- src/mongo/db/dbwebserver.cpp.orig 2017-07-11 17:07:27.098292902 +0000
-+++ src/mongo/db/dbwebserver.cpp
-@@ -35,6 +35,7 @@
-
- #include "mongo/db/dbwebserver.h"
-
-+#include <string>
- #include <pcrecpp.h>
-
- #include "mongo/base/init.h"
-@@ -67,6 +68,7 @@ namespace mongo {
- using std::map;
- using std::stringstream;
- using std::vector;
-+using std::string;
-
- using namespace html;
-
diff --git a/databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp b/databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp
deleted file mode 100644
index 20b36a5b0c8..00000000000
--- a/databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-src_mongo_db_fts_unicode_string.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
-
-* Fix build with boost 1.62.0
-
---- src/mongo/db/fts/unicode/string.cpp.orig 2016-09-26 12:10:04.000000000 +0000
-+++ src/mongo/db/fts/unicode/string.cpp
-@@ -274,7 +274,7 @@ bool String::substrMatch(const std::stri
-
- // Case sensitive and diacritic sensitive.
- return boost::algorithm::boyer_moore_search(
-- haystack.begin(), haystack.end(), needle.begin(), needle.end()) != haystack.end();
-+ haystack.begin(), haystack.end(), needle.begin(), needle.end()) != std::make_pair(haystack.end(), haystack.end());
- }
-
- } // namespace unicode
diff --git a/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp b/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp
index 8999bd66735..7fe356aad70 100644
--- a/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp
+++ b/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_mongo_platform_random.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: patch-src_mongo_platform_random.cpp,v 1.2 2019/07/09 07:28:30 adam Exp $
Add NetBSD support.
+
--- src/mongo/platform/random.cpp.orig 2016-01-05 18:31:44.000000000 +0000
+++ src/mongo/platform/random.cpp
@@ -145,7 +145,7 @@ SecureRandom* SecureRandom::create() {
diff --git a/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp
deleted file mode 100644
index 80c5de97cfd..00000000000
--- a/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-$NetBSD: patch-src_mongo_platform_stack__locator__dragonfly.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
-
---- src/mongo/platform/stack_locator_dragonfly.cpp.orig 2016-02-11 11:27:13.489023328 +0000
-+++ src/mongo/platform/stack_locator_dragonfly.cpp
-@@ -0,0 +1,58 @@
-+/**
-+ * Copyright (C) 2015 MongoDB Inc.
-+ *
-+ * This program is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Affero General Public License, version 3,
-+ * as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Affero General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Affero General Public License
-+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
-+ *
-+ * As a special exception, the copyright holders give permission to link the
-+ * code of portions of this program with the OpenSSL library under certain
-+ * conditions as described in each individual source file and distribute
-+ * linked combinations including the program with the OpenSSL library. You
-+ * must comply with the GNU Affero General Public License in all respects for
-+ * all of the code used other than as permitted herein. If you modify file(s)
-+ * with this exception, you may extend this exception to your version of the
-+ * file(s), but you are not obligated to do so. If you do not wish to do so,
-+ * delete this exception statement from your version. If you delete this
-+ * exception statement from all source files in the program, then also delete
-+ * it in the license file.
-+ */
-+
-+#include "mongo/platform/basic.h"
-+
-+#include "mongo/platform/stack_locator.h"
-+
-+#include <pthread.h>
-+#include <pthread_np.h>
-+
-+#include "mongo/util/assert_util.h"
-+#include "mongo/util/scopeguard.h"
-+
-+namespace mongo {
-+
-+StackLocator::StackLocator() {
-+ pthread_attr_t attr;
-+ size_t size;
-+
-+ pthread_t self = pthread_self();
-+
-+ invariant(pthread_attr_init(&attr) == 0);
-+ ON_BLOCK_EXIT(pthread_attr_destroy, &attr);
-+
-+ invariant(pthread_attr_get_np(self, &attr) == 0);
-+
-+ invariant(pthread_attr_getstack(&attr, &_end, &size) == 0);
-+
-+ // TODO: Assumes stack grows downward on FreeBSD
-+ _begin = static_cast<char*>(_end) + size;
-+}
-+
-+} // namespace mongo
diff --git a/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp
index 60511b89d4f..42615e31dfb 100644
--- a/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp
+++ b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp
@@ -1,63 +1,23 @@
-$NetBSD: patch-src_mongo_platform_stack__locator__netbsd.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: patch-src_mongo_platform_stack__locator__netbsd.cpp,v 1.2 2019/07/09 07:28:30 adam Exp $
---- src/mongo/platform/stack_locator_netbsd.cpp.orig 2016-02-11 12:24:33.443209041 +0000
+Add NetBSD support.
+
+--- src/mongo/platform/stack_locator_netbsd.cpp.orig 2019-07-08 19:30:20.000000000 +0000
+++ src/mongo/platform/stack_locator_netbsd.cpp
-@@ -0,0 +1,58 @@
-+/**
-+ * Copyright (C) 2015 MongoDB Inc.
-+ *
-+ * This program is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Affero General Public License, version 3,
-+ * as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Affero General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Affero General Public License
-+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
-+ *
-+ * As a special exception, the copyright holders give permission to link the
-+ * code of portions of this program with the OpenSSL library under certain
-+ * conditions as described in each individual source file and distribute
-+ * linked combinations including the program with the OpenSSL library. You
-+ * must comply with the GNU Affero General Public License in all respects for
-+ * all of the code used other than as permitted herein. If you modify file(s)
-+ * with this exception, you may extend this exception to your version of the
-+ * file(s), but you are not obligated to do so. If you do not wish to do so,
-+ * delete this exception statement from your version. If you delete this
-+ * exception statement from all source files in the program, then also delete
-+ * it in the license file.
-+ */
-+
-+#include "mongo/platform/basic.h"
-+
-+#include "mongo/platform/stack_locator.h"
-+
-+#include <pthread.h>
-+
-+
-+#include "mongo/util/assert_util.h"
-+#include "mongo/util/scopeguard.h"
-+
-+namespace mongo {
-+
-+StackLocator::StackLocator() {
-+ pthread_attr_t attr;
-+ size_t size;
-+
-+ pthread_t self = pthread_self();
-+
-+ invariant(pthread_attr_init(&attr) == 0);
-+ ON_BLOCK_EXIT(pthread_attr_destroy, &attr);
-+
-+ invariant(pthread_attr_get_np(self, &attr) == 0);
-+
-+ invariant(pthread_attr_getstack(&attr, &_end, &size) == 0);
-+
-+ // TODO: Assumes stack grows downward on FreeBSD
-+ _begin = static_cast<char*>(_end) + size;
-+}
-+
-+} // namespace mongo
+@@ -31,7 +31,6 @@
+ #include "mongo/platform/stack_locator.h"
+
+ #include <pthread.h>
+-#include <pthread_np.h>
+
+ #include "mongo/util/assert_util.h"
+ #include "mongo/util/scopeguard.h"
+@@ -51,7 +50,7 @@ StackLocator::StackLocator() {
+
+ invariant(pthread_attr_getstack(&attr, &_end, &size) == 0);
+
+- // TODO: Assumes stack grows downward on FreeBSD
++ // TODO: Assumes stack grows downward on NetBSD
+ _begin = static_cast<char*>(_end) + size;
+ }
+
diff --git a/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h b/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h
index dbf472899b7..f29414e3a3d 100644
--- a/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h
+++ b/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_mongo_shell_linenoise__utf8.h,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: patch-src_mongo_shell_linenoise__utf8.h,v 1.2 2019/07/09 07:28:30 adam Exp $
Use Boost swap instead of std. Fixes build on SunOS.
+
--- src/mongo/shell/linenoise_utf8.h.orig 2016-01-05 18:31:44.000000000 +0000
+++ src/mongo/shell/linenoise_utf8.h
@@ -27,6 +27,7 @@
diff --git a/databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp b/databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp
deleted file mode 100644
index 7cfdc692a34..00000000000
--- a/databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-src_mongo_util_net_miniwebserver.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
-
---- src/mongo/util/net/miniwebserver.cpp.orig 2017-07-11 17:42:54.304511569 +0000
-+++ src/mongo/util/net/miniwebserver.cpp
-@@ -33,6 +33,7 @@
-
- #include "mongo/util/net/miniwebserver.h"
-
-+#include <string>
- #include <pcrecpp.h>
-
- #include "mongo/config.h"
-@@ -45,6 +46,7 @@
- namespace mongo {
-
- using std::shared_ptr;
-+using std::string;
- using std::stringstream;
- using std::vector;
-
diff --git a/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp b/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp
index 2f835ae26c0..7bc8fe321dd 100644
--- a/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp
+++ b/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp
@@ -1,217 +1,50 @@
-$NetBSD: patch-src_mongo_util_processinfo__netbsd.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $
+$NetBSD: patch-src_mongo_util_processinfo__netbsd.cpp,v 1.2 2019/07/09 07:28:30 adam Exp $
---- src/mongo/util/processinfo_netbsd.cpp.orig 2017-06-24 01:47:17.271883765 +0000
+Add NetBSD support.
+
+--- src/mongo/util/processinfo_netbsd.cpp.orig 2019-07-08 19:34:24.000000000 +0000
+++ src/mongo/util/processinfo_netbsd.cpp
-@@ -0,0 +1,212 @@
-+/* Copyright 2012 10gen Inc.
-+ *
-+ * This program is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Affero General Public License, version 3,
-+ * as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Affero General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Affero General Public License
-+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
-+ *
-+ * As a special exception, the copyright holders give permission to link the
-+ * code of portions of this program with the OpenSSL library under certain
-+ * conditions as described in each individual source file and distribute
-+ * linked combinations including the program with the OpenSSL library. You
-+ * must comply with the GNU Affero General Public License in all respects
-+ * for all of the code used other than as permitted herein. If you modify
-+ * file(s) with this exception, you may extend this exception to your
-+ * version of the file(s), but you are not obligated to do so. If you do not
-+ * wish to do so, delete this exception statement from your version. If you
-+ * delete this exception statement from all source files in the program,
-+ * then also delete it in the license file.
-+ */
-+
-+#if defined(__NetBSD__)
+@@ -25,6 +25,8 @@
+ * then also delete it in the license file.
+ */
+
+#define _KMEMUSER
-+#endif
-+
-+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl
-+
-+#include <cstdlib>
-+#include <string>
-+
-+#include <kvm.h>
-+#include <sys/file.h>
-+#include <sys/mman.h>
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#include <sys/types.h>
-+#include <sys/vmmeter.h>
-+#include <unistd.h>
-+
-+#include "mongo/util/scopeguard.h"
-+#include "mongo/util/log.h"
-+#include "processinfo.h"
-+
-+using namespace std;
-+
-+namespace mongo {
-+
-+ProcessInfo::ProcessInfo(ProcessId pid) : _pid(pid) {}
-+
-+ProcessInfo::~ProcessInfo() {}
-+
-+/**
-+ * Get a sysctl string value by name. Use string specialization by default.
-+ */
-+template <typename T>
-+int getSysctlByIDWithDefault(const int* sysctlID,
-+ const int idLen,
-+ const T& defaultValue,
-+ T* result);
-+
-+template <>
-+int getSysctlByIDWithDefault<uintptr_t>(const int* sysctlID,
-+ const int idLen,
-+ const uintptr_t& defaultValue,
-+ uintptr_t* result) {
-+ uintptr_t value = 0;
-+ size_t len = sizeof(value);
-+ if (sysctl(sysctlID, idLen, &value, &len, NULL, 0) == -1) {
-+ *result = defaultValue;
-+ return errno;
-+ }
-+ if (len > sizeof(value)) {
-+ *result = defaultValue;
-+ return EINVAL;
-+ }
-+
-+ *result = value;
-+ return 0;
-+}
-+
-+template <>
-+int getSysctlByIDWithDefault<string>(const int* sysctlID,
-+ const int idLen,
-+ const string& defaultValue,
-+ string* result) {
-+ char value[256] = {0};
-+ size_t len = sizeof(value);
-+ if (sysctl(sysctlID, idLen, &value, &len, NULL, 0) == -1) {
-+ *result = defaultValue;
-+ return errno;
-+ }
-+ *result = value;
-+ return 0;
-+}
-+
-+bool ProcessInfo::checkNumaEnabled() {
-+ return false;
-+}
-+
-+int ProcessInfo::getVirtualMemorySize() {
-+ kvm_t* kd = NULL;
-+ int cnt = 0;
-+ char err[_POSIX2_LINE_MAX] = {0};
-+ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, err)) == NULL) {
-+ log() << "Unable to get virt mem size: " << err << endl;
-+ return -1;
-+ }
+
+ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl
+
+ #include <cstdlib>
+@@ -36,7 +38,6 @@
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+ #include <sys/types.h>
+-#include <sys/user.h>
+ #include <sys/vmmeter.h>
+ #include <unistd.h>
+
+@@ -109,7 +110,7 @@ int ProcessInfo::getVirtualMemorySize()
+ return -1;
+ }
+
+- kinfo_proc* task = kvm_getprocs(kd, KERN_PROC_PID, _pid.toNative(), sizeof(kinfo_proc), &cnt);
+ kinfo_proc2* task = kvm_getproc2(kd, KERN_PROC_PID, _pid.toNative(), sizeof(kinfo_proc2), &cnt);
-+ kvm_close(kd);
-+ return ((task->p_vm_dsize + task->p_vm_ssize + task->p_vm_tsize) * sysconf(_SC_PAGESIZE)) /
-+ 1048576;
-+}
-+
-+int ProcessInfo::getResidentSize() {
-+ kvm_t* kd = NULL;
-+ int cnt = 0;
-+ char err[_POSIX2_LINE_MAX] = {0};
-+ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, err)) == NULL) {
-+ log() << "Unable to get res mem size: " << err << endl;
-+ return -1;
-+ }
+ kvm_close(kd);
+ return ((task->p_vm_dsize + task->p_vm_ssize + task->p_vm_tsize) * sysconf(_SC_PAGESIZE)) /
+ 1048576;
+@@ -123,7 +124,7 @@ int ProcessInfo::getResidentSize() {
+ log() << "Unable to get res mem size: " << err;
+ return -1;
+ }
+- kinfo_proc* task = kvm_getprocs(kd, KERN_PROC_PID, _pid.toNative(), sizeof(kinfo_proc), &cnt);
+ kinfo_proc2* task = kvm_getproc2(kd, KERN_PROC_PID, _pid.toNative(), sizeof(kinfo_proc2), &cnt);
-+ kvm_close(kd);
-+ return (task->p_vm_rssize * sysconf(_SC_PAGESIZE)) / 1048576; // convert from pages to MB
-+}
-+
-+double ProcessInfo::getSystemMemoryPressurePercentage() {
-+ return 0.0;
-+}
-+
-+void ProcessInfo::SystemInfo::collectSystemInfo() {
-+ osType = "BSD";
+ kvm_close(kd);
+ return (task->p_vm_rssize * sysconf(_SC_PAGESIZE)) / 1048576; // convert from pages to MB
+ }
+@@ -134,7 +135,7 @@ double ProcessInfo::getSystemMemoryPress
+
+ void ProcessInfo::SystemInfo::collectSystemInfo() {
+ osType = "BSD";
+- osName = "OpenBSD";
+ osName = "NetBSD";
-+ int mib[2];
-+
-+ mib[0] = CTL_KERN;
-+ mib[1] = KERN_VERSION;
-+ int status = getSysctlByIDWithDefault(mib, 2, string("unknown"), &osVersion);
-+ if (status != 0)
-+ log() << "Unable to collect OS Version. (errno: " << status << " msg: " << strerror(status)
-+ << ")" << endl;
-+
-+ mib[0] = CTL_HW;
-+ mib[1] = HW_MACHINE;
-+ status = getSysctlByIDWithDefault(mib, 2, string("unknown"), &cpuArch);
-+ if (status != 0)
-+ log() << "Unable to collect Machine Architecture. (errno: " << status
-+ << " msg: " << strerror(status) << ")" << endl;
-+ addrSize = cpuArch.find("64") != std::string::npos ? 64 : 32;
-+
-+ uintptr_t numBuffer;
-+ uintptr_t defaultNum = 1;
-+ mib[0] = CTL_HW;
-+ mib[1] = HW_PHYSMEM;
-+ status = getSysctlByIDWithDefault(mib, 2, defaultNum, &numBuffer);
-+ memSize = numBuffer;
-+ if (status != 0)
-+ log() << "Unable to collect Physical Memory. (errno: " << status
-+ << " msg: " << strerror(status) << ")" << endl;
-+
-+ mib[0] = CTL_HW;
-+ mib[1] = HW_NCPU;
-+ status = getSysctlByIDWithDefault(mib, 2, defaultNum, &numBuffer);
-+ numCores = numBuffer;
-+ if (status != 0)
-+ log() << "Unable to collect Number of CPUs. (errno: " << status
-+ << " msg: " << strerror(status) << ")" << endl;
-+
-+ pageSize = static_cast<unsigned long long>(sysconf(_SC_PAGESIZE));
-+
-+ hasNuma = checkNumaEnabled();
-+}
-+
-+void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {}
-+
-+bool ProcessInfo::supported() {
-+ return true;
-+}
-+
-+bool ProcessInfo::blockCheckSupported() {
-+ return true;
-+}
-+
-+bool ProcessInfo::blockInMemory(const void* start) {
-+ char x = 0;
-+ if (mincore((void*)alignToStartOfPage(start), getPageSize(), &x)) {
-+ log() << "mincore failed: " << errnoWithDescription() << endl;
-+ return 1;
-+ }
-+ return x & 0x1;
-+}
-+
-+bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, vector<char>* out) {
-+ out->resize(numPages);
-+ // int mincore(const void *addr, size_t len, char *vec);
-+ if (mincore((void*)alignToStartOfPage(start), numPages * getPageSize(), &(out->front()))) {
-+ log() << "mincore failed: " << errnoWithDescription() << endl;
-+ return false;
-+ }
-+ for (size_t i = 0; i < numPages; ++i) {
-+ (*out)[i] = 0x1;
-+ }
-+ return true;
-+}
-+}
+ int mib[2];
+
+ mib[0] = CTL_KERN;