(root)/
strace-6.5/
tests-m32/
set_ptracer_any.c
       1  /*
       2   * Copyright (c) 2013-2015 Dmitry V. Levin <ldv@strace.io>
       3   * Copyright (c) 2013-2021 The strace developers.
       4   * All rights reserved.
       5   *
       6   * SPDX-License-Identifier: GPL-2.0-or-later
       7   */
       8  
       9  #include "tests.h"
      10  #include <stdio.h>
      11  #include <unistd.h>
      12  #include <sys/prctl.h>
      13  
      14  int main(int argc, char **argv)
      15  {
      16  	if (argc < 2)
      17  		return 99;
      18  	/*
      19  	 * Turn off restrictions on tracing if applicable.
      20  	 * If the command is not available on this system, that's OK too.
      21  	 */
      22  	(void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0);
      23  	if (write(1, "\n", 1) != 1) {
      24  		perror("write");
      25  		return 99;
      26  	}
      27  	(void) execvp(argv[1], argv + 1);
      28  	perror(argv[1]);
      29  	return 99;
      30  }