Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19f3ec9

Browse files
committed
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
2 parents fed71ef + 8dd2f8d commit 19f3ec9

File tree

4 files changed

+87
-6
lines changed

4 files changed

+87
-6
lines changed

components/vfs/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
if(CONFIG_USING_ESP_VFS)
22
set(COMPONENT_SRCS "vfs.c"
33
"vfs_uart.c")
4-
set(COMPONENT_ADD_INCLUDEDIRS "include")
4+
else()
5+
set(COMPONENT_SRCDIRS "port")
6+
endif()
57

6-
set(COMPONENT_REQUIRES)
8+
set(COMPONENT_ADD_INCLUDEDIRS "include")
79

8-
register_component()
9-
endif()
10+
set(COMPONENT_REQUIRES)
11+
12+
register_component()

components/vfs/component.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
55

66
ifndef CONFIG_USING_ESP_VFS
7-
COMPONENT_ADD_INCLUDEDIRS :=
8-
COMPONENT_SRCDIRS :=
7+
COMPONENT_SRCDIRS := port
98
endif
109

components/vfs/port/fcntl.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "sdkconfig.h"
16+
17+
#ifndef CONFIG_USING_ESP_VFS
18+
19+
#include <stdarg.h>
20+
#include <fcntl.h>
21+
22+
int fcntl(int fd, int request, ...)
23+
{
24+
int val, ret;
25+
va_list va;
26+
27+
va_start(va, request);
28+
29+
val = va_arg(va, int);
30+
ret = lwip_fcntl(fd, request, val);
31+
32+
va_end(va);
33+
34+
return ret;
35+
}
36+
37+
#endif /* !CONFIG_USING_ESP_VFS */

components/vfs/port/ioctl.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "sdkconfig.h"
16+
17+
#ifndef CONFIG_USING_ESP_VFS
18+
19+
#include <stdarg.h>
20+
#include <lwip/sockets.h>
21+
22+
#undef ioctl
23+
24+
#include <sys/ioctl.h>
25+
26+
int ioctl(int fd, int request, ...)
27+
{
28+
int ret;
29+
void *p;
30+
va_list va;
31+
32+
va_start(va, request);
33+
34+
p = va_arg(va, void *);
35+
ret = lwip_ioctl(fd, request, p);
36+
37+
va_end(va);
38+
39+
return ret;
40+
}
41+
42+
#endif /* !CONFIG_USING_ESP_VFS */

0 commit comments

Comments
 (0)