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.

mount.c 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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) 2005 Roland McGrath <roland@redhat.com>
  7. * Copyright (c) 2007-2015 Dmitry V. Levin <ldv@altlinux.org>
  8. * Copyright (c) 2014-2018 The strace developers.
  9. * All rights reserved.
  10. *
  11. * SPDX-License-Identifier: LGPL-2.1-or-later
  12. */
  13. #include "defs.h"
  14. #define MS_MGC_VAL 0xc0ed0000 /* old magic mount flag number */
  15. #define MS_MGC_MSK 0xffff0000 /* old magic mount flag mask */
  16. #include "xlat/mount_flags.h"
  17. SYS_FUNC(mount)
  18. {
  19. bool ignore_type = false;
  20. bool ignore_data = false;
  21. bool old_magic = false;
  22. kernel_ulong_t flags = tcp->u_arg[3];
  23. /* Discard magic */
  24. if ((flags & MS_MGC_MSK) == MS_MGC_VAL) {
  25. flags &= ~MS_MGC_MSK;
  26. old_magic = true;
  27. }
  28. if (flags & MS_REMOUNT)
  29. ignore_type = true;
  30. else if (flags & (MS_BIND | MS_MOVE | MS_SHARED
  31. | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
  32. ignore_type = ignore_data = true;
  33. printpath(tcp, tcp->u_arg[0]);
  34. tprints(", ");
  35. printpath(tcp, tcp->u_arg[1]);
  36. tprints(", ");
  37. if (ignore_type)
  38. printaddr(tcp->u_arg[2]);
  39. else
  40. printstr(tcp, tcp->u_arg[2]);
  41. tprints(", ");
  42. if (old_magic) {
  43. print_xlat(MS_MGC_VAL);
  44. if (flags)
  45. tprints("|");
  46. }
  47. if (flags || !old_magic)
  48. printflags64(mount_flags, flags, "MS_???");
  49. tprints(", ");
  50. if (ignore_data)
  51. printaddr(tcp->u_arg[4]);
  52. else
  53. printstr(tcp, tcp->u_arg[4]);
  54. return RVAL_DECODED;
  55. }