Pointer ptr = posix.getRuntime().getMemoryManager().allocateDirect(totalSize);
int offset = 0;
for (int i = 0; i < dataLengths.length; ++i) {
int eachLen = posix.socketMacros().CMSG_SPACE(dataLengths[i]);
CmsgHdr each = allocateCmsgHdrInternal(posix, ptr.slice(offset, eachLen), eachLen);
cmsgs[i] = each;
offset += eachLen;
}
setControlPointer(ptr);