From ab5e066fbf0fd7d944938e2fefbbae5a77526ac4 Mon Sep 17 00:00:00 2001 From: Daniel Niccoli Date: Fri, 19 Sep 2014 15:57:24 +0200 Subject: [PATCH] Removed Windows code bits from source --- Makefile.am | 5 - admin/consts.py | 3 +- cherokee/common-internal.h | 35 ++---- cherokee/connection.c | 8 -- cherokee/fdpoll-protected.h | 2 - cherokee/handler_cgi.c | 188 ---------------------------- cherokee/handler_cgi.h | 7 -- cherokee/handler_cgi_base.c | 22 ---- cherokee/info.c | 3 - cherokee/init.c | 4 - cherokee/macros.h | 8 -- cherokee/ncpus.c | 2 +- cherokee/resolv_cache.c | 12 +- cherokee/server.c | 7 -- cherokee/socket.c | 52 +------- cherokee/source_interpreter.c | 3 +- cherokee/util.c | 37 +----- cherokee/util.h | 9 +- config.h.win32 | 52 -------- configure.ac | 4 +- doc/Makefile.am | 1 - doc/basics.txt | 1 - doc/basics_installation.txt | 1 - doc/basics_installation_git.txt | 1 - doc/basics_installation_windows.txt | 164 ------------------------ doc/basics_requirements.txt | 4 +- doc/basics_why_cherokee.txt | 2 +- doc/config_advanced.txt | 3 +- doc/config_walkthrough.txt | 3 +- doc/cookbook_cross_compilation.txt | 114 ----------------- doc/index.txt | 1 - 31 files changed, 33 insertions(+), 725 deletions(-) delete mode 100644 config.h.win32 delete mode 100644 doc/basics_installation_windows.txt delete mode 100644 doc/cookbook_cross_compilation.txt diff --git a/Makefile.am b/Makefile.am index 043b6c203..f01278c35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,10 +54,6 @@ http-cherokee.xml.pre XMLS = \ $(XMLS_PRE:.xml.pre=.xml) - -WINDOWS_PORT_FILES = \ -config.h.win32 - CLEANFILES = \ $(XMLS) \ $(CONFS) \ @@ -86,7 +82,6 @@ $(XMLS_PRE) \ $(CONFS_PRE) \ $(CONSTANTS_PRE) \ $(man_MANS) \ -$(WINDOWS_PORT_FILES) \ $(COMPILATION_TESTS) all-local: $(CONSTANTS) $(CONFS) $(XMLS) add_user_group diff --git a/admin/consts.py b/admin/consts.py index a54f21b29..bb7279406 100644 --- a/admin/consts.py +++ b/admin/consts.py @@ -137,8 +137,7 @@ ('kqueue', 'kqueue() - BSD, OS X'), ('ports', 'Solaris ports - >= 10'), ('poll', 'poll()'), - ('select', 'select()'), - ('win32', 'Win32') + ('select', 'select()') ] REDIR_SHOW = [ diff --git a/cherokee/common-internal.h b/cherokee/common-internal.h index e9d21e6d9..5c28da97f 100644 --- a/cherokee/common-internal.h +++ b/cherokee/common-internal.h @@ -28,29 +28,22 @@ #include #include -#ifdef _WIN32 -# include "unix4win32.h" -# include "win32_misc.h" -#endif - #include "common.h" #include "threading.h" #include "error_log.h" -#ifndef _WIN32 -# if defined HAVE_ENDIAN_H -# include -# elif defined HAVE_MACHINE_ENDIAN_H -# include -# elif defined HAVE_SYS_ENDIAN_H -# include -# elif defined HAVE_SYS_MACHINE_H -# include -# elif defined HAVE_SYS_ISA_DEFS_H -# include -# else -# error "Can not include endian.h" -# endif +#if defined HAVE_ENDIAN_H +# include +#elif defined HAVE_MACHINE_ENDIAN_H +# include +#elif defined HAVE_SYS_ENDIAN_H +# include +#elif defined HAVE_SYS_MACHINE_H +# include +#elif defined HAVE_SYS_ISA_DEFS_H +# include +#else +# error "Can not include endian.h" #endif #include @@ -162,11 +155,7 @@ #endif -#ifdef _WIN32 -# define SOCK_ERRNO() WSAGetLastError() -#else # define SOCK_ERRNO() errno -#endif /* IMPORTANT: diff --git a/cherokee/connection.c b/cherokee/connection.c index 195ba8a67..0b7902824 100644 --- a/cherokee/connection.c +++ b/cherokee/connection.c @@ -2217,14 +2217,6 @@ cherokee_connection_get_request (cherokee_connection_t *conn) goto error; } -#ifdef _WIN32 - /* Prevent back-slashes in the request on Windows - */ - TRACE (ENTRIES, "Win32 req before: %s\n", conn->request.buf); - cherokee_buffer_swap_chars (&conn->request, '\\', '/'); - TRACE (ENTRIES, "Win32 req after: %s\n", conn->request.buf); -#endif - /* Short the path. It transforms the request: * /dir1/dir2/../file in /dir1/file */ diff --git a/cherokee/fdpoll-protected.h b/cherokee/fdpoll-protected.h index 137dd351b..a73e29927 100644 --- a/cherokee/fdpoll-protected.h +++ b/cherokee/fdpoll-protected.h @@ -42,14 +42,12 @@ ret_t fdpoll_kqueue_get_fdlimits (cuint_t *sys_fd_limit, cuint_t *fd_limit); ret_t fdpoll_port_get_fdlimits (cuint_t *sys_fd_limit, cuint_t *fd_limit); ret_t fdpoll_poll_get_fdlimits (cuint_t *sys_fd_limit, cuint_t *fd_limit); ret_t fdpoll_select_get_fdlimits (cuint_t *sys_fd_limit, cuint_t *fd_limit); -ret_t fdpoll_win32_get_fdlimits (cuint_t *sys_fd_limit, cuint_t *fd_limit); ret_t fdpoll_epoll_new (cherokee_fdpoll_t **fdp, int sys_fd_limit, int fd_limit); ret_t fdpoll_kqueue_new (cherokee_fdpoll_t **fdp, int sys_fd_limit, int fd_limit); ret_t fdpoll_port_new (cherokee_fdpoll_t **fdp, int sys_fd_limit, int fd_limit); ret_t fdpoll_poll_new (cherokee_fdpoll_t **fdp, int sys_fd_limit, int fd_limit); ret_t fdpoll_select_new (cherokee_fdpoll_t **fdp, int sys_fd_limit, int fd_limit); -ret_t fdpoll_win32_new (cherokee_fdpoll_t **fdp, int sys_fd_limit, int fd_limit); struct cherokee_fdpoll { diff --git a/cherokee/handler_cgi.c b/cherokee/handler_cgi.c index ea19011bc..f3f777750 100644 --- a/cherokee/handler_cgi.c +++ b/cherokee/handler_cgi.c @@ -60,13 +60,8 @@ #define ENTRIES "handler,cgi" -#ifdef _WIN32 -# define fork_and_execute_cgi(c) fork_and_execute_cgi_win32(c) -static ret_t fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi); -#else # define fork_and_execute_cgi(c) fork_and_execute_cgi_unix(c) static ret_t fork_and_execute_cgi_unix (cherokee_handler_cgi_t *cgi); -#endif #define set_env(cgi,k,v,vl) cherokee_handler_cgi_add_env_pair(cgi, k, sizeof(k)-1, v, vl) @@ -148,19 +143,11 @@ cherokee_handler_cgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_p */ n->pipeInput = -1; n->pipeOutput = -1; - -#ifdef _WIN32 - n->process = NULL; - n->thread = NULL; - - cherokee_buffer_init (&n->envp); -#else n->pid = -1; n->envp_last = 0; for (i=0; ienvp[i] = NULL; -#endif /* Return the object */ @@ -176,8 +163,6 @@ do_reap (void) int status; int child_count = 0; -#ifndef _WIN32 - /* Reap defunct children until there aren't any more. */ for (child_count = 0; ; ++child_count) { @@ -195,7 +180,6 @@ do_reap (void) break; } } -#endif return child_count; } @@ -224,7 +208,6 @@ cherokee_handler_cgi_free (cherokee_handler_cgi_t *cgi) /* Kill the CGI */ -#ifndef _WIN32 if (cgi->pid > 0) { pid_t pid; cint_t tries = 2; @@ -250,27 +233,13 @@ cherokee_handler_cgi_free (cherokee_handler_cgi_t *cgi) break; } } -#else - if (cgi->process) { - WaitForSingleObject (cgi->process, INFINITE); - CloseHandle (cgi->process); - } - - if (cgi->thread) { - CloseHandle (cgi->thread); - } -#endif /* Free the environment variables */ -#ifdef _WIN32 - cherokee_buffer_mrproper (&cgi->envp); -#else for (i=0; ienvp_last; i++) { free (cgi->envp[i]); cgi->envp[i] = NULL; } -#endif /* For some reason, we have seen that the SIGCHLD signal does not call to * our handler in a server with a lot of requests, so the wait() call, @@ -318,10 +287,6 @@ cherokee_handler_cgi_add_env_pair (cherokee_handler_cgi_base_t *cgi_base, { cherokee_handler_cgi_t *cgi = HDL_CGI(cgi_base); -#ifdef _WIN32 - cherokee_buffer_add_va (&cgi->envp, "%s=%s", name, content); - cherokee_buffer_add (&cgi->envp, "\0", 1); -#else char *entry; /* Build the new envp entry @@ -350,7 +315,6 @@ cherokee_handler_cgi_add_env_pair (cherokee_handler_cgi_base_t *cgi_base, if (cgi->envp_last >= ENV_VAR_NUM) { SHOULDNT_HAPPEN; } -#endif } static ret_t @@ -482,12 +446,6 @@ cherokee_handler_cgi_read_post (cherokee_handler_cgi_t *cgi) } -/******************************* - * UNIX: Linux, Solaris, etc.. * - *******************************/ - -#ifndef _WIN32 - static ret_t _fd_set_properties (int fd, int add_flags, int remove_flags) { @@ -727,152 +685,6 @@ fork_and_execute_cgi_unix (cherokee_handler_cgi_t *cgi) } - -#else - - - -/******************************* - * WINDOWS * - *******************************/ - -static ret_t -fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi) -{ - int re; - PROCESS_INFORMATION pi; - STARTUPINFO si; - char *cmd; - cherokee_buffer_t cmd_line = CHEROKEE_BUF_INIT; - cherokee_buffer_t exec_dir = CHEROKEE_BUF_INIT; - cherokee_connection_t *conn = HANDLER_CONN(cgi); - - SECURITY_ATTRIBUTES saSecAtr; - HANDLE hProc; - HANDLE hChildStdinRd = INVALID_HANDLE_VALUE; - HANDLE hChildStdinWr = INVALID_HANDLE_VALUE; - HANDLE hChildStdoutRd = INVALID_HANDLE_VALUE; - HANDLE hChildStdoutWr = INVALID_HANDLE_VALUE; - - /* Create the environment for the process - */ - add_environment (cgi, conn); - cherokee_buffer_add (&cgi->envp, "\0", 1); - - /* Command line - */ - cmd = HDL_CGI_BASE(cgi)->executable.buf; - cherokee_buffer_add (&cmd_line, cmd, strlen(cmd)); -// cherokee_buffer_add_va (&cmd_line, " \"%s\"", HDL_CGI_BASE(cgi)->param.buf); - - /* Execution directory - */ - if (! cherokee_buffer_is_empty (&conn->effective_directory)) { - cherokee_buffer_add_buffer (&exec_dir, &conn->effective_directory); - } else { - char *file = strrchr (cmd, '/'); - char *end = HDL_CGI_BASE(cgi)->executable.buf + HDL_CGI_BASE(cgi)->executable.len; - - cherokee_buffer_add (&exec_dir, cmd, - HDL_CGI_BASE(cgi)->executable.len - (end - file)); - } - - /* Set the bInheritHandle flag so pipe handles are inherited. - */ - memset(&saSecAtr, 0, sizeof(SECURITY_ATTRIBUTES)); - saSecAtr.nLength = sizeof(SECURITY_ATTRIBUTES); - saSecAtr.lpSecurityDescriptor = NULL; - saSecAtr.bInheritHandle = TRUE; - - /* Create the pipes - */ - hProc = GetCurrentProcess(); - - re = CreatePipe (&hChildStdoutRd, &hChildStdoutWr, &saSecAtr, 0); - if (!re) return ret_error; - - re = CreatePipe (&hChildStdinRd, &hChildStdinWr, &saSecAtr, 0); - if (!re) return ret_error; - - /* Make them inheritable - */ - re = DuplicateHandle (hProc, hChildStdoutRd, - hProc, &hChildStdoutRd, - 0, TRUE, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS); - if (!re) return ret_error; - - re = DuplicateHandle (hProc, hChildStdinWr, - hProc, &hChildStdinWr, - 0, TRUE, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS); - if (!re) return ret_error; - - - /* Starting information - */ - ZeroMemory (&si, sizeof(STARTUPINFO)); - si.cb = sizeof(STARTUPINFO); - si.hStdOutput = hChildStdoutWr; - si.hStdError = hChildStdoutWr; - si.hStdInput = hChildStdinRd; - si.dwFlags |= STARTF_USESTDHANDLES; - - TRACE (ENTRIES, "exec %s dir %s\n", cmd_line.buf, exec_dir.buf); - - /* Launch the child process - */ - re = CreateProcess (cmd, /* ApplicationName */ - cmd_line.buf, /* Command line */ - NULL, /* Process handle not inheritable */ - NULL, /* Thread handle not inheritable */ - TRUE, /* Handle inheritance */ - 0, /* Creation flags */ - cgi->envp.buf, /* Use parent's environment block */ - exec_dir.buf, /* Use parent's starting directory */ - &si, /* Pointer to STARTUPINFO structure */ - &pi); /* Pointer to PROCESS_INFORMATION structure */ - - CloseHandle (hChildStdinRd); - CloseHandle (hChildStdoutWr); - - if (!re) { - LOG_ERROR (CHEROKEE_ERROR_HANDLER_CGI_CREATEPROCESS, GetLastError()); - - CloseHandle (pi.hProcess); - CloseHandle (pi.hThread); - - conn->error_code = http_internal_error; - return ret_error; - } - - cherokee_buffer_mrproper (&cmd_line); - cherokee_buffer_mrproper (&exec_dir); - - cgi->thread = pi.hThread; - cgi->process = pi.hProcess; - - /* Wait for the CGI process to be ready - */ - WaitForInputIdle (pi.hProcess, INFINITE); - - /* Extract the file descriptors - */ - cgi->pipeInput = _open_osfhandle((LONG)hChildStdoutRd, O_BINARY|_O_RDONLY); - - if (! conn->post.len <= 0) { - CloseHandle (hChildStdinWr); - } else { - cgi->pipeOutput = _open_osfhandle((LONG)hChildStdinWr, O_BINARY|_O_WRONLY); - } - - TRACE (ENTRIES, "In fd %d, Out fd %d\n", cgi->pipeInput, cgi->pipeOutput); - - return ret_ok; -} - -#endif - static ret_t fork_and_execute_cgi_via_spawner(cherokee_handler_cgi_t *cgi) { diff --git a/cherokee/handler_cgi.h b/cherokee/handler_cgi.h index 352ef8eef..fc48e2d29 100644 --- a/cherokee/handler_cgi.h +++ b/cherokee/handler_cgi.h @@ -50,16 +50,9 @@ typedef struct { int post_data_sent; /* amount POSTed to the CGI */ int pipeInput; /* read from the CGI */ int pipeOutput; /* write to the CGI */ - -#ifdef _WIN32 - cherokee_buffer_t envp; - HANDLE process; - HANDLE thread; -#else char *envp[ENV_VAR_NUM]; /* Environ variables for execve() */ int envp_last; pid_t pid; /* CGI pid */ -#endif } cherokee_handler_cgi_t; #define HDL_CGI(x) ((cherokee_handler_cgi_t *)(x)) diff --git a/cherokee/handler_cgi_base.c b/cherokee/handler_cgi_base.c index 47f6b05ac..3062c657b 100644 --- a/cherokee/handler_cgi_base.c +++ b/cherokee/handler_cgi_base.c @@ -244,22 +244,6 @@ cherokee_handler_cgi_base_free (cherokee_handler_cgi_base_t *cgi) } -#ifdef _WIN32 -static void -add_win32_systemroot_env (cherokee_handler_cgi_base_t *cgi, - cherokee_handler_cgi_base_add_env_pair_t set_env_pair) -{ - char *root; - - root = getenv("SYSTEMROOT"); - if (!root) - return; - - set_env (cgi, "SYSTEMROOT", root, strlen(root)); -} -#endif - - ret_t cherokee_handler_cgi_base_build_basic_env ( cherokee_handler_cgi_base_t *cgi, @@ -419,12 +403,6 @@ cherokee_handler_cgi_base_build_basic_env ( set_env (cgi, "CONTENT_TYPE", tmp->buf, tmp->len); } - /* SYSTEMROOT environment for Win32 - */ -#ifdef _WIN32 - add_win32_systemroot_env (cgi, set_env_pair); -#endif - /* Query string */ if (conn->query_string.len > 0) diff --git a/cherokee/info.c b/cherokee/info.c index bd0f86ddf..8fff47e6d 100644 --- a/cherokee/info.c +++ b/cherokee/info.c @@ -101,9 +101,6 @@ cherokee_info_build_print (cherokee_server_t *srv) #ifdef HAVE_PORT printf ("ports "); #endif -#ifdef HAVE_WIN32_SELECT - printf ("win32-select "); -#endif #ifdef HAVE_SELECT printf ("select "); #endif diff --git a/cherokee/init.c b/cherokee/init.c index 8a92387b4..158815996 100644 --- a/cherokee/init.c +++ b/cherokee/init.c @@ -67,10 +67,6 @@ cherokee_init (void) if (_cherokee_init) return ret_ok; -#ifdef _WIN32 - init_win32(); -#endif - /* Init the tracing facility */ cherokee_trace_init(); diff --git a/cherokee/macros.h b/cherokee/macros.h index 9eafcc8fb..bac0a77e9 100644 --- a/cherokee/macros.h +++ b/cherokee/macros.h @@ -385,17 +385,9 @@ cherokee_ ## klass ## _free (cherokee_ ## klass ## _t *obj) { \ #endif -#ifdef _WIN32 -# define CHEROKEE_EXPORT __declspec(dllexport) -#else # define CHEROKEE_EXPORT -#endif -#ifdef _WIN32 -# define SLASH '\\' -#else # define SLASH '/' -#endif #define CHEROKEE_CRASH \ do { \ diff --git a/cherokee/ncpus.c b/cherokee/ncpus.c index 0b610f3d7..d8cbd63d1 100644 --- a/cherokee/ncpus.c +++ b/cherokee/ncpus.c @@ -114,7 +114,7 @@ int dcc_ncpus(int *ncpus) } } -#elif !defined (_WIN32) /* every other system but Windows */ +#else /* every other system */ /* * http://www.opengroup.org/onlinepubs/007904975/functions/sysconf.html diff --git a/cherokee/resolv_cache.c b/cherokee/resolv_cache.c index 7071e0f37..d7fff6a7d 100644 --- a/cherokee/resolv_cache.c +++ b/cherokee/resolv_cache.c @@ -23,14 +23,10 @@ */ #include "common-internal.h" - -#ifndef _WIN32 -# include -# include -# include -# include -#endif - +#include +#include +#include +#include #include "resolv_cache.h" #include "socket_lowlevel.h" #include "util.h" diff --git a/cherokee/server.c b/cherokee/server.c index 0947ac9d1..7afbf19d3 100644 --- a/cherokee/server.c +++ b/cherokee/server.c @@ -1178,11 +1178,6 @@ cherokee_server_step (cherokee_server_t *srv) srv->flcache_next = cherokee_bogonow_now + srv->flcache_lapse; } -#ifdef _WIN32 - if (unlikely (cherokee_win32_shutdown_signaled (cherokee_bogonow_now))) - srv->wanna_exit = true; -#endif - /* Gracefull restart: */ if (unlikely ((ret == ret_eof) && @@ -1773,7 +1768,6 @@ cherokee_server_read_config_file (cherokee_server_t *srv, const char *fullpath) ret_t cherokee_server_daemonize (cherokee_server_t *srv) { -#ifndef _WIN32 pid_t child_pid; TRACE (ENTRIES, "server (%p) about to become evil", srv); @@ -1795,7 +1789,6 @@ cherokee_server_daemonize (cherokee_server_t *srv) default: exit(0); } -#endif UNUSED(srv); return ret_ok; diff --git a/cherokee/socket.c b/cherokee/socket.c index 224792dc8..24a2b47d7 100644 --- a/cherokee/socket.c +++ b/cherokee/socket.c @@ -198,11 +198,8 @@ cherokee_socket_close (cherokee_socket_t *socket) /* Close the socket */ -#ifdef _WIN32 - ret = closesocket (socket->socket); -#else + ret = cherokee_fd_close (socket->socket); -#endif /* Clean up */ @@ -921,46 +918,6 @@ cherokee_socket_writev (cherokee_socket_t *socket, if (likely (socket->is_tls != TLS)) { -#ifdef _WIN32 - int i; - size_t total; - - for (i = 0, re = 0, total = 0; i < vector_len; i++) { - if (vector[i].iov_len == 0) - continue; - do { - re = send (SOCKET_FD(socket), vector[i].iov_base, vector[i].iov_len, 0); - } while ((re == -1) && (errno == EINTR)); - - if (re < 0) - break; - - total += re; - - /* if it is a partial send, then stop sending data - */ - if (re != vector[i].iov_len) - break; - } - *pcnt_written = total; - - /* if we have sent at least one byte, - * then return OK. - */ - if (likely (total > 0)) - return ret_ok; - - if (re == 0) { - int err = SOCK_ERRNO(); - if (i == vector_len) - return ret_ok; - /* Retry later. - */ - return ret_eagain; - } - -#else /* ! WIN32 */ - do { re = writev (SOCKET_FD(socket), vector, vector_len); } while ((re == -1) && (errno == EINTR)); @@ -983,7 +940,7 @@ cherokee_socket_writev (cherokee_socket_t *socket, */ return ret_ok; } -#endif + if (re < 0) { int err = SOCK_ERRNO(); @@ -1356,7 +1313,6 @@ cherokee_socket_sendfile (cherokee_socket_t *socket, ret_t cherokee_socket_gethostbyname (cherokee_socket_t *socket, cherokee_buffer_t *hostname) { -#ifndef _WIN32 ret_t ret; cherokee_resolv_cache_t *resolv = NULL; @@ -1394,10 +1350,6 @@ cherokee_socket_gethostbyname (cherokee_socket_t *socket, cherokee_buffer_t *hos } return ret_ok; -#else - SHOULDNT_HAPPEN; - return ret_no_sys; -#endif } diff --git a/cherokee/source_interpreter.c b/cherokee/source_interpreter.c index bcead208d..860240752 100644 --- a/cherokee/source_interpreter.c +++ b/cherokee/source_interpreter.c @@ -578,9 +578,8 @@ _spawn_local (cherokee_source_interpreter_t *src, cherokee_buffer_add_va (&tmp, "exec %s", src->interpreter.buf); TRACE (ENTRIES, "Spawn: /bin/sh -c \"exec %s\"\n", src->interpreter.buf); -#ifndef _WIN32 child = fork(); -#endif + switch (child) { case 0: /* Change user if requested diff --git a/cherokee/util.c b/cherokee/util.c index 0e2f121e0..cdf0da684 100644 --- a/cherokee/util.c +++ b/cherokee/util.c @@ -138,9 +138,8 @@ const char *month[13] = { char * cherokee_strerror_r (int err, char *buf, size_t bufsize) { -#ifdef _WIN32 return win_strerror (err, buf, bufsize); -#else + char *p; if (buf == NULL) return NULL; @@ -157,7 +156,6 @@ cherokee_strerror_r (int err, char *buf, size_t bufsize) } return p; -#endif } @@ -230,7 +228,6 @@ cherokee_sys_fdlimit_get (cuint_t *limit) ret_t cherokee_sys_fdlimit_set (cuint_t limit) { -#ifndef _WIN32 int re; struct rlimit rl; @@ -241,7 +238,6 @@ cherokee_sys_fdlimit_set (cuint_t limit) if (re != 0) { return ret_error; } -#endif return ret_ok; } @@ -853,11 +849,7 @@ cherokee_fd_set_nodelay (int fd, cherokee_boolean_t enable) * poor utilization of the network. */ -#ifdef _WIN32 - flags = enable; - re = ioctlsocket (fd, FIONBIO, (u_long) &flags); - -#elif defined(FIONBIO) +#ifdef FIONBIO /* Even though the right thing to do would be to use POSIX's * O_NONBLOCK, we are using FIONBIO here. It requires a single * syscall, while using O_NONBLOCK would require us to call @@ -896,9 +888,6 @@ cherokee_fd_set_nonblocking (int fd, cherokee_boolean_t enable) int re; int flags = 0; -#ifdef _WIN32 - re = ioctlsocket (fd, FIONBIO, (u_long *) &enable); -#else flags = fcntl (fd, F_GETFL, 0); if (flags < 0) { LOG_ERRNO (errno, cherokee_err_warning, CHEROKEE_ERROR_UTIL_F_GETFL, fd); @@ -911,7 +900,7 @@ cherokee_fd_set_nonblocking (int fd, cherokee_boolean_t enable) BIT_UNSET (flags, O_NONBLOCK); re = fcntl (fd, F_SETFL, flags); -#endif + if (re < 0) { LOG_ERRNO (errno, cherokee_err_warning, CHEROKEE_ERROR_UTIL_F_SETFL, fd, flags, "O_NONBLOCK"); return ret_error; @@ -927,7 +916,6 @@ cherokee_fd_set_closexec (int fd) int re; int flags = 0; -#ifndef _WIN32 flags = fcntl (fd, F_GETFD, 0); if (flags < 0) { LOG_ERRNO (errno, cherokee_err_warning, CHEROKEE_ERROR_UTIL_F_GETFD, fd); @@ -941,7 +929,6 @@ cherokee_fd_set_closexec (int fd) LOG_ERRNO (errno, cherokee_err_warning, CHEROKEE_ERROR_UTIL_F_SETFD, fd, flags, "FD_CLOEXEC"); return ret_error; } -#endif return ret_ok; } @@ -1657,11 +1644,7 @@ cherokee_fd_close (int fd) return ret_error; } -#ifdef _WIN32 - re = closesocket (fd); -#else re = close (fd); -#endif TRACE (ENTRIES",close_fd", "fd=%d re=%d\n", fd, re); return (re == 0) ? ret_ok : ret_error; @@ -1675,11 +1658,7 @@ cherokee_get_shell (const char **shell, const char **binary) /* Set the shell path */ -#ifdef _WIN32 - *shell = getenv("ComSpec"); -#else *shell = "/bin/sh"; -#endif /* Find the binary */ @@ -1756,11 +1735,8 @@ cherokee_mkstemp (cherokee_buffer_t *buffer, int *fd) { int re; -#ifdef _WIN32 - re = cherokee_win32_mkstemp (buffer); -#else re = mkstemp (buffer->buf); -#endif + if (re < 0) return ret_error; *fd = re; @@ -2296,11 +2272,8 @@ cherokee_tmp_dir_copy (cherokee_buffer_t *buffer) /* Read the system variable */ -#ifdef _WIN32 - p = getenv("TEMP"); -#else p = getenv("TMPDIR"); -#endif + if (p != NULL) { cherokee_buffer_add (buffer, p, strlen(p)); return ret_ok; diff --git a/cherokee/util.h b/cherokee/util.h index 7d11e6445..88b065aa5 100644 --- a/cherokee/util.h +++ b/cherokee/util.h @@ -72,14 +72,7 @@ CHEROKEE_BEGIN_DECLS */ #define ERROR_MIN_BUFSIZE 64 /* min. buffer size */ #define ERROR_MAX_BUFSIZE 512 /* max. buffer size */ - -#ifdef _WIN32 -# define cherokee_stat(path,buf) cherokee_win32_stat(path,buf) -# define cherokee_lstat(path,buf) cherokee_win32_stat(path,buf) -# define cherokee_error GetLastError() -#else -# define cherokee_error errno -#endif +#define cherokee_error errno /* Missing functions */ diff --git a/config.h.win32 b/config.h.win32 deleted file mode 100644 index d75b2bf3a..000000000 --- a/config.h.win32 +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; TABs are evil */ - -/* Cherokee - * - * Authors: - * Gisle Vanem - * - */ - -#ifndef _CONFIG_H_WIN32_ -#define _CONFIG_H_WIN32_ - -/* Headers - */ -#ifdef __MINGW32__ -#define HAVE_INTTYPES_H 1 -#endif - -#define HAVE_STDINT_H 1 -#define HAVE_FCNTL_H 1 - -/* Functions & features - */ -#define HAVE_INT_TIMEZONE 1 -#define HAVE_MEMMOVE 1 -#define HAVE_INET_PTON 1 -#define HAVE_INET_NTOP 1 -#define HAVE_CRYPT 1 -#define HAVE_GETDTABLESIZE 1 -#define HAVE_WIN32_SELECT 1 - -/* Types - */ -#define UWORD32 unsigned long - -/* Misc - */ -#define FD_SETSIZE 256 -#define _PC_NAME_MAX 256 -#define SO_SUFFIX "dll" -#define OS_TYPE "Win32" - - -#ifdef __MINGW32__ -#define HAVE_INLINE 1 -#endif - -#ifndef WEXITSTATUS -#define WEXITSTATUS(x) ((x) & 0xff) -#endif - -#endif diff --git a/configure.ac b/configure.ac index 9ea50b2a8..d6298f27a 100644 --- a/configure.ac +++ b/configure.ac @@ -204,9 +204,7 @@ AC_CONFIG_HEADERS(config.h) AC_SUBST(VERSION) dnl Initialize Libtool -m4_ifdef([LT_INIT], - [LT_INIT([dlopen shared static win32-dll])], - [AC_LIBTOOL_DLOPEN]) +m4_ifdef([LT_INIT], [LT_INIT([dlopen shared static])], [AC_LIBTOOL_DLOPEN]) dnl Paths AC_PROG_CC diff --git a/doc/Makefile.am b/doc/Makefile.am index aadfdc078..7e97bb8b5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -16,7 +16,6 @@ basics_installation_easy-install.html \ basics_installation_freebsd.html \ basics_installation_unix.html \ basics_installation_osx.html \ -basics_installation_windows.html \ basics_installation_git.html \ basics_upgrade.html \ basics_running_cherokee.html \ diff --git a/doc/basics.txt b/doc/basics.txt index 0d81ba8bd..0d9771941 100644 --- a/doc/basics.txt +++ b/doc/basics.txt @@ -7,7 +7,6 @@ - link:basics_installation_easy-install.html[Easy installation]: One-step installation. - link:basics_installation_unix.html[Unix]: Installation on Unix/Linux platforms. - link:basics_installation_osx.html[OSX]: Installation on Mac OSX platform. - - link:basics_installation_windows.html[Windows]: Installation on Windows platform. - link:basics_installation_freebsd.html[FreeBSD]: Installation on FreeBSD platforms. - link:basics_installation_git.html[From GIT]: Installation of the development release. . link:basics_upgrade.html[Upgrading Cherokee]: Upgrading from a previous release? diff --git a/doc/basics_installation.txt b/doc/basics_installation.txt index 7c6df6a5f..bcba39578 100644 --- a/doc/basics_installation.txt +++ b/doc/basics_installation.txt @@ -9,7 +9,6 @@ several platforms. * link:basics_installation_easy-install.html[Easy installation] * link:basics_installation_unix.html[Unix installation] * link:basics_installation_osx.html[OSX installation] -* link:basics_installation_windows.html[Windows installation] * link:basics_installation_git.html[Installation From GIT] For insight on more specific subjects such as cross-compilation or diff --git a/doc/basics_installation_git.txt b/doc/basics_installation_git.txt index d3d693937..b72f22182 100644 --- a/doc/basics_installation_git.txt +++ b/doc/basics_installation_git.txt @@ -99,4 +99,3 @@ Once you have done this, you are now ready to proceed with the standard compilation process for your platform: * link:basics_installation_unix.html[Unix installation] -* link:basics_installation_windows.html[Windows installation] diff --git a/doc/basics_installation_windows.txt b/doc/basics_installation_windows.txt deleted file mode 100644 index a46edd601..000000000 --- a/doc/basics_installation_windows.txt +++ /dev/null @@ -1,164 +0,0 @@ -== link:index.html[Index] -> link:basics.html[Getting started] -> link:basics_installation.html[Installation] -//// -Last checked: 2010/04/26 Cherokee 0.99.46b -//// - -Installation on Windows ------------------------ - -The latest Windows bundled release is available at the -link:http://www.cherokee-project.com/download/windows[Windows -download] section of the Cherokee Project website. - -WARNING: The Windows native build is currently broken. It will be -fixed as soon as possible. A Windows binary release will be available -too. In the meantime, if you need to run Cherokee on a Windows host -you will have to rely on Cygwin and the likes. Almost all the code -base of the Cherokee-Project can be used natively under Windows, as it -was 100% compatible not too long ago. However, since resources and -man-power are limited, and due to Cherokee's fast evolution, we are -not yet there. Reacquiring binary compatibility with the Windows -platform is a medium-to-long term goal. - - -[[quickstart]] -Quickstart -~~~~~~~~~~ -The installation process requires little explanation, as it is simply -a matter of pointing and clicking. - -You have to check the desired components to be installed, select the -desired installation path and that's it. - -However, if you want to try out the latest development release or -simply want to compile from source, you will need to setup a proper -building environment. - -[[environment]] -Configuring the building the environment -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Cherokee for Windows runs in fully native mode, but the environment -for its development has always been Unix/Linux. Building in -non-native mode (i.e., using Cygwin) would incur in a big loss of -performance, though it would be much simpler to maintain and build. - -However, a big effort is made to ensure Cherokee's complete -cross-platform compatibility. To be able to build Cherokee you will -need a unix-like environment that provides the necessary tools listed -in the link:basics_requirements.html[requirements] section. Unfortunately -this environment is far from trivial to set up. - -You can either follow these instructions on how to accomplish such -task, or simply download the link:http://cherokee-project.com/download/windows/Win32_Building_Environment.rar[Win32 -preconfigured building environment bundle] provided by the -Cherokee-Project and skip the rest of this section, right to the -*building* part. - -This is what you need to install. Check the -link:http://www.mingw.org/[MinGW] site to download most of the -software mentioned in the following lines. - -.*MinGW*: minimalist GNU for Windows (GCC & binutils) - - * Download MinGW release 5.1.4 at the time of this writing. - * Run it and select ‘Candidate’. Check base tools & g++ - * Install in a directory with no spaces (the default directory - C:\MinGW is fine). - - -.*MSYS*: Minimal SYStem - - * Download MSYS, tests were made with release 1.0.10 - * Install it in the same directory as MinGW (remove “1.0″ from - the install path). - * Answer y, y, c:/MinGW - * You should add something like this to your ~/.profile to process - your preferences: -+ ------------------------------- -if [ -f ${HOME}/.bashrc ] then - . ${HOME}/.bashrc -fi ------------------------------- - -.*MSYS DTK*: Dev Toolkit - - * Get DTK - * Install it in the same path as above - -.*Update Autoconf & Automake* - - * You might encounter problems if you do not have up to date - `Autoconf` and `Automake`. We recommend the usage of at least - versions 2.61 and 1.10.1, that are the ones we used. - -.*Pthreads Win32*: POSIX Threads - - * Cherokee will need these. Just download - link:ftp://sourceware.org/pub/pthreads-win32/dll-latest/[Pthreads-Win32] - and copy the appropriate files to /lib and /include - - -.*Python* - - * You will need this, since both the build process and - Cherokee-Admin use Python. Just - link:http://python.org/download/[download] a Python Windows - installer, remember to include the directory in your path - environment variable, and you’re done. - * rxvt seems to be broken, which is most noticeable when you try - to run Python interactively, so just comment out its line in - msys.bat. - - -[[building]] -Building -~~~~~~~~ -. link:basics_download.html[Download] a fresh copy of Cherokee -. Configure the package for your system: -+ -------------------------------------------------------------------- -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ ---enable-trace --enable-static-module=all --enable-static \ ---enable-shared=no --enable-beta --disable-readdir_r -------------------------------------------------------------------- - -. Compile the package: -+ ------------------------------------------ -make ------------------------------------------ - -. Install the programs and any data files: -+ ------------------------------------------ -make install ------------------------------------------ - -[[advanced]] -Advanced parameters -~~~~~~~~~~~~~~~~~~~ - -If you want to learn more about 'configure' you can run `./configure ---help`. - -[cols="30%,70%",options="header"] -|====================================================================== -|Parameter |Description -|`--with-wwwroot=DIR` |Specify the webserver root directory -|`--with-user=USER` |Custom username under which the server will run -|`--with-user=GROUP` |Custom group under which the server will run -|`--disable-epoll` |Disable epoll() support -|`--disable-pthread` |Disable threading support -|`--disable-readdir_r` |Disable readdir_r usage -|`--disable-ipv6` |Disable IPv6 support -|`--disable-pam` |Disable PAM support -|`--enable-trace` |Allows debugging options -|`--disable-admin` |Stops cherokee-admin from installing -|====================================================================== - -[[autostart]] -Autostart -~~~~~~~~~ -To be written - diff --git a/doc/basics_requirements.txt b/doc/basics_requirements.txt index 778c01d1a..c33131b2e 100644 --- a/doc/basics_requirements.txt +++ b/doc/basics_requirements.txt @@ -53,8 +53,8 @@ several tools and libraries. targeted by our developers are 2.4, 2.5 and 2.6. Anything other than that is not guaranteed to work at the moment. -* If you are building Cherokee in a non-POSIX compliant platform such - as Windows, you will need a POSIX threads implementation. Although +* If you are building Cherokee in a non-POSIX compliant platform, + you will need a POSIX threads implementation. Although you can disable the usage at compilation time and do without this, it will have a dramatic impact in scalability. diff --git a/doc/basics_why_cherokee.txt b/doc/basics_why_cherokee.txt index abd59ec1c..9b8bb00f8 100644 --- a/doc/basics_why_cherokee.txt +++ b/doc/basics_why_cherokee.txt @@ -30,7 +30,7 @@ many concurrent connections, has a low memory footprint, and provides load balancing facilities. As such, it is suitable for usage among a wide variety of systems, from tiny embedded devices to huge enterprise grade infrastructures. It is also multi-platform, offering native -performance for Unix, Linux and Windows systems. +performance for Unix and Linux systems. By simply upgrading your existing web server to Cherokee, you can literally multiply your existing hardware's performance, extending its diff --git a/doc/config_advanced.txt b/doc/config_advanced.txt index b08dda5d2..298706637 100644 --- a/doc/config_advanced.txt +++ b/doc/config_advanced.txt @@ -38,8 +38,7 @@ Connections * Polling Method: This affects the internal file descriptor polling method among the ones supported by the OS. The full list of options - is `epoll()`, `kqueue`, `poll()`, `Solaris ports`, `select()` and - `Win32`. Only the alternatives available for your specific + is `epoll()`, `kqueue`, `poll()`, `Solaris ports` and `select()`. Only the alternatives available for your specific architectures are shown. If you don't know what this is or how this affects performance, just choose `Automatic`. This will choose the most efficient one among the present at any given time. diff --git a/doc/config_walkthrough.txt b/doc/config_walkthrough.txt index 99ee6e175..e76d59529 100644 --- a/doc/config_walkthrough.txt +++ b/doc/config_walkthrough.txt @@ -202,8 +202,7 @@ placed in the upper side of the left panel, adjacent to the `Virtual Servers` label and the `Add New Virtual Server` button. While you are at it you should also append the following line to your -`/etc/hosts` file (in Windows you will find this as -`%WINDIR%\system32\drivers\etc\hosts`). +`/etc/hosts` file. ---- 127.0.0.1 example.com example.net example.org diff --git a/doc/cookbook_cross_compilation.txt b/doc/cookbook_cross_compilation.txt deleted file mode 100644 index f8607fdcb..000000000 --- a/doc/cookbook_cross_compilation.txt +++ /dev/null @@ -1,114 +0,0 @@ -== link:index.html[Index] -> link:cookbook.html[Cookbook] - -Cookbook: How to cross compile Cherokee ---------------------------------------- - -[[linux2win32]] -Cherokee-Win32 from Linux -~~~~~~~~~~~~~~~~~~~~~~~~~ - -First of all, you will have to install the cross compiler: - ----- -# apt-get install mingw32 mingw32-binutils ----- - -Then, you'll have to install the pthread library: - ----- -$ cd /var/tmp -$ mkdir pthread-win32 -$ cd pthread-win32 -$ wget ftp://sources.redhat.com/pub/pthreads-win32/pthreads-w32-2-8-0-release.exe -$ unzip pthreads-w32-2-8-0-release.exe -# cp ./Pre-built.2/lib/libpthreadGCE2.a /usr/i586-mingw32msvc/lib/libpthread.a -# cp Pre-built.2/include/* /usr/i586-mingw32msvc/include/ ----- - -And now, we are ready to compile it. We only have to set a few environment -variables: - ----- -PATH=/usr/i586-mingw32msvc/bin:$PATH -CC=i586-mingw32msvc-gcc -LD=i586-mingw32msvc-ld -AR=i586-mingw32msvc-ar -RC=i586-mingw32msvc-windres ----- - -Check out the last development version of Cherokee: - ----- -$ git clone --recursive git://github.com/cherokee/webserver.git cherokee -$ cd cherokee -$ git submodule update --init #Not needed on Git >= 1.6.5 ----- - -and execute a quite long "configure" command: - ----- -$ ac_cv_func_malloc_0_nonnull=yes \ - ac_cv_func_realloc_0_nonnull=yes \ -./configure \ - --host=i586-mingw32msvc \ - --prefix=/usr/i586-mingw32msvc \ - --disable-readdir_r \ - --disable-tls \ - --enable-static-module=all \ - --enable-trace \ - --enable-static \ - --enable-shared=no \ - --enable-beta \ - CC=i586-mingw32msvc-gcc ----- - -Once reached this point, we are ready to build it by simply typing: - ----- -$ make ----- - - -[[osx2win32]] -Cherokee-Win32 from OS X -~~~~~~~~~~~~~~~~~~~~~~~~ - -First of all, you will have to install MinGW for OS X and to check out the -latest version of the source code, then fetch, uncompress and install -pthreads-win32: - ----- -unzip pthreads-w32-2-8-0-release.exe -cp Pre-built.2/lib/libpthreadGCE2.a \ - /usr/local/i386-mingw32-3.4.5/lib/libpthread.a -cp Pre-built.2/include/* \ - /usr/local/i386-mingw32-3.4.5/lib/gcc/*/*/include/ ----- - -Then you will have to set a few environment variables: - ----- - CC=i386-mingw32-gcc - LD=i386-mingw32-ld - AR=i386-mingw32-ar - RC=i386-mingw32-windres ----- - -and run the configuration script:: - ----- -ac_cv_func_malloc_0_nonnull=yes \ -ac_cv_func_realloc_0_nonnull=yes \ -./configure \ - --host=i386-mingw32 \ - --prefix=/usr/local/i386-mingw32-3.4.5/ \ - --enable-static \ - --enable-shared=no \ - --enable-static-module=all \ - --disable-readdir_r \ - --disable-tls \ - --enable-beta \ - --enable-trace \ - CC=i386-mingw32-gcc ----- - diff --git a/doc/index.txt b/doc/index.txt index 59ebc8a1e..a1828ed93 100644 --- a/doc/index.txt +++ b/doc/index.txt @@ -11,7 +11,6 @@ link:basics.html[Getting started]: Cherokee basics - link:basics_installation_easy-install.html[Easy installation]: One-step installation. - link:basics_installation_unix.html[Unix]: Installation on Unix/Linux platforms. - link:basics_installation_osx.html[OSX]: Installation on Mac OSX platform. - - link:basics_installation_windows.html[Windows]: Installation on Windows platform. - link:basics_installation_git.html[From GIT]: Installation of the development release. . link:basics_upgrade.html[Upgrading Cherokee]: Upgrading from a previous release? . link:basics_running_cherokee.html[Running Cherokee]: Basic steps to run Cherokee.