cctools
|
Perform complete I/O operations, retrying through failures and signals. More...
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
Functions | |
ssize_t | full_read (int fd, void *buf, size_t count) |
Read the next bytes from a file descriptor. More... | |
ssize_t | full_write (int fd, const void *buf, size_t count) |
Write the next bytes to a file descriptor. More... | |
ssize_t | full_pread (int fd, void *buf, size_t count, off_t offset) |
Read arbitrary bytes from a file descriptor. More... | |
ssize_t | full_pwrite (int fd, const void *buf, size_t count, off_t offset) |
Write arbitrary bytes to a file descriptor. More... | |
ssize_t | full_pread64 (int fd, void *buf, size_t count, int64_t offset) |
Read arbitrary bytes from a file descriptor. More... | |
ssize_t | full_pwrite64 (int fd, const void *buf, size_t count, int64_t offset) |
Write arbitrary bytes to a file descriptor. More... | |
ssize_t | full_fread (FILE *file, void *buf, size_t count) |
Read the next bytes from a file stream. More... | |
ssize_t | full_fwrite (FILE *file, const void *buf, size_t count) |
Write the next bytes to a file stream. More... | |
Perform complete I/O operations, retrying through failures and signals.
A subtle property of Unix is that the kernel may choose to leave an I/O operation incomplete, returning a smaller number of bytes than you requested, or simply giving up with the error EINTR, if it is simply more "convenient". The full_io routines look lik normal Unix read and write operations, but silently retry through temporary failures. Of course, these routines may still fail for more permanent reasons such as end of file or disk full.
ssize_t full_read | ( | int | fd, |
void * | buf, | ||
size_t | count | ||
) |
Read the next bytes from a file descriptor.
fd | File descriptor. |
buf | Pointer to buffer. |
count | The number of bytes to read. |
ssize_t full_write | ( | int | fd, |
const void * | buf, | ||
size_t | count | ||
) |
Write the next bytes to a file descriptor.
fd | File descriptor. |
buf | Pointer to buffer. |
count | The number of bytes to write. |
ssize_t full_pread | ( | int | fd, |
void * | buf, | ||
size_t | count, | ||
off_t | offset | ||
) |
Read arbitrary bytes from a file descriptor.
fd | File descriptor. |
buf | Pointer to buffer. |
count | The number of bytes to read. |
offset | The offset in the file to begin from. |
ssize_t full_pwrite | ( | int | fd, |
const void * | buf, | ||
size_t | count, | ||
off_t | offset | ||
) |
Write arbitrary bytes to a file descriptor.
fd | File descriptor. |
buf | Pointer to buffer. |
count | The number of bytes to write. |
offset | The offset in the file to begin from. |
ssize_t full_pread64 | ( | int | fd, |
void * | buf, | ||
size_t | count, | ||
int64_t | offset | ||
) |
Read arbitrary bytes from a file descriptor.
(64 bit)
fd | File descriptor. |
buf | Pointer to buffer. |
count | The number of bytes to read. |
offset | The offset in the file to begin from. |
ssize_t full_pwrite64 | ( | int | fd, |
const void * | buf, | ||
size_t | count, | ||
int64_t | offset | ||
) |
Write arbitrary bytes to a file descriptor.
(64 bit)
fd | File descriptor. |
buf | Pointer to buffer. |
count | The number of bytes to write. |
offset | The offset in the file to begin from. |
ssize_t full_fread | ( | FILE * | file, |
void * | buf, | ||
size_t | count | ||
) |
Read the next bytes from a file stream.
file | Standard file stream. |
buf | Pointer to buffer. |
count | The number of bytes to read. |
ssize_t full_fwrite | ( | FILE * | file, |
const void * | buf, | ||
size_t | count | ||
) |
Write the next bytes to a file stream.
file | Standard file stream. |
buf | Pointer to buffer. |
count | The number of bytes to write. |