kern_return_t wait_queue_sub_init( wait_queue_set_t wqset, int policy) { return wait_queue_set_init(wqset, policy); }
/* * Routine: ipc_mqueue_init * Purpose: * Initialize a newly-allocated message queue. */ void ipc_mqueue_init( ipc_mqueue_t mqueue, boolean_t is_set) { if (is_set) { wait_queue_set_init(&mqueue->imq_set_queue, SYNC_POLICY_FIFO|SYNC_POLICY_PREPOST); } else { wait_queue_init(&mqueue->imq_wait_queue, SYNC_POLICY_FIFO); ipc_kmsg_queue_init(&mqueue->imq_messages); mqueue->imq_seqno = 0; mqueue->imq_msgcount = 0; mqueue->imq_qlimit = MACH_PORT_QLIMIT_DEFAULT; mqueue->imq_fullwaiters = FALSE; } }
/* * Routine: wait_queue_set_alloc * Purpose: * Allocate and initialize a wait queue set for * use outside of the mach part of the kernel. * Conditions: * May block. * Returns: * The allocated and initialized wait queue set * WAIT_QUEUE_SET_NULL if there is a resource shortage */ wait_queue_set_t wait_queue_set_alloc( int policy) { wait_queue_set_t wq_set; wq_set = (wait_queue_set_t) zalloc(_wait_queue_set_zone); if (wq_set != WAIT_QUEUE_SET_NULL) { kern_return_t ret; ret = wait_queue_set_init(wq_set, policy); if (ret != KERN_SUCCESS) { zfree(_wait_queue_set_zone, wq_set); wq_set = WAIT_QUEUE_SET_NULL; } } return wq_set; }
/* * Routine: wait_queue_set_alloc * Purpose: * Allocate and initialize a wait queue set for * use outside of the mach part of the kernel. * Conditions: * May block. * Returns: * The allocated and initialized wait queue set * WAIT_QUEUE_SET_NULL if there is a resource shortage */ wait_queue_set_t wait_queue_set_alloc( int policy) { wait_queue_set_t wq_set; wq_set = (wait_queue_set_t) kalloc(sizeof(struct wait_queue_set)); if (wq_set != WAIT_QUEUE_SET_NULL) { kern_return_t ret; ret = wait_queue_set_init(wq_set, policy); if (ret != KERN_SUCCESS) { kfree((vm_offset_t)wq_set, sizeof(struct wait_queue_set)); wq_set = WAIT_QUEUE_SET_NULL; } } return wq_set; }