1 /*
2  * Copyright (c) 2022 Meta
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "_common.h"
8 
9 #ifdef CONFIG_POSIX_API
10 #include <poll.h>
11 #else
12 #include <zephyr/posix/poll.h>
13 #endif
14 
15 /**
16  * @brief existence test for `<poll.h>`
17  *
18  * @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html">poll.h</a>
19  */
ZTEST(posix_headers,test_poll_h)20 ZTEST(posix_headers, test_poll_h)
21 {
22 	zassert_not_equal(-1, offsetof(struct pollfd, fd));
23 	zassert_not_equal(-1, offsetof(struct pollfd, events));
24 	zassert_not_equal(-1, offsetof(struct pollfd, revents));
25 
26 	zassert_true(sizeof(nfds_t) <= sizeof(long));
27 
28 	zassert_not_equal(-1, POLLIN);
29 	/* zassert_not_equal(-1, POLLRDNORM); */ /* not implemented */
30 	/* zassert_not_equal(-1, POLLRDBAND); */ /* not implemented */
31 	zassert_not_equal(-1, POLLPRI);
32 	zassert_not_equal(-1, POLLOUT);
33 	/* zassert_not_equal(-1, POLLWRNORM); */ /* not implemented */
34 	/* zassert_not_equal(-1, POLLWRBAND); */ /* not implemented */
35 	zassert_not_equal(-1, POLLERR);
36 	zassert_not_equal(-1, POLLHUP);
37 	zassert_not_equal(-1, POLLNVAL);
38 
39 	if (IS_ENABLED(CONFIG_POSIX_DEVICE_IO)) {
40 		zassert_not_null(poll);
41 	}
42 }
43