xref: /kvm-unit-tests/lib/abort.c (revision ce42dc88e4d1c60f852d8bc803d44b7f176e59a3)
1*ce42dc88SAndrew Jones /*
2*ce42dc88SAndrew Jones  * Copyright (C) 2014, Red Hat Inc, Andrew Jones <drjones@redhat.com>
3*ce42dc88SAndrew Jones  *
4*ce42dc88SAndrew Jones  * This work is licensed under the terms of the GNU LGPL, version 2.
5*ce42dc88SAndrew Jones  */
6*ce42dc88SAndrew Jones #include "libcflat.h"
7*ce42dc88SAndrew Jones 
8*ce42dc88SAndrew Jones /*
9*ce42dc88SAndrew Jones  * When exit(code) is invoked, qemu will exit with ((code << 1) | 1),
10*ce42dc88SAndrew Jones  * leaving us 128 exit status codes. To avoid confusion with signal
11*ce42dc88SAndrew Jones  * status, we further limit exit codes to those resulting in qemu
12*ce42dc88SAndrew Jones  * exiting with a status < 128. We give abort() the highest (127),
13*ce42dc88SAndrew Jones  * leaving the lower status codes for unit tests.
14*ce42dc88SAndrew Jones  */
15*ce42dc88SAndrew Jones #define ABORT_EXIT_STATUS 63	/* 127 exit status from qemu */
16*ce42dc88SAndrew Jones 
abort(void)17*ce42dc88SAndrew Jones void abort(void)
18*ce42dc88SAndrew Jones {
19*ce42dc88SAndrew Jones 	exit(ABORT_EXIT_STATUS);
20*ce42dc88SAndrew Jones }
21