summaryrefslogtreecommitdiff
path: root/TSRM/tsrm_win32.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-07-04 17:06:52 +0200
committerAnatol Belski <ab@php.net>2017-07-04 17:06:52 +0200
commit6a3a2bf18eceba346aa0857c9bfba0c5525fdb3b (patch)
tree3be6e6e65404aa5bf1bf017a5646d2bc723fd21d /TSRM/tsrm_win32.c
parenta0203ea14318c0009efcf99d9735ada783a02d14 (diff)
downloadphp-git-6a3a2bf18eceba346aa0857c9bfba0c5525fdb3b.tar.gz
vim folds and mode lines yet
Diffstat (limited to 'TSRM/tsrm_win32.c')
-rw-r--r--TSRM/tsrm_win32.c83
1 files changed, 47 insertions, 36 deletions
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index b9a4ec9814..039fef7cc2 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -42,7 +42,7 @@ static tsrm_win32_globals win32_globals;
#endif
static void tsrm_win32_ctor(tsrm_win32_globals *globals)
-{
+{/*{{{*/
#ifdef ZTS
TSRMLS_CACHE_UPDATE();
#endif
@@ -61,10 +61,10 @@ TSRMLS_CACHE_UPDATE();
*/
globals->impersonation_token = INVALID_HANDLE_VALUE;
globals->impersonation_token_sid = NULL;
-}
+}/*}}}*/
static void tsrm_win32_dtor(tsrm_win32_globals *globals)
-{
+{/*{{{*/
shm_pair *ptr;
if (globals->process) {
@@ -89,26 +89,26 @@ static void tsrm_win32_dtor(tsrm_win32_globals *globals)
if (globals->impersonation_token_sid) {
free(globals->impersonation_token_sid);
}
-}
+}/*}}}*/
TSRM_API void tsrm_win32_startup(void)
-{
+{/*{{{*/
#ifdef ZTS
ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
#else
tsrm_win32_ctor(&win32_globals);
#endif
-}
+}/*}}}*/
TSRM_API void tsrm_win32_shutdown(void)
-{
+{/*{{{*/
#ifndef ZTS
tsrm_win32_dtor(&win32_globals);
#endif
-}
+}/*}}}*/
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;
char *bucket_key = NULL;
@@ -139,11 +139,11 @@ char * tsrm_win32_get_path_sid_key(const char *pathname, size_t pathname_len, si
LocalFree(ptcSid);
return bucket_key;
-}
+}/*}}}*/
PSID tsrm_win32_get_token_sid(HANDLE hToken)
-{
+{/*{{{*/
DWORD dwLength = 0;
PTOKEN_USER pTokenUser = NULL;
DWORD sid_len;
@@ -190,10 +190,10 @@ Finished:
HeapFree(GetProcessHeap(), 0, (LPVOID)pTokenUser);
}
return NULL;
-}
+}/*}}}*/
TSRM_API int tsrm_win32_access(const char *pathname, int mode)
-{
+{/*{{{*/
time_t t;
HANDLE thread_token = NULL;
PSID token_sid;
@@ -394,11 +394,11 @@ Finished:
return 0;
}
}
-}
+}/*}}}*/
static process_pair *process_get(FILE *stream)
-{
+{/*{{{*/
process_pair *ptr;
process_pair *newptr;
@@ -421,10 +421,10 @@ static process_pair *process_get(FILE *stream)
ptr = newptr + TWG(process_size);
TWG(process_size)++;
return ptr;
-}
+}/*}}}*/
static shm_pair *shm_get(key_t key, void *addr)
-{
+{/*{{{*/
shm_pair *ptr;
shm_pair *newptr;
@@ -453,24 +453,25 @@ static shm_pair *shm_get(key_t key, void *addr)
TWG(shm_size)++;
memset(ptr, 0, sizeof(*ptr));
return ptr;
-}
+}/*}}}*/
-static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
+static HANDLE dupHandle(HANDLE fh, BOOL inherit)
+{/*{{{*/
HANDLE copy, self = GetCurrentProcess();
if (!DuplicateHandle(self, fh, self, &copy, 0, inherit, DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) {
return NULL;
}
return copy;
-}
+}/*}}}*/
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)
-{
+{/*{{{*/
FILE *stream = NULL;
int fno, type_len, read, mode;
STARTUPINFOW startup;
@@ -614,10 +615,10 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
proc->prochnd = process.hProcess;
proc->stream = stream;
return stream;
-}
+}/*}}}*/
TSRM_API int pclose(FILE *stream)
-{
+{/*{{{*/
DWORD termstat = 0;
process_pair *process;
@@ -634,10 +635,10 @@ TSRM_API int pclose(FILE *stream)
CloseHandle(process->prochnd);
return termstat;
-}
+}/*}}}*/
TSRM_API int shmget(key_t key, size_t size, int flags)
-{
+{/*{{{*/
shm_pair *shm;
char shm_segment[26], shm_info[29];
HANDLE shm_handle, info_handle;
@@ -717,10 +718,10 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
}
return key;
-}
+}/*}}}*/
TSRM_API void *shmat(int key, const void *shmaddr, int flags)
-{
+{/*{{{*/
shm_pair *shm = shm_get(key, NULL);
if (!shm->segment) {
@@ -740,10 +741,10 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags)
shm->descriptor->shm_nattch++;
return shm->addr;
-}
+}/*}}}*/
TSRM_API int shmdt(const void *shmaddr)
-{
+{/*{{{*/
shm_pair *shm = shm_get(0, (void*)shmaddr);
if (!shm->segment) {
@@ -755,9 +756,10 @@ TSRM_API int shmdt(const void *shmaddr)
shm->descriptor->shm_nattch--;
return UnmapViewOfFile(shm->addr) ? 0 : -1;
-}
+}/*}}}*/
-TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
+TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf)
+{/*{{{*/
shm_pair *shm = shm_get(key, NULL);
if (!shm->segment) {
@@ -785,16 +787,16 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
default:
return -1;
}
-}
+}/*}}}*/
TSRM_API char *realpath(char *orig_path, char *buffer)
-{
+{/*{{{*/
int ret = GetFullPathName(orig_path, _MAX_PATH, buffer, NULL);
if(!ret || ret > _MAX_PATH) {
return NULL;
}
return buffer;
-}
+}/*}}}*/
#if HAVE_UTIME
static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
@@ -852,3 +854,12 @@ TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
/* }}} */
#endif
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: sw=4 ts=4 fdm=marker
+ * vim<600: sw=4 ts=4
+ */