2000-09-04 02:18:13 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2014-09-20 00:33:14 +08:00
|
|
|
| PHP Version 7 |
|
2000-09-04 02:18:13 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2014-01-03 11:08:10 +08:00
|
|
|
| Copyright (c) 1997-2014 The PHP Group |
|
2000-09-04 02:18:13 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 20:51:34 +08:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
2000-09-04 02:18:13 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-25 13:05:06 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 20:51:34 +08:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
2000-09-04 02:18:13 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Andi Gutmans <andi@zend.com> |
|
|
|
|
| Sascha Schumann <sascha@schumann.cx> |
|
2010-09-01 17:49:53 +08:00
|
|
|
| Pierre Joye <pierre@php.net> |
|
2000-09-04 02:18:13 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef VIRTUAL_CWD_H
|
|
|
|
#define VIRTUAL_CWD_H
|
|
|
|
|
2001-08-05 09:34:40 +08:00
|
|
|
#include "TSRM.h"
|
2000-09-07 04:27:12 +08:00
|
|
|
#include "tsrm_config_common.h"
|
2000-09-04 02:58:46 +08:00
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UTIME_H
|
|
|
|
#include <utime.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_STDARG_H
|
|
|
|
#include <stdarg.h>
|
|
|
|
#endif
|
|
|
|
|
2006-09-04 16:18:15 +08:00
|
|
|
#ifdef ZTS
|
|
|
|
#define VIRTUAL_DIR
|
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#ifndef TSRM_WIN32
|
|
|
|
#include <unistd.h>
|
2006-09-04 16:18:15 +08:00
|
|
|
#else
|
|
|
|
#include <direct.h>
|
2000-09-04 02:18:13 +08:00
|
|
|
#endif
|
|
|
|
|
2003-08-07 23:32:18 +08:00
|
|
|
#if defined(__osf__) || defined(_AIX)
|
|
|
|
#include <errno.h>
|
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#ifdef TSRM_WIN32
|
2000-09-04 02:47:35 +08:00
|
|
|
#include "readdir.h"
|
2000-09-04 12:18:38 +08:00
|
|
|
#include <sys/utime.h>
|
2000-09-04 02:47:35 +08:00
|
|
|
/* mode_t isn't defined on Windows */
|
2000-11-01 02:05:28 +08:00
|
|
|
typedef unsigned short mode_t;
|
2000-09-04 02:18:13 +08:00
|
|
|
|
2000-10-04 00:36:32 +08:00
|
|
|
#define DEFAULT_SLASH '\\'
|
2001-07-16 21:31:22 +08:00
|
|
|
#define DEFAULT_DIR_SEPARATOR ';'
|
2000-09-04 02:18:13 +08:00
|
|
|
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
2002-04-25 22:43:40 +08:00
|
|
|
#define IS_SLASH_P(c) (*(c) == '/' || \
|
|
|
|
(*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
|
2002-11-05 04:45:28 +08:00
|
|
|
|
2003-06-25 13:05:06 +08:00
|
|
|
/* COPY_WHEN_ABSOLUTE is 2 under Win32 because by chance both regular absolute paths
|
|
|
|
in the file system and UNC paths need copying of two characters */
|
2002-11-05 04:45:28 +08:00
|
|
|
#define COPY_WHEN_ABSOLUTE(path) 2
|
2001-03-23 16:33:06 +08:00
|
|
|
#define IS_UNC_PATH(path, len) \
|
|
|
|
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
|
2003-06-25 13:05:06 +08:00
|
|
|
#define IS_ABSOLUTE_PATH(path, len) \
|
2014-09-19 21:44:04 +08:00
|
|
|
(len >= 2 && ((/* is local */isalpha(path[0]) && path[1] == ':') || /* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1])))
|
2000-09-04 02:18:13 +08:00
|
|
|
|
2002-05-29 16:41:21 +08:00
|
|
|
#elif defined(NETWARE)
|
|
|
|
#ifdef HAVE_DIRENT_H
|
|
|
|
#include <dirent.h>
|
|
|
|
#endif
|
|
|
|
|
2005-07-07 15:12:44 +08:00
|
|
|
#define DEFAULT_SLASH '/'
|
2002-05-29 16:41:21 +08:00
|
|
|
#define DEFAULT_DIR_SEPARATOR ';'
|
|
|
|
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
2003-06-25 13:05:06 +08:00
|
|
|
#define IS_SLASH_P(c) IS_SLASH(*(c))
|
2004-10-08 17:48:20 +08:00
|
|
|
/* Colon indicates volume name, either first character should be forward slash or backward slash */
|
2002-05-29 16:41:21 +08:00
|
|
|
#define IS_ABSOLUTE_PATH(path, len) \
|
2004-10-08 17:48:20 +08:00
|
|
|
((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\'))))
|
2002-05-29 16:41:21 +08:00
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#else
|
|
|
|
#ifdef HAVE_DIRENT_H
|
|
|
|
#include <dirent.h>
|
|
|
|
#endif
|
|
|
|
|
2000-10-04 00:36:32 +08:00
|
|
|
#define DEFAULT_SLASH '/'
|
2001-11-03 21:33:21 +08:00
|
|
|
|
|
|
|
#ifdef __riscos__
|
|
|
|
#define DEFAULT_DIR_SEPARATOR ';'
|
|
|
|
#else
|
|
|
|
#define DEFAULT_DIR_SEPARATOR ':'
|
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#define IS_SLASH(c) ((c) == '/')
|
2002-04-25 22:43:40 +08:00
|
|
|
#define IS_SLASH_P(c) (*(c) == '/')
|
2000-09-04 02:18:13 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-10-04 00:36:32 +08:00
|
|
|
|
|
|
|
#ifndef COPY_WHEN_ABSOLUTE
|
2002-11-05 04:45:28 +08:00
|
|
|
#define COPY_WHEN_ABSOLUTE(path) 0
|
2000-10-04 00:36:32 +08:00
|
|
|
#endif
|
|
|
|
|
2010-09-13 17:08:42 +08:00
|
|
|
#ifndef IS_ABSOLUTE_PATH
|
2000-09-04 02:18:13 +08:00
|
|
|
#define IS_ABSOLUTE_PATH(path, len) \
|
|
|
|
(IS_SLASH(path[0]))
|
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:47:35 +08:00
|
|
|
#ifdef TSRM_EXPORTS
|
2000-09-04 02:18:13 +08:00
|
|
|
#define CWD_EXPORTS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TSRM_WIN32
|
2008-01-30 17:41:12 +08:00
|
|
|
# ifdef CWD_EXPORTS
|
|
|
|
# define CWD_API __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define CWD_API __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
#elif defined(__GNUC__) && __GNUC__ >= 4
|
|
|
|
# define CWD_API __attribute__ ((visibility("default")))
|
2000-09-04 02:18:13 +08:00
|
|
|
#else
|
2008-01-30 17:41:12 +08:00
|
|
|
# define CWD_API
|
2000-09-04 02:18:13 +08:00
|
|
|
#endif
|
|
|
|
|
2006-11-10 23:04:07 +08:00
|
|
|
#ifdef TSRM_WIN32
|
2014-08-16 17:16:11 +08:00
|
|
|
CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat);
|
2010-09-01 17:49:53 +08:00
|
|
|
# define php_sys_stat(path, buf) php_sys_stat_ex(path, buf, 0)
|
|
|
|
# define php_sys_lstat(path, buf) php_sys_stat_ex(path, buf, 1)
|
2010-10-04 18:35:32 +08:00
|
|
|
CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len);
|
2006-11-10 23:04:07 +08:00
|
|
|
#else
|
|
|
|
# define php_sys_stat stat
|
2010-09-01 17:49:53 +08:00
|
|
|
# define php_sys_lstat lstat
|
2010-09-10 22:01:44 +08:00
|
|
|
# ifdef HAVE_SYMLINK
|
|
|
|
# define php_sys_readlink(link, target, target_len) readlink(link, target, target_len)
|
|
|
|
# endif
|
2006-11-10 23:04:07 +08:00
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
typedef struct _cwd_state {
|
|
|
|
char *cwd;
|
|
|
|
int cwd_length;
|
|
|
|
} cwd_state;
|
|
|
|
|
|
|
|
typedef int (*verify_path_func)(const cwd_state *);
|
|
|
|
|
|
|
|
CWD_API void virtual_cwd_startup(void);
|
|
|
|
CWD_API void virtual_cwd_shutdown(void);
|
2013-10-17 16:40:43 +08:00
|
|
|
CWD_API int virtual_cwd_activate(TSRMLS_D);
|
|
|
|
CWD_API int virtual_cwd_deactivate(TSRMLS_D);
|
2001-08-05 09:34:40 +08:00
|
|
|
CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC);
|
|
|
|
CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC);
|
|
|
|
CWD_API int virtual_chdir(const char *path TSRMLS_DC);
|
|
|
|
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC);
|
|
|
|
CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC);
|
|
|
|
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC);
|
|
|
|
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
|
|
|
|
CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
|
|
|
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
|
|
|
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
2013-07-30 18:49:36 +08:00
|
|
|
CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC);
|
2014-08-16 17:16:11 +08:00
|
|
|
CWD_API int virtual_stat(const char *path, zend_stat_t *buf TSRMLS_DC);
|
|
|
|
CWD_API int virtual_lstat(const char *path, zend_stat_t *buf TSRMLS_DC);
|
2001-08-05 09:34:40 +08:00
|
|
|
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
|
|
|
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
|
|
|
|
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
|
|
|
|
CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC);
|
|
|
|
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
|
2002-10-04 09:04:00 +08:00
|
|
|
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
|
2003-06-25 13:05:06 +08:00
|
|
|
#if defined(TSRM_WIN32)
|
|
|
|
/* these are not defined in win32 headers */
|
|
|
|
#ifndef W_OK
|
|
|
|
#define W_OK 0x02
|
|
|
|
#endif
|
|
|
|
#ifndef R_OK
|
|
|
|
#define R_OK 0x04
|
|
|
|
#endif
|
|
|
|
#ifndef X_OK
|
|
|
|
#define X_OK 0x01
|
|
|
|
#endif
|
|
|
|
#ifndef F_OK
|
|
|
|
#define F_OK 0x00
|
|
|
|
#endif
|
2002-10-04 09:04:00 +08:00
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#if HAVE_UTIME
|
2001-08-05 09:34:40 +08:00
|
|
|
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
|
2000-09-04 02:18:13 +08:00
|
|
|
#endif
|
2001-08-05 09:34:40 +08:00
|
|
|
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
|
2002-05-29 16:41:21 +08:00
|
|
|
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
2006-03-06 02:57:54 +08:00
|
|
|
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
|
2000-09-04 02:18:13 +08:00
|
|
|
#endif
|
|
|
|
|
2010-09-13 17:08:42 +08:00
|
|
|
/* One of the following constants must be used as the last argument
|
2006-11-14 17:15:55 +08:00
|
|
|
in virtual_file_ex() call. */
|
|
|
|
|
|
|
|
#define CWD_EXPAND 0 /* expand "." and ".." but dont resolve symlinks */
|
|
|
|
#define CWD_FILEPATH 1 /* resolve symlinks if file is exist otherwise expand */
|
|
|
|
#define CWD_REALPATH 2 /* call realpath(), resolve symlinks. File must exist */
|
2006-11-13 23:13:20 +08:00
|
|
|
|
2010-08-30 17:38:47 +08:00
|
|
|
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath TSRMLS_DC);
|
2000-09-04 02:18:13 +08:00
|
|
|
|
2006-11-10 20:59:27 +08:00
|
|
|
CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC);
|
|
|
|
|
2004-10-05 08:42:25 +08:00
|
|
|
#define REALPATH_CACHE_TTL (2*60) /* 2 minutes */
|
|
|
|
#define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
|
|
|
|
|
|
|
|
typedef struct _realpath_cache_bucket {
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_ulong key;
|
2004-10-05 08:42:25 +08:00
|
|
|
char *path;
|
|
|
|
char *realpath;
|
2014-09-13 03:31:25 +08:00
|
|
|
struct _realpath_cache_bucket *next;
|
|
|
|
time_t expires;
|
|
|
|
int path_len;
|
2004-10-05 08:42:25 +08:00
|
|
|
int realpath_len;
|
2008-08-12 16:01:24 +08:00
|
|
|
int is_dir;
|
2009-06-16 08:07:05 +08:00
|
|
|
#ifdef PHP_WIN32
|
|
|
|
unsigned char is_rvalid;
|
|
|
|
unsigned char is_readable;
|
|
|
|
unsigned char is_wvalid;
|
|
|
|
unsigned char is_writable;
|
|
|
|
#endif
|
2004-10-05 08:42:25 +08:00
|
|
|
} realpath_cache_bucket;
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
typedef struct _virtual_cwd_globals {
|
|
|
|
cwd_state cwd;
|
2014-08-26 01:24:55 +08:00
|
|
|
zend_long realpath_cache_size;
|
|
|
|
zend_long realpath_cache_size_limit;
|
|
|
|
zend_long realpath_cache_ttl;
|
2004-10-05 08:42:25 +08:00
|
|
|
realpath_cache_bucket *realpath_cache[1024];
|
2000-09-04 02:18:13 +08:00
|
|
|
} virtual_cwd_globals;
|
|
|
|
|
|
|
|
#ifdef ZTS
|
2004-10-05 08:42:25 +08:00
|
|
|
extern ts_rsrc_id cwd_globals_id;
|
2001-07-28 18:46:11 +08:00
|
|
|
# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v)
|
2000-09-04 02:18:13 +08:00
|
|
|
#else
|
2004-10-05 08:42:25 +08:00
|
|
|
extern virtual_cwd_globals cwd_globals;
|
2000-09-04 02:18:13 +08:00
|
|
|
# define CWDG(v) (cwd_globals.v)
|
|
|
|
#endif
|
|
|
|
|
2007-01-22 17:31:46 +08:00
|
|
|
CWD_API void realpath_cache_clean(TSRMLS_D);
|
|
|
|
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC);
|
2009-06-16 08:07:05 +08:00
|
|
|
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC);
|
2014-08-26 01:24:55 +08:00
|
|
|
CWD_API zend_long realpath_cache_size(TSRMLS_D);
|
|
|
|
CWD_API zend_long realpath_cache_max_buckets(TSRMLS_D);
|
2009-12-08 09:51:34 +08:00
|
|
|
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
|
2007-01-22 17:31:46 +08:00
|
|
|
|
2000-09-04 12:18:38 +08:00
|
|
|
/* The actual macros to be used in programs using TSRM
|
|
|
|
* If the program defines VIRTUAL_DIR it will use the
|
2010-09-13 17:08:42 +08:00
|
|
|
* virtual_* functions
|
2000-09-04 12:18:38 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef VIRTUAL_DIR
|
|
|
|
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC)
|
|
|
|
#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode TSRMLS_CC)
|
|
|
|
/* Because open() has two modes, we have to macros to replace it */
|
|
|
|
#define VCWD_OPEN(path, flags) virtual_open(path TSRMLS_CC, flags)
|
|
|
|
#define VCWD_OPEN_MODE(path, flags, mode) virtual_open(path TSRMLS_CC, flags, mode)
|
|
|
|
#define VCWD_CREAT(path, mode) virtual_creat(path, mode TSRMLS_CC)
|
|
|
|
#define VCWD_CHDIR(path) virtual_chdir(path TSRMLS_CC)
|
|
|
|
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir TSRMLS_CC)
|
2001-04-30 20:45:02 +08:00
|
|
|
#define VCWD_GETWD(buf)
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
|
|
|
|
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
|
|
|
|
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
2008-04-24 15:45:01 +08:00
|
|
|
# define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
|
|
|
|
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
|
|
|
|
#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
|
|
|
|
#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC)
|
|
|
|
#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC)
|
2002-10-04 09:04:00 +08:00
|
|
|
#define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode TSRMLS_CC)
|
2000-09-04 12:18:38 +08:00
|
|
|
#if HAVE_UTIME
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC)
|
2000-09-04 12:18:38 +08:00
|
|
|
#endif
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
|
2002-05-29 16:41:21 +08:00
|
|
|
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
2006-03-06 02:57:54 +08:00
|
|
|
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0 TSRMLS_CC)
|
2006-04-10 19:56:18 +08:00
|
|
|
#if HAVE_LCHOWN
|
2006-03-06 02:57:54 +08:00
|
|
|
#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1 TSRMLS_CC)
|
2000-09-04 12:18:38 +08:00
|
|
|
#endif
|
2006-04-10 19:56:18 +08:00
|
|
|
#endif
|
2000-09-04 12:18:38 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_GETCWD(buff, size) getcwd(buff, size)
|
2001-04-30 20:45:02 +08:00
|
|
|
#define VCWD_FOPEN(path, mode) fopen(path, mode)
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_OPEN(path, flags) open(path, flags)
|
|
|
|
#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode)
|
2001-04-30 20:45:02 +08:00
|
|
|
#define VCWD_CREAT(path, mode) creat(path, mode)
|
2008-04-24 15:45:01 +08:00
|
|
|
/* rename on windows will fail if newname already exists.
|
|
|
|
MoveFileEx has to be used */
|
|
|
|
#if defined(TSRM_WIN32)
|
2009-07-06 16:56:23 +08:00
|
|
|
# define VCWD_RENAME(oldname, newname) (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0 ? -1 : 0)
|
2008-04-24 15:45:01 +08:00
|
|
|
#else
|
|
|
|
# define VCWD_RENAME(oldname, newname) rename(oldname, newname)
|
|
|
|
#endif
|
2001-04-30 20:45:02 +08:00
|
|
|
#define VCWD_CHDIR(path) chdir(path)
|
|
|
|
#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
|
|
|
|
#define VCWD_GETWD(buf) getwd(buf)
|
2006-11-10 23:04:07 +08:00
|
|
|
#define VCWD_STAT(path, buff) php_sys_stat(path, buff)
|
2001-04-30 20:45:02 +08:00
|
|
|
#define VCWD_LSTAT(path, buff) lstat(path, buff)
|
|
|
|
#define VCWD_UNLINK(path) unlink(path)
|
|
|
|
#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
|
|
|
|
#define VCWD_RMDIR(pathname) rmdir(pathname)
|
|
|
|
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
|
|
|
#define VCWD_POPEN(command, type) popen(command, type)
|
2003-06-25 13:05:06 +08:00
|
|
|
#if defined(TSRM_WIN32)
|
2010-09-17 17:27:19 +08:00
|
|
|
#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode TSRMLS_CC)
|
2003-06-25 13:05:06 +08:00
|
|
|
#else
|
2002-10-04 09:04:00 +08:00
|
|
|
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
|
2003-06-25 13:05:06 +08:00
|
|
|
#endif
|
2001-08-05 09:34:40 +08:00
|
|
|
|
2006-11-10 20:59:27 +08:00
|
|
|
#define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path TSRMLS_CC)
|
2001-08-05 09:34:40 +08:00
|
|
|
|
2000-09-04 12:18:38 +08:00
|
|
|
#if HAVE_UTIME
|
2009-08-25 17:16:53 +08:00
|
|
|
# ifdef TSRM_WIN32
|
|
|
|
# define VCWD_UTIME(path, time) win32_utime(path, time)
|
|
|
|
# else
|
|
|
|
# define VCWD_UTIME(path, time) utime(path, time)
|
|
|
|
# endif
|
2000-09-04 12:18:38 +08:00
|
|
|
#endif
|
2009-08-25 17:16:53 +08:00
|
|
|
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_CHMOD(path, mode) chmod(path, mode)
|
2002-05-29 16:41:21 +08:00
|
|
|
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
2001-08-05 09:34:40 +08:00
|
|
|
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
|
2006-04-10 19:56:18 +08:00
|
|
|
#if HAVE_LCHOWN
|
2006-03-06 02:57:54 +08:00
|
|
|
#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group)
|
2000-09-04 12:18:38 +08:00
|
|
|
#endif
|
2006-04-10 19:56:18 +08:00
|
|
|
#endif
|
2000-09-04 12:18:38 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-09-04 02:18:13 +08:00
|
|
|
#endif /* VIRTUAL_CWD_H */
|