[LTP] [PATCH v2 3/3] shmctl03: Use safe_shmctl(), TST_EXP_LE_LU()
Petr Vorel
pvorel@suse.cz
Thu Sep 24 13:25:14 CEST 2026
Shorten code with safe function and test macro.
Link manpage.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: it can be postponed after the release.
testcases/kernel/syscalls/shmctl/shmctl03.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/testcases/kernel/syscalls/shmctl/shmctl03.c b/testcases/kernel/syscalls/shmctl/shmctl03.c
index 0a4e27ce98..46ab989b10 100644
--- a/testcases/kernel/syscalls/shmctl/shmctl03.c
+++ b/testcases/kernel/syscalls/shmctl/shmctl03.c
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2026
*/
/*\
- * Call shmctl() with IPC_INFO flag and check that the data are consistent with
- * /proc/sys/kernel/shm*.
+ * Call :manpage:`shmctl(2)` with IPC_INFO flag and check that the data are
+ * consistent with /proc/sys/kernel/shm*.
*/
#define _GNU_SOURCE
@@ -17,18 +18,8 @@ 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");
+ safe_shmctl(__FILE__, __LINE__, 0, IPC_INFO, ((struct shmid_ds *)&info));
+ TST_EXP_LE_LU(info.shmmin, 1);
if (tst_is_compat_mode() && info.shmmax == INT_MAX) {
unsigned long long shmmax;
--
2.55.0
More information about the ltp
mailing list