(root)/
strace-6.5/
src/
reboot.c
       1  /*
       2   * Copyright (c) 2014-2021 The strace developers.
       3   * All rights reserved.
       4   *
       5   * SPDX-License-Identifier: LGPL-2.1-or-later
       6   */
       7  
       8  #include "defs.h"
       9  
      10  #include "xlat/bootflags1.h"
      11  #include "xlat/bootflags2.h"
      12  #include "xlat/bootflags3.h"
      13  
      14  SYS_FUNC(reboot)
      15  {
      16  	const unsigned int magic1 = tcp->u_arg[0];
      17  	const unsigned int magic2 = tcp->u_arg[1];
      18  	const unsigned int cmd = tcp->u_arg[2];
      19  
      20  	/* magic */
      21  	printxval(bootflags1, magic1, "LINUX_REBOOT_MAGIC_???");
      22  	tprint_arg_next();
      23  
      24  	/* magic2 */
      25  	printxval(bootflags2, magic2, "LINUX_REBOOT_MAGIC_???");
      26  	tprint_arg_next();
      27  
      28  	/* cmd */
      29  	printxval(bootflags3, cmd, "LINUX_REBOOT_CMD_???");
      30  	if (cmd == LINUX_REBOOT_CMD_RESTART2) {
      31  		tprint_arg_next();
      32  
      33  		/*
      34  		 * The size of kernel buffer is 256 bytes and
      35  		 * the last byte is always zero, at most 255 bytes
      36  		 * are copied from the user space.
      37  		 */
      38  		/* arg */
      39  		printstr_ex(tcp, tcp->u_arg[3], 255, QUOTE_0_TERMINATED);
      40  	}
      41  	return RVAL_DECODED;
      42  }