Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | !!NAME |
2 | PerryLorier | 2 | pread, pwrite - read from or write to a file descriptor at a given offset |
1 | perry | 3 | |
4 | !!SYNOPSIS | ||
2 | PerryLorier | 5 | __#define _XOPEN_SOURCE 500__ |
6 | __#include <unistd.h>__ | ||
1 | perry | 7 | |
2 | PerryLorier | 8 | __ssize_t pread(int__ ''fd''__, void *__''buf''__, size_t__ ''count''__, off_t__ ''offset''__);__ |
1 | perry | 9 | |
2 | PerryLorier | 10 | __ssize_t pwrite(int__ ''fd''__, const void *__''buf''__, size_t__ ''count''__, off_t__ ''offset''__);__ |
1 | perry | 11 | |
12 | !!DESCRIPTION | ||
2 | PerryLorier | 13 | __pread()__ reads up to ''count'' bytes from file descriptor ''fd'' at offset ''offset'' (from the start of the file) into the buffer starting at ''buf''. The file offset is not changed. |
1 | perry | 14 | |
2 | PerryLorier | 15 | __pwrite()__ writes up to ''count'' bytes from the buffer starting at ''buf'' to the file descriptor ''fd'' at offset ''offset''. The file offset is not changed. |
1 | perry | 16 | |
2 | PerryLorier | 17 | The file referenced by ''fd'' must be capable of seeking. |
1 | perry | 18 | |
19 | !!RETURN VALUE | ||
3 | PerryLorier | 20 | On success, the number of bytes read or written is returned (zero indicates that nothing was written, in the case of __pwrite__, or end of file, in the case of __pread__), |
2 | PerryLorier | 21 | or -1 on error, in which case ''errno'' is set to indicate the error. |
1 | perry | 22 | |
23 | !!ERRORS | ||
2 | PerryLorier | 24 | __pread__ can fail and set ''errno'' to any error specified for read(2) or lseek(2). __pwrite__ can fail and set ''errno'' to any error specified for write(2) or lseek(2). |
1 | perry | 25 | |
26 | !!CONFORMING TO | ||
2 | PerryLorier | 27 | Unix98 |
1 | perry | 28 | |
29 | !!HISTORY | ||
2 | PerryLorier | 30 | The __pread__ and __pwrite__ system calls were added to Linux in version 2.1.60; the entries in the i386 system call table were added in 2.1.69. The libc support (including |
31 | emulation on older kernels without the system calls) was added in glibc 2.1. | ||
1 | perry | 32 | |
33 | !!SEE ALSO | ||
2 | PerryLorier | 34 | read(2), write(2), lseek(2) |
4 | RajinikanthSambasivan | 35 | |
36 | __Why __Pread? | ||
37 | The use of the pread()/pwrite() functions is by faster by almost a factor of two than the use of a lseek()/read() or lseek()/write() combination, since only one system call has to be performed, thus saving unecessary user/kernel mode transitions |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 8 times)