tools/testing/selftests/bpf/prog_tests/send_signal_sched_switch.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/send_signal_sched_switch.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/send_signal_sched_switch.c- Extension
.c- Size
- 1291 bytes
- Lines
- 62
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.hstdio.hstdlib.hsys/mman.hpthread.hsys/types.hsys/stat.hfcntl.htest_send_signal_kern.skel.h
Detected Declarations
function sigusr1_handlerfunction serial_test_send_signal_sched_switch
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "test_send_signal_kern.skel.h"
static void sigusr1_handler(int signum)
{
}
#define THREAD_COUNT 100
static void *worker(void *p)
{
int i;
for ( i = 0; i < 1000; i++)
usleep(1);
return NULL;
}
/* NOTE: cause events loss */
void serial_test_send_signal_sched_switch(void)
{
struct test_send_signal_kern *skel;
pthread_t threads[THREAD_COUNT];
u32 duration = 0;
int i, err;
signal(SIGUSR1, sigusr1_handler);
skel = test_send_signal_kern__open_and_load();
if (CHECK(!skel, "skel_open_and_load", "skeleton open_and_load failed\n"))
return;
skel->bss->pid = getpid();
skel->bss->sig = SIGUSR1;
err = test_send_signal_kern__attach(skel);
if (CHECK(err, "skel_attach", "skeleton attach failed\n"))
goto destroy_skel;
for (i = 0; i < THREAD_COUNT; i++) {
err = pthread_create(threads + i, NULL, worker, NULL);
if (CHECK(err, "pthread_create", "Error creating thread, %s\n",
strerror(errno)))
goto destroy_skel;
}
for (i = 0; i < THREAD_COUNT; i++)
pthread_join(threads[i], NULL);
destroy_skel:
test_send_signal_kern__destroy(skel);
}
Annotation
- Immediate include surface: `test_progs.h`, `stdio.h`, `stdlib.h`, `sys/mman.h`, `pthread.h`, `sys/types.h`, `sys/stat.h`, `fcntl.h`.
- Detected declarations: `function sigusr1_handler`, `function serial_test_send_signal_sched_switch`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.