Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / allreadwrite.h / fd_write.3.md

% limb manual
% fd_write(3)
% limb 0.1.0
% 2023-07-24

# NAME

fd_write, fd_writev - safe wrappers for writing files

# SYNOPSIS

    #include <limb/allreadwrite.h>

```pre hl
ssize_t fd_write(int <em>fd</em>, char *<em>dst</em>, size_t <em>dlen</em>)
ssize_t fd_writev(int <em>fd</em>, const struct iovec *<em>v</em>, unsigned <em>n</em>)
```

# DESCRIPTION

The `fd_write`() function is a safe wrapper around [write](3), i.e. it cannot be
interrupted by signals. More precisely, if [write](3) fails with *EINTR* it is
automatically called again until it succeeds or fails with another error.

The `fd_writev`() function is similar, but around [writev](3).

# RETURN VALUE

These functions return the number of bytes written to `fd` on success. Otherwise
they return -1 and set `errno` to indicate the error.

# ERRORS

The `fd_write`() and `fd_writev`() functions may fail and set `errno` for any of
the errors described for [write](3) and [writev](3), respectively, except for
*EINTR*.