From: Subrata <sub...@us...> - 2008-10-15 18:17:51
|
Update of /cvsroot/ltp/ltp/testcases/kernel/ipc/ipc_stress In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2513/ltp/testcases/kernel/ipc/ipc_stress Modified Files: shmem_test_06.c Log Message: This patch adds some debug messages when shmat(2) failed, so we could tell if the failure was because the requested address space has been used. In addition, it fixes the output of failed error code to a more meaningful form. This patch should be applied on the top of another patch I sent earlier with title "shmem_test_06 Failed with Stack Randomization". Tested successfully on a x86_64 machine. Signed-off-by: CAI Qian <ca...@cc...>. Index: shmem_test_06.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/ipc/ipc_stress/shmem_test_06.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** shmem_test_06.c 15 Oct 2008 14:49:30 -0000 1.4 --- shmem_test_06.c 15 Oct 2008 16:17:40 -0000 1.5 *************** *** 203,207 **** if ((long)(shmptr[i] = (char *) shmat (shmid[i], (const void*)offset, 0)) == -1) { ! sprintf(tmpstr, "shmat failed - return: %p", shmptr[i]); sys_error (tmpstr, __LINE__); } --- 203,213 ---- if ((long)(shmptr[i] = (char *) shmat (shmid[i], (const void*)offset, 0)) == -1) { ! /* If shmat(2) failed, we need the currect process address ! space layout to debug. The failure can be random. */ ! sprintf (tmpstr, "cat /proc/%d/maps >&2", (int) getpid ()); ! fprintf (stderr, "heap %p\n", sbrk (0)); ! system (tmpstr); ! ! sprintf(tmpstr, "shmat failed - return: %ld", (long)shmptr[i]); sys_error (tmpstr, __LINE__); } |