From e022cdd803efaf5702a7383a108d623430947d04 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 21 Aug 2019 15:32:24 +0300 Subject: [PATCH] include: posix: Add poll.h header poll() and related things are expected to be declared in this header by POSIX applications. Signed-off-by: Paul Sokolovsky --- include/posix/poll.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 include/posix/poll.h diff --git a/include/posix/poll.h b/include/posix/poll.h new file mode 100644 index 00000000000..713778ae78c --- /dev/null +++ b/include/posix/poll.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_POSIX_POLL_H_ +#define ZEPHYR_INCLUDE_POSIX_POLL_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define pollfd zsock_pollfd + +#define POLLIN ZSOCK_POLLIN +#define POLLOUT ZSOCK_POLLOUT +#define POLLERR ZSOCK_POLLERR +#define POLLHUP ZSOCK_POLLHUP +#define POLLNVAL ZSOCK_POLLNVAL + +static inline int poll(struct pollfd *fds, int nfds, int timeout) +{ + return zsock_poll(fds, nfds, timeout); +} + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_POSIX_POLL_H_ */