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.

print_mq_attr.c 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
  3. * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
  4. * Copyright (c) 2015-2018 The strace developers.
  5. * All rights reserved.
  6. *
  7. * SPDX-License-Identifier: LGPL-2.1-or-later
  8. */
  9. #include "defs.h"
  10. #include DEF_MPERS_TYPE(mq_attr_t)
  11. #ifdef HAVE_MQUEUE_H
  12. # include <mqueue.h>
  13. typedef struct mq_attr mq_attr_t;
  14. #elif defined HAVE_LINUX_MQUEUE_H
  15. # include <linux/types.h>
  16. # include <linux/mqueue.h>
  17. typedef struct mq_attr mq_attr_t;
  18. #endif
  19. #include "xlat/mq_attr_flags.h"
  20. #include MPERS_DEFS
  21. MPERS_PRINTER_DECL(void, printmqattr, struct tcb *const tcp,
  22. const kernel_ulong_t addr, const bool decode_flags)
  23. {
  24. #if defined HAVE_MQUEUE_H || defined HAVE_LINUX_MQUEUE_H
  25. mq_attr_t attr;
  26. if (umove_or_printaddr(tcp, addr, &attr))
  27. return;
  28. tprints("{mq_flags=");
  29. if (decode_flags)
  30. printflags64(mq_attr_flags,
  31. zero_extend_signed_to_ull(attr.mq_flags),
  32. "O_???");
  33. else
  34. tprintf("%#llx", zero_extend_signed_to_ull(attr.mq_flags));
  35. tprintf(", mq_maxmsg=%lld, mq_msgsize=%lld, mq_curmsgs=%lld}",
  36. sign_extend_unsigned_to_ll(attr.mq_maxmsg),
  37. sign_extend_unsigned_to_ll(attr.mq_msgsize),
  38. sign_extend_unsigned_to_ll(attr.mq_curmsgs));
  39. #else
  40. printaddr(addr);
  41. #endif
  42. }