* tests/flock.c: New file.
* tests/flock.test: New test.
* tests/.gitignore: Add flock.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add flock.test.
---
 tests/.gitignore  |  1 +
 tests/Makefile.am |  2 ++
 tests/flock.c     | 28 ++++++++++++++++++++++++++++
 tests/flock.test  | 11 +++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 tests/flock.c
 create mode 100755 tests/flock.test

diff --git a/tests/.gitignore b/tests/.gitignore
index b89796a..6059af9 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -35,6 +35,7 @@ fcntl
 fcntl64
 file_handle
 filter-unavailable
+flock
 fork-f
 fstat
 fstat64
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 59e7e78..6d1c771 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -85,6 +85,7 @@ check_PROGRAMS = \
        fcntl64 \
        file_handle \
        filter-unavailable \
+       flock \
        fork-f \
        fstat \
        fstat64 \
@@ -258,6 +259,7 @@ TESTS = \
        fcntl64.test \
        file_handle.test \
        filter-unavailable.test \
+       flock.test \
        fork-f.test \
        fstat.test \
        fstat64.test \
diff --git a/tests/flock.c b/tests/flock.c
new file mode 100644
index 0000000..cd25185
--- /dev/null
+++ b/tests/flock.c
@@ -0,0 +1,28 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_flock
+
+# include <errno.h>
+# include <sys/file.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+       const unsigned long fd = (long int) 0xdeadbeefffffffff;
+       int rc = syscall(__NR_flock, fd, LOCK_SH);
+       printf("flock(%d, LOCK_SH) = %d %s (%m)\n",
+              (int) fd, rc,
+              errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_flock")
+
+#endif
diff --git a/tests/flock.test b/tests/flock.test
new file mode 100755
index 0000000..771af7d
--- /dev/null
+++ b/tests/flock.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Check flock syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -eflock -a19 $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"
-- 
1.8.3.1




------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to