// OSMetaClassDefineReservedUsed(IOAudioControlUserClient, 0); void IOAudioControlUserClient::sendChangeNotification(UInt32 notificationType) { if (notificationMessage) { kern_return_t kr; notificationMessage->type = notificationType; kr = mach_msg_send_from_kernel(¬ificationMessage->messageHeader, notificationMessage->messageHeader.msgh_size); if ((kr != MACH_MSG_SUCCESS) && (kr != MACH_SEND_TIMED_OUT)) { IOLog("IOAudioControlUserClient: sendRangeChangeNotification() failed - msg_send returned: %d\n", kr); } } }
static void host_notify_all( host_flavor_t notify_type, mach_msg_header_t *msg, mach_msg_size_t msg_size) { queue_t notify_queue = &host_notify_queue[notify_type]; mutex_lock(&host_notify_lock); if (!queue_empty(notify_queue)) { queue_head_t send_queue; host_notify_t entry; send_queue = *notify_queue; queue_init(notify_queue); send_queue.next->prev = &send_queue; send_queue.prev->next = &send_queue; msg->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE, 0); msg->msgh_local_port = MACH_PORT_NULL; msg->msgh_id = host_notify_replyid[notify_type]; msg->msgh_reserved = 0; while ((entry = (host_notify_t)dequeue(&send_queue)) != NULL) { ipc_port_t port; port = entry->port; assert(port != IP_NULL); ip_lock(port); assert(ip_kotype(port) == IKOT_HOST_NOTIFY); assert(port->ip_kobject == (ipc_kobject_t)entry); ipc_kobject_set_atomically(port, IKO_NULL, IKOT_NONE); ip_unlock(port); mutex_unlock(&host_notify_lock); zfree(host_notify_zone, (vm_offset_t)entry); msg->msgh_remote_port = port; (void) mach_msg_send_from_kernel(msg, msg_size); mutex_lock(&host_notify_lock); } } mutex_unlock(&host_notify_lock); }