(root)/
strace-6.5/
src/
hostname.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  #include <linux/utsname.h>
      10  
      11  SYS_FUNC(sethostname)
      12  {
      13  	unsigned int len = tcp->u_arg[1];
      14  
      15  	/* name */
      16  	if (len > __NEW_UTS_LEN) {
      17  		printaddr(tcp->u_arg[0]);
      18  	} else {
      19  		printstrn(tcp, tcp->u_arg[0], len);
      20  	}
      21  	tprint_arg_next();
      22  
      23  	/* len */
      24  	PRINT_VAL_U(len);
      25  
      26  	return RVAL_DECODED;
      27  }
      28  
      29  #if defined(ALPHA)
      30  SYS_FUNC(gethostname)
      31  {
      32  	if (exiting(tcp)) {
      33  		/* name */
      34  		if (syserror(tcp))
      35  			printaddr(tcp->u_arg[0]);
      36  		else
      37  			printstr(tcp, tcp->u_arg[0]);
      38  		tprint_arg_next();
      39  
      40  		/* len */
      41  		PRINT_VAL_U(tcp->u_arg[1]);
      42  	}
      43  	return 0;
      44  }
      45  #endif /* ALPHA */