Changeset 83


Ignore:
Timestamp:
2006-06-18T03:27:30+02:00 (8 years ago)
Author:
moo
Message:

fix win32 emulated anonymous mmap

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0/mmap.c

    r80 r83  
    1212#   define ftruncate chsize 
    1313#   define getuid() 0 
     14#   include <process.h> 
    1415#   define XCacheCreateFileMapping(size, perm, name) \ 
    1516        CreateFileMapping(INVALID_HANDLE_VALUE, NULL, perm, (sizeof(xc_shmsize_t) > 4) ? size >> 32 : 0, size & 0xffffffff, name) 
     
    157158    if (path == NULL || !path[0]) { 
    158159        static int inc = 0; 
    159         snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d", TMP_PATH, (int) getuid(), inc ++, rand()); 
     160        snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d.%d", TMP_PATH, (int) getuid(), (int) getpid(), inc ++, rand()); 
    160161        path = tmpname; 
    161162    } 
     163#ifdef ZEND_WIN32 
     164    else { 
     165        static int inc2 = 0; 
     166        snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d.%d", path, (int) getuid(), (int) getpid(), inc2 ++, rand()); 
     167        path = tmpname; 
     168    } 
     169#endif 
    162170 
    163171    shm->name = strdup(path); 
  • trunk/mmap.c

    r79 r83  
    1212#   define ftruncate chsize 
    1313#   define getuid() 0 
     14#   include <process.h> 
    1415#   define XCacheCreateFileMapping(size, perm, name) \ 
    1516        CreateFileMapping(INVALID_HANDLE_VALUE, NULL, perm, (sizeof(xc_shmsize_t) > 4) ? size >> 32 : 0, size & 0xffffffff, name) 
     
    158159    if (path == NULL || !path[0]) { 
    159160        static int inc = 0; 
    160         snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d", TMP_PATH, (int) getuid(), inc ++, rand()); 
     161        snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d.%d", TMP_PATH, (int) getuid(), (int) getpid(), inc ++, rand()); 
    161162        path = tmpname; 
    162163    } 
     164#ifdef ZEND_WIN32 
     165    else { 
     166        static int inc2 = 0; 
     167        snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d.%d", path, (int) getuid(), (int) getpid(), inc2 ++, rand()); 
     168        path = tmpname; 
     169    } 
     170#endif 
    163171 
    164172    shm->name = strdup(path); 
Note: See TracChangeset for help on using the changeset viewer.