feat(vfs): Add fcntl and modify ioctl

This commit is contained in:
Dong Heng
2018-08-24 14:19:51 +08:00
parent e2288f9f93
commit f98c6efeba
4 changed files with 40 additions and 3 deletions

View File

@ -1 +1,4 @@
#include <sys/socket.h>
#undef fcntl
#include <sys/fcntl.h>

View File

@ -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__)

View 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;
}

View File

@ -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);