]> git.pld-linux.org Git - packages/memcached.git/blame - repcached.patch
- raw from http://mdounin.ru/files/repcached-2.2-1.4.4.patch.gz
[packages/memcached.git] / repcached.patch
CommitLineData
894d11c1
ER
1diff -urN --exclude *.m4 memcached-1.4.4/Makefile.am repcached-2.2-1.4.4/Makefile.am
2--- memcached-1.4.4/Makefile.am Fri Oct 30 04:24:52 2009
3+++ repcached-2.2-1.4.4/Makefile.am Tue Feb 9 23:02:45 2010
4@@ -31,6 +31,10 @@
5 memcached_SOURCES += sasl_defs.c
6 endif
7
8+if ENABLE_REPLICATION
9+memcached_SOURCES += replication.h replication.c
10+endif
11+
12 memcached_debug_SOURCES = $(memcached_SOURCES)
13 memcached_CPPFLAGS = -DNDEBUG
14 memcached_debug_LDADD = @PROFILER_LDFLAGS@
15diff -urN --exclude *.m4 memcached-1.4.4/Makefile.in repcached-2.2-1.4.4/Makefile.in
16--- memcached-1.4.4/Makefile.in Fri Nov 27 09:34:57 2009
17+++ repcached-2.2-1.4.4/Makefile.in Wed Feb 10 19:12:15 2010
18@@ -41,13 +41,14 @@
19 @BUILD_CACHE_TRUE@am__append_2 = cache.c
20 @BUILD_SOLARIS_PRIVS_TRUE@am__append_3 = solaris_priv.c
21 @ENABLE_SASL_TRUE@am__append_4 = sasl_defs.c
22-@BUILD_DTRACE_TRUE@am__append_5 = memcached_dtrace.h
23+@ENABLE_REPLICATION_TRUE@am__append_5 = replication.h replication.c
24 @BUILD_DTRACE_TRUE@am__append_6 = memcached_dtrace.h
25-@DTRACE_INSTRUMENT_OBJ_TRUE@am__append_7 = memcached_dtrace.o
26+@BUILD_DTRACE_TRUE@am__append_7 = memcached_dtrace.h
27 @DTRACE_INSTRUMENT_OBJ_TRUE@am__append_8 = memcached_dtrace.o
28-@DTRACE_INSTRUMENT_OBJ_TRUE@am__append_9 = memcached_debug_dtrace.o
29+@DTRACE_INSTRUMENT_OBJ_TRUE@am__append_9 = memcached_dtrace.o
30 @DTRACE_INSTRUMENT_OBJ_TRUE@am__append_10 = memcached_debug_dtrace.o
31-@DTRACE_INSTRUMENT_OBJ_TRUE@am__append_11 = memcached_dtrace.o memcached_debug_dtrace.o
32+@DTRACE_INSTRUMENT_OBJ_TRUE@am__append_11 = memcached_debug_dtrace.o
33+@DTRACE_INSTRUMENT_OBJ_TRUE@am__append_12 = memcached_dtrace.o memcached_debug_dtrace.o
34 subdir = .
35 DIST_COMMON = README $(am__configure_deps) $(pkginclude_HEADERS) \
36 $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
37@@ -70,34 +71,41 @@
38 am__memcached_SOURCES_DIST = memcached.c memcached.h hash.c hash.h \
39 slabs.c slabs.h items.c items.h assoc.c assoc.h thread.c \
40 daemon.c stats.c stats.h util.c util.h trace.h cache.h \
41- sasl_defs.h cache.c solaris_priv.c sasl_defs.c
42+ sasl_defs.h cache.c solaris_priv.c sasl_defs.c replication.h \
43+ replication.c
44 @BUILD_CACHE_TRUE@am__objects_1 = memcached-cache.$(OBJEXT)
45 @BUILD_SOLARIS_PRIVS_TRUE@am__objects_2 = \
46 @BUILD_SOLARIS_PRIVS_TRUE@ memcached-solaris_priv.$(OBJEXT)
47 @ENABLE_SASL_TRUE@am__objects_3 = memcached-sasl_defs.$(OBJEXT)
48+@ENABLE_REPLICATION_TRUE@am__objects_4 = \
49+@ENABLE_REPLICATION_TRUE@ memcached-replication.$(OBJEXT)
50 am_memcached_OBJECTS = memcached-memcached.$(OBJEXT) \
51 memcached-hash.$(OBJEXT) memcached-slabs.$(OBJEXT) \
52 memcached-items.$(OBJEXT) memcached-assoc.$(OBJEXT) \
53 memcached-thread.$(OBJEXT) memcached-daemon.$(OBJEXT) \
54 memcached-stats.$(OBJEXT) memcached-util.$(OBJEXT) \
55- $(am__objects_1) $(am__objects_2) $(am__objects_3)
56+ $(am__objects_1) $(am__objects_2) $(am__objects_3) \
57+ $(am__objects_4)
58 memcached_OBJECTS = $(am_memcached_OBJECTS)
59 am__memcached_debug_SOURCES_DIST = memcached.c memcached.h hash.c \
60 hash.h slabs.c slabs.h items.c items.h assoc.c assoc.h \
61 thread.c daemon.c stats.c stats.h util.c util.h trace.h \
62- cache.h sasl_defs.h cache.c solaris_priv.c sasl_defs.c
63-@BUILD_CACHE_TRUE@am__objects_4 = memcached_debug-cache.$(OBJEXT)
64-@BUILD_SOLARIS_PRIVS_TRUE@am__objects_5 = memcached_debug-solaris_priv.$(OBJEXT)
65-@ENABLE_SASL_TRUE@am__objects_6 = memcached_debug-sasl_defs.$(OBJEXT)
66-am__objects_7 = memcached_debug-memcached.$(OBJEXT) \
67+ cache.h sasl_defs.h cache.c solaris_priv.c sasl_defs.c \
68+ replication.h replication.c
69+@BUILD_CACHE_TRUE@am__objects_5 = memcached_debug-cache.$(OBJEXT)
70+@BUILD_SOLARIS_PRIVS_TRUE@am__objects_6 = memcached_debug-solaris_priv.$(OBJEXT)
71+@ENABLE_SASL_TRUE@am__objects_7 = memcached_debug-sasl_defs.$(OBJEXT)
72+@ENABLE_REPLICATION_TRUE@am__objects_8 = memcached_debug-replication.$(OBJEXT)
73+am__objects_9 = memcached_debug-memcached.$(OBJEXT) \
74 memcached_debug-hash.$(OBJEXT) memcached_debug-slabs.$(OBJEXT) \
75 memcached_debug-items.$(OBJEXT) \
76 memcached_debug-assoc.$(OBJEXT) \
77 memcached_debug-thread.$(OBJEXT) \
78 memcached_debug-daemon.$(OBJEXT) \
79 memcached_debug-stats.$(OBJEXT) memcached_debug-util.$(OBJEXT) \
80- $(am__objects_4) $(am__objects_5) $(am__objects_6)
81-am_memcached_debug_OBJECTS = $(am__objects_7)
82+ $(am__objects_5) $(am__objects_6) $(am__objects_7) \
83+ $(am__objects_8)
84+am_memcached_debug_OBJECTS = $(am__objects_9)
85 memcached_debug_OBJECTS = $(am_memcached_debug_OBJECTS)
86 memcached_debug_LINK = $(CCLD) $(memcached_debug_CFLAGS) $(CFLAGS) \
87 $(AM_LDFLAGS) $(LDFLAGS) -o $@
88@@ -105,8 +113,9 @@
89 sizes_OBJECTS = sizes.$(OBJEXT)
90 sizes_LDADD = $(LDADD)
91 am__testapp_SOURCES_DIST = testapp.c util.c util.h cache.c
92-@BUILD_CACHE_TRUE@am__objects_8 = cache.$(OBJEXT)
93-am_testapp_OBJECTS = testapp.$(OBJEXT) util.$(OBJEXT) $(am__objects_8)
94+@BUILD_CACHE_TRUE@am__objects_10 = cache.$(OBJEXT)
95+am_testapp_OBJECTS = testapp.$(OBJEXT) util.$(OBJEXT) \
96+ $(am__objects_10)
97 testapp_OBJECTS = $(am_testapp_OBJECTS)
98 testapp_LDADD = $(LDADD)
99 am_timedrun_OBJECTS = timedrun.$(OBJEXT)
100@@ -261,21 +270,22 @@
101 top_builddir = @top_builddir@
102 top_srcdir = @top_srcdir@
103 pkginclude_HEADERS = protocol_binary.h
104-BUILT_SOURCES = $(am__append_5)
105+BUILT_SOURCES = $(am__append_6)
106 testapp_SOURCES = testapp.c util.c util.h $(am__append_2)
107 timedrun_SOURCES = timedrun.c
108 memcached_SOURCES = memcached.c memcached.h hash.c hash.h slabs.c \
109 slabs.h items.c items.h assoc.c assoc.h thread.c daemon.c \
110 stats.c stats.h util.c util.h trace.h cache.h sasl_defs.h \
111- $(am__append_1) $(am__append_3) $(am__append_4)
112+ $(am__append_1) $(am__append_3) $(am__append_4) \
113+ $(am__append_5)
114 memcached_debug_SOURCES = $(memcached_SOURCES)
115 memcached_CPPFLAGS = -DNDEBUG
116-memcached_debug_LDADD = @PROFILER_LDFLAGS@ $(am__append_9)
117+memcached_debug_LDADD = @PROFILER_LDFLAGS@ $(am__append_10)
118 memcached_debug_CFLAGS = @PROFILER_FLAGS@
119-memcached_LDADD = $(am__append_7)
120-memcached_DEPENDENCIES = $(am__append_8)
121-memcached_debug_DEPENDENCIES = $(am__append_10)
122-CLEANFILES = $(am__append_6) $(am__append_11)
123+memcached_LDADD = $(am__append_8)
124+memcached_DEPENDENCIES = $(am__append_9)
125+memcached_debug_DEPENDENCIES = $(am__append_11)
126+CLEANFILES = $(am__append_7) $(am__append_12)
127 SUBDIRS = doc
128 DIST_DIRS = scripts
129 EXTRA_DIST = doc scripts t memcached.spec memcached_dtrace.d version.m4
130@@ -390,6 +400,7 @@
131 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-hash.Po@am__quote@
132 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-items.Po@am__quote@
133 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-memcached.Po@am__quote@
134+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-replication.Po@am__quote@
135 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-sasl_defs.Po@am__quote@
136 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-slabs.Po@am__quote@
137 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached-solaris_priv.Po@am__quote@
138@@ -402,6 +413,7 @@
139 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-hash.Po@am__quote@
140 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-items.Po@am__quote@
141 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-memcached.Po@am__quote@
142+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-replication.Po@am__quote@
143 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-sasl_defs.Po@am__quote@
144 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-slabs.Po@am__quote@
145 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_debug-solaris_priv.Po@am__quote@
146@@ -595,6 +607,20 @@
147 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
148 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(memcached_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memcached-sasl_defs.obj `if test -f 'sasl_defs.c'; then $(CYGPATH_W) 'sasl_defs.c'; else $(CYGPATH_W) '$(srcdir)/sasl_defs.c'; fi`
149
150+memcached-replication.o: replication.c
151+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(memcached_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT memcached-replication.o -MD -MP -MF $(DEPDIR)/memcached-replication.Tpo -c -o memcached-replication.o `test -f 'replication.c' || echo '$(srcdir)/'`replication.c
152+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/memcached-replication.Tpo $(DEPDIR)/memcached-replication.Po
153+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='replication.c' object='memcached-replication.o' libtool=no @AMDEPBACKSLASH@
154+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
155+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(memcached_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memcached-replication.o `test -f 'replication.c' || echo '$(srcdir)/'`replication.c
156+
157+memcached-replication.obj: replication.c
158+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(memcached_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT memcached-replication.obj -MD -MP -MF $(DEPDIR)/memcached-replication.Tpo -c -o memcached-replication.obj `if test -f 'replication.c'; then $(CYGPATH_W) 'replication.c'; else $(CYGPATH_W) '$(srcdir)/replication.c'; fi`
159+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/memcached-replication.Tpo $(DEPDIR)/memcached-replication.Po
160+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='replication.c' object='memcached-replication.obj' libtool=no @AMDEPBACKSLASH@
161+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
162+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(memcached_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memcached-replication.obj `if test -f 'replication.c'; then $(CYGPATH_W) 'replication.c'; else $(CYGPATH_W) '$(srcdir)/replication.c'; fi`
163+
164 memcached_debug-memcached.o: memcached.c
165 @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_debug_CFLAGS) $(CFLAGS) -MT memcached_debug-memcached.o -MD -MP -MF $(DEPDIR)/memcached_debug-memcached.Tpo -c -o memcached_debug-memcached.o `test -f 'memcached.c' || echo '$(srcdir)/'`memcached.c
166 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/memcached_debug-memcached.Tpo $(DEPDIR)/memcached_debug-memcached.Po
167@@ -762,6 +788,20 @@
168 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sasl_defs.c' object='memcached_debug-sasl_defs.obj' libtool=no @AMDEPBACKSLASH@
169 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
170 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_debug_CFLAGS) $(CFLAGS) -c -o memcached_debug-sasl_defs.obj `if test -f 'sasl_defs.c'; then $(CYGPATH_W) 'sasl_defs.c'; else $(CYGPATH_W) '$(srcdir)/sasl_defs.c'; fi`
171+
172+memcached_debug-replication.o: replication.c
173+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_debug_CFLAGS) $(CFLAGS) -MT memcached_debug-replication.o -MD -MP -MF $(DEPDIR)/memcached_debug-replication.Tpo -c -o memcached_debug-replication.o `test -f 'replication.c' || echo '$(srcdir)/'`replication.c
174+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/memcached_debug-replication.Tpo $(DEPDIR)/memcached_debug-replication.Po
175+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='replication.c' object='memcached_debug-replication.o' libtool=no @AMDEPBACKSLASH@
176+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
177+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_debug_CFLAGS) $(CFLAGS) -c -o memcached_debug-replication.o `test -f 'replication.c' || echo '$(srcdir)/'`replication.c
178+
179+memcached_debug-replication.obj: replication.c
180+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_debug_CFLAGS) $(CFLAGS) -MT memcached_debug-replication.obj -MD -MP -MF $(DEPDIR)/memcached_debug-replication.Tpo -c -o memcached_debug-replication.obj `if test -f 'replication.c'; then $(CYGPATH_W) 'replication.c'; else $(CYGPATH_W) '$(srcdir)/replication.c'; fi`
181+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/memcached_debug-replication.Tpo $(DEPDIR)/memcached_debug-replication.Po
182+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='replication.c' object='memcached_debug-replication.obj' libtool=no @AMDEPBACKSLASH@
183+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
184+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_debug_CFLAGS) $(CFLAGS) -c -o memcached_debug-replication.obj `if test -f 'replication.c'; then $(CYGPATH_W) 'replication.c'; else $(CYGPATH_W) '$(srcdir)/replication.c'; fi`
185 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
186 @$(NORMAL_INSTALL)
187 test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
188diff -urN --exclude *.m4 memcached-1.4.4/assoc.c repcached-2.2-1.4.4/assoc.c
189--- memcached-1.4.4/assoc.c Sat Oct 24 00:38:01 2009
190+++ repcached-2.2-1.4.4/assoc.c Tue Feb 9 23:02:45 2010
191@@ -258,3 +258,51 @@
192 }
193
194
195+#ifdef USE_REPLICATION
196+char *assoc_key_snap(int *n)
197+{
198+ char *p = NULL;
199+ char *b = NULL;
200+ item *i = NULL;
201+ int co = 0;
202+ int sz = 1;
203+ int hs = 0;
204+ int hm = hashsize(hashpower);
205+
206+ hs = hm;
207+ while(hs--){
208+ if(expanding && hs < hashsize(hashpower - 1) && hs >= expand_bucket){
209+ i = old_hashtable[hs];
210+ }else{
211+ i = primary_hashtable[hs];
212+ }
213+ while(i){
214+ sz += i->nkey + 1;
215+ co++;
216+ i = i->h_next;
217+ }
218+ }
219+
220+ if(co){
221+ if((p = b = malloc(sz))){
222+ hs = hm;
223+ while(hs--){
224+ if(expanding && hs < hashsize(hashpower - 1) && hs >= expand_bucket){
225+ i = old_hashtable[hs];
226+ }else{
227+ i = primary_hashtable[hs];
228+ }
229+ while(i){
230+ memcpy(p, ITEM_key(i), i->nkey);
231+ p += i->nkey;
232+ *(p++) = 0;
233+ i = i->h_next;
234+ }
235+ }
236+ *(p++) = 0;
237+ }
238+ }
239+ if(n) *n = co;
240+ return(b);
241+}
242+#endif /* USE_REPLICATION */
243diff -urN --exclude *.m4 memcached-1.4.4/assoc.h repcached-2.2-1.4.4/assoc.h
244--- memcached-1.4.4/assoc.h Sun Aug 30 03:00:58 2009
245+++ repcached-2.2-1.4.4/assoc.h Tue Feb 9 23:02:45 2010
246@@ -7,3 +7,6 @@
247 int start_assoc_maintenance_thread(void);
248 void stop_assoc_maintenance_thread(void);
249
250+#ifdef USE_REPLICATION
251+char *assoc_key_snap(int *n);
252+#endif /*USE_REPLICATION*/
253diff -urN --exclude *.m4 memcached-1.4.4/config.guess repcached-2.2-1.4.4/config.guess
254--- memcached-1.4.4/config.guess Sat Aug 22 04:38:32 2009
255+++ repcached-2.2-1.4.4/config.guess Tue Jan 19 12:34:08 2010
256@@ -1,10 +1,9 @@
257 #! /bin/sh
258 # Attempt to guess a canonical system name.
259 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
260-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
261-# Free Software Foundation, Inc.
262+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
263
264-timestamp='2008-09-28'
265+timestamp='2003-07-02'
266
267 # This file is free software; you can redistribute it and/or modify it
268 # under the terms of the GNU General Public License as published by
269@@ -18,15 +17,13 @@
270 #
271 # You should have received a copy of the GNU General Public License
272 # along with this program; if not, write to the Free Software
273-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
274-# 02110-1301, USA.
275+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
276 #
277 # As a special exception to the GNU General Public License, if you
278 # distribute this file as part of a program that contains a
279 # configuration script generated by Autoconf, you may include it under
280 # the same distribution terms that you use for the rest of that program.
281
282-
283 # Originally written by Per Bothner <per@bothner.com>.
284 # Please send patches to <config-patches@gnu.org>. Submit a context
285 # diff and a properly formatted ChangeLog entry.
286@@ -56,8 +53,8 @@
287 GNU config.guess ($timestamp)
288
289 Originally written by Per Bothner.
290-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
291-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
292+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
293+Free Software Foundation, Inc.
294
295 This is free software; see the source for copying conditions. There is NO
296 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
297@@ -69,11 +66,11 @@
298 while test $# -gt 0 ; do
299 case $1 in
300 --time-stamp | --time* | -t )
301- echo "$timestamp" ; exit ;;
302+ echo "$timestamp" ; exit 0 ;;
303 --version | -v )
304- echo "$version" ; exit ;;
305+ echo "$version" ; exit 0 ;;
306 --help | --h* | -h )
307- echo "$usage"; exit ;;
308+ echo "$usage"; exit 0 ;;
309 -- ) # Stop option processing
310 shift; break ;;
311 - ) # Use stdin as input.
312@@ -107,7 +104,7 @@
313 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
314 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
315 : ${TMPDIR=/tmp} ;
316- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
317+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
318 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
319 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
320 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
321@@ -126,7 +123,7 @@
322 ;;
323 ,,*) CC_FOR_BUILD=$CC ;;
324 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
325-esac ; set_cc_for_build= ;'
326+esac ;'
327
328 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
329 # (ghazi@noc.rutgers.edu 1994-08-24)
330@@ -139,23 +136,6 @@
331 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
332 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
333
334-if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
335- eval $set_cc_for_build
336- cat << EOF > $dummy.c
337- #include <features.h>
338- #ifdef __UCLIBC__
339- # ifdef __UCLIBC_CONFIG_VERSION__
340- LIBC=uclibc __UCLIBC_CONFIG_VERSION__
341- # else
342- LIBC=uclibc
343- # endif
344- #else
345- LIBC=gnu
346- #endif
347-EOF
348- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
349-fi
350-
351 # Note: order is significant - the case branches are not exclusive.
352
353 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
354@@ -178,7 +158,6 @@
355 arm*) machine=arm-unknown ;;
356 sh3el) machine=shl-unknown ;;
357 sh3eb) machine=sh-unknown ;;
358- sh5el) machine=sh5le-unknown ;;
359 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
360 esac
361 # The Operating System including object format, if it has switched
362@@ -217,32 +196,50 @@
363 # contains redundant information, the shorter form:
364 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
365 echo "${machine}-${os}${release}"
366- exit ;;
367+ exit 0 ;;
368+ amiga:OpenBSD:*:*)
369+ echo m68k-unknown-openbsd${UNAME_RELEASE}
370+ exit 0 ;;
371+ arc:OpenBSD:*:*)
372+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
373+ exit 0 ;;
374+ hp300:OpenBSD:*:*)
375+ echo m68k-unknown-openbsd${UNAME_RELEASE}
376+ exit 0 ;;
377+ mac68k:OpenBSD:*:*)
378+ echo m68k-unknown-openbsd${UNAME_RELEASE}
379+ exit 0 ;;
380+ macppc:OpenBSD:*:*)
381+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
382+ exit 0 ;;
383+ mvme68k:OpenBSD:*:*)
384+ echo m68k-unknown-openbsd${UNAME_RELEASE}
385+ exit 0 ;;
386+ mvme88k:OpenBSD:*:*)
387+ echo m88k-unknown-openbsd${UNAME_RELEASE}
388+ exit 0 ;;
389+ mvmeppc:OpenBSD:*:*)
390+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
391+ exit 0 ;;
392+ pmax:OpenBSD:*:*)
393+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
394+ exit 0 ;;
395+ sgi:OpenBSD:*:*)
396+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
397+ exit 0 ;;
398+ sun3:OpenBSD:*:*)
399+ echo m68k-unknown-openbsd${UNAME_RELEASE}
400+ exit 0 ;;
401+ wgrisc:OpenBSD:*:*)
402+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
403+ exit 0 ;;
404 *:OpenBSD:*:*)
405- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
406- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
407- exit ;;
408- *:ekkoBSD:*:*)
409- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
410- exit ;;
411- *:SolidBSD:*:*)
412- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
413- exit ;;
414- macppc:MirBSD:*:*)
415- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
416- exit ;;
417- *:MirBSD:*:*)
418- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
419- exit ;;
420+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
421+ exit 0 ;;
422 alpha:OSF1:*:*)
423- case $UNAME_RELEASE in
424- *4.0)
425+ if test $UNAME_RELEASE = "V4.0"; then
426 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
427- ;;
428- *5.*)
429- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
430- ;;
431- esac
432+ fi
433 # According to Compaq, /usr/sbin/psrinfo has been available on
434 # OSF/1 and Tru64 systems produced since 1995. I hope that
435 # covers most systems running today. This code pipes the CPU
436@@ -280,49 +277,42 @@
437 "EV7.9 (21364A)")
438 UNAME_MACHINE="alphaev79" ;;
439 esac
440- # A Pn.n version is a patched version.
441 # A Vn.n version is a released version.
442 # A Tn.n version is a released field test version.
443 # A Xn.n version is an unreleased experimental baselevel.
444 # 1.2 uses "1.2" for uname -r.
445- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
446- exit ;;
447+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
448+ exit 0 ;;
449+ Alpha*:OpenVMS:*:*)
450+ echo alpha-hp-vms
451+ exit 0 ;;
452 Alpha\ *:Windows_NT*:*)
453 # How do we know it's Interix rather than the generic POSIX subsystem?
454 # Should we change UNAME_MACHINE based on the output of uname instead
455 # of the specific Alpha model?
456 echo alpha-pc-interix
457- exit ;;
458+ exit 0 ;;
459 21064:Windows_NT:50:3)
460 echo alpha-dec-winnt3.5
461- exit ;;
462+ exit 0 ;;
463 Amiga*:UNIX_System_V:4.0:*)
464 echo m68k-unknown-sysv4
465- exit ;;
466+ exit 0;;
467 *:[Aa]miga[Oo][Ss]:*:*)
468 echo ${UNAME_MACHINE}-unknown-amigaos
469- exit ;;
470+ exit 0 ;;
471 *:[Mm]orph[Oo][Ss]:*:*)
472 echo ${UNAME_MACHINE}-unknown-morphos
473- exit ;;
474+ exit 0 ;;
475 *:OS/390:*:*)
476 echo i370-ibm-openedition
477- exit ;;
478- *:z/VM:*:*)
479- echo s390-ibm-zvmoe
480- exit ;;
481- *:OS400:*:*)
482- echo powerpc-ibm-os400
483- exit ;;
484+ exit 0 ;;
485 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
486 echo arm-acorn-riscix${UNAME_RELEASE}
487- exit ;;
488- arm:riscos:*:*|arm:RISCOS:*:*)
489- echo arm-unknown-riscos
490- exit ;;
491+ exit 0;;
492 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
493 echo hppa1.1-hitachi-hiuxmpp
494- exit ;;
495+ exit 0;;
496 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
497 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
498 if test "`(/bin/universe) 2>/dev/null`" = att ; then
499@@ -330,32 +320,32 @@
500 else
501 echo pyramid-pyramid-bsd
502 fi
503- exit ;;
504+ exit 0 ;;
505 NILE*:*:*:dcosx)
506 echo pyramid-pyramid-svr4
507- exit ;;
508+ exit 0 ;;
509 DRS?6000:unix:4.0:6*)
510 echo sparc-icl-nx6
511- exit ;;
512- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
513+ exit 0 ;;
514+ DRS?6000:UNIX_SV:4.2*:7*)
515 case `/usr/bin/uname -p` in
516- sparc) echo sparc-icl-nx7; exit ;;
517+ sparc) echo sparc-icl-nx7 && exit 0 ;;
518 esac ;;
519 sun4H:SunOS:5.*:*)
520 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
521- exit ;;
522+ exit 0 ;;
523 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
524 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
525- exit ;;
526- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
527+ exit 0 ;;
528+ i86pc:SunOS:5.*:*)
529 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
530- exit ;;
531+ exit 0 ;;
532 sun4*:SunOS:6*:*)
533 # According to config.sub, this is the proper way to canonicalize
534 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
535 # it's likely to be more like Solaris than SunOS4.
536 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
537- exit ;;
538+ exit 0 ;;
539 sun4*:SunOS:*:*)
540 case "`/usr/bin/arch -k`" in
541 Series*|S4*)
542@@ -364,10 +354,10 @@
543 esac
544 # Japanese Language versions have a version number like `4.1.3-JL'.
545 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
546- exit ;;
547+ exit 0 ;;
548 sun3*:SunOS:*:*)
549 echo m68k-sun-sunos${UNAME_RELEASE}
550- exit ;;
551+ exit 0 ;;
552 sun*:*:4.2BSD:*)
553 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
554 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
555@@ -379,10 +369,10 @@
556 echo sparc-sun-sunos${UNAME_RELEASE}
557 ;;
558 esac
559- exit ;;
560+ exit 0 ;;
561 aushp:SunOS:*:*)
562 echo sparc-auspex-sunos${UNAME_RELEASE}
563- exit ;;
564+ exit 0 ;;
565 # The situation for MiNT is a little confusing. The machine name
566 # can be virtually everything (everything which is not
567 # "atarist" or "atariste" at least should have a processor
568@@ -393,40 +383,37 @@
569 # be no problem.
570 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
571 echo m68k-atari-mint${UNAME_RELEASE}
572- exit ;;
573+ exit 0 ;;
574 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
575 echo m68k-atari-mint${UNAME_RELEASE}
576- exit ;;
577+ exit 0 ;;
578 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
579 echo m68k-atari-mint${UNAME_RELEASE}
580- exit ;;
581+ exit 0 ;;
582 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
583 echo m68k-milan-mint${UNAME_RELEASE}
584- exit ;;
585+ exit 0 ;;
586 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
587 echo m68k-hades-mint${UNAME_RELEASE}
588- exit ;;
589+ exit 0 ;;
590 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
591 echo m68k-unknown-mint${UNAME_RELEASE}
592- exit ;;
593- m68k:machten:*:*)
594- echo m68k-apple-machten${UNAME_RELEASE}
595- exit ;;
596+ exit 0 ;;
597 powerpc:machten:*:*)
598 echo powerpc-apple-machten${UNAME_RELEASE}
599- exit ;;
600+ exit 0 ;;
601 RISC*:Mach:*:*)
602 echo mips-dec-mach_bsd4.3
603- exit ;;
604+ exit 0 ;;
605 RISC*:ULTRIX:*:*)
606 echo mips-dec-ultrix${UNAME_RELEASE}
607- exit ;;
608+ exit 0 ;;
609 VAX*:ULTRIX*:*:*)
610 echo vax-dec-ultrix${UNAME_RELEASE}
611- exit ;;
612+ exit 0 ;;
613 2020:CLIX:*:* | 2430:CLIX:*:*)
614 echo clipper-intergraph-clix${UNAME_RELEASE}
615- exit ;;
616+ exit 0 ;;
617 mips:*:*:UMIPS | mips:*:*:RISCos)
618 eval $set_cc_for_build
619 sed 's/^ //' << EOF >$dummy.c
620@@ -450,33 +437,32 @@
621 exit (-1);
622 }
623 EOF
624- $CC_FOR_BUILD -o $dummy $dummy.c &&
625- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
626- SYSTEM_NAME=`$dummy $dummyarg` &&
627- { echo "$SYSTEM_NAME"; exit; }
628+ $CC_FOR_BUILD -o $dummy $dummy.c \
629+ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
630+ && exit 0
631 echo mips-mips-riscos${UNAME_RELEASE}
632- exit ;;
633+ exit 0 ;;
634 Motorola:PowerMAX_OS:*:*)
635 echo powerpc-motorola-powermax
636- exit ;;
637+ exit 0 ;;
638 Motorola:*:4.3:PL8-*)
639 echo powerpc-harris-powermax
640- exit ;;
641+ exit 0 ;;
642 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
643 echo powerpc-harris-powermax
644- exit ;;
645+ exit 0 ;;
646 Night_Hawk:Power_UNIX:*:*)
647 echo powerpc-harris-powerunix
648- exit ;;
649+ exit 0 ;;
650 m88k:CX/UX:7*:*)
651 echo m88k-harris-cxux7
652- exit ;;
653+ exit 0 ;;
654 m88k:*:4*:R4*)
655 echo m88k-motorola-sysv4
656- exit ;;
657+ exit 0 ;;
658 m88k:*:3*:R3*)
659 echo m88k-motorola-sysv3
660- exit ;;
661+ exit 0 ;;
662 AViiON:dgux:*:*)
663 # DG/UX returns AViiON for all architectures
664 UNAME_PROCESSOR=`/usr/bin/uname -p`
665@@ -492,29 +478,29 @@
666 else
667 echo i586-dg-dgux${UNAME_RELEASE}
668 fi
669- exit ;;
670+ exit 0 ;;
671 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
672 echo m88k-dolphin-sysv3
673- exit ;;
674+ exit 0 ;;
675 M88*:*:R3*:*)
676 # Delta 88k system running SVR3
677 echo m88k-motorola-sysv3
678- exit ;;
679+ exit 0 ;;
680 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
681 echo m88k-tektronix-sysv3
682- exit ;;
683+ exit 0 ;;
684 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
685 echo m68k-tektronix-bsd
686- exit ;;
687+ exit 0 ;;
688 *:IRIX*:*:*)
689 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
690- exit ;;
691+ exit 0 ;;
692 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
693- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
694- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
695+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
696+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
697 i*86:AIX:*:*)
698 echo i386-ibm-aix
699- exit ;;
700+ exit 0 ;;
701 ia64:AIX:*:*)
702 if [ -x /usr/bin/oslevel ] ; then
703 IBM_REV=`/usr/bin/oslevel`
704@@ -522,7 +508,7 @@
705 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
706 fi
707 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
708- exit ;;
709+ exit 0 ;;
710 *:AIX:2:3)
711 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
712 eval $set_cc_for_build
713@@ -537,19 +523,15 @@
714 exit(0);
715 }
716 EOF
717- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
718- then
719- echo "$SYSTEM_NAME"
720- else
721- echo rs6000-ibm-aix3.2.5
722- fi
723+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
724+ echo rs6000-ibm-aix3.2.5
725 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
726 echo rs6000-ibm-aix3.2.4
727 else
728 echo rs6000-ibm-aix3.2
729 fi
730- exit ;;
731- *:AIX:*:[456])
732+ exit 0 ;;
733+ *:AIX:*:[45])
734 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
735 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
736 IBM_ARCH=rs6000
737@@ -562,28 +544,28 @@
738 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
739 fi
740 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
741- exit ;;
742+ exit 0 ;;
743 *:AIX:*:*)
744 echo rs6000-ibm-aix
745- exit ;;
746+ exit 0 ;;
747 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
748 echo romp-ibm-bsd4.4
749- exit ;;
750+ exit 0 ;;
751 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
752 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
753- exit ;; # report: romp-ibm BSD 4.3
754+ exit 0 ;; # report: romp-ibm BSD 4.3
755 *:BOSX:*:*)
756 echo rs6000-bull-bosx
757- exit ;;
758+ exit 0 ;;
759 DPX/2?00:B.O.S.:*:*)
760 echo m68k-bull-sysv3
761- exit ;;
762+ exit 0 ;;
763 9000/[34]??:4.3bsd:1.*:*)
764 echo m68k-hp-bsd
765- exit ;;
766+ exit 0 ;;
767 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
768 echo m68k-hp-bsd4.4
769- exit ;;
770+ exit 0 ;;
771 9000/[34678]??:HP-UX:*:*)
772 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
773 case "${UNAME_MACHINE}" in
774@@ -645,19 +627,9 @@
775 esac
776 if [ ${HP_ARCH} = "hppa2.0w" ]
777 then
778- eval $set_cc_for_build
779-
780- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
781- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
782- # generating 64-bit code. GNU and HP use different nomenclature:
783- #
784- # $ CC_FOR_BUILD=cc ./config.guess
785- # => hppa2.0w-hp-hpux11.23
786- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
787- # => hppa64-hp-hpux11.23
788-
789- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
790- grep __LP64__ >/dev/null
791+ # avoid double evaluation of $set_cc_for_build
792+ test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
793+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
794 then
795 HP_ARCH="hppa2.0w"
796 else
797@@ -665,11 +637,11 @@
798 fi
799 fi
800 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
801- exit ;;
802+ exit 0 ;;
803 ia64:HP-UX:*:*)
804 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
805 echo ia64-hp-hpux${HPUX_REV}
806- exit ;;
807+ exit 0 ;;
808 3050*:HI-UX:*:*)
809 eval $set_cc_for_build
810 sed 's/^ //' << EOF >$dummy.c
811@@ -697,192 +669,153 @@
812 exit (0);
813 }
814 EOF
815- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
816- { echo "$SYSTEM_NAME"; exit; }
817+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
818 echo unknown-hitachi-hiuxwe2
819- exit ;;
820+ exit 0 ;;
821 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
822 echo hppa1.1-hp-bsd
823- exit ;;
824+ exit 0 ;;
825 9000/8??:4.3bsd:*:*)
826 echo hppa1.0-hp-bsd
827- exit ;;
828+ exit 0 ;;
829 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
830 echo hppa1.0-hp-mpeix
831- exit ;;
832+ exit 0 ;;
833 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
834 echo hppa1.1-hp-osf
835- exit ;;
836+ exit 0 ;;
837 hp8??:OSF1:*:*)
838 echo hppa1.0-hp-osf
839- exit ;;
840+ exit 0 ;;
841 i*86:OSF1:*:*)
842 if [ -x /usr/sbin/sysversion ] ; then
843 echo ${UNAME_MACHINE}-unknown-osf1mk
844 else
845 echo ${UNAME_MACHINE}-unknown-osf1
846 fi
847- exit ;;
848+ exit 0 ;;
849 parisc*:Lites*:*:*)
850 echo hppa1.1-hp-lites
851- exit ;;
852+ exit 0 ;;
853 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
854 echo c1-convex-bsd
855- exit ;;
856+ exit 0 ;;
857 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
858 if getsysinfo -f scalar_acc
859 then echo c32-convex-bsd
860 else echo c2-convex-bsd
861 fi
862- exit ;;
863+ exit 0 ;;
864 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
865 echo c34-convex-bsd
866- exit ;;
867+ exit 0 ;;
868 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
869 echo c38-convex-bsd
870- exit ;;
871+ exit 0 ;;
872 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
873 echo c4-convex-bsd
874- exit ;;
875+ exit 0 ;;
876 CRAY*Y-MP:*:*:*)
877 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
878- exit ;;
879+ exit 0 ;;
880 CRAY*[A-Z]90:*:*:*)
881 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
882 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
883 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
884 -e 's/\.[^.]*$/.X/'
885- exit ;;
886+ exit 0 ;;
887 CRAY*TS:*:*:*)
888 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
889- exit ;;
890+ exit 0 ;;
891 CRAY*T3E:*:*:*)
892 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
893- exit ;;
894+ exit 0 ;;
895 CRAY*SV1:*:*:*)
896 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
897- exit ;;
898+ exit 0 ;;
899 *:UNICOS/mp:*:*)
900- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
901- exit ;;
902+ echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
903+ exit 0 ;;
904 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
905 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
906 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
907 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
908 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
909- exit ;;
910- 5000:UNIX_System_V:4.*:*)
911- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
912- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
913- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
914- exit ;;
915+ exit 0 ;;
916 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
917 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
918- exit ;;
919+ exit 0 ;;
920 sparc*:BSD/OS:*:*)
921 echo sparc-unknown-bsdi${UNAME_RELEASE}
922- exit ;;
923+ exit 0 ;;
924 *:BSD/OS:*:*)
925 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
926- exit ;;
927- *:FreeBSD:*:*)
928- case ${UNAME_MACHINE} in
929- pc98)
930- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
931- amd64)
932- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
933- *)
934- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
935- esac
936- exit ;;
937+ exit 0 ;;
938+ *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
939+ # Determine whether the default compiler uses glibc.
940+ eval $set_cc_for_build
941+ sed 's/^ //' << EOF >$dummy.c
942+ #include <features.h>
943+ #if __GLIBC__ >= 2
944+ LIBC=gnu
945+ #else
946+ LIBC=
947+ #endif
948+EOF
949+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
950+ # GNU/FreeBSD systems have a "k" prefix to indicate we are using
951+ # FreeBSD's kernel, but not the complete OS.
952+ case ${LIBC} in gnu) kernel_only='k' ;; esac
953+ echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
954+ exit 0 ;;
955 i*:CYGWIN*:*)
956 echo ${UNAME_MACHINE}-pc-cygwin
957- exit ;;
958- *:MINGW*:*)
959+ exit 0 ;;
960+ i*:MINGW*:*)
961 echo ${UNAME_MACHINE}-pc-mingw32
962- exit ;;
963- i*:windows32*:*)
964- # uname -m includes "-pc" on this system.
965- echo ${UNAME_MACHINE}-mingw32
966- exit ;;
967+ exit 0 ;;
968 i*:PW*:*)
969 echo ${UNAME_MACHINE}-pc-pw32
970- exit ;;
971- *:Interix*:[3456]*)
972- case ${UNAME_MACHINE} in
973- x86)
974- echo i586-pc-interix${UNAME_RELEASE}
975- exit ;;
976- EM64T | authenticamd | genuineintel)
977- echo x86_64-unknown-interix${UNAME_RELEASE}
978- exit ;;
979- IA64)
980- echo ia64-unknown-interix${UNAME_RELEASE}
981- exit ;;
982- esac ;;
983+ exit 0 ;;
984+ x86:Interix*:[34]*)
985+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
986+ exit 0 ;;
987 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
988 echo i${UNAME_MACHINE}-pc-mks
989- exit ;;
990+ exit 0 ;;
991 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
992 # How do we know it's Interix rather than the generic POSIX subsystem?
993 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
994 # UNAME_MACHINE based on the output of uname instead of i386?
995 echo i586-pc-interix
996- exit ;;
997+ exit 0 ;;
998 i*:UWIN*:*)
999 echo ${UNAME_MACHINE}-pc-uwin
1000- exit ;;
1001- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
1002- echo x86_64-unknown-cygwin
1003- exit ;;
1004+ exit 0 ;;
1005 p*:CYGWIN*:*)
1006 echo powerpcle-unknown-cygwin
1007- exit ;;
1008+ exit 0 ;;
1009 prep*:SunOS:5.*:*)
1010 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1011- exit ;;
1012+ exit 0 ;;
1013 *:GNU:*:*)
1014- # the GNU system
1015 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
1016- exit ;;
1017- *:GNU/*:*:*)
1018- # other systems with GNU libc and userland
1019- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
1020- exit ;;
1021+ exit 0 ;;
1022 i*86:Minix:*:*)
1023 echo ${UNAME_MACHINE}-pc-minix
1024- exit ;;
1025+ exit 0 ;;
1026 arm*:Linux:*:*)
1027- eval $set_cc_for_build
1028- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1029- | grep -q __ARM_EABI__
1030- then
1031- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1032- else
1033- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
1034- fi
1035- exit ;;
1036- avr32*:Linux:*:*)
1037- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1038- exit ;;
1039+ echo ${UNAME_MACHINE}-unknown-linux-gnu
1040+ exit 0 ;;
1041 cris:Linux:*:*)
1042- echo cris-axis-linux-${LIBC}
1043- exit ;;
1044- crisv32:Linux:*:*)
1045- echo crisv32-axis-linux-${LIBC}
1046- exit ;;
1047- frv:Linux:*:*)
1048- echo frv-unknown-linux-${LIBC}
1049- exit ;;
1050+ echo cris-axis-linux-gnu
1051+ exit 0 ;;
1052 ia64:Linux:*:*)
1053- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1054- exit ;;
1055- m32r*:Linux:*:*)
1056- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1057- exit ;;
1058+ echo ${UNAME_MACHINE}-unknown-linux-gnu
1059+ exit 0 ;;
1060 m68*:Linux:*:*)
1061- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1062- exit ;;
1063+ echo ${UNAME_MACHINE}-unknown-linux-gnu
1064+ exit 0 ;;
1065 mips:Linux:*:*)
1066 eval $set_cc_for_build
1067 sed 's/^ //' << EOF >$dummy.c
1068@@ -899,12 +832,8 @@
1069 #endif
1070 #endif
1071 EOF
1072- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1073- /^CPU/{
1074- s: ::g
1075- p
1076- }'`"
1077- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
1078+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
1079+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
1080 ;;
1081 mips64:Linux:*:*)
1082 eval $set_cc_for_build
1083@@ -922,22 +851,15 @@
1084 #endif
1085 #endif
1086 EOF
1087- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1088- /^CPU/{
1089- s: ::g
1090- p
1091- }'`"
1092- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
1093+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
1094+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
1095 ;;
1096- or32:Linux:*:*)
1097- echo or32-unknown-linux-${LIBC}
1098- exit ;;
1099 ppc:Linux:*:*)
1100- echo powerpc-unknown-linux-${LIBC}
1101- exit ;;
1102+ echo powerpc-unknown-linux-gnu
1103+ exit 0 ;;
1104 ppc64:Linux:*:*)
1105- echo powerpc64-unknown-linux-${LIBC}
1106- exit ;;
1107+ echo powerpc64-unknown-linux-gnu
1108+ exit 0 ;;
1109 alpha:Linux:*:*)
1110 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
1111 EV5) UNAME_MACHINE=alphaev5 ;;
1112@@ -949,44 +871,35 @@
1113 EV68*) UNAME_MACHINE=alphaev68 ;;
1114 esac
1115 objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
1116- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
1117- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1118- exit ;;
1119- padre:Linux:*:*)
1120- echo sparc-unknown-linux-gnu
1121- exit ;;
1122+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
1123+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
1124+ exit 0 ;;
1125 parisc:Linux:*:* | hppa:Linux:*:*)
1126 # Look for CPU level
1127 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1128- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
1129- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
1130- *) echo hppa-unknown-linux-${LIBC} ;;
1131+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
1132+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
1133+ *) echo hppa-unknown-linux-gnu ;;
1134 esac
1135- exit ;;
1136+ exit 0 ;;
1137 parisc64:Linux:*:* | hppa64:Linux:*:*)
1138- echo hppa64-unknown-linux-${LIBC}
1139- exit ;;
1140+ echo hppa64-unknown-linux-gnu
1141+ exit 0 ;;
1142 s390:Linux:*:* | s390x:Linux:*:*)
1143 echo ${UNAME_MACHINE}-ibm-linux
1144- exit ;;
1145+ exit 0 ;;
1146 sh64*:Linux:*:*)
1147- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1148- exit ;;
1149+ echo ${UNAME_MACHINE}-unknown-linux-gnu
1150+ exit 0 ;;
1151 sh*:Linux:*:*)
1152- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1153- exit ;;
1154+ echo ${UNAME_MACHINE}-unknown-linux-gnu
1155+ exit 0 ;;
1156 sparc:Linux:*:* | sparc64:Linux:*:*)
1157- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1158- exit ;;
1159- vax:Linux:*:*)
1160- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1161- exit ;;
1162+ echo ${UNAME_MACHINE}-unknown-linux-gnu
1163+ exit 0 ;;
1164 x86_64:Linux:*:*)
1165- echo x86_64-unknown-linux-${LIBC}
1166- exit ;;
1167- xtensa*:Linux:*:*)
1168- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1169- exit ;;
1170+ echo x86_64-unknown-linux-gnu
1171+ exit 0 ;;
1172 i*86:Linux:*:*)
1173 # The BFD linker knows what the default object file format is, so
1174 # first see if it will tell us. cd to the root directory to prevent
1175@@ -1000,19 +913,20 @@
1176 p'`
1177 case "$ld_supported_targets" in
1178 elf32-i386)
1179- TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
1180+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1181 ;;
1182 a.out-i386-linux)
1183- echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
1184- exit ;;
1185+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
1186+ exit 0 ;;
1187+ coff-i386)
1188+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
1189+ exit 0 ;;
1190 "")
1191 # Either a pre-BFD a.out linker (linux-gnuoldld) or
1192 # one that does not give us useful --help.
1193- echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
1194- exit ;;
1195+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
1196+ exit 0 ;;
1197 esac
1198- # This should get integrated into the C code below, but now we hack
1199- if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
1200 # Determine whether the default compiler is a.out or elf
1201 eval $set_cc_for_build
1202 sed 's/^ //' << EOF >$dummy.c
1203@@ -1028,33 +942,23 @@
1204 LIBC=gnulibc1
1205 # endif
1206 #else
1207- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1208+ #ifdef __INTEL_COMPILER
1209 LIBC=gnu
1210 #else
1211 LIBC=gnuaout
1212 #endif
1213 #endif
1214- #ifdef __dietlibc__
1215- LIBC=dietlibc
1216- #endif
1217 EOF
1218- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1219- /^LIBC/{
1220- s: ::g
1221- p
1222- }'`"
1223- test x"${LIBC}" != x && {
1224- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1225- exit
1226- }
1227- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1228+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
1229+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
1230+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
1231 ;;
1232 i*86:DYNIX/ptx:4*:*)
1233 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1234 # earlier versions are messed up and put the nodename in both
1235 # sysname and nodename.
1236 echo i386-sequent-sysv4
1237- exit ;;
1238+ exit 0 ;;
1239 i*86:UNIX_SV:4.2MP:2.*)
1240 # Unixware is an offshoot of SVR4, but it has its own version
1241 # number series starting with 2...
1242@@ -1062,27 +966,24 @@
1243 # I just have to hope. -- rms.
1244 # Use sysv4.2uw... so that sysv4* matches it.
1245 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1246- exit ;;
1247+ exit 0 ;;
1248 i*86:OS/2:*:*)
1249 # If we were able to find `uname', then EMX Unix compatibility
1250 # is probably installed.
1251 echo ${UNAME_MACHINE}-pc-os2-emx
1252- exit ;;
1253+ exit 0 ;;
1254 i*86:XTS-300:*:STOP)
1255 echo ${UNAME_MACHINE}-unknown-stop
1256- exit ;;
1257+ exit 0 ;;
1258 i*86:atheos:*:*)
1259 echo ${UNAME_MACHINE}-unknown-atheos
1260- exit ;;
1261- i*86:syllable:*:*)
1262- echo ${UNAME_MACHINE}-pc-syllable
1263- exit ;;
1264+ exit 0 ;;
1265 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1266 echo i386-unknown-lynxos${UNAME_RELEASE}
1267- exit ;;
1268+ exit 0 ;;
1269 i*86:*DOS:*:*)
1270 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1271- exit ;;
1272+ exit 0 ;;
1273 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1274 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1275 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1276@@ -1090,16 +991,15 @@
1277 else
1278 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1279 fi
1280- exit ;;
1281- i*86:*:5:[678]*)
1282- # UnixWare 7.x, OpenUNIX and OpenServer 6.
1283+ exit 0 ;;
1284+ i*86:*:5:[78]*)
1285 case `/bin/uname -X | grep "^Machine"` in
1286 *486*) UNAME_MACHINE=i486 ;;
1287 *Pentium) UNAME_MACHINE=i586 ;;
1288 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1289 esac
1290 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1291- exit ;;
1292+ exit 0 ;;
1293 i*86:*:3.2:*)
1294 if test -f /usr/options/cb.name; then
1295 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1296@@ -1117,73 +1017,73 @@
1297 else
1298 echo ${UNAME_MACHINE}-pc-sysv32
1299 fi
1300- exit ;;
1301+ exit 0 ;;
1302 pc:*:*:*)
1303 # Left here for compatibility:
1304 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1305 # the processor, so we play safe by assuming i386.
1306 echo i386-pc-msdosdjgpp
1307- exit ;;
1308+ exit 0 ;;
1309 Intel:Mach:3*:*)
1310 echo i386-pc-mach3
1311- exit ;;
1312+ exit 0 ;;
1313 paragon:*:*:*)
1314 echo i860-intel-osf1
1315- exit ;;
1316+ exit 0 ;;
1317 i860:*:4.*:*) # i860-SVR4
1318 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1319 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1320 else # Add other i860-SVR4 vendors below as they are discovered.
1321 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1322 fi
1323- exit ;;
1324+ exit 0 ;;
1325 mini*:CTIX:SYS*5:*)
1326 # "miniframe"
1327 echo m68010-convergent-sysv
1328- exit ;;
1329+ exit 0 ;;
1330 mc68k:UNIX:SYSTEM5:3.51m)
1331 echo m68k-convergent-sysv
1332- exit ;;
1333+ exit 0 ;;
1334 M680?0:D-NIX:5.3:*)
1335 echo m68k-diab-dnix
1336- exit ;;
1337- M68*:*:R3V[5678]*:*)
1338- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1339- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1340+ exit 0 ;;
1341+ M68*:*:R3V[567]*:*)
1342+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1343+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
1344 OS_REL=''
1345 test -r /etc/.relid \
1346 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1347 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1348- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1349+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
1350 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1351- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1352+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
1353 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1354 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1355- && { echo i486-ncr-sysv4; exit; } ;;
1356+ && echo i486-ncr-sysv4 && exit 0 ;;
1357 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1358 echo m68k-unknown-lynxos${UNAME_RELEASE}
1359- exit ;;
1360+ exit 0 ;;
1361 mc68030:UNIX_System_V:4.*:*)
1362 echo m68k-atari-sysv4
1363- exit ;;
1364+ exit 0 ;;
1365 TSUNAMI:LynxOS:2.*:*)
1366 echo sparc-unknown-lynxos${UNAME_RELEASE}
1367- exit ;;
1368+ exit 0 ;;
1369 rs6000:LynxOS:2.*:*)
1370 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1371- exit ;;
1372+ exit 0 ;;
1373 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1374 echo powerpc-unknown-lynxos${UNAME_RELEASE}
1375- exit ;;
1376+ exit 0 ;;
1377 SM[BE]S:UNIX_SV:*:*)
1378 echo mips-dde-sysv${UNAME_RELEASE}
1379- exit ;;
1380+ exit 0 ;;
1381 RM*:ReliantUNIX-*:*:*)
1382 echo mips-sni-sysv4
1383- exit ;;
1384+ exit 0 ;;
1385 RM*:SINIX-*:*:*)
1386 echo mips-sni-sysv4
1387- exit ;;
1388+ exit 0 ;;
1389 *:SINIX-*:*:*)
1390 if uname -p 2>/dev/null >/dev/null ; then
1391 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1392@@ -1191,84 +1091,68 @@
1393 else
1394 echo ns32k-sni-sysv
1395 fi
1396- exit ;;
1397+ exit 0 ;;
1398 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1399 # says <Richard.M.Bartel@ccMail.Census.GOV>
1400 echo i586-unisys-sysv4
1401- exit ;;
1402+ exit 0 ;;
1403 *:UNIX_System_V:4*:FTX*)
1404 # From Gerald Hewes <hewes@openmarket.com>.
1405 # How about differentiating between stratus architectures? -djm
1406 echo hppa1.1-stratus-sysv4
1407- exit ;;
1408+ exit 0 ;;
1409 *:*:*:FTX*)
1410 # From seanf@swdc.stratus.com.
1411 echo i860-stratus-sysv4
1412- exit ;;
1413- i*86:VOS:*:*)
1414- # From Paul.Green@stratus.com.
1415- echo ${UNAME_MACHINE}-stratus-vos
1416- exit ;;
1417+ exit 0 ;;
1418 *:VOS:*:*)
1419 # From Paul.Green@stratus.com.
1420 echo hppa1.1-stratus-vos
1421- exit ;;
1422+ exit 0 ;;
1423 mc68*:A/UX:*:*)
1424 echo m68k-apple-aux${UNAME_RELEASE}
1425- exit ;;
1426+ exit 0 ;;
1427 news*:NEWS-OS:6*:*)
1428 echo mips-sony-newsos6
1429- exit ;;
1430+ exit 0 ;;
1431 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1432 if [ -d /usr/nec ]; then
1433 echo mips-nec-sysv${UNAME_RELEASE}
1434 else
1435 echo mips-unknown-sysv${UNAME_RELEASE}
1436 fi
1437- exit ;;
1438+ exit 0 ;;
1439 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1440 echo powerpc-be-beos
1441- exit ;;
1442+ exit 0 ;;
1443 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1444 echo powerpc-apple-beos
1445- exit ;;
1446+ exit 0 ;;
1447 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1448 echo i586-pc-beos
1449- exit ;;
1450- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
1451- echo i586-pc-haiku
1452- exit ;;
1453+ exit 0 ;;
1454 SX-4:SUPER-UX:*:*)
1455 echo sx4-nec-superux${UNAME_RELEASE}
1456- exit ;;
1457+ exit 0 ;;
1458 SX-5:SUPER-UX:*:*)
1459 echo sx5-nec-superux${UNAME_RELEASE}
1460- exit ;;
1461+ exit 0 ;;
1462 SX-6:SUPER-UX:*:*)
1463 echo sx6-nec-superux${UNAME_RELEASE}
1464- exit ;;
1465- SX-7:SUPER-UX:*:*)
1466- echo sx7-nec-superux${UNAME_RELEASE}
1467- exit ;;
1468- SX-8:SUPER-UX:*:*)
1469- echo sx8-nec-superux${UNAME_RELEASE}
1470- exit ;;
1471- SX-8R:SUPER-UX:*:*)
1472- echo sx8r-nec-superux${UNAME_RELEASE}
1473- exit ;;
1474+ exit 0 ;;
1475 Power*:Rhapsody:*:*)
1476 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1477- exit ;;
1478+ exit 0 ;;
1479 *:Rhapsody:*:*)
1480 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1481- exit ;;
1482+ exit 0 ;;
1483 *:Darwin:*:*)
1484- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1485- case $UNAME_PROCESSOR in
1486- unknown) UNAME_PROCESSOR=powerpc ;;
1487+ case `uname -p` in
1488+ *86) UNAME_PROCESSOR=i686 ;;
1489+ powerpc) UNAME_PROCESSOR=powerpc ;;
1490 esac
1491 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1492- exit ;;
1493+ exit 0 ;;
1494 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1495 UNAME_PROCESSOR=`uname -p`
1496 if test "$UNAME_PROCESSOR" = "x86"; then
1497@@ -1276,25 +1160,22 @@
1498 UNAME_MACHINE=pc
1499 fi
1500 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1501- exit ;;
1502+ exit 0 ;;
1503 *:QNX:*:4*)
1504 echo i386-pc-qnx
1505- exit ;;
1506- NSE-?:NONSTOP_KERNEL:*:*)
1507- echo nse-tandem-nsk${UNAME_RELEASE}
1508- exit ;;
1509- NSR-?:NONSTOP_KERNEL:*:*)
1510+ exit 0 ;;
1511+ NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
1512 echo nsr-tandem-nsk${UNAME_RELEASE}
1513- exit ;;
1514+ exit 0 ;;
1515 *:NonStop-UX:*:*)
1516 echo mips-compaq-nonstopux
1517- exit ;;
1518+ exit 0 ;;
1519 BS2000:POSIX*:*:*)
1520 echo bs2000-siemens-sysv
1521- exit ;;
1522+ exit 0 ;;
1523 DS/*:UNIX_System_V:*:*)
1524 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1525- exit ;;
1526+ exit 0 ;;
1527 *:Plan9:*:*)
1528 # "uname -m" is not consistent, so use $cputype instead. 386
1529 # is converted to i386 for consistency with other x86
1530@@ -1305,47 +1186,28 @@
1531 UNAME_MACHINE="$cputype"
1532 fi
1533 echo ${UNAME_MACHINE}-unknown-plan9
1534- exit ;;
1535+ exit 0 ;;
1536 *:TOPS-10:*:*)
1537 echo pdp10-unknown-tops10
1538- exit ;;
1539+ exit 0 ;;
1540 *:TENEX:*:*)
1541 echo pdp10-unknown-tenex
1542- exit ;;
1543+ exit 0 ;;
1544 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1545 echo pdp10-dec-tops20
1546- exit ;;
1547+ exit 0 ;;
1548 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1549 echo pdp10-xkl-tops20
1550- exit ;;
1551+ exit 0 ;;
1552 *:TOPS-20:*:*)
1553 echo pdp10-unknown-tops20
1554- exit ;;
1555+ exit 0 ;;
1556 *:ITS:*:*)
1557 echo pdp10-unknown-its
1558- exit ;;
1559+ exit 0 ;;
1560 SEI:*:*:SEIUX)
1561 echo mips-sei-seiux${UNAME_RELEASE}
1562- exit ;;
1563- *:DragonFly:*:*)
1564- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1565- exit ;;
1566- *:*VMS:*:*)
1567- UNAME_MACHINE=`(uname -p) 2>/dev/null`
1568- case "${UNAME_MACHINE}" in
1569- A*) echo alpha-dec-vms ; exit ;;
1570- I*) echo ia64-dec-vms ; exit ;;
1571- V*) echo vax-dec-vms ; exit ;;
1572- esac ;;
1573- *:XENIX:*:SysV)
1574- echo i386-pc-xenix
1575- exit ;;
1576- i*86:skyos:*:*)
1577- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1578- exit ;;
1579- i*86:rdos:*:*)
1580- echo ${UNAME_MACHINE}-pc-rdos
1581- exit ;;
1582+ exit 0 ;;
1583 esac
1584
1585 #echo '(No uname command or uname output not recognized.)' 1>&2
1586@@ -1377,7 +1239,7 @@
1587 #endif
1588
1589 #if defined (__arm) && defined (__acorn) && defined (__unix)
1590- printf ("arm-acorn-riscix\n"); exit (0);
1591+ printf ("arm-acorn-riscix"); exit (0);
1592 #endif
1593
1594 #if defined (hp300) && !defined (hpux)
1595@@ -1466,12 +1328,11 @@
1596 }
1597 EOF
1598
1599-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1600- { echo "$SYSTEM_NAME"; exit; }
1601+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
1602
1603 # Apollos put the system type in the environment.
1604
1605-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1606+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1607
1608 # Convex versions that predate uname can use getsysinfo(1)
1609
1610@@ -1480,22 +1341,22 @@
1611 case `getsysinfo -f cpu_type` in
1612 c1*)
1613 echo c1-convex-bsd
1614- exit ;;
1615+ exit 0 ;;
1616 c2*)
1617 if getsysinfo -f scalar_acc
1618 then echo c32-convex-bsd
1619 else echo c2-convex-bsd
1620 fi
1621- exit ;;
1622+ exit 0 ;;
1623 c34*)
1624 echo c34-convex-bsd
1625- exit ;;
1626+ exit 0 ;;
1627 c38*)
1628 echo c38-convex-bsd
1629- exit ;;
1630+ exit 0 ;;
1631 c4*)
1632 echo c4-convex-bsd
1633- exit ;;
1634+ exit 0 ;;
1635 esac
1636 fi
1637
1638@@ -1506,9 +1367,7 @@
1639 the operating system you are using. It is advised that you
1640 download the most up to date version of the config scripts from
1641
1642- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1643-and
1644- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1645+ ftp://ftp.gnu.org/pub/gnu/config/
1646
1647 If the version you run ($0) is already up to date, please
1648 send the following data and any information you think might be
1649diff -urN --exclude *.m4 memcached-1.4.4/config.h.in repcached-2.2-1.4.4/config.h.in
1650--- memcached-1.4.4/config.h.in Fri Nov 27 09:34:56 2009
1651+++ repcached-2.2-1.4.4/config.h.in Wed Feb 10 19:12:46 2010
1652@@ -99,6 +99,9 @@
1653 /* Define to 1 if you have the ANSI C header files. */
1654 #undef STDC_HEADERS
1655
1656+/* Define this if you want to use replication */
1657+#undef USE_REPLICATION
1658+
1659 /* Version number of package */
1660 #undef VERSION
1661
1662diff -urN --exclude *.m4 memcached-1.4.4/config.sub repcached-2.2-1.4.4/config.sub
1663--- memcached-1.4.4/config.sub Sat Aug 22 04:38:32 2009
1664+++ repcached-2.2-1.4.4/config.sub Tue Jan 19 12:34:08 2010
1665@@ -1,10 +1,9 @@
1666 #! /bin/sh
1667 # Configuration validation subroutine script.
1668 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
1669-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
1670-# Free Software Foundation, Inc.
1671+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1672
1673-timestamp='2008-09-08'
1674+timestamp='2003-07-04'
1675
1676 # This file is (in principle) common to ALL GNU software.
1677 # The presence of a machine in this file suggests that SOME GNU software
1678@@ -22,15 +21,14 @@
1679 #
1680 # You should have received a copy of the GNU General Public License
1681 # along with this program; if not, write to the Free Software
1682-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
1683-# 02110-1301, USA.
1684-#
1685+# Foundation, Inc., 59 Temple Place - Suite 330,
1686+# Boston, MA 02111-1307, USA.
1687+
1688 # As a special exception to the GNU General Public License, if you
1689 # distribute this file as part of a program that contains a
1690 # configuration script generated by Autoconf, you may include it under
1691 # the same distribution terms that you use for the rest of that program.
1692
1693-
1694 # Please send patches to <config-patches@gnu.org>. Submit a context
1695 # diff and a properly formatted ChangeLog entry.
1696 #
1697@@ -72,8 +70,8 @@
1698 version="\
1699 GNU config.sub ($timestamp)
1700
1701-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
1702-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
1703+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
1704+Free Software Foundation, Inc.
1705
1706 This is free software; see the source for copying conditions. There is NO
1707 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
1708@@ -85,11 +83,11 @@
1709 while test $# -gt 0 ; do
1710 case $1 in
1711 --time-stamp | --time* | -t )
1712- echo "$timestamp" ; exit ;;
1713+ echo "$timestamp" ; exit 0 ;;
1714 --version | -v )
1715- echo "$version" ; exit ;;
1716+ echo "$version" ; exit 0 ;;
1717 --help | --h* | -h )
1718- echo "$usage"; exit ;;
1719+ echo "$usage"; exit 0 ;;
1720 -- ) # Stop option processing
1721 shift; break ;;
1722 - ) # Use stdin as input.
1723@@ -101,7 +99,7 @@
1724 *local*)
1725 # First pass through any local machine types.
1726 echo $1
1727- exit ;;
1728+ exit 0;;
1729
1730 * )
1731 break ;;
1732@@ -120,9 +118,7 @@
1733 # Here we must recognize all the valid KERNEL-OS combinations.
1734 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
1735 case $maybe_os in
1736- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
1737- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
1738- storm-chaos* | os2-emx* | rtmk-nova*)
1739+ nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
1740 os=-$maybe_os
1741 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
1742 ;;
1743@@ -148,7 +144,7 @@
1744 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
1745 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
1746 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
1747- -apple | -axis | -knuth | -cray)
1748+ -apple | -axis)
1749 os=
1750 basic_machine=$1
1751 ;;
1752@@ -173,10 +169,6 @@
1753 -hiux*)
1754 os=-hiuxwe2
1755 ;;
1756- -sco6)
1757- os=-sco5v6
1758- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
1759- ;;
1760 -sco5)
1761 os=-sco3.2v5
1762 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
1763@@ -193,10 +185,6 @@
1764 # Don't forget version if it is 3.2v4 or newer.
1765 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
1766 ;;
1767- -sco5v6*)
1768- # Don't forget version if it is 3.2v4 or newer.
1769- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
1770- ;;
1771 -sco*)
1772 os=-sco3.2v2
1773 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
1774@@ -240,55 +228,44 @@
1775 | a29k \
1776 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
1777 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
1778- | am33_2.0 \
1779- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
1780- | bfin \
1781+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
1782 | c4x | clipper \
1783- | d10v | d30v | dlx | dsp16xx | dvp \
1784- | fido | fr30 | frv \
1785+ | d10v | d30v | dlx | dsp16xx \
1786+ | fr30 | frv \
1787 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1788 | i370 | i860 | i960 | ia64 \
1789- | ip2k | iq2000 \
1790- | m32c | m32r | m32rle | m68000 | m68k | m88k \
1791- | maxq | mb | microblaze | mcore | mep | metag \
1792+ | ip2k \
1793+ | m32r | m68000 | m68k | m88k | mcore \
1794 | mips | mipsbe | mipseb | mipsel | mipsle \
1795 | mips16 \
1796 | mips64 | mips64el \
1797- | mips64octeon | mips64octeonel \
1798- | mips64orion | mips64orionel \
1799- | mips64r5900 | mips64r5900el \
1800 | mips64vr | mips64vrel \
1801+ | mips64orion | mips64orionel \
1802 | mips64vr4100 | mips64vr4100el \
1803 | mips64vr4300 | mips64vr4300el \
1804 | mips64vr5000 | mips64vr5000el \
1805- | mips64vr5900 | mips64vr5900el \
1806 | mipsisa32 | mipsisa32el \
1807 | mipsisa32r2 | mipsisa32r2el \
1808 | mipsisa64 | mipsisa64el \
1809- | mipsisa64r2 | mipsisa64r2el \
1810 | mipsisa64sb1 | mipsisa64sb1el \
1811 | mipsisa64sr71k | mipsisa64sr71kel \
1812 | mipstx39 | mipstx39el \
1813 | mn10200 | mn10300 \
1814- | mt \
1815 | msp430 \
1816- | nios | nios2 \
1817 | ns16k | ns32k \
1818- | or32 \
1819+ | openrisc | or32 \
1820 | pdp10 | pdp11 | pj | pjl \
1821 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
1822 | pyramid \
1823- | score \
1824- | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
1825+ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
1826 | sh64 | sh64le \
1827- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
1828- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
1829- | spu | strongarm \
1830+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
1831+ | strongarm \
1832 | tahoe | thumb | tic4x | tic80 | tron \
1833 | v850 | v850e \
1834 | we32k \
1835- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
1836- | z8k | z80)
1837+ | x86 | xscale | xstormy16 | xtensa \
1838+ | z8k)
1839 basic_machine=$basic_machine-unknown
1840 ;;
1841 m6811 | m68hc11 | m6812 | m68hc12)
1842@@ -298,9 +275,6 @@
1843 ;;
1844 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
1845 ;;
1846- ms1)
1847- basic_machine=mt-unknown
1848- ;;
1849
1850 # We use `pc' rather than `unknown'
1851 # because (1) that's what they normally are, and
1852@@ -318,68 +292,56 @@
1853 | a29k-* \
1854 | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
1855 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
1856- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
1857+ | alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* \
1858 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
1859- | avr-* | avr32-* \
1860- | bfin-* | bs2000-* \
1861+ | avr-* \
1862+ | bs2000-* \
1863 | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
1864- | clipper-* | craynv-* | cydra-* \
1865+ | clipper-* | cydra-* \
1866 | d10v-* | d30v-* | dlx-* \
1867 | elxsi-* \
1868- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
1869+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
1870 | h8300-* | h8500-* \
1871 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
1872 | i*86-* | i860-* | i960-* | ia64-* \
1873- | ip2k-* | iq2000-* \
1874- | m32c-* | m32r-* | m32rle-* \
1875+ | ip2k-* \
1876+ | m32r-* \
1877 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
1878- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
1879+ | m88110-* | m88k-* | mcore-* \
1880 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
1881 | mips16-* \
1882 | mips64-* | mips64el-* \
1883- | mips64octeon-* | mips64octeonel-* \
1884- | mips64orion-* | mips64orionel-* \
1885- | mips64r5900-* | mips64r5900el-* \
1886 | mips64vr-* | mips64vrel-* \
1887+ | mips64orion-* | mips64orionel-* \
1888 | mips64vr4100-* | mips64vr4100el-* \
1889 | mips64vr4300-* | mips64vr4300el-* \
1890 | mips64vr5000-* | mips64vr5000el-* \
1891- | mips64vr5900-* | mips64vr5900el-* \
1892 | mipsisa32-* | mipsisa32el-* \
1893 | mipsisa32r2-* | mipsisa32r2el-* \
1894 | mipsisa64-* | mipsisa64el-* \
1895- | mipsisa64r2-* | mipsisa64r2el-* \
1896 | mipsisa64sb1-* | mipsisa64sb1el-* \
1897 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
1898 | mipstx39-* | mipstx39el-* \
1899- | mmix-* \
1900- | mt-* \
1901 | msp430-* \
1902- | nios-* | nios2-* \
1903- | none-* | np1-* | ns16k-* | ns32k-* \
1904+ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
1905 | orion-* \
1906 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
1907 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
1908 | pyramid-* \
1909 | romp-* | rs6000-* \
1910- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
1911+ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
1912 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
1913- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
1914- | sparclite-* \
1915- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
1916+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
1917+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
1918 | tahoe-* | thumb-* \
1919- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
1920+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
1921 | tron-* \
1922 | v850-* | v850e-* | vax-* \
1923 | we32k-* \
1924- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
1925- | xstormy16-* | xtensa*-* \
1926+ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
1927+ | xtensa-* \
1928 | ymp-* \
1929- | z8k-* | z80-*)
1930- ;;
1931- # Recognize the basic CPU types without company name, with glob match.
1932- xtensa*)
1933- basic_machine=$basic_machine-unknown
1934+ | z8k-*)
1935 ;;
1936 # Recognize the various machine names and aliases which stand
1937 # for a CPU type and a company and sometimes even an OS.
1938@@ -397,9 +359,6 @@
1939 basic_machine=a29k-amd
1940 os=-udi
1941 ;;
1942- abacus)
1943- basic_machine=abacus-unknown
1944- ;;
1945 adobe68k)
1946 basic_machine=m68010-adobe
1947 os=-scout
1948@@ -417,9 +376,6 @@
1949 amd64)
1950 basic_machine=x86_64-pc
1951 ;;
1952- amd64-*)
1953- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
1954- ;;
1955 amdahl)
1956 basic_machine=580-amdahl
1957 os=-sysv
1958@@ -451,22 +407,10 @@
1959 basic_machine=ns32k-sequent
1960 os=-dynix
1961 ;;
1962- blackfin)
1963- basic_machine=bfin-unknown
1964- os=-linux
1965- ;;
1966- blackfin-*)
1967- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
1968- os=-linux
1969- ;;
1970 c90)
1971 basic_machine=c90-cray
1972 os=-unicos
1973 ;;
1974- cegcc)
1975- basic_machine=arm-unknown
1976- os=-cegcc
1977- ;;
1978 convex-c1)
1979 basic_machine=c1-convex
1980 os=-bsd
1981@@ -491,27 +435,12 @@
1982 basic_machine=j90-cray
1983 os=-unicos
1984 ;;
1985- craynv)
1986- basic_machine=craynv-cray
1987- os=-unicosmp
1988- ;;
1989- cr16)
1990- basic_machine=cr16-unknown
1991- os=-elf
1992- ;;
1993 crds | unos)
1994 basic_machine=m68k-crds
1995 ;;
1996- crisv32 | crisv32-* | etraxfs*)
1997- basic_machine=crisv32-axis
1998- ;;
1999 cris | cris-* | etrax*)
2000 basic_machine=cris-axis
2001 ;;
2002- crx)
2003- basic_machine=crx-unknown
2004- os=-elf
2005- ;;
2006 da30 | da30-*)
2007 basic_machine=m68k-da30
2008 ;;
2009@@ -534,14 +463,6 @@
2010 basic_machine=m88k-motorola
2011 os=-sysv3
2012 ;;
2013- dicos)
2014- basic_machine=i686-pc
2015- os=-dicos
2016- ;;
2017- djgpp)
2018- basic_machine=i586-pc
2019- os=-msdosdjgpp
2020- ;;
2021 dpx20 | dpx20-*)
2022 basic_machine=rs6000-bull
2023 os=-bosx
2024@@ -692,14 +613,6 @@
2025 basic_machine=m68k-isi
2026 os=-sysv
2027 ;;
2028- m68knommu)
2029- basic_machine=m68k-unknown
2030- os=-linux
2031- ;;
2032- m68knommu-*)
2033- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
2034- os=-linux
2035- ;;
2036 m88k-omron*)
2037 basic_machine=m88k-omron
2038 ;;
2039@@ -715,10 +628,6 @@
2040 basic_machine=i386-pc
2041 os=-mingw32
2042 ;;
2043- mingw32ce)
2044- basic_machine=arm-unknown
2045- os=-mingw32ce
2046- ;;
2047 miniframe)
2048 basic_machine=m68000-convergent
2049 ;;
2050@@ -726,30 +635,16 @@
2051 basic_machine=m68k-atari
2052 os=-mint
2053 ;;
2054- mipsEE* | ee | ps2)
2055- basic_machine=mips64r5900el-scei
2056- case $os in
2057- -linux*)
2058- ;;
2059- *)
2060- os=-elf
2061- ;;
2062- esac
2063- ;;
2064- iop)
2065- basic_machine=mipsel-scei
2066- os=-irx
2067- ;;
2068- dvp)
2069- basic_machine=dvp-scei
2070- os=-elf
2071- ;;
2072 mips3*-*)
2073 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
2074 ;;
2075 mips3*)
2076 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
2077 ;;
2078+ mmix*)
2079+ basic_machine=mmix-knuth
2080+ os=-mmixware
2081+ ;;
2082 monitor)
2083 basic_machine=m68k-rom68k
2084 os=-coff
2085@@ -762,9 +657,6 @@
2086 basic_machine=i386-pc
2087 os=-msdos
2088 ;;
2089- ms1-*)
2090- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
2091- ;;
2092 mvs)
2093 basic_machine=i370-ibm
2094 os=-mvs
2095@@ -833,6 +725,10 @@
2096 np1)
2097 basic_machine=np1-gould
2098 ;;
2099+ nv1)
2100+ basic_machine=nv1-cray
2101+ os=-unicosmp
2102+ ;;
2103 nsr-tandem)
2104 basic_machine=nsr-tandem
2105 ;;
2106@@ -840,12 +736,9 @@
2107 basic_machine=hppa1.1-oki
2108 os=-proelf
2109 ;;
2110- openrisc | openrisc-*)
2111+ or32 | or32-*)
2112 basic_machine=or32-unknown
2113- ;;
2114- os400)
2115- basic_machine=powerpc-ibm
2116- os=-os400
2117+ os=-coff
2118 ;;
2119 OSE68000 | ose68000)
2120 basic_machine=m68000-ericsson
2121@@ -863,14 +756,6 @@
2122 basic_machine=i860-intel
2123 os=-osf
2124 ;;
2125- parisc)
2126- basic_machine=hppa-unknown
2127- os=-linux
2128- ;;
2129- parisc-*)
2130- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
2131- os=-linux
2132- ;;
2133 pbd)
2134 basic_machine=sparc-tti
2135 ;;
2136@@ -880,12 +765,6 @@
2137 pc532 | pc532-*)
2138 basic_machine=ns32k-pc532
2139 ;;
2140- pc98)
2141- basic_machine=i386-pc
2142- ;;
2143- pc98-*)
2144- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
2145- ;;
2146 pentium | p5 | k5 | k6 | nexgen | viac3)
2147 basic_machine=i586-pc
2148 ;;
2149@@ -942,10 +821,6 @@
2150 basic_machine=i586-unknown
2151 os=-pw32
2152 ;;
2153- rdos)
2154- basic_machine=i386-pc
2155- os=-rdos
2156- ;;
2157 rom68k)
2158 basic_machine=m68k-rom68k
2159 os=-coff
2160@@ -972,10 +847,6 @@
2161 sb1el)
2162 basic_machine=mipsisa64sb1el-unknown
2163 ;;
2164- sde)
2165- basic_machine=mipsisa32-sde
2166- os=-elf
2167- ;;
2168 sei)
2169 basic_machine=mips-sei
2170 os=-seiux
2171@@ -987,9 +858,6 @@
2172 basic_machine=sh-hitachi
2173 os=-hms
2174 ;;
2175- sh5el)
2176- basic_machine=sh5le-unknown
2177- ;;
2178 sh64)
2179 basic_machine=sh64-unknown
2180 ;;
2181@@ -1079,10 +947,6 @@
2182 basic_machine=tic6x-unknown
2183 os=-coff
2184 ;;
2185- tile*)
2186- basic_machine=tile-unknown
2187- os=-linux-gnu
2188- ;;
2189 tx39)
2190 basic_machine=mipstx39-unknown
2191 ;;
2192@@ -1096,10 +960,6 @@
2193 tower | tower-32)
2194 basic_machine=m68k-ncr
2195 ;;
2196- tpf)
2197- basic_machine=s390x-ibm
2198- os=-tpf
2199- ;;
2200 udi29k)
2201 basic_machine=a29k-amd
2202 os=-udi
2203@@ -1143,10 +1003,6 @@
2204 basic_machine=hppa1.1-winbond
2205 os=-proelf
2206 ;;
2207- xbox)
2208- basic_machine=i686-pc
2209- os=-mingw32
2210- ;;
2211 xps | xps100)
2212 basic_machine=xps100-honeywell
2213 ;;
2214@@ -1158,10 +1014,6 @@
2215 basic_machine=z8k-unknown
2216 os=-sim
2217 ;;
2218- z80-*-coff)
2219- basic_machine=z80-unknown
2220- os=-sim
2221- ;;
2222 none)
2223 basic_machine=none-none
2224 os=-none
2225@@ -1181,9 +1033,6 @@
2226 romp)
2227 basic_machine=romp-ibm
2228 ;;
2229- mmix)
2230- basic_machine=mmix-knuth
2231- ;;
2232 rs6000)
2233 basic_machine=rs6000-ibm
2234 ;;
2235@@ -1200,10 +1049,13 @@
2236 we32k)
2237 basic_machine=we32k-att
2238 ;;
2239- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
2240+ sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
2241 basic_machine=sh-unknown
2242 ;;
2243- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
2244+ sh64)
2245+ basic_machine=sh64-unknown
2246+ ;;
2247+ sparc | sparcv9 | sparcv9b)
2248 basic_machine=sparc-sun
2249 ;;
2250 cydra)
2251@@ -1276,23 +1128,19 @@
2252 | -aos* \
2253 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
2254 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
2255- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
2256- | -openbsd* | -solidbsd* \
2257- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
2258- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
2259+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
2260+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
2261 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
2262 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
2263- | -chorusos* | -chorusrdb* | -cegcc* \
2264+ | -chorusos* | -chorusrdb* \
2265 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
2266- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
2267- | -uxpv* | -beos* | -mpeix* | -udk* \
2268+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
2269 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
2270 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
2271 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
2272 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
2273 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
2274- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
2275- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*)
2276+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
2277 # Remember, each alternative MUST END IN *, to match a version number.
2278 ;;
2279 -qnx*)
2280@@ -1310,15 +1158,12 @@
2281 os=`echo $os | sed -e 's|nto|nto-qnx|'`
2282 ;;
2283 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
2284- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
2285+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
2286 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
2287 ;;
2288 -mac*)
2289 os=`echo $os | sed -e 's|mac|macos|'`
2290 ;;
2291- -linux-dietlibc)
2292- os=-linux-dietlibc
2293- ;;
2294 -linux*)
2295 os=`echo $os | sed -e 's|linux|linux-gnu|'`
2296 ;;
2297@@ -1331,9 +1176,6 @@
2298 -opened*)
2299 os=-openedition
2300 ;;
2301- -os400*)
2302- os=-os400
2303- ;;
2304 -wince*)
2305 os=-wince
2306 ;;
2307@@ -1355,9 +1197,6 @@
2308 -atheos*)
2309 os=-atheos
2310 ;;
2311- -syllable*)
2312- os=-syllable
2313- ;;
2314 -386bsd)
2315 os=-bsd
2316 ;;
2317@@ -1380,9 +1219,6 @@
2318 -sinix*)
2319 os=-sysv4
2320 ;;
2321- -tpf*)
2322- os=-tpf
2323- ;;
2324 -triton*)
2325 os=-sysv3
2326 ;;
2327@@ -1419,12 +1255,6 @@
2328 -kaos*)
2329 os=-kaos
2330 ;;
2331- -zvmoe)
2332- os=-zvmoe
2333- ;;
2334- -dicos*)
2335- os=-dicos
2336- ;;
2337 -none)
2338 ;;
2339 *)
2340@@ -1447,12 +1277,6 @@
2341 # system, and we'll never get to this point.
2342
2343 case $basic_machine in
2344- score-*)
2345- os=-elf
2346- ;;
2347- spu-*)
2348- os=-elf
2349- ;;
2350 *-acorn)
2351 os=-riscix1.2
2352 ;;
2353@@ -1462,9 +1286,9 @@
2354 arm*-semi)
2355 os=-aout
2356 ;;
2357- c4x-* | tic4x-*)
2358- os=-coff
2359- ;;
2360+ c4x-* | tic4x-*)
2361+ os=-coff
2362+ ;;
2363 # This must come before the *-dec entry.
2364 pdp10-*)
2365 os=-tops20
2366@@ -1490,9 +1314,6 @@
2367 m68*-cisco)
2368 os=-aout
2369 ;;
2370- mep-*)
2371- os=-elf
2372- ;;
2373 mips*-cisco)
2374 os=-elf
2375 ;;
2376@@ -1511,15 +1332,9 @@
2377 *-be)
2378 os=-beos
2379 ;;
2380- *-haiku)
2381- os=-haiku
2382- ;;
2383 *-ibm)
2384 os=-aix
2385 ;;
2386- *-knuth)
2387- os=-mmixware
2388- ;;
2389 *-wec)
2390 os=-proelf
2391 ;;
2392@@ -1652,15 +1467,9 @@
2393 -mvs* | -opened*)
2394 vendor=ibm
2395 ;;
2396- -os400*)
2397- vendor=ibm
2398- ;;
2399 -ptx*)
2400 vendor=sequent
2401 ;;
2402- -tpf*)
2403- vendor=ibm
2404- ;;
2405 -vxsim* | -vxworks* | -windiss*)
2406 vendor=wrs
2407 ;;
2408@@ -1685,7 +1494,7 @@
2409 esac
2410
2411 echo $basic_machine$os
2412-exit
2413+exit 0
2414
2415 # Local variables:
2416 # eval: (add-hook 'write-file-hooks 'time-stamp)
2417diff -urN --exclude *.m4 memcached-1.4.4/configure repcached-2.2-1.4.4/configure
2418--- memcached-1.4.4/configure Fri Nov 27 09:34:57 2009
2419+++ repcached-2.2-1.4.4/configure Wed Feb 10 19:12:16 2010
2420@@ -1,6 +1,6 @@
2421 #! /bin/sh
2422 # Guess values for system-dependent variables and create Makefiles.
2423-# Generated by GNU Autoconf 2.63 for memcached 1.4.4.
2424+# Generated by GNU Autoconf 2.63 for memcached 1.4.4_49_g6b6b7ed.
2425 #
2426 # Report bugs to <brad@danga.com>.
2427 #
2428@@ -596,8 +596,8 @@
2429 # Identity of this package.
2430 PACKAGE_NAME='memcached'
2431 PACKAGE_TARNAME='memcached'
2432-PACKAGE_VERSION='1.4.4'
2433-PACKAGE_STRING='memcached 1.4.4'
2434+PACKAGE_VERSION='1.4.4_49_g6b6b7ed'
2435+PACKAGE_STRING='memcached 1.4.4_49_g6b6b7ed'
2436 PACKAGE_BUGREPORT='brad@danga.com'
2437
2438 ac_unique_file="memcached.c"
2439@@ -647,6 +647,8 @@
2440 BUILD_CACHE_TRUE
2441 BUILD_SOLARIS_PRIVS_FALSE
2442 BUILD_SOLARIS_PRIVS_TRUE
2443+ENABLE_REPLICATION_FALSE
2444+ENABLE_REPLICATION_TRUE
2445 PROFILER_FLAGS
2446 PROFILER
2447 PROFILER_LDFLAGS
2448@@ -759,6 +761,7 @@
2449 enable_coverage
2450 enable_64bit
2451 with_libevent
2452+enable_replication
2453 enable_docs
2454 '
2455 ac_precious_vars='build_alias
2456@@ -1322,7 +1325,7 @@
2457 # Omit some internal or obsolete options to make the list less imposing.
2458 # This message is too long to be a string in the A/UX 3.1 sh.
2459 cat <<_ACEOF
2460-\`configure' configures memcached 1.4.4 to adapt to many kinds of systems.
2461+\`configure' configures memcached 1.4.4_49_g6b6b7ed to adapt to many kinds of systems.
2462
2463 Usage: $0 [OPTION]... [VAR=VALUE]...
2464
2465@@ -1393,7 +1396,7 @@
2466
2467 if test -n "$ac_init_help"; then
2468 case $ac_init_help in
2469- short | recursive ) echo "Configuration of memcached 1.4.4:";;
2470+ short | recursive ) echo "Configuration of memcached 1.4.4_49_g6b6b7ed:";;
2471 esac
2472 cat <<\_ACEOF
2473
2474@@ -1407,6 +1410,7 @@
2475 --enable-dtrace Enable dtrace probes
2476 --disable-coverage Disable code coverage
2477 --enable-64bit build 64bit version
2478+ --enable-replication support replication
2479 --disable-docs Disable documentation generation
2480
2481 Optional Packages:
2482@@ -1490,7 +1494,7 @@
2483 test -n "$ac_init_help" && exit $ac_status
2484 if $ac_init_version; then
2485 cat <<\_ACEOF
2486-memcached configure 1.4.4
2487+memcached configure 1.4.4_49_g6b6b7ed
2488 generated by GNU Autoconf 2.63
2489
2490 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2491@@ -1504,7 +1508,7 @@
2492 This file contains any messages produced by compilers while
2493 running configure, to aid debugging if configure makes a mistake.
2494
2495-It was created by memcached $as_me 1.4.4, which was
2496+It was created by memcached $as_me 1.4.4_49_g6b6b7ed, which was
2497 generated by GNU Autoconf 2.63. Invocation command line was
2498
2499 $ $0 $@
2500@@ -2347,7 +2351,7 @@
2501
2502 # Define the identity of the package.
2503 PACKAGE=memcached
2504- VERSION=1.4.4
2505+ VERSION=1.4.4_49_g6b6b7ed
2506
2507
2508 cat >>confdefs.h <<_ACEOF
2509@@ -6798,6 +6802,32 @@
2510 { (exit 1); exit 1; }; }
2511 fi
2512
2513+# Check whether --enable-replication was given.
2514+if test "${enable_replication+set}" = set; then
2515+ enableval=$enable_replication; if test "x$enable_threads" = "xyes"; then
2516+ { { $as_echo "$as_me:$LINENO: error: Can't enable threads and replication together." >&5
2517+$as_echo "$as_me: error: Can't enable threads and replication together." >&2;}
2518+ { (exit 1); exit 1; }; }
2519+ else
2520+
2521+cat >>confdefs.h <<\_ACEOF
2522+#define USE_REPLICATION /**/
2523+_ACEOF
2524+
2525+ fi
2526+
2527+fi
2528+
2529+
2530+ if test "x$enable_replication" = "xyes"; then
2531+ ENABLE_REPLICATION_TRUE=
2532+ ENABLE_REPLICATION_FALSE='#'
2533+else
2534+ ENABLE_REPLICATION_TRUE='#'
2535+ ENABLE_REPLICATION_FALSE=
2536+fi
2537+
2538+
2539
2540 for ac_func in mlockall
2541 do
2542@@ -7969,6 +7999,13 @@
2543 Usually this means the macro was only invoked conditionally." >&2;}
2544 { (exit 1); exit 1; }; }
2545 fi
2546+if test -z "${ENABLE_REPLICATION_TRUE}" && test -z "${ENABLE_REPLICATION_FALSE}"; then
2547+ { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_REPLICATION\" was never defined.
2548+Usually this means the macro was only invoked conditionally." >&5
2549+$as_echo "$as_me: error: conditional \"ENABLE_REPLICATION\" was never defined.
2550+Usually this means the macro was only invoked conditionally." >&2;}
2551+ { (exit 1); exit 1; }; }
2552+fi
2553 if test -z "${BUILD_SOLARIS_PRIVS_TRUE}" && test -z "${BUILD_SOLARIS_PRIVS_FALSE}"; then
2554 { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_SOLARIS_PRIVS\" was never defined.
2555 Usually this means the macro was only invoked conditionally." >&5
2556@@ -8312,7 +8349,7 @@
2557 # report actual input values of CONFIG_FILES etc. instead of their
2558 # values after options handling.
2559 ac_log="
2560-This file was extended by memcached $as_me 1.4.4, which was
2561+This file was extended by memcached $as_me 1.4.4_49_g6b6b7ed, which was
2562 generated by GNU Autoconf 2.63. Invocation command line was
2563
2564 CONFIG_FILES = $CONFIG_FILES
2565@@ -8375,7 +8412,7 @@
2566 _ACEOF
2567 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2568 ac_cs_version="\\
2569-memcached config.status 1.4.4
2570+memcached config.status 1.4.4_49_g6b6b7ed
2571 configured by $0, generated by GNU Autoconf 2.63,
2572 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
2573
2574diff -urN --exclude *.m4 memcached-1.4.4/configure.ac repcached-2.2-1.4.4/configure.ac
2575--- memcached-1.4.4/configure.ac Wed Nov 25 03:40:29 2009
2576+++ repcached-2.2-1.4.4/configure.ac Tue Feb 9 23:02:45 2010
2577@@ -382,6 +382,18 @@
2578 AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
2579 fi
2580
2581+dnl Check whether the user wants replication or not
2582+AC_ARG_ENABLE(replication,
2583+ [AS_HELP_STRING([--enable-replication],[support replication])],
2584+ [if test "x$enable_threads" = "xyes"; then
2585+ AC_MSG_ERROR([Can't enable threads and replication together.])
2586+ else
2587+ AC_DEFINE([USE_REPLICATION],,[Define this if you want to use replication])
2588+ fi
2589+ ])
2590+
2591+AM_CONDITIONAL(ENABLE_REPLICATION, test "x$enable_replication" = "xyes")
2592+
2593 AC_CHECK_FUNCS(mlockall)
2594 AC_CHECK_FUNCS(getpagesizes)
2595 AC_CHECK_FUNCS(memcntl)
2596diff -urN --exclude *.m4 memcached-1.4.4/doc/Makefile repcached-2.2-1.4.4/doc/Makefile
2597--- memcached-1.4.4/doc/Makefile Fri Nov 27 09:35:03 2009
2598+++ repcached-2.2-1.4.4/doc/Makefile Wed Feb 10 19:12:43 2010
2599@@ -29,9 +29,9 @@
2600 NORMAL_UNINSTALL = :
2601 PRE_UNINSTALL = :
2602 POST_UNINSTALL = :
2603-build_triplet = x86_64-unknown-linux-gnu
2604-host_triplet = x86_64-unknown-linux-gnu
2605-target_triplet = x86_64-unknown-linux-gnu
2606+build_triplet = i386-unknown-freebsd6.2
2607+host_triplet = i386-unknown-freebsd6.2
2608+target_triplet = i386-unknown-freebsd6.2
2609 #am__append_1 = protocol-binary.txt protocol-binary-range.txt
2610 subdir = doc
2611 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
2612@@ -50,17 +50,17 @@
2613 NROFF = nroff
2614 MANS = $(man_MANS)
2615 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
2616-ACLOCAL = ${SHELL} /home/dormando/p/danga/memcached_github_new/missing --run aclocal-1.10
2617-AMTAR = ${SHELL} /home/dormando/p/danga/memcached_github_new/missing --run tar
2618-AUTOCONF = ${SHELL} /home/dormando/p/danga/memcached_github_new/missing --run autoconf
2619-AUTOHEADER = ${SHELL} /home/dormando/p/danga/memcached_github_new/missing --run autoheader
2620-AUTOMAKE = ${SHELL} /home/dormando/p/danga/memcached_github_new/missing --run automake-1.10
2621-AWK = gawk
2622+ACLOCAL = ${SHELL} /home/mdounin/work/memcached-repcached/memcached/missing --run aclocal-1.10
2623+AMTAR = ${SHELL} /home/mdounin/work/memcached-repcached/memcached/missing --run tar
2624+AUTOCONF = ${SHELL} /home/mdounin/work/memcached-repcached/memcached/missing --run autoconf
2625+AUTOHEADER = ${SHELL} /home/mdounin/work/memcached-repcached/memcached/missing --run autoheader
2626+AUTOMAKE = ${SHELL} /home/mdounin/work/memcached-repcached/memcached/missing --run automake-1.10
2627+AWK = nawk
2628 CC = gcc -std=gnu99
2629 CCDEPMODE = depmode=gcc3
2630 CFLAGS = -g -O2 -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
2631 CPP = gcc -E
2632-CPPFLAGS =
2633+CPPFLAGS = -I/usr/local/include
2634 CYGPATH_W = echo
2635 DEFS = -DHAVE_CONFIG_H
2636 DEPDIR = .deps
2637@@ -69,42 +69,42 @@
2638 ECHO_C =
2639 ECHO_N = -n
2640 ECHO_T =
2641-EGREP = /bin/grep -E
2642+EGREP = /usr/bin/grep -E
2643 ENABLE_SASL =
2644 EXEEXT =
2645-GREP = /bin/grep
2646+GREP = /usr/bin/grep
2647 INSTALL = /usr/bin/install -c
2648 INSTALL_DATA = ${INSTALL} -m 644
2649 INSTALL_PROGRAM = ${INSTALL}
2650 INSTALL_SCRIPT = ${INSTALL}
2651 INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
2652-LDFLAGS =
2653+LDFLAGS = -L/usr/local/lib
2654 LIBOBJS =
2655 LIBS = -levent
2656 LTLIBOBJS =
2657-MAKEINFO = ${SHELL} /home/dormando/p/danga/memcached_github_new/missing --run makeinfo
2658-MKDIR_P = /usr/bin/mkdir -p
2659+MAKEINFO = ${SHELL} /home/mdounin/work/memcached-repcached/memcached/missing --run makeinfo
2660+MKDIR_P = .././install-sh -c -d
2661 OBJEXT = o
2662 PACKAGE = memcached
2663 PACKAGE_BUGREPORT = brad@danga.com
2664 PACKAGE_NAME = memcached
2665-PACKAGE_STRING = memcached 1.4.4
2666+PACKAGE_STRING = memcached 1.4.4_49_g6b6b7ed
2667 PACKAGE_TARNAME = memcached
2668-PACKAGE_VERSION = 1.4.4
2669+PACKAGE_VERSION = 1.4.4_49_g6b6b7ed
2670 PATH_SEPARATOR = :
2671 PROFILER = /usr/bin/gcov
2672 PROFILER_FLAGS = -fprofile-arcs -ftest-coverage
2673 PROFILER_LDFLAGS = -lgcov
2674 SET_MAKE =
2675-SHELL = /bin/sh
2676+SHELL = /usr/local/bin/bash
2677 STRIP =
2678-VERSION = 1.4.4
2679+VERSION = 1.4.4_49_g6b6b7ed
2680 XML2RFC = no
2681-XSLTPROC = /usr/bin/xsltproc
2682-abs_builddir = /home/dormando/p/danga/memcached_github_new/doc
2683-abs_srcdir = /home/dormando/p/danga/memcached_github_new/doc
2684-abs_top_builddir = /home/dormando/p/danga/memcached_github_new
2685-abs_top_srcdir = /home/dormando/p/danga/memcached_github_new
2686+XSLTPROC = /usr/local/bin/xsltproc
2687+abs_builddir = /home/mdounin/work/memcached-repcached/memcached/doc
2688+abs_srcdir = /home/mdounin/work/memcached-repcached/memcached/doc
2689+abs_top_builddir = /home/mdounin/work/memcached-repcached/memcached
2690+abs_top_srcdir = /home/mdounin/work/memcached-repcached/memcached
2691 ac_ct_CC = gcc
2692 am__include = include
2693 am__leading_dot = .
2694@@ -112,10 +112,10 @@
2695 am__tar = ${AMTAR} chof - "$$tardir"
2696 am__untar = ${AMTAR} xf -
2697 bindir = ${exec_prefix}/bin
2698-build = x86_64-unknown-linux-gnu
2699+build = i386-unknown-freebsd6.2
2700 build_alias =
2701-build_cpu = x86_64
2702-build_os = linux-gnu
2703+build_cpu = i386
2704+build_os = freebsd6.2
2705 build_vendor = unknown
2706 builddir = .
2707 datadir = ${datarootdir}
2708@@ -123,21 +123,21 @@
2709 docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
2710 dvidir = ${docdir}
2711 exec_prefix = ${prefix}
2712-host = x86_64-unknown-linux-gnu
2713+host = i386-unknown-freebsd6.2
2714 host_alias =
2715-host_cpu = x86_64
2716-host_os = linux-gnu
2717+host_cpu = i386
2718+host_os = freebsd6.2
2719 host_vendor = unknown
2720 htmldir = ${docdir}
2721 includedir = ${prefix}/include
2722 infodir = ${datarootdir}/info
2723-install_sh = $(SHELL) /home/dormando/p/danga/memcached_github_new/install-sh
2724+install_sh = $(SHELL) /home/mdounin/work/memcached-repcached/memcached/install-sh
2725 libdir = ${exec_prefix}/lib
2726 libexecdir = ${exec_prefix}/libexec
2727 localedir = ${datarootdir}/locale
2728 localstatedir = ${prefix}/var
2729 mandir = ${datarootdir}/man
2730-mkdir_p = /usr/bin/mkdir -p
2731+mkdir_p = $(top_builddir)/./install-sh -c -d
2732 oldincludedir = /usr/include
2733 pdfdir = ${docdir}
2734 prefix = /usr/local
2735@@ -147,10 +147,10 @@
2736 sharedstatedir = ${prefix}/com
2737 srcdir = .
2738 sysconfdir = ${prefix}/etc
2739-target = x86_64-unknown-linux-gnu
2740+target = i386-unknown-freebsd6.2
2741 target_alias =
2742-target_cpu = x86_64
2743-target_os = linux-gnu
2744+target_cpu = i386
2745+target_os = freebsd6.2
2746 target_vendor = unknown
2747 top_build_prefix = ../
2748 top_builddir = ..
2749@@ -379,10 +379,10 @@
2750 no $< $@
2751
2752 %.chk: %.xml xml2rfc/rfc2629-refchk.xsl
2753- /usr/bin/xsltproc xml2rfc/rfc2629-refchk.xsl $< >$@
2754+ /usr/local/bin/xsltproc xml2rfc/rfc2629-refchk.xsl $< >$@
2755
2756 %.full: %.xml xml2rfc/rfc2629-noinc.xsl
2757- /usr/bin/xsltproc xml2rfc/rfc2629-noinc.xsl $< >$@
2758+ /usr/local/bin/xsltproc xml2rfc/rfc2629-noinc.xsl $< >$@
2759 # Tell versions [3.59,3.63) of GNU make to not export all variables.
2760 # Otherwise a system limit (for SysV at least) may be exceeded.
2761 .NOEXPORT:
2762diff -urN --exclude *.m4 memcached-1.4.4/items.c repcached-2.2-1.4.4/items.c
2763--- memcached-1.4.4/items.c Sat Oct 24 00:38:01 2009
2764+++ repcached-2.2-1.4.4/items.c Tue Feb 9 23:02:45 2010
2765@@ -155,6 +155,9 @@
2766 STATS_LOCK();
2767 stats.evictions++;
2768 STATS_UNLOCK();
2769+#ifdef USE_REPLICATION
2770+ replication_call_del(ITEM_key(search), search->nkey);
2771+#endif /* USE_REPLICATION */
2772 }
2773 do_item_unlink(search);
2774 break;
2775@@ -288,8 +291,14 @@
2776 stats.total_items += 1;
2777 STATS_UNLOCK();
2778
2779+#ifdef USE_REPLICATION
2780+ /* Allocate a new CAS ID on link. */
2781+ if(!(it->it_flags & ITEM_REPDATA))
2782+ ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0);
2783+#else
2784 /* Allocate a new CAS ID on link. */
2785 ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0);
2786+#endif /* USE_REPLICATION */
2787
2788 item_link_q(it);
2789
2790diff -urN --exclude *.m4 memcached-1.4.4/memcached.c repcached-2.2-1.4.4/memcached.c
2791--- memcached-1.4.4/memcached.c Fri Nov 27 08:45:13 2009
2792+++ repcached-2.2-1.4.4/memcached.c Wed Feb 10 16:08:37 2010
2793@@ -102,6 +102,30 @@
2794
2795 static void conn_free(conn *c);
2796
2797+#ifdef USE_REPLICATION
2798+static int rep_exit = 0;
2799+static conn *rep_recv = NULL;
2800+static conn *rep_send = NULL;
2801+static conn *rep_conn = NULL;
2802+static conn *rep_serv = NULL;
2803+static int server_socket_replication(const int);
2804+static void server_close_replication(void);
2805+static int replication_init(void);
2806+static int replication_server_init(void);
2807+static int replication_client_init(void);
2808+static int replication_start(void);
2809+static int replication_connect(void);
2810+static int replication_close(void);
2811+static void replication_dispatch_close(void);
2812+static int replication_marugoto(int);
2813+static int replication_send(conn *);
2814+static int replication_pop(void);
2815+static int replication_push(void);
2816+static int replication_exit(void);
2817+static int replication_item(Q_ITEM *);
2818+static pthread_mutex_t replication_pipe_lock = PTHREAD_MUTEX_INITIALIZER;
2819+#endif /* USE_REPLICATION */
2820+
2821 /** exported globals **/
2822 struct stats stats;
2823 struct settings settings;
2824@@ -194,6 +218,11 @@
2825 settings.backlog = 1024;
2826 settings.binding_protocol = negotiating_prot;
2827 settings.item_size_max = 1024 * 1024; /* The famous 1MB upper limit. */
2828+#ifdef USE_REPLICATION
2829+ settings.rep_addr.s_addr = htonl(INADDR_ANY);
2830+ settings.rep_port = 11212;
2831+ settings.rep_qmax = 8192;
2832+#endif /* USE_REPLICATION */
2833 }
2834
2835 /*
2836@@ -382,6 +411,10 @@
2837 prot_text(c->protocol));
2838 } else if (IS_UDP(transport)) {
2839 fprintf(stderr, "<%d server listening (udp)\n", sfd);
2840+#ifdef USE_REPLICATION
2841+ } else if (init_state == conn_rep_listen) {
2842+ fprintf(stderr, "<%d server listening (replication)\n", sfd);
2843+#endif /* USE_REPLICATION */
2844 } else if (c->protocol == negotiating_prot) {
2845 fprintf(stderr, "<%d new auto-negotiating client connection\n",
2846 sfd);
2847@@ -593,7 +626,11 @@
2848 "conn_nread",
2849 "conn_swallow",
2850 "conn_closing",
2851- "conn_mwrite" };
2852+ "conn_mwrite",
2853+ "conn_repconnect",
2854+ "conn_rep_listen",
2855+ "conn_pipe_recv",
2856+ "conn_pipe_send" };
2857 return statenames[state];
2858 }
2859
2860@@ -752,6 +789,14 @@
2861
2862 assert(c != NULL);
2863
2864+#ifdef USE_REPLICATION
2865+ if (c == rep_conn){
2866+ if (settings.verbose > 1)
2867+ fprintf(stderr, "REP>%d %s\n", c->sfd, str);
2868+ conn_set_state(c, conn_new_cmd);
2869+ return;
2870+ }
2871+#endif /* USE_REPLICATION */
2872 if (c->noreply) {
2873 if (settings.verbose > 1)
2874 fprintf(stderr, ">%d NOREPLY %s\n", c->sfd, str);
2875@@ -791,9 +836,11 @@
2876 int comm = c->cmd;
2877 enum store_item_type ret;
2878
2879- pthread_mutex_lock(&c->thread->stats.mutex);
2880- c->thread->stats.slab_stats[it->slabs_clsid].set_cmds++;
2881- pthread_mutex_unlock(&c->thread->stats.mutex);
2882+ if (c->thread) {
2883+ pthread_mutex_lock(&c->thread->stats.mutex);
2884+ c->thread->stats.slab_stats[it->slabs_clsid].set_cmds++;
2885+ pthread_mutex_unlock(&c->thread->stats.mutex);
2886+ }
2887
2888 if (strncmp(ITEM_data(it) + it->nbytes - 2, "\r\n", 2) != 0) {
2889 out_string(c, "CLIENT_ERROR bad data chunk");
2890@@ -832,6 +879,11 @@
2891
2892 switch (ret) {
2893 case STORED:
2894+#ifdef USE_REPLICATION
2895+ if( c != rep_conn ){
2896+ replication_call_rep(ITEM_key(it), it->nkey);
2897+ }
2898+#endif /* USE_REPLICATION */
2899 out_string(c, "STORED");
2900 break;
2901 case EXISTS:
2902@@ -2410,6 +2462,11 @@
2903 APPEND_STAT("listen_disabled_num", "%llu", (unsigned long long)stats.listen_disabled_num);
2904 APPEND_STAT("threads", "%d", settings.num_threads);
2905 APPEND_STAT("conn_yields", "%llu", (unsigned long long)thread_stats.conn_yields);
2906+#ifdef USE_REPLICATION
2907+ APPEND_STAT("replication", "MASTER", 0);
2908+ APPEND_STAT("repcached_version", "%s", REPCACHED_VERSION);
2909+ APPEND_STAT("repcached_qi_free", "%u", settings.rep_qmax - get_qi_count());
2910+#endif /*USE_REPLICATION*/
2911 STATS_UNLOCK();
2912 }
2913
2914@@ -2797,6 +2854,11 @@
2915 switch(add_delta(c, it, incr, delta, temp)) {
2916 case OK:
2917 out_string(c, temp);
2918+#ifdef USE_REPLICATION
2919+ if( c != rep_conn){
2920+ replication_call_rep(ITEM_key(it), it->nkey);
2921+ }
2922+#endif /* USE_REPLICATION */
2923 break;
2924 case NON_NUMERIC:
2925 out_string(c, "CLIENT_ERROR cannot increment or decrement non-numeric value");
2926@@ -2911,17 +2973,25 @@
2927 if (it) {
2928 MEMCACHED_COMMAND_DELETE(c->sfd, ITEM_key(it), it->nkey);
2929
2930- pthread_mutex_lock(&c->thread->stats.mutex);
2931- c->thread->stats.slab_stats[it->slabs_clsid].delete_hits++;
2932- pthread_mutex_unlock(&c->thread->stats.mutex);
2933+ if (c->thread) {
2934+ pthread_mutex_lock(&c->thread->stats.mutex);
2935+ c->thread->stats.slab_stats[it->slabs_clsid].delete_hits++;
2936+ pthread_mutex_unlock(&c->thread->stats.mutex);
2937+ }
2938
2939 item_unlink(it);
2940 item_remove(it); /* release our reference */
2941+#ifdef USE_REPLICATION
2942+ if( c != rep_conn )
2943+ replication_call_del(key, nkey);
2944+#endif /* USE_REPLICATION */
2945 out_string(c, "DELETED");
2946 } else {
2947- pthread_mutex_lock(&c->thread->stats.mutex);
2948- c->thread->stats.delete_misses++;
2949- pthread_mutex_unlock(&c->thread->stats.mutex);
2950+ if (c->thread) {
2951+ pthread_mutex_lock(&c->thread->stats.mutex);
2952+ c->thread->stats.delete_misses++;
2953+ pthread_mutex_unlock(&c->thread->stats.mutex);
2954+ }
2955
2956 out_string(c, "NOT_FOUND");
2957 }
2958@@ -2986,6 +3056,22 @@
2959
2960 process_update_command(c, tokens, ntokens, comm, true);
2961
2962+#ifdef USE_REPLICATION
2963+ } else if ((ntokens == 7) && (strcmp(tokens[COMMAND_TOKEN].value, "rep") == 0 && (comm = NREAD_SET)) && (c == rep_conn)) {
2964+
2965+ process_update_command(c, tokens, ntokens, comm, true);
2966+ if(c->item)
2967+ ((item *)(c->item))->it_flags |= ITEM_REPDATA;
2968+
2969+ } else if ((ntokens == 2) && (strcmp(tokens[COMMAND_TOKEN].value, "marugoto_end") == 0) && (c == rep_conn)) {
2970+ if(replication_start() == -1)
2971+ exit(EXIT_FAILURE);
2972+ if (settings.verbose > 0)
2973+ fprintf(stderr,"replication: start\n");
2974+ out_string(c, "OK");
2975+ return;
2976+
2977+#endif /* USE_REPLICATION */
2978 } else if ((ntokens == 4 || ntokens == 5) && (strcmp(tokens[COMMAND_TOKEN].value, "incr") == 0)) {
2979
2980 process_arithmetic_command(c, tokens, ntokens, 1);
2981@@ -3012,11 +3098,17 @@
2982
2983 set_noreply_maybe(c, tokens, ntokens);
2984
2985- pthread_mutex_lock(&c->thread->stats.mutex);
2986- c->thread->stats.flush_cmds++;
2987- pthread_mutex_unlock(&c->thread->stats.mutex);
2988+ if (c->thread) {
2989+ pthread_mutex_lock(&c->thread->stats.mutex);
2990+ c->thread->stats.flush_cmds++;
2991+ pthread_mutex_unlock(&c->thread->stats.mutex);
2992+ }
2993
2994 if(ntokens == (c->noreply ? 3 : 2)) {
2995+#ifdef USE_REPLICATION
2996+ if( c != rep_conn )
2997+ replication_call_flush_all();
2998+#endif
2999 settings.oldest_live = current_time - 1;
3000 item_flush_expired();
3001 out_string(c, "OK");
3002@@ -3029,6 +3121,11 @@
3003 return;
3004 }
3005
3006+#ifdef USE_REPLICATION
3007+ if( c != rep_conn )
3008+ replication_call_defer_flush_all(realtime(exptime) + process_started);
3009+#endif
3010+ settings.oldest_live = realtime(exptime) - 1;
3011 /*
3012 If exptime is zero realtime() would return zero too, and
3013 realtime(exptime) - 1 would overflow to the max unsigned
3014@@ -3275,9 +3372,11 @@
3015 int avail = c->rsize - c->rbytes;
3016 res = read(c->sfd, c->rbuf + c->rbytes, avail);
3017 if (res > 0) {
3018- pthread_mutex_lock(&c->thread->stats.mutex);
3019- c->thread->stats.bytes_read += res;
3020- pthread_mutex_unlock(&c->thread->stats.mutex);
3021+ if (c->thread) {
3022+ pthread_mutex_lock(&c->thread->stats.mutex);
3023+ c->thread->stats.bytes_read += res;
3024+ pthread_mutex_unlock(&c->thread->stats.mutex);
3025+ }
3026 gotdata = READ_DATA_RECEIVED;
3027 c->rbytes += res;
3028 if (res == avail) {
3029@@ -3423,6 +3522,12 @@
3030
3031 assert(c != NULL);
3032
3033+#ifdef USE_REPLICATION
3034+ if(rep_exit && (c->state != conn_pipe_recv)){
3035+ return;
3036+ }
3037+#endif /* USE_REPLICATION */
3038+
3039 while (!stop) {
3040
3041 switch(c->state) {
3042@@ -3502,9 +3607,11 @@
3043 if (nreqs >= 0) {
3044 reset_cmd_handler(c);
3045 } else {
3046- pthread_mutex_lock(&c->thread->stats.mutex);
3047- c->thread->stats.conn_yields++;
3048- pthread_mutex_unlock(&c->thread->stats.mutex);
3049+ if (c->thread) {
3050+ pthread_mutex_lock(&c->thread->stats.mutex);
3051+ c->thread->stats.conn_yields++;
3052+ pthread_mutex_unlock(&c->thread->stats.mutex);
3053+ }
3054 if (c->rbytes > 0) {
3055 /* We have already read in data into the input buffer,
3056 so libevent will most likely not signal read events
3057@@ -3545,9 +3652,11 @@
3058 /* now try reading from the socket */
3059 res = read(c->sfd, c->ritem, c->rlbytes);
3060 if (res > 0) {
3061- pthread_mutex_lock(&c->thread->stats.mutex);
3062- c->thread->stats.bytes_read += res;
3063- pthread_mutex_unlock(&c->thread->stats.mutex);
3064+ if (c->thread) {
3065+ pthread_mutex_lock(&c->thread->stats.mutex);
3066+ c->thread->stats.bytes_read += res;
3067+ pthread_mutex_unlock(&c->thread->stats.mutex);
3068+ }
3069 if (c->rcurr == c->ritem) {
3070 c->rcurr += res;
3071 }
3072@@ -3600,9 +3709,11 @@
3073 /* now try reading from the socket */
3074 res = read(c->sfd, c->rbuf, c->rsize > c->sbytes ? c->sbytes : c->rsize);
3075 if (res > 0) {
3076- pthread_mutex_lock(&c->thread->stats.mutex);
3077- c->thread->stats.bytes_read += res;
3078- pthread_mutex_unlock(&c->thread->stats.mutex);
3079+ if (c->thread) {
3080+ pthread_mutex_lock(&c->thread->stats.mutex);
3081+ c->thread->stats.bytes_read += res;
3082+ pthread_mutex_unlock(&c->thread->stats.mutex);
3083+ }
3084 c->sbytes -= res;
3085 break;
3086 }
3087@@ -3698,6 +3809,10 @@
3088 case conn_closing:
3089 if (IS_UDP(c->transport))
3090 conn_cleanup(c);
3091+#ifdef USE_REPLICATION
3092+ else if(c == rep_conn)
3093+ replication_close();
3094+#endif /*USE_REPLICATION*/
3095 else
3096 conn_close(c);
3097 stop = true;
3098@@ -3706,6 +3821,70 @@
3099 case conn_max_state:
3100 assert(false);
3101 break;
3102+
3103+#ifdef USE_REPLICATION
3104+ case conn_pipe_recv:
3105+ if(replication_pop()){
3106+ replication_close();
3107+ }else{
3108+ replication_send(rep_conn);
3109+ }
3110+ stop = true;
3111+ break;
3112+
3113+ case conn_rep_listen:
3114+ if (settings.verbose > 0)
3115+ fprintf(stderr,"replication: accept\n");
3116+ addrlen = sizeof(addr);
3117+ res = accept(c->sfd, (struct sockaddr *)&addr, &addrlen);
3118+ if(res == -1){
3119+ if(errno == EAGAIN || errno == EWOULDBLOCK) {
3120+ } else if (errno == EMFILE) {
3121+ fprintf(stderr, "replication: Too many opened connections\n");
3122+ } else {
3123+ fprintf(stderr, "replication: accept error\n");
3124+ }
3125+ }else{
3126+ if(rep_conn){
3127+ close(res);
3128+ fprintf(stderr,"replication: already connected\n");
3129+ }else{
3130+ if((flags = fcntl(res, F_GETFL, 0)) < 0 || fcntl(res, F_SETFL, flags | O_NONBLOCK) < 0){
3131+ close(res);
3132+ fprintf(stderr, "replication: Can't Setting O_NONBLOCK\n");
3133+ }else{
3134+ server_close_replication();
3135+ rep_conn = conn_new(res, conn_read, EV_READ | EV_PERSIST, DATA_BUFFER_SIZE, tcp_transport, main_base);
3136+ rep_conn->item = NULL;
3137+ rep_conn->rbytes = 0;
3138+ rep_conn->rcurr = rep_conn->rbuf;
3139+ replication_connect();
3140+ replication_marugoto(1);
3141+ replication_marugoto(0);
3142+ }
3143+ }
3144+ }
3145+ stop = true;
3146+ break;
3147+
3148+ case conn_repconnect:
3149+ rep_conn = c;
3150+ replication_connect();
3151+ conn_set_state(c, conn_read);
3152+ if (settings.verbose > 0)
3153+ fprintf(stderr,"replication: marugoto copying\n");
3154+ if(!update_event(c, EV_READ | EV_PERSIST)){
3155+ fprintf(stderr, "replication: Couldn't update event\n");
3156+ conn_set_state(c, conn_closing);
3157+ }
3158+ stop = true;
3159+ break;
3160+
3161+ case conn_pipe_send:
3162+ /* should not happen */
3163+ fprintf(stderr, "replication: unexpected conn_pipe_send state\n");
3164+ break;
3165+#endif /* USE_REPLICATION */
3166 }
3167 }
3168
3169@@ -4002,6 +4181,89 @@
3170 return 0;
3171 }
3172
3173+#ifdef USE_REPLICATION
3174+static int server_socket_replication(const int port) {
3175+ int sfd;
3176+ struct linger ling = {0, 0};
3177+ struct addrinfo *ai;
3178+ struct addrinfo *next;
3179+ struct addrinfo hints;
3180+ char port_buf[NI_MAXSERV];
3181+ int error;
3182+ int success = 0;
3183+
3184+ int flags =1;
3185+
3186+ memset(&hints, 0, sizeof (hints));
3187+ hints.ai_flags = AI_PASSIVE|AI_ADDRCONFIG;
3188+ hints.ai_family = AF_UNSPEC;
3189+ hints.ai_protocol = IPPROTO_TCP;
3190+ hints.ai_socktype = SOCK_STREAM;
3191+ snprintf(port_buf, NI_MAXSERV, "%d", port);
3192+ error= getaddrinfo(settings.inter, port_buf, &hints, &ai);
3193+ if (error != 0) {
3194+ if (error != EAI_SYSTEM)
3195+ fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(error));
3196+ else
3197+ perror("getaddrinfo()");
3198+
3199+ return 1;
3200+ }
3201+
3202+ for (next= ai; next; next= next->ai_next) {
3203+ conn *rep_serv_add;
3204+ if ((sfd = new_socket(next)) == -1) {
3205+ freeaddrinfo(ai);
3206+ return 1;
3207+ }
3208+ setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void *)&flags, sizeof(flags));
3209+ setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
3210+ setsockopt(sfd, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
3211+ setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags));
3212+
3213+ if (bind(sfd, next->ai_addr, next->ai_addrlen) == -1) {
3214+ if (errno != EADDRINUSE) {
3215+ perror("bind()");
3216+ close(sfd);
3217+ freeaddrinfo(ai);
3218+ return 1;
3219+ }
3220+ close(sfd);
3221+ continue;
3222+ } else {
3223+ success++;
3224+ if (listen(sfd, 1024) == -1) {
3225+ perror("listen()");
3226+ close(sfd);
3227+ freeaddrinfo(ai);
3228+ return 1;
3229+ }
3230+ }
3231+
3232+ if (!(rep_serv_add = conn_new(sfd, conn_rep_listen,
3233+ EV_READ | EV_PERSIST, 1, tcp_transport, main_base))) {
3234+ fprintf(stderr, "failed to create replication server connection\n");
3235+ exit(EXIT_FAILURE);
3236+ }
3237+
3238+ rep_serv_add->next = rep_serv;
3239+ rep_serv = rep_serv_add;
3240+ }
3241+
3242+ freeaddrinfo(ai);
3243+
3244+ /* Return zero iff we detected no errors in starting up connections */
3245+ return success == 0;
3246+}
3247+
3248+static void server_close_replication(void) {
3249+ while(rep_serv){
3250+ conn_close(rep_serv);
3251+ rep_serv = rep_serv->next;
3252+ }
3253+}
3254+#endif /* USE_REPLICATION */
3255+
3256 /*
3257 * We keep the current time of day in a global variable that's updated by a
3258 * timer event. This saves us a bunch of time() system calls (we really only
3259@@ -4041,6 +4303,9 @@
3260
3261 static void usage(void) {
3262 printf(PACKAGE " " VERSION "\n");
3263+#ifdef USE_REPLICATION
3264+ printf("repcached %s\n",REPCACHED_VERSION);
3265+#endif /* USE_REPLICATION */
3266 printf("-p <num> TCP port number to listen on (default: 11211)\n"
3267 "-U <num> UDP port number to listen on (default: 11211, 0 is off)\n"
3268 "-s <file> UNIX socket path to listen on (disables network support)\n"
3269@@ -4088,6 +4353,10 @@
3270 #ifdef ENABLE_SASL
3271 printf("-S Turn on Sasl authentication\n");
3272 #endif
3273+#ifdef USE_REPLICATION
3274+ printf("-x <ip_addr> hostname or IP address of peer repcached\n");
3275+ printf("-X <num> TCP port number for replication (default: 11212)\n");
3276+#endif /* USE_REPLICATION */
3277 return;
3278 }
3279
3280@@ -4194,6 +4463,26 @@
3281 exit(EXIT_SUCCESS);
3282 }
3283
3284+#ifdef USE_REPLICATION
3285+static void sig_handler_cb(int fd, short event, void *arg)
3286+{
3287+ struct event *signal = arg;
3288+
3289+ if (settings.verbose)
3290+ fprintf(stderr, "got signal %d\n", EVENT_SIGNAL(signal));
3291+
3292+ if (replication_exit()) {
3293+ exit(EXIT_FAILURE);
3294+ }
3295+
3296+ pthread_mutex_lock(&replication_pipe_lock);
3297+ if (!rep_send) {
3298+ exit(EXIT_SUCCESS);
3299+ }
3300+ pthread_mutex_unlock(&replication_pipe_lock);
3301+}
3302+#endif /* USE_REPLICATION */
3303+
3304 #ifndef HAVE_SIGIGNORE
3305 static int sigignore(int sig) {
3306 struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = 0 };
3307@@ -4249,6 +4538,57 @@
3308 #endif
3309 }
3310
3311+static void create_listening_sockets(void)
3312+{
3313+ /* create unix mode sockets after dropping privileges */
3314+ if (settings.socketpath != NULL) {
3315+ errno = 0;
3316+ if (server_socket_unix(settings.socketpath,settings.access)) {
3317+ vperror("failed to listen on UNIX socket: %s", settings.socketpath);
3318+ exit(EX_OSERR);
3319+ }
3320+ }
3321+
3322+ /* create the listening socket, bind it, and init */
3323+ if (settings.socketpath == NULL) {
3324+ const char *portnumber_filename = getenv("MEMCACHED_PORT_FILENAME");
3325+ char temp_portnumber_filename[PATH_MAX];
3326+ FILE *portnumber_file = NULL;
3327+
3328+ if (portnumber_filename != NULL) {
3329+ snprintf(temp_portnumber_filename,
3330+ sizeof(temp_portnumber_filename),
3331+ "%s.lck", portnumber_filename);
3332+
3333+ portnumber_file = fopen(temp_portnumber_filename, "a");
3334+ if (portnumber_file == NULL) {
3335+ fprintf(stderr, "Failed to open \"%s\": %s\n",
3336+ temp_portnumber_filename, strerror(errno));
3337+ }
3338+ }
3339+
3340+ errno = 0;
3341+ if (settings.port && server_socket(settings.port, tcp_transport,
3342+ portnumber_file)) {
3343+ vperror("failed to listen on TCP port %d", settings.port);
3344+ exit(EX_OSERR);
3345+ }
3346+
3347+ /* create the UDP listening socket and bind it */
3348+ errno = 0;
3349+ if (settings.udpport && server_socket(settings.udpport, udp_transport,
3350+ portnumber_file)) {
3351+ vperror("failed to listen on UDP port %d", settings.udpport);
3352+ exit(EX_OSERR);
3353+ }
3354+
3355+ if (portnumber_file) {
3356+ fclose(portnumber_file);
3357+ rename(temp_portnumber_filename, portnumber_filename);
3358+ }
3359+ }
3360+}
3361+
3362 int main (int argc, char **argv) {
3363 int c;
3364 bool lock_memory = false;
3365@@ -4261,6 +4601,11 @@
3366 struct rlimit rlim;
3367 char unit = '\0';
3368 int size_max = 0;
3369+#ifdef USE_REPLICATION
3370+ struct in_addr addr;
3371+ struct addrinfo master_hint;
3372+ struct addrinfo *master_addr;
3373+#endif /* USE_REPLICATION */
3374 /* listening sockets */
3375 static int *l_socket = NULL;
3376
3377@@ -4307,6 +4652,11 @@
3378 "B:" /* Binding protocol */
3379 "I:" /* Max item size */
3380 "S" /* Sasl ON */
3381+#ifdef USE_REPLICATION
3382+ "X:" /* replication port */
3383+ "x:" /* replication master */
3384+ "q:" /* replication queue length */
3385+#endif /* USE_REPLICATION */
3386 ))) {
3387 switch (c) {
3388 case 'a':
3389@@ -4462,6 +4812,31 @@
3390 );
3391 }
3392 break;
3393+#ifdef USE_REPLICATION
3394+ case 'x':
3395+ if (inet_pton(AF_INET, optarg, &addr) <= 0) {
3396+ memset(&master_hint, 0, sizeof(master_hint));
3397+ master_hint.ai_flags = 0;
3398+ master_hint.ai_socktype = 0;
3399+ master_hint.ai_protocol = 0;
3400+ if(!getaddrinfo(optarg, NULL, &master_hint, &master_addr)){
3401+ settings.rep_addr = ((struct sockaddr_in *)(master_addr->ai_addr)) -> sin_addr;
3402+ freeaddrinfo(master_addr);
3403+ }else{
3404+ fprintf(stderr, "Illegal address: %s\n", optarg);
3405+ return 1;
3406+ }
3407+ } else {
3408+ settings.rep_addr = addr;
3409+ }
3410+ break;
3411+ case 'X':
3412+ settings.rep_port = atoi(optarg);
3413+ break;
3414+ case 'q':
3415+ settings.rep_qmax = atoi(optarg);
3416+ break;
3417+#endif /* USE_REPLICATION */
3418 case 'S': /* set Sasl authentication to true. Default is false */
3419 #ifndef ENABLE_SASL
3420 fprintf(stderr, "This server is not built with SASL support.\n");
3421@@ -4587,6 +4962,17 @@
3422 /* initialize main thread libevent instance */
3423 main_base = event_init();
3424
3425+#ifdef USE_REPLICATION
3426+ /* register events for SIGINT and SIGTERM to handle them in main thread */
3427+ struct event signal_int, signal_term;
3428+ event_set(&signal_int, SIGINT, EV_SIGNAL|EV_PERSIST, sig_handler_cb,
3429+ &signal_int);
3430+ event_add(&signal_int, NULL);
3431+ event_set(&signal_term, SIGTERM, EV_SIGNAL|EV_PERSIST, sig_handler_cb,
3432+ &signal_term);
3433+ event_add(&signal_term, NULL);
3434+#endif
3435+
3436 /* initialize other stuff */
3437 stats_init();
3438 assoc_init();
3439@@ -4615,63 +5001,21 @@
3440 /* initialise clock event */
3441 clock_handler(0, 0, 0);
3442
3443- /* create unix mode sockets after dropping privileges */
3444- if (settings.socketpath != NULL) {
3445- errno = 0;
3446- if (server_socket_unix(settings.socketpath,settings.access)) {
3447- vperror("failed to listen on UNIX socket: %s", settings.socketpath);
3448- exit(EX_OSERR);
3449- }
3450- }
3451-
3452- /* create the listening socket, bind it, and init */
3453- if (settings.socketpath == NULL) {
3454- int udp_port;
3455-
3456- const char *portnumber_filename = getenv("MEMCACHED_PORT_FILENAME");
3457- char temp_portnumber_filename[PATH_MAX];
3458- FILE *portnumber_file = NULL;
3459-
3460- if (portnumber_filename != NULL) {
3461- snprintf(temp_portnumber_filename,
3462- sizeof(temp_portnumber_filename),
3463- "%s.lck", portnumber_filename);
3464-
3465- portnumber_file = fopen(temp_portnumber_filename, "a");
3466- if (portnumber_file == NULL) {
3467- fprintf(stderr, "Failed to open \"%s\": %s\n",
3468- temp_portnumber_filename, strerror(errno));
3469- }
3470- }
3471-
3472- errno = 0;
3473- if (settings.port && server_socket(settings.port, tcp_transport,
3474- portnumber_file)) {
3475- vperror("failed to listen on TCP port %d", settings.port);
3476- exit(EX_OSERR);
3477- }
3478-
3479- /*
3480- * initialization order: first create the listening sockets
3481- * (may need root on low ports), then drop root if needed,
3482- * then daemonise if needed, then init libevent (in some cases
3483- * descriptors created by libevent wouldn't survive forking).
3484- */
3485- udp_port = settings.udpport ? settings.udpport : settings.port;
3486-
3487- /* create the UDP listening socket and bind it */
3488- errno = 0;
3489- if (settings.udpport && server_socket(settings.udpport, udp_transport,
3490- portnumber_file)) {
3491- vperror("failed to listen on UDP port %d", settings.udpport);
3492- exit(EX_OSERR);
3493- }
3494+ /*
3495+ * initialization order: first create the listening sockets
3496+ * (may need root on low ports), then drop root if needed,
3497+ * then daemonise if needed, then init libevent (in some cases
3498+ * descriptors created by libevent wouldn't survive forking).
3499+ */
3500
3501- if (portnumber_file) {
3502- fclose(portnumber_file);
3503- rename(temp_portnumber_filename, portnumber_filename);
3504- }
3505+#ifdef USE_REPLICATION
3506+ if(replication_init() == -1){
3507+ fprintf(stderr, "faild to replication init\n");
3508+ exit(EXIT_FAILURE);
3509 }
3510+#else
3511+ create_listening_sockets();
3512+#endif
3513
3514 /* Drop privileges no longer needed */
3515 drop_privileges();
3516@@ -4694,3 +5038,401 @@
3517
3518 return EXIT_SUCCESS;
3519 }
3520+
3521+#ifdef USE_REPLICATION
3522+static int replication_start(void)
3523+{
3524+ static int start = 0;
3525+ if(start)
3526+ return(0);
3527+
3528+ create_listening_sockets();
3529+
3530+ start = 1;
3531+ return(0);
3532+}
3533+
3534+static int replication_server_init(void)
3535+{
3536+ rep_recv = NULL;
3537+ rep_send = NULL;
3538+ rep_conn = NULL;
3539+ if(server_socket_replication(settings.rep_port)){
3540+ fprintf(stderr, "replication: failed to initialize replication server socket\n");
3541+ return(-1);
3542+ }
3543+ if (settings.verbose > 0)
3544+ fprintf(stderr, "replication: listen\n");
3545+ return(replication_start());
3546+}
3547+
3548+static int replication_client_init(void)
3549+{
3550+ int s;
3551+ conn *c;
3552+ struct addrinfo ai;
3553+ struct sockaddr_in server;
3554+
3555+ rep_recv = NULL;
3556+ rep_send = NULL;
3557+ rep_conn = NULL;
3558+
3559+ memset(&ai,0,sizeof(ai));
3560+ ai.ai_family = AF_INET;
3561+ ai.ai_socktype = SOCK_STREAM;
3562+ s = new_socket(&ai);
3563+
3564+ if(s == -1) {
3565+ fprintf(stderr, "replication: failed to replication client socket\n");
3566+ return(-1);
3567+ }else{
3568+ /* connect */
3569+ memset((char *)&server, 0, sizeof(server));
3570+ server.sin_family = AF_INET;
3571+ server.sin_addr = settings.rep_addr;
3572+ server.sin_port = htons(settings.rep_port);
3573+ if (settings.verbose > 0)
3574+ fprintf(stderr,"replication: connect (peer=%s:%d)\n", inet_ntoa(settings.rep_addr), settings.rep_port);
3575+ if(connect(s,(struct sockaddr *)&server, sizeof(server)) == 0){
3576+ c = conn_new(s, conn_repconnect, EV_WRITE | EV_PERSIST, DATA_BUFFER_SIZE, false, main_base);
3577+ if(c == NULL){
3578+ fprintf(stderr, "replication: failed to create client conn");
3579+ close(s);
3580+ return(-1);
3581+ }
3582+ drive_machine(c);
3583+ }else{
3584+ if(errno == EINPROGRESS){
3585+ c = conn_new(s, conn_repconnect, EV_WRITE | EV_PERSIST, DATA_BUFFER_SIZE, false, main_base);
3586+ if(c == NULL){
3587+ fprintf(stderr, "replication: failed to create client conn");
3588+ close(s);
3589+ return(-1);
3590+ }
3591+ }else{
3592+ fprintf(stdout,"replication: can't connect %s:%d\n", inet_ntoa(server.sin_addr), ntohs(server.sin_port));
3593+ close(s);
3594+ return(-1);
3595+ }
3596+ }
3597+ }
3598+ return(0);
3599+}
3600+
3601+static int replication_init(void)
3602+{
3603+ if(settings.rep_addr.s_addr != htonl(INADDR_ANY)){
3604+ if(replication_client_init() != -1){
3605+ return(0);
3606+ }
3607+ }
3608+ return(replication_server_init());
3609+}
3610+
3611+static int replication_connect(void)
3612+{
3613+ int f;
3614+ int p[2];
3615+
3616+ if(pipe(p) == -1){
3617+ fprintf(stderr, "replication: can't create pipe\n");
3618+ return(-1);
3619+ }else{
3620+ if((f = fcntl(p[0], F_GETFL, 0)) < 0 || fcntl(p[0], F_SETFL, f | O_NONBLOCK) < 0) {
3621+ fprintf(stderr, "replication: can't setting O_NONBLOCK pipe[0]\n");
3622+ return(-1);
3623+ }
3624+ if((f = fcntl(p[1], F_GETFL, 0)) < 0 || fcntl(p[1], F_SETFL, f | O_NONBLOCK) < 0) {
3625+ fprintf(stderr, "replication: can't setting O_NONBLOCK pipe[0]\n");
3626+ return(-1);
3627+ }
3628+ pthread_mutex_lock(&replication_pipe_lock);
3629+ rep_recv = conn_new(p[0], conn_pipe_recv, EV_READ | EV_PERSIST, DATA_BUFFER_SIZE, tcp_transport, main_base);
3630+ rep_send = conn_new(p[1], conn_pipe_send, EV_READ | EV_PERSIST, DATA_BUFFER_SIZE, tcp_transport, main_base);
3631+ event_del(&rep_send->event);
3632+ pthread_mutex_unlock(&replication_pipe_lock);
3633+ }
3634+ return(0);
3635+}
3636+
3637+static int replication_close(void)
3638+{
3639+ int c;
3640+ int r;
3641+ Q_ITEM *q;
3642+
3643+ if(settings.verbose > 0)
3644+ fprintf(stderr,"replication: close\n");
3645+ if(rep_recv){
3646+ rep_recv->rbytes = sizeof(q);
3647+ rep_recv->rcurr = rep_recv->rbuf;
3648+ c = 0;
3649+ do{
3650+ r = read(rep_recv->sfd, rep_recv->rcurr, rep_recv->rbytes);
3651+ if(r == -1){
3652+ break;
3653+ }
3654+ rep_recv->rbytes -= r;
3655+ rep_recv->rcurr += r;
3656+ if(!rep_recv->rbytes){
3657+ memcpy(&q, rep_recv->rbuf, sizeof(q));
3658+ rep_recv->rbytes = sizeof(q);
3659+ rep_recv->rcurr = rep_recv->rbuf;
3660+ qi_free(q);
3661+ c++;
3662+ }
3663+ }while(r);
3664+ conn_close(rep_recv);
3665+ rep_recv = NULL;
3666+ if (settings.verbose > 1) {
3667+ fprintf(stderr, "replication: qitem free %d items\n", qi_free_list());
3668+ fprintf(stderr, "replication: close recv %d items\n", c);
3669+ }
3670+ }
3671+ pthread_mutex_lock(&replication_pipe_lock);
3672+ if(rep_send){
3673+ conn_close(rep_send);
3674+ rep_send = NULL;
3675+ if (settings.verbose > 1)
3676+ fprintf(stderr,"replication: close send\n");
3677+ }
3678+ pthread_mutex_unlock(&replication_pipe_lock);
3679+ if(rep_conn){
3680+ conn_close(rep_conn);
3681+ rep_conn = NULL;
3682+ if (settings.verbose > 1)
3683+ fprintf(stderr,"replication: close conn\n");
3684+ }
3685+ if(!rep_exit)
3686+ replication_server_init();
3687+ return(0);
3688+}
3689+
3690+static void replication_dispatch_close(void)
3691+{
3692+ if (settings.verbose > 1)
3693+ fprintf(stderr, "replication: dispatch close\n");
3694+ pthread_mutex_lock(&replication_pipe_lock);
3695+ if (rep_send) {
3696+ conn_close(rep_send);
3697+ rep_send = NULL;
3698+ }
3699+ pthread_mutex_unlock(&replication_pipe_lock);
3700+}
3701+
3702+static int replication_marugoto(int f)
3703+{
3704+ static int keysend = 0;
3705+ static int keycount = 0;
3706+ static char *keylist = NULL;
3707+ static char *keyptr = NULL;
3708+
3709+ if(f){
3710+ if(keylist){
3711+ free(keylist);
3712+ keylist = NULL;
3713+ keyptr = NULL;
3714+ keycount = 0;
3715+ keysend = 0;
3716+ }
3717+ pthread_mutex_lock(&cache_lock);
3718+ keylist = (char *)assoc_key_snap((int *)&keycount);
3719+ pthread_mutex_unlock(&cache_lock);
3720+ keyptr = keylist;
3721+ if (!keyptr){
3722+ replication_call_marugoto_end();
3723+ }else{
3724+ if (settings.verbose > 0)
3725+ fprintf(stderr,"replication: marugoto start\n");
3726+ }
3727+ }else{
3728+ if(keyptr){
3729+ while(*keyptr){
3730+ item *it = item_get(keyptr, strlen(keyptr));
3731+ if(it){
3732+ item_remove(it);
3733+ if(replication_call_rep(keyptr, strlen(keyptr)) == -1){
3734+ return(-1);
3735+ }else{
3736+ keysend++;
3737+ keyptr += strlen(keyptr) + 1;
3738+ return(0);
3739+ }
3740+ }
3741+ keyptr += strlen(keyptr) + 1;
3742+ }
3743+ if(settings.verbose > 0)
3744+ fprintf(stderr,"replication: marugoto %d\n", keysend);
3745+ replication_call_marugoto_end();
3746+ if(settings.verbose > 0)
3747+ fprintf(stderr,"replication: marugoto owari\n");
3748+ free(keylist);
3749+ keylist = NULL;
3750+ keyptr = NULL;
3751+ keycount = 0;
3752+ keysend = 0;
3753+ }
3754+ }
3755+ return(0);
3756+}
3757+
3758+static int replication_send(conn *c)
3759+{
3760+ while(c->wbytes){
3761+ int w = write(c->sfd, c->wcurr, c->wbytes);
3762+ if(w == -1){
3763+ if(errno == EAGAIN || errno == EINTR){
3764+ }else{
3765+ fprintf(stderr,"replication: send error\n");
3766+ replication_close();
3767+ break;
3768+ }
3769+ }else{
3770+ c->wbytes -= w;
3771+ c->wcurr += w;
3772+ }
3773+ }
3774+ return(c->wbytes);
3775+}
3776+
3777+static int replication_pop(void)
3778+{
3779+ int r;
3780+ int c;
3781+ int m;
3782+ Q_ITEM **q;
3783+
3784+ if(settings.verbose > 1)
3785+ fprintf(stderr, "replication: pop\n");
3786+
3787+ if(!rep_recv)
3788+ return(0);
3789+
3790+ r = read(rep_recv->sfd, rep_recv->rbuf, rep_recv->rsize);
3791+ if(r == -1){
3792+ if(errno == EAGAIN || errno == EINTR){
3793+ }else{
3794+ fprintf(stderr,"replication: pop error %d\n", errno);
3795+ return(-1);
3796+ }
3797+ }if(r == 0){
3798+ /* other end closed, trigger replication_close() */
3799+ return(-1);
3800+ }else{
3801+ c = r / sizeof(Q_ITEM *);
3802+ m = r % sizeof(Q_ITEM *);
3803+ q = (Q_ITEM **)(rep_recv->rbuf);
3804+ while(c--){
3805+ if(q[c]){
3806+ if(rep_conn && replication_cmd(rep_conn, q[c])){
3807+ replication_item(q[c]); /* error retry */
3808+ }else{
3809+ qi_free(q[c]);
3810+ }
3811+ }else{
3812+ if(!rep_exit){
3813+ if (settings.verbose)
3814+ fprintf(stderr,"replication: cleanup start\n");
3815+ rep_exit = 1;
3816+ }
3817+ }
3818+ }
3819+ }
3820+ if(rep_exit){
3821+ if(rep_conn->wbytes){
3822+ /* retry */
3823+ if(replication_exit()){
3824+ replication_close();
3825+ fprintf(stderr,"replication: cleanup error\n");
3826+ exit(EXIT_FAILURE);
3827+ }
3828+ }else{
3829+ /* finish */
3830+ replication_close();
3831+ if (settings.verbose)
3832+ fprintf(stderr,"replication: cleanup complete\n");
3833+ exit(EXIT_SUCCESS);
3834+ }
3835+ }
3836+ replication_marugoto(0);
3837+ return(0);
3838+}
3839+
3840+static int replication_push(void)
3841+{
3842+ int w;
3843+
3844+ while(rep_send->wbytes){
3845+ w = write(rep_send->sfd, rep_send->wcurr, rep_send->wbytes);
3846+ if(w == -1){
3847+ if(errno == EAGAIN || errno == EINTR){
3848+ fprintf(stderr,"replication: push EAGAIN or EINTR\n");
3849+ }else{
3850+ return(-1);
3851+ }
3852+ }else{
3853+ rep_send->wbytes -= w;
3854+ rep_send->wcurr += w;
3855+ }
3856+ }
3857+ rep_send->wcurr = rep_send->wbuf;
3858+ return(0);
3859+}
3860+
3861+static int replication_exit(void)
3862+{
3863+ return(replication_item(NULL));
3864+}
3865+
3866+static int replication_item(Q_ITEM *q)
3867+{
3868+ pthread_mutex_lock(&replication_pipe_lock);
3869+ if (!rep_send) {
3870+ pthread_mutex_unlock(&replication_pipe_lock);
3871+ return 0;
3872+ }
3873+ if(rep_send->wcurr + rep_send->wbytes + sizeof(q) > rep_send->wbuf + rep_send->wsize){
3874+ fprintf(stderr,"replication: buffer over fllow\n");
3875+ if(q){
3876+ qi_free(q);
3877+ }
3878+ pthread_mutex_unlock(&replication_pipe_lock);
3879+ replication_dispatch_close();
3880+ return(-1);
3881+ }
3882+ memcpy(rep_send->wcurr + rep_send->wbytes, &q, sizeof(q));
3883+ rep_send->wbytes += sizeof(q);
3884+ if(replication_push()){
3885+ fprintf(stderr, "replication: push error\n");
3886+ if(q){
3887+ qi_free(q);
3888+ }
3889+ pthread_mutex_unlock(&replication_pipe_lock);
3890+ replication_dispatch_close();
3891+ return(-1);
3892+ }
3893+ pthread_mutex_unlock(&replication_pipe_lock);
3894+ return(0);
3895+}
3896+
3897+int replication(enum CMD_TYPE type, R_CMD *cmd)
3898+{
3899+ Q_ITEM *q;
3900+
3901+ pthread_mutex_lock(&replication_pipe_lock);
3902+ if (!rep_send) {
3903+ pthread_mutex_unlock(&replication_pipe_lock);
3904+ return 0;
3905+ }
3906+ pthread_mutex_unlock(&replication_pipe_lock);
3907+
3908+ if((q = qi_new(type, cmd, false))) {
3909+ replication_item(q);
3910+ }else{
3911+ fprintf(stderr,"replication: can't create Q_ITEM\n");
3912+ replication_dispatch_close();
3913+ return(-1);
3914+ }
3915+ return(0);
3916+}
3917+#endif /* USE_REPLICATION */
3918diff -urN --exclude *.m4 memcached-1.4.4/memcached.h repcached-2.2-1.4.4/memcached.h
3919--- memcached-1.4.4/memcached.h Thu Nov 26 03:37:49 2009
3920+++ repcached-2.2-1.4.4/memcached.h Tue Feb 9 23:02:45 2010
3921@@ -144,7 +144,13 @@
3922 conn_swallow, /**< swallowing unnecessary bytes w/o storing */
3923 conn_closing, /**< closing this connection */
3924 conn_mwrite, /**< writing out many items sequentially */
3925- conn_max_state /**< Max state value (used for assertion) */
3926+#ifdef USE_REPLICATION
3927+ conn_repconnect, /**< replication connecting to master */
3928+ conn_rep_listen, /**< replication listening socket */
3929+ conn_pipe_recv, /**< replication command pipe recv */
3930+ conn_pipe_send, /**< replication command pipe send */
3931+#endif /* USE_REPLICATION */
3932+ conn_max_state, /**< Max state value (used for assertion) */
3933 };
3934
3935 enum bin_substates {
3936@@ -240,7 +246,9 @@
3937 uint64_t get_hits;
3938 uint64_t get_misses;
3939 uint64_t evictions;
3940+#if 0
3941 time_t started; /* when the process was started */
3942+#endif
3943 bool accepting_conns; /* whether we are currently accepting */
3944 uint64_t listen_disabled_num;
3945 };
3946@@ -274,6 +282,11 @@
3947 int backlog;
3948 int item_size_max; /* Maximum item size, and upper end for slabs */
3949 bool sasl; /* SASL on/off */
3950+#ifdef USE_REPLICATION
3951+ struct in_addr rep_addr; /* replication addr */
3952+ int rep_port; /* replication port */
3953+ int rep_qmax; /* replication QITEM max */
3954+#endif /*USE_REPLICATION*/
3955 };
3956
3957 extern struct stats stats;
3958@@ -286,6 +299,10 @@
3959 /* temp */
3960 #define ITEM_SLABBED 4
3961
3962+#ifdef USE_REPLICATION
3963+#define ITEM_REPDATA 128
3964+#endif /*USE_REPLICATION*/
3965+
3966 /**
3967 * Structure for storing items within memcached.
3968 */
3969@@ -438,6 +455,10 @@
3970 #include "trace.h"
3971 #include "hash.h"
3972 #include "util.h"
3973+
3974+#ifdef USE_REPLICATION
3975+#include "replication.h"
3976+#endif /* USE_REPLICATION */
3977
3978 /*
3979 * Functions such as the libevent-related calls that need to do cross-thread
3980diff -urN --exclude *.m4 memcached-1.4.4/memcached.spec repcached-2.2-1.4.4/memcached.spec
3981--- memcached-1.4.4/memcached.spec Fri Nov 27 09:34:55 2009
3982+++ repcached-2.2-1.4.4/memcached.spec Wed Feb 10 19:12:03 2010
3983@@ -1,12 +1,12 @@
3984 Name: memcached
3985 Version: 1.4.4
3986-Release: 1%{?dist}
3987+Release: 1.49_g6b6b7ed%{?dist}
3988 Summary: High Performance, Distributed Memory Object Cache
3989
3990 Group: System Environment/Daemons
3991 License: BSD
3992 URL: http://www.danga.com/memcached/
3993-Source0: http://memcached.googlecode.com/files/%{name}-1.4.4.tar.gz
3994+Source0: http://memcached.googlecode.com/files/%{name}-1.4.4_49_g6b6b7ed.tar.gz
3995 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
3996
3997 BuildRequires: libevent-devel
3998@@ -23,7 +23,7 @@
3999 web applications by alleviating database load.
4000
4001 %prep
4002-%setup -q -n %{name}-1.4.4
4003+%setup -q -n %{name}-1.4.4_49_g6b6b7ed
4004
4005
4006 %build
4007diff -urN --exclude *.m4 memcached-1.4.4/replication.c repcached-2.2-1.4.4/replication.c
4008--- memcached-1.4.4/replication.c Thu Jan 1 03:00:00 1970
4009+++ repcached-2.2-1.4.4/replication.c Wed Feb 10 18:40:48 2010
4010@@ -0,0 +1,355 @@
4011+/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
4012+/*
4013+ *
4014+ */
4015+#include "memcached.h"
4016+#include "replication.h"
4017+#include <stdlib.h>
4018+#include <stdio.h>
4019+#include <unistd.h>
4020+#include <string.h>
4021+#include <errno.h>
4022+
4023+static Q_ITEM *q_freelist = NULL;
4024+static int q_itemcount = 0;
4025+static pthread_mutex_t replication_queue_lock = PTHREAD_MUTEX_INITIALIZER;
4026+
4027+int get_qi_count(void)
4028+{
4029+ int c;
4030+ pthread_mutex_lock(&replication_queue_lock);
4031+ c = q_itemcount;
4032+ pthread_mutex_unlock(&replication_queue_lock);
4033+ return(c);
4034+}
4035+
4036+Q_ITEM *qi_new(enum CMD_TYPE type, R_CMD *cmd, bool reuse)
4037+{
4038+ Q_ITEM *q = NULL;
4039+ char *key = NULL;
4040+ uint32_t keylen = 0;
4041+ rel_time_t time = 0;
4042+
4043+ pthread_mutex_lock(&replication_queue_lock);
4044+ if(q_freelist){
4045+ q = q_freelist;
4046+ q_freelist = q->next;
4047+ }
4048+
4049+ if(NULL == q){
4050+ if(reuse) {
4051+ pthread_mutex_unlock(&replication_queue_lock);
4052+ return(NULL);
4053+ }
4054+ if(q_itemcount >= settings.rep_qmax) {
4055+ pthread_mutex_unlock(&replication_queue_lock);
4056+ return(NULL);
4057+ }
4058+ q = malloc(sizeof(Q_ITEM));
4059+ if (NULL == q){
4060+ fprintf(stderr,"replication: qi_new out of memory\n");
4061+ pthread_mutex_unlock(&replication_queue_lock);
4062+ return(NULL);
4063+ }
4064+ q_itemcount++;
4065+ if (settings.verbose > 2)
4066+ fprintf(stderr,"replication: alloc c=%d\n", q_itemcount);
4067+ }
4068+
4069+ pthread_mutex_unlock(&replication_queue_lock);
4070+
4071+ switch (type) {
4072+ case REPLICATION_REP:
4073+ case REPLICATION_DEL:
4074+ key = cmd->key;
4075+ keylen = cmd->keylen;
4076+ break;
4077+ case REPLICATION_FLUSH_ALL:
4078+ break;
4079+ case REPLICATION_DEFER_FLUSH_ALL:
4080+ time = cmd->time;
4081+ break;
4082+ case REPLICATION_MARUGOTO_END:
4083+ break;
4084+ default:
4085+ fprintf(stderr,"replication: got unknown command: %d\n", type);
4086+ return(NULL);
4087+ }
4088+
4089+ q->key = NULL;
4090+ q->type = type;
4091+ q->time = time;
4092+ q->next = NULL;
4093+ if (keylen) {
4094+ q->key = malloc(keylen + 1);
4095+ if(NULL == q->key){
4096+ qi_free(q);
4097+ q = NULL;
4098+ }else{
4099+ memcpy(q->key, key, keylen);
4100+ *(q->key + keylen) = 0;
4101+ }
4102+ }
4103+
4104+ return(q);
4105+}
4106+
4107+void qi_free(Q_ITEM *q)
4108+{
4109+ if(q){
4110+ if(q->key){
4111+ free(q->key);
4112+ q->key = NULL;
4113+ }
4114+ pthread_mutex_lock(&replication_queue_lock);
4115+ q->next = q_freelist;
4116+ q_freelist = q;
4117+ pthread_mutex_unlock(&replication_queue_lock);
4118+ }
4119+}
4120+
4121+int qi_free_list()
4122+{
4123+ int c = 0;
4124+ Q_ITEM *q = NULL;
4125+
4126+ pthread_mutex_lock(&replication_queue_lock);
4127+ while((q = q_freelist)){
4128+ q_itemcount--;
4129+ c++;
4130+ q_freelist = q->next;
4131+ free(q);
4132+ }
4133+ pthread_mutex_unlock(&replication_queue_lock);
4134+ return(c);
4135+}
4136+
4137+static int replication_get_num(char *p, int n)
4138+{
4139+ int l;
4140+ char b[64];
4141+ if(p)
4142+ l = sprintf(p, "%u", n);
4143+ else
4144+ l = sprintf(b, "%u", n);
4145+ return(l);
4146+}
4147+
4148+int replication_call_rep(char *key, size_t keylen)
4149+{
4150+ R_CMD r;
4151+ r.key = key;
4152+ r.keylen = keylen;
4153+ return(replication(REPLICATION_REP, &r));
4154+}
4155+
4156+int replication_call_del(char *key, size_t keylen)
4157+{
4158+ R_CMD r;
4159+ r.key = key;
4160+ r.keylen = keylen;
4161+ return(replication(REPLICATION_DEL, &r));
4162+}
4163+
4164+int replication_call_flush_all()
4165+{
4166+ R_CMD r;
4167+ r.key = NULL;
4168+ return(replication(REPLICATION_FLUSH_ALL, &r));
4169+}
4170+
4171+int replication_call_defer_flush_all(const rel_time_t time)
4172+{
4173+ R_CMD r;
4174+ r.key = NULL;
4175+ r.time = time;
4176+ return(replication(REPLICATION_DEFER_FLUSH_ALL, &r));
4177+}
4178+
4179+int replication_call_marugoto_end()
4180+{
4181+ R_CMD r;
4182+ r.key = NULL;
4183+ return(replication(REPLICATION_MARUGOTO_END, &r));
4184+}
4185+
4186+static int replication_alloc(conn *c, int s)
4187+{
4188+ char *p;
4189+ s += c->wbytes;
4190+ if(c->wsize < s){
4191+ while(c->wsize < s)
4192+ c->wsize += 4096;
4193+ if((p = malloc(c->wsize))){
4194+ memcpy(p, c->wbuf, c->wbytes);
4195+ free(c->wbuf);
4196+ c->wbuf = p;
4197+ }else{
4198+ return(-1);
4199+ }
4200+ }
4201+ return(0);
4202+}
4203+
4204+static int replication_del(conn *c, char *k)
4205+{
4206+ int l = 0;
4207+ char *s = "delete ";
4208+ char *n = "\r\n";
4209+ char *p = NULL;
4210+
4211+ l += strlen(s);
4212+ l += strlen(k);
4213+ l += strlen(n);
4214+ if(replication_alloc(c,l) == -1){
4215+ fprintf(stderr, "replication: del malloc error\n");
4216+ return(-1);
4217+ }
4218+ p = c->wbuf + c->wbytes;
4219+ memcpy(p, s, strlen(s));
4220+ p += strlen(s);
4221+ memcpy(p, k, strlen(k));
4222+ p += strlen(k);
4223+ memcpy(p, n, strlen(n));
4224+ p += strlen(n);
4225+ c->wbytes = p - c->wbuf;
4226+ c->wcurr = c->wbuf;
4227+ return(0);
4228+}
4229+
4230+static int replication_rep(conn *c, item *it)
4231+{
4232+ int exp = 0;
4233+ int len = 0;
4234+ char *s = "rep ";
4235+ char *n = "\r\n";
4236+ char *p = NULL;
4237+ char flag[40];
4238+
4239+ if(it->exptime)
4240+ exp = it->exptime + process_started;
4241+ flag[0]=0;
4242+ if((p=ITEM_suffix(it))){
4243+ int i;
4244+ memcpy(flag, p, it->nsuffix - 2);
4245+ flag[it->nsuffix - 2] = 0;
4246+ for(i=0;i<strlen(flag);i++){
4247+ if(flag[i] > ' ')
4248+ break;
4249+ }
4250+ memmove(flag,&flag[i],strlen(flag)-i);
4251+ for(p=flag;*p>' ';p++);
4252+ *p=0;
4253+ }
4254+ len += strlen(s);
4255+ len += it->nkey;
4256+ len += 1;
4257+ len += strlen(flag);
4258+ len += 1;
4259+ len += replication_get_num(NULL, exp);
4260+ len += 1;
4261+ len += replication_get_num(NULL, it->nbytes - 2);
4262+ len += 1;
4263+ len += replication_get_num(NULL, ITEM_get_cas(it));
4264+ len += strlen(n);
4265+ len += it->nbytes;
4266+ len += strlen(n);
4267+ if(replication_alloc(c,len) == -1){
4268+ fprintf(stderr, "replication: rep malloc error\n");
4269+ return(-1);
4270+ }
4271+ p = c->wbuf + c->wbytes;
4272+ memcpy(p, s, strlen(s));
4273+ p += strlen(s);
4274+ memcpy(p, ITEM_key(it), it->nkey);
4275+ p += it->nkey;
4276+ *(p++) = ' ';
4277+ memcpy(p, flag, strlen(flag));
4278+ p += strlen(flag);
4279+ *(p++) = ' ';
4280+ p += replication_get_num(p, exp);
4281+ *(p++) = ' ';
4282+ p += replication_get_num(p, it->nbytes - 2);
4283+ *(p++) = ' ';
4284+ p += replication_get_num(p, ITEM_get_cas(it));
4285+ memcpy(p, n, strlen(n));
4286+ p += strlen(n);
4287+ memcpy(p, ITEM_data(it), it->nbytes);
4288+ p += it->nbytes;
4289+ c->wbytes = p - c->wbuf;
4290+ c->wcurr = c->wbuf;
4291+ return(0);
4292+}
4293+
4294+static int replication_flush_all(conn *c, rel_time_t exp)
4295+{
4296+ char *s = "flush_all ";
4297+ char *n = "\r\n";
4298+ char *p = NULL;
4299+
4300+ int l = strlen(s) + strlen(n);
4301+ if (exp > 0)
4302+ l += replication_get_num(NULL, exp);
4303+ if(replication_alloc(c,l) == -1){
4304+ fprintf(stderr, "replication: flush_all malloc error\n");
4305+ return(-1);
4306+ }
4307+ p = c->wbuf + c->wbytes;
4308+ memcpy(p, s, strlen(s));
4309+ p += strlen(s);
4310+ if (exp > 0)
4311+ p += replication_get_num(p, exp);
4312+ memcpy(p, n, strlen(n));
4313+ p += strlen(n);
4314+ c->wbytes = p - c->wbuf;
4315+ c->wcurr = c->wbuf;
4316+ return(0);
4317+}
4318+
4319+static int replication_marugoto_end(conn *c)
4320+{
4321+ char *s = "marugoto_end";
4322+ char *n = "\r\n";
4323+ char *p = NULL;
4324+
4325+ int l = strlen(s) + strlen(n);
4326+ if(replication_alloc(c,l) == -1){
4327+ fprintf(stderr, "replication: marugoto_end malloc error\n");
4328+ return(-1);
4329+ }
4330+ p = c->wbuf + c->wbytes;
4331+ memcpy(p, s, strlen(s));
4332+ p += strlen(s);
4333+ memcpy(p, n, strlen(n));
4334+ p += strlen(n);
4335+ c->wbytes = p - c->wbuf;
4336+ c->wcurr = c->wbuf;
4337+ return(0);
4338+}
4339+
4340+int replication_cmd(conn *c, Q_ITEM *q)
4341+{
4342+ item *it;
4343+ int r;
4344+
4345+ switch (q->type) {
4346+ case REPLICATION_REP:
4347+ it = item_get(q->key, strlen(q->key));
4348+ if (!it)
4349+ return(replication_del(c, q->key));
4350+ r = replication_rep(c, it);
4351+ item_remove(it);
4352+ return r;
4353+ case REPLICATION_DEL:
4354+ return(replication_del(c, q->key));
4355+ case REPLICATION_FLUSH_ALL:
4356+ return(replication_flush_all(c, 0));
4357+ case REPLICATION_DEFER_FLUSH_ALL:
4358+ return(replication_flush_all(c, q->time));
4359+ case REPLICATION_MARUGOTO_END:
4360+ return(replication_marugoto_end(c));
4361+ default:
4362+ fprintf(stderr,"replication: got unknown command:%d\n", q->type);
4363+ return(0);
4364+ }
4365+}
4366diff -urN --exclude *.m4 memcached-1.4.4/replication.h repcached-2.2-1.4.4/replication.h
4367--- memcached-1.4.4/replication.h Thu Jan 1 03:00:00 1970
4368+++ repcached-2.2-1.4.4/replication.h Wed Feb 10 18:40:31 2010
4369@@ -0,0 +1,42 @@
4370+#ifndef MEMCACHED_REPLICATION_H
4371+#define MEMCACHED_REPLICATION_H
4372+#define REPCACHED_VERSION "2.2"
4373+#include <netdb.h>
4374+
4375+enum CMD_TYPE {
4376+ REPLICATION_REP,
4377+ REPLICATION_DEL,
4378+ REPLICATION_FLUSH_ALL,
4379+ REPLICATION_DEFER_FLUSH_ALL,
4380+ REPLICATION_MARUGOTO_END,
4381+};
4382+
4383+typedef struct queue_item_t Q_ITEM;
4384+struct queue_item_t {
4385+ enum CMD_TYPE type;
4386+ char *key;
4387+ rel_time_t time;
4388+ Q_ITEM *next;
4389+};
4390+
4391+typedef struct replication_cmd_t R_CMD;
4392+struct replication_cmd_t {
4393+ char *key;
4394+ int keylen;
4395+ rel_time_t time;
4396+};
4397+
4398+Q_ITEM *qi_new(enum CMD_TYPE type, R_CMD *cmd, bool);
4399+void qi_free(Q_ITEM *);
4400+int qi_free_list(void);
4401+int replication_cmd(conn *, Q_ITEM *);
4402+int get_qi_count(void);
4403+
4404+int replication_call_rep(char *key, size_t keylen);
4405+int replication_call_del(char *key, size_t keylen);
4406+int replication_call_flush_all(void);
4407+int replication_call_defer_flush_all(const rel_time_t time);
4408+int replication_call_marugoto_end(void);
4409+int replication(enum CMD_TYPE type, R_CMD *cmd);
4410+
4411+#endif
4412diff -urN --exclude *.m4 memcached-1.4.4/t/binary.t repcached-2.2-1.4.4/t/binary.t
4413--- memcached-1.4.4/t/binary.t Fri Nov 27 08:05:16 2009
4414+++ repcached-2.2-1.4.4/t/binary.t Wed Feb 10 17:04:01 2010
4415@@ -2,10 +2,12 @@
4416
4417 use strict;
4418 use warnings;
4419-use Test::More tests => 3349;
4420+use Test::More;
4421 use FindBin qw($Bin);
4422 use lib "$Bin/lib";
4423 use MemcachedTest;
4424+
4425+Test::More::plan(tests => support_replication() ? 3385 : 3349);
4426
4427 my $server = new_memcached();
4428 ok($server, "started the server");
4429diff -urN --exclude *.m4 memcached-1.4.4/t/issue_67.t repcached-2.2-1.4.4/t/issue_67.t
4430--- memcached-1.4.4/t/issue_67.t Sun Nov 1 01:44:09 2009
4431+++ repcached-2.2-1.4.4/t/issue_67.t Wed Feb 10 17:50:12 2010
4432@@ -41,6 +41,10 @@
4433 my $exe = "$builddir/memcached-debug";
4434 croak("memcached binary doesn't exist. Haven't run 'make' ?\n") unless -e $exe;
4435
4436+ if (support_replication()) {
4437+ $args .= ' -X 0';
4438+ }
4439+
4440 my $childpid = fork();
4441
4442 my $cmd = "$builddir/timedrun 10 $exe $args";
4443diff -urN --exclude *.m4 memcached-1.4.4/t/lib/MemcachedTest.pm repcached-2.2-1.4.4/t/lib/MemcachedTest.pm
4444--- memcached-1.4.4/t/lib/MemcachedTest.pm Fri Oct 30 04:24:52 2009
4445+++ repcached-2.2-1.4.4/t/lib/MemcachedTest.pm Wed Feb 10 17:53:34 2010
4446@@ -13,7 +13,8 @@
4447
4448
4449 @EXPORT = qw(new_memcached sleep mem_get_is mem_gets mem_gets_is mem_stats
4450- supports_sasl free_port);
4451+ supports_sasl free_port support_replication memcached_version
4452+ version2num);
4453
4454 sub sleep {
4455 my $n = shift;
4456@@ -148,6 +149,23 @@
4457 return 0;
4458 }
4459
4460+sub support_replication {
4461+ my $output = `$builddir/memcached-debug -h`;
4462+ return 1 if $output =~ /^-x <ip_addr>/m;
4463+ return 0;
4464+}
4465+
4466+sub memcached_version {
4467+ my $output = `$builddir/memcached-debug -h`;
4468+ return $1 if $output =~ /^memcached (\d[\d\.]+)/;
4469+ return 0;
4470+}
4471+
4472+sub version2num {
4473+ my($major,$minor,$pl) = ($_[0] =~ /^(\d+)\.(\d+)\.(\d+)$/);
4474+ return $major*100**2 + $minor*100 + $pl
4475+}
4476+
4477 sub new_memcached {
4478 my ($args, $passed_port) = @_;
4479 my $port = $passed_port || free_port();
4480@@ -171,6 +189,9 @@
4481 }
4482 if ($< == 0) {
4483 $args .= " -u root";
4484+ }
4485+ if (support_replication() && $args !~ m/-X/) {
4486+ $args .= ' -X 0';
4487 }
4488
4489 my $childpid = fork();
4490diff -urN --exclude *.m4 memcached-1.4.4/t/stats.t repcached-2.2-1.4.4/t/stats.t
4491--- memcached-1.4.4/t/stats.t Thu Nov 26 03:37:49 2009
4492+++ repcached-2.2-1.4.4/t/stats.t Tue Feb 9 23:13:26 2010
4493@@ -56,7 +56,11 @@
4494 my $stats = mem_stats($sock);
4495
4496 # Test number of keys
4497-is(scalar(keys(%$stats)), 37, "37 stats values");
4498+if (! support_replication()) {
4499+ is(scalar(keys(%$stats)), 37, "37 stats values");
4500+} else {
4501+ is(scalar(keys(%$stats)), 40, "40 stats values");
4502+}
4503
4504 # Test initial state
4505 foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses
4506diff -urN --exclude *.m4 memcached-1.4.4/testapp.c repcached-2.2-1.4.4/testapp.c
4507--- memcached-1.4.4/testapp.c Wed Nov 25 03:40:29 2009
4508+++ repcached-2.2-1.4.4/testapp.c Wed Feb 10 17:52:05 2010
4509@@ -300,6 +300,10 @@
4510 argv[arg++] = "-1";
4511 argv[arg++] = "-U";
4512 argv[arg++] = "0";
4513+#ifdef USE_REPLICATION
4514+ argv[arg++] = "-X";
4515+ argv[arg++] = "0";
4516+#endif
4517 /* Handle rpmbuild and the like doing this as root */
4518 if (getuid() == 0) {
4519 argv[arg++] = "-u";
This page took 0.568099 seconds and 4 git commands to generate.