Home
last modified time | relevance | path

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

1234

/hal_espressif-2.7.6/components/vfs/test/
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-2.7.6/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-2.7.6/components/vfs/
Dvfs_uart.c59 static void uart_tx_char(int fd, int c);
60 static int uart_rx_char(int fd);
63 static void uart_tx_char_via_driver(int fd, int c);
64 static int uart_rx_char_via_driver(int fd);
139 int fd = -1; in uart_open() local
142 fd = 0; in uart_open()
144 fd = 1; in uart_open()
146 fd = 2; in uart_open()
149 return fd; in uart_open()
152 s_ctx[fd]->non_blocking = ((flags & O_NONBLOCK) == O_NONBLOCK); in uart_open()
[all …]
Dvfs.c203 esp_err_t esp_vfs_register_fd(esp_vfs_id_t vfs_id, int *fd) in esp_vfs_register_fd() argument
205 if (vfs_id < 0 || vfs_id >= s_vfs_count || fd == NULL) { in esp_vfs_register_fd()
206 ESP_LOGD(TAG, "Invalid arguments for esp_vfs_register_fd(%d, 0x%x)", vfs_id, (int) fd); in esp_vfs_register_fd()
217 *fd = i; in esp_vfs_register_fd()
224 …ESP_LOGD(TAG, "esp_vfs_register_fd(%d, 0x%x) finished with %s", vfs_id, (int) fd, esp_err_to_name(… in esp_vfs_register_fd()
229 esp_err_t esp_vfs_unregister_fd(esp_vfs_id_t vfs_id, int fd) in esp_vfs_unregister_fd() argument
233 if (vfs_id < 0 || vfs_id >= s_vfs_count || fd < 0 || fd >= MAX_FDS) { in esp_vfs_unregister_fd()
234 ESP_LOGD(TAG, "Invalid arguments for esp_vfs_unregister_fd(%d, %d)", vfs_id, fd); in esp_vfs_unregister_fd()
239 fd_table_t *item = s_fd_table + fd; in esp_vfs_unregister_fd()
240 if (item->permanent == true && item->vfs_index == vfs_id && item->local_fd == fd) { in esp_vfs_unregister_fd()
[all …]
Dvfs_cdcacm.c59 static ssize_t cdcacm_write(int fd, const void *data, size_t size) in cdcacm_write() argument
61 assert(fd == 0); in cdcacm_write()
82 static int cdcacm_fsync(int fd) in cdcacm_fsync() argument
84 assert(fd == 0); in cdcacm_fsync()
96 static int cdcacm_fstat(int fd, struct stat *st) in cdcacm_fstat() argument
98 assert(fd == 0); in cdcacm_fstat()
104 static int cdcacm_close(int fd) in cdcacm_close() argument
106 assert(fd == 0); in cdcacm_close()
154 static ssize_t cdcacm_read(int fd, void *data, size_t size) in cdcacm_read() argument
156 assert(fd == 0); in cdcacm_read()
[all …]
Dvfs_semihost.c221 static ssize_t vfs_semihost_write(void* ctx, int fd, const void * data, size_t size) in vfs_semihost_write() argument
226 ESP_LOGV(TAG, "%s: %d %u bytes", __func__, fd, size); in vfs_semihost_write()
227 ret = generic_syscall(SYS_WRITE, fd, (int)data, size, 0, &host_err); in vfs_semihost_write()
234 static ssize_t vfs_semihost_read(void* ctx, int fd, void* data, size_t size) in vfs_semihost_read() argument
239 ESP_LOGV(TAG, "%s: %d %u bytes", __func__, fd, size); in vfs_semihost_read()
240 ret = generic_syscall(SYS_READ, fd, (int)data, size, 0, &host_err); in vfs_semihost_read()
250 static int vfs_semihost_close(void* ctx, int fd) in vfs_semihost_close() argument
254 ESP_LOGV(TAG, "%s: %d", __func__, fd); in vfs_semihost_close()
255 ret = generic_syscall(SYS_CLOSE, fd, 0, 0, 0, &host_err); in vfs_semihost_close()
262 static off_t vfs_semihost_lseek(void* ctx, int fd, off_t offset, int mode) in vfs_semihost_lseek() argument
[all …]
/hal_espressif-2.7.6/components/vfs/include/
Desp_vfs.h104 …ssize_t (*write_p)(void* p, int fd, const void * data, size_t size); /*!< …
105 …ssize_t (*write)(int fd, const void * data, size_t size); /*!< …
108 …off_t (*lseek_p)(void* p, int fd, off_t size, int mode); /*!< …
109 …off_t (*lseek)(int fd, off_t size, int mode); /*!< …
112 …ssize_t (*read_p)(void* ctx, int fd, void * dst, size_t size); /*!< …
113 …ssize_t (*read)(int fd, void * dst, size_t size); /*!< …
116 …ssize_t (*pread_p)(void *ctx, int fd, void * dst, size_t size, off_t offset); /*!< …
117 …ssize_t (*pread)(int fd, void * dst, size_t size, off_t offset); /*!< …
120 …ssize_t (*pwrite_p)(void *ctx, int fd, const void *src, size_t size, off_t offset); /*!< …
121 …ssize_t (*pwrite)(int fd, const void *src, size_t size, off_t offset); /*!< …
[all …]
/hal_espressif-2.7.6/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-2.7.6/components/esp_http_server/src/
Dhttpd_sess.c29 if (hd->hd_sd[i].fd == -1) { in httpd_is_sess_available()
44 if ((hd->hd_req_aux.sd) && (hd->hd_req_aux.sd->fd == sockfd)) { in httpd_sess_get()
52 if (hd->hd_sd[i].fd == sockfd) { in httpd_sess_get()
70 if (hd->hd_sd[i].fd == -1) { in httpd_sess_new()
72 hd->hd_sd[i].fd = newfd; in httpd_sess_new()
79 esp_err_t ret = hd->config.open_fn(hd, hd->hd_sd[i].fd); in httpd_sess_new()
81 httpd_sess_delete(hd, hd->hd_sd[i].fd); in httpd_sess_new()
187 if (hd->hd_sd[i].fd != -1) { in httpd_sess_set_descriptors()
188 FD_SET(hd->hd_sd[i].fd, fdset); in httpd_sess_set_descriptors()
189 if (hd->hd_sd[i].fd > *maxfd) { in httpd_sess_set_descriptors()
[all …]
Dhttpd_main.c114 if (hd->hd_sd[i].fd != -1) { in httpd_get_client_list()
116 client_fds[(*fds)++] = hd->hd_sd[i].fd; in httpd_get_client_list()
137 int fd = -1; in httpd_close_all_sessions() local
138 while ((fd = httpd_sess_iterate(hd, fd)) != -1) { in httpd_close_all_sessions()
139 ESP_LOGD(TAG, LOG_FMT("cleaning up socket %d"), fd); in httpd_close_all_sessions()
140 httpd_sess_delete(hd, fd); in httpd_close_all_sessions()
141 close(fd); in httpd_close_all_sessions()
213 int fd = -1; in httpd_server() local
214 while ((fd = httpd_sess_iterate(hd, fd)) != -1) { in httpd_server()
215 if (FD_ISSET(fd, &read_set) || (httpd_sess_pending(hd, fd))) { in httpd_server()
[all …]
/hal_espressif-2.7.6/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
97 int fd = resp_arg->fd; in send_hello() local
104 httpd_ws_send_frame_async(hd, fd, &ws_pkt); in send_hello()
112 int fd = resp_arg->fd; in send_ping() local
119 httpd_ws_send_frame_async(hd, fd, &ws_pkt); in send_ping()
123 bool client_not_alive_cb(wss_keep_alive_t h, int fd) in client_not_alive_cb() argument
125 ESP_LOGE(TAG, "Client not alive, closing fd %d", fd); in client_not_alive_cb()
126 httpd_sess_trigger_close(wss_keep_alive_get_user_ctx(h), fd); in client_not_alive_cb()
130 bool check_client_alive_cb(wss_keep_alive_t h, int fd) in check_client_alive_cb() argument
132 ESP_LOGD(TAG, "Checking if client (fd=%d) is alive", fd); in check_client_alive_cb()
[all …]
Dkeep_alive.h22 typedef bool (*wss_check_client_alive_cb_t)(wss_keep_alive_t h, int fd);
23 typedef bool (*wss_client_not_alive_cb_t)(wss_keep_alive_t h, int fd);
46 esp_err_t wss_keep_alive_add_client(wss_keep_alive_t h, int fd);
55 esp_err_t wss_keep_alive_remove_client(wss_keep_alive_t h, int fd);
65 esp_err_t wss_keep_alive_client_is_active(wss_keep_alive_t h, int fd);
/hal_espressif-2.7.6/components/esp_http_server/src/util/
Dctrl_sock.c29 int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); in cs_create_ctrl_sock() local
30 if (fd < 0) { in cs_create_ctrl_sock()
40 ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); in cs_create_ctrl_sock()
42 close(fd); in cs_create_ctrl_sock()
45 return fd; in cs_create_ctrl_sock()
48 void cs_free_ctrl_sock(int fd) in cs_free_ctrl_sock() argument
50 close(fd); in cs_free_ctrl_sock()
68 int cs_recv_from_ctrl_sock(int fd, void *data, unsigned int data_len) in cs_recv_from_ctrl_sock() argument
71 ret = recvfrom(fd, data, data_len, 0, NULL, NULL); in cs_recv_from_ctrl_sock()
/hal_espressif-2.7.6/components/newlib/
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 …]
Dsyscalls.c37 ssize_t _write_r_console(struct _reent *r, int fd, const void * data, size_t size) in _write_r_console() argument
40 if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { in _write_r_console()
50 ssize_t _read_r_console(struct _reent *r, int fd, void * data, size_t size) in _read_r_console() argument
53 if (fd == STDIN_FILENO) { in _read_r_console()
72 ssize_t _read_r(struct _reent *r, int fd, void * dst, size_t size)
74 ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size)
87 int _close_r(struct _reent *r, int fd)
89 off_t _lseek_r(struct _reent *r, int fd, off_t size, int mode)
91 int _fcntl_r(struct _reent *r, int fd, int cmd, int arg)
93 int _fstat_r(struct _reent *r, int fd, struct stat * st)
[all …]
/hal_espressif-2.7.6/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-2.7.6/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-2.7.6/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-2.7.6/components/newlib/platform_include/sys/
Dtermios.h234 int tcdrain(int fd);
243 int tcflow(int fd, int action);
252 int tcflush(int fd, int select);
261 int tcgetattr(int fd, struct termios *p);
269 pid_t tcgetsid(int fd);
278 int tcsendbreak(int fd, int duration);
288 int tcsetattr(int fd, int optional_actions, const struct termios *p);
/hal_espressif-2.7.6/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 …]
/hal_espressif-2.7.6/examples/protocols/http_server/file_serving/main/
Dfile_server.c210 FILE *fd = NULL; in download_get_handler() local
241 fd = fopen(filepath, "r"); in download_get_handler()
242 if (!fd) { in download_get_handler()
257 chunksize = fread(chunk, 1, SCRATCH_BUFSIZE, fd); in download_get_handler()
262 fclose(fd); in download_get_handler()
276 fclose(fd); in download_get_handler()
291 FILE *fd = NULL; in upload_post_handler() local
330 fd = fopen(filepath, "w"); in upload_post_handler()
331 if (!fd) { in upload_post_handler()
360 fclose(fd); in upload_post_handler()
[all …]
/hal_espressif-2.7.6/components/esp-tls/
Desp_tls.c130 tls->server_fd.fd = -1; in esp_tls_init()
164 static int esp_tls_tcp_enable_keep_alive(int fd, tls_keep_alive_cfg_t *cfg) in esp_tls_tcp_enable_keep_alive() argument
172 …if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keep_alive_enable, sizeof(keep_alive_enable)) != 0) { in esp_tls_tcp_enable_keep_alive()
176 if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keep_alive_idle, sizeof(keep_alive_idle)) != 0) { in esp_tls_tcp_enable_keep_alive()
180 …if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &keep_alive_interval, sizeof(keep_alive_interval)) … in esp_tls_tcp_enable_keep_alive()
184 … if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &keep_alive_count, sizeof(keep_alive_count)) != 0) { in esp_tls_tcp_enable_keep_alive()
200 int fd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol); in esp_tcp_connect() local
201 if (fd < 0) { in esp_tcp_connect()
232 setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); in esp_tcp_connect()
233 setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)); in esp_tcp_connect()
[all …]

1234