diff options
-rw-r--r-- | src/mongo/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/db.cpp | 12 | ||||
-rw-r--r-- | src/mongo/dbtests/dbtests.cpp | 4 | ||||
-rw-r--r-- | src/mongo/dbtests/perf/perftest.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/server.cpp | 4 | ||||
-rw-r--r-- | src/mongo/shell/dbshell.cpp | 10 | ||||
-rw-r--r-- | src/mongo/tools/bridge.cpp | 5 | ||||
-rw-r--r-- | src/mongo/tools/bsondump.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/docgeneratormain.cpp | 5 | ||||
-rw-r--r-- | src/mongo/tools/dump.cpp | 13 | ||||
-rw-r--r-- | src/mongo/tools/export.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/files.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/import.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/loadgenerator.cpp | 5 | ||||
-rw-r--r-- | src/mongo/tools/oplog.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/restore.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/sniffer.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/stat.cpp | 4 | ||||
-rw-r--r-- | src/mongo/tools/top.cpp | 4 | ||||
-rw-r--r-- | src/mongo/util/lame_stacktrace_test.cpp | 4 |
20 files changed, 73 insertions, 31 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index f78cc738816..2bb8e0a0ad1 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -32,6 +32,7 @@ env.StaticLibrary('foundation', 'util/time_support.cpp', ], LIBDEPS=['stacktrace', + '$BUILD_DIR/mongo/base/base', '$BUILD_DIR/third_party/shim_allocator', '$BUILD_DIR/third_party/shim_boost']) diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 6a80fe9e8b4..b3d2ec1c1d4 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -22,6 +22,7 @@ #include <boost/filesystem/operations.hpp> #include <fstream> +#include "mongo/base/initializer.h" #include "mongo/db/client.h" #include "mongo/db/clientcursor.h" #include "mongo/db/cmdline.h" @@ -618,15 +619,18 @@ string arg_error_check(int argc, char* argv[]) { return ""; } -static int mongoDbMain(int argc, char* argv[]); +static int mongoDbMain(int argc, char* argv[], char** envp); -int main(int argc, char* argv[]) { - int exitCode = mongoDbMain(argc, argv); +int main(int argc, char* argv[], char** envp) { + int exitCode = mongoDbMain(argc, argv, envp); ::_exit(exitCode); } -static int mongoDbMain(int argc, char* argv[]) { +static int mongoDbMain(int argc, char* argv[], char **envp) { static StaticObserver staticObserver; + + mongo::runGlobalInitializersOrDie(argc, argv, envp); + getcurns = ourgetns; po::options_description general_options("General options"); diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index d84df604c56..19fcb0b9f5a 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -19,12 +19,14 @@ #include "pch.h" +#include "mongo/base/initializer.h" #include "mongo/dbtests/dbtests.h" #include "mongo/dbtests/framework.h" #include "mongo/util/startup_test.h" -int main( int argc, char** argv ) { +int main( int argc, char** argv, char** envp ) { static StaticObserver StaticObserver; + mongo::runGlobalInitializersOrDie(argc, argv, envp); StartupTest::runTests(); _exit(mongo::dbtests::runDbTests( argc, argv, "/tmp/unittest" )); } diff --git a/src/mongo/dbtests/perf/perftest.cpp b/src/mongo/dbtests/perf/perftest.cpp index b6fe10efa86..548fb0ecdbd 100644 --- a/src/mongo/dbtests/perf/perftest.cpp +++ b/src/mongo/dbtests/perf/perftest.cpp @@ -20,6 +20,7 @@ #include "pch.h" #include <boost/date_time/posix_time/posix_time.hpp> +#include "mongo/base/initializer.h" #include "mongo/client/dbclientcursor.h" #include "mongo/db/instance.h" #include "mongo/db/json.h" @@ -758,7 +759,9 @@ namespace Misc { } all; } -int main( int argc, char **argv ) { +int main( int argc, char **argv, char** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); + logLevel = -1; client_ = new DBDirectClient(); diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index a1d0673ca3c..1cc1ebf685e 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -20,6 +20,7 @@ #include <boost/thread/thread.hpp> +#include "mongo/base/initializer.h" #include "../util/net/message.h" #include "../util/startup_test.h" #include "../client/connpool.h" @@ -462,7 +463,8 @@ namespace mongo { } // namespace mongo #endif -int main(int argc, char* argv[]) { +int main(int argc, char* argv[], char** envp) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); try { int exitCode = _main(argc, argv); ::_exit(exitCode); diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp index 0d8258b736a..997ca4d7fe2 100644 --- a/src/mongo/shell/dbshell.cpp +++ b/src/mongo/shell/dbshell.cpp @@ -23,6 +23,7 @@ #include <stdio.h> #include <string.h> +#include "mongo/base/initializer.h" #include "mongo/client/dbclientinterface.h" #include "mongo/db/cmdline.h" #include "mongo/db/repl/rs_member.h" @@ -595,7 +596,8 @@ static void edit( const string& whatToEdit ) { } } -int _main( int argc, char* argv[] ) { +int _main( int argc, char* argv[], char **envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); mongo::isShell = true; setupSignals(); @@ -978,7 +980,7 @@ int wmain( int argc, wchar_t* argvW[] ) { int returnValue = -1; try { WindowsCommandLine wcl( argc, argvW ); - returnValue = _main( argc, wcl.argv() ); + returnValue = _main( argc, wcl.argv(), NULL ); // TODO: Convert wide env to utf8 env. } catch ( mongo::DBException& e ) { cerr << "exception: " << e.what() << endl; @@ -988,11 +990,11 @@ int wmain( int argc, wchar_t* argvW[] ) { ::_exit(returnValue); } #else // #ifdef _WIN32 -int main( int argc, char* argv[] ) { +int main( int argc, char* argv[], char **envp ) { static mongo::StaticObserver staticObserver; int returnCode; try { - returnCode = _main( argc , argv ); + returnCode = _main( argc , argv, envp ); } catch ( mongo::DBException& e ) { cerr << "exception: " << e.what() << endl; diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp index ff63aa68b89..4d13b64a938 100644 --- a/src/mongo/tools/bridge.cpp +++ b/src/mongo/tools/bridge.cpp @@ -20,6 +20,7 @@ #include <boost/thread.hpp> +#include "mongo/base/initializer.h" #include "mongo/db/dbmessage.h" #include "mongo/util/net/listen.h" #include "mongo/util/net/message.h" @@ -149,7 +150,9 @@ void check( bool b ) { helpExit(); } -int main( int argc, char **argv ) { +int main( int argc, char **argv, char** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); + static StaticObserver staticObserver; setupSignals(); diff --git a/src/mongo/tools/bsondump.cpp b/src/mongo/tools/bsondump.cpp index 16f9ea39198..461737af739 100644 --- a/src/mongo/tools/bsondump.cpp +++ b/src/mongo/tools/bsondump.cpp @@ -17,6 +17,7 @@ */ #include "../pch.h" +#include "mongo/base/initializer.h" #include "mongo/client/dbclientcursor.h" #include "../util/mmap.h" #include "../util/text.h" @@ -141,7 +142,8 @@ public: } }; -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char **envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); BSONDump dump; return dump.main( argc , argv ); } diff --git a/src/mongo/tools/docgeneratormain.cpp b/src/mongo/tools/docgeneratormain.cpp index 4841e8975ad..2cae11fa2e4 100644 --- a/src/mongo/tools/docgeneratormain.cpp +++ b/src/mongo/tools/docgeneratormain.cpp @@ -25,6 +25,7 @@ #include <boost/program_options.hpp> +#include "mongo/base/initializer.h" #include "mongo/util/assert_util.h" #include "mongo/client/dbclientcursor.h" #include "mongo/tools/docgenerator.h" @@ -90,8 +91,8 @@ int parseCmdLineOptions( int argc, char **argv ) { } -int main( int argc, char* argv[] ) { - +int main( int argc, char* argv[], char* envp[] ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); if( parseCmdLineOptions( argc, argv) ) return 1; diff --git a/src/mongo/tools/dump.cpp b/src/mongo/tools/dump.cpp index 11780ca0226..e89449c4142 100644 --- a/src/mongo/tools/dump.cpp +++ b/src/mongo/tools/dump.cpp @@ -16,10 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "../pch.h" -#include "../db/db.h" -#include "mongo/client/dbclientcursor.h" -#include "tool.h" +#include "mongo/pch.h" #include <fcntl.h> #include <map> @@ -28,6 +25,11 @@ #include <boost/filesystem/operations.hpp> #include <boost/filesystem/convenience.hpp> +#include "mongo/base/initializer.h" +#include "mongo/client/dbclientcursor.h" +#include "mongo/db/db.h" +#include "mongo/tools/tool.h" + using namespace mongo; namespace po = boost::program_options; @@ -537,7 +539,8 @@ public: BSONObj _query; }; -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char ** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); Dump d; return d.main( argc , argv ); } diff --git a/src/mongo/tools/export.cpp b/src/mongo/tools/export.cpp index 0278e0bffaf..c2255da1fe6 100644 --- a/src/mongo/tools/export.cpp +++ b/src/mongo/tools/export.cpp @@ -18,6 +18,7 @@ #include "pch.h" #include "db/json.h" +#include "mongo/base/initializer.h" #include "mongo/client/dbclientcursor.h" #include "tool.h" @@ -245,7 +246,8 @@ public: } }; -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); Export e; return e.main( argc , argv ); } diff --git a/src/mongo/tools/files.cpp b/src/mongo/tools/files.cpp index d9b17e5d954..1eaab72f536 100644 --- a/src/mongo/tools/files.cpp +++ b/src/mongo/tools/files.cpp @@ -18,6 +18,7 @@ #include "pch.h" #include "client/gridfs.h" +#include "mongo/base/initializer.h" #include "mongo/client/dbclientcursor.h" #include "tool.h" @@ -162,7 +163,8 @@ public: } }; -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); Files f; return f.main( argc , argv ); } diff --git a/src/mongo/tools/import.cpp b/src/mongo/tools/import.cpp index faa7ed9ad55..f65214a6c7e 100644 --- a/src/mongo/tools/import.cpp +++ b/src/mongo/tools/import.cpp @@ -21,6 +21,7 @@ #include "tool.h" #include "../util/text.h" +#include "mongo/base/initializer.h" #include <fstream> #include <iostream> @@ -475,7 +476,8 @@ public: } }; -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); Import import; return import.main( argc , argv ); } diff --git a/src/mongo/tools/loadgenerator.cpp b/src/mongo/tools/loadgenerator.cpp index 1fb10a1e3e0..4f0690def5e 100644 --- a/src/mongo/tools/loadgenerator.cpp +++ b/src/mongo/tools/loadgenerator.cpp @@ -40,6 +40,7 @@ #include <boost/program_options.hpp> #include <boost/scoped_ptr.hpp> +#include "mongo/base/initializer.h" #include "mongo/util/assert_util.h" #include "mongo/scripting/bench.h" #include "mongo/client/dbclientinterface.h" @@ -407,8 +408,8 @@ int parseCmdLineOptions(int argc, char **argv) { } // namespace -int main(int argc, char **argv) { - +int main(int argc, char **argv, char** envp) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); if( parseCmdLineOptions(argc, argv) ) return 1; diff --git a/src/mongo/tools/oplog.cpp b/src/mongo/tools/oplog.cpp index c914a866bc0..ea7f2af5b13 100644 --- a/src/mongo/tools/oplog.cpp +++ b/src/mongo/tools/oplog.cpp @@ -17,6 +17,7 @@ */ #include "pch.h" +#include "mongo/base/initializer.h" #include "db/json.h" #include "db/oplogreader.h" @@ -104,7 +105,8 @@ public: } }; -int main( int argc , char** argv ) { +int main( int argc , char** argv, char** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); OplogTool t; return t.main( argc , argv ); } diff --git a/src/mongo/tools/restore.cpp b/src/mongo/tools/restore.cpp index d7779e6a3a7..a71dc5028d9 100644 --- a/src/mongo/tools/restore.cpp +++ b/src/mongo/tools/restore.cpp @@ -25,6 +25,7 @@ #include <fstream> #include <set> +#include "mongo/base/initializer.h" #include "mongo/db/namespacestring.h" #include "mongo/tools/tool.h" #include "mongo/util/mmap.h" @@ -495,7 +496,8 @@ private: } }; -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char ** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); Restore restore; return restore.main( argc , argv ); } diff --git a/src/mongo/tools/sniffer.cpp b/src/mongo/tools/sniffer.cpp index 4a45cfba6bb..f83d42268d3 100644 --- a/src/mongo/tools/sniffer.cpp +++ b/src/mongo/tools/sniffer.cpp @@ -34,6 +34,7 @@ #undef max #endif +#include "mongo/base/initializer.h" #include "../bson/util/builder.h" #include "../util/net/message.h" #include "../util/mmap.h" @@ -444,7 +445,8 @@ void usage() { << endl; } -int main(int argc, char **argv) { +int main(int argc, char **argv, char** envp) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); stringstream nullStream; nullStream.clear(ios::failbit); diff --git a/src/mongo/tools/stat.cpp b/src/mongo/tools/stat.cpp index 2158fd20718..75688d05914 100644 --- a/src/mongo/tools/stat.cpp +++ b/src/mongo/tools/stat.cpp @@ -20,6 +20,7 @@ #include <boost/thread/thread.hpp> +#include "mongo/base/initializer.h" #include "db/json.h" #include "../util/net/httpclient.h" #include "../util/text.h" @@ -572,7 +573,8 @@ namespace mongo { } -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char ** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); mongo::Stat stat; return stat.main( argc , argv ); } diff --git a/src/mongo/tools/top.cpp b/src/mongo/tools/top.cpp index 0c0b84814ae..7e877f69717 100644 --- a/src/mongo/tools/top.cpp +++ b/src/mongo/tools/top.cpp @@ -18,6 +18,7 @@ #include "pch.h" +#include "mongo/base/initializer.h" #include "db/json.h" #include "../util/text.h" #include "tool.h" @@ -192,7 +193,8 @@ namespace mongo { } -int main( int argc , char ** argv ) { +int main( int argc , char ** argv, char ** envp ) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); mongo::TopTool top; return top.main( argc , argv ); } diff --git a/src/mongo/util/lame_stacktrace_test.cpp b/src/mongo/util/lame_stacktrace_test.cpp index f2bdb95f680..89a32a713f9 100644 --- a/src/mongo/util/lame_stacktrace_test.cpp +++ b/src/mongo/util/lame_stacktrace_test.cpp @@ -5,8 +5,10 @@ * function, until such time as it is properly unit tested. */ +#include "mongo/base/initializer.h" #include "mongo/util/stacktrace.h" -int main(int argc, char **argv) { +int main(int argc, char **argv, char ** envp) { + mongo::runGlobalInitializersOrDie(argc, argv, envp); mongo::printStackTrace(); } |