All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/shmget03: Stat and skip existing shared segments
@ 2021-08-04  0:42 Ian May
  2021-08-05 12:08 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Ian May @ 2021-08-04  0:42 UTC (permalink / raw)
  To: ltp

From: Ian May <ian.s.may@gmail.com>

Run a SHM_STAT prior to the creation of the shared memory segment.
This allows for not failing unexpectedly and still exhausting the
proper max shared segments.

Signed-off-by: Ian May <ian.s.may@gmail.com>
---
 testcases/kernel/syscalls/ipc/shmget/shmget03.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget03.c b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
index efbc465e1..fe91b6191 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget03.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
@@ -34,6 +34,7 @@ static void verify_shmget(void)
 static void setup(void)
 {
 	int res, num;
+	struct shmid_ds buf;
 
 	shmkey = GETIPCKEY();
 
@@ -41,6 +42,8 @@ static void setup(void)
 
 	queues = SAFE_MALLOC(maxshms * sizeof(int));
 	for (num = 0; num < maxshms; num++) {
+		if(shmctl(num, SHM_STAT, &buf) != -1)
+			continue;
 		res = shmget(shmkey + num, SHM_SIZE, IPC_CREAT | IPC_EXCL | SHM_RW);
 		if (res == -1)
 			tst_brk(TBROK | TERRNO, "shmget failed unexpectedly");
-- 
2.25.1


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

* [LTP] [PATCH] syscalls/shmget03: Stat and skip existing shared segments
  2021-08-04  0:42 [LTP] [PATCH] syscalls/shmget03: Stat and skip existing shared segments Ian May
@ 2021-08-05 12:08 ` Cyril Hrubis
  2021-08-05 13:53   ` Ian M
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2021-08-05 12:08 UTC (permalink / raw)
  To: ltp

Hi!
Yang Xu is already working on it, see:

http://patchwork.ozlabs.org/project/ltp/list/?series=256752

Thanks for the effort anyway.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH] syscalls/shmget03: Stat and skip existing shared segments
  2021-08-05 12:08 ` Cyril Hrubis
@ 2021-08-05 13:53   ` Ian M
  0 siblings, 0 replies; 3+ messages in thread
From: Ian M @ 2021-08-05 13:53 UTC (permalink / raw)
  To: ltp

That looks like a good solution!

Thanks,
Ian

On Thu, Aug 5, 2021 at 7:07 AM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> Yang Xu is already working on it, see:
>
> http://patchwork.ozlabs.org/project/ltp/list/?series=256752
>
> Thanks for the effort anyway.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210805/ea095991/attachment.htm>

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

end of thread, other threads:[~2021-08-05 13:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04  0:42 [LTP] [PATCH] syscalls/shmget03: Stat and skip existing shared segments Ian May
2021-08-05 12:08 ` Cyril Hrubis
2021-08-05 13:53   ` Ian M

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.