- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mmap failed with ENOMEM error
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
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
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
09-14-2015 08:07 AM
09-14-2015 08:07 AM
mmap failed with ENOMEM error
Hi All,
1. My process has two threads (thread created using pthreads)
2. One thread acts as a PUBLISHER (WRITER) and other thread acts as a SUBSCRIBER (READER).
3. The PUBLISHER thread creates a MAP file (SHARED MAP) with READ and WRITE permissions.
example:
mmap (NULL, maxSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
4. After creating the MAP file PUBLISHER thread writes the data into MAP file.
5. After step (4), SUBSCRIBER thread also tries to open same map file as below
mmap(NULL, maxSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
6. Unfortunatiely the mmap at step (5) is always failing with error code 12, ENOMEM.
I am not seeing this issue on LINUX and SOLARIS. The issue observed only on HPUX.
In HPUX, can't a process open the same map file twice?
Thanks,
MasthanD
- Tags:
- mmap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2015 09:18 AM
09-14-2015 09:18 AM
Re: mmap failed with ENOMEM error
Hi MasthanD,
Indeed, HPUX do not support those nested mmap.
man mmap:
+ In most cases, two separate calls to mmap() cannot map
overlapping ranges in a file. The virtual address range
reserved for a file range is determined at the time of the
initial mapping of the file range into a process address
space. The system allocates only the virtual address range
necessary to represent the initial mapping. As long as the
initial mapping exists, subsequent attempts to map a different
file range that includes any portion of the initial range may
fail with an [ENOMEM] error if an extended contiguous address
range that preserves the mappings of the initial range cannot
be allocated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2015 10:18 AM - last edited on 06-18-2021 02:53 AM by Ramya_Heera
09-14-2015 10:18 AM - last edited on 06-18-2021 02:53 AM by Ramya_Heera
Re: mmap failed with ENOMEM error
The threads are part of the same process, so they share access to its address space, so they both can access
the same mmap()'ed space, without the second mmap() anyway.
Otherwise the process would have to be MPAS for the second mmap() to succeed (see man chatr) and also look for "adaptive address space technical paper".