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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
Extension
.c
Size
2458 bytes
Lines
94
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 (errno == EINVAL) {
			/*
			 * The kernel correctly detected the mismatched
			 * requeue_pi target and aborted. Wake the child with
			 * FUTEX_WAKE.
			 */
			ret = futex_wake(&f1, 1, FUTEX_PRIVATE_FLAG);
			if (ret == 1)
				ret = 0;
			else if (ret < 0)
				ksft_exit_fail_msg("futex_wake\n");
			else
				ksft_exit_fail_msg("futex_wake did not wake the child\n");
		} else {
			ksft_exit_fail_msg("futex_cmp_requeue_pi\n");
		}
	} else if (ret > 0) {
		ksft_test_result_fail("futex_cmp_requeue_pi failed to detect the mismatch\n");
	} else {
		ksft_exit_fail_msg("futex_cmp_requeue_pi found no waiters\n");
	}

	pthread_join(child, NULL);

	if (!ret && !child_ret)
		ksft_test_result_pass("futex_requeue_pi_mismatched_ops passed\n");
	else
		ksft_test_result_pass("futex_requeue_pi_mismatched_ops failed\n");
}

TEST_HARNESS_MAIN

Annotation

Implementation Notes