aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
AgeCommit message (Collapse)Author
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-11-28[trivial] Reuse translation and cleanup DEFAULT_* valuesMarcoFalke
* DEFAULT_DISABLE_SAFEMODE = false * Use DEFAULT_* constants for extern bools
2015-11-28Constrain constant values to a single location in codeLuke Dashjr
2015-11-27util: Don't set strMiscWarning on every exceptionWladimir J. van der Laan
Fixes #6809 - run-of-the-mill exceptions should not get into strMiscWarning (which is reported by `getinfo`).
2015-10-26Add option for microsecond precision in debug.logSuhas Daftuar
2015-09-30Changed logging to make -logtimestamps to work also for -printtoconsoleArne Brutschy
2015-09-03Move windows socket init to utility functionWladimir J. van der Laan
2015-07-27Fix argument parsing oddity with -noXWladimir J. van der Laan
`bitcoind -X -noX` ends up, unintuitively, with `X` set. (for all boolean options X) This result is due to the odd two-pass processing of arguments. This patch fixes this oddity and simplifies the code at the same time.
2015-07-23Merge pull request #6287Wladimir J. van der Laan
a794284 locking: add a quick example of GUARDED_BY (Cory Fields) 2b890dd locking: fix a few small issues uncovered by -Wthread-safety (Cory Fields) cd27bba locking: teach Clang's -Wthread-safety to cope with our scoped lock macros (Cory Fields)
2015-07-22Merge pull request #6149Wladimir J. van der Laan
27d7605 Buffer log messages and explicitly open logs (Adam Weiss)
2015-07-14openssl: avoid config file load/raceCory Fields
2015-07-06Buffer log messages and explicitly open logsAdam Weiss
Prevents stomping on debug logs in datadirs that are locked by other instances and lost parameter interaction messages that can get wiped by ShrinkDebugFile(). The log is now opened explicitly and all emitted messages are buffered until this open occurs. The version message and log cut have also been moved to the earliest possible sensible location.
2015-07-01Use real number of cores for default -par, ignore virtual coresWladimir J. van der Laan
To determine the default for `-par`, the number of script verification threads, use [boost::thread::physical_concurrency()](http://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_management.html#thread.thread_management.thread.physical_concurrency) which counts only physical cores, not virtual cores. Virtual cores are roughly a set of cached registers to avoid context switches while threading, they cannot actually perform work, so spawning a verification thread for them could even reduce efficiency and will put undue load on the system. Should fix issue #6358, as well as some other reported system overload issues, especially on Intel processors. The function was only introduced in boost 1.56, so provide a utility function `GetNumCores` to fall back for older Boost versions.
2015-06-16locking: fix a few small issues uncovered by -Wthread-safetyCory Fields
- rpcwallet: No need to lock twice here - openssl: Clang doesn't understand selective lock/unlock here. Ignore it. - CNode: Fix a legitimate (though very unlikely) locking bug.
2015-06-04use const references where appropriatePhilip Kaufmann
2015-05-19Make command line option to show all debugging consistent with similar optionslpescher
Most people expect a value of 1 to enable all for command line arguments. However to do this for the -debug option you must type "-debug=". This has been changed to allow "-debug=1" as well as "-debug=" to enable all debug logging
2015-05-14fix header include groupsPhilip Kaufmann
2015-05-10[squashme] simplify SetupEnvironment() (by dexX7)Jonas Schnelli
2015-05-01don't imbue boost::filesystem::path with locale "C" on windowsJonas Schnelli
fixes https://github.com/bitcoin/bitcoin/issues/6078
2015-04-30Merge pull request #6022Wladimir J. van der Laan
b74dcb3 Separate CTranslationInterface from CClientUIInterface (Jorge Timón)
2015-04-29DragonFlyBSD thread renaming.sinetek
2015-04-21FreeBSD, OpenBSD thread renaming.sinetek
2015-04-16Separate CTranslationInterface from CClientUIInterfaceJorge Timón
2015-03-27Initialization: set fallback locale as environment variabledexX7
The scope of `std::locale::global` appears to be smaller than `setenv("LC_ALL", ...)` and insufficient to fix messed up locale settings for the whole application.
2015-03-11Initialization: set Boost path locale in main threaddexX7
The path locale is lazy initialized and to avoid deinitialization errors in multithreading environments, it is set explicitly by the main thread.
2015-03-10Help messages correctly formatted (79 chars)Luca Venturini
Help messages are formatted programmatically with FormatParagraph in order not to break existing strings in Transifex. The new format works even if the translation of the strings modifies the lenght of the message. Sqashed 6 commits in a single one. Help messages correctly formatted for SVGA text mode (132 chars) Help messages are formatted programmatically with FormatParagraph in order not to break existing strings in Transifex. The new format should work even if the translation of the strings modifies the lenght of the message. Fix - syntax error Correct formatting for 79 chars Correctly based on C++ functions Removed spare spaces from option strings Fix - syntax error
2015-02-18Merge #5366: No longer check osx compatibility in RenameThreadWladimir J. van der Laan
850c570 No longer check osx compatibility in RenameThread (Michael Ford)
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-17make all catch() arguments constPhilip Kaufmann
- I saw this on http://en.cppreference.com/w/cpp/language/try_catch and thought it would be a good idea - also unify used format to better be able to search for exception uses in our codebase
2014-11-25No longer check osx compatibility in RenameThreadMichael Ford
10.5 support has been dropped for some time now.
2014-11-17Update comments in util to be doxygen compatibleMichael Ford
2014-11-01util.cpp comment correction21E14
2014-10-17Merge pull request #4804 from jtimon/chainparams3Wladimir J. van der Laan
Remove CBaseChainParams::NetworkID()
2014-10-11SQUASHME: fix "Reserve only one network specific cached path per session"jtimon
2014-09-25Fixing C4146 warningENikS
Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
2014-09-21Reserve only one network specific cached path per sessionjtimon
2014-09-20Also create pid file in non-daemon modeWladimir J. van der Laan
Always make a pid file, not only when `-daemon` specified. This is useful for troubleshooting, for attaching debuggers and loggers and such. - Write the pid file only after the datadir lock was acquired - Don't create or remove a pid file on WIN32, and also don't show the option
2014-09-16Merge pull request #4825Pieter Wuille
8d657a6 Fixing compiler warning C4800: 'type' forcing value to bool 'true' or 'false' (ENikS)
2014-09-10Use explicit fflush() instead of setvbuf()Adam Weiss
Flushing after every line when printing to console is desirable when running with systemd but setvbuf() has slightly different semantics on Windows that causes warnings. Just do an explicit fflush() after each line print to console instead.
2014-09-06Fixing compiler warning C4800: 'type' forcing value to bool 'true' or 'false'ENikS
2014-08-26Split up util.cpp/hWladimir J. van der Laan
Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
2014-08-26Move `*Version()` functions to version.h/cppWladimir J. van der Laan
2014-08-26Move SetThreadPriority implementation to util.cpp instead of the headerWladimir J. van der Laan
Put the THREAD_* and PRIO_ constants in compat.h.
2014-08-12build: check for sys/prctl.h in the proper wayWladimir J. van der Laan
Use AC_CHECK_HEADERS to check for the header, and include it only if detected and the subsequent HAVE_SYS_PRCTL_H is set.
2014-08-12Fix thread name settingWladimir J. van der Laan
Because of a typo, thread names no longer appeared in the overview. This was broken in 51ed9ec.
2014-07-15Can't log to debug log before chain params initializedWladimir J. van der Laan
Add a function `AreBaseParamsConfigured` and use this to check before writing to the debug log. This avoids assertions when the application happens to log too early, which happens in the GUI. Messages logged before the base parameters are configured can be shown using `-printtoconsole`.
2014-07-09move rand functions from util to new random.h/.cppPhilip Kaufmann
2014-07-09add GetRandBytes() as wrapper for RAND_bytes()Philip Kaufmann
- add a small wrapper in util around RAND_bytes() and replace with GetRandBytes() in the code to log errors from calling RAND_bytes() - remove OpenSSL header rand.h where no longer needed
2014-07-07Merge pull request #4401Wladimir J. van der Laan
cf04d83 add OpenSSL RAND_cleanup() on OpenSSL shutdown (Philip Kaufmann)
2014-07-07Move ui_interface to bitcoin_server.aWladimir J. van der Laan
There is no need for it in the utility libraries or tools. Put it in init.cpp, and in the tests separately (as they can't link init).