* tests/mknodat.c: New file.
* tests/mknodat.test: New test.
* tests/.gitignore: Add mknodat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mknodat.test.
---
 tests/.gitignore   |  1 +
 tests/Makefile.am  |  2 ++
 tests/mknodat.c    | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/mknodat.test |  6 ++++++
 4 files changed, 50 insertions(+)
 create mode 100644 tests/mknodat.c
 create mode 100755 tests/mknodat.test

diff --git a/tests/.gitignore b/tests/.gitignore
index 72a2e1d..6f056a2 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -108,6 +108,7 @@ mincore
 mkdir
 mkdirat
 mknod
+mknodat
 mlock2
 mlockall
 mmap
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1baf45b..e3ffc1c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -160,6 +160,7 @@ check_PROGRAMS = \
        mkdir \
        mkdirat \
        mknod \
+       mknodat \
        mlock2 \
        mlockall \
        mmap \
@@ -420,6 +421,7 @@ DECODER_TESTS = \
        mkdir.test \
        mkdirat.test \
        mknod.test \
+       mknodat.test \
        mlock2.test \
        mlockall.test \
        mmap.test \
diff --git a/tests/mknodat.c b/tests/mknodat.c
new file mode 100644
index 0000000..2cdc47c
--- /dev/null
+++ b/tests/mknodat.c
@@ -0,0 +1,41 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_mknodat
+
+# include <stdio.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+# ifdef MAJOR_IN_SYSMACROS
+#  include <sys/sysmacros.h>
+# endif
+# ifdef MAJOR_IN_MKDEV
+#  include <sys/mkdev.h>
+# endif
+
+int
+main(void)
+{
+       static const char sample[] = "mknokat_sample";
+       const long int fd = (long int) 0xdeadbeefffffffff;
+       long rc = syscall(__NR_mknodat, fd, sample, S_IFREG|0600, 0);
+       printf("mknodat(%d, \"%s\", S_IFREG|0600) = %ld %s (%m)\n",
+              (int) fd, sample, rc, errno2name());
+
+       const unsigned long dev =
+               (unsigned long) 0xdeadbeef00000000 | makedev(1, 7);
+
+       rc = syscall(__NR_mknodat, fd, sample, S_IFCHR | 0400, dev);
+       printf("mknodat(%d, \"%s\", S_IFCHR|0400, makedev(1, 7)) = %ld %s 
(%m)\n",
+              (int) fd, sample, rc, errno2name());
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mknodat")
+
+#endif
diff --git a/tests/mknodat.test b/tests/mknodat.test
new file mode 100755
index 0000000..edf0498
--- /dev/null
+++ b/tests/mknodat.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check mknodat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
-- 
1.8.3.1




------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to