mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-06 13:59:16 +08:00
Merge branch 'bugfix/fix_vfs_header_file_dependence' into 'master'
Add standard "fcntl" and "ioctl" for application if VFS is not enable See merge request sdk/ESP8266_RTOS_SDK!905
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
if(CONFIG_USING_ESP_VFS)
|
||||
set(COMPONENT_SRCS "vfs.c"
|
||||
"vfs_uart.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
||||
|
||||
set(COMPONENT_REQUIRES)
|
||||
|
||||
register_component()
|
||||
else()
|
||||
set(COMPONENT_SRCDIRS "port")
|
||||
endif()
|
||||
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
||||
|
||||
set(COMPONENT_REQUIRES)
|
||||
|
||||
register_component()
|
||||
|
@ -4,7 +4,6 @@
|
||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||
|
||||
ifndef CONFIG_USING_ESP_VFS
|
||||
COMPONENT_ADD_INCLUDEDIRS :=
|
||||
COMPONENT_SRCDIRS :=
|
||||
COMPONENT_SRCDIRS := port
|
||||
endif
|
||||
|
||||
|
37
components/vfs/port/fcntl.c
Normal file
37
components/vfs/port/fcntl.c
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright 2019-2020 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.
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifndef CONFIG_USING_ESP_VFS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int fcntl(int fd, int request, ...)
|
||||
{
|
||||
int val, ret;
|
||||
va_list va;
|
||||
|
||||
va_start(va, request);
|
||||
|
||||
val = va_arg(va, int);
|
||||
ret = lwip_fcntl(fd, request, val);
|
||||
|
||||
va_end(va);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_USING_ESP_VFS */
|
42
components/vfs/port/ioctl.c
Normal file
42
components/vfs/port/ioctl.c
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2019-2020 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.
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifndef CONFIG_USING_ESP_VFS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <lwip/sockets.h>
|
||||
|
||||
#undef ioctl
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
int ioctl(int fd, int request, ...)
|
||||
{
|
||||
int ret;
|
||||
void *p;
|
||||
va_list va;
|
||||
|
||||
va_start(va, request);
|
||||
|
||||
p = va_arg(va, void *);
|
||||
ret = lwip_ioctl(fd, request, p);
|
||||
|
||||
va_end(va);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_USING_ESP_VFS */
|
Reference in New Issue
Block a user