6.1.1.10.3. Example: Sending File Descriptor Array
struct msghdr message;
int decriptors [LEN];
char buffer [CMSG_SPACE (sizeof (descriptors))];
// Prepare message header.
message.msg_control = buffer;
message.msg_controllen = sizeof (buffer);
struct cmsghdr *control = CMSG_FIRSTHDR (&message);
// Fill in protocol identifier and protocol specific type.
// Use of SOL_SOCKET instead of AF_UNIX for legacy reasons.
control->cmsg_level = SOL_SOCKET;
control->cmsg_type = SCM_RIGHTS;
control->cmsg_len = CMSG_LEN (sizeof (int) * LEN);
// Fill in protocol specific payload.
memcpy (CMSG_DATA (control), descriptors, sizeof (descriptors));
// Complete message header.
message->msg_controllen = control->cmsg_len;