summaryrefslogtreecommitdiff
path: root/src/unistd/lseek.c
blob: 0dab2679196e9c840d1f85034ca8a09f39a36139 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);