source: rtems/cpukit/libfs/src/pipe/pipe.h @ a7d1992c

Last change on this file since a7d1992c was a7d1992c, checked in by Sebastian Huber <sebastian.huber@…>, on 05/15/12 at 08:06:18

Merge branch 'upstream'

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