MOS Source Code
Loading...
Searching...
No Matches
pipe.hpp
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.hpp"
6#include "mos/tasks/wait.hpp"
7
8#include <mos/allocator.hpp>
10
20
21PtrResult<pipe_t> pipe_create(size_t bufsize);
22size_t pipe_read(pipe_t *pipe, void *buf, size_t size);
23size_t pipe_write(pipe_t *pipe, const void *buf, size_t size);
24
33
34struct pipeio_t : mos::NamedType<"PipeIO">
35{
38};
39
long define_syscall pipe(fd_t *reader, fd_t *writer, fd_flags_t flags)
Definition ksyscall.cpp:534
#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.cpp:136
PtrResult< pipe_t > pipe_create(size_t bufsize)
Definition pipe.cpp:167
pipeio_t * pipeio_create(pipe_t *pipe)
Definition pipe.cpp:221
size_t pipe_write(pipe_t *pipe, const void *buf, size_t size)
Definition pipe.cpp:22
size_t pipe_read(pipe_t *pipe, void *buf, size_t size)
Definition pipe.cpp:82
size_t size
Definition slab.cpp:34
Definition io.hpp:48
bool other_closed
true if the other end of the pipe has been closed
Definition pipe.hpp:16
u32 magic
Definition pipe.hpp:13
ring_buffer_pos_t buffer_pos
Definition pipe.hpp:18
void * buffers
Definition pipe.hpp:17
spinlock_t lock
protects the buffer_pos (and thus the buffer)
Definition pipe.hpp:15
waitlist_t waitlist
for both reader and writer, only one party can wait on the pipe at a time
Definition pipe.hpp:14
pipe_t * pipe
Definition pipe.hpp:37
io_t io_w
Definition pipe.hpp:36
io_t io_r
Definition pipe.hpp:36
unsigned int u32
Definition types.h:17