8 __weak_alias(pread
, _pread
)
13 #include <minix/u64.h>
15 ssize_t
pread64(int fd
, void *buffer
, size_t nbytes
, u64_t where
)
20 if (lseek64(fd
, make64(0,0), SEEK_CUR
, &here
) < 0) return(-1);
21 if (lseek64(fd
, where
, SEEK_SET
, NULL
) < 0) return(-1);
22 if ((r
= read(fd
, buffer
, nbytes
)) < 0) {
24 lseek64(fd
, here
, SEEK_SET
, NULL
);
29 if (lseek64(fd
, here
, SEEK_SET
, NULL
) < 0) return(-1);
34 ssize_t
pread(int fd
, void *buffer
, size_t nbytes
, off_t where
)
39 if((here
= lseek(fd
, 0, SEEK_CUR
)) < 0)
42 if(lseek(fd
, where
, SEEK_SET
) < 0)
45 if((r
=read(fd
, buffer
, nbytes
)) < 0) {
47 lseek(fd
, here
, SEEK_SET
);
52 if(lseek(fd
, here
, SEEK_SET
) < 0)