From ea49b5b3f435bce0a301111fad0738efb0b39e0d Mon Sep 17 00:00:00 2001 From: Pixel Date: Sat, 29 Jan 2011 18:34:54 -0800 Subject: Adding some romfs support. --- os/src/lseek.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'os/src/lseek.c') 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 #include +#include +#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; } -- cgit v1.2.3