Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 83) sorted by relevance

1234

/hal_espressif-3.6.0/components/vfs/test/
Dtest_vfs_eventfd.c29 int fd = eventfd(0, 0); variable
30 TEST_ASSERT_GREATER_OR_EQUAL(0, fd);
31 TEST_ASSERT_EQUAL(0, close(fd));
33 fd = eventfd(0, EFD_SUPPORT_ISR);
34 TEST_ASSERT_GREATER_OR_EQUAL(0, fd);
35 TEST_ASSERT_EQUAL(0, close(fd));
44 int fd = eventfd(0, 1); variable
45 TEST_ASSERT_LESS_THAN(0, fd);
48 fd = eventfd(0, INT_MAX);
49 TEST_ASSERT_LESS_THAN(0, fd);
[all …]
Dtest_vfs_append.c32 static inline void test_write(int fd, const char *str, const char *msg) in test_write() argument
34 TEST_ASSERT_EQUAL_MESSAGE(strlen(str), write(fd, str, strlen(str)), msg); in test_write()
37 static inline void test_read(int fd, const char *str, const char *msg) in test_read() argument
40 TEST_ASSERT_EQUAL_MESSAGE(strlen(str), read(fd, buf, strlen(str)), msg); in test_read()
44 static inline void test_read_fails(int fd, const char *msg) in test_read_fails() argument
47 TEST_ASSERT_EQUAL_MESSAGE(0, read(fd, &buf, 1), msg); in test_read_fails()
52 int fd = open(path, O_RDWR | O_APPEND | O_CREAT | O_TRUNC, OPEN_MODE); in test_append() local
53 TEST_ASSERT_NOT_EQUAL(-1, fd); in test_append()
55 test_write(fd, MSG1, "write MSG1"); in test_append()
56 test_read_fails(fd, "read fails MSG1"); in test_append()
[all …]
Dtest_vfs_select.c31 int fd; member
116 write(test_task_param->fd, message, sizeof(message)); in send_task()
170 .fd = uart_fd,
219 .fd = uart_fd,
223 .fd = -1, // should be ignored according to the documentation of poll()
228 .fd = uart_fd,
237 TEST_ASSERT_EQUAL(uart_fd, poll_fds[0].fd);
239 TEST_ASSERT_EQUAL(-1, poll_fds[1].fd);
248 poll_fds[1].fd = socket_fd;
255 TEST_ASSERT_EQUAL(uart_fd, poll_fds[0].fd);
[all …]
Dtest_vfs_fd.c35 int fd; member
42 return param->fd; in collision_test_vfs_open()
48 static int collision_test_vfs_close(void* ctx, int fd) in collision_test_vfs_close() argument
51 if (fd == param->fd) { in collision_test_vfs_close()
62 .fd = 1,
126 static int concurrent_test_vfs_close(int fd) in concurrent_test_vfs_close() argument
129 if (concurrent_test_path_to_fd[i].local_fd == fd) { in concurrent_test_vfs_close()
226 static int time_test_vfs_close(int fd) in time_test_vfs_close() argument
231 static int time_test_vfs_write(int fd, const void *data, size_t size) in time_test_vfs_write() argument
251 const int fd = open(VFS_PREF1 FILE1, 0, 0); variable
[all …]
/hal_espressif-3.6.0/components/vfs/
Dvfs_eventfd.c52 int fd; member
64 int fd; member
117 if (s_events[i].fd == i) { in event_start_select()
124 event_select_args->fd = i; in event_start_select()
178 event_context_t *event = &s_events[select_args->fd]; in event_end_select()
185 if (event->fd != select_args->fd) { // already closed in event_end_select()
187 FD_SET(select_args->fd, select_args->error_fds); in event_end_select()
191 FD_SET(select_args->fd, select_args->read_fds); in event_end_select()
207 if (event->fd == FD_PENDING_SELECT) { in event_end_select()
208 event->fd = FD_INVALID; in event_end_select()
[all …]
Dvfs_uart.c53 static void uart_tx_char(int fd, int c);
54 static int uart_rx_char(int fd);
57 static void uart_tx_char_via_driver(int fd, int c);
58 static int uart_rx_char_via_driver(int fd);
133 int fd = -1; in uart_open() local
136 fd = 0; in uart_open()
138 fd = 1; in uart_open()
140 fd = 2; in uart_open()
143 return fd; in uart_open()
146 s_ctx[fd]->non_blocking = ((flags & O_NONBLOCK) == O_NONBLOCK); in uart_open()
[all …]
Dvfs.c200 esp_err_t esp_vfs_register_fd(esp_vfs_id_t vfs_id, int *fd) in esp_vfs_register_fd() argument
202 return esp_vfs_register_fd_with_local_fd(vfs_id, -1, true, fd); in esp_vfs_register_fd()
205 …err_t esp_vfs_register_fd_with_local_fd(esp_vfs_id_t vfs_id, int local_fd, bool permanent, int *fd) in esp_vfs_register_fd_with_local_fd() argument
207 if (vfs_id < 0 || vfs_id >= s_vfs_count || fd == NULL) { in esp_vfs_register_fd_with_local_fd()
209 vfs_id, local_fd, permanent, fd); in esp_vfs_register_fd_with_local_fd()
224 *fd = i; in esp_vfs_register_fd_with_local_fd()
232 vfs_id, local_fd, permanent, fd, esp_err_to_name(ret)); in esp_vfs_register_fd_with_local_fd()
237 esp_err_t esp_vfs_unregister_fd(esp_vfs_id_t vfs_id, int fd) in esp_vfs_unregister_fd() argument
241 if (vfs_id < 0 || vfs_id >= s_vfs_count || fd < 0 || fd >= MAX_FDS) { in esp_vfs_unregister_fd()
242 ESP_LOGD(TAG, "Invalid arguments for esp_vfs_unregister_fd(%d, %d)", vfs_id, fd); in esp_vfs_unregister_fd()
[all …]
Dvfs_usb_serial_jtag.c53 static void usb_serial_jtag_tx_char(int fd, int c);
54 static int usb_serial_jtag_rx_char(int fd);
105 static void usb_serial_jtag_tx_char(int fd, int c) in usb_serial_jtag_tx_char() argument
125 static int usb_serial_jtag_rx_char(int fd) in usb_serial_jtag_rx_char() argument
135 static ssize_t usb_serial_jtag_write(int fd, const void * data, size_t size) in usb_serial_jtag_write() argument
146 s_ctx.tx_func(fd, '\r'); in usb_serial_jtag_write()
151 s_ctx.tx_func(fd, c); in usb_serial_jtag_write()
166 static int usb_serial_jtag_read_char(int fd) in usb_serial_jtag_read_char() argument
174 return s_ctx.rx_func(fd); in usb_serial_jtag_read_char()
178 static void usb_serial_jtag_return_char(int fd, int c) in usb_serial_jtag_return_char() argument
[all …]
Dvfs_cdcacm.c51 static ssize_t cdcacm_write(int fd, const void *data, size_t size) in cdcacm_write() argument
53 assert(fd == 0); in cdcacm_write()
74 static int cdcacm_fsync(int fd) in cdcacm_fsync() argument
76 assert(fd == 0); in cdcacm_fsync()
88 static int cdcacm_fstat(int fd, struct stat *st) in cdcacm_fstat() argument
90 assert(fd == 0); in cdcacm_fstat()
96 static int cdcacm_close(int fd) in cdcacm_close() argument
98 assert(fd == 0); in cdcacm_close()
146 static ssize_t cdcacm_read(int fd, void *data, size_t size) in cdcacm_read() argument
148 assert(fd == 0); in cdcacm_read()
[all …]
Dvfs_console.c70 ssize_t console_write(int fd, const void *data, size_t size) in console_write() argument
80 int console_fstat(int fd, struct stat * st) in console_fstat() argument
82 return get_vfs_for_index(primary_vfs_index)->vfs.fstat(fd, st); in console_fstat()
85 int console_close(int fd) in console_close() argument
95 ssize_t console_read(int fd, void * dst, size_t size) in console_read() argument
100 int console_fcntl(int fd, int cmd, int arg) in console_fcntl() argument
105 int console_fsync(int fd) in console_fsync() argument
134 int console_tcsetattr(int fd, int optional_actions, const struct termios *p) in console_tcsetattr() argument
139 int console_tcgetattr(int fd, struct termios *p) in console_tcgetattr() argument
144 int console_tcdrain(int fd) in console_tcdrain() argument
[all …]
/hal_espressif-3.6.0/components/mbedtls/port/
Dnet_sockets.c69 ctx->fd = -1; in mbedtls_net_init()
97 int fd = socket( cur->ai_family, cur->ai_socktype, cur->ai_protocol ); in mbedtls_net_connect() local
99 if ( fd < 0 ) { in mbedtls_net_connect()
104 if ( connect( fd, cur->ai_addr, cur->ai_addrlen ) == 0 ) { in mbedtls_net_connect()
105 ctx->fd = fd; // connected! in mbedtls_net_connect()
110 close( fd ); in mbedtls_net_connect()
148 int fd = socket( cur->ai_family, cur->ai_socktype, cur->ai_protocol ); in mbedtls_net_bind() local
149 if ( fd < 0 ) { in mbedtls_net_bind()
156 if ( setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, in mbedtls_net_bind()
158 close( fd ); in mbedtls_net_bind()
[all …]
/hal_espressif-3.6.0/components/vfs/include/
Desp_vfs.h96 …ssize_t (*write_p)(void* p, int fd, const void * data, size_t size); /*!< …
97 …ssize_t (*write)(int fd, const void * data, size_t size); /*!< …
100 …off_t (*lseek_p)(void* p, int fd, off_t size, int mode); /*!< …
101 …off_t (*lseek)(int fd, off_t size, int mode); /*!< …
104 …ssize_t (*read_p)(void* ctx, int fd, void * dst, size_t size); /*!< …
105 …ssize_t (*read)(int fd, void * dst, size_t size); /*!< …
108 …ssize_t (*pread_p)(void *ctx, int fd, void * dst, size_t size, off_t offset); /*!< …
109 …ssize_t (*pread)(int fd, void * dst, size_t size, off_t offset); /*!< …
112 …ssize_t (*pwrite_p)(void *ctx, int fd, const void *src, size_t size, off_t offset); /*!< …
113 …ssize_t (*pwrite)(int fd, const void *src, size_t size, off_t offset); /*!< …
[all …]
/hal_espressif-3.6.0/components/lwip/port/esp32/
Dno_vfs_syscalls.c33 extern ssize_t _write_r_console(struct _reent *r, int fd, const void * data, size_t size);
34 extern ssize_t _read_r_console(struct _reent *r, int fd, const void * data, size_t size);
36 ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) in _write_r() argument
38 if (fd < LWIP_SOCKET_OFFSET) { in _write_r()
39 return _write_r_console(r, fd, data, size); in _write_r()
41 return lwip_write(fd, data, size); in _write_r()
44 ssize_t _read_r(struct _reent *r, int fd, void * dst, size_t size) in _read_r() argument
46 if (fd < LWIP_SOCKET_OFFSET) { in _read_r()
47 return _read_r_console(r, fd, dst, size); in _read_r()
49 return lwip_read(fd, dst, size); in _read_r()
[all …]
/hal_espressif-3.6.0/examples/protocols/https_server/wss_server/main/
Dkeep_alive.c29 int fd; member
75 if (h->clients[i].type == CLIENT_ACTIVE && h->clients[i].fd == sockfd) { in update_client()
86 if (h->clients[i].type == CLIENT_ACTIVE && h->clients[i].fd == sockfd) { in remove_client()
88 h->clients[i].fd = -1; in remove_client()
99 h->clients[i].fd = sockfd; in add_new_client()
117 if (!add_new_client(keep_alive_storage, client_action.fd)) { in keep_alive_task()
122 if (!remove_client(keep_alive_storage, client_action.fd)) { in keep_alive_task()
123 ESP_LOGE(TAG, "Cannot remove client fd:%d", client_action.fd); in keep_alive_task()
127 … if (!update_client(keep_alive_storage, client_action.fd, client_action.last_seen)) { in keep_alive_task()
128 ESP_LOGE(TAG, "Cannot find client fd:%d", client_action.fd); in keep_alive_task()
[all …]
Dwss_server_example.c28 int fd; member
120 int fd = resp_arg->fd; in send_hello() local
127 httpd_ws_send_frame_async(hd, fd, &ws_pkt); in send_hello()
135 int fd = resp_arg->fd; in send_ping() local
142 httpd_ws_send_frame_async(hd, fd, &ws_pkt); in send_ping()
146 bool client_not_alive_cb(wss_keep_alive_t h, int fd) in client_not_alive_cb() argument
148 ESP_LOGE(TAG, "Client not alive, closing fd %d", fd); in client_not_alive_cb()
149 httpd_sess_trigger_close(wss_keep_alive_get_user_ctx(h), fd); in client_not_alive_cb()
153 bool check_client_alive_cb(wss_keep_alive_t h, int fd) in check_client_alive_cb() argument
155 ESP_LOGD(TAG, "Checking if client (fd=%d) is alive", fd); in check_client_alive_cb()
[all …]
/hal_espressif-3.6.0/components/esp_http_server/src/
Dhttpd_sess.c32 int fd; member
58 static int fd_is_valid(int fd) in fd_is_valid() argument
60 return fcntl(fd, F_GETFD) != -1 || errno != EBADF; in fd_is_valid()
73 session->fd = -1; in enum_function()
78 found = (session->fd != -1); in enum_function()
82 found = (session->fd < 0); in enum_function()
86 found = (session->fd == ctx->fd); in enum_function()
90 if (session->fd != -1) { in enum_function()
91 FD_SET(session->fd, ctx->fdset); in enum_function()
92 if (session->fd > ctx->max_fd) { in enum_function()
[all …]
Dhttpd_main.c111 if (hd->hd_sd[i].fd != -1) { in httpd_get_client_list()
113 client_fds[(*fds)++] = hd->hd_sd[i].fd; in httpd_get_client_list()
169 if (session->fd < 0) { in httpd_process_session()
174 int fd = session->fd; in httpd_process_session() local
176 if (FD_ISSET(fd, ctx->fdset) || httpd_sess_pending(ctx->hd, session)) { in httpd_process_session()
177 ESP_LOGD(TAG, LOG_FMT("processing socket %d"), fd); in httpd_process_session()
268 int fd = socket(PF_INET6, SOCK_STREAM, 0); in httpd_server_init() local
270 int fd = socket(PF_INET, SOCK_STREAM, 0); in httpd_server_init()
272 if (fd < 0) { in httpd_server_init()
295 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) < 0) { in httpd_server_init()
[all …]
/hal_espressif-3.6.0/components/newlib/
Dsyscalls.c38 ssize_t _write_r_console(struct _reent *r, int fd, const void * data, size_t size) in _write_r_console() argument
41 if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { in _write_r_console()
51 ssize_t _read_r_console(struct _reent *r, int fd, void * data, size_t size) in _read_r_console() argument
54 if (fd == STDIN_FILENO) { in _read_r_console()
68 static ssize_t _fstat_r_console(struct _reent *r, int fd, struct stat * st) in _fstat_r_console() argument
70 if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { in _fstat_r_console()
85 ssize_t _read_r(struct _reent *r, int fd, void * dst, size_t size)
87 ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size)
89 int _fstat_r (struct _reent *r, int fd, struct stat *st)
104 int _close_r(struct _reent *r, int fd)
[all …]
Dpoll.c47 if (fds[i].fd < 0) { in poll()
52 if (fds[i].fd >= FD_SETSIZE) { in poll()
59 FD_SET(fds[i].fd, &readfds); in poll()
60 FD_SET(fds[i].fd, &errorfds); in poll()
61 max_fd = MAX(max_fd, fds[i].fd); in poll()
65 FD_SET(fds[i].fd, &writefds); in poll()
66 FD_SET(fds[i].fd, &errorfds); in poll()
67 max_fd = MAX(max_fd, fds[i].fd); in poll()
77 if (FD_ISSET(fds[i].fd, &readfds)) { in poll()
81 if (FD_ISSET(fds[i].fd, &writefds)) { in poll()
[all …]
/hal_espressif-3.6.0/components/esp-tls/
Desp_tls.c131 …stname_to_fd(const char *host, size_t hostlen, int port, struct sockaddr_storage *address, int* fd) in esp_tls_hostname_to_fd() argument
153 *fd = socket(address_info->ai_family, address_info->ai_socktype, address_info->ai_protocol); in esp_tls_hostname_to_fd()
154 if (*fd < 0) { in esp_tls_hostname_to_fd()
163 …ESP_LOGD(TAG, "[sock=%d] Resolved IPv4 address: %s", *fd, ipaddr_ntoa((const ip_addr_t*)&p->sin_ad… in esp_tls_hostname_to_fd()
171 …ESP_LOGD(TAG, "[sock=%d] Resolved IPv6 address: %s", *fd, ip6addr_ntoa((const ip6_addr_t*)&p->sin6… in esp_tls_hostname_to_fd()
177 close(*fd); in esp_tls_hostname_to_fd()
192 static esp_err_t esp_tls_set_socket_options(int fd, const esp_tls_cfg_t *cfg) in esp_tls_set_socket_options() argument
198 if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) != 0) { in esp_tls_set_socket_options()
202 if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) != 0) { in esp_tls_set_socket_options()
214 …if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keep_alive_enable, sizeof(keep_alive_enable)) != 0) { in esp_tls_set_socket_options()
[all …]
/hal_espressif-3.6.0/components/esp_http_server/src/util/
Dctrl_sock.c21 int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); in cs_create_ctrl_sock() local
22 if (fd < 0) { in cs_create_ctrl_sock()
32 ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); in cs_create_ctrl_sock()
34 close(fd); in cs_create_ctrl_sock()
37 return fd; in cs_create_ctrl_sock()
40 void cs_free_ctrl_sock(int fd) in cs_free_ctrl_sock() argument
42 close(fd); in cs_free_ctrl_sock()
60 int cs_recv_from_ctrl_sock(int fd, void *data, unsigned int data_len) in cs_recv_from_ctrl_sock() argument
63 ret = recvfrom(fd, data, data_len, 0, NULL, NULL); in cs_recv_from_ctrl_sock()
/hal_espressif-3.6.0/components/bt/esp_ble_mesh/mesh_common/tinycrypt/src/
Decc_platform_specific.c82 int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC); in default_CSPRNG() local
83 if (fd == -1) { in default_CSPRNG()
84 fd = open("/dev/random", O_RDONLY | O_CLOEXEC); in default_CSPRNG()
85 if (fd == -1) { in default_CSPRNG()
93 ssize_t bytes_read = read(fd, ptr, left); in default_CSPRNG()
95 close(fd); in default_CSPRNG()
102 close(fd); in default_CSPRNG()
/hal_espressif-3.6.0/components/tinyusb/additions/src/
Dvfs_tinyusb.c40 #define FD_CHECK(fd, ret_val) do { \ argument
41 if ((fd) != 0) { \
129 static ssize_t tusb_write(int fd, const void *data, size_t size) in tusb_write() argument
131 FD_CHECK(fd, -1); in tusb_write()
161 static int tusb_close(int fd) in tusb_close() argument
163 FD_CHECK(fd, -1); in tusb_close()
167 static ssize_t tusb_read(int fd, void *data, size_t size) in tusb_read() argument
169 FD_CHECK(fd, -1); in tusb_read()
207 static int tusb_fstat(int fd, struct stat *st) in tusb_fstat() argument
209 FD_CHECK(fd, -1); in tusb_fstat()
[all …]
/hal_espressif-3.6.0/examples/peripherals/uart/uart_select/main/
Duart_select_example_main.c37 int fd; in uart_select_task() local
39 if ((fd = open("/dev/uart/0", O_RDWR)) == -1) { in uart_select_task()
57 FD_SET(fd, &rfds); in uart_select_task()
59 s = select(fd + 1, &rfds, NULL, NULL, &tv); in uart_select_task()
67 if (FD_ISSET(fd, &rfds)) { in uart_select_task()
69 if (read(fd, &buf, 1) > 0) { in uart_select_task()
85 close(fd); in uart_select_task()
/hal_espressif-3.6.0/components/fatfs/vfs/
Dvfs_fat.c68 static ssize_t vfs_fat_write(void* p, int fd, const void * data, size_t size);
69 static off_t vfs_fat_lseek(void* p, int fd, off_t size, int mode);
70 static ssize_t vfs_fat_read(void* ctx, int fd, void * dst, size_t size);
71 static ssize_t vfs_fat_pread(void *ctx, int fd, void *dst, size_t size, off_t offset);
72 static ssize_t vfs_fat_pwrite(void *ctx, int fd, const void *src, size_t size, off_t offset);
74 static int vfs_fat_close(void* ctx, int fd);
75 static int vfs_fat_fstat(void* ctx, int fd, struct stat * st);
76 static int vfs_fat_fsync(void* ctx, int fd);
273 static void file_cleanup(vfs_fat_ctx_t* ctx, int fd) in file_cleanup() argument
275 memset(&ctx->files[fd], 0, sizeof(FIL)); in file_cleanup()
[all …]

1234