--- /dev/null
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/stat.h>
+
+#define text_string "STRACE_STRING"
+#define msgsz sizeof(text_string)
+
+int
+main (void)
+{
+ const long mtype = 0xdefaced;
+ struct {
+ long mtype;
+ char mtext[msgsz];
+ } msg = {
+ .mtype = mtype,
+ .mtext = text_string
+ };
+ int msqid = msgget(IPC_PRIVATE, IPC_CREAT | S_IRWXU);
+ if (msqid == -1)
+ return 77;
+ if (msgsnd(msqid, &msg, msgsz, 0) == -1)
+ goto cleanup;
+ if (msgrcv(msqid, &msg, msgsz, mtype, 0) != msgsz)
+ goto cleanup;
+ if (msgctl(msqid, IPC_RMID, 0) == -1)
+ return 77;
+ return 0;
+
+cleanup:
+ msgctl(msqid, IPC_RMID, 0);
+ return 77;
+}
--- /dev/null
+msgget\(IPC_PRIVATE, IPC_CREAT\|0700\) += [0-9]*
+msgsnd\([0-9]*, \{233811181, "STRACE_STRING\\0"\}, 14, 0\) += 0
+msgrcv\([0-9]*, \{233811181, "STRACE_STRING\\0"\}, 14, 233811181, 0\) += 14
+msgctl\([0-9]*, (IPC_64\|)?IPC_RMID, NULL\) += 0
--- /dev/null
+#!/bin/sh
+
+# Check msgget, msgsnd, msgrcv, msgctl syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog
+run_strace -v -e msgget,msgsnd,msgrcv,msgctl $args
+match_grep
+
+exit 0