[Geeqie-devel] patch for MAP_ANONYMOUS use

2009-07-12 Thread Greg Troxel

NetBSD has MAP_ANON, and MAP_ANONYMOUS looks odd to me.  I tried to find
what POSIX says, and it seems MAP_ANON* is not part of the required
definition of mmap:

http://www.opengroup.org/onlinepubs/009695399/functions/mmap.html

I am pretty sure mmap originated around 4.2BSD, so would think that
4.4BSD-derived systems would have the historically correct definition
for MAP_ANON.

On my mac (10.5.7) sys/mman.h has MAP_ANON and not MAP_ANONYMOUS.

Does MAP_ANON work on linux?  Any reason not to just use MAP_ANON?

Index: src/main.c
===
--- src/main.c  (revision 1796)
+++ src/main.c  (working copy)
@@ -703,7 +703,7 @@
 {
unsigned long pagesize = sysconf(_SC_PAGE_SIZE);
DEBUG_1(SIGBUS %p, info-si_addr);
-   mmap((void *)(((unsigned long)info-si_addr / pagesize) * pagesize), 
pagesize, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 
0);
+   mmap((void *)(((unsigned long)info-si_addr / pagesize) * pagesize), 
pagesize, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
 }
 #endif
 



pgpE2ZIjspgsV.pgp
Description: PGP signature
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel


Re: [Geeqie-devel] patch for MAP_ANONYMOUS use

2009-07-12 Thread Omari Stephens
Greg Troxel wrote:
 NetBSD has MAP_ANON, and MAP_ANONYMOUS looks odd to me.  I tried to find
 what POSIX says, and it seems MAP_ANON* is not part of the required
 definition of mmap:
 
 http://www.opengroup.org/onlinepubs/009695399/functions/mmap.html
 
 I am pretty sure mmap originated around 4.2BSD, so would think that
 4.4BSD-derived systems would have the historically correct definition
 for MAP_ANON.
 
 On my mac (10.5.7) sys/mman.h has MAP_ANON and not MAP_ANONYMOUS.
 
 Does MAP_ANON work on linux?  Any reason not to just use MAP_ANON?
I know nothing about mmap, but a quick grep shows the following on Debian sid. 
bits/mman.h is #included by sys/mman.h:

02:51:51 [xsdg{intercal}@/usr/include]
$ack MAP_ANON
asm-generic/mman.h
21:#define MAP_ANONYMOUS0x20/* don't use a file */

bits/mman.h
53:# define MAP_ANONYMOUS   0x20/* Don't use a file.  */
54:# define MAP_ANONMAP_ANONYMOUS

--xsdg

PS. ack-grep is awesome: http://betterthangrep.com/
curl http://ack.googlecode.com/svn/tags/latest/ack  ~/bin/ack  chmod 0755 !$

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel