(root)/
strace-6.5/
tests/
uname.c
       1  /*
       2   * Check decoding of uname syscall.
       3   *
       4   * Copyright (c) 2016-2021 The strace developers.
       5   * All rights reserved.
       6   *
       7   * SPDX-License-Identifier: GPL-2.0-or-later
       8   */
       9  
      10  #include "tests.h"
      11  #include "scno.h"
      12  
      13  #include <stdio.h>
      14  #include <sys/utsname.h>
      15  #include <unistd.h>
      16  
      17  int main(int ac, char **av)
      18  {
      19  	int abbrev = ac > 1;
      20  	TAIL_ALLOC_OBJECT_CONST_PTR(struct utsname, uname);
      21  	int rc = syscall(__NR_uname, uname);
      22  	printf("uname({sysname=");
      23  	print_quoted_string(uname->sysname);
      24  	printf(", nodename=");
      25  	print_quoted_string(uname->nodename);
      26  	if (abbrev) {
      27  		printf(", ...");
      28  	} else {
      29  		printf(", release=");
      30  		print_quoted_string(uname->release);
      31  		printf(", version=");
      32  		print_quoted_string(uname->version);
      33  		printf(", machine=");
      34  		print_quoted_string(uname->machine);
      35  #ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
      36  		printf(", domainname=");
      37  		print_quoted_string(uname->domainname);
      38  #endif
      39  	}
      40  	printf("}) = %d\n", rc);
      41  
      42  	puts("+++ exited with 0 +++");
      43  	return 0;
      44  }