MOS Source Code
Loading...
Searching...
No Matches
pipe.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include "mos/io/io.h"
6#include "mos/tasks/wait.h"
7
9
19
20pipe_t *pipe_create(size_t bufsize);
21size_t pipe_read(pipe_t *pipe, void *buf, size_t size);
22size_t pipe_write(pipe_t *pipe, const void *buf, size_t size);
23
32
33typedef struct
34{
35 io_t io_r, io_w;
37} pipeio_t;
38
long define_syscall pipe(fd_t *reader, fd_t *writer, fd_flags_t flags)
Definition ksyscall.c:528
#define __nodiscard
Definition mos_global.h:35
__nodiscard bool pipe_close_one_end(pipe_t *pipe)
Close one end of the pipe, so that the other end will get EOF.
Definition pipe.c:143
pipeio_t * pipeio_create(pipe_t *pipe)
Definition pipe.c:228
size_t pipe_write(pipe_t *pipe, const void *buf, size_t size)
Definition pipe.c:29
size_t pipe_read(pipe_t *pipe, void *buf, size_t size)
Definition pipe.c:89
pipe_t * pipe_create(size_t bufsize)
Definition pipe.c:174
size_t size
Definition slab.c:30
Definition io.h:46
Definition pipe.h:11
bool other_closed
true if the other end of the pipe has been closed
Definition pipe.h:15
u32 magic
Definition pipe.h:12
ring_buffer_pos_t buffer_pos
Definition pipe.h:17
void * buffers
Definition pipe.h:16
spinlock_t lock
protects the buffer_pos (and thus the buffer)
Definition pipe.h:14
waitlist_t waitlist
for both reader and writer, only one party can wait on the pipe at a time
Definition pipe.h:13
pipe_t * pipe
Definition pipe.h:36
io_t io_r
Definition pipe.h:35
unsigned int u32
Definition types.h:21