source: rtems/cpukit/libfs/src/pipe/pipe.h @ 9ab091e

4.11
Last change on this file since 9ab091e was 9ab091e, checked in by Mathew Kallada <matkallada@…>, on Dec 28, 2012 at 4:35:32 PM

Header File Doxygen Enhancement Task #2

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 * @file rtems/pipe.h
3 *
4 * @brief Defines the Interface to the POSIX FIFO/pipe File System Support
5 *
6 * This include file defines the interface to the POSIX FIFO/pipe file system
7 * support.
8 */
9
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.com/license/LICENSE.
16 */
17
18#ifndef _RTEMS_PIPE_H
19#define _RTEMS_PIPE_H
20
21#include <rtems/libio.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * @defgroup FIFO_PIPE FIFO/pipe File System Support
29 *
30 * @brief Interface to the POSIX FIFO/pipe File System
31 */
32
33/* Control block to manage each pipe */
34typedef struct pipe_control {
35  char *Buffer;
36  unsigned int Size;
37  unsigned int Start;
38  unsigned int Length;
39  unsigned int Readers;
40  unsigned int Writers;
41  unsigned int waitingReaders;
42  unsigned int waitingWriters;
43  unsigned int readerCounter;     /* incremental counters */
44  unsigned int writerCounter;     /* for differentiation of successive opens */
45  rtems_id Semaphore;
46  rtems_id readBarrier;   /* wait queues */
47  rtems_id writeBarrier;
48#if 0
49  boolean Anonymous;      /* anonymous pipe or FIFO */
50#endif
51} pipe_control_t;
52
53/**
54 * @brief Create an Anonymous Pipe
55 *
56 * Called by pipe() to create an anonymous pipe.
57 */
58extern int pipe_create(
59  int filsdes[2]
60);
61
62/**
63 * @brief Release a Pipe
64 *
65 * Interface to file system close.
66 *
67 * *pipep points to pipe control structure. When the last user releases pipe,
68 * it will be set to NULL.
69 */
70extern void pipe_release(
71  pipe_control_t **pipep,
72  rtems_libio_t *iop
73);
74
75/**
76 * @brief FIFO Open
77 * Interface to file system open.
78 *
79 * *pipep points to pipe control structure. If called with *pipep = NULL,
80 * fifo_open will try allocating and initializing a control structure. If the
81 * call succeeds, *pipep will be set to address of new control structure.
82 */
83extern int fifo_open(
84  pipe_control_t **pipep,
85  rtems_libio_t *iop
86);
87
88/**
89 * @brief Pipe Read
90 *
91 * Interface to file system read.
92 */
93extern ssize_t pipe_read(
94  pipe_control_t *pipe,
95  void           *buffer,
96  size_t          count,
97  rtems_libio_t  *iop
98);
99
100/**
101 * @brief Pipe Write
102 *
103 * Interface to file system write.
104 */
105extern ssize_t pipe_write(
106  pipe_control_t *pipe,
107  const void     *buffer,
108  size_t          count,
109  rtems_libio_t  *iop
110);
111
112/**
113 * @brief Pipe IO Control
114 *
115 * Interface to file system ioctl.
116 */
117extern int pipe_ioctl(
118  pipe_control_t  *pipe,
119  ioctl_command_t  cmd,
120  void            *buffer,
121  rtems_libio_t   *iop
122);
123
124#ifdef __cplusplus
125}
126#endif
127
128#endif
Note: See TracBrowser for help on using the repository browser.