diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/CMakeLists.txt wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/CMakeLists.txt --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/CMakeLists.txt 2021-03-08 00:31:20.959042010 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/CMakeLists.txt 2021-03-08 01:17:40.919887572 +0100 @@ -5,7 +5,6 @@ option(WERROR "" OFF) -add_subdirectory(liburing) set(WCP_COMPILER_FLAGS -Wall -pedantic -Wextra) if (WERROR) @@ -34,7 +33,7 @@ src/ETACalculator.cpp) find_package(Threads) -target_link_libraries(wcp_lib Uring ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(wcp_lib uring ${CMAKE_THREAD_LIBS_INIT}) target_compile_options(wcp_lib PRIVATE ${WCP_COMPILER_FLAGS}) add_executable(wcp src/main.cpp) @@ -42,4 +41,4 @@ add_executable(tests src/tests.cpp src/acutest.h) target_link_libraries(tests wcp_lib) -target_compile_options(tests PRIVATE ${WCP_COMPILER_FLAGS}) \ No newline at end of file +target_compile_options(tests PRIVATE ${WCP_COMPILER_FLAGS}) Only in wcp-45ab7b81f2bc11f5f577978a974bb99838726d67: build Only in wcp-45ab7b81f2bc11f5f577978a974bb99838726d67: foo diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/CopyQueue.cpp wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/CopyQueue.cpp --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/CopyQueue.cpp 2021-03-08 00:31:20.969042225 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/CopyQueue.cpp 2021-03-08 02:07:23.263887052 +0100 @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include "CopyQueue.hpp" @@ -73,8 +74,8 @@ while (true) { - if constexpr (Config::VALGRIND_MODE) - pthread_yield(); +// if constexpr (Config::VALGRIND_MODE) +// pthread_yield(); // SUBMIT int32_t runnersAdded = 0; diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/CopyQueue.hpp wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/CopyQueue.hpp --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/CopyQueue.hpp 2021-03-08 00:31:20.969042225 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/CopyQueue.hpp 2021-03-08 00:34:28.293060034 +0100 @@ -65,7 +65,7 @@ io_uring ring = {}; std::deque copiesPendingStart; - pthread_mutex_t copiesPendingStartMutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; + pthread_mutex_t copiesPendingStartMutex = PTHREAD_MUTEX_INITIALIZER; std::atomic_uint32_t copiesPendingStartCount = 0; std::atomic_uint32_t keepAliveCount = 0; @@ -79,7 +79,7 @@ ETACalculator etaCalulator; std::vector errorMessages; - pthread_mutex_t errorMessagesMutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; + pthread_mutex_t errorMessagesMutex = PTHREAD_MUTEX_INITIALIZER; std::atomic_bool errored = false; static constexpr uint64_t RESERVED_FD_COUNT = 2; // Reserved one for the ring itself, and one for directory iteration diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/QueueFileDescriptor.cpp wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/QueueFileDescriptor.cpp --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/QueueFileDescriptor.cpp 2021-03-08 00:31:20.979042439 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/QueueFileDescriptor.cpp 2021-03-08 00:54:01.888938294 +0100 @@ -27,8 +27,8 @@ { while(!this->reserveFileDescriptor(OpenPriority::High)) { - if constexpr (Config::VALGRIND_MODE) - pthread_yield(); +// if constexpr (Config::VALGRIND_MODE) +// pthread_yield(); } return this->doOpen(); @@ -70,4 +70,4 @@ this->fd = std::get(result); return Success(); -} \ No newline at end of file +} diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/Util.cpp wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/Util.cpp --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/Util.cpp 2021-03-08 00:31:20.979042439 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/Util.cpp 2021-03-08 02:01:31.976352451 +0100 @@ -2,9 +2,11 @@ #include "Assert.hpp" #include #include +#include #include #include #include +#include void recursiveMkdir(std::string& path) { @@ -84,7 +86,7 @@ { int err = retrySyscall([&]() { - statx(fd, path.c_str(), flags, mask, &buf); + syscall(SYS_statx, fd, path.c_str(), flags, mask, &buf); }); if (err != 0) @@ -98,11 +100,11 @@ ssize_t retval = 0; int err = retrySyscall([&]() { - retval = getdents64(dfd, buffer, bufferSize); + retval = syscall(SYS_getdents64, dfd, buffer, bufferSize); }); if (err != 0) return Error("Couldn't open directory \"" + path + "\": \"" + strerror(err) + "\""); return size_t(retval); -} \ No newline at end of file +} diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/Util.hpp wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/Util.hpp --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/Util.hpp 2021-03-08 00:31:20.979042439 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/Util.hpp 2021-03-08 01:44:49.324847050 +0100 @@ -1,4 +1,6 @@ #pragma once +#include +#include #include #include #include @@ -19,8 +21,8 @@ explicit Error(std::string&& message): humanFriendlyErrorMessage(std::make_unique(std::move(message))) {} }; -using Result = std::variant; -static constexpr nullptr_t Success() { return nullptr; } +using Result = std::variant; +static constexpr std::nullptr_t Success() { return nullptr; } using OpenResult = std::variant; OpenResult myOpen(const std::string& path, int oflag, mode_t mode); @@ -55,4 +57,4 @@ using GetDentsResult = std::variant; [[nodiscard]] GetDentsResult myGetDents(int dfd, const std::string& path, void* buffer, size_t bufferSize); -[[nodiscard]] Result myStatx(int fd, const std::string& path, int flags, unsigned int mask, struct statx& buf); \ No newline at end of file +[[nodiscard]] Result myStatx(int fd, const std::string& path, int flags, unsigned int mask, struct statx& buf); diff -ur wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/wcpMain.cpp wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/wcpMain.cpp --- wcp-45ab7b81f2bc11f5f577978a974bb99838726d67.orig/src/wcpMain.cpp 2021-03-08 00:31:20.979042439 +0100 +++ wcp-45ab7b81f2bc11f5f577978a974bb99838726d67/src/wcpMain.cpp 2021-03-08 01:18:28.830915194 +0100 @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,7 @@ { destStatResult = retrySyscall([&]() { - statx(AT_FDCWD, dest.c_str(), 0, STATX_BASIC_STATS, &destStat); + syscall(SYS_statx, AT_FDCWD, dest.c_str(), 0, STATX_BASIC_STATS, &destStat); }); if (destStatResult != 0 && destStatResult != ENOENT) @@ -95,4 +96,4 @@ bool success = copyQueue.join(completionAction); return int(!success); -} \ No newline at end of file +}