diff options
Diffstat (limited to 'src/mongo/util')
25 files changed, 100 insertions, 64 deletions
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h index 43117fe3318..4a932db33f9 100644 --- a/src/mongo/util/assert_util.h +++ b/src/mongo/util/assert_util.h @@ -87,8 +87,10 @@ struct MONGO_CLIENT_API ExceptionInfo { int code; }; -/** helper class that builds error strings. lighter weight than a StringBuilder, albeit less flexible. - NOINLINE_DECL used in the constructor implementations as we are assuming this is a cold code path when used. +/** helper class that builds error strings. lighter weight than a StringBuilder, albeit less + * flexible. + NOINLINE_DECL used in the constructor implementations as we are assuming this is a cold code + path when used. example: throw UserException(123, ErrorMsg("blah", num_val)); diff --git a/src/mongo/util/background.h b/src/mongo/util/background.h index f6693c0e318..978fa52ceed 100644 --- a/src/mongo/util/background.h +++ b/src/mongo/util/background.h @@ -72,8 +72,8 @@ protected: * after this returns, deleted if deleteSelf true. * * NOTE: - * if run() throws, the exception will be caught within 'this' object and will ultimately lead to the - * BackgroundJob's thread being finished, as if run() returned. + * if run() throws, the exception will be caught within 'this' object and will ultimately lead + * to the BackgroundJob's thread being finished, as if run() returned. * */ virtual void run() = 0; diff --git a/src/mongo/util/concurrency/value.h b/src/mongo/util/concurrency/value.h index 4be9c3d14e5..0189c4ed521 100644 --- a/src/mongo/util/concurrency/value.h +++ b/src/mongo/util/concurrency/value.h @@ -74,7 +74,8 @@ public: set(rhs.get()); } - // == is not defined. use get() == ... instead. done this way so one thinks about if composing multiple operations + // == is not defined. use get() == ... instead. done this way so one thinks about if composing + // multiple operations bool operator==(const std::string& s) const; }; } diff --git a/src/mongo/util/debugger.cpp b/src/mongo/util/debugger.cpp index d4b722e2a0b..5fed04a0e88 100644 --- a/src/mongo/util/debugger.cpp +++ b/src/mongo/util/debugger.cpp @@ -52,7 +52,8 @@ void breakpoint() { #ifndef _WIN32 // code to raise a breakpoint in GDB ONCE { - // prevent SIGTRAP from crashing the program if default action is specified and we are not in gdb + // prevent SIGTRAP from crashing the program if default action is specified and we are not + // in gdb struct sigaction current; sigaction(SIGTRAP, NULL, ¤t); if (current.sa_handler == SIG_DFL) { diff --git a/src/mongo/util/descriptive_stats-inl.h b/src/mongo/util/descriptive_stats-inl.h index 1b7c91595d1..d09bc388cf7 100644 --- a/src/mongo/util/descriptive_stats-inl.h +++ b/src/mongo/util/descriptive_stats-inl.h @@ -82,9 +82,12 @@ DistributionEstimators<NumQuantiles>::DistributionEstimators() * The quantile estimation follows the extended_p_square implementation in boost.accumulators. * It differs by removing the ability to request arbitrary quantiles and computing exactly * 'NumQuantiles' equidistant quantiles (plus minimum and maximum) instead. - * See http://www.boost.org/doc/libs/1_51_0/doc/html/boost/accumulators/impl/extended_p_square_impl.html , - * R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. and - * K. E. E. Raatikainen, Simultaneous estimation of several quantiles, Simulation, Volume 49, Number 4 (October), 1986, p. 159-164. + * See + * http://www.boost.org/doc/libs/1_51_0/doc/html/boost/accumulators/impl/extended_p_square_impl.html + * , R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + * histograms without storing observations, Communications of the ACM, Volume 28 (October), Number + * 10, 1985, p. 1076-1085. and K. E. E. Raatikainen, Simultaneous estimation of several quantiles, + * Simulation, Volume 49, Number 4 (October), 1986, p. 159-164. */ template <std::size_t NumQuantiles> DistributionEstimators<NumQuantiles>& DistributionEstimators<NumQuantiles>::operator<<( diff --git a/src/mongo/util/file_allocator.cpp b/src/mongo/util/file_allocator.cpp index a0d9c3f5da1..ca71a4e6b7c 100644 --- a/src/mongo/util/file_allocator.cpp +++ b/src/mongo/util/file_allocator.cpp @@ -317,7 +317,8 @@ void FileAllocator::ensureLength(int fd, long size) { void FileAllocator::checkFailure() { if (_failed) { - // we want to log the problem (diskfull.js expects it) but we do not want to dump a stack tracke + // we want to log the problem (diskfull.js expects it) but we do not + // want to dump a stack tracke msgassertedNoTrace(12520, "new file allocation failure"); } } diff --git a/src/mongo/util/logfile.h b/src/mongo/util/logfile.h index 2b823582b51..dc316d6cb76 100644 --- a/src/mongo/util/logfile.h +++ b/src/mongo/util/logfile.h @@ -52,7 +52,8 @@ public: */ void synchronousAppend(const void* buf, size_t len); - /** write at specified offset. must be aligned. noreturn until physically written. thread safe */ + /** write at specified offset. must be aligned. noreturn until physically written. thread safe + * */ void writeAt(unsigned long long offset, const void* _bug, size_t _len); void readAt(unsigned long long offset, void* _buf, size_t _len); diff --git a/src/mongo/util/mmap.h b/src/mongo/util/mmap.h index c99453d7d11..f0ce0d29139 100644 --- a/src/mongo/util/mmap.h +++ b/src/mongo/util/mmap.h @@ -124,7 +124,8 @@ public: template <class F> static void forEach(F fun); - /** note: you need to be in mmmutex when using this. forEach (above) handles that for you automatically. + /** note: you need to be in mmmutex when using this. forEach (above) handles that for you + * automatically. */ static std::set<MongoFile*>& getAllFiles(); diff --git a/src/mongo/util/mmap_win.cpp b/src/mongo/util/mmap_win.cpp index d72f10ab72d..8ceb8401f03 100644 --- a/src/mongo/util/mmap_win.cpp +++ b/src/mongo/util/mmap_win.cpp @@ -229,7 +229,8 @@ void* MemoryMappedFile::map(const char* filenameIn, unsigned long long& length, verify(fd == 0 && len == 0); // can't open more than once setFilename(filenameIn); FileAllocator::get()->allocateAsap(filenameIn, length); - /* big hack here: Babble uses db names with colons. doesn't seem to work on windows. temporary perhaps. */ + /* big hack here: Babble uses db names with colons. doesn't seem to work on windows. temporary + * perhaps. */ char filename[256]; strncpy(filename, filenameIn, 255); filename[255] = 0; diff --git a/src/mongo/util/moveablebuffer.h b/src/mongo/util/moveablebuffer.h index 981197028af..571204ecfe2 100644 --- a/src/mongo/util/moveablebuffer.h +++ b/src/mongo/util/moveablebuffer.h @@ -32,7 +32,8 @@ namespace mongo { -/** this is a sort of smart pointer class where we can move where something is and all the pointers will adjust. +/** this is a sort of smart pointer class where we can move where something is and all the pointers + * will adjust. not threadsafe. */ struct MoveableBuffer { @@ -46,7 +47,8 @@ struct MoveableBuffer { /* implementation (inlines) below */ -// this is a temp stub implementation...not really done yet - just having everything compile & such for checkpointing into git +// this is a temp stub implementation...not really done yet - just having everything compile & such +// for checkpointing into git inline MoveableBuffer::MoveableBuffer() : p(0) {} diff --git a/src/mongo/util/net/listen.h b/src/mongo/util/net/listen.h index 856658137ab..07370deeac0 100644 --- a/src/mongo/util/net/listen.h +++ b/src/mongo/util/net/listen.h @@ -96,7 +96,8 @@ public: if (_timeTracker) return _timeTracker->getMyElapsedTimeMillis(); - // should this assert or throw? seems like callers may not expect to get zero back, certainly not forever. + // should this assert or throw? seems like callers may not expect to get zero back, + // certainly not forever. return 0; } diff --git a/src/mongo/util/net/message.h b/src/mongo/util/net/message.h index d5ef5eae8d2..b1adccc1f80 100644 --- a/src/mongo/util/net/message.h +++ b/src/mongo/util/net/message.h @@ -330,7 +330,8 @@ inline int ConstView::dataLen() const { class Message { public: - // we assume here that a vector with initial size 0 does no allocation (0 is the default, but wanted to make it explicit). + // we assume here that a vector with initial size 0 does no allocation (0 is the default, but + // wanted to make it explicit). Message() : _buf(0), _data(0), _freeIt(false) {} Message(void* data, bool freeIt) : _buf(0), _data(0), _freeIt(false) { _setData(reinterpret_cast<char*>(data), freeIt); @@ -486,7 +487,8 @@ private: } // if just one buffer, keep it in _buf, otherwise keep a sequence of buffers in _data char* _buf; - // byte buffer(s) - the first must contain at least a full MsgData unless using _buf for storage instead + // byte buffer(s) - the first must contain at least a full MsgData unless using _buf for storage + // instead typedef std::vector<std::pair<char*, int>> MsgVec; MsgVec _data; bool _freeIt; diff --git a/src/mongo/util/net/message_port.h b/src/mongo/util/net/message_port.h index 27637acb5ac..f1e37328368 100644 --- a/src/mongo/util/net/message_port.h +++ b/src/mongo/util/net/message_port.h @@ -48,8 +48,8 @@ public: virtual void reply( Message& received, Message& response, - MSGID - responseTo) = 0; // like the reply below, but doesn't rely on received.data still being available + // like the reply below, but doesn't rely on received.data still being available + MSGID responseTo) = 0; virtual void reply(Message& received, Message& response) = 0; virtual HostAndPort remote() const = 0; diff --git a/src/mongo/util/net/miniwebserver.h b/src/mongo/util/net/miniwebserver.h index 8c3cfa72833..36320c342ae 100644 --- a/src/mongo/util/net/miniwebserver.h +++ b/src/mongo/util/net/miniwebserver.h @@ -45,15 +45,14 @@ public: MiniWebServer(const std::string& name, const std::string& ip, int _port); virtual ~MiniWebServer() {} - virtual void doRequest( - const char* rq, // the full request - std::string url, - // set these and return them: - std::string& responseMsg, - int& responseCode, - std::vector<std::string>& - headers, // if completely empty, content-type: text/html will be added - const SockAddr& from) = 0; + virtual void doRequest(const char* rq, // the full request + std::string url, + // set these and return them: + std::string& responseMsg, + int& responseCode, + std::vector<std::string>& headers, // if completely empty, content-type: + // text/html will be added + const SockAddr& from) = 0; // --- static helpers ---- diff --git a/src/mongo/util/ntservice.cpp b/src/mongo/util/ntservice.cpp index 6abe04a82d7..751f9870fe5 100644 --- a/src/mongo/util/ntservice.cpp +++ b/src/mongo/util/ntservice.cpp @@ -292,7 +292,8 @@ void installServiceOrDie(const wstring& serviceName, while (true) { // Make sure service doesn't already exist. - // TODO: Check to see if service is in "Deleting" status, suggest the user close down Services MMC snap-ins. + // TODO: Check to see if service is in "Deleting" status, suggest the user close down + // Services MMC snap-ins. schService = ::OpenService(schSCManager, serviceName.c_str(), SERVICE_ALL_ACCESS); if (schService != NULL) { log() << "There is already a service named '" << toUtf8String(serviceName) @@ -381,13 +382,13 @@ void installServiceOrDie(const wstring& serviceName, if (!serviceInstalled) { #else // This code sets the mongod service to auto-restart, forever. - // This might be a fine thing to do except that when mongod or Windows has a crash, the mongo.lock - // file is still around, so any attempt at a restart will immediately fail. With auto-restart, we - // go into a loop, crashing and restarting, crashing and restarting, until someone comes in and - // disables the service or deletes the mongod.lock file. + // This might be a fine thing to do except that when mongod or Windows has a crash, the + // mongo.lock file is still around, so any attempt at a restart will immediately fail. With + // auto-restart, we go into a loop, crashing and restarting, crashing and restarting, until + // someone comes in and disables the service or deletes the mongod.lock file. // - // I'm leaving the old code here for now in case we solve this and are able to turn SC_ACTION_RESTART - // back on. + // I'm leaving the old code here for now in case we solve this and are able to turn + // SC_ACTION_RESTART back on. // if (serviceInstalled) { SC_ACTION aActions[3] = { diff --git a/src/mongo/util/options_parser/option_description.h b/src/mongo/util/options_parser/option_description.h index 1dce8ea2980..4c50f0abbff 100644 --- a/src/mongo/util/options_parser/option_description.h +++ b/src/mongo/util/options_parser/option_description.h @@ -174,8 +174,9 @@ public: OptionDescription& validRange(long min, long max); /** - * Specifies that this option is incompatible with another option. The std::string provided must - * be the dottedName, which is the name used to access the option in the result Environment. + * Specifies that this option is incompatible with another option. The std::string provided + * must be the dottedName, which is the name used to access the option in the result + * Environment. * * TODO: Find a way to check that that option actually exists in our section somewhere. */ diff --git a/src/mongo/util/options_parser/options_parser.h b/src/mongo/util/options_parser/options_parser.h index 9c3752f1660..f247fb6dfb0 100644 --- a/src/mongo/util/options_parser/options_parser.h +++ b/src/mongo/util/options_parser/options_parser.h @@ -108,7 +108,8 @@ private: const std::vector<std::string>& argv, Environment*); - /** Handles parsing of an INI config std::string and adds the results to the given Environment */ + /** Handles parsing of an INI config std::string and adds the results to the given Environment + * */ Status parseINIConfigFile(const OptionSection&, const std::string& config, Environment*); /** Gets defaults from the OptionSection and adds them to the given Environment */ diff --git a/src/mongo/util/processinfo_linux2.cpp b/src/mongo/util/processinfo_linux2.cpp index 91a39cbe29a..d1ed23a4861 100644 --- a/src/mongo/util/processinfo_linux2.cpp +++ b/src/mongo/util/processinfo_linux2.cpp @@ -138,11 +138,13 @@ public: // The process ID. char _comm[128]; - // The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out. + // The filename of the executable, in parentheses. This is visible whether or not the + // executable is swapped out. char _state; - // One character from the string "RSDZTW" where R is running, S is sleeping in an interruptible wait, D is waiting in uninterruptible - // disk sleep, Z is zombie, T is traced or stopped (on a signal), and W is paging. + // One character from the string "RSDZTW" where R is running, S is sleeping in an interruptible + // wait, D is waiting in uninterruptible disk sleep, Z is zombie, T is traced or stopped (on a + // signal), and W is paging. int _ppid; // The PID of the parent. @@ -157,19 +159,23 @@ public: // The tty the process uses. int _tpgid; - // The process group ID of the process which currently owns the tty that the process is connected to. + // The process group ID of the process which currently owns the tty that the process is + // connected to. unsigned long _flags; // %lu - // The kernel flags word of the process. For bit meanings, see the PF_* defines in <linux/sched.h>. Details depend on the kernel version. + // The kernel flags word of the process. For bit meanings, see the PF_* defines in + // <linux/sched.h>. Details depend on the kernel version. unsigned long _min_flt; // %lu - // The number of minor faults the process has made which have not required loading a memory page from disk. + // The number of minor faults the process has made which have not required loading a memory page + // from disk. unsigned long _cmin_flt; // %lu // The number of minor faults that the process unsigned long _maj_flt; // %lu - // The number of major faults the process has made which have required loading a memory page from disk. + // The number of major faults the process has made which have required loading a memory page + // from disk. unsigned long _cmaj_flt; // %lu // The number of major faults that the process @@ -192,7 +198,8 @@ public: // number of threads unsigned long _alarm; - // The time in jiffies before the next SIGALRM is sent to the process due to an interval timer. (unused since 2.6.17) + // The time in jiffies before the next SIGALRM is sent to the process due to an interval timer. + // (unused since 2.6.17) unsigned long _start_time; // %lu // The time in jiffies the process started after system boot. @@ -201,8 +208,9 @@ public: // Virtual memory size in bytes. long _rss; // %ld - // Resident Set Size: number of pages the process has in real memory, minus 3 for administrative purposes. This is just the pages which - // count towards text, data, or stack space. This does not include pages which have not been demand-loaded in, or which are swapped out + // Resident Set Size: number of pages the process has in real memory, minus 3 for administrative + // purposes. This is just the pages which count towards text, data, or stack space. This + // does not include pages which have not been demand-loaded in, or which are swapped out unsigned long _rss_rlim; // %lu // Current limit in bytes on the rss of the process (usually 4294967295 on i386). @@ -310,7 +318,8 @@ public: } // try known flat-text file locations - // format: Slackware-x86_64 13.0, Red Hat Enterprise Linux Server release 5.6 (Tikanga), etc. + // format: Slackware-x86_64 13.0, Red Hat Enterprise Linux Server release 5.6 (Tikanga), + // etc. typedef vector<string> pathvec; pathvec paths; pathvec::const_iterator i; diff --git a/src/mongo/util/processinfo_win32.cpp b/src/mongo/util/processinfo_win32.cpp index e0d84214bc7..34391de46d0 100644 --- a/src/mongo/util/processinfo_win32.cpp +++ b/src/mongo/util/processinfo_win32.cpp @@ -438,8 +438,9 @@ bool ProcessInfo::blockInMemory(const void* start) { if (bstat) { for (int i=0; i<30; i++) { if (wiex[i].BasicInfo.FaultingPc == 0) break; - cout << "faulting pc = " << wiex[i].BasicInfo.FaultingPc << " address = " << wiex[i].BasicInfo.FaultingVa << " thread id = " << wiex[i].FaultingThreadId << endl; - } + cout << "faulting pc = " << wiex[i].BasicInfo.FaultingPc << "address = " + << wiex[i].BasicInfo.FaultingVa << " thread id = " + << wiex[i].FaultingThreadId << endl; } } #endif PSAPI_WORKING_SET_EX_INFORMATION wsinfo; diff --git a/src/mongo/util/progress_meter.h b/src/mongo/util/progress_meter.h index 3dc116886f7..fbf9887311b 100644 --- a/src/mongo/util/progress_meter.h +++ b/src/mongo/util/progress_meter.h @@ -126,8 +126,8 @@ private: // e.g.: // CurOp * op = txn.getCurOp(); -// ProgressMeterHolder pm(op->setMessage("index: (1/3) external sort", "Index: External Sort Progress", d->stats.nrecords, 10)); -// loop { pm.hit(); } +// ProgressMeterHolder pm(op->setMessage("index: (1/3) external sort", "Index: External Sort +// Progress", d->stats.nrecords, 10)); loop { pm.hit(); } class ProgressMeterHolder : boost::noncopyable { public: ProgressMeterHolder(ProgressMeter& pm) : _pm(pm) {} diff --git a/src/mongo/util/ptr.h b/src/mongo/util/ptr.h index 5ad5d94cb0e..98213ec8689 100644 --- a/src/mongo/util/ptr.h +++ b/src/mongo/util/ptr.h @@ -85,7 +85,8 @@ struct ptr { _p = p.get(); return *this; } - // template<typename U> ptr& operator= (const std::auto_ptr<U>& p) { _p = p.get(); return *this; } + // template<typename U> ptr& operator= (const std::auto_ptr<U>& p) { _p = p.get(); return *this; + // } // use T* operator->() const { diff --git a/src/mongo/util/queue.h b/src/mongo/util/queue.h index 2161b537a4c..0d1066d0ead 100644 --- a/src/mongo/util/queue.h +++ b/src/mongo/util/queue.h @@ -49,7 +49,8 @@ size_t _getSizeDefault(const T& t) { * A custom sizing function can optionally be given. By default the getSize function * returns 1 for each item, resulting in size equaling the number of items queued. * - * Note that use of this class is deprecated. This class only works with a single consumer and * a single producer. + * Note that use of this class is deprecated. This class only works with a single consumer and + * * a single producer. */ template <typename T> class BlockingQueue : boost::noncopyable { diff --git a/src/mongo/util/safe_num.cpp b/src/mongo/util/safe_num.cpp index 1350fca1c78..05eabe803e0 100644 --- a/src/mongo/util/safe_num.cpp +++ b/src/mongo/util/safe_num.cpp @@ -172,7 +172,9 @@ SafeNum addInt32Int32(int lInt32, int rInt32) { // NOTE: Please see "Secure Coding in C and C++", Second Edition, page 264-265 for // details on this algorithm (for an alternative resources, see // - // https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow?showComments=false). + // https://www.securecoding.cert.org/confluence/display/seccode/ + // INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow + // ?showComments=false). // // We are using the "Downcast from a larger type" algorithm here. We always perform // the arithmetic in 64-bit mode, which can never overflow for 32-bit @@ -214,7 +216,9 @@ SafeNum mulInt32Int32(int lInt32, int rInt32) { // NOTE: Please see "Secure Coding in C and C++", Second Edition, page 264-265 for // details on this algorithm (for an alternative resources, see // - // https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow?showComments=false). + // https://www.securecoding.cert.org/confluence/display/seccode/ + // INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow + // ?showComments=false). // // We are using the "Downcast from a larger type" algorithm here. We always perform // the arithmetic in 64-bit mode, which can never overflow for 32-bit diff --git a/src/mongo/util/startup_test.h b/src/mongo/util/startup_test.h index fd1b220e1d9..ed87d78ed38 100644 --- a/src/mongo/util/startup_test.h +++ b/src/mongo/util/startup_test.h @@ -33,15 +33,16 @@ namespace mongo { -/* The idea here is to let all initialization of global variables (classes inheriting from StartupTest) +/* The idea here is to let all initialization of global variables (classes inheriting from + * StartupTest) complete before we run the tests -- otherwise order of initilization being arbitrary may mess us up. The app's main() function should call runTests(). - To define a unit test, inherit from this and implement run. instantiate one object for the new class - as a global. + To define a unit test, inherit from this and implement run. instantiate one object for the new + class as a global. - These tests are ran on *every* startup of mongod, so they have to be very lightweight. But it is a - good quick check for a bad build. + These tests are ran on *every* startup of mongod, so they have to be very lightweight. But it is + a good quick check for a bad build. */ class StartupTest { public: diff --git a/src/mongo/util/winutil.h b/src/mongo/util/winutil.h index 57e93730867..5d4b727b111 100644 --- a/src/mongo/util/winutil.h +++ b/src/mongo/util/winutil.h @@ -48,7 +48,8 @@ inline std::string GetWinErrMsg(DWORD err) { NULL); std::string errMsgStr = toUtf8String(errMsg); ::LocalFree(errMsg); - // FormatMessage() appends a newline to the end of error messages, we trim it because std::endl flushes the buffer. + // FormatMessage() appends a newline to the end of error messages, we trim it because std::endl + // flushes the buffer. errMsgStr = errMsgStr.erase(errMsgStr.length() - 2); std::ostringstream output; output << errMsgStr << " (" << err << ")"; |