limb 0.2.0

2024-01-09

siov_deal(3)
limb manual
siov_deal(3)

NAME

siov_deal - copy data from an array of vectors into another

SYNOPSIS

#include <limb/siovec.h>
size_t siov_deal(const struct iovec *vdst, unsigned ndst, const struct iovec *vsce, unsigned nsce)

DESCRIPTION

The siov_deal() function copies the data from the array vsce of nsce vectors into the memory pointed by the array vdst of ndst vectors.

You can think of it as a memcpy(3) for vectors.

It is similar to siov_scatter(3) only copying data from another array of vectors instead of a byte array.

Note

The function only copies data from one location in memory to another, as described by the two array of vectors. The arrays themselves are not modified, which means that if the vdst array represents a larger space than vsce does, the content of the data in vdst after the length of data copied (from vsce) is left unchanged, as is the array itself.

In other words, the length of data in vdst (i.e. as returned by siov_len(vdst, ndst)) does not change upon calling this function, regardless of how much data is actually copied.

RETURN VALUE

The siov_deal() function returns the amount of data copied, which may be less than what siov_len(vsce, nsce) would return, if there wasn't enough space in the memory represented by the vdst array of ndst vectors, or less than what siov_len(vdst, ndst) would return, as noted above.

SEE ALSO

siov_scatter(3), siov_gather(3)

limb 0.1.0
2023-07-24
siov_deal(3)