mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:27:34 +00:00
LibIPC: Support sending file descriptors :^)
It is now possible to use the special IPC::File type in message arguments. In C++, the type is nothing more than a wrapper over a file descriptor. But when serializing/deserializing IPC::File arguments, LibIPC will use the sendfd/recvfd kernel APIs instead of sending the integer inline. This makes it quite convenient to pass files over IPC, and will allow us to significantly tighten sandboxes in the future :^) Closes https://github.com/SerenityOS/serenity/issues/3643
This commit is contained in:
parent
fa2e3e2be4
commit
23dc3ff0c2
9 changed files with 148 additions and 50 deletions
|
@ -44,8 +44,9 @@ inline bool decode(Decoder&, T&)
|
|||
|
||||
class Decoder {
|
||||
public:
|
||||
explicit Decoder(InputMemoryStream& stream)
|
||||
Decoder(InputMemoryStream& stream, int sockfd)
|
||||
: m_stream(stream)
|
||||
, m_sockfd(sockfd)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
bool decode(ByteBuffer&);
|
||||
bool decode(URL&);
|
||||
bool decode(Dictionary&);
|
||||
bool decode(File&);
|
||||
template<typename K, typename V>
|
||||
bool decode(HashMap<K, V>& hashmap)
|
||||
{
|
||||
|
@ -124,6 +126,7 @@ public:
|
|||
|
||||
private:
|
||||
InputMemoryStream& m_stream;
|
||||
int m_sockfd { -1 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue