Lines Matching refs:path
252 CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{{ */ in php_sys_stat_ex() argument
258 wchar_t *pathw = php_win32_ioutil_conv_any_to_w(path, PHP_WIN32_CP_IGNORE_LEN, &pathw_len); in php_sys_stat_ex()
557 static inline zend_ulong realpath_cache_key(const char *path, size_t path_len) /* {{{ */ in realpath_cache_key() argument
561 char *bucket_key_start = tsrm_win32_get_path_sid_key(path, path_len, &bucket_key_len); in realpath_cache_key()
574 if (bucket_key_start != path) { in realpath_cache_key()
581 static inline zend_ulong realpath_cache_key(const char *path, size_t path_len) /* {{{ */ in realpath_cache_key() argument
584 const char *e = path + path_len; in realpath_cache_key()
586 for (h = Z_UL(2166136261); path < e;) { in realpath_cache_key()
588 h ^= *path++; in realpath_cache_key()
613 CWD_API void realpath_cache_del(const char *path, size_t path_len) /* {{{ */ in realpath_cache_del() argument
615 zend_ulong key = realpath_cache_key(path, path_len); in realpath_cache_del()
621 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_del()
626 if(r->path == r->realpath) { in realpath_cache_del()
641 static inline void realpath_cache_add(const char *path, size_t path_len, const char *realpath, size… in realpath_cache_add() argument
647 memcmp(path, realpath, path_len) != 0) { in realpath_cache_add()
660 bucket->key = realpath_cache_key(path, path_len); in realpath_cache_add()
661 bucket->path = (char*)bucket + sizeof(realpath_cache_bucket); in realpath_cache_add()
662 memcpy(bucket->path, path, path_len+1); in realpath_cache_add()
665 bucket->realpath = bucket->path; in realpath_cache_add()
667 bucket->realpath = bucket->path + (path_len + 1); in realpath_cache_add()
687 static inline realpath_cache_bucket* realpath_cache_find(const char *path, size_t path_len, time_t … in realpath_cache_find() argument
689 zend_ulong key = realpath_cache_key(path, path_len); in realpath_cache_find()
699 if(r->path == r->realpath) { in realpath_cache_find()
706 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_find()
716 CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, size_t path_len, time_t t) /… in realpath_cache_lookup() argument
718 return realpath_cache_find(path, path_len, t); in realpath_cache_lookup()
741 static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_rea… in tsrm_realpath_r() argument
770 while (i > start && !IS_SLASH(path[i-1])) { in tsrm_realpath_r()
776 (i + 1 == len && path[i] == '.')) { in tsrm_realpath_r()
781 } else if (i + 2 == len && path[i] == '.' && path[i+1] == '.') { in tsrm_realpath_r()
790 j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL); in tsrm_realpath_r()
794 while (j > start && !IS_SLASH(path[j])) { in tsrm_realpath_r()
800 if (j == 0 && path[0] == '.' && path[1] == '.' && in tsrm_realpath_r()
801 IS_SLASH(path[2])) { in tsrm_realpath_r()
802 path[3] = '.'; in tsrm_realpath_r()
803 path[4] = '.'; in tsrm_realpath_r()
804 path[5] = DEFAULT_SLASH; in tsrm_realpath_r()
807 path[j+1] == '.' && path[j+2] == '.' && in tsrm_realpath_r()
808 IS_SLASH(path[j+3])) { in tsrm_realpath_r()
810 path[j++] = '.'; in tsrm_realpath_r()
811 path[j++] = '.'; in tsrm_realpath_r()
812 path[j] = DEFAULT_SLASH; in tsrm_realpath_r()
817 path[0] = '.'; in tsrm_realpath_r()
818 path[1] = '.'; in tsrm_realpath_r()
819 path[2] = DEFAULT_SLASH; in tsrm_realpath_r()
825 path[len] = 0; in tsrm_realpath_r()
834 if ((bucket = realpath_cache_find(path, len, *t)) != NULL) { in tsrm_realpath_r()
842 memcpy(path, bucket->realpath, bucket->realpath_len + 1); in tsrm_realpath_r()
852 pathw = php_win32_ioutil_any_to_w(path); in tsrm_realpath_r()
871 memcpy(tmp, path, len+1); in tsrm_realpath_r()
875 !(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') && in tsrm_realpath_r()
1028 memcpy(substitutename, path, len + 1); in tsrm_realpath_r()
1063 *(path + bufindex) = *(tmp2 + bufindex); in tsrm_realpath_r()
1066 *(path + bufindex) = 0; in tsrm_realpath_r()
1076 fprintf(stderr, "resolved: %s ", path); in tsrm_realpath_r()
1086 pathw = php_win32_ioutil_any_to_w(path); in tsrm_realpath_r()
1099 if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { in tsrm_realpath_r()
1101 j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory); in tsrm_realpath_r()
1116 memmove(path+i, path, j+1); in tsrm_realpath_r()
1117 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1118 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1119 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory); in tsrm_realpath_r()
1143 if (save && php_sys_lstat(path, &st) < 0) { in tsrm_realpath_r()
1153 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1156 if (++(*ll) > LINK_MAX || (j = (size_t)php_sys_readlink(tmp, path, MAXPATHLEN)) == (size_t)-1) { in tsrm_realpath_r()
1161 path[j] = 0; in tsrm_realpath_r()
1162 if (IS_ABSOLUTE_PATH(path, j)) { in tsrm_realpath_r()
1163 j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory); in tsrm_realpath_r()
1173 memmove(path+i, path, j+1); in tsrm_realpath_r()
1174 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1175 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1176 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory); in tsrm_realpath_r()
1202 j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL); in tsrm_realpath_r()
1204 path[j++] = DEFAULT_SLASH; in tsrm_realpath_r()
1222 memcpy(path+j, tmp_path, i+1); in tsrm_realpath_r()
1227 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1236 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1243 realpath_cache_add(tmp, len, path, j, directory, *t); in tsrm_realpath_r()
1258 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int u… in virtual_file_ex() argument
1260 size_t path_length = strlen(path); in virtual_file_ex()
1279 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1285 if (!IS_ABSOLUTE_PATH(path, path_length)) { in virtual_file_ex()
1289 memcpy(resolved_path , path, path_length + 1); in virtual_file_ex()
1294 if (IS_SLASH(path[0])) { in virtual_file_ex()
1323 memcpy(resolved_path + state_cwd_length, path, path_length + 1); in virtual_file_ex()
1327 memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); in virtual_file_ex()
1333 if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) { in virtual_file_ex()
1334 resolved_path[0] = path[0]; in virtual_file_ex()
1337 memcpy(resolved_path + 3, path + 2, path_length - 1); in virtual_file_ex()
1341 memcpy(resolved_path, path, path_length + 1); in virtual_file_ex()
1439 CWD_API int virtual_chdir(const char *path) /* {{{ */ in virtual_chdir() argument
1441 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; in virtual_chdir()
1445 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path)) /* {{{ */ in virtual_chdir_file() argument
1447 size_t length = strlen(path); in virtual_chdir_file()
1455 while(--length < SIZE_MAX && !IS_SLASH(path[length])) { in virtual_chdir_file()
1464 …if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing… in virtual_chdir_file()
1468 memcpy(temp, path, length); in virtual_chdir_file()
1479 CWD_API char *virtual_realpath(const char *path, char *real_path) /* {{{ */ in virtual_realpath() argument
1486 if (!*path) { in virtual_realpath()
1491 path = cwd; in virtual_realpath()
1493 } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) { in virtual_realpath()
1501 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) { in virtual_realpath()
1516 CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path) /*… in virtual_filepath_ex() argument
1522 retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH); in virtual_filepath_ex()
1531 CWD_API int virtual_filepath(const char *path, char **filepath) /* {{{ */ in virtual_filepath() argument
1533 return virtual_filepath_ex(path, filepath, php_is_file_ok); in virtual_filepath()
1537 CWD_API FILE *virtual_fopen(const char *path, const char *mode) /* {{{ */ in virtual_fopen() argument
1542 if (path[0] == '\0') { /* Fail to open empty path */ in virtual_fopen()
1547 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_fopen()
1673 CWD_API int virtual_open(const char *path, int flags, ...) /* {{{ */ in virtual_open() argument
1679 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_open()
1709 CWD_API int virtual_creat(const char *path, mode_t mode) /* {{{ */ in virtual_creat() argument
1715 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_creat()
1764 CWD_API int virtual_stat(const char *path, zend_stat_t *buf) /* {{{ */ in virtual_stat() argument
1770 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { in virtual_stat()
1782 CWD_API int virtual_lstat(const char *path, zend_stat_t *buf) /* {{{ */ in virtual_lstat() argument
1788 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_lstat()
1800 CWD_API int virtual_unlink(const char *path) /* {{{ */ in virtual_unlink() argument
1806 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_unlink()
1950 CWD_API char *tsrm_realpath(const char *path, char *real_path) /* {{{ */ in tsrm_realpath() argument
1956 if (!*path) { in tsrm_realpath()
1961 path = cwd; in tsrm_realpath()
1963 } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && in tsrm_realpath()
1973 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { in tsrm_realpath()