axle OS
x86_32 UNIX-like hobby OS
pipe.h
1 #ifndef PIPE_H
2 #define PIPE_H
3 
4 #include <std/circular_buffer.h>
5 #include <std/array_m.h>
6 
7 typedef enum PIPE_DIR {
8  READ = 0,
9  WRITE,
10 } PIPE_DIR;
11 
12 typedef struct pipe_t {
13  //is this a read or write direction pipe?
14  PIPE_DIR dir;
15  //file descriptor associated with this pipe
16  int fd;
17 
18  //backing buffer
19  circular_buffer* cb;
20 
21  //list of PIDs referencing this pipe
22  array_m* pids;
23 } pipe_t;
24 
25 typedef struct pipe_block_info {
26  pipe_t* pipe;
27  int free_bytes_needed;
29 
30 int pipe(int pipefd[2]);
31 
32 int pipe_read(int fd, char* buf, int count);
33 int pipe_write(int fd, char* buf, int count);
34 int pipe_close(int fd);
35 
36 #endif
Definition: circular_buffer.h:7
Definition: pipe.h:25
Definition: pipe.h:12
Definition: array_m.h:14