summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/common.cpp6
-rw-r--r--src/mongo/db/db.cpp1
-rw-r--r--src/mongo/db/namespace_details.cpp25
-rw-r--r--src/mongo/db/pdfile.h6
-rw-r--r--src/mongo/dbtests/dbtests.cpp1
-rw-r--r--src/mongo/pch.h38
-rw-r--r--src/mongo/s/server.cpp2
-rw-r--r--src/mongo/shell/dbshell.cpp23
-rw-r--r--src/mongo/tools/bridge.cpp7
-rw-r--r--src/mongo/util/assert_util.cpp3
-rw-r--r--src/mongo/util/debug_util.h2
-rw-r--r--src/mongo/util/log.cpp18
-rw-r--r--src/mongo/util/log.h1
-rw-r--r--src/mongo/util/util.cpp18
-rw-r--r--src/mongo/util/util.h12
-rw-r--r--src/mongo/util/version.cpp1
16 files changed, 78 insertions, 86 deletions
diff --git a/src/mongo/db/common.cpp b/src/mongo/db/common.cpp
index 0af8c8f4c5a..f4a09eb4131 100644
--- a/src/mongo/db/common.cpp
+++ b/src/mongo/db/common.cpp
@@ -28,12 +28,6 @@
*/
namespace mongo {
- /** called by mongos, mongod, test. do not call from clients and such.
- invoked before about everything except global var construction.
- */
- void doPreServerStartupInits() {
- }
-
NOINLINE_DECL OpTime OpTime::skewed() {
bool toLog = false;
ONCE toLog = true;
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 7f5dcada2af..7591f73f959 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -589,7 +589,6 @@ string arg_error_check(int argc, char* argv[]) {
int main(int argc, char* argv[]) {
static StaticObserver staticObserver;
- doPreServerStartupInits();
getcurns = ourgetns;
po::options_description general_options("General options");
diff --git a/src/mongo/db/namespace_details.cpp b/src/mongo/db/namespace_details.cpp
index 01b1c12bd2c..769433ddc0c 100644
--- a/src/mongo/db/namespace_details.cpp
+++ b/src/mongo/db/namespace_details.cpp
@@ -1,5 +1,3 @@
-// namespace.cpp
-
/**
* Copyright (C) 2008 10gen Inc.
*
@@ -17,19 +15,26 @@
*/
#include "pch.h"
-#include "pdfile.h"
-#include "db.h"
-#include "mongommf.h"
-#include "../util/hashtab.h"
-#include "../scripting/engine.h"
-#include "btree.h"
+
+#include "mongo/db/namespace_details.h"
+
#include <algorithm>
#include <list>
-#include "json.h"
-#include "ops/delete.h"
#include <boost/filesystem/operations.hpp>
+#include "mongo/db/btree.h"
+#include "mongo/db/db.h"
+#include "mongo/db/json.h"
+#include "mongo/db/mongommf.h"
+#include "mongo/db/ops/delete.h"
+#include "mongo/db/pdfile.h"
+#include "mongo/scripting/engine.h"
+#include "mongo/util/hashtab.h"
+#include "mongo/util/util.h"
+
+
+
namespace mongo {
BSONObj idKeyPattern = fromjson("{\"_id\":1}");
diff --git a/src/mongo/db/pdfile.h b/src/mongo/db/pdfile.h
index a426f29b792..577c3189133 100644
--- a/src/mongo/db/pdfile.h
+++ b/src/mongo/db/pdfile.h
@@ -33,11 +33,15 @@
#include "mongo/db/namespace-inl.h"
#include "mongo/db/namespace_details-inl.h"
#include "mongo/db/namespacestring.h"
-#include "pch.h"
#include "mongo/util/mmap.h"
+#include "mongo/util/util.h"
namespace mongo {
+ // pdfile versions
+ const int PDFILE_VERSION = 4;
+ const int PDFILE_VERSION_MINOR = 5;
+
class DataFileHeader;
class Extent;
class Record;
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index 6e1f925de8d..b93ef2ce850 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -25,7 +25,6 @@
int main( int argc, char** argv ) {
static StaticObserver StaticObserver;
- doPreServerStartupInits();
StartupTest::runTests();
return mongo::dbtests::runDbTests( argc, argv, "/tmp/unittest" );
}
diff --git a/src/mongo/pch.h b/src/mongo/pch.h
index a2809b2ae6a..05119d555db 100644
--- a/src/mongo/pch.h
+++ b/src/mongo/pch.h
@@ -93,16 +93,6 @@ namespace mongo {
using namespace std;
using boost::shared_ptr;
-#if defined(_DEBUG)
- const bool debug=true;
-#else
- const bool debug=false;
-#endif
-
- // pdfile versions
- const int PDFILE_VERSION = 4;
- const int PDFILE_VERSION_MINOR = 5;
-
void dbexit( ExitCode returnCode, const char *whyMsg = "", bool tryToGetLock = false);
/**
@@ -113,31 +103,13 @@ namespace mongo {
void exit( ExitCode returnCode );
bool inShutdown();
- void asserted(const char *msg, const char *file, unsigned line);
}
-#include "util/assert_util.h"
-#include "util/debug_util.h"
-#include "util/goodies.h"
-#include "util/allocator.h"
-#include "util/log.h"
-
-namespace mongo {
-
- void sayDbContext(const char *msg = 0);
- void rawOut( const string &s );
-
- typedef char _TCHAR;
-
- using boost::uint32_t;
- using boost::uint64_t;
-
- /** called by mongos, mongod, test. do not call from clients and such.
- invoked before about everything except global var construction.
- */
- void doPreServerStartupInits();
-
-} // namespace mongo
+#include "mongo/util/assert_util.h"
+#include "mongo/util/debug_util.h"
+#include "mongo/util/goodies.h"
+#include "mongo/util/allocator.h"
+#include "mongo/util/log.h"
#endif // MONGO_PCH_H
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index d10ad2400d7..cffc8f85a3d 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -40,6 +40,7 @@
#include "cursors.h"
#include "shard_version.h"
#include "../util/processinfo.h"
+#include "mongo/util/util.h"
#if defined(_WIN32)
# include "../util/ntservice.h"
@@ -437,7 +438,6 @@ namespace mongo {
int main(int argc, char* argv[]) {
try {
- doPreServerStartupInits();
return _main(argc, argv);
}
catch(SocketException& e) {
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index 5fc901fb310..95035e56cc5 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -19,19 +19,20 @@
#include <stdio.h>
#include <string.h>
-#include "../third_party/linenoise/linenoise.h"
-#include "../scripting/engine.h"
-#include "../util/startup_test.h"
-#include "../db/cmdline.h"
-#include "utils.h"
-#include "../util/password.h"
-#include "../util/version.h"
-#include "../util/file.h"
-#include "../db/repl/rs_member.h"
-#include "mongo/client/dbclientinterface.h"
-
#include <boost/filesystem/operations.hpp>
+#include "mongo/client/dbclientinterface.h"
+#include "mongo/db/cmdline.h"
+#include "mongo/db/repl/rs_member.h"
+#include "mongo/scripting/engine.h"
+#include "mongo/shell/utils.h"
+#include "mongo/util/file.h"
+#include "mongo/util/password.h"
+#include "mongo/util/startup_test.h"
+#include "mongo/util/util.h"
+#include "mongo/util/version.h"
+#include "third_party/linenoise/linenoise.h"
+
using namespace std;
using namespace mongo;
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp
index b6a1795ed5c..125589262f5 100644
--- a/src/mongo/tools/bridge.cpp
+++ b/src/mongo/tools/bridge.cpp
@@ -17,9 +17,10 @@
*/
#include "pch.h"
-#include "../util/net/message.h"
-#include "../util/net/listen.h"
-#include "../db/dbmessage.h"
+#include "mongo/db/dbmessage.h"
+#include "mongo/util/net/listen.h"
+#include "mongo/util/net/message.h"
+#include "mongo/util/util.h"
using namespace mongo;
using namespace std;
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index 66c64db2bc5..21386a5d6c8 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -24,7 +24,8 @@ using namespace std;
#include <sys/file.h>
#endif
-#include "../bson/bsonobjbuilder.h"
+#include "mongo/bson/bsonobjbuilder.h"
+#include "mongo/util/util.h"
namespace mongo {
diff --git a/src/mongo/util/debug_util.h b/src/mongo/util/debug_util.h
index cb9f95fbdfb..f1832565f50 100644
--- a/src/mongo/util/debug_util.h
+++ b/src/mongo/util/debug_util.h
@@ -38,8 +38,10 @@ namespace mongo {
#if defined(_DEBUG)
enum {DEBUG_BUILD = 1};
+ const bool debug=true;
#else
enum {DEBUG_BUILD = 0};
+ const bool debug=false;
#endif
#define MONGO_DEV if( DEBUG_BUILD )
diff --git a/src/mongo/util/log.cpp b/src/mongo/util/log.cpp
index de3528a7a72..cc393509b5c 100644
--- a/src/mongo/util/log.cpp
+++ b/src/mongo/util/log.cpp
@@ -386,4 +386,22 @@ namespace mongo {
return *p;
}
+ /* note: can't use malloc herein - may be in signal handler.
+ logLockless() likely does not comply and should still be fixed todo
+ likewise class string?
+ */
+ void rawOut( const string &s ) {
+ if( s.empty() ) return;
+
+ char buf[64];
+ time_t_to_String( time(0) , buf );
+ /* truncate / don't show the year: */
+ buf[19] = ' ';
+ buf[20] = 0;
+
+ Logstream::logLockless(buf);
+ Logstream::logLockless(s);
+ Logstream::logLockless("\n");
+ }
+
}
diff --git a/src/mongo/util/log.h b/src/mongo/util/log.h
index a329faabe78..608a3894100 100644
--- a/src/mongo/util/log.h
+++ b/src/mongo/util/log.h
@@ -445,5 +445,6 @@ namespace mongo {
extern Tee* const warnings; // Things put here go in serverStatus
string errnoWithDescription(int errorcode = -1);
+ void rawOut( const string &s );
} // namespace mongo
diff --git a/src/mongo/util/util.cpp b/src/mongo/util/util.cpp
index 70ccefaecec..56f911bf5b2 100644
--- a/src/mongo/util/util.cpp
+++ b/src/mongo/util/util.cpp
@@ -193,24 +193,6 @@ namespace mongo {
printStackTrace();
}
- /* note: can't use malloc herein - may be in signal handler.
- logLockless() likely does not comply and should still be fixed todo
- likewise class string?
- */
- void rawOut( const string &s ) {
- if( s.empty() ) return;
-
- char buf[64];
- time_t_to_String( time(0) , buf );
- /* truncate / don't show the year: */
- buf[19] = ' ';
- buf[20] = 0;
-
- Logstream::logLockless(buf);
- Logstream::logLockless(s);
- Logstream::logLockless("\n");
- }
-
ostream& operator<<( ostream &s, const ThreadSafeString &o ) {
s << o.toString();
return s;
diff --git a/src/mongo/util/util.h b/src/mongo/util/util.h
new file mode 100644
index 00000000000..a0aa79d56db
--- /dev/null
+++ b/src/mongo/util/util.h
@@ -0,0 +1,12 @@
+// Do not add anything new to this file.
+// Find a better/more appropriate place instead.
+
+#pragma once
+
+#include <cstddef>
+
+namespace mongo {
+
+ void sayDbContext(const char *msg = NULL);
+
+} // namespace mongo
diff --git a/src/mongo/util/version.cpp b/src/mongo/util/version.cpp
index f36570b7916..18cfdce91d9 100644
--- a/src/mongo/util/version.cpp
+++ b/src/mongo/util/version.cpp
@@ -30,6 +30,7 @@
#include "ramlog.h"
#include "../db/cmdline.h"
#include "processinfo.h"
+#include "mongo/db/pdfile.h"
#include <boost/filesystem/operations.hpp>