about summary refs log tree commit diff
path: root/src/unistd/lseek.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd/lseek.c')
-rw-r--r--src/unistd/lseek.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/unistd/lseek.c b/src/unistd/lseek.c
new file mode 100644
index 00000000..0dab2679
--- /dev/null
+++ b/src/unistd/lseek.c
@@ -0,0 +1,16 @@
+#include <unistd.h>
+#include "syscall.h"
+#include "libc.h"
+
+off_t lseek(int fd, off_t offset, int whence)
+{
+	/* optimized away at compiletime */
+	if (sizeof(long) == 8)
+		return syscall3(__NR_lseek, fd, offset, whence);
+	else {
+		off_t result;
+		return syscall5(__NR__llseek, fd, offset>>32, offset, (long)&result, whence) ? -1 : result;
+	}
+}
+
+LFS64(lseek);