Probably attaching the patch is a good idea ! :)
R.
Le mercredi 02 avril 2008, Renaud Lottiaux a écrit :
> Hi !
>
> Fix concurrency issue in msgsnd05. Due to the use of usleep function to
> synchronize processes, synchronization issues can occur on a loaded
> system. Fix this by using pipes to synchronize processes.
>
> Signed-off-by: Matthieu Fertré <[EMAIL PROTECTED]>
>
> R.
--
Renaud Lottiaux
Kerlabs
Bâtiment Germanium
80, avenue des buttes de Coësmes
35700 Rennes - France
Phone : (+33|0)6 80 89 19 34
Fax : (+33|0)2 99 84 71 71
Email : [EMAIL PROTECTED]
Web : http://www.kerlabs.com/
Index: cvs/testcases/kernel/syscalls/ipc/msgsnd/Makefile
===================================================================
--- cvs.orig/testcases/kernel/syscalls/ipc/msgsnd/Makefile 2008-03-28 14:54:26.000000000 +0100
+++ cvs/testcases/kernel/syscalls/ipc/msgsnd/Makefile 2008-03-28 15:10:49.000000000 +0100
@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-CFLAGS += -I../lib -I../../../../../include -Wall
-LDLIBS += -L../../../../../lib -lltp -L.. -lipc
+CFLAGS += -I../lib -I../../lib -I../../../../../include -Wall
+LDLIBS += -L../../../../../lib -lltp -L.. -lipc -L../.. -ltestsuite
SRCS = $(wildcard *.c)
TARGETS = $(patsubst %.c,%,$(SRCS))
Index: cvs/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
===================================================================
--- cvs.orig/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c 2008-03-28 14:54:26.000000000 +0100
+++ cvs/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c 2008-03-28 15:12:16.000000000 +0100
@@ -50,6 +50,10 @@
*
* HISTORY
* 03/2001 - Written by Wayne Boyer
+ * 14/03/2008 Matthieu Fertré ([EMAIL PROTECTED])
+ * - Fix concurrency issue. Due to the use of usleep function to
+ * synchronize processes, synchronization issues can occur on a loaded
+ * system. Fix this by using pipes to synchronize processes.
*
* RESTRICTIONS
* none
@@ -59,6 +63,7 @@
#include "usctest.h"
#include "ipcmsg.h"
+#include "libtestsuite.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -85,6 +90,7 @@
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
pid_t c_pid;
+ int sync_pipes[2];
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -97,6 +103,10 @@
setup(); /* global setup */
+ if (create_sync_pipes(sync_pipes) == -1) {
+ tst_brkm(TBROK, cleanup, "cannot create sync pipes");
+ }
+
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
@@ -116,6 +126,12 @@
* Attempt to write another message to the full queue.
* Without the IPC_NOWAIT flag, the child sleeps
*/
+
+ if (notify_startup(sync_pipes) == -1) {
+ tst_brkm(TBROK, cleanup, "notify_startup failed");
+ }
+
+
#ifdef UCLINUX
if (self_exec(av[0], "d", msg_q_1) < 0) {
tst_brkm(TBROK, cleanup, "could not self_exec");
@@ -124,7 +140,15 @@
do_child();
#endif
} else { /* parent */
- usleep(250000);
+
+ if (wait_son_startup(sync_pipes) == -1) {
+ tst_brkm(TBROK, cleanup, "wait_son_startup failed");
+ }
+ /* After son has been created, give it a chance to execute the
+ * msgsnd command before we continue. Without this sleep, on SMP machine
+ * the father kill could be executed before the son msgsnd.
+ */
+ sleep(2);
/* send a signal that must be caught to the child */
if (kill(c_pid, SIGHUP) == -1) {
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list