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 <sys/eventfd.h>
11 #else
12 #include <zephyr/posix/sys/eventfd.h>
13 #endif
14 
15 /**
16  * @brief existence test for `<sys/eventfd.h>`
17  *
18  * @note the eventfd API is not (yet) a part of POSIX.
19  *
20  * @see <a href="https://man7.org/linux/man-pages/man2/eventfd.2.html">sys/eventfd.h</a>
21  */
ZTEST(posix_headers,test_sys_eventfd_h)22 ZTEST(posix_headers, test_sys_eventfd_h)
23 {
24 	/* zassert_not_equal(-1, EFD_CLOEXEC); */ /* not implemented */
25 	zassert_not_equal(-1, EFD_NONBLOCK);
26 	zassert_not_equal(-1, EFD_SEMAPHORE);
27 
28 	zassert_not_equal((eventfd_t)-1, (eventfd_t)0);
29 
30 	if (IS_ENABLED(CONFIG_POSIX_API)) {
31 		zassert_not_null(eventfd);
32 		zassert_not_null(eventfd_read);
33 		zassert_not_null(eventfd_write);
34 	}
35 }
36