Commit e82b2ea9 authored by Chris Friedt's avatar Chris Friedt Committed by Henrik Brix Andersen
Browse files

fdtable: workaround posix->zephyr->posix dependency cycle



Currently Zephyr depends on POSIX, which presents a
dependency cycle.

Newlib does not seem to like this dependency cycle so it
requires that we re-declare off_t and ssize_t.

We should really stop using off_t and ssize_t below the
POSIX API line in Zephyr.

Signed-off-by: default avatarChris Friedt <cfriedt@tenstorrent.com>
parent c152fb90
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -6,18 +6,16 @@
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
#define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_

#include <zephyr/net/socket_types.h>
#include <zephyr/net/socket_select.h>
#include <zephyr/sys/fdtable.h>

#ifdef __cplusplus
extern "C" {
#endif

#undef fd_set
#define fd_set zsock_fd_set

#define FD_SETSIZE ZVFS_FD_SETSIZE

typedef struct zvfs_fd_set fd_set;

struct timeval;

int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+12 −0
Original line number Diff line number Diff line
@@ -39,6 +39,18 @@
extern "C" {
#endif

/* FIXME: use k_off_t and k_ssize_t to avoid the POSIX->Zephyr->POSIX dependency cycle */
#ifdef CONFIG_NEWLIB_LIBC
#ifndef _OFF_T_DECLARED
typedef __off_t off_t;
#define _OFF_T_DECLARED
#endif
#ifndef _SSIZE_T_DECLARED
typedef _ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif
#endif

/**
 * File descriptor virtual method table.
 * Currently all operations beyond read/write/close go thru ioctl method.