diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-10-25 13:02:58 +0200 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2012-03-12 11:03:42 -0400 |
commit | e2dcefcb404df39fc38786f4b76e3b94d4f476e1 (patch) | |
tree | 70c06bebb31006aad7aa0a2d05ab93d314d95f9f /arch/sandbox | |
parent | 4f345d5673bc68122bcc5018a97fda2d8275437d (diff) | |
download | u-boot-imx-e2dcefcb404df39fc38786f4b76e3b94d4f476e1.zip u-boot-imx-e2dcefcb404df39fc38786f4b76e3b94d4f476e1.tar.gz u-boot-imx-e2dcefcb404df39fc38786f4b76e3b94d4f476e1.tar.bz2 |
sandbox: add lseek helper
Follow up patches want to be able to seek fd's.
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/os.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 093e7dc..f6d0e84 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -45,6 +45,19 @@ ssize_t os_write(int fd, const void *buf, size_t count) return write(fd, buf, count); } +off_t os_lseek(int fd, off_t offset, int whence) +{ + if (whence == OS_SEEK_SET) + whence = SEEK_SET; + else if (whence == OS_SEEK_CUR) + whence = SEEK_CUR; + else if (whence == OS_SEEK_END) + whence = SEEK_END; + else + os_exit(1); + return lseek(fd, offset, whence); +} + int os_open(const char *pathname, int flags) { return open(pathname, flags); |