full_io.h File Reference

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.
ssize_t | full_write (int fd, const void *buf, size_t count)
| Write the next bytes to a file descriptor.
ssize_t | full_pread (int fd, void *buf, size_t count, off_t offset)
| Read arbitrary bytes from a file descriptor.
ssize_t | full_pwrite (int fd, const void *buf, size_t count, off_t offset)
| Write arbitrary bytes to a file descriptor.
ssize_t | full_pread64 (int fd, void *buf, size_t count, int64_t offset)
| Read arbitrary bytes from a file descriptor.
ssize_t | full_pwrite64 (int fd, const void *buf, size_t count, int64_t offset)
| Write arbitrary bytes to a file descriptor.
ssize_t | full_fread (FILE *file, void *buf, size_t count)
| Read the next bytes from a file stream.
ssize_t | full_fwrite (FILE *file, const void *buf, size_t count)
| Write the next bytes to a file stream.

## Detailed Description

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.

## Function Documentation

## full_read()

ssize_t full_read | ( | int | fd,
|  | void * | buf,
|  | size_t | count )

Read the next bytes from a file descriptor.

Parameters

  fd | File descriptor.
  buf | Pointer to buffer.
  count | The number of bytes to read.

Returns
  The number of bytes actually read, or less than zero indicating error.

## full_write()

ssize_t full_write | ( | int | fd,
|  | const void * | buf,
|  | size_t | count )

Write the next bytes to a file descriptor.

Parameters

  fd | File descriptor.
  buf | Pointer to buffer.
  count | The number of bytes to write.

Returns
  The number of bytes actually written, or less than zero indicating error.

## full_pread()

ssize_t full_pread | ( | int | fd,
|  | void * | buf,
|  | size_t | count,
|  | off_t | offset )

Read arbitrary bytes from a file descriptor.

Parameters

  fd | File descriptor.
  buf | Pointer to buffer.
  count | The number of bytes to read.
  offset | The offset in the file to begin from.

Returns
  The number of bytes actually read, or less than zero indicating error.

## full_pwrite()

ssize_t full_pwrite | ( | int | fd,
|  | const void * | buf,
|  | size_t | count,
|  | off_t | offset )

Write arbitrary bytes to a file descriptor.

Parameters

  fd | File descriptor.
  buf | Pointer to buffer.
  count | The number of bytes to write.
  offset | The offset in the file to begin from.

Returns
  The number of bytes actually written, or less than zero indicating error.

## full_pread64()

ssize_t full_pread64 | ( | int | fd,
|  | void * | buf,
|  | size_t | count,
|  | int64_t | offset )

Read arbitrary bytes from a file descriptor.

(64 bit)

Parameters

  fd | File descriptor.
  buf | Pointer to buffer.
  count | The number of bytes to read.
  offset | The offset in the file to begin from.

Returns
  The number of bytes actually read, or less than zero indicating error.

## full_pwrite64()

ssize_t full_pwrite64 | ( | int | fd,
|  | const void * | buf,
|  | size_t | count,
|  | int64_t | offset )

Write arbitrary bytes to a file descriptor.

(64 bit)

Parameters

  fd | File descriptor.
  buf | Pointer to buffer.
  count | The number of bytes to write.
  offset | The offset in the file to begin from.

Returns
  The number of bytes actually written, or less than zero indicating error.

## full_fread()

ssize_t full_fread | ( | FILE * | file,
|  | void * | buf,
|  | size_t | count )

Read the next bytes from a file stream.

Parameters

  file | Standard file stream.
  buf | Pointer to buffer.
  count | The number of bytes to read.

Returns
  The number of bytes actually read, or less than zero indicating error.

## full_fwrite()

ssize_t full_fwrite | ( | FILE * | file,
|  | const void * | buf,
|  | size_t | count )

Write the next bytes to a file stream.

Parameters

  file | Standard file stream.
  buf | Pointer to buffer.
  count | The number of bytes to write.

Returns
  The number of bytes actually written, or less than zero indicating error.