Skip to contentSkip to conversation

Testcase for statx syscall with AT_NO_AUTOMOUNT flag

RFC PATCH New Sikkandar 2 participants 2 messages Aug 2, 2018 – Aug 3, 2018

lore
Share & tools
lore

Sikkandar

author
#0 lore raw

RFC PATCH 1/1 Testcase for statx syscall with AT_NO_AUTOMOUNT flag

Added statx01.c testfile. Functionality of the file is provided in its description.

Required inputs:
1. Is there any 'ltp' recommended way to create and use automount points from c program?
2. Is it recommended to invoke systemctl services from c program by system() call?

Requesting suggestions for alternate methods if any non-recommended practices are available in the code.

---
 confefYmE5/defines.awk                     |  144 +
 confefYmE5/subs.awk                        |  160 +
 confefYmE5/subs1.awk                       |  160 +
 include/lapi/fs.h                          |   47 +
 include/lapi/sys_statx.h                   |  264 +
 include/lapi/syscalls/arm.in               |    1 +
 include/lapi/syscalls/i386.in              |    1 +
 include/lapi/syscalls/powerpc.in           |    1 +
 include/lapi/syscalls/powerpc64.in         |    1 +
 include/lapi/syscalls/s390.in              |    1 +
 include/lapi/syscalls/sparc.in             |    1 +
 include/lapi/syscalls/sparc64.in           |    1 +
 include/lapi/syscalls/x86_64.in            |    1 +
 m4/ltp-statx.m4                            |   25 +
 runtest/syscalls                           |    9 +
 testcases/kernel/syscalls/statx/.gitignore |    2 +
 testcases/kernel/syscalls/statx/Makefile   |   26 +
 testcases/kernel/syscalls/statx/statx01.c  |  245 +
 utils/ffsb-6.0-rc2/config.h.in             |   49 +-
 utils/ffsb-6.0-rc2/configure               | 5949 +++++++++-----------
 20 files changed, 3902 insertions(+), 3186 deletions(-)
 create mode 100644 confefYmE5/defines.awk
 create mode 100644 confefYmE5/subs.awk
 create mode 100644 confefYmE5/subs1.awk
 create mode 100644 include/lapi/fs.h
 create mode 100644 include/lapi/sys_statx.h
 create mode 100644 m4/ltp-statx.m4
 create mode 100644 testcases/kernel/syscalls/statx/.gitignore
 create mode 100644 testcases/kernel/syscalls/statx/Makefile
 create mode 100644 testcases/kernel/syscalls/statx/statx01.c
confefYmE5/defines.awk new file +144 -0
new file mode 100644
index 000000000..8144b109d
@@ -0,0 +1,144 @@
+BEGIN {
+D["PACKAGE_NAME"]=" \"ltp\""
+D["PACKAGE_TARNAME"]=" \"ltp\""
+D["PACKAGE_VERSION"]=" \"LTP_VERSION\""
+D["PACKAGE_STRING"]=" \"ltp LTP_VERSION\""
+D["PACKAGE_BUGREPORT"]=" \"[email protected]\""
+D["PACKAGE_URL"]=" \"\""
+D["PACKAGE"]=" \"ltp\""
+D["VERSION"]=" \"LTP_VERSION\""
+D["STDC_HEADERS"]=" 1"
+D["HAVE_SYS_TYPES_H"]=" 1"
+D["HAVE_SYS_STAT_H"]=" 1"
+D["HAVE_STDLIB_H"]=" 1"
+D["HAVE_STRING_H"]=" 1"
+D["HAVE_MEMORY_H"]=" 1"
+D["HAVE_STRINGS_H"]=" 1"
+D["HAVE_INTTYPES_H"]=" 1"
+D["HAVE_STDINT_H"]=" 1"
+D["HAVE_UNISTD_H"]=" 1"
+D["HAVE_IFADDRS_H"]=" 1"
+D["HAVE_LINUX_CAN_H"]=" 1"
+D["HAVE_LINUX_DCCP_H"]=" 1"
+D["HAVE_LINUX_CRYPTOUSER_H"]=" 1"
+D["HAVE_LINUX_GENETLINK_H"]=" 1"
+D["HAVE_LINUX_KEYCTL_H"]=" 1"
+D["HAVE_LINUX_IF_PACKET_H"]=" 1"
+D["HAVE_LINUX_IF_ETHER_H"]=" 1"
+D["HAVE_LINUX_MEMPOLICY_H"]=" 1"
+D["HAVE_LINUX_MODULE_H"]=" 1"
+D["HAVE_LINUX_NETLINK_H"]=" 1"
+D["HAVE_PTHREAD_H"]=" 1"
+D["HAVE_SYS_EPOLL_H"]=" 1"
+D["HAVE_SYS_FANOTIFY_H"]=" 1"
+D["HAVE_SYS_INOTIFY_H"]=" 1"
+D["HAVE_SYS_PRCTL_H"]=" 1"
+D["HAVE_SYS_SHM_H"]=" 1"
+D["HAVE_SYS_USTAT_H"]=" 1"
+D["HAVE_SYS_XATTR_H"]=" 1"
+D["HAVE_PROFIL"]=" 1"
+D["HAVE_USTAT"]=" 1"
+D["HAVE_MKDTEMP"]=" 1"
+D["HAVE_SYS_PTRACE_H"]=" 1"
+D["HAVE_SYS_REG_H"]=" 1"
+D["HAVE_ASM_PTRACE_H"]=" 1"
+D["HAVE_LINUX_PTRACE_H"]=" 1"
+D["HAVE_STRUCT_PT_REGS"]=" 1"
+D["HAVE_DECL_PTRACE_GETSIGINFO"]=" 1"
+D["HAVE_DECL_PTRACE_O_TRACEVFORKDONE"]=" 1"
+D["HAVE_DECL_PTRACE_SETOPTIONS"]=" 1"
+D["HAVE_FORK"]=" 1"
+D["HAVE_DAEMON"]=" 1"
+D["HAVE_VFORK"]=" 1"
+D["HAVE_SYS_PRCTL_H"]=" 1"
+D["HAVE_DECL_PR_CAPBSET_DROP"]=" 1"
+D["HAVE_DECL_PR_CAPBSET_READ"]=" 1"
+D["HAVE_LINUX_SECUREBITS_H"]=" 1"
+D["HAVE_STRUCT_SIGACTION_SA_SIGACTION"]=" 1"
+D["HAVE_MODIFY_LDT"]=" 1"
+D["HAVE_ASM_LDT_H"]=" 1"
+D["HAVE_STRUCT_USER_DESC"]=" 1"
+D["HAVE_QUOTAV2"]=" 1"
+D["HAVE_SIGNALFD"]=" 1"
+D["HAVE_SYS_SIGNALFD_H"]=" 1"
+D["HAVE_LINUX_TYPES_H"]=" 1"
+D["HAVE_LINUX_SIGNALFD_H"]=" 1"
+D["HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO"]=" 1"
+D["HAVE_UNSHARE"]=" 1"
+D["HAVE_UTIMENSAT"]=" 1"
+D["HAVE_LINUX_TASKSTATS_H"]=" 1"
+D["HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT"]=" 1"
+D["HAVE_STRUCT_TASKSTATS_NVCSW"]=" 1"
+D["HAVE_STRUCT_TASKSTATS_READ_BYTES"]=" 1"
+D["HAVE_DECL_CLOCK_MONOTONIC_RAW"]=" 1"
+D["HAVE_DECL_CLOCK_REALTIME_COARSE"]=" 1"
+D["HAVE_DECL_CLOCK_MONOTONIC_COARSE"]=" 1"
+D["HAVE_DECL_MADV_MERGEABLE"]=" 1"
+D["HAVE_MADV_MERGEABLE"]=" 1"
+D["HAVE_FS_IOC_FLAGS"]=" 1"
+D["HAVE_MREMAP_FIXED"]=" 1"
+D["CLONE_SUPPORTS_7_ARGS"]=" 1"
+D["HAVE_MKDIRAT"]=" 1"
+D["HAVE_FCHOWNAT"]=" 1"
+D["HAVE_FSTATAT"]=" 1"
+D["HAVE_MKNODAT"]=" 1"
+D["HAVE_READLINKAT"]=" 1"
+D["HAVE_OPENAT"]=" 1"
+D["HAVE_RENAMEAT"]=" 1"
+D["HAVE_FALLOCATE"]=" 1"
+D["HAVE_STRUCT_F_OWNER_EX"]=" 1"
+D["HAVE_PERF_EVENT_ATTR"]=" 1"
+D["HAVE_TEE"]=" 1"
+D["HAVE_SPLICE"]=" 1"
+D["HAVE_VMSPLICE"]=" 1"
+D["HAVE_TIMERFD_CREATE"]=" 1"
+D["HAVE_TIMERFD_SETTIME"]=" 1"
+D["HAVE_TIMERFD_GETTIME"]=" 1"
+D["HAVE_SYS_TIMERFD_H"]=" 1"
+D["HAVE_STRUCT_IOVEC"]=" 1"
+D["HAVE_LINUX_RANDOM_H"]=" 1"
+D["HAVE_DECL_IFLA_NET_NS_PID"]=" 1"
+D["HAVE_ENUM_KCMP_TYPE"]=" 1"
+D["HAVE_PREADV"]=" 1"
+D["HAVE_PWRITEV"]=" 1"
+D["HAVE_EPOLL_PWAIT"]=" 1"
+D["HAVE_SYNC_ADD_AND_FETCH"]=" 1"
+D["HAVE_BUILTIN_CLEAR_CACHE"]=" 1"
+D["HAVE_STRUCT_MMSGHDR"]=" 1"
+D["HAVE_STRUCT_UTSNAME_DOMAINNAME"]=" 1"
+D["HAVE_STRUCT_XT_ENTRY_MATCH"]=" 1"
+D["HAVE_STRUCT_XT_ENTRY_TARGET"]=" 1"
+D["HAVE_ATOMIC_MEMORY_MODEL"]=" 1"
+D["HAVE_STRUCT_TPACKET_REQ3"]=" 1"
+D["NUMA_ERROR_MSG"]=" \"test requires libnuma >= 2 and it's development packages\""
+  for (key in D) D_is_set[key] = 1
+  FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t (]|$)/ {
+  line = $ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
confefYmE5/subs.awk new file +160 -0

160 lines not on this page · raw message

confefYmE5/subs1.awk new file +160 -0

160 lines not on this page · raw message

include/lapi/fs.h new file +47 -0

47 lines not on this page · raw message

include/lapi/sys_statx.h new file +264 -0

264 lines not on this page · raw message

include/lapi/syscalls/arm.in +1 -0
index 71a4b713d..784b64004 100644
@@ -341,3 +341,4 @@ renameat2 (__NR_SYSCALL_BASE+382)
 getrandom (__NR_SYSCALL_BASE+384)
 memfd_create (__NR_SYSCALL_BASE+385)
 copy_file_range (__NR_SYSCALL_BASE+391)
+statx (__NR_SYSCALL+397)
include/lapi/syscalls/i386.in +1 -0
index 0f9601472..453ac3e4e 100644
@@ -341,3 +341,4 @@ renameat2 354
 getrandom 355
 memfd_create 356
 copy_file_range 377
+statx 383
include/lapi/syscalls/powerpc.in +1 -0
index 11ddca34e..10fb238bf 100644
@@ -348,3 +348,4 @@ renameat2 357
 getrandom 359
 memfd_create 360
 copy_file_range 379
+statx 383
include/lapi/syscalls/powerpc64.in +1 -0
index 11ddca34e..10fb238bf 100644
@@ -348,3 +348,4 @@ renameat2 357
 getrandom 359
 memfd_create 360
 copy_file_range 379
+statx 383
include/lapi/syscalls/s390.in +1 -0
index 98c861f36..486205030 100644
@@ -332,3 +332,4 @@ renameat2 347
 getrandom 349
 memfd_create 350
 copy_file_range 375
+statx 379
\ No newline at end of file
include/lapi/syscalls/sparc.in +1 -0
index 296d694a8..bbab51b72 100644
@@ -337,3 +337,4 @@ renameat2 345
 getrandom 347
 memfd_create 348
 copy_file_range 357
+statx 360
include/lapi/syscalls/sparc64.in +1 -0
index 169347a6a..ebff38265 100644
@@ -313,3 +313,4 @@ renameat2 345
 getrandom 347
 memfd_create 348
 copy_file_range 357
+statx 360
include/lapi/syscalls/x86_64.in +1 -0
index 89db79404..11a7b74ca 100644
@@ -308,3 +308,4 @@ renameat2 316
 getrandom 318
 memfd_create 319
 copy_file_range 326
+statx 332
m4/ltp-statx.m4 new file +25 -0
new file mode 100644
index 000000000..52823b5ed
@@ -0,0 +1,25 @@
+dnl
+dnl Copyright (c) Linux Test Project, 2014
+dnl
+dnl This program is free software;  you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program;  if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+
+dnl
+dnl LTP_CHECK_STATX
+dnl ----------------------------
+dnl
+AC_DEFUN([LTP_CHECK_STATX],[
+AC_CHECK_FUNCS(statx,,)
+])
runtest/syscalls +9 -0
index dc72484cb..bc84c0df7 100644
@@ -1277,6 +1277,15 @@ statfs03_64 statfs03_64
 statvfs01 statvfs01
 statvfs02 statvfs02
 
+statx01 statx01
+statx01_64 statx01_64
+statx02 statx02
+statx02_64 statx02_64
+statx03 statx03
+statx03_64 statx03_64
+statx04 statx04
+statx04_64 statx04_64
+
 stime01 stime01
 stime02 stime02
 
testcases/kernel/syscalls/statx/.gitignore new file +2 -0
new file mode 100644
index 000000000..63597779b
@@ -0,0 +1,2 @@
+/statx01
+/statx01_64
testcases/kernel/syscalls/statx/Makefile new file +26 -0
new file mode 100644
index 000000000..bf1201019
@@ -0,0 +1,26 @@
+#
+#  Copyright (c) International Business Machines  Corp., 2001
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(abs_srcdir)/../utils/newer_64.mk
+
+%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/statx/statx01.c new file +245 -0

245 lines not on this page · raw message

utils/ffsb-6.0-rc2/config.h.in +33 -16

68 lines not on this page · raw message

utils/ffsb-6.0-rc2/configure +2779 -3170

1,811 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#1 lore raw

RFC PATCH 1/1 Testcase for statx syscall with AT_NO_AUTOMOUNT flag

Hi!

Quoted 1 line

Added statx01.c testfile. Functionality of the file is provided in its description.

This conflicts with the initial batch of the statx testcases, this patch should be based on LTP tree with that patch applied.

Quoted 2 lines

Required inputs:
1. Is there any 'ltp' recommended way to create and use automount points from c program?

Just use the automount kernel API it's not really complicated one.

I looked into it and created example code, see the attached C source.

Quoted 1 line

2. Is it recommended to invoke systemctl services from c program by system() call?

No as LTP runs also on systems without systemd it should not depend on systemctl being installed on the system at all.

Quoted 19 lines

Requesting suggestions for alternate methods if any non-recommended practices are available in the code.

---
 confefYmE5/defines.awk                     |  144 +
 confefYmE5/subs.awk                        |  160 +
 confefYmE5/subs1.awk                       |  160 +
 include/lapi/fs.h                          |   47 +
 include/lapi/sys_statx.h                   |  264 +
 include/lapi/syscalls/arm.in               |    1 +
 include/lapi/syscalls/i386.in              |    1 +
 include/lapi/syscalls/powerpc.in           |    1 +
 include/lapi/syscalls/powerpc64.in         |    1 +
 include/lapi/syscalls/s390.in              |    1 +
 include/lapi/syscalls/sparc.in             |    1 +
 include/lapi/syscalls/sparc64.in           |    1 +
Quoted 8 lines
 include/lapi/syscalls/x86_64.in            |    1 +
 m4/ltp-statx.m4                            |   25 +
 runtest/syscalls                           |    9 +
 testcases/kernel/syscalls/statx/.gitignore |    2 +
 testcases/kernel/syscalls/statx/Makefile   |   26 +
 testcases/kernel/syscalls/statx/statx01.c  |  245 +
 utils/ffsb-6.0-rc2/config.h.in             |   49 +-
 utils/ffsb-6.0-rc2/configure               | 5949 +++++++++-----------

There is a couple of files added here by a mistake, the conf*/ files and the utils/*.

Signature · 9 lines
Cyril Hrubis
[email protected]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: automount.c
Type: text/x-c
Size: 1499 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20180803/6c2e3475/attachment.bin>