Merge lp:~mordred/gearmand/fix-1.0-build into lp:gearmand/1.0

Proposed by Monty Taylor
Status: Merged
Merge reported by: Monty Taylor
Merged at revision: not available
Proposed branch: lp:~mordred/gearmand/fix-1.0-build
Merge into: lp:gearmand/1.0
Diff against target: 18576 lines (+9419/-5025) (has conflicts)
110 files modified
.quickly (+5/-0)
ChangeLog (+14/-0)
HACKING (+13/-0)
Makefile.am (+7/-6)
bin/gearman.c (+4/-0)
config/autorun.sh (+1/-1)
config/pandora-plugin (+667/-0)
config/uncrustify.cfg (+1112/-0)
configure.ac (+8/-1)
gearmand/gearmand.cc (+239/-387)
gearmand/include.am (+4/-3)
libgearman-server/client.cc (+14/-1)
libgearman-server/client.h (+4/-44)
libgearman-server/common.h (+21/-28)
libgearman-server/conf.h (+0/-103)
libgearman-server/conf_module.h (+0/-80)
libgearman-server/connection.cc (+523/-186)
libgearman-server/connection.h (+145/-152)
libgearman-server/constants.h (+2/-31)
libgearman-server/function.cc (+45/-24)
libgearman-server/function.h (+7/-20)
libgearman-server/gearmand.cc (+225/-139)
libgearman-server/gearmand.h (+123/-138)
libgearman-server/gearmand_con.cc (+79/-148)
libgearman-server/gearmand_con.h (+17/-19)
libgearman-server/gearmand_thread.cc (+191/-247)
libgearman-server/gearmand_thread.h (+47/-54)
libgearman-server/gqueue.h (+87/-0)
libgearman-server/include.am (+45/-28)
libgearman-server/job.cc (+100/-116)
libgearman-server/job.h (+80/-70)
libgearman-server/log.cc (+111/-97)
libgearman-server/log.h (+78/-75)
libgearman-server/logger.cc (+13/-0)
libgearman-server/logger.h (+64/-0)
libgearman-server/logger/standard.cc (+106/-0)
libgearman-server/logger/standard.h (+52/-0)
libgearman-server/logger/stats.cc (+75/-0)
libgearman-server/logger/stats.h (+49/-0)
libgearman-server/logger/syslog.cc (+71/-0)
libgearman-server/logger/syslog.h (+43/-0)
libgearman-server/packet.cc (+28/-1)
libgearman-server/packet.h (+9/-55)
libgearman-server/port.cc (+228/-0)
libgearman-server/port.h (+63/-0)
libgearman-server/protocol.h (+33/-0)
libgearman-server/protocol/http.cc (+92/-101)
libgearman-server/protocol/http.h (+49/-21)
libgearman-server/queue/libdrizzle.cc (+195/-254)
libgearman-server/queue/libdrizzle.h (+51/-48)
libgearman-server/queue/libmemcached.cc (+108/-227)
libgearman-server/queue/libmemcached.h (+35/-49)
libgearman-server/queue/libpq.cc (+141/-193)
libgearman-server/queue/libpq.h (+46/-47)
libgearman-server/queue/libsqlite3.cc (+271/-357)
libgearman-server/queue/libsqlite3.h (+47/-53)
libgearman-server/queue/libtokyocabinet.cc (+88/-214)
libgearman-server/queue/libtokyocabinet.h (+36/-52)
libgearman-server/server.cc (+622/-380)
libgearman-server/server.h (+83/-144)
libgearman-server/service.cc (+8/-0)
libgearman-server/service.h (+34/-0)
libgearman-server/service/echo.cc (+86/-0)
libgearman-server/service/echo.h (+39/-0)
libgearman-server/services.cc (+26/-0)
libgearman-server/services.h (+60/-0)
libgearman-server/thread.cc (+180/-197)
libgearman-server/thread.h (+75/-111)
libgearman-server/wake.cc (+116/-0)
libgearman-server/wake.h (+57/-0)
libgearman-server/worker.cc (+44/-22)
libgearman-server/worker.h (+27/-47)
libgearman/constants.h (+1/-0)
libgearman/universal.c (+0/-7)
libgearman/universal.h (+64/-5)
libgearman/worker.c (+15/-4)
libgearman/worker.h (+1/-0)
m4/ac_cxx_header_stdcxx_98.m4 (+22/-6)
m4/acx_pthread.m4 (+68/-73)
m4/gettext.m4 (+379/-0)
m4/iconv.m4 (+180/-0)
m4/pandora_canonical.m4 (+8/-7)
m4/pandora_drizzle_build.m4 (+2/-1)
m4/pandora_enable_dtrace.m4 (+32/-17)
m4/pandora_ensure_gcc_version.m4 (+39/-16)
m4/pandora_have_boost.m4 (+4/-5)
m4/pandora_have_innodb.m4 (+0/-41)
m4/pandora_have_libboost_options.m4 (+47/-0)
m4/pandora_have_libboost_thread.m4 (+45/-0)
m4/pandora_have_libhashkit.m4 (+42/-0)
m4/pandora_have_libldap.m4 (+73/-0)
m4/pandora_have_libpqxx.m4 (+44/-0)
m4/pandora_have_libvbucket.m4 (+40/-0)
m4/pandora_have_sasl.m4 (+133/-0)
m4/pandora_platform.m4 (+10/-1)
m4/pandora_plugins.m4 (+6/-2)
m4/pandora_stack_direction.m4 (+0/-39)
m4/pandora_vc_build.m4 (+6/-4)
m4/pandora_warnings.m4 (+7/-1)
m4/po.m4 (+449/-0)
m4/progtest.m4 (+92/-0)
tests/client_test.c (+71/-0)
tests/include.am (+1/-2)
tests/internals.c (+0/-18)
tests/memcached_test.c (+1/-1)
tests/round_robin.c (+1/-1)
tests/test_gearmand.c (+62/-0)
tests/tokyocabinet_test.c (+1/-1)
tests/worker_test.c (+5/-1)
unittests/include.am (+0/-1)
Text conflict in ChangeLog
Text conflict in bin/gearman.c
Text conflict in configure.ac
Text conflict in libgearman-server/client.cc
Contents conflict in libgearman-server/conf.c
Contents conflict in libgearman-server/conf_module.c
Text conflict in libgearman-server/connection.cc
Text conflict in libgearman-server/function.cc
Text conflict in libgearman-server/gearmand.cc
Text conflict in libgearman-server/gearmand_con.cc
Text conflict in libgearman-server/gearmand_thread.cc
Text conflict in libgearman-server/job.cc
Text conflict in libgearman-server/packet.cc
Text conflict in libgearman-server/protocol/http.cc
Text conflict in libgearman-server/queue/libdrizzle.cc
Text conflict in libgearman-server/queue/libpq.cc
Text conflict in libgearman-server/queue/libsqlite3.cc
Text conflict in libgearman-server/server.cc
Text conflict in libgearman-server/thread.cc
Text conflict in libgearman-server/worker.cc
Text conflict in tests/client_test.c
Text conflict in tests/test_gearmand.c
To merge this branch: bzr merge lp:~mordred/gearmand/fix-1.0-build
Reviewer Review Type Date Requested Status
Brian Aker Pending
Review via email: mp+28949@code.launchpad.net

Description of the change

Updates pandora.
Fixes boost linking.
Fixes the boost system header include file issue on FreeBSD.

To post a comment you must log in.
lp:~mordred/gearmand/fix-1.0-build updated
358. By Monty Taylor

Remove two old crufty files.

359. By Monty Taylor

Updated pandora-build files to version 0.135

360. By Monty Taylor

Merged in no-error removal.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.quickly'
2--- .quickly 1970-01-01 00:00:00 +0000
3+++ .quickly 2010-07-01 01:31:26 +0000
4@@ -0,0 +1,5 @@
5+project = gearmand
6+version = 1.0
7+template = pandora-build
8+project-type = application
9+pandora-version = 0.135
10
11=== modified file 'ChangeLog'
12--- ChangeLog 2010-06-30 20:04:51 +0000
13+++ ChangeLog 2010-07-01 01:31:26 +0000
14@@ -1,8 +1,22 @@
15+<<<<<<< TREE
16 0.14 Wed Jun 30 13:04:39 PDT 2010
17 * Leak in SQLite resolved.
18 * updated build configs
19 * Increased testting.
20
21+=======
22+1.00 Mon Jun 14 12:17:09 PDT 2010
23+ * Server written in C++ now.
24+ * Making use of boost command line arguments.
25+ * New debugging can now be done with the server.
26+ * New Logger functionality added so that you can either use syslog, or
27+ use stderr.
28+ * It is possible to have "workers" internally in the server that act
29+ as internal services.
30+
31+
32+
33+>>>>>>> MERGE-SOURCE
34 0.13 Sun Apr 4 14:45:08 PDT 2010
35 * Fix for bug #518512.
36 * Use OR REPLACE syntax for inserting items into the sqlite.
37
38=== added file 'HACKING'
39--- HACKING 1970-01-01 00:00:00 +0000
40+++ HACKING 2010-07-01 01:31:26 +0000
41@@ -0,0 +1,13 @@
42+Hi!
43+
44+If you are working on the server here are some handy environmental variables
45+you can set so that you can debug make test:
46+
47+GEARMAN_VALGRIND <- runs the server under valgrind.
48+GEARMAN_MANUAL_GDB <-- runs the server under a remote version of GDB.
49+GEARMAN_LOG <-- generates a log file for you with the output of the debug for the server
50+
51+GDB will pause the server while you do run the GDB command.
52+
53+Cheers,
54+ -Brian
55
56=== modified file 'Makefile.am'
57--- Makefile.am 2010-06-30 15:21:36 +0000
58+++ Makefile.am 2010-07-01 01:31:26 +0000
59@@ -35,12 +35,13 @@
60 TESTS += ${check_PROGRAMS}
61
62 EXTRA_DIST+= \
63- docs/Doxyfile.api \
64- docs/Doxyfile.dev \
65- docs/api_header.html \
66- docs/dev_header.html \
67- docs/doxygen.h \
68- scripts/README.solaris
69+ HACKING \
70+ docs/Doxyfile.api \
71+ docs/Doxyfile.dev \
72+ docs/api_header.html \
73+ docs/dev_header.html \
74+ docs/doxygen.h \
75+ scripts/README.solaris
76
77 docs: all
78 ${DOXYGEN} docs/Doxyfile.api
79
80=== modified file 'bin/gearman.c'
81--- bin/gearman.c 2010-06-30 20:04:05 +0000
82+++ bin/gearman.c 2010-07-01 01:31:26 +0000
83@@ -588,9 +588,13 @@
84 {
85 ret= gearman_worker_work(&worker);
86 if (ret != GEARMAN_SUCCESS)
87+<<<<<<< TREE
88 {
89 GEARMAN_ERROR("gearman_worker_work:%s", gearman_worker_error(&worker));
90 }
91+=======
92+ GEARMAN_ERROR("gearman_worker_work:%s", gearman_worker_error(&worker));
93+>>>>>>> MERGE-SOURCE
94
95 if (args->count > 0)
96 {
97
98=== modified file 'config/autorun.sh'
99--- config/autorun.sh 2009-12-18 18:02:39 +0000
100+++ config/autorun.sh 2010-07-01 01:31:26 +0000
101@@ -35,7 +35,7 @@
102 LIBTOOLIZE_FLAGS=" --automake --copy --force"
103 # --add-missing instructs automake to install missing auxiliary files
104 # and --force to overwrite them if they already exist
105-AUTOMAKE_FLAGS="--add-missing --copy --force"
106+AUTOMAKE_FLAGS="--add-missing --copy --force --foreign"
107 ACLOCAL_FLAGS="-I m4"
108
109 ARGV0=$0
110
111=== added file 'config/pandora-plugin'
112--- config/pandora-plugin 1970-01-01 00:00:00 +0000
113+++ config/pandora-plugin 2010-07-01 01:31:26 +0000
114@@ -0,0 +1,667 @@
115+#!/usr/bin/python
116+
117+# Copyright (C) 2009 Sun Microsystems
118+#
119+# This program is free software; you can redistribute it and/or modify
120+# it under the terms of the GNU General Public License as published by
121+# the Free Software Foundation; version 2 of the License.
122+#
123+# This program is distributed in the hope that it will be useful,
124+# but WITHOUT ANY WARRANTY; without even the implied warranty of
125+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126+# GNU General Public License for more details.
127+#
128+# You should have received a copy of the GNU General Public License
129+# along with this program; if not, write to the Free Software
130+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
131+
132+pandora_plugin_file = 'config/pandora-plugin.ini'
133+
134+# Find plugins in the tree and add them to the build system
135+
136+import ConfigParser, os, sys
137+import datetime, time
138+import subprocess
139+
140+plugin_am_file=None
141+plugin_ac_file=None
142+
143+class ChangeProtectedFile(object):
144+
145+ def __init__(self, fname):
146+ self.bogus_file= False
147+ self.real_fname= fname
148+ self.new_fname= "%s.new" % fname
149+ try:
150+ self.new_file= open(self.new_fname,'w+')
151+ except IOError:
152+ self.bogus_file= True
153+
154+ def write(self, text):
155+ if not self.bogus_file:
156+ self.new_file.write(text)
157+
158+ # We've written all of this out into .new files, now we only copy them
159+ # over the old ones if they are different, so that we don't cause
160+ # unnecessary recompiles
161+ def close(self):
162+ """Return True if the file had changed."""
163+ if self.bogus_file:
164+ return
165+ self.new_file.seek(0)
166+ new_content = self.new_file.read()
167+ self.new_file.close()
168+ try:
169+ old_file = file(self.real_fname, 'r')
170+ old_content = old_file.read()
171+ old_file.close()
172+ except IOError:
173+ old_content = None
174+ if new_content != old_content:
175+ if old_content != None:
176+ os.unlink(self.real_fname)
177+ os.rename(self.new_fname, self.real_fname)
178+ return True
179+ else:
180+ try:
181+ os.unlink(self.new_fname)
182+ except:
183+ pass
184+
185+
186+def write_external_configure(plugin, plugin_file):
187+ """Write the initial bits of the configure.ac file"""
188+ if not os.path.exists('m4'):
189+ os.mkdir('m4')
190+ plugin_file.write("""
191+AC_PREREQ(2.59)dnl Minimum Autoconf version required.
192+AC_INIT([%(name)s],[%(version)s],[%(url)s])
193+AC_CONFIG_SRCDIR([%(main_source)s])
194+AC_CONFIG_AUX_DIR(config)
195+
196+PANDORA_CANONICAL_TARGET(less-warnings, warnings-always-on, require-cxx, force-gcc42,skip-visibility)
197+
198+PANDORA_REQUIRE_LIBPROTOBUF
199+PANDORA_PROTOBUF_REQUIRE_VERSION([2.1.0])
200+PANDORA_REQUIRE_PROTOC
201+
202+AC_LANG_PUSH(C++)
203+PANDORA_REQUIRE_PTHREAD
204+PANDORA_REQUIRE_LIBDL
205+AC_LANG_POP
206+
207+PANDORA_USE_BETTER_MALLOC
208+
209+PANDORA_DRIZZLE_BUILD
210+""" % plugin)
211+
212+ write_plugin_ac(plugin, plugin_file)
213+
214+ plugin_file.write("""
215+AC_CONFIG_FILES(Makefile)
216+
217+AC_OUTPUT
218+
219+echo "---"
220+echo "Configuration summary for $PACKAGE_NAME version $VERSION $PANDORA_RELEASE_COMMENT"
221+echo ""
222+echo " * Installation prefix: $prefix"
223+echo " * System type: $host_vendor-$host_os"
224+echo " * Host CPU: $host_cpu"
225+echo " * C Compiler: $CC_VERSION"
226+echo " * C++ Compiler: $CXX_VERSION"
227+echo " * Debug enabled: $with_debug"
228+echo " * Warnings as failure: $ac_cv_warnings_as_errors"
229+echo " * C++ cstdint location: $ac_cv_cxx_cstdint"
230+echo " * C++ hash_map location: $ac_cv_cxx_hash_map"
231+echo " * C++ hash namespace: $ac_cv_cxx_hash_namespace"
232+echo " * C++ shared_ptr namespace: $ac_cv_shared_ptr_namespace"
233+echo ""
234+echo "---"
235+
236+ """ % plugin)
237+
238+def write_external_makefile(plugin, plugin_file):
239+
240+ plugin_file.write("""
241+ACLOCAL_AMFLAGS = -I m4 --force
242+VERSION=$(PANDORA_RELEASE_VERSION)
243+
244+pkgplugindir=%(pkgplugindir)s
245+EXTRA_DIST = plugin.ini
246+
247+""" % plugin)
248+ if plugin['headers'] != "":
249+ plugin_file.write("noinst_HEADERS = %(headers)s\n" % plugin)
250+ if plugin['install_headers'] != "":
251+ plugin_file.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin)
252+ if plugin['testsuite']:
253+ if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
254+ plugin_file.write("EXTRA_DIST += %(testsuitedir)s\n" % plugin)
255+ plugin_file.write("""
256+pkgplugin_LTLIBRARIES=%(libname)s.la
257+%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
258+%(libname)s_la_LIBADD=%(libs)s
259+%(libname)s_la_DEPENDENCIES=%(libs)s
260+%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s %(cppflags)s
261+%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
262+%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
263+%(libname)s_la_SOURCES=%(sources)s
264+check_PROGRAMS += %(tests)s
265+""" % plugin)
266+ plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am')
267+ if os.path.exists(plugin_am_file):
268+ plugin_file.write('include %s\n' % plugin_am_file)
269+
270+def write_external_plugin():
271+ """Return True if the plugin had changed."""
272+ plugin = read_plugin_ini('.')
273+ expand_plugin_ini(plugin)
274+ plugin_file = ChangeProtectedFile('configure.ac')
275+ write_external_configure(plugin, plugin_file)
276+ result = plugin_file.close()
277+ plugin_file = ChangeProtectedFile('Makefile.am')
278+ write_external_makefile(plugin, plugin_file)
279+ # Write some stub configure.ac and Makefile.am files that include the above
280+ result = plugin_file.close() or result
281+ return result
282+
283+def write_plugin(plugin, plugin_ini_list):
284+ # Since this function is recursive, make sure we're not already in it.
285+ if plugin.has_key('writing_status'):
286+ if plugin['writing_status'] == 'done':
287+ return
288+ else:
289+ print "Dependency loop detected with %s" % plugin['name']
290+ exit(1)
291+
292+ plugin['writing_status'] = 'dependencies'
293+
294+ # Write all dependencies first to get around annoying automake bug
295+ for dependency in plugin['dependency_list']:
296+ found = False
297+ for find_plugin in plugin_ini_list:
298+ if find_plugin['module_name'] == dependency:
299+ found = True
300+ write_plugin(find_plugin, plugin_ini_list)
301+ break
302+ if found is False:
303+ print "Could not find dependency %s: %s" % (plugin['name'], dependency)
304+ exit(1)
305+
306+ write_plugin_ac(plugin, plugin_ac_file)
307+ write_plugin_am(plugin, plugin_am_file)
308+ plugin['writing_status'] = 'done'
309+
310+def write_plugin_ac(plugin, plugin_ac):
311+ #
312+ # Write plugin config instructions into plugin.ac file.
313+ #
314+ plugin_ac_file=os.path.join(plugin['rel_path'],'plugin.ac')
315+ plugin_m4_dir=os.path.join(plugin['rel_path'],'m4')
316+ plugin_m4_files=[]
317+ if os.path.exists(plugin_m4_dir) and os.path.isdir(plugin_m4_dir):
318+ for m4_file in os.listdir(plugin_m4_dir):
319+ if os.path.splitext(m4_file)[-1] == '.m4':
320+ plugin_m4_files.append(os.path.join(plugin['rel_path'], m4_file))
321+ plugin_ac.write("""
322+dnl Config for %(title)s
323+""" % plugin)
324+ for m4_file in plugin_m4_files:
325+ plugin_ac.write('m4_sinclude([%s])\n' % m4_file)
326+ plugin['plugin_dep_libs']=" ".join(["\${top_builddir}/%s" % f for f in plugin['libs'].split()])
327+
328+ plugin_ac.write("""
329+AC_ARG_WITH([%(name_with_dashes)s-plugin],[
330+dnl indented wierd to make the help output correct
331+AS_HELP_STRING([--with-%(name_with_dashes)s-plugin],[Build %(title)s. @<:@default=%(enabled)s@:>@])
332+AS_HELP_STRING([--without-%(name_with_dashes)s-plugin],[Disable building %(title)s])
333+ ],[
334+ with_%(name)s_plugin="$withval"
335+ AS_IF([test "x$with_%(name)s_plugin" = "xyes"],[
336+ requested_%(name)s_plugin="yes"
337+ ],[
338+ requested_%(name)s_plugin="no"
339+ ])
340+ ],[
341+ with_%(name)s_plugin="%(enabled)s"
342+ requested_%(name)s_plugin="no"
343+ ])
344+AC_ARG_ENABLE([%(name_with_dashes)s-plugin],[
345+dnl indented wierd to make the help output correct
346+AS_HELP_STRING([--enable-%(name_with_dashes)s-plugin],[Build %(title)s. @<:@default=%(default_yesno)s@:>@])
347+AS_HELP_STRING([--disable-%(name_with_dashes)s-plugin],[Disable building %(title)s])
348+ ],
349+ [enable_%(name)s_plugin="$enableval"],
350+ [enable_%(name)s_plugin=%(default_yesno)s])
351+
352+""" % plugin)
353+ if os.path.exists(plugin_ac_file):
354+ plugin_ac.write('m4_sinclude([%s])\n' % plugin_ac_file)
355+ # The plugin author has specified some check to make to determine
356+ # if the plugin can be built. If the plugin is turned on and this
357+ # check fails, then configure should error out. If the plugin is not
358+ # turned on, then the normal conditional build stuff should just let
359+ # it silently not build
360+ if plugin['has_build_conditional']:
361+ plugin_ac.write("""
362+AS_IF([test %(build_conditional)s],
363+ [], dnl build_conditional can only negate
364+ [
365+ AS_IF([test "x${requested_%(name)s_plugin}" = "xyes"],
366+ [AC_MSG_ERROR([Plugin %(name)s was explicitly requested, yet failed build dependency checks. Aborting!])])
367+ with_%(name)s_plugin=no
368+ ])
369+
370+""" % plugin)
371+ if not plugin['unconditional']:
372+ plugin_ac.write("""
373+AM_CONDITIONAL([%(build_conditional_tag)s],
374+ [test %(build_conditional)s])
375+ """ % plugin)
376+
377+ plugin_ac.write("""
378+AS_IF([test "x$with_%(name)s_plugin" = "xyes"],
379+ [
380+""" % plugin)
381+ if plugin['testsuite']:
382+ plugin_ac.write("""
383+ pandora_plugin_test_list="%(name)s,${pandora_plugin_test_list}"
384+ """ % plugin)
385+ if plugin['static']:
386+ plugin_ac.write("""
387+ AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
388+ pandora_builtin_list="%(module_name)s,${pandora_builtin_list}"
389+ pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}"
390+ pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la"
391+ PANDORA_PLUGIN_DEP_LIBS="${PANDORA_PLUGIN_DEP_LIBS} %(plugin_dep_libs)s"
392+ ])
393+ """ % plugin)
394+
395+ else:
396+ plugin_ac.write("""
397+ AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[
398+ pandora_default_plugin_list="%(name)s,${pandora_default_plugin_list}"
399+ ])
400+ """ % plugin)
401+ plugin_ac.write(" ])\n")
402+
403+def fix_file_paths(plugin, files):
404+ # TODO: determine path to plugin dir relative to top_srcdir... append it to
405+ # source files if they don't already have it
406+ new_files=""
407+ if plugin['plugin_dir'] != ".":
408+ for file in files.split():
409+ if not file.startswith(plugin['rel_path']):
410+ file= os.path.join(plugin['rel_path'], file)
411+ new_files= "%s %s" % (new_files, file)
412+ else:
413+ new_files= " ".join(plugin['sources'].split())
414+ if new_files != "":
415+ return new_files
416+ return files
417+
418+def expand_plugin_ini(plugin):
419+ if plugin['name'] == "**OUT-OF-TREE**":
420+ print "Out of tree plugins require the name field to be specified in plugin.ini"
421+ sys.exit(1)
422+
423+ if plugin['plugin_dir'] == ".":
424+ plugin['rel_path']= plugin['plugin_dir']
425+ plugin['unconditional']=True
426+ else:
427+ plugin['rel_path']= plugin['plugin_dir'][len(config['top_srcdir'])+len(os.path.sep):]
428+ plugin['unconditional']=False
429+
430+ plugin['sources']= fix_file_paths(plugin, plugin['sources'])
431+ plugin['main_source']= plugin['sources'].split()[0]
432+ plugin['headers']= fix_file_paths(plugin, plugin['headers'])
433+ plugin['install_headers']= fix_file_paths(plugin, plugin['install_headers'])
434+ plugin['tests']= fix_file_paths(plugin, plugin['tests'])
435+
436+ # Make a yes/no version for autoconf help messages
437+ if plugin['load_by_default'] or plugin['static']:
438+ plugin['default_yesno']="yes"
439+ else:
440+ plugin['default_yesno']="no"
441+
442+
443+ plugin['build_conditional_tag']= "BUILD_%s_PLUGIN" % plugin['name'].upper()
444+ plugin['name_with_dashes']= plugin['name'].replace('_','-')
445+ if plugin.has_key('build_conditional'):
446+ plugin['has_build_conditional']=True
447+ plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes" -a %(build_conditional)s' % plugin
448+ else:
449+ plugin['has_build_conditional']=False
450+ plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes"' %plugin
451+
452+ if plugin['install']:
453+ plugin['library_type']= 'pkgplugin'
454+ else:
455+ plugin['library_type']= 'noinst'
456+
457+def find_testsuite(plugin_dir):
458+ for testdir in ['drizzle-tests','tests']:
459+ if os.path.isdir(os.path.join(plugin_dir,testdir)):
460+ return testdir
461+ if os.path.isdir(os.path.join('tests','suite',os.path.basename(plugin_dir))):
462+ return ""
463+ return None
464+
465+def read_plugin_ini(plugin_dir):
466+ if plugin_dir == ".":
467+ plugin_name="**OUT-OF-TREE**"
468+ else:
469+ short_name=os.path.basename(plugin_dir)
470+ plugin_name = plugin_dir[plugin_dir.index(config['root_plugin_dir']) + len(config['root_plugin_dir']) + 1:]
471+ module_name = plugin_name.replace("/", config['module_name_separator']).replace("\\", config['module_name_separator'])
472+ plugin_name = plugin_name.replace("/", config['plugin_name_separator']).replace("\\", config['plugin_name_separator'])
473+
474+
475+ plugin_file= os.path.join(plugin_dir,config['plugin_ini_fname'])
476+ plugin_defaults= dict(sources="%s.cc" % short_name,
477+ headers="",
478+ install_headers="",
479+ cflags="",
480+ cppflags="",
481+ cxxflags="",
482+ libs="",
483+ ldflags="",
484+ author="",
485+ title="",
486+ description="",
487+ license="PLUGIN_LICENSE_GPL",
488+ name=plugin_name,
489+ module_name=module_name,
490+ load_by_default=config['default_load_by_default'],
491+ disabled="False",
492+ static="False",
493+ dependencies="",
494+ dependency_aliases="",
495+ tests="",
496+ install=config['default_install'])
497+ parser=ConfigParser.ConfigParser(defaults= plugin_defaults)
498+ parser.read(plugin_file)
499+ plugin=dict(parser.items('plugin'))
500+ plugin['plugin_dir'] = plugin_dir
501+ if plugin_dir == '.':
502+ if not plugin.has_key('url'):
503+ print "External Plugins are required to specifiy a url"
504+ plugin['url']= 'http://launchpad.net/%(name)s' % plugin
505+ sys.exit(1)
506+ if plugin_dir == '.' and not plugin.has_key('version'):
507+ print "External Plugins are required to specifiy a version"
508+ sys.exit(1)
509+ if not plugin.has_key('version'):
510+ plugin['version'] = config['default_plugin_version']
511+
512+ if plugin.has_key('load_by_default'):
513+ plugin['load_by_default']=parser.getboolean('plugin','load_by_default')
514+ if plugin.has_key('disabled'):
515+ plugin['disabled']=parser.getboolean('plugin','disabled')
516+ if plugin['disabled']:
517+ plugin['enabled']="no"
518+ else:
519+ plugin['enabled']="yes"
520+ if plugin.has_key('static'):
521+ plugin['static']= parser.getboolean('plugin','static')
522+ if plugin.has_key('install'):
523+ plugin['install']= parser.getboolean('plugin','install')
524+ if plugin.has_key('testsuite'):
525+ if plugin['testsuite'] == 'disable':
526+ plugin['testsuite']= False
527+ else:
528+ plugin_testsuite= find_testsuite(plugin_dir)
529+ plugin['testsuitedir']=plugin_testsuite
530+ if plugin_testsuite is not None:
531+ plugin['testsuite']=True
532+ else:
533+ plugin['testsuite']=False
534+
535+ plugin['cflags']+= ' ' + config['extra_cflags']
536+ plugin['cppflags']+= ' ' + config['extra_cppflags']
537+ plugin['cxxflags']+= ' ' + config['extra_cxxflags']
538+
539+ plugin['libname']= "lib%s%s%s" % (config['plugin_prefix'],
540+ plugin['name'],
541+ config['plugin_suffix'])
542+ if config['force_lowercase_libname']:
543+ plugin['libname']= plugin['libname'].lower()
544+
545+ plugin['root_plugin_dir']= config['root_plugin_dir']
546+ plugin['plugin_prefix']= config['plugin_prefix']
547+ plugin['plugin_suffix']= config['plugin_suffix']
548+ plugin['pkgplugindir']= config['pkgplugindir']
549+
550+ # Dependencies must have a module but dependency aliases are simply added
551+ # to the variable passed during compile.
552+ plugin['dependency_list'] = plugin['dependencies'].split()
553+ dependency_aliases = plugin['dependency_aliases'].split()
554+ plugin['dependencies'] = ','.join(plugin['dependency_list'] +
555+ plugin['dependency_aliases'].split())
556+ dependency_libs = ["%s/lib%s%s.la" % (config['root_plugin_dir'],
557+ dependency.lower().replace('::', '_'),
558+ config['plugin_suffix'])
559+ for dependency in plugin['dependency_list']]
560+ plugin['libs'] = " ".join(plugin['libs'].split() + dependency_libs);
561+
562+# Libtool is going to expand:
563+# -DPANDORA_MODULE_AUTHOR='"Padraig O'"'"'Sullivan"'
564+# to:
565+# "-DPANDORA_MODULE_AUTHOR=\"Padraig O'Sullivan\""
566+# So we have to replace internal ''s to '"'"'
567+ for key in ('author','title','description','version'):
568+ plugin[key]=plugin[key].replace('"','\\"')
569+ plugin[key]=plugin[key].replace("'","'\"'\"'")
570+ return plugin
571+
572+
573+def write_plugin_am(plugin, plugin_am):
574+ """Write an automake fragment for this plugin.
575+
576+ :param plugin: The plugin dict.
577+ :param plugin_am: The file to write to.
578+ """
579+ # The .plugin.ini.stamp avoids changing the datestamp on plugin.ini which can
580+ # confuse VCS systems.
581+ plugin_am.write("""
582+EXTRA_DIST += %(rel_path)s/plugin.ini
583+
584+# Prevent errors when a plugin dir is removed
585+%(rel_path)s/plugin.ini:
586+
587+""" % plugin)
588+ if plugin['headers'] != "":
589+ plugin_am.write("noinst_HEADERS += %(headers)s\n" % plugin)
590+ if plugin['install_headers'] != "":
591+ plugin_am.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin)
592+ if plugin['testsuite']:
593+ if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "":
594+ plugin_am.write("EXTRA_DIST += %(rel_path)s/%(testsuitedir)s\n" % plugin)
595+ if plugin['static']:
596+ plugin_am.write("""
597+%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
598+EXTRA_DIST += %(rel_path)s/plugin.ini
599+if %(build_conditional_tag)s
600+ noinst_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
601+ %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
602+ %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
603+ %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=$(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
604+ %(root_plugin_dir)s_%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s -DPANDORA_MODULE_DEPENDENCIES='"%(dependencies)s"' %(cppflags)s
605+ %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
606+ %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
607+ %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s
608+ check_PROGRAMS += %(tests)s
609+ PANDORA_DYNAMIC_LDADDS+=${top_builddir}/%(root_plugin_dir)s/%(libname)s.la
610+endif
611+""" % plugin)
612+ else:
613+ plugin_am.write("""
614+%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s
615+EXTRA_DIST += %(rel_path)s/plugin.ini
616+if %(build_conditional_tag)s
617+ %(library_type)s_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la
618+ %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS)
619+ %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s
620+ %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s
621+ %(root_plugin_dir)s_%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s -DPANDORA_MODULE_DEPENDENCIES='"%(dependencies)s"' %(cppflags)s
622+ %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s
623+ %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s
624+ %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s
625+ check_PROGRAMS += %(tests)s
626+endif
627+""" % plugin)
628+ plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am')
629+ if os.path.exists(plugin_am_file):
630+ plugin_am.write('include %s\n' % plugin_am_file)
631+
632+#
633+# MAIN STARTS HERE:
634+#
635+
636+# Parse the pandora-plugin config file
637+
638+config_defaults= dict(
639+ top_srcdir='.',
640+ top_builddir='.',
641+ plugin_ini_fname='plugin.ini',
642+ plugin_prefix='',
643+ plugin_suffix='',
644+ extra_cflags='',
645+ extra_cppflags='',
646+ extra_cxxflags='',
647+ root_plugin_dir='',
648+ pkgplugindir='',
649+ default_install='True',
650+ default_plugin_version='',
651+ default_load_by_default='False',
652+ force_lowercase_libname='True',
653+ plugin_name_separator='_',
654+ module_name_separator='::'
655+)
656+
657+config_parser = ConfigParser.ConfigParser(defaults=config_defaults)
658+config_parser.read(pandora_plugin_file)
659+config = dict(config_parser.items('pandora-plugin'))
660+config['force_lowercase_libname']=config_parser.getboolean('pandora-plugin','force_lowercase_libname')
661+
662+# I'm 3 seconds away from writing a comprehensive build solution
663+if not os.path.exists('config/pandora_vc_revinfo'):
664+ if os.path.exists('.bzr'):
665+ bzr_revno= subprocess.Popen(["bzr", "revno"], stdout=subprocess.PIPE).communicate()[0].strip()
666+ rev_date= datetime.date.fromtimestamp(time.time())
667+ config['default_plugin_version'] = "%d.%02d.%s" % (rev_date.year, rev_date.month, bzr_revno)
668+ else:
669+ config['default_plugin_version']=datetime.date.fromtimestamp(time.time()).isoformat()
670+else:
671+ # need to read config/pandora_vc_revno
672+ pandora_vc_revno=open('config/pandora_vc_revinfo','r').read().split()
673+ rev_date=""
674+ bzr_revno=""
675+ for revno_line in pandora_vc_revno:
676+ (revno_key,revno_val)= revno_line.split("=")
677+ if revno_key == 'PANDORA_VC_REVNO':
678+ bzr_revno=revno_val.strip()
679+ elif revno_key == 'PANDORA_RELEASE_DATE':
680+ rev_date=revno_val.strip()
681+
682+ config['default_plugin_version'] = "%s.%s" % (rev_date, bzr_revno)
683+
684+actions=[]
685+for arg in sys.argv:
686+ if arg.startswith('--top_srcdir='):
687+ config['top_srcdir']=arg[12:]
688+ elif arg.startswith('--top_builddir='):
689+ config['top_builddir']=arg[14:]
690+ elif arg == "--force-all":
691+ actions=['plugin-list','pandora-plugin.am','write']
692+ break
693+ else:
694+ actions.append(arg)
695+if len(actions) == 0:
696+ actions.append('write')
697+
698+plugin_list=[]
699+
700+def accumulate_plugins(arg, dirname, fnames):
701+ # plugin_ini_fname is a name in dirname indicating dirname is a plugin.
702+ if config['plugin_ini_fname'] in fnames:
703+ arg.append(dirname)
704+
705+os.path.walk(os.path.join(config['top_srcdir'],
706+ config['root_plugin_dir']),
707+ accumulate_plugins,
708+ plugin_list)
709+
710+
711+if not os.path.exists("config/pandora-plugin.am") or "write" in actions:
712+ plugin_am_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.am'))
713+ plugin_am_file.write("""
714+# always the current list, generated every build so keep this lean.
715+# pandora-plugin.list: datestamp preserved list
716+${srcdir}/config/pandora-plugin.list: .plugin.scan
717+.plugin.scan:
718+ @cd ${top_srcdir} && python config/pandora-plugin plugin-list
719+
720+# Plugins affect configure; so to prevent configure running twice in a tarball
721+# build (once up front, once with the right list of plugins, we ship the
722+# generated list of plugins and the housekeeping material for that list so it
723+# is likewise not updated.
724+EXTRA_DIST += \
725+ config/pandora-plugin.am \
726+ config/pandora-plugin.ac \
727+ config/pandora-plugin \
728+ config/pandora-plugin.ini
729+
730+
731+# Seed the list of plugin LDADDS which plugins may extend.
732+PANDORA_DYNAMIC_LDADDS=
733+
734+# plugin.stamp: graph dominator for creating all per pandora-plugin.ac/am
735+# files. This is invoked when the code to generate such files has altered.""")
736+
737+if not os.path.exists("config/pandora-plugin.ac") or "write" in actions:
738+ plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac'))
739+ plugin_ac_file.write("dnl Generated file, run make to rebuild\n")
740+
741+
742+if os.path.exists('plugin.ini'):
743+ # Are we in a plugin dir which wants to have a self-sufficient build system?
744+ plugin_list=['.']
745+
746+ write_external_plugin()
747+else:
748+ plugin_list_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.list'))
749+ for p in plugin_list:
750+ plugin_list_file.write(p)
751+ plugin_list_file.write("\n")
752+ plugin_list.sort()
753+ plugin_list_file.close()
754+
755+if not os.path.exists("config/pandora-plugin.am") or 'write' in actions:
756+ plugin_am_file.write("\n${top_srcdir}/config/pandora-plugin.am: ${top_srcdir}/config/pandora-plugin.list ${top_srcdir}/config/pandora-plugin ")
757+ for plugin_dir in plugin_list:
758+ plugin_am_file.write("\\\n\t%s/plugin.ini " % plugin_dir)
759+ plugin_am_file.write("\n\tcd ${top_srcdir} && python config/pandora-plugin write\n")
760+ plugin_ini_list=[]
761+
762+ # Load all plugin.ini files first so we can do dependency tracking.
763+ for plugin_dir in plugin_list:
764+ plugin = read_plugin_ini(plugin_dir)
765+ expand_plugin_ini(plugin)
766+ plugin_ini_list.append(plugin)
767+
768+ # Check for duplicates
769+ plugin_name_list = [plugin['libname'] for plugin in plugin_ini_list]
770+ for plugin in plugin_ini_list:
771+ if plugin_name_list.count(plugin['libname']) != 1:
772+ print "Duplicate module name %s" % plugin['libname']
773+ exit(1)
774+
775+ for plugin in plugin_ini_list:
776+ write_plugin(plugin, plugin_ini_list)
777+
778+if plugin_am_file is not None:
779+ plugin_am_file.close()
780+if plugin_ac_file is not None:
781+ plugin_ac_file.close()
782
783=== added file 'config/uncrustify.cfg'
784--- config/uncrustify.cfg 1970-01-01 00:00:00 +0000
785+++ config/uncrustify.cfg 2010-07-01 01:31:26 +0000
786@@ -0,0 +1,1112 @@
787+#
788+# Uncrustify options (with comments) for Pandora Projects
789+#
790+
791+nl_after_brace_close = TRUE
792+
793+# The type of line endings
794+newlines = lf # auto/lf/crlf/cr
795+
796+# The original size of tabs in the input
797+input_tab_size = 8 # number
798+
799+# The size of tabs in the output (only used if align_with_tabs=true)
800+output_tab_size = 3 # number
801+
802+# The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn)
803+string_escape_char = 92 # number
804+
805+# Alternate string escape char for Pawn. Only works right before the quote char.
806+string_escape_char2 = 0 # number
807+
808+#
809+# Indenting
810+#
811+
812+# The number of columns to indent per level.
813+# Usually 2, 3, 4, or 8.
814+indent_columns = 2 # number
815+
816+# How to use tabs when indenting code
817+# 0=spaces only
818+# 1=indent with tabs, align with spaces
819+# 2=indent and align with tabs
820+indent_with_tabs = 0 # number
821+
822+# Whether to indent strings broken by '\' so that they line up
823+indent_align_string = true # false/true
824+
825+# The number of spaces to indent multi-line XML strings.
826+# Requires indent_align_string=True
827+indent_xml_string = 0 # number
828+
829+# Spaces to indent '{' from level
830+indent_brace = 0 # number
831+
832+# Whether braces are indented to the body level
833+indent_braces = false # false/true
834+
835+# Disabled indenting function braces if indent_braces is true
836+indent_braces_no_func = false # false/true
837+
838+# Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc.
839+indent_brace_parent = false # false/true
840+
841+# Whether the 'namespace' body is indented
842+indent_namespace = false # false/true
843+
844+# Whether the 'extern "C"' body is indented
845+indent_extern = false # false/true
846+
847+# Whether the 'class' body is indented
848+indent_class = true # false/true
849+
850+# Whether to indent the stuff after a leading class colon
851+indent_class_colon = true # false/true
852+
853+# False=treat 'else\nif' as 'else if' for indenting purposes
854+# True=indent the 'if' one level
855+indent_else_if = false # false/true
856+
857+# True: indent continued function call parameters one indent level
858+# False: align parameters under the open paren
859+indent_func_call_param = false # false/true
860+
861+# Same as indent_func_call_param, but for function defs
862+indent_func_def_param = false # false/true
863+
864+# Same as indent_func_call_param, but for function protos
865+indent_func_proto_param = false # false/true
866+
867+# Same as indent_func_call_param, but for class declarations
868+indent_func_class_param = false # false/true
869+
870+# Same as indent_func_call_param, but for class variable constructors
871+indent_func_ctor_var_param = false # false/true
872+
873+# Same as indent_func_call_param, but for templates
874+indent_template_param = false # false/true
875+
876+# Double the indent for indent_func_xxx_param options
877+indent_func_param_double = false # false/true
878+
879+# Indentation column for standalone 'const' function decl/proto qualifier
880+indent_func_const = 0 # number
881+
882+# Indentation column for standalone 'throw' function decl/proto qualifier
883+indent_func_throw = 0 # number
884+
885+# The number of spaces to indent a continued '->' or '.'
886+# Usually set to 0, 1, or indent_columns.
887+indent_member = 3 # number
888+
889+# Spaces to indent single line ('//') comments on lines before code
890+indent_sing_line_comments = 0 # number
891+
892+# If set, will indent trailing single line ('//') comments relative
893+# to the code instead of trying to keep the same absolute column
894+indent_relative_single_line_comments = false # false/true
895+
896+# Spaces to indent 'case' from 'switch'
897+# Usually 0 or indent_columns.
898+indent_switch_case = 0 # number
899+
900+# Spaces to shift the 'case' line, without affecting any other lines
901+# Usually 0.
902+indent_case_shift = 0 # number
903+
904+# Spaces to indent '{' from 'case'.
905+# By default, the brace will appear under the 'c' in case.
906+# Usually set to 0 or indent_columns.
907+indent_case_brace = 0 # number
908+
909+# Whether to indent comments found in first column
910+indent_col1_comment = false # false/true
911+
912+# How to indent goto labels
913+# >0 : absolute column where 1 is the leftmost column
914+# <=0 : subtract from brace indent
915+indent_label = 1 # number
916+
917+# Same as indent_label, but for access specifiers that are followed by a colon
918+indent_access_spec = 1 # number
919+
920+# Indent the code after an access specifier by one level.
921+# If set, this option forces 'indent_access_spec=0'
922+indent_access_spec_body = false # false/true
923+
924+# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended)
925+indent_paren_nl = false # false/true
926+
927+# Controls the indent of a close paren after a newline.
928+# 0: Indent to body level
929+# 1: Align under the open paren
930+# 2: Indent to the brace level
931+indent_paren_close = 0 # number
932+
933+# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren
934+indent_comma_paren = false # false/true
935+
936+# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren
937+indent_bool_paren = false # false/true
938+
939+# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended)
940+indent_square_nl = false # false/true
941+
942+# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies
943+indent_preserve_sql = false # false/true
944+
945+#
946+# Spacing options
947+#
948+
949+# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
950+sp_arith = force # ignore/add/remove/force
951+
952+# Add or remove space before assignment operator '=', '+=', etc
953+sp_before_assign = remove # ignore/add/remove/force
954+
955+# Add or remove space after assignment operator '=', '+=', etc
956+sp_after_assign = force # ignore/add/remove/force
957+
958+# Add or remove space around assignment '=' in enum
959+sp_enum_assign = ignore # ignore/add/remove/force
960+
961+# Add or remove space around boolean operators '&&' and '||'
962+sp_bool = force # ignore/add/remove/force
963+
964+# Add or remove space around compare operator '<', '>', '==', etc
965+sp_compare = force # ignore/add/remove/force
966+
967+# Add or remove space inside '(' and ')'
968+sp_inside_paren = remove # ignore/add/remove/force
969+
970+# Add or remove space between nested parens
971+sp_paren_paren = remove # ignore/add/remove/force
972+
973+# Whether to balance spaces inside nested parens
974+sp_balance_nested_parens = false # false/true
975+
976+# Add or remove space between ')' and '{'
977+sp_paren_brace = ignore # ignore/add/remove/force
978+
979+# Add or remove space before pointer star '*'
980+sp_before_ptr_star = force # ignore/add/remove/force
981+
982+# Add or remove space before pointer star '*' that isn't followed by a variable name
983+# If set to 'ignore', sp_before_ptr_star is used instead.
984+sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force
985+
986+# Add or remove space between pointer stars '*'
987+sp_between_ptr_star = remove # ignore/add/remove/force
988+
989+# Add or remove space after pointer star '*', if followed by a word.
990+sp_after_ptr_star = remove # ignore/add/remove/force
991+
992+# Add or remove space after a pointer star '*', if followed by a func proto/def.
993+sp_after_ptr_star_func = ignore # ignore/add/remove/force
994+
995+# Add or remove space before a pointer star '*', if followed by a func proto/def.
996+sp_before_ptr_star_func = ignore # ignore/add/remove/force
997+
998+# Add or remove space before a reference sign '&'
999+sp_before_byref = remove # ignore/add/remove/force
1000+
1001+# Add or remove space before a reference sign '&' that isn't followed by a variable name
1002+# If set to 'ignore', sp_before_byref is used instead.
1003+sp_before_unnamed_byref = ignore # ignore/add/remove/force
1004+
1005+# Add or remove space after reference sign '&', if followed by a word.
1006+sp_after_byref = force # ignore/add/remove/force
1007+
1008+# Add or remove space after a reference sign '&', if followed by a func proto/def.
1009+sp_after_byref_func = ignore # ignore/add/remove/force
1010+
1011+# Add or remove space before a reference sign '&', if followed by a func proto/def.
1012+sp_before_byref_func = ignore # ignore/add/remove/force
1013+
1014+# Add or remove space between type and word
1015+sp_after_type = force # ignore/add/remove/force
1016+
1017+# Add or remove space in 'template <' vs 'template<'.
1018+# If set to ignore, sp_before_angle is used.
1019+sp_template_angle = ignore # ignore/add/remove/force
1020+
1021+# Add or remove space before '<>'
1022+sp_before_angle = remove # ignore/add/remove/force
1023+
1024+# Add or remove space inside '<' and '>'
1025+sp_inside_angle = remove # ignore/add/remove/force
1026+
1027+# Add or remove space after '<>'
1028+sp_after_angle = force # ignore/add/remove/force
1029+
1030+# Add or remove space between '<>' and '(' as found in 'new List<byte>();'
1031+sp_angle_paren = ignore # ignore/add/remove/force
1032+
1033+# Add or remove space between '<>' and a word as in 'List<byte> m;'
1034+sp_angle_word = ignore # ignore/add/remove/force
1035+
1036+# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
1037+sp_before_sparen = force # ignore/add/remove/force
1038+
1039+# Add or remove space inside if-condition '(' and ')'
1040+sp_inside_sparen = remove # ignore/add/remove/force
1041+
1042+# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
1043+sp_after_sparen = force # ignore/add/remove/force
1044+
1045+# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'
1046+sp_sparen_brace = add # ignore/add/remove/force
1047+
1048+# Add or remove space before empty statement ';' on 'if', 'for' and 'while'
1049+sp_special_semi = ignore # ignore/add/remove/force
1050+
1051+# Add or remove space before ';'
1052+sp_before_semi = remove # ignore/add/remove/force
1053+
1054+# Add or remove space before ';' in non-empty 'for' statements
1055+sp_before_semi_for = ignore # ignore/add/remove/force
1056+
1057+# Add or remove space before a semicolon of an empty part of a for statment.
1058+sp_before_semi_for_empty = force # ignore/add/remove/force
1059+
1060+# Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; <here> ).
1061+sp_after_semi_for_empty = ignore # ignore/add/remove/force
1062+
1063+# Add or remove space before '[' (except '[]')
1064+sp_before_square = ignore # ignore/add/remove/force
1065+
1066+# Add or remove space before '[]'
1067+sp_before_squares = ignore # ignore/add/remove/force
1068+
1069+# Add or remove space inside '[' and ']'
1070+sp_inside_square = remove # ignore/add/remove/force
1071+
1072+# Add or remove space after ','
1073+sp_after_comma = force # ignore/add/remove/force
1074+
1075+# Add or remove space before ','
1076+sp_before_comma = remove # ignore/add/remove/force
1077+
1078+# Add or remove space after class ':'
1079+sp_after_class_colon = ignore # ignore/add/remove/force
1080+
1081+# Add or remove space before class ':'
1082+sp_before_class_colon = ignore # ignore/add/remove/force
1083+
1084+# Add or remove space between 'operator' and operator sign
1085+sp_after_operator = ignore # ignore/add/remove/force
1086+
1087+# Add or remove space between the operator symbol and the open paren, as in 'operator ++('
1088+sp_after_operator_sym = ignore # ignore/add/remove/force
1089+
1090+# Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'
1091+sp_after_cast = remove # ignore/add/remove/force
1092+
1093+# Add or remove spaces inside cast parens
1094+sp_inside_paren_cast = remove # ignore/add/remove/force
1095+
1096+# Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)'
1097+sp_cpp_cast_paren = remove # ignore/add/remove/force
1098+
1099+# Add or remove space between 'sizeof' and '('
1100+sp_sizeof_paren = remove # ignore/add/remove/force
1101+
1102+# Add or remove space after the tag keyword (Pawn)
1103+sp_after_tag = ignore # ignore/add/remove/force
1104+
1105+# Add or remove space inside enum '{' and '}'
1106+sp_inside_braces_enum = force # ignore/add/remove/force
1107+
1108+# Add or remove space inside struct/union '{' and '}'
1109+sp_inside_braces_struct = force # ignore/add/remove/force
1110+
1111+# Add or remove space inside '{' and '}'
1112+sp_inside_braces = force # ignore/add/remove/force
1113+
1114+# Add or remove space inside '{}'
1115+sp_inside_braces_empty = ignore # ignore/add/remove/force
1116+
1117+# Add or remove space between return type and function name
1118+# A minimum of 1 is forced except for pointer return types.
1119+sp_type_func = force # ignore/add/remove/force
1120+
1121+# Add or remove space between function name and '(' on function declaration
1122+sp_func_proto_paren = remove # ignore/add/remove/force
1123+
1124+# Add or remove space between function name and '(' on function definition
1125+sp_func_def_paren = remove # ignore/add/remove/force
1126+
1127+# Add or remove space inside empty function '()'
1128+sp_inside_fparens = ignore # ignore/add/remove/force
1129+
1130+# Add or remove space inside function '(' and ')'
1131+sp_inside_fparen = remove # ignore/add/remove/force
1132+
1133+# Add or remove space between ']' and '(' when part of a function call.
1134+sp_square_fparen = ignore # ignore/add/remove/force
1135+
1136+# Add or remove space between ')' and '{' of function
1137+sp_fparen_brace = add # ignore/add/remove/force
1138+
1139+# Add or remove space between function name and '(' on function calls
1140+sp_func_call_paren = remove # ignore/add/remove/force
1141+
1142+# Add or remove space between the user function name and '(' on function calls
1143+# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file.
1144+sp_func_call_user_paren = ignore # ignore/add/remove/force
1145+
1146+# Add or remove space between a constructor/destructor and the open paren
1147+sp_func_class_paren = remove # ignore/add/remove/force
1148+
1149+# Add or remove space between 'return' and '('
1150+sp_return_paren = remove # ignore/add/remove/force
1151+
1152+# Add or remove space between '__attribute__' and '('
1153+sp_attribute_paren = remove # ignore/add/remove/force
1154+
1155+# Add or remove space between 'defined' and '(' in '#if defined (FOO)'
1156+sp_defined_paren = remove # ignore/add/remove/force
1157+
1158+# Add or remove space between 'throw' and '(' in 'throw (something)'
1159+sp_throw_paren = ignore # ignore/add/remove/force
1160+
1161+# Add or remove space between macro and value
1162+sp_macro = ignore # ignore/add/remove/force
1163+
1164+# Add or remove space between macro function ')' and value
1165+sp_macro_func = ignore # ignore/add/remove/force
1166+
1167+# Add or remove space between 'else' and '{' if on the same line
1168+sp_else_brace = ignore # ignore/add/remove/force
1169+
1170+# Add or remove space between '}' and 'else' if on the same line
1171+sp_brace_else = ignore # ignore/add/remove/force
1172+
1173+# Add or remove space between '}' and the name of a typedef on the same line
1174+sp_brace_typedef = force # ignore/add/remove/force
1175+
1176+# Add or remove space between 'catch' and '{' if on the same line
1177+sp_catch_brace = ignore # ignore/add/remove/force
1178+
1179+# Add or remove space between '}' and 'catch' if on the same line
1180+sp_brace_catch = ignore # ignore/add/remove/force
1181+
1182+# Add or remove space between 'finally' and '{' if on the same line
1183+sp_finally_brace = ignore # ignore/add/remove/force
1184+
1185+# Add or remove space between '}' and 'finally' if on the same line
1186+sp_brace_finally = ignore # ignore/add/remove/force
1187+
1188+# Add or remove space between 'try' and '{' if on the same line
1189+sp_try_brace = ignore # ignore/add/remove/force
1190+
1191+# Add or remove space between get/set and '{' if on the same line
1192+sp_getset_brace = ignore # ignore/add/remove/force
1193+
1194+# Add or remove space before the '::' operator
1195+sp_before_dc = remove # ignore/add/remove/force
1196+
1197+# Add or remove space after the '::' operator
1198+sp_after_dc = remove # ignore/add/remove/force
1199+
1200+# Add or remove around the D named array initializer ':' operator
1201+sp_d_array_colon = ignore # ignore/add/remove/force
1202+
1203+# Add or remove space after the '!' (not) operator.
1204+sp_not = force # ignore/add/remove/force
1205+
1206+# Add or remove space after the '~' (invert) operator.
1207+sp_inv = remove # ignore/add/remove/force
1208+
1209+# Add or remove space after the '&' (address-of) operator.
1210+# This does not affect the spacing after a '&' that is part of a type.
1211+sp_addr = remove # ignore/add/remove/force
1212+
1213+# Add or remove space around the '.' or '->' operators
1214+sp_member = remove # ignore/add/remove/force
1215+
1216+# Add or remove space after the '*' (dereference) operator.
1217+# This does not affect the spacing after a '*' that is part of a type.
1218+sp_deref = remove # ignore/add/remove/force
1219+
1220+# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'
1221+sp_sign = remove # ignore/add/remove/force
1222+
1223+# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'
1224+sp_incdec = remove # ignore/add/remove/force
1225+
1226+# Add or remove space before a backslash-newline at the end of a line
1227+sp_before_nl_cont = add # ignore/add/remove/force
1228+
1229+# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'
1230+sp_after_oc_scope = ignore # ignore/add/remove/force
1231+
1232+# Add or remove space after the colon in message specs
1233+# '-(int) f:(int) x;' vs '-(int) f: (int) x;'
1234+sp_after_oc_colon = ignore # ignore/add/remove/force
1235+
1236+# Add or remove space before the colon in message specs
1237+# '-(int) f: (int) x;' vs '-(int) f : (int) x;'
1238+sp_before_oc_colon = ignore # ignore/add/remove/force
1239+
1240+# Add or remove space after the colon in message specs
1241+# '[object setValue:1];' vs '[object setValue: 1];'
1242+sp_after_send_oc_colon = ignore # ignore/add/remove/force
1243+
1244+# Add or remove space before the colon in message specs
1245+# '[object setValue:1];' vs '[object setValue :1];'
1246+sp_before_send_oc_colon = ignore # ignore/add/remove/force
1247+
1248+# Add or remove space after the (type) in message specs
1249+# '-(int) f: (int) x;' vs '-(int) f: (int)x;'
1250+sp_after_oc_type = ignore # ignore/add/remove/force
1251+
1252+# Add or remove space around the ':' in 'b ? t : f'
1253+sp_cond_colon = ignore # ignore/add/remove/force
1254+
1255+# Add or remove space around the '?' in 'b ? t : f'
1256+sp_cond_question = ignore # ignore/add/remove/force
1257+
1258+# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here.
1259+sp_case_label = remove # ignore/add/remove/force
1260+
1261+#
1262+# Code alignment (not left column spaces/tabs)
1263+#
1264+
1265+# Whether to keep non-indenting tabs
1266+align_keep_tabs = false # false/true
1267+
1268+# Whether to use tabs for alinging
1269+align_with_tabs = false # false/true
1270+
1271+# Whether to bump out to the next tab when aligning
1272+align_on_tabstop = false # false/true
1273+
1274+# Whether to left-align numbers
1275+align_number_left = false # false/true
1276+
1277+# Align variable definitions in prototypes and functions
1278+align_func_params = false # false/true
1279+
1280+# Align parameters in single-line functions that have the same name.
1281+# The function names must already be aligned with each other.
1282+align_same_func_call_params = false # false/true
1283+
1284+# The span for aligning variable definitions (0=don't align)
1285+align_var_def_span = 1 # number
1286+
1287+# How to align the star in variable definitions.
1288+# 0=Part of the type 'void * foo;'
1289+# 1=Part of the variable 'void *foo;'
1290+# 2=Dangling 'void *foo;'
1291+align_var_def_star_style = 1 # number
1292+
1293+# How to align the '&' in variable definitions.
1294+# 0=Part of the type
1295+# 1=Part of the variable
1296+# 2=Dangling
1297+align_var_def_amp_style = 0 # number
1298+
1299+# The threshold for aligning variable definitions (0=no limit)
1300+align_var_def_thresh = 1 # number
1301+
1302+# The gap for aligning variable definitions
1303+align_var_def_gap = 0 # number
1304+
1305+# Whether to align the colon in struct bit fields
1306+align_var_def_colon = false # false/true
1307+
1308+# Whether to align inline struct/enum/union variable definitions
1309+align_var_def_inline = false # false/true
1310+
1311+# The span for aligning on '=' in assignments (0=don't align)
1312+align_assign_span = 0 # number
1313+
1314+# The threshold for aligning on '=' in assignments (0=no limit)
1315+align_assign_thresh = 12 # number
1316+
1317+# The span for aligning on '=' in enums (0=don't align)
1318+align_enum_equ_span = 0 # number
1319+
1320+# The threshold for aligning on '=' in enums (0=no limit)
1321+align_enum_equ_thresh = 0 # number
1322+
1323+# The span for aligning struct/union (0=don't align)
1324+align_var_struct_span = 0 # number
1325+
1326+# The threshold for aligning struct/union member definitions (0=no limit)
1327+align_var_struct_thresh = 0 # number
1328+
1329+# The gap for aligning struct/union member definitions
1330+align_var_struct_gap = 0 # number
1331+
1332+# The span for aligning struct initializer values (0=don't align)
1333+align_struct_init_span = 3 # number
1334+
1335+# The minimum space between the type and the synonym of a typedef
1336+align_typedef_gap = 3 # number
1337+
1338+# The span for aligning single-line typedefs (0=don't align)
1339+align_typedef_span = 5 # number
1340+
1341+# How to align typedef'd functions with other typedefs
1342+# 0: Don't mix them at all
1343+# 1: align the open paren with the types
1344+# 2: align the function type name with the other type names
1345+align_typedef_func = 0 # number
1346+
1347+# Controls the positioning of the '*' in typedefs. Just try it.
1348+# 0: Align on typdef type, ignore '*'
1349+# 1: The '*' is part of type name: typedef int *pint;
1350+# 2: The '*' is part of the type, but dangling: typedef int *pint;
1351+align_typedef_star_style = 0 # number
1352+
1353+# Controls the positioning of the '&' in typedefs. Just try it.
1354+# 0: Align on typdef type, ignore '&'
1355+# 1: The '&' is part of type name: typedef int &pint;
1356+# 2: The '&' is part of the type, but dangling: typedef int &pint;
1357+align_typedef_amp_style = 0 # number
1358+
1359+# The span for aligning comments that end lines (0=don't align)
1360+align_right_cmt_span = 3 # number
1361+
1362+# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment
1363+align_right_cmt_mix = false # false/true
1364+
1365+# If a trailing comment is more than this number of columns away from the text it follows,
1366+# it will qualify for being aligned.
1367+align_right_cmt_gap = 0 # number
1368+
1369+# The span for aligning function prototypes (0=don't align)
1370+align_func_proto_span = 0 # number
1371+
1372+# Minimum gap between the return type and the function name.
1373+align_func_proto_gap = 0 # number
1374+
1375+# Whether to mix aligning prototype and variable declarations.
1376+# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options.
1377+align_mix_var_proto = false # false/true
1378+
1379+# Align single-line functions with function prototypes, uses align_func_proto_span
1380+align_single_line_func = false # false/true
1381+
1382+# Aligning the open brace of single-line functions.
1383+# Requires align_single_line_func=true, uses align_func_proto_span
1384+align_single_line_brace = false # false/true
1385+
1386+# Gap for align_single_line_brace.
1387+align_single_line_brace_gap = 0 # number
1388+
1389+# The span for aligning ObjC msg spec (0=don't align)
1390+align_oc_msg_spec_span = 0 # number
1391+
1392+# Whether to align macros wrapped with a backslash and a newline.
1393+# This will not work right if the macro contains a multi-line comment.
1394+align_nl_cont = true # false/true
1395+
1396+# The minimum space between label and value of a preprocessor define
1397+align_pp_define_gap = 4 # number
1398+
1399+# The span for aligning on '#define' bodies (0=don't align)
1400+align_pp_define_span = 3 # number
1401+
1402+# Align lines that start with '<<' with previous '<<'. Default=true
1403+align_left_shift = true # false/true
1404+
1405+#
1406+# Newline adding and removing options
1407+#
1408+
1409+# Whether to collapse empty blocks between '{' and '}'
1410+nl_collapse_empty_body = true # false/true
1411+
1412+# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'
1413+nl_assign_leave_one_liners = false # false/true
1414+
1415+# Don't split one-line braced statements inside a class xx { } body
1416+nl_class_leave_one_liners = false # false/true
1417+
1418+# Don't split one-line enums: 'enum foo { BAR = 15 };'
1419+nl_enum_leave_one_liners = false # false/true
1420+
1421+# Don't split one-line get or set functions
1422+nl_getset_leave_one_liners = false # false/true
1423+
1424+# Don't split one-line function definitions - 'int foo() { return 0; }'
1425+nl_func_leave_one_liners = false # false/true
1426+
1427+# Don't split one-line if/else statements - 'if(a) b++;'
1428+nl_if_leave_one_liners = false # false/true
1429+
1430+# Add or remove newlines at the start of the file
1431+nl_start_of_file = remove # ignore/add/remove/force
1432+
1433+# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'
1434+nl_start_of_file_min = 0 # number
1435+
1436+# Add or remove newline at the end of the file
1437+nl_end_of_file = force # ignore/add/remove/force
1438+
1439+# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force')
1440+nl_end_of_file_min = 1 # number
1441+
1442+# Add or remove newline between '=' and '{'
1443+nl_assign_brace = force # ignore/add/remove/force
1444+
1445+# Add or remove newline between '=' and '[' (D only)
1446+nl_assign_square = force # ignore/add/remove/force
1447+
1448+# Add or remove newline after '= [' (D only). Will also affect the newline before the ']'
1449+nl_after_square_assign = force # ignore/add/remove/force
1450+
1451+# The number of newlines after a block of variable definitions
1452+nl_func_var_def_blk = 1 # number
1453+
1454+# Add or remove newline between a function call's ')' and '{', as in:
1455+# list_for_each(item, &list) { }
1456+nl_fcall_brace = force # ignore/add/remove/force
1457+
1458+# Add or remove newline between 'enum' and '{'
1459+nl_enum_brace = force # ignore/add/remove/force
1460+
1461+# Add or remove newline between 'struct and '{'
1462+nl_struct_brace = force # ignore/add/remove/force
1463+
1464+# Add or remove newline between 'union' and '{'
1465+nl_union_brace = force # ignore/add/remove/force
1466+
1467+# Add or remove newline between 'if' and '{'
1468+nl_if_brace = force # ignore/add/remove/force
1469+
1470+# Add or remove newline between '}' and 'else'
1471+nl_brace_else = force # ignore/add/remove/force
1472+
1473+# Add or remove newline between 'else if' and '{'
1474+# If set to ignore, nl_if_brace is used instead
1475+nl_elseif_brace = force # ignore/add/remove/force
1476+
1477+# Add or remove newline between 'else' and '{'
1478+nl_else_brace = force # ignore/add/remove/force
1479+
1480+# Add or remove newline between 'else' and 'if'
1481+nl_else_if = remove # ignore/add/remove/force
1482+
1483+# Add or remove newline between '}' and 'finally'
1484+nl_brace_finally = force # ignore/add/remove/force
1485+
1486+# Add or remove newline between 'finally' and '{'
1487+nl_finally_brace = force # ignore/add/remove/force
1488+
1489+# Add or remove newline between 'try' and '{'
1490+nl_try_brace = force # ignore/add/remove/force
1491+
1492+# Add or remove newline between get/set and '{'
1493+nl_getset_brace = force # ignore/add/remove/force
1494+
1495+# Add or remove newline between 'for' and '{'
1496+nl_for_brace = force # ignore/add/remove/force
1497+
1498+# Add or remove newline between 'catch' and '{'
1499+nl_catch_brace = force # ignore/add/remove/force
1500+
1501+# Add or remove newline between '}' and 'catch'
1502+nl_brace_catch = force # ignore/add/remove/force
1503+
1504+# Add or remove newline between 'while' and '{'
1505+nl_while_brace = force # ignore/add/remove/force
1506+
1507+# Add or remove newline between 'do' and '{'
1508+nl_do_brace = force # ignore/add/remove/force
1509+
1510+# Add or remove newline between '}' and 'while' of 'do' statement
1511+nl_brace_while = force # ignore/add/remove/force
1512+
1513+# Add or remove newline between 'switch' and '{'
1514+nl_switch_brace = force # ignore/add/remove/force
1515+
1516+# Add or remove newline when condition spans two or more lines
1517+nl_multi_line_cond = false # false/true
1518+
1519+# Force a newline in a define after the macro name for multi-line defines.
1520+nl_multi_line_define = true # false/true
1521+
1522+# Whether to put a newline before 'case' statement
1523+nl_before_case = true # false/true
1524+
1525+# Add or remove newline between ')' and 'throw'
1526+nl_before_throw = ignore # ignore/add/remove/force
1527+
1528+# Whether to put a newline after 'case' statement
1529+nl_after_case = true # false/true
1530+
1531+# Newline between namespace and {
1532+nl_namespace_brace = add # ignore/add/remove/force
1533+
1534+# Add or remove newline between 'template<>' and whatever follows.
1535+nl_template_class = add # ignore/add/remove/force
1536+
1537+# Add or remove newline between 'class' and '{'
1538+nl_class_brace = add # ignore/add/remove/force
1539+
1540+# Add or remove newline after each ',' in the constructor member initialization
1541+nl_class_init_args = force # ignore/add/remove/force
1542+
1543+# Add or remove newline between return type and function name in definition
1544+nl_func_type_name = ignore # ignore/add/remove/force
1545+
1546+# Add or remove newline between return type and function name in a prototype
1547+nl_func_proto_type_name = remove # ignore/add/remove/force
1548+
1549+# Add or remove newline between a function name and the opening '('
1550+nl_func_paren = remove # ignore/add/remove/force
1551+
1552+# Add or remove newline after '(' in a function declaration
1553+nl_func_decl_start = remove # ignore/add/remove/force
1554+
1555+# Add or remove newline after each ',' in a function declaration
1556+nl_func_decl_args = remove # ignore/add/remove/force
1557+
1558+# Add or remove newline before the ')' in a function declaration
1559+nl_func_decl_end = remove # ignore/add/remove/force
1560+
1561+# Add or remove newline between function signature and '{'
1562+nl_fdef_brace = add # ignore/add/remove/force
1563+
1564+# Whether to put a newline after 'return' statement
1565+nl_after_return = true # false/true
1566+
1567+# Add or remove a newline between the return keyword and return expression.
1568+nl_return_expr = remove # ignore/add/remove/force
1569+
1570+# Whether to put a newline after semicolons, except in 'for' statements
1571+nl_after_semicolon = true # false/true
1572+
1573+# Whether to put a newline after brace open.
1574+# This also adds a newline before the matching brace close.
1575+nl_after_brace_open = true # false/true
1576+
1577+# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is
1578+# placed between the open brace and a trailing single-line comment.
1579+nl_after_brace_open_cmt = false # false/true
1580+
1581+# Whether to put a newline after a virtual brace open.
1582+# These occur in un-braced if/while/do/for statement bodies.
1583+nl_after_vbrace_open = true # false/true
1584+
1585+# Whether to alter newlines in '#define' macros
1586+nl_define_macro = true # false/true
1587+
1588+# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
1589+nl_squeeze_ifdef = false # false/true
1590+
1591+# Add or remove newline before 'if'
1592+nl_before_if = ignore # ignore/add/remove/force
1593+
1594+# Add or remove newline after 'if'
1595+nl_after_if = ignore # ignore/add/remove/force
1596+
1597+# Add or remove newline before 'for'
1598+nl_before_for = ignore # ignore/add/remove/force
1599+
1600+# Add or remove newline after 'for'
1601+nl_after_for = ignore # ignore/add/remove/force
1602+
1603+# Add or remove newline before 'while'
1604+nl_before_while = ignore # ignore/add/remove/force
1605+
1606+# Add or remove newline after 'while'
1607+nl_after_while = ignore # ignore/add/remove/force
1608+
1609+# Add or remove newline before 'switch'
1610+nl_before_switch = force # ignore/add/remove/force
1611+
1612+# Add or remove newline after 'switch'
1613+nl_after_switch = force # ignore/add/remove/force
1614+
1615+# Add or remove newline before 'do'
1616+nl_before_do = ignore # ignore/add/remove/force
1617+
1618+# Add or remove newline after 'do'
1619+nl_after_do = ignore # ignore/add/remove/force
1620+
1621+# Whether to double-space commented-entries in struct/enum
1622+nl_ds_struct_enum_cmt = false # false/true
1623+
1624+# Whether to double-space before the close brace of a struct/union/enum
1625+nl_ds_struct_enum_close_brace = false # false/true
1626+
1627+# Add or remove a newline around a class colon.
1628+# Related to pos_class_colon, nl_class_init_args, and pos_comma.
1629+nl_class_colon = ignore # ignore/add/remove/force
1630+
1631+# Change simple unbraced if statements into a one-liner
1632+# 'if(b)\n i++;' => 'if(b) i++;'
1633+nl_create_if_one_liner = false # false/true
1634+
1635+# Change simple unbraced for statements into a one-liner
1636+# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'
1637+nl_create_for_one_liner = false # false/true
1638+
1639+# Change simple unbraced while statements into a one-liner
1640+# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);'
1641+nl_create_while_one_liner = false # false/true
1642+
1643+#
1644+# Positioning options
1645+#
1646+
1647+# The position of arithmetic operators in wrapped expressions
1648+pos_arith = lead # ignore/lead/trail
1649+
1650+# The position of assignment in wrapped expressions
1651+pos_assign = trail # ignore/lead/trail
1652+
1653+# The position of boolean operators in wrapped expressions
1654+pos_bool = lead # ignore/lead/trail
1655+
1656+# The position of the comma in wrapped expressions
1657+pos_comma = trail # ignore/lead/trail
1658+
1659+# The position of the comma in the constructor initialization list
1660+pos_class_comma = trail # ignore/lead/trail
1661+
1662+# The position of colons between constructor and member initialization
1663+pos_class_colon = lead # ignore/lead/trail
1664+
1665+#
1666+# Line Splitting options
1667+#
1668+
1669+# Try to limit code width to N number of columns
1670+code_width = 76 # number
1671+
1672+# Whether to fully split long 'for' statements at semi-colons
1673+ls_for_split_full = true # false/true
1674+
1675+# Whether to fully split long function protos/calls at commas
1676+ls_func_split_full = true # false/true
1677+
1678+#
1679+# Blank line options
1680+#
1681+
1682+# The maximum consecutive newlines
1683+nl_max = 4 # number
1684+
1685+# The number of newlines after a function prototype, if followed by another function prototype
1686+nl_after_func_proto = 0 # number
1687+
1688+# The number of newlines after a function prototype, if not followed by another function prototype
1689+nl_after_func_proto_group = 3 # number
1690+
1691+# The number of newlines after '}' of a multi-line function body
1692+nl_after_func_body = 3 # number
1693+
1694+# The number of newlines after '}' of a single line function body
1695+nl_after_func_body_one_liner = 1 # number
1696+
1697+# The minimum number of newlines before a multi-line comment.
1698+# Doesn't apply if after a brace open or another multi-line comment.
1699+nl_before_block_comment = 2 # number
1700+
1701+# The minimum number of newlines before a single-line C comment.
1702+# Doesn't apply if after a brace open or other single-line C comments.
1703+nl_before_c_comment = 1 # number
1704+
1705+# The minimum number of newlines before a CPP comment.
1706+# Doesn't apply if after a brace open or other CPP comments.
1707+nl_before_cpp_comment = 0 # number
1708+
1709+# Whether to force a newline after a mulit-line comment.
1710+nl_after_multiline_comment = false # false/true
1711+
1712+# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
1713+# Will not change the newline count if after a brace open.
1714+# 0 = No change.
1715+nl_before_access_spec = 1 # number
1716+
1717+# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
1718+# 0 = No change.
1719+nl_after_access_spec = 1 # number
1720+
1721+# The number of newlines between a function def and the function comment.
1722+# 0 = No change.
1723+nl_comment_func_def = 0 # number
1724+
1725+# Whether to remove blank lines after '{'
1726+eat_blanks_after_open_brace = true # false/true
1727+
1728+# Whether to remove blank lines before '}'
1729+eat_blanks_before_close_brace = true # false/true
1730+
1731+#
1732+# Code modifying options (non-whitespace)
1733+#
1734+
1735+# Add or remove braces on single-line 'do' statement
1736+mod_full_brace_do = add # ignore/add/remove/force
1737+
1738+# Add or remove braces on single-line 'for' statement
1739+mod_full_brace_for = add # ignore/add/remove/force
1740+
1741+# Add or remove braces on single-line function defintions. (Pawn)
1742+mod_full_brace_function = ignore # ignore/add/remove/force
1743+
1744+# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
1745+mod_full_brace_if = ignore # ignore/add/remove/force
1746+
1747+# Don't remove braces around statements that span N newlines
1748+mod_full_brace_nl = 0 # number
1749+
1750+# Add or remove braces on single-line 'while' statement
1751+mod_full_brace_while = add # ignore/add/remove/force
1752+
1753+# Add or remove unnecessary paren on 'return' statement
1754+mod_paren_on_return = remove # ignore/add/remove/force
1755+
1756+# Whether to change optional semicolons to real semicolons
1757+mod_pawn_semicolon = false # false/true
1758+
1759+# Add parens on 'while' and 'if' statement around bools
1760+mod_full_paren_if_bool = true # false/true
1761+
1762+# Whether to remove superfluous semicolons
1763+mod_remove_extra_semicolon = true # false/true
1764+
1765+# If a function body exceeds the specified number of newlines and doesn't have a comment after
1766+# the close brace, a comment will be added.
1767+mod_add_long_function_closebrace_comment = 5 # number
1768+
1769+# If a switch body exceeds the specified number of newlines and doesn't have a comment after
1770+# the close brace, a comment will be added.
1771+mod_add_long_switch_closebrace_comment = 5 # number
1772+
1773+# If TRUE, will sort consecutive single-line 'import' statements [Java, D]
1774+mod_sort_import = false # false/true
1775+
1776+# If TRUE, will sort consecutive single-line 'using' statements [C#]
1777+mod_sort_using = false # false/true
1778+
1779+# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C]
1780+# This is generally a bad idea, as it may break your code.
1781+mod_sort_include = false # false/true
1782+
1783+# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace.
1784+mod_move_case_break = false # false/true
1785+
1786+# If TRUE, it will remove a void 'return;' that appears as the last statement in a function.
1787+mod_remove_empty_return = true # false/true
1788+
1789+#
1790+# Comment modifications
1791+#
1792+
1793+# Try to wrap comments at cmt_width columns
1794+cmt_width = 0 # number
1795+
1796+# If false, disable all multi-line comment changes, including cmt_width and leading chars.
1797+# Default is true.
1798+cmt_indent_multi = true # false/true
1799+
1800+# Whether to group c-comments that look like they are in a block
1801+cmt_c_group = false # false/true
1802+
1803+# Whether to put an empty '/*' on the first line of the combined c-comment
1804+cmt_c_nl_start = false # false/true
1805+
1806+# Whether to put a newline before the closing '*/' of the combined c-comment
1807+cmt_c_nl_end = false # false/true
1808+
1809+# Whether to group cpp-comments that look like they are in a block
1810+cmt_cpp_group = false # false/true
1811+
1812+# Whether to put an empty '/*' on the first line of the combined cpp-comment
1813+cmt_cpp_nl_start = false # false/true
1814+
1815+# Whether to put a newline before the closing '*/' of the combined cpp-comment
1816+cmt_cpp_nl_end = false # false/true
1817+
1818+# Whether to change cpp-comments into c-comments
1819+cmt_cpp_to_c = false # false/true
1820+
1821+# Whether to put a star on subsequent comment lines
1822+cmt_star_cont = true # false/true
1823+
1824+# The number of spaces to insert at the start of subsequent comment lines
1825+cmt_sp_before_star_cont = 0 # number
1826+
1827+# The number of spaces to insert after the star on subsequent comment lines
1828+cmt_sp_after_star_cont = 1 # number
1829+
1830+# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of
1831+# the comment are the same length. Default=True
1832+cmt_multi_check_last = true # false/true
1833+
1834+# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment.
1835+# Will substitue $(filename) with the current file's name.
1836+cmt_insert_file_header = "" # string
1837+
1838+# The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment.
1839+# Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff.
1840+# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }
1841+cmt_insert_func_header = "" # string
1842+
1843+# The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment.
1844+# Will substitue $(class) with the class name.
1845+cmt_insert_class_header = "" # string
1846+
1847+# If a preprocessor is encountered when stepping backwards from a function name, then
1848+# this option decides whether the comment should be inserted.
1849+# Affects cmt_insert_func_header and cmt_insert_class_header.
1850+cmt_insert_before_preproc = false # false/true
1851+
1852+#
1853+# Preprocessor options
1854+#
1855+
1856+# Control indent of preprocessors inside #if blocks at brace level 0
1857+pp_indent = remove # ignore/add/remove/force
1858+
1859+# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)
1860+pp_indent_at_level = false # false/true
1861+
1862+# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1.
1863+pp_indent_count = 1 # number
1864+
1865+# Add or remove space after # based on pp_level of #if blocks
1866+pp_space = add # ignore/add/remove/force
1867+
1868+# Sets the number of spaces added with pp_space
1869+pp_space_count = 1 # number
1870+
1871+# The indent for #region and #endregion in C# and '#pragma region' in C/C++
1872+pp_indent_region = 0 # number
1873+
1874+# Whether to indent the code between #region and #endregion
1875+pp_region_indent_code = false # false/true
1876+
1877+# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level
1878+pp_indent_if = 0 # number
1879+
1880+# Control whether to indent the code between #if, #else and #endif when not at file-level
1881+pp_if_indent_code = false # false/true
1882+
1883+# Whether to indent '#define' at the brace level (true) or from column 1 (false)
1884+pp_define_at_level = false # false/true
1885+
1886+# You can force a token to be a type with the 'type' option.
1887+# Example:
1888+# type myfoo1 myfoo2
1889+#
1890+# You can create custom macro-based indentation using macro-open,
1891+# macro-else and macro-close.
1892+# Example:
1893+# macro-open BEGIN_TEMPLATE_MESSAGE_MAP
1894+# macro-open BEGIN_MESSAGE_MAP
1895+# macro-close END_MESSAGE_MAP
1896+#
1897+# You can assign any keyword to any type with the set option.
1898+# set func_call_user _ N_
1899
1900=== modified file 'configure.ac'
1901--- configure.ac 2010-06-30 18:41:07 +0000
1902+++ configure.ac 2010-07-01 01:31:26 +0000
1903@@ -6,11 +6,15 @@
1904 # the COPYING file in this directory for full text.
1905
1906 AC_PREREQ(2.59)
1907+<<<<<<< TREE
1908 AC_INIT([gearmand],[0.14],[https://launchpad.net/gearmand])
1909+=======
1910+AC_INIT([gearmand],[1.00],[https://launchpad.net/gearmand])
1911+>>>>>>> MERGE-SOURCE
1912 AC_CONFIG_SRCDIR(libgearman/gearman.c)
1913 AC_CONFIG_AUX_DIR(config)
1914
1915-PANDORA_CANONICAL_TARGET(require-cxx)
1916+PANDORA_CANONICAL_TARGET(require-cxx, less-warnings)
1917
1918 GEARMAN_LIBRARY_VERSION=4:0:0
1919 # | | |
1920@@ -27,6 +31,9 @@
1921 AC_SUBST(GEARMAN_LIBRARY_VERSION)
1922
1923
1924+PANDORA_REQUIRE_BOOST
1925+PANDORA_REQUIRE_BOOST_PROGRAM_OPTIONS
1926+PANDORA_REQUIRE_BOOST_THREAD
1927 PANDORA_REQUIRE_PTHREAD
1928 PANDORA_REQUIRE_LIBEVENT
1929 PANDORA_REQUIRE_LIBUUID
1930
1931=== renamed file 'gearmand/gearmand.c' => 'gearmand/gearmand.cc'
1932--- gearmand/gearmand.c 2010-02-02 00:43:22 +0000
1933+++ gearmand/gearmand.cc 2010-07-01 01:31:26 +0000
1934@@ -8,6 +8,9 @@
1935
1936 #include "config.h"
1937
1938+#define __STDC_LIMIT_MACROS
1939+#define __STDC_FORMAT_MACROS
1940+
1941 #ifdef HAVE_ERRNO_H
1942 #include <errno.h>
1943 #endif
1944@@ -53,428 +56,316 @@
1945 # endif
1946 #endif
1947
1948+#include <boost/program_options/options_description.hpp>
1949+#include <boost/program_options/parsers.hpp>
1950+#include <boost/program_options/variables_map.hpp>
1951+#include <boost/tokenizer.hpp>
1952+#include <boost/token_functions.hpp>
1953+using namespace boost;
1954+using namespace boost::program_options;
1955+
1956 #include <libgearman-server/gearmand.h>
1957
1958-#ifdef HAVE_LIBDRIZZLE
1959-#include <libgearman-server/queue_libdrizzle.h>
1960-#endif
1961-
1962-#ifdef HAVE_LIBMEMCACHED
1963-#include <libgearman-server/queue_libmemcached.h>
1964-#endif
1965-
1966-#ifdef HAVE_LIBSQLITE3
1967-#include <libgearman-server/queue_libsqlite3.h>
1968-#endif
1969-
1970-#ifdef HAVE_LIBPQ
1971-#include <libgearman-server/queue_libpq.h>
1972-#endif
1973-
1974-#ifdef HAVE_LIBTOKYOCABINET
1975-#include <libgearman-server/queue_libtokyocabinet.h>
1976-#endif
1977-
1978-#include <libgearman-server/protocol_http.h>
1979+
1980+#include <iostream>
1981+#include <fstream>
1982+using namespace std;
1983+
1984+#include <string>
1985+
1986+using std::string;
1987
1988 #define GEARMAND_LOG_REOPEN_TIME 60
1989 #define GEARMAND_LISTEN_BACKLOG 32
1990
1991-typedef struct
1992+struct gearmand_log_info_st
1993 {
1994- const char *file;
1995+ string file;
1996 int fd;
1997 time_t reopen;
1998-} gearmand_log_info_st;
1999+
2000+ gearmand_log_info_st() :
2001+ fd(-1),
2002+ reopen(0)
2003+ {}
2004+
2005+ ~gearmand_log_info_st() {}
2006+
2007+};
2008
2009 static gearmand_st *_gearmand;
2010
2011 static bool _set_fdlimit(rlim_t fds);
2012 static bool _pid_write(const char *pid_file);
2013 static void _pid_delete(const char *pid_file);
2014-static bool _switch_user(const char *user);
2015+static bool _switch_user(const string user);
2016 static bool _set_signals(void);
2017 static void _shutdown_handler(int signal_arg);
2018-static void _log(const char *line, gearman_verbose_t verbose, void *context);
2019+
2020
2021 int main(int argc, char *argv[])
2022 {
2023- gearman_conf_st conf;
2024- gearman_conf_module_st module;
2025- const char *name;
2026- const char *value;
2027+ options_description general("General options");
2028+
2029 int backlog= GEARMAND_LISTEN_BACKLOG;
2030 rlim_t fds= 0;
2031+ string pid_file;
2032 uint8_t job_retries= 0;
2033 uint8_t worker_wakeup= 0;
2034- in_port_t port= 0;
2035- const char *host= NULL;
2036- const char *pid_file= NULL;
2037- const char *queue_type= NULL;
2038- uint32_t threads= 0;
2039- const char *user= NULL;
2040- uint8_t verbose= 0;
2041+ in_port_t port;
2042+ string host;
2043+ string queue_type;
2044+ uint32_t threads;
2045+ string user;
2046+ gearman_verbose_t verbose;
2047+ string verbose_string;
2048 gearman_return_t ret;
2049 gearmand_log_info_st log_info;
2050 bool close_stdio= false;
2051- int fd;
2052- bool round_robin= false;
2053+ string protocol;
2054+ bool round_robin;
2055
2056- log_info.file= NULL;
2057 log_info.fd= -1;
2058 log_info.reopen= 0;
2059
2060- if (gearman_conf_create(&conf) == NULL)
2061- {
2062- fprintf(stderr, "gearmand: gearman_conf_create: NULL\n");
2063- return 1;
2064- }
2065-
2066- if (gearman_conf_module_create(&conf, &module, NULL) == NULL)
2067- {
2068- fprintf(stderr, "gearmand: gearman_conf_module_create: NULL\n");
2069- return 1;
2070- }
2071-
2072- /* Add all main configuration options. */
2073-#define MCO(__name, __short, __value, __help) \
2074- gearman_conf_module_add_option(&module, __name, __short, __value, __help);
2075-
2076- MCO("backlog", 'b', "BACKLOG", "Number of backlog connections for listen.")
2077- MCO("daemon", 'd', NULL, "Daemon, detach and run in the background.")
2078- MCO("file-descriptors", 'f', "FDS",
2079- "Number of file descriptors to allow for the process (total connections "
2080- "will be slightly less). Default is max allowed for user.")
2081- MCO("help", 'h', NULL, "Print this help menu.");
2082- MCO("job-retries", 'j', "RETRIES",
2083- "Number of attempts to run the job before the job server removes it. This"
2084- "is helpful to ensure a bad job does not crash all available workers. "
2085- "Default is no limit.")
2086- MCO("log-file", 'l', "FILE",
2087- "Log file to write errors and information to. Turning this option on "
2088- "also forces the first verbose level to be enabled.")
2089- MCO("listen", 'L', "ADDRESS",
2090- "Address the server should listen on. Default is INADDR_ANY.")
2091- MCO("port", 'p', "PORT", "Port the server should listen on.")
2092- MCO("pid-file", 'P', "FILE", "File to write process ID out to.")
2093- MCO("protocol", 'r', "PROTOCOL", "Load protocol module.")
2094- MCO("round-robin", 'R', NULL, "Assign work in round-robin order per worker"
2095- "connection. The default is to assign work in the order of functions "
2096- "added by the worker.")
2097- MCO("queue-type", 'q', "QUEUE", "Persistent queue type to use.")
2098- MCO("threads", 't', "THREADS", "Number of I/O threads to use. Default=0.")
2099- MCO("user", 'u', "USER", "Switch to given user after startup.")
2100- MCO("verbose", 'v', NULL, "Increase verbosity level by one.")
2101- MCO("version", 'V', NULL, "Display the version of gearmand and exit.")
2102- MCO("worker-wakeup", 'w', "WORKERS",
2103- "Number of workers to wakeup for each job received. The default is to "
2104- "wakeup all available workers.")
2105-
2106- /* Make sure none of the gearman_conf_module_add_option calls failed. */
2107- if (gearman_conf_return(&conf) != GEARMAN_SUCCESS)
2108- {
2109- fprintf(stderr, "gearmand: gearman_conf_module_add_option: %s\n",
2110- gearman_conf_error(&conf));
2111- return 1;
2112- }
2113+ general.add_options()
2114+ ("backlog,b", value(&backlog)->default_value(GEARMAND_LISTEN_BACKLOG), "Number of backlog connections for listen.")
2115+ ("daemon,d", "Daemon, detach and run in the background.")
2116+ ("file-descriptors,f", value(&fds), "Number of file descriptors to allow for the process (total connections will be slightly less). Default is max allowed for user.")
2117+ ("help,h", "Print this help menu.")
2118+ ("job-retries,j", value(&job_retries), "Number of attempts to run the job before the job server removes it. This is helpful to ensure a bad job does not crash all available workers. Default is no limit.")
2119+ ("listen,L", value(&host), "Address the server should listen on. Default is INADDR_ANY.")
2120+ ("port,p", value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port the server should listen on.")
2121+ ("pid-file,P", value(&pid_file), "File to write process ID out to.")
2122+ ("protocol,r", value(&protocol), "Load protocol module.")
2123+ ("round-robin,R", bool_switch(&round_robin)->default_value(false), "Assign work in round-robin order per worker connection. The default is to assign work in the order of functions added by the worker.")
2124+ ("queue-type,q", value(&queue_type), "Persistent queue type to use.")
2125+ ("threads,t", value(&threads)->default_value(0), "Number of I/O threads to use. Default=4.")
2126+ ("user,u", value(&user), "Switch to given user after startup.")
2127+ ("verbose,v", value(&verbose_string)->default_value("v"), "Increase verbosity level by one.")
2128+ ("version,V", "Display the version of gearmand and exit.")
2129+ ("worker-wakeup,w", value(&worker_wakeup), "Number of workers to wakeup for each job received. The default is to wakeup all available workers.")
2130+ ;
2131+ options_description all("Allowed options");
2132+ all.add(general);
2133+
2134+ // Add in all of the options found for our logging modules
2135+ all.add(Log::Instance()->options());
2136
2137 /* Add queue configuration options. */
2138+#ifdef HAVE_LIBSQLITE3
2139+ SqliteQueue libsqlite;
2140+ all.add(libsqlite.options());
2141+#endif
2142
2143 #ifdef HAVE_LIBDRIZZLE
2144- if (gearman_server_queue_libdrizzle_conf(&conf) != GEARMAN_SUCCESS)
2145- {
2146- fprintf(stderr, "gearmand: gearman_queue_libdrizzle_conf: %s\n",
2147- gearman_conf_error(&conf));
2148- return 1;
2149- }
2150+ LibDrizzleQueue libdrizzle;
2151+ all.add(libdrizzle.options());
2152+#endif
2153+
2154+#ifdef HAVE_LIBTOKYOCABINET
2155+ TokyoCabinetQueue libtokyocabinet;
2156+ all.add(libtokyocabinet.options());
2157 #endif
2158
2159 #ifdef HAVE_LIBMEMCACHED
2160- if (gearman_server_queue_libmemcached_conf(&conf) != GEARMAN_SUCCESS)
2161- {
2162- fprintf(stderr, "gearmand: gearman_queue_libmemcached_conf: %s\n",
2163- gearman_conf_error(&conf));
2164- return 1;
2165- }
2166-#endif
2167-#ifdef HAVE_LIBTOKYOCABINET
2168- if (gearman_server_queue_libtokyocabinet_conf(&conf) != GEARMAN_SUCCESS)
2169- {
2170- fprintf(stderr, "gearmand: gearman_queue_libtokyocabinet_conf: %s\n",
2171- gearman_conf_error(&conf));
2172- return 1;
2173- }
2174-#endif
2175-
2176-#ifdef HAVE_LIBSQLITE3
2177- if (gearman_server_queue_libsqlite3_conf(&conf) != GEARMAN_SUCCESS)
2178- {
2179- fprintf(stderr, "gearmand: gearman_queue_libsqlite3_conf: %s\n",
2180- gearman_conf_error(&conf));
2181- return 1;
2182- }
2183+ LibmemcachedQueue libmemcached;
2184+ all.add(libmemcached.options());
2185 #endif
2186
2187 #ifdef HAVE_LIBPQ
2188- if (gearman_server_queue_libpq_conf(&conf) != GEARMAN_SUCCESS)
2189- {
2190- fprintf(stderr, "gearmand: gearman_queue_libpq_conf: %s\n",
2191- gearman_conf_error(&conf));
2192- return 1;
2193- }
2194+ LibPqQueue postgres;
2195+ all.add(postgres.options());
2196 #endif
2197
2198- if (gearmand_protocol_http_conf(&conf) != GEARMAN_SUCCESS)
2199- {
2200- fprintf(stderr, "gearmand: gearman_protocol_http_conf: %s\n",
2201- gearman_conf_error(&conf));
2202- return 1;
2203- }
2204-
2205- /* Let gearman conf parse the command line arguments. */
2206- if (gearman_conf_parse_args(&conf, argc, argv) != GEARMAN_SUCCESS)
2207- {
2208- printf("\n%s\n\n", gearman_conf_error(&conf));
2209- printf("gearmand %s - %s\n\n", gearman_version(), gearman_bugreport());
2210- printf("usage: %s [OPTIONS]\n", argv[0]);
2211- gearman_conf_usage(&conf);
2212- return 1;
2213- }
2214-
2215- /* Check for option values that were given. */
2216- while (gearman_conf_module_value(&module, &name, &value))
2217- {
2218- if (!strcmp(name, "backlog"))
2219- backlog= atoi(value);
2220- else if (!strcmp(name, "daemon"))
2221- {
2222- switch (fork())
2223- {
2224- case -1:
2225- fprintf(stderr, "gearmand: fork:%d\n", errno);
2226- return 1;
2227-
2228- case 0:
2229- break;
2230-
2231- default:
2232- return 0;
2233- }
2234-
2235- if (setsid() == -1)
2236- {
2237- fprintf(stderr, "gearmand: setsid:%d\n", errno);
2238- return 1;
2239- }
2240-
2241- close_stdio= true;
2242- }
2243- else if (!strcmp(name, "file-descriptors"))
2244- fds= (rlim_t)atoi(value);
2245- else if (!strcmp(name, "help"))
2246- {
2247- printf("\ngearmand %s - %s\n\n", gearman_version(), gearman_bugreport());
2248- printf("usage: %s [OPTIONS]\n", argv[0]);
2249- gearman_conf_usage(&conf);
2250- return 1;
2251- }
2252- else if (!strcmp(name, "job-retries"))
2253- job_retries= (uint8_t)atoi(value);
2254- else if (!strcmp(name, "log-file"))
2255- log_info.file= value;
2256- else if (!strcmp(name, "listen"))
2257- host= value;
2258- else if (!strcmp(name, "port"))
2259- port= (in_port_t)atoi(value);
2260- else if (!strcmp(name, "pid-file"))
2261- pid_file= value;
2262- else if (!strcmp(name, "protocol"))
2263- continue;
2264- else if (!strcmp(name, "queue-type"))
2265- queue_type= value;
2266- else if (!strcmp(name, "threads"))
2267- threads= (uint32_t)atoi(value);
2268- else if (!strcmp(name, "user"))
2269- user= value;
2270- else if (!strcmp(name, "verbose"))
2271- verbose++;
2272- else if (!strcmp(name, "round-robin"))
2273- round_robin++;
2274- else if (!strcmp(name, "version"))
2275- printf("\ngearmand %s - %s\n", gearman_version(), gearman_bugreport());
2276- else if (!strcmp(name, "worker-wakeup"))
2277- worker_wakeup= (uint8_t)atoi(value);
2278- else
2279- {
2280- fprintf(stderr, "gearmand: Unknown option:%s\n", name);
2281- return 1;
2282- }
2283+ GearmanHTTP http;
2284+ all.add(http.options());
2285+
2286+ variables_map vm;
2287+
2288+ try {
2289+ store(parse_command_line(argc, argv, all), vm);
2290+ notify(vm);
2291+ }
2292+
2293+ catch(std::exception &e)
2294+ {
2295+ cout << e.what() << "\n";
2296+ return 1;
2297+ }
2298+
2299+ if (vm.count("help"))
2300+ {
2301+ cout << all << "\n";
2302+ return 1;
2303+ }
2304+
2305+ if (vm.count("version"))
2306+ {
2307+ cout << "\ngearmand " << gearman_version() << " - " << gearman_bugreport() << "\n";
2308+ return 1;
2309+ }
2310+
2311+ verbose= static_cast<gearman_verbose_t>(verbose_string.length());
2312+
2313+ /*
2314+ @note Logging begins from this point on.
2315+ */
2316+ Log::Instance()->start(verbose);
2317+
2318+ if (vm.count("daemon"))
2319+ {
2320+ switch (fork())
2321+ {
2322+ case -1:
2323+ Log::Instance()->fatal("gearmand: fork:%d\n", errno);
2324+ return 1;
2325+
2326+ case 0:
2327+ break;
2328+
2329+ default:
2330+ return 0;
2331+ }
2332+
2333+ if (setsid() == -1)
2334+ {
2335+ Log::Instance()->fatal("gearmand: setsid:%d\n", errno);
2336+ return 1;
2337+ }
2338+
2339+ close_stdio= true;
2340 }
2341
2342 if (verbose == 0 && close_stdio)
2343 {
2344 /* If we can't remap stdio, it should not a fatal error. */
2345- fd = open("/dev/null", O_RDWR, 0);
2346+ int fd= open("/dev/null", O_RDWR, 0);
2347+
2348 if (fd != -1)
2349 {
2350 if (dup2(fd, STDIN_FILENO) == -1)
2351 {
2352- fprintf(stderr, "gearmand: dup2:%d\n", errno);
2353+ Log::Instance()->fatal("gearmand: dup2:%d\n", errno);
2354 return 1;
2355 }
2356
2357 if (dup2(fd, STDOUT_FILENO) == -1)
2358 {
2359- fprintf(stderr, "gearmand: dup2:%d\n", errno);
2360+ Log::Instance()->fatal("gearmand: dup2:%d\n", errno);
2361 return 1;
2362 }
2363
2364 if (dup2(fd, STDERR_FILENO) == -1)
2365 {
2366- fprintf(stderr, "gearmand: dup2:%d\n", errno);
2367+ Log::Instance()->fatal("gearmand: dup2:%d\n", errno);
2368 return 1;
2369 }
2370
2371 close(fd);
2372 }
2373 }
2374-
2375 if ((fds > 0 && _set_fdlimit(fds)) || _switch_user(user) || _set_signals())
2376- return 1;
2377-
2378- if (pid_file != NULL && _pid_write(pid_file))
2379- return 1;
2380-
2381- _gearmand= gearmand_create(host, port);
2382+ return -1;
2383+
2384+ if (not pid_file.empty() && _pid_write(pid_file.c_str()))
2385+ return -1;
2386+
2387+ _gearmand= new gearmand_st(host.empty() ? NULL : host.c_str(),
2388+ port,
2389+ threads);
2390 if (_gearmand == NULL)
2391 {
2392- fprintf(stderr, "gearmand: Could not create gearmand library instance\n");
2393- return 1;
2394+ Log::Instance()->fatal("gearmand: Could not create gearmand library instance\n");
2395+ return -1;
2396 }
2397
2398- gearmand_set_backlog(_gearmand, backlog);
2399- gearmand_set_threads(_gearmand, threads);
2400- gearmand_set_job_retries(_gearmand, job_retries);
2401- gearmand_set_worker_wakeup(_gearmand, worker_wakeup);
2402- gearmand_set_log_fn(_gearmand, _log, &log_info, verbose);
2403- gearmand_set_round_robin(_gearmand, round_robin);
2404+ _gearmand->set_backlog(backlog);
2405+ _gearmand->set_server_job_retries(job_retries);
2406+ _gearmand->set_worker_wakeup(worker_wakeup);
2407+ _gearmand->set_round_robin(round_robin);
2408
2409- if (queue_type != NULL)
2410+ if (not queue_type.empty())
2411 {
2412+#ifdef HAVE_LIBSQLITE3
2413+ if (not queue_type.compare("libsqlite3"))
2414+ {
2415+ ret= libsqlite.start();
2416+ if (ret != GEARMAN_SUCCESS)
2417+ return 1;
2418+ _gearmand->server.queue= &libsqlite;
2419+ //_gearmand->server.queue= static_cast<GQueue *>(libsqlite);
2420+ }
2421+ else
2422+#endif
2423 #ifdef HAVE_LIBDRIZZLE
2424- if (!strcmp(queue_type, "libdrizzle"))
2425+ if (not queue_type.compare("libdrizzle"))
2426 {
2427- ret= gearmand_queue_libdrizzle_init(_gearmand, &conf);
2428+ ret= libdrizzle.start();
2429 if (ret != GEARMAN_SUCCESS)
2430 return 1;
2431+ _gearmand->server.queue= &libdrizzle;
2432 }
2433 else
2434 #endif
2435 #ifdef HAVE_LIBMEMCACHED
2436- if (!strcmp(queue_type, "libmemcached"))
2437- {
2438- ret= gearmand_queue_libmemcached_init(_gearmand, &conf);
2439- if (ret != GEARMAN_SUCCESS)
2440- return 1;
2441- }
2442- else
2443-#endif
2444-#ifdef HAVE_LIBSQLITE3
2445- if (!strcmp(queue_type, "libsqlite3"))
2446- {
2447- ret= gearmand_queue_libsqlite3_init(_gearmand, &conf);
2448- if (ret != GEARMAN_SUCCESS)
2449- return 1;
2450+ if (not queue_type.compare("libmemcached"))
2451+ {
2452+ ret= libmemcached.start();
2453+ if (ret != GEARMAN_SUCCESS)
2454+ return 1;
2455+ _gearmand->server.queue= &libmemcached;
2456 }
2457 else
2458 #endif
2459 #ifdef HAVE_LIBPQ
2460- if (!strcmp(queue_type, "libpq"))
2461+ if (not queue_type.compare("libpq"))
2462 {
2463- ret= gearmand_queue_libpq_init(_gearmand, &conf);
2464+ ret= postgres.start();
2465 if (ret != GEARMAN_SUCCESS)
2466 return 1;
2467+ _gearmand->server.queue= &postgres;
2468 }
2469 else
2470 #endif
2471 #ifdef HAVE_LIBTOKYOCABINET
2472- if (!strcmp(queue_type, "libtokyocabinet"))
2473+ if (not queue_type.compare("libtokyocabinet"))
2474 {
2475- ret= gearmand_queue_libtokyocabinet_init(_gearmand, &conf);
2476+ ret= libtokyocabinet.start();
2477 if (ret != GEARMAN_SUCCESS)
2478 return 1;
2479+ _gearmand->server.queue= &libtokyocabinet;
2480 }
2481 else
2482 #endif
2483 {
2484- fprintf(stderr, "gearmand: Unknown queue module: %s\n", queue_type);
2485- return 1;
2486- }
2487- }
2488-
2489- while (gearman_conf_module_value(&module, &name, &value))
2490- {
2491- if (strcmp(name, "protocol"))
2492- continue;
2493-
2494- if (!strcmp(value, "http"))
2495- {
2496- ret= gearmand_protocol_http_init(_gearmand, &conf);
2497- if (ret != GEARMAN_SUCCESS)
2498- return 1;
2499- }
2500- else
2501- {
2502- fprintf(stderr, "gearmand: Unknown protocol module: %s\n", value);
2503- return 1;
2504- }
2505- }
2506-
2507- ret= gearmand_run(_gearmand);
2508-
2509- if (queue_type != NULL)
2510- {
2511-#ifdef HAVE_LIBDRIZZLE
2512- if (!strcmp(queue_type, "libdrizzle"))
2513- gearmand_queue_libdrizzle_deinit(_gearmand);
2514-#endif
2515-#ifdef HAVE_LIBMEMCACHED
2516- if (!strcmp(queue_type, "libmemcached"))
2517- gearmand_queue_libmemcached_deinit(_gearmand);
2518-#endif
2519-#ifdef HAVE_LIBSQLITE3
2520- if (!strcmp(queue_type, "libsqlite3"))
2521- gearmand_queue_libsqlite3_deinit(_gearmand);
2522-#endif
2523-#ifdef HAVE_LIBPQ
2524- if (!strcmp(queue_type, "libpq"))
2525- gearmand_queue_libpq_deinit(_gearmand);
2526-#endif
2527-#ifdef HAVE_LIBTOKYOCABINET
2528- if (!strcmp(queue_type, "libtokyocabinet"))
2529- gearmand_queue_libtokyocabinet_deinit(_gearmand);
2530-#endif
2531- }
2532-
2533- while (gearman_conf_module_value(&module, &name, &value))
2534- {
2535- if (strcmp(name, "protocol"))
2536- continue;
2537-
2538- if (!strcmp(value, "http"))
2539- gearmand_protocol_http_deinit(_gearmand);
2540- }
2541-
2542- gearmand_free(_gearmand);
2543-
2544- if (pid_file != NULL)
2545- _pid_delete(pid_file);
2546+ Log::Instance()->fatal("gearmand: Unknown queue module: %s\n", queue_type.c_str());
2547+ return 1;
2548+ }
2549+ }
2550+
2551+ if (not protocol.compare("http"))
2552+ {
2553+ ret= http.start(_gearmand);
2554+ if (ret != GEARMAN_SUCCESS)
2555+ return 1;
2556+ }
2557+ else if (not protocol.empty())
2558+ {
2559+ Log::Instance()->fatal("gearmand: Unknown protocol module: %s\n", protocol.c_str());
2560+ return 1;
2561+ }
2562+
2563+ ret= _gearmand->run();
2564+
2565+ delete _gearmand;
2566+
2567+ if (not pid_file.empty())
2568+ _pid_delete(pid_file.c_str());
2569
2570 if (log_info.fd != -1)
2571 (void) close(log_info.fd);
2572
2573- gearman_conf_free(&conf);
2574-
2575 return (ret == GEARMAN_SUCCESS || ret == GEARMAN_SHUTDOWN) ? 0 : 1;
2576 }
2577
2578@@ -484,8 +375,7 @@
2579
2580 if (getrlimit(RLIMIT_NOFILE, &rl) == -1)
2581 {
2582- fprintf(stderr, "gearmand: Could not get file descriptor limit:%d\n",
2583- errno);
2584+ Log::Instance()->fatal("gearmand: Could not get file descriptor limit:%d\n", errno);
2585 return true;
2586 }
2587
2588@@ -495,10 +385,10 @@
2589
2590 if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
2591 {
2592- fprintf(stderr, "gearmand: Failed to set limit for the number of file "
2593- "descriptors (%d). Try running as root or giving a "
2594- "smaller value to -f.\n",
2595- errno);
2596+ Log::Instance()->fatal("gearmand: Failed to set limit for the number of file "
2597+ "descriptors (%d). Try running as root or giving a "
2598+ "smaller value to -f.\n",
2599+ errno);
2600 return true;
2601 }
2602
2603@@ -512,8 +402,8 @@
2604 f= fopen(pid_file, "w");
2605 if (f == NULL)
2606 {
2607- fprintf(stderr, "gearmand: Could not open pid file for writing: %s (%d)\n",
2608- pid_file, errno);
2609+ Log::Instance()->fatal("gearmand: Could not open pid file for writing: %s (%d)\n",
2610+ pid_file, errno);
2611 return true;
2612 }
2613
2614@@ -521,8 +411,8 @@
2615
2616 if (fclose(f) == -1)
2617 {
2618- fprintf(stderr, "gearmand: Could not close the pid file: %s (%d)\n",
2619- pid_file, errno);
2620+ Log::Instance()->fatal("gearmand: Could not close the pid file: %s (%d)\n",
2621+ pid_file, errno);
2622 return true;
2623 }
2624
2625@@ -533,40 +423,39 @@
2626 {
2627 if (unlink(pid_file) == -1)
2628 {
2629- fprintf(stderr, "gearmand: Could not remove the pid file: %s (%d)\n",
2630- pid_file, errno);
2631+ Log::Instance()->fatal("gearmand: Could not remove the pid file: %s (%d)\n",
2632+ pid_file, errno);
2633 }
2634 }
2635
2636-static bool _switch_user(const char *user)
2637+static bool _switch_user(const string user)
2638 {
2639 struct passwd *pw;
2640
2641 if (getuid() == 0 || geteuid() == 0)
2642 {
2643- if (user == NULL || user[0] == 0)
2644+ if (user.empty())
2645 {
2646- fprintf(stderr,
2647- "gearmand: Must specify '-u root' if you want to run as root\n");
2648+ Log::Instance()->fatal("gearmand: Must specify '-u root' if you want to run as root\n");
2649 return true;
2650 }
2651
2652- pw= getpwnam(user);
2653+ pw= getpwnam(user.c_str());
2654 if (pw == NULL)
2655 {
2656- fprintf(stderr, "gearmand: Could not find user '%s'\n", user);
2657- return 1;
2658+ Log::Instance()->fatal("gearmand: Could not find user '%s'\n", user.c_str());
2659+ return true;
2660 }
2661
2662 if (setgid(pw->pw_gid) == -1 || setuid(pw->pw_uid) == -1)
2663 {
2664- fprintf(stderr, "gearmand: Could not switch to user '%s'\n", user);
2665+ Log::Instance()->fatal("gearmand: Could not switch to user '%s'\n", user.c_str());
2666 return 1;
2667 }
2668 }
2669- else if (user != NULL)
2670+ else if (not user.empty())
2671 {
2672- fprintf(stderr, "gearmand: Must be root to switch users\n");
2673+ Log::Instance()->fatal("gearmand: Must be root to switch users\n");
2674 return true;
2675 }
2676
2677@@ -583,26 +472,26 @@
2678 if (sigemptyset(&sa.sa_mask) == -1 ||
2679 sigaction(SIGPIPE, &sa, 0) == -1)
2680 {
2681- fprintf(stderr, "gearmand: Could not set SIGPIPE handler (%d)\n", errno);
2682+ Log::Instance()->fatal("gearmand: Could not set SIGPIPE handler (%d)\n", errno);
2683 return true;
2684 }
2685
2686 sa.sa_handler= _shutdown_handler;
2687 if (sigaction(SIGTERM, &sa, 0) == -1)
2688 {
2689- fprintf(stderr, "gearmand: Could not set SIGTERM handler (%d)\n", errno);
2690+ Log::Instance()->fatal("gearmand: Could not set SIGTERM handler (%d)\n", errno);
2691 return true;
2692 }
2693
2694 if (sigaction(SIGINT, &sa, 0) == -1)
2695 {
2696- fprintf(stderr, "gearmand: Could not set SIGINT handler (%d)\n", errno);
2697+ Log::Instance()->fatal("gearmand: Could not set SIGINT handler (%d)\n", errno);
2698 return true;
2699 }
2700
2701 if (sigaction(SIGUSR1, &sa, 0) == -1)
2702 {
2703- fprintf(stderr, "gearmand: Could not set SIGUSR1 handler (%d)\n", errno);
2704+ Log::Instance()->fatal("gearmand: Could not set SIGUSR1 handler (%d)\n", errno);
2705 return true;
2706 }
2707
2708@@ -612,48 +501,11 @@
2709 static void _shutdown_handler(int signal_arg)
2710 {
2711 if (signal_arg == SIGUSR1)
2712- gearmand_wakeup(_gearmand, GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL);
2713- else
2714- gearmand_wakeup(_gearmand, GEARMAND_WAKEUP_SHUTDOWN);
2715-}
2716-
2717-static void _log(const char *line, gearman_verbose_t verbose, void *context)
2718-{
2719- gearmand_log_info_st *log_info= (gearmand_log_info_st *)context;
2720- int fd;
2721- time_t t;
2722- char buffer[GEARMAN_MAX_ERROR_SIZE];
2723-
2724- if (log_info->file == NULL)
2725- fd= 1;
2726- else
2727- {
2728- t= time(NULL);
2729-
2730- if (log_info->fd != -1 && log_info->reopen < t)
2731- {
2732- (void) close(log_info->fd);
2733- log_info->fd= -1;
2734- }
2735-
2736- if (log_info->fd == -1)
2737- {
2738- log_info->fd= open(log_info->file, O_CREAT | O_WRONLY | O_APPEND, 0644);
2739- if (log_info->fd == -1)
2740- {
2741- fprintf(stderr, "gearmand: Could not open log file for writing (%d)\n",
2742- errno);
2743- return;
2744- }
2745-
2746- log_info->reopen= t + GEARMAND_LOG_REOPEN_TIME;
2747- }
2748-
2749- fd= log_info->fd;
2750- }
2751-
2752- snprintf(buffer, GEARMAN_MAX_ERROR_SIZE, "%5s %s\n",
2753- gearman_verbose_name(verbose), line);
2754- if (write(fd, buffer, strlen(buffer)) == -1)
2755- fprintf(stderr, "gearmand: Could not write to log file: %d\n", errno);
2756+ {
2757+ _gearmand->set_wakeup(GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL);
2758+ }
2759+ else
2760+ {
2761+ _gearmand->set_wakeup(GEARMAND_WAKEUP_SHUTDOWN);
2762+ }
2763 }
2764
2765=== modified file 'gearmand/include.am'
2766--- gearmand/include.am 2009-12-18 18:19:29 +0000
2767+++ gearmand/include.am 2010-07-01 01:31:26 +0000
2768@@ -13,10 +13,11 @@
2769 sbin_PROGRAMS+= gearmand/gearmand
2770
2771 gearmand_gearmand_LDADD= \
2772- libgearman-server/libgearman-server.la \
2773- ${BETTER_MALLOC_LIBS}
2774+ ${BOOST_LIBS} \
2775+ libgearman-server/libgearman-server.la \
2776+ ${BETTER_MALLOC_LIBS}
2777
2778-gearmand_gearmand_SOURCES= gearmand/gearmand.c
2779+gearmand_gearmand_SOURCES= gearmand/gearmand.cc
2780
2781 gearmand-valgrind: gearmand/gearmand
2782 $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes gearmand/gearmand
2783
2784=== renamed file 'libgearman-server/client.c' => 'libgearman-server/client.cc'
2785--- libgearman-server/client.c 2010-04-06 21:41:46 +0000
2786+++ libgearman-server/client.cc 2010-07-01 01:31:26 +0000
2787@@ -1,4 +1,5 @@
2788 /* Gearman server and library
2789+ * Copyright (C) 2010 Data Differential
2790 * Copyright (C) 2008 Brian Aker, Eric Day
2791 * All rights reserved.
2792 *
2793@@ -11,12 +12,13 @@
2794 * @brief Server client definitions
2795 */
2796
2797-#include "common.h"
2798+#include "libgearman-server/common.h"
2799
2800 /*
2801 * Public definitions
2802 */
2803
2804+<<<<<<< TREE
2805 gearman_server_client_st *
2806 gearman_server_client_add(gearman_server_con_st *con)
2807 {
2808@@ -93,4 +95,15 @@
2809 else
2810 free(client);
2811 }
2812+=======
2813+gearman_server_client_st::gearman_server_client_st() :
2814+ job(NULL),
2815+ job_next(NULL),
2816+ job_prev(NULL)
2817+{
2818+}
2819+
2820+gearman_server_client_st::~gearman_server_client_st()
2821+{
2822+>>>>>>> MERGE-SOURCE
2823 }
2824
2825=== modified file 'libgearman-server/client.h'
2826--- libgearman-server/client.h 2010-03-11 19:58:32 +0000
2827+++ libgearman-server/client.h 2010-07-01 01:31:26 +0000
2828@@ -1,4 +1,5 @@
2829 /* Gearman server and library
2830+ * Copyright (C) 2010 Data Differential
2831 * Copyright (C) 2008 Brian Aker, Eric Day
2832 * All rights reserved.
2833 *
2834@@ -14,61 +15,20 @@
2835 #ifndef __GEARMAN_SERVER_CLIENT_H__
2836 #define __GEARMAN_SERVER_CLIENT_H__
2837
2838-#ifdef __cplusplus
2839-extern "C" {
2840-#endif
2841-
2842 /**
2843 * @ingroup gearman_server_client
2844 */
2845 struct gearman_server_client_st
2846 {
2847- struct {
2848- bool allocated;
2849- } options;
2850 gearman_server_con_st *con;
2851 gearman_server_client_st *con_next;
2852 gearman_server_client_st *con_prev;
2853 gearman_server_job_st *job;
2854 gearman_server_client_st *job_next;
2855 gearman_server_client_st *job_prev;
2856+
2857+ gearman_server_client_st();
2858+ ~gearman_server_client_st();
2859 };
2860
2861-/**
2862- * @addtogroup gearman_server_client Client Declarations
2863- * @ingroup gearman_server
2864- *
2865- * This is a low level interface for gearman server clients. This is used
2866- * internally by the server interface, so you probably want to look there first.
2867- *
2868- * @{
2869- */
2870-
2871-/**
2872- * Add a new client to a server instance.
2873- */
2874-GEARMAN_API
2875-gearman_server_client_st *
2876-gearman_server_client_add(gearman_server_con_st *con);
2877-
2878-/**
2879- * Initialize a server client structure.
2880- */
2881-GEARMAN_API
2882-gearman_server_client_st *
2883-gearman_server_client_create(gearman_server_con_st *con,
2884- gearman_server_client_st *client);
2885-
2886-/**
2887- * Free a server client structure.
2888- */
2889-GEARMAN_API
2890-void gearman_server_client_free(gearman_server_client_st *client);
2891-
2892-/** @} */
2893-
2894-#ifdef __cplusplus
2895-}
2896-#endif
2897-
2898 #endif /* __GEARMAN_SERVER_CLIENT_H__ */
2899
2900=== modified file 'libgearman-server/common.h'
2901--- libgearman-server/common.h 2010-04-02 02:04:04 +0000
2902+++ libgearman-server/common.h 2010-07-01 01:31:26 +0000
2903@@ -1,4 +1,5 @@
2904 /* Gearman server and library
2905+ * Copyright (C) 2010 Data Differential
2906 * Copyright (C) 2008 Brian Aker, Eric Day
2907 * All rights reserved.
2908 *
2909@@ -16,8 +17,13 @@
2910
2911 #include "config.h"
2912
2913+#define __STDC_LIMIT_MACROS
2914+#define __STDC_FORMAT_MACROS
2915+
2916+#include <cstdarg>
2917+
2918 #define GEARMAN_CORE
2919-#include "gearmand.h"
2920+#include "libgearman-server/gearmand.h"
2921
2922 #ifdef HAVE_ASSERT_H
2923 #include <assert.h>
2924@@ -34,9 +40,6 @@
2925 #ifdef HAVE_PTHREAD
2926 #include <pthread.h>
2927 #endif
2928-#ifdef HAVE_STDARG_H
2929-#include <stdarg.h>
2930-#endif
2931 #ifdef HAVE_STDDEF_H
2932 #include <stddef.h>
2933 #endif
2934@@ -116,30 +119,6 @@
2935 }
2936
2937 /**
2938- * Add an object to a fifo list.
2939- * @ingroup gearman_constants
2940- */
2941-#define GEARMAN_FIFO_ADD(__list, __obj, __prefix) { \
2942- if (__list ## _end == NULL) \
2943- __list ## _list= __obj; \
2944- else \
2945- __list ## _end->__prefix ## next= __obj; \
2946- __list ## _end= __obj; \
2947- __list ## _count++; \
2948-}
2949-
2950-/**
2951- * Delete an object from a fifo list.
2952- * @ingroup gearman_constants
2953- */
2954-#define GEARMAN_FIFO_DEL(__list, __obj, __prefix) { \
2955- __list ## _list= __obj->__prefix ## next; \
2956- if (__list ## _list == NULL) \
2957- __list ## _end= NULL; \
2958- __list ## _count--; \
2959-}
2960-
2961-/**
2962 * Add an object to a hash.
2963 * @ingroup gearman_constants
2964 */
2965@@ -184,4 +163,18 @@
2966 }
2967 #endif
2968
2969+#include <boost/bind.hpp>
2970+#include <boost/foreach.hpp>
2971+#include <boost/program_options/options_description.hpp>
2972+#include <boost/program_options/parsers.hpp>
2973+#include <boost/program_options/variables_map.hpp>
2974+#include <boost/shared_ptr.hpp>
2975+#include <boost/smart_ptr/shared_ptr.hpp>
2976+#include <boost/thread/condition.hpp>
2977+#include <boost/thread/mutex.hpp>
2978+#include <boost/thread/thread.hpp>
2979+#include <boost/token_functions.hpp>
2980+#include <boost/tokenizer.hpp>
2981+#include <boost/unordered_map.hpp>
2982+
2983 #endif /* __GEARMAN_SERVER_COMMON_H__ */
2984
2985=== renamed file 'libgearman-server/conf.c' => 'libgearman-server/conf.c.THIS'
2986=== removed file 'libgearman-server/conf.h'
2987--- libgearman-server/conf.h 2010-03-11 20:33:13 +0000
2988+++ libgearman-server/conf.h 1970-01-01 00:00:00 +0000
2989@@ -1,103 +0,0 @@
2990-/* Gearman server and library
2991- * Copyright (C) 2009 Eric Day
2992- * All rights reserved.
2993- *
2994- * Use and distribution licensed under the BSD license. See
2995- * the COPYING file in the parent directory for full text.
2996- */
2997-
2998-/**
2999- * @file
3000- * @brief Configuration Declarations
3001- */
3002-
3003-#ifndef __GEARMAN_SERVER_CONF_H__
3004-#define __GEARMAN_SERVER_CONF_H__
3005-
3006-#ifdef __cplusplus
3007-extern "C" {
3008-#endif
3009-
3010-/**
3011- * @addtogroup gearman_conf Configuration Declarations
3012- * @ingroup gearman_server
3013- * @{
3014- */
3015-
3016-struct gearman_conf_option_st
3017-{
3018- size_t value_count;
3019- gearman_conf_module_st *module;
3020- const char *name;
3021- const char *value_name;
3022- const char *help;
3023- char **value_list;
3024-};
3025-
3026-struct gearman_conf_st
3027-{
3028- struct {
3029- bool allocated;
3030- } options;
3031- gearman_return_t last_return;
3032- int last_errno;
3033- size_t module_count;
3034- size_t option_count;
3035- size_t short_count;
3036- gearman_conf_module_st **module_list;
3037- gearman_conf_option_st *option_list;
3038- struct option *option_getopt;
3039- char option_short[GEARMAN_CONF_MAX_OPTION_SHORT];
3040- char last_error[GEARMAN_MAX_ERROR_SIZE];
3041-};
3042-
3043-/**
3044- * Initialize a gearman conf structure.
3045- */
3046-GEARMAN_API
3047-gearman_conf_st *gearman_conf_create(gearman_conf_st *conf);
3048-
3049-/**
3050- * Free a gearman conf structure.
3051- */
3052-GEARMAN_API
3053-void gearman_conf_free(gearman_conf_st *conf);
3054-
3055-/**
3056- * Return an return code for the last library error encountered.
3057- */
3058-GEARMAN_API
3059-gearman_return_t gearman_conf_return(gearman_conf_st *conf);
3060-
3061-/**
3062- * Return an error string for last library error encountered.
3063- */
3064-GEARMAN_API
3065-const char *gearman_conf_error(gearman_conf_st *conf);
3066-
3067-/**
3068- * Value of errno in the case of a GEARMAN_ERRNO return value.
3069- */
3070-GEARMAN_API
3071-int gearman_conf_errno(gearman_conf_st *conf);
3072-
3073-/**
3074- * Parse command line arguments.
3075- */
3076-GEARMAN_API
3077-gearman_return_t gearman_conf_parse_args(gearman_conf_st *conf, int argc,
3078- char *argv[]);
3079-
3080-/**
3081- * Print usage information to stdout.
3082- */
3083-GEARMAN_API
3084-void gearman_conf_usage(gearman_conf_st *conf);
3085-
3086-/** @} */
3087-
3088-#ifdef __cplusplus
3089-}
3090-#endif
3091-
3092-#endif /* __GEARMAN_SERVER_CONF_H__ */
3093
3094=== renamed file 'libgearman-server/conf_module.c' => 'libgearman-server/conf_module.c.THIS'
3095=== removed file 'libgearman-server/conf_module.h'
3096--- libgearman-server/conf_module.h 2010-03-11 22:45:34 +0000
3097+++ libgearman-server/conf_module.h 1970-01-01 00:00:00 +0000
3098@@ -1,80 +0,0 @@
3099-/* Module configuration library
3100- * Copyright (C) 2009 Eric Day
3101- * All rights reserved.
3102- *
3103- * Use and distribution licensed under the BSD license. See
3104- * the COPYING file in the parent directory for full text.
3105- */
3106-
3107-/**
3108- * @file
3109- * @brief Configuration Module Declarations
3110- */
3111-
3112-#ifndef __GEARMAN_SERVER_CONF_MODULE_H__
3113-#define __GEARMAN_SERVER_CONF_MODULE_H__
3114-
3115-#ifdef __cplusplus
3116-extern "C" {
3117-#endif
3118-
3119-/**
3120- * @addtogroup gearman_conf_module Configuration Module Declarations
3121- * @ingroup gearman_server
3122- * @{
3123- */
3124-
3125-struct gearman_conf_module_st
3126-{
3127- struct {
3128- bool allocated;
3129- } options;
3130- size_t current_option;
3131- size_t current_value;
3132- gearman_conf_st *conf;
3133- const char *name;
3134-};
3135-
3136-/**
3137- * Initialize a gearman conf module structure.
3138- */
3139-GEARMAN_API
3140-gearman_conf_module_st *gearman_conf_module_create(gearman_conf_st *conf,
3141- gearman_conf_module_st *module,
3142- const char *name);
3143-
3144-/**
3145- * Free a gearman conf module structure.
3146- */
3147-GEARMAN_API
3148-void gearman_conf_module_free(gearman_conf_module_st *module);
3149-
3150-/**
3151- * Find a gearman conf module structure by name.
3152- */
3153-GEARMAN_API
3154-gearman_conf_module_st *gearman_conf_module_find(gearman_conf_st *conf,
3155- const char *name);
3156-
3157-/**
3158- * Add option for a module.
3159- */
3160-GEARMAN_API
3161-void gearman_conf_module_add_option(gearman_conf_module_st *module,
3162- const char *name, int short_name,
3163- const char *value_name, const char *help);
3164-
3165-/**
3166- * Loop through all values that were given for a set of module options.
3167- */
3168-GEARMAN_API
3169-bool gearman_conf_module_value(gearman_conf_module_st *module,
3170- const char **name, const char **value);
3171-
3172-/** @} */
3173-
3174-#ifdef __cplusplus
3175-}
3176-#endif
3177-
3178-#endif /* __GEARMAN_SERVER_CONF_MODULE_H__ */
3179
3180=== renamed file 'libgearman-server/connection.c' => 'libgearman-server/connection.cc'
3181--- libgearman-server/connection.c 2010-04-06 21:41:46 +0000
3182+++ libgearman-server/connection.cc 2010-07-01 01:31:26 +0000
3183@@ -1,4 +1,5 @@
3184 /* Gearman server and library
3185+ * Copyright (C) 2010 Data Differential
3186 * Copyright (C) 2008 Brian Aker, Eric Day
3187 * All rights reserved.
3188 *
3189@@ -11,12 +12,13 @@
3190 * @brief Server connection definitions
3191 */
3192
3193-#include "common.h"
3194+#include "libgearman-server/common.h"
3195
3196 /*
3197 * Public definitions
3198 */
3199
3200+<<<<<<< TREE
3201 gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread,
3202 int fd, void *data)
3203 {
3204@@ -115,128 +117,150 @@
3205
3206 con->host= NULL;
3207 con->port= NULL;
3208+=======
3209+gearman_server_con_st::gearman_server_con_st(gearman_server_thread_st *thread_arg) :
3210+ is_sleeping(false),
3211+ is_exceptions(false),
3212+ is_dead(false),
3213+ is_noop_sent(false),
3214+ ret(GEARMAN_SUCCESS),
3215+ io_list(false),
3216+ proc_list(false),
3217+ proc_removed(false),
3218+ worker_count(0),
3219+ client_count(0),
3220+ thread(thread_arg),
3221+ packet(NULL),
3222+ io_next(NULL),
3223+ io_prev(NULL),
3224+ proc_next(NULL),
3225+ proc_prev(NULL),
3226+ worker_list(NULL),
3227+ client_list(NULL),
3228+ _host(NULL),
3229+ _port(NULL)
3230+{
3231+ strcpy(_id, "-");
3232+
3233+ gearman_connection_options_t _options[] = { GEARMAN_CON_IGNORE_LOST_CONNECTION, GEARMAN_CON_MAX };
3234+ if (gearman_connection_create(&thread_arg->gearman, con(), _options) == NULL)
3235+ {
3236+ abort(); // Should be impossible
3237+ }
3238+}
3239+
3240+gearman_server_con_st::~gearman_server_con_st()
3241+{
3242+ _host= NULL;
3243+ _port= NULL;
3244+
3245+ {
3246+ boost::mutex::scoped_lock l(thread->lock);
3247+ thread->con_list.erase(this);
3248+ }
3249+>>>>>>> MERGE-SOURCE
3250
3251 if (thread->server->flags.threaded &&
3252- !(con->proc_removed) && !(thread->server->proc_shutdown))
3253+ !(proc_removed) && !(thread->server->proc_shutdown))
3254 {
3255- con->is_dead= true;
3256- con->is_sleeping= false;
3257- con->is_exceptions= false;
3258- con->is_noop_sent= false;
3259- gearman_server_con_proc_add(con);
3260+ is_dead= true;
3261+ is_sleeping= false;
3262+ is_exceptions= false;
3263+ is_noop_sent= false;
3264+ proc_add();
3265 return;
3266 }
3267
3268- gearman_connection_free(&(con->con));
3269-
3270- if (con->proc_list)
3271- gearman_server_con_proc_remove(con);
3272-
3273- if (con->io_list)
3274- gearman_server_con_io_remove(con);
3275-
3276- if (con->packet != NULL)
3277- {
3278- if (&(con->packet->packet) != con->con.recv_packet)
3279- gearman_packet_free(&(con->packet->packet));
3280- gearman_server_packet_free(con->packet, con->thread, true);
3281- }
3282-
3283- while (con->io_packet_list != NULL)
3284- gearman_server_io_packet_remove(con);
3285-
3286- while (con->proc_packet_list != NULL)
3287- {
3288- packet= gearman_server_proc_packet_remove(con);
3289- gearman_packet_free(&(packet->packet));
3290- gearman_server_packet_free(packet, con->thread, true);
3291- }
3292-
3293- gearman_server_con_free_workers(con);
3294-
3295- while (con->client_list != NULL)
3296- gearman_server_client_free(con->client_list);
3297-
3298- (void) pthread_mutex_lock(&thread->lock);
3299- GEARMAN_LIST_DEL(con->thread->con, con,)
3300- (void) pthread_mutex_unlock(&thread->lock);
3301-
3302- if (thread->free_con_count < GEARMAN_MAX_FREE_SERVER_CON)
3303- GEARMAN_LIST_ADD(thread->free_con, con,)
3304- else
3305- free(con);
3306-}
3307-
3308-gearman_connection_st *gearman_server_con_con(gearman_server_con_st *con)
3309-{
3310- return &con->con;
3311-}
3312-
3313-const void *gearman_server_con_data(const gearman_server_con_st *con)
3314-{
3315- return gearman_connection_context(&(con->con));
3316-}
3317-
3318-void gearman_server_con_set_data(gearman_server_con_st *con, void *data)
3319-{
3320- gearman_connection_set_context(&(con->con), data);
3321-}
3322-
3323-const char *gearman_server_con_host(gearman_server_con_st *con)
3324-{
3325- return con->host;
3326-}
3327-
3328-void gearman_server_con_set_host(gearman_server_con_st *con, const char *host)
3329-{
3330- con->host= host;
3331-}
3332-
3333-const char *gearman_server_con_port(gearman_server_con_st *con)
3334-{
3335- return con->port;
3336-}
3337-
3338-void gearman_server_con_set_port(gearman_server_con_st *con, const char *port)
3339-{
3340- con->port= port;
3341-}
3342-
3343-const char *gearman_server_con_id(gearman_server_con_st *con)
3344-{
3345- return con->id;
3346-}
3347-
3348-void gearman_server_con_set_id(gearman_server_con_st *con, char *id,
3349- size_t size)
3350+ if (proc_list)
3351+ proc_remove();
3352+
3353+ if (io_list)
3354+ io_remove();
3355+
3356+ if (packet != NULL)
3357+ {
3358+ if (&packet->packet != con()->recv_packet)
3359+ { }
3360+ else
3361+ {
3362+ packet->release_packet= false;
3363+ }
3364+ delete packet;
3365+ }
3366+
3367+ assert(con()->options.allocated == false);
3368+ gearman_connection_free(con());
3369+
3370+ while (io_packet_list.size())
3371+ {
3372+ io_packet_remove();
3373+ }
3374+
3375+ while (proc_packet_list.size())
3376+ {
3377+ gearman_server_packet_st *packet_ptr;
3378+
3379+ packet_ptr= proc_packet_remove();
3380+ delete packet_ptr;
3381+ }
3382+
3383+ while (worker_list != NULL)
3384+ {
3385+ delete worker_list;
3386+ }
3387+
3388+ while (client_list != NULL)
3389+ {
3390+ client_list->con->thread->server->client_free(client_list);
3391+ }
3392+}
3393+
3394+const void *gearman_server_con_st::data()
3395+{
3396+ return gearman_connection_context(con());
3397+}
3398+
3399+void gearman_server_con_st::set_host(const char *host_arg)
3400+{
3401+ _host= host_arg;
3402+}
3403+
3404+void gearman_server_con_st::set_port(const char *port_arg)
3405+{
3406+ _port= port_arg;
3407+}
3408+
3409+void gearman_server_con_st::set_id(char *id_arg, size_t size)
3410 {
3411 if (size >= GEARMAN_SERVER_CON_ID_SIZE)
3412 size= GEARMAN_SERVER_CON_ID_SIZE - 1;
3413
3414- memcpy(con->id, id, size);
3415- con->id[size]= 0;
3416+ memcpy(_id, id_arg, size);
3417+ _id[size]= 0;
3418 }
3419
3420-void gearman_server_con_free_worker(gearman_server_con_st *con,
3421- char *function_name,
3422- size_t function_name_size)
3423+void gearman_server_con_st::free_worker(const char *function_name_arg,
3424+ size_t function_name_size_arg)
3425 {
3426- gearman_server_worker_st *worker= con->worker_list;
3427+ gearman_server_worker_st *worker= worker_list;
3428 gearman_server_worker_st *prev_worker= NULL;
3429
3430 while (worker != NULL)
3431 {
3432- if (worker->function->function_name_size == function_name_size &&
3433- !memcmp(worker->function->function_name, function_name,
3434- function_name_size))
3435+ if (worker->function->function_name.length() == function_name_size_arg &&
3436+ !memcmp(worker->function->function_name.c_str(), function_name_arg, function_name_size_arg))
3437 {
3438- gearman_server_worker_free(worker);
3439+ delete worker;
3440
3441 /* Set worker to the last kept worker, or the beginning of the list. */
3442 if (prev_worker == NULL)
3443- worker= con->worker_list;
3444+ {
3445+ worker= worker_list;
3446+ }
3447 else
3448+ {
3449 worker= prev_worker;
3450+ }
3451 }
3452 else
3453 {
3454@@ -247,111 +271,424 @@
3455 }
3456 }
3457
3458-void gearman_server_con_free_workers(gearman_server_con_st *con)
3459+void gearman_server_con_st::free_workers()
3460 {
3461- while (con->worker_list != NULL)
3462- gearman_server_worker_free(con->worker_list);
3463+ while (worker_list != NULL)
3464+ {
3465+ delete worker_list;
3466+ }
3467 }
3468
3469-void gearman_server_con_io_add(gearman_server_con_st *con)
3470+void gearman_server_con_st::io_add()
3471 {
3472- if (con->io_list)
3473+ if (io_list)
3474 return;
3475
3476- (void) pthread_mutex_lock(&con->thread->lock);
3477+ thread->lock.lock();
3478
3479- GEARMAN_LIST_ADD(con->thread->io, con, io_)
3480- con->io_list= true;
3481+ GEARMAN_LIST_ADD(thread->io, this, io_)
3482+ io_list= true;
3483
3484 /* Looks funny, but need to check io_count locked, but call run unlocked. */
3485- if (con->thread->io_count == 1 && con->thread->run_fn)
3486+ if (thread->io_count == 1 && thread->run_fn)
3487 {
3488- (void) pthread_mutex_unlock(&con->thread->lock);
3489- (*con->thread->run_fn)(con->thread, con->thread->run_fn_arg);
3490+ thread->lock.unlock();
3491+ (*thread->run_fn)(thread, thread->run_fn_arg);
3492 }
3493 else
3494 {
3495- (void) pthread_mutex_unlock(&con->thread->lock);
3496+ thread->lock.unlock();
3497 }
3498 }
3499
3500-void gearman_server_con_io_remove(gearman_server_con_st *con)
3501+void gearman_server_con_st::io_remove()
3502 {
3503- (void) pthread_mutex_lock(&con->thread->lock);
3504- if (con->io_list)
3505+ boost::mutex::scoped_lock l(thread->lock);
3506+ if (io_list)
3507 {
3508- GEARMAN_LIST_DEL(con->thread->io, con, io_)
3509- con->io_list= false;
3510+ GEARMAN_LIST_DEL(thread->io, this, io_)
3511+ io_list= false;
3512 }
3513- (void) pthread_mutex_unlock(&con->thread->lock);
3514-}
3515-
3516-gearman_server_con_st *
3517-gearman_server_con_io_next(gearman_server_thread_st *thread)
3518-{
3519- gearman_server_con_st *con= thread->io_list;
3520-
3521- if (con == NULL)
3522- return NULL;
3523-
3524- gearman_server_con_io_remove(con);
3525-
3526- return con;
3527-}
3528-
3529-void gearman_server_con_proc_add(gearman_server_con_st *con)
3530-{
3531- if (con->proc_list)
3532+}
3533+
3534+void gearman_server_con_st::proc_add()
3535+{
3536+ if (proc_list)
3537 return;
3538
3539- (void) pthread_mutex_lock(&con->thread->lock);
3540- GEARMAN_LIST_ADD(con->thread->proc, con, proc_)
3541- con->proc_list= true;
3542- (void) pthread_mutex_unlock(&con->thread->lock);
3543-
3544- if (! (con->thread->server->proc_shutdown) &&
3545- !(con->thread->server->proc_wakeup))
3546- {
3547- (void) pthread_mutex_lock(&(con->thread->server->proc_lock));
3548- con->thread->server->proc_wakeup= true;
3549- (void) pthread_cond_signal(&(con->thread->server->proc_cond));
3550- (void) pthread_mutex_unlock(&(con->thread->server->proc_lock));
3551- }
3552-}
3553-
3554-void gearman_server_con_proc_remove(gearman_server_con_st *con)
3555-{
3556- (void) pthread_mutex_lock(&con->thread->lock);
3557-
3558- if (con->proc_list)
3559- {
3560- GEARMAN_LIST_DEL(con->thread->proc, con, proc_)
3561- con->proc_list= false;
3562- }
3563- (void) pthread_mutex_unlock(&con->thread->lock);
3564-}
3565-
3566-gearman_server_con_st *
3567-gearman_server_con_proc_next(gearman_server_thread_st *thread)
3568-{
3569- gearman_server_con_st *con;
3570-
3571- if (thread->proc_list == NULL)
3572- return NULL;
3573-
3574- (void) pthread_mutex_lock(&thread->lock);
3575-
3576- con= thread->proc_list;
3577- while (con != NULL)
3578- {
3579- GEARMAN_LIST_DEL(thread->proc, con, proc_)
3580- con->proc_list= false;
3581- if (!(con->proc_removed))
3582- break;
3583- con= thread->proc_list;
3584- }
3585-
3586- (void) pthread_mutex_unlock(&thread->lock);
3587-
3588- return con;
3589+ {
3590+ boost::mutex::scoped_lock l(thread->lock);
3591+ GEARMAN_LIST_ADD(thread->proc, this, proc_);
3592+ proc_list= true;
3593+ }
3594+
3595+ if (! (thread->server->proc_shutdown) &&
3596+ !(thread->server->proc_wakeup))
3597+ {
3598+
3599+ // Rethink this (copied from straight pthread)
3600+ boost::mutex::scoped_lock l(thread->server->proc_lock);
3601+ thread->server->proc_wakeup= true;
3602+ thread->server->proc_cond.notify_all();
3603+ }
3604+}
3605+
3606+void gearman_server_con_st::proc_remove()
3607+{
3608+ boost::mutex::scoped_lock l(thread->lock);
3609+
3610+ if (proc_list)
3611+ {
3612+ GEARMAN_LIST_DEL(thread->proc, this, proc_)
3613+ proc_list= false;
3614+ }
3615+}
3616+
3617+gearman_server_client_st *gearman_server_con_st::client_create()
3618+{
3619+ gearman_server_client_st *client;
3620+
3621+ {
3622+ client= new gearman_server_client_st;
3623+ if (client == NULL)
3624+ {
3625+ Log::Instance()->error("gearman_server_client_create: new()");
3626+
3627+ return NULL;
3628+ }
3629+ }
3630+
3631+ client->con= this;
3632+ GEARMAN_LIST_ADD(client, client, con_)
3633+
3634+ return client;
3635+}
3636+
3637+gearman_server_client_st *gearman_server_con_st::client_add()
3638+{
3639+ gearman_server_client_st *client;
3640+
3641+ client= client_create();
3642+ if (client == NULL)
3643+ return NULL;
3644+
3645+ return client;
3646+}
3647+
3648+
3649+gearman_server_worker_st *
3650+gearman_server_con_st::worker_create(gearman_server_function_st *function)
3651+{
3652+ gearman_server_worker_st *worker= NULL;
3653+
3654+ worker= new gearman_server_worker_st(this, function);
3655+
3656+ GEARMAN_LIST_ADD(worker, worker, con_);
3657+
3658+ Log::Instance()->event(Logger::WORKER_CREATED, NULL);
3659+
3660+ /* Add worker to the function list, which is a double-linked circular list. */
3661+ if (function->worker_list == NULL)
3662+ {
3663+ function->worker_list= worker;
3664+ worker->function_next= worker;
3665+ worker->function_prev= worker;
3666+ }
3667+ else
3668+ {
3669+ worker->function_next= function->worker_list;
3670+ worker->function_prev= function->worker_list->function_prev;
3671+ worker->function_next->function_prev= worker;
3672+ worker->function_prev->function_next= worker;
3673+ }
3674+ function->worker_count++;
3675+
3676+ return worker;
3677+}
3678+
3679+gearman_server_worker_st *
3680+gearman_server_con_st::worker_add(const char *function_name_arg, size_t length, uint32_t timeout)
3681+{
3682+ std::string function_name(function_name_arg, length);
3683+ gearman_server_worker_st *worker;
3684+ gearman_server_function_st *function;
3685+
3686+ if (function_name.empty())
3687+ return NULL;
3688+
3689+ function= thread->server->function_get(function_name);
3690+
3691+ if (function == NULL)
3692+ return NULL;
3693+
3694+ worker= worker_create(function);
3695+ if (worker == NULL)
3696+ return NULL;
3697+
3698+ worker->set_timeout(timeout);
3699+
3700+ return worker;
3701+}
3702+
3703+
3704+gearman_server_job_st *gearman_server_con_st::job_peek()
3705+{
3706+ gearman_server_worker_st *server_worker;
3707+
3708+ for (server_worker= worker_list; server_worker != NULL;
3709+ server_worker= server_worker->con_next)
3710+ {
3711+ if (server_worker->function->job_count != 0)
3712+ {
3713+ for (uint32_t priority= GEARMAN_JOB_PRIORITY_HIGH;
3714+ priority != GEARMAN_JOB_PRIORITY_MAX; priority++)
3715+ {
3716+ if (server_worker->function->job_list[priority] != NULL)
3717+ {
3718+ if (server_worker->function->job_list[priority]->ignore_job())
3719+ {
3720+ /* This is only happens when a client disconnects from a foreground
3721+ job. We do this because we don't want to run the job anymore. */
3722+ server_worker->function->job_list[priority]->set_ignore_job(false);
3723+
3724+ delete job_take();
3725+
3726+ return job_peek();
3727+ }
3728+ return server_worker->function->job_list[priority];
3729+ }
3730+ }
3731+ }
3732+ }
3733+
3734+ return NULL;
3735+}
3736+
3737+/**
3738+ * Appends a worker onto the end of a list of workers.
3739+ */
3740+static inline void _server_con_worker_list_append(gearman_server_worker_st *list,
3741+ gearman_server_worker_st *worker)
3742+{
3743+ worker->con_prev= NULL;
3744+ worker->con_next= list;
3745+ while (worker->con_next != NULL)
3746+ {
3747+ worker->con_prev= worker->con_next;
3748+ worker->con_next= worker->con_next->con_next;
3749+ }
3750+ if (worker->con_prev)
3751+ worker->con_prev->con_next= worker;
3752+}
3753+
3754+
3755+gearman_server_job_st *gearman_server_con_st::job_take()
3756+{
3757+ gearman_server_worker_st *server_worker;
3758+ gearman_server_job_st *server_job;
3759+ gearman_job_priority_t priority;
3760+
3761+ for (server_worker= worker_list; server_worker != NULL;
3762+ server_worker= server_worker->con_next)
3763+ {
3764+ if (server_worker->function->job_count != 0)
3765+ break;
3766+ }
3767+
3768+ if (server_worker == NULL)
3769+ return NULL;
3770+
3771+ if (thread->server->flags.round_robin)
3772+ {
3773+ GEARMAN_LIST_DEL(worker, server_worker, con_)
3774+ _server_con_worker_list_append(worker_list, server_worker);
3775+ ++worker_count;
3776+ if (worker_list == NULL)
3777+ {
3778+ worker_list= server_worker;
3779+ }
3780+ }
3781+
3782+ uint32_t x;
3783+ for (x= (uint32_t)GEARMAN_JOB_PRIORITY_HIGH; x != GEARMAN_JOB_PRIORITY_MAX; x++)
3784+ {
3785+ if (server_worker->function->job_list[x] != NULL)
3786+ break;
3787+ }
3788+ priority= (gearman_job_priority_t)x;
3789+
3790+ server_job= server_worker->function->job_list[priority];
3791+ server_job->function->job_list[priority]= server_job->function_next;
3792+ if (server_job->function->job_end[priority] == server_job)
3793+ server_job->function->job_end[priority]= NULL;
3794+ server_job->function->job_count--;
3795+
3796+ server_job->worker= server_worker;
3797+ server_worker->add_job(server_job);
3798+ server_job->function->job_running++;
3799+
3800+ if (server_job->ignore_job())
3801+ {
3802+ delete server_job;
3803+ return job_take();
3804+ }
3805+
3806+ return server_job;
3807+}
3808+
3809+gearman_return_t gearman_server_con_st::_server_error_packet(const char *error_code, const char *error_string)
3810+{
3811+ return io_packet_add(false, GEARMAN_MAGIC_RESPONSE,
3812+ GEARMAN_COMMAND_ERROR, error_code,
3813+ (size_t)(strlen(error_code) + 1),
3814+ error_string,
3815+ (size_t)strlen(error_string), NULL);
3816+}
3817+
3818+
3819+gearman_return_t gearman_server_con_st::_thread_packet_read()
3820+{
3821+ gearman_return_t rc;
3822+ gearman_server_con_st *con_this= this;
3823+
3824+ while (1)
3825+ {
3826+ if (con_this->packet == NULL)
3827+ {
3828+ con_this->packet= new gearman_server_packet_st;
3829+ if (con_this->packet == NULL)
3830+ return GEARMAN_MEMORY_ALLOCATION_FAILURE;
3831+ }
3832+
3833+ (void)gearman_connection_recv(con_this->con(), &(con_this->packet->packet), &rc, true);
3834+ if (rc != GEARMAN_SUCCESS)
3835+ {
3836+ if (rc == GEARMAN_IO_WAIT)
3837+ break;
3838+
3839+ delete con_this->packet;
3840+ con_this->packet= NULL;
3841+ return rc;
3842+ }
3843+
3844+ Log::Instance()->debug("%15s:%5s Received %s",
3845+ con_this->_host == NULL ? "-" : con_this->_host,
3846+ con_this->_port == NULL ? "-" : con_this->_port,
3847+ gearman_command_info_list[con_this->packet->packet.command].name);
3848+
3849+ /* We read a complete packet. */
3850+ if (con_this->thread->server->flags.threaded)
3851+ {
3852+ /* Multi-threaded, queue for the processing thread to run. */
3853+ con_this->gearman_server_proc_packet_add(con_this->packet);
3854+ con_this->packet= NULL;
3855+ }
3856+ else
3857+ {
3858+ /* Single threaded, run the command here. */
3859+ rc= gearman_server_run_command(con_this, &(con_this->packet->packet));
3860+ delete con_this->packet;
3861+ con_this->packet= NULL;
3862+ if (rc != GEARMAN_SUCCESS)
3863+ return rc;
3864+ }
3865+ }
3866+
3867+ return GEARMAN_SUCCESS;
3868+}
3869+
3870+gearman_return_t gearman_server_con_st::io_packet_add(bool take_data,
3871+ enum gearman_magic_t magic,
3872+ gearman_command_t command,
3873+ const void *arg, ...)
3874+{
3875+ gearman_server_packet_st *server_packet;
3876+ va_list ap;
3877+ size_t arg_size;
3878+ gearman_return_t rc;
3879+
3880+ server_packet= new gearman_server_packet_st(thread->gearman, magic, command);
3881+ if (server_packet == NULL)
3882+ return GEARMAN_MEMORY_ALLOCATION_FAILURE;
3883+
3884+ va_start(ap, arg);
3885+
3886+ while (arg != NULL)
3887+ {
3888+ arg_size = va_arg(ap, size_t);
3889+
3890+ rc= gearman_packet_create_arg(&(server_packet->packet), arg, arg_size);
3891+ if (rc != GEARMAN_SUCCESS)
3892+ {
3893+ va_end(ap);
3894+ delete server_packet;
3895+
3896+ return rc;
3897+ }
3898+
3899+ arg = va_arg(ap, void *);
3900+ }
3901+
3902+ va_end(ap);
3903+
3904+ rc= gearman_packet_pack_header(&(server_packet->packet));
3905+ if (rc != GEARMAN_SUCCESS)
3906+ {
3907+ delete server_packet;
3908+
3909+ return rc;
3910+ }
3911+
3912+ if (take_data)
3913+ {
3914+ server_packet->packet.options.free_data= true;
3915+ }
3916+
3917+ {
3918+ boost::mutex::scoped_lock l(thread->lock);
3919+ io_packet_list.push(server_packet);
3920+ }
3921+
3922+ io_add();
3923+
3924+ return GEARMAN_SUCCESS;
3925+}
3926+
3927+void gearman_server_con_st::io_packet_remove()
3928+{
3929+ gearman_server_packet_st *server_packet;
3930+ {
3931+ boost::mutex::scoped_lock l(thread->lock);
3932+ server_packet= io_packet_list.front();
3933+ io_packet_list.pop();
3934+ assert(server_packet);
3935+ }
3936+
3937+ delete server_packet;
3938+}
3939+
3940+void gearman_server_con_st::gearman_server_proc_packet_add(gearman_server_packet_st *arg)
3941+{
3942+ {
3943+ boost::mutex::scoped_lock l(thread->lock);
3944+ proc_packet_list.push(arg);
3945+ }
3946+
3947+ proc_add();
3948+}
3949+
3950+gearman_server_packet_st *gearman_server_con_st::proc_packet_remove()
3951+{
3952+ if (proc_packet_list.size() == 0)
3953+ return NULL;
3954+
3955+ gearman_server_packet_st *server_packet;
3956+ {
3957+ boost::mutex::scoped_lock l(thread->lock);
3958+ server_packet= proc_packet_list.front();
3959+ proc_packet_list.pop();
3960+ assert(server_packet);
3961+ }
3962+
3963+ return server_packet;
3964 }
3965
3966=== modified file 'libgearman-server/connection.h'
3967--- libgearman-server/connection.h 2010-04-06 16:34:30 +0000
3968+++ libgearman-server/connection.h 2010-07-01 01:31:26 +0000
3969@@ -1,4 +1,5 @@
3970 /* Gearman server and library
3971+ * Copyright (C) 2010 Data Differential
3972 * Copyright (C) 2008 Brian Aker, Eric Day
3973 * All rights reserved.
3974 *
3975@@ -14,9 +15,7 @@
3976 #ifndef __GEARMAN_SERVER_CON_H__
3977 #define __GEARMAN_SERVER_CON_H__
3978
3979-#ifdef __cplusplus
3980-extern "C" {
3981-#endif
3982+#include <queue>
3983
3984 /**
3985 * @addtogroup gearman_server_con Connection Declarations
3986@@ -28,9 +27,11 @@
3987 * @{
3988 */
3989
3990+typedef std::queue<gearman_server_packet_st *> ProcPacketList;
3991+
3992 struct gearman_server_con_st
3993 {
3994- gearman_connection_st con; /* This must be the first struct member. */
3995+ gearman_connection_st _con; /* This must be the first struct member. */
3996 bool is_sleeping;
3997 bool is_exceptions;
3998 bool is_dead;
3999@@ -39,166 +40,158 @@
4000 bool io_list;
4001 bool proc_list;
4002 bool proc_removed;
4003- uint32_t io_packet_count;
4004- uint32_t proc_packet_count;
4005 uint32_t worker_count;
4006 uint32_t client_count;
4007 gearman_server_thread_st *thread;
4008- gearman_server_con_st *next;
4009- gearman_server_con_st *prev;
4010 gearman_server_packet_st *packet;
4011- gearman_server_packet_st *io_packet_list;
4012- gearman_server_packet_st *io_packet_end;
4013- gearman_server_packet_st *proc_packet_list;
4014- gearman_server_packet_st *proc_packet_end;
4015+ ProcPacketList io_packet_list;
4016+ ProcPacketList proc_packet_list;
4017 gearman_server_con_st *io_next;
4018 gearman_server_con_st *io_prev;
4019 gearman_server_con_st *proc_next;
4020 gearman_server_con_st *proc_prev;
4021 gearman_server_worker_st *worker_list;
4022 gearman_server_client_st *client_list;
4023- const char *host;
4024- const char *port;
4025- char id[GEARMAN_SERVER_CON_ID_SIZE];
4026+ const char *_host;
4027+ const char *_port;
4028+ char _id[GEARMAN_SERVER_CON_ID_SIZE];
4029+
4030+ gearman_server_con_st(gearman_server_thread_st *thread_arg);
4031+ ~gearman_server_con_st();
4032+
4033+ void free_workers();
4034+public:
4035+ gearman_server_client_st *client_create();
4036+ gearman_server_client_st *client_add();
4037+
4038+ gearman_return_t _server_run_text(gearman_packet_st *packet);
4039+
4040+ /**
4041+ * Remove connection from the io thread list.
4042+ */
4043+ void io_remove();
4044+
4045+ /**
4046+ * Add connection to the proc thread list.
4047+ */
4048+ void proc_add();
4049+
4050+ gearman_server_packet_st *proc_packet_remove();
4051+
4052+ /**
4053+ * Remove the first server packet structure from io queue for a connection.
4054+ */
4055+ void io_packet_remove();
4056+
4057+ /**
4058+ * Remove connection from the proc thread list.
4059+ */
4060+ void proc_remove();
4061+
4062+ /**
4063+ * Get gearman connection pointer the server connection uses.
4064+ */
4065+ gearman_connection_st *con()
4066+ {
4067+ return &_con;
4068+ }
4069+
4070+ /**
4071+ * Set client id.
4072+ */
4073+ void set_id(char *id_arg, size_t size);
4074+
4075+ /**
4076+ * Set client port.
4077+ */
4078+ void set_port(const char *port);
4079+
4080+ /**
4081+ * Set client host.
4082+ */
4083+ void set_host(const char *host_arg);
4084+
4085+ /**
4086+ * Get client host.
4087+ */
4088+ const char *host()
4089+ {
4090+ return _host;
4091+ }
4092+
4093+ /**
4094+ * Get client port.
4095+ */
4096+ const char *port()
4097+ {
4098+ return _port;
4099+ }
4100+
4101+ /**
4102+ * Get client id.
4103+ */
4104+ const char *id()
4105+ {
4106+ return _id;
4107+ }
4108+
4109+ /**
4110+ * Get application data pointer.
4111+ */
4112+ const void *data();
4113+
4114+ /**
4115+ * Add connection to the io thread list.
4116+ */
4117+ void io_add();
4118+
4119+ /**
4120+ * Free server worker struction with name for a server connection.
4121+ */
4122+ void free_worker(const char *function_name_arg,
4123+ size_t function_name_size_arg);
4124+
4125+ /**
4126+ * Add a server packet structure to io queue for a connection.
4127+ */
4128+ gearman_return_t io_packet_add(bool take_data,
4129+ enum gearman_magic_t magic,
4130+ gearman_command_t command,
4131+ const void *arg, ...);
4132+
4133+ /**
4134+ * Add a new worker to a server instance.
4135+ */
4136+ gearman_server_worker_st *
4137+ worker_add(const char *function_name, size_t function_name_size, uint32_t timeout);
4138+
4139+ gearman_server_worker_st *
4140+ worker_create(gearman_server_function_st *function);
4141+
4142+ /**
4143+ * See if there are any jobs to be run for the server worker connection.
4144+ */
4145+ gearman_server_job_st *job_peek();
4146+
4147+ /**
4148+ * Start running a job for the server worker connection.
4149+ */
4150+ gearman_server_job_st *job_take();
4151+
4152+ gearman_return_t _thread_packet_read();
4153+
4154+/**
4155+ * Remove the first server packet structure from proc queue for a connection.
4156+ */
4157+
4158+ gearman_return_t _server_error_packet(const char *error_code, const char *error_string);
4159+
4160+ /**
4161+ * Add a server packet structure to proc queue for a connection.
4162+ */
4163+ void gearman_server_proc_packet_add(gearman_server_packet_st *packet);
4164 };
4165
4166-/**
4167- * Add a connection to a server thread. This goes into a list of connections
4168- * that is used later with server_thread_run, no socket I/O happens here.
4169- * @param thread Thread structure previously initialized with
4170- * gearman_server_thread_create.
4171- * @param fd File descriptor for a newly accepted connection.
4172- * @param data Application data pointer.
4173- * @return Gearman server connection pointer.
4174- */
4175-GEARMAN_API
4176-gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread,
4177- int fd, void *data);
4178-
4179-/**
4180- * Initialize a server connection structure.
4181- */
4182-GEARMAN_API
4183-gearman_server_con_st *
4184-gearman_server_con_create(gearman_server_thread_st *thread);
4185-
4186-/**
4187- * Free a server connection structure.
4188- */
4189-GEARMAN_API
4190-void gearman_server_con_free(gearman_server_con_st *con);
4191-
4192-/**
4193- * Get gearman connection pointer the server connection uses.
4194- */
4195-GEARMAN_API
4196-gearman_connection_st *gearman_server_con_con(gearman_server_con_st *con);
4197-
4198-/**
4199- * Get application data pointer.
4200- */
4201-GEARMAN_API
4202-const void *gearman_server_con_data(const gearman_server_con_st *con);
4203-
4204-/**
4205- * Set application data pointer.
4206- */
4207-GEARMAN_API
4208-void gearman_server_con_set_data(gearman_server_con_st *con, void *data);
4209-
4210-/**
4211- * Get client host.
4212- */
4213-GEARMAN_API
4214-const char *gearman_server_con_host(gearman_server_con_st *con);
4215-
4216-/**
4217- * Set client host.
4218- */
4219-GEARMAN_API
4220-void gearman_server_con_set_host(gearman_server_con_st *con, const char *host);
4221-
4222-/**
4223- * Get client port.
4224- */
4225-GEARMAN_API
4226-const char *gearman_server_con_port(gearman_server_con_st *con);
4227-
4228-/**
4229- * Set client port.
4230- */
4231-GEARMAN_API
4232-void gearman_server_con_set_port(gearman_server_con_st *con, const char *port);
4233-
4234-/**
4235- * Get client id.
4236- */
4237-GEARMAN_API
4238-const char *gearman_server_con_id(gearman_server_con_st *con);
4239-
4240-/**
4241- * Set client id.
4242- */
4243-GEARMAN_API
4244-void gearman_server_con_set_id(gearman_server_con_st *con, char *id,
4245- size_t size);
4246-
4247-/**
4248- * Free server worker struction with name for a server connection.
4249- */
4250-GEARMAN_API
4251-void gearman_server_con_free_worker(gearman_server_con_st *con,
4252- char *function_name,
4253- size_t function_name_size);
4254-
4255-/**
4256- * Free all server worker structures for a server connection.
4257- */
4258-GEARMAN_API
4259-void gearman_server_con_free_workers(gearman_server_con_st *con);
4260-
4261-/**
4262- * Add connection to the io thread list.
4263- */
4264-GEARMAN_API
4265-void gearman_server_con_io_add(gearman_server_con_st *con);
4266-
4267-/**
4268- * Remove connection from the io thread list.
4269- */
4270-GEARMAN_API
4271-void gearman_server_con_io_remove(gearman_server_con_st *con);
4272-
4273-/**
4274- * Get next connection from the io thread list.
4275- */
4276-GEARMAN_API
4277-gearman_server_con_st *
4278-gearman_server_con_io_next(gearman_server_thread_st *thread);
4279-
4280-/**
4281- * Add connection to the proc thread list.
4282- */
4283-GEARMAN_API
4284-void gearman_server_con_proc_add(gearman_server_con_st *con);
4285-
4286-/**
4287- * Remove connection from the proc thread list.
4288- */
4289-GEARMAN_API
4290-void gearman_server_con_proc_remove(gearman_server_con_st *con);
4291-
4292-/**
4293- * Get next connection from the proc thread list.
4294- */
4295-GEARMAN_API
4296-gearman_server_con_st *
4297-gearman_server_con_proc_next(gearman_server_thread_st *thread);
4298-
4299 /** @} */
4300
4301-#ifdef __cplusplus
4302-}
4303-#endif
4304-
4305 #endif /* __GEARMAN_SERVER_CON_H__ */
4306
4307=== modified file 'libgearman-server/constants.h'
4308--- libgearman-server/constants.h 2010-04-06 19:40:28 +0000
4309+++ libgearman-server/constants.h 2010-07-01 01:31:26 +0000
4310@@ -1,4 +1,5 @@
4311 /* Gearman server and library
4312+ * Copyright (C) 2010 Data Differential
4313 * Copyright (C) 2008 Brian Aker, Eric Day
4314 * All rights reserved.
4315 *
4316@@ -14,10 +15,6 @@
4317 #ifndef __GEARMAN_SERVER_CONSTANTS_H__
4318 #define __GEARMAN_SERVER_CONSTANTS_H__
4319
4320-#ifdef __cplusplus
4321-extern "C" {
4322-#endif
4323-
4324 /**
4325 * @addtogroup gearman_server_constants Constants
4326 * @ingroup gearman_server
4327@@ -70,13 +67,13 @@
4328 typedef struct gearman_server_client_st gearman_server_client_st;
4329 typedef struct gearman_server_worker_st gearman_server_worker_st;
4330 typedef struct gearman_server_job_st gearman_server_job_st;
4331-typedef struct gearmand_st gearmand_st;
4332 typedef struct gearmand_port_st gearmand_port_st;
4333 typedef struct gearmand_con_st gearmand_con_st;
4334 typedef struct gearmand_thread_st gearmand_thread_st;
4335 typedef struct gearman_conf_st gearman_conf_st;
4336 typedef struct gearman_conf_option_st gearman_conf_option_st;
4337 typedef struct gearman_conf_module_st gearman_conf_module_st;
4338+struct gearmand_st;
4339
4340 /* Function types. */
4341 typedef void (gearman_server_thread_run_fn)(gearman_server_thread_st *thread,
4342@@ -91,35 +88,9 @@
4343 const void *data,
4344 size_t data_size,
4345 gearman_job_priority_t priority);
4346-typedef gearman_return_t (gearman_queue_flush_fn)(gearman_server_st *server,
4347- void *context);
4348-typedef gearman_return_t (gearman_queue_done_fn)(gearman_server_st *server,
4349- void *context,
4350- const void *unique,
4351- size_t unique_size,
4352- const void *function_name,
4353- size_t function_name_size);
4354-typedef gearman_return_t (gearman_queue_replay_fn)(gearman_server_st *server,
4355- void *context,
4356- gearman_queue_add_fn *add_fn,
4357- void *add_context);
4358
4359 typedef gearman_return_t (gearman_connection_add_fn)(gearman_connection_st *con);
4360
4361 /** @} */
4362
4363-/**
4364- * @addtogroup gearman_server_protocol Protocol Plugins
4365- * @ingroup gearman_server
4366- */
4367-
4368-/**
4369- * @addtogroup gearman_server_queue Queue Plugins
4370- * @ingroup gearman_server
4371- */
4372-
4373-#ifdef __cplusplus
4374-}
4375-#endif
4376-
4377 #endif /* __GEARMAN_SERVER_CONSTANTS_H__ */
4378
4379=== renamed file 'libgearman-server/function.c' => 'libgearman-server/function.cc'
4380--- libgearman-server/function.c 2010-04-06 21:41:46 +0000
4381+++ libgearman-server/function.cc 2010-07-01 01:31:26 +0000
4382@@ -1,4 +1,5 @@
4383 /* Gearman server and library
4384+ * Copyright (C) 2010 Data Differential
4385 * Copyright (C) 2008 Brian Aker, Eric Day
4386 * All rights reserved.
4387 *
4388@@ -11,33 +12,55 @@
4389 * @brief Server function definitions
4390 */
4391
4392-#include "common.h"
4393+#include "libgearman-server/common.h"
4394
4395 /*
4396 * Public definitions
4397 */
4398
4399+gearman_server_function_st::gearman_server_function_st(gearman_server_st *server_arg,
4400+ const std::string &function_name_arg) :
4401+ worker_count(0),
4402+ job_count(0),
4403+ job_total(0),
4404+ job_running(0),
4405+ max_queue_size(GEARMAN_DEFAULT_MAX_QUEUE_SIZE),
4406+ server(server_arg),
4407+ next(NULL),
4408+ prev(NULL),
4409+ function_name(function_name_arg),
4410+ worker_list(NULL)
4411+{
4412+ memset(job_list, 0, sizeof(gearman_server_job_st *) * GEARMAN_JOB_PRIORITY_MAX);
4413+ memset(job_end, 0, sizeof(gearman_server_job_st *) * GEARMAN_JOB_PRIORITY_MAX);
4414+}
4415+
4416+gearman_server_function_st::~gearman_server_function_st()
4417+{
4418+}
4419+
4420 gearman_server_function_st *
4421-gearman_server_function_get(gearman_server_st *server,
4422- const char *function_name,
4423- size_t function_name_size)
4424+gearman_server_st::function_get(const std::string &function_name_arg)
4425 {
4426 gearman_server_function_st *function;
4427
4428- for (function= server->function_list; function != NULL;
4429+ if (function_name_arg.empty())
4430+ return NULL;
4431+
4432+ for (function= function_list; function != NULL;
4433 function= function->next)
4434 {
4435- if (function->function_name_size == function_name_size &&
4436- !memcmp(function->function_name, function_name, function_name_size))
4437+ if (not function->function_name.compare(function_name_arg))
4438 {
4439 return function;
4440 }
4441 }
4442
4443- function= gearman_server_function_create(server, NULL);
4444+ function= gearman_server_function_create(this, function_name_arg);
4445 if (function == NULL)
4446 return NULL;
4447
4448+<<<<<<< TREE
4449 function->function_name= (char *)malloc(function_name_size + 1);
4450 if (function->function_name == NULL)
4451 {
4452@@ -49,13 +72,15 @@
4453 function->function_name[function_name_size]= 0;
4454 function->function_name_size= function_name_size;
4455
4456+=======
4457+>>>>>>> MERGE-SOURCE
4458 return function;
4459 }
4460
4461-gearman_server_function_st *
4462-gearman_server_function_create(gearman_server_st *server,
4463- gearman_server_function_st *function)
4464+gearman_server_function_st *gearman_server_function_create(gearman_server_st *server,
4465+ const std::string &function_name)
4466 {
4467+<<<<<<< TREE
4468 if (function == NULL)
4469 {
4470 function= (gearman_server_function_st *)malloc(sizeof(gearman_server_function_st));
4471@@ -76,24 +101,20 @@
4472 function->max_queue_size= GEARMAN_DEFAULT_MAX_QUEUE_SIZE;
4473 function->function_name_size= 0;
4474 function->server= server;
4475+=======
4476+ gearman_server_function_st *function;
4477+
4478+ function= new gearman_server_function_st(server, function_name);
4479+
4480+>>>>>>> MERGE-SOURCE
4481 GEARMAN_LIST_ADD(server->function, function,)
4482- function->function_name= NULL;
4483- function->worker_list= NULL;
4484- memset(function->job_list, 0,
4485- sizeof(gearman_server_job_st *) * GEARMAN_JOB_PRIORITY_MAX);
4486- memset(function->job_end, 0,
4487- sizeof(gearman_server_job_st *) * GEARMAN_JOB_PRIORITY_MAX);
4488
4489 return function;
4490 }
4491
4492 void gearman_server_function_free(gearman_server_function_st *function)
4493 {
4494- if (function->function_name != NULL)
4495- free(function->function_name);
4496-
4497- GEARMAN_LIST_DEL(function->server->function, function,)
4498-
4499- if (function->options.allocated)
4500- free(function);
4501+ GEARMAN_LIST_DEL(function->server->function, function,);
4502+
4503+ delete function;
4504 }
4505
4506=== modified file 'libgearman-server/function.h'
4507--- libgearman-server/function.h 2010-03-11 19:52:09 +0000
4508+++ libgearman-server/function.h 2010-07-01 01:31:26 +0000
4509@@ -1,4 +1,5 @@
4510 /* Gearman server and library
4511+ * Copyright (C) 2010 Data Differential
4512 * Copyright (C) 2008 Brian Aker, Eric Day
4513 * All rights reserved.
4514 *
4515@@ -14,9 +15,7 @@
4516 #ifndef __GEARMAN_SERVER_FUNCTION_H__
4517 #define __GEARMAN_SERVER_FUNCTION_H__
4518
4519-#ifdef __cplusplus
4520-extern "C" {
4521-#endif
4522+#include <string>
4523
4524 /**
4525 * @addtogroup gearman_server_function Function Declarations
4526@@ -41,32 +40,24 @@
4527 uint32_t job_total;
4528 uint32_t job_running;
4529 uint32_t max_queue_size;
4530- size_t function_name_size;
4531 gearman_server_st *server;
4532 gearman_server_function_st *next;
4533 gearman_server_function_st *prev;
4534- char *function_name;
4535+ std::string function_name;
4536 gearman_server_worker_st *worker_list;
4537 gearman_server_job_st *job_list[GEARMAN_JOB_PRIORITY_MAX];
4538 gearman_server_job_st *job_end[GEARMAN_JOB_PRIORITY_MAX];
4539+
4540+ gearman_server_function_st(gearman_server_st *server, const std::string &function_name_arg);
4541+ ~gearman_server_function_st();
4542 };
4543
4544 /**
4545- * Add a new function to a server instance.
4546- */
4547-GEARMAN_API
4548-gearman_server_function_st *
4549-gearman_server_function_get(gearman_server_st *server,
4550- const char *function_name,
4551- size_t function_name_size);
4552-
4553-/**
4554 * Initialize a server function structure.
4555 */
4556 GEARMAN_API
4557 gearman_server_function_st *
4558-gearman_server_function_create(gearman_server_st *server,
4559- gearman_server_function_st *function);
4560+gearman_server_function_create(gearman_server_st *server, const std::string &function_name_arg);
4561
4562 /**
4563 * Free a server function structure.
4564@@ -76,8 +67,4 @@
4565
4566 /** @} */
4567
4568-#ifdef __cplusplus
4569-}
4570-#endif
4571-
4572 #endif /* __GEARMAN_SERVER_FUNCTION_H__ */
4573
4574=== renamed file 'libgearman-server/gearmand.c' => 'libgearman-server/gearmand.cc'
4575--- libgearman-server/gearmand.c 2010-04-06 21:41:46 +0000
4576+++ libgearman-server/gearmand.cc 2010-07-01 01:31:26 +0000
4577@@ -1,4 +1,5 @@
4578 /* Gearman server and library
4579+ * Copyright (C) 2010 Data Differential
4580 * Copyright (C) 2008 Brian Aker, Eric Day
4581 * All rights reserved.
4582 *
4583@@ -11,43 +12,14 @@
4584 * @brief Gearmand Definitions
4585 */
4586
4587-#include "common.h"
4588+#include "libgearman-server/common.h"
4589 #include "gearmand.h"
4590
4591 /*
4592- * Private declarations
4593- */
4594-
4595-/**
4596- * @addtogroup gearmand_private Private Gearman Daemon Functions
4597- * @ingroup gearmand
4598- * @{
4599- */
4600-
4601-static void _log(const char *line, gearman_verbose_t verbose, void *context);
4602-
4603-static gearman_return_t _listen_init(gearmand_st *gearmand);
4604-static void _listen_close(gearmand_st *gearmand);
4605-static gearman_return_t _listen_watch(gearmand_st *gearmand);
4606-static void _listen_clear(gearmand_st *gearmand);
4607-static void _listen_event(int fd, short events, void *arg);
4608-
4609-static gearman_return_t _wakeup_init(gearmand_st *gearmand);
4610-static void _wakeup_close(gearmand_st *gearmand);
4611-static gearman_return_t _wakeup_watch(gearmand_st *gearmand);
4612-static void _wakeup_clear(gearmand_st *gearmand);
4613-static void _wakeup_event(int fd, short events, void *arg);
4614-
4615-static gearman_return_t _watch_events(gearmand_st *gearmand);
4616-static void _clear_events(gearmand_st *gearmand);
4617-static void _close_events(gearmand_st *gearmand);
4618-
4619-/** @} */
4620-
4621-/*
4622 * Public definitions
4623 */
4624
4625+<<<<<<< TREE
4626 gearmand_st *gearmand_create(const char *host, in_port_t port)
4627 {
4628 gearmand_st *gearmand;
4629@@ -82,10 +54,33 @@
4630 gearmand->thread_list= NULL;
4631 gearmand->thread_add_next= NULL;
4632 gearmand->free_dcon_list= NULL;
4633+=======
4634+static in_port_t global_port= 0;
4635+
4636+in_port_t libgearmand_server_port()
4637+{
4638+ return global_port;
4639+}
4640+
4641+gearmand_st::gearmand_st(const char *host_arg,
4642+ in_port_t port,
4643+ uint32_t threads_arg) :
4644+ ret(GEARMAN_SUCCESS),
4645+ backlog(0),
4646+ is_listen_event(false),
4647+ threads(threads_arg),
4648+ host(0),
4649+ base(0),
4650+ port_list(0),
4651+ thread_add_next(0)
4652+{
4653+ host= host_arg;
4654+>>>>>>> MERGE-SOURCE
4655
4656 if (port == 0)
4657 port= GEARMAN_DEFAULT_TCP_PORT;
4658
4659+<<<<<<< TREE
4660 if (gearmand_port_add(gearmand, port, NULL) != GEARMAN_SUCCESS)
4661 {
4662 gearmand_free(gearmand);
4663@@ -188,109 +183,137 @@
4664
4665 gearmand->port_list= port_list;
4666 gearmand->port_count++;
4667+=======
4668+ global_port= port;
4669+
4670+ port_add(port);
4671+}
4672+
4673+gearmand_st::~gearmand_st()
4674+{
4675+ _close_events();
4676+
4677+ Log::Instance()->info("Stopping Services");
4678+
4679+ Services::Instance()->stop();
4680+
4681+ thread_add_next= thread_list.end();
4682+
4683+ if (thread_list.size())
4684+ {
4685+ Log::Instance()->info("Shutting down all threads");
4686+ }
4687+ for (std::vector<ThreadPtr>::iterator iter= thread_list.begin();
4688+ iter != thread_list.end();
4689+ iter++)
4690+ {
4691+ delete *iter;
4692+ }
4693+ thread_list.clear();
4694+
4695+ if (base != NULL)
4696+ event_base_free(base);
4697+
4698+ port_list.clear();
4699+
4700+ Log::Instance()->info("Shutdown complete");
4701+}
4702+
4703+gearman_return_t gearmand_st::port_add(in_port_t port,
4704+ gearman_connection_add_fn *function,
4705+ Protocol *protocol)
4706+{
4707+ PortPtr new_port(new gearmand_port_st(this, port, function, protocol));
4708+
4709+ port_list.push_back(new_port);
4710+>>>>>>> MERGE-SOURCE
4711
4712 return GEARMAN_SUCCESS;
4713 }
4714
4715-gearman_return_t gearmand_run(gearmand_st *gearmand)
4716+gearman_return_t gearmand_st::run()
4717 {
4718- uint32_t x;
4719
4720 /* Initialize server components. */
4721- if (gearmand->base == NULL)
4722+ if (base == NULL)
4723 {
4724- gearmand_log_info(gearmand, "Starting up");
4725+ Log::Instance()->info("Starting up");
4726
4727- if (gearmand->threads > 0)
4728+ if (threads > 0)
4729 {
4730 #ifndef HAVE_EVENT_BASE_NEW
4731- gearmand_log_fatal(gearmand, "Multi-threaded gearmand requires libevent 1.4 or later, libevent 1.3 does not provided a "
4732- "thread-safe interface.");
4733+ Log::Instance()->fatal("Multi-threaded gearmand requires libevent 1.4 or later, libevent 1.3 does not provided a "
4734+ "thread-safe interface.");
4735 return GEARMAN_EVENT;
4736-#else
4737- /* Set the number of free connection structures each thread should keep
4738- around before the main thread is forced to take them. We compute this
4739- here so we don't need to on every new connection. */
4740- gearmand->max_thread_free_dcon_count= ((GEARMAN_MAX_FREE_SERVER_CON /
4741- gearmand->threads) / 2);
4742 #endif
4743 }
4744
4745- gearmand_log_debug(gearmand, "Initializing libevent for main thread");
4746+ Log::Instance()->debug("Initializing libevent for main thread");
4747
4748- gearmand->base= event_base_new();
4749- if (gearmand->base == NULL)
4750+ base= event_base_new();
4751+ if (base == NULL)
4752 {
4753- gearmand_log_fatal(gearmand, "gearmand_run:event_base_new:NULL");
4754+ Log::Instance()->fatal("gearmand_run:event_base_new:NULL");
4755 return GEARMAN_EVENT;
4756 }
4757
4758- gearmand_log_debug(gearmand, "Method for libevent: %s",
4759- event_base_get_method(gearmand->base));
4760-
4761- gearmand->ret= _listen_init(gearmand);
4762- if (gearmand->ret != GEARMAN_SUCCESS)
4763- return gearmand->ret;
4764-
4765- gearmand->ret= _wakeup_init(gearmand);
4766- if (gearmand->ret != GEARMAN_SUCCESS)
4767- return gearmand->ret;
4768-
4769- gearmand_log_debug(gearmand, "Creating %u threads", gearmand->threads);
4770+ Log::Instance()->debug("Method for libevent: %s", event_base_get_method(base));
4771+
4772+ ret= _listen_init();
4773+ if (ret != GEARMAN_SUCCESS)
4774+ return ret;
4775+
4776+ ret= _wakeup_init(base);
4777+ if (ret != GEARMAN_SUCCESS)
4778+ return ret;
4779+
4780+ Log::Instance()->debug("Creating %u threads", threads);
4781
4782 /* If we have 0 threads we still need to create a fake one for context. */
4783- x= 0;
4784+ uint32_t x= 0;
4785 do
4786 {
4787- gearmand->ret= gearmand_thread_create(gearmand);
4788- if (gearmand->ret != GEARMAN_SUCCESS)
4789- return gearmand->ret;
4790+ ThreadPtr thread(new gearmand_thread_st(this));
4791+ thread_list.push_back(thread);
4792+
4793+ if (ret != GEARMAN_SUCCESS)
4794+ return ret;
4795 x++;
4796- }
4797- while (x < gearmand->threads);
4798-
4799- gearmand->ret= gearman_server_queue_replay(&(gearmand->server));
4800- if (gearmand->ret != GEARMAN_SUCCESS)
4801- return gearmand->ret;
4802+ } while (x < threads);
4803+
4804+ thread_add_next= thread_list.end();
4805+
4806+ ret= server.queue_replay();
4807+ if (ret != GEARMAN_SUCCESS)
4808+ return ret;
4809 }
4810
4811- gearmand->ret= _watch_events(gearmand);
4812- if (gearmand->ret != GEARMAN_SUCCESS)
4813- return gearmand->ret;
4814-
4815- gearmand_log_info(gearmand, "Entering main event loop");
4816-
4817- if (event_base_loop(gearmand->base, 0) == -1)
4818+ ret= _watch_events();
4819+ if (ret != GEARMAN_SUCCESS)
4820+ return ret;
4821+
4822+ Log::Instance()->info("Starting Services");
4823+
4824+ Services::Instance()->start();
4825+
4826+ Log::Instance()->info("Entering main event loop");
4827+
4828+ if (event_base_loop(base, 0) == -1)
4829 {
4830- gearmand_log_fatal(gearmand, "gearmand_run:event_base_loop:-1");
4831+ Log::Instance()->fatal("gearmand_run:event_base_loop:-1");
4832 return GEARMAN_EVENT;
4833 }
4834
4835- gearmand_log_info(gearmand, "Exited main event loop");
4836-
4837- return gearmand->ret;
4838-}
4839-
4840-void gearmand_wakeup(gearmand_st *gearmand, gearmand_wakeup_t wakeup)
4841-{
4842- uint8_t buffer= wakeup;
4843-
4844- /* If this fails, there is not much we can really do. This should never fail
4845- though if the main gearmand thread is still active. */
4846- if (write(gearmand->wakeup_fd[1], &buffer, 1) != 1)
4847- gearmand_log_error(gearmand, "gearmand_wakeup:write:%d", errno);
4848-}
4849-
4850-void gearmand_set_round_robin(gearmand_st *gearmand, bool round_robin)
4851-{
4852- gearmand->server.flags.round_robin= round_robin;
4853-}
4854-
4855+ Log::Instance()->info("Exited main event loop");
4856+
4857+ return ret;
4858+}
4859
4860 /*
4861 * Private definitions
4862 */
4863
4864+<<<<<<< TREE
4865 static void _log(const char *line, gearman_verbose_t verbose, void *context)
4866 {
4867 gearmand_st *gearmand= (gearmand_st *)context;
4868@@ -623,21 +646,86 @@
4869 void *arg)
4870 {
4871 gearmand_st *gearmand= (gearmand_st *)arg;
4872+=======
4873+gearman_return_t gearmand_st::_listen_init()
4874+{
4875+ for (std::vector<PortPtr>::iterator iter= port_list.begin();
4876+ iter != port_list.end(); iter++)
4877+ {
4878+ gearman_return_t rc= (*iter)->_listen_init(host, base, backlog);
4879+
4880+ if (rc != GEARMAN_SUCCESS)
4881+ return rc;
4882+ }
4883+
4884+ return GEARMAN_SUCCESS;
4885+}
4886+
4887+void gearmand_st::_listen_close()
4888+{
4889+ _listen_clear();
4890+}
4891+
4892+gearman_return_t gearmand_st::_listen_watch()
4893+{
4894+ if (is_listen_event)
4895+ return GEARMAN_SUCCESS;
4896+
4897+ for (std::vector<PortPtr>::iterator iter= port_list.begin(); iter != port_list.end(); iter++)
4898+ {
4899+
4900+ gearman_return_t rc= (*iter)->_listen_watch();
4901+
4902+ if (rc == GEARMAN_EVENT)
4903+ return GEARMAN_EVENT;
4904+ }
4905+
4906+ is_listen_event= true;
4907+ return GEARMAN_SUCCESS;
4908+}
4909+
4910+void gearmand_st::_listen_clear()
4911+{
4912+ if (! (is_listen_event))
4913+ return;
4914+
4915+ for (std::vector<PortPtr>::iterator iter= port_list.begin(); iter != port_list.end(); iter++)
4916+ {
4917+ (*iter)->_listen_clear();
4918+ }
4919+
4920+ is_listen_event= false;
4921+}
4922+
4923+void gearmand_st::_wake_up_thread_for_shutdown()
4924+{
4925+ for (std::vector<ThreadPtr>::iterator iter= thread_list.begin();
4926+ iter != thread_list.end();
4927+ iter++)
4928+ {
4929+ (*iter)->set_wakeup(GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL);
4930+ }
4931+}
4932+
4933+void gearmand_st::_wakeup_event(int fd, short events __attribute__ ((unused)))
4934+{
4935+ gearmand_st *gearmand= (gearmand_st *)this;
4936+>>>>>>> MERGE-SOURCE
4937 uint8_t buffer[GEARMAN_PIPE_BUFFER_SIZE];
4938- ssize_t ret;
4939- gearmand_thread_st *thread;
4940
4941 while (1)
4942 {
4943- ret= read(fd, buffer, GEARMAN_PIPE_BUFFER_SIZE);
4944- if (ret == 0)
4945+ ssize_t rc;
4946+ rc= read(fd, buffer, GEARMAN_PIPE_BUFFER_SIZE);
4947+ if (rc == 0)
4948 {
4949- _clear_events(gearmand);
4950- gearmand_log_fatal(gearmand, "_wakeup_event:read:EOF");
4951+ gearmand->_clear_events();
4952+ Log::Instance()->fatal("_wakeup_event:read:EOF");
4953 gearmand->ret= GEARMAN_PIPE_EOF;
4954+
4955 return;
4956 }
4957- else if (ret == -1)
4958+ else if (rc == -1)
4959 {
4960 if (errno == EINTR)
4961 continue;
4962@@ -645,46 +733,42 @@
4963 if (errno == EAGAIN)
4964 break;
4965
4966- _clear_events(gearmand);
4967- gearmand_log_fatal(gearmand, "_wakeup_event:read:%d", errno);
4968+ gearmand->_clear_events();
4969+ Log::Instance()->fatal("_wakeup_event:read:%d", errno);
4970 gearmand->ret= GEARMAN_ERRNO;
4971 return;
4972 }
4973
4974- for (ssize_t x= 0; x < ret; x++)
4975+ for (ssize_t x= 0; x < rc; x++)
4976 {
4977 switch ((gearmand_wakeup_t)buffer[x])
4978 {
4979 case GEARMAND_WAKEUP_PAUSE:
4980- gearmand_log_info(gearmand, "Received PAUSE wakeup event");
4981- _clear_events(gearmand);
4982+ Log::Instance()->info("Received PAUSE wakeup event");
4983+ gearmand->_clear_events();
4984 gearmand->ret= GEARMAN_PAUSE;
4985 break;
4986
4987 case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL:
4988- gearmand_log_info(gearmand, "Received SHUTDOWN_GRACEFUL wakeup event");
4989- _listen_close(gearmand);
4990+ Log::Instance()->info("Received SHUTDOWN_GRACEFUL wakeup event");
4991
4992- for (thread= gearmand->thread_list; thread != NULL;
4993- thread= thread->next)
4994- {
4995- gearmand_thread_wakeup(thread, GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL);
4996- }
4997+ gearmand->_listen_close();
4998+ gearmand->_wake_up_thread_for_shutdown();
4999
5000 gearmand->ret= GEARMAN_SHUTDOWN_GRACEFUL;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches