Ancillary Data data structure to handle various optional data. cmsghdr + cmsg_data set to the msg_control member of msghdr{} for sendmsg() and recvmsg() system calls. |<--------------------------- msg_controllen -------------------------->| | OR | |<--------------------------- msg_controllen ----------------------->| | | |<----- ancillary data object ----->|<----- ancillary data object ----->| |<------ min CMSG_SPACE() --------->|<------ min CMSG_SPACE() --------->| | | | |<---------- cmsg_len ---------->| |<--------- cmsg_len ----------->| | |<--------- CMSG_LEN() --------->| |<-------- CMSG_LEN() ---------->| | | | | | | +-----+-----+-----+--+-----------+--+-----+-----+-----+--+-----------+--+ |cmsg_|cmsg_|cmsg_|XX| |XX|cmsg_|cmsg_|cmsg_|XX| |XX| |len |level|type |XX|cmsg_data[]|XX|len |level|type |XX|cmsg_data[]|XX| +-----+-----+-----+--+-----------+--+-----+-----+-----+--+-----------+--+ ^ | msg_control points here