tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c- Extension
.c- Size
- 1066 bytes
- Lines
- 51
- 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
stdio.hstdlib.hsignal.hutils.htm.h
Detected Declarations
function Statefunction tm_signal_sigreturn_ntfunction main
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright 2018, Breno Leitao, Gustavo Romero, IBM Corp.
*
* A test case that creates a signal and starts a suspended transaction
* inside the signal handler.
*
* It returns from the signal handler with the CPU at suspended state, but
* without setting usercontext MSR Transaction State (TS) fields.
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "utils.h"
#include "tm.h"
void trap_signal_handler(int signo, siginfo_t *si, void *uc)
{
ucontext_t *ucp = (ucontext_t *) uc;
asm("tbegin.; tsuspend.;");
/* Skip 'trap' instruction if it succeed */
ucp->uc_mcontext.regs->nip += 4;
}
int tm_signal_sigreturn_nt(void)
{
struct sigaction trap_sa;
SKIP_IF(!have_htm());
SKIP_IF(htm_is_synthetic());
trap_sa.sa_flags = SA_SIGINFO;
trap_sa.sa_sigaction = trap_signal_handler;
sigaction(SIGTRAP, &trap_sa, NULL);
raise(SIGTRAP);
return EXIT_SUCCESS;
}
int main(int argc, char **argv)
{
return test_harness(tm_signal_sigreturn_nt, "tm_signal_sigreturn_nt");
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `signal.h`, `utils.h`, `tm.h`.
- Detected declarations: `function State`, `function tm_signal_sigreturn_nt`, `function main`.
- 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.