NAME

xallocubuf - allocate a message

SYNOPSIS

#include <xio/socket.h>

void *xallocubuf (size_t size);

DESCRIPTION

Allocate a message of the specified size to be sent in zero-copy fashion. The content of the message is undefined after allocation and it should be filled in by the user.

RETURN VALUE

On success, xmsg pointer is returned. On error, 0 is returned, and errno is set appropriately.

ERRORS

EINVAL

Supplied allocation size is invalid.

ENOMEM

Not enough memory to allocate the message.

EXAMPLE

void *ubuf = xallocubuf (12);
memcpy (ubuf, "Hello world!", 12);
xsend (s, ubuf);

SEE ALSO

xfreeubuf(3) xsend(3) xio(7)

AUTHORS

Dong Fang <yp.fangdong@gmail.com>
Martin Sustrik <sustrik@250bpm.com>