Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/fast_io_core_impl/mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ enum class open_mode : ::std::uint_least64_t
// *POSIX O_TRUNC
tty_init = static_cast<::std::uint_least64_t>(1) << 32,
// POSIX O_TTY_INIT
dsync = static_cast<::std::uint_least64_t>(1) << 33,
// POSIX O_DSYNC
rsync = static_cast<::std::uint_least64_t>(1) << 34,
// POSIX O_RSYNC
};

inline constexpr open_mode operator&(open_mode x, open_mode y) noexcept
Expand Down
1 change: 1 addition & 0 deletions include/fast_io_dsal/impl/misc/push_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#pragma push_macro("new")
#if __GNUC__ >= 16
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wkeyword-macro"
#undef new
#pragma GCC diagnostic pop
Expand Down
10 changes: 5 additions & 5 deletions include/fast_io_hosted/filesystem/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ inline posix_directory_iterator &operator++(posix_directory_iterator &pdit)
To fix: avoid setting errno
*/
errno = 0; // [tls]
auto entry{readdir(pdit.dirp)};
auto entry{::fast_io::noexcept_call(::readdir, pdit.dirp)};
auto en{errno};
if (entry == nullptr && en)
{
Expand All @@ -357,7 +357,7 @@ inline posix_directory_iterator &operator++(posix_directory_iterator &pdit)
inline posix_directory_iterator begin(posix_directory_generator const &pdg)
{
auto dirp{pdg.dir_fl.dirp};
::rewinddir(dirp);
::fast_io::noexcept_call(::rewinddir, dirp);
posix_directory_iterator pdit{dirp};
++pdit;
return pdit;
Expand Down Expand Up @@ -433,7 +433,7 @@ operator++(basic_posix_recursive_directory_iterator<StackType> &prdit)
errno = 0;
if (prdit.stack.empty())
{
auto entry{readdir(prdit.dirp)};
auto entry{::fast_io::noexcept_call(::readdir, prdit.dirp)};
if (entry == nullptr)
{
auto en{errno};
Expand All @@ -448,7 +448,7 @@ operator++(basic_posix_recursive_directory_iterator<StackType> &prdit)
}
else
{
auto entry = readdir(prdit.stack.back().dirp);
auto entry = ::fast_io::noexcept_call(::readdir, prdit.stack.back().dirp);
if (entry == nullptr)
{
auto en{errno};
Expand Down Expand Up @@ -515,7 +515,7 @@ inline basic_posix_recursive_directory_iterator<StackType>
begin(basic_posix_recursive_directory_generator<StackType> const &pdg)
{
auto dirp{pdg.dir_fl.dirp};
::rewinddir(dirp);
::fast_io::noexcept_call(::rewinddir, dirp);
basic_posix_recursive_directory_iterator<StackType> pdit{dirp};
++pdit;
return pdit;
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/platforms/nt.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ inline constexpr nt_open_mode calculate_nt_open_mode(open_mode_perms ompm) noexc
{
mode.CreateOptions |= 0x00000002; // FILE_WRITE_THROUGH
}
if ((value & open_mode::follow) != open_mode::none)
if ((value & open_mode::follow) == open_mode::none)
{
mode.CreateOptions |= 0x00200000; // FILE_FLAG_OPEN_REPARSE_POINT => FILE_OPEN_REPARSE_POINT (0x00200000)
}
Expand Down
12 changes: 12 additions & 0 deletions include/fast_io_hosted/platforms/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ inline constexpr int calculate_posix_open_mode(open_mode value) noexcept
mode |= O_SYNC;
}
#endif
#ifdef O_DSYNC
if ((value & open_mode::dsync) != open_mode::none)
{
mode |= O_DSYNC;
}
#endif
#ifdef O_RSYNC
if ((value & open_mode::rsync) != open_mode::none)
{
mode |= O_RSYNC;
}
#endif
#ifdef O_TTY_INIT
if ((value & open_mode::tty_init) != open_mode::none)
{
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_hosted/platforms/win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ inline constexpr win32_open_mode calculate_win32_open_mode(open_mode_perms ompm)
{
mode.dwFlagsAndAttributes |= 0x40000000; // FILE_FLAG_OVERLAPPED
}
if ((value & open_mode::follow) != open_mode::none)
if ((value & open_mode::follow) == open_mode::none)
{
mode.dwFlagsAndAttributes |= 0x00200000; // FILE_FLAG_OPEN_REPARSE_POINT
}
Expand Down