[LTP] Regarding shmat01 syscall test

Om Prakash PAL
2012-10-23T09:25:06Z

[-- Attachment #1.1: Type: text/plain, Size: 841 bytes --]

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?.
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

[-- Attachment #1.2: Type: text/html, Size: 3430 bytes --]

[-- Attachment #2: Type: text/plain, Size: 240 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]