diff options
author | Anatol Belski <ab@php.net> | 2017-12-15 13:23:34 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-12-15 13:23:34 +0100 |
commit | f3f6cd24e9677c820f198f3804d6c9a932685373 (patch) | |
tree | efa5dea154db468a6b7d33c85ce6db3e5c61f093 /TSRM | |
parent | 66a604171cc676ebc8cb717437f6b9cd589d3d24 (diff) | |
download | php-git-f3f6cd24e9677c820f198f3804d6c9a932685373.tar.gz |
Modernize realpath and integrate quick variant into virtual_file_ex
The slower I/O as a traditional bottleneck on Windows which is
the target of this patch. The recursive path resolution, while being
an allround solution, is expensive when it comes to the common case.
Files with proper ACLs set can be resolved in one go by usage of specific
API. Those are available since Vista, so actually can be called old. Those
simpler api is used for the cases where no CWD_EXPAND is requested. For
the cases where ACLs are improper, the existing solution based on
FindFirstFile still does good job also partially providing quirks. Cases
involing reparse tags and other non local filesystems are also partially
server by new APIs.
The approach uses both APIs - the quick one for the common case still
integrating realpath cache, and the existing one as a fallback. The tests
show the I/O load drop on the realpath resolution part due to less
system calls for the sub part resolution of paths. In most case it is
justified, as the sub parts were otherwise cached or unused as well. The
realpath() implementation in ioutil is also closer to the POSIX.
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_config.w32.h | 1 | ||||
-rw-r--r-- | TSRM/tsrm_win32.c | 9 | ||||
-rw-r--r-- | TSRM/tsrm_win32.h | 2 |
3 files changed, 0 insertions, 12 deletions
diff --git a/TSRM/tsrm_config.w32.h b/TSRM/tsrm_config.w32.h index a58d47517c..ab45141179 100644 --- a/TSRM/tsrm_config.w32.h +++ b/TSRM/tsrm_config.w32.h @@ -6,7 +6,6 @@ #define HAVE_UTIME 1 #define HAVE_ALLOCA 1 -#define HAVE_REALPATH 1 #include <malloc.h> #include <stdlib.h> diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 902a693ccc..4de7acbfe3 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -766,15 +766,6 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) } }/*}}}*/ -TSRM_API char *realpath(char *orig_path, char *buffer) -{/*{{{*/ - int ret = GetFullPathName(orig_path, _MAX_PATH, buffer, NULL); - if(!ret || ret > _MAX_PATH) { - return NULL; - } - return buffer; -}/*}}}*/ - #if HAVE_UTIME static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */ { diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h index b90791cd59..3edef1dd58 100644 --- a/TSRM/tsrm_win32.h +++ b/TSRM/tsrm_win32.h @@ -110,8 +110,6 @@ TSRM_API int shmget(key_t key, size_t size, int flags); TSRM_API void *shmat(int key, const void *shmaddr, int flags); TSRM_API int shmdt(const void *shmaddr); TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf); - -TSRM_API char *realpath(char *orig_path, char *buffer); #endif /* |