Lines Matching refs:path
284 CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */ in php_sys_stat_ex() argument
288 const size_t path_len = strlen(path); in php_sys_stat_ex()
290 if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { in php_sys_stat_ex()
291 return stat(path, buf); in php_sys_stat_ex()
294 if (path_len >= 1 && path[1] == ':') { in php_sys_stat_ex()
295 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
296 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
298 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
300 } else if (IS_UNC_PATH(path, path_len)) { in php_sys_stat_ex()
311 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
312 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
314 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
342 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in php_sys_stat_ex()
373 int len = strlen(path); in php_sys_stat_ex()
375 if (path[len-4] == '.') { in php_sys_stat_ex()
376 if (_memicmp(path+len-3, "exe", 3) == 0 || in php_sys_stat_ex()
377 _memicmp(path+len-3, "com", 3) == 0 || in php_sys_stat_ex()
378 _memicmp(path+len-3, "bat", 3) == 0 || in php_sys_stat_ex()
379 _memicmp(path+len-3, "cmd", 3) == 0) { in php_sys_stat_ex()
557 static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ in realpath_cache_key() argument
560 char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); in realpath_cache_key()
577 static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */ in realpath_cache_key() argument
580 const char *e = path + path_len; in realpath_cache_key()
582 for (h = 2166136261U; path < e;) { in realpath_cache_key()
584 h ^= *path++; in realpath_cache_key()
609 CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */ in realpath_cache_del() argument
612 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_del()
614 unsigned long 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, int path_len, const char *realpath, int rea… in realpath_cache_add() argument
647 memcmp(path, realpath, path_len) != 0) { in realpath_cache_add()
661 bucket->key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_add()
663 bucket->key = realpath_cache_key(path, path_len); in realpath_cache_add()
665 bucket->path = (char*)bucket + sizeof(realpath_cache_bucket); in realpath_cache_add()
666 memcpy(bucket->path, path, path_len+1); in realpath_cache_add()
669 bucket->realpath = bucket->path; in realpath_cache_add()
671 bucket->realpath = bucket->path + (path_len + 1); in realpath_cache_add()
691 static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t T… in realpath_cache_find() argument
694 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_find()
696 unsigned long key = realpath_cache_key(path, path_len); in realpath_cache_find()
708 if(r->path == r->realpath) { in realpath_cache_find()
715 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_find()
725 CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRML… in realpath_cache_lookup() argument
727 return realpath_cache_find(path, path_len, t TSRMLS_CC); in realpath_cache_lookup()
750 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
774 while (i > start && !IS_SLASH(path[i-1])) { in tsrm_realpath_r()
779 (i == len - 1 && path[i] == '.')) { in tsrm_realpath_r()
784 } else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') { in tsrm_realpath_r()
793 j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC); in tsrm_realpath_r()
796 while (j > start && !IS_SLASH(path[j])) { in tsrm_realpath_r()
801 if (j == 0 && path[0] == '.' && path[1] == '.' && in tsrm_realpath_r()
802 IS_SLASH(path[2])) { in tsrm_realpath_r()
803 path[3] = '.'; in tsrm_realpath_r()
804 path[4] = '.'; in tsrm_realpath_r()
805 path[5] = DEFAULT_SLASH; in tsrm_realpath_r()
808 path[j+1] == '.' && path[j+2] == '.' && in tsrm_realpath_r()
809 IS_SLASH(path[j+3])) { in tsrm_realpath_r()
811 path[j++] = '.'; in tsrm_realpath_r()
812 path[j++] = '.'; in tsrm_realpath_r()
813 path[j] = DEFAULT_SLASH; in tsrm_realpath_r()
818 path[0] = '.'; in tsrm_realpath_r()
819 path[1] = '.'; in tsrm_realpath_r()
820 path[2] = DEFAULT_SLASH; in tsrm_realpath_r()
826 path[len] = 0; in tsrm_realpath_r()
835 if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) { in tsrm_realpath_r()
843 memcpy(path, bucket->realpath, bucket->realpath_len + 1); in tsrm_realpath_r()
850 if (save && (hFind = FindFirstFile(path, &data)) == INVALID_HANDLE_VALUE) { in tsrm_realpath_r()
864 memcpy(tmp, path, len+1); in tsrm_realpath_r()
867 !(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') && in tsrm_realpath_r()
885 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in tsrm_realpath_r()
955 memcpy(substitutename, path, len + 1); in tsrm_realpath_r()
987 *(path + bufindex) = *(tmp2 + bufindex); in tsrm_realpath_r()
990 *(path + bufindex) = 0; in tsrm_realpath_r()
1000 fprintf(stderr, "resolved: %s ", path); in tsrm_realpath_r()
1005 if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { in tsrm_realpath_r()
1007 j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1020 memmove(path+i, path, j+1); in tsrm_realpath_r()
1021 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1022 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1023 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1047 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1049 if (save && php_sys_lstat(path, &st) < 0) { in tsrm_realpath_r()
1059 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1062 if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) { in tsrm_realpath_r()
1067 path[j] = 0; in tsrm_realpath_r()
1068 if (IS_ABSOLUTE_PATH(path, j)) { in tsrm_realpath_r()
1069 j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1079 memmove(path+i, path, j+1); in tsrm_realpath_r()
1080 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1081 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1082 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1108 …j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL TSRMLS_CC… in tsrm_realpath_r()
1110 path[j++] = DEFAULT_SLASH; in tsrm_realpath_r()
1120 memcpy(path+j, data.cFileName, i+1); in tsrm_realpath_r()
1124 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1133 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1140 realpath_cache_add(tmp, len, path, j, directory, *t TSRMLS_CC); in tsrm_realpath_r()
1151 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int u… in virtual_file_ex() argument
1153 int path_length = strlen(path); in virtual_file_ex()
1176 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1182 if (!IS_ABSOLUTE_PATH(path, path_length)) { in virtual_file_ex()
1186 memcpy(resolved_path , path, path_length + 1); in virtual_file_ex()
1191 if (IS_SLASH(path[0])) { in virtual_file_ex()
1220 memcpy(resolved_path + state_cwd_length, path, path_length + 1); in virtual_file_ex()
1224 memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); in virtual_file_ex()
1230 if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) { in virtual_file_ex()
1231 resolved_path[0] = path[0]; in virtual_file_ex()
1234 memcpy(resolved_path + 3, path + 2, path_length - 1); in virtual_file_ex()
1238 memcpy(resolved_path, path, path_length + 1); in virtual_file_ex()
1359 CWD_API int virtual_chdir(const char *path TSRMLS_DC) /* {{{ */ in virtual_chdir()
1361 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH TSRMLS_CC)?-1:0; in virtual_chdir()
1365 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_… in virtual_chdir_file() argument
1367 int length = strlen(path); in virtual_chdir_file()
1375 while(--length >= 0 && !IS_SLASH(path[length])) { in virtual_chdir_file()
1384 …if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing… in virtual_chdir_file()
1388 memcpy(temp, path, length); in virtual_chdir_file()
1399 CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ in virtual_realpath() argument
1406 if (!*path) { in virtual_realpath()
1415 path = cwd; in virtual_realpath()
1417 } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) { in virtual_realpath()
1429 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)==0) { in virtual_realpath()
1445 CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSR… in virtual_filepath_ex() argument
1451 retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH TSRMLS_CC); in virtual_filepath_ex()
1460 CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC) /* {{{ */ in virtual_filepath() argument
1462 return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC); in virtual_filepath()
1466 CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{ */ in virtual_fopen() argument
1471 if (path[0] == '\0') { /* Fail to open empty path */ in virtual_fopen()
1476 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { in virtual_fopen()
1630 CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */ in virtual_open()
1636 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) { in virtual_open()
1658 CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */ in virtual_creat() argument
1664 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) { in virtual_creat()
1713 CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ in virtual_stat() argument
1719 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { in virtual_stat()
1731 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ in virtual_lstat() argument
1737 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { in virtual_lstat()
1749 CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */ in virtual_unlink()
1755 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) { in virtual_unlink()
1925 CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ in tsrm_realpath() argument
1931 if (!*path) { in tsrm_realpath()
1939 path = cwd; in tsrm_realpath()
1941 } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && in tsrm_realpath()
1954 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) { in tsrm_realpath()