sys/emulation/linux/linux_futex.c
void
release_futexes(struct proc *p)
{
	struct linux_robust_list_head *head = NULL;
	struct linux_robust_list *entry, *next_entry, *pending;
	unsigned int limit = 2048, pi, next_pi, pip;
	struct linux_emuldata *em;
	l_long futex_offset;
	int rc;

	EMUL_LOCK();
	KKASSERT(p != NULL);
	em = emuldata_get(p);
	KKASSERT(em != NULL);
	head = em->robust_futexes;
	EMUL_UNLOCK();

	if (head == NULL)
		return;

	if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi))
		return;

	if (copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset)))
		return;

	if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip))
		return;

	while (entry != &head->list) {
		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);

		if (entry != pending)
			if (handle_futex_death(p, (uint32_t *)entry + futex_offset, pi))
				return;
		if (rc)
			return;

		entry = next_entry;
		pi = next_pi;

		if (!--limit)
			break;

		/* XXX: not sure about this yield, was sched_relinquish(curthread); */
		lwkt_yield();
	}

	if (pending)
		handle_futex_death(p, (uint32_t *)pending + futex_offset, pip);
}
/* This walks the list of robust futexes releasing them. */
This walks the list of robust futexes releasing them.
This walks the list of robust futexes releasing them .
void
release_futexes(struct proc *p)
{
	struct linux_robust_list_head *head = NULL;
	struct linux_robust_list *entry, *next_entry, *pending;
	unsigned int limit = 2048, pi, next_pi, pip;
	struct linux_emuldata *em;
	l_long futex_offset;
	int rc;
	EMUL_LOCK();
	KKASSERT(p != NULL);
	em = emuldata_get(p);
	KKASSERT(em != NULL);
	head = em->robust_futexes;
	EMUL_UNLOCK();
	if (head == NULL)
		return;
	if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi))
		return;
	if (copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset)))
		return;
	if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip))
		return;
	while (entry != &head->list) {
		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
		if (entry != pending)
			if (handle_futex_death(p, (uint32_t *)entry + futex_offset, pi))
				return;
		if (rc)
			return;
		entry = next_entry;
		pi = next_pi;
		if (!--limit)
			break;
		lwkt_yield();
	}
	if (pending)
		handle_futex_death(p, (uint32_t *)pending + futex_offset, pip);
}
void release_futexes ( struct proc * p ) { struct linux_robust_list_head * head = NULL ; struct linux_robust_list * entry , * next_entry , * pending ; unsigned int limit = 2048 , pi , next_pi , pip ; struct linux_emuldata * em ; l_long futex_offset ; int rc ; EMUL_LOCK ( ) ; KKASSERT ( p != NULL ) ; em = emuldata_get ( p ) ; KKASSERT ( em != NULL ) ; head = em -> robust_futexes ; EMUL_UNLOCK ( ) ; if ( head == NULL ) return ; if ( fetch_robust_entry ( & entry , PTRIN ( & head -> list . next ) , & pi ) ) return ; if ( copyin ( & head -> futex_offset , & futex_offset , sizeof ( futex_offset ) ) ) return ; if ( fetch_robust_entry ( & pending , PTRIN ( & head -> pending_list ) , & pip ) ) return ; while ( entry != & head -> list ) { rc = fetch_robust_entry ( & next_entry , PTRIN ( & entry -> next ) , & next_pi ) ; if ( entry != pending ) if ( handle_futex_death ( p , ( uint32_t * ) entry + futex_offset , pi ) ) return ; if ( rc ) return ; entry = next_entry ; pi = next_pi ; if ( ! -- limit ) break ; lwkt_yield ( ) ; } if ( pending ) handle_futex_death ( p , ( uint32_t * ) pending + futex_offset , pip ) ; }
This walks the list of robust futexes releasing them.
This walks the list of robust futexes releasing them .
/* XXX: not sure about this yield, was sched_relinquish(curthread); */