mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-03 19:49:09 +08:00
feat(vfs): Add fcntl and modify ioctl
This commit is contained in:
@ -1 +1,4 @@
|
||||
#include <sys/socket.h>
|
||||
#undef fcntl
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
|
@ -41,7 +41,9 @@ extern "C" {
|
||||
#define O_SYNC _FSYNC
|
||||
/* O_NDELAY _FNDELAY set in include/fcntl.h */
|
||||
/* O_NDELAY _FNBIO set in include/fcntl.h */
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK _FNONBLOCK
|
||||
#endif
|
||||
#define O_NOCTTY _FNOCTTY
|
||||
/* For machines which care - */
|
||||
#if defined (__CYGWIN__)
|
||||
|
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;
|
||||
}
|
@ -17,13 +17,14 @@
|
||||
|
||||
int ioctl(int fd, int request, ...)
|
||||
{
|
||||
int val, ret;
|
||||
int ret;
|
||||
void *p;
|
||||
va_list va;
|
||||
|
||||
va_start(va, request);
|
||||
|
||||
val = va_arg(va, int);
|
||||
ret = lwip_fcntl(fd, request, val);
|
||||
p = va_arg(va, void *);
|
||||
ret = lwip_ioctl(fd, request, p);
|
||||
|
||||
va_end(va);
|
||||
|
||||
|
Reference in New Issue
Block a user