mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 15:15:15 +08:00
Merge branch 'feature/add_fcntl_function' into 'master'
Add fcntl and modify ioctl See merge request sdk/ESP8266_RTOS_SDK!428
This commit is contained in:
15
components/lwip/include/lwip/sntp/sntp.h
Normal file
15
components/lwip/include/lwip/sntp/sntp.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2018-2019 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 "lwip/app/sntp.h"
|
@ -1 +1,4 @@
|
|||||||
|
#include <sys/socket.h>
|
||||||
|
#undef fcntl
|
||||||
|
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
|
@ -41,7 +41,9 @@ extern "C" {
|
|||||||
#define O_SYNC _FSYNC
|
#define O_SYNC _FSYNC
|
||||||
/* O_NDELAY _FNDELAY set in include/fcntl.h */
|
/* O_NDELAY _FNDELAY set in include/fcntl.h */
|
||||||
/* O_NDELAY _FNBIO set in include/fcntl.h */
|
/* O_NDELAY _FNBIO set in include/fcntl.h */
|
||||||
|
#ifndef O_NONBLOCK
|
||||||
#define O_NONBLOCK _FNONBLOCK
|
#define O_NONBLOCK _FNONBLOCK
|
||||||
|
#endif
|
||||||
#define O_NOCTTY _FNOCTTY
|
#define O_NOCTTY _FNOCTTY
|
||||||
/* For machines which care - */
|
/* For machines which care - */
|
||||||
#if defined (__CYGWIN__)
|
#if defined (__CYGWIN__)
|
||||||
|
Binary file not shown.
Binary file not shown.
7
components/vfs/component.mk
Executable file
7
components/vfs/component.mk
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
# Component Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
COMPONENT_ADD_INCLUDEDIRS := include
|
||||||
|
|
||||||
|
COMPONENT_SRCDIRS := src
|
29
components/vfs/include/sys/ioctl.h
Normal file
29
components/vfs/include/sys/ioctl.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2015-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.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#undef ioctl
|
||||||
|
|
||||||
|
int ioctl(int fd, int request, ...);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
31
components/vfs/src/fcntl.c
Normal file
31
components/vfs/src/fcntl.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2018-2019 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 <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;
|
||||||
|
}
|
33
components/vfs/src/ioctl.c
Normal file
33
components/vfs/src/ioctl.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright 2018-2019 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 <stdarg.h>
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user