diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2023-03-31 10:54:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2023-03-31 12:28:07 +0300 |
commit | fc1cffcfa7f0497a1f97b384a24bcbf23362f3be (patch) | |
tree | c15f7ab5b9e9b20fd0ef8fc07d598d28e8b32004 /contrib | |
parent | 8a749596d40e91c896a1907afcd108d9221fbde1 (diff) | |
download | ydb-fc1cffcfa7f0497a1f97b384a24bcbf23362f3be.tar.gz |
Ydb stable 23-1-1923.1.19
x-stable-origin-commit: c5d5a396e89d0a72e0267a55e93d8404d4fb54fe
Diffstat (limited to 'contrib')
20 files changed, 36 insertions, 1745 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/windows/Net.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/windows/Net.cpp deleted file mode 100644 index b1ec65b5df..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/windows/Net.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <WinSock2.h> -#include <cassert> -#include <aws/core/utils/logging/LogMacros.h> - -namespace Aws -{ - namespace Net - { - static bool s_globalNetworkInitiated = false; - - bool IsNetworkInitiated() - { - return s_globalNetworkInitiated; - } - - void InitNetwork() - { - if (IsNetworkInitiated()) - { - return; - } - // Initialize Winsock( requires winsock version 2.2) - WSADATA wsaData; - int result = WSAStartup(MAKEWORD(2, 2), &wsaData); - assert(result == NO_ERROR); - if (result != NO_ERROR) - { - AWS_LOGSTREAM_ERROR("WinSock2", "Failed to Initate WinSock2.2"); - s_globalNetworkInitiated = false; - } - else - { - s_globalNetworkInitiated = true; - } - } - - void CleanupNetwork() - { - WSACleanup(); - s_globalNetworkInitiated = false; - } - } -} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/windows/SimpleUDP.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/windows/SimpleUDP.cpp deleted file mode 100644 index f6e36077ec..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/net/windows/SimpleUDP.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <WinSock2.h> -#include <Ws2ipdef.h> -#include <Ws2tcpip.h> -#include <cassert> -#include <aws/core/net/SimpleUDP.h> -#include <aws/core/utils/logging/LogMacros.h> -namespace Aws -{ - namespace Net - { - static const char ALLOC_TAG[] = "SimpleUDP"; - static const char IPV4_LOOP_BACK_ADDRESS[] = "127.0.0.1"; - static const char IPV6_LOOP_BACK_ADDRESS[] = "::1"; - - static inline bool IsValidIPAddress(const char* ip, int addressFamily/*AF_INET or AF_INET6*/) - { - char buffer[128]; - return inet_pton(addressFamily, ip, (void*)buffer) == 1 ?true :false; - } - - static bool GetASockAddrFromHostName(const char* hostName, void* sockAddrBuffer, size_t& addrLength, int& addressFamily) - { - struct addrinfo hints, *res; - - memset(&hints, 0, sizeof(hints)); - - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - if (getaddrinfo(hostName, nullptr, &hints, &res)) - { - return false; - } - - memcpy(sockAddrBuffer, res->ai_addr, res->ai_addrlen); - addrLength = res->ai_addrlen; - addressFamily = res->ai_family; - freeaddrinfo(res); - return true; - } - - static sockaddr_in BuildAddrInfoIPV4(const char* hostIP, short port) - { - sockaddr_in addrinfo {}; - addrinfo.sin_family = AF_INET; - addrinfo.sin_port = htons(port); - inet_pton(AF_INET, hostIP, &addrinfo.sin_addr); - return addrinfo; - } - - static sockaddr_in6 BuildAddrInfoIPV6(const char* hostIP, short port) - { - sockaddr_in6 addrinfo {}; - addrinfo.sin6_family = AF_INET6; - addrinfo.sin6_port = htons(port); - inet_pton(AF_INET6, hostIP, &addrinfo.sin6_addr); - return addrinfo; - } - - SimpleUDP::SimpleUDP(int addressFamily, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking): - m_addressFamily(addressFamily), m_connected(false), m_socket(-1), m_port(0) - { - CreateSocket(addressFamily, sendBufSize, receiveBufSize, nonBlocking); - } - - SimpleUDP::SimpleUDP(bool IPV4, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking) : - m_addressFamily(IPV4 ? AF_INET : AF_INET6), m_connected(false), m_socket(-1), m_port(0) - { - CreateSocket(m_addressFamily, sendBufSize, receiveBufSize, nonBlocking); - } - - SimpleUDP::SimpleUDP(const char* host, unsigned short port, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking) : - m_addressFamily(AF_INET), m_connected(false), m_socket(-1), m_port(port) - { - if (IsValidIPAddress(host, AF_INET)) - { - m_addressFamily = AF_INET; - m_hostIP = Aws::String(host); - } - else if (IsValidIPAddress(host, AF_INET6)) - { - m_addressFamily = AF_INET6; - m_hostIP = Aws::String(host); - } - else - { - char sockAddrBuffer[100]; - char hostBuffer[100]; - size_t addrLength = 0; - if (GetASockAddrFromHostName(host, (void*)sockAddrBuffer, addrLength, m_addressFamily)) - { - if (m_addressFamily == AF_INET) - { - struct sockaddr_in* sockaddr = reinterpret_cast<struct sockaddr_in*>(sockAddrBuffer); - inet_ntop(m_addressFamily, &(sockaddr->sin_addr), hostBuffer, sizeof(hostBuffer)); - } - else - { - struct sockaddr_in6* sockaddr = reinterpret_cast<struct sockaddr_in6*>(sockAddrBuffer); - inet_ntop(m_addressFamily, &(sockaddr->sin6_addr), hostBuffer, sizeof(hostBuffer)); - } - m_hostIP = Aws::String(hostBuffer); - } - else - { - AWS_LOGSTREAM_ERROR(ALLOC_TAG, "Can't retrieve a valid ip address based on provided host: " << host); - } - } - CreateSocket(m_addressFamily, sendBufSize, receiveBufSize, nonBlocking); - } - - SimpleUDP::~SimpleUDP() - { - closesocket(GetUnderlyingSocket()); - } - - void SimpleUDP::CreateSocket(int addressFamily, size_t sendBufSize, size_t receiveBufSize, bool nonBlocking) - { - SOCKET sock = socket(addressFamily, SOCK_DGRAM, IPPROTO_UDP); - assert(sock != INVALID_SOCKET); - - // Try to set sock to nonblocking mode. - if (nonBlocking) - { - u_long enable = 1; - ioctlsocket(sock, FIONBIO, &enable); - } - - // if sendBufSize is not zero, try to set send buffer size - if (sendBufSize) - { - int ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<const char*>(&sendBufSize), sizeof(sendBufSize)); - if (ret) - { - AWS_LOGSTREAM_WARN(ALLOC_TAG, "Failed to set UDP send buffer size to " << sendBufSize << " for socket " << sock << " error code: " << WSAGetLastError()); - } - assert(ret == 0); - } - - // if receiveBufSize is not zero, try to set receive buffer size - if (receiveBufSize) - { - int ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<const char*>(&receiveBufSize), sizeof(receiveBufSize)); - if (ret) - { - AWS_LOGSTREAM_WARN(ALLOC_TAG, "Failed to set UDP receive buffer size to " << receiveBufSize << " for socket " << sock << " error code: " << WSAGetLastError()); - } - assert(ret == 0); - } - - SetUnderlyingSocket(static_cast<int>(sock)); - } - - int SimpleUDP::Connect(const sockaddr* address, size_t addressLength) - { - int ret = connect(GetUnderlyingSocket(), address, static_cast<socklen_t>(addressLength)); - m_connected = ret ? false : true; - return ret; - } - - int SimpleUDP::ConnectToHost(const char* hostIP, unsigned short port) const - { - int ret; - if (m_addressFamily == AF_INET6) - { - sockaddr_in6 addrinfo = BuildAddrInfoIPV6(hostIP, port); - ret = connect(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in6)); - } - else - { - sockaddr_in addrinfo = BuildAddrInfoIPV4(hostIP, port); - ret = connect(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in)); - } - m_connected = ret ? false : true; - return ret; - } - - int SimpleUDP::ConnectToLocalHost(unsigned short port) const - { - if (m_addressFamily == AF_INET6) - { - return ConnectToHost(IPV6_LOOP_BACK_ADDRESS, port); - } - else - { - return ConnectToHost(IPV4_LOOP_BACK_ADDRESS, port); - } - } - - int SimpleUDP::Bind(const sockaddr* address, size_t addressLength) const - { - return bind(GetUnderlyingSocket(), address, static_cast<socklen_t>(addressLength)); - } - - int SimpleUDP::BindToLocalHost(unsigned short port) const - { - if (m_addressFamily == AF_INET6) - { - sockaddr_in6 addrinfo = BuildAddrInfoIPV6(IPV6_LOOP_BACK_ADDRESS, port); - return bind(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in6)); - } - else - { - sockaddr_in addrinfo = BuildAddrInfoIPV4(IPV4_LOOP_BACK_ADDRESS, port); - return bind(GetUnderlyingSocket(), reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in)); - } - } - - int SimpleUDP::SendData(const uint8_t* data, size_t dataLen) const - { - if (!m_connected) - { - ConnectToHost(m_hostIP.c_str(), m_port); - } - return send(GetUnderlyingSocket(), reinterpret_cast<const char*>(data), static_cast<int>(dataLen), 0); - } - - int SimpleUDP::SendDataTo(const sockaddr* address, size_t addressLength, const uint8_t* data, size_t dataLen) const - { - if (m_connected) - { - return send(GetUnderlyingSocket(), reinterpret_cast<const char*>(data), static_cast<int>(dataLen), 0); - } - else - { - return sendto(GetUnderlyingSocket(), reinterpret_cast<const char*>(data), static_cast<int>(dataLen), 0, address, static_cast<socklen_t>(addressLength)); - } - } - - int SimpleUDP::SendDataToLocalHost(const uint8_t* data, size_t dataLen, unsigned short port) const - { - if (m_connected) - { - return send(GetUnderlyingSocket(), reinterpret_cast<const char*>(data), static_cast<int>(dataLen), 0); - } - else if (m_addressFamily == AF_INET6) - { - sockaddr_in6 addrinfo = BuildAddrInfoIPV6(IPV6_LOOP_BACK_ADDRESS, port); - return sendto(GetUnderlyingSocket(), reinterpret_cast<const char*>(data), static_cast<int>(dataLen), 0, reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in6)); - } - else - { - sockaddr_in addrinfo = BuildAddrInfoIPV4(IPV4_LOOP_BACK_ADDRESS, port); - return sendto(GetUnderlyingSocket(), reinterpret_cast<const char*>(data), static_cast<int>(dataLen), 0, reinterpret_cast<sockaddr*>(&addrinfo), sizeof(sockaddr_in)); - } - } - - int SimpleUDP::ReceiveData(uint8_t* buffer, size_t bufferLen) const - { - return recv(GetUnderlyingSocket(), reinterpret_cast<char*>(buffer), static_cast<int>(bufferLen), 0); - } - - - int SimpleUDP::ReceiveDataFrom(sockaddr* address, size_t* addressLength, uint8_t* buffer, size_t bufferLen) const - { - return recvfrom(GetUnderlyingSocket(), reinterpret_cast<char*>(buffer), static_cast<int>(bufferLen), 0, address, reinterpret_cast<socklen_t*>(addressLength)); - } - } -} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Environment.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Environment.cpp deleted file mode 100644 index d8b5403123..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Environment.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/core/platform/Environment.h> - -#include <stdio.h> -#include <utility> - -namespace Aws -{ -namespace Environment -{ - -/* -using std::getenv generates a warning on windows so we use _dupenv_s instead. The character array returned by this function is our responsibility to clean up, so rather than returning raw strings -that would need to be manually freed in all the client functions, just copy it into a Aws::String instead, freeing it here. -*/ -Aws::String GetEnv(const char *variableName) -{ - char* variableValue = nullptr; - std::size_t valueSize = 0; - auto queryResult = _dupenv_s(&variableValue, &valueSize, variableName); - - Aws::String result; - if(queryResult == 0 && variableValue != nullptr && valueSize > 0) - { - result.assign(variableValue, valueSize - 1); // don't copy the c-string terminator byte - free(variableValue); - } - - return result; -} - -} // namespace Environment -} // namespace Aws diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp deleted file mode 100644 index 2ea82de6f8..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#include <aws/core/platform/FileSystem.h> - -#include <aws/core/platform/Environment.h> -#include <aws/core/utils/logging/LogMacros.h> -#include <aws/core/utils/StringUtils.h> -#include <cassert> -#include <iostream> -#include <Userenv.h> - -#pragma warning( disable : 4996) - -using namespace Aws::Utils; -namespace Aws -{ -namespace FileSystem -{ - -static const char* FILE_SYSTEM_UTILS_LOG_TAG = "FileSystem"; - -/** - * See - * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx - * to understand how could we pass long path (over 260 chars) to WinAPI - */ -static inline Aws::WString ToLongPath(const Aws::WString& path) -{ - if (path.size() > MAX_PATH - 12/*8.3 file name*/) - { - return L"\\\\?\\" + path; - } - return path; -} - -class User32Directory : public Directory -{ -public: - User32Directory(const Aws::String& path, const Aws::String& relativePath) : Directory(path, relativePath), m_find(INVALID_HANDLE_VALUE), m_lastError(0) - { - WIN32_FIND_DATAW ffd; - AWS_LOGSTREAM_TRACE(FILE_SYSTEM_UTILS_LOG_TAG, "Entering directory " << m_directoryEntry.path); - - m_find = FindFirstFileW(ToLongPath(Aws::Utils::StringUtils::ToWString(m_directoryEntry.path.c_str())).c_str(), &ffd); - if (m_find != INVALID_HANDLE_VALUE) - { - m_directoryEntry = ParseFileInfo(ffd, false); - FindClose(m_find); - auto seachPath = Join(m_directoryEntry.path, "*"); - m_find = FindFirstFileW(ToLongPath(Aws::Utils::StringUtils::ToWString(seachPath.c_str())).c_str(), &m_ffd); - } - else - { - AWS_LOGSTREAM_ERROR(FILE_SYSTEM_UTILS_LOG_TAG, "Could not load directory " << m_directoryEntry.path << " with error code " << GetLastError()); - } - } - - ~User32Directory() - { - if (m_find != INVALID_HANDLE_VALUE) - { - FindClose(m_find); - } - } - - operator bool() const override { return m_directoryEntry.operator bool() && m_find != INVALID_HANDLE_VALUE; } - - DirectoryEntry Next() override - { - assert(m_find != INVALID_HANDLE_VALUE); - DirectoryEntry entry; - bool invalidEntry = true; - - while(invalidEntry && !m_lastError) - { - //due to the way the FindFirstFile api works, - //the first entry will already be loaded by the time we get here. - entry = ParseFileInfo(m_ffd, true); - - Aws::String fileName = Aws::Utils::StringUtils::FromWString(m_ffd.cFileName); - if (fileName != ".." && fileName != ".") - { - AWS_LOGSTREAM_TRACE(FILE_SYSTEM_UTILS_LOG_TAG, "Found entry " << entry.path); - invalidEntry = false; - } - else - { - entry.fileType = FileType::None; - AWS_LOGSTREAM_TRACE(FILE_SYSTEM_UTILS_LOG_TAG, "Skipping . or .. entries."); - } - - if(!FindNextFileW(m_find, &m_ffd)) - { - m_lastError = GetLastError(); - AWS_LOGSTREAM_ERROR(FILE_SYSTEM_UTILS_LOG_TAG, "Could not fetch next entry from " << m_directoryEntry.path << " with error code " << m_lastError); - break; - } - } - - return entry; - } - -private: - DirectoryEntry ParseFileInfo(WIN32_FIND_DATAW& ffd, bool computePath) - { - DirectoryEntry entry; - LARGE_INTEGER fileSize; - fileSize.HighPart = ffd.nFileSizeHigh; - fileSize.LowPart = ffd.nFileSizeLow; - entry.fileSize = static_cast<int64_t>(fileSize.QuadPart); - - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - entry.fileType = FileType::Directory; - } - else - { - entry.fileType = FileType::File; - } - - if(computePath) - { - entry.path = Join(m_directoryEntry.path, Aws::Utils::StringUtils::FromWString(ffd.cFileName)); - entry.relativePath = m_directoryEntry.relativePath.empty() ? Aws::Utils::StringUtils::FromWString(ffd.cFileName) : Join(m_directoryEntry.relativePath, Aws::Utils::StringUtils::FromWString(ffd.cFileName)); - } - else - { - entry.path = m_directoryEntry.path; - entry.relativePath = m_directoryEntry.relativePath; - } - - return entry; - } - - HANDLE m_find; - WIN32_FIND_DATAW m_ffd; - DWORD m_lastError; -}; - -Aws::String GetHomeDirectory() -{ - static const char* HOME_DIR_ENV_VAR = "USERPROFILE"; - - AWS_LOGSTREAM_TRACE(FILE_SYSTEM_UTILS_LOG_TAG, "Checking " << HOME_DIR_ENV_VAR << " for the home directory."); - Aws::String homeDir = Aws::Environment::GetEnv(HOME_DIR_ENV_VAR); - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "Environment value for variable " << HOME_DIR_ENV_VAR << " is " << homeDir); - if(homeDir.empty()) - { - AWS_LOGSTREAM_WARN(FILE_SYSTEM_UTILS_LOG_TAG, "Home dir not stored in environment, trying to fetch manually from the OS."); - HANDLE hToken; - - if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken)) - { - DWORD len = MAX_PATH; - WCHAR path[MAX_PATH]; - if (GetUserProfileDirectoryW(hToken, path, &len)) - { - homeDir = Aws::Utils::StringUtils::FromWString(path); - } - CloseHandle(hToken); - } - - AWS_LOGSTREAM_INFO(FILE_SYSTEM_UTILS_LOG_TAG, "Pulled " << homeDir << " as home directory from the OS."); - } - - Aws::String retVal = (homeDir.size() > 0) ? Aws::Utils::StringUtils::Trim(homeDir.c_str()) : ""; - - if (!retVal.empty()) - { - if (retVal.at(retVal.length() - 1) != Aws::FileSystem::PATH_DELIM) - { - retVal += Aws::FileSystem::PATH_DELIM; - } - } - - return retVal; -} - -Aws::String GetExecutableDirectory() -{ - static const unsigned long long bufferSize = 256; - WCHAR buffer[bufferSize]; - - memset(buffer, 0, sizeof(buffer)); - - if (GetModuleFileNameW(nullptr, buffer, static_cast<DWORD>(sizeof(buffer)))) - { - Aws::String bufferStr(Aws::Utils::StringUtils::FromWString(buffer)); - auto fileNameStart = bufferStr.find_last_of(PATH_DELIM); - if (fileNameStart != std::string::npos) - { - bufferStr = bufferStr.substr(0, fileNameStart); - } - - return bufferStr; - } - - return ""; -} - -bool CreateDirectoryIfNotExists(const char* path, bool createParentDirs) -{ - Aws::String directoryName = path; - AWS_LOGSTREAM_INFO(FILE_SYSTEM_UTILS_LOG_TAG, "Creating directory " << directoryName); - - // Create intermediate directories or create the target directory once. - for (size_t i = createParentDirs ? 0 : directoryName.size() - 1; i < directoryName.size(); i++) - { - // Create the intermediate directory if we find a delimiter and the delimiter is not the first char, or if this is the target directory. - if (i != 0 && (directoryName[i] == FileSystem::PATH_DELIM || i == directoryName.size() - 1)) - { - // the last delimeter can be removed safely. - if (directoryName[i] == FileSystem::PATH_DELIM) - { - directoryName[i] = '\0'; - } - if (CreateDirectoryW(ToLongPath(StringUtils::ToWString(directoryName.c_str())).c_str(), nullptr)) - { - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "Creation of directory " << directoryName.c_str() << " succeeded."); - } - else - { - DWORD errorCode = GetLastError(); - if (errorCode != ERROR_ALREADY_EXISTS && errorCode != NO_ERROR) // in vs2013 the errorCode is NO_ERROR - { - AWS_LOGSTREAM_ERROR(FILE_SYSTEM_UTILS_LOG_TAG, " Creation of directory " << directoryName.c_str() << " returned code: " << errorCode); - return false; - } - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, " Creation of directory " << directoryName.c_str() << " returned code: " << errorCode); - } - // Restore the path. We are good even if we didn't change that char to '\0', because we are ready to return. - directoryName[i] = FileSystem::PATH_DELIM; - } - } - return true; -} - -bool RemoveFileIfExists(const char* path) -{ - AWS_LOGSTREAM_INFO(FILE_SYSTEM_UTILS_LOG_TAG, "Deleting file: " << path); - - if (DeleteFileW(ToLongPath(Aws::Utils::StringUtils::ToWString(path)).c_str())) - { - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "Successfully deleted file: " << path); - return true; - } - else - { - DWORD errorCode = GetLastError(); - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "Deletion of file: " << path << " Returned error code: " << errorCode); - return errorCode == ERROR_FILE_NOT_FOUND; - } -} - -bool RelocateFileOrDirectory(const char* from, const char* to) -{ - AWS_LOGSTREAM_INFO(FILE_SYSTEM_UTILS_LOG_TAG, "Moving file at " << from << " to " << to); - - if(MoveFileW(ToLongPath(Aws::Utils::StringUtils::ToWString(from)).c_str(), Aws::Utils::StringUtils::ToWString(to).c_str())) - { - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "The moving operation of file at " << from << " to " << to << " Succeeded."); - return true; - } - else - { - int errorCode = GetLastError(); - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "The moving operation of file at " << from << " to " << to << " Returned error code of " << errorCode); - return false; - } -} - -bool RemoveDirectoryIfExists(const char* path) -{ - AWS_LOGSTREAM_INFO(FILE_SYSTEM_UTILS_LOG_TAG, "Removing directory at " << path); - - if(RemoveDirectoryW(ToLongPath(Aws::Utils::StringUtils::ToWString(path)).c_str())) - { - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "The remove operation of file at " << path << " Succeeded."); - return true; - } - else - { - int errorCode = GetLastError(); - if (errorCode == ERROR_DIR_NOT_EMPTY) - { - AWS_LOGSTREAM_ERROR(FILE_SYSTEM_UTILS_LOG_TAG, "The remove operation of file at " << path << " failed. with error code because it was not empty."); - } - - else if(errorCode == ERROR_DIRECTORY) - { - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "The deletion of directory at " << path << " failed because it doesn't exist."); - return true; - - } - - AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "The remove operation of file at " << path << " failed. with error code " << errorCode); - return false; - } -} - -Aws::String CreateTempFilePath() -{ -#ifdef _MSC_VER -#pragma warning(disable: 4996) // _CRT_SECURE_NO_WARNINGS -#endif - char s_tempName[L_tmpnam_s+1]; - - /* - Prior to VS 2014, tmpnam/tmpnam_s generated root level files ("\filename") which were not appropriate for our usage, so for the windows version, we prepended a '.' to make it a - tempfile in the current directory. Starting with VS2014, the behavior of tmpnam/tmpnam_s was changed to be a full, valid filepath based on the - current user ("C:\Users\username\AppData\Local\Temp\..."). - - See the tmpnam section in http://blogs.msdn.com/b/vcblog/archive/2014/06/18/crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1.aspx - for more details. - */ - -#if _MSC_VER >= 1900 - tmpnam_s(s_tempName, L_tmpnam_s); -#else - s_tempName[0] = '.'; - tmpnam_s(s_tempName + 1, L_tmpnam_s); -#endif // _MSC_VER - - - return s_tempName; -} - -Aws::UniquePtr<Directory> OpenDirectory(const Aws::String& path, const Aws::String& relativePath) -{ - return Aws::MakeUnique<User32Directory>(FILE_SYSTEM_UTILS_LOG_TAG, path, relativePath); -} - -} // namespace FileSystem -} // namespace Aws diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp deleted file mode 100644 index 0180f7fbf6..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/core/platform/OSVersionInfo.h> -#include <aws/core/utils/StringUtils.h> -#include <aws/core/utils/memory/stl/AWSStringStream.h> - -#include <iomanip> - -#pragma warning(disable: 4996) -#include <windows.h> -#include <stdio.h> -namespace Aws -{ -namespace OSVersionInfo -{ - -Aws::String GetSysCommandOutput(const char* command) -{ - Aws::String outputStr; - FILE* outputStream; - const int maxBufferSize = 256; - char outputBuffer[maxBufferSize]; - - outputStream = _popen(command, "r"); - - if (outputStream) - { - while (!feof(outputStream)) - { - if (fgets(outputBuffer, maxBufferSize, outputStream) != nullptr) - { - outputStr.append(outputBuffer); - } - } - - _pclose(outputStream); - - return Aws::Utils::StringUtils::Trim(outputStr.c_str()); - } - - return {}; -} - -Aws::String ComputeOSVersionString() -{ - // With the release of Windows 8.1, the behavior of the GetVersionEx API has changed in the value it will return for the operating system version. - // The value returned by the GetVersionEx function now depends on how the application is manifested. - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 - // - // This only works when the application is manifested for Windows 8.1 or 10, which we don't actually care about. - // Also, this will cause build headaches for folks not building with VS2015, and is overall an unusable API for us. - // The following is the least painful but most reliable hack I can come up with. - // - // From this article: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724429.aspx - // we will do the following: - // - // To obtain the full version number for the operating system, call the GetFileVersionInfo function on one of the system DLLs, such as Kernel32.dll, - // then call VerQueryValue to obtain the \\StringFileInfo\\<lang><codepage>\\ProductVersion subblock of the file version information. - // - Aws::StringStream ss; - ss << "Windows/"; - - DWORD uselessParameter(0); - static const char* FILE_TO_CHECK = "Kernel32.dll"; - DWORD fileVersionSize = GetFileVersionInfoSizeA(FILE_TO_CHECK, &uselessParameter); - void* blob = Aws::Malloc("OSVersionInfo", static_cast<size_t>(fileVersionSize)); - bool versionFound(false); - - if (GetFileVersionInfoA(FILE_TO_CHECK, 0, fileVersionSize, blob)) - { - struct LANGANDCODEPAGE { - WORD wLanguage; - WORD wCodePage; - } *lpTranslate; - - UINT sizeOfCodePage(0); - - if (VerQueryValueA(blob, "\\VarFileInfo\\Translation", (LPVOID*)&lpTranslate, &sizeOfCodePage)) - { - //we don't actually care which language pack we get, they should all have the same windows version attached. - Aws::StringStream codePageSS; - codePageSS << "\\StringFileInfo\\"; - codePageSS << std::setfill('0') << std::setw(4) << std::nouppercase << std::hex << lpTranslate[0].wLanguage; - codePageSS << std::setfill('0') << std::setw(4) << std::nouppercase << std::hex << lpTranslate[0].wCodePage; - codePageSS << "\\ProductVersion"; - - void* subBlock(nullptr); - UINT subBlockSize(0); - - if (VerQueryValueA(blob, codePageSS.str().c_str(), &subBlock, &subBlockSize)) - { - ss << static_cast<const char*>(subBlock); - versionFound = true; - } - } - } - - Aws::Free(blob); - - if (!versionFound) - { - ss << "Unknown Version"; - } - - - - SYSTEM_INFO sysInfo; - ZeroMemory(&sysInfo, sizeof(SYSTEM_INFO)); - GetSystemInfo(&sysInfo); - - switch (sysInfo.wProcessorArchitecture) - { - //PROCESSOR_ARCHITECTURE_AMD64 - case 0x09: - ss << " AMD64"; - break; - //PROCESSOR_ARCHITECTURE_IA64 - case 0x06: - ss << " IA64"; - break; - //PROCESSOR_ARCHITECTURE_INTEL - case 0x00: - ss << " x86"; - break; - default: - ss << " Unknown Processor Architecture"; - break; - } - - return ss.str(); -} - - -} // namespace OSVersionInfo -} // namespace Aws diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Security.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Security.cpp deleted file mode 100644 index fbf9a4e679..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Security.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/core/platform/Security.h> - -#include <windows.h> - -namespace Aws -{ -namespace Security -{ - -void SecureMemClear(unsigned char *data, size_t length) -{ - SecureZeroMemory(data, length); -} - -} // namespace Security -} // namespace Aws diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Time.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Time.cpp deleted file mode 100644 index e186d21c81..0000000000 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/platform/windows/Time.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/core/platform/Time.h> - -#include <time.h> - -namespace Aws -{ -namespace Time -{ - -time_t TimeGM(struct tm* const t) -{ - return _mkgmtime(t); -} - -void LocalTime(tm* t, std::time_t time) -{ - localtime_s(t, &time); -} - -void GMTime(tm* t, std::time_t time) -{ - gmtime_s(t, &time); -} - -} // namespace Time -} // namespace Aws diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h index e23b95c224..2002d78262 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h @@ -304,10 +304,14 @@ class ServerInterface : public internal::CallHook { internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, - void* tag, bool delete_on_finalize); + void* tag, bool delete_on_finalize, + bool delay_start = false); bool FinalizeResult(void** tag, bool* status) override; + protected: + void Start(); + private: grpc_call_details call_details_; }; diff --git a/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.cc b/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.cc index b65583fcb2..a3f238220d 100644 --- a/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.cc +++ b/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.cc @@ -136,6 +136,7 @@ static void on_writable(void* acp, grpc_error_handle error) { int done; grpc_endpoint** ep = ac->ep; grpc_closure* closure = ac->closure; + std::string addr_str = ac->addr_str; grpc_fd* fd; (void)GRPC_ERROR_REF(error); @@ -221,8 +222,7 @@ finish: TString description = y_absl::StrCat("Failed to connect to remote host: ", str); error = grpc_error_set_str(error, GRPC_ERROR_STR_DESCRIPTION, description); - error = - grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS, ac->addr_str); + error = grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS, addr_str); } if (done) { // This is safe even outside the lock, because "done", the sentinel, is diff --git a/contrib/libs/grpc/src/core/lib/iomgr/work_serializer.cc b/contrib/libs/grpc/src/core/lib/iomgr/work_serializer.cc index 3af315ccb1..dab378c64d 100644 --- a/contrib/libs/grpc/src/core/lib/iomgr/work_serializer.cc +++ b/contrib/libs/grpc/src/core/lib/iomgr/work_serializer.cc @@ -121,10 +121,9 @@ void WorkSerializer::WorkSerializerImpl::Orphan() { if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) { gpr_log(GPR_INFO, "WorkSerializer::Orphan() %p", this); } - uint64_t prev_ref_pair = + const uint64_t prev_ref_pair = refs_.fetch_sub(MakeRefPair(0, 1), std::memory_order_acq_rel); - if (GetSize(prev_ref_pair) == 1) { - GPR_DEBUG_ASSERT(GetOwners(prev_ref_pair) == 0); + if (GetOwners(prev_ref_pair) == 0 && GetSize(prev_ref_pair) == 1) { if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) { gpr_log(GPR_INFO, " Destroying"); } @@ -170,13 +169,19 @@ void WorkSerializer::WorkSerializerImpl::DrainQueueOwned() { return; } if (GetSize(prev_ref_pair) == 2) { - // Queue drained. Give up ownership but only if queue remains empty. Note - // that we are using relaxed memory order semantics for the load on - // failure since we don't care about that value. + // Queue drained. Give up ownership but only if queue remains empty. uint64_t expected = MakeRefPair(1, 1); if (refs_.compare_exchange_strong(expected, MakeRefPair(0, 1), - std::memory_order_acq_rel, - std::memory_order_relaxed)) { + std::memory_order_acq_rel)) { + // Queue is drained. + return; + } + if (GetSize(expected) == 0) { + // WorkSerializer got orphaned while this was running + if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) { + gpr_log(GPR_INFO, " Queue Drained. Destroying"); + } + delete this; return; } } diff --git a/contrib/libs/grpc/src/cpp/server/server_cc.cc b/contrib/libs/grpc/src/cpp/server/server_cc.cc index edb1fe4d1d..02a52263c9 100644 --- a/contrib/libs/grpc/src/cpp/server/server_cc.cc +++ b/contrib/libs/grpc/src/cpp/server/server_cc.cc @@ -225,17 +225,24 @@ void ServerInterface::RegisteredAsyncRequest::IssueRequest( ServerInterface::GenericAsyncRequest::GenericAsyncRequest( ServerInterface* server, GenericServerContext* context, internal::ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, void* tag, bool delete_on_finalize) + ServerCompletionQueue* notification_cq, void* tag, bool delete_on_finalize, + bool delay_start) : BaseAsyncRequest(server, context, stream, call_cq, notification_cq, tag, delete_on_finalize) { grpc_call_details_init(&call_details_); - GPR_ASSERT(notification_cq); - GPR_ASSERT(call_cq); + if (!delay_start) { + Start(); + } +} + +void ServerInterface::GenericAsyncRequest::Start() { + GPR_ASSERT(notification_cq_); + GPR_ASSERT(call_cq_); // The following call_start_batch is internally-generated so no need for an // explanatory log on failure. - GPR_ASSERT(grpc_server_request_call(server->server(), &call_, &call_details_, - context->client_metadata_.arr(), - call_cq->cq(), notification_cq->cq(), + GPR_ASSERT(grpc_server_request_call(server_->server(), &call_, &call_details_, + context_->client_metadata_.arr(), + call_cq_->cq(), notification_cq_->cq(), this) == GRPC_CALL_OK); } @@ -303,7 +310,9 @@ class Server::UnimplementedAsyncRequest final UnimplementedAsyncRequest(ServerInterface* server, grpc::ServerCompletionQueue* cq) : GenericAsyncRequest(server, &server_context_, &generic_stream_, cq, cq, - nullptr, false) {} + nullptr, false, true) { + Start(); + } bool FinalizeResult(void** tag, bool* status) override; diff --git a/contrib/libs/libxml/CMakeLists.darwin.txt b/contrib/libs/libxml/CMakeLists.darwin.txt index cebe9de336..1893b6f891 100644 --- a/contrib/libs/libxml/CMakeLists.darwin.txt +++ b/contrib/libs/libxml/CMakeLists.darwin.txt @@ -6,7 +6,6 @@ # original buildsystem will not be accepted. -find_package(Iconv REQUIRED) find_package(ZLIB REQUIRED) add_library(contrib-libs-libxml) @@ -26,7 +25,6 @@ target_include_directories(contrib-libs-libxml PRIVATE target_link_libraries(contrib-libs-libxml PUBLIC contrib-libs-cxxsupp yutil - Iconv::Iconv ZLIB::ZLIB library-cpp-charset ) diff --git a/contrib/libs/libxml/CMakeLists.linux-aarch64.txt b/contrib/libs/libxml/CMakeLists.linux-aarch64.txt index 8d1f7ee7bf..09717ab04e 100644 --- a/contrib/libs/libxml/CMakeLists.linux-aarch64.txt +++ b/contrib/libs/libxml/CMakeLists.linux-aarch64.txt @@ -6,7 +6,6 @@ # original buildsystem will not be accepted. -find_package(Iconv REQUIRED) find_package(ZLIB REQUIRED) add_library(contrib-libs-libxml) @@ -27,7 +26,6 @@ target_link_libraries(contrib-libs-libxml PUBLIC contrib-libs-linux-headers contrib-libs-cxxsupp yutil - Iconv::Iconv ZLIB::ZLIB library-cpp-charset ) diff --git a/contrib/libs/libxml/CMakeLists.linux.txt b/contrib/libs/libxml/CMakeLists.linux.txt index 8d1f7ee7bf..09717ab04e 100644 --- a/contrib/libs/libxml/CMakeLists.linux.txt +++ b/contrib/libs/libxml/CMakeLists.linux.txt @@ -6,7 +6,6 @@ # original buildsystem will not be accepted. -find_package(Iconv REQUIRED) find_package(ZLIB REQUIRED) add_library(contrib-libs-libxml) @@ -27,7 +26,6 @@ target_link_libraries(contrib-libs-libxml PUBLIC contrib-libs-linux-headers contrib-libs-cxxsupp yutil - Iconv::Iconv ZLIB::ZLIB library-cpp-charset ) diff --git a/contrib/restricted/boost/context/include/boost/context/stack_context.hpp b/contrib/restricted/boost/context/include/boost/context/stack_context.hpp deleted file mode 100644 index 740d981dc7..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/stack_context.hpp +++ /dev/null @@ -1,72 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_STACK_CONTEXT_H -#define BOOST_CONTEXT_STACK_CONTEXT_H - -#include <cstddef> - -#include <boost/config.hpp> - -#include <boost/context/detail/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -#if ! defined(BOOST_CONTEXT_NO_CXX11) -struct BOOST_CONTEXT_DECL stack_context { -# if defined(BOOST_USE_SEGMENTED_STACKS) - typedef void * segments_context[BOOST_CONTEXT_SEGMENTS]; -# endif - - std::size_t size{ 0 }; - void * sp{ nullptr }; -# if defined(BOOST_USE_SEGMENTED_STACKS) - segments_context segments_ctx{}; -# endif -# if defined(BOOST_USE_VALGRIND) - unsigned valgrind_stack_id{ 0 }; -# endif -}; -#else -struct BOOST_CONTEXT_DECL stack_context { -# if defined(BOOST_USE_SEGMENTED_STACKS) - typedef void * segments_context[BOOST_CONTEXT_SEGMENTS]; -# endif - - std::size_t size; - void * sp; -# if defined(BOOST_USE_SEGMENTED_STACKS) - segments_context segments_ctx; -# endif -# if defined(BOOST_USE_VALGRIND) - unsigned valgrind_stack_id; -# endif - - stack_context() : - size( 0), - sp( 0) -# if defined(BOOST_USE_SEGMENTED_STACKS) - , segments_ctx() -# endif -# if defined(BOOST_USE_VALGRIND) - , valgrind_stack_id( 0) -# endif - {} -}; -#endif - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_STACK_CONTEXT_H diff --git a/contrib/restricted/boost/context/src/asm/jump_x86_64_ms_pe_masm.masm b/contrib/restricted/boost/context/src/asm/jump_x86_64_ms_pe_masm.masm deleted file mode 100644 index c8a28a558e..0000000000 --- a/contrib/restricted/boost/context/src/asm/jump_x86_64_ms_pe_masm.masm +++ /dev/null @@ -1,205 +0,0 @@ - -; Copyright Oliver Kowalke 2009. -; Distributed under the Boost Software License, Version 1.0. -; (See accompanying file LICENSE_1_0.txt or copy at -; http://www.boost.org/LICENSE_1_0.txt) - -; ---------------------------------------------------------------------------------- -; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | -; ---------------------------------------------------------------------------------- -; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -; ---------------------------------------------------------------------------------- -; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -; ---------------------------------------------------------------------------------- -; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -; ---------------------------------------------------------------------------------- -; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -; ---------------------------------------------------------------------------------- -; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -; ---------------------------------------------------------------------------------- -; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | -; ---------------------------------------------------------------------------------- -; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -; ---------------------------------------------------------------------------------- -; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | -; ---------------------------------------------------------------------------------- -; | limit | base | R12 | R13 | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -; ---------------------------------------------------------------------------------- -; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | -; ---------------------------------------------------------------------------------- -; | R14 | R15 | RDI | RSI | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -; ---------------------------------------------------------------------------------- -; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | -; ---------------------------------------------------------------------------------- -; | RBX | RBP | hidden | RIP | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -; ---------------------------------------------------------------------------------- -; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | -; ---------------------------------------------------------------------------------- -; | parameter area | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -; ---------------------------------------------------------------------------------- -; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | -; ---------------------------------------------------------------------------------- -; | FCTX | DATA | | -; ---------------------------------------------------------------------------------- - -.code - -jump_fcontext PROC BOOST_CONTEXT_EXPORT FRAME - .endprolog - - ; prepare stack - lea rsp, [rsp-0118h] - -IFNDEF BOOST_USE_TSX - ; save XMM storage - movaps [rsp], xmm6 - movaps [rsp+010h], xmm7 - movaps [rsp+020h], xmm8 - movaps [rsp+030h], xmm9 - movaps [rsp+040h], xmm10 - movaps [rsp+050h], xmm11 - movaps [rsp+060h], xmm12 - movaps [rsp+070h], xmm13 - movaps [rsp+080h], xmm14 - movaps [rsp+090h], xmm15 - ; save MMX control- and status-word - stmxcsr [rsp+0a0h] - ; save x87 control-word - fnstcw [rsp+0a4h] -ENDIF - - ; load NT_TIB - mov r10, gs:[030h] - ; save fiber local storage - mov rax, [r10+020h] - mov [rsp+0b0h], rax - ; save current deallocation stack - mov rax, [r10+01478h] - mov [rsp+0b8h], rax - ; save current stack limit - mov rax, [r10+010h] - mov [rsp+0c0h], rax - ; save current stack base - mov rax, [r10+08h] - mov [rsp+0c8h], rax - - mov [rsp+0d0h], r12 ; save R12 - mov [rsp+0d8h], r13 ; save R13 - mov [rsp+0e0h], r14 ; save R14 - mov [rsp+0e8h], r15 ; save R15 - mov [rsp+0f0h], rdi ; save RDI - mov [rsp+0f8h], rsi ; save RSI - mov [rsp+0100h], rbx ; save RBX - mov [rsp+0108h], rbp ; save RBP - - mov [rsp+0110h], rcx ; save hidden address of transport_t - - ; preserve RSP (pointing to context-data) in R9 - mov r9, rsp - - ; restore RSP (pointing to context-data) from RDX - mov rsp, rdx - -IFNDEF BOOST_USE_TSX - ; restore XMM storage - movaps xmm6, [rsp] - movaps xmm7, [rsp+010h] - movaps xmm8, [rsp+020h] - movaps xmm9, [rsp+030h] - movaps xmm10, [rsp+040h] - movaps xmm11, [rsp+050h] - movaps xmm12, [rsp+060h] - movaps xmm13, [rsp+070h] - movaps xmm14, [rsp+080h] - movaps xmm15, [rsp+090h] - ; restore MMX control- and status-word - ldmxcsr [rsp+0a0h] - ; save x87 control-word - fldcw [rsp+0a4h] -ENDIF - - ; load NT_TIB - mov r10, gs:[030h] - ; restore fiber local storage - mov rax, [rsp+0b0h] - mov [r10+020h], rax - ; restore current deallocation stack - mov rax, [rsp+0b8h] - mov [r10+01478h], rax - ; restore current stack limit - mov rax, [rsp+0c0h] - mov [r10+010h], rax - ; restore current stack base - mov rax, [rsp+0c8h] - mov [r10+08h], rax - - mov r12, [rsp+0d0h] ; restore R12 - mov r13, [rsp+0d8h] ; restore R13 - mov r14, [rsp+0e0h] ; restore R14 - mov r15, [rsp+0e8h] ; restore R15 - mov rdi, [rsp+0f0h] ; restore RDI - mov rsi, [rsp+0f8h] ; restore RSI - mov rbx, [rsp+0100h] ; restore RBX - mov rbp, [rsp+0108h] ; restore RBP - - mov rax, [rsp+0110h] ; restore hidden address of transport_t - - ; prepare stack - lea rsp, [rsp+0118h] - - ; load return-address - pop r10 - - ; transport_t returned in RAX - ; return parent fcontext_t - mov [rax], r9 - ; return data - mov [rax+08h], r8 - - ; transport_t as 1.arg of context-function - mov rcx, rax - - ; indirect jump to context - jmp r10 -jump_fcontext ENDP -END diff --git a/contrib/restricted/boost/context/src/asm/make_x86_64_ms_pe_masm.masm b/contrib/restricted/boost/context/src/asm/make_x86_64_ms_pe_masm.masm deleted file mode 100644 index 8f6c959a83..0000000000 --- a/contrib/restricted/boost/context/src/asm/make_x86_64_ms_pe_masm.masm +++ /dev/null @@ -1,163 +0,0 @@ - -; Copyright Oliver Kowalke 2009. -; Distributed under the Boost Software License, Version 1.0. -; (See accompanying file LICENSE_1_0.txt or copy at -; http://www.boost.org/LICENSE_1_0.txt) - -; ---------------------------------------------------------------------------------- -; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | -; ---------------------------------------------------------------------------------- -; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -; ---------------------------------------------------------------------------------- -; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -; ---------------------------------------------------------------------------------- -; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -; ---------------------------------------------------------------------------------- -; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -; ---------------------------------------------------------------------------------- -; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -; ---------------------------------------------------------------------------------- -; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | -; ---------------------------------------------------------------------------------- -; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -; ---------------------------------------------------------------------------------- -; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | -; ---------------------------------------------------------------------------------- -; | limit | base | R12 | R13 | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -; ---------------------------------------------------------------------------------- -; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | -; ---------------------------------------------------------------------------------- -; | R14 | R15 | RDI | RSI | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -; ---------------------------------------------------------------------------------- -; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | -; ---------------------------------------------------------------------------------- -; | RBX | RBP | hidden | RIP | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -; ---------------------------------------------------------------------------------- -; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | -; ---------------------------------------------------------------------------------- -; | parameter area | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -; ---------------------------------------------------------------------------------- -; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | -; ---------------------------------------------------------------------------------- -; | FCTX | DATA | | -; ---------------------------------------------------------------------------------- - -; standard C library function -EXTERN _exit:PROC -.code - -; generate function table entry in .pdata and unwind information in -make_fcontext PROC BOOST_CONTEXT_EXPORT FRAME - ; .xdata for a function's structured exception handling unwind behavior - .endprolog - - ; first arg of make_fcontext() == top of context-stack - mov rax, rcx - - ; shift address in RAX to lower 16 byte boundary - ; == pointer to fcontext_t and address of context stack - and rax, -16 - - ; reserve space for context-data on context-stack - ; on context-function entry: (RSP -0x8) % 16 == 0 - sub rax, 0150h - - ; third arg of make_fcontext() == address of context-function - ; stored in RBX - mov [rax+0100h], r8 - - ; first arg of make_fcontext() == top of context-stack - ; save top address of context stack as 'base' - mov [rax+0c8h], rcx - ; second arg of make_fcontext() == size of context-stack - ; negate stack size for LEA instruction (== substraction) - neg rdx - ; compute bottom address of context stack (limit) - lea rcx, [rcx+rdx] - ; save bottom address of context stack as 'limit' - mov [rax+0c0h], rcx - ; save address of context stack limit as 'dealloction stack' - mov [rax+0b8h], rcx - ; set fiber-storage to zero - xor rcx, rcx - mov [rax+0b0h], rcx - - ; save MMX control- and status-word - stmxcsr [rax+0a0h] - ; save x87 control-word - fnstcw [rax+0a4h] - - ; compute address of transport_t - lea rcx, [rax+0140h] - ; store address of transport_t in hidden field - mov [rax+0110h], rcx - - ; compute abs address of label trampoline - lea rcx, trampoline - ; save address of trampoline as return-address for context-function - ; will be entered after calling jump_fcontext() first time - mov [rax+0118h], rcx - - ; compute abs address of label finish - lea rcx, finish - ; save address of finish as return-address for context-function in RBP - ; will be entered after context-function returns - mov [rax+0108h], rcx - - ret ; return pointer to context-data - -trampoline: - ; store return address on stack - ; fix stack alignment - push rbp - ; jump to context-function - jmp rbx - -finish: - ; exit code is zero - xor rcx, rcx - ; exit application - call _exit - hlt -make_fcontext ENDP -END diff --git a/contrib/restricted/boost/context/src/asm/ontop_x86_64_ms_pe_masm.masm b/contrib/restricted/boost/context/src/asm/ontop_x86_64_ms_pe_masm.masm deleted file mode 100644 index b57dd15884..0000000000 --- a/contrib/restricted/boost/context/src/asm/ontop_x86_64_ms_pe_masm.masm +++ /dev/null @@ -1,207 +0,0 @@ - -; Copyright Oliver Kowalke 2009. -; Distributed under the Boost Software License, Version 1.0. -; (See accompanying file LICENSE_1_0.txt or copy at -; http://www.boost.org/LICENSE_1_0.txt) - -; ---------------------------------------------------------------------------------- -; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | -; ---------------------------------------------------------------------------------- -; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -; ---------------------------------------------------------------------------------- -; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -; ---------------------------------------------------------------------------------- -; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -; ---------------------------------------------------------------------------------- -; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -; ---------------------------------------------------------------------------------- -; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | -; ---------------------------------------------------------------------------------- -; | SEE registers (XMM6-XMM15) | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -; ---------------------------------------------------------------------------------- -; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | -; ---------------------------------------------------------------------------------- -; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -; ---------------------------------------------------------------------------------- -; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | -; ---------------------------------------------------------------------------------- -; | limit | base | R12 | R13 | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -; ---------------------------------------------------------------------------------- -; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | -; ---------------------------------------------------------------------------------- -; | R14 | R15 | RDI | RSI | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -; ---------------------------------------------------------------------------------- -; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | -; ---------------------------------------------------------------------------------- -; | RBX | RBP | hidden | RIP | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -; ---------------------------------------------------------------------------------- -; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | -; ---------------------------------------------------------------------------------- -; | parameter area | -; ---------------------------------------------------------------------------------- -; ---------------------------------------------------------------------------------- -; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -; ---------------------------------------------------------------------------------- -; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | -; ---------------------------------------------------------------------------------- -; | FCTX | DATA | | -; ---------------------------------------------------------------------------------- - -.code - -ontop_fcontext PROC BOOST_CONTEXT_EXPORT FRAME - .endprolog - - ; prepare stack - lea rsp, [rsp-0118h] - -IFNDEF BOOST_USE_TSX - ; save XMM storage - movaps [rsp], xmm6 - movaps [rsp+010h], xmm7 - movaps [rsp+020h], xmm8 - movaps [rsp+030h], xmm9 - movaps [rsp+040h], xmm10 - movaps [rsp+050h], xmm11 - movaps [rsp+060h], xmm12 - movaps [rsp+070h], xmm13 - movaps [rsp+080h], xmm14 - movaps [rsp+090h], xmm15 - ; save MMX control- and status-word - stmxcsr [rsp+0a0h] - ; save x87 control-word - fnstcw [rsp+0a4h] -ENDIF - - ; load NT_TIB - mov r10, gs:[030h] - ; save fiber local storage - mov rax, [r10+020h] - mov [rsp+0b0h], rax - ; save current deallocation stack - mov rax, [r10+01478h] - mov [rsp+0b8h], rax - ; save current stack limit - mov rax, [r10+010h] - mov [rsp+0c0h], rax - ; save current stack base - mov rax, [r10+08h] - mov [rsp+0c8h], rax - - mov [rsp+0d0h], r12 ; save R12 - mov [rsp+0d8h], r13 ; save R13 - mov [rsp+0e0h], r14 ; save R14 - mov [rsp+0e8h], r15 ; save R15 - mov [rsp+0f0h], rdi ; save RDI - mov [rsp+0f8h], rsi ; save RSI - mov [rsp+0100h], rbx ; save RBX - mov [rsp+0108h], rbp ; save RBP - - mov [rsp+0110h], rcx ; save hidden address of transport_t - - ; preserve RSP (pointing to context-data) in RCX - mov rcx, rsp - - ; restore RSP (pointing to context-data) from RDX - mov rsp, rdx - -IFNDEF BOOST_USE_TSX - ; restore XMM storage - movaps xmm6, [rsp] - movaps xmm7, [rsp+010h] - movaps xmm8, [rsp+020h] - movaps xmm9, [rsp+030h] - movaps xmm10, [rsp+040h] - movaps xmm11, [rsp+050h] - movaps xmm12, [rsp+060h] - movaps xmm13, [rsp+070h] - movaps xmm14, [rsp+080h] - movaps xmm15, [rsp+090h] - ; restore MMX control- and status-word - ldmxcsr [rsp+0a0h] - ; save x87 control-word - fldcw [rsp+0a4h] -ENDIF - - ; load NT_TIB - mov r10, gs:[030h] - ; restore fiber local storage - mov rax, [rsp+0b0h] - mov [r10+020h], rax - ; restore current deallocation stack - mov rax, [rsp+0b8h] - mov [r10+01478h], rax - ; restore current stack limit - mov rax, [rsp+0c0h] - mov [r10+010h], rax - ; restore current stack base - mov rax, [rsp+0c8h] - mov [r10+08h], rax - - mov r12, [rsp+0d0h] ; restore R12 - mov r13, [rsp+0d8h] ; restore R13 - mov r14, [rsp+0e0h] ; restore R14 - mov r15, [rsp+0e8h] ; restore R15 - mov rdi, [rsp+0f0h] ; restore RDI - mov rsi, [rsp+0f8h] ; restore RSI - mov rbx, [rsp+0100h] ; restore RBX - mov rbp, [rsp+0108h] ; restore RBP - - mov rax, [rsp+0110h] ; restore hidden address of transport_t - - ; prepare stack - lea rsp, [rsp+0118h] - - ; keep return-address on stack - - ; transport_t returned in RAX - ; return parent fcontext_t - mov [rax], rcx - ; return data - mov [rax+08h], r8 - - ; transport_t as 1.arg of context-function - ; RCX contains address of returned (hidden) transfer_t - mov rcx, rax - ; RDX contains address of passed transfer_t - mov rdx, rax - - ; indirect jump to context - jmp r9 -ontop_fcontext ENDP -END diff --git a/contrib/restricted/boost/context/src/windows/stack_traits.cpp b/contrib/restricted/boost/context/src/windows/stack_traits.cpp deleted file mode 100644 index 4edada0965..0000000000 --- a/contrib/restricted/boost/context/src/windows/stack_traits.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "boost/context/stack_traits.hpp" - -extern "C" { -#include <windows.h> -} - -//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L - -#include <algorithm> -#include <cmath> -#include <cstddef> -#include <cstring> -#include <stdexcept> - -#include <boost/assert.hpp> -#include <boost/context/detail/config.hpp> - -#include <boost/context/stack_context.hpp> - -// x86_64 -// test x86_64 before i386 because icc might -// define __i686__ for x86_64 too -#if defined(__x86_64__) || defined(__x86_64) \ - || defined(__amd64__) || defined(__amd64) \ - || defined(_M_X64) || defined(_M_AMD64) - -// Windows seams not to provide a constant or function -// telling the minimal stacksize -# define MIN_STACKSIZE 8 * 1024 -#else -# define MIN_STACKSIZE 4 * 1024 -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace { - -std::size_t pagesize() BOOST_NOEXCEPT_OR_NOTHROW { - SYSTEM_INFO si; - ::GetSystemInfo(&si); - return static_cast< std::size_t >( si.dwPageSize ); -} - -} - -namespace boost { -namespace context { - -// Windows seams not to provide a limit for the stacksize -// libcoco uses 32k+4k bytes as minimum -BOOST_CONTEXT_DECL -bool -stack_traits::is_unbounded() BOOST_NOEXCEPT_OR_NOTHROW { - return true; -} - -BOOST_CONTEXT_DECL -std::size_t -stack_traits::page_size() BOOST_NOEXCEPT_OR_NOTHROW { - static std::size_t size = pagesize(); - return size; -} - -BOOST_CONTEXT_DECL -std::size_t -stack_traits::default_size() BOOST_NOEXCEPT_OR_NOTHROW { - return 128 * 1024; -} - -// because Windows seams not to provide a limit for minimum stacksize -BOOST_CONTEXT_DECL -std::size_t -stack_traits::minimum_size() BOOST_NOEXCEPT_OR_NOTHROW { - return MIN_STACKSIZE; -} - -// because Windows seams not to provide a limit for maximum stacksize -// maximum_size() can never be called (pre-condition ! is_unbounded() ) -BOOST_CONTEXT_DECL -std::size_t -stack_traits::maximum_size() BOOST_NOEXCEPT_OR_NOTHROW { - BOOST_ASSERT( ! is_unbounded() ); - return 1 * 1024 * 1024 * 1024; // 1GB -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif diff --git a/contrib/restricted/boost/coroutine/src/windows/stack_traits.cpp b/contrib/restricted/boost/coroutine/src/windows/stack_traits.cpp deleted file mode 100644 index a31ebb56a9..0000000000 --- a/contrib/restricted/boost/coroutine/src/windows/stack_traits.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "boost/coroutine/stack_traits.hpp" - -extern "C" { -#include <windows.h> -} - -//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L - -#include <algorithm> -#include <cmath> -#include <cstddef> -#include <cstring> -#include <stdexcept> - -#include <boost/assert.hpp> -#include <boost/coroutine/detail/config.hpp> - -#include <boost/coroutine/stack_context.hpp> - -// x86_64 -// test x86_64 before i386 because icc might -// define __i686__ for x86_64 too -#if defined(__x86_64__) || defined(__x86_64) \ - || defined(__amd64__) || defined(__amd64) \ - || defined(_M_X64) || defined(_M_AMD64) - -// Windows seams not to provide a constant or function -// telling the minimal stacksize -# define MIN_STACKSIZE 8 * 1024 -#else -# define MIN_STACKSIZE 4 * 1024 -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace { - -std::size_t pagesize() -{ - SYSTEM_INFO si; - ::GetSystemInfo(&si); - return static_cast< std::size_t >( si.dwPageSize ); -} - -} - -namespace boost { -namespace coroutines { - -// Windows seams not to provide a limit for the stacksize -// libcoco uses 32k+4k bytes as minimum -bool -stack_traits::is_unbounded() BOOST_NOEXCEPT -{ return true; } - -std::size_t -stack_traits::page_size() BOOST_NOEXCEPT -{ - static std::size_t size = pagesize(); - return size; -} - -std::size_t -stack_traits::default_size() BOOST_NOEXCEPT -{ - std::size_t size = 64 * 1024; // 64 kB - if ( is_unbounded() ) - return (std::max)( size, minimum_size() ); - - BOOST_ASSERT( maximum_size() >= minimum_size() ); - return maximum_size() == minimum_size() - ? minimum_size() - : ( std::min)( size, maximum_size() ); -} - -// because Windows seams not to provide a limit for minimum stacksize -std::size_t -stack_traits::minimum_size() BOOST_NOEXCEPT -{ return MIN_STACKSIZE; } - -// because Windows seams not to provide a limit for maximum stacksize -// maximum_size() can never be called (pre-condition ! is_unbounded() ) -std::size_t -stack_traits::maximum_size() BOOST_NOEXCEPT -{ - BOOST_ASSERT( ! is_unbounded() ); - return 1 * 1024 * 1024 * 1024; // 1GB -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif |