Skip to contentSkip to conversation

syscalls: Add tests to verify the _time_high fields

PATCH New Viresh Kumar 5 participants 32 messages May 21, 2020 – Jun 16, 2020

lore
Share & tools
lore
#0 lore raw

cover syscalls: Add tests to verify the _time_high fields

Hello,

This patchset adds a new test to three syscalls to verify that the extended fields, _time_high, are cleared by the kernel. This was suggested by Arnd.

I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.

Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)

Viresh Kumar (5):
syscalls:ipc: Move libraries to libs/ director
include: Add declaration of struct ipc64_perm
syscalls: semctl: Add new test to verify the _time_high fields
syscalls: shmctl: Add new test to verify the _time_high fields
syscalls: msgctl: Add new test to verify the _time_high fields

 configure.ac                                  |   4 +
 include/ipcbuf.h                              |  45 +++
 .../syscalls/ipc/lib => include}/ipcmsg.h     |   0
 .../syscalls/ipc/lib => include}/ipcsem.h     |   0
 .../syscalls/ipc/lib => include}/ipcshm.h     |   0
 .../syscalls/ipc/lib => include}/libmsgctl.h  |   0
 .../ipc/libnewipc => include}/libnewipc.h     |   2 +
 include/msgbuf.h                              | 306 ++++++++++++++++++
 include/sembuf.h                              | 234 ++++++++++++++
 include/shmbuf.h                              | 273 ++++++++++++++++
 .../ipc/lib => libs/libltpipc}/Makefile       |   5 +-
 .../ipc/lib => libs/libltpipc}/libipc.c       |   0
 .../ipc/lib => libs/libltpipc}/libmsgctl.c    |   0
 .../libnewipc => libs/libltpnewipc}/Makefile  |   5 +-
 .../libltpnewipc}/libnewipc.c                 |   0
 runtest/syscalls                              |   3 +
 runtest/syscalls-ipc                          |   3 +
 testcases/kernel/syscalls/ipc/Makefile        |  22 --
 testcases/kernel/syscalls/ipc/Makefile.inc    |  28 --
 testcases/kernel/syscalls/ipc/Makefile2.inc   |  22 --
 .../kernel/syscalls/ipc/msgctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/msgctl/Makefile |   5 +-
 testcases/kernel/syscalls/ipc/msgctl/msgctl05 | Bin 0 -> 498784 bytes
 .../kernel/syscalls/ipc/msgctl/msgctl05.c     |  48 +++
 testcases/kernel/syscalls/ipc/msgget/Makefile |   5 +-
 testcases/kernel/syscalls/ipc/msgrcv/Makefile |   5 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv01.c     |   2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv02.c     |   2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv03.c     |   2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv04.c     |   2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv05.c     |   2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv06.c     |   2 +-
 testcases/kernel/syscalls/ipc/msgsnd/Makefile |   5 +-
 .../kernel/syscalls/ipc/msgstress/Makefile    |   8 +-
 .../syscalls/ipc/msgstress/msgstress01.c      |   2 +-
 .../syscalls/ipc/msgstress/msgstress02.c      |   2 +-
 .../syscalls/ipc/msgstress/msgstress03.c      |   2 +-
 .../syscalls/ipc/msgstress/msgstress04.c      |   2 +-
 .../kernel/syscalls/ipc/semctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/semctl/Makefile |   8 +-
 .../kernel/syscalls/ipc/semctl/semctl02.c     |   2 +-
 .../kernel/syscalls/ipc/semctl/semctl03.c     |   2 +-
 .../kernel/syscalls/ipc/semctl/semctl04.c     |   2 +-
 .../kernel/syscalls/ipc/semctl/semctl05.c     |   2 +-
 .../kernel/syscalls/ipc/semctl/semctl08.c     |  52 +++
 testcases/kernel/syscalls/ipc/semget/Makefile |   5 +-
 .../kernel/syscalls/ipc/semget/semget01.c     |   4 +-
 .../kernel/syscalls/ipc/semget/semget02.c     |   4 +-
 .../kernel/syscalls/ipc/semget/semget03.c     |   4 +-
 .../kernel/syscalls/ipc/semget/semget05.c     |   2 +-
 .../kernel/syscalls/ipc/semget/semget06.c     |   4 +-
 testcases/kernel/syscalls/ipc/semop/Makefile  |   5 +-
 testcases/kernel/syscalls/ipc/semop/semop03.c |   2 +-
 testcases/kernel/syscalls/ipc/semop/semop04.c |   2 +-
 testcases/kernel/syscalls/ipc/semop/semop05.c |   2 +-
 testcases/kernel/syscalls/ipc/shmat/Makefile  |   5 +-
 .../kernel/syscalls/ipc/shmctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/shmctl/Makefile |  10 +-
 .../kernel/syscalls/ipc/shmctl/shmctl02.c     |   2 +-
 .../kernel/syscalls/ipc/shmctl/shmctl03.c     |   2 +-
 .../kernel/syscalls/ipc/shmctl/shmctl04.c     |   2 +-
 .../kernel/syscalls/ipc/shmctl/shmctl06.c     |  51 +++
 testcases/kernel/syscalls/ipc/shmdt/Makefile  |   5 +-
 testcases/kernel/syscalls/ipc/shmdt/shmdt01.c |   2 +-
 testcases/kernel/syscalls/ipc/shmget/Makefile |   5 +-
 .../kernel/syscalls/ipc/shmget/shmget01.c     |   2 +-
 .../kernel/syscalls/ipc/shmget/shmget02.c     |   2 +-
 .../kernel/syscalls/ipc/shmget/shmget03.c     |   2 +-
 .../kernel/syscalls/ipc/shmget/shmget04.c     |   2 +-
 .../kernel/syscalls/ipc/shmget/shmget05.c     |   2 +-
 testcases/kernel/syscalls/kill/Makefile       |  19 +-
 testcases/kernel/syscalls/kill/kill07.c       |   2 +-
 testcases/kernel/syscalls/mremap/Makefile     |  19 +-
 73 files changed, 1124 insertions(+), 163 deletions(-)
 create mode 100644 include/ipcbuf.h
 rename {testcases/kernel/syscalls/ipc/lib => include}/ipcmsg.h (100%)
 rename {testcases/kernel/syscalls/ipc/lib => include}/ipcsem.h (100%)
 rename {testcases/kernel/syscalls/ipc/lib => include}/ipcshm.h (100%)
 rename {testcases/kernel/syscalls/ipc/lib => include}/libmsgctl.h (100%)
 rename {testcases/kernel/syscalls/ipc/libnewipc => include}/libnewipc.h (98%)
 create mode 100644 include/msgbuf.h
 create mode 100644 include/sembuf.h
 create mode 100644 include/shmbuf.h
 rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/Makefile (63%)
 rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libipc.c (100%)
 rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libmsgctl.c (100%)
 rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/Makefile (63%)
 rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/libnewipc.c (100%)
 delete mode 100644 testcases/kernel/syscalls/ipc/Makefile.inc
 delete mode 100644 testcases/kernel/syscalls/ipc/Makefile2.inc
 create mode 100755 testcases/kernel/syscalls/ipc/msgctl/msgctl05
 create mode 100644 testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
 create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#1 lore raw

PATCH 1/5 syscalls:ipc: Move libraries to libs/ director

Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.

