• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
4  *
5  * Description:
6  * Basic pidfd_open() test, fetches the PID of the current process and tries to
7  * get its file descriptor.
8  */
9 #include "tst_test.h"
10 #include "lapi/pidfd_open.h"
11 
run(void)12 static void run(void)
13 {
14 	TEST(pidfd_open(getpid(), 0));
15 
16 	if (TST_RET == -1)
17 		tst_brk(TFAIL | TTERRNO, "pidfd_open(getpid(), 0) failed");
18 
19 	SAFE_CLOSE(TST_RET);
20 
21 	tst_res(TPASS, "pidfd_open(getpid(), 0) passed");
22 }
23 
24 static struct tst_test test = {
25 	.min_kver = "5.3",
26 	.test_all = run,
27 };
28