}
} /* }}} */
-#ifndef _WIN32
int phpdbg_open_socket(const char *interface, short port) /* {{{ */
{
int reuse = 1;
static void phpdbg_remote_close(int socket, FILE *stream) {
if (socket >= 0) {
+#ifdef _WIN32
+ closesocket(socket);
+#else
shutdown(socket, SHUT_RDWR);
close(socket);
+#endif
}
if (stream) {
return SUCCESS;
}
+#ifndef _WIN32
/* This function *strictly* assumes that SIGIO is *only* used on the remote connection stream */
void phpdbg_sigio_handler(int sig, siginfo_t *info, void *context) /* {{{ */
{
char bp_tmp_file[] = "/tmp/phpdbg.XXXXXX";
#endif
-#ifndef _WIN32
char *address;
int listen = -1;
int server = -1;
int socket = -1;
FILE* stream = NULL;
-#endif
#ifdef ZTS
void ***tsrm_ls;
show_banner = 0;
break;
-#ifndef _WIN32
/* if you pass a listen port, we will read and write on listen port */
case 'l': /* set listen ports */
if (sscanf(php_optarg, "%d", &listen) != 1) {
address = strdup("*");
} else address = strdup(php_optarg);
} break;
-#endif
case 'V': {
sapi_startup(phpdbg);
#endif
zend_mm_heap *mm_heap;
-#ifndef _WIN32
/* setup remote server if necessary */
if (!cleaning && listen > 0) {
if (phpdbg_remote_init(address, listen, &server, &socket, &stream) == FAILURE) {
exit(0);
}
+#ifndef _WIN32
sigaction(SIGIO, &sigio_struct, NULL);
+#endif
/* set remote flag to stop service shutting down upon quit */
remote = 1;
}
-#endif
mm_heap = phpdbg_mm_get_heap();
/* set flags from command line */
PHPDBG_G(flags) = flags;
-#ifndef _WIN32
/* setup io here */
if (stream) {
PHPDBG_G(flags) |= PHPDBG_IS_REMOTE;
-
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
- }
#endif
+ }
PHPDBG_G(io)[PHPDBG_STDIN].ptr = stdin;
PHPDBG_G(io)[PHPDBG_STDIN].fd = fileno(stdin);
}
}
-/* #ifndef for making compiler shutting up */
-#ifndef _WIN32
phpdbg_interact:
-#endif
/* phpdbg main() */
do {
zend_try {
cleaning = 0;
}
-#ifndef _WIN32
if (!cleaning) {
/* remote client disconnected */
if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
}
}
}
-#endif
} zend_end_try();
} while(!cleaning && !(PHPDBG_G(flags) & PHPDBG_IS_QUITTING));
/* this is just helpful */
PG(report_memleaks) = 0;
-#ifndef _WIN32
phpdbg_out:
if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
PHPDBG_G(flags) &= ~PHPDBG_IS_DISCONNECTED;
goto phpdbg_interact;
}
-#endif
#ifdef _WIN32
} __except(phpdbg_exception_handler_win32(xp = GetExceptionInformation())) {
phpdbg_error("Access violation (Segementation fault) encountered\ntrying to abort cleanly...");
}
-phpdbg_out:
+/* phpdbg_out: */
#endif
{