*/
#include "defs.h"
+#include "ipc_defs.h"
-#include <sys/ipc.h>
-#include <sys/msg.h>
+#ifdef HAVE_SYS_MSG_H
+# include <sys/msg.h>
+#elif defined HAVE_LINUX_MSG_H
+# include <linux/msg.h>
+#endif
#include "xlat/ipc_msg_flags.h"
#include "xlat/resource_flags.h"
-extern void tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count);
-
SYS_FUNC(msgget)
{
- if (tcp->u_arg[0])
- tprintf("%#lx, ", tcp->u_arg[0]);
+ const int key = (int) tcp->u_arg[0];
+ if (key)
+ tprintf("%#x", key);
else
- tprints("IPC_PRIVATE, ");
+ tprints("IPC_PRIVATE");
+ tprints(", ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");
- tprintf("%#lo", tcp->u_arg[1] & 0777);
+ print_numeric_umode_t(tcp->u_arg[1] & 0777);
return RVAL_DECODED;
}
}
static int
-fetch_msgrcv_args(struct tcb *tcp, const long addr, long *pair)
+fetch_msgrcv_args(struct tcb *tcp, const long addr, unsigned long *pair)
{
- if (current_wordsize == sizeof(long)) {
- if (umoven_or_printaddr(tcp, addr, 2 * sizeof(long), pair))
+ if (current_wordsize == sizeof(*pair)) {
+ if (umoven_or_printaddr(tcp, addr, 2 * sizeof(*pair), pair))
return -1;
} else {
unsigned int tmp[2];
tprintf("%d, ", (int) tcp->u_arg[0]);
} else {
if (indirect_ipccall(tcp)) {
- long pair[2];
+ const bool direct =
+#ifdef SPARC64
+ current_wordsize == 8 ||
+#endif
+ get_tcb_priv_ulong(tcp) != 0;
+ if (direct) {
+ tprint_msgrcv(tcp, tcp->u_arg[3],
+ tcp->u_arg[1], tcp->u_arg[4]);
+ } else {
+ unsigned long pair[2];
- if (fetch_msgrcv_args(tcp, tcp->u_arg[3], pair))
- tprintf(", %lu, ", tcp->u_arg[1]);
- else
- tprint_msgrcv(tcp, pair[0], tcp->u_arg[1], pair[1]);
+ if (fetch_msgrcv_args(tcp, tcp->u_arg[3], pair))
+ tprintf(", %lu, ", tcp->u_arg[1]);
+ else
+ tprint_msgrcv(tcp, pair[0],
+ tcp->u_arg[1], pair[1]);
+ }
printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
} else {
tprint_msgrcv(tcp, tcp->u_arg[1],