1 // Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef _ESP_PLATFORM_SYS_POLL_H_ 16 #define _ESP_PLATFORM_SYS_POLL_H_ 17 18 #define POLLIN (1u << 0) /* data other than high-priority may be read without blocking */ 19 #define POLLRDNORM (1u << 1) /* normal data may be read without blocking */ 20 #define POLLRDBAND (1u << 2) /* priority data may be read without blocking */ 21 #define POLLPRI (POLLRDBAND) /* high-priority data may be read without blocking */ 22 // Note: POLLPRI is made equivalent to POLLRDBAND in order to fit all these events into one byte 23 #define POLLOUT (1u << 3) /* normal data may be written without blocking */ 24 #define POLLWRNORM (POLLOUT) /* equivalent to POLLOUT */ 25 #define POLLWRBAND (1u << 4) /* priority data my be written */ 26 #define POLLERR (1u << 5) /* some poll error occurred */ 27 #define POLLHUP (1u << 6) /* file descriptor was "hung up" */ 28 #define POLLNVAL (1u << 7) /* the specified file descriptor is invalid */ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct pollfd { 35 int fd; /* The descriptor. */ 36 short events; /* The event(s) is/are specified here. */ 37 short revents; /* Events found are returned here. */ 38 }; 39 40 typedef unsigned int nfds_t; 41 42 int poll(struct pollfd *fds, nfds_t nfds, int timeout); 43 44 #ifdef __cplusplus 45 } // extern "C" 46 #endif 47 48 #endif // _ESP_PLATFORM_SYS_POLL_H_ 49