RTEMS CPU Kit with SuperCore  4.10.99.0
pipe.h
Go to the documentation of this file.
1 
10 /*
11  * Author: Wei Shen <cquark@gmail.com>
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifndef _RTEMS_PIPE_H
19 #define _RTEMS_PIPE_H
20 
21 #include <rtems/libio.h>
22 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* Control block to manage each pipe */
37 typedef struct pipe_control {
38  char *Buffer;
39  unsigned int Size;
40  unsigned int Start;
41  unsigned int Length;
42  unsigned int Readers;
43  unsigned int Writers;
44  unsigned int waitingReaders;
45  unsigned int waitingWriters;
46  unsigned int readerCounter; /* incremental counters */
47  unsigned int writerCounter; /* for differentiation of successive opens */
48  rtems_id Semaphore;
49  rtems_id readBarrier; /* wait queues */
50  rtems_id writeBarrier;
51 #if 0
52  boolean Anonymous; /* anonymous pipe or FIFO */
53 #endif
55 
61 extern int pipe_create(
62  int filsdes[2]
63 );
64 
73 extern void pipe_release(
74  pipe_control_t **pipep,
75  rtems_libio_t *iop
76 );
77 
86 extern int fifo_open(
87  pipe_control_t **pipep,
88  rtems_libio_t *iop
89 );
90 
96 extern ssize_t pipe_read(
97  pipe_control_t *pipe,
98  void *buffer,
99  size_t count,
100  rtems_libio_t *iop
101 );
102 
108 extern ssize_t pipe_write(
109  pipe_control_t *pipe,
110  const void *buffer,
111  size_t count,
112  rtems_libio_t *iop
113 );
114 
120 extern int pipe_ioctl(
121  pipe_control_t *pipe,
122  ioctl_command_t cmd,
123  void *buffer,
124  rtems_libio_t *iop
125 );
126 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:80
int pipe_create(int filsdes[2])
Create an anonymous pipe.
int pipe_ioctl(pipe_control_t *pipe, ioctl_command_t cmd, void *buffer, rtems_libio_t *iop)
File system Input/Output control.
int fifo_open(pipe_control_t **pipep, rtems_libio_t *iop)
File system open.
ssize_t pipe_write(pipe_control_t *pipe, const void *buffer, size_t count, rtems_libio_t *iop)
File system write.
void pipe_release(pipe_control_t **pipep, rtems_libio_t *iop)
Release a pipe.
Definition: pipe.h:37
ssize_t pipe_read(pipe_control_t *pipe, void *buffer, size_t count, rtems_libio_t *iop)
File system read.