From e2dcefcb404df39fc38786f4b76e3b94d4f476e1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 25 Oct 2011 13:02:58 +0200 Subject: sandbox: add lseek helper Follow up patches want to be able to seek fd's. Acked-by: Simon Glass Signed-off-by: Mike Frysinger --- arch/sandbox/cpu/os.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arch') diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 093e7dc7ad..f6d0e8457d 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); -- cgit v1.2.1