From c61e89c0eda126c2c1a4a3983520c35fe30db156 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 6 May 2010 17:35:04 +0000 Subject: Make creat() posix compliant API-wise. Shouldn't affect the core as it's wrapped via a static inline. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25843 a1c6a512-1295-4272-9138-f99709370657 --- firmware/include/file.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'firmware/include') diff --git a/firmware/include/file.h b/firmware/include/file.h index 9a9548f8f6..b60c744549 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -48,9 +48,9 @@ #define O_TRUNC 0x10 #endif -#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) +#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) #define open(x,y) sim_open(x,y) -#define creat(x) sim_creat(x) +#define creat(x,m) sim_creat(x,m) #define remove(x) sim_remove(x) #define rename(x,y) sim_rename(x,y) #define filesize(x) sim_filesize(x) @@ -60,11 +60,12 @@ #define read(x,y,z) sim_read(x,y,z) #define write(x,y,z) sim_write(x,y,z) #define close(x) sim_close(x) +extern int sim_creat(const char *pathname, mode_t mode); #endif typedef int (*open_func)(const char* pathname, int flags); typedef ssize_t (*read_func)(int fd, void *buf, size_t count); -typedef int (*creat_func)(const char *pathname); +typedef int (*creat_func)(const char *pathname, mode_t mode); typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, int(*_compar)(const void *, const void *)); @@ -74,7 +75,15 @@ extern int close(int fd); extern int fsync(int fd); extern ssize_t read(int fd, void *buf, size_t count); extern off_t lseek(int fildes, off_t offset, int whence); -extern int creat(const char *pathname); +extern int file_creat(const char *pathname); +#ifndef SIMULATOR +/* posix compatibility function */ +static inline int creat(const char *pathname, mode_t mode) +{ + (void)mode; + return file_creat(pathname); +} +#endif extern ssize_t write(int fd, const void *buf, size_t count); extern int remove(const char* pathname); extern int rename(const char* path, const char* newname); -- cgit v1.2.3