1 /* $NetBSD: pread.c,v 1.1.1.1 2013/03/23 15:49:15 christos Exp $ */ 2 3 #include "file.h" 4 #ifndef lint 5 #if 0 6 FILE_RCSID("@(#)$File: pread.c,v 1.1 2013/02/18 15:40:59 christos Exp $") 7 #else 8 __RCSID("$NetBSD: pread.c,v 1.1.1.1 2013/03/23 15:49:15 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, ssize_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