---
 .../syscalls/ipc/lib => include}/ipcmsg.h     |  0
 .../syscalls/ipc/lib => include}/ipcsem.h     |  0
 .../syscalls/ipc/lib => include}/ipcshm.h     |  0
 .../syscalls/ipc/lib => include}/libmsgctl.h  |  0
 .../ipc/libnewipc => include}/libnewipc.h     |  2 ++
 .../ipc/lib => libs/libltpipc}/Makefile       |  5 ++--
 .../ipc/lib => libs/libltpipc}/libipc.c       |  0
 .../ipc/lib => libs/libltpipc}/libmsgctl.c    |  0
 .../libnewipc => libs/libltpnewipc}/Makefile  |  5 ++--
 .../libltpnewipc}/libnewipc.c                 |  0
 testcases/kernel/syscalls/ipc/Makefile        | 22 ---------------
 testcases/kernel/syscalls/ipc/Makefile.inc    | 28 -------------------
 testcases/kernel/syscalls/ipc/Makefile2.inc   | 22 ---------------
 testcases/kernel/syscalls/ipc/msgctl/Makefile |  5 +++-
 testcases/kernel/syscalls/ipc/msgget/Makefile |  5 +++-
 testcases/kernel/syscalls/ipc/msgrcv/Makefile |  5 +++-
 .../kernel/syscalls/ipc/msgrcv/msgrcv01.c     |  2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv02.c     |  2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv03.c     |  2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv04.c     |  2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv05.c     |  2 +-
 .../kernel/syscalls/ipc/msgrcv/msgrcv06.c     |  2 +-
 testcases/kernel/syscalls/ipc/msgsnd/Makefile |  5 +++-
 .../kernel/syscalls/ipc/msgstress/Makefile    |  8 ++----
 .../syscalls/ipc/msgstress/msgstress01.c      |  2 +-
 .../syscalls/ipc/msgstress/msgstress02.c      |  2 +-
 .../syscalls/ipc/msgstress/msgstress03.c      |  2 +-
 .../syscalls/ipc/msgstress/msgstress04.c      |  2 +-
 testcases/kernel/syscalls/ipc/semctl/Makefile |  5 +++-
 .../kernel/syscalls/ipc/semctl/semctl02.c     |  2 +-
 .../kernel/syscalls/ipc/semctl/semctl03.c     |  2 +-
 .../kernel/syscalls/ipc/semctl/semctl04.c     |  2 +-
 .../kernel/syscalls/ipc/semctl/semctl05.c     |  2 +-
 testcases/kernel/syscalls/ipc/semget/Makefile |  5 +++-
 .../kernel/syscalls/ipc/semget/semget01.c     |  4 +--
 .../kernel/syscalls/ipc/semget/semget02.c     |  4 +--
 .../kernel/syscalls/ipc/semget/semget03.c     |  4 +--
 .../kernel/syscalls/ipc/semget/semget05.c     |  2 +-
 .../kernel/syscalls/ipc/semget/semget06.c     |  4 +--
 testcases/kernel/syscalls/ipc/semop/Makefile  |  5 +++-
 testcases/kernel/syscalls/ipc/semop/semop03.c |  2 +-
 testcases/kernel/syscalls/ipc/semop/semop04.c |  2 +-
 testcases/kernel/syscalls/ipc/semop/semop05.c |  2 +-
 testcases/kernel/syscalls/ipc/shmat/Makefile  |  5 +++-
 testcases/kernel/syscalls/ipc/shmctl/Makefile |  5 +++-
 .../kernel/syscalls/ipc/shmctl/shmctl02.c     |  2 +-
 .../kernel/syscalls/ipc/shmctl/shmctl03.c     |  2 +-
 .../kernel/syscalls/ipc/shmctl/shmctl04.c     |  2 +-
 testcases/kernel/syscalls/ipc/shmdt/Makefile  |  5 +++-
 testcases/kernel/syscalls/ipc/shmdt/shmdt01.c |  2 +-
 testcases/kernel/syscalls/ipc/shmget/Makefile |  5 +++-
 .../kernel/syscalls/ipc/shmget/shmget01.c     |  2 +-
 .../kernel/syscalls/ipc/shmget/shmget02.c     |  2 +-
 .../kernel/syscalls/ipc/shmget/shmget03.c     |  2 +-
 .../kernel/syscalls/ipc/shmget/shmget04.c     |  2 +-
 .../kernel/syscalls/ipc/shmget/shmget05.c     |  2 +-
 testcases/kernel/syscalls/kill/Makefile       | 19 ++-----------
 testcases/kernel/syscalls/kill/kill07.c       |  2 +-
 testcases/kernel/syscalls/mremap/Makefile     | 19 ++-----------
 59 files changed, 95 insertions(+), 162 deletions(-)
 rename {testcases/kernel/syscalls/ipc/lib => include}/ipcmsg.h (100%)
 rename {testcases/kernel/syscalls/ipc/lib => include}/ipcsem.h (100%)
 rename {testcases/kernel/syscalls/ipc/lib => include}/ipcshm.h (100%)
 rename {testcases/kernel/syscalls/ipc/lib => include}/libmsgctl.h (100%)
 rename {testcases/kernel/syscalls/ipc/libnewipc => include}/libnewipc.h (98%)
 rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/Makefile (63%)
 rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libipc.c (100%)
 rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libmsgctl.c (100%)
 rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/Makefile (63%)
 rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/libnewipc.c (100%)
 delete mode 100644 testcases/kernel/syscalls/ipc/Makefile.inc
 delete mode 100644 testcases/kernel/syscalls/ipc/Makefile2.inc
include/ipcmsg.h renamed from testcases/kernel/syscalls/ipc/lib/ipcmsg.h +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/lib/ipcmsg.h
rename to include/ipcmsg.h
include/ipcsem.h renamed from testcases/kernel/syscalls/ipc/lib/ipcsem.h +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/lib/ipcsem.h
rename to include/ipcsem.h
include/ipcshm.h renamed from testcases/kernel/syscalls/ipc/lib/ipcshm.h +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/lib/ipcshm.h
rename to include/ipcshm.h
include/libmsgctl.h renamed from testcases/kernel/syscalls/ipc/lib/libmsgctl.h +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/lib/libmsgctl.h
rename to include/libmsgctl.h
include/libnewipc.h renamed from testcases/kernel/syscalls/ipc/libnewipc/libnewipc.h +2 -0
similarity index 98%
rename from testcases/kernel/syscalls/ipc/libnewipc/libnewipc.h
rename to include/libnewipc.h
index 660be8088053..30288cd68ca6 100644
@@ -22,6 +22,8 @@
 #ifndef __LIBNEWIPC_H
 #define __LIBNEWIPC_H	1
 
+#include <sys/types.h>
+
 #define MSG_RD	0400
 #define MSG_WR	0200
 #define MSG_RW	(MSG_RD | MSG_WR)
libs/libltpipc/Makefile renamed from testcases/kernel/syscalls/ipc/lib/Makefile +3 -2
similarity index 63%
rename from testcases/kernel/syscalls/ipc/lib/Makefile
rename to libs/libltpipc/Makefile
index 19916fa05003..11f38ea0a2a9 100644
@@ -1,10 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) International Business Machines  Corp., 2001
 
-top_srcdir		?= ../../../../..
+top_srcdir		?= ../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-LIB			:= libipc.a libmsgctl.a
+LIB			:= libltpipc.a libltpmsgctl.a
 
 include $(top_srcdir)/include/mk/lib.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
libs/libltpipc/libipc.c renamed from testcases/kernel/syscalls/ipc/lib/libipc.c +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/lib/libipc.c
rename to libs/libltpipc/libipc.c
libs/libltpipc/libmsgctl.c renamed from testcases/kernel/syscalls/ipc/lib/libmsgctl.c +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/lib/libmsgctl.c
rename to libs/libltpipc/libmsgctl.c
libs/libltpnewipc/Makefile renamed from testcases/kernel/syscalls/ipc/libnewipc/Makefile +3 -2
similarity index 63%
rename from testcases/kernel/syscalls/ipc/libnewipc/Makefile
rename to libs/libltpnewipc/Makefile
index d150fb70f6e8..741c78f81c89 100644
@@ -1,10 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Xiao Yang <[email protected]>
 
-top_srcdir		?= ../../../../..
+top_srcdir		?= ../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INTERNAL_LIB		:= libnewipc.a
+INTERNAL_LIB		:= libltpnewipc.a
 
 include $(top_srcdir)/include/mk/lib.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
libs/libltpnewipc/libnewipc.c renamed from testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c +0 -0
similarity index 100%
rename from testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c
rename to libs/libltpnewipc/libnewipc.c
testcases/kernel/syscalls/ipc/Makefile +0 -22
index 9025a70f0609..7876f4bbd307 100644
@@ -4,26 +4,4 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
-
-LIBDIR			:= lib
-LIBNEWDIR		:= libnewipc
-FILTER_OUT_DIRS		:= $(LIBDIR) $(LIBNEWDIR)
-LIB			:= $(LIBDIR)/libipc.a $(LIBDIR)/libmsgctl.a
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean libnew-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-libnew-clean:: $(LIBNEWDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/syscalls/ipc/Makefile.inc deleted +0 -28
deleted file mode 100644
index c7e82bb18401..000000000000
@@ -1,28 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-#    kernel/syscalls/ipc testcase suite common definitions Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-# Ngie Cooper, July 2009
-#
-
-# DO NOT USE THIS FILE FOR ipc / lib!!!
-
-LDLIBS			+= -lipc
-LIBDIR			:= ../lib
-
-LIBIPC			:= $(LIBDIR)/libipc.a
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIBIPC): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIBIPC)
-
-CPPFLAGS		+= -I$(abs_srcdir)/$(LIBDIR)
-
-LDFLAGS			+= -L$(abs_builddir)/$(LIBDIR)
-
-# vim: syntax=make
testcases/kernel/syscalls/ipc/Makefile2.inc deleted +0 -22
deleted file mode 100644
index 17917f5f8964..000000000000
@@ -1,22 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-#    kernel/syscalls/ipc testcase suite common definitions Makefile.
-#
-#    Copyright (C) 2016, Cyril Hrubis
-#
-
-LDLIBS			+= -lnewipc
-LIBDIR			:= ../libnewipc
-
-LIBIPC			:= $(LIBDIR)/libnewipc.a
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIBIPC): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIBIPC)
-
-CPPFLAGS		+= -I$(abs_srcdir)/$(LIBDIR)
-
-LDFLAGS			+= -L$(abs_builddir)/$(LIBDIR)
testcases/kernel/syscalls/ipc/msgctl/Makefile +4 -1
index 5e4c695dd310..e2b305573247 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile2.inc
+
+LDLIBS  += -lltpnewipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgget/Makefile +4 -1
index 5e4c695dd310..e2b305573247 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile2.inc
+
+LDLIBS  += -lltpnewipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/Makefile +4 -1
index 401e5e8cbb9f..aa211d37f8ee 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c +1 -1
index 375d262bcdae..3e89a7f90376 100644
@@ -181,7 +181,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c +1 -1
index e42cf1f1323d..52cffeaf4e4c 100644
@@ -159,7 +159,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c +1 -1
index 762b4d51bced..a81f7436dd98 100644
@@ -136,7 +136,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c +1 -1
index 833ad1aec066..573059c35d13 100644
@@ -147,7 +147,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c +1 -1
index 66c4341f1aee..4c7a446e79f1 100644
@@ -181,7 +181,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c +1 -1
index a27d093bed80..e3458b9ad0d7 100644
@@ -202,7 +202,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 }
testcases/kernel/syscalls/ipc/msgsnd/Makefile +4 -1
index 46f6f108535e..b4930310fc63 100644
@@ -8,5 +8,8 @@ FILTER_OUT_MAKE_TARGETS += msgsnd05 msgsnd06
 endif
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile2.inc
+
+LDLIBS  += -lltpnewipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/Makefile +3 -5
index c62bf4131063..5514638297ed 100644
@@ -5,10 +5,8 @@ top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LIBMSGCTL               := $(LIBDIR)/libmsgctl.a
-LDLIBS                  += -lmsgctl
+LDLIBS  += -lltpipc
+LDLIBS  += -lltpmsgctl
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
-MAKE_DEPS               := $(LIBMSGCTL)
-
-include $(abs_srcdir)/../Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/msgstress01.c +1 -1
index 7117e38311c4..0a660c042e95 100644
@@ -39,7 +39,7 @@
 #include <sys/msg.h>
 #include "test.h"
 #include "ipcmsg.h"
-#include "../lib/libmsgctl.h"
+#include "libmsgctl.h"
 
 char *TCID = "msgstress01";
 int TST_TOTAL = 1;
testcases/kernel/syscalls/ipc/msgstress/msgstress02.c +1 -1
index 43982bdc20f8..e151310436cb 100644
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include "test.h"
 #include "ipcmsg.h"
-#include "../lib/libmsgctl.h"
+#include "libmsgctl.h"
 
 char *TCID = "msgstress02";
 int TST_TOTAL = 1;
testcases/kernel/syscalls/ipc/msgstress/msgstress03.c +1 -1
index de4b459a1df7..294b401b1b38 100644
@@ -40,7 +40,7 @@
 #include <sys/msg.h>
 #include "test.h"
 #include "ipcmsg.h"
-#include "../lib/libmsgctl.h"
+#include "libmsgctl.h"
 
 char *TCID = "msgstress03";
 int TST_TOTAL = 1;
testcases/kernel/syscalls/ipc/msgstress/msgstress04.c +1 -1
index 81383d6c8b11..f1c124990cb1 100644
@@ -38,7 +38,7 @@
 #include <unistd.h>
 #include "test.h"
 #include "ipcmsg.h"
-#include "../lib/libmsgctl.h"
+#include "libmsgctl.h"
 
 char *TCID = "msgstress04";
 int TST_TOTAL = 1;
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
index 401e5e8cbb9f..aa211d37f8ee 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/semctl02.c +1 -1
index 1fcdd1dc6074..35051f62c196 100644
@@ -130,7 +130,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semctl/semctl03.c +1 -1
index c1006509e484..dc851bfd6fbd 100644
@@ -147,7 +147,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semctl/semctl04.c +1 -1
index a08db1c5c94a..b1f199e6050f 100644
@@ -174,7 +174,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semctl/semctl05.c +1 -1
index 865305484fd1..84dace404083 100644
@@ -150,7 +150,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semget/Makefile +4 -1
index 401e5e8cbb9f..aa211d37f8ee 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semget/semget01.c +2 -2
index a6cdd2d20ab7..217163b3af20 100644
@@ -56,7 +56,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semget01";
 int TST_TOTAL = 1;
@@ -150,7 +150,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semget/semget02.c +2 -2
index af7797189a45..4124514c2963 100644
@@ -51,7 +51,7 @@
  */
 #include <pwd.h>
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semget02";
 int TST_TOTAL = 2;
@@ -138,7 +138,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semget/semget03.c +2 -2
index 976c78a521b9..995b4bd3add7 100644
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semget03";
 int TST_TOTAL = 1;
@@ -111,7 +111,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semget/semget05.c +1 -1
index 976769619c1e..f801cb8ed53a 100644
@@ -48,7 +48,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semget05";
 int TST_TOTAL = 1;
testcases/kernel/syscalls/ipc/semget/semget06.c +2 -2
index 858006d80dd6..52297c010092 100644
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semget06";
 int TST_TOTAL = 2;
@@ -121,7 +121,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semop/Makefile +4 -1
index 401e5e8cbb9f..aa211d37f8ee 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semop/semop03.c +1 -1
index a904e99439e2..9c1c58202ad3 100644
@@ -130,7 +130,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semop/semop04.c +1 -1
index bf425b54bb4c..c1fa2eba7584 100644
@@ -148,7 +148,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/semop/semop05.c +1 -1
index 6ed25014c7af..e97ad42fe01d 100644
@@ -256,7 +256,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmat/Makefile +4 -1
index 5e4c695dd310..e2b305573247 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile2.inc
+
+LDLIBS  += -lltpnewipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/Makefile +4 -1
index 77cba6c335d0..dda6d636f755 100644
@@ -7,5 +7,8 @@ shmctl05: CFLAGS += -pthread
 shmctl05: LDLIBS += -lrt
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/shmctl02.c +1 -1
index 563f6870ade8..0b97bb240f02 100644
@@ -174,7 +174,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmctl/shmctl03.c +1 -1
index 97cf27baf14c..798eadad6549 100644
@@ -176,7 +176,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmctl/shmctl04.c +1 -1
index c9d13d46e571..40cfa9419f65 100644
@@ -97,7 +97,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmdt/Makefile +4 -1
index 401e5e8cbb9f..aa211d37f8ee 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmdt/shmdt01.c +1 -1
index fc167e7fd8d1..697613a47c12 100644
@@ -184,7 +184,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmget/Makefile +4 -1
index 401e5e8cbb9f..aa211d37f8ee 100644
@@ -4,5 +4,8 @@
 top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-include $(abs_srcdir)/../Makefile.inc
+
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmget/shmget01.c +1 -1
index ae63baf6fe6c..586f4c263934 100644
@@ -149,7 +149,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmget/shmget02.c +1 -1
index 71d161614afa..4436ca7f8492 100644
@@ -144,7 +144,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmget/shmget03.c +1 -1
index b9ff1a4e6572..96ebf3608a6d 100644
@@ -123,7 +123,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmget/shmget04.c +1 -1
index b0cff30569d7..60a263c77687 100644
@@ -125,7 +125,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/ipc/shmget/shmget05.c +1 -1
index 01770ba7da0a..de9544591b74 100644
@@ -157,7 +157,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/kill/Makefile +2 -17
index a6577183b2bb..3e32978fc86a 100644
@@ -5,22 +5,7 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS                  += -lipc
-
-LIBDIR			:= ../ipc/lib
-
-LIB                     := $(LIBDIR)/libipc.a
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-CPPFLAGS                += -I$(abs_srcdir)/$(LIBDIR)
-
-LDFLAGS                 += -L$(abs_builddir)/$(LIBDIR)
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/kill/kill07.c +1 -1
index 60904dd2b16d..c566a0a09589 100644
@@ -214,7 +214,7 @@ void setup(void)
 	/*
 	 * Create a temporary directory and cd into it.
 	 * This helps to ensure that a unique msgkey is created.
-	 * See ../lib/libipc.c for more information.
+	 * See libs/libltpipc/libipc.c for more information.
 	 */
 	tst_tmpdir();
 
testcases/kernel/syscalls/mremap/Makefile +2 -17
index 16ebb64df820..3e32978fc86a 100644
@@ -5,22 +5,7 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS			+= -lipc
-
-LIBDIR			:= ../ipc/lib
-
-LIB                     := $(LIBDIR)/libipc.a
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-CPPFLAGS                += -I$(abs_srcdir)/$(LIBDIR)
-
-LDFLAGS                 += -L$(abs_builddir)/$(LIBDIR)
+LDLIBS  += -lltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#6 lore raw

PATCH 2/5 include: Add declaration of struct ipc64_perm

In reply to Viresh Kumar

This adds declaration of struct ipc64_perm, which will be used by following patches.

---
 configure.ac     |  1 +
 include/ipcbuf.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 include/ipcbuf.h
configure.ac +1 -0
index 1d3ea58d0082..eaf33dd60350 100644
@@ -150,6 +150,7 @@ AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
 AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
+AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/ipcbuf.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#14 lore raw

PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
 configure.ac                                  |   1 +
 include/sembuf.h                              | 234 ++++++++++++++++++
 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 testcases/kernel/syscalls/ipc/msgctl/msgctl05 | Bin 0 -> 498784 bytes
 .../kernel/syscalls/ipc/semctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/semctl/Makefile |   5 +-
 .../kernel/syscalls/ipc/semctl/semctl08.c     |  52 ++++
 8 files changed, 294 insertions(+), 1 deletion(-)
 create mode 100644 include/sembuf.h
 create mode 100755 testcases/kernel/syscalls/ipc/msgctl/msgctl05
 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
configure.ac +1 -0
index eaf33dd60350..c513fdf440c2 100644
@@ -151,6 +151,7 @@ AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
+AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/sembuf.h new file +234 -0

234 lines not on this page · raw message

runtest/syscalls +1 -0
index edd3e8de7861..db14ba4baf9e 100644
@@ -1156,6 +1156,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
runtest/syscalls-ipc +1 -0
index 54d8622d4223..f912cb067f74 100644
@@ -33,6 +33,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
testcases/kernel/syscalls/ipc/msgctl/msgctl05 new file binary +0 -0
new file mode 100755
index 0000000000000000000000000000000000000000..3ca0f8954d8d0a38312b9ee554fbfe9038db6ac0
GIT binary patch
testcases/kernel/syscalls/ipc/semctl/.gitignore +1 -0
index b6899acf5da6..6189a04cc3c6 100644
@@ -5,3 +5,4 @@
 /semctl05
 /semctl06
 /semctl07
+/semctl08
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
index aa211d37f8ee..150f581825c5 100644
@@ -5,7 +5,10 @@ top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
+semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc
+semctl08: LDLIBS += -lltpnewipc
+
 LDFLAGS += -L$(top_builddir)/libs/libltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#24 lore raw

PATCH 4/5 syscalls: shmctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
 configure.ac                                  |   1 +
 include/shmbuf.h                              | 273 ++++++++++++++++++
 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 .../kernel/syscalls/ipc/shmctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/shmctl/Makefile |   7 +-
 .../kernel/syscalls/ipc/shmctl/shmctl06.c     |  51 ++++
 7 files changed, 333 insertions(+), 2 deletions(-)
 create mode 100644 include/shmbuf.h
 create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
configure.ac +1 -0
index c513fdf440c2..f1ee98b23cbe 100644
@@ -152,6 +152,7 @@ AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
+AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/shmbuf.h new file +273 -0

273 lines not on this page · raw message

runtest/syscalls +1 -0
index db14ba4baf9e..297b225448b8 100644
@@ -1352,6 +1352,7 @@ shmctl02 shmctl02
 shmctl03 shmctl03
 shmctl04 shmctl04
 shmctl05 shmctl05
+shmctl06 shmctl06
 
 shmdt01 shmdt01
 shmdt02 shmdt02
runtest/syscalls-ipc +1 -0
index f912cb067f74..5ba3b1449a6c 100644
@@ -55,6 +55,7 @@ shmctl02 shmctl02
 shmctl03 shmctl03
 shmctl04 shmctl04
 shmctl05 shmctl05
+shmctl06 shmctl06
 
 shmdt01 shmdt01
 shmdt02 shmdt02
testcases/kernel/syscalls/ipc/shmctl/.gitignore +1 -0
index d6777e3b8f1b..46b107344cf4 100644
@@ -3,3 +3,4 @@
 /shmctl03
 /shmctl04
 /shmctl05
+/shmctl06
testcases/kernel/syscalls/ipc/shmctl/Makefile +5 -2
index dda6d636f755..44e38d8fa760 100644
@@ -3,12 +3,15 @@
 
 top_srcdir              ?= ../../../../..
 
+include $(top_srcdir)/include/mk/testcases.mk
+
 shmctl05: CFLAGS += -pthread
 shmctl05: LDLIBS += -lrt
 
-include $(top_srcdir)/include/mk/testcases.mk
+shmctl01 shmctl02 shmctl03 shmctl04 shmctl05: LDLIBS += -lltpipc
+shmctl06: LDLIBS += -lltpnewipc
 
-LDLIBS  += -lltpipc
 LDFLAGS += -L$(top_builddir)/libs/libltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/shmctl06.c new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#26 lore raw

PATCH 5/5 syscalls: msgctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
 configure.ac                                  |   1 +
 include/msgbuf.h                              | 306 ++++++++++++++++++
 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 .../kernel/syscalls/ipc/msgctl/.gitignore     |   1 +
 .../kernel/syscalls/ipc/msgctl/msgctl05.c     |  48 +++
 6 files changed, 358 insertions(+)
 create mode 100644 include/msgbuf.h
 create mode 100644 testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
configure.ac +1 -0
index f1ee98b23cbe..05032d1cfd8f 100644
@@ -153,6 +153,7 @@ AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
+AC_CHECK_TYPES([struct msqid64_ds],,,[#include <sys/msgbuf.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/msgbuf.h new file +306 -0

306 lines not on this page · raw message

runtest/syscalls +1 -0
index 297b225448b8..e6e354bbf797 100644
@@ -796,6 +796,7 @@ msgctl01 msgctl01
 msgctl02 msgctl02
 msgctl03 msgctl03
 msgctl04 msgctl04
+msgctl05 msgctl05
 msgstress01 msgstress01
 msgstress02 msgstress02
 msgstress03 msgstress03
runtest/syscalls-ipc +1 -0
index 5ba3b1449a6c..c3a35896c5a8 100644
@@ -2,6 +2,7 @@ msgctl01 msgctl01
 msgctl02 msgctl02
 msgctl03 msgctl03
 msgctl04 msgctl04
+msgctl05 msgctl05
 msgstress01 msgstress01
 msgstress02 msgstress02
 msgstress03 msgstress03
testcases/kernel/syscalls/ipc/msgctl/.gitignore +1 -0
index f179f2606a3e..0157f4611bdf 100644
@@ -2,4 +2,5 @@
 /msgctl02
 /msgctl03
 /msgctl04
+/msgctl05
 /msgctl12
testcases/kernel/syscalls/ipc/msgctl/msgctl05.c new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#28 lore raw

cover syscalls: Add tests to verify the _time_high fields

In reply to Viresh Kumar
Quoted 7 lines · Viresh Kumar

Hello,

This patchset adds a new test to three syscalls to verify that the extended fields, _time_high, are cleared by the kernel. This was suggested by Arnd.

Quoted 6 lines

I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.

Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)

The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).

