6#define pr_fmt(fmt) "pipe: " fmt
18#define PIPE_MAGIC MOS_FOURCC('P', 'I', 'P', 'E')
20#define advance_buffer(buffer, bytes) ((buffer) = (void *) ((char *) (buffer) + (bytes)))
26 pr_warn(
"pipe_io_write: invalid magic");
35 if (
pipe->other_closed)
43 size_t total_written = 0;
64 if (
pipe->other_closed)
86 pr_warn(
"pipe_io_read: invalid magic");
95 size_t total_read = 0;
140 pr_warn(
"pipe_io_close: invalid magic");
145 if (!
pipe->other_closed)
147 pipe->other_closed =
true;
195 const char *type =
"<unknown>";
208 pr_dinfo2(
pipe,
"pipe is already closed by the other end, '%s' closing", type);
#define MOS_UNREACHABLE()
bool signal_has_pending(void)
Return true if there's a pending signal.
long signal_send_to_thread(Thread *target, signal_t signal)
Send a signal to a thread.
#define phyframe_va(frame)
#define mm_free_pages(frame, npages)
phyframe_t * mm_get_free_pages(size_t npages)
MOSAPI size_t ring_buffer_pos_pop_front(u8 *buffer, ring_buffer_pos_t *pos, u8 *buf, size_t size)
should_inline bool ring_buffer_pos_is_empty(ring_buffer_pos_t *pos)
MOSAPI void ring_buffer_pos_init(ring_buffer_pos_t *pos, size_t capacity)
MOSAPI size_t ring_buffer_pos_push_back(u8 *buffer, ring_buffer_pos_t *pos, const u8 *data, size_t size)
void io_init(io_t *io, io_type_t type, io_flags_t flags, const io_op_t *ops)
long define_syscall pipe(fd_t *reader, fd_t *writer, fd_flags_t flags)
#define statement_expr(type,...)
#define ALIGN_UP_TO_PAGE(addr)
T * create(Args &&...args)
PtrResult< pipe_t > pipe_create(size_t bufsize)
pipeio_t * pipeio_create(pipe_t *pipe)
size_t pipe_write(pipe_t *pipe, const void *buf, size_t size)
#define advance_buffer(buffer, bytes)
static void pipeio_io_close(io_t *io)
bool pipe_close_one_end(pipe_t *pipe)
Close one end of the pipe, so that the other end will get EOF.
size_t pipe_read(pipe_t *pipe, void *buf, size_t size)
static size_t pipeio_io_write(io_t *io, const void *buf, size_t size)
static size_t pipeio_io_read(io_t *io, void *buf, size_t size)
static const io_op_t pipe_io_ops
#define pr_dinfo2(feat, fmt,...)
__nodiscard bool reschedule_for_waitlist(waitlist_t *waitlist)
#define spinlock_acquire(lock)
#define spinlock_release(lock)
bool other_closed
true if the other end of the pipe has been closed
#define container_of(ptr, type, member)
void waitlist_init(waitlist_t *list)
size_t waitlist_wake(waitlist_t *list, size_t max_wakeups)