Deleted errors in code.
[ZeXOS.git] / kernel / include / pipe.h
blob202b797fa0fcf8c3e515fd26d2859de3114ae543
1 /*
2 * ZeX/OS
3 * Copyright (C) 2009 Martin 'povik' Poviser (martin.povik@gmail.com)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
19 #ifndef _PIPE_H
20 #define _PIPE_H
22 #include <mytypes.h>
24 #define PIPE_BUFFER_PART_SIZE 128
26 typedef struct pipe_buffer {
27 BYTE buffer[PIPE_BUFFER_PART_SIZE];
28 struct pipe_buffer *next, *prev;
29 } pipe_buffer_t;
31 typedef struct pipe {
32 pipe_buffer_t *buffer_list_start;
33 pipe_buffer_t *buffer_list_end;
34 unsigned int buffer_start_pos;
35 unsigned int buffer_end_len;
36 int fd_a, fd_b;
37 struct pipe *next, *prev;
38 } pipe_t;
40 pipe_t *pipe_get (int fd);
41 bool pipe_write (pipe_t *p, BYTE *buffer, unsigned int buffer_len);
42 unsigned int pipe_read (pipe_t *p, BYTE *buffer, unsigned int buffer_max_len);
43 void pipe (int fds[2]);
45 #endif