Electroneum
util.h File Reference
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/optional.hpp>
#include <system_error>
#include <csignal>
#include <cstdio>
#include <functional>
#include <memory>
#include <string>
#include "crypto/hash.h"
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tools::close_file
 Functional class for closing C file handles. More...
 
class  tools::private_file
 A file restricted to process owner AND process. Deletes file on destruction. More...
 
class  tools::file_locker
 
class  tools::signal_handler
 Defines a signal handler for win32 and *nix. More...
 

Namespaces

 tools
 Various Tools.
 

Functions

std::string tools::get_default_data_dir ()
 Returns the default data directory. More...
 
std::string tools::get_os_version_string ()
 Returns the OS version string. More...
 
bool tools::create_directories_if_necessary (const std::string &path)
 creates directories for a path More...
 
std::error_code tools::replace_file (const std::string &old_name, const std::string &new_name)
 std::rename wrapper for nix and something strange for windows. More...
 
bool tools::sanitize_locale ()
 
bool tools::disable_core_dumps ()
 
bool tools::on_startup ()
 
void tools::set_strict_default_file_permissions (bool strict)
 
ssize_t tools::get_lockable_memory ()
 
void tools::set_max_concurrency (unsigned n)
 
unsigned tools::get_max_concurrency ()
 
bool tools::is_local_address (const std::string &address)
 
int tools::vercmp (const char *v0, const char *v1)
 
bool tools::sha256sum (const uint8_t *data, size_t len, crypto::hash &hash)
 
bool tools::sha256sum (const std::string &filename, crypto::hash &hash)
 
boost::optional< booltools::is_hdd (const char *file_path)
 
boost::optional< std::pair< uint32_t, uint32_t > > tools::parse_subaddress_lookahead (const std::string &str)
 
std::string tools::glob_to_regex (const std::string &val)
 
void tools::closefrom (int fd)
 
std::string tools::get_human_readable_timestamp (uint64_t ts)
 
std::string tools::get_human_readable_bytes (uint64_t bytes)
 
int tools::display_simple_progress_spinner (int x)