1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz> 4 */ 5 6/*\ 7 * [Description] 8 * 9 * Call shmctl() with IPC_INFO flag and check that the data are consistent with 10 * /proc/sys/kernel/shm*. 11 */ 12 13#define _GNU_SOURCE 14#include "tst_test.h" 15#include "tst_safe_sysv_ipc.h" 16#include "libnewipc.h" 17 18static void verify_ipcinfo(void) 19{ 20 struct shminfo info; 21 22 TEST(shmctl(0, IPC_INFO, (struct shmid_ds *)&info)); 23 24 if (TST_RET < 0) { 25 tst_res(TFAIL | TTERRNO, 26 "shmctl(0, IPC_INFO, ...) returned %li", TST_RET); 27 return; 28 } 29 30 if (info.shmmin != 1) 31 tst_res(TFAIL, "shmmin = %li, expected 1", info.shmmin); 32 else 33 tst_res(TPASS, "shmmin = 1"); 34 35 TST_ASSERT_ULONG("/proc/sys/kernel/shmmax", info.shmmax); 36 TST_ASSERT_ULONG("/proc/sys/kernel/shmmni", info.shmmni); 37 TST_ASSERT_ULONG("/proc/sys/kernel/shmall", info.shmall); 38} 39 40static struct tst_test test = { 41 .test_all = verify_ipcinfo, 42}; 43