- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mmap problem
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
11-28-2001 04:33 PM
11-28-2001 04:33 PM
I compile with gcc and run it on hp-ux 11i, 64 bit.
Here are relevant portions of the code:
....
name = tempnam(NULL, "abc");
fd = open (name, O_CREAT|O_RDWR|O_EXCL, 0666);
ftruncate(fd, 4096);
mmap(NULL, nbytes, PROT_READ|PROT_WRITE|PROT_EXEC|MAP_SHARED, fd, (off_t)0);
The mmap call fails with error 13. (I check the return value from each call).
Is this a known bug? I searched the forums but did not see anything.
The exact same program runs correctly on another unix platform!!
Thanks
Gopi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2001 06:29 PM
11-28-2001 06:29 PM
Re: mmap problem
Looks like a file permission problem (from the error code you have given).
you can verify the same by typing in the following command:
#grep 13 /usr/include/sys/errno.h
Then, the permissions of / and /lib have to be verified ..
1. ll -d /
drwxr-xr-x 45 root root 2048 Nov 8 12:34 /
2. ll -d /lib
dr-xr-xr-x 4 bin bin 1024 Oct 23 12:11 /lib
Correct them if needed..
Hope this helps ..
Cheers !!!
Mathew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2001 09:22 PM
11-28-2001 09:22 PM
Re: mmap problem
One thing I see immediately is that you are one paramter short in your call to mmap. You need a comma where you have a '|' before the MAP_SHARED argument. Just to be safe, I would specify flags to be MAP_FILE | MAP_SHARED. I know MAP_FILE is default but I never trust such things.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2001 08:37 AM
11-29-2001 08:37 AM
Re: mmap problem
It still doesn't work.
I set the TMPDIR env variable to my current working dir and I run the program as myself to eliminate permission problems.
I have also tried running as root without setting the TMPDIR env variable so that the temp file gets created in /var/tmp where root has permissions to read & write.
Thanks for the suggestions.
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2001 01:09 PM
11-29-2001 01:09 PM
Solutionwith permissions 0666. Try opening the file with
0777 (or whatever is appropriate, like 0755), or
try deleting the PROT_EXEC if you don't need it.
Also, what is nbytes? You truncate the file to
4096 bytes, but map bytes [0,nbytes-1] of it.
If nbytes > the size of the file you'll get into
trouble. (Having nbytes < the size of the file is
OK, however.)
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2001 01:42 PM
11-29-2001 01:42 PM
Re: mmap problem
Thanks for catching the bug in my program. Your answer was correct.
I was going down the wrong path because the code worked on linux & solaris.
It seems that hp-ux does a better job of catching user errors!!
Thanks
Gopi