Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Readme.md8
m---------include/boost/afio/boost-lite0
m---------include/boost/afio/outcome0
-rw-r--r--include/boost/afio/revision.hpp6
-rw-r--r--include/boost/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp6
-rw-r--r--include/boost/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp4
-rw-r--r--include/boost/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp4
-rw-r--r--include/boost/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp8
-rw-r--r--include/boost/afio/v2.0/config.hpp4
-rw-r--r--include/boost/afio/v2.0/detail/impl/posix/file_handle.ipp10
-rw-r--r--include/boost/afio/v2.0/detail/impl/posix/handle.ipp12
-rw-r--r--include/boost/afio/v2.0/detail/impl/posix/io_service.ipp6
-rw-r--r--include/boost/afio/v2.0/detail/impl/posix/statfs.ipp2
-rw-r--r--include/boost/afio/v2.0/detail/impl/posix/storage_profile.ipp6
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/async_file_handle.ipp4
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/file_handle.ipp2
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/handle.ipp8
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/import.hpp8
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/io_service.ipp2
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/map_handle.ipp8
-rw-r--r--include/boost/afio/v2.0/detail/impl/windows/statfs.ipp2
-rw-r--r--include/boost/afio/v2.0/file_handle.hpp6
-rw-r--r--include/boost/afio/v2.0/handle.hpp8
-rw-r--r--include/boost/afio/v2.0/io_service.hpp4
m---------test/kerneltest0
25 files changed, 69 insertions, 59 deletions
diff --git a/Readme.md b/Readme.md
index a5c7efdd..f4b1cba7 100644
--- a/Readme.md
+++ b/Readme.md
@@ -7,14 +7,14 @@ Tarballs of source and prebuilt binaries with all unit tests passing: https://de
### Immediate todos in order of priority:
-- [ ] Audit Outcome and AFIO for all uses of `std::error_code::value()` and replace where
+- [x] Audit Outcome and AFIO for all uses of `std::error_code::value()` and replace where
appropriate with `std::errc::whatever`.
- [x] Get Outcome to work perfectly with exceptions and RTTI disabled, this makes
Outcome useful in the games/audio world.
- - [ ] Add a new Boost.Test emulation, one which is noexcept capable
+ - [x] Add a new Boost.Test emulation, one which is noexcept capable
- [ ] Move AFIO to being tested with exceptions and RTTI disabled. Where AFIO
throws, have it detect __cpp_exceptions and skip those implementations.
- - [ ] Add macro helpers to Outcome for returning outcomes out of things
+ - [x] Add macro helpers to Outcome for returning outcomes out of things
which cannot return values like constructors, and convert said exceptions/TLS
back into outcomes.
- Make use of std::system_error(errno, system_category, "custom error message");
@@ -46,7 +46,7 @@ fix e.g. named shared memory. Make log disc stored while we are at it.
fuzzed, coverage calculated, bloat calculated, ABI dumped etc
- Easy coverage is the usual gcov route => coveralls.io or gcovr http://gcovr.com/guide.html
- [ ] Single include generation
-- [ ] Make updating revision.hpp updated by the pre-commit git hook
+- [x] Make updating revision.hpp updated by the pre-commit git hook
- [ ] Add missing functions on handle/file_handle from AFIO v1
diff --git a/include/boost/afio/boost-lite b/include/boost/afio/boost-lite
-Subproject f7a19f6a8e0f51a8d47197e7b76d102bc12b167
+Subproject ef5c587149bada2c62d0b33a67a1e46decf2b6b
diff --git a/include/boost/afio/outcome b/include/boost/afio/outcome
-Subproject ad136750f6134fbe8576d65b1141a0d1ad888e1
+Subproject 90b397d29ae9b81d9347a7798a99188c592a874
diff --git a/include/boost/afio/revision.hpp b/include/boost/afio/revision.hpp
index bd73de7c..c471ace3 100644
--- a/include/boost/afio/revision.hpp
+++ b/include/boost/afio/revision.hpp
@@ -1,4 +1,4 @@
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
-#define BOOST_AFIO_PREVIOUS_COMMIT_REF fb6fb35b40877816f063adca44c30d7ce161baa1
-#define BOOST_AFIO_PREVIOUS_COMMIT_DATE "2017-04-08 13:11:21 +00:00"
-#define BOOST_AFIO_PREVIOUS_COMMIT_UNIQUE fb6fb35b
+#define BOOST_AFIO_PREVIOUS_COMMIT_REF 1f0e2992bf7f96caf52e62882917e4cf2a0569d1
+#define BOOST_AFIO_PREVIOUS_COMMIT_DATE "2017-04-08 21:33:47 +00:00"
+#define BOOST_AFIO_PREVIOUS_COMMIT_UNIQUE 1f0e2992
diff --git a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp
index 7574b6df..dd614682 100644
--- a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp
+++ b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp
@@ -223,7 +223,7 @@ namespace algorithm
BOOST_AFIO_LOG_FUNCTION_CALL(this);
atomic_append_detail::lock_request lock_request;
if(out.entities.size() > sizeof(lock_request.entities) / sizeof(lock_request.entities[0]))
- return make_errored_result<void>(E2BIG);
+ return make_errored_result<void>(stl11::errc::argument_list_too_long);
stl11::chrono::steady_clock::time_point began_steady;
stl11::chrono::system_clock::time_point end_utc;
@@ -393,12 +393,12 @@ namespace algorithm
if((d).steady)
{
if(stl11::chrono::steady_clock::now() >= (began_steady + stl11::chrono::nanoseconds((d).nsecs)))
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
else
{
if(stl11::chrono::system_clock::now() >= end_utc)
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
}
} while(record_offset >= _header.first_known_good);
diff --git a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp
index ec25af72..aa16fa98 100644
--- a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp
+++ b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp
@@ -183,12 +183,12 @@ namespace algorithm
if((d).steady)
{
if(stl11::chrono::steady_clock::now() >= (began_steady + stl11::chrono::nanoseconds((d).nsecs)))
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
else
{
if(stl11::chrono::system_clock::now() >= end_utc)
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
}
// Move was_contended to front and randomise rest of out.entities
diff --git a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp
index fc2df47d..f98ccb3b 100644
--- a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp
+++ b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp
@@ -177,12 +177,12 @@ namespace algorithm
if((d).steady)
{
if(stl11::chrono::steady_clock::now() >= (began_steady + stl11::chrono::nanoseconds((d).nsecs)))
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
else
{
if(stl11::chrono::system_clock::now() >= end_utc)
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
}
// Move was_contended to front and randomise rest of out.entities
diff --git a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp
index 8b0d86f7..17c78af6 100644
--- a/include/boost/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp
+++ b/include/boost/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp
@@ -243,7 +243,7 @@ namespace algorithm
// lock on the second final byte
BOOST_OUTCOME_TRY(mapinuse2, ret.lock(_mapinuseoffset, 1, true));
// Release the exclusive lock and tell caller to just use the fallback lock directly
- return make_errored_result<memory_map>(EBUSY);
+ return make_errored_result<memory_map>(stl11::errc::device_or_resource_busy);
}
else
{
@@ -333,7 +333,7 @@ namespace algorithm
}
if(_fallbacklock)
return _fallbacklock->_lock(out, d, spin_not_sleep);
- return make_errored_result<void>(EBUSY);
+ return make_errored_result<void>(stl11::errc::device_or_resource_busy);
}
stl11::chrono::steady_clock::time_point began_steady;
stl11::chrono::system_clock::time_point end_utc;
@@ -384,12 +384,12 @@ namespace algorithm
if((d).steady)
{
if(stl11::chrono::steady_clock::now() >= (began_steady + stl11::chrono::nanoseconds((d).nsecs)))
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
else
{
if(stl11::chrono::system_clock::now() >= end_utc)
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
}
}
// Move was_contended to front and randomise rest of out.entities
diff --git a/include/boost/afio/v2.0/config.hpp b/include/boost/afio/v2.0/config.hpp
index 4568e7b6..9c92c5d6 100644
--- a/include/boost/afio/v2.0/config.hpp
+++ b/include/boost/afio/v2.0/config.hpp
@@ -479,6 +479,10 @@ using namespace BOOST_OUTCOME_V1_NAMESPACE;
using BOOST_OUTCOME_V1_NAMESPACE::outcome;
using BOOST_OUTCOME_V1_NAMESPACE::make_errored_result;
using BOOST_OUTCOME_V1_NAMESPACE::make_errored_outcome;
+namespace stl11
+{
+ using BOOST_OUTCOME_V1_NAMESPACE::stl11::errc;
+}
#if DOXYGEN_SHOULD_SKIP_THIS
/*! \brief Please see https://ned14.github.io/boost.outcome/classboost_1_1outcome_1_1v1__xxx_1_1basic__monad.html
*/
diff --git a/include/boost/afio/v2.0/detail/impl/posix/file_handle.ipp b/include/boost/afio/v2.0/detail/impl/posix/file_handle.ipp
index 7fbb537d..613f27fe 100644
--- a/include/boost/afio/v2.0/detail/impl/posix/file_handle.ipp
+++ b/include/boost/afio/v2.0/detail/impl/posix/file_handle.ipp
@@ -298,7 +298,7 @@ result<handle> handle::clone(io_service &service, handle::mode mode, handle::cac
{
// Race free fetch the handle's path and reopen it with the new permissions
// TODO FIXME
- return make_errored_result<handle>(ENOSYS);
+ return make_errored_result<handle>(stl11::errc::function_not_supported);
}
else
{
@@ -319,7 +319,7 @@ result<handle> handle::clone(io_service &service, handle::mode mode, handle::cac
case handle::mode::attr_read:
case handle::mode::attr_write:
case handle::mode::read:
- return make_errored_result<handle>(EINVAL);
+ return make_errored_result<handle>(stl11::errc::invalid_argument);
case handle::mode::write:
attribs &= ~O_APPEND;
ret.value()._v.behaviour |= native_handle_type::disposition::seekable | native_handle_type::disposition::readable | native_handle_type::disposition::writable;
@@ -335,7 +335,7 @@ result<handle> handle::clone(io_service &service, handle::mode mode, handle::cac
if(caching != handle::caching::unchanged && caching != _caching)
{
// TODO: Allow fiddling with O_DIRECT
- return make_errored_result<handle>(EINVAL);
+ return make_errored_result<handle>(stl11::errc::invalid_argument);
}
}
return ret;
@@ -455,11 +455,11 @@ template <class CompletionRoutine, class BuffersType, class IORoutine> result<fi
using return_type = io_state_ptr<CompletionRoutine, BuffersType>;
#if BOOST_AFIO_USE_POSIX_AIO && defined(AIO_LISTIO_MAX)
if(items > AIO_LISTIO_MAX)
- return make_errored_result<return_type>(EINVAL);
+ return make_errored_result<return_type>(stl11::errc::invalid_argument);
#endif
void *mem = ::calloc(1, statelen);
if(!mem)
- return make_errored_result<return_type>(ENOMEM);
+ return make_errored_result<return_type>(stl11::errc::not_enough_memory);
return_type _state((_io_state_type<CompletionRoutine, BuffersType> *) mem);
new((state = (state_type *) mem)) state_type(this, operation, std::forward<CompletionRoutine>(completion), items);
// Noexcept move the buffers from req into result
diff --git a/include/boost/afio/v2.0/detail/impl/posix/handle.ipp b/include/boost/afio/v2.0/detail/impl/posix/handle.ipp
index d09da6b9..ad22dbaf 100644
--- a/include/boost/afio/v2.0/detail/impl/posix/handle.ipp
+++ b/include/boost/afio/v2.0/detail/impl/posix/handle.ipp
@@ -168,9 +168,9 @@ io_handle::io_result<io_handle::buffers_type> io_handle::read(io_handle::io_requ
{
BOOST_AFIO_LOG_FUNCTION_CALL(_v.fd);
if(d)
- return make_errored_result<>(ENOTSUP);
+ return make_errored_result<>(stl11::errc::not_supported);
if(reqs.buffers.size() > IOV_MAX)
- return make_errored_result<>(E2BIG);
+ return make_errored_result<>(stl11::errc::argument_list_too_long);
struct iovec *iov = (struct iovec *) alloca(reqs.size() * sizeof(struct iovec));
for(size_t n = 0; n < reqs.buffers.size(); n++)
{
@@ -197,9 +197,9 @@ io_handle::io_result<io_handle::const_buffers_type> io_handle::write(io_handle::
{
BOOST_AFIO_LOG_FUNCTION_CALL(_v.fd);
if(d)
- return make_errored_result<>(ENOTSUP);
+ return make_errored_result<>(stl11::errc::not_supported);
if(reqs.buffers.size() > IOV_MAX)
- return make_errored_result<>(E2BIG);
+ return make_errored_result<>(stl11::errc::argument_list_too_long);
struct iovec *iov = (struct iovec *) alloca(reqs.size() * sizeof(struct iovec));
for(size_t n = 0; n < reqs.buffers.size(); n++)
{
@@ -226,7 +226,7 @@ result<io_handle::extent_guard> io_handle::lock(io_handle::extent_type offset, i
{
BOOST_AFIO_LOG_FUNCTION_CALL(_v.fd);
if(d && d.nsecs > 0)
- return make_errored_result<io_handle::extent_guard>(ENOTSUP);
+ return make_errored_result<io_handle::extent_guard>(stl11::errc::not_supported);
bool failed = false;
#if !defined(__linux__) && !defined(F_OFD_SETLK)
if(0 == bytes)
@@ -277,7 +277,7 @@ result<io_handle::extent_guard> io_handle::lock(io_handle::extent_type offset, i
if(failed)
{
if(d && !d.nsecs && (EACCES == errno || EAGAIN == errno || EWOULDBLOCK == errno))
- return make_errored_result<void>(ETIMEDOUT);
+ return make_errored_result<void>(stl11::errc::timed_out);
else
return make_errored_result<void>(errno);
}
diff --git a/include/boost/afio/v2.0/detail/impl/posix/io_service.ipp b/include/boost/afio/v2.0/detail/impl/posix/io_service.ipp
index 9d740b42..8211da80 100644
--- a/include/boost/afio/v2.0/detail/impl/posix/io_service.ipp
+++ b/include/boost/afio/v2.0/detail/impl/posix/io_service.ipp
@@ -191,7 +191,7 @@ result<bool> io_service::run_until(deadline d) noexcept
if (!_work_queued)
return false;
if (pthread_self() != _threadh)
- return make_errored_result<bool>(EOPNOTSUPP);
+ return make_errored_result<bool>(stl11::errc::operation_not_supported);
stl11::chrono::steady_clock::time_point began_steady;
stl11::chrono::system_clock::time_point end_utc;
if (d)
@@ -300,12 +300,12 @@ result<bool> io_service::run_until(deadline d) noexcept
if (d.steady)
{
if(stl11::chrono::steady_clock::now()>=(began_steady + stl11::chrono::nanoseconds(d.nsecs)))
- return make_errored_result<bool>(ETIMEDOUT);
+ return make_errored_result<bool>(stl11::errc::timed_out);
}
else
{
if(stl11::chrono::system_clock::now()>=end_utc)
- return make_errored_result<bool>(ETIMEDOUT);
+ return make_errored_result<bool>(stl11::errc::timed_out);
}
}
} while(!done);
diff --git a/include/boost/afio/v2.0/detail/impl/posix/statfs.ipp b/include/boost/afio/v2.0/detail/impl/posix/statfs.ipp
index f6465fa5..a46525f5 100644
--- a/include/boost/afio/v2.0/detail/impl/posix/statfs.ipp
+++ b/include/boost/afio/v2.0/detail/impl/posix/statfs.ipp
@@ -125,7 +125,7 @@ BOOST_AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<size_t> statfs_t::fill(handle &h, st
}
#ifndef BOOST_AFIO_COMPILING_FOR_GCOV
if(mountentries.empty())
- return make_errored_result<size_t>(ENOENT);
+ return make_errored_result<size_t>(stl11::errc::no_such_file_or_directory);
// Choose the mount entry with the most closely matching statfs. You can't choose
// exclusively based on mount point because of bind mounts
if(mountentries.size() > 1)
diff --git a/include/boost/afio/v2.0/detail/impl/posix/storage_profile.ipp b/include/boost/afio/v2.0/detail/impl/posix/storage_profile.ipp
index fd8d492a..3a7c31da 100644
--- a/include/boost/afio/v2.0/detail/impl/posix/storage_profile.ipp
+++ b/include/boost/afio/v2.0/detail/impl/posix/storage_profile.ipp
@@ -255,16 +255,16 @@ namespace storage_profile
if(s[0]=='s' && s[1]=='c' && s[2]=='d') continue;
// Is there more than one physical disk device?
if(!mntfromname.empty())
- return make_errored_outcome<void>(ENOSYS);
+ return make_errored_outcome<void>(stl11::errc::function_not_supported);
mntfromname="/dev/"+std::string(s, e-s);
}
}
else
- return make_errored_outcome<void>(ENOSYS);
+ return make_errored_outcome<void>(stl11::errc::function_not_supported);
}
else
#endif
- return make_errored_outcome<void>(ENOSYS);
+ return make_errored_outcome<void>(stl11::errc::function_not_supported);
}
BOOST_OUTCOME_TRY(deviceh, file_handle::file(*h.service(), mntfromname, handle::mode::none, handle::creation::open_existing, handle::caching::only_metadata));
diff --git a/include/boost/afio/v2.0/detail/impl/windows/async_file_handle.ipp b/include/boost/afio/v2.0/detail/impl/windows/async_file_handle.ipp
index e320c72b..e4308f0d 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/async_file_handle.ipp
+++ b/include/boost/afio/v2.0/detail/impl/windows/async_file_handle.ipp
@@ -115,11 +115,11 @@ result<async_file_handle::io_state_ptr<CompletionRoutine, BuffersType>> async_fi
using return_type = io_state_ptr<CompletionRoutine, BuffersType>;
// On Windows i/o must be scheduled on the same thread pumping completion
if(GetCurrentThreadId() != service()->_threadid)
- return make_errored_result<return_type>(EOPNOTSUPP);
+ return make_errored_result<return_type>(stl11::errc::operation_not_supported);
void *mem = ::calloc(1, statelen);
if(!mem)
- return make_errored_result<return_type>(ENOMEM);
+ return make_errored_result<return_type>(stl11::errc::not_enough_memory);
return_type _state((_io_state_type<CompletionRoutine, BuffersType> *) mem);
new((state = (state_type *) mem)) state_type(this, operation, std::forward<CompletionRoutine>(completion), items);
diff --git a/include/boost/afio/v2.0/detail/impl/windows/file_handle.ipp b/include/boost/afio/v2.0/detail/impl/windows/file_handle.ipp
index ea6c600f..f3e89143 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/file_handle.ipp
+++ b/include/boost/afio/v2.0/detail/impl/windows/file_handle.ipp
@@ -225,7 +225,7 @@ result<file_handle::path_type> file_handle::relink(path_type newpath) noexcept
// FIXME: As soon as we implement fat paths, eliminate this mallocing NT path conversion nonsense
UNICODE_STRING NtPath;
if(!RtlDosPathNameToNtPathName_U(newpath.c_str(), &NtPath, NULL, NULL))
- return make_errored_result<path_type>(ENOENT);
+ return make_errored_result<path_type>(stl11::errc::no_such_file_or_directory);
auto unntpath = undoer([&NtPath] {
if(!HeapFree(GetProcessHeap(), 0, NtPath.Buffer))
abort();
diff --git a/include/boost/afio/v2.0/detail/impl/windows/handle.ipp b/include/boost/afio/v2.0/detail/impl/windows/handle.ipp
index f2adb05b..fa053419 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/handle.ipp
+++ b/include/boost/afio/v2.0/detail/impl/windows/handle.ipp
@@ -120,9 +120,9 @@ result<void> handle::set_kernel_caching(caching caching) noexcept
template <class BuffersType, class Syscall> inline io_handle::io_result<BuffersType> do_read_write(const native_handle_type &nativeh, Syscall &&syscall, io_handle::io_request<BuffersType> reqs, deadline d) noexcept
{
if(d && !nativeh.is_overlapped())
- return make_errored_result<BuffersType>(ENOTSUP);
+ return make_errored_result<BuffersType>(stl11::errc::not_supported);
if(reqs.buffers.size() > 64)
- return make_errored_result<BuffersType>(E2BIG);
+ return make_errored_result<BuffersType>(stl11::errc::argument_list_too_long);
BOOST_AFIO_WIN_DEADLINE_TO_SLEEP_INIT(d);
std::array<OVERLAPPED, 64> _ols;
@@ -201,7 +201,7 @@ result<io_handle::extent_guard> io_handle::lock(io_handle::extent_type offset, i
{
BOOST_AFIO_LOG_FUNCTION_CALL(_v.h);
if(d && d.nsecs > 0 && !_v.is_overlapped())
- return make_errored_result<io_handle::extent_guard>(ENOTSUP);
+ return make_errored_result<io_handle::extent_guard>(stl11::errc::not_supported);
DWORD flags = exclusive ? LOCKFILE_EXCLUSIVE_LOCK : 0;
if(d && !d.nsecs)
flags |= LOCKFILE_FAIL_IMMEDIATELY;
@@ -216,7 +216,7 @@ result<io_handle::extent_guard> io_handle::lock(io_handle::extent_type offset, i
if(!LockFileEx(_v.h, flags, 0, bytes_low, bytes_high, &ol))
{
if(ERROR_LOCK_VIOLATION == GetLastError() && d && !d.nsecs)
- return make_errored_result<io_handle::extent_guard>(ETIMEDOUT);
+ return make_errored_result<io_handle::extent_guard>(stl11::errc::timed_out);
if(ERROR_IO_PENDING != GetLastError())
return make_errored_result<io_handle::extent_guard>(GetLastError());
}
diff --git a/include/boost/afio/v2.0/detail/impl/windows/import.hpp b/include/boost/afio/v2.0/detail/impl/windows/import.hpp
index e261f865..3d9f8201 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/import.hpp
+++ b/include/boost/afio/v2.0/detail/impl/windows/import.hpp
@@ -819,12 +819,12 @@ if(d)
if((d).steady) \
{ \
if(stl11::chrono::steady_clock::now() >= (began_steady + stl11::chrono::nanoseconds((d).nsecs))) \
- return make_errored_result<type>(ETIMEDOUT); \
+ return make_errored_result<type>(stl11::errc::timed_out); \
} \
else \
{ \
if(stl11::chrono::system_clock::now() >= end_utc) \
- return make_errored_result<type>(ETIMEDOUT); \
+ return make_errored_result<type>(stl11::errc::timed_out); \
} \
\
}
@@ -894,12 +894,12 @@ if(d)
if((d).steady) \
{ \
if(stl11::chrono::steady_clock::now() >= (began_steady + stl11::chrono::nanoseconds((d).nsecs))) \
- return make_errored_result<type>(ETIMEDOUT); \
+ return make_errored_result<type>(stl11::errc::timed_out); \
} \
else \
{ \
if(stl11::chrono::system_clock::now() >= end_utc) \
- return make_errored_result<type>(ETIMEDOUT); \
+ return make_errored_result<type>(stl11::errc::timed_out); \
} \
\
}
diff --git a/include/boost/afio/v2.0/detail/impl/windows/io_service.ipp b/include/boost/afio/v2.0/detail/impl/windows/io_service.ipp
index f6967d98..f99b9028 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/io_service.ipp
+++ b/include/boost/afio/v2.0/detail/impl/windows/io_service.ipp
@@ -61,7 +61,7 @@ result<bool> io_service::run_until(deadline d) noexcept
if(!_work_queued)
return false;
if(GetCurrentThreadId() != _threadid)
- return make_errored_result<bool>(EOPNOTSUPP);
+ return make_errored_result<bool>(stl11::errc::operation_not_supported);
ntsleep(d, true);
return _work_queued != 0;
}
diff --git a/include/boost/afio/v2.0/detail/impl/windows/map_handle.ipp b/include/boost/afio/v2.0/detail/impl/windows/map_handle.ipp
index 6fc3b019..31d129b6 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/map_handle.ipp
+++ b/include/boost/afio/v2.0/detail/impl/windows/map_handle.ipp
@@ -47,7 +47,7 @@ result<section_handle> section_handle::section(file_handle &backing, extent_type
maximum_size = length;
}
else
- return make_errored_result<section_handle>(EINVAL);
+ return make_errored_result<section_handle>(stl11::errc::invalid_argument);
}
// Do NOT round up to page size here, it causes STATUS_SECTION_TOO_BIG
// maximum_size = utils::round_up_to_page_size(maximum_size);
@@ -245,7 +245,7 @@ result<map_handle::buffer_type> map_handle::commit(buffer_type region, section_h
{
BOOST_AFIO_LOG_FUNCTION_CALL(_v.h);
if(!region.first)
- return make_errored_result<map_handle::buffer_type>(EINVAL);
+ return make_errored_result<map_handle::buffer_type>(stl11::errc::invalid_argument);
DWORD prot = 0;
if(_flag == section_handle::flag::none)
{
@@ -282,7 +282,7 @@ result<void> map_handle::zero(buffer_type region) noexcept
{
BOOST_AFIO_LOG_FUNCTION_CALL(_v.h);
if(!region.first)
- return make_errored_result<void>(EINVAL);
+ return make_errored_result<void>(stl11::errc::invalid_argument);
//! \todo Once you implement file_handle::zero(), please implement map_handle::zero()
// buffer_type page_region { (char *) utils::round_up_to_page_size((uintptr_t) region.first), utils::round_down_to_page_size(region.second); };
memset(region.first, 0, region.second);
@@ -306,7 +306,7 @@ result<map_handle::buffer_type> map_handle::do_not_store(buffer_type region) noe
{
region = utils::round_to_page_size(region);
if(!region.first)
- return make_errored_result<map_handle::buffer_type>(EINVAL);
+ return make_errored_result<map_handle::buffer_type>(stl11::errc::invalid_argument);
if(!VirtualAlloc(region.first, region.second, MEM_RESET, 0))
return make_errored_result<buffer_type>(GetLastError());
return region;
diff --git a/include/boost/afio/v2.0/detail/impl/windows/statfs.ipp b/include/boost/afio/v2.0/detail/impl/windows/statfs.ipp
index bd9296d4..b0c7932e 100644
--- a/include/boost/afio/v2.0/detail/impl/windows/statfs.ipp
+++ b/include/boost/afio/v2.0/detail/impl/windows/statfs.ipp
@@ -155,7 +155,7 @@ BOOST_AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<size_t> statfs_t::fill(handle &h, st
len -= pathlen;
// buffer should look like \Device\HarddiskVolumeX
if(memcmp(buffer, L"\\Device\\HarddiskVolume", 44))
- return make_errored_result<size_t>(EILSEQ);
+ return make_errored_result<size_t>(stl11::errc::illegal_byte_sequence);
// TODO FIXME This should output the kind of path the input handle uses
// For now though, output a win32 compatible path
f_mntfromname.reserve(len + 3);
diff --git a/include/boost/afio/v2.0/file_handle.hpp b/include/boost/afio/v2.0/file_handle.hpp
index ba17337c..4268351b 100644
--- a/include/boost/afio/v2.0/file_handle.hpp
+++ b/include/boost/afio/v2.0/file_handle.hpp
@@ -245,6 +245,12 @@ public:
is both atomic and silent matching POSIX behaviour even on Microsoft Windows where
no Win32 API can match POSIX semantics.
+ \warning Some operating systems provide a race free syscall for renaming an open handle (Windows).
+ On all other operating systems this call is \b racy and can result in the wrong file entry being
+ deleted. Note that unless `flag::disable_safety_unlinks` is set, this implementation checks
+ before relinking that the item about to be relinked has the same inode as the open file handle.
+ This should prevent most unmalicious accidental loss of data.
+
\return The full new path of the relinked filesystem entry.
\param newpath The optionally partial new path to relink to. The current path is used as a base
for any relative paths specified.
diff --git a/include/boost/afio/v2.0/handle.hpp b/include/boost/afio/v2.0/handle.hpp
index d3f9f73c..9224a2c8 100644
--- a/include/boost/afio/v2.0/handle.hpp
+++ b/include/boost/afio/v2.0/handle.hpp
@@ -104,7 +104,7 @@ public:
to by `path()` upon the call of `close()` if and only if the inode matches. On Windows,
this opens the file handle with the `FILE_FLAG_DELETE_ON_CLOSE` modifier which substantially
affects caching policy and causes the \b first handle close to make the file unavailable for
- anyone else to open with an `EAGAIN` error return. Because this is confusing, unless the
+ anyone else to open with an `errc::resource_unavailable_try_again` error return. Because this is confusing, unless the
`win_disable_unlink_emulation` flag is also specified, this POSIX behaviour is
somewhat emulated by AFIO on Windows by renaming the file to a random name on `close()`
causing it to appear to have been unlinked immediately.
@@ -404,7 +404,7 @@ public:
\param reqs A scatter-gather and offset request.
\param d An optional deadline by which the i/o must complete, else it is cancelled.
Note function may return significantly after this deadline if the i/o takes long to cancel.
- \errors Any of the values POSIX read() can return, ETIMEDOUT, ECANCELED. ENOTSUP may be
+ \errors Any of the values POSIX read() can return, `errc::timed_out`, `errc::operation_canceled`. `errc::not_supported` may be
returned if deadline i/o is not possible with this particular handle configuration (e.g.
reading from regular files on POSIX or reading from a non-overlapped HANDLE on Windows).
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
@@ -428,7 +428,7 @@ public:
\param reqs A scatter-gather and offset request.
\param d An optional deadline by which the i/o must complete, else it is cancelled.
Note function may return significantly after this deadline if the i/o takes long to cancel.
- \errors Any of the values POSIX write() can return, ETIMEDOUT, ECANCELED. ENOTSUP may be
+ \errors Any of the values POSIX write() can return, `errc::timed_out`, `errc::operation_canceled`. `errc::not_supported` may be
returned if deadline i/o is not possible with this particular handle configuration (e.g.
writing to regular files on POSIX or writing to a non-overlapped HANDLE on Windows).
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
@@ -541,7 +541,7 @@ public:
flock() for non-insane semantics).
\param exclusive Whether the lock is to be exclusive.
\param d An optional deadline by which the lock must complete, else it is cancelled.
- \errors Any of the values POSIX fcntl() can return, ETIMEDOUT. ENOTSUP may be
+ \errors Any of the values POSIX fcntl() can return, `errc::timed_out`, `errc::not_supported` may be
returned if deadline i/o is not possible with this particular handle configuration (e.g.
non-overlapped HANDLE on Windows).
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
diff --git a/include/boost/afio/v2.0/io_service.hpp b/include/boost/afio/v2.0/io_service.hpp
index 6efa71ea..e8e11324 100644
--- a/include/boost/afio/v2.0/io_service.hpp
+++ b/include/boost/afio/v2.0/io_service.hpp
@@ -224,8 +224,8 @@ public:
#endif
/*! Runs the i/o service for the thread owning this i/o service. Returns true if more
- work remains and we just handled an i/o or post; false if there is no more work; ETIMEDOUT if
- the deadline passed; EOPNOTSUPP if you try to call it from a non-owning thread; EINVAL
+ work remains and we just handled an i/o or post; false if there is no more work; `errc::timed_out` if
+ the deadline passed; `errc::operation_not_supported` if you try to call it from a non-owning thread; `errc::invalid_argument`
if deadline is invalid.
*/
BOOST_AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<bool> run_until(deadline d) noexcept;
diff --git a/test/kerneltest b/test/kerneltest
-Subproject c6f9b348168e6478b4d99b4211827affeda6734
+Subproject e7239d243272fb4876674de3e0546fd25a223b4