Lines Matching refs:dsock_idx
677 static void ctrl_data_close(int dsock_idx) { in ctrl_data_close() argument
681 if (epoll_ctl(epollfd, EPOLL_CTL_DEL, data_sock[dsock_idx].sock, &epev) == -1) { in ctrl_data_close()
687 close(data_sock[dsock_idx].sock); in ctrl_data_close()
688 data_sock[dsock_idx].sock = -1; in ctrl_data_close()
691 remove_claims(data_sock[dsock_idx].pid); in ctrl_data_close()
694 static ssize_t ctrl_data_read(int dsock_idx, char* buf, size_t bufsz, struct ucred* sender_cred) { in ctrl_data_read() argument
701 ret = TEMP_FAILURE_RETRY(recvmsg(data_sock[dsock_idx].sock, &hdr, 0)); in ctrl_data_read()
724 ctrl_data_close(dsock_idx); in ctrl_data_read()
731 data_sock[dsock_idx].pid = cred->pid; in ctrl_data_read()
736 static int ctrl_data_write(int dsock_idx, char* buf, size_t bufsz) { in ctrl_data_write() argument
739 ret = TEMP_FAILURE_RETRY(write(data_sock[dsock_idx].sock, buf, bufsz)); in ctrl_data_write()
1222 static void cmd_subscribe(int dsock_idx, LMKD_CTRL_PACKET packet) { in cmd_subscribe() argument
1226 data_sock[dsock_idx].async_event_mask |= 1 << params.evt_type; in cmd_subscribe()
1365 static void ctrl_command_handler(int dsock_idx) { in ctrl_command_handler() argument
1375 len = ctrl_data_read(dsock_idx, (char *)packet, CTRL_PACKET_MAX_SIZE, &cred); in ctrl_command_handler()
1417 if (ctrl_data_write(dsock_idx, (char *)packet, len) != len) in ctrl_command_handler()
1423 cmd_subscribe(dsock_idx, packet); in ctrl_command_handler()
1441 if (ctrl_data_write(dsock_idx, (char *)packet, len) != len) { in ctrl_command_handler()