(root)/
strace-6.5/
tests-mx32/
xetpgid.c
       1  /*
       2   * Check decoding of getpgid and setpgid syscalls.
       3   *
       4   * Copyright (c) 2016 Dmitry V. Levin <ldv@strace.io>
       5   * Copyright (c) 2016-2021 The strace developers.
       6   * All rights reserved.
       7   *
       8   * SPDX-License-Identifier: GPL-2.0-or-later
       9   */
      10  
      11  #include "tests.h"
      12  #include "scno.h"
      13  #include "pidns.h"
      14  
      15  #include <stdio.h>
      16  #include <unistd.h>
      17  
      18  int
      19  main(void)
      20  {
      21  	PIDNS_TEST_INIT;
      22  
      23  	const int pid = getpid();
      24  	long pgid = syscall(__NR_getpgid, F8ILL_KULONG_MASK | pid);
      25  	pidns_print_leader();
      26  	printf("getpgid(%d%s) = %ld%s\n", pid, pidns_pid2str(PT_TGID),
      27  		pgid, pidns_pid2str(PT_PGID));
      28  
      29  	long rc = syscall(__NR_setpgid, F8ILL_KULONG_MASK,
      30  		F8ILL_KULONG_MASK | pgid);
      31  	pidns_print_leader();
      32  	printf("setpgid(0, %ld%s) = %s\n", pgid, pidns_pid2str(PT_PGID),
      33  		sprintrc(rc));
      34  
      35  	pidns_print_leader();
      36  	puts("+++ exited with 0 +++");
      37  	return 0;
      38  }