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.

hostname.c 717B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2014-2018 The strace developers.
  3. * All rights reserved.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. */
  7. #include "defs.h"
  8. #ifdef HAVE_LINUX_UTSNAME_H
  9. # include <linux/utsname.h>
  10. #endif
  11. #ifndef __NEW_UTS_LEN
  12. # define __NEW_UTS_LEN 64
  13. #endif
  14. SYS_FUNC(sethostname)
  15. {
  16. unsigned int len = tcp->u_arg[1];
  17. if (len > __NEW_UTS_LEN) {
  18. printaddr(tcp->u_arg[0]);
  19. } else {
  20. printstrn(tcp, tcp->u_arg[0], len);
  21. }
  22. tprintf(", %u", len);
  23. return RVAL_DECODED;
  24. }
  25. #if defined(ALPHA)
  26. SYS_FUNC(gethostname)
  27. {
  28. if (exiting(tcp)) {
  29. if (syserror(tcp))
  30. printaddr(tcp->u_arg[0]);
  31. else
  32. printstr(tcp, tcp->u_arg[0]);
  33. tprintf(", %" PRI_klu, tcp->u_arg[1]);
  34. }
  35. return 0;
  36. }
  37. #endif /* ALPHA */