mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
bring head into sync with the php4 branch
This commit is contained in:
parent
d4cd1ef084
commit
76f85107e2
10 changed files with 198 additions and 273 deletions
48
TSRM/TSRM.c
48
TSRM/TSRM.c
|
@ -158,9 +158,6 @@ TSRM_API void tsrm_shutdown(void)
|
||||||
|
|
||||||
next_p = p->next;
|
next_p = p->next;
|
||||||
for (j=0; j<id_count; j++) {
|
for (j=0; j<id_count; j++) {
|
||||||
if (resource_types_table && resource_types_table[j].dtor) {
|
|
||||||
resource_types_table[j].dtor(p->storage[j], &p->storage);
|
|
||||||
}
|
|
||||||
free(p->storage[j]);
|
free(p->storage[j]);
|
||||||
}
|
}
|
||||||
free(p->storage);
|
free(p->storage);
|
||||||
|
@ -293,15 +290,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
|
||||||
int hash_value;
|
int hash_value;
|
||||||
tsrm_tls_entry *thread_resources;
|
tsrm_tls_entry *thread_resources;
|
||||||
|
|
||||||
#ifdef NETWARE
|
|
||||||
/* The below if loop is added for NetWare to fix an abend while unloading PHP
|
|
||||||
* when an Apache unload command is issued on the system console.
|
|
||||||
* While exiting from PHP, at the end for some reason, this function is called
|
|
||||||
* with tsrm_tls_table = NULL. When this happened, the server abends when
|
|
||||||
* tsrm_tls_table is accessed since it is NULL.
|
|
||||||
*/
|
|
||||||
if(tsrm_tls_table) {
|
|
||||||
#endif
|
|
||||||
if (!th_id) {
|
if (!th_id) {
|
||||||
#if defined(PTHREADS)
|
#if defined(PTHREADS)
|
||||||
/* Fast path for looking up the resources for the current
|
/* Fast path for looking up the resources for the current
|
||||||
|
@ -364,9 +352,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
|
||||||
* changes to the structure as we read it.
|
* changes to the structure as we read it.
|
||||||
*/
|
*/
|
||||||
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
|
||||||
#ifdef NETWARE
|
|
||||||
} /* if(tsrm_tls_table) */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,12 +419,7 @@ TSRM_API THREAD_T tsrm_thread_id(void)
|
||||||
#ifdef TSRM_WIN32
|
#ifdef TSRM_WIN32
|
||||||
return GetCurrentThreadId();
|
return GetCurrentThreadId();
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
/* There seems to be some problem with the LibC call: NXThreadGetId().
|
return NXThreadGetId();
|
||||||
* Due to this, the PHPMyAdmin application is abending in PHP calls.
|
|
||||||
* Used the call, kCurrentThread instead and it works fine.
|
|
||||||
*/
|
|
||||||
/* return NXThreadGetId(); */
|
|
||||||
return kCurrentThread();
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
return pth_self();
|
return pth_self();
|
||||||
#elif defined(PTHREADS)
|
#elif defined(PTHREADS)
|
||||||
|
@ -461,23 +441,16 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void)
|
||||||
{
|
{
|
||||||
MUTEX_T mutexp;
|
MUTEX_T mutexp;
|
||||||
#ifdef NETWARE
|
#ifdef NETWARE
|
||||||
#ifndef USE_MPK
|
long flags = 0; /* Don't require NX_MUTEX_RECURSIVE, I guess */
|
||||||
/* To use the Recursive Mutex Locking of LibC */
|
|
||||||
long flags = NX_MUTEX_RECURSIVE;
|
|
||||||
NXHierarchy_t order = 0;
|
NXHierarchy_t order = 0;
|
||||||
NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0);
|
NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TSRM_WIN32
|
#ifdef TSRM_WIN32
|
||||||
mutexp = malloc(sizeof(CRITICAL_SECTION));
|
mutexp = malloc(sizeof(CRITICAL_SECTION));
|
||||||
InitializeCriticalSection(mutexp);
|
InitializeCriticalSection(mutexp);
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
#ifdef USE_MPK
|
mutexp = NXMutexAlloc(flags, order, &lockInfo); /* return value ignored for now */
|
||||||
mutexp = kMutexAlloc((BYTE*)"PHP-TSRM");
|
|
||||||
#else
|
|
||||||
mutexp = NXMutexAlloc(flags, order, &lockInfo);
|
|
||||||
#endif
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
|
mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
|
||||||
pth_mutex_init(mutexp);
|
pth_mutex_init(mutexp);
|
||||||
|
@ -508,13 +481,8 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
|
||||||
if (mutexp) {
|
if (mutexp) {
|
||||||
#ifdef TSRM_WIN32
|
#ifdef TSRM_WIN32
|
||||||
DeleteCriticalSection(mutexp);
|
DeleteCriticalSection(mutexp);
|
||||||
free(mutexp);
|
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
#ifdef USE_MPK
|
|
||||||
kMutexFree(mutexp);
|
|
||||||
#else
|
|
||||||
NXMutexFree(mutexp);
|
NXMutexFree(mutexp);
|
||||||
#endif
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
free(mutexp);
|
free(mutexp);
|
||||||
#elif defined(PTHREADS)
|
#elif defined(PTHREADS)
|
||||||
|
@ -545,11 +513,7 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
|
||||||
EnterCriticalSection(mutexp);
|
EnterCriticalSection(mutexp);
|
||||||
return 1;
|
return 1;
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
#ifdef USE_MPK
|
|
||||||
return kMutexLock(mutexp);
|
|
||||||
#else
|
|
||||||
return NXLock(mutexp);
|
return NXLock(mutexp);
|
||||||
#endif
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
return pth_mutex_acquire(mutexp, 0, NULL);
|
return pth_mutex_acquire(mutexp, 0, NULL);
|
||||||
#elif defined(PTHREADS)
|
#elif defined(PTHREADS)
|
||||||
|
@ -576,11 +540,7 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
|
||||||
LeaveCriticalSection(mutexp);
|
LeaveCriticalSection(mutexp);
|
||||||
return 1;
|
return 1;
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
#ifdef USE_MPK
|
|
||||||
return kMutexUnlock(mutexp);
|
|
||||||
#else
|
|
||||||
return NXUnlock(mutexp);
|
return NXUnlock(mutexp);
|
||||||
#endif
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
return pth_mutex_release(mutexp);
|
return pth_mutex_release(mutexp);
|
||||||
#elif defined(PTHREADS)
|
#elif defined(PTHREADS)
|
||||||
|
|
15
TSRM/TSRM.h
15
TSRM/TSRM.h
|
@ -37,17 +37,10 @@
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
|
|
||||||
#ifdef TSRM_WIN32
|
#ifdef TSRM_WIN32
|
||||||
# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# endif
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
# include <nks/thread.h>
|
# include <nks/thread.h>
|
||||||
#ifdef USE_MPK
|
|
||||||
# include <mpklib4php.h>
|
|
||||||
#else
|
|
||||||
# include <nks/synch.h>
|
# include <nks/synch.h>
|
||||||
#endif
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
# include <pth.h>
|
# include <pth.h>
|
||||||
#elif defined(PTHREADS)
|
#elif defined(PTHREADS)
|
||||||
|
@ -67,11 +60,7 @@ typedef int ts_rsrc_id;
|
||||||
# define MUTEX_T CRITICAL_SECTION *
|
# define MUTEX_T CRITICAL_SECTION *
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
# define THREAD_T NXThreadId_t
|
# define THREAD_T NXThreadId_t
|
||||||
#ifdef USE_MPK
|
|
||||||
# define MUTEX_T MUTEX
|
|
||||||
#else
|
|
||||||
# define MUTEX_T NXMutex_t *
|
# define MUTEX_T NXMutex_t *
|
||||||
#endif
|
|
||||||
#elif defined(GNUPTH)
|
#elif defined(GNUPTH)
|
||||||
# define THREAD_T pth_t
|
# define THREAD_T pth_t
|
||||||
# define MUTEX_T pth_mutex_t *
|
# define MUTEX_T pth_mutex_t *
|
||||||
|
@ -149,8 +138,6 @@ TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread
|
||||||
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
|
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
|
||||||
|
|
||||||
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
|
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
|
||||||
#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
|
|
||||||
#define TSRMLS_SET_CTX(ctx) (void ***) ctx = tsrm_ls
|
|
||||||
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
|
||||||
#define TSRMLS_D void ***tsrm_ls
|
#define TSRMLS_D void ***tsrm_ls
|
||||||
#define TSRMLS_DC , TSRMLS_D
|
#define TSRMLS_DC , TSRMLS_D
|
||||||
|
@ -164,8 +151,6 @@ TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread
|
||||||
#else /* non ZTS */
|
#else /* non ZTS */
|
||||||
|
|
||||||
#define TSRMLS_FETCH()
|
#define TSRMLS_FETCH()
|
||||||
#define TSRMLS_FETCH_FROM_CTX(ctx)
|
|
||||||
#define TSRMLS_SET_CTX(ctx)
|
|
||||||
#define TSRMLS_D void
|
#define TSRMLS_D void
|
||||||
#define TSRMLS_DC
|
#define TSRMLS_DC
|
||||||
#define TSRMLS_C
|
#define TSRMLS_C
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#define HAVE_UTIME 1
|
#define HAVE_UTIME 1
|
||||||
|
|
||||||
/* Though we have alloca(), this seems to be causing some problem
|
/* Though we have alloca(), this seems to be causing some problem with the stack pointer -- hence not using it */
|
||||||
* with the stack pointer. Hence not using it
|
/* #define HAVE_ALLOCA 1 */
|
||||||
*/
|
|
||||||
/*#define HAVE_ALLOCA 1*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,9 +25,7 @@
|
||||||
#pragma alloca
|
#pragma alloca
|
||||||
# else
|
# else
|
||||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||||
# ifndef NETWARE
|
|
||||||
char *alloca ();
|
char *alloca ();
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
290
TSRM/tsrm_nw.c
290
TSRM/tsrm_nw.c
|
@ -4,16 +4,15 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2003 The PHP Group |
|
| Copyright (c) 1997-2003 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| This source file is subject to version 3.0 of the PHP license, |
|
| This source file is subject to version 2.02 of the PHP license, |
|
||||||
| that is bundled with this package in the file LICENSE, and is |
|
| that is bundled with this package in the file LICENSE, and is |
|
||||||
| available through the world-wide-web at the following url: |
|
| available at through the world-wide-web at |
|
||||||
| http://www.php.net/license/3_0.txt. |
|
| http://www.php.net/license/2_02.txt. |
|
||||||
| If you did not receive a copy of the PHP license and are unable to |
|
| 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 |
|
| obtain it through the world-wide-web, please send a note to |
|
||||||
| license@php.net so we can mail you a copy immediately. |
|
| license@php.net so we can mail you a copy immediately. |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
|
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
|
||||||
| Anantha Kesari H Y <hyanantha@novell.com> |
|
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,9 +39,8 @@
|
||||||
|
|
||||||
#include "mktemp.h"
|
#include "mktemp.h"
|
||||||
|
|
||||||
/* strtok() call in LibC is abending when used in a different address space
|
/* strtok() call in LibC is abending when used in a different address space -- hence using
|
||||||
* -- hence using PHP's version itself for now
|
PHP's version itself for now : Venkat (30/4/02) */
|
||||||
*/
|
|
||||||
#include "tsrm_strtok_r.h"
|
#include "tsrm_strtok_r.h"
|
||||||
#define tsrm_strtok_r(a,b,c) strtok((a),(b))
|
#define tsrm_strtok_r(a,b,c) strtok((a),(b))
|
||||||
|
|
||||||
|
@ -52,189 +50,211 @@
|
||||||
|
|
||||||
TSRM_API FILE* popen(const char *commandline, const char *type)
|
TSRM_API FILE* popen(const char *commandline, const char *type)
|
||||||
{
|
{
|
||||||
char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL;
|
char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL;
|
||||||
char *tempName = "sys:/php/temp/phpXXXXXX.tmp";
|
char *tempName = "sys:/php/temp/phpXXXXXX.tmp";
|
||||||
char *filePath = NULL;
|
char *filePath = NULL;
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0;
|
int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0;
|
||||||
FILE *stream = NULL;
|
FILE *stream = NULL;
|
||||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||||
int pipe_handle;
|
int pipe_handle;
|
||||||
int mode = O_RDONLY;
|
int mode = O_RDONLY;
|
||||||
#else
|
#else
|
||||||
NXHandle_t pipe_handle;
|
NXHandle_t pipe_handle;
|
||||||
NXMode_t mode = NX_O_RDONLY;
|
NXMode_t mode = NX_O_RDONLY;
|
||||||
#endif
|
#endif
|
||||||
NXExecEnvSpec_t envSpec;
|
NXExecEnvSpec_t envSpec;
|
||||||
NXNameSpec_t nameSpec;
|
NXNameSpec_t nameSpec;
|
||||||
NXVmId_t newVM = 0;
|
NXVmId_t newVM = 0;
|
||||||
|
|
||||||
/* Check for validity of input parameters */
|
/* Check for validity of input parameters */
|
||||||
if (!commandline || !type)
|
if (!commandline || !type)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Get temporary file name */
|
/* Get temporary file name */
|
||||||
filePath = mktemp(tempName);
|
filePath = mktemp(tempName);
|
||||||
|
/*consoleprintf ("PHP | popen: file path = %s, mode = %s\n", filePath, type);*/
|
||||||
if (!filePath)
|
if (!filePath)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Set pipe mode according to type -- for now allow only "r" or "w" */
|
/* Set pipe mode according to type -- for now allow only "r" or "w" */
|
||||||
if (strcmp(type, "r") == 0)
|
if (strcmp(type, "r") == 0)
|
||||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||||
mode = O_RDONLY;
|
mode = O_RDONLY;
|
||||||
#else
|
#else
|
||||||
mode = NX_O_RDONLY;
|
mode = NX_O_RDONLY;
|
||||||
#endif
|
#endif
|
||||||
else if (strcmp(type, "w") == 0)
|
else if (strcmp(type, "w") == 0)
|
||||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||||
mode = O_WRONLY;
|
mode = O_WRONLY;
|
||||||
#else
|
#else
|
||||||
mode = NX_O_WRONLY;
|
mode = NX_O_WRONLY;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef USE_PIPE_OPEN
|
#ifdef USE_PIPE_OPEN
|
||||||
pipe_handle = pipe_open(filePath, mode);
|
pipe_handle = pipe_open(filePath, mode);
|
||||||
if (pipe_handle == -1)
|
/*consoleprintf ("PHP | popen: pipe_open() returned %d\n", pipe_handle);*/
|
||||||
return NULL;
|
if (pipe_handle == -1)
|
||||||
|
return NULL;
|
||||||
#elif defined(USE_MKFIFO)
|
#elif defined(USE_MKFIFO)
|
||||||
pipe_handle = mkfifo(filePath, mode);
|
pipe_handle = mkfifo(filePath, mode);
|
||||||
if (pipe_handle == -1)
|
consoleprintf ("PHP | popen: mkfifo() returned %d\n", pipe_handle);
|
||||||
return NULL;
|
if (pipe_handle == -1)
|
||||||
|
return NULL;
|
||||||
#else
|
#else
|
||||||
/* - NetWare doesn't require first parameter
|
/*
|
||||||
* - Allowing LibC to choose the buffer size for now
|
- NetWare doesn't require first parameter
|
||||||
*/
|
- Allowing LibC to choose the buffer size for now
|
||||||
err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle);
|
*/
|
||||||
if (err)
|
err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle);
|
||||||
return NULL;
|
/*consoleprintf ("PHP | popen: NXFifoOpen() returned %d\n", err);*/
|
||||||
|
if (err)
|
||||||
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Copy the environment variables in preparation for the spawn call */
|
/* Copy the environment variables in preparation for the spawn call */
|
||||||
envCount = NXGetEnvCount() + 1; /* add one for NULL */
|
|
||||||
env = (char **) NXMemAlloc(sizeof(char *) * envCount, 0);
|
|
||||||
if (!env)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
err = NXCopyEnv(env, envCount);
|
envCount = NXGetEnvCount() + 1; /* add one for NULL */
|
||||||
if (err) {
|
env = (char**)NXMemAlloc(sizeof(char*) * envCount, 0);
|
||||||
NXMemFree (env);
|
if (!env)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Separate commandline string into words */
|
err = NXCopyEnv(env, envCount);
|
||||||
ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL);
|
consoleprintf ("PHP | popen: NXCopyEnv() returned %d\n", err);
|
||||||
ptrLen = strlen(ptr);
|
if (err)
|
||||||
|
{
|
||||||
|
NXMemFree (env);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
command = (char*)malloc(ptrLen + 1);
|
/* Separate commandline string into words */
|
||||||
if (!command) {
|
consoleprintf ("PHP | popen: commandline = %s\n", commandline);
|
||||||
NXMemFree (env);
|
ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL);
|
||||||
return NULL;
|
ptrLen = strlen(ptr);
|
||||||
}
|
|
||||||
|
|
||||||
strcpy (command, ptr);
|
command = (char*)malloc(ptrLen + 1);
|
||||||
|
if (!command)
|
||||||
|
{
|
||||||
|
NXMemFree (env);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
|
strcpy (command, ptr);
|
||||||
while (ptr && (argc < MAX_ARGS)) {
|
|
||||||
ptrLen = strlen(ptr);
|
|
||||||
|
|
||||||
argv[argc] = (char*)malloc(ptrLen + 1);
|
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
|
||||||
if (!argv[argc]) {
|
while (ptr && (argc < MAX_ARGS))
|
||||||
NXMemFree (env);
|
{
|
||||||
if (command)
|
ptrLen = strlen(ptr);
|
||||||
free (command);
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
argv[argc] = (char*)malloc(ptrLen + 1);
|
||||||
if (argv[i])
|
if (!argv[argc])
|
||||||
free (argv[i]);
|
{
|
||||||
}
|
NXMemFree (env);
|
||||||
|
|
||||||
return NULL;
|
if (command)
|
||||||
}
|
free (command);
|
||||||
|
|
||||||
strcpy (argv[argc], ptr);
|
for (i = 0; i < argc; i++)
|
||||||
argc++;
|
{
|
||||||
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
|
if (argv[i])
|
||||||
}
|
free (argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup the execution environment and spawn new process */
|
return NULL;
|
||||||
envSpec.esFlags = 0; /* Not used */
|
}
|
||||||
envSpec.esArgc = argc;
|
|
||||||
envSpec.esArgv = (void **) argv;
|
|
||||||
envSpec.esEnv = (void **) env;
|
|
||||||
|
|
||||||
/* envSpec.esStdin.ssType = */
|
strcpy (argv[argc], ptr);
|
||||||
envSpec.esStdout.ssType = NX_OBJ_FIFO;
|
|
||||||
envSpec.esStderr.ssType = NX_OBJ_FILE;
|
|
||||||
|
|
||||||
/* 'ssHandle' is not a struct/union/class member */
|
argc++;
|
||||||
|
|
||||||
|
ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
|
||||||
|
}
|
||||||
|
consoleprintf ("PHP | popen: commandline string parsed into tokens\n");
|
||||||
|
/* Setup the execution environment and spawn new process */
|
||||||
|
|
||||||
|
envSpec.esFlags = 0; /* Not used */
|
||||||
|
envSpec.esArgc = argc;
|
||||||
|
envSpec.esArgv = (void**)argv;
|
||||||
|
envSpec.esEnv = (void**)env;
|
||||||
|
|
||||||
|
envSpec.esStdin.ssType =
|
||||||
|
envSpec.esStdout.ssType = NX_OBJ_FIFO;
|
||||||
|
envSpec.esStderr.ssType = NX_OBJ_FILE;
|
||||||
/*
|
/*
|
||||||
envSpec.esStdin.ssHandle =
|
envSpec.esStdin.ssHandle =
|
||||||
envSpec.esStdout.ssHandle =
|
envSpec.esStdout.ssHandle =
|
||||||
envSpec.esStderr.ssHandle = -1;
|
envSpec.esStderr.ssHandle = -1;
|
||||||
*/
|
*/
|
||||||
envSpec.esStdin.ssPathCtx = NULL;
|
envSpec.esStdin.ssPathCtx =
|
||||||
envSpec.esStdout.ssPathCtx = NULL;
|
envSpec.esStdout.ssPathCtx =
|
||||||
envSpec.esStderr.ssPathCtx = NULL;
|
envSpec.esStderr.ssPathCtx = NULL;
|
||||||
|
|
||||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||||
if (mode == O_RDONLY) {
|
if (mode == O_RDONLY)
|
||||||
#else
|
#else
|
||||||
if (mode == NX_O_RDONLY) {
|
if (mode == NX_O_RDONLY)
|
||||||
#endif
|
#endif
|
||||||
envSpec.esStdin.ssPath = filePath;
|
{
|
||||||
envSpec.esStdout.ssPath = stdout;
|
envSpec.esStdin.ssPath = filePath;
|
||||||
} else { /* Write Only */
|
envSpec.esStdout.ssPath = stdout;
|
||||||
envSpec.esStdin.ssPath = stdin;
|
}
|
||||||
envSpec.esStdout.ssPath = filePath;
|
else /* Write Only */
|
||||||
}
|
{
|
||||||
|
envSpec.esStdin.ssPath = stdin;
|
||||||
|
envSpec.esStdout.ssPath = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
envSpec.esStderr.ssPath = stdout;
|
envSpec.esStderr.ssPath = stdout;
|
||||||
|
|
||||||
nameSpec.ssType = NX_OBJ_FIFO;
|
nameSpec.ssType = NX_OBJ_FIFO;
|
||||||
/* nameSpec.ssHandle = 0; */ /* 'ssHandle' is not a struct/union/class member */
|
/* nameSpec.ssHandle = 0; */ /* Not used */
|
||||||
nameSpec.ssPathCtx = NULL; /* Not used */
|
nameSpec.ssPathCtx = NULL; /* Not used */
|
||||||
nameSpec.ssPath = argv[0];
|
nameSpec.ssPath = argv[0];
|
||||||
err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM);
|
consoleprintf ("PHP | popen: environment setup\n");
|
||||||
if (!err)
|
err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM);
|
||||||
/* Get file pointer corresponding to the pipe (file) opened */
|
consoleprintf ("PHP | popen: NXVmSpawn() returned %d\n", err);
|
||||||
stream = fdopen(pipe_handle, type);
|
if (!err)
|
||||||
|
/* Get file pointer corresponding to the pipe (file) opened */
|
||||||
|
stream = fdopen(pipe_handle, type);
|
||||||
|
|
||||||
/* Clean-up */
|
/* Clean-up */
|
||||||
if (env)
|
|
||||||
NXMemFree (env);
|
|
||||||
|
|
||||||
if (pipe_handle)
|
if (env)
|
||||||
|
NXMemFree (env);
|
||||||
|
|
||||||
|
if (pipe_handle)
|
||||||
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
|
||||||
close(pipe_handle);
|
close(pipe_handle);
|
||||||
#else
|
#else
|
||||||
NXClose(pipe_handle);
|
NXClose(pipe_handle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (command)
|
if (command)
|
||||||
free (command);
|
free (command);
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++)
|
||||||
if (argv[i])
|
{
|
||||||
free (argv[i]);
|
if (argv[i])
|
||||||
}
|
free (argv[i]);
|
||||||
|
}
|
||||||
return stream;
|
consoleprintf ("PHP | popen: all clean-up done, returning...\n");
|
||||||
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSRM_API int pclose(FILE* stream)
|
TSRM_API int pclose(FILE* stream)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
NXHandle_t fd = 0;
|
NXHandle_t fd = 0;
|
||||||
|
|
||||||
/* Get the process associated with this pipe (file) handle and terminate it */
|
/* Get the process associated with this pipe (file) handle and terminate it */
|
||||||
fd = fileno(stream);
|
fd = fileno(stream);
|
||||||
NXClose (fd);
|
NXClose (fd);
|
||||||
|
|
||||||
err = fclose(stream);
|
err = fclose(stream);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NETWARE */
|
#endif
|
||||||
|
|
|
@ -4,16 +4,15 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2003 The PHP Group |
|
| Copyright (c) 1997-2003 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| This source file is subject to version 3.0 of the PHP license, |
|
| This source file is subject to version 2.02 of the PHP license, |
|
||||||
| that is bundled with this package in the file LICENSE, and is |
|
| that is bundled with this package in the file LICENSE, and is |
|
||||||
| available through the world-wide-web at the following url: |
|
| available at through the world-wide-web at |
|
||||||
| http://www.php.net/license/3_0.txt. |
|
| http://www.php.net/license/2_02.txt. |
|
||||||
| If you did not receive a copy of the PHP license and are unable to |
|
| 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 |
|
| obtain it through the world-wide-web, please send a note to |
|
||||||
| license@php.net so we can mail you a copy immediately. |
|
| license@php.net so we can mail you a copy immediately. |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
|
| Authors: Venkat Raghavan S <rvenkat@novell.com> |
|
||||||
| Anantha Kesari H Y <hyanantha@novell.com> |
|
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2003 The PHP Group |
|
| Copyright (c) 1997-2003 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| This source file is subject to version 3.0 of the PHP license, |
|
| This source file is subject to version 2.02 of the PHP license, |
|
||||||
| that is bundled with this package in the file LICENSE, and is |
|
| that is bundled with this package in the file LICENSE, and is |
|
||||||
| available through the world-wide-web at the following url: |
|
| available at through the world-wide-web at |
|
||||||
| http://www.php.net/license/3_0.txt. |
|
| http://www.php.net/license/2_02.txt. |
|
||||||
| If you did not receive a copy of the PHP license and are unable to |
|
| 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 |
|
| obtain it through the world-wide-web, please send a note to |
|
||||||
| license@php.net so we can mail you a copy immediately. |
|
| license@php.net so we can mail you a copy immediately. |
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
#include "TSRM.h"
|
#include "TSRM.h"
|
||||||
|
|
||||||
/* Only need mutex for popen() in Windows and NetWare because it doesn't chdir() on UNIX */
|
/* Only need mutex for popen() in Windows and NetWare, because it doesn't chdir() on UNIX */
|
||||||
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
|
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
|
||||||
MUTEX_T cwd_mutex;
|
MUTEX_T cwd_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
@ -210,7 +210,7 @@ CWD_API void virtual_cwd_startup(void)
|
||||||
cwd_globals_ctor(&cwd_globals TSRMLS_CC);
|
cwd_globals_ctor(&cwd_globals TSRMLS_CC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
|
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||||
cwd_mutex = tsrm_mutex_alloc();
|
cwd_mutex = tsrm_mutex_alloc();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ CWD_API void virtual_cwd_shutdown(void)
|
||||||
#ifndef ZTS
|
#ifndef ZTS
|
||||||
cwd_globals_dtor(&cwd_globals TSRMLS_CC);
|
cwd_globals_dtor(&cwd_globals TSRMLS_CC);
|
||||||
#endif
|
#endif
|
||||||
#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS)
|
#if defined(TSRM_WIN32) && defined(ZTS)
|
||||||
tsrm_mutex_free(cwd_mutex);
|
tsrm_mutex_free(cwd_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -343,6 +343,9 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||||
copy_amount = COPY_WHEN_ABSOLUTE(path_copy);
|
copy_amount = COPY_WHEN_ABSOLUTE(path_copy);
|
||||||
is_absolute = 1;
|
is_absolute = 1;
|
||||||
#ifdef TSRM_WIN32
|
#ifdef TSRM_WIN32
|
||||||
|
} else if (IS_UNC_PATH(path_copy, path_length)) {
|
||||||
|
copy_amount = 2;
|
||||||
|
is_absolute = 1;
|
||||||
} else if (IS_SLASH(path_copy[0])) {
|
} else if (IS_SLASH(path_copy[0])) {
|
||||||
copy_amount = 2;
|
copy_amount = 2;
|
||||||
#endif
|
#endif
|
||||||
|
@ -483,23 +486,19 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
|
||||||
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
|
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
|
||||||
{
|
{
|
||||||
cwd_state new_state;
|
cwd_state new_state;
|
||||||
char *retval;
|
int retval;
|
||||||
|
|
||||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||||
|
retval = virtual_file_ex(&new_state, path, NULL, 1);
|
||||||
|
|
||||||
if (virtual_file_ex(&new_state, path, NULL, 1)==0) {
|
if (!retval) {
|
||||||
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
|
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
|
||||||
|
|
||||||
memcpy(real_path, new_state.cwd, len);
|
memcpy(real_path, new_state.cwd, len);
|
||||||
real_path[len] = '\0';
|
real_path[len] = '\0';
|
||||||
retval = real_path;
|
return real_path;
|
||||||
} else {
|
|
||||||
retval = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CWD_STATE_FREE(&new_state);
|
return NULL;
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
|
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
|
||||||
|
@ -539,6 +538,7 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC)
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(TSRM_WIN32)
|
||||||
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC)
|
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC)
|
||||||
{
|
{
|
||||||
cwd_state new_state;
|
cwd_state new_state;
|
||||||
|
@ -547,16 +547,13 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC)
|
||||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||||
virtual_file_ex(&new_state, pathname, NULL, 1);
|
virtual_file_ex(&new_state, pathname, NULL, 1);
|
||||||
|
|
||||||
#if defined(TSRM_WIN32)
|
|
||||||
ret = tsrm_win32_access(new_state.cwd, mode);
|
|
||||||
#else
|
|
||||||
ret = access(new_state.cwd, mode);
|
ret = access(new_state.cwd, mode);
|
||||||
#endif
|
|
||||||
|
|
||||||
CWD_STATE_FREE(&new_state);
|
CWD_STATE_FREE(&new_state);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_UTIME
|
#if HAVE_UTIME
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2003 The PHP Group |
|
| Copyright (c) 1997-2003 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| This source file is subject to version 3.0 of the PHP license, |
|
| This source file is subject to version 2.02 of the PHP license, |
|
||||||
| that is bundled with this package in the file LICENSE, and is |
|
| that is bundled with this package in the file LICENSE, and is |
|
||||||
| available through the world-wide-web at the following url: |
|
| available at through the world-wide-web at |
|
||||||
| http://www.php.net/license/3_0.txt. |
|
| http://www.php.net/license/2_02.txt. |
|
||||||
| If you did not receive a copy of the PHP license and are unable to |
|
| 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 |
|
| obtain it through the world-wide-web, please send a note to |
|
||||||
| license@php.net so we can mail you a copy immediately. |
|
| license@php.net so we can mail you a copy immediately. |
|
||||||
|
@ -53,13 +53,14 @@ typedef unsigned short mode_t;
|
||||||
#define IS_SLASH_P(c) (*(c) == '/' || \
|
#define IS_SLASH_P(c) (*(c) == '/' || \
|
||||||
(*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
|
(*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
|
||||||
|
|
||||||
/* COPY_WHEN_ABSOLUTE is 2 under Win32 because by chance both regular absolute paths
|
/* COPY_WHEN_ABSOLUTE also takes path as argument because netware needs it
|
||||||
in the file system and UNC paths need copying of two characters */
|
* to account for volume name that is unique to NetWare absolute paths
|
||||||
|
*/
|
||||||
#define COPY_WHEN_ABSOLUTE(path) 2
|
#define COPY_WHEN_ABSOLUTE(path) 2
|
||||||
|
#define IS_ABSOLUTE_PATH(path, len) \
|
||||||
|
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || (IS_SLASH(path[0]) && IS_SLASH(path[1]))))
|
||||||
#define IS_UNC_PATH(path, len) \
|
#define IS_UNC_PATH(path, len) \
|
||||||
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
|
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
|
||||||
#define IS_ABSOLUTE_PATH(path, len) \
|
|
||||||
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len)))
|
|
||||||
|
|
||||||
#elif defined(NETWARE)
|
#elif defined(NETWARE)
|
||||||
#ifdef HAVE_DIRENT_H
|
#ifdef HAVE_DIRENT_H
|
||||||
|
@ -69,7 +70,6 @@ typedef unsigned short mode_t;
|
||||||
#define DEFAULT_SLASH '/'
|
#define DEFAULT_SLASH '/'
|
||||||
#define DEFAULT_DIR_SEPARATOR ';'
|
#define DEFAULT_DIR_SEPARATOR ';'
|
||||||
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||||
#define IS_SLASH_P(c) IS_SLASH(*(c))
|
|
||||||
#define COPY_WHEN_ABSOLUTE(path) \
|
#define COPY_WHEN_ABSOLUTE(path) \
|
||||||
(strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */
|
(strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */
|
||||||
#define IS_ABSOLUTE_PATH(path, len) \
|
#define IS_ABSOLUTE_PATH(path, len) \
|
||||||
|
@ -150,21 +150,9 @@ 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 int virtual_rmdir(const char *pathname TSRMLS_DC);
|
||||||
CWD_API DIR *virtual_opendir(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);
|
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
|
||||||
|
|
||||||
|
#if !defined(TSRM_WIN32)
|
||||||
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
|
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
|
||||||
#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
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_UTIME
|
#if HAVE_UTIME
|
||||||
|
@ -241,11 +229,7 @@ typedef struct _virtual_cwd_globals {
|
||||||
#define VCWD_RMDIR(pathname) rmdir(pathname)
|
#define VCWD_RMDIR(pathname) rmdir(pathname)
|
||||||
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
||||||
#define VCWD_POPEN(command, type) popen(command, type)
|
#define VCWD_POPEN(command, type) popen(command, type)
|
||||||
#if defined(TSRM_WIN32)
|
|
||||||
#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode)
|
|
||||||
#else
|
|
||||||
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
|
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_REALPATH
|
#ifdef HAVE_REALPATH
|
||||||
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
|
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2003 The PHP Group |
|
| Copyright (c) 1997-2003 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| This source file is subject to version 3.0 of the PHP license, |
|
| This source file is subject to version 2.02 of the PHP license, |
|
||||||
| that is bundled with this package in the file LICENSE, and is |
|
| that is bundled with this package in the file LICENSE, and is |
|
||||||
| available through the world-wide-web at the following url: |
|
| available at through the world-wide-web at |
|
||||||
| http://www.php.net/license/3_0.txt. |
|
| http://www.php.net/license/2_02.txt. |
|
||||||
| If you did not receive a copy of the PHP license and are unable to |
|
| 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 |
|
| obtain it through the world-wide-web, please send a note to |
|
||||||
| license@php.net so we can mail you a copy immediately. |
|
| license@php.net so we can mail you a copy immediately. |
|
||||||
|
@ -24,8 +24,6 @@
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define TSRM_INCLUDE_FULL_WINDOWS_HEADERS
|
|
||||||
|
|
||||||
#include "TSRM.h"
|
#include "TSRM.h"
|
||||||
|
|
||||||
#ifdef TSRM_WIN32
|
#ifdef TSRM_WIN32
|
||||||
|
@ -83,19 +81,6 @@ TSRM_API void tsrm_win32_shutdown(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode)
|
|
||||||
{
|
|
||||||
SHFILEINFO sfi;
|
|
||||||
|
|
||||||
if (mode == 1 /*X_OK*/) {
|
|
||||||
return access(pathname, 0) == 0 &&
|
|
||||||
SHGetFileInfo(pathname, 0, &sfi, sizeof(SHFILEINFO), SHGFI_EXETYPE) != 0 ? 0 : -1;
|
|
||||||
} else {
|
|
||||||
return access(pathname, mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static process_pair *process_get(FILE *stream TSRMLS_DC)
|
static process_pair *process_get(FILE *stream TSRMLS_DC)
|
||||||
{
|
{
|
||||||
process_pair *ptr;
|
process_pair *ptr;
|
||||||
|
@ -374,4 +359,4 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -4,10 +4,10 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2003 The PHP Group |
|
| Copyright (c) 1997-2003 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| This source file is subject to version 3.0 of the PHP license, |
|
| This source file is subject to version 2.02 of the PHP license, |
|
||||||
| that is bundled with this package in the file LICENSE, and is |
|
| that is bundled with this package in the file LICENSE, and is |
|
||||||
| available through the world-wide-web at the following url: |
|
| available at through the world-wide-web at |
|
||||||
| http://www.php.net/license/3_0.txt. |
|
| http://www.php.net/license/2_02.txt. |
|
||||||
| If you did not receive a copy of the PHP license and are unable to |
|
| 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 |
|
| obtain it through the world-wide-web, please send a note to |
|
||||||
| license@php.net so we can mail you a copy immediately. |
|
| license@php.net so we can mail you a copy immediately. |
|
||||||
|
@ -95,11 +95,10 @@ TSRM_API void tsrm_win32_shutdown(void);
|
||||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
|
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
|
||||||
TSRM_API FILE *popen(const char *command, const char *type);
|
TSRM_API FILE *popen(const char *command, const char *type);
|
||||||
TSRM_API int pclose(FILE *stream);
|
TSRM_API int pclose(FILE *stream);
|
||||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
|
|
||||||
|
|
||||||
TSRM_API int shmget(int key, int size, int flags);
|
TSRM_API int shmget(int key, int size, int flags);
|
||||||
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
|
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
|
||||||
TSRM_API int shmdt(const void *shmaddr);
|
TSRM_API int shmdt(const void *shmaddr);
|
||||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
|
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue