[libc] remove RT_USING_LIBC

This commit is contained in:
Meco Man
2021-12-26 09:41:24 -05:00
committed by Bernard Xiong
parent 5925abce3e
commit ed09f38012
59 changed files with 178 additions and 190 deletions

View File

@@ -11,6 +11,10 @@
#include <rtthread.h>
#include <LowLevelIOInterface.h>
#include <fcntl.h>
#include <compiler_private.h>
#define DBG_TAG "dlib.syscall.open"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
/*
* The "__open" function opens the file named "filename" as specified
@@ -22,56 +26,58 @@
int __open(const char *filename, int mode)
{
#ifdef DFS_USING_POSIX
int handle;
int open_mode = O_RDONLY;
int handle;
int open_mode = O_RDONLY;
if (mode & _LLIO_CREAT)
{
open_mode |= O_CREAT;
/* Check what we should do with it if it exists. */
if (mode & _LLIO_APPEND)
if (mode & _LLIO_CREAT)
{
/* Append to the existing file. */
open_mode |= O_APPEND;
open_mode |= O_CREAT;
/* Check what we should do with it if it exists. */
if (mode & _LLIO_APPEND)
{
/* Append to the existing file. */
open_mode |= O_APPEND;
}
if (mode & _LLIO_TRUNC)
{
/* Truncate the existsing file. */
open_mode |= O_TRUNC;
}
}
if (mode & _LLIO_TRUNC)
if (mode & _LLIO_TEXT)
{
/* Truncate the existsing file. */
open_mode |= O_TRUNC;
/* we didn't support text mode */
}
}
if (mode & _LLIO_TEXT)
{
/* we didn't support text mode */
}
switch (mode & _LLIO_RDWRMASK)
{
case _LLIO_RDONLY:
break;
switch (mode & _LLIO_RDWRMASK)
{
case _LLIO_RDONLY:
break;
case _LLIO_WRONLY:
open_mode |= O_WRONLY;
break;
case _LLIO_WRONLY:
open_mode |= O_WRONLY;
break;
case _LLIO_RDWR:
/* The file should be opened for both reads and writes. */
open_mode |= O_RDWR;
break;
case _LLIO_RDWR:
/* The file should be opened for both reads and writes. */
open_mode |= O_RDWR;
break;
default:
return _LLIO_ERROR;
}
default:
return _LLIO_ERROR;
}
handle = open(filename, open_mode, 0);
if (handle < 0)
return _LLIO_ERROR;
return handle;
handle = open(filename, open_mode, 0);
if (handle < 0)
{
return _LLIO_ERROR;
}
return handle;
#else
return _LLIO_ERROR;
LOG_W(warning_without_fs);
return _LLIO_ERROR;
#endif /* DFS_USING_POSIX */
}