Changeset 555
- Timestamp:
- 05/08/07 00:20:20 (2 years ago)
- Files:
-
- branches/memcached-win32/server/Win32-Code (added)
- branches/memcached-win32/server/Win32-Code/config.h (added)
- branches/memcached-win32/server/Win32-Code/ntservice.c (added)
- branches/memcached-win32/server/Win32-Code/ntservice.h (added)
- branches/memcached-win32/server/Win32-Code/win32.c (added)
- branches/memcached-win32/server/Win32-Code/win32.h (added)
- branches/memcached-win32/server/Win32-Prj (added)
- branches/memcached-win32/server/Win32-Prj/memcached.rc (added)
- branches/memcached-win32/server/Win32-Prj/memcached.sln (added)
- branches/memcached-win32/server/Win32-Prj/memcached.vcproj (added)
- branches/memcached-win32/server/assoc.c (modified) (2 diffs)
- branches/memcached-win32/server/compat (added)
- branches/memcached-win32/server/compat/bsd_getopt.c (added)
- branches/memcached-win32/server/compat/bsd_getopt.h (added)
- branches/memcached-win32/server/items.c (modified) (1 diff)
- branches/memcached-win32/server/memcached.c (modified) (16 diffs)
- branches/memcached-win32/server/memcached.h (modified) (2 diffs)
- branches/memcached-win32/server/slabs.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/memcached-win32/server/assoc.c
r551 r555 15 15 16 16 #include "memcached.h" 17 17 18 #include <sys/stat.h> 18 19 #include <sys/socket.h> 20 21 #ifndef WIN32 19 22 #include <sys/signal.h> 20 23 #include <sys/resource.h> … … 22 25 #include <netinet/in.h> 23 26 #include <errno.h> 27 #else /* !WIN32 */ 28 #include "Win32-Code/config.h" 29 #include <Winsock2.h> 30 #endif /* WIN32 */ 31 24 32 #include <stdlib.h> 25 33 #include <stdio.h> branches/memcached-win32/server/items.c
r551 r555 9 9 #include <netinet/in.h> 10 10 #include <errno.h> 11 #else /* !WIN32 */ 12 #include <Winsock2.h> 13 #endif /* WIN32 */ 11 14 #include <stdlib.h> 12 15 #include <stdio.h> branches/memcached-win32/server/memcached.c
r552 r555 18 18 #include "memcached.h" 19 19 #include <sys/stat.h> 20 21 #ifndef WIN32 20 22 #include <sys/socket.h> 21 23 #include <sys/un.h> … … 39 41 #include <arpa/inet.h> 40 42 #include <errno.h> 43 #else /* !WIN32 */ 44 #include "Win32-Code/config.h" 45 #include <Winsock2.h> 46 #include <process.h> 47 #include "Win32-Code/ntservice.h" 48 #include "compat/bsd_getopt.h" 49 #endif /* WIN32 */ 41 50 #include <stdlib.h> 42 51 #include <stdio.h> … … 854 863 return; 855 864 } 865 #endif /* !WIN32 */ 856 866 857 867 command = tokens[COMMAND_TOKEN].value; … … 2192 2202 } 2193 2203 2204 #ifndef WIN32 2194 2205 static int server_socket_unix(const char *path) { 2195 2206 int sfd; … … 2239 2250 return sfd; 2240 2251 } 2252 #endif /* WIN32 */ 2253 2241 2254 2242 2255 /* listening socket */ … … 2248 2261 /* invoke right before gdb is called, on assert */ 2249 2262 void pre_gdb(void) { 2263 #ifndef WIN32 2250 2264 int i; 2251 2265 if (l_socket > -1) close(l_socket); … … 2253 2267 for (i = 3; i <= 500; i++) close(i); /* so lame */ 2254 2268 kill(getpid(), SIGABRT); 2269 #endif 2255 2270 } 2256 2271 … … 2334 2349 "-s <file> unix socket path to listen on (disables network support)\n" 2335 2350 "-l <ip_addr> interface to listen on, default is INDRR_ANY\n" 2351 #ifndef WIN32 2336 2352 "-d run as a daemon\n" 2353 #else /* !WIN32 */ 2354 "-d start tell memcached to start\n" 2355 "-d restart tell running memcached to do a graceful restart\n" 2356 "-d stop|shutdown tell running memcached to shutdown\n" 2357 "-d install install memcached service\n" 2358 "-d uninstall uninstall memcached service\n" 2359 #endif /* WIN32 */ 2337 2360 "-r maximize core file limit\n" 2338 2361 "-u <username> assume identity of <username> (only when run as root)\n" … … 2421 2444 "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" 2422 2445 "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" 2446 #ifdef WIN32 2447 "This product includes software developed by the NetBSD\n" 2448 "Foundation, Inc. and its contributors.\n" 2449 "\n" 2450 "[ bsd_getopts ]\n" 2451 "\n" 2452 "Copyright (c) 2000 The NetBSD Foundation, Inc.\n" 2453 "All rights reserved.\n" 2454 "\n" 2455 "This code is derived from software contributed to The NetBSD Foundation\n" 2456 "by Dieter Baron and Thomas Klausner.\n" 2457 "\n" 2458 "Redistribution and use in source and binary forms, with or without\n" 2459 "modification, are permitted provided that the following conditions\n" 2460 "are met:\n" 2461 "1. Redistributions of source code must retain the above copyright\n" 2462 " notice, this list of conditions and the following disclaimer.\n" 2463 "2. Redistributions in binary form must reproduce the above copyright\n" 2464 " notice, this list of conditions and the following disclaimer in the\n" 2465 " documentation and/or other materials provided with the distribution.\n" 2466 "3. All advertising materials mentioning features or use of this software\n" 2467 " must display the following acknowledgement:\n" 2468 " This product includes software developed by the NetBSD\n" 2469 " Foundation, Inc. and its contributors.\n" 2470 "4. Neither the name of The NetBSD Foundation nor the names of its\n" 2471 " contributors may be used to endorse or promote products derived\n" 2472 " from this software without specific prior written permission.\n" 2473 "\n" 2474 "THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n" 2475 "``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n" 2476 "TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" 2477 "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n" 2478 "BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" 2479 "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n" 2480 "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n" 2481 "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n" 2482 "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n" 2483 "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n" 2484 "POSSIBILITY OF SUCH DAMAGE.\n" 2485 "\n" 2486 "\n" 2487 "Win32 port by Kronuz\n" 2488 "This product includes software developed by Kronuz.\n" 2489 "\n" 2490 "[ ntservice ]\n" 2491 "\n" 2492 "Copyright (c) 2006 Germán Méndez Bravo (Kronuz) <kronuz@users.sf.net>\n" 2493 "All rights reserved.\n" 2494 "\n" 2495 "Redistribution and use in source and binary forms, with or without\n" 2496 "modification, are permitted provided that the following conditions\n" 2497 "are met:\n" 2498 "1. Redistributions of source code must retain the above copyright\n" 2499 " notice, this list of conditions and the following disclaimer.\n" 2500 "2. Redistributions in binary form must reproduce the above copyright\n" 2501 " notice, this list of conditions and the following disclaimer in the\n" 2502 " documentation and/or other materials provided with the distribution.\n" 2503 "3. All advertising materials mentioning features or use of this software\n" 2504 " must display the following acknowledgement:\n" 2505 " This product includes software developed by Kronuz.\n" 2506 "4. The name of the author may not be used to endorse or promote products\n" 2507 " derived from this software without specific prior written permission.\n" 2508 "\n" 2509 "THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" 2510 "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" 2511 "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" 2512 "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" 2513 "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" 2514 "NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" 2515 "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" 2516 "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" 2517 "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" 2518 "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" 2519 #endif /* WIN32 */ 2423 2520 ); 2424 2521 … … 2467 2564 char *username = NULL; 2468 2565 char *pid_file = NULL; 2566 2567 #ifndef WIN32 2469 2568 struct passwd *pw; 2470 2569 struct sigaction sa; … … 2473 2572 /* handle SIGINT */ 2474 2573 signal(SIGINT, sig_handler); 2574 #else /* !WIN32 */ 2575 WSADATA wsaData; 2576 if(WSAStartup(MAKEWORD(2,0), &wsaData) != 0) { 2577 fprintf(stderr, "Socket Initialization Error. Program aborted\n"); 2578 return; 2579 } 2580 #endif /* WIN32 */ 2475 2581 2476 2582 /* init settings */ … … 2596 2702 } 2597 2703 } 2704 #endif /* !WIN32 */ 2598 2705 2599 2706 /* … … 2642 2749 } 2643 2750 2751 #ifndef WIN32 2644 2752 /* lose root privileges if we have them */ 2645 2753 if (getuid() == 0 || geteuid() == 0) { … … 2666 2774 } 2667 2775 } 2668 2776 #endif /* !WIN32 */ 2777 2778 #ifndef WIN32 2669 2779 /* daemonize if requested */ 2670 2780 /* if we want to ensure our ability to dump core, don't chdir to / */ … … 2707 2817 } 2708 2818 2819 #ifndef WIN32 2709 2820 /* 2710 2821 * ignore SIGPIPE signals; we can use errno==EPIPE if we … … 2718 2829 exit(EXIT_FAILURE); 2719 2830 } 2831 #endif /* !WIN32 */ 2720 2832 /* create the initial listening connection */ 2721 2833 if (!(listen_conn = conn_new(l_socket, conn_listening, branches/memcached-win32/server/memcached.h
r552 r555 2 2 /* $Id$ */ 3 3 4 5 6 #ifndef WIN32 4 7 #include "config.h" 5 8 #include <sys/types.h> … … 8 11 #include <netinet/in.h> 9 12 #include <event.h> 13 14 #else 15 #include "Win32-Code/win32.h" 16 #endif /* WIN32 */ 10 17 11 18 #define DATA_BUFFER_SIZE 2048 branches/memcached-win32/server/slabs.c
r551 r555 12 12 #include "memcached.h" 13 13 #include <sys/stat.h> 14 15 #ifndef WIN32 14 16 #include <sys/socket.h> 15 17 #include <sys/signal.h> … … 18 20 #include <netinet/in.h> 19 21 #include <errno.h> 22 #else /* !WIN32 */ 23 #include <Winsock2.h> 24 #endif /* WIN32 */ 20 25 #include <stdlib.h> 21 26 #include <stdio.h>
