All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
@ 2017-02-06 12:42 Xiao Yang
  2017-02-15  1:26 ` Xiao Yang
  2017-02-15 15:24 ` Cyril Hrubis
  0 siblings, 2 replies; 9+ messages in thread
From: Xiao Yang @ 2017-02-06 12:42 UTC (permalink / raw)
  To: ltp

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);
 }
 
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
  2017-02-06 12:42 [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max Xiao Yang
@ 2017-02-15  1:26 ` Xiao Yang
  2017-02-15 15:24 ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Xiao Yang @ 2017-02-15  1:26 UTC (permalink / raw)
  To: ltp

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);
>  }
>  




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
  2017-02-06 12:42 [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max Xiao Yang
  2017-02-15  1:26 ` Xiao Yang
@ 2017-02-15 15:24 ` Cyril Hrubis
  2017-02-15 16:50   ` Jan Stancek
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-15 15:24 UTC (permalink / raw)
  To: ltp

Hi!
> 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.

First I think that you have wrong commit, the one that actually added
the limits was:

commit 93e6f119c0ce8a1bba6e81dc8dd97d67be360844
Author: Doug Ledford <dledford@redhat.com>
Date:   Thu May 31 16:26:28 2012 -0700

    ipc/mqueue: cleanup definition names and locations

Since this commit changes the proc handler in sysctl table and adds the minimum
and maximum values there.

Secondly these limits were removed in:

commit a5c5928b759d8c7382cccc7be36769a68046cc58
Author: Joe Perches <joe@perches.com>
Date:   Fri Jun 6 14:38:07 2014 -0700

    ipc: convert use of typedef ctl_table to struct ctl_table


I'm not sure if this is worth the effort.

Jan what do you think, should we apply this to fix the test on RHEL6?

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
  2017-02-15 15:24 ` Cyril Hrubis
@ 2017-02-15 16:50   ` Jan Stancek
  2017-02-15 18:19     ` Jan Stancek
  2017-02-16  1:20   ` Xiao Yang
  2017-02-16  2:38   ` [LTP] [PATCH v2] " Xiao Yang
  2 siblings, 1 reply; 9+ messages in thread
From: Jan Stancek @ 2017-02-15 16:50 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Xiao Yang" <yangx.jy@cn.fujitsu.com>
> Cc: ltp@lists.linux.it, "Jan Stancek" <jstancek@redhat.com>
> Sent: Wednesday, 15 February, 2017 4:24:06 PM
> Subject: Re: [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
> 
> Hi!
> > 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

since RHEL6.2

> > 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.
> 
> First I think that you have wrong commit, the one that actually added
> the limits was:
> 
> commit 93e6f119c0ce8a1bba6e81dc8dd97d67be360844

since RHEL6.2

> Author: Doug Ledford <dledford@redhat.com>
> Date:   Thu May 31 16:26:28 2012 -0700
> 
>     ipc/mqueue: cleanup definition names and locations
> 
> Since this commit changes the proc handler in sysctl table and adds the
> minimum
> and maximum values there.
> 
> Secondly these limits were removed in:
> 
> commit a5c5928b759d8c7382cccc7be36769a68046cc58

doesn't seem to present in any RHEL6 kernel

> Author: Joe Perches <joe@perches.com>
> Date:   Fri Jun 6 14:38:07 2014 -0700
> 
>     ipc: convert use of typedef ctl_table to struct ctl_table
> 
> 
> I'm not sure if this is worth the effort.
> 
> Jan what do you think, should we apply this to fix the test on RHEL6?

I would like this to work with RHEL6, but it be good to understand
why failures started for Xiao only now.

I'm looking at results of kernel-2.6.32-694.el6 (6.9), and it's passing:
<<<test_start>>>
tag=mq_open01 stime=1487065446
cmdline="mq_open01"
contacts=""
analysis=exit
<<<test_output>>>
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)=       7 errno=0 (Success)
mq_open01    0  TINFO  :  (case00) START
mq_open01    0  TINFO  :  mq_maxmsg E:20,	R:20
mq_open01    0  TINFO  :  mq_msgsize E:16384,	R:16384
mq_open01    0  TINFO  :  (case00) END => OK
mq_open01    1  TPASS  :  mq_open call succeeded 
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=0 corefile=no
cutime=0 cstime=0
<<<test_end>>>

I'll try 6.8 too.

Regards,
Jan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
  2017-02-15 16:50   ` Jan Stancek
@ 2017-02-15 18:19     ` Jan Stancek
  2017-02-16  9:37       ` Cyril Hrubis
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Stancek @ 2017-02-15 18:19 UTC (permalink / raw)
  To: ltp

> I'm looking at results of kernel-2.6.32-694.el6 (6.9), and it's passing:
> <<<test_start>>>
> tag=mq_open01 stime=1487065446
> cmdline="mq_open01"
> contacts=""
> analysis=exit
> <<<test_output>>>
> EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
> RESULT: return value(ret)=       7 errno=0 (Success)
> mq_open01    0  TINFO  :  (case00) START
> mq_open01    0  TINFO  :  mq_maxmsg E:20,	R:20
> mq_open01    0  TINFO  :  mq_msgsize E:16384,	R:16384
> mq_open01    0  TINFO  :  (case00) END => OK
> mq_open01    1  TPASS  :  mq_open call succeeded
> <<<execution_status>>>
> initiation_status="ok"
> duration=0 termination_type=exited termination_id=0 corefile=no
> cutime=0 cstime=0
> <<<test_end>>>

Oh, I see, the testcase has changed:
 8e49ed6b0fa2 "syscalls/mq_open: fix old tests + convert to use new API"
I was using ltp-20170116. git HEAD fails for me too:

# ./mq_open01
tst_test.c:812: INFO: Timeout per run is 0h 05m 00s
mq_open01.c:230: INFO: queue name "/test_mqueue"
mq_open01.c:260: PASS: NORMAL returned: 3: SUCCESS
mq_open01.c:230: INFO: queue name "/test_mqueue"
mq_open01.c:260: PASS: NORMAL returned: 3: SUCCESS
mq_open01.c:230: INFO: queue name "/caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
mq_open01.c:260: PASS: NORMAL returned: 3: SUCCESS
mq_open01.c:230: INFO: queue name "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
mq_open01.c:277: PASS: NORMAL returned: -1: ENAMETOOLONG
mq_open01.c:230: INFO: queue name ""
mq_open01.c:277: PASS: NORMAL returned: -1: EINVAL
mq_open01.c:230: INFO: queue name "/test_mqueue"
mq_open01.c:277: PASS: NORMAL returned: -1: EACCES
mq_open01.c:230: INFO: queue name "/test_mqueue"
mq_open01.c:277: PASS: NORMAL returned: -1: EEXIST
mq_open01.c:230: INFO: queue name "/test_mqueue"
mq_open01.c:277: PASS: NO_FILE returned: -1: EMFILE
mq_open01.c:230: INFO: queue name "/notexist"
mq_open01.c:277: PASS: NORMAL returned: -1: ENOENT
mq_open01.c:230: INFO: queue name "/test_mqueue"
safe_file_ops.c:301: BROK: Failed to close FILE '/proc/sys/fs/mqueue/queues_max' at mq_open01.c:177: EINVAL

So, yes, I'd prefer to apply Xiao's patch. It shouldn't affect
test on newer kernels, and we can test older ones too.

Regards,
Jan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
  2017-02-15 15:24 ` Cyril Hrubis
  2017-02-15 16:50   ` Jan Stancek
@ 2017-02-16  1:20   ` Xiao Yang
  2017-02-16  2:38   ` [LTP] [PATCH v2] " Xiao Yang
  2 siblings, 0 replies; 9+ messages in thread
From: Xiao Yang @ 2017-02-16  1:20 UTC (permalink / raw)
  To: ltp

On 2017/02/15 23:24, Cyril Hrubis wrote:
> Hi!
>> 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.
> First I think that you have wrong commit, the one that actually added
> the limits was:
>
> commit 93e6f119c0ce8a1bba6e81dc8dd97d67be360844
> Author: Doug Ledford<dledford@redhat.com>
> Date:   Thu May 31 16:26:28 2012 -0700
>
>      ipc/mqueue: cleanup definition names and locations
>
> Since this commit changes the proc handler in sysctl table and adds the minimum
> and maximum values there.
>
> Secondly these limits were removed in:
>
> commit a5c5928b759d8c7382cccc7be36769a68046cc58
> Author: Joe Perches<joe@perches.com>
> Date:   Fri Jun 6 14:38:07 2014 -0700
>
>      ipc: convert use of typedef ctl_table to struct ctl_table
>
Hi Cyril

Thanks for your review.
I will change commit as you said and send v2 patch.

Best Regards,
Xiao Yang
> I'm not sure if this is worth the effort.
>
> Jan what do you think, should we apply this to fix the test on RHEL6?
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2] syscalls/mq_open: fix limits for queues_max
  2017-02-15 15:24 ` Cyril Hrubis
  2017-02-15 16:50   ` Jan Stancek
  2017-02-16  1:20   ` Xiao Yang
@ 2017-02-16  2:38   ` Xiao Yang
  2017-02-16  9:28     ` Cyril Hrubis
  2 siblings, 1 reply; 9+ messages in thread
From: Xiao Yang @ 2017-02-16  2:38 UTC (permalink / raw)
  To: ltp

1) 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 and hasn't been removed on some distributions.

   these limits are added in kernel:
   '93e6f119c0ce8("ipc/mqueue: cleanup definition names and locations")'

   these limits are removed in kernel:
   'a5c5928b759d8("ipc: convert use of typedef ctl_table to struct ctl_table")'

2) This case fails recently because it has been changed in ltp:
   '8e49ed6b0fa28("syscalls/mq_open: fix old tests + convert to use new API")'

We set queues_max to 1 instead of 0, so this case can work on both
older kernels(eg. RHEL6) and newer kernels.

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..6324d92 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);
 }
 
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2] syscalls/mq_open: fix limits for queues_max
  2017-02-16  2:38   ` [LTP] [PATCH v2] " Xiao Yang
