From 61ba39a23786a7ae9694705af1d146c00a319144 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sat, 5 Feb 2011 04:35:27 +0100 Subject: Getting rid of newlib, starting to implement a libc. Highly experimental, highly untested. --- libc/src/lseek.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 libc/src/lseek.c (limited to 'libc/src/lseek.c') diff --git a/libc/src/lseek.c b/libc/src/lseek.c new file mode 100644 index 0000000..bffc81f --- /dev/null +++ b/libc/src/lseek.c @@ -0,0 +1,24 @@ +#include "reent.h" +#include "errno.h" +#include + +off_t lseek(int fd, off_t seek, int wheel) { + off_t r; + + if ((wheel != SEEK_SET) && (wheel != SEEK_CUR) && (wheel != SEEK_END)) { + _impure_ptr->_errno = EINVAL; + return -1; + } + + if (!fio_is_open(fd)) { + _impure_ptr->_errno = EBADF; + return -1; + } + + r = fio_seek(fd, seek, wheel); + + if (r < 0) + _impure_ptr->_errno = EINVAL; + + return r; +} -- cgit v1.2.3