Changeset 21 for trunk


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

friendly anonymous mmap name for win32

Location:
trunk
Files:
2 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    }
  • trunk/xcache.c

    r20 r21  
    17121712#endif
    17131713
     1714#ifdef ZEND_WIN32
     1715#   define DEFAULT_PATH "xcache"
     1716#else
     1717#   define DEFAULT_PATH "/dev/zero"
     1718#endif
    17141719PHP_INI_BEGIN()
    17151720    PHP_INI_ENTRY1     ("xcache.size",                   "0", PHP_INI_SYSTEM, xc_OnUpdateLong,     &xc_php_size)
     
    17211726    PHP_INI_ENTRY1     ("xcache.var_slots",             "8K", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_var_hentry)
    17221727
    1723     PHP_INI_ENTRY1     ("xcache.mmap_path",      "/dev/zero", PHP_INI_SYSTEM, xc_OnUpdateString,   &xc_mmap_path)
     1728    PHP_INI_ENTRY1     ("xcache.mmap_path",     DEFAULT_PATH, PHP_INI_SYSTEM, xc_OnUpdateString,   &xc_mmap_path)
    17241729    PHP_INI_ENTRY1     ("xcache.coredump_directory",      "", PHP_INI_SYSTEM, xc_OnUpdateString,   &xc_coredump_dir)
    17251730    PHP_INI_ENTRY1     ("xcache.test",                   "0", PHP_INI_SYSTEM, xc_OnUpdateBool,     &xc_test)
     
    18211826    if ((xc_php_size || xc_var_size) && xc_mmap_path && xc_mmap_path[0]) {
    18221827        if (!xc_init(module_number TSRMLS_CC)) {
    1823             zend_error(E_ERROR, "XCache: Cannot init xcache");
     1828            zend_error(E_ERROR, "XCache: Cannot init");
    18241829            goto err_init;
    18251830        }
     
    18921897zend_module_entry xcache_module_entry = {
    18931898    STANDARD_MODULE_HEADER,
    1894     "xcache",
     1899    "XCache",
    18951900    xcache_functions,
    18961901    PHP_MINIT(xcache),
Note: See TracChangeset for help on using the changeset viewer.