[memcached] plindner,
r510: Part 1 of the Windows compatibility patc...
commits at code.sixapart.com
commits at code.sixapart.com
Mon Apr 16 21:32:19 UTC 2007
Part 1 of the Windows compatibility patch
U trunk/server/ChangeLog
U trunk/server/assoc.c
U trunk/server/items.c
U trunk/server/memcached.c
U trunk/server/memcached.h
U trunk/server/slabs.c
Modified: trunk/server/ChangeLog
===================================================================
--- trunk/server/ChangeLog 2007-04-16 15:34:03 UTC (rev 509)
+++ trunk/server/ChangeLog 2007-04-16 21:32:18 UTC (rev 510)
@@ -1,3 +1,7 @@
+2007-04-16 Paul Lindner <lindner at inuus.com>
+
+ * Windows Patch integration -- part 1, warnings elimination.
+
2007-04-12 Paul Lindner <lindner at mirth.inuus.com>
* Allow changes to the verbosity level of the server with a new
Modified: trunk/server/assoc.c
===================================================================
--- trunk/server/assoc.c 2007-04-16 15:34:03 UTC (rev 509)
+++ trunk/server/assoc.c 2007-04-16 21:32:18 UTC (rev 510)
@@ -19,11 +19,12 @@
#include <sys/signal.h>
#include <sys/resource.h>
#include <fcntl.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
-#include <errno.h>
#include <assert.h>
/*
Modified: trunk/server/items.c
===================================================================
--- trunk/server/items.c 2007-04-16 15:34:03 UTC (rev 509)
+++ trunk/server/items.c 2007-04-16 21:32:18 UTC (rev 510)
@@ -6,11 +6,12 @@
#include <sys/signal.h>
#include <sys/resource.h>
#include <fcntl.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
-#include <errno.h>
#include <time.h>
#include <assert.h>
@@ -310,7 +311,7 @@
}
for (i = 0; i < LARGEST_ID; i++) {
- if (tails[i])
+ if (tails[i] != NULL)
bufcurr += snprintf(bufcurr, (size_t)buflen, "STAT items:%d:number %u\r\nSTAT items:%d:age %u\r\n",
i, sizes[i], i, now - tails[i]->time);
}
Modified: trunk/server/memcached.c
===================================================================
--- trunk/server/memcached.c 2007-04-16 15:34:03 UTC (rev 509)
+++ trunk/server/memcached.c 2007-04-16 21:32:18 UTC (rev 510)
@@ -12,7 +12,7 @@
* Authors:
* Anatoly Vorobey <mellon at pobox.com>
* Brad Fitzpatrick <brad at danga.com>
- *
+std *
* $Id$
*/
#include "memcached.h"
@@ -35,13 +35,13 @@
#include <pwd.h>
#include <sys/mman.h>
#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
#include <time.h>
#include <assert.h>
#include <limits.h>
@@ -168,7 +168,7 @@
static void settings_init(void) {
settings.port = 11211;
settings.udpport = 0;
- settings.interface.s_addr = htonl(INADDR_ANY);
+ settings.interf.s_addr = htonl(INADDR_ANY);
settings.maxbytes = 67108864; /* default is 64MB: (64 * 1024 * 1024) */
settings.maxconns = 1024; /* to limit connections-related memory to about 5MB */
settings.verbose = 0;
@@ -894,7 +894,7 @@
pos += sprintf(pos, "STAT evictions %llu\r\n", stats.evictions);
pos += sprintf(pos, "STAT bytes_read %llu\r\n", stats.bytes_read);
pos += sprintf(pos, "STAT bytes_written %llu\r\n", stats.bytes_written);
- pos += sprintf(pos, "STAT limit_maxbytes %llu\r\n", (unsigned long long)settings.maxbytes);
+ pos += sprintf(pos, "STAT limit_maxbytes %llu\r\n", (uint64_t) settings.maxbytes);
pos += sprintf(pos, "STAT threads %u\r\n", settings.num_threads);
pos += sprintf(pos, "END");
STATS_UNLOCK();
@@ -2122,7 +2122,7 @@
while (min <= max) {
avg = ((unsigned int)(min + max)) / 2;
- if (setsockopt(sfd, SOL_SOCKET, SO_SNDBUF, &avg, intsize) == 0) {
+ if (setsockopt(sfd, SOL_SOCKET, SO_SNDBUF, (void *)&avg, intsize) == 0) {
last_good = avg;
min = avg + 1;
} else {
@@ -2145,13 +2145,13 @@
return -1;
}
- setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void *)&flags, sizeof(flags));
if (is_udp) {
maximize_sndbuf(sfd);
} else {
- setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags));
- setsockopt(sfd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
- setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
+ setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags));
}
/*
@@ -2162,7 +2162,7 @@
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
- addr.sin_addr = settings.interface;
+ addr.sin_addr = settings.interf;
if (bind(sfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
perror("bind()");
close(sfd);
@@ -2217,9 +2217,9 @@
unlink(path);
}
- setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
- setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags));
- setsockopt(sfd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
+ setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void *)&flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
/*
* the memset call clears nonstandard fields in some impementations
@@ -2468,10 +2468,10 @@
bool daemonize = false;
int maxcore = 0;
char *username = NULL;
+ char *pid_file = NULL;
struct passwd *pw;
struct sigaction sa;
struct rlimit rlim;
- char *pid_file = NULL;
/* handle SIGINT */
signal(SIGINT, sig_handler);
@@ -2523,7 +2523,7 @@
fprintf(stderr, "Illegal address: %s\n", optarg);
return 1;
} else {
- settings.interface = addr;
+ settings.interf = addr;
}
break;
case 'd':
Modified: trunk/server/memcached.h
===================================================================
--- trunk/server/memcached.h 2007-04-16 15:34:03 UTC (rev 509)
+++ trunk/server/memcached.h 2007-04-16 21:32:18 UTC (rev 510)
@@ -1,5 +1,6 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* $Id$ */
+
#include "config.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -46,18 +47,18 @@
struct stats {
unsigned int curr_items;
unsigned int total_items;
- unsigned long long curr_bytes;
+ uint64_t curr_bytes;
unsigned int curr_conns;
unsigned int total_conns;
unsigned int conn_structs;
- unsigned long long get_cmds;
- unsigned long long set_cmds;
- unsigned long long get_hits;
- unsigned long long get_misses;
- unsigned long long evictions;
+ uint64_t get_cmds;
+ uint64_t set_cmds;
+ uint64_t get_hits;
+ uint64_t get_misses;
+ uint64_t evictions;
time_t started; /* when the process was started */
- unsigned long long bytes_read;
- unsigned long long bytes_written;
+ uint64_t bytes_read;
+ uint64_t bytes_written;
};
#define MAX_VERBOSITY_LEVEL 2
@@ -67,7 +68,7 @@
int maxconns;
int port;
int udpport;
- struct in_addr interface;
+ struct in_addr interf;
int verbose;
rel_time_t oldest_live; /* ignore existing items older than this */
bool managed; /* if 1, a tracker manages virtual buckets */
Modified: trunk/server/slabs.c
===================================================================
--- trunk/server/slabs.c 2007-04-16 15:34:03 UTC (rev 509)
+++ trunk/server/slabs.c 2007-04-16 21:32:18 UTC (rev 510)
@@ -15,11 +15,12 @@
#include <sys/signal.h>
#include <sys/resource.h>
#include <fcntl.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
-#include <errno.h>
#include <assert.h>
#include <stdbool.h>
@@ -337,9 +338,9 @@
if (p->killing == 0) p->killing = 1;
slab = p->slab_list[p->killing - 1];
- slab_end = slab + POWER_BLOCK;
+ slab_end = (char*)slab + POWER_BLOCK;
- for (iter = slab; iter < slab_end; iter += p->size) {
+ for (iter = slab; iter < slab_end; (char*)iter += p->size) {
item *it = (item *)iter;
if (it->slabs_clsid) {
if (it->refcount) was_busy = true;
@@ -369,7 +370,7 @@
dp->end_page_free = dp->perslab;
/* this isn't too critical, but other parts of the code do asserts to
make sure this field is always 0. */
- for (iter = slab; iter < slab_end; iter += dp->size) {
+ for (iter = slab; iter < slab_end; (char*)iter += dp->size) {
((item *)iter)->slabs_clsid = 0;
}
return 1;
More information about the memcached-commits
mailing list