posix: define nfds_t in posix/poll.h

Add the nfds_t type defined by POSIX and test for it.

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
This commit is contained in:
Jakub Michalski 2024-10-30 16:39:15 +01:00 committed by Benjamin Cabé
commit f4cb7e35ec
2 changed files with 3 additions and 1 deletions

View file

@ -12,6 +12,8 @@
extern "C" { extern "C" {
#endif #endif
typedef unsigned int nfds_t;
#define pollfd zsock_pollfd #define pollfd zsock_pollfd
#define POLLIN ZSOCK_POLLIN #define POLLIN ZSOCK_POLLIN

View file

@ -23,7 +23,7 @@ ZTEST(posix_headers, test_poll_h)
zassert_not_equal(-1, offsetof(struct pollfd, events)); zassert_not_equal(-1, offsetof(struct pollfd, events));
zassert_not_equal(-1, offsetof(struct pollfd, revents)); zassert_not_equal(-1, offsetof(struct pollfd, revents));
/* zassert_true(sizeof(nfds_t) <= sizeof(long)); */ /* not implemented */ zassert_true(sizeof(nfds_t) <= sizeof(long));
zassert_not_equal(-1, POLLIN); zassert_not_equal(-1, POLLIN);
/* zassert_not_equal(-1, POLLRDNORM); */ /* not implemented */ /* zassert_not_equal(-1, POLLRDNORM); */ /* not implemented */