- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- changing permission of shmat address without detac...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 12:46 AM
05-04-2004 12:46 AM
changing permission of shmat address without detach
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 02:52 AM
05-04-2004 02:52 AM
Re: changing permission of shmat address without detach
For pre-11.23 or the traditional address space models (Mostly Global), this just isn't possible. From shmop(2): "If the calling process is already attached to the shared memory segment, shmat() fails and returns SHM_FAILED regardless of what value is passed in shmaddr."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 03:39 PM
05-04-2004 03:39 PM
Re: changing permission of shmat address without detach
Let me simplify the question,
If I have attached to a Shared Memory segment in "Read Only" mode can I change it to "Write Enabled" without detaching to segment ?
Can I achieve this in SYS V Calls and is there is any other way to achieve above in SYS V Implementation ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2004 02:38 AM
05-05-2004 02:38 AM
Re: changing permission of shmat address without detach
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2004 03:46 PM
05-05-2004 03:46 PM
Re: changing permission of shmat address without detach
But mprotect will require address to be multiple of page size.
My system is configured for 4096 bytes. If I require protection of memory in particular region which is not multiple of 4096 then how I can achieve such a protection ?
For example,
If allocate shared memory of 1024 bytes( which by itself is less than page size of 4096 bytes).
Lets say address addr1, I want to protect the memory (prevent accidental write) region between addr1+40, addr1+80 bytes, can I do this in SYS V Call ?
Thanks again for your response.
Note: Of Course lock consistency are taken care.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2004 02:07 AM
05-06-2004 02:07 AM
Re: changing permission of shmat address without detach
mprotect() can handle less than a full page arguments - so just be consistent and it shouldn't matter (though if you set up a 128 bytes segment and read between 128 to the page boundary, you just get zero'es instead of a SIGSEGV).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2004 06:12 PM
05-06-2004 06:12 PM
Re: changing permission of shmat address without detach
I conclude that at user level If I have to protect memory of certain region (using SYS V Call) i.e., memory of lesser than page size
it is not possible.
I can do only page protection.
But I still feel that at programming level ideally I should not be bothered about pages. I feel as a programmer I should have provision to control even small memory area.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2004 06:12 PM
05-06-2004 06:12 PM
Re: changing permission of shmat address without detach
I conclude that at user level If I have to protect memory of certain region (using SYS V Call) i.e., memory of lesser than page size
it is not possible.
I can do only page protection.
But I still feel that at programming level ideally I should not be bothered about pages. I feel as a programmer I should have provision to control even small memory area.
With kind Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2004 06:12 PM
05-06-2004 06:12 PM
Re: changing permission of shmat address without detach
I conclude that at user level If I have to protect memory of certain region (using SYS V Call) i.e., memory of lesser than page size
it is not possible.
I can do only page protection.
But I still feel that at programming level ideally I should not be bothered about pages. I feel as a programmer I should have provision to control even small memory area.
With kind Regards,
Srinivasan S