summaryrefslogtreecommitdiff
path: root/os/src/lseek.c
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-01-29 18:34:54 -0800
committerPixel <pixel@nobis-crew.org>2011-01-29 18:34:54 -0800
commitea49b5b3f435bce0a301111fad0738efb0b39e0d (patch)
treeaa595cc250514f5225f624d2e691e144c740c567 /os/src/lseek.c
parent7182d70210f4880e66ae9e5a5531bddd3a90737b (diff)
Adding some romfs support.
Diffstat (limited to 'os/src/lseek.c')
-rw-r--r--os/src/lseek.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/os/src/lseek.c b/os/src/lseek.c
index fdd0b94..1cb0234 100644
--- a/os/src/lseek.c
+++ b/os/src/lseek.c
@@ -1,7 +1,25 @@
#include <reent.h>
#include <osdebug.h>
+#include <errno.h>
+#include "fio.h"
_off_t _lseek_r(struct _reent * reent, int fd, _off_t seek, int wheel) {
- DBGOUT("_lseek_r(%p, %d, %d, %d)\r\n", reent, fd, (int) seek, wheel);
- return 0;
+ off_t r;
+
+ if ((wheel != SEEK_SET) && (wheel != SEEK_CUR) && (wheel != SEEK_END)) {
+ reent->_errno = EINVAL;
+ return -1;
+ }
+
+ if (!fio_is_open(fd)) {
+ reent->_errno = EBADF;
+ return -1;
+ }
+
+ r = fio_seek(fd, seek, wheel);
+
+ if (r < 0)
+ reent->_errno = EINVAL;
+
+ return r;
}