Arnd

#7 lore raw

PATCH 2/5 include: Add declaration of struct ipc64_perm

In reply to Viresh Kumar
Quoted 5 lines · Viresh Kumar

This adds declaration of struct ipc64_perm, which will be used by following patches.

Like the other structures, there are multiple definitions in the kernel:

$ git grep ^struct.ipc64_perm
arch/parisc/include/uapi/asm/ipcbuf.h:struct ipc64_perm
arch/powerpc/include/uapi/asm/ipcbuf.h:struct ipc64_perm
arch/s390/include/uapi/asm/ipcbuf.h:struct ipc64_perm
arch/sparc/include/uapi/asm/ipcbuf.h:struct ipc64_perm
arch/xtensa/include/uapi/asm/ipcbuf.h:struct ipc64_perm
include/uapi/asm-generic/ipcbuf.h:struct ipc64_perm

Any reason you can't just #include <asm/ipcbuf.h> to get the kernel's definition for the correct architecture?

Arnd

#15 lore raw

PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar
Quoted 6 lines · Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

Right, here you do need to copy the struct definitions since I forgot to add a way to detect the presence in the kernel header files, sorry about that.

Possibly you could just have a check in the Makefile that lets skips the test if it fails to build because of old kernel headers? Or maybe check LINUX_VERSION_CODE to see if the headers are at least from linux-4.19?

Quoted 5 lines
 configure.ac                                  |   1 +
 include/sembuf.h                              | 234 ++++++++++++++++++
 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 testcases/kernel/syscalls/ipc/msgctl/msgctl05 | Bin 0 -> 498784 bytes

stale file

Quoted 10 lines
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +10 -0
+       /* get an IPC resource key */
+       key = GETIPCKEY();
+
+       semid = semget(key, 1, SEM_RA | IPC_CREAT);
+       if (semid == -1)
+               tst_brk(TBROK | TERRNO, "couldn't create semaphore");
+
+       arg.buf = (struct semid_ds *)&buf_ds;
+       TEST(semctl(semid, 0, IPC_STAT, arg));
+       if (TST_RET == -1)

testcases/kernel/syscalls/ipc/semctl/semctl08.c line 44

Quoted 10 lines
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +10 -0
+               tst_brk(TFAIL | TTERRNO, "semctl() failed");
+
+       if (buf_ds.sem_otime_high || buf_ds.sem_ctime_high)
+               tst_res(TFAIL, "time_high fields aren't cleared by the kernel");
+       else
+               tst_res(TPASS, "time_high fields cleared by the kernel");
+
+       if (semctl(semid, 0, IPC_RMID, arg) == -1)
+               tst_res(TINFO, "WARNING: semaphore deletion failed.");
+}

The test looks good to me.

If we wanted to get fancy, you could check that the time is actually correct when setting the system clock past y2038 with clock_settime64() at the start and then setting it back at the end.
That might risk crashing the system though, depending what else is running at the same time that relies on the time fitting into a 32-bit time_t.

Arnd

#29 lore raw

cover syscalls: Add tests to verify the _time_high fields

In reply to Arnd Bergmann

Hi!

Quoted 8 lines
Quoted 8 lines

This patchset adds a new test to three syscalls to verify that the extended fields, _time_high, are cleared by the kernel. This was suggested by Arnd.

I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.

Quoted 8 lines
Quoted 2 lines

Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)

The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).

We run LTP compiled with -m32 in our automation in SUSE precisely because of these reasons. Not sure if somebody else does that.

Signature · 2 lines
Cyril Hrubis
[email protected]
#16 lore raw

PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Arnd Bergmann

Hi!

Quoted 6 lines
Quoted 5 lines

The _time_high fields must be reset by the kernel, add a test to verify that.

Quoted 8 lines

Right, here you do need to copy the struct definitions since I forgot to add a way to detect the presence in the kernel header files, sorry about that.

Possibly you could just have a check in the Makefile that lets skips the test if it fails to build because of old kernel headers? Or maybe check LINUX_VERSION_CODE to see if the headers are at least from linux-4.19?

We usually include autotools checks and fallback definitions in include/lapi.h in this case.

Signature · 2 lines
Cyril Hrubis
[email protected]
#30 lore raw

cover syscalls: Add tests to verify the _time_high fields

In reply to Cyril Hrubis

Hi!

Quoted 8 lines
Quoted 5 lines

The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).

We run LTP compiled with -m32 in our automation in SUSE precisely because of these reasons. Not sure if somebody else does that.

In addition to a normal runs. And we also run syscalls with various kernel debugging enabled, I guess we have one flavor with SLUB_DEBUG etc.

Signature · 2 lines
Cyril Hrubis
[email protected]
#8 lore raw

PATCH 2/5 include: Add declaration of struct ipc64_perm

In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann
Quoted 5 lines · Viresh Kumar

This adds declaration of struct ipc64_perm, which will be used by following patches.

Like the other structures, there are multiple definitions in the kernel:

$ git grep ^struct.ipc64_perm

I searched with a { at the end :)

Quoted 9 lines

arch/parisc/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/powerpc/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/s390/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/sparc/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/xtensa/include/uapi/asm/ipcbuf.h:struct ipc64_perm include/uapi/asm-generic/ipcbuf.h:struct ipc64_perm

Any reason you can't just #include <asm/ipcbuf.h> to get the kernel's definition for the correct architecture?

Because the libc header may not have the definitions, and so we need to define our own.

Signature · 1 line
viresh
#17 lore raw

PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Cyril Hrubis
Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 10 lines
Quoted 5 lines

The _time_high fields must be reset by the kernel, add a test to verify that.

Right, here you do need to copy the struct definitions since I forgot to add a way to detect the presence in the kernel header files, sorry about that.

Quoted 7 lines
Quoted 4 lines

Possibly you could just have a check in the Makefile that lets skips the test if it fails to build because of old kernel headers? Or maybe check LINUX_VERSION_CODE to see if the headers are at least from linux-4.19?

We usually include autotools checks and fallback definitions in include/lapi.h in this case.

And that's what my patches are doing. They check for

#ifndef HAVE_MSQID64_DS

and then only go define them.

We can't work with kernel versions due to possible backporting of the patches to older kernels.

Signature · 1 line
viresh
#9 lore raw

PATCH v2 2/5 include: Add declaration of struct ipc64_perm

In reply to Viresh Kumar

This adds declaration of struct ipc64_perm, which will be used by following patches.

---
V2: Include definitions for other architectures as well.

 configure.ac     |   1 +
 include/ipcbuf.h | 199 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 200 insertions(+)
 create mode 100644 include/ipcbuf.h
configure.ac +1 -0
index 1d3ea58d0082..eaf33dd60350 100644
@@ -150,6 +150,7 @@ AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
 AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
+AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/ipcbuf.h new file +199 -0

199 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#18 lore raw

PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
V2: Remove stale file.

 configure.ac                                  |   1 +
 include/sembuf.h                              | 234 ++++++++++++++++++
 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 .../kernel/syscalls/ipc/semctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/semctl/Makefile |   5 +-
 .../kernel/syscalls/ipc/semctl/semctl08.c     |  52 ++++
 7 files changed, 294 insertions(+), 1 deletion(-)
 create mode 100644 include/sembuf.h
 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
configure.ac +1 -0
index eaf33dd60350..c513fdf440c2 100644
@@ -151,6 +151,7 @@ AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
+AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/sembuf.h new file +234 -0

234 lines not on this page · raw message