@ 2017-02-16  9:28     ` Cyril Hrubis
  0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-16  9:28 UTC (permalink / raw)
  To: ltp

Hi!
>    these limits are removed in kernel:
>    'a5c5928b759d8("ipc: convert use of typedef ctl_table to struct ctl_table")'

And I did a copy & paste error yesterday, the right commit is:

      f3713fd9cff73
      ("ipc,mqueue: remove limits for the amount of system-wide queues")

I will fix that in the commit message and push the patch, thanks.

> 2) This case fails recently because it has been changed in ltp:
>    '8e49ed6b0fa28("syscalls/mq_open: fix old tests + convert to use new API")'
> 
> We set queues_max to 1 instead of 0, so this case can work on both
> older kernels(eg. RHEL6) and newer kernels.
> 
> 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..6324d92 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);
>  }
>  
> -- 
> 1.8.3.1
> 
> 
> 

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max
  2017-02-15 18:19     ` Jan Stancek
@ 2017-02-16  9:37       ` Cyril Hrubis
  0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-16  9:37 UTC (permalink / raw)
  To: ltp

Hi!
> Oh, I see, the testcase has changed:
>  8e49ed6b0fa2 "syscalls/mq_open: fix old tests + convert to use new API"
> I was using ltp-20170116. git HEAD fails for me too:

Yep, all but the fist testcase were ifdefed out, so we never tried to
set the max_queues to 0 at all, that explains it.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-02-16  9:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 12:42 [LTP] [PATCH] syscalls/mq_open: fix limits for queues_max Xiao Yang
2017-02-15  1:26 ` Xiao Yang
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

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.