3 <<pread64>>---read a large file from specified position
10 ssize_t pread64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>);
14 ssize_t pread64(<[fd]>, <[buf]>, <[n]>, <[off]>)
21 The <<pread64>> function is similar to <<pread>>. The only difference is
22 that it operates on large files and so takes a 64-bit offset. Like <<pread>>>,
23 the file position is unchanged by the function (i.e. the file position
24 is the same before and after a call to <<pread>>).
27 <<pread64>> returns the number of bytes read or <<-1>> if failure occurred.
30 <<pread64>> is an EL/IX extension.
32 Supporting OS subroutine required: <<read>>, <<lseek64>>.
40 _DEFUN (pread64, (fd, buf, n, off),
47 _READ_WRITE_RETURN_TYPE num_read;
49 if ((cur_pos = lseek64 (fd, 0, SEEK_CUR)) == (loff_t)-1)
52 if (lseek64 (fd, off, SEEK_SET) == (loff_t)-1)
55 num_read = read (fd, buf, n);
57 if (lseek64 (fd, cur_pos, SEEK_SET) == (loff_t)-1)
60 return (ssize_t)num_read;