From: V.R.Sundar <vr_...@at...> - 2003-01-15 08:32:48
|
Hi, The patch below fixes the following in msgctl09 & msgctl08 (1) Set permissions to to allow user read & write (S_IRUSR| S_IWUSR) when creating the message queue as otherwise msgsnd & msgrcv fail with EACCESS and other related error msgs. ( This doesn't happen if you run the testcase as root even though the perms were originally being set to 0 ). (2) In msgctl09, under certain error conditions, the message queues are not removed on exit. So after you run it a few times, you hit the system limit for message queues and start getting ENOSPC errors (3) In msgctl09, don't create a message queue in dowriter if it doesn't exist. These 2 tests seem to be commented out in runtest/syscalls in the normal releases but are not commented out in the files from cvs. Wasn't able to check with the latest cvs code as sourceforge seems to be having some problems. sundar --- ltp-20030110/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c.old 2003-01-14 19:53:30.000000000 -0800 +++ ltp-20030110/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c 2003-01-14 20:01:14.000000000 -0800 @@ -239,7 +239,7 @@ int id, pid; sighold(SIGTERM); - TEST(msgget(key, IPC_CREAT)); + TEST(msgget(key, IPC_CREAT | S_IRUSR | S_IWUSR)); if (TEST_RETURN < 0) { tst_resm(TFAIL, "\tMsgget error in child %d, errno = %d\n", child_process, TEST_ERRNO); --- ltp-20030110/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c.old 2002-12-05 12:12:29.000000000 -0800 +++ ltp-20030110/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c 2003-01-14 19:23:46.000000000 -0800 @@ -36,6 +36,7 @@ */ #define _XOPEN_SOURCE 500 +#include <sys/stat.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> @@ -256,7 +257,7 @@ int i, count, status, exit_status; sighold(SIGTERM); - if ((id = msgget(key, IPC_CREAT)) < 0) + if ((id = msgget(key, IPC_CREAT | S_IRUSR | S_IWUSR )) < 0) { tst_resm(TFAIL, "\tMsgget error in child %d, errno = %d\n", child_process, errno); tst_exit(); @@ -354,6 +355,9 @@ kill(rkidarray[i], SIGTERM); kill(wkidarray[i], SIGTERM); } + if (msgctl(tid, IPC_RMID, 0) < 0) { + tst_resm(TFAIL, "\tMsgctl error, errno = %d\n", errno); + } tst_exit(); } count++; @@ -370,6 +374,9 @@ if (count != (nkids * 2)) { tst_resm(TFAIL, "\tWrong number of children exited in child group %d, Saw %d Expected %d \n", child_process, count, (nkids * 2)); + if (msgctl(tid, IPC_RMID, 0) < 0) { + tst_resm(TFAIL, "\tMsgctl error, errno = %d\n", errno); + } tst_exit(); } if (msgctl(id, IPC_RMID, 0) < 0) @@ -432,7 +439,7 @@ int i, size; int id; - if ((id = msgget(key, IPC_CREAT)) < 0) + if ((id = msgget(key, 0)) < 0) { tst_resm(TFAIL, "\tMsgget error in writer of child group %d, errno = %d\n", child, errno); tst_exit(); -- V.R.Sundar <vr_...@at...> |