[Bf-committers] Re: [Bf-blender-cvs] CVS commit: blender/intern/guardedalloc/intern mallocn.c

Ton Roosendaal ton at blender.org
Mon Feb 27 19:22:19 CET 2006


Hi,

Afaik, the MAP_ANONYMOUS is a shortcut to open the mapped file in  
/dev/zero;

you could replace the mmap() call with this in the code:


#ifdef __sgi
{

	int fd;
	fd = open("/dev/zero", O_RDWR);

	memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
			   PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
	close(fd);
}
#else
	memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
			   PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
#endif


To test if it works, just render a picture!

-Ton-

On 27 Feb, 2006, at 18:39, Chris Want wrote:

> Ton Roosendaal wrote:
>> Hi,
>> SGI probably has MAP_ANONYMOUS... can you grep for it in   
>> /usr/include/sys/mman.h?
>> Might be same for Solaris.
>> -Ton-
>
> Nope, here are the MAP_* defines:
>
> #define MAP_SHARED      0x1     /* share changes */
> #define MAP_PRIVATE     0x2     /* changes are private */
> #define MAP_TYPE        0xf     /* mask for mapping type */
> #define MAP_FIXED       0x010   /* interpret addr exactly */
> #define MAP_RENAME      0x020   /* assign page to file */
> #define MAP_AUTOGROW    0x040   /* file grows with store access */
> #define MAP_LOCAL       0x080   /* separate copies made on fork/sproc  
> */
> #define MAP_AUTORESRV   0x100   /* logical swap reserved on demand */
> #define MAP_TEXT        0x200   /* chg SHARED -> PRIVATE on write */
> #define MAP_BRK         0x400   /* potentially make the area following  
> this
> #define MAP_PRIMARY     0x800   /* this mapping should be considered  
> the
> #define MAP_SGI_ANYADDR 0x1000  /* allow auto-placed mappings in the
> #define MAP_FAILED      ((void *)-1L)
>
> Chris
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list