xref: /netbsd-src/external/bsd/file/dist/src/pread.c (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1 /*	$NetBSD: pread.c,v 1.1.1.2 2013/12/01 19:28:16 christos Exp $	*/
2 
3 #include "file.h"
4 #ifndef lint
5 #if 0
6 FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
7 #else
8 __RCSID("$NetBSD: pread.c,v 1.1.1.2 2013/12/01 19:28:16 christos Exp $");
9 #endif
10 #endif  /* lint */
11 #include <fcntl.h>
12 #include <unistd.h>
13 
14 ssize_t
15 pread(int fd, void *buf, size_t len, off_t off) {
16 	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
17 		return -1;
18 
19 	return read(fd, buf, len);
20 }
21