xref: /illumos-gate/usr/src/test/libproc-tests/tests/agent/agent_target.c (revision f618476ce4f1b39cd7619a6e742f87a06a54fbfc)
1*f618476cSAndy Fiddaman /*
2*f618476cSAndy Fiddaman  * This file and its contents are supplied under the terms of the
3*f618476cSAndy Fiddaman  * Common Development and Distribution License ("CDDL"), version 1.0.
4*f618476cSAndy Fiddaman  * You may only use this file in accordance with the terms of version
5*f618476cSAndy Fiddaman  * 1.0 of the CDDL.
6*f618476cSAndy Fiddaman  *
7*f618476cSAndy Fiddaman  * A full copy of the text of the CDDL should have accompanied this
8*f618476cSAndy Fiddaman  * source.  A copy of the CDDL is also available via the Internet at
9*f618476cSAndy Fiddaman  * http://www.illumos.org/license/CDDL.
10*f618476cSAndy Fiddaman  */
11*f618476cSAndy Fiddaman 
12*f618476cSAndy Fiddaman /*
13*f618476cSAndy Fiddaman  * Copyright 2026 Oxide Computer Company
14*f618476cSAndy Fiddaman  */
15*f618476cSAndy Fiddaman 
16*f618476cSAndy Fiddaman /*
17*f618476cSAndy Fiddaman  * This program serves as a target for the agent_destroy program to run.
18*f618476cSAndy Fiddaman  * agent_target_hook() is used as a place to set a breakpoint at which the
19*f618476cSAndy Fiddaman  * controller performs its injections. There is no state to verify afterwards.
20*f618476cSAndy Fiddaman  * The test is that this program remains controllable throughout and runs to
21*f618476cSAndy Fiddaman  * completion undamaged.
22*f618476cSAndy Fiddaman  */
23*f618476cSAndy Fiddaman 
24*f618476cSAndy Fiddaman #include <stdlib.h>
25*f618476cSAndy Fiddaman 
26*f618476cSAndy Fiddaman /*
27*f618476cSAndy Fiddaman  * This is used as a place to set a breakpoint for the controller to find us.
28*f618476cSAndy Fiddaman  * It is a weak symbol to help avoid compiler optimisation.
29*f618476cSAndy Fiddaman  */
30*f618476cSAndy Fiddaman #pragma weak agent_target_hook
31*f618476cSAndy Fiddaman void
agent_target_hook(void)32*f618476cSAndy Fiddaman agent_target_hook(void)
33*f618476cSAndy Fiddaman {
34*f618476cSAndy Fiddaman }
35*f618476cSAndy Fiddaman 
36*f618476cSAndy Fiddaman int
main(void)37*f618476cSAndy Fiddaman main(void)
38*f618476cSAndy Fiddaman {
39*f618476cSAndy Fiddaman 	agent_target_hook();
40*f618476cSAndy Fiddaman 	return (EXIT_SUCCESS);
41*f618476cSAndy Fiddaman }
42