Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uname.c 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
  3. * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  4. * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
  5. * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
  6. * Copyright (c) 2012-2015 Dmitry V. Levin <ldv@altlinux.org>
  7. * Copyright (c) 2014-2018 The strace developers.
  8. * All rights reserved.
  9. *
  10. * SPDX-License-Identifier: LGPL-2.1-or-later
  11. */
  12. #include "defs.h"
  13. #include "print_fields.h"
  14. #include <sys/utsname.h>
  15. SYS_FUNC(uname)
  16. {
  17. struct utsname uname;
  18. if (entering(tcp))
  19. return 0;
  20. if (!umove_or_printaddr(tcp, tcp->u_arg[0], &uname)) {
  21. PRINT_FIELD_CSTRING("{", uname, sysname);
  22. PRINT_FIELD_CSTRING(", ", uname, nodename);
  23. if (abbrev(tcp)) {
  24. tprints(", ...}");
  25. return 0;
  26. }
  27. PRINT_FIELD_CSTRING(", ", uname, release);
  28. PRINT_FIELD_CSTRING(", ", uname, version);
  29. PRINT_FIELD_CSTRING(", ", uname, machine);
  30. #ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
  31. PRINT_FIELD_CSTRING(", ", uname, domainname);
  32. #endif
  33. tprints("}");
  34. }
  35. return 0;
  36. }