Lines Matching refs:cmsg
102 struct cmsghdr *cmsg; in cras_send_with_fds() local
117 cmsg = CMSG_FIRSTHDR(&msg); in cras_send_with_fds()
118 cmsg->cmsg_level = SOL_SOCKET; in cras_send_with_fds()
119 cmsg->cmsg_type = SCM_RIGHTS; in cras_send_with_fds()
120 cmsg->cmsg_len = CMSG_LEN(sizeof(*fd) * num_fds); in cras_send_with_fds()
121 memcpy(CMSG_DATA(cmsg), fd, sizeof(*fd) * num_fds); in cras_send_with_fds()
133 struct cmsghdr *cmsg; in cras_recv_with_fds() local
157 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; in cras_recv_with_fds()
158 cmsg = CMSG_NXTHDR(&msg, cmsg)) { in cras_recv_with_fds()
159 if (cmsg->cmsg_level == SOL_SOCKET in cras_recv_with_fds()
160 && cmsg->cmsg_type == SCM_RIGHTS) { in cras_recv_with_fds()
161 size_t fd_size = cmsg->cmsg_len - sizeof(*cmsg); in cras_recv_with_fds()
163 memcpy(fd, CMSG_DATA(cmsg), *num_fds * sizeof(*fd)); in cras_recv_with_fds()