Message ID | 20210804004216.2754304-1-ian.may@canonical.com |
---|---|
State | Rejected |
Headers | show |
Series | syscalls/shmget03: Stat and skip existing shared segments | expand |
Hi! Yang Xu is already working on it, see: http://patchwork.ozlabs.org/project/ltp/list/?series=256752 Thanks for the effort anyway.
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 >
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");