For mips architecture, SHMLBA is not equal to PAGE_SIZE base_addr is not available address for process after base_addr is aligned to next SHMLBA address. so we should probe a bigger available virtual address space for ensuring that a wide range from base_addr aligned to next SHMLBA to base_addr + INT_SIZE always is available
PATCH 1/1 For mips architecture, SHMLBA is not equal to PAGE_SIZE base_addr is not available address for process after base_addr is aligned to next SHMLBA address. so we should probe a bigger available virtual address space for ensuring that a wide range from base_addr aligned to next SHMLBA to base_addr + INT_SIZE always is available
From: Wei Yang <[email protected]>
--- testcases/kernel/syscalls/ipc/shmat/shmat01.c | 27 +++++++++++++++++++++++- 1 files changed, 25 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ipc/shmat/shmat01.c +25 -2
@@ -65,6 +65,9 @@ void check_functionality(int);#define CASE1 20/* memory location. */ int shm_id_1 =-1 ; +#if defined(__mips__) || defined(__mips64) +int shm_id_2 =-1 ; +#endif void *base_addr;/* By probing this address first, we can make * non-aligned addresses from it for different
@@ -262,14 +265,34 @@ void setup(void)tst_brkm (TBROK , cleanup,"Failed to create shared memory " "resource 1 in setup()" ); } -/* Probe an available linear address for attachment */ +#if defined(__mips__) || defined(__mips64) +/* +* For mips architecture, SHMLBA is not equal to PAGE_SIZE +* base_addr is not available address for process after +* base_addr is aligned to next SHMLBA address +*/ +if ((shm_id_2 =shmget (shmkey++,SHMLBA ,SHM_RW |IPC_CREAT |IPC_EXCL )) ==-1 ) { +tst_brkm (TBROK , cleanup,"Failed to create shared memory " ); + } +if ((base_addr =shmat (shm_id_2,NULL ,0 )) == (void *)-1 ) { +rm_shm (shm_id_2); +tst_brkm (TBROK , cleanup,"Couldn't attach shared memory" ); + } +if (shmdt ((const void *)base_addr) ==-1 ) { +rm_shm (shm_id_2); +tst_brkm (TBROK , cleanup,"Couldn't detach shared memory" ); + } +rm_shm (shm_id_2); +#else if ((base_addr =shmat (shm_id_1,NULL ,0 )) == (void *)-1 ) {tst_brkm (TBROK , cleanup,"Couldn't attach shared memory" ); }if (shmdt ((const void *)base_addr) ==-1 ) {tst_brkm (TBROK , cleanup,"Couldn't detach shared memory" ); } +#endif +/* some architectures (e.g. parisc) are strange, so better always align to * next SHMLBA address. */
@@ -299,4 +322,4 @@ void cleanup(void)*/ TEST_CLEANUP ; -} +}
Signature · 13 lines
1.7.0.2 ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi Cyril
Please ignore this patch. I am so sorry for my fault.:-[ I will resend
it.
thanks
wei
Quoted 59 lines · On 12/27/2011 02:45 PM, [email protected] wrote:
From: Wei Yang<[email protected]>
Signed-off-by Wei Yang<[email protected]>--- testcases/kernel/syscalls/ipc/shmat/shmat01.c | 27 +++++++++++++++++++++++- 1 files changed, 25 insertions(+), 2 deletions(-)testcases/kernel/syscalls/ipc/shmat/shmat01.c +24
-1@@ -65,6 +65,9 @@ void check_functionality(int);#define CASE1 20/* memory location. */ int shm_id_1 =-1 ; +#if defined(__mips__) || defined(__mips64) +int shm_id_2 =-1 ; +#endif void *base_addr;/* By probing this address first, we can make * non-aligned addresses from it for different @@ -262,14 +265,34 @@ void setup(void)tst_brkm (TBROK , cleanup,"Failed to create shared memory " "resource 1 in setup()" ); } -/* Probe an available linear address for attachment */ +#if defined(__mips__) || defined(__mips64) +/* +* For mips architecture, SHMLBA is not equal to PAGE_SIZE +* base_addr is not available address for process after +* base_addr is aligned to next SHMLBA address +*/ +if ((shm_id_2 =shmget (shmkey++,SHMLBA ,SHM_RW |IPC_CREAT |IPC_EXCL )) ==-1 ) { +tst_brkm (TBROK , cleanup,"Failed to create shared memory " ); + } +if ((base_addr =shmat (shm_id_2,NULL ,0 )) == (void *)-1 ) { +rm_shm (shm_id_2); +tst_brkm (TBROK , cleanup,"Couldn't attach shared memory" ); + } +if (shmdt ((const void *)base_addr) ==-1 ) { +rm_shm (shm_id_2); +tst_brkm (TBROK , cleanup,"Couldn't detach shared memory" ); + } +rm_shm (shm_id_2); +#else if ((base_addr =shmat (shm_id_1,NULL ,0 )) == (void *)-1 ) {tst_brkm (TBROK , cleanup,"Couldn't attach shared memory" ); }if (shmdt ((const void *)base_addr) ==-1 ) {tst_brkm (TBROK , cleanup,"Couldn't detach shared memory" ); } +#endif +/* some architectures (e.g. parisc) are strange, so better always align to * next SHMLBA address. */
testcases/kernel/syscalls/ipc/shmat/shmat01.c void cleanup(void) · line 325
Quoted 6 lines
testcases/kernel/syscalls/ipc/shmat/shmat01.c +1
-1@@ -299,4 +322,4 @@ void cleanup(void)*/ TEST_CLEANUP ; -} +}
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list