linux-hardened/tools/testing/selftests/powerpc/tm/tm-fork.c
Thomas Gleixner f50a7f3d92 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 191
Based on 1 normalized pattern(s):

  licensed under gplv2

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 99 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Steve Winslow <swinslow@gmail.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190528170027.163048684@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:29:21 -07:00

42 lines
796 B
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2015, Michael Neuling, IBM Corp.
*
* Edited: Rashmica Gupta, Nov 2015
*
* This test does a fork syscall inside a transaction. Basic sniff test
* to see if we can enter the kernel during a transaction.
*/
#include <errno.h>
#include <inttypes.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "utils.h"
#include "tm.h"
int test_fork(void)
{
SKIP_IF(!have_htm());
asm __volatile__(
"tbegin.;"
"blt 1f; "
"li 0, 2;" /* fork syscall */
"sc ;"
"tend.;"
"1: ;"
: : : "memory", "r0");
/* If we reach here, we've passed. Otherwise we've probably crashed
* the kernel */
return 0;
}
int main(int argc, char *argv[])
{
return test_harness(test_fork, "tm_fork");
}