diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2011-02-05 04:35:27 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2011-02-05 04:35:27 +0100 |
commit | 61ba39a23786a7ae9694705af1d146c00a319144 (patch) | |
tree | f9ad51bee751f7e878ac3e7ad4d45f993605c37d /libc/src/lseek.c | |
parent | e2d292afdb43cd7d9391128563384e1edd53c52e (diff) |
Getting rid of newlib, starting to implement a libc. Highly experimental, highly untested.
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; +} |