summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-28 09:03:15 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-28 23:14:18 +0100
commit86a3ef27092e518d61a2540b37878da2423b4cd9 (patch)
tree4d526706b5676868e9f9ed019095474a08caf632 /Userland/Libraries
parent8608cd11e4600d3dc3bac093e2a863be9a721597 (diff)
downloadserenity-86a3ef27092e518d61a2540b37878da2423b4cd9.zip
LibIPC: Give MessageBuffer::fds some inline capacity (1)
This dodges a heap allocation when sending 0 or 1 fd across the IPC boundary (which covers every message.)
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibIPC/Connection.cpp2
-rw-r--r--Userland/Libraries/LibIPC/Message.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp
index b9600a8332..2571c8b456 100644
--- a/Userland/Libraries/LibIPC/Connection.cpp
+++ b/Userland/Libraries/LibIPC/Connection.cpp
@@ -41,7 +41,7 @@ void ConnectionBase::post_message(MessageBuffer buffer)
#ifdef __serenity__
for (auto& fd : buffer.fds) {
- auto rc = sendfd(m_socket->fd(), fd->value());
+ auto rc = sendfd(m_socket->fd(), fd.value());
if (rc < 0) {
perror("sendfd");
shutdown();
diff --git a/Userland/Libraries/LibIPC/Message.h b/Userland/Libraries/LibIPC/Message.h
index 86bf53c697..8590e28808 100644
--- a/Userland/Libraries/LibIPC/Message.h
+++ b/Userland/Libraries/LibIPC/Message.h
@@ -6,9 +6,9 @@
#pragma once
+#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
-#include <AK/Vector.h>
#include <unistd.h>
namespace IPC {
@@ -34,7 +34,7 @@ private:
struct MessageBuffer {
Vector<u8, 1024> data;
- Vector<RefPtr<AutoCloseFileDescriptor>> fds;
+ NonnullRefPtrVector<AutoCloseFileDescriptor, 1> fds;
};
enum class ErrorCode : u32 {