xref: /haiku/src/system/libroot/posix/unistd/lseek.c (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2 ** Copyright 2001, Manuel J. Petit. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 
6 #include <unistd.h>
7 
8 #include <errno.h>
9 
10 #include <errno_private.h>
11 #include <syscalls.h>
12 
13 
14 off_t
15 lseek(int fd, off_t pos, int whence)
16 {
17 	off_t result = _kern_seek(fd, pos, whence);
18 	if (result < 0) {
19 		__set_errno(result);
20 		return -1;
21 	}
22 	return result;
23 }
24