php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_virtual_cwd.h File Reference
#include "TSRM.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdarg.h>
#include <limits.h>
#include <unistd.h>
#include "zend_stream.h"

Go to the source code of this file.

Data Structures

struct  _cwd_state
 
struct  _realpath_cache_bucket
 
struct  _virtual_cwd_globals
 

Macros

#define MAXPATHLEN   256
 
#define DEFAULT_SLASH   '/'
 
#define DEFAULT_DIR_SEPARATOR   ':'
 
#define IS_SLASH(c)
 
#define IS_SLASH_P(c)
 
#define IS_SLASH_P_EX(c, first_byte)
 
#define COPY_WHEN_ABSOLUTE(path)
 
#define IS_ABSOLUTE_PATH(path, len)
 
#define CWD_API
 
#define php_sys_stat   stat
 
#define php_sys_lstat   lstat
 
#define php_sys_fstat   fstat
 
#define CWD_EXPAND   0 /* expand "." and ".." but don't 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 */
 
#define REALPATH_CACHE_TTL   (2*60) /* 2 minutes */
 
#define REALPATH_CACHE_SIZE   0 /* disabled while php.ini isn't loaded */
 
#define CWDG(v)
 
#define VCWD_CREAT(path, mode)
 
#define VCWD_FOPEN(path, mode)
 
#define VCWD_OPEN(path, flags)
 
#define VCWD_OPEN_MODE(path, flags, mode)
 
#define VCWD_RENAME(oldname, newname)
 
#define VCWD_MKDIR(pathname, mode)
 
#define VCWD_RMDIR(pathname)
 
#define VCWD_UNLINK(path)
 
#define VCWD_CHDIR(path)
 
#define VCWD_ACCESS(pathname, mode)
 
#define VCWD_GETCWD(buff, size)
 
#define VCWD_CHMOD(path, mode)
 
#define VCWD_CHDIR_FILE(path)
 
#define VCWD_GETWD(buf)
 
#define VCWD_STAT(path, buff)
 
#define VCWD_LSTAT(path, buff)
 
#define VCWD_OPENDIR(pathname)
 
#define VCWD_POPEN(command, type)
 
#define VCWD_REALPATH(path, real_path)
 
#define VCWD_CHOWN(path, owner, group)
 
#define _S_IFDIR   S_IFDIR
 
#define _S_IFREG   S_IFREG
 
#define _IFLNK   0120000 /* symbolic link */
 
#define S_IFLNK   _IFLNK
 
#define S_ISDIR(mode)
 
#define S_ISREG(mode)
 
#define S_ISLNK(mode)
 
#define S_IXROOT   ( S_IXUSR | S_IXGRP | S_IXOTH )
 
#define _IFIFO   0010000 /* fifo */
 
#define S_IFIFO   _IFIFO
 
#define _IFBLK   0060000 /* block special */
 
#define S_IFBLK   _IFBLK
 

Typedefs

typedef struct _cwd_state cwd_state
 
typedef int(* verify_path_func) (const cwd_state *)
 
typedef struct _realpath_cache_bucket realpath_cache_bucket
 
typedef struct _virtual_cwd_globals virtual_cwd_globals
 

Functions

CWD_API void virtual_cwd_startup (void)
 
CWD_API void virtual_cwd_shutdown (void)
 
CWD_API void virtual_cwd_activate (void)
 
CWD_API void virtual_cwd_deactivate (void)
 
CWD_API char * virtual_getcwd_ex (size_t *length)
 
CWD_API char * virtual_getcwd (char *buf, size_t size)
 
CWD_API zend_result virtual_chdir (const char *path)
 
CWD_API int virtual_chdir_file (const char *path, int(*p_chdir)(const char *path))
 
CWD_API int virtual_filepath (const char *path, char **filepath)
 
CWD_API int virtual_filepath_ex (const char *path, char **filepath, verify_path_func verify_path)
 
CWD_API char * virtual_realpath (const char *path, char *real_path)
 
CWD_API FILE * virtual_fopen (const char *path, const char *mode)
 
CWD_API int virtual_open (const char *path, int flags,...)
 
CWD_API int virtual_creat (const char *path, mode_t mode)
 
