diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 17:35:04 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 17:35:04 +0000 |
commit | c61e89c0eda126c2c1a4a3983520c35fe30db156 (patch) | |
tree | 1285f8cbde5485f93f8653f31ea0454587dd741e /firmware/include/file.h | |
parent | 684c70bac5f27e8dec49e113563cf6e496da854d (diff) | |
download | rockbox-c61e89c0eda126c2c1a4a3983520c35fe30db156.tar.gz rockbox-c61e89c0eda126c2c1a4a3983520c35fe30db156.zip |
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
Diffstat (limited to 'firmware/include/file.h')
-rw-r--r-- | firmware/include/file.h | 17 |
1 files changed, 13 insertions, 4 deletions
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 @@ | |||
48 | #define O_TRUNC 0x10 | 48 | #define O_TRUNC 0x10 |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) | 51 | #if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) |
52 | #define open(x,y) sim_open(x,y) | 52 | #define open(x,y) sim_open(x,y) |
53 | #define creat(x) sim_creat(x) | 53 | #define creat(x,m) sim_creat(x,m) |
54 | #define remove(x) sim_remove(x) | 54 | #define remove(x) sim_remove(x) |
55 | #define rename(x,y) sim_rename(x,y) | 55 | #define rename(x,y) sim_rename(x,y) |
56 | #define filesize(x) sim_filesize(x) | 56 | #define filesize(x) sim_filesize(x) |
@@ -60,11 +60,12 @@ | |||
60 | #define read(x,y,z) sim_read(x,y,z) | 60 | #define read(x,y,z) sim_read(x,y,z) |
61 | #define write(x,y,z) sim_write(x,y,z) | 61 | #define write(x,y,z) sim_write(x,y,z) |
62 | #define close(x) sim_close(x) | 62 | #define close(x) sim_close(x) |
63 | extern int sim_creat(const char *pathname, mode_t mode); | ||
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | typedef int (*open_func)(const char* pathname, int flags); | 66 | typedef int (*open_func)(const char* pathname, int flags); |
66 | typedef ssize_t (*read_func)(int fd, void *buf, size_t count); | 67 | typedef ssize_t (*read_func)(int fd, void *buf, size_t count); |
67 | typedef int (*creat_func)(const char *pathname); | 68 | typedef int (*creat_func)(const char *pathname, mode_t mode); |
68 | typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); | 69 | typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); |
69 | typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, | 70 | typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, |
70 | int(*_compar)(const void *, const void *)); | 71 | int(*_compar)(const void *, const void *)); |
@@ -74,7 +75,15 @@ extern int close(int fd); | |||
74 | extern int fsync(int fd); | 75 | extern int fsync(int fd); |
75 | extern ssize_t read(int fd, void *buf, size_t count); | 76 | extern ssize_t read(int fd, void *buf, size_t count); |
76 | extern off_t lseek(int fildes, off_t offset, int whence); | 77 | extern off_t lseek(int fildes, off_t offset, int whence); |
77 | extern int creat(const char *pathname); | 78 | extern int file_creat(const char *pathname); |
79 | #ifndef SIMULATOR | ||
80 | /* posix compatibility function */ | ||
81 | static inline int creat(const char *pathname, mode_t mode) | ||
82 | { | ||
83 | (void)mode; | ||
84 | return file_creat(pathname); | ||
85 | } | ||
86 | #endif | ||
78 | extern ssize_t write(int fd, const void *buf, size_t count); | 87 | extern ssize_t write(int fd, const void *buf, size_t count); |
79 | extern int remove(const char* pathname); | 88 | extern int remove(const char* pathname); |
80 | extern int rename(const char* path, const char* newname); | 89 | extern int rename(const char* path, const char* newname); |