next up previous contents index
Next: 5.5 oskit_netio: Network packet Up: 5.4 oskit_bufio: Buffer-based I/O Previous: 5.4.4 unwire: Unwire a

5.4.5 copy: Create a copy of the specified portion of this buffer

 

SYNOPSIS

#include <oskit/io/bufio.h>

OSKIT_COMDECL copy(oskit_bufio_t *io, oskit_off_t offset, oskit_size_t amount, [out] oskit_bufio_t **out_io);

DESCRIPTION

This method attempts to create a logical copy of a portion of this buffer object (possibly the whole buffer), returning a new oskit_bufio object representing the copy. As with the map and wire methods, this method should only be implemented by an object if it can be done more efficiently than a simple ``brute-force'' copy using read. For example, in virtual memory environments, the object may be able to use copy-on-write optimizations. Similarly, if the buffer's contents are stored in special memory not efficiently accessible to the processor, such as memory on a video or coprocessor board, this method could use on-board hardware to perform a much faster copy.

PARAMETERS

io
The object whose contents are to be copied.
offset
The offset into the buffer of the region to be copied.
size
The size of the region to be copied.
out_io
On success, this parameter holds the bufio object representing the newly created copy of the buffer's contents.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.



University of Utah Flux Research Group