summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2016-12-11 12:19:19 -0500
committerAndrew Morrow <acm@mongodb.com>2016-12-14 09:22:24 -0500
commit8cdf4e80df8fdf28a1057cb50708fab0dd5cd53b (patch)
tree18f92779c871c1a8188af0af53674f5e9ab01950 /src
parent786f35e9a118d43b3f14b8d173cb3d9973e81477 (diff)
downloadmongo-8cdf4e80df8fdf28a1057cb50708fab0dd5cd53b.tar.gz
SERVER-23103 Remove remaining logic from instance.cpp
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/SConscript12
-rw-r--r--src/mongo/db/authz_manager_external_state_factory_d.cpp52
-rw-r--r--src/mongo/db/db.cpp23
-rw-r--r--src/mongo/db/instance.cpp48
-rw-r--r--src/mongo/db/instance.h42
5 files changed, 69 insertions, 108 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 097652d948e..500e5ae092f 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -825,9 +825,20 @@ env.Library(
],
)
+env.Library(
+ target="authz_manager_external_state_factory_d",
+ source=[
+ "authz_manager_external_state_factory_d.cpp",
+ ],
+ LIBDEPS=[
+ 'auth/authmongod',
+ ],
+)
+
# mongod files - also files used in tools. present in dbtests, but not in mongos and not in client
# libs.
serverOnlyFiles = [
+ # DO NOT ADD ADDITIONAL FILES TO THIS LIST
"instance.cpp",
]
@@ -850,6 +861,7 @@ serveronlyLibdeps = [
'$BUILD_DIR/mongo/db/ttl_collection_cache',
"assemble_response",
"auth/authmongod",
+ "authz_manager_external_state_factory_d",
"background",
"catalog/catalog",
"catalog/collection_options",
diff --git a/src/mongo/db/authz_manager_external_state_factory_d.cpp b/src/mongo/db/authz_manager_external_state_factory_d.cpp
new file mode 100644
index 00000000000..12a9ec19c43
--- /dev/null
+++ b/src/mongo/db/authz_manager_external_state_factory_d.cpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2008-2014 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.
+ */
+
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/base/init.h"
+#include "mongo/db/auth/authz_manager_external_state_d.h"
+#include "mongo/stdx/memory.h"
+
+namespace mongo {
+using std::unique_ptr;
+
+namespace {
+
+unique_ptr<AuthzManagerExternalState> createAuthzManagerExternalStateMongod() {
+ return stdx::make_unique<AuthzManagerExternalStateMongod>();
+}
+
+MONGO_INITIALIZER(CreateAuthorizationExternalStateFactory)(InitializerContext* context) {
+ AuthzManagerExternalState::create = &createAuthzManagerExternalStateMongod;
+ return Status::OK();
+}
+
+} // namespace
+} // namespace mongo
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index ee29446affa..8f93af50cf0 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -70,7 +70,6 @@
#include "mongo/db/index_names.h"
#include "mongo/db/index_rebuilder.h"
#include "mongo/db/initialize_server_global_state.h"
-#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
#include "mongo/db/json.h"
#include "mongo/db/log_process_details.h"
@@ -909,22 +908,6 @@ MONGO_INITIALIZER_GENERAL(setSSLManagerType, MONGO_NO_PREREQUISITES, ("SSLManage
}
#endif
-#if defined(_WIN32)
-namespace mongo {
-// the hook for mongoAbort
-extern void (*reportEventToSystem)(const char* msg);
-static void reportEventToSystemImpl(const char* msg) {
- static ::HANDLE hEventLog = RegisterEventSource(NULL, TEXT("mongod"));
- if (hEventLog) {
- std::wstring s = toNativeString(msg);
- LPCTSTR txt = s.c_str();
- BOOL ok = ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, 0, 0, NULL, 1, 0, &txt, 0);
- wassert(ok);
- }
-}
-} // namespace mongo
-#endif // if defined(_WIN32)
-
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
@@ -1054,14 +1037,8 @@ static int mongoDbMain(int argc, char* argv[], char** envp) {
registerShutdownTask(shutdownTask);
-#if defined(_WIN32)
- mongo::reportEventToSystem = &mongo::reportEventToSystemImpl;
-#endif
-
setupSignalHandlers();
- dbExecCommand = argv[0];
-
srand(static_cast<unsigned>(curTimeMicros64()));
Status status = mongo::runGlobalInitializers(argc, argv, envp);
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 10283a3d972..b24a86fd0ce 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -26,46 +26,8 @@
* it in the license file.
*/
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/instance.h"
-
-#include <memory>
-
-#include "mongo/base/init.h"
-#include "mongo/db/auth/authz_manager_external_state_d.h"
-#include "mongo/stdx/memory.h"
-#include "mongo/util/log.h"
-
-namespace mongo {
-using std::string;
-using std::unique_ptr;
-
-string dbExecCommand;
-
-namespace {
-
-unique_ptr<AuthzManagerExternalState> createAuthzManagerExternalStateMongod() {
- return stdx::make_unique<AuthzManagerExternalStateMongod>();
-}
-
-MONGO_INITIALIZER(CreateAuthorizationExternalStateFactory)(InitializerContext* context) {
- AuthzManagerExternalState::create = &createAuthzManagerExternalStateMongod;
- return Status::OK();
-}
-
-} // namespace
-
-// Mongod on win32 defines a value for this function. In all other executables it is NULL.
-void (*reportEventToSystem)(const char* msg) = 0;
-
-void mongoAbort(const char* msg) {
- if (reportEventToSystem)
- reportEventToSystem(msg);
- severe() << redact(msg);
- ::abort();
-}
-
-} // namespace mongo
+// DO NOT ADD SYMBOLS TO THIS FILE
+//
+// This file exists to create a library that in turn exists only to aggregate other library
+// dependencies. As such, it should not export any symbols of its own, or depend directly on any
+// symbols defined in other libraries.
diff --git a/src/mongo/db/instance.h b/src/mongo/db/instance.h
deleted file mode 100644
index 764b4605432..00000000000
--- a/src/mongo/db/instance.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// instance.h : Global state functions.
-//
-
-/**
-* Copyright (C) 2008 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.
-*/
-
-#pragma once
-
-#include <string>
-
-namespace mongo {
-
-extern std::string dbExecCommand;
-
-void maybeCreatePidFile();
-
-} // namespace mongo