io: igt-gpu-tools Reference Manual

## io io — Helpers for file I/O |

## Functions

ssize_t | igt_readn ()
ssize_t | igt_writen ()

## Includes

    #include <igt_io.h>

## Description

This library provides helpers for file I/O

## Functions

### igt_readn ()

    ssize_t
    igt_readn (int fd,
               char *buf,
               size_t len);

Read from fd into provided buffer until the buffer is full or EOF

#### Parameters

fd | the file descriptor |
buf | buffer where the contents will be stored, allocated by the caller |
size | size of the buffer |

#### Returns

-errno on failure or bytes read on success

### igt_writen ()

    ssize_t
    igt_writen (int fd,
                const char *buf,
                size_t len);

This writes `len` bytes from `data` to the sysfs file.

#### Parameters

fd | the file descriptor |
buf | the block with the contents to write |
len | the length to write |

#### Returns

-errno on failure or bytes written on success