summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/demangle.cpp2
-rw-r--r--src/common/detached_tasks.cpp4
-rw-r--r--src/common/page_table.cpp1
-rw-r--r--src/common/page_table.h1
-rw-r--r--src/common/scratch_buffer.h17
-rw-r--r--src/common/socket_types.h17
6 files changed, 36 insertions, 6 deletions
diff --git a/src/common/demangle.cpp b/src/common/demangle.cpp
index 3310faf86..6e117cb41 100644
--- a/src/common/demangle.cpp
+++ b/src/common/demangle.cpp
@@ -23,7 +23,7 @@ std::string DemangleSymbol(const std::string& mangled) {
SCOPE_EXIT({ std::free(demangled); });
if (is_itanium(mangled)) {
- demangled = llvm::itaniumDemangle(mangled.c_str(), nullptr, nullptr, nullptr);
+ demangled = llvm::itaniumDemangle(mangled.c_str());
}
if (!demangled) {
diff --git a/src/common/detached_tasks.cpp b/src/common/detached_tasks.cpp
index da64848da..f2ed795cc 100644
--- a/src/common/detached_tasks.cpp
+++ b/src/common/detached_tasks.cpp
@@ -30,8 +30,8 @@ DetachedTasks::~DetachedTasks() {
void DetachedTasks::AddTask(std::function<void()> task) {
std::unique_lock lock{instance->mutex};
++instance->count;
- std::thread([task{std::move(task)}]() {
- task();
+ std::thread([task_{std::move(task)}]() {
+ task_();
std::unique_lock thread_lock{instance->mutex};
--instance->count;
std::notify_all_at_thread_exit(instance->cv, std::move(thread_lock));
diff --git a/src/common/page_table.cpp b/src/common/page_table.cpp
index b744b68ce..4b1690269 100644
--- a/src/common/page_table.cpp
+++ b/src/common/page_table.cpp
@@ -66,6 +66,7 @@ void PageTable::Resize(std::size_t address_space_width_in_bits, std::size_t page
<< (address_space_width_in_bits - page_size_in_bits)};
pointers.resize(num_page_table_entries);
backing_addr.resize(num_page_table_entries);
+ blocks.resize(num_page_table_entries);
current_address_space_width_in_bits = address_space_width_in_bits;
page_size = 1ULL << page_size_in_bits;
}
diff --git a/src/common/page_table.h b/src/common/page_table.h
index 1ad3a9f8b..fec8378f3 100644
--- a/src/common/page_table.h
+++ b/src/common/page_table.h
@@ -122,6 +122,7 @@ struct PageTable {
* corresponding attribute element is of type `Memory`.
*/
VirtualBuffer<PageInfo> pointers;
+ VirtualBuffer<u64> blocks;
VirtualBuffer<u64> backing_addr;
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h
index d5961b020..2a98cda53 100644
--- a/src/common/scratch_buffer.h
+++ b/src/common/scratch_buffer.h
@@ -40,8 +40,21 @@ public:
~ScratchBuffer() = default;
ScratchBuffer(const ScratchBuffer&) = delete;
ScratchBuffer& operator=(const ScratchBuffer&) = delete;
- ScratchBuffer(ScratchBuffer&&) = default;
- ScratchBuffer& operator=(ScratchBuffer&&) = default;
+
+ ScratchBuffer(ScratchBuffer&& other) noexcept {
+ swap(other);
+ other.last_requested_size = 0;
+ other.buffer_capacity = 0;
+ other.buffer.reset();
+ }
+
+ ScratchBuffer& operator=(ScratchBuffer&& other) noexcept {
+ swap(other);
+ other.last_requested_size = 0;
+ other.buffer_capacity = 0;
+ other.buffer.reset();
+ return *this;
+ }
/// This will only grow the buffer's capacity if size is greater than the current capacity.
/// The previously held data will remain intact.
diff --git a/src/common/socket_types.h b/src/common/socket_types.h
index 0a801a443..63824a5c4 100644
--- a/src/common/socket_types.h
+++ b/src/common/socket_types.h
@@ -3,17 +3,22 @@
#pragma once
+#include <optional>
+#include <string>
+
#include "common/common_types.h"
namespace Network {
/// Address families
enum class Domain : u8 {
- INET, ///< Address family for IPv4
+ Unspecified, ///< Represents 0, used in getaddrinfo hints
+ INET, ///< Address family for IPv4
};
/// Socket types
enum class Type {
+ Unspecified, ///< Represents 0, used in getaddrinfo hints
STREAM,
DGRAM,
RAW,
@@ -22,6 +27,7 @@ enum class Type {
/// Protocol values for sockets
enum class Protocol : u8 {
+ Unspecified, ///< Represents 0, usable in various places
ICMP,
TCP,
UDP,
@@ -48,4 +54,13 @@ constexpr u32 FLAG_MSG_PEEK = 0x2;
constexpr u32 FLAG_MSG_DONTWAIT = 0x80;
constexpr u32 FLAG_O_NONBLOCK = 0x800;
+/// Cross-platform addrinfo structure
+struct AddrInfo {
+ Domain family;
+ Type socket_type;
+ Protocol protocol;
+ SockAddrIn addr;
+ std::optional<std::string> canon_name;
+};
+
} // namespace Network