CWD_API int virtual_rename (const char *oldname, const char *newname)
 
CWD_API int virtual_stat (const char *path, zend_stat_t *buf)
 
CWD_API int virtual_lstat (const char *path, zend_stat_t *buf)
 
CWD_API int virtual_unlink (const char *path)
 
CWD_API int virtual_mkdir (const char *pathname, mode_t mode)
 
CWD_API int virtual_rmdir (const char *pathname)
 
CWD_API DIRvirtual_opendir (const char *pathname)
 
CWD_API FILE * virtual_popen (const char *command, const char *type)
 
CWD_API int virtual_access (const char *pathname, int mode)
 
CWD_API int virtual_chmod (const char *filename, mode_t mode)
 
CWD_API int virtual_chown (const char *filename, uid_t owner, gid_t group, int link)
 
CWD_API int virtual_file_ex (cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath)
 
CWD_API char * tsrm_realpath (const char *path, char *real_path)
 
CWD_API void realpath_cache_clean (void)
 
CWD_API void realpath_cache_del (const char *path, size_t path_len)
 
CWD_API realpath_cache_bucketrealpath_cache_lookup (const char *path, size_t path_len, time_t t)
 
CWD_API zend_long realpath_cache_size (void)
 
CWD_API zend_long realpath_cache_max_buckets (void)
 
CWD_API realpath_cache_bucket ** realpath_cache_get_buckets (void)
 

Variables

virtual_cwd_globals cwd_globals
 

Macro Definition Documentation

◆ _IFBLK

#define _IFBLK   0060000 /* block special */

Definition at line 397 of file zend_virtual_cwd.h.

◆ _IFIFO

#define _IFIFO   0010000 /* fifo */

Definition at line 392 of file zend_virtual_cwd.h.

◆ _IFLNK

#define _IFLNK   0120000 /* symbolic link */

Definition at line 370 of file zend_virtual_cwd.h.

◆ _S_IFDIR

#define _S_IFDIR   S_IFDIR

Definition at line 362 of file zend_virtual_cwd.h.

◆ _S_IFREG

#define _S_IFREG   S_IFREG

Definition at line 366 of file zend_virtual_cwd.h.

◆ COPY_WHEN_ABSOLUTE

#define COPY_WHEN_ABSOLUTE ( path)
Value:
0

Definition at line 124 of file zend_virtual_cwd.h.

◆ CWD_API

#define CWD_API

Definition at line 145 of file zend_virtual_cwd.h.

◆ CWD_EXPAND

#define CWD_EXPAND   0 /* expand "." and ".." but don't resolve symlinks */

Definition at line 210 of file zend_virtual_cwd.h.

◆ CWD_FILEPATH

#define CWD_FILEPATH   1 /* resolve symlinks if file is exist otherwise expand */

Definition at line 211 of file zend_virtual_cwd.h.

◆ CWD_REALPATH

#define CWD_REALPATH   2 /* call realpath(), resolve symlinks. File must exist */

Definition at line 212 of file zend_virtual_cwd.h.

◆ CWDG

#define CWDG ( v)
Value:
virtual_cwd_globals cwd_globals

Definition at line 252 of file zend_virtual_cwd.h.

◆ DEFAULT_DIR_SEPARATOR

#define DEFAULT_DIR_SEPARATOR   ':'

Definition at line 112 of file zend_virtual_cwd.h.

◆ DEFAULT_SLASH

#define DEFAULT_SLASH   '/'

Definition at line 107 of file zend_virtual_cwd.h.

◆ IS_ABSOLUTE_PATH

#define IS_ABSOLUTE_PATH ( path,
len )
Value:
(IS_SLASH(path[0]))
#define IS_SLASH(c)

Definition at line 128 of file zend_virtual_cwd.h.

◆ IS_SLASH

#define IS_SLASH ( c)
Value:
((c) == '/')

Definition at line 115 of file zend_virtual_cwd.h.

◆ IS_SLASH_P

#define IS_SLASH_P ( c)
Value:
(*(c) == '/')

Definition at line 117 of file zend_virtual_cwd.h.

◆ IS_SLASH_P_EX

#define IS_SLASH_P_EX ( c,
first_byte )
Value:
#define IS_SLASH_P(c)

