lib: Add msghdr.[ch]
authorVolker Lendecke <vl@samba.org>
Tue, 30 Dec 2014 13:36:46 +0000 (13:36 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 5 Jan 2015 23:33:09 +0000 (00:33 +0100)
commit190554c402f23a9eff1f20670e66f7b94a36b396
tree5cf1fbf421b4f3c92e8a3d1d0eddecbbc11b7d59
parent98598485c3bb10638ee99f4b04768bd2e8683bb1
lib: Add msghdr.[ch]

This is a little set of routines to deal with the ugly fd-passing macros.

This patch is the first step assisting the creation of msghrds for sending fds.
Receiving fd helpers will follow later.

The basic idea behind these routines is that they fill a variable-sized buffer.
They are supposed to be called twice per msghdr preparation. First with a
0-sized NULL output buffer to calculate the required bufsize, and then a second
time filling in the buffer as such.

This does not take care of the old msg_accrights way of passing file
descriptors. CMSG/SCM_RIGHTS is standardized for quite a while now, and I
believe this intreface can be made to also take care of msg_accrights if
needed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/lib/msghdr.c [new file with mode: 0644]
source3/lib/msghdr.h [new file with mode: 0644]
source3/wscript_build