tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
Extension
.c
Size
4615 bytes
Lines
168
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (res > 0) {
			atomic_set(&requeued, 1);
			break;
		} else if (res < 0) {
			ksft_exit_fail_msg("FUTEX_CMP_REQUEUE_PI failed\n");
		}
	}
	ksft_print_dbg_msg("m4:f2: %x\n", f2);

	/*
	 * Signal the waiter after requeue, waiter should return from
	 * futex_wait_requeue_pi() with EWOULDBLOCK. Join the thread here so the
	 * futex_unlock_pi() can't happen before the signal wakeup is detected
	 * in the kernel.
	 */
	ksft_print_dbg_msg("Issuing SIGUSR1 to waiter\n");
	pthread_kill(waiter, SIGUSR1);
	ksft_print_dbg_msg("Waiting for waiter to return\n");
	pthread_join(waiter, NULL);

	ksft_print_dbg_msg("Calling FUTEX_UNLOCK_PI on mutex=%x @ %p\n", f2, &f2);
	futex_unlock_pi(&f2, FUTEX_PRIVATE_FLAG);
	ksft_print_dbg_msg("m5:f2: %x\n", f2);
}

TEST_HARNESS_MAIN

Annotation

Implementation Notes