include: posix: unistd: Fix prototypes and dependency

For read/write/lseek, use size_t and off_t types, as mandated by
POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html

Also, prototypes of unistd.h functions should not depend on
CONFIG_POSIX_FS, as (many) of them deal with generic I/O, not with
files in filesystem per se.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
Paul Sokolovsky 2018-10-08 18:48:22 +03:00 committed by Anas Nashif
commit 7f9127578b
2 changed files with 7 additions and 7 deletions

View file

@ -13,7 +13,7 @@ extern "C" {
#include "sys/types.h"
#include "sys/stat.h"
#ifdef CONFIG_POSIX_FS
#ifdef CONFIG_POSIX_API
#include <fs.h>
typedef unsigned int mode_t;
@ -21,9 +21,9 @@ typedef unsigned int mode_t;
/* File related operations */
extern int open(const char *name, int flags);
extern int close(int file);
extern ssize_t write(int file, char *buffer, unsigned int count);
extern ssize_t read(int file, char *buffer, unsigned int count);
extern int lseek(int file, int offset, int whence);
extern ssize_t write(int file, const void *buffer, size_t count);
extern ssize_t read(int file, void *buffer, size_t count);
extern off_t lseek(int file, off_t offset, int whence);
/* File System related operations */
extern int rename(const char *old, const char *newp);