Xenomai 3.3.2
Loading...
Searching...
No Matches
pipe.h
1/*
2 * Copyright (C) 2011 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
18#ifndef _XENOMAI_ALCHEMY_PIPE_H
19#define _XENOMAI_ALCHEMY_PIPE_H
20
21#include <stdint.h>
22#include <cobalt/uapi/kernel/pipe.h>
23#include <alchemy/timer.h>
24#include <alchemy/compat.h>
25
32#define P_MINOR_AUTO XNPIPE_MINOR_AUTO
33
35#define P_URGENT XNPIPE_URGENT
36#define P_NORMAL XNPIPE_NORMAL
37
38struct RT_PIPE {
39 uintptr_t handle;
40};
41
42typedef struct RT_PIPE RT_PIPE;
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48CURRENT_DECL(int, rt_pipe_create(RT_PIPE *pipe,
49 const char *name,
50 int minor, size_t poolsize));
51
52int rt_pipe_delete(RT_PIPE *pipe);
53
54ssize_t rt_pipe_read_timed(RT_PIPE *pipe,
55 void *buf, size_t size,
56 const struct timespec *abs_timeout);
57
58static inline
59ssize_t rt_pipe_read_until(RT_PIPE *pipe,
60 void *buf, size_t size, RTIME timeout)
61{
62 struct timespec ts;
63 return rt_pipe_read_timed(pipe, buf, size,
64 alchemy_abs_timeout(timeout, &ts));
65}
66
67ssize_t rt_pipe_read(RT_PIPE *pipe,
68 void *buf, size_t size, RTIME timeout);
69
70ssize_t rt_pipe_write(RT_PIPE *pipe,
71 const void *buf, size_t size, int mode);
72
73ssize_t rt_pipe_stream(RT_PIPE *pipe,
74 const void *buf, size_t size);
75
76int rt_pipe_bind(RT_PIPE *pipe,
77 const char *name, RTIME timeout);
78
79int rt_pipe_unbind(RT_PIPE *pipe);
80
81#ifdef __cplusplus
82}
83#endif
84
87#endif /* _XENOMAI_ALCHEMY_PIPE_H */
ssize_t rt_pipe_write(RT_PIPE *pipe, const void *buf, size_t size, int mode)
Write a message to a pipe.
Definition pipe.c:545
int rt_pipe_delete(RT_PIPE *pipe)
Delete a message pipe.
Definition pipe.c:257
int rt_pipe_create(RT_PIPE *pipe, const char *name, int minor, size_t poolsize)
Create a message pipe.
Definition pipe.c:137
ssize_t rt_pipe_read(RT_PIPE *pipe, void *buf, size_t size, RTIME timeout)
Read from a pipe (with relative scalar timeout).
Definition pipe.c:314
int rt_pipe_unbind(RT_PIPE *pipe)
Unbind from a message pipe.
Definition pipe.c:670
ssize_t rt_pipe_read_timed(RT_PIPE *pipe, void *buf, size_t size, const struct timespec *abs_timeout)
Read a message from a pipe.
Definition pipe.c:428
static ssize_t rt_pipe_read_until(RT_PIPE *pipe, void *buf, size_t size, RTIME timeout)
Read from a pipe (with absolute scalar timeout).
Definition pipe.h:59
int rt_pipe_bind(RT_PIPE *pipe, const char *name, RTIME timeout)
Bind to a message pipe.
Definition pipe.c:648
ssize_t rt_pipe_stream(RT_PIPE *pipe, const void *buf, size_t size)
Stream bytes through a pipe.
Definition pipe.c:599