Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorChris Want <cwant@ualberta.ca>2006-03-05 17:58:56 +0300
committerChris Want <cwant@ualberta.ca>2006-03-05 17:58:56 +0300
commit46daa8d7421870474e44da6a2738415a2d2208dc (patch)
treede36841f652a0b29ff22cfd6205c86d7ce7b012a /intern
parent58f4fcfd6e9f91441f476e05dd2bb9ad14911310 (diff)
It looks like Irix works alright with the /dev/zero trick for mmap().
I had to include fcntl.h for Irix to get symbol O_RDWR.
Diffstat (limited to 'intern')
-rw-r--r--intern/guardedalloc/intern/mallocn.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index f3023b96445..6636e68b817 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -252,16 +252,29 @@ void *MEM_callocN(unsigned int len, const char *str)
/* note; mmap returns zero'd memory */
void *MEM_mapallocN(unsigned int len, const char *str)
{
-#if defined(AMIGA) || defined(__BeOS) || defined(WIN32) || defined(__sgi)
+#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
return MEM_callocN(len, str);
#else
MemHead *memh;
len = (len + 3 ) & ~3; /* allocate in units of 4 */
- memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
- PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
-
+#ifdef __sgi
+ {
+#include <fcntl.h>
+
+ 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
+
if(memh!=(MemHead *)-1) {
make_memhead_header(memh, len, str);
memh->mmap= 1;