1 #ifndef PERSISTENT_UTIL_HPP 2 #define PERSISTENT_UTIL_HPP 4 #include "../PersistException.hpp" 10 #include <sys/types.h> 14 ({ __typeof__ (a) _a = (a); \ 15 __typeof__ (b) _b = (b); \ 19 ({ __typeof__ (a) _a = (a); \ 20 __typeof__ (b) _b = (b); \ 23 #define HIGH__int128(x) (*((uint64_t*)((uint64_t)(&(x)) + 8))) 24 #define LOW__int128(x) (*((uint64_t*)&(x))) 31 std::stringstream pid_ss;
33 return path + pid_ss.str();
45 if(
stat(dirPath.c_str(), &sb) == 0) {
46 if(!S_ISDIR(sb.st_mode)) {
51 if(mkdir(dirPath.c_str(), 0700) != 0) {
62 if(
stat(file.c_str(), &sb) == 0) {
63 if(!S_ISREG(sb.st_mode)) {
81 fd = open(file.c_str(), O_RDWR | O_CREAT, S_IWUSR | S_IRUSR | S_IRGRP | S_IWGRP | S_IROTH);
86 if(ftruncate(fd, size) != 0) {
93 #endif //UTIL_PERSISTENT_HPP #define PERSIST_EXP_TRUNCATE_FILE(x)
bool checkRegularFile(const std::string &file) noexcept(false)
const std::string & getConfString(const std::string &key)
#define PERSIST_EXP_INV_PATH
#define PERSIST_EXP_INV_FILE
#define PERSIST_EXP_CREATE_FILE(x)
std::string getPersFilePath()
bool checkOrCreateFileWithSize(const std::string &file, uint64_t size) noexcept(false)
void checkOrCreateDir(const std::string &dirPath) noexcept(false)
#define PERSIST_EXP_CREATE_PATH(x)
std::string getPersRamdiskPath()
#define CONF_PERS_RAMDISK_PATH
#define CONF_PERS_FILE_PATH