AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
pipe.h
Go to the documentation of this file.
1
#ifndef _FS_PIPE_H
2
#define _FS_PIPE_H
3
4
#include <
core/system.h
>
5
6
struct
pipe
;
7
8
#include <
fs/vfs.h
>
9
#include <
ds/ringbuf.h
>
10
11
/* Pipes and FIFOs (fs/pipe.c). */
12
13
/* The size of a pipe's buffer. */
14
#define PIPE_BUFLEN 1024
15
17
struct
pipe
{
19
struct
vnode
*
r_node
;
20
struct
vnode
*
w_node
;
21
struct
vnode
*
rw_node
;
22
24
struct
waitq
queue
;
25
29
unsigned
long
r_opens
;
30
unsigned
long
w_opens
;
31
33
struct
vnode
*
fifo
;
34
36
struct
ringbuf
*
ring
;
37
};
38
39
/* The pipes' filesystem; makes a pipe's two ends; opens a FIFO. */
40
extern
struct
fs
pipefs
;
41
int
pipefs_pipe
(
struct
file
*read,
struct
file
*write);
42
int
pipefs_fifo_open
(
struct
file
*
file
);
43
44
#endif
/* ! _FS_PIPE_H */
system.h
pipefs
struct fs pipefs
Definition
pipe.c:308
pipefs_fifo_open
int pipefs_fifo_open(struct file *file)
Opens a FIFO: the open file's vnode becomes an end of the FIFO's pipe, made by its first open.
Definition
pipe.c:239
pipefs_pipe
int pipefs_pipe(struct file *read, struct file *write)
Makes an anonymous pipe, for pipe(): one open file for each end.
Definition
pipe.c:199
ringbuf.h
file
An open file (POSIX's "open file description", fs/file.c).
Definition
vfs.h:157
fs
A filesystem type.
Definition
vfs.h:98
pipe
A pipe, or a FIFO's pipe.
Definition
pipe.h:17
pipe::queue
struct waitq queue
readers and writers sleep here
Definition
pipe.h:24
pipe::r_node
struct vnode * r_node
its ends, NULL once closed (rw_node: a FIFO opened read-write)
Definition
pipe.h:19
pipe::w_node
struct vnode * w_node
Definition
pipe.h:20
pipe::w_opens
unsigned long w_opens
Definition
pipe.h:30
pipe::fifo
struct vnode * fifo
the FIFO this is the pipe of, or NULL for pipe()
Definition
pipe.h:33
pipe::ring
struct ringbuf * ring
the data written, not read yet
Definition
pipe.h:36
pipe::r_opens
unsigned long r_opens
how many times a FIFO was opened for reading and for writing, so far: an open waiting for the other s...
Definition
pipe.h:29
pipe::rw_node
struct vnode * rw_node
Definition
pipe.h:21
ringbuf
A ring buffer.
Definition
ringbuf.h:18
vnode
A file in memory (a vnode): what its inode says, and the kernel's own state.
Definition
vfs.h:113
waitq
Definition
waitq.h:19
vfs.h
kernel
include
fs
pipe.h
Generated by
1.18.0