From: xuyang2018.jy@fujitsu.com <xuyang2018.jy@fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/shmctl04: Add kernel version requestions
Date: Tue, 30 Mar 2021 01:51:14 +0000 [thread overview]
Message-ID: <6062841B.6030302@fujitsu.com> (raw)
In-Reply-To: <20210329134647.27740-1-zhaogongyi@huawei.com>
Hi Gongyi
> SHM_STAT_ANY is imported to linux in v4.17.
>
> Signed-off-by: Zhao Gongyi<zhaogongyi@huawei.com>
> ---
> testcases/kernel/syscalls/ipc/shmctl/shmctl04.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
> index 9e8ec4199..18ac8ba0a 100644
> --- a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
> +++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
> @@ -168,6 +168,7 @@ static void cleanup(void)
> }
>
> static struct tst_test test = {
> + .min_kver = "4.17",
Some linux distribution such as centos7.8 has backported this feature,
so we should call SHM_STAT_ANY directly to detect whether kernel
supports SHM_STAT_ANY instead of using min_kver.
code as below:
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
@@ -155,10 +155,19 @@ static void verify_shminfo(unsigned int n)
static void setup(void)
{
struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
+ struct shmid_ds temp_ds;
nobody_uid = ltpuser->pw_uid;
root_uid = 0;
shm_id = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | SHM_RW);
+ TEST(shmctl(shm_id, SHM_STAT_ANY, &temp_ds));
+ if (TST_RET == -1) {
+ if (TST_ERR == EINVAL)
+ tst_brk(TCONF, "kernel doesn't support
SHM_STAT_ANY");
+ else
+ tst_brk(TBROK | TTERRNO,
+ "Current environment doesn't permit
SHM_STAT_ANY");
+ }
}
Also, On your environment, does semctl09.c/msgctl06.c have the same problem?
> .setup = setup,
> .cleanup = cleanup,
> .test = verify_shminfo,
> --
> 2.17.1
>
>
next prev parent reply other threads:[~2021-03-30 1:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 13:46 [LTP] [PATCH] syscalls/shmctl04: Add kernel version requestions Zhao Gongyi
2021-03-30 1:51 ` xuyang2018.jy [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-03-30 1:58 zhaogongyi
2021-03-30 2:05 ` xuyang2018.jy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6062841B.6030302@fujitsu.com \
--to=xuyang2018.jy@fujitsu.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox