diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-18 00:39:57 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-18 00:39:57 +0000 |
commit | e98bad5b386d58a6add0b7db31ea7090cb791b55 (patch) | |
tree | 34d05b75f305da2bba228af448e9de953250136c /uisimulator/x11 | |
parent | 55fc6df87491f20e0776b167cf58e84d49e00efd (diff) | |
download | rockbox-e98bad5b386d58a6add0b7db31ea7090cb791b55.tar.gz rockbox-e98bad5b386d58a6add0b7db31ea7090cb791b55.zip |
Added the filesize() function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3473 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11')
-rw-r--r-- | uisimulator/x11/file.h | 2 | ||||
-rw-r--r-- | uisimulator/x11/io.c | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h index cf77eea4ba..f11f5056c9 100644 --- a/uisimulator/x11/file.h +++ b/uisimulator/x11/file.h | |||
@@ -25,12 +25,14 @@ | |||
25 | 25 | ||
26 | int x11_open(char *name, int opts); | 26 | int x11_open(char *name, int opts); |
27 | int x11_close(int fd); | 27 | int x11_close(int fd); |
28 | int x11_filesize(int fd); | ||
28 | int x11_creat(char *name, int mode); | 29 | int x11_creat(char *name, int mode); |
29 | int x11_remove(char *name); | 30 | int x11_remove(char *name); |
30 | int x11_rename(char *oldpath, char *newpath); | 31 | int x11_rename(char *oldpath, char *newpath); |
31 | 32 | ||
32 | #define open(x,y) x11_open(x,y) | 33 | #define open(x,y) x11_open(x,y) |
33 | #define close(x) x11_close(x) | 34 | #define close(x) x11_close(x) |
35 | #define filesize(x) x11_filesize(x) | ||
34 | #define creat(x,y) x11_creat(x,y) | 36 | #define creat(x,y) x11_creat(x,y) |
35 | #define remove(x) x11_remove(x) | 37 | #define remove(x) x11_remove(x) |
36 | #define rename(x,y) x11_rename(x,y) | 38 | #define rename(x,y) x11_rename(x,y) |
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c index bc9c99fa10..c33a42d636 100644 --- a/uisimulator/x11/io.c +++ b/uisimulator/x11/io.c | |||
@@ -156,6 +156,15 @@ int x11_rename(char *oldpath, char* newpath) | |||
156 | return -1; | 156 | return -1; |
157 | } | 157 | } |
158 | 158 | ||
159 | int x11_filesize(int fd) | ||
160 | { | ||
161 | int old = lseek(fd, 0, SEEK_CUR); | ||
162 | int size = lseek(fd, 0, SEEK_END); | ||
163 | lseek(fd, old, SEEK_SET); | ||
164 | |||
165 | return(size); | ||
166 | } | ||
167 | |||
159 | void fat_size(unsigned int* size, unsigned int* free) | 168 | void fat_size(unsigned int* size, unsigned int* free) |
160 | { | 169 | { |
161 | struct statfs fs; | 170 | struct statfs fs; |