Date: Wed, 28 Jun 2017 09:22:46 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320448 - in head: contrib/pjdfstest contrib/pjdfstest/tests contrib/pjdfstest/tests/chflags contrib/pjdfstest/tests/chmod contrib/pjdfstest/tests/chown contrib/pjdfstest/tests/ftruncat... Message-ID: <201706280922.v5S9MkTZ021682@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Wed Jun 28 09:22:45 2017 New Revision: 320448 URL: https://svnweb.freebsd.org/changeset/base/320448 Log: Pull down pjdfstest 0.1 The summary of changes is as follows.. Generic changes:: - Added configure support [2]. - Check for lchmod filesystem support with create_file(..); for testcases that require lchmod, skip the testcase -- otherwise use chmod directly [1]. - Added Travis CI integration [2]. - Added utimensat testcases [1]. Linux support:: - Fixed Linux support to pass on later supported versions of Fedora/Ubuntu [2]. - Conditionally enable posix_fallocate(2) support [2]. OSX support:: - Fixed compilation on OSX [2]. - Added partial OSX support (the test run isn't fully green yet) [2]. MFC after: 2 months Obtained from: https://github.com/pjd/pjdfstest/tree/0.1 Relnotes: yes Submitted by: asomers [1], ngie [2] Tested with: UFS, ZFS Added: head/contrib/pjdfstest/.gitignore - copied unchanged from r320447, vendor/pjdfstest/dist/.gitignore head/contrib/pjdfstest/.travis.yml - copied unchanged from r320447, vendor/pjdfstest/dist/.travis.yml head/contrib/pjdfstest/AUTHORS - copied unchanged from r320447, vendor/pjdfstest/dist/AUTHORS head/contrib/pjdfstest/COPYING - copied unchanged from r320447, vendor/pjdfstest/dist/COPYING head/contrib/pjdfstest/ChangeLog - copied unchanged from r320447, vendor/pjdfstest/dist/ChangeLog head/contrib/pjdfstest/Makefile.am - copied unchanged from r320447, vendor/pjdfstest/dist/Makefile.am head/contrib/pjdfstest/NEWS - copied unchanged from r320447, vendor/pjdfstest/dist/NEWS head/contrib/pjdfstest/configure.ac - copied unchanged from r320447, vendor/pjdfstest/dist/configure.ac head/contrib/pjdfstest/tests/utimensat/ - copied from r320447, vendor/pjdfstest/dist/tests/utimensat/ head/contrib/pjdfstest/travis/ - copied from r320447, vendor/pjdfstest/dist/travis/ head/tests/sys/pjdfstest/config.h (contents, props changed) head/tests/sys/pjdfstest/tests/utimensat/ head/tests/sys/pjdfstest/tests/utimensat/Makefile - copied, changed from r320415, head/tests/sys/pjdfstest/tests/chown/Makefile Deleted: head/contrib/pjdfstest/Makefile Modified: head/contrib/pjdfstest/README head/contrib/pjdfstest/pjdfstest.c head/contrib/pjdfstest/tests/chflags/00.t head/contrib/pjdfstest/tests/chflags/01.t head/contrib/pjdfstest/tests/chflags/02.t head/contrib/pjdfstest/tests/chflags/03.t head/contrib/pjdfstest/tests/chflags/04.t head/contrib/pjdfstest/tests/chflags/05.t head/contrib/pjdfstest/tests/chflags/06.t head/contrib/pjdfstest/tests/chflags/07.t head/contrib/pjdfstest/tests/chflags/08.t head/contrib/pjdfstest/tests/chflags/09.t head/contrib/pjdfstest/tests/chflags/10.t head/contrib/pjdfstest/tests/chflags/11.t head/contrib/pjdfstest/tests/chflags/12.t head/contrib/pjdfstest/tests/chflags/13.t head/contrib/pjdfstest/tests/chmod/00.t head/contrib/pjdfstest/tests/chmod/01.t head/contrib/pjdfstest/tests/chmod/02.t head/contrib/pjdfstest/tests/chmod/03.t head/contrib/pjdfstest/tests/chmod/04.t head/contrib/pjdfstest/tests/chmod/05.t head/contrib/pjdfstest/tests/chmod/06.t head/contrib/pjdfstest/tests/chmod/07.t head/contrib/pjdfstest/tests/chmod/08.t head/contrib/pjdfstest/tests/chmod/09.t head/contrib/pjdfstest/tests/chmod/10.t head/contrib/pjdfstest/tests/chmod/11.t head/contrib/pjdfstest/tests/chmod/12.t head/contrib/pjdfstest/tests/chown/00.t head/contrib/pjdfstest/tests/chown/01.t head/contrib/pjdfstest/tests/chown/02.t head/contrib/pjdfstest/tests/chown/03.t head/contrib/pjdfstest/tests/chown/04.t head/contrib/pjdfstest/tests/chown/05.t head/contrib/pjdfstest/tests/chown/06.t head/contrib/pjdfstest/tests/chown/07.t head/contrib/pjdfstest/tests/chown/08.t head/contrib/pjdfstest/tests/chown/09.t head/contrib/pjdfstest/tests/chown/10.t head/contrib/pjdfstest/tests/conf head/contrib/pjdfstest/tests/ftruncate/00.t head/contrib/pjdfstest/tests/ftruncate/01.t head/contrib/pjdfstest/tests/ftruncate/02.t head/contrib/pjdfstest/tests/ftruncate/03.t head/contrib/pjdfstest/tests/ftruncate/04.t head/contrib/pjdfstest/tests/ftruncate/05.t head/contrib/pjdfstest/tests/ftruncate/06.t head/contrib/pjdfstest/tests/ftruncate/07.t head/contrib/pjdfstest/tests/ftruncate/08.t head/contrib/pjdfstest/tests/ftruncate/09.t head/contrib/pjdfstest/tests/ftruncate/10.t head/contrib/pjdfstest/tests/ftruncate/11.t head/contrib/pjdfstest/tests/ftruncate/12.t head/contrib/pjdfstest/tests/ftruncate/13.t head/contrib/pjdfstest/tests/ftruncate/14.t head/contrib/pjdfstest/tests/granular/00.t head/contrib/pjdfstest/tests/granular/01.t head/contrib/pjdfstest/tests/granular/02.t head/contrib/pjdfstest/tests/granular/03.t head/contrib/pjdfstest/tests/granular/04.t head/contrib/pjdfstest/tests/granular/05.t head/contrib/pjdfstest/tests/link/00.t head/contrib/pjdfstest/tests/link/01.t head/contrib/pjdfstest/tests/link/02.t head/contrib/pjdfstest/tests/link/03.t head/contrib/pjdfstest/tests/link/04.t head/contrib/pjdfstest/tests/link/05.t head/contrib/pjdfstest/tests/link/06.t head/contrib/pjdfstest/tests/link/07.t head/contrib/pjdfstest/tests/link/08.t head/contrib/pjdfstest/tests/link/09.t head/contrib/pjdfstest/tests/link/10.t head/contrib/pjdfstest/tests/link/11.t head/contrib/pjdfstest/tests/link/12.t head/contrib/pjdfstest/tests/link/13.t head/contrib/pjdfstest/tests/link/14.t head/contrib/pjdfstest/tests/link/15.t head/contrib/pjdfstest/tests/link/16.t head/contrib/pjdfstest/tests/link/17.t head/contrib/pjdfstest/tests/misc.sh head/contrib/pjdfstest/tests/mkdir/00.t head/contrib/pjdfstest/tests/mkdir/01.t head/contrib/pjdfstest/tests/mkdir/02.t head/contrib/pjdfstest/tests/mkdir/03.t head/contrib/pjdfstest/tests/mkdir/04.t head/contrib/pjdfstest/tests/mkdir/05.t head/contrib/pjdfstest/tests/mkdir/06.t head/contrib/pjdfstest/tests/mkdir/07.t head/contrib/pjdfstest/tests/mkdir/08.t head/contrib/pjdfstest/tests/mkdir/09.t head/contrib/pjdfstest/tests/mkdir/10.t head/contrib/pjdfstest/tests/mkdir/11.t head/contrib/pjdfstest/tests/mkdir/12.t head/contrib/pjdfstest/tests/mkfifo/00.t head/contrib/pjdfstest/tests/mkfifo/01.t head/contrib/pjdfstest/tests/mkfifo/02.t head/contrib/pjdfstest/tests/mkfifo/03.t head/contrib/pjdfstest/tests/mkfifo/04.t head/contrib/pjdfstest/tests/mkfifo/05.t head/contrib/pjdfstest/tests/mkfifo/06.t head/contrib/pjdfstest/tests/mkfifo/07.t head/contrib/pjdfstest/tests/mkfifo/08.t head/contrib/pjdfstest/tests/mkfifo/09.t head/contrib/pjdfstest/tests/mkfifo/10.t head/contrib/pjdfstest/tests/mkfifo/11.t head/contrib/pjdfstest/tests/mkfifo/12.t head/contrib/pjdfstest/tests/mknod/00.t head/contrib/pjdfstest/tests/mknod/01.t head/contrib/pjdfstest/tests/mknod/02.t head/contrib/pjdfstest/tests/mknod/03.t head/contrib/pjdfstest/tests/mknod/04.t head/contrib/pjdfstest/tests/mknod/05.t head/contrib/pjdfstest/tests/mknod/06.t head/contrib/pjdfstest/tests/mknod/07.t head/contrib/pjdfstest/tests/mknod/08.t head/contrib/pjdfstest/tests/mknod/09.t head/contrib/pjdfstest/tests/mknod/10.t head/contrib/pjdfstest/tests/mknod/11.t head/contrib/pjdfstest/tests/open/00.t head/contrib/pjdfstest/tests/open/01.t head/contrib/pjdfstest/tests/open/02.t head/contrib/pjdfstest/tests/open/03.t head/contrib/pjdfstest/tests/open/04.t head/contrib/pjdfstest/tests/open/05.t head/contrib/pjdfstest/tests/open/06.t head/contrib/pjdfstest/tests/open/07.t head/contrib/pjdfstest/tests/open/08.t head/contrib/pjdfstest/tests/open/09.t head/contrib/pjdfstest/tests/open/10.t head/contrib/pjdfstest/tests/open/11.t head/contrib/pjdfstest/tests/open/12.t head/contrib/pjdfstest/tests/open/13.t head/contrib/pjdfstest/tests/open/14.t head/contrib/pjdfstest/tests/open/15.t head/contrib/pjdfstest/tests/open/16.t head/contrib/pjdfstest/tests/open/17.t head/contrib/pjdfstest/tests/open/18.t head/contrib/pjdfstest/tests/open/19.t head/contrib/pjdfstest/tests/open/20.t head/contrib/pjdfstest/tests/open/21.t head/contrib/pjdfstest/tests/open/22.t head/contrib/pjdfstest/tests/open/23.t head/contrib/pjdfstest/tests/open/24.t head/contrib/pjdfstest/tests/rename/00.t head/contrib/pjdfstest/tests/rename/01.t head/contrib/pjdfstest/tests/rename/02.t head/contrib/pjdfstest/tests/rename/03.t head/contrib/pjdfstest/tests/rename/04.t head/contrib/pjdfstest/tests/rename/05.t head/contrib/pjdfstest/tests/rename/06.t head/contrib/pjdfstest/tests/rename/07.t head/contrib/pjdfstest/tests/rename/08.t head/contrib/pjdfstest/tests/rename/09.t head/contrib/pjdfstest/tests/rename/10.t head/contrib/pjdfstest/tests/rename/11.t head/contrib/pjdfstest/tests/rename/12.t head/contrib/pjdfstest/tests/rename/13.t head/contrib/pjdfstest/tests/rename/14.t head/contrib/pjdfstest/tests/rename/15.t head/contrib/pjdfstest/tests/rename/16.t head/contrib/pjdfstest/tests/rename/17.t head/contrib/pjdfstest/tests/rename/18.t head/contrib/pjdfstest/tests/rename/19.t head/contrib/pjdfstest/tests/rename/20.t head/contrib/pjdfstest/tests/rename/21.t head/contrib/pjdfstest/tests/rmdir/00.t head/contrib/pjdfstest/tests/rmdir/01.t head/contrib/pjdfstest/tests/rmdir/02.t head/contrib/pjdfstest/tests/rmdir/03.t head/contrib/pjdfstest/tests/rmdir/04.t head/contrib/pjdfstest/tests/rmdir/05.t head/contrib/pjdfstest/tests/rmdir/06.t head/contrib/pjdfstest/tests/rmdir/07.t head/contrib/pjdfstest/tests/rmdir/08.t head/contrib/pjdfstest/tests/rmdir/09.t head/contrib/pjdfstest/tests/rmdir/10.t head/contrib/pjdfstest/tests/rmdir/11.t head/contrib/pjdfstest/tests/rmdir/12.t head/contrib/pjdfstest/tests/rmdir/13.t head/contrib/pjdfstest/tests/rmdir/14.t head/contrib/pjdfstest/tests/rmdir/15.t head/contrib/pjdfstest/tests/symlink/00.t head/contrib/pjdfstest/tests/symlink/01.t head/contrib/pjdfstest/tests/symlink/02.t head/contrib/pjdfstest/tests/symlink/03.t head/contrib/pjdfstest/tests/symlink/04.t head/contrib/pjdfstest/tests/symlink/05.t head/contrib/pjdfstest/tests/symlink/06.t head/contrib/pjdfstest/tests/symlink/07.t head/contrib/pjdfstest/tests/symlink/08.t head/contrib/pjdfstest/tests/symlink/09.t head/contrib/pjdfstest/tests/symlink/10.t head/contrib/pjdfstest/tests/symlink/11.t head/contrib/pjdfstest/tests/symlink/12.t head/contrib/pjdfstest/tests/truncate/00.t head/contrib/pjdfstest/tests/truncate/01.t head/contrib/pjdfstest/tests/truncate/02.t head/contrib/pjdfstest/tests/truncate/03.t head/contrib/pjdfstest/tests/truncate/04.t head/contrib/pjdfstest/tests/truncate/05.t head/contrib/pjdfstest/tests/truncate/06.t head/contrib/pjdfstest/tests/truncate/07.t head/contrib/pjdfstest/tests/truncate/08.t head/contrib/pjdfstest/tests/truncate/09.t head/contrib/pjdfstest/tests/truncate/10.t head/contrib/pjdfstest/tests/truncate/11.t head/contrib/pjdfstest/tests/truncate/12.t head/contrib/pjdfstest/tests/truncate/13.t head/contrib/pjdfstest/tests/truncate/14.t head/contrib/pjdfstest/tests/unlink/00.t head/contrib/pjdfstest/tests/unlink/01.t head/contrib/pjdfstest/tests/unlink/02.t head/contrib/pjdfstest/tests/unlink/03.t head/contrib/pjdfstest/tests/unlink/04.t head/contrib/pjdfstest/tests/unlink/05.t head/contrib/pjdfstest/tests/unlink/06.t head/contrib/pjdfstest/tests/unlink/07.t head/contrib/pjdfstest/tests/unlink/08.t head/contrib/pjdfstest/tests/unlink/09.t head/contrib/pjdfstest/tests/unlink/10.t head/contrib/pjdfstest/tests/unlink/11.t head/contrib/pjdfstest/tests/unlink/12.t head/contrib/pjdfstest/tests/unlink/13.t head/etc/mtree/BSD.tests.dist head/tests/sys/pjdfstest/pjdfstest/Makefile head/tests/sys/pjdfstest/tests/Makefile Directory Properties: head/contrib/pjdfstest/ (props changed) Copied: head/contrib/pjdfstest/.gitignore (from r320447, vendor/pjdfstest/dist/.gitignore) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/pjdfstest/.gitignore Wed Jun 28 09:22:45 2017 (r320448, copy of r320447, vendor/pjdfstest/dist/.gitignore) @@ -0,0 +1,19 @@ +autom4te.cache +aclocal.m4 +compile +configure +config.h* +config.guess +config.log +config.status +config.sub +depcomp +install-sh +missing +pjdfstest +stamp-h1 +INSTALL +Makefile +Makefile.in +.deps +*.o Copied: head/contrib/pjdfstest/.travis.yml (from r320447, vendor/pjdfstest/dist/.travis.yml) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/pjdfstest/.travis.yml Wed Jun 28 09:22:45 2017 (r320448, copy of r320447, vendor/pjdfstest/dist/.travis.yml) @@ -0,0 +1,19 @@ +language: c +sudo: required + +matrix: + include: + - os: linux + compiler: clang + dist: xenial + - os: linux + compiler: gcc + dist: xenial + - os: osx + compiler: clang + - os: osx + compiler: gcc + +script: + - ./travis/build.sh + - ./travis/test.sh Copied: head/contrib/pjdfstest/AUTHORS (from r320447, vendor/pjdfstest/dist/AUTHORS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/pjdfstest/AUTHORS Wed Jun 28 09:22:45 2017 (r320448, copy of r320447, vendor/pjdfstest/dist/AUTHORS) @@ -0,0 +1,3 @@ +* Alan Somers <asomers@FreeBSD.org> - contributor/co-maintainer +* Ngie Cooper <ngie@FreeBSD.org> - contributor/co-maintainer +* Pawel Jakub Dawidek <pawel@dawidek.net> - pjdfstest author/maintainer Copied: head/contrib/pjdfstest/COPYING (from r320447, vendor/pjdfstest/dist/COPYING) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/pjdfstest/COPYING Wed Jun 28 09:22:45 2017 (r320448, copy of r320447, vendor/pjdfstest/dist/COPYING) @@ -0,0 +1,27 @@ +$FreeBSD: head/tools/regression/pjdfstest/LICENSE 211354 2010-08-15 21:29:03Z pjd $ + +License for all regression tests available with pjdfstest: + +Copyright (c) 2006-2012 Pawel Jakub Dawidek <pawel@dawidek.net> +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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``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 AUTHORS OR CONTRIBUTORS 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. Copied: head/contrib/pjdfstest/ChangeLog (from r320447, vendor/pjdfstest/dist/ChangeLog) ============================================================================== Copied: head/contrib/pjdfstest/Makefile.am (from r320447, vendor/pjdfstest/dist/Makefile.am) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/pjdfstest/Makefile.am Wed Jun 28 09:22:45 2017 (r320448, copy of r320447, vendor/pjdfstest/dist/Makefile.am) @@ -0,0 +1,5 @@ +AM_CFLAGS= -Wall -Werror + +bin_PROGRAMS= pjdfstest + +pjdfstest_SOURCES= pjdfstest.c Copied: head/contrib/pjdfstest/NEWS (from r320447, vendor/pjdfstest/dist/NEWS) ============================================================================== Modified: head/contrib/pjdfstest/README ============================================================================== --- head/contrib/pjdfstest/README Wed Jun 28 08:48:09 2017 (r320447) +++ head/contrib/pjdfstest/README Wed Jun 28 09:22:45 2017 (r320448) @@ -1,22 +1,57 @@ $FreeBSD: head/tools/regression/pjdfstest/README 211354 2010-08-15 21:29:03Z pjd $ -Few notes on how to use pjdfstest in short steps: +============ +Introduction +============ - # cd pjdfstest - # vi tests/conf - Change 'fs' to file system type you want to test (UFS or ZFS). - # vi Makefile - You need to manually tweak few things by editing CFLAGS lines - at the top of the file. - # make - It will compile pjdfstest utility which is used by regression tests. - # cd /path/to/file/system/you/want/to/test/ - # prove -r /path/to/pjdfstest/tests +pjdfstest is a test suite that helps exercise POSIX system calls. -That's all. Enjoy. +pjdfstest supports the following operating systems/filesystems: -Currently supported operating systems: FreeBSD, Solaris. -Currently supported file system types: UFS, ZFS. +- Supported Operating Systems: FreeBSD, Linux, Solaris +- Supported Filesystems: ext4, UFS, ZFS --- -Pawel Jakub Dawidek <pawel@dawidek.net> +================== +Building pjdfstest +================== + +------------- +Prerequisites +------------- + +- autoconf 2.69 or newer +- automake 1.15 or newer +- cc (clang or gcc) +- make +- appropriate system headers (please install your distribution appropriate + header package) + +--------- +Procedure +--------- + + $ autoreconf -ifs + $ ./configure + $ make pjdfstest + +================= +Running pjdfstest +================= + +------------- +Prerequisites +------------- +- You must be root when running these testcases. + +---------------------- +Software Prerequisites +---------------------- +- perl +- TAP-Harness (perl package) + +--------- +Procedure +--------- + + # cd /path/to/filesystem/under/test + # prove -rv /path/to/pjdfstest/tests Copied: head/contrib/pjdfstest/configure.ac (from r320447, vendor/pjdfstest/dist/configure.ac) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/pjdfstest/configure.ac Wed Jun 28 09:22:45 2017 (r320448, copy of r320447, vendor/pjdfstest/dist/configure.ac) @@ -0,0 +1,107 @@ +AC_PREREQ(2.61) +AC_INIT([pjdfstest],[0.1],) +AC_CONFIG_AUX_DIR([.]) +AM_INIT_AUTOMAKE +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([ \ + Makefile \ +]) + +AC_CANONICAL_HOST + +AC_PROG_CC([cc]) + +# For _GNU_SOURCE on Linux, etc. +AC_USE_SYSTEM_EXTENSIONS + +AC_CHECK_HEADERS([ \ + sys/mkdev.h \ +]) + +#HAS_FREEBSD_ACL + +AC_CHECK_FUNC([bindat], + [AC_DEFINE([HAVE_BINDAT], [1], [Define if bindat exists])]) +AC_CHECK_FUNC([chflags], + [AC_DEFINE([HAVE_CHFLAGS], [1], [Define if chflags exists])]) +AC_CHECK_FUNC([chflagsat], + [AC_DEFINE([HAVE_CHFLAGSAT], [1], [Define if chflagsat exists])]) +AC_CHECK_FUNC([connectat], + [AC_DEFINE([HAVE_CONNECTAT], [1], [Define if connectat exists])]) +AC_CHECK_FUNC([faccessat], + [AC_DEFINE([HAVE_FACCESSAT], [1], [Define if faccessat exists])]) +AC_CHECK_FUNC([fchflags], + [AC_DEFINE([HAVE_FCHFLAGS], [1], [Define if fchflags exists])]) +AC_CHECK_FUNC([fchmodat], + [AC_DEFINE([HAVE_FCHMODAT], [1], [Define if fchmodat exists])]) +AC_CHECK_FUNC([fchownat], + [AC_DEFINE([HAVE_FCHOWNAT], [1], [Define if fchownat exists])]) +AC_CHECK_FUNC([fstatat], + [AC_DEFINE([HAVE_FSTATAT], [1], [Define if fstatat exists])]) +AC_CHECK_FUNC([lchflags], + [AC_DEFINE([HAVE_LCHFLAGS], [1], [Define if lchflags exists])]) +AC_CHECK_FUNC([lchmod], + [AC_DEFINE([HAVE_LCHMOD], [1], [Define if lchmod exists])]) +AC_CHECK_FUNC([linkat], + [AC_DEFINE([HAVE_LINKAT], [1], [Define if linkat exists])]) +AC_CHECK_FUNC([lpathconf], + [AC_DEFINE([HAVE_LPATHCONF], [1], [Define if lpathconf exists])]) +AC_CHECK_FUNC([mkdirat], + [AC_DEFINE([HAVE_MKDIRAT], [1], [Define if mkdirat exists])]) +AC_CHECK_FUNC([mkfifoat], + [AC_DEFINE([HAVE_MKFIFOAT], [1], [Define if mkfifoat exists])]) +AC_CHECK_FUNC([mknodat], + [AC_DEFINE([HAVE_MKNODAT], [1], [Define if mknodat exists])]) +AC_CHECK_FUNC([openat], + [AC_DEFINE([HAVE_OPENAT], [1], [Define if openat exists])]) +AC_CHECK_FUNC([posix_fallocate], + [AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [Define if posix_fallocate exists])]) +AC_CHECK_FUNC([readlinkat], + [AC_DEFINE([HAVE_READLINKAT], [1], [Define if readlinkat exists])]) +AC_CHECK_FUNC([renameat], + [AC_DEFINE([HAVE_RENAMEAT], [1], [Define if renameat exists])]) +AC_CHECK_FUNC([symlinkat], + [AC_DEFINE([HAVE_SYMLINKAT], [1], [Define if symlinkat exists])]) +AC_CHECK_FUNC([utimensat], + [AC_DEFINE([HAVE_UTIMENSAT], [1], [Define if utimensat exists])]) + +# ACL test battery. +AC_CHECK_HEADER([sys/acl.h], [has_sys_acl_h=yes], [has_sys_acl_h=no]) +has_acl_funcs=no +if test x$has_sys_acl_h = xyes; then + AC_DEFINE([HAVE_SYS_ACL_H], [1], + [Define to 1 if sys/acl.h is available]) + AC_CHECK_FUNCS([acl_create_entry_np acl_from_text acl_get_entry acl_get_file acl_set_file], + [has_acl_funcs=yes],[]) +fi +if test x$has_acl_funcs = xyes; then + # Check for NFSv4 ACL support. + AC_CHECK_DECL([ACL_TYPE_NFS4], + [has_nfsv4_acl_support=yes], [has_nfsv4_acl_support=no],[[#include <sys/acl.h>]]) + if test x$has_nfsv4_acl_support = xyes; then + AC_DEFINE([HAS_NFSV4_ACL_SUPPORT], [1], + [Define to 1 if NFSv4 ACL support is available]) + fi +fi + +AC_CHECK_MEMBERS([struct stat.st_atim, struct stat.st_atimespec], [], [], [[ +#include <sys/types.h> +#include <sys/stat.h> +]]) + +AC_CHECK_MEMBERS([struct stat.st_birthtim, struct stat.st_birthtime, struct stat.st_birthtimespec], [], [], [[ +#include <sys/types.h> +#include <sys/stat.h> +]]) + +AC_CHECK_MEMBERS([struct stat.st_ctim, struct stat.st_ctimespec], [], [], [[ +#include <sys/types.h> +#include <sys/stat.h> +]]) + +AC_CHECK_MEMBERS([struct stat.st_mtim, struct stat.st_mtimespec], [], [], [[ +#include <sys/types.h> +#include <sys/stat.h> +]]) + +AC_OUTPUT Modified: head/contrib/pjdfstest/pjdfstest.c ============================================================================== --- head/contrib/pjdfstest/pjdfstest.c Wed Jun 28 08:48:09 2017 (r320447) +++ head/contrib/pjdfstest/pjdfstest.c Wed Jun 28 09:22:45 2017 (r320448) @@ -26,14 +26,19 @@ * $FreeBSD$ */ +/* Needs to be first to twiddle appropriate system configuration/HAVE_* flags */ +#include "config.h" + #include <sys/param.h> -#include <sys/types.h> +#ifdef HAVE_SYS_ACL_H +#include <sys/acl.h> +#endif +#ifdef HAVE_SYS_MKDEV_H +#include <sys/mkdev.h> +#endif #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> -#ifndef makedev -#include <sys/mkdev.h> -#endif #include <assert.h> #include <ctype.h> @@ -45,18 +50,15 @@ #include <string.h> #include <unistd.h> -#ifndef HAS_TRUNCATE64 -#define truncate64 truncate -#define ftruncate64 ftruncate +#ifdef __sun__ +#define _USE_STAT64 #endif -#ifndef HAS_STAT64 -#define stat64 stat -#define fstat64 fstat -#define lstat64 lstat + +#ifdef _USE_STAT64 +typedef struct stat64 stat_t; +#else +typedef struct stat stat_t; #endif -#ifdef HAS_FREEBSD_ACL -#include <sys/acl.h> -#endif #ifndef ALLPERMS #define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) @@ -64,69 +66,91 @@ enum action { ACTION_OPEN, +#ifdef HAVE_OPENAT ACTION_OPENAT, +#endif ACTION_CREATE, ACTION_UNLINK, +#ifdef HAVE_UNLINKAT ACTION_UNLINKAT, +#endif ACTION_MKDIR, +#ifdef HAVE_MKDIRAT ACTION_MKDIRAT, +#endif ACTION_RMDIR, ACTION_LINK, +#ifdef HAVE_LINKAT ACTION_LINKAT, +#endif ACTION_SYMLINK, +#ifdef HAVE_SYMLINKAT ACTION_SYMLINKAT, +#endif ACTION_RENAME, +#ifdef HAVE_RENAMEAT ACTION_RENAMEAT, +#endif ACTION_MKFIFO, +#ifdef HAVE_MKFIFOAT ACTION_MKFIFOAT, +#endif ACTION_MKNOD, ACTION_MKNODAT, ACTION_BIND, -#ifdef HAS_BINDAT +#ifdef HAVE_BINDAT ACTION_BINDAT, #endif ACTION_CONNECT, -#ifdef HAS_CONNECTAT +#ifdef HAVE_CONNECTAT ACTION_CONNECTAT, #endif ACTION_CHMOD, ACTION_FCHMOD, -#ifdef HAS_LCHMOD +#ifdef HAVE_LCHMOD ACTION_LCHMOD, #endif ACTION_FCHMODAT, ACTION_CHOWN, ACTION_FCHOWN, ACTION_LCHOWN, +#ifdef HAVE_FCHOWNAT ACTION_FCHOWNAT, -#ifdef HAS_CHFLAGS +#endif +#ifdef HAVE_CHFLAGS ACTION_CHFLAGS, #endif -#ifdef HAS_FCHFLAGS +#ifdef HAVE_FCHFLAGS ACTION_FCHFLAGS, #endif -#ifdef HAS_CHFLAGSAT +#ifdef HAVE_CHFLAGSAT ACTION_CHFLAGSAT, #endif -#ifdef HAS_LCHFLAGS +#ifdef HAVE_LCHFLAGS ACTION_LCHFLAGS, #endif ACTION_TRUNCATE, ACTION_FTRUNCATE, +#ifdef HAVE_POSIX_FALLOCATE + ACTION_POSIX_FALLOCATE, +#endif ACTION_STAT, ACTION_FSTAT, ACTION_LSTAT, ACTION_FSTATAT, ACTION_PATHCONF, ACTION_FPATHCONF, -#ifdef HAS_LPATHCONF +#ifdef HAVE_LPATHCONF ACTION_LPATHCONF, #endif -#ifdef HAS_FREEBSD_ACL +#ifdef HAS_NFSV4_ACL_SUPPORT ACTION_PREPENDACL, ACTION_READACL, #endif ACTION_WRITE, +#ifdef HAVE_UTIMENSAT + ACTION_UTIMENSAT, +#endif }; #define TYPE_NONE 0x0000 @@ -147,69 +171,104 @@ struct syscall_desc { static struct syscall_desc syscalls[] = { { "open", ACTION_OPEN, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER | TYPE_OPTIONAL, TYPE_NONE } }, +#ifdef HAVE_OPENAT { "openat", ACTION_OPENAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER | TYPE_OPTIONAL, TYPE_NONE } }, +#endif { "create", ACTION_CREATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, { "unlink", ACTION_UNLINK, { TYPE_STRING, TYPE_NONE } }, +#ifdef HAVE_UNLINKAT { "unlinkat", ACTION_UNLINKAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#endif { "mkdir", ACTION_MKDIR, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, +#ifdef HAVE_MKDIRAT { "mkdirat", ACTION_MKDIRAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, +#endif { "rmdir", ACTION_RMDIR, { TYPE_STRING, TYPE_NONE } }, { "link", ACTION_LINK, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#ifdef HAVE_LINKAT { "linkat", ACTION_LINKAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#endif { "symlink", ACTION_SYMLINK, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#ifdef HAVE_SYMLINKAT { "symlinkat", ACTION_SYMLINKAT, { TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, +#endif { "rename", ACTION_RENAME, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#ifdef HAVE_RENAMEAT { "renameat", ACTION_RENAMEAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, +#endif { "mkfifo", ACTION_MKFIFO, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, +#ifdef HAVE_MKFIFOAT { "mkfifoat", ACTION_MKFIFOAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, +#endif { "mknod", ACTION_MKNOD, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} }, +#ifdef HAVE_MKNODAT { "mknodat", ACTION_MKNODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} }, +#endif { "bind", ACTION_BIND, { TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_BINDAT +#ifdef HAVE_BINDAT { "bindat", ACTION_BINDAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, #endif { "connect", ACTION_CONNECT, { TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_CONNECTAT +#ifdef HAVE_CONNECTAT { "connectat", ACTION_CONNECTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, #endif { "chmod", ACTION_CHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, { "fchmod", ACTION_FCHMOD, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } }, -#ifdef HAS_LCHMOD +#ifdef HAVE_LCHMOD { "lchmod", ACTION_LCHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, #endif +#ifdef HAVE_FCHMODAT { "fchmodat", ACTION_FCHMODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_STRING, TYPE_NONE } }, +#endif { "chown", ACTION_CHOWN, { TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, { "fchown", ACTION_FCHOWN, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, { "lchown", ACTION_LCHOWN, { TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, +#ifdef HAVE_FCHOWNAT { "fchownat", ACTION_FCHOWNAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_CHFLAGS +#endif +#ifdef HAVE_CHFLAGS { "chflags", ACTION_CHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, #endif -#ifdef HAS_FCHFLAGS +#ifdef HAVE_FCHFLAGS { "fchflags", ACTION_FCHFLAGS, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, #endif -#ifdef HAS_CHFLAGSAT +#ifdef HAVE_CHFLAGSAT { "chflagsat", ACTION_CHFLAGSAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, #endif -#ifdef HAS_LCHFLAGS +#ifdef HAVE_LCHFLAGS { "lchflags", ACTION_LCHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, #endif { "truncate", ACTION_TRUNCATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, { "ftruncate", ACTION_FTRUNCATE, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } }, +#ifdef HAVE_POSIX_FALLOCATE + { "posix_fallocate", ACTION_POSIX_FALLOCATE, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, +#endif { "stat", ACTION_STAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "fstat", ACTION_FSTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, { "lstat", ACTION_LSTAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#ifdef HAVE_FSTATAT { "fstatat", ACTION_FSTATAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#endif { "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "fpathconf", ACTION_FPATHCONF, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_LPATHCONF +#ifdef HAVE_LPATHCONF { "lpathconf", ACTION_LPATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, #endif -#ifdef HAS_FREEBSD_ACL +#ifdef HAS_NFSV4_ACL_SUPPORT { "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } }, #endif { "write", ACTION_WRITE, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, +#ifdef HAVE_UTIMENSAT + { "utimensat", ACTION_UTIMENSAT, { + TYPE_DESCRIPTOR, /* Directory */ + TYPE_STRING, /* Relative path */ + TYPE_NUMBER, /* atime seconds */ + TYPE_STRING, /* atime nanoseconds */ + TYPE_NUMBER, /* mtime seconds */ + TYPE_STRING, /* mtime nanoseconds */ + TYPE_STRING, /* flags */}}, +#endif { NULL, -1, { TYPE_NONE } } }; @@ -219,122 +278,136 @@ struct flag { }; static struct flag open_flags[] = { -#ifdef O_RDONLY +#ifdef O_RDONLY { O_RDONLY, "O_RDONLY" }, #endif -#ifdef O_WRONLY +#ifdef O_WRONLY { O_WRONLY, "O_WRONLY" }, #endif -#ifdef O_RDWR +#ifdef O_RDWR { O_RDWR, "O_RDWR" }, #endif -#ifdef O_NONBLOCK +#ifdef O_NONBLOCK { O_NONBLOCK, "O_NONBLOCK" }, #endif -#ifdef O_APPEND +#ifdef O_APPEND { O_APPEND, "O_APPEND" }, #endif -#ifdef O_CREAT +#ifdef O_CREAT { O_CREAT, "O_CREAT" }, #endif -#ifdef O_TRUNC +#ifdef O_TRUNC { O_TRUNC, "O_TRUNC" }, #endif -#ifdef O_EXCL +#ifdef O_EXCL { O_EXCL, "O_EXCL" }, #endif -#ifdef O_SHLOCK +#ifdef O_SHLOCK { O_SHLOCK, "O_SHLOCK" }, #endif -#ifdef O_EXLOCK +#ifdef O_EXLOCK { O_EXLOCK, "O_EXLOCK" }, #endif -#ifdef O_DIRECT +#ifdef O_DIRECT { O_DIRECT, "O_DIRECT" }, #endif -#ifdef O_FSYNC +#ifdef O_FSYNC { O_FSYNC, "O_FSYNC" }, #endif -#ifdef O_SYNC +#ifdef O_SYNC { O_SYNC, "O_SYNC" }, #endif -#ifdef O_NOFOLLOW +#ifdef O_NOFOLLOW { O_NOFOLLOW, "O_NOFOLLOW" }, #endif -#ifdef O_NOCTTY +#ifdef O_NOCTTY { O_NOCTTY, "O_NOCTTY" }, #endif -#ifdef O_DIRECTORY +#ifdef O_DIRECTORY { O_DIRECTORY, "O_DIRECTORY" }, #endif { 0, NULL } }; -#ifdef HAS_CHFLAGS +#ifdef HAVE_CHFLAGS static struct flag chflags_flags[] = { -#ifdef UF_NODUMP +#ifdef UF_NODUMP { UF_NODUMP, "UF_NODUMP" }, #endif -#ifdef UF_IMMUTABLE +#ifdef UF_IMMUTABLE { UF_IMMUTABLE, "UF_IMMUTABLE" }, #endif -#ifdef UF_APPEND +#ifdef UF_APPEND { UF_APPEND, "UF_APPEND" }, #endif -#ifdef UF_NOUNLINK +#ifdef UF_NOUNLINK { UF_NOUNLINK, "UF_NOUNLINK" }, #endif -#ifdef UF_OPAQUE +#ifdef UF_OPAQUE { UF_OPAQUE, "UF_OPAQUE" }, #endif -#ifdef SF_ARCHIVED +#ifdef SF_ARCHIVED { SF_ARCHIVED, "SF_ARCHIVED" }, #endif -#ifdef SF_IMMUTABLE +#ifdef SF_IMMUTABLE { SF_IMMUTABLE, "SF_IMMUTABLE" }, #endif -#ifdef SF_APPEND +#ifdef SF_APPEND { SF_APPEND, "SF_APPEND" }, #endif -#ifdef SF_NOUNLINK +#ifdef SF_NOUNLINK { SF_NOUNLINK, "SF_NOUNLINK" }, #endif -#ifdef SF_SNAPSHOT +#ifdef SF_SNAPSHOT { SF_SNAPSHOT, "SF_SNAPSHOT" }, #endif { 0, NULL } }; #endif +#ifdef HAVE_UNLINKAT static struct flag unlinkat_flags[] = { { AT_REMOVEDIR, "AT_REMOVEDIR" }, { 0, NULL } }; +#endif +#ifdef HAVE_LINKAT static struct flag linkat_flags[] = { +#ifdef AT_SYMLINK_FOLLOW { AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" }, +#endif { 0, NULL } }; +#endif +#ifdef HAVE_CHFLAGSAT static struct flag chflagsat_flags[] = { { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, { 0, NULL } }; +#endif +#ifdef HAVE_FCHMODAT static struct flag fchmodat_flags[] = { { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, { 0, NULL } }; +#endif +#ifdef HAVE_FCHOWNAT static struct flag fchownat_flags[] = { { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, { 0, NULL } }; +#endif +#ifdef HAVE_FSTATAT static struct flag fstatat_flags[] = { { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, { 0, NULL } }; +#endif struct name { int n_name; @@ -342,16 +415,16 @@ struct name { }; static struct name pathconf_names[] = { -#ifdef _PC_LINK_MAX +#ifdef _PC_LINK_MAX { _PC_LINK_MAX, "_PC_LINK_MAX" }, #endif -#ifdef _PC_NAME_MAX +#ifdef _PC_NAME_MAX { _PC_NAME_MAX, "_PC_NAME_MAX" }, #endif -#ifdef _PC_PATH_MAX +#ifdef _PC_PATH_MAX { _PC_PATH_MAX, "_PC_PATH_MAX" }, #endif -#ifdef _PC_SYMLINK_MAX +#ifdef _PC_SYMLINK_MAX { _PC_SYMLINK_MAX, "_PC_SYMLINK_MAX" }, #endif { 0, NULL } @@ -394,7 +467,7 @@ str2flags(struct flag *tflags, char *sflags) return (flags); } -#ifdef HAS_CHFLAGS +#ifdef HAVE_CHFLAGS static char * flags2str(struct flag *tflags, long long flags) { @@ -440,7 +513,7 @@ find_syscall(const char *name) } static void -show_stat(struct stat64 *sp, const char *what) +show_stat(stat_t *sp, const char *what) { if (strcmp(what, "mode") == 0) @@ -459,11 +532,51 @@ show_stat(struct stat64 *sp, const char *what) printf("%lld", (long long)sp->st_blocks); else if (strcmp(what, "atime") == 0) printf("%lld", (long long)sp->st_atime); - else if (strcmp(what, "mtime") == 0) - printf("%lld", (long long)sp->st_mtime); +#if defined(HAVE_STRUCT_STAT_ST_ATIM) || \ + defined(HAVE_STRUCT_STAT_ST_ATIMESPEC) + else if (strcmp(what, "atime_ns") == 0) +#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC + printf("%lld", (long long)sp->st_atimespec.tv_nsec); +#else + printf("%lld", (long long)sp->st_atim.tv_nsec); +#endif +#endif /* st_atim* */ else if (strcmp(what, "ctime") == 0) printf("%lld", (long long)sp->st_ctime); -#ifdef HAS_CHFLAGS +#if defined(HAVE_STRUCT_STAT_ST_CTIM) || \ + defined(HAVE_STRUCT_STAT_ST_CTIMESPEC) + else if (strcmp(what, "ctime_ns") == 0) +#ifdef HAVE_STRUCT_STAT_ST_CTIMESPEC + printf("%lld", (long long)sp->st_ctimespec.tv_nsec); +#else + printf("%lld", (long long)sp->st_ctim.tv_nsec); +#endif +#endif /* st_ctim* */ + else if (strcmp(what, "mtime") == 0) + printf("%lld", (long long)sp->st_mtime); + else if (strcmp(what, "mtime_ns") == 0) +#if defined(HAVE_STRUCT_STAT_ST_MTIM) || \ + defined(HAVE_STRUCT_STAT_ST_MTIMESPEC) +#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC + printf("%lld", (long long)sp->st_mtimespec.tv_nsec); +#else + printf("%lld", (long long)sp->st_mtim.tv_nsec); +#endif +#endif /* st_mtim* */ +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME + else if (strcmp(what, "birthtime") == 0) + printf("%lld", (long long)sp->st_birthtime); +#endif /* st_birthtime */ +#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIM) || \ + defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC) + else if (strcmp(what, "birthtime_ns") == 0) +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC + printf("%lld", (long long)sp->st_birthtimespec.tv_nsec); +#else + printf("%lld", (long long)sp->st_birthtim.tv_nsec); +#endif +#endif /* st_birthtim{,espec} */ +#ifdef HAVE_CHFLAGS else if (strcmp(what, "flags") == 0) printf("%s", flags2str(chflags_flags, (long long)sp->st_flags)); #endif @@ -504,7 +617,7 @@ show_stat(struct stat64 *sp, const char *what) } static void -show_stats(struct stat64 *sp, char *what) +show_stats(stat_t *sp, char *what) { const char *s = ""; char *w; @@ -547,7 +660,11 @@ descriptor_get(int pos) static unsigned int call_syscall(struct syscall_desc *scall, char *argv[]) { - struct stat64 sb; + stat_t sb; +#ifdef HAVE_UTIMENSAT + struct timespec times[2]; + int flag; +#endif long long flags; unsigned int i; char *endp; @@ -556,7 +673,7 @@ call_syscall(struct syscall_desc *scall, char *argv[]) char *str; long long num; } args[MAX_ARGS]; -#ifdef HAS_FREEBSD_ACL +#ifdef HAS_NFSV4_ACL_SUPPORT int entry_id = ACL_FIRST_ENTRY; acl_t acl, newacl; acl_entry_t entry, newentry; @@ -645,6 +762,7 @@ call_syscall(struct syscall_desc *scall, char *argv[]) if (rval >= 0) descriptor_add(rval); break; +#ifdef HAVE_OPENAT case ACTION_OPENAT: flags = str2flags(open_flags, STR(2)); if (flags & O_CREAT) { @@ -664,6 +782,7 @@ call_syscall(struct syscall_desc *scall, char *argv[]) if (rval >= 0) descriptor_add(rval); break; +#endif case ACTION_CREATE: rval = open(STR(0), O_CREAT | O_EXCL, (mode_t)NUM(1)); if (rval >= 0) @@ -672,46 +791,60 @@ call_syscall(struct syscall_desc *scall, char *argv[]) case ACTION_UNLINK: rval = unlink(STR(0)); break; +#ifdef HAVE_UNLINKAT case ACTION_UNLINKAT: rval = unlinkat(NUM(0), STR(1), (int)str2flags(unlinkat_flags, STR(2))); break; +#endif case ACTION_MKDIR: rval = mkdir(STR(0), (mode_t)NUM(1)); break; +#ifdef HAVE_MKDIRAT case ACTION_MKDIRAT: rval = mkdirat(NUM(0), STR(1), (mode_t)NUM(2)); break; +#endif case ACTION_RMDIR: rval = rmdir(STR(0)); break; case ACTION_LINK: rval = link(STR(0), STR(1)); break; +#ifdef HAVE_LINKAT case ACTION_LINKAT: rval = linkat(NUM(0), STR(1), NUM(2), STR(3), (int)str2flags(linkat_flags, STR(4))); break; +#endif case ACTION_SYMLINK: rval = symlink(STR(0), STR(1)); break; +#ifdef HAVE_SYMLINKAT case ACTION_SYMLINKAT: rval = symlinkat(STR(0), NUM(1), STR(2)); break; +#endif case ACTION_RENAME: rval = rename(STR(0), STR(1)); break; +#ifdef HAVE_RENAMEAT case ACTION_RENAMEAT: rval = renameat(NUM(0), STR(1), NUM(2), STR(3)); break; +#endif case ACTION_MKFIFO: rval = mkfifo(STR(0), (mode_t)NUM(1)); break; +#ifdef HAVE_MKFIFOAT case ACTION_MKFIFOAT: rval = mkfifoat(NUM(0), STR(1), (mode_t)NUM(2)); break; +#endif case ACTION_MKNOD: +#ifdef HAVE_MKNODAT case ACTION_MKNODAT: +#endif { mode_t ntype; dev_t dev; @@ -721,9 +854,11 @@ call_syscall(struct syscall_desc *scall, char *argv[]) case ACTION_MKNOD: fa = 0; break; +#ifdef HAVE_MKNODAT case ACTION_MKNODAT: fa = 1; break; +#endif default: abort(); } @@ -747,9 +882,11 @@ call_syscall(struct syscall_desc *scall, char *argv[]) case ACTION_MKNOD: rval = mknod(STR(0), ntype | NUM(2), dev); break; +#ifdef HAVE_MKNODAT case ACTION_MKNODAT: rval = mknodat(NUM(0), STR(1), ntype | NUM(3), dev); break; +#endif default: abort(); } @@ -768,7 +905,7 @@ call_syscall(struct syscall_desc *scall, char *argv[]) rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx)); break; } -#ifdef HAS_BINDAT +#ifdef HAVE_BINDAT case ACTION_BINDAT: { struct sockaddr_un sunx; @@ -797,7 +934,7 @@ call_syscall(struct syscall_desc *scall, char *argv[]) rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx)); break; } -#ifdef HAS_CONNECTAT +#ifdef HAVE_CONNECTAT case ACTION_CONNECTAT: { struct sockaddr_un sunx; @@ -819,15 +956,17 @@ call_syscall(struct syscall_desc *scall, char *argv[]) case ACTION_FCHMOD: rval = fchmod(NUM(0), (mode_t)NUM(1)); break; -#ifdef HAS_LCHMOD +#ifdef HAVE_LCHMOD case ACTION_LCHMOD: rval = lchmod(STR(0), (mode_t)NUM(1)); break; #endif +#ifdef HAVE_FCHMODAT case ACTION_FCHMODAT: rval = fchmodat(NUM(0), STR(1), (mode_t)NUM(2), str2flags(fchmodat_flags, STR(3))); break; +#endif case ACTION_CHOWN: rval = chown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2)); break; @@ -837,62 +976,94 @@ call_syscall(struct syscall_desc *scall, char *argv[]) case ACTION_LCHOWN: rval = lchown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2)); break; +#ifdef HAVE_FCHOWNAT case ACTION_FCHOWNAT: rval = fchownat(NUM(0), STR(1), (uid_t)NUM(2), (gid_t)NUM(3), (int)str2flags(fchownat_flags, STR(4))); break; -#ifdef HAS_CHFLAGS +#endif +#ifdef HAVE_CHFLAGS case ACTION_CHFLAGS: rval = chflags(STR(0), (unsigned long)str2flags(chflags_flags, STR(1))); break; #endif -#ifdef HAS_FCHFLAGS +#ifdef HAVE_FCHFLAGS case ACTION_FCHFLAGS: rval = fchflags(NUM(0), (unsigned long)str2flags(chflags_flags, STR(1))); break; #endif -#ifdef HAS_CHFLAGSAT +#ifdef HAVE_CHFLAGSAT case ACTION_CHFLAGSAT: rval = chflagsat(NUM(0), STR(1), (unsigned long)str2flags(chflags_flags, STR(2)), (int)str2flags(chflagsat_flags, STR(3))); break; #endif *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706280922.v5S9MkTZ021682>