|
|
|
@ -23,9 +23,10 @@
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
|
|
|
|
|
# include <io.h> // _get_osfhandle and _isatty support
|
|
|
|
|
# include <process.h> // _get_pid support
|
|
|
|
|
# include <io.h> // for _get_osfhandle, _isatty, _fileno
|
|
|
|
|
# include <process.h> // for _get_pid
|
|
|
|
|
# include <spdlog/details/windows_include.h>
|
|
|
|
|
# include <fileapi.h> // for FlushFileBuffers
|
|
|
|
|
|
|
|
|
|
# ifdef __MINGW32__
|
|
|
|
|
# include <share.h>
|
|
|
|
@ -601,6 +602,17 @@ std::string SPDLOG_INLINE getenv(const char *field)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Do fsync by FILE descriptor
|
|
|
|
|
// Return true on success
|
|
|
|
|
SPDLOG_INLINE bool fsync(FILE *fd)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
return FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(fd)))) != 0;
|
|
|
|
|
#else
|
|
|
|
|
return ::fsync(fileno(fd)) == 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace os
|
|
|
|
|
} // namespace details
|
|
|
|
|
} // namespace spdlog
|
|
|
|
|