Re: [LTP] Regarding shmat01 syscall test

Wanlong Gao
2012-10-24T00:47:57Z

On 10/23/2012 06:05 PM, Om Prakash PAL wrote:
>
>
> -----Original Message-----
> From: Wanlong Gao [mailto:gaowanlong@cn.fujitsu.com]
> Sent: Tuesday, October 23, 2012 3:07 PM
> To: Om Prakash PAL
> Cc: ltp-list@lists.sourceforge.net
> Subject: Re: [LTP] Regarding shmat01 syscall test
>
> On 10/23/2012 05:24 PM, Om Prakash PAL wrote:
>> Hi,
>>
>> I am working on syscall test: shmat01.c
>>
>> I have some confusion:
>>
>>
>>
>> In setup() : it is allocating shared memory by shmget() and then attaching by shmat() and after that detaching the attached address (i.e. shmdt())
>>
>>
>>
>> if (shmdt((const void *)base_addr) == -1) {
>>
>> tst_brkm(TBROK, cleanup, "Couldn't detach shared memory");
>>
>> }
>>
>>
>>
>> And again in main function it is using same "base_addr" as attaching address,
>>
>>
>>
>> addr = shmat(*(TC[i].shmid), base_addr+TC[i].offset,
>>
>> TC[i].flags);
>>
>> how can we ensure(100%) that base_addr (virtual) will be free till this point for attaching?.
>
> Maybe we can't, but I didn't see any fail on this. Did you see any testing failure here?
>
> Yes, I got some failure and the reason of failure is : the address at which we want to attach is busy.

OK, please feel free to send a patch, or can you tell us how to reproduce it?

Thanks,
Wanlong Gao

>
> Best Regards,
> Om Prakash Pal
>
>
>
> Thanks,
> Wanlong Gao
>
>>
>> there is possibility that this address(base_addr) will be used, so in that case this shmat() will fail.
>>
>> Please correct me if I am wrong.
>>
>> Thanks in advance.
>>
>>
>>
>> Best Regards,
>>
>> Om Prakash Pal
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>>
>>
>>
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>