O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.
* open.c (STRACE_O_TMPFILE): New macro.
(decode_open): Print the mode argument when O_TMPFILE flag is set.
* tests/open.c (main): Check it.
Fixes RH#
1377846.
tprints(sprint_open_modes(flags) + sizeof("flags"));
}
+#ifdef O_TMPFILE
+/* The kernel & C libraries often inline O_DIRECTORY. */
+# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY)
+#else /* !O_TMPFILE */
+# define STRACE_O_TMPFILE 0
+#endif
+
static int
decode_open(struct tcb *tcp, int offset)
{
tprints(", ");
/* flags */
tprint_open_modes(tcp->u_arg[offset + 1]);
- if (tcp->u_arg[offset + 1] & O_CREAT) {
+ if (tcp->u_arg[offset + 1] & (O_CREAT | STRACE_O_TMPFILE)) {
/* mode */
tprints(", ");
print_numeric_umode_t(tcp->u_arg[offset + 2]);
sample, sprintrc(fd));
}
+#ifdef O_TMPFILE
+# if O_TMPFILE == (O_TMPFILE & ~O_DIRECTORY)
+# define STR_O_TMPFILE "O_TMPFILE"
+# else
+# define STR_O_TMPFILE "O_DIRECTORY|O_TMPFILE"
+# endif
+ fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600);
+ printf("open(\"%s\", O_WRONLY|%s, 0600) = %s\n",
+ sample, STR_O_TMPFILE, sprintrc(fd));
+#endif /* O_TMPFILE */
+
puts("+++ exited with 0 +++");
return 0;
}