Lines Matching refs:lock_set
115 * Initialize the lock_set subsystem.
139 lock_set_t lock_set = LOCK_SET_NULL;
149 if ((VM_MAX_ADDRESS - sizeof(struct lock_set))/sizeof(struct ulock) < (unsigned)n_ulocks)
152 size = sizeof(struct lock_set) + (sizeof(struct ulock) * (n_ulocks-1));
153 lock_set = (lock_set_t) kalloc (size);
155 if (lock_set == LOCK_SET_NULL)
159 lock_set_lock_init(lock_set);
160 lock_set->n_ulocks = n_ulocks;
161 lock_set->ref_count = 1;
166 lock_set->port = ipc_port_alloc_kernel();
167 if (lock_set->port == IP_NULL) {
169 lock_set_dereference(lock_set);
173 ipc_kobject_set (lock_set->port,
174 (ipc_kobject_t) lock_set,
182 ulock = (ulock_t) &lock_set->ulock_list[x];
184 ulock->lock_set = lock_set;
192 lock_set_ownership_set(lock_set, task);
194 lock_set->active = TRUE;
195 *new_lock_set = lock_set;
212 lock_set_destroy (task_t task, lock_set_t lock_set)
217 if (task == TASK_NULL || lock_set == LOCK_SET_NULL)
220 if (lock_set->owner != task)
223 lock_set_lock(lock_set);
224 if (!lock_set->active) {
225 lock_set_unlock(lock_set);
232 lock_set->active = FALSE;
245 for (i = 0; i < lock_set->n_ulocks; i++) {
246 ulock = &lock_set->ulock_list[i];
276 lock_set_unlock(lock_set);
277 lock_set_ownership_clear(lock_set, task);
286 ipc_port_dealloc_kernel(lock_set->port);
287 lock_set_dereference(lock_set);
293 lock_acquire (lock_set_t lock_set, int lock_id)
297 if (lock_set == LOCK_SET_NULL)
300 if (lock_id < 0 || lock_id >= lock_set->n_ulocks)
304 lock_set_lock(lock_set);
305 if (!lock_set->active) {
306 lock_set_unlock(lock_set);
310 ulock = (ulock_t) &lock_set->ulock_list[lock_id];
312 lock_set_unlock(lock_set);
355 goto retry; /* probably a dead lock_set */
372 lock_release (lock_set_t lock_set, int lock_id)
376 if (lock_set == LOCK_SET_NULL)
379 if (lock_id < 0 || lock_id >= lock_set->n_ulocks)
382 ulock = (ulock_t) &lock_set->ulock_list[lock_id];
388 lock_try (lock_set_t lock_set, int lock_id)
393 if (lock_set == LOCK_SET_NULL)
396 if (lock_id < 0 || lock_id >= lock_set->n_ulocks)
400 lock_set_lock(lock_set);
401 if (!lock_set->active) {
402 lock_set_unlock(lock_set);
406 ulock = (ulock_t) &lock_set->ulock_list[lock_id];
408 lock_set_unlock(lock_set);
418 lock_set_unlock(lock_set);
440 lock_make_stable (lock_set_t lock_set, int lock_id)
445 if (lock_set == LOCK_SET_NULL)
448 if (lock_id < 0 || lock_id >= lock_set->n_ulocks)
452 lock_set_lock(lock_set);
453 if (!lock_set->active) {
454 lock_set_unlock(lock_set);
458 ulock = (ulock_t) &lock_set->ulock_list[lock_id];
460 lock_set_unlock(lock_set);
485 lock_set_t lock_set;
487 lock_set = ulock->lock_set;
488 lock_set_lock(lock_set);
489 if (!lock_set->active) {
490 lock_set_unlock(lock_set);
495 lock_set_unlock(lock_set);
518 lock_set_t lock_set;
520 if ((lock_set = ulock->lock_set) == LOCK_SET_NULL)
523 lock_set_lock(lock_set);
524 if (!lock_set->active) {
525 lock_set_unlock(lock_set);
529 lock_set_unlock(lock_set);
593 lock_handoff (lock_set_t lock_set, int lock_id)
599 if (lock_set == LOCK_SET_NULL)
602 if (lock_id < 0 || lock_id >= lock_set->n_ulocks)
606 lock_set_lock(lock_set);
608 if (!lock_set->active) {
609 lock_set_unlock(lock_set);
613 ulock = (ulock_t) &lock_set->ulock_list[lock_id];
615 lock_set_unlock(lock_set);
721 lock_handoff_accept (lock_set_t lock_set, int lock_id)
727 if (lock_set == LOCK_SET_NULL)
730 if (lock_id < 0 || lock_id >= lock_set->n_ulocks)
734 lock_set_lock(lock_set);
735 if (!lock_set->active) {
736 lock_set_unlock(lock_set);
740 ulock = (ulock_t) &lock_set->ulock_list[lock_id];
742 lock_set_unlock(lock_set);
835 lock_set_reference(lock_set_t lock_set)
837 lock_set_lock(lock_set);
838 lock_set->ref_count++;
839 lock_set_unlock(lock_set);
849 lock_set_dereference(lock_set_t lock_set)
854 lock_set_lock(lock_set);
855 ref_count = --(lock_set->ref_count);
856 lock_set_unlock(lock_set);
859 size = sizeof(struct lock_set) +
860 (sizeof(struct ulock) * (lock_set->n_ulocks - 1));
861 kfree(lock_set, size);