6#define pr_fmt(fmt) "pipe: " fmt
19#define PIPE_MAGIC MOS_FOURCC('P', 'I', 'P', 'E')
27#define advance_buffer(buffer, bytes) ((buffer) = (void *) ((char *) (buffer) + (bytes)))
33 pr_warn(
"pipe_io_write: invalid magic");
42 if (
pipe->other_closed)
50 size_t total_written = 0;
71 if (
pipe->other_closed)
93 pr_warn(
"pipe_io_read: invalid magic");
102 size_t total_read = 0;
147 pr_warn(
"pipe_io_close: invalid magic");
152 if (!
pipe->other_closed)
154 pipe->other_closed =
true;
202 const char *type =
"<unknown>";
215 pr_dinfo2(
pipe,
"pipe is already closed by the other end, '%s' closing", type);
#define MOS_UNREACHABLE()
long signal_send_to_thread(thread_t *target, signal_t signal)
Send a signal to a thread.
bool signal_has_pending(void)
Return true if there's a pending signal.
#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)
#define container_of(ptr, type, member)
static slab_t * pipeio_slab
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 slab_t * pipe_slab
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
pipe_t * pipe_create(size_t bufsize)
#define pr_dinfo2(feat, fmt,...)
__nodiscard bool reschedule_for_waitlist(waitlist_t *waitlist)
#define SLAB_AUTOINIT(name, var, type)
#define spinlock_acquire(lock)
#define spinlock_release(lock)
bool other_closed
true if the other end of the pipe has been closed
size_t waitlist_wake(waitlist_t *list, size_t max_wakeups)
__BEGIN_DECLS void waitlist_init(waitlist_t *list)