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 | |
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')
-rw-r--r-- | firmware/common/file.c | 2 | ||||
-rw-r--r-- | firmware/drivers/tuner/lv24020lp.c | 2 | ||||
-rw-r--r-- | firmware/font.c | 2 | ||||
-rw-r--r-- | firmware/include/file.h | 17 | ||||
-rw-r--r-- | firmware/screendump.c | 4 |
5 files changed, 18 insertions, 9 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 7ec712a244..05612cd75e 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -55,7 +55,7 @@ static struct filedesc openfiles[MAX_OPEN_FILES]; | |||
55 | 55 | ||
56 | static int flush_cache(int fd); | 56 | static int flush_cache(int fd); |
57 | 57 | ||
58 | int creat(const char *pathname) | 58 | int file_creat(const char *pathname) |
59 | { | 59 | { |
60 | return open(pathname, O_WRONLY|O_CREAT|O_TRUNC); | 60 | return open(pathname, O_WRONLY|O_CREAT|O_TRUNC); |
61 | } | 61 | } |
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c index d70eef8eea..5f23338eee 100644 --- a/firmware/drivers/tuner/lv24020lp.c +++ b/firmware/drivers/tuner/lv24020lp.c | |||
@@ -46,7 +46,7 @@ static struct mutex tuner_mtx; | |||
46 | static int fd_log = -1; | 46 | static int fd_log = -1; |
47 | 47 | ||
48 | #define TUNER_LOG_OPEN() if (fd_log < 0) \ | 48 | #define TUNER_LOG_OPEN() if (fd_log < 0) \ |
49 | fd_log = creat("/tuner_dump.txt") | 49 | fd_log = creat("/tuner_dump.txt", 0666) |
50 | /* syncing required because close() is never called */ | 50 | /* syncing required because close() is never called */ |
51 | #define TUNER_LOG_SYNC() fsync(fd_log) | 51 | #define TUNER_LOG_SYNC() fsync(fd_log) |
52 | #define TUNER_LOG(s...) fdprintf(fd_log, s) | 52 | #define TUNER_LOG(s...) fdprintf(fd_log, s) |
diff --git a/firmware/font.c b/firmware/font.c index 804d3895b1..6877d7e1ff 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -609,7 +609,7 @@ void glyph_cache_save(struct font* pf) | |||
609 | #ifdef WPSEDITOR | 609 | #ifdef WPSEDITOR |
610 | cache_fd = open(GLYPH_CACHE_FILE, O_WRONLY|O_CREAT|O_TRUNC); | 610 | cache_fd = open(GLYPH_CACHE_FILE, O_WRONLY|O_CREAT|O_TRUNC); |
611 | #else | 611 | #else |
612 | cache_fd = creat(GLYPH_CACHE_FILE); | 612 | cache_fd = creat(GLYPH_CACHE_FILE, 0666); |
613 | #endif | 613 | #endif |
614 | if (cache_fd < 0) return; | 614 | if (cache_fd < 0) return; |
615 | 615 | ||
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); |
diff --git a/firmware/screendump.c b/firmware/screendump.c index e84afb9511..1876df8ac0 100644 --- a/firmware/screendump.c +++ b/firmware/screendump.c | |||
@@ -140,7 +140,7 @@ void screen_dump(void) | |||
140 | IF_CNFN_NUM_(, NULL)); | 140 | IF_CNFN_NUM_(, NULL)); |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | fd = creat(filename); | 143 | fd = creat(filename, 0666); |
144 | if (fd < 0) | 144 | if (fd < 0) |
145 | return; | 145 | return; |
146 | 146 | ||
@@ -317,7 +317,7 @@ void remote_screen_dump(void) | |||
317 | IF_CNFN_NUM_(, NULL)); | 317 | IF_CNFN_NUM_(, NULL)); |
318 | #endif | 318 | #endif |
319 | 319 | ||
320 | fd = creat(filename); | 320 | fd = creat(filename, 0666); |
321 | if (fd < 0) | 321 | if (fd < 0) |
322 | return; | 322 | return; |
323 | 323 | ||