Communications and Wireless
1849275 Members
6209 Online
104042 Solutions
New Discussion

Shared Memory shmat Read Only -> Write Mode

 
Srinivasan S_1
Advisor

Shared Memory shmat Read Only -> Write Mode

Hi,
Is there is any way to change the address attached as "Read only" (SHM_RDONLY) to write enabled without "detaching" in same process.

For example,
Process P1()
{
addr1 = shmat(id1,0,SHM_RDONLY);
//addr1 is being used by another process
function(addr1);
shmdt(addr1)
addr2=shmat(id1,0,0);
//Modifies data of shared memory id1,
addr2. data = XXX
}

function(addr1)
{
//addr1 is used down the line
}

Can above be done without detaching the address "addr1" , so that I can get another address("addr2") within same process which is write enabled.

Thanks in Advance.

Regards,
Srinivasan S