mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
The system uses ssize_t so it can return -1 in case of an error. But in our case, we will transform that to an AK::Error, thus we never return -1. Let's return size_t instead.
36 lines
657 B
C++
36 lines
657 B
C++
/*
|
|
* Copyright (c) 2025, ayeteadoe <ayeteadoe@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Span.h>
|
|
|
|
namespace RequestServer {
|
|
|
|
class RequestPipe {
|
|
AK_MAKE_NONCOPYABLE(RequestPipe);
|
|
|
|
public:
|
|
RequestPipe(RequestPipe&& other);
|
|
RequestPipe& operator=(RequestPipe&& other);
|
|
~RequestPipe();
|
|
|
|
static ErrorOr<RequestPipe> create();
|
|
|
|
int reader_fd() const { return m_reader_fd; }
|
|
int writer_fd() const { return m_writer_fd; }
|
|
|
|
ErrorOr<size_t> write(ReadonlyBytes bytes);
|
|
|
|
private:
|
|
RequestPipe(int reader_fd, int writer_fd);
|
|
|
|
int m_reader_fd { -1 };
|
|
int m_writer_fd { -1 };
|
|
};
|
|
|
|
}
|