diff options
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/map_handle.ipp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/pipe_handle.ipp | 15 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp | 8 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/utils.ipp | 20 | ||||
-rw-r--r-- | include/llfio/v2.0/symlink_handle.hpp | 4 |
6 files changed, 48 insertions, 7 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index cc75ca09..df5d78b3 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/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 LLFIO_PREVIOUS_COMMIT_REF cbd573161b6703febcdc4f26d701066430317d27 -#define LLFIO_PREVIOUS_COMMIT_DATE "2020-03-17 10:15:31 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE cbd57316 +#define LLFIO_PREVIOUS_COMMIT_REF 48a380488e389962594914c234452fb8447d064a +#define LLFIO_PREVIOUS_COMMIT_DATE "2020-03-17 21:19:03 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 48a38048 diff --git a/include/llfio/v2.0/detail/impl/posix/map_handle.ipp b/include/llfio/v2.0/detail/impl/posix/map_handle.ipp index 969a70ce..6cebdbb3 100644 --- a/include/llfio/v2.0/detail/impl/posix/map_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/map_handle.ipp @@ -335,6 +335,7 @@ static inline result<void *> do_mmap(native_handle_type &nativeh, void *ataddr, #elif defined(__APPLE__) if(have_backing) { + (void) pagesizes; return errc::invalid_argument; } fd_to_use = VM_FLAGS_SUPERPAGE_SIZE_ANY; @@ -465,6 +466,7 @@ result<map_handle::size_type> map_handle::truncate(size_type newsize, bool permi _length = (length - _offset < newsize) ? (length - _offset) : newsize; // length of backing, not reservation return newsize; #else + (void) permit_relocation; // Try to expand reservation in place if(newsize > _reservation) { diff --git a/include/llfio/v2.0/detail/impl/posix/pipe_handle.ipp b/include/llfio/v2.0/detail/impl/posix/pipe_handle.ipp index 39c018e2..ef200448 100644 --- a/include/llfio/v2.0/detail/impl/posix/pipe_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/pipe_handle.ipp @@ -102,7 +102,18 @@ result<pipe_handle> pipe_handle::pipe(pipe_handle::path_view_type path, pipe_han } if(need_to_create_fifo) { +#ifdef __APPLE__ + native_handle_type dirhfd_; + dirhfd_.fd = dirhfd; + path_handle dirhfdwrap(dirhfd_); + auto dirhpath = dirhfdwrap.current_path(); + dirhfdwrap.release(); + OUTCOME_TRY(dirhpath); + dirhpath.value() /= leafname; + if(-1 == ::mkfifo(dirhpath.value().c_str(), 0x1b0 /*660*/)) +#else if(-1 == ::mkfifoat(dirhfd, leafname.c_str(), 0x1b0 /*660*/)) +#endif { return posix_error(); } @@ -123,7 +134,11 @@ result<std::pair<pipe_handle, pipe_handle>> pipe_handle::anonymous_pipe(caching LLFIO_LOG_FUNCTION_CALL(&ret); OUTCOME_TRY(readattribs, attribs_from_handle_mode_caching_and_flags(readnativeh, mode::read, creation::open_existing, _caching, flags)); OUTCOME_TRY(attribs_from_handle_mode_caching_and_flags(writenativeh, mode::append, creation::open_existing, _caching, flags)); +#ifdef O_DIRECT readattribs &= O_DIRECT | O_NONBLOCK; +#else + readattribs &= O_NONBLOCK; +#endif readnativeh.behaviour |= native_handle_type::disposition::pipe; readnativeh.behaviour &= ~native_handle_type::disposition::seekable; // not seekable writenativeh.behaviour |= native_handle_type::disposition::pipe; diff --git a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp index c90937f1..941f68c0 100644 --- a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp @@ -131,7 +131,7 @@ result<symlink_handle> symlink_handle::reopen(mode mode_, deadline d) const noex result<symlink_handle> ret(symlink_handle(native_handle_type(), _devid, _inode, _flags)); ret.value()._v.behaviour = _v.behaviour; OUTCOME_TRY(dirh, _dirh.clone()); - ret.value()._dirh = std::move(dirh); + ret.value()._dirh = path_handle(std::move(dirh)); try { ret.value()._leafname = _leafname; @@ -234,7 +234,7 @@ result<symlink_handle::path_type> symlink_handle::current_path() const noexcept { continue; } - return dirpath; + return {std::move(dirpath)}; } } catch(...) @@ -255,7 +255,7 @@ result<void> symlink_handle::relink(const path_handle &base, path_view_type path if(base.is_valid() && path_parent.empty()) { OUTCOME_TRY(dh, base.clone()); - _dirh = std::move(dh); + _dirh = path_handle(std::move(dh)); } else if(!path_parent.empty()) { @@ -314,7 +314,7 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<symlink_handle> symlink_handle::symlink(c dirhfd = base.native_handle().fd; #else OUTCOME_TRY(dh, base.clone()); - dirh = std::move(dh); + dirh = path_handle(std::move(dh)); dirhfd = dirh.native_handle().fd; #endif } diff --git a/include/llfio/v2.0/detail/impl/posix/utils.ipp b/include/llfio/v2.0/detail/impl/posix/utils.ipp index 79f5bd92..97a414d6 100644 --- a/include/llfio/v2.0/detail/impl/posix/utils.ipp +++ b/include/llfio/v2.0/detail/impl/posix/utils.ipp @@ -33,6 +33,10 @@ Distributed under the Boost Software License, Version 1.0. #ifdef __linux__ #include <unistd.h> // for preadv #endif +#ifdef __APPLE__ +#include <mach/task.h> +#include <mach/task_info.h> +#endif LLFIO_V2_NAMESPACE_BEGIN @@ -401,6 +405,22 @@ namespace utils { return error_from_exception(); } +#elif defined(__APPLE__) + kern_return_t error; + mach_msg_type_number_t outCount; + task_vm_info_data_t vmInfo; + + outCount = TASK_VM_INFO_COUNT; + error = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t)&vmInfo, &outCount); + if (error != KERN_SUCCESS) { + return errc::invalid_argument; + } + process_memory_usage ret; + ret.total_address_space_in_use = vmInfo.virtual_size; + ret.total_address_space_paged_in = vmInfo.resident_size; + ret.private_committed = vmInfo.internal + vmInfo.compressed; + ret.private_paged_in = vmInfo.phys_footprint; + return ret; #else #error Unknown platform #endif diff --git a/include/llfio/v2.0/symlink_handle.hpp b/include/llfio/v2.0/symlink_handle.hpp index 722eca4c..99b74a29 100644 --- a/include/llfio/v2.0/symlink_handle.hpp +++ b/include/llfio/v2.0/symlink_handle.hpp @@ -43,6 +43,10 @@ Distributed under the Boost Software License, Version 1.0. #pragma warning(disable : 4251) // dll interface #endif +extern "C" { + struct stat; +} + LLFIO_V2_NAMESPACE_EXPORT_BEGIN class symlink_handle; |