[libc] fix the fcntl issue in newlib

This commit is contained in:
Bernard Xiong
2018-02-07 19:49:31 +08:00
parent 64a20c0f15
commit 4e41b0573b
4 changed files with 52 additions and 30 deletions

View File

@@ -1,6 +1,27 @@
/*
* fcntl.h file in libc
*/
* File : libc_fcntl.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2018-02-07 Bernard Add O_DIRECTORY definition in NEWLIB mode.
*/
#ifndef LIBC_FCNTL_H__
#define LIBC_FCNTL_H__
@@ -8,11 +29,10 @@
#include <fcntl.h>
#ifndef O_NONBLOCK
#define O_NONBLOCK 04000
#define O_NONBLOCK 0x4000
#endif
#if defined(_WIN32)
#define O_DIRECTORY 0200000
#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR)
#endif
@@ -23,6 +43,10 @@
#define F_SETFL 4
#endif
#ifndef O_DIRECTORY
#define O_DIRECTORY 0x200000
#endif
#else
#define O_RDONLY 00
#define O_WRONLY 01
@@ -77,4 +101,3 @@
#endif
#endif