tools/testing/selftests/bpf/progs/test_sleepable_tracepoints_fail.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_sleepable_tracepoints_fail.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/progs/test_sleepable_tracepoints_fail.c
Extension
.c
Size
545 bytes
Lines
19
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

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */

#include <vmlinux.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_helpers.h>
#include "bpf_misc.h"

char _license[] SEC("license") = "GPL";

/* Sleepable program on a non-faultable tracepoint should fail to load */
SEC("tp_btf.s/sched_switch")
__failure __msg("Sleepable program cannot attach to non-faultable tracepoint")
int BPF_PROG(handle_sched_switch, bool preempt,
	     struct task_struct *prev, struct task_struct *next)
{
	return 0;
}

Annotation

Implementation Notes