2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

zdtm: don't wait in IPC queue on message operations

Otherwise test will sleep in kernel in case of queue is emptry on read or
queue is full on write.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrey Vagin <avagin@gmail.com>
This commit is contained in:
Kinsbursky Stanislav 2012-02-10 15:03:40 +03:00 committed by Andrey Vagin
parent ece90f467c
commit 2e0e295b51

View File

@ -59,7 +59,7 @@ static int test_fn(int argc, char **argv)
if (pid == 0) { if (pid == 0) {
test_waitsig(); test_waitsig();
if (msgrcv(msg, &msgbuf, sizeof(TEST_STRING), MSG_TYPE, 0) == -1) { if (msgrcv(msg, &msgbuf, sizeof(TEST_STRING), MSG_TYPE, IPC_NOWAIT) == -1) {
fail("Child: msgrcv failed (%m)"); fail("Child: msgrcv failed (%m)");
return -errno; return -errno;
} }
@ -72,7 +72,7 @@ static int test_fn(int argc, char **argv)
msgbuf.mtype = ANOTHER_MSG_TYPE; msgbuf.mtype = ANOTHER_MSG_TYPE;
memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING)); memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING));
if (msgsnd(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), 0) != 0) { if (msgsnd(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), IPC_NOWAIT) != 0) {
fail("Child: msgsnd failed (%m)"); fail("Child: msgsnd failed (%m)");
return -errno; return -errno;
}; };
@ -81,7 +81,7 @@ static int test_fn(int argc, char **argv)
} else { } else {
msgbuf.mtype = MSG_TYPE; msgbuf.mtype = MSG_TYPE;
memcpy(msgbuf.mtext, TEST_STRING, sizeof(TEST_STRING)); memcpy(msgbuf.mtext, TEST_STRING, sizeof(TEST_STRING));
if (msgsnd(msg, &msgbuf, sizeof(TEST_STRING), 0) != 0) { if (msgsnd(msg, &msgbuf, sizeof(TEST_STRING), IPC_NOWAIT) != 0) {
fail("Parent: msgsnd failed (%m)"); fail("Parent: msgsnd failed (%m)");
goto err_kill; goto err_kill;
}; };
@ -99,7 +99,7 @@ static int test_fn(int argc, char **argv)
goto out; goto out;
} }
if (msgrcv(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), ANOTHER_MSG_TYPE, 0) == -1) { if (msgrcv(msg, &msgbuf, sizeof(ANOTHER_TEST_STRING), ANOTHER_MSG_TYPE, IPC_NOWAIT) == -1) {
fail("Parent: msgrcv failed (%m)"); fail("Parent: msgrcv failed (%m)");
goto err; goto err;
} }