mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	lwip: Route LWIP socket POSIX I/O functions via IDF VFS layer
No more conflicts between LWIP & newlib read(), write(), fcntl(), etc. select() still only works if all of the fds are sockets. Closes https://github.com/espressif/esp-idf/issues/273
This commit is contained in:
		
				
					committed by
					
						
						Angus Gratton
					
				
			
			
				
	
			
			
			
						parent
						
							a320fed3b5
						
					
				
				
					commit
					3ebf7923d3
				
			@@ -37,6 +37,7 @@
 | 
			
		||||
#include "freertos/task.h"
 | 
			
		||||
#include "freertos/queue.h"
 | 
			
		||||
#include "freertos/semphr.h"
 | 
			
		||||
#include "arch/vfs_lwip.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								components/lwip/include/lwip/port/arch/vfs_lwip.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								components/lwip/include/lwip/port/arch/vfs_lwip.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
//     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Internal declarations used to ingreate LWIP port layer
 | 
			
		||||
   to ESP-IDF VFS for POSIX I/O.
 | 
			
		||||
*/
 | 
			
		||||
extern unsigned lwip_socket_offset;
 | 
			
		||||
 | 
			
		||||
void esp_vfs_lwip_sockets_register();
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -34,6 +34,7 @@
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <sys/fcntl.h>
 | 
			
		||||
#include "esp_task.h"
 | 
			
		||||
@@ -687,6 +688,19 @@
 | 
			
		||||
#define ETHARP_TRUST_IP_MAC             CONFIG_LWIP_ETHARP_TRUST_IP_MAC
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * POSIX I/O functions are mapped to LWIP via the VFS layer
 | 
			
		||||
 * (see port/vfs_lwip.c)
 | 
			
		||||
 */
 | 
			
		||||
#define LWIP_POSIX_SOCKETS_IO_NAMES     0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Socket offset is also determined via the VFS layer at
 | 
			
		||||
 * filesystem registration time (see port/vfs_lwip.c)
 | 
			
		||||
 */
 | 
			
		||||
#define LWIP_SOCKET_OFFSET              lwip_socket_offset
 | 
			
		||||
 | 
			
		||||
/* Enable all Espressif-only options */
 | 
			
		||||
 | 
			
		||||
#define ESP_LWIP                        1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user