Changeset 21 for trunk/mmap.c


Ignore:
Timestamp:
2006-05-25T04:39:16+02:00 (9 years ago)
Author:
moo
Message:

friendly anonymous mmap name for win32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mmap.c

    r11 r21  
    138138xc_shm_t *xc_shm_init(const char *path, xc_shmsize_t size, zend_bool readonly_protection) /* {{{ */ 
    139139{ 
     140#ifdef ZEND_WIN32 
     141#   define TMP_PATH "XCache" 
     142#else 
     143#   define TMP_PATH "/tmp/XCache" 
     144#endif 
    140145    xc_shm_t *shm = NULL; 
    141146    int fd = -1; 
    142147    int ro_ok; 
    143148    volatile void *romem; 
    144     char tmpname[sizeof("/tmp/xcache") - 1 + 100]; 
     149    char tmpname[sizeof(TMP_PATH) - 1 + 100]; 
    145150 
    146151    CHECK(shm = calloc(1, sizeof(xc_shm_t)), "shm OOM"); 
     
    149154    if (path == NULL || !path[0]) { 
    150155        static int inc = 0; 
    151         snprintf(tmpname, sizeof(tmpname) - 1, "/tmp/xcache.%d.%d.%d", (int) getuid(), inc ++, rand()); 
     156        snprintf(tmpname, sizeof(tmpname) - 1, "%s.%d.%d.%d", TMP_PATH, (int) getuid(), inc ++, rand()); 
    152157        path = tmpname; 
    153158    } 
Note: See TracChangeset for help on using the changeset viewer.