@@ -1355,6 +1355,7 @@ shmat03 shmat03
shmctl01 shmctl01
shmctl02 shmctl02
+shmctl03 shmctl03
shmctl04 shmctl04
shmctl05 shmctl05
shmctl06 shmctl06
@@ -51,6 +51,7 @@ shmat02 shmat02
shmctl01 shmctl01
shmctl02 shmctl02
+shmctl03 shmctl03
shmctl04 shmctl04
shmctl05 shmctl05
shmctl06 shmctl06
@@ -1,5 +1,6 @@
/shmctl01
/shmctl02
+/shmctl03
/shmctl04
/shmctl05
/shmctl06
new file mode 100644
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
+ */
+/*
+ * Call shmctl() with IPC_INFO flag and check that the data are consistent with
+ * /proc/sys/kernel/shm*.
+ */
+
+#define _GNU_SOURCE
+#include "tst_test.h"
+#include "tst_safe_sysv_ipc.h"
+#include "libnewipc.h"
+
+static void verify_ipcinfo(void)
+{
+ struct shminfo info;
+
+ TEST(shmctl(0, IPC_INFO, (struct shmid_ds *)&info));
+
+ if (TST_RET < 0) {
+ tst_res(TFAIL | TTERRNO,
+ "shmctl(0, IPC_INFO, ...) returned %li",
+ TST_RET);
+ return;
+ }
+
+ if (info.shmmin != 1)
+ tst_res(TFAIL, "shmmin = %li, expected 1", info.shmmin);
+ else
+ tst_res(TPASS, "shmmin = 1");
+
+ TST_ASSERT_ULONG("/proc/sys/kernel/shmmax", info.shmmax);
+ TST_ASSERT_ULONG("/proc/sys/kernel/shmmni", info.shmmni);
+ TST_ASSERT_ULONG("/proc/sys/kernel/shmall", info.shmall);
+}
+
+static struct tst_test test = {
+ .test_all = verify_ipcinfo,
+};
Signed-off-by: Cyril Hrubis <chrubis@suse.cz> --- runtest/syscalls | 1 + runtest/syscalls-ipc | 1 + .../kernel/syscalls/ipc/shmctl/.gitignore | 1 + .../kernel/syscalls/ipc/shmctl/shmctl03.c | 40 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl03.c