diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/initialize_server_global_state.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/initialize_server_global_state.idl | 51 |
3 files changed, 55 insertions, 6 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index d649a59f07d..699aaeb2f7e 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -487,6 +487,7 @@ env.Library( target="serverinit", source=[ "initialize_server_global_state.cpp", + env.Idlc("initialize_server_global_state.idl")[0], "server_options_init.cpp", ], LIBDEPS_PRIVATE=[ diff --git a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp index 2c8202f9c74..243101a38ab 100644 --- a/src/mongo/db/initialize_server_global_state.cpp +++ b/src/mongo/db/initialize_server_global_state.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include "mongo/db/initialize_server_global_state.h" +#include "mongo/db/initialize_server_global_state_gen.h" #include <boost/filesystem/operations.hpp> #include <iostream> @@ -205,7 +206,6 @@ void forkServerOrDie() { quickExit(EXIT_FAILURE); } -MONGO_EXPORT_SERVER_PARAMETER(maxLogSizeKB, int, logger::LogContext::kDefaultMaxLogSizeKB); // On POSIX platforms we need to set our umask before opening any log files, so this // should depend on MungeUmask above, but not on Windows. MONGO_INITIALIZER_GENERAL( @@ -222,7 +222,7 @@ MONGO_INITIALIZER_GENERAL( using logger::StatusWithRotatableFileWriter; // Hook up this global into our logging encoder - MessageEventDetailsEncoder::setMaxLogSizeKBSource(maxLogSizeKB); + MessageEventDetailsEncoder::setMaxLogSizeKBSource(gMaxLogSizeKB); if (serverGlobalParams.logWithSyslog) { #ifdef _WIN32 @@ -350,14 +350,11 @@ MONGO_INITIALIZER(RegisterShortCircuitExitHandler)(InitializerContext*) { // is to set the bits for 'other' and 'group', but leave umask bits // bits for 'user' unaltered. namespace { -#ifndef _WIN32 -MONGO_EXPORT_STARTUP_SERVER_PARAMETER(honorSystemUmask, bool, false); -#endif MONGO_INITIALIZER_WITH_PREREQUISITES(MungeUmask, ("EndStartupOptionHandling")) (InitializerContext*) { #ifndef _WIN32 - if (!honorSystemUmask) { + if (!gHonorSystemUmask) { umask(umask(S_IRWXU | S_IRWXG | S_IRWXO) | S_IRWXG | S_IRWXO); } #endif diff --git a/src/mongo/db/initialize_server_global_state.idl b/src/mongo/db/initialize_server_global_state.idl new file mode 100644 index 00000000000..5b697ac1ac3 --- /dev/null +++ b/src/mongo/db/initialize_server_global_state.idl @@ -0,0 +1,51 @@ +# Copyright (C) 2018-present MongoDB, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the Server Side Public License, version 1, +# as published by MongoDB, Inc. +# +# 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 +# Server Side Public License for more details. +# +# You should have received a copy of the Server Side Public License +# along with this program. If not, see +# <http://www.mongodb.com/licensing/server-side-public-license>. +# +# 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 Server Side 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. + +global: + cpp_namespace: mongo + cpp_includes: + - mongo/logger/message_event_utf8_encoder.h + +server_parameters: + maxLogSizeKB: + cpp_varname: gMaxLogSizeKB + cpp_vartype: AtomicWord<int> + default: + expr: logger::LogContext::kDefaultMaxLogSizeKB + description: 'Max log size in kilobytes' + set_at: [ startup, runtime ] + + honorSystemUmask: + cpp_varname: gHonorSystemUmask + cpp_vartype: bool + condition: + preprocessor: '!defined(_WIN32)' + default: false + description: 'Max log size in kilobytes' + set_at: [ startup ] + + |