46inline
bool file_write(const std::
string& path, const
void* buf,
size_t sz,
bool append = false)
48 return file_write(path.c_str(), buf, sz, append);
58inline bool file_write(
const std::string& path,
const std::string& s,
bool append =
false)
60 return file_write(path.c_str(), s.c_str(), s.length(), append);
128inline bool file_mkdir(
const std::string& path, __mode_t mode = 0755)
156 explicit inline operator bool()
const
236 explicit operator bool()
const
Counted vector of strings.
Definition TStrings.h:12
#define _MISC_FUNC
Definition misc/global.h:39
Definition Application.h:10
_MISC_FUNC bool getFiles(strings &files, const std::string &directory, const std::string &wildcard)
_MISC_FUNC void proc_setegid(gid_t gid)
_MISC_FUNC bool file_mkdir(const char *path, __mode_t mode=0755)
Makes all directories recursively in the path.
void proc_setuid(uid_t uid)
int _MISC_FUNC siginterrupt(int sig, int flag)
Replacement for deprecated 'siginterrupt' function. Returns EINVAL when the sig argument is not a val...
_MISC_FUNC std::string time_format(const struct tm *time_info, const char *format=nullptr)
Formats the time to the given format.
_MISC_FUNC void proc_setfsgid(gid_t gid)
struct group group_type
Definition lnx_utils.h:214
_MISC_FUNC time_t time_mktime(struct tm *tm, bool gm_time=false)
Same as mktime().
_MISC_FUNC std::filesystem::path file_fd_path(int fd)
_MISC_FUNC bool file_stat(const std::string &path, stat_t &_stat)
Same as stat() but using a std::string.
bool proc_getpwnam(std::string name, passwd_t &pwd)
_MISC_FUNC void proc_setfsuid(uid_t uid)
_MISC_FUNC pid_t gettid() noexcept
_MISC_FUNC bool proc_getgrnam(const std::string &name, group_t &grp)
void proc_seteuid(uid_t uid)
struct stat stat_t
Easier typename for 'struct stat'.
Definition lnx_utils.h:73
struct passwd passwd_type
Definition lnx_utils.h:136
_MISC_FUNC time_t time_str2time(const std::string &str, const char *format=nullptr, bool gm_time=false)
Gets the unix time from the passed string in the format that was passed.
_MISC_FUNC bool file_write(const char *path, const void *buf, size_t sz, bool append=false)
Writes a buffer to a filepath.
bool proc_getpwuid(uid_t uid, passwd_t &pwd)
_MISC_FUNC bool proc_getgrgid(gid_t gid, group_t &grp)
_MISC_FUNC void proc_setgid(gid_t gid)
Definition lnx_utils.h:221
friend bool proc_getgrgid(gid_t gid, group_t &grp)
friend bool proc_getgrnam(const std::string &name, group_t &grp)
Extends struct passwd and auto allocates needed memory. Used as a result type with auto memory cleanu...
Definition lnx_utils.h:143
friend bool proc_getpwuid(uid_t uid, passwd_t &pwd)
friend bool proc_getpwnam(std::string name, passwd_t &pwd)