Skip to content

Commit 4e3b1a0

Browse files
aescolarDashingR
authored andcommitted
Revert "net: sockets: move poll implementation to zvfs"
This reverts commit 93973e2. PR zephyrproject-rtos#73978 introduced a regression. Unfortunately this PR cannot be reverted without reverting also Let's revert both PRs to stabilize main again towards the 3.7 release. For more details on the issue see zephyrproject-rtos#75205 Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent d1e5227 commit 4e3b1a0

File tree

15 files changed

+239
-275
lines changed

15 files changed

+239
-275
lines changed

include/zephyr/net/socket.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,7 @@ static inline int zsock_ioctl_wrapper(int sock, unsigned long request, ...)
625625
* it may conflict with generic POSIX ``poll()`` function).
626626
* @endrst
627627
*/
628-
static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout)
629-
{
630-
return zvfs_poll(fds, nfds, timeout);
631-
}
628+
__syscall int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout);
632629

633630
/**
634631
* @brief Get various socket options

include/zephyr/net/socket_poll.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_POLL_H_
88
#define ZEPHYR_INCLUDE_NET_SOCKET_POLL_H_
99

10-
#include <zephyr/sys/fdtable.h>
11-
1210
/* Setting for pollfd to avoid circular inclusion */
1311

1412
/**
@@ -27,7 +25,11 @@ extern "C" {
2725
*
2826
* An array of these descriptors is passed as an argument to poll().
2927
*/
30-
#define zsock_pollfd zvfs_pollfd
28+
struct zsock_pollfd {
29+
int fd; /**< Socket descriptor */
30+
short events; /**< Requested events */
31+
short revents; /**< Returned events */
32+
};
3133

3234
#ifdef __cplusplus
3335
}

include/zephyr/sys/fdtable.h

-18
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@
2727
#define ZVFS_MODE_IFLNK 0120000
2828
#define ZVFS_MODE_IFSOCK 0140000
2929

30-
#define ZVFS_POLLIN BIT(0)
31-
#define ZVFS_POLLPRI BIT(1)
32-
#define ZVFS_POLLOUT BIT(2)
33-
#define ZVFS_POLLERR BIT(3)
34-
#define ZVFS_POLLHUP BIT(4)
35-
#define ZVFS_POLLNVAL BIT(5)
36-
3730
#ifdef __cplusplus
3831
extern "C" {
3932
#endif
@@ -199,17 +192,6 @@ static inline int zvfs_fdtable_call_ioctl(const struct fd_op_vtable *vtable, voi
199192
return res;
200193
}
201194

202-
struct zvfs_pollfd {
203-
int fd;
204-
short events;
205-
short revents;
206-
};
207-
208-
__syscall int zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout);
209-
210-
struct zsock_fd_set {
211-
uint32_t bitset[(CONFIG_ZVFS_OPEN_MAX + 31) / 32];
212-
};
213195
/**
214196
* Request codes for fd_op_vtable.ioctl().
215197
*

lib/os/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ zephyr_sources(
1212
)
1313

1414
zephyr_sources_ifdef(CONFIG_FDTABLE fdtable.c)
15-
zephyr_syscall_header_ifdef(CONFIG_FDTABLE
16-
${ZEPHYR_BASE}/include/zephyr/sys/fdtable.h
17-
)
1815

1916
zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c)
2017
zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c)

lib/os/zvfs/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22

33
zephyr_library()
44
zephyr_library_sources_ifdef(CONFIG_ZVFS_EVENTFD zvfs_eventfd.c)
5-
zephyr_library_sources_ifdef(CONFIG_ZVFS_POLL zvfs_poll.c)

lib/os/zvfs/Kconfig

+1-19
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if ZVFS
1616

1717
config ZVFS_EVENTFD
1818
bool "ZVFS event file descriptor support"
19-
imply ZVFS_POLL
19+
select POLL
2020
help
2121
Enable support for ZVFS event file descriptors. An eventfd can
2222
be used as an event wait/notify mechanism together with POSIX calls
@@ -33,22 +33,4 @@ config ZVFS_EVENTFD_MAX
3333

3434
endif # ZVFS_EVENTFD
3535

36-
config ZVFS_POLL
37-
bool "ZVFS poll"
38-
select POLL
39-
help
40-
Enable support for zvfs_poll().
41-
42-
if ZVFS_POLL
43-
44-
config ZVFS_POLL_MAX
45-
int "Max number of supported zvfs_poll() entries"
46-
default 6 if WIFI_NM_WPA_SUPPLICANT
47-
default 4 if SHELL_BACKEND_TELNET
48-
default 3
49-
help
50-
Maximum number of entries supported for poll() call.
51-
52-
endif # ZVFS_POLL
53-
5436
endif # ZVFS

lib/os/zvfs/zvfs_poll.c

-212
This file was deleted.

lib/posix/options/Kconfig.device_io

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ menu "POSIX device I/O"
66

77
config POSIX_DEVICE_IO
88
bool "POSIX device I/O [EXPERIMENTAL]"
9+
select FDTABLE
910
select EXPERIMENTAL
1011
select REQUIRES_FULL_LIBC
11-
select ZVFS
12-
select ZVFS_POLL
1312
help
1413
Select 'y' here and Zephyr will provide an implementation of the POSIX_DEVICE_IO Option
1514
Group such as FD_CLR(), FD_ISSET(), FD_SET(), FD_ZERO(), close(), fdopen(), fileno(), open(),

lib/posix/options/device_io.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ FUNC_ALIAS(open, _open, int);
3737

3838
int poll(struct pollfd *fds, int nfds, int timeout)
3939
{
40-
return zvfs_poll(fds, nfds, timeout);
40+
/* TODO: create zvfs_poll() and dispatch to subsystems based on file type */
41+
return zsock_poll(fds, nfds, timeout);
4142
}
4243

4344
ssize_t pread(int fd, void *buf, size_t count, off_t offset)

subsys/net/lib/sockets/Kconfig

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
menuconfig NET_SOCKETS
77
bool "BSD Sockets compatible API"
8-
select ZVFS
9-
select ZVFS_POLL
8+
select FDTABLE
109
help
1110
Provide BSD Sockets like API on top of native Zephyr networking API.
1211

@@ -48,7 +47,9 @@ config NET_SOCKETS_POSIX_NAMES
4847

4948
config NET_SOCKETS_POLL_MAX
5049
int "Max number of supported poll() entries"
51-
default ZVFS_POLL_MAX
50+
default 6 if WIFI_NM_WPA_SUPPLICANT
51+
default 4 if SHELL_BACKEND_TELNET
52+
default 3
5253
help
5354
Maximum number of entries supported for poll() call.
5455

0 commit comments

Comments
 (0)