22#if defined( __FreeBSD__ )
23 #define RESTINIO_FREEBSD_TARGET
24#elif defined(__APPLE__) && defined( __MACH__ )
25 #define RESTINIO_MACOS_TARGET
51#if defined( RESTINIO_FREEBSD_TARGET ) || defined( RESTINIO_MACOS_TARGET )
61 return file_descriptor;
65template <
typename META >
71 throw exception_t{
"invalid file descriptor" };
74#if defined( RESTINIO_FREEBSD_TARGET ) || defined( RESTINIO_MACOS_TARGET )
87 fmt::format(
"unable to get file stat : {}",
strerror(
errno ) ) };
90 const std::chrono::system_clock::time_point
92#if defined( RESTINIO_MACOS_TARGET )
93 std::chrono::seconds(
file_stat.st_mtimespec.tv_sec ) +
94 std::chrono::microseconds(
file_stat.st_mtimespec.tv_nsec / 1000 )
96 std::chrono::seconds(
file_stat.st_mtim.tv_sec ) +
97 std::chrono::microseconds(
file_stat.st_mtim.tv_nsec / 1000 )
constexpr file_descriptor_t null_file_descriptor()
Get file descriptor which stands for null.
std::uint64_t file_size_t
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
void close_file(file_descriptor_t fd)
Close file by its descriptor.
std::int64_t file_offset_t
std::FILE * file_descriptor_t
file_descriptor_t open_file(const char *file_path)
Open file.
META get_file_meta(file_descriptor_t fd)
Get file size.