xref: /freebsd/contrib/file/src/pread.c (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
1 #include "file.h"
2 #ifndef lint
3 FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
4 #endif  /* lint */
5 #include <fcntl.h>
6 #include <unistd.h>
7 
8 ssize_t
9 pread(int fd, void *buf, size_t len, off_t off) {
10 	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
11 		return -1;
12 
13 	return read(fd, buf, len);
14 }
15