diff options
Diffstat (limited to 'libc/src/lseek.c')
-rw-r--r-- | libc/src/lseek.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 <fio.h> + +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; +} |