From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
Date: Wed, 15 Feb 2017 09:26:57 +0800 [thread overview]
Message-ID: <58A3AE61.6090507@cn.fujitsu.com> (raw)
In-Reply-To: <1486384930-28588-1-git-send-email-yangx.jy@cn.fujitsu.com>
Hi!
Ping, Thanks. :-)
Best Regards,
Xiao Yang
On 2017/02/06 20:42, Xiao Yang wrote:
> This case fails on RHEL6.8GA and RHEL6.9Beta, because setting
> queues_max to 0 is invalid. the minimum value of queues_max
> has been limitted to 1 on some distributions, Please see the
> following kernel commit:
>
> commit 5b5c4d1a1440e94994c73dddbad7be0676cd8b9a
> Author: Doug Ledford <dledford@redhat.com>
> Date: Thu May 31 16:26:30 2012 -0700
>
> ipc/mqueue: update maximums for the mqueue subsystem
>
> We set queues_max to 1 instead of 0, so this case can work on RHEL6.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/mq_open/mq_open01.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c
> index d6f7196..caffaf5 100644
> --- a/testcases/kernel/syscalls/mq_open/mq_open01.c
> +++ b/testcases/kernel/syscalls/mq_open/mq_open01.c
> @@ -28,6 +28,7 @@
> #include "tst_test.h"
>
> #define QUEUE_NAME "/test_mqueue"
> +#define QUEUE_INIT "/init_mqueue"
>
> static uid_t euid;
> static struct passwd *pw;
> @@ -35,6 +36,7 @@ static char *qname;
> static struct rlimit rlim;
>
> static mqd_t fd, fd2;
> +static mqd_t fd3 = -1;
> static int max_queues;
>
> struct test_case {
> @@ -174,7 +176,7 @@ static void unlink_queue(void)
> static void set_max_queues(void)
> {
> SAFE_FILE_SCANF(PROC_MAX_QUEUES, "%d", &max_queues);
> - SAFE_FILE_PRINTF(PROC_MAX_QUEUES, "%d", 0);
> + SAFE_FILE_PRINTF(PROC_MAX_QUEUES, "%d", 1);
>
> SAFE_SETEUID(pw->pw_uid);
> }
> @@ -206,6 +208,10 @@ static void setup(void)
> euid = geteuid();
> pw = SAFE_GETPWNAM("nobody");
> SAFE_GETRLIMIT(RLIMIT_NOFILE, &rlim);
> +
> + fd3 = mq_open(QUEUE_INIT, O_CREAT | O_EXCL | O_RDWR, S_IRWXU, NULL);
> + if (fd3 == -1)
> + tst_brk(TBROK | TERRNO, "mq_open(%s) failed", QUEUE_INIT);
> }
>
> static void cleanup(void)
> @@ -216,6 +222,12 @@ static void cleanup(void)
> if (fd2 > 0)
> mq_close(fd2);
>
> + if (fd3 > 0 && mq_close(fd3))
> + tst_res(TWARN | TERRNO, "mq_close(%s) failed", QUEUE_INIT);
> +
> + if (mq_unlink(QUEUE_INIT))
> + tst_res(TWARN | TERRNO, "mq_unlink(%s) failed", QUEUE_INIT);
> +
> mq_unlink(qname);
> }
>
next prev parent reply other threads:[~2017-02-15 1:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 12:42 [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max Xiao Yang
2017-02-15 1:26 ` Xiao Yang [this message]
2017-02-15 15:24 ` Cyril Hrubis
2017-02-15 16:50 ` Jan Stancek
2017-02-15 18:19 ` Jan Stancek
2017-02-16 9:37 ` Cyril Hrubis
2017-02-16 1:20 ` Xiao Yang
2017-02-16 2:38 ` [LTP] [PATCH v2] " Xiao Yang
2017-02-16 9:28 ` Cyril Hrubis
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=58A3AE61.6090507@cn.fujitsu.com \
--to=yangx.jy@cn.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.