12#ifndef OPENVPN_COMMON_STAT_H
13#define OPENVPN_COMMON_STAT_H
28 return ::stat(filename.c_str(), &buffer) == 0;
42 if (::stat(filename.c_str(), &s) != 0)
48inline bool is_directory(
const std::string &pathname,
const bool follow_symlinks =
false)
54 return ::stat(pathname.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode);
56 return ::lstat(pathname.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode);
63 if (::stat(filename.c_str(), &buffer) != 0)
66 return buffer.st_mtime;
72 typedef std::uint64_t T;
74 return T(s.st_mtimespec.tv_sec) * T(1000000000) + T(s.st_mtimespec.tv_nsec);
76 return T(s.st_mtim.tv_sec) * T(1000000000) + T(s.st_mtim.tv_nsec);
84 if (::stat(filename, &s) == 0)
100 if (::fstat(fd, &s) == 0)
Support deferred server-side state creation when client connects.
std::uint64_t stat_mod_time_nanoseconds(const struct stat &s)
std::uint64_t file_mod_time_milliseconds(const std::string &filename)
time_t file_mod_time(const std::string &filename)
bool is_directory(const std::string &pathname, const bool follow_symlinks=false)
bool file_exists_nonempty(const std::string &filename)
std::uint64_t file_mod_time_nanoseconds(const char *filename)
std::uint64_t fd_mod_time_nanoseconds(const int fd)
bool file_exists(const std::string &filename)