runtest/syscalls +1 -0
index edd3e8de7861..db14ba4baf9e 100644
@@ -1156,6 +1156,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
runtest/syscalls-ipc +1 -0
index 54d8622d4223..f912cb067f74 100644
@@ -33,6 +33,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
testcases/kernel/syscalls/ipc/semctl/.gitignore +1 -0
index b6899acf5da6..6189a04cc3c6 100644
@@ -5,3 +5,4 @@
 /semctl05
 /semctl06
 /semctl07
+/semctl08
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
index aa211d37f8ee..150f581825c5 100644
@@ -5,7 +5,10 @@ top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
+semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc
+semctl08: LDLIBS += -lltpnewipc
+
 LDFLAGS += -L$(top_builddir)/libs/libltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#31 lore raw

cover syscalls: Add tests to verify the _time_high fields

In reply to Cyril Hrubis
Quoted 12 lines · Cyril Hrubis

Hi!

Quoted 11 lines
Quoted 10 lines

This patchset adds a new test to three syscalls to verify that the extended fields, _time_high, are cleared by the kernel. This was suggested by Arnd.

I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.

Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)

Quoted 8 lines
Quoted 5 lines

The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).

We run LTP compiled with -m32 in our automation in SUSE precisely because of these reasons. Not sure if somebody else does that.

Okay, I tested LTP with:

LDFLAGS=-m32 CFLAGS=-m32 ./configure

and the time-high fields got cleared on my x86 machine with 5.5 kernel.

Signature · 1 line
viresh
#2 lore raw

PATCH 1/5 syscalls:ipc: Move libraries to libs/ director

In reply to Viresh Kumar

Hi!

Quoted 3 lines

Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.

Pushed with following diff, thanks.

1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap tests

libs/libltpipc/Makefile +1 -1
index 11f38ea0a..9fdc57894 100644
@@ -5,7 +5,7 @@ top_srcdir		?= ../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-LIB			:= libltpipc.a libltpmsgctl.a
+LIB			:= libltpipc.a
 
 include $(top_srcdir)/include/mk/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgctl/Makefile +2 -1
index e2b305573..a11cbcf2e 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpnewipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpnewipc
-LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgget/Makefile +2 -1
index e2b305573..a11cbcf2e 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpnewipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpnewipc
-LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/Makefile +2 -1
index aa211d37f..f62cd1f48 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgsnd/Makefile +2 -1
index b4930310f..17960cae3 100644
@@ -3,6 +3,8 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpnewipc
+
 ifeq ($(UCLINUX),1)
 FILTER_OUT_MAKE_TARGETS += msgsnd05 msgsnd06
 endif
@@ -10,6 +12,5 @@ endif
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpnewipc
-LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/Makefile +2 -2
index 551463829..f62cd1f48 100644
@@ -3,10 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDLIBS  += -lltpmsgctl
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/Makefile +2 -1
index aa211d37f..f62cd1f48 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semget/Makefile +2 -1
index aa211d37f..f62cd1f48 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semop/Makefile +2 -1
index aa211d37f..f62cd1f48 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmat/Makefile +2 -1
index e2b305573..a11cbcf2e 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpnewipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpnewipc
-LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/Makefile +2 -1
index dda6d636f..cfa5d6e76 100644
@@ -3,12 +3,13 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 shmctl05: CFLAGS += -pthread
 shmctl05: LDLIBS += -lrt
 
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmdt/Makefile +2 -1
index aa211d37f..f62cd1f48 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmget/Makefile +2 -1
index aa211d37f..f62cd1f48 100644
@@ -3,9 +3,10 @@
 
 top_srcdir              ?= ../../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/kill/Makefile +4 -2
index 3e32978fc..00cadabef 100644
@@ -3,9 +3,11 @@
 
 top_srcdir		?= ../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
+kill07: LDLIBS  += -lltpipc
+kill05: LDLIBS  += -lltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mremap/Makefile +3 -2
index 3e32978fc..7bdf425d2 100644
@@ -3,9 +3,10 @@
 
 top_srcdir		?= ../../../..
 
+LTPLIBS = ltpipc
+
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
-LDFLAGS += -L$(top_builddir)/libs/libltpipc
+mremap04: LDLIBS  += -lltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/5 syscalls:ipc: Move libraries to libs/ director

Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 3 lines

Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.

Pushed with following diff, thanks.

1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap tests

I don't think you pushed the changes you made. I still see my original patch there. :)

Signature · 1 line
viresh
#4 lore raw

PATCH 1/5 syscalls:ipc: Move libraries to libs/ director

Hi Cyril

Quoted 8 lines · Cyril Hrubis
Quoted 7 lines

Hi!

Quoted 3 lines

Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.

Pushed with following diff, thanks.

Quoted 7 lines
Quoted 4 lines

1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap tests

I don't think you pushed the changes you made. I still see my original patch there. :)

It looks like you miss this change. It still uses
LDFLAGS instead of correct LTPLIBS.

Best Regards
Yang Xu

Quoted 1 line
#5 lore raw

PATCH 1/5 syscalls:ipc: Move libraries to libs/ director

In reply to Viresh Kumar

Hi!

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.

Pushed with following diff, thanks.

Quoted 7 lines
Quoted 4 lines

1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap tests

I don't think you pushed the changes you made. I still see my original patch there. :)

Indeed, I messed up ammend when I was in a hurry, sorry for that. I've pushed a fix today.

Signature · 2 lines
Cyril Hrubis
[email protected]
#10 lore raw

PATCH v2 2/5 include: Add declaration of struct ipc64_perm

In reply to Viresh Kumar

Hi!
Applied with two changes, thanks.

* The header is moved to lapi/ where it should have been

* I've removed a piece of GPL header that probably ended up in the source due to copy&paste

Quoted 5 lines
include/ipcbuf.h new file +5 -0
+#if defined(__powerpc__) || defined(__powerpc64__)
+#define HAVE_IPC64_PERM
+/*
+ * The ipc64_perm structure for the powerpc is identical to
+ * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the

include/ipcbuf.h line 56

Quoted 10 lines
include/ipcbuf.h new file +10 -0
+ * kernel.  Note extra padding because this structure is passed back
+ * and forth between kernel and user space.  Pad space is left for:
+ *	- 1 32-bit value to fill up for 8-byte alignment
+ *	- 2 miscellaneous 64-bit values
+ *
+ * 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 part.
Signature · 2 lines
Cyril Hrubis
[email protected]
#19 lore raw

PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

Hi!

Quoted 258 lines

---
V2: Remove stale file.

 configure.ac                                  |   1 +
 include/sembuf.h                              | 234 ++++++++++++++++++
 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 .../kernel/syscalls/ipc/semctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/semctl/Makefile |   5 +-
 .../kernel/syscalls/ipc/semctl/semctl08.c     |  52 ++++
 7 files changed, 294 insertions(+), 1 deletion(-)
 create mode 100644 include/sembuf.h
 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
configure.ac +1 -0
index eaf33dd60350..c513fdf440c2 100644
@@ -151,6 +151,7 @@ AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
+AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/sembuf.h new file +224 -0
new file mode 100644
index 000000000000..00263abca995
@@ -0,0 +1,234 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Linaro Limited. All rights reserved.
+ * Author: Viresh Kumar <[email protected]>
+ */
+
+#ifndef IPC_SEMBUF_H
+#define IPC_SEMBUF_H
+
+#include <linux/posix_types.h>
+#include <sys/sem.h>
+#include "tst_timer.h"
+#include "ipcbuf.h"
+
+#ifndef HAVE_SEMID64_DS
+
+#if defined(__mips__)
+#define HAVE_SEMID64_DS
+/*
+ * The semid64_ds structure for the MIPS architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for 2 miscellaneous 64-bit values on mips64,
+ * but used for the upper 32 bit of the time values on mips32.
+ */
+#if defined(__arch64__)
+struct semid64_ds {
+	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
+	long		 sem_otime;		/* last semop time */
+	long		 sem_ctime;		/* last change time */
+	unsigned long	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	__unused1;
+	unsigned long	__unused2;
+};
+#else
+#define HAVE_SEMID64_DS_TIME_HIGH
+struct semid64_ds {
+	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
+	unsigned long   sem_otime;		/* last semop time */
+	unsigned long   sem_ctime;		/* last change time */
+	unsigned long	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	sem_otime_high;
+	unsigned long	sem_ctime_high;
+};
+#endif
+#endif /* __mips__ */
+
+#if defined(__hppa__)
+#define HAVE_SEMID64_DS
+/*
+ * The semid64_ds structure for parisc architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 2 miscellaneous 32-bit values
+ */
+struct semid64_ds {
+	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
+#if __BITS_PER_LONG == 64
+	long		sem_otime;		/* last semop time */
+	long		sem_ctime;		/* last change time */
+#else
+#define HAVE_SEMID64_DS_TIME_HIGH
+	unsigned long	sem_otime_high;
+	unsigned long	sem_otime;		/* last semop time */
+	unsigned long	sem_ctime_high;
+	unsigned long	sem_ctime;		/* last change time */
+#endif
+	unsigned long	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	__unused1;
+	unsigned long	__unused2;
+};
+#endif /* __hppa__ */
+
+#if defined(__powerpc__) || defined(__powerpc64__)
+#define HAVE_SEMID64_DS
+/*
+ * The semid64_ds structure for PPC architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 2 miscellaneous 32/64-bit values
+ */
+
+struct semid64_ds {
+	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
+#ifndef __powerpc64__
+#define HAVE_SEMID64_DS_TIME_HIGH
+	unsigned long	sem_otime_high;
+	unsigned long	sem_otime;	/* last semop time */
+	unsigned long	sem_ctime_high;
+	unsigned long	sem_ctime;	/* last change time */
+#else
+	long		sem_otime;	/* last semop time */
+	long		sem_ctime;	/* last change time */
+#endif
+	unsigned long	sem_nsems;	/* no. of semaphores in array */
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+#endif /* defined(__powerpc__) || defined(__powerpc64__) */
+
+#if defined(__sparc__)
+#define HAVE_SEMID64_DS
+/*
+ * The semid64_ds structure for sparc architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct semid64_ds {
+	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
+#if defined(__arch64__)
+	long		sem_otime;		/* last semop time */
+	long		sem_ctime;		/* last change time */
+#else
+#define HAVE_SEMID64_DS_TIME_HIGH
+	unsigned long	sem_otime_high;
+	unsigned long	sem_otime;		/* last semop time */
+	unsigned long	sem_ctime_high;
+	unsigned long	sem_ctime;		/* last change time */
+#endif
+	unsigned long	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	__unused1;
+	unsigned long	__unused2;
+};
+#endif /* __sparc__ */
+
+#if defined(__x86_64__)
+#define HAVE_SEMID64_DS
+/*
+ * The semid64_ds structure for x86 architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 2 miscellaneous 32-bit values
+ *
+ * x86_64 and x32 incorrectly added padding here, so the structures
+ * are still incompatible with the padding on x86.
+ */
+struct semid64_ds {
+	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
+#ifdef __i386__
+#define HAVE_SEMID64_DS_TIME_HIGH
+	unsigned long	sem_otime;	/* last semop time */
+	unsigned long	sem_otime_high;
+	unsigned long	sem_ctime;	/* last change time */
+	unsigned long	sem_ctime_high;
+#else
+	__kernel_long_t sem_otime;	/* last semop time */
+	__kernel_ulong_t __unused1;
+	__kernel_long_t sem_ctime;	/* last change time */
+	__kernel_ulong_t __unused2;
+#endif
+	__kernel_ulong_t sem_nsems;	/* no. of semaphores in array */
+	__kernel_ulong_t __unused3;
+	__kernel_ulong_t __unused4;
+};
+#endif /* defined(__x86_64__) */
+
+#if defined(__xtensa__)
+#define HAVE_SEMID64_DS
+#define HAVE_SEMID64_DS_TIME_HIGH
+
+struct semid64_ds {
+	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
+#ifdef __XTENSA_EL__
+	unsigned long	sem_otime;		/* last semop time */
+	unsigned long	sem_otime_high;
+	unsigned long	sem_ctime;		/* last change time */
+	unsigned long	sem_ctime_high;
+#else
+	unsigned long	sem_otime_high;
+	unsigned long	sem_otime;		/* last semop time */
+	unsigned long	sem_ctime_high;
+	unsigned long	sem_ctime;		/* last change time */
+#endif
+	unsigned long	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+
+#endif /* __xtensa__ */
+
+#ifndef HAVE_SEMID64_DS
+/*
+ * The semid64_ds structure for most architectures (though it came
+ * from x86_32 originally). Note extra padding because this structure
+ * is passed back and forth between kernel and user space.
+ *
+ * semid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures use a 64-bit long time field here, while
+ * 32 bit architectures have a pair of unsigned long values.
+ *
+ * On big-endian systems, the padding is in the wrong place for
+ * historic reasons, so user space has to reconstruct a time_t
+ * value using
+ *
+ * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
+ *		((long long)kernel_semid64_ds.sem_otime_high << 32)
+ *
+ * Pad space is left for 2 miscellaneous 32-bit values
+ */
+struct semid64_ds {
+	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
+#if __BITS_PER_LONG == 64
+	long		sem_otime;	/* last semop time */
+	long		sem_ctime;	/* last change time */
+#else
+#define HAVE_SEMID64_DS_TIME_HIGH
+	unsigned long	sem_otime;	/* last semop time */
+	unsigned long	sem_otime_high;
+	unsigned long	sem_ctime;	/* last change time */
+	unsigned long	sem_ctime_high;

include/sembuf.h line 234

Quoted 10 lines
include/sembuf.h new file +10 -0
+#endif
+	unsigned long	sem_nsems;	/* no. of semaphores in array */
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+#endif /* semid64_ds */
+
+#endif /* HAVE_SEMID64_DS */
+
+#endif /* IPC_SEMBUF_H */

Can we please put the header into the lapi/ and also split this patch so that we have one for the the fallback definition and one for the actuall test?

Quoted 38 lines
runtest/syscalls +1 -0
index edd3e8de7861..db14ba4baf9e 100644
@@ -1156,6 +1156,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
runtest/syscalls-ipc +1 -0
index 54d8622d4223..f912cb067f74 100644
@@ -33,6 +33,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
testcases/kernel/syscalls/ipc/semctl/.gitignore +1 -0
index b6899acf5da6..6189a04cc3c6 100644
@@ -5,3 +5,4 @@
 /semctl05
 /semctl06
 /semctl07
+/semctl08
testcases/kernel/syscalls/ipc/semctl/Makefile +0 -0
index aa211d37f8ee..150f581825c5 100644

testcases/kernel/syscalls/ipc/semctl/Makefile top_srcdir ?= ../../../../.. · line 12

Quoted 9 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
@@ -5,7 +5,10 @@ top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
+semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc
+semctl08: LDLIBS += -lltpnewipc
+
 LDFLAGS += -L$(top_builddir)/libs/libltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc

This does not apply anymore after my fix. This should be:

LTPLIBS = ltpipc ltpnewipc

Which would add a dependency on these libraries in the build system and also append the LDFLAGS, then all we need to do is to add the LDLIBS.

Quoted 49 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +0 -0
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +42 -0
new file mode 100644
index 000000000000..90a88989f2d3
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Viresh Kumar <[email protected]>
+ *
+ * Description:
+ * Cross verify the _high fields being set to 0 by the kernel.
+ */
+#include "lapi/semun.h"
+#include "tst_test.h"
+#include "libnewipc.h"
+#include "sembuf.h"
+
+#ifdef HAVE_SEMID64_DS_TIME_HIGH
+
+static void run(void)
+{
+	struct semid64_ds buf_ds = {
+		.sem_otime_high = 0x0A0A,
+		.sem_ctime_high = 0x0A0A,
+	};
+	int semid;
+	union semun arg;
+	key_t key;
+
+	/* get an IPC resource key */
+	key = GETIPCKEY();
+
+	semid = semget(key, 1, SEM_RA | IPC_CREAT);
+	if (semid == -1)
+		tst_brk(TBROK | TERRNO, "couldn't create semaphore");
+
+	arg.buf = (struct semid_ds *)&buf_ds;
+	TEST(semctl(semid, 0, IPC_STAT, arg));
+	if (TST_RET == -1)
+		tst_brk(TFAIL | TTERRNO, "semctl() failed");
+
+	if (buf_ds.sem_otime_high || buf_ds.sem_ctime_high)
+		tst_res(TFAIL, "time_high fields aren't cleared by the kernel");
+	else
+		tst_res(TPASS, "time_high fields cleared by the kernel");
+
+	if (semctl(semid, 0, IPC_RMID, arg) == -1)

testcases/kernel/syscalls/ipc/semctl/semctl08.c line 52

Quoted 10 lines
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +10 -0
+		tst_res(TINFO, "WARNING: semaphore deletion failed.");
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.needs_tmpdir = 1,
+};
+#else
+TST_TEST_TCONF("test requires struct semid64_ds to have the time_high fields");
+#endif

Other than that the patch looks good.

Signature · 2 lines
Cyril Hrubis
[email protected]
#20 lore raw

PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Cyril Hrubis
Quoted 17 lines · Cyril Hrubis
Quoted 5 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +0 -0
index aa211d37f8ee..150f581825c5 100644

testcases/kernel/syscalls/ipc/semctl/Makefile top_srcdir ?= ../../../../.. · line 12

Quoted 9 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
@@ -5,7 +5,10 @@ top_srcdir              ?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
+semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc
+semctl08: LDLIBS += -lltpnewipc
+
 LDFLAGS += -L$(top_builddir)/libs/libltpipc
+LDFLAGS += -L$(top_builddir)/libs/libltpnewipc

This does not apply anymore after my fix. This should be:

Quoted 4 lines

LTPLIBS = ltpipc ltpnewipc

Which would add a dependency on these libraries in the build system and also append the LDFLAGS, then all we need to do is to add the LDLIBS.

testcases/kernel/syscalls/ipc/semctl/Makefile +1 -2
index 6895fb1967a1..d7002872ab42 100644
@@ -3,7 +3,7 @@
 
 top_srcdir              ?= ../../../../..
 
-LTPLIBS = ltpipc
+LTPLIBS = ltpipc ltpnewipc
 
 include $(top_srcdir)/include/mk/testcases.mk
 
@@ -11,4 +11,4 @@ semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpi
 semctl08: LDLIBS += -lltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
-LDFLAGS += -L$(top_builddir)/libs/libltpnewipc

This doesn't build for some reason.

make -C "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc" -f "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/Makefile" all make[1]: *** /mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc: No such file or directory. Stop.
../../../../../include/mk/testcases.mk:52: recipe for target '/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a' failed
make: *** [/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a] Error 2

Signature · 1 line
viresh
#11 lore raw

PATCH v2 2/5 include: Add declaration of struct ipc64_perm

In reply to Cyril Hrubis
Quoted 17 lines · Cyril Hrubis

Hi!
Applied with two changes, thanks.

* The header is moved to lapi/ where it should have been

* I've removed a piece of GPL header that probably ended up in the source due to copy&paste

Quoted 9 lines
include/ipcbuf.h new file +9 -0
+#if defined(__powerpc__) || defined(__powerpc64__)
+#define HAVE_IPC64_PERM
+/*
+ * The ipc64_perm structure for the powerpc is identical to
+ * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
+ * kernel.  Note extra padding because this structure is passed back
+ * and forth between kernel and user space.  Pad space is left for:
+ *	- 1 32-bit value to fill up for 8-byte alignment
+ *	- 2 miscellaneous 64-bit values
Quoted 8 lines
Quoted 6 lines

+ *
+ * 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 part.

I don't see this patch in master yet.

Signature · 1 line
viresh
#21 lore raw

PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

Hi!

Quoted 19 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +1 -2
index 6895fb1967a1..d7002872ab42 100644
@@ -3,7 +3,7 @@
 
 top_srcdir              ?= ../../../../..
 
-LTPLIBS = ltpipc
+LTPLIBS = ltpipc ltpnewipc
 
 include $(top_srcdir)/include/mk/testcases.mk
 
@@ -11,4 +11,4 @@ semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpi
 semctl08: LDLIBS += -lltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
-LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
Quoted 6 lines

This doesn't build for some reason.

make -C "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc" -f "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/Makefile" all make[1]: *** /mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc: No such file or directory. Stop.
../../../../../include/mk/testcases.mk:52: recipe for target '/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a' failed
make: *** [/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a] Error 2

Ah, right, the rule that rebuilds the libraries does not work correctly for more than one library because I do pass "$^" there which is the list of directories and not a single directory.

As a quick hack this should fix it:

include/mk/testcases.mk +3 -1
index 684655fbf..7e0ec13f9 100644
@@ -49,7 +49,9 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach
 MAKE_DEPS += $(LTPLIBS_FILES)
 
 $(LTPLIBS_FILES): $(LTPLIBS_DIRS)
-       $(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all
+       for dir in $^; do \
+               $(MAKE) -C "$$dir" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$$dir)/Makefile" all; \
+       done
 
 LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
 

This does not parallelize the build but I guess that it would be fine since when we rebuild LTP from top directory the libraries are build first anyways and this is no-op.

Signature · 2 lines
Cyril Hrubis
[email protected]
#12 lore raw

PATCH v2 2/5 include: Add declaration of struct ipc64_perm

In reply to Viresh Kumar

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

+ * The ipc64_perm structure for the powerpc is identical to
+ * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
+ * kernel. Note extra padding because this structure is passed back
+ * and forth between kernel and user space. Pad space is left for:
+ * - 1 32-bit value to fill up for 8-byte alignment
+ * - 2 miscellaneous 64-bit values
+ *
+ * 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.
+ */

Quoted 4 lines
Quoted 2 lines
            ^
	    This part.

I don't see this patch in master yet.

Sorry, haven't done git push at the end of my workday, should be there now.

Signature · 2 lines
Cyril Hrubis
[email protected]
#22 lore raw

PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Cyril Hrubis
Quoted 22 lines · Cyril Hrubis

Ah, right, the rule that rebuilds the libraries does not work correctly for more than one library because I do pass "$^" there which is the list of directories and not a single directory.

As a quick hack this should fix it:

include/mk/testcases.mk +3 -1
index 684655fbf..7e0ec13f9 100644
@@ -49,7 +49,9 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach
 MAKE_DEPS += $(LTPLIBS_FILES)
 
 $(LTPLIBS_FILES): $(LTPLIBS_DIRS)
-       $(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all
+       for dir in $^; do \
+               $(MAKE) -C "$$dir" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$$dir)/Makefile" all; \
+       done
 
 LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
 
Quoted 3 lines

This does not parallelize the build but I guess that it would be fine since when we rebuild LTP from top directory the libraries are build first anyways and this is no-op.

Please merge it, I am sending my patches again based on this.

Signature · 1 line
viresh
#23 lore raw

PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields

Hi!

Quoted 1 line

Please merge it, I am sending my patches again based on this.

I've just pushed a proper fix with a pattern rule instead.

Signature · 2 lines
Cyril Hrubis
[email protected]
#13 lore raw

PATCH 2/5 include: Add declaration of struct ipc64_perm

In reply to Viresh Kumar

Hi,

Quoted 2 lines
include/ipcbuf.h new file +0 -0

...

Quoted 3 lines
include/ipcbuf.h new file +3 -0
+#include <linux/posix_types.h>
+
+#ifndef HAVE_IPC64_PERM

...

include/ipcbuf.h line 41

Quoted 13 lines
include/ipcbuf.h new file +13 -0
+struct ipc64_perm {
+	__kernel_key_t		key;
+	__kernel_uid32_t	uid;
+	__kernel_gid32_t	gid;
+	__kernel_uid32_t	cuid;
+	__kernel_gid32_t	cgid;
+	__kernel_mode_t		mode;
+				/* pad if mode_t is u16: */
+	unsigned char		__pad1[4 - sizeof(__kernel_mode_t)];
+	unsigned short		seq;
+	unsigned short		__pad2;
+	__kernel_ulong_t	__unused1;
+	__kernel_ulong_t	__unused2;

Since this commit we depend on kernel headers from v3.4-rc1
- __kernel_ulong_t was defined in afead38d011a ("posix_types: Introduce __kernel_[u]long_t").

I'll send a RFC patch, because not sure, whether we should still support these old versions, or just drop the oldest distro from Travis and declare kernel v3.4 dependency. BTW current glibc requires v3.2.

Kind regards,
Petr