diff options
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/TSRM.c | 206 | ||||
-rw-r--r-- | TSRM/TSRM.h | 66 | ||||
-rw-r--r-- | TSRM/tsrm.m4 | 74 | ||||
-rw-r--r-- | TSRM/tsrm_win32.c | 12 | ||||
-rw-r--r-- | TSRM/tsrm_win32.h | 10 |
5 files changed, 80 insertions, 288 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index 1a8d5192ff..cd340035a2 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -17,11 +17,11 @@ #include <stdio.h> #include <stdarg.h> -#ifdef ZEND_DEBUG +#if ZEND_DEBUG # include <assert.h> -# define TSRM_ASSERT assert +# define TSRM_ASSERT(c) assert(c) #else -# define TSRM_ASSERT +# define TSRM_ASSERT(c) #endif typedef struct _tsrm_tls_entry tsrm_tls_entry; @@ -74,7 +74,7 @@ int tsrm_error(int level, const char *format, ...); static int tsrm_error_level; static FILE *tsrm_error_file; -#if TSRM_DEBUG +#ifdef TSRM_DEBUG #define TSRM_ERROR(args) tsrm_error args #define TSRM_SAFE_RETURN_RSRC(array, offset, range) \ { \ @@ -102,49 +102,26 @@ static FILE *tsrm_error_file; } #endif -#if defined(GNUPTH) -static pth_key_t tls_key; -# define tsrm_tls_set(what) pth_key_setdata(tls_key, (void*)(what)) -# define tsrm_tls_get() pth_key_getdata(tls_key) - -#elif defined(PTHREADS) -/* Thread local storage */ -static pthread_key_t tls_key; -# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what)) -# define tsrm_tls_get() pthread_getspecific(tls_key) - -#elif defined(TSRM_ST) -static int tls_key; -# define tsrm_tls_set(what) st_thread_setspecific(tls_key, (void*)(what)) -# define tsrm_tls_get() st_thread_getspecific(tls_key) - -#elif defined(TSRM_WIN32) +#ifdef TSRM_WIN32 static DWORD tls_key; # define tsrm_tls_set(what) TlsSetValue(tls_key, (void*)(what)) # define tsrm_tls_get() TlsGetValue(tls_key) - #else -# define tsrm_tls_set(what) -# define tsrm_tls_get() NULL -# warning tsrm_set_interpreter_context is probably broken on this platform +static pthread_key_t tls_key; +# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what)) +# define tsrm_tls_get() pthread_getspecific(tls_key) #endif TSRM_TLS uint8_t in_main_thread = 0; TSRM_TLS uint8_t is_thread_shutdown = 0; /* Startup TSRM (call once for the entire process) */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename) +TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, const char *debug_filename) {/*{{{*/ -#if defined(GNUPTH) - pth_init(); - pth_key_create(&tls_key, 0); -#elif defined(PTHREADS) - pthread_key_create( &tls_key, 0 ); -#elif defined(TSRM_ST) - st_init(); - st_key_create(&tls_key, 0); -#elif defined(TSRM_WIN32) +#ifdef TSRM_WIN32 tls_key = TlsAlloc(); +#else + pthread_key_create(&tls_key, 0); #endif /* ensure singleton */ @@ -232,13 +209,11 @@ TSRM_API void tsrm_shutdown(void) if (tsrm_error_file!=stderr) { fclose(tsrm_error_file); } -#if defined(GNUPTH) - pth_kill(); -#elif defined(PTHREADS) +#ifdef TSRM_WIN32 + TlsFree(tls_key); +#else pthread_setspecific(tls_key, 0); pthread_key_delete(tls_key); -#elif defined(TSRM_WIN32) - TlsFree(tls_key); #endif if (tsrm_shutdown_handler) { tsrm_shutdown_handler(); @@ -253,11 +228,11 @@ TSRM_API void tsrm_shutdown(void) /* {{{ */ /* environ lock api */ -TSRM_API void tsrm_env_lock() { +TSRM_API void tsrm_env_lock(void) { tsrm_mutex_lock(tsrm_env_mutex); } -TSRM_API void tsrm_env_unlock() { +TSRM_API void tsrm_env_unlock(void) { tsrm_mutex_unlock(tsrm_env_mutex); } /* }}} */ @@ -494,67 +469,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id) TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count); }/*}}}*/ -/* frees an interpreter context. You are responsible for making sure that - * it is not linked into the TSRM hash, and not marked as the current interpreter */ -void tsrm_free_interpreter_context(void *context) -{/*{{{*/ - tsrm_tls_entry *next, *thread_resources = (tsrm_tls_entry*)context; - int i; - - while (thread_resources) { - next = thread_resources->next; - - for (i=0; i<thread_resources->count; i++) { - if (resource_types_table[i].dtor) { - resource_types_table[i].dtor(thread_resources->storage[i]); - } - } - for (i=0; i<thread_resources->count; i++) { - if (!resource_types_table[i].fast_offset) { - free(thread_resources->storage[i]); - } - } - free(thread_resources->storage); - free(thread_resources); - thread_resources = next; - } -}/*}}}*/ - -void *tsrm_set_interpreter_context(void *new_ctx) -{/*{{{*/ - tsrm_tls_entry *current; - - current = tsrm_tls_get(); - - /* TODO: unlink current from the global linked list, and replace it - * it with the new context, protected by mutex where/if appropriate */ - - /* Set thread local storage to this new thread resources structure */ - tsrm_tls_set(new_ctx); - - /* return old context, so caller can restore it when they're done */ - return current; -}/*}}}*/ - - -/* allocates a new interpreter context */ -void *tsrm_new_interpreter_context(void) -{/*{{{*/ - tsrm_tls_entry *new_ctx, *current; - THREAD_T thread_id; - - thread_id = tsrm_thread_id(); - tsrm_mutex_lock(tsmm_mutex); - - current = tsrm_tls_get(); - - allocate_new_resource(&new_ctx, thread_id); - - /* switch back to the context that was in use prior to our creation - * of the new one */ - return tsrm_set_interpreter_context(current); -}/*}}}*/ - /* frees all resources allocated for the current thread */ void ts_free_thread(void) @@ -637,8 +551,6 @@ void ts_free_id(ts_rsrc_id id) }/*}}}*/ - - /* * Utility Functions */ @@ -648,12 +560,8 @@ TSRM_API THREAD_T tsrm_thread_id(void) {/*{{{*/ #ifdef TSRM_WIN32 return GetCurrentThreadId(); -#elif defined(GNUPTH) - return pth_self(); -#elif defined(PTHREADS) +#else return pthread_self(); -#elif defined(TSRM_ST) - return st_thread_self(); #endif }/*}}}*/ @@ -665,14 +573,9 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void) #ifdef TSRM_WIN32 mutexp = malloc(sizeof(CRITICAL_SECTION)); InitializeCriticalSection(mutexp); -#elif defined(GNUPTH) - mutexp = (MUTEX_T) malloc(sizeof(*mutexp)); - pth_mutex_init(mutexp); -#elif defined(PTHREADS) +#else mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); pthread_mutex_init(mutexp,NULL); -#elif defined(TSRM_ST) - mutexp = st_mutex_new(); #endif #ifdef THR_DEBUG printf("Mutex created thread: %d\n",mythreadid()); @@ -688,13 +591,9 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp) #ifdef TSRM_WIN32 DeleteCriticalSection(mutexp); free(mutexp); -#elif defined(GNUPTH) - free(mutexp); -#elif defined(PTHREADS) +#else pthread_mutex_destroy(mutexp); free(mutexp); -#elif defined(TSRM_ST) - st_mutex_destroy(mutexp); #endif } #ifdef THR_DEBUG @@ -713,15 +612,8 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp) #ifdef TSRM_WIN32 EnterCriticalSection(mutexp); return 0; -#elif defined(GNUPTH) - if (pth_mutex_acquire(mutexp, 0, NULL)) { - return 0; - } - return -1; -#elif defined(PTHREADS) +#else return pthread_mutex_lock(mutexp); -#elif defined(TSRM_ST) - return st_mutex_lock(mutexp); #endif }/*}}}*/ @@ -736,15 +628,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp) #ifdef TSRM_WIN32 LeaveCriticalSection(mutexp); return 0; -#elif defined(GNUPTH) - if (pth_mutex_release(mutexp)) { - return 0; - } - return -1; -#elif defined(PTHREADS) +#else return pthread_mutex_unlock(mutexp); -#elif defined(TSRM_ST) - return st_mutex_unlock(mutexp); #endif }/*}}}*/ @@ -755,12 +640,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp) TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset) {/*{{{*/ TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Changed sigmask in thread: %ld", tsrm_thread_id())); - /* TODO: add support for other APIs */ -#ifdef PTHREADS - return pthread_sigmask(how, set, oldset); -#else - return sigprocmask(how, set, oldset); -#endif + + return pthread_sigmask(how, set, oldset); }/*}}}*/ #endif @@ -796,7 +677,7 @@ TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler) * Debug support */ -#if TSRM_DEBUG +#ifdef TSRM_DEBUG int tsrm_error(int level, const char *format, ...) {/*{{{*/ if (level<=tsrm_error_level) { @@ -817,11 +698,11 @@ int tsrm_error(int level, const char *format, ...) #endif -void tsrm_error_set(int level, char *debug_filename) +void tsrm_error_set(int level, const char *debug_filename) {/*{{{*/ tsrm_error_level = level; -#if TSRM_DEBUG +#ifdef TSRM_DEBUG if (tsrm_error_file!=stderr) { /* close files opened earlier */ fclose(tsrm_error_file); } @@ -842,6 +723,29 @@ TSRM_API void *tsrm_get_ls_cache(void) return tsrm_tls_get(); }/*}}}*/ +/* Returns offset of tsrm_ls_cache slot from Thread Control Block address */ +TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void) +{/*{{{*/ +#if defined(__APPLE__) && defined(__x86_64__) + // TODO: Implement support for fast JIT ZTS code ??? + return 0; +#elif defined(__x86_64__) && defined(__GNUC__) + size_t ret; + + asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0" + : "=r" (ret)); + return ret; +#elif defined(__i386__) && defined(__GNUC__) + size_t ret; + + asm ("leal _tsrm_ls_cache@ntpoff,%0" + : "=r" (ret)); + return ret; +#else + return 0; +#endif +}/*}}}*/ + TSRM_API uint8_t tsrm_is_main_thread(void) {/*{{{*/ return in_main_thread; @@ -854,16 +758,10 @@ TSRM_API uint8_t tsrm_is_shutdown(void) TSRM_API const char *tsrm_api_name(void) {/*{{{*/ -#if defined(GNUPTH) - return "GNU Pth"; -#elif defined(PTHREADS) - return "POSIX Threads"; -#elif defined(TSRM_ST) - return "State Threads"; -#elif defined(TSRM_WIN32) +#ifdef TSRM_WIN32 return "Windows Threads"; #else - return "Unknown"; + return "POSIX Threads"; #endif }/*}}}*/ diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index d710eb6f75..6978b49732 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -44,14 +44,8 @@ typedef uintptr_t tsrm_uintptr_t; # ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS # define WIN32_LEAN_AND_MEAN # endif -# include <windows.h> -# include <shellapi.h> -#elif defined(GNUPTH) -# include <pth.h> -#elif defined(PTHREADS) +#else # include <pthread.h> -#elif defined(TSRM_ST) -# include <st.h> #endif #if SIZEOF_SIZE_T == 4 @@ -68,15 +62,9 @@ typedef int ts_rsrc_id; #ifdef TSRM_WIN32 # define THREAD_T DWORD # define MUTEX_T CRITICAL_SECTION * -#elif defined(GNUPTH) -# define THREAD_T pth_t -# define MUTEX_T pth_mutex_t * -#elif defined(PTHREADS) +#else # define THREAD_T pthread_t # define MUTEX_T pthread_mutex_t * -#elif defined(TSRM_ST) -# define THREAD_T st_thread_t -# define MUTEX_T st_mutex_t #endif #include <signal.h> @@ -91,12 +79,12 @@ extern "C" { #endif /* startup/shutdown */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename); +TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, const char *debug_filename); TSRM_API void tsrm_shutdown(void); /* environ lock API */ -TSRM_API void tsrm_env_lock(); -TSRM_API void tsrm_env_unlock(); +TSRM_API void tsrm_env_lock(void); +TSRM_API void tsrm_env_unlock(void); /* allocates a new thread-safe-resource id */ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor); @@ -127,7 +115,7 @@ typedef void (*tsrm_shutdown_func_t)(void); TSRM_API int tsrm_error(int level, const char *format, ...); -TSRM_API void tsrm_error_set(int level, char *debug_filename); +TSRM_API void tsrm_error_set(int level, const char *debug_filename); /* utility functions */ TSRM_API THREAD_T tsrm_thread_id(void); @@ -143,13 +131,8 @@ TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_th TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler); TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler); -/* these 3 APIs should only be used by people that fully understand the threading model - * used by PHP/Zend and the selected SAPI. */ -TSRM_API void *tsrm_new_interpreter_context(void); -TSRM_API void *tsrm_set_interpreter_context(void *new_ctx); -TSRM_API void tsrm_free_interpreter_context(void *context); - TSRM_API void *tsrm_get_ls_cache(void); +TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void); TSRM_API uint8_t tsrm_is_main_thread(void); TSRM_API uint8_t tsrm_is_shutdown(void); TSRM_API const char *tsrm_api_name(void); @@ -160,11 +143,21 @@ TSRM_API const char *tsrm_api_name(void); # define TSRM_TLS __thread #endif +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + +#if !__has_attribute(tls_model) +# define TSRM_TLS_MODEL_ATTR +#elif __PIC__ +# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec"))) +#else +# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("local-exec"))) +#endif + #define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1) #define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1) -#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx -#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache() #define TSRMG(id, type, element) (TSRMG_BULK(id, type)->element) #define TSRMG_BULK(id, type) ((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)]) #define TSRMG_FAST(offset, type, element) (TSRMG_FAST_BULK(offset, type)->element) @@ -174,18 +167,11 @@ TSRM_API const char *tsrm_api_name(void); #define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)]) #define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element) #define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset))) -#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE; -#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL; +#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR; +#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL; #define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache() #define TSRMLS_CACHE _tsrm_ls_cache -/* BC only */ -#define TSRMLS_D void -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC -#define TSRMLS_FETCH() - #ifdef __cplusplus } #endif @@ -195,10 +181,6 @@ TSRM_API const char *tsrm_api_name(void); #define tsrm_env_lock() #define tsrm_env_unlock() -#define TSRMLS_FETCH() -#define TSRMLS_FETCH_FROM_CTX(ctx) -#define TSRMLS_SET_CTX(ctx) - #define TSRMG_STATIC(id, type, element) #define TSRMLS_CACHE_EXTERN() #define TSRMLS_CACHE_DEFINE() @@ -207,12 +189,6 @@ TSRM_API const char *tsrm_api_name(void); #define TSRM_TLS -/* BC only */ -#define TSRMLS_D void -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC - #endif /* ZTS */ #endif /* TSRM_H */ diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4 index 0330d7a7da..9f5c8001d8 100644 --- a/TSRM/tsrm.m4 +++ b/TSRM/tsrm.m4 @@ -1,44 +1,6 @@ dnl This file contains TSRM specific autoconf macros. dnl -dnl TSRM_CHECK_PTH -dnl -AC_DEFUN([TSRM_CHECK_PTH],[ -AC_MSG_CHECKING(for GNU Pth) -PTH_PREFIX="`$1 --prefix`" -if test -z "$PTH_PREFIX"; then - AC_MSG_RESULT(Please check your Pth installation) -fi - -CPPFLAGS="$CPPFLAGS `$1 --cflags`" -LDFLAGS="$LDFLAGS `$1 --ldflags`" -LIBS="$LIBS `$1 --libs`" - -AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth]) -AC_MSG_RESULT(yes - installed in $PTH_PREFIX) -]) - -dnl -dnl TSRM_CHECK_ST -dnl -AC_DEFUN([TSRM_CHECK_ST],[ - if test -r "$1/include/st.h"; then - CPPFLAGS="$CPPFLAGS -I$1/include" - LDFLAGS="$LDFLAGS -L$1/lib" - elif test -r "$1/st.h"; then - CPPFLAGS="$CPPFLAGS -I$1" - LDFLAGS="$LDFLAGS -L$1" - fi - AC_CHECK_HEADERS(st.h,[],[ - AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix]) - ]) - LIBS="$LIBS -lst" - AC_MSG_CHECKING(for SGI's State Threads) - AC_MSG_RESULT(yes) - AC_DEFINE(TSRM_ST, 1, [ ]) -]) - -dnl dnl TSRM_CHECK_PTHREADS dnl AC_DEFUN([TSRM_CHECK_PTHREADS],[ @@ -53,39 +15,3 @@ AC_DEFINE(PTHREADS, 1, Whether to use Pthreads) AC_MSG_CHECKING(for POSIX threads) AC_MSG_RESULT(yes) ]) - -dnl -dnl TSRM_THREADS_CHECKS -dnl -dnl For the thread implementations, we always use --with-* to maintain -dnl consistency. -dnl -AC_DEFUN([TSRM_THREADS_CHECKS],[ -AC_ARG_WITH([tsrm-pth], - [AS_HELP_STRING([[--with-tsrm-pth[=pth-config]]], - [Use GNU Pth])], - [TSRM_PTH=$withval], - [TSRM_PTH=no]) - -AC_ARG_WITH([tsrm-st], - [AS_HELP_STRING([--with-tsrm-st], - [Use SGI's State Threads])], - [TSRM_ST=$withval], - [TSRM_ST=no]) - -AC_ARG_WITH([tsrm-pthreads], - [AS_HELP_STRING([--with-tsrm-pthreads], - [Use POSIX threads (default)])], - [TSRM_PTHREADS=$withval], - [TSRM_PTHREADS=yes]) - -test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config - -if test "$TSRM_PTH" != "no"; then - TSRM_CHECK_PTH($TSRM_PTH) -elif test "$TSRM_ST" != "no"; then - TSRM_CHECK_ST($TSRM_ST) -elif test "$TSRM_PTHREADS" != "no"; then - TSRM_CHECK_PTHREADS -fi -]) diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 75240282f6..23cb31c2fe 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -105,7 +103,7 @@ TSRM_API void tsrm_win32_shutdown(void) #endif }/*}}}*/ -char * tsrm_win32_get_path_sid_key(const char *pathname, size_t pathname_len, size_t *key_len) +const char * tsrm_win32_get_path_sid_key(const char *pathname, size_t pathname_len, size_t *key_len) {/*{{{*/ PSID pSid = TWG(impersonation_token_sid); char *ptcSid = NULL; @@ -445,7 +443,7 @@ TSRM_API FILE *popen(const char *command, const char *type) return popen_ex(command, type, NULL, NULL); }/*}}}*/ -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, const char *env) {/*{{{*/ FILE *stream = NULL; int fno, type_len, read, mode; @@ -480,12 +478,12 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, return NULL; } - cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2); + cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /s /c ")+2); if (!cmd) { return NULL; } - sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command); + sprintf(cmd, "%s /s /c \"%s\"", TWG(comspec), command); cmdw = php_win32_cp_any_to_w(cmd); if (!cmdw) { free(cmd); @@ -771,7 +769,6 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) } }/*}}}*/ -#if HAVE_UTIME static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */ { // Note that LONGLONG is a 64-bit value @@ -826,4 +823,3 @@ TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ } /* }}} */ #endif -#endif diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h index 1ae9beaf2c..0f5c003abd 100644 --- a/TSRM/tsrm_win32.h +++ b/TSRM/tsrm_win32.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -21,9 +19,7 @@ #include "TSRM.h" #include <windows.h> -#if HAVE_UTIME -# include <sys/utime.h> -#endif +#include <sys/utime.h> #include "win32/ipc.h" struct ipc_perm { @@ -93,12 +89,12 @@ TSRMLS_CACHE_EXTERN() #define SHM_RND FILE_MAP_WRITE #define SHM_REMAP FILE_MAP_COPY -char * tsrm_win32_get_path_sid_key(const char *pathname, size_t pathname_len, size_t *key_len); +const char * tsrm_win32_get_path_sid_key(const char *pathname, size_t pathname_len, size_t *key_len); TSRM_API void tsrm_win32_startup(void); 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, const char *env); TSRM_API FILE *popen(const char *command, const char *type); TSRM_API int pclose(FILE *stream); TSRM_API int tsrm_win32_access(const char *pathname, int mode); |