Tizen RT Libs&Environment
v1.0 D5
Main Page
Modules
Data Structures
Files
File List
Globals
poll.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* Copyright 2016 Samsung Electronics All Rights Reserved.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing,
12
* software distributed under the License is distributed on an
13
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14
* either express or implied. See the License for the specific
15
* language governing permissions and limitations under the License.
16
*
17
****************************************************************************/
18
/****************************************************************************
19
* include/poll.h
20
*
21
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
22
* Author: Gregory Nutt <gnutt@nuttx.org>
23
*
24
* Redistribution and use in source and binary forms, with or without
25
* modification, are permitted provided that the following conditions
26
* are met:
27
*
28
* 1. Redistributions of source code must retain the above copyright
29
* notice, this list of conditions and the following disclaimer.
30
* 2. Redistributions in binary form must reproduce the above copyright
31
* notice, this list of conditions and the following disclaimer in
32
* the documentation and/or other materials provided with the
33
* distribution.
34
* 3. Neither the name NuttX nor the names of its contributors may be
35
* used to endorse or promote products derived from this software
36
* without specific prior written permission.
37
*
38
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
41
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
42
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
43
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
44
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
45
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
46
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
48
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49
* POSSIBILITY OF SUCH DAMAGE.
50
*
51
****************************************************************************/
60
63
#ifndef __INCLUDE_POLL_H
64
#define __INCLUDE_POLL_H
65
66
/****************************************************************************
67
* Included Files
68
****************************************************************************/
69
70
#include <tinyara/config.h>
71
72
#include <stdint.h>
73
#include <
semaphore.h
>
74
75
/****************************************************************************
76
* Pre-processor Definitions
77
****************************************************************************/
78
79
/* Poll event definitions:
80
*
81
* POLLIN
82
* Data other than high-priority data may be read without blocking.
83
* POLLRDNORM
84
* Normal data may be read without blocking.
85
* POLLRDBAND
86
* Priority data may be read without blocking.
87
* POLLPRI
88
* High priority data may be read without blocking.
89
*
90
* POLLOUT
91
* Normal data may be written without blocking.
92
* POLLWRNORM
93
* Equivalent to POLLOUT.
94
* POLLWRBAND
95
* Priority data may be written.
96
*
97
* POLLERR
98
* An error has occurred (revents only).
99
* POLLHUP
100
* Device has been disconnected (revents only).
101
* POLLNVAL
102
* Invalid fd member (revents only).
103
*/
104
105
#define POLLIN (0x01)
/* TinyAra does not make priority distinctions */
106
#define POLLRDNORM (0x01)
107
#define POLLRDBAND (0x01)
108
#define POLLPRI (0x01)
109
110
#define POLLOUT (0x02)
/* TinyAra does not make priority distinctions */
111
#define POLLWRNORM (0x02)
112
#define POLLWRBAND (0x02)
113
114
#define POLLERR (0x04)
115
#define POLLHUP (0x08)
116
#define POLLNVAL (0x10)
117
118
/****************************************************************************
119
* Public Type Definitions
120
****************************************************************************/
121
122
/* The number of poll descriptors (required by poll() specification */
123
124
typedef
unsigned
int
nfds_t
;
125
126
/* In the standard poll() definition, the size of the event set is 'short'.
127
* Here we pick the smallest storage element that will contain all of the
128
* poll events.
129
*/
130
131
typedef
uint8_t
pollevent_t
;
132
133
/* This is the TinyAra variant of the standard pollfd structure. */
134
135
struct
pollfd
{
136
int
fd
;
/* The descriptor being polled */
137
sem_t
*
sem
;
/* Pointer to semaphore used to post output event */
138
pollevent_t
events
;
/* The input event flags */
139
pollevent_t
revents
;
/* The output event flags */
140
FAR
void
*
priv
;
/* For use by drivers */
141
#ifdef CONFIG_NET_LWIP
142
FAR
void
*scb;
143
#endif
144
};
145
146
/****************************************************************************
147
* Public Variables
148
****************************************************************************/
149
150
#undef EXTERN
151
#if defined(__cplusplus)
152
#define EXTERN extern "C"
153
extern
"C"
{
154
#else
155
#define EXTERN extern
156
#endif
157
158
/****************************************************************************
159
* Public Function Prototypes
160
****************************************************************************/
161
168
int
poll
(FAR
struct
pollfd
*fds,
nfds_t
nfds,
int
timeout);
169
170
#undef EXTERN
171
#if defined(__cplusplus)
172
}
173
#endif
174
175
#endif
/* __INCLUDE_POLL_H */
176
nfds_t
unsigned int nfds_t
Definition:
poll.h:124
pollfd::revents
pollevent_t revents
Definition:
poll.h:139
pollfd::fd
int fd
Definition:
poll.h:136
pollfd::sem
sem_t * sem
Definition:
poll.h:137
pollfd
Definition:
poll.h:135
semaphore.h
Semaphore APIs.
sem_s
Structure of generic semaphore.
Definition:
semaphore.h:115
pollevent_t
uint8_t pollevent_t
Definition:
poll.h:131
poll
int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
POSIX APIs (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)
pollfd::priv
FAR void * priv
Definition:
poll.h:140
pollfd::events
pollevent_t events
Definition:
poll.h:138
os
include
poll.h
Generated by
1.8.11