Definition at line 118 of file zend_virtual_cwd.h.

◆ MAXPATHLEN

#define MAXPATHLEN   256

Definition at line 48 of file zend_virtual_cwd.h.

◆ php_sys_fstat

#define php_sys_fstat   fstat

Definition at line 159 of file zend_virtual_cwd.h.

◆ php_sys_lstat

#define php_sys_lstat   lstat

Definition at line 158 of file zend_virtual_cwd.h.

◆ php_sys_stat

#define php_sys_stat   stat

Definition at line 157 of file zend_virtual_cwd.h.

◆ REALPATH_CACHE_SIZE

#define REALPATH_CACHE_SIZE   0 /* disabled while php.ini isn't loaded */

Definition at line 219 of file zend_virtual_cwd.h.

◆ REALPATH_CACHE_TTL

#define REALPATH_CACHE_TTL   (2*60) /* 2 minutes */

Definition at line 218 of file zend_virtual_cwd.h.

◆ S_IFBLK

#define S_IFBLK   _IFBLK

Definition at line 398 of file zend_virtual_cwd.h.

◆ S_IFIFO

#define S_IFIFO   _IFIFO

Definition at line 393 of file zend_virtual_cwd.h.

◆ S_IFLNK

#define S_IFLNK   _IFLNK

Definition at line 371 of file zend_virtual_cwd.h.

◆ S_ISDIR

#define S_ISDIR ( mode)
Value:
(((mode)&S_IFMT) == S_IFDIR)
char * mode

Definition at line 375 of file zend_virtual_cwd.h.

◆ S_ISLNK

#define S_ISLNK ( mode)
Value:
(((mode)&S_IFMT) == S_IFLNK)
#define S_IFLNK

Definition at line 383 of file zend_virtual_cwd.h.

◆ S_ISREG

#define S_ISREG ( mode)
Value:
(((mode)&S_IFMT) == S_IFREG)

Definition at line 379 of file zend_virtual_cwd.h.

◆ S_IXROOT

#define S_IXROOT   ( S_IXUSR | S_IXGRP | S_IXOTH )

Definition at line 387 of file zend_virtual_cwd.h.

◆ VCWD_ACCESS

#define VCWD_ACCESS ( pathname,
mode )
Value:
access(pathname, mode)

Definition at line 329 of file zend_virtual_cwd.h.

◆ VCWD_CHDIR

#define VCWD_CHDIR ( path)
Value:
chdir(path)
chdir(string $directory)

Definition at line 328 of file zend_virtual_cwd.h.

◆ VCWD_CHDIR_FILE

#define VCWD_CHDIR_FILE ( path)
Value:
CWD_API int virtual_chdir_file(const char *path, int(*p_chdir)(const char *path))

Definition at line 334 of file zend_virtual_cwd.h.

◆ VCWD_CHMOD

#define VCWD_CHMOD ( path,
mode )
Value:
chmod(path, mode)
chmod(string $filename, int $permissions)

Definition at line 331 of file zend_virtual_cwd.h.

◆ VCWD_CHOWN

#define VCWD_CHOWN ( path,
owner,
group )
Value:
chown(path, owner, group)
chown(string $filename, string|int $user)

Definition at line 352 of file zend_virtual_cwd.h.

◆ VCWD_CREAT

#define VCWD_CREAT ( path,
mode )
Value:
creat(path, mode)

Definition at line 305 of file zend_virtual_cwd.h.

◆ VCWD_FOPEN

#define VCWD_FOPEN ( path,
mode )
Value:
fopen(path, mode)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)

Definition at line 321 of file zend_virtual_cwd.h.

◆ VCWD_GETCWD

#define VCWD_GETCWD ( buff,
size )
Value:
getcwd(buff, size)
new_type size
Definition ffi.c:4365

Definition at line 330 of file zend_virtual_cwd.h.

◆ VCWD_GETWD

#define VCWD_GETWD ( buf)
Value:
getwd(buf)
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685

Definition at line 335 of file zend_virtual_cwd.h.

◆ VCWD_LSTAT

#define VCWD_LSTAT ( path,
buff )
Value:
lstat(path, buff)
lstat(string $filename)

Definition at line 337 of file zend_virtual_cwd.h.

◆ VCWD_MKDIR

#define VCWD_MKDIR ( pathname,
mode )
Value:
mkdir(pathname, mode)
mkdir(string $directory, int $permissions=0777, bool $recursive=false, $context=null)

Definition at line 325 of file zend_virtual_cwd.h.

◆ VCWD_OPEN

#define VCWD_OPEN ( path,
flags )
Value:
open(path, flags)

Definition at line 322 of file zend_virtual_cwd.h.

◆ VCWD_OPEN_MODE

#define VCWD_OPEN_MODE ( path,
flags,
mode )
Value:
open(path, flags, mode)

Definition at line 323 of file zend_virtual_cwd.h.

◆ VCWD_OPENDIR

#define VCWD_OPENDIR ( pathname)
Value:
opendir(pathname)
opendir(string $directory, $context=null)

Definition at line 338 of file zend_virtual_cwd.h.

◆ VCWD_POPEN

#define VCWD_POPEN ( command,
type )
Value:
popen(command, type)
popen(string $command, string $mode)
zend_ffi_type * type
Definition ffi.c:3812

Definition at line 339 of file zend_virtual_cwd.h.

◆ VCWD_REALPATH

#define VCWD_REALPATH ( path,
real_path )
Value:
tsrm_realpath(path, real_path)
CWD_API char * tsrm_realpath(const char *path, char *real_path)

Definition at line 341 of file zend_virtual_cwd.h.

◆ VCWD_RENAME

#define VCWD_RENAME ( oldname,
newname )
Value:
rename(oldname, newname)
rename(string $from, string $to, $context=null)

Definition at line 324 of file zend_virtual_cwd.h.

◆ VCWD_RMDIR

#define VCWD_RMDIR ( pathname)
Value:
rmdir(pathname)
rmdir(string $directory, $context=null)

Definition at line 326 of file zend_virtual_cwd.h.

◆ VCWD_STAT

#define VCWD_STAT ( path,
buff )
Value:
php_sys_stat(path, buff)
#define php_sys_stat

Definition at line 336 of file zend_virtual_cwd.h.

◆ VCWD_UNLINK

#define VCWD_UNLINK ( path)
Value:
unlink(path)
unlink(string $filename, $context=null)

Definition at line 327 of file zend_virtual_cwd.h.

Typedef Documentation

◆ cwd_state

typedef struct _cwd_state cwd_state

◆ realpath_cache_bucket

◆ verify_path_func

typedef int(* verify_path_func) (const cwd_state *)

Definition at line 172 of file zend_virtual_cwd.h.

◆ virtual_cwd_globals

Function Documentation

◆ realpath_cache_clean()

CWD_API void realpath_cache_clean ( void )

Definition at line 355 of file zend_virtual_cwd.c.

◆ realpath_cache_del()

CWD_API void realpath_cache_del ( const char * path,
size_t path_len )

Definition at line 361 of file zend_virtual_cwd.c.

◆ realpath_cache_get_buckets()

CWD_API realpath_cache_bucket ** realpath_cache_get_buckets ( void )

Definition at line 480 of file zend_virtual_cwd.c.

◆ realpath_cache_lookup()

CWD_API realpath_cache_bucket * realpath_cache_lookup ( const char * path,
size_t path_len,
time_t t )

Definition at line 464 of file zend_virtual_cwd.c.

◆ realpath_cache_max_buckets()

CWD_API zend_long realpath_cache_max_buckets ( void )

Definition at line 475 of file zend_virtual_cwd.c.

◆ realpath_cache_size()

CWD_API zend_long realpath_cache_size ( void )

Definition at line 470 of file zend_virtual_cwd.c.

◆ tsrm_realpath()

CWD_API char * tsrm_realpath ( const char * path,
char * real_path )

Definition at line 1717 of file zend_virtual_cwd.c.

◆ virtual_access()

CWD_API int virtual_access ( const char * pathname,
int mode )

Definition at line 1332 of file zend_virtual_cwd.c.

◆ virtual_chdir()

CWD_API zend_result virtual_chdir ( const char * path)

Definition at line 1203 of file zend_virtual_cwd.c.

◆ virtual_chdir_file()

CWD_API int virtual_chdir_file ( const char * path,
int(* p_chdir )(const char *path) )

Definition at line 1211 of file zend_virtual_cwd.c.

◆ virtual_chmod()

CWD_API int virtual_chmod ( const char * filename,
mode_t mode )

Definition at line 1379 of file zend_virtual_cwd.c.

◆ virtual_chown()

CWD_API int virtual_chown ( const char * filename,
uid_t owner,
gid_t group,
int link )

Definition at line 1414 of file zend_virtual_cwd.c.

◆ virtual_creat()

CWD_API int virtual_creat ( const char * path,
mode_t mode )

Definition at line 1477 of file zend_virtual_cwd.c.

◆ virtual_cwd_activate()

CWD_API void virtual_cwd_activate ( void )

Definition at line 233 of file zend_virtual_cwd.c.

◆ virtual_cwd_deactivate()

CWD_API void virtual_cwd_deactivate ( void )

Definition at line 241 of file zend_virtual_cwd.c.

◆ virtual_cwd_shutdown()

CWD_API void virtual_cwd_shutdown ( void )

Definition at line 220 of file zend_virtual_cwd.c.

◆ virtual_cwd_startup()

CWD_API void virtual_cwd_startup ( void )

Definition at line 205 of file zend_virtual_cwd.c.

◆ virtual_file_ex()

CWD_API int virtual_file_ex ( cwd_state * state,
const char * path,
verify_path_func verify_path,
int use_realpath )

Definition at line 1007 of file zend_virtual_cwd.c.

◆ virtual_filepath()

CWD_API int virtual_filepath ( const char * path,
char ** filepath )

Definition at line 1299 of file zend_virtual_cwd.c.

◆ virtual_filepath_ex()

CWD_API int virtual_filepath_ex ( const char * path,
char ** filepath,
verify_path_func verify_path )

Definition at line 1283 of file zend_virtual_cwd.c.

◆ virtual_fopen()

CWD_API FILE * virtual_fopen ( const char * path,
const char * mode )

Definition at line 1305 of file zend_virtual_cwd.c.

◆ virtual_getcwd()

CWD_API char * virtual_getcwd ( char * buf,
size_t size )

Definition at line 291 of file zend_virtual_cwd.c.

◆ virtual_getcwd_ex()

CWD_API char * virtual_getcwd_ex ( size_t * length)

Definition at line 250 of file zend_virtual_cwd.c.

◆ virtual_lstat()

CWD_API int virtual_lstat ( const char * path,
zend_stat_t * buf )

Definition at line 1550 of file zend_virtual_cwd.c.

◆ virtual_mkdir()

CWD_API int virtual_mkdir ( const char * pathname,
mode_t mode )

Definition at line 1590 of file zend_virtual_cwd.c.

◆ virtual_open()

CWD_API int virtual_open ( const char * path,
int flags,
... )

Definition at line 1441 of file zend_virtual_cwd.c.

◆ virtual_opendir()

CWD_API DIR * virtual_opendir ( const char * pathname)

Definition at line 1636 of file zend_virtual_cwd.c.

◆ virtual_popen()

CWD_API FILE * virtual_popen ( const char * command,
const char * type )

Definition at line 1661 of file zend_virtual_cwd.c.

◆ virtual_realpath()

CWD_API char * virtual_realpath ( const char * path,
char * real_path )

Definition at line 1245 of file zend_virtual_cwd.c.

◆ virtual_rename()

CWD_API int virtual_rename ( const char * oldname,
const char * newname )

Definition at line 1495 of file zend_virtual_cwd.c.

◆ virtual_rmdir()

CWD_API int virtual_rmdir ( const char * pathname)

Definition at line 1611 of file zend_virtual_cwd.c.

◆ virtual_stat()

CWD_API int virtual_stat ( const char * path,
zend_stat_t * buf )

Definition at line 1532 of file zend_virtual_cwd.c.

◆ virtual_unlink()

CWD_API int virtual_unlink ( const char * path)

Definition at line 1568 of file zend_virtual_cwd.c.

Variable Documentation

◆ cwd_globals

virtual_cwd_globals cwd_globals
extern

Definition at line 89 of file zend_virtual_cwd.c.