mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
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.)
This commit is contained in:
parent
8608cd11e4
commit
86a3ef2709
2 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ void ConnectionBase::post_message(MessageBuffer buffer)
|
||||||
|
|
||||||
#ifdef __serenity__
|
#ifdef __serenity__
|
||||||
for (auto& fd : buffer.fds) {
|
for (auto& fd : buffer.fds) {
|
||||||
auto rc = sendfd(m_socket->fd(), fd->value());
|
auto rc = sendfd(m_socket->fd(), fd.value());
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
perror("sendfd");
|
perror("sendfd");
|
||||||
shutdown();
|
shutdown();
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/NonnullRefPtrVector.h>
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
#include <AK/RefPtr.h>
|
#include <AK/RefPtr.h>
|
||||||
#include <AK/Vector.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
@ -34,7 +34,7 @@ private:
|
||||||
|
|
||||||
struct MessageBuffer {
|
struct MessageBuffer {
|
||||||
Vector<u8, 1024> data;
|
Vector<u8, 1024> data;
|
||||||
Vector<RefPtr<AutoCloseFileDescriptor>> fds;
|
NonnullRefPtrVector<AutoCloseFileDescriptor, 1> fds;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ErrorCode : u32 {
|
enum class ErrorCode : u32 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue