* tests/oldfstat.c: New file.
* tests/oldlstat.c: Likewise.
* tests/oldstat.c: Likewise.
* tests/oldfstat.test: New test.
* tests/oldlstat.test: Likewise.
* tests/oldstat.test: Likewise.
* tests/xstatx.c [!OLD_STAT]: define OLD_STAT to 0.
(print_stat) [OLD_STAT]: Print predefined values for
st_blksize/st_blocks.
(print_stat): Check for !OLD_STAT in nanosecond precision checks.
(main) [OLD_STAT]: Ignore EOVERFLOW.
(main): Test for successful rc in returned size value check;
print address only on non-successful rc.
* tests/.gitignore: Add oldfstat, oldlstat, and oldstat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add oldfstat.test, oldlstat.test, and oldstat.test.
newfstatat
nsyscalls
old_mmap
+oldfstat
+oldlstat
oldselect
+oldstat
open
openat
pause
newfstatat \
nsyscalls \
old_mmap \
+ oldfstat \
+ oldlstat \
oldselect \
+ oldstat \
open \
openat \
pause \
newfstatat.test \
nsyscalls.test \
old_mmap.test \
+ oldfstat.test \
+ oldlstat.test \
oldselect.test \
+ oldstat.test \
open.test \
openat.test \
pause.test \
--- /dev/null
+/*
+ * Check decoding of oldfstat syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <asm/unistd.h>
+
+#if defined __NR_oldfstat && HAVE_STRUCT___OLD_KERNEL_STAT
+
+# define OLD_STAT 1
+# define TEST_SYSCALL_NR __NR_oldfstat
+# define TEST_SYSCALL_STR "oldfstat"
+# define STRUCT_STAT struct __old_kernel_stat
+# define STRUCT_STAT_STR "struct __old_kernel_stat"
+# define STRUCT_STAT_IS_STAT64 0
+# define SAMPLE_SIZE ((kernel_ulong_t) 23147718418U)
+# include "fstatx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_oldfstat && HAVE_STRUCT___OLD_KERNEL_STAT")
+
+#endif
--- /dev/null
+#!/bin/sh
+
+# Check oldfstat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+# strace -P is implemented using /proc/self/fd
+[ -d /proc/self/fd/ ] ||
+ framework_skip_ '/proc/self/fd/ is not available'
+
+syscall=$NAME
+run_prog > /dev/null
+sample=$syscall.sample
+> "$sample"
+run_strace -ve$syscall -P$sample -a21 $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"
+
+exit 0
--- /dev/null
+/*
+ * Check decoding of oldlstat syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <asm/unistd.h>
+
+#if defined __NR_oldlstat && HAVE_STRUCT___OLD_KERNEL_STAT
+
+# define OLD_STAT 1
+# define TEST_SYSCALL_NR __NR_oldlstat
+# define TEST_SYSCALL_STR "oldlstat"
+# define STRUCT_STAT struct __old_kernel_stat
+# define STRUCT_STAT_STR "struct __old_kernel_stat"
+# define STRUCT_STAT_IS_STAT64 0
+# define SAMPLE_SIZE ((kernel_ulong_t) 23147718418U)
+# include "lstatx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_oldlstat && HAVE_STRUCT___OLD_KERNEL_STAT")
+
+#endif
--- /dev/null
+#!/bin/sh
+
+# Check oldlstat syscall decoding.
+
+. "${srcdir=.}/statx.sh"
--- /dev/null
+/*
+ * Check decoding of oldstat syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <asm/unistd.h>
+
+#if defined __NR_oldstat && HAVE_STRUCT___OLD_KERNEL_STAT
+
+# define OLD_STAT 1
+# define TEST_SYSCALL_NR __NR_oldstat
+# define TEST_SYSCALL_STR "oldstat"
+# define STRUCT_STAT struct __old_kernel_stat
+# define STRUCT_STAT_STR "struct __old_kernel_stat"
+# define STRUCT_STAT_IS_STAT64 0
+# define SAMPLE_SIZE ((kernel_ulong_t) 131478418U)
+# include "lstatx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_oldstat && HAVE_STRUCT___OLD_KERNEL_STAT")
+
+#endif
--- /dev/null
+#!/bin/sh
+
+# Check oldstat syscall decoding.
+
+. "${srcdir=.}/statx.sh"
# define IS_STAT 0
# endif
+# ifndef OLD_STAT
+# define OLD_STAT 0
+# endif
+
static void
print_ftype(const unsigned int mode)
{
printf(", st_nlink=%llu", zero_extend_signed_to_ull(st->st_nlink));
printf(", st_uid=%llu", zero_extend_signed_to_ull(st->st_uid));
printf(", st_gid=%llu", zero_extend_signed_to_ull(st->st_gid));
+# if OLD_STAT
+ printf(", st_blksize=0, st_blocks=0");
+# else /* !OLD_STAT */
printf(", st_blksize=%llu", zero_extend_signed_to_ull(st->st_blksize));
printf(", st_blocks=%llu", zero_extend_signed_to_ull(st->st_blocks));
+# endif /* OLD_STAT */
switch (st->st_mode & S_IFMT) {
case S_IFCHR: case S_IFBLK:
printf(", st_atime=");
print_time(sign_extend_unsigned_to_ll(st->st_atime));
-# ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
+# if defined(HAVE_STRUCT_STAT_ST_MTIME_NSEC) && !OLD_STAT
if (st->st_atime_nsec)
printf(".%09llu", zero_extend_signed_to_ull(st->st_atime_nsec));
# endif
printf(", st_mtime=");
print_time(sign_extend_unsigned_to_ll(st->st_mtime));
-# ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
+# if defined(HAVE_STRUCT_STAT_ST_MTIME_NSEC) && !OLD_STAT
if (st->st_mtime_nsec)
printf(".%09llu", zero_extend_signed_to_ull(st->st_mtime_nsec));
# endif
printf(", st_ctime=");
print_time(sign_extend_unsigned_to_ll(st->st_ctime));
-# ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
+# if defined(HAVE_STRUCT_STAT_ST_MTIME_NSEC) && !OLD_STAT
if (st->st_ctime_nsec)
printf(".%09llu", zero_extend_signed_to_ull(st->st_ctime_nsec));
# endif
# endif
if ((rc = TEST_SYSCALL_INVOKE(sample, st))) {
- perror(TEST_SYSCALL_STR);
- (void) unlink(sample);
- return 77;
+# if OLD_STAT
+ if (errno != EOVERFLOW)
+# endif
+ {
+ perror(TEST_SYSCALL_STR);
+ (void) unlink(sample);
+ return 77;
+ }
}
(void) unlink(sample);
- if (zero_extend_signed_to_ull(SAMPLE_SIZE) !=
+ if (!rc && zero_extend_signed_to_ull(SAMPLE_SIZE) !=
zero_extend_signed_to_ull(st[0].st_size)) {
fprintf(stderr, "Size mismatch: "
"requested size(%llu) != st_size(%llu)\n",
", sizeof(st_size) = %zu\n",
STRUCT_STAT_STR, offsetof(STRUCT_STAT, st_size),
sizeof(st[0].st_size));
+# if !OLD_STAT
fprintf(stderr, "offsetof(%s, st_blksize) = %zu"
", sizeof(st_blksize) = %zu\n",
STRUCT_STAT_STR, offsetof(STRUCT_STAT, st_blksize),
", sizeof(st_blocks) = %zu\n",
STRUCT_STAT_STR, offsetof(STRUCT_STAT, st_blocks),
sizeof(st[0].st_blocks));
+# endif /* !OLD_STAT */
return 77;
}
PRINT_SYSCALL_HEADER(sample);
- print_stat(st);
+ if (rc)
+ printf("%p", st);
+ else
+ print_stat(st);
PRINT_SYSCALL_FOOTER(rc);
puts("+++ exited with 0 +++");