Commit 7f912757 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Anas Nashif
Browse files

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: default avatarPaul Sokolovsky <paul.sokolovsky@linaro.org>
parent 92ed7161
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ int close(int fd)
 *
 * See IEEE 1003.1
 */
ssize_t write(int fd, char *buffer, unsigned int count)
ssize_t write(int fd, const void *buffer, size_t count)
{
	ssize_t rc;
	struct fs_file_t *ptr = NULL;
@@ -175,7 +175,7 @@ ssize_t write(int fd, char *buffer, unsigned int count)
 *
 * See IEEE 1003.1
 */
ssize_t read(int fd, char *buffer, unsigned int count)
ssize_t read(int fd, void *buffer, size_t count)
{
	ssize_t rc;
	struct fs_file_t *ptr = NULL;
@@ -199,7 +199,7 @@ ssize_t read(int fd, char *buffer, unsigned int count)
 *
 * See IEEE 1003.1
 */
int lseek(int fd, int offset, int whence)
off_t lseek(int fd, off_t offset, int whence)
{
	int rc;
	struct fs_file_t *ptr = NULL;