Lines Matching refs:path
294 CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */ in php_sys_stat_ex() argument
298 const size_t path_len = strlen(path); in php_sys_stat_ex()
301 if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { in php_sys_stat_ex()
302 return stat(path, buf); in php_sys_stat_ex()
305 if (path_len >= 1 && path[1] == ':') { in php_sys_stat_ex()
306 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
307 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
309 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
311 } else if (IS_UNC_PATH(path, path_len)) { in php_sys_stat_ex()
322 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
323 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
325 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
352 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in php_sys_stat_ex()
383 int len = strlen(path); in php_sys_stat_ex()
385 if (path[len-4] == '.') { in php_sys_stat_ex()
386 if (_memicmp(path+len-3, "exe", 3) == 0 || in php_sys_stat_ex()
387 _memicmp(path+len-3, "com", 3) == 0 || in php_sys_stat_ex()
388 _memicmp(path+len-3, "bat", 3) == 0 || in php_sys_stat_ex()
389 _memicmp(path+len-3, "cmd", 3) == 0) { in php_sys_stat_ex()
585 static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ in realpath_cache_key() argument
588 char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); in realpath_cache_key()
607 static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */ in realpath_cache_key() argument
610 const char *e = path + path_len; in realpath_cache_key()
612 for (h = 2166136261U; path < e;) { in realpath_cache_key()
614 h ^= *path++; in realpath_cache_key()
639 CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */ in realpath_cache_del() argument
642 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_del()
644 unsigned long key = realpath_cache_key(path, path_len); in realpath_cache_del()
651 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_del()
656 if(r->path == r->realpath) { in realpath_cache_del()
671 static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int rea… in realpath_cache_add() argument
677 memcmp(path, realpath, path_len) != 0) { in realpath_cache_add()
691 bucket->key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_add()
693 bucket->key = realpath_cache_key(path, path_len); in realpath_cache_add()
695 bucket->path = (char*)bucket + sizeof(realpath_cache_bucket); in realpath_cache_add()
696 memcpy(bucket->path, path, path_len+1); in realpath_cache_add()
699 bucket->realpath = bucket->path; in realpath_cache_add()
701 bucket->realpath = bucket->path + (path_len + 1); in realpath_cache_add()
721 static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t T… in realpath_cache_find() argument
724 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_find()
726 unsigned long key = realpath_cache_key(path, path_len); in realpath_cache_find()
738 if(r->path == r->realpath) { in realpath_cache_find()
745 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_find()
755 CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRML… in realpath_cache_lookup() argument
757 return realpath_cache_find(path, path_len, t TSRMLS_CC); in realpath_cache_lookup()
780 static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath, in… in tsrm_realpath_r() argument
804 while (i > start && !IS_SLASH(path[i-1])) { in tsrm_realpath_r()
809 (i == len - 1 && path[i] == '.')) { in tsrm_realpath_r()
814 } else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') { in tsrm_realpath_r()
823 j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC); in tsrm_realpath_r()
826 while (j > start && !IS_SLASH(path[j])) { in tsrm_realpath_r()
831 if (j == 0 && path[0] == '.' && path[1] == '.' && in tsrm_realpath_r()
832 IS_SLASH(path[2])) { in tsrm_realpath_r()
833 path[3] = '.'; in tsrm_realpath_r()
834 path[4] = '.'; in tsrm_realpath_r()
835 path[5] = DEFAULT_SLASH; in tsrm_realpath_r()
838 path[j+1] == '.' && path[j+2] == '.' && in tsrm_realpath_r()
839 IS_SLASH(path[j+3])) { in tsrm_realpath_r()
841 path[j++] = '.'; in tsrm_realpath_r()
842 path[j++] = '.'; in tsrm_realpath_r()
843 path[j] = DEFAULT_SLASH; in tsrm_realpath_r()
848 path[0] = '.'; in tsrm_realpath_r()
849 path[1] = '.'; in tsrm_realpath_r()
850 path[2] = DEFAULT_SLASH; in tsrm_realpath_r()
856 path[len] = 0; in tsrm_realpath_r()
865 if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) { in tsrm_realpath_r()
873 memcpy(path, bucket->realpath, bucket->realpath_len + 1); in tsrm_realpath_r()
880 if (save && (hFind = FindFirstFile(path, &data)) == INVALID_HANDLE_VALUE) { in tsrm_realpath_r()
894 memcpy(tmp, path, len+1); in tsrm_realpath_r()
897 !(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') && in tsrm_realpath_r()
915 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in tsrm_realpath_r()
986 memcpy(substitutename, path, len + 1); in tsrm_realpath_r()
1018 *(path + bufindex) = *(tmp2 + bufindex); in tsrm_realpath_r()
1021 *(path + bufindex) = 0; in tsrm_realpath_r()
1031 fprintf(stderr, "resolved: %s ", path); in tsrm_realpath_r()
1036 if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { in tsrm_realpath_r()
1038 j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1051 memmove(path+i, path, j+1); in tsrm_realpath_r()
1052 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1053 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1054 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1078 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1080 if (save && php_sys_lstat(path, &st) < 0) { in tsrm_realpath_r()
1090 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1093 if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) { in tsrm_realpath_r()
1098 path[j] = 0; in tsrm_realpath_r()
1099 if (IS_ABSOLUTE_PATH(path, j)) { in tsrm_realpath_r()
1100 j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1110 memmove(path+i, path, j+1); in tsrm_realpath_r()
1111 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1112 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1113 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1139 …j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL TSRMLS_CC… in tsrm_realpath_r()
1141 path[j++] = DEFAULT_SLASH; in tsrm_realpath_r()
1151 memcpy(path+j, data.cFileName, i+1); in tsrm_realpath_r()
1155 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1164 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1171 realpath_cache_add(tmp, len, path, j, directory, *t TSRMLS_CC); in tsrm_realpath_r()
1182 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int u… in virtual_file_ex() argument
1184 int path_length = strlen(path); in virtual_file_ex()
1207 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1213 if (!IS_ABSOLUTE_PATH(path, path_length)) { in virtual_file_ex()
1217 memcpy(resolved_path , path, path_length + 1); in virtual_file_ex()
1222 if (IS_SLASH(path[0])) { in virtual_file_ex()
1251 memcpy(resolved_path + state_cwd_length, path, path_length + 1); in virtual_file_ex()
1255 memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); in virtual_file_ex()
1261 if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) { in virtual_file_ex()
1262 resolved_path[0] = path[0]; in virtual_file_ex()
1265 memcpy(resolved_path + 3, path + 2, path_length - 1); in virtual_file_ex()
1269 memcpy(resolved_path, path, path_length + 1); in virtual_file_ex()
1390 CWD_API int virtual_chdir(const char *path TSRMLS_DC) /* {{{ */ in virtual_chdir()
1392 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH TSRMLS_CC)?-1:0; in virtual_chdir()
1396 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_… in virtual_chdir_file() argument
1398 int length = strlen(path); in virtual_chdir_file()
1406 while(--length >= 0 && !IS_SLASH(path[length])) { in virtual_chdir_file()
1415 …if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing… in virtual_chdir_file()
1419 memcpy(temp, path, length); in virtual_chdir_file()
1430 CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ in virtual_realpath() argument
1437 if (!*path) { in virtual_realpath()
1446 path = cwd; in virtual_realpath()
1448 } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) { in virtual_realpath()
1460 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)==0) { in virtual_realpath()
1476 CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSR… in virtual_filepath_ex() argument
1482 retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH TSRMLS_CC); in virtual_filepath_ex()
1491 CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC) /* {{{ */ in virtual_filepath() argument
1493 return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC); in virtual_filepath()
1497 CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{ */ in virtual_fopen() argument
1502 if (path[0] == '\0') { /* Fail to open empty path */ in virtual_fopen()
1507 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { in virtual_fopen()
1662 CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */ in virtual_open()
1668 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) { in virtual_open()
1690 CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */ in virtual_creat() argument
1696 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) { in virtual_creat()
1745 CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ in virtual_stat() argument
1751 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { in virtual_stat()
1763 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ in virtual_lstat() argument
1769 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { in virtual_lstat()
1781 CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */ in virtual_unlink()
1787 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { in virtual_unlink()
1957 CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ in tsrm_realpath() argument
1963 if (!*path) { in tsrm_realpath()
1971 path = cwd; in tsrm_realpath()
1973 } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && in tsrm_realpath()
1986 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { in tsrm_realpath()