<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 18, 2020 at 12:36 AM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail_default" style="font-size:small">...</span><br>
+static void verify_shmset(void)<br>
+{<br>
+       struct shmid_ds ds;<br>
+       unsigned short old_mode;<br>
+       time_t old_ctime;<br>
+<br>
+       SAFE_SHMCTL(shm_id, IPC_STAT, &ds);<br>
+<br>
+       old_mode = ds.shm_perm.mode;<br>
+       old_ctime = ds.shm_ctime;<br>
+<br>
+       sleep(1);<br>
+<br>
+       ds.shm_perm.mode &= ~0066;<br>
+<br>
+       if (test_ipc_set(&ds))<br>
+               return;<br>
+<br>
+       memset(&ds, 0, sizeof(ds));<br>
+       SAFE_SHMCTL(shm_id, IPC_STAT, &ds);<br>
+       check_mode(&ds, old_mode & ~0066);<br>
+<br>
+       if (ds.shm_ctime - old_ctime > 10) {<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Maybe we also need to consider a situation that timestamp is just as previous value?</div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">i.e.</div></div><div class="gmail_default" style="font-size:small">    if (ds.shm_ctime - old_ctime > 10 || ds.shm_ctime - old_ctime == 0) </div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               tst_res(TFAIL, "shm_ctime not updated old %li new %li",<br>
+                       (long)old_ctime, (long)ds.shm_ctime);<br>
+       } else {<br>
+               tst_res(TPASS, "shm_ctime updated correctly diff=%li",<br>
+                       (long)(ds.shm_ctime - old_ctime));<br>
+       }<br>
+<br></blockquote><div><br></div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>