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