<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: mmap problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621743#M925983</link>
    <description>I made a mistake while copying the code from my terminal to the browser. There is a comma before MAP_SHARED. I also added MAP_FILE just to be sure.&lt;BR /&gt;&lt;BR /&gt;It still doesn't work. &lt;BR /&gt;&lt;BR /&gt;I set the TMPDIR env variable to my current working dir and I run the program as myself to eliminate permission problems.&lt;BR /&gt;&lt;BR /&gt;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 &amp;amp; write.&lt;BR /&gt;&lt;BR /&gt;Thanks for the suggestions.&lt;BR /&gt;&lt;BR /&gt;Gopi</description>
    <pubDate>Thu, 29 Nov 2001 16:37:29 GMT</pubDate>
    <dc:creator>Gopinath_3</dc:creator>
    <dc:date>2001-11-29T16:37:29Z</dc:date>
    <item>
      <title>mmap problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621740#M925980</link>
      <description>I have a C program that opens a file and mmaps it. The file has both read &amp;amp; write permissions for everyone.&lt;BR /&gt;&lt;BR /&gt;I compile with gcc and run it on hp-ux 11i, 64 bit. &lt;BR /&gt;&lt;BR /&gt;Here are relevant portions of the code:&lt;BR /&gt;&lt;BR /&gt;....&lt;BR /&gt;name = tempnam(NULL, "abc");&lt;BR /&gt;fd = open (name, O_CREAT|O_RDWR|O_EXCL, 0666);&lt;BR /&gt;ftruncate(fd, 4096);&lt;BR /&gt;mmap(NULL, nbytes, PROT_READ|PROT_WRITE|PROT_EXEC|MAP_SHARED, fd, (off_t)0);&lt;BR /&gt;&lt;BR /&gt;The mmap call fails with error 13. (I check the return value from each call). &lt;BR /&gt;&lt;BR /&gt;Is this a known bug? I searched the forums but did not see anything.&lt;BR /&gt;&lt;BR /&gt;The exact same program runs correctly on another unix platform!!&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Gopi&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Nov 2001 00:33:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621740#M925980</guid>
      <dc:creator>Gopinath_3</dc:creator>
      <dc:date>2001-11-29T00:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: mmap problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621741#M925981</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Looks like a file permission problem (from the error code you have given).&lt;BR /&gt;you can verify the same by typing in the following command:&lt;BR /&gt;&lt;BR /&gt;#grep 13 /usr/include/sys/errno.h&lt;BR /&gt;&lt;BR /&gt;Then, the permissions of / and /lib have to be verified ..&lt;BR /&gt;&lt;BR /&gt;1.   ll -d /&lt;BR /&gt;     drwxr-xr-x  45 root     root   2048 Nov  8 12:34 /&lt;BR /&gt;&lt;BR /&gt;2.   ll -d /lib&lt;BR /&gt;     dr-xr-xr-x   4 bin      bin    1024 Oct 23 12:11 /lib&lt;BR /&gt;&lt;BR /&gt;Correct them if needed..&lt;BR /&gt;&lt;BR /&gt;Hope this helps ..&lt;BR /&gt;Cheers !!!&lt;BR /&gt;Mathew&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Nov 2001 02:29:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621741#M925981</guid>
      <dc:creator>Varghese Mathew</dc:creator>
      <dc:date>2001-11-29T02:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: mmap problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621742#M925982</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Thu, 29 Nov 2001 05:22:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621742#M925982</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-11-29T05:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: mmap problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621743#M925983</link>
      <description>I made a mistake while copying the code from my terminal to the browser. There is a comma before MAP_SHARED. I also added MAP_FILE just to be sure.&lt;BR /&gt;&lt;BR /&gt;It still doesn't work. &lt;BR /&gt;&lt;BR /&gt;I set the TMPDIR env variable to my current working dir and I run the program as myself to eliminate permission problems.&lt;BR /&gt;&lt;BR /&gt;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 &amp;amp; write.&lt;BR /&gt;&lt;BR /&gt;Thanks for the suggestions.&lt;BR /&gt;&lt;BR /&gt;Gopi</description>
      <pubDate>Thu, 29 Nov 2001 16:37:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621743#M925983</guid>
      <dc:creator>Gopinath_3</dc:creator>
      <dc:date>2001-11-29T16:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: mmap problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621744#M925984</link>
      <description>You specify PROT_EXEC, but you open the file&lt;BR /&gt;with permissions 0666.  Try opening the file with&lt;BR /&gt;0777 (or whatever is appropriate, like 0755), or&lt;BR /&gt;try deleting the PROT_EXEC if you don't need it.&lt;BR /&gt;&lt;BR /&gt;Also, what is nbytes?  You truncate the file to&lt;BR /&gt;4096 bytes, but map bytes [0,nbytes-1] of it.&lt;BR /&gt;If nbytes &amp;gt; the size of the file you'll get into&lt;BR /&gt;trouble.  (Having nbytes &amp;lt; the size of the file is&lt;BR /&gt;OK, however.)&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Nov 2001 21:09:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621744#M925984</guid>
      <dc:creator>Gregory Fruth</dc:creator>
      <dc:date>2001-11-29T21:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: mmap problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621745#M925985</link>
      <description>Gregory,&lt;BR /&gt;&lt;BR /&gt;Thanks for catching the bug in my program. Your answer was correct.&lt;BR /&gt;&lt;BR /&gt;I was going down the wrong path because the code worked on linux &amp;amp; solaris.&lt;BR /&gt;&lt;BR /&gt;It seems that hp-ux does a better job of catching user errors!!&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Gopi</description>
      <pubDate>Thu, 29 Nov 2001 21:42:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mmap-problem/m-p/2621745#M925985</guid>
      <dc:creator>Gopinath_3</dc:creator>
      <dc:date>2001-11-29T21:42:54Z</dc:date>
    </item>
  </channel>
</rss>

