Home
last modified time | relevance | path

Searched refs:fds (Results 1 – 25 of 71) sorted by relevance

123

/Zephyr-latest/tests/net/socket/socketpair/src/
Dpoll.c27 struct zsock_pollfd fds[1]; in test_socketpair_poll_timeout_common() local
29 memset(fds, 0, sizeof(fds)); in test_socketpair_poll_timeout_common()
30 fds[0].fd = fixture->sv[0]; in test_socketpair_poll_timeout_common()
31 fds[0].events |= ZSOCK_POLLIN; in test_socketpair_poll_timeout_common()
32 res = zsock_poll(fds, 1, 1); in test_socketpair_poll_timeout_common()
40 memset(fds, 0, sizeof(fds)); in test_socketpair_poll_timeout_common()
41 fds[0].fd = fixture->sv[0]; in test_socketpair_poll_timeout_common()
42 fds[0].events |= ZSOCK_POLLOUT; in test_socketpair_poll_timeout_common()
43 res = zsock_poll(fds, 1, 1); in test_socketpair_poll_timeout_common()
96 struct zsock_pollfd fds[1]; in ZTEST_F() local
[all …]
/Zephyr-latest/tests/posix/headers/src/
Dsys_select_h.c22 fd_set fds = {0}; in ZTEST() local
28 FD_CLR(0, &fds); in ZTEST()
29 FD_ISSET(0, &fds); in ZTEST()
30 FD_SET(0, &fds); in ZTEST()
31 FD_ZERO(&fds); in ZTEST()
/Zephyr-latest/subsys/net/lib/zperf/
Dzperf_tcp_receiver.c39 static struct zsock_pollfd fds[SOCK_ID_MAX]; variable
110 for (i = 0; i < ARRAY_SIZE(fds); i++) { in tcp_receiver_cleanup()
111 if (fds[i].fd >= 0) { in tcp_receiver_cleanup()
112 zsock_close(fds[i].fd); in tcp_receiver_cleanup()
113 fds[i].fd = -1; in tcp_receiver_cleanup()
157 if (fds[SOCK_ID_IPV4_LISTEN].fd == pev->event.fd || in tcp_recv_data()
158 fds[SOCK_ID_IPV6_LISTEN].fd == pev->event.fd) { in tcp_recv_data()
172 if (fds[i].fd < 0) { in tcp_recv_data()
182 fds[i].fd = sock; in tcp_recv_data()
183 fds[i].events = ZSOCK_POLLIN; in tcp_recv_data()
[all …]
Dzperf_udp_receiver.c47 struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; variable
301 for (i = 0; i < ARRAY_SIZE(fds); i++) { in udp_receiver_cleanup()
302 if (fds[i].fd >= 0) { in udp_receiver_cleanup()
303 zperf_udp_leave_mcast(fds[i].fd); in udp_receiver_cleanup()
304 zsock_close(fds[i].fd); in udp_receiver_cleanup()
305 fds[i].fd = -1; in udp_receiver_cleanup()
382 for (int i = 0; i < ARRAY_SIZE(fds); i++) { in zperf_udp_receiver_init()
383 fds[i].fd = -1; in zperf_udp_receiver_init()
393 fds[SOCK_ID_IPV4].fd = zsock_socket(AF_INET, SOCK_DGRAM, in zperf_udp_receiver_init()
395 if (fds[SOCK_ID_IPV4].fd < 0) { in zperf_udp_receiver_init()
[all …]
/Zephyr-latest/samples/net/sockets/socketpair/src/
Dmain.c163 static void setup_poll(const struct context *ctx, struct pollfd *fds, size_t n) in setup_poll() argument
166 fds[i].fd = ctx[i].spair[0]; in setup_poll()
167 fds[i].events = POLLIN; in setup_poll()
168 fds[i].revents = 0; in setup_poll()
172 static int handle_poll_events(const struct context *ctx, struct pollfd *fds, size_t n, in handle_poll_events() argument
181 idx = fd_to_idx(fds[i].fd, ctx, n); in handle_poll_events()
183 printf("failed to find fd %d in any active context\n", fds[i].fd); in handle_poll_events()
187 if ((fds[i].revents & POLLERR) != 0) { in handle_poll_events()
188 printf("fd: %d: error\n", fds[i].fd); in handle_poll_events()
190 } else if ((fds[i].revents & POLLIN) != 0) { in handle_poll_events()
[all …]
/Zephyr-latest/subsys/shell/backends/
Dshell_telnet.c53 (void)zsock_close(sh_telnet->fds[SOCK_ID_CLIENT].fd); in telnet_end_client_connection()
55 sh_telnet->fds[SOCK_ID_CLIENT].fd = -1; in telnet_end_client_connection()
61 ret = net_socket_service_register(&telnet_server, sh_telnet->fds, in telnet_end_client_connection()
62 ARRAY_SIZE(sh_telnet->fds), NULL); in telnet_end_client_connection()
70 if (sh_telnet->fds[SOCK_ID_CLIENT].fd < 0) { in telnet_command_send_reply()
77 ret = zsock_send(sh_telnet->fds[SOCK_ID_CLIENT].fd, msg, len, 0); in telnet_command_send_reply()
194 if (sh_telnet->fds[SOCK_ID_CLIENT].fd < 0) { in telnet_send()
199 ret = zsock_send(sh_telnet->fds[SOCK_ID_CLIENT].fd, msg, len, in telnet_send()
389 if (sh_telnet->fds[SOCK_ID_IPV4_LISTEN].fd >= 0) { in telnet_restart_server()
390 (void)zsock_close(sh_telnet->fds[SOCK_ID_IPV4_LISTEN].fd); in telnet_restart_server()
[all …]
Dshell_websocket.c36 LOG_DBG("Closing connection to #%d", ws->fds[0].fd); in ws_end_client_connection()
38 (void)log_backend_ws_unregister(ws->fds[0].fd); in ws_end_client_connection()
40 (void)websocket_unregister(ws->fds[0].fd); in ws_end_client_connection()
42 ws->fds[0].fd = -1; in ws_end_client_connection()
47 ret = net_socket_service_register(&websocket_server, ws->fds, in ws_end_client_connection()
48 ARRAY_SIZE(ws->fds), NULL); in ws_end_client_connection()
64 if (ws->fds[0].fd < 0) { in ws_send()
69 ret = zsock_send(ws->fds[0].fd, msg, len, in ws_send()
174 if (evt->event.fd == ws->fds[0].fd) { in ws_server_cb()
185 if (evt->event.fd == ws->fds[0].fd) { in ws_server_cb()
[all …]
/Zephyr-latest/tests/net/lib/coap_client/src/
Dstubs.c37 int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) in z_impl_zvfs_poll() argument
42 fds[i].revents = in z_impl_zvfs_poll()
43 my_events[fds[i].fd] & (fds[i].events | ZSOCK_POLLERR | ZSOCK_POLLHUP); in z_impl_zvfs_poll()
44 if (fds[i].revents) { in z_impl_zvfs_poll()
/Zephyr-latest/subsys/net/lib/http/
Dhttp_server_core.c53 struct zsock_pollfd fds[HTTP_SERVER_SOCK_COUNT]; member
93 memset(ctx->fds, 0, sizeof(ctx->fds)); in http_server_init()
96 for (i = 0; i < ARRAY_SIZE(ctx->fds); i++) { in http_server_init()
97 ctx->fds[i].fd = INVALID_SOCK; in http_server_init()
108 ctx->fds[count].fd = fd; in http_server_init()
109 ctx->fds[count].events = ZSOCK_POLLIN; in http_server_init()
240 ctx->fds[count].fd = fd; in http_server_init()
241 ctx->fds[count].events = ZSOCK_POLLIN; in http_server_init()
248 zsock_close(ctx->fds[0].fd); in http_server_init()
283 zsock_close(ctx->fds[0].fd); /* close eventfd */ in close_all_sockets()
[all …]
/Zephyr-latest/samples/net/sockets/echo_client/src/
Decho-client.c72 static APP_BMEM struct pollfd fds[1 + 4]; variable
88 fds[nfds].fd = eventfd(0, 0); in prepare_fds()
89 fds[nfds].events = POLLIN; in prepare_fds()
93 fds[nfds].fd = conf.ipv4.udp.sock; in prepare_fds()
94 fds[nfds].events = POLLIN; in prepare_fds()
99 fds[nfds].fd = conf.ipv4.tcp.sock; in prepare_fds()
100 fds[nfds].events = POLLIN; in prepare_fds()
105 fds[nfds].fd = conf.ipv6.udp.sock; in prepare_fds()
106 fds[nfds].events = POLLIN; in prepare_fds()
111 fds[nfds].fd = conf.ipv6.tcp.sock; in prepare_fds()
[all …]
/Zephyr-latest/lib/os/zvfs/
Dzvfs_poll.c20 int zvfs_poll_internal(struct zvfs_pollfd *fds, int nfds, k_timeout_t timeout) in zvfs_poll_internal() argument
39 for (pfd = fds, i = nfds; i--; pfd++) { in zvfs_poll_internal()
102 return zvfs_fdtable_call_ioctl(offl_vtable, offl_ctx, ZFD_IOCTL_POLL_OFFLOAD, fds, in zvfs_poll_internal()
120 for (pfd = fds, i = nfds; i--; pfd++) { in zvfs_poll_internal()
172 int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) in z_impl_zvfs_poll() argument
182 return zvfs_poll_internal(fds, nfds, timeout); in z_impl_zvfs_poll()
186 static inline int z_vrfy_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int timeout) in z_vrfy_zvfs_poll() argument
197 fds_copy = k_usermode_alloc_from_copy((void *)fds, fds_size); in z_vrfy_zvfs_poll()
206 k_usermode_to_copy((void *)fds, fds_copy, fds_size); in z_vrfy_zvfs_poll()
/Zephyr-latest/tests/posix/eventfd/src/
Dblocking.c109 struct zsock_pollfd fds[] = { in ZTEST_F() local
122 ret = zsock_poll(fds, ARRAY_SIZE(fds), 200); in ZTEST_F()
125 zassert_equal(fds[0].revents, ZSOCK_POLLIN); in ZTEST_F()
144 struct zsock_pollfd fds[] = { in ZTEST_F() local
158 ret = zsock_poll(fds, ARRAY_SIZE(fds), 200); in ZTEST_F()
161 zassert_equal(fds[0].revents, ZSOCK_POLLOUT); in ZTEST_F()
/Zephyr-latest/subsys/net/lib/dns/
Ddispatcher.c260 CHECKIF((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) { in dns_dispatcher_register()
265 if (ctx->fds[i].fd < 0) { in dns_dispatcher_register()
269 if (dispatch_table[ctx->fds[i].fd].ctx == NULL) { in dns_dispatcher_register()
270 dispatch_table[ctx->fds[i].fd].ctx = ctx; in dns_dispatcher_register()
301 if ((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) { in dns_dispatcher_register()
306 if (ctx->fds[i].fd < 0) { in dns_dispatcher_register()
310 if (dispatch_table[ctx->fds[i].fd].ctx == NULL) { in dns_dispatcher_register()
311 dispatch_table[ctx->fds[i].fd].ctx = ctx; in dns_dispatcher_register()
315 ret = net_socket_service_register(ctx->svc, ctx->fds, ctx->fds_len, &dispatch_table); in dns_dispatcher_register()
343 CHECKIF((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) { in dns_dispatcher_unregister()
[all …]
Dllmnr_responder.c68 static struct zsock_pollfd fds[LLMNR_MAX_POLL]; variable
625 ARRAY_FOR_EACH(fds, j) { in init_listener()
626 fds[j].fd = -1; in init_listener()
646 ARRAY_FOR_EACH(fds, j) { in init_listener()
647 if (fds[j].fd == ipv6) { in init_listener()
652 if (fds[j].fd < 0) { in init_listener()
653 fds[j].fd = ipv6; in init_listener()
654 fds[j].events = ZSOCK_POLLIN; in init_listener()
666 ret = net_socket_service_register(&svc_llmnr, fds, ARRAY_SIZE(fds), NULL); in init_listener()
693 ARRAY_FOR_EACH(fds, j) { in init_listener()
[all …]
Dmdns_responder.c689 struct zsock_pollfd *fds, in register_dispatcher() argument
694 ctx->dispatcher.fds = fds; in register_dispatcher()
757 ARRAY_FOR_EACH(v6_ctx[i].fds, j) { in init_listener()
758 v6_ctx[i].fds[j].fd = -1; in init_listener()
796 ARRAY_FOR_EACH(v6_ctx[i].fds, j) { in init_listener()
797 if (v6_ctx[i].fds[j].fd == v6) { in init_listener()
802 if (v6_ctx[i].fds[j].fd < 0) { in init_listener()
803 v6_ctx[i].fds[j].fd = v6; in init_listener()
804 v6_ctx[i].fds[j].events = ZSOCK_POLLIN; in init_listener()
850 ARRAY_FOR_EACH(v4_ctx[i].fds, j) { in init_listener()
[all …]
/Zephyr-latest/tests/net/socket/tls/src/
Dmain.c360 struct zsock_pollfd fds[1]; in test_prepare_dtls_connection() local
398 fds[0].fd = s_sock; in test_prepare_dtls_connection()
399 fds[0].events = ZSOCK_POLLIN; in test_prepare_dtls_connection()
400 ret = zsock_poll(fds, 1, 1000); in test_prepare_dtls_connection()
1549 struct zsock_pollfd fds[1]; in ZTEST() local
1553 fds[0].fd = new_sock; in ZTEST()
1554 fds[0].events = ZSOCK_POLLIN; in ZTEST()
1556 ret = zsock_poll(fds, 1, 0); in ZTEST()
1562 ret = zsock_poll(fds, 1, 100); in ZTEST()
1564 zassert_equal(fds[0].revents, ZSOCK_POLLIN, "No POLLIN event"); in ZTEST()
[all …]
/Zephyr-latest/tests/net/socket/tls_configurations/src/
Dmain.c61 static struct pollfd fds[1]; variable
74 ret = poll(fds, ARRAY_SIZE(fds), -1); in wait_for_event()
135 fds[0].fd = socket_fd; in create_socket()
136 fds[0].events = POLLIN; in create_socket()
/Zephyr-latest/tests/modules/thrift/ThriftTest/src/
Dmain.cpp64 std::shared_ptr<TTransport> trans(new TFDTransport(context.fds[ctx::CLIENT])); in setup_client()
73 trans = std::make_shared<TFDTransport>(context.fds[ctx::CLIENT]); in setup_client()
102 serverTransport = std::make_shared<TFDServer>(context.fds[ctx::SERVER]); in setup_server()
136 rv = socketpair(AF_UNIX, SOCK_STREAM, 0, &context.fds.front()); in thrift_test_before()
161 for (auto &fd : context.fds) { in thrift_test_after()
Dcontext.hpp27 std::array<int, CLIENT + 1> fds; member
/Zephyr-latest/samples/net/sockets/http_server/src/
Dws.c66 struct pollfd fds[1]; member
71 .fds[0].fd = -1,
124 cfg->fds[0].fd = client; in ws_echo_handler()
125 cfg->fds[0].events = POLLIN; in ws_echo_handler()
134 if (poll(cfg->fds, 1, -1) < 0) { in ws_echo_handler()
139 if (cfg->fds[0].fd < 0) { in ws_echo_handler()
143 if (cfg->fds[0].revents & ZSOCK_POLLHUP) { in ws_echo_handler()
/Zephyr-latest/drivers/modem/
Dmodem_socket.c265 int modem_socket_poll(struct modem_socket_config *cfg, struct zsock_pollfd *fds, int nfds, in modem_socket_poll() argument
279 sock = modem_socket_from_fd(cfg, fds[i].fd); in modem_socket_poll()
285 if (fds[i].events & ZSOCK_POLLOUT) { in modem_socket_poll()
288 } else if (fds[i].events & ZSOCK_POLLIN) { in modem_socket_poll()
313 sock = modem_socket_from_fd(cfg, fds[i].fd); in modem_socket_poll()
322 if (fds[i].events & ZSOCK_POLLOUT) { in modem_socket_poll()
323 fds[i].revents |= ZSOCK_POLLOUT; in modem_socket_poll()
325 } else if ((fds[i].events & ZSOCK_POLLIN) && (sock->packet_sizes[0] > 0U)) { in modem_socket_poll()
326 fds[i].revents |= ZSOCK_POLLIN; in modem_socket_poll()
/Zephyr-latest/samples/net/cloud/aws_iot_mqtt/src/
Dmain.c365 struct pollfd fds; in aws_client_loop() local
374 fds.fd = client_ctx.transport.tcp.sock; in aws_client_loop()
375 fds.events = POLLIN; in aws_client_loop()
379 rc = poll(&fds, 1u, timeout); in aws_client_loop()
381 if (fds.revents & POLLIN) { in aws_client_loop()
389 if (fds.revents & (POLLHUP | POLLERR)) { in aws_client_loop()
418 close(fds.fd); in aws_client_loop()
419 fds.fd = -1; in aws_client_loop()
/Zephyr-latest/samples/net/secure_mqtt_sensor_actuator/src/
Dmqtt_client.c30 static struct zsock_pollfd fds[1]; variable
75 fds[0].fd = client->transport.tcp.sock; in prepare_fds()
79 fds[0].fd = client->transport.tls.sock; in prepare_fds()
83 fds[0].events = ZSOCK_POLLIN; in prepare_fds()
258 rc = zsock_poll(fds, nfds, timeout); in poll_mqtt_socket()
365 if (fds[0].revents & ZSOCK_POLLIN) { in app_mqtt_process()
373 if (fds[0].revents & (ZSOCK_POLLHUP | ZSOCK_POLLERR)) { in app_mqtt_process()
/Zephyr-latest/subsys/net/lib/coap/
Dcoap_client.c567 struct zsock_pollfd fds[CONFIG_COAP_CLIENT_MAX_INSTANCES] = {0}; in handle_poll() local
579 fds[nfds].fd = clients[i]->fd; in handle_poll()
580 fds[nfds].events = events; in handle_poll()
581 fds[nfds].revents = 0; in handle_poll()
585 ret = zsock_poll(fds, nfds, COAP_PERIODIC_TIMEOUT); in handle_poll()
596 struct coap_client *client = get_client(fds[i].fd); in handle_poll()
599 LOG_ERR("No client found for socket %d", fds[i].fd); in handle_poll()
603 if (fds[i].revents & ZSOCK_POLLOUT) { in handle_poll()
606 if (fds[i].revents & ZSOCK_POLLIN) { in handle_poll()
628 if (fds[i].revents & ZSOCK_POLLERR) { in handle_poll()
[all …]
/Zephyr-latest/include/zephyr/posix/
Dpoll.h26 int poll(struct pollfd *fds, int nfds, int timeout);

123