lib: posix: Add Posix Style File System API support

Add IEEE 1003.1 Posix Style file system API support.
These API's will internally use corresponding Zephyr
File System API's.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
Ramakrishna Pallala 2018-05-03 17:17:22 +05:30 committed by Anas Nashif
commit eb0aaca64d
9 changed files with 550 additions and 19 deletions

View file

@ -75,6 +75,7 @@ void __stdin_hook_install(unsigned char (*hook)(void))
_stdin_hook = hook;
}
#ifndef CONFIG_POSIX_FS
int _read(int fd, char *buf, int nbytes)
{
int i = 0;
@ -104,6 +105,28 @@ int _write(int fd, char *buf, int nbytes)
}
FUNC_ALIAS(_write, write, int);
int _open(const char *name, int mode)
{
return -1;
}
FUNC_ALIAS(_open, open, int);
int _close(int file)
{
return -1;
}
FUNC_ALIAS(_close, close, int);
int _lseek(int file, int ptr, int dir)
{
return 0;
}
FUNC_ALIAS(_lseek, lseek, int);
#else
extern ssize_t write(int file, char *buffer, unsigned int count);
#define _write write
#endif
int _isatty(int file)
{
return 1;
@ -137,24 +160,6 @@ void _exit(int status)
}
}
int _open(const char *name, int mode)
{
return -1;
}
FUNC_ALIAS(_open, open, int);
int _close(int file)
{
return -1;
}
FUNC_ALIAS(_close, close, int);
int _lseek(int file, int ptr, int dir)
{
return 0;
}
FUNC_ALIAS(_lseek, lseek, int);
void *_sbrk(int count)
{
void *ptr = heap_base + heap_sz;