Lines Matching refs:path

284 CWD_API int php_sys_stat(const char *path, struct stat *buf) /* {{{ */  in php_sys_stat()  argument
286 return php_sys_stat_ex(path, buf, 0); in php_sys_stat()
290 CWD_API int php_sys_lstat(const char *path, struct stat *buf) /* {{{ */ in php_sys_lstat() argument
292 return php_sys_stat_ex(path, buf, 1); in php_sys_lstat()
296 CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */ in php_sys_stat_ex() argument
300 const size_t path_len = strlen(path); in php_sys_stat_ex()
302 if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { in php_sys_stat_ex()
303 return stat(path, buf); in php_sys_stat_ex()
306 if (path_len >= 1 && path[1] == ':') { in php_sys_stat_ex()
307 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
308 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
310 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
312 } else if (IS_UNC_PATH(path, path_len)) { in php_sys_stat_ex()
323 if (path[0] >= 'A' && path[0] <= 'Z') { in php_sys_stat_ex()
324 buf->st_dev = buf->st_rdev = path[0] - 'A'; in php_sys_stat_ex()
326 buf->st_dev = buf->st_rdev = path[0] - 'a'; in php_sys_stat_ex()
354 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in php_sys_stat_ex()
385 int len = strlen(path); in php_sys_stat_ex()
387 if (path[len-4] == '.') { in php_sys_stat_ex()
388 if (_memicmp(path+len-3, "exe", 3) == 0 || in php_sys_stat_ex()
389 _memicmp(path+len-3, "com", 3) == 0 || in php_sys_stat_ex()
390 _memicmp(path+len-3, "bat", 3) == 0 || in php_sys_stat_ex()
391 _memicmp(path+len-3, "cmd", 3) == 0) { in php_sys_stat_ex()
569 static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ in realpath_cache_key() argument
572 char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); in realpath_cache_key()
589 static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */ in realpath_cache_key() argument
592 const char *e = path + path_len; in realpath_cache_key()
594 for (h = 2166136261U; path < e;) { in realpath_cache_key()
596 h ^= *path++; in realpath_cache_key()
621 CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */ in realpath_cache_del() argument
624 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_del()
626 unsigned long key = realpath_cache_key(path, path_len); in realpath_cache_del()
633 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_del()
638 if(r->path == r->realpath) { in realpath_cache_del()
653 static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int rea… in realpath_cache_add() argument
659 memcmp(path, realpath, path_len) != 0) { in realpath_cache_add()
673 bucket->key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_add()
675 bucket->key = realpath_cache_key(path, path_len); in realpath_cache_add()
677 bucket->path = (char*)bucket + sizeof(realpath_cache_bucket); in realpath_cache_add()
678 memcpy(bucket->path, path, path_len+1); in realpath_cache_add()
681 bucket->realpath = bucket->path; in realpath_cache_add()
683 bucket->realpath = bucket->path + (path_len + 1); in realpath_cache_add()
703 static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t T… in realpath_cache_find() argument
706 unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); in realpath_cache_find()
708 unsigned long key = realpath_cache_key(path, path_len); in realpath_cache_find()
720 if(r->path == r->realpath) { in realpath_cache_find()
728 memcmp(path, (*bucket)->path, path_len) == 0) { in realpath_cache_find()
738 CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRML… in realpath_cache_lookup() argument
740 return realpath_cache_find(path, path_len, t TSRMLS_CC); in realpath_cache_lookup()
763 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
787 while (i > start && !IS_SLASH(path[i-1])) { in tsrm_realpath_r()
792 (i == len - 1 && path[i] == '.')) { in tsrm_realpath_r()
797 } else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') { in tsrm_realpath_r()
806 j = tsrm_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC); in tsrm_realpath_r()
809 while (j > start && !IS_SLASH(path[j])) { in tsrm_realpath_r()
814 if (j == 0 && path[0] == '.' && path[1] == '.' && in tsrm_realpath_r()
815 IS_SLASH(path[2])) { in tsrm_realpath_r()
816 path[3] = '.'; in tsrm_realpath_r()
817 path[4] = '.'; in tsrm_realpath_r()
818 path[5] = DEFAULT_SLASH; in tsrm_realpath_r()
821 path[j+1] == '.' && path[j+2] == '.' && in tsrm_realpath_r()
822 IS_SLASH(path[j+3])) { in tsrm_realpath_r()
824 path[j++] = '.'; in tsrm_realpath_r()
825 path[j++] = '.'; in tsrm_realpath_r()
826 path[j] = DEFAULT_SLASH; in tsrm_realpath_r()
831 path[0] = '.'; in tsrm_realpath_r()
832 path[1] = '.'; in tsrm_realpath_r()
833 path[2] = DEFAULT_SLASH; in tsrm_realpath_r()
839 path[len] = 0; in tsrm_realpath_r()
848 if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) { in tsrm_realpath_r()
856 memcpy(path, bucket->realpath, bucket->realpath_len + 1); in tsrm_realpath_r()
863 if (save && (hFind = FindFirstFile(path, &data)) == INVALID_HANDLE_VALUE) { in tsrm_realpath_r()
877 memcpy(tmp, path, len+1); in tsrm_realpath_r()
880 !(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') && in tsrm_realpath_r()
898 …hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_F… in tsrm_realpath_r()
968 memcpy(substitutename, path, len + 1); in tsrm_realpath_r()
1000 *(path + bufindex) = *(tmp2 + bufindex); in tsrm_realpath_r()
1003 *(path + bufindex) = 0; in tsrm_realpath_r()
1013 fprintf(stderr, "resolved: %s ", path); in tsrm_realpath_r()
1018 if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { in tsrm_realpath_r()
1020 j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1033 memmove(path+i, path, j+1); in tsrm_realpath_r()
1034 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1035 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1036 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1060 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1062 if (save && php_sys_lstat(path, &st) < 0) { in tsrm_realpath_r()
1072 memcpy(tmp, path, len+1); in tsrm_realpath_r()
1075 if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) { in tsrm_realpath_r()
1080 path[j] = 0; in tsrm_realpath_r()
1081 if (IS_ABSOLUTE_PATH(path, j)) { in tsrm_realpath_r()
1082 j = tsrm_realpath_r(path, 1, j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1092 memmove(path+i, path, j+1); in tsrm_realpath_r()
1093 memcpy(path, tmp, i-1); in tsrm_realpath_r()
1094 path[i-1] = DEFAULT_SLASH; in tsrm_realpath_r()
1095 j = tsrm_realpath_r(path, start, i + j, ll, t, use_realpath, is_dir, &directory TSRMLS_CC); in tsrm_realpath_r()
1121 …j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL TSRMLS_CC… in tsrm_realpath_r()
1123 path[j++] = DEFAULT_SLASH; in tsrm_realpath_r()
1133 memcpy(path+j, data.cFileName, i+1); in tsrm_realpath_r()
1137 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1146 memcpy(path+j, tmp+i, len-i+1); in tsrm_realpath_r()
1153 realpath_cache_add(tmp, len, path, j, directory, *t TSRMLS_CC); in tsrm_realpath_r()
1164 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int u… in virtual_file_ex() argument
1166 int path_length = strlen(path); in virtual_file_ex()
1190 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1196 if (!IS_ABSOLUTE_PATH(path, path_length)) { in virtual_file_ex()
1200 memcpy(resolved_path , path, path_length + 1); in virtual_file_ex()
1205 if (IS_SLASH(path[0])) { in virtual_file_ex()
1234 memcpy(resolved_path + state_cwd_length, path, path_length + 1); in virtual_file_ex()
1238 memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); in virtual_file_ex()
1244 if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) { in virtual_file_ex()
1245 resolved_path[0] = path[0]; in virtual_file_ex()
1248 memcpy(resolved_path + 3, path + 2, path_length - 1); in virtual_file_ex()
1252 memcpy(resolved_path, path, path_length + 1); in virtual_file_ex()
1373 CWD_API int virtual_chdir(const char *path TSRMLS_DC) /* {{{ */ in virtual_chdir()
1375 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; in virtual_chdir()
1379 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_… in virtual_chdir_file() argument
1381 int length = strlen(path); in virtual_chdir_file()
1389 while(--length >= 0 && !IS_SLASH(path[length])) { in virtual_chdir_file()
1398 …if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing… in virtual_chdir_file()
1402 memcpy(temp, path, length); in virtual_chdir_file()
1413 CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ in virtual_realpath() argument
1420 if (!*path) { in virtual_realpath()
1429 path = cwd; in virtual_realpath()
1431 } else if (!IS_ABSOLUTE_PATH(path, strlen(path))) { in virtual_realpath()
1443 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) { in virtual_realpath()
1459 CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSR… in virtual_filepath_ex() argument
1465 retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH); in virtual_filepath_ex()
1474 CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC) /* {{{ */ in virtual_filepath() argument
1476 return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC); in virtual_filepath()
1480 CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{ */ in virtual_fopen() argument
1485 if (path[0] == '\0') { /* Fail to open empty path */ in virtual_fopen()
1490 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_fopen()
1644 CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */ in virtual_open()
1650 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_open()
1672 CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */ in virtual_creat() argument
1678 if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) { in virtual_creat()
1727 CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ in virtual_stat() argument
1733 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { in virtual_stat()
1745 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */ in virtual_lstat() argument
1751 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_lstat()
1763 CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */ in virtual_unlink()
1769 if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) { in virtual_unlink()
1939 CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ */ in tsrm_realpath() argument
1945 if (!*path) { in tsrm_realpath()
1953 path = cwd; in tsrm_realpath()
1955 } else if (!IS_ABSOLUTE_PATH(path, strlen(path)) && in tsrm_realpath()
1968 if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) { in tsrm